832 lines
2.3 MiB
832 lines
2.3 MiB
define("vs/editor-KLE6jdfb", ["require", "exports","./editorWorkerHost-fVE1cjcC"], (function(require, _,l){"use strict";var Qs,vl,Nh,yl,Ll,Or,os,Pr,Dl,xl,El,Il,Tl,Nl,Rl,Ml,kh,Al,$o,Br,Ol;const eo=new class{constructor(){this._zoomLevel=0,this._onDidChangeZoomLevel=new l.Emitter,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event}getZoomLevel(){return this._zoomLevel}setZoomLevel(o){o=Math.min(Math.max(-5,o),20),this._zoomLevel!==o&&(this._zoomLevel=o,this._onDidChangeZoomLevel.fire(this._zoomLevel))}},DP=l.isMacintosh?1.5:1.35,zb=8;class Ur{static _create(e,t,i,n,s,r,a,c,h){r===0?r=DP*i:r<zb&&(r=r*i),r=Math.round(r),r<zb&&(r=zb);const d=1+(h?0:eo.getZoomLevel()*.1);return i*=d,r*=d,s===TD&&(t==="normal"||t==="bold"?s=ID:(s=`'wght' ${parseInt(t,10)}`,t="normal")),new Ur({pixelRatio:c,fontFamily:e,fontWeight:t,fontSize:i,fontFeatureSettings:n,fontVariationSettings:s,lineHeight:r,letterSpacing:a})}constructor(e){this._bareFontInfoBrand=void 0,this.pixelRatio=e.pixelRatio,this.fontFamily=String(e.fontFamily),this.fontWeight=String(e.fontWeight),this.fontSize=e.fontSize,this.fontFeatureSettings=e.fontFeatureSettings,this.fontVariationSettings=e.fontVariationSettings,this.lineHeight=e.lineHeight|0,this.letterSpacing=e.letterSpacing}getId(){return`${this.pixelRatio}-${this.fontFamily}-${this.fontWeight}-${this.fontSize}-${this.fontFeatureSettings}-${this.fontVariationSettings}-${this.lineHeight}-${this.letterSpacing}`}getMassagedFontFamily(){const e=Zi.fontFamily,t=Ur._wrapInQuotes(this.fontFamily);return this.fontFamily!==e?`${t}, ${e}`:t}static _wrapInQuotes(e){return/[,"']/.test(e)?e:/[+ ]/.test(e)?`"${e}"`:e}}const xP=2;class Af extends Ur{constructor(e,t){super(e),this._editorStylingBrand=void 0,this.version=xP,this.isTrusted=t,this.isMonospace=e.isMonospace,this.typicalHalfwidthCharacterWidth=e.typicalHalfwidthCharacterWidth,this.typicalFullwidthCharacterWidth=e.typicalFullwidthCharacterWidth,this.canUseHalfwidthRightwardsArrow=e.canUseHalfwidthRightwardsArrow,this.spaceWidth=e.spaceWidth,this.middotWidth=e.middotWidth,this.wsmiddotWidth=e.wsmiddotWidth,this.maxDigitWidth=e.maxDigitWidth}equals(e){return this.fontFamily===e.fontFamily&&this.fontWeight===e.fontWeight&&this.fontSize===e.fontSize&&this.fontFeatureSettings===e.fontFeatureSettings&&this.fontVariationSettings===e.fontVariationSettings&&this.lineHeight===e.lineHeight&&this.letterSpacing===e.letterSpacing&&this.typicalHalfwidthCharacterWidth===e.typicalHalfwidthCharacterWidth&&this.typicalFullwidthCharacterWidth===e.typicalFullwidthCharacterWidth&&this.canUseHalfwidthRightwardsArrow===e.canUseHalfwidthRightwardsArrow&&this.spaceWidth===e.spaceWidth&&this.middotWidth===e.middotWidth&&this.wsmiddotWidth===e.wsmiddotWidth&&this.maxDigitWidth===e.maxDigitWidth}}const ID="normal",TD="translate",Zi={fontFamily:l.isMacintosh?"Menlo, Monaco, 'Courier New', monospace":l.isWindows?"Consolas, 'Courier New', monospace":"'Droid Sans Mono', monospace",fontWeight:"normal",fontSize:l.isMacintosh?12:14,lineHeight:0,letterSpacing:0},zt={tabSize:4,indentSize:4,insertSpaces:!0,detectIndentation:!0,trimAutoWhitespace:!0,largeFileOptimizations:!0,bracketPairColorizationOptions:{enabled:!0,independentColorPoolPerBracketType:!1}},ls=8;class ND{constructor(e){this._values=e}hasChanged(e){return this._values[e]}}class RD{constructor(){this.stableMinimapLayoutInput=null,this.stableFitMaxMinimapScale=0,this.stableFitRemainingWidth=0}}class Ye{constructor(e,t,i,n){this.id=e,this.name=t,this.defaultValue=i,this.schema=n}applyUpdate(e,t){return Of(e,t)}compute(e,t,i){return i}}class Kh{constructor(e,t){this.newValue=e,this.didChange=t}}function Of(o,e){if(typeof o!="object"||typeof e!="object"||!o||!e)return new Kh(e,o!==e);if(Array.isArray(o)||Array.isArray(e)){const i=Array.isArray(o)&&Array.isArray(e)&&l.equals(o,e);return new Kh(e,!i)}let t=!1;for(const i in e)if(e.hasOwnProperty(i)){const n=Of(o[i],e[i]);n.didChange&&(o[i]=n.newValue,t=!0)}return new Kh(o,t)}class Go{constructor(e,t){this.schema=void 0,this.id=e,this.name="_never_",this.defaultValue=t}applyUpdate(e,t){return Of(e,t)}validate(e){return this.defaultValue}}class Fl{constructor(e,t,i,n){this.id=e,this.name=t,this.defaultValue=i,this.schema=n}applyUpdate(e,t){return Of(e,t)}compute(e,t,i){return i}}function $(o,e){return typeof o>"u"?e:o==="false"?!1:!!o}class se extends Fl{constructor(e,t,i,n=void 0){typeof n<"u"&&(n.type="boolean",n.default=i),super(e,t,i,n)}validate(e){return $(e,this.defaultValue)}}function to(o,e,t,i){if(typeof o=="string"&&(o=parseInt(o,10)),typeof o!="number"||isNaN(o))return e;let n=o;return n=Math.max(t,n),n=Math.min(i,n),n|0}class Ie extends Fl{static clampedInt(e,t,i,n){return to(e,t,i,n)}constructor(e,t,i,n,s,r=void 0){typeof r<"u"&&(r.type="integer",r.default=i,r.minimum=n,r.maximum=s),super(e,t,i,r),this.minimum=n,this.maximum=s}validate(e){return Ie.clampedInt(e,this.defaultValue,this.minimum,this.maximum)}}function EP(o,e,t,i){if(typeof o>"u")return e;const n=xi.float(o,e);return xi.clamp(n,t,i)}class xi extends Fl{static clamp(e,t,i){return e<t?t:e>i?i:e}static float(e,t){return typeof e=="string"&&(e=parseFloat(e)),typeof e!="number"||isNaN(e)?t:e}constructor(e,t,i,n,s,r,a){typeof s<"u"&&(s.type="number",s.default=i,s.minimum=r,s.maximum=a),super(e,t,i,s),this.validationFn=n,this.minimum=r,this.maximum=a}validate(e){return this.validationFn(xi.float(e,this.defaultValue))}}class si extends Fl{static string(e,t){return typeof e!="string"?t:e}constructor(e,t,i,n=void 0){typeof n<"u"&&(n.type="string",n.default=i),super(e,t,i,n)}validate(e){return si.string(e,this.defaultValue)}}function Fe(o,e,t,i){return typeof o!="string"?e:i&&o in i?i[o]:t.indexOf(o)===-1?e:o}class Ze extends Fl{constructor(e,t,i,n,s=void 0){typeof s<"u"&&(s.type="string",s.enum=n.slice(0),s.default=i),super(e,t,i,s),this._allowedValues=n}validate(e){return Fe(e,this.defaultValue,this._allowedValues)}}class Gh extends Ye{constructor(e,t,i,n,s,r,a=void 0){typeof a<"u"&&(a.type="string",a.enum=s,a.default=n),super(e,t,i,a),this._allowedValues=s,this._convert=r}validate(e){return typeof e!="string"?this.defaultValue:this._allowedValues.indexOf(e)===-1?this.defaultValue:this._convert(e)}}function IP(o){switch(o){case"none":return 0;case"keep":return 1;case"brackets":return 2;case"advanced":return 3;case"full":return 4}}class TP extends Ye{constructor(){super(2,"accessibilitySupport",0,{type:"string",enum:["auto","on","off"],enumDescriptions:[l.localize(220,"Use platform APIs to detect when a Screen Reader is attached."),l.localize(221,"Optimize for usage with a Screen Reader."),l.localize(222,"Assume a screen reader is not attached.")],default:"auto",tags:["accessibility"],description:l.localize(223,"Controls if the UI should run in a mode where it is optimized for screen readers.")})}validate(e){switch(e){case"auto":return 0;case"off":return 1;case"on":return 2}return this.defaultValue}compute(e,t,i){return i===0?e.accessibilitySupport:i}}class NP extends Ye{constructor(){const e={insertSpace:!0,ignoreEmptyLines:!0};super(29,"comments",e,{"editor.comments.insertSpace":{type:"boolean",default:e.insertSpace,description:l.localize(224,"Controls whether a space character is inserted when commenting.")},"editor.comments.ignoreEmptyLines":{type:"boolean",default:e.ignoreEmptyLines,description:l.localize(225,"Controls if empty lines should be ignored with toggle, add or remove actions for line comments.")}})}validate(e){if(!e||typeof e!="object")return this.defaultValue;const t=e;return{insertSpace:$(t.insertSpace,this.defaultValue.insertSpace),ignoreEmptyLines:$(t.ignoreEmptyLines,this.defaultValue.ignoreEmptyLines)}}}function RP(o){switch(o){case"blink":return 1;case"smooth":return 2;case"phase":return 3;case"expand":return 4;case"solid":return 5}}var vt;(function(o){o[o.Line=1]="Line",o[o.Block=2]="Block",o[o.Underline=3]="Underline",o[o.LineThin=4]="LineThin",o[o.BlockOutline=5]="BlockOutline",o[o.UnderlineThin=6]="UnderlineThin"})(vt||(vt={}));function MD(o){switch(o){case"line":return vt.Line;case"block":return vt.Block;case"underline":return vt.Underline;case"line-thin":return vt.LineThin;case"block-outline":return vt.BlockOutline;case"underline-thin":return vt.UnderlineThin}}class MP extends Go{constructor(){super(162,"")}compute(e,t,i){const n=["monaco-editor"];return t.get(48)&&n.push(t.get(48)),e.extraEditorClassName&&n.push(e.extraEditorClassName),t.get(82)==="default"?n.push("mouse-default"):t.get(82)==="copy"&&n.push("mouse-copy"),t.get(127)&&n.push("showUnused"),t.get(157)&&n.push("showDeprecated"),n.join(" ")}}class AP extends se{constructor(){super(45,"emptySelectionClipboard",!0,{description:l.localize(226,"Controls whether copying without a selection copies the current line.")})}compute(e,t,i){return i&&e.emptySelectionClipboard}}class OP extends Ye{constructor(){const e={cursorMoveOnType:!0,findOnType:!0,seedSearchStringFromSelection:"always",autoFindInSelection:"never",globalFindClipboard:!1,addExtraSpaceOnTop:!0,loop:!0,closeOnResult:!1,history:"workspace",replaceHistory:"workspace"};super(50,"find",e,{"editor.find.cursorMoveOnType":{type:"boolean",default:e.cursorMoveOnType,description:l.localize(227,"Controls whether the cursor should jump to find matches while typing.")},"editor.find.seedSearchStringFromSelection":{type:"string",enum:["never","always","selection"],default:e.seedSearchStringFromSelection,enumDescriptions:[l.localize(228,"Never seed search string from the editor selection."),l.localize(229,"Always seed search string from the editor selection, including word at cursor position."),l.localize(230,"Only seed search string from the editor selection.")],description:l.localize(231,"Controls whether the search string in the Find Widget is seeded from the editor selection.")},"editor.find.autoFindInSelection":{type:"string",enum:["never","always","multiline"],default:e.autoFindInSelection,enumDescriptions:[l.localize(232,"Never turn on Find in Selection automatically (default)."),l.localize(233,"Always turn on Find in Selection automatically."),l.localize(234,"Turn on Find in Selection automatically when multiple lines of content are selected.")],description:l.localize(235,"Controls the condition for turning on Find in Selection automatically.")},"editor.find.globalFindClipboard":{type:"boolean",default:e.globalFindClipboard,description:l.localize(236,"Controls whether the Find Widget should read or modify the shared find clipboard on macOS."),included:l.isMacintosh},"editor.find.addExtraSpaceOnTop":{type:"boolean",default:e.addExtraSpaceOnTop,description:l.localize(237,"Controls whether the Find Widget should add extra lines on top of the editor. When true, you can scroll beyond the first line when the Find Widget is visible.")},"editor.find.loop":{type:"boolean",default:e.loop,description:l.localize(238,"Controls whether the search automatically restarts from the beginning (or the end) when no further matches can be found.")},"editor.find.closeOnResult":{type:"boolean",default:e.closeOnResult,description:l.localize(239,"Controls whether the Find Widget closes after an explicit find navigation command lands on a result.")},"editor.find.history":{type:"string",enum:["never","workspace"],default:"workspace",enumDescriptions:[l.localize(240,"Do not store search history from the find widget."),l.localize(241,"Store search history across the active workspace")],description:l.localize(242,"Controls how the find widget history should be stored")},"editor.find.replaceHistory":{type:"string",enum:["never","workspace"],default:"workspace",enumDescriptions:[l.localize(243,"Do not store history from the replace widget."),l.localize(244,"Store replace history across the active workspace")],description:l.localize(245,"Controls how the replace widget history should be stored")},"editor.find.findOnType":{type:"boolean",default:e.findOnType,description:l.localize(246,"Controls whether the Find Widget should search as you type.")}})}validate(e){if(!e||typeof e!="object")return this.defaultValue;const t=e;return{cursorMoveOnType:$(t.cursorMoveOnType,this.defaultValue.cursorMoveOnType),findOnType:$(t.findOnType,this.defaultValue.findOnType),seedSearchStringFromSelection:typeof t.seedSearchStringFromSelection=="boolean"?t.seedSearchStringFromSelection?"always":"never":Fe(t.seedSearchStringFromSelection,this.defaultValue.seedSearchStringFromSelection,["never","always","selection"]),autoFindInSelection:typeof t.autoFindInSelection=="boolean"?t.autoFindInSelection?"always":"never":Fe(t.autoFindInSelection,this.defaultValue.autoFindInSelection,["never","always","multiline"]),globalFindClipboard:$(t.globalFindClipboard,this.defaultValue.globalFindClipboard),addExtraSpaceOnTop:$(t.addExtraSpaceOnTop,this.defaultValue.addExtraSpaceOnTop),loop:$(t.loop,this.defaultValue.loop),closeOnResult:$(t.closeOnResult,this.defaultValue.closeOnResult),history:Fe(t.history,this.defaultValue.history,["never","workspace"]),replaceHistory:Fe(t.replaceHistory,this.defaultValue.replaceHistory,["never","workspace"])}}}const ko=class ko extends Ye{constructor(){super(60,"fontLigatures",ko.OFF,{anyOf:[{type:"boolean",description:l.localize(247,"Enables/Disables font ligatures ('calt' and 'liga' font features). Change this to a string for fine-grained control of the 'font-feature-settings' CSS property.")},{type:"string",description:l.localize(248,"Explicit 'font-feature-settings' CSS property. A boolean can be passed instead if one only needs to turn on/off ligatures.")}],description:l.localize(249,"Configures font ligatures or font features. Can be either a boolean to enable/disable ligatures or a string for the value of the CSS 'font-feature-settings' property."),default:!1})}validate(e){return typeof e>"u"?this.defaultValue:typeof e=="string"?e==="false"||e.length===0?ko.OFF:e==="true"?ko.ON:e:e?ko.ON:ko.OFF}};ko.OFF='"liga" off, "calt" off',ko.ON='"liga" on, "calt" on';let io=ko;const Fo=class Fo extends Ye{constructor(){super(63,"fontVariations",Fo.OFF,{anyOf:[{type:"boolean",description:l.localize(250,"Enables/Disables the translation from font-weight to font-variation-settings. Change this to a string for fine-grained control of the 'font-variation-settings' CSS property.")},{type:"string",description:l.localize(251,"Explicit 'font-variation-settings' CSS property. A boolean can be passed instead if one only needs to translate font-weight to font-variation-settings.")}],description:l.localize(252,"Configures font variations. Can be either a boolean to enable/disable the translation from font-weight to font-variation-settings or a string for the value of the CSS 'font-variation-settings' property."),default:!1})}validate(e){return typeof e>"u"?this.defaultValue:typeof e=="string"?e==="false"?Fo.OFF:e==="true"?Fo.TRANSLATE:e:e?Fo.TRANSLATE:Fo.OFF}compute(e,t,i){return e.fontInfo.fontVariationSettings}};Fo.OFF=ID,Fo.TRANSLATE=TD;let Vb=Fo;class PP extends Go{constructor(){super(59,new Af({pixelRatio:0,fontFamily:"",fontWeight:"",fontSize:0,fontFeatureSettings:"",fontVariationSettings:"",lineHeight:0,letterSpacing:0,isMonospace:!1,typicalHalfwidthCharacterWidth:0,typicalFullwidthCharacterWidth:0,canUseHalfwidthRightwardsArrow:!1,spaceWidth:0,middotWidth:0,wsmiddotWidth:0,maxDigitWidth:0},!1))}compute(e,t,i){return e.fontInfo}}class kP extends Go{constructor(){super(161,vt.Line)}compute(e,t,i){return e.inputMode==="overtype"?t.get(92):t.get(34)}}class FP extends Go{constructor(){super(170,!1)}compute(e,t){return e.editContextSupported&&t.get(44)}}class BP extends Go{constructor(){super(172,!1)}compute(e,t){return e.accessibilitySupport===2?t.get(7):t.get(6)}}class zP extends Fl{constructor(){super(61,"fontSize",Zi.fontSize,{type:"number",minimum:6,maximum:100,default:Zi.fontSize,description:l.localize(253,"Controls the font size in pixels.")})}validate(e){const t=xi.float(e,this.defaultValue);return t===0?Zi.fontSize:xi.clamp(t,6,100)}compute(e,t,i){return e.fontInfo.fontSize}}const Zs=class Zs extends Ye{constructor(){super(62,"fontWeight",Zi.fontWeight,{anyOf:[{type:"number",minimum:Zs.MINIMUM_VALUE,maximum:Zs.MAXIMUM_VALUE,errorMessage:l.localize(254,'Only "normal" and "bold" keywords or numbers between 1 and 1000 are allowed.')},{type:"string",pattern:"^(normal|bold|1000|[1-9][0-9]{0,2})$"},{enum:Zs.SUGGESTION_VALUES}],default:Zi.fontWeight,description:l.localize(255,'Controls the font weight. Accepts "normal" and "bold" keywords or numbers between 1 and 1000.')})}validate(e){return e==="normal"||e==="bold"?e:String(Ie.clampedInt(e,Zi.fontWeight,Zs.MINIMUM_VALUE,Zs.MAXIMUM_VALUE))}};Zs.SUGGESTION_VALUES=["normal","bold","100","200","300","400","500","600","700","800","900"],Zs.MINIMUM_VALUE=1,Zs.MAXIMUM_VALUE=1e3;let Ub=Zs;class VP extends Ye{constructor(){const e={multiple:"peek",multipleDefinitions:"peek",multipleTypeDefinitions:"peek",multipleDeclarations:"peek",multipleImplementations:"peek",multipleReferences:"peek",multipleTests:"peek",alternativeDefinitionCommand:"editor.action.goToReferences",alternativeTypeDefinitionCommand:"editor.action.goToReferences",alternativeDeclarationCommand:"editor.action.goToReferences",alternativeImplementationCommand:"",alternativeReferenceCommand:"",alternativeTestsCommand:""},t={type:"string",enum:["peek","gotoAndPeek","goto"],default:e.multiple,enumDescriptions:[l.localize(256,"Show Peek view of the results (default)"),l.localize(257,"Go to the primary result and show a Peek view"),l.localize(258,"Go to the primary result and enable Peek-less navigation to others")]},i=["","editor.action.referenceSearch.trigger","editor.action.goToReferences","editor.action.peekImplementation","editor.action.goToImplementation","editor.action.peekTypeDefinition","editor.action.goToTypeDefinition","editor.action.peekDeclaration","editor.action.revealDeclaration","editor.action.peekDefinition","editor.action.revealDefinitionAside","editor.action.revealDefinition"];super(67,"gotoLocation",e,{"editor.gotoLocation.multiple":{deprecationMessage:l.localize(259,"This setting is deprecated, please use separate settings like 'editor.editor.gotoLocation.multipleDefinitions' or 'editor.editor.gotoLocation.multipleImplementations' instead.")},"editor.gotoLocation.multipleDefinitions":{description:l.localize(260,"Controls the behavior the 'Go to Definition'-command when multiple target locations exist."),...t},"editor.gotoLocation.multipleTypeDefinitions":{description:l.localize(261,"Controls the behavior the 'Go to Type Definition'-command when multiple target locations exist."),...t},"editor.gotoLocation.multipleDeclarations":{description:l.localize(262,"Controls the behavior the 'Go to Declaration'-command when multiple target locations exist."),...t},"editor.gotoLocation.multipleImplementations":{description:l.localize(263,"Controls the behavior the 'Go to Implementations'-command when multiple target locations exist."),...t},"editor.gotoLocation.multipleReferences":{description:l.localize(264,"Controls the behavior the 'Go to References'-command when multiple target locations exist."),...t},"editor.gotoLocation.alternativeDefinitionCommand":{type:"string",default:e.alternativeDefinitionCommand,enum:i,description:l.localize(265,"Alternative command id that is being executed when the result of 'Go to Definition' is the current location.")},"editor.gotoLocation.alternativeTypeDefinitionCommand":{type:"string",default:e.alternativeTypeDefinitionCommand,enum:i,description:l.localize(266,"Alternative command id that is being executed when the result of 'Go to Type Definition' is the current location.")},"editor.gotoLocation.alternativeDeclarationCommand":{type:"string",default:e.alternativeDeclarationCommand,enum:i,description:l.localize(267,"Alternative command id that is being executed when the result of 'Go to Declaration' is the current location.")},"editor.gotoLocation.alternativeImplementationCommand":{type:"string",default:e.alternativeImplementationCommand,enum:i,description:l.localize(268,"Alternative command id that is being executed when the result of 'Go to Implementation' is the current location.")},"editor.gotoLocation.alternativeReferenceCommand":{type:"string",default:e.alternativeReferenceCommand,enum:i,description:l.localize(269,"Alternative command id that is being executed when the result of 'Go to Reference' is the current location.")}})}validate(e){if(!e||typeof e!="object")return this.defaultValue;const t=e;return{multiple:Fe(t.multiple,this.defaultValue.multiple,["peek","gotoAndPeek","goto"]),multipleDefinitions:Fe(t.multipleDefinitions,"peek",["peek","gotoAndPeek","goto"]),multipleTypeDefinitions:Fe(t.multipleTypeDefinitions,"peek",["peek","gotoAndPeek","goto"]),multipleDeclarations:Fe(t.multipleDeclarations,"peek",["peek","gotoAndPeek","goto"]),multipleImplementations:Fe(t.multipleImplementations,"peek",["peek","gotoAndPeek","goto"]),multipleReferences:Fe(t.multipleReferences,"peek",["peek","gotoAndPeek","goto"]),multipleTests:Fe(t.multipleTests,"peek",["peek","gotoAndPeek","goto"]),alternativeDefinitionCommand:si.string(t.alternativeDefinitionCommand,this.defaultValue.alternativeDefinitionCommand),alternativeTypeDefinitionCommand:si.string(t.alternativeTypeDefinitionCommand,this.defaultValue.alternativeTypeDefinitionCommand),alternativeDeclarationCommand:si.string(t.alternativeDeclarationCommand,this.defaultValue.alternativeDeclarationCommand),alternativeImplementationCommand:si.string(t.alternativeImplementationCommand,this.defaultValue.alternativeImplementationCommand),alternativeReferenceCommand:si.string(t.alternativeReferenceCommand,this.defaultValue.alternativeReferenceCommand),alternativeTestsCommand:si.string(t.alternativeTestsCommand,this.defaultValue.alternativeTestsCommand)}}}class UP extends Ye{constructor(){const e={enabled:"on",delay:300,hidingDelay:300,sticky:!0,above:!0,showLongLineWarning:!0};super(69,"hover",e,{"editor.hover.enabled":{type:"string",enum:["on","off","onKeyboardModifier"],default:e.enabled,markdownEnumDescriptions:[l.localize(270,"Hover is enabled."),l.localize(271,"Hover is disabled."),l.localize(272,"Hover is shown when holding `{0}` or `Alt` (the opposite modifier of `#editor.multiCursorModifier#`)",l.isMacintosh?"Command":"Control")],description:l.localize(273,"Controls whether the hover is shown."),keywords:["hint","info","tooltip"]},"editor.hover.delay":{type:"number",default:e.delay,minimum:0,maximum:1e4,description:l.localize(274,"Controls the delay in milliseconds after which the hover is shown.")},"editor.hover.sticky":{type:"boolean",default:e.sticky,description:l.localize(275,"Controls whether the hover should remain visible when mouse is moved over it.")},"editor.hover.hidingDelay":{type:"integer",minimum:0,default:e.hidingDelay,markdownDescription:l.localize(276,"Controls the delay in milliseconds after which the hover is hidden. Requires `#editor.hover.sticky#` to be enabled.")},"editor.hover.above":{type:"boolean",default:e.above,description:l.localize(277,"Prefer showing hovers above the line, if there's space.")},"editor.hover.showLongLineWarning":{type:"boolean",default:e.showLongLineWarning,description:l.localize(278,"Controls whether long line warning hovers are shown, such as when tokenization is skipped or rendering is paused.")}})}validate(e){if(!e||typeof e!="object")return this.defaultValue;const t=e;return{enabled:Fe(t.enabled,this.defaultValue.enabled,["on","off","onKeyboardModifier"]),delay:Ie.clampedInt(t.delay,this.defaultValue.delay,0,1e4),sticky:$(t.sticky,this.defaultValue.sticky),hidingDelay:Ie.clampedInt(t.hidingDelay,this.defaultValue.hidingDelay,0,6e5),above:$(t.above,this.defaultValue.above),showLongLineWarning:$(t.showLongLineWarning,this.defaultValue.showLongLineWarning)}}}class Bl extends Go{constructor(){super(165,{width:0,height:0,glyphMarginLeft:0,glyphMarginWidth:0,glyphMarginDecorationLaneCount:0,lineNumbersLeft:0,lineNumbersWidth:0,decorationsLeft:0,decorationsWidth:0,contentLeft:0,contentWidth:0,minimap:{renderMinimap:0,minimapLeft:0,minimapWidth:0,minimapHeightIsEditorHeight:!1,minimapIsSampling:!1,minimapScale:1,minimapLineHeight:1,minimapCanvasInnerWidth:0,minimapCanvasInnerHeight:0,minimapCanvasOuterWidth:0,minimapCanvasOuterHeight:0},viewportColumn:0,isWordWrapMinified:!1,isViewportWrapping:!1,wrappingColumn:-1,verticalScrollbarWidth:0,horizontalScrollbarHeight:0,overviewRuler:{top:0,width:0,height:0,right:0}})}compute(e,t,i){return Bl.computeLayout(t,{memory:e.memory,outerWidth:e.outerWidth,outerHeight:e.outerHeight,isDominatedByLongLines:e.isDominatedByLongLines,lineHeight:e.fontInfo.lineHeight,viewLineCount:e.viewLineCount,lineNumbersDigitCount:e.lineNumbersDigitCount,typicalHalfwidthCharacterWidth:e.fontInfo.typicalHalfwidthCharacterWidth,maxDigitWidth:e.fontInfo.maxDigitWidth,pixelRatio:e.pixelRatio,glyphMarginDecorationLaneCount:e.glyphMarginDecorationLaneCount})}static computeContainedMinimapLineCount(e){const t=e.height/e.lineHeight,i=Math.floor(e.paddingTop/e.lineHeight);let n=Math.floor(e.paddingBottom/e.lineHeight);e.scrollBeyondLastLine&&(n=Math.max(n,t-1));const s=(i+e.viewLineCount+n)/(e.pixelRatio*e.height),r=Math.floor(e.viewLineCount/s);return{typicalViewportLineCount:t,extraLinesBeforeFirstLine:i,extraLinesBeyondLastLine:n,desiredRatio:s,minimapLineCount:r}}static _computeMinimapLayout(e,t){const i=e.outerWidth,n=e.outerHeight,s=e.pixelRatio;if(!e.minimap.enabled)return{renderMinimap:0,minimapLeft:0,minimapWidth:0,minimapHeightIsEditorHeight:!1,minimapIsSampling:!1,minimapScale:1,minimapLineHeight:1,minimapCanvasInnerWidth:0,minimapCanvasInnerHeight:Math.floor(s*n),minimapCanvasOuterWidth:0,minimapCanvasOuterHeight:n};const r=t.stableMinimapLayoutInput,a=r&&e.outerHeight===r.outerHeight&&e.lineHeight===r.lineHeight&&e.typicalHalfwidthCharacterWidth===r.typicalHalfwidthCharacterWidth&&e.pixelRatio===r.pixelRatio&&e.scrollBeyondLastLine===r.scrollBeyondLastLine&&e.paddingTop===r.paddingTop&&e.paddingBottom===r.paddingBottom&&e.minimap.enabled===r.minimap.enabled&&e.minimap.side===r.minimap.side&&e.minimap.size===r.minimap.size&&e.minimap.showSlider===r.minimap.showSlider&&e.minimap.renderCharacters===r.minimap.renderCharacters&&e.minimap.maxColumn===r.minimap.maxColumn&&e.minimap.scale===r.minimap.scale&&e.verticalScrollbarWidth===r.verticalScrollbarWidth&&e.isViewportWrapping===r.isViewportWrapping,c=e.lineHeight,h=e.typicalHalfwidthCharacterWidth,d=e.scrollBeyondLastLine,u=e.minimap.renderCharacters;let f=s>=2?Math.round(e.minimap.scale*2):e.minimap.scale;const g=e.minimap.maxColumn,m=e.minimap.size,p=e.minimap.side,b=e.verticalScrollbarWidth,v=e.viewLineCount,C=e.remainingWidth,w=e.isViewportWrapping,S=u?2:3;let L=Math.floor(s*n);const D=L/s;let x=!1,I=!1,T=S*f,M=f/s,O=1;if(m==="fill"||m==="fit"){const{typicalViewportLineCount:re,extraLinesBeforeFirstLine:Y,extraLinesBeyondLastLine:ee,desiredRatio:Ee,minimapLineCount:Rt}=Bl.computeContainedMinimapLineCount({viewLineCount:v,scrollBeyondLastLine:d,paddingTop:e.paddingTop,paddingBottom:e.paddingBottom,height:n,lineHeight:c,pixelRatio:s});if(v/Rt>1)x=!0,I=!0,f=1,T=1,M=f/s;else{let Ke=!1,Mt=f+1;if(m==="fit"){const Ce=Math.ceil((Y+v+ee)*T);w&&a&&C<=t.stableFitRemainingWidth?(Ke=!0,Mt=t.stableFitMaxMinimapScale):Ke=Ce>L}if(m==="fill"||Ke){x=!0;const Ce=f;T=Math.min(c*s,Math.max(1,Math.floor(1/Ee))),w&&a&&C<=t.stableFitRemainingWidth&&(Mt=t.stableFitMaxMinimapScale),f=Math.min(Mt,Math.max(1,Math.floor(T/S))),f>Ce&&(O=Math.min(2,f/Ce)),M=f/s/O,L=Math.ceil(Math.max(re,Y+v+ee)*T),w?(t.stableMinimapLayoutInput=e,t.stableFitRemainingWidth=C,t.stableFitMaxMinimapScale=f):(t.stableMinimapLayoutInput=null,t.stableFitRemainingWidth=0)}}}const P=Math.floor(g*M),k=Math.min(P,Math.max(0,Math.floor((C-b-2)*M/(h+M)))+ls);let U=Math.floor(s*k);const B=U/s;U=Math.floor(U*O);const G=u?1:2,X=p==="left"?0:i-k-b;return{renderMinimap:G,minimapLeft:X,minimapWidth:k,minimapHeightIsEditorHeight:x,minimapIsSampling:I,minimapScale:f,minimapLineHeight:T,minimapCanvasInnerWidth:U,minimapCanvasInnerHeight:L,minimapCanvasOuterWidth:B,minimapCanvasOuterHeight:D}}static computeLayout(e,t){const i=t.outerWidth|0,n=t.outerHeight|0,s=t.lineHeight|0,r=t.lineNumbersDigitCount|0,a=t.typicalHalfwidthCharacterWidth,c=t.maxDigitWidth,h=t.pixelRatio,d=t.viewLineCount,u=e.get(154),f=u==="inherit"?e.get(153):u,g=f==="inherit"?e.get(149):f,m=e.get(152),p=t.isDominatedByLongLines,b=e.get(66),v=e.get(76).renderType!==0,C=e.get(77),w=e.get(119),S=e.get(96),L=e.get(81),D=e.get(117),x=D.verticalScrollbarSize,I=D.verticalHasArrows,T=D.arrowSize,M=D.horizontalScrollbarSize,O=e.get(52),P=e.get(126)!=="never";let k=e.get(74);O&&P&&(k+=16);let U=0;if(v){const Me=Math.max(r,C);U=Math.round(Me*c)}let B=0;b&&(B=s*t.glyphMarginDecorationLaneCount);let G=0,X=G+B,re=X+U,Y=re+k;const ee=i-B-U-k;let Ee=!1,Rt=!1,We=-1;e.get(2)===2&&f==="inherit"&&p?(Ee=!0,Rt=!0):g==="on"||g==="bounded"?Rt=!0:g==="wordWrapColumn"&&(We=m);const Ke=Bl._computeMinimapLayout({outerWidth:i,outerHeight:n,lineHeight:s,typicalHalfwidthCharacterWidth:a,pixelRatio:h,scrollBeyondLastLine:w,paddingTop:S.top,paddingBottom:S.bottom,minimap:L,verticalScrollbarWidth:x,viewLineCount:d,remainingWidth:ee,isViewportWrapping:Rt},t.memory||new RD);Ke.renderMinimap!==0&&Ke.minimapLeft===0&&(G+=Ke.minimapWidth,X+=Ke.minimapWidth,re+=Ke.minimapWidth,Y+=Ke.minimapWidth);const Mt=ee-Ke.minimapWidth,Ce=Math.max(1,Math.floor((Mt-x-2)/a)),Jt=I?T:0;return Rt&&(We=Math.max(1,Ce),g==="bounded"&&(We=Math.min(We,m))),{width:i,height:n,glyphMarginLeft:G,glyphMarginWidth:B,glyphMarginDecorationLaneCount:t.glyphMarginDecorationLaneCount,lineNumbersLeft:X,lineNumbersWidth:U,decorationsLeft:re,decorationsWidth:k,contentLeft:Y,contentWidth:Mt,minimap:Ke,viewportColumn:Ce,isWordWrapMinified:Ee,isViewportWrapping:Rt,wrappingColumn:We,verticalScrollbarWidth:x,horizontalScrollbarHeight:M,overviewRuler:{top:Jt,width:x,height:n-2*Jt,right:0}}}}class $P extends Ye{constructor(){super(156,"wrappingStrategy","simple",{"editor.wrappingStrategy":{enumDescriptions:[l.localize(279,"Assumes that all characters are of the same width. This is a fast algorithm that works correctly for monospace fonts and certain scripts (like Latin characters) where glyphs are of equal width."),l.localize(280,"Delegates wrapping points computation to the browser. This is a slow algorithm, that might cause freezes for large files, but it works correctly in all cases.")],type:"string",enum:["simple","advanced"],default:"simple",description:l.localize(281,"Controls the algorithm that computes wrapping points. Note that when in accessibility mode, advanced will be used for the best experience.")}})}validate(e){return Fe(e,"simple",["simple","advanced"])}compute(e,t,i){return t.get(2)===2?"advanced":i}}_.ShowLightbulbIconMode=void 0,(function(o){o.Off="off",o.OnCode="onCode",o.On="on"})(_.ShowLightbulbIconMode||(_.ShowLightbulbIconMode={}));class KP extends Ye{constructor(){const e={enabled:_.ShowLightbulbIconMode.OnCode};super(73,"lightbulb",e,{"editor.lightbulb.enabled":{type:"string",enum:[_.ShowLightbulbIconMode.Off,_.ShowLightbulbIconMode.OnCode,_.ShowLightbulbIconMode.On],default:e.enabled,enumDescriptions:[l.localize(282,"Disable the code action menu."),l.localize(283,"Show the code action menu when the cursor is on lines with code."),l.localize(284,"Show the code action menu when the cursor is on lines with code or on empty lines.")],description:l.localize(285,"Enables the Code Action lightbulb in the editor.")}})}validate(e){return!e||typeof e!="object"?this.defaultValue:{enabled:Fe(e.enabled,this.defaultValue.enabled,[_.ShowLightbulbIconMode.Off,_.ShowLightbulbIconMode.OnCode,_.ShowLightbulbIconMode.On])}}}class GP extends Ye{constructor(){const e={enabled:!0,maxLineCount:5,defaultModel:"outlineModel",scrollWithEditor:!0};super(131,"stickyScroll",e,{"editor.stickyScroll.enabled":{type:"boolean",default:e.enabled,description:l.localize(286,"Shows the nested current scopes during the scroll at the top of the editor.")},"editor.stickyScroll.maxLineCount":{type:"number",default:e.maxLineCount,minimum:1,maximum:20,description:l.localize(287,"Defines the maximum number of sticky lines to show.")},"editor.stickyScroll.defaultModel":{type:"string",enum:["outlineModel","foldingProviderModel","indentationModel"],default:e.defaultModel,description:l.localize(288,"Defines the model to use for determining which lines to stick. If the outline model does not exist, it will fall back on the folding provider model which falls back on the indentation model. This order is respected in all three cases.")},"editor.stickyScroll.scrollWithEditor":{type:"boolean",default:e.scrollWithEditor,description:l.localize(289,"Enable scrolling of Sticky Scroll with the editor's horizontal scrollbar.")}})}validate(e){if(!e||typeof e!="object")return this.defaultValue;const t=e;return{enabled:$(t.enabled,this.defaultValue.enabled),maxLineCount:Ie.clampedInt(t.maxLineCount,this.defaultValue.maxLineCount,1,20),defaultModel:Fe(t.defaultModel,this.defaultValue.defaultModel,["outlineModel","foldingProviderModel","indentationModel"]),scrollWithEditor:$(t.scrollWithEditor,this.defaultValue.scrollWithEditor)}}}class jP extends Ye{constructor(){const e={enabled:"on",fontSize:0,fontFamily:"",padding:!1,maximumLength:43};super(159,"inlayHints",e,{"editor.inlayHints.enabled":{type:"string",default:e.enabled,description:l.localize(290,"Enables the inlay hints in the editor."),enum:["on","onUnlessPressed","offUnlessPressed","off"],markdownEnumDescriptions:[l.localize(291,"Inlay hints are enabled"),l.localize(292,"Inlay hints are showing by default and hide when holding {0}",l.isMacintosh?"Ctrl+Option":"Ctrl+Alt"),l.localize(293,"Inlay hints are hidden by default and show when holding {0}",l.isMacintosh?"Ctrl+Option":"Ctrl+Alt"),l.localize(294,"Inlay hints are disabled")]},"editor.inlayHints.fontSize":{type:"number",default:e.fontSize,markdownDescription:l.localize(295,"Controls font size of inlay hints in the editor. As default the {0} is used when the configured value is less than {1} or greater than the editor font size.","`#editor.fontSize#`","`5`")},"editor.inlayHints.fontFamily":{type:"string",default:e.fontFamily,markdownDescription:l.localize(296,"Controls font family of inlay hints in the editor. When set to empty, the {0} is used.","`#editor.fontFamily#`")},"editor.inlayHints.padding":{type:"boolean",default:e.padding,description:l.localize(297,"Enables the padding around the inlay hints in the editor.")},"editor.inlayHints.maximumLength":{type:"number",default:e.maximumLength,markdownDescription:l.localize(298,"Maximum overall length of inlay hints, for a single line, before they get truncated by the editor. Set to `0` to never truncate")}})}validate(e){if(!e||typeof e!="object")return this.defaultValue;const t=e;return typeof t.enabled=="boolean"&&(t.enabled=t.enabled?"on":"off"),{enabled:Fe(t.enabled,this.defaultValue.enabled,["on","off","offUnlessPressed","onUnlessPressed"]),fontSize:Ie.clampedInt(t.fontSize,this.defaultValue.fontSize,0,100),fontFamily:si.string(t.fontFamily,this.defaultValue.fontFamily),padding:$(t.padding,this.defaultValue.padding),maximumLength:Ie.clampedInt(t.maximumLength,this.defaultValue.maximumLength,0,Number.MAX_SAFE_INTEGER)}}}class qP extends Ye{constructor(){super(74,"lineDecorationsWidth",10)}validate(e){return typeof e=="string"&&/^\d+(\.\d+)?ch$/.test(e)?-parseFloat(e.substring(0,e.length-2)):Ie.clampedInt(e,this.defaultValue,0,1e3)}compute(e,t,i){return i<0?Ie.clampedInt(-i*e.fontInfo.typicalHalfwidthCharacterWidth,this.defaultValue,0,1e3):i}}class YP extends xi{constructor(){super(75,"lineHeight",Zi.lineHeight,e=>xi.clamp(e,0,150),{markdownDescription:l.localize(299,`Controls the line height.
|
||
- Use 0 to automatically compute the line height from the font size.
|
||
- Values between 0 and 8 will be used as a multiplier with the font size.
|
||
- Values greater than or equal to 8 will be used as effective values.`)},0,150)}compute(e,t,i){return e.fontInfo.lineHeight}}class ZP extends Ye{constructor(){const e={enabled:!0,size:"proportional",side:"right",showSlider:"mouseover",autohide:"none",renderCharacters:!0,maxColumn:120,scale:1,showRegionSectionHeaders:!0,showMarkSectionHeaders:!0,markSectionHeaderRegex:"\\bMARK:\\s*(?<separator>-?)\\s*(?<label>.*)$",sectionHeaderFontSize:9,sectionHeaderLetterSpacing:1};super(81,"minimap",e,{"editor.minimap.enabled":{type:"boolean",default:e.enabled,description:l.localize(300,"Controls whether the minimap is shown.")},"editor.minimap.autohide":{type:"string",enum:["none","mouseover","scroll"],enumDescriptions:[l.localize(301,"The minimap is always shown."),l.localize(302,"The minimap is hidden when mouse is not over the minimap and shown when mouse is over the minimap."),l.localize(303,"The minimap is only shown when the editor is scrolled")],default:e.autohide,description:l.localize(304,"Controls whether the minimap is hidden automatically.")},"editor.minimap.size":{type:"string",enum:["proportional","fill","fit"],enumDescriptions:[l.localize(305,"The minimap has the same size as the editor contents (and might scroll)."),l.localize(306,"The minimap will stretch or shrink as necessary to fill the height of the editor (no scrolling)."),l.localize(307,"The minimap will shrink as necessary to never be larger than the editor (no scrolling).")],default:e.size,description:l.localize(308,"Controls the size of the minimap.")},"editor.minimap.side":{type:"string",enum:["left","right"],default:e.side,description:l.localize(309,"Controls the side where to render the minimap.")},"editor.minimap.showSlider":{type:"string",enum:["always","mouseover"],default:e.showSlider,description:l.localize(310,"Controls when the minimap slider is shown.")},"editor.minimap.scale":{type:"number",default:e.scale,minimum:1,maximum:3,enum:[1,2,3],description:l.localize(311,"Scale of content drawn in the minimap: 1, 2 or 3.")},"editor.minimap.renderCharacters":{type:"boolean",default:e.renderCharacters,description:l.localize(312,"Render the actual characters on a line as opposed to color blocks.")},"editor.minimap.maxColumn":{type:"number",default:e.maxColumn,description:l.localize(313,"Limit the width of the minimap to render at most a certain number of columns.")},"editor.minimap.showRegionSectionHeaders":{type:"boolean",default:e.showRegionSectionHeaders,description:l.localize(314,"Controls whether named regions are shown as section headers in the minimap.")},"editor.minimap.showMarkSectionHeaders":{type:"boolean",default:e.showMarkSectionHeaders,description:l.localize(315,"Controls whether MARK: comments are shown as section headers in the minimap.")},"editor.minimap.markSectionHeaderRegex":{type:"string",default:e.markSectionHeaderRegex,description:l.localize(316,"Defines the regular expression used to find section headers in comments. The regex must contain a named match group `label` (written as `(?<label>.+)`) that encapsulates the section header, otherwise it will not work. Optionally you can include another match group named `separator`. Use \\n in the pattern to match multi-line headers.")},"editor.minimap.sectionHeaderFontSize":{type:"number",default:e.sectionHeaderFontSize,description:l.localize(317,"Controls the font size of section headers in the minimap.")},"editor.minimap.sectionHeaderLetterSpacing":{type:"number",default:e.sectionHeaderLetterSpacing,description:l.localize(318,"Controls the amount of space (in pixels) between characters of section header. This helps the readability of the header in small font sizes.")}})}validate(e){if(!e||typeof e!="object")return this.defaultValue;const t=e;let i=this.defaultValue.markSectionHeaderRegex;const n=t.markSectionHeaderRegex;if(typeof n=="string")try{new RegExp(n,"d"),i=n}catch{}return{enabled:$(t.enabled,this.defaultValue.enabled),autohide:Fe(t.autohide,this.defaultValue.autohide,["none","mouseover","scroll"]),size:Fe(t.size,this.defaultValue.size,["proportional","fill","fit"]),side:Fe(t.side,this.defaultValue.side,["right","left"]),showSlider:Fe(t.showSlider,this.defaultValue.showSlider,["always","mouseover"]),renderCharacters:$(t.renderCharacters,this.defaultValue.renderCharacters),scale:Ie.clampedInt(t.scale,1,1,3),maxColumn:Ie.clampedInt(t.maxColumn,this.defaultValue.maxColumn,1,1e4),showRegionSectionHeaders:$(t.showRegionSectionHeaders,this.defaultValue.showRegionSectionHeaders),showMarkSectionHeaders:$(t.showMarkSectionHeaders,this.defaultValue.showMarkSectionHeaders),markSectionHeaderRegex:i,sectionHeaderFontSize:xi.clamp(xi.float(t.sectionHeaderFontSize,this.defaultValue.sectionHeaderFontSize),4,32),sectionHeaderLetterSpacing:xi.clamp(xi.float(t.sectionHeaderLetterSpacing,this.defaultValue.sectionHeaderLetterSpacing),0,5)}}}function QP(o){return o==="ctrlCmd"?l.isMacintosh?"metaKey":"ctrlKey":"altKey"}class XP extends Ye{constructor(){super(96,"padding",{top:0,bottom:0},{"editor.padding.top":{type:"number",default:0,minimum:0,maximum:1e3,description:l.localize(319,"Controls the amount of space between the top edge of the editor and the first line.")},"editor.padding.bottom":{type:"number",default:0,minimum:0,maximum:1e3,description:l.localize(320,"Controls the amount of space between the bottom edge of the editor and the last line.")}})}validate(e){if(!e||typeof e!="object")return this.defaultValue;const t=e;return{top:Ie.clampedInt(t.top,0,0,1e3),bottom:Ie.clampedInt(t.bottom,0,0,1e3)}}}class JP extends Ye{constructor(){const e={enabled:!0,cycle:!0};super(98,"parameterHints",e,{"editor.parameterHints.enabled":{type:"boolean",default:e.enabled,description:l.localize(321,"Enables a pop-up that shows parameter documentation and type information as you type.")},"editor.parameterHints.cycle":{type:"boolean",default:e.cycle,description:l.localize(322,"Controls whether the parameter hints menu cycles or closes when reaching the end of the list.")}})}validate(e){if(!e||typeof e!="object")return this.defaultValue;const t=e;return{enabled:$(t.enabled,this.defaultValue.enabled),cycle:$(t.cycle,this.defaultValue.cycle)}}}class WP extends Go{constructor(){super(163,1)}compute(e,t,i){return e.pixelRatio}}class HP extends Ye{constructor(){super(100,"placeholder",void 0)}validate(e){return typeof e>"u"?this.defaultValue:typeof e=="string"?e:this.defaultValue}}class ek extends Ye{constructor(){const e={other:"offWhenInlineCompletions",comments:"off",strings:"off"},t=[{type:"boolean"},{type:"string",enum:["on","inline","off","offWhenInlineCompletions"],enumDescriptions:[l.localize(323,"Quick suggestions show inside the suggest widget"),l.localize(324,"Quick suggestions show as ghost text"),l.localize(325,"Quick suggestions are disabled"),l.localize(326,"Quick suggestions are disabled when inline completions are showing")]}];super(102,"quickSuggestions",e,{anyOf:[{type:"boolean"},{type:"string",enum:["on","inline","off","offWhenInlineCompletions"],enumDescriptions:[l.localize(327,"Quick suggestions are enabled for all token types"),l.localize(328,"Quick suggestions show as ghost text for all token types"),l.localize(329,"Quick suggestions are disabled for all token types"),l.localize(330,"Quick suggestions are disabled for all token types when inline completions are showing")]},{type:"object",additionalProperties:!1,properties:{strings:{anyOf:t,default:e.strings,description:l.localize(331,"Enable quick suggestions inside strings.")},comments:{anyOf:t,default:e.comments,description:l.localize(332,"Enable quick suggestions inside comments.")},other:{anyOf:t,default:e.other,description:l.localize(333,"Enable quick suggestions outside of strings and comments.")}}}],default:e,markdownDescription:l.localize(334,"Controls whether suggestions should automatically show up while typing. This can be controlled for typing in comments, strings, and other code. Quick suggestion can be configured to show as ghost text or with the suggest widget. Also be aware of the {0}-setting which controls if suggestions are triggered by special characters.","`#editor.suggestOnTriggerCharacters#`"),experiment:{mode:"auto"}}),this.defaultValue=e}validate(e){if(typeof e=="boolean"){const h=e?"on":"off";return{comments:h,strings:h,other:h}}if(typeof e=="string"){const h=["on","inline","off","offWhenInlineCompletions"],d=Fe(e,this.defaultValue.other,h);return{comments:d,strings:d,other:d}}if(!e||typeof e!="object")return this.defaultValue;const{other:t,comments:i,strings:n}=e,s=["on","inline","off","offWhenInlineCompletions"];let r,a,c;return typeof t=="boolean"?r=t?"on":"off":r=Fe(t,this.defaultValue.other,s),typeof i=="boolean"?a=i?"on":"off":a=Fe(i,this.defaultValue.comments,s),typeof n=="boolean"?c=n?"on":"off":c=Fe(n,this.defaultValue.strings,s),{other:r,comments:a,strings:c}}}class tk extends Ye{constructor(){super(76,"lineNumbers",{renderType:1,renderFn:null},{type:"string",enum:["off","on","relative","interval"],enumDescriptions:[l.localize(335,"Line numbers are not rendered."),l.localize(336,"Line numbers are rendered as absolute number."),l.localize(337,"Line numbers are rendered as distance in lines to cursor position."),l.localize(338,"Line numbers are rendered every 10 lines.")],default:"on",description:l.localize(339,"Controls the display of line numbers.")})}validate(e){let t=this.defaultValue.renderType,i=this.defaultValue.renderFn;return typeof e<"u"&&(typeof e=="function"?(t=4,i=e):e==="interval"?t=3:e==="relative"?t=2:e==="on"?t=1:t=0),{renderType:t,renderFn:i}}}function Pf(o){const e=o.get(112);return e==="editable"?o.get(104):e!=="on"}function kf(o){return!o.get(172)}class ik extends Ye{constructor(){const e=[],t={type:"number",description:l.localize(340,"Number of monospace characters at which this editor ruler will render.")};super(116,"rulers",e,{type:"array",items:{anyOf:[t,{type:["object"],properties:{column:t,color:{type:"string",description:l.localize(341,"Color of this editor ruler."),format:"color-hex"}}}]},default:e,description:l.localize(342,"Render vertical rulers after a certain number of monospace characters. Use multiple values for multiple rulers. No rulers are drawn if array is empty.")})}validate(e){if(Array.isArray(e)){const t=[];for(const i of e)if(typeof i=="number")t.push({column:Ie.clampedInt(i,0,0,1e4),color:null});else if(i&&typeof i=="object"){const n=i;t.push({column:Ie.clampedInt(n.column,0,0,1e4),color:n.color})}return t.sort((i,n)=>i.column-n.column),t}return this.defaultValue}}class nk extends Ye{constructor(){super(105,"readOnlyMessage",void 0)}validate(e){return!e||typeof e!="object"?this.defaultValue:e}}function AD(o,e){if(typeof o!="string")return e;switch(o){case"hidden":return 2;case"visible":return 3;default:return 1}}let sk=class extends Ye{constructor(){const e={vertical:1,horizontal:1,arrowSize:11,useShadows:!0,verticalHasArrows:!1,horizontalHasArrows:!1,horizontalScrollbarSize:12,horizontalSliderSize:12,verticalScrollbarSize:14,verticalSliderSize:14,handleMouseWheel:!0,alwaysConsumeMouseWheel:!0,scrollByPage:!1,ignoreHorizontalScrollbarInContentHeight:!1};super(117,"scrollbar",e,{"editor.scrollbar.vertical":{type:"string",enum:["auto","visible","hidden"],enumDescriptions:[l.localize(343,"The vertical scrollbar will be visible only when necessary."),l.localize(344,"The vertical scrollbar will always be visible."),l.localize(345,"The vertical scrollbar will always be hidden.")],default:"auto",description:l.localize(346,"Controls the visibility of the vertical scrollbar.")},"editor.scrollbar.horizontal":{type:"string",enum:["auto","visible","hidden"],enumDescriptions:[l.localize(347,"The horizontal scrollbar will be visible only when necessary."),l.localize(348,"The horizontal scrollbar will always be visible."),l.localize(349,"The horizontal scrollbar will always be hidden.")],default:"auto",description:l.localize(350,"Controls the visibility of the horizontal scrollbar.")},"editor.scrollbar.verticalScrollbarSize":{type:"number",default:e.verticalScrollbarSize,description:l.localize(351,"The width of the vertical scrollbar.")},"editor.scrollbar.horizontalScrollbarSize":{type:"number",default:e.horizontalScrollbarSize,description:l.localize(352,"The height of the horizontal scrollbar.")},"editor.scrollbar.scrollByPage":{type:"boolean",default:e.scrollByPage,description:l.localize(353,"Controls whether clicks scroll by page or jump to click position.")},"editor.scrollbar.ignoreHorizontalScrollbarInContentHeight":{type:"boolean",default:e.ignoreHorizontalScrollbarInContentHeight,description:l.localize(354,"When set, the horizontal scrollbar will not increase the size of the editor's content.")}})}validate(e){if(!e||typeof e!="object")return this.defaultValue;const t=e,i=Ie.clampedInt(t.horizontalScrollbarSize,this.defaultValue.horizontalScrollbarSize,0,1e3),n=Ie.clampedInt(t.verticalScrollbarSize,this.defaultValue.verticalScrollbarSize,0,1e3);return{arrowSize:Ie.clampedInt(t.arrowSize,this.defaultValue.arrowSize,0,1e3),vertical:AD(t.vertical,this.defaultValue.vertical),horizontal:AD(t.horizontal,this.defaultValue.horizontal),useShadows:$(t.useShadows,this.defaultValue.useShadows),verticalHasArrows:$(t.verticalHasArrows,this.defaultValue.verticalHasArrows),horizontalHasArrows:$(t.horizontalHasArrows,this.defaultValue.horizontalHasArrows),handleMouseWheel:$(t.handleMouseWheel,this.defaultValue.handleMouseWheel),alwaysConsumeMouseWheel:$(t.alwaysConsumeMouseWheel,this.defaultValue.alwaysConsumeMouseWheel),horizontalScrollbarSize:i,horizontalSliderSize:Ie.clampedInt(t.horizontalSliderSize,i,0,1e3),verticalScrollbarSize:n,verticalSliderSize:Ie.clampedInt(t.verticalSliderSize,n,0,1e3),scrollByPage:$(t.scrollByPage,this.defaultValue.scrollByPage),ignoreHorizontalScrollbarInContentHeight:$(t.ignoreHorizontalScrollbarInContentHeight,this.defaultValue.ignoreHorizontalScrollbarInContentHeight)}}};const Mn="inUntrustedWorkspace",jo={allowedCharacters:"editor.unicodeHighlight.allowedCharacters",invisibleCharacters:"editor.unicodeHighlight.invisibleCharacters",nonBasicASCII:"editor.unicodeHighlight.nonBasicASCII",ambiguousCharacters:"editor.unicodeHighlight.ambiguousCharacters",includeComments:"editor.unicodeHighlight.includeComments",includeStrings:"editor.unicodeHighlight.includeStrings",allowedLocales:"editor.unicodeHighlight.allowedLocales"};class ok extends Ye{constructor(){const e={nonBasicASCII:Mn,invisibleCharacters:!0,ambiguousCharacters:!0,includeComments:Mn,includeStrings:!0,allowedCharacters:{},allowedLocales:{_os:!0,_vscode:!0}};super(142,"unicodeHighlight",e,{[jo.nonBasicASCII]:{restricted:!0,type:["boolean","string"],enum:[!0,!1,Mn],default:e.nonBasicASCII,description:l.localize(355,"Controls whether all non-basic ASCII characters are highlighted. Only characters between U+0020 and U+007E, tab, line-feed and carriage-return are considered basic ASCII.")},[jo.invisibleCharacters]:{restricted:!0,type:"boolean",default:e.invisibleCharacters,description:l.localize(356,"Controls whether characters that just reserve space or have no width at all are highlighted.")},[jo.ambiguousCharacters]:{restricted:!0,type:"boolean",default:e.ambiguousCharacters,description:l.localize(357,"Controls whether characters are highlighted that can be confused with basic ASCII characters, except those that are common in the current user locale.")},[jo.includeComments]:{restricted:!0,type:["boolean","string"],enum:[!0,!1,Mn],default:e.includeComments,description:l.localize(358,"Controls whether characters in comments should also be subject to Unicode highlighting.")},[jo.includeStrings]:{restricted:!0,type:["boolean","string"],enum:[!0,!1,Mn],default:e.includeStrings,description:l.localize(359,"Controls whether characters in strings should also be subject to Unicode highlighting.")},[jo.allowedCharacters]:{restricted:!0,type:"object",default:e.allowedCharacters,description:l.localize(360,"Defines allowed characters that are not being highlighted."),additionalProperties:{type:"boolean"}},[jo.allowedLocales]:{restricted:!0,type:"object",additionalProperties:{type:"boolean"},default:e.allowedLocales,description:l.localize(361,"Unicode characters that are common in allowed locales are not being highlighted.")}})}applyUpdate(e,t){let i=!1;t.allowedCharacters&&e&&(l.equals$1(e.allowedCharacters,t.allowedCharacters)||(e={...e,allowedCharacters:t.allowedCharacters},i=!0)),t.allowedLocales&&e&&(l.equals$1(e.allowedLocales,t.allowedLocales)||(e={...e,allowedLocales:t.allowedLocales},i=!0));const n=super.applyUpdate(e,t);return i?new Kh(n.newValue,!0):n}validate(e){if(!e||typeof e!="object")return this.defaultValue;const t=e;return{nonBasicASCII:zl(t.nonBasicASCII,Mn,[!0,!1,Mn]),invisibleCharacters:$(t.invisibleCharacters,this.defaultValue.invisibleCharacters),ambiguousCharacters:$(t.ambiguousCharacters,this.defaultValue.ambiguousCharacters),includeComments:zl(t.includeComments,Mn,[!0,!1,Mn]),includeStrings:zl(t.includeStrings,Mn,[!0,!1,Mn]),allowedCharacters:this.validateBooleanMap(t.allowedCharacters,this.defaultValue.allowedCharacters),allowedLocales:this.validateBooleanMap(t.allowedLocales,this.defaultValue.allowedLocales)}}validateBooleanMap(e,t){if(typeof e!="object"||!e)return t;const i={};for(const[n,s]of Object.entries(e))s===!0&&(i[n]=!0);return i}}class rk extends Ye{constructor(){const e={enabled:!0,mode:"subwordSmart",showToolbar:"onHover",suppressSuggestions:!1,keepOnBlur:!1,fontFamily:"default",syntaxHighlightingEnabled:!0,minShowDelay:0,suppressInSnippetMode:!0,edits:{enabled:!0,showCollapsed:!1,renderSideBySide:"auto",allowCodeShifting:"always",showLongDistanceHint:!0},triggerCommandOnProviderChange:!1,experimental:{suppressInlineSuggestions:"",showOnSuggestConflict:"never",emptyResponseInformation:!0}};super(71,"inlineSuggest",e,{"editor.inlineSuggest.enabled":{type:"boolean",default:e.enabled,description:l.localize(362,"Controls whether to automatically show inline suggestions in the editor.")},"editor.inlineSuggest.showToolbar":{type:"string",default:e.showToolbar,enum:["always","onHover","never"],enumDescriptions:[l.localize(363,"Show the inline suggestion toolbar whenever an inline suggestion is shown."),l.localize(364,"Show the inline suggestion toolbar when hovering over an inline suggestion."),l.localize(365,"Never show the inline suggestion toolbar.")],description:l.localize(366,"Controls when to show the inline suggestion toolbar.")},"editor.inlineSuggest.syntaxHighlightingEnabled":{type:"boolean",default:e.syntaxHighlightingEnabled,description:l.localize(367,"Controls whether to show syntax highlighting for inline suggestions in the editor.")},"editor.inlineSuggest.suppressSuggestions":{type:"boolean",default:e.suppressSuggestions,description:l.localize(368,"Controls how inline suggestions interact with the suggest widget. If enabled, the suggest widget is not shown automatically when inline suggestions are available.")},"editor.inlineSuggest.suppressInSnippetMode":{type:"boolean",default:e.suppressInSnippetMode,description:l.localize(369,"Controls whether inline suggestions are suppressed when in snippet mode.")},"editor.inlineSuggest.minShowDelay":{type:"number",default:0,minimum:0,maximum:1e4,description:l.localize(370,"Controls the minimal delay in milliseconds after which inline suggestions are shown after typing.")},"editor.inlineSuggest.experimental.suppressInlineSuggestions":{type:"string",default:e.experimental.suppressInlineSuggestions,tags:["experimental"],description:l.localize(371,"Suppresses inline completions for specified extension IDs -- comma separated."),experiment:{mode:"auto"}},"editor.inlineSuggest.experimental.emptyResponseInformation":{type:"boolean",default:e.experimental.emptyResponseInformation,tags:["experimental"],description:l.localize(372,"Controls whether to send request information from the inline suggestion provider."),experiment:{mode:"auto"}},"editor.inlineSuggest.triggerCommandOnProviderChange":{type:"boolean",default:e.triggerCommandOnProviderChange,tags:["experimental"],description:l.localize(373,"Controls whether to trigger a command when the inline suggestion provider changes."),experiment:{mode:"auto"}},"editor.inlineSuggest.experimental.showOnSuggestConflict":{type:"string",default:e.experimental.showOnSuggestConflict,tags:["experimental"],enum:["always","never","whenSuggestListIsIncomplete"],description:l.localize(374,"Controls whether to show inline suggestions when there is a suggest conflict."),experiment:{mode:"auto"}},"editor.inlineSuggest.fontFamily":{type:"string",default:e.fontFamily,description:l.localize(375,"Controls the font family of the inline suggestions.")},"editor.inlineSuggest.edits.allowCodeShifting":{type:"string",default:e.edits.allowCodeShifting,description:l.localize(376,"Controls whether showing a suggestion will shift the code to make space for the suggestion inline."),enum:["always","horizontal","never"],tags:["nextEditSuggestions"]},"editor.inlineSuggest.edits.showLongDistanceHint":{type:"boolean",default:e.edits.showLongDistanceHint,description:l.localize(377,"Controls whether long distance inline suggestions are shown."),tags:["nextEditSuggestions","experimental"]},"editor.inlineSuggest.edits.renderSideBySide":{type:"string",default:e.edits.renderSideBySide,description:l.localize(378,"Controls whether larger suggestions can be shown side by side."),enum:["auto","never"],enumDescriptions:[l.localize(379,"Larger suggestions will show side by side if there is enough space, otherwise they will be shown below."),l.localize(380,"Larger suggestions are never shown side by side and will always be shown below.")],tags:["nextEditSuggestions"]},"editor.inlineSuggest.edits.showCollapsed":{type:"boolean",default:e.edits.showCollapsed,description:l.localize(381,"Controls whether the suggestion will show as collapsed until jumping to it."),tags:["nextEditSuggestions"]}})}validate(e){if(!e||typeof e!="object")return this.defaultValue;const t=e;return{enabled:$(t.enabled,this.defaultValue.enabled),mode:Fe(t.mode,this.defaultValue.mode,["prefix","subword","subwordSmart"]),showToolbar:Fe(t.showToolbar,this.defaultValue.showToolbar,["always","onHover","never"]),suppressSuggestions:$(t.suppressSuggestions,this.defaultValue.suppressSuggestions),keepOnBlur:$(t.keepOnBlur,this.defaultValue.keepOnBlur),fontFamily:si.string(t.fontFamily,this.defaultValue.fontFamily),syntaxHighlightingEnabled:$(t.syntaxHighlightingEnabled,this.defaultValue.syntaxHighlightingEnabled),minShowDelay:Ie.clampedInt(t.minShowDelay,0,0,1e4),suppressInSnippetMode:$(t.suppressInSnippetMode,this.defaultValue.suppressInSnippetMode),edits:this._validateEdits(t.edits),triggerCommandOnProviderChange:$(t.triggerCommandOnProviderChange,this.defaultValue.triggerCommandOnProviderChange),experimental:this._validateExperimental(t.experimental)}}_validateEdits(e){if(!e||typeof e!="object")return this.defaultValue.edits;const t=e;return{enabled:$(t.enabled,this.defaultValue.edits.enabled),showCollapsed:$(t.showCollapsed,this.defaultValue.edits.showCollapsed),allowCodeShifting:Fe(t.allowCodeShifting,this.defaultValue.edits.allowCodeShifting,["always","horizontal","never"]),showLongDistanceHint:$(t.showLongDistanceHint,this.defaultValue.edits.showLongDistanceHint),renderSideBySide:Fe(t.renderSideBySide,this.defaultValue.edits.renderSideBySide,["never","auto"])}}_validateExperimental(e){if(!e||typeof e!="object")return this.defaultValue.experimental;const t=e;return{suppressInlineSuggestions:si.string(t.suppressInlineSuggestions,this.defaultValue.experimental.suppressInlineSuggestions),showOnSuggestConflict:Fe(t.showOnSuggestConflict,this.defaultValue.experimental.showOnSuggestConflict,["always","never","whenSuggestListIsIncomplete"]),emptyResponseInformation:$(t.emptyResponseInformation,this.defaultValue.experimental.emptyResponseInformation)}}}class ak extends Ye{constructor(){const e={enabled:zt.bracketPairColorizationOptions.enabled,independentColorPoolPerBracketType:zt.bracketPairColorizationOptions.independentColorPoolPerBracketType};super(21,"bracketPairColorization",e,{"editor.bracketPairColorization.enabled":{type:"boolean",default:e.enabled,markdownDescription:l.localize(382,"Controls whether bracket pair colorization is enabled or not. Use {0} to override the bracket highlight colors.","`#workbench.colorCustomizations#`")},"editor.bracketPairColorization.independentColorPoolPerBracketType":{type:"boolean",default:e.independentColorPoolPerBracketType,description:l.localize(383,"Controls whether each bracket type has its own independent color pool.")}})}validate(e){if(!e||typeof e!="object")return this.defaultValue;const t=e;return{enabled:$(t.enabled,this.defaultValue.enabled),independentColorPoolPerBracketType:$(t.independentColorPoolPerBracketType,this.defaultValue.independentColorPoolPerBracketType)}}}class lk extends Ye{constructor(){const e={bracketPairs:!1,bracketPairsHorizontal:"active",highlightActiveBracketPair:!0,indentation:!0,highlightActiveIndentation:!0};super(22,"guides",e,{"editor.guides.bracketPairs":{type:["boolean","string"],enum:[!0,"active",!1],enumDescriptions:[l.localize(384,"Enables bracket pair guides."),l.localize(385,"Enables bracket pair guides only for the active bracket pair."),l.localize(386,"Disables bracket pair guides.")],default:e.bracketPairs,description:l.localize(387,"Controls whether bracket pair guides are enabled or not.")},"editor.guides.bracketPairsHorizontal":{type:["boolean","string"],enum:[!0,"active",!1],enumDescriptions:[l.localize(388,"Enables horizontal guides as addition to vertical bracket pair guides."),l.localize(389,"Enables horizontal guides only for the active bracket pair."),l.localize(390,"Disables horizontal bracket pair guides.")],default:e.bracketPairsHorizontal,description:l.localize(391,"Controls whether horizontal bracket pair guides are enabled or not.")},"editor.guides.highlightActiveBracketPair":{type:"boolean",default:e.highlightActiveBracketPair,description:l.localize(392,"Controls whether the editor should highlight the active bracket pair.")},"editor.guides.indentation":{type:"boolean",default:e.indentation,description:l.localize(393,"Controls whether the editor should render indent guides.")},"editor.guides.highlightActiveIndentation":{type:["boolean","string"],enum:[!0,"always",!1],enumDescriptions:[l.localize(394,"Highlights the active indent guide."),l.localize(395,"Highlights the active indent guide even if bracket guides are highlighted."),l.localize(396,"Do not highlight the active indent guide.")],default:e.highlightActiveIndentation,description:l.localize(397,"Controls whether the editor should highlight the active indent guide.")}})}validate(e){if(!e||typeof e!="object")return this.defaultValue;const t=e;return{bracketPairs:zl(t.bracketPairs,this.defaultValue.bracketPairs,[!0,!1,"active"]),bracketPairsHorizontal:zl(t.bracketPairsHorizontal,this.defaultValue.bracketPairsHorizontal,[!0,!1,"active"]),highlightActiveBracketPair:$(t.highlightActiveBracketPair,this.defaultValue.highlightActiveBracketPair),indentation:$(t.indentation,this.defaultValue.indentation),highlightActiveIndentation:zl(t.highlightActiveIndentation,this.defaultValue.highlightActiveIndentation,[!0,!1,"always"])}}}function zl(o,e,t){const i=t.indexOf(o);return i===-1?e:t[i]}class ck extends Ye{constructor(){const e={insertMode:"insert",filterGraceful:!0,snippetsPreventQuickSuggestions:!1,localityBonus:!1,shareSuggestSelections:!1,selectionMode:"always",showIcons:!0,showStatusBar:!1,preview:!1,previewMode:"subwordSmart",showInlineDetails:!0,showMethods:!0,showFunctions:!0,showConstructors:!0,showDeprecated:!0,matchOnWordStartOnly:!0,showFields:!0,showVariables:!0,showClasses:!0,showStructs:!0,showInterfaces:!0,showModules:!0,showProperties:!0,showEvents:!0,showOperators:!0,showUnits:!0,showValues:!0,showConstants:!0,showEnums:!0,showEnumMembers:!0,showKeywords:!0,showWords:!0,showColors:!0,showFiles:!0,showReferences:!0,showFolders:!0,showTypeParameters:!0,showSnippets:!0,showUsers:!0,showIssues:!0};super(134,"suggest",e,{"editor.suggest.insertMode":{type:"string",enum:["insert","replace"],enumDescriptions:[l.localize(398,"Insert suggestion without overwriting text right of the cursor."),l.localize(399,"Insert suggestion and overwrite text right of the cursor.")],default:e.insertMode,description:l.localize(400,"Controls whether words are overwritten when accepting completions. Note that this depends on extensions opting into this feature.")},"editor.suggest.filterGraceful":{type:"boolean",default:e.filterGraceful,description:l.localize(401,"Controls whether filtering and sorting suggestions accounts for small typos.")},"editor.suggest.localityBonus":{type:"boolean",default:e.localityBonus,description:l.localize(402,"Controls whether sorting favors words that appear close to the cursor.")},"editor.suggest.shareSuggestSelections":{type:"boolean",default:e.shareSuggestSelections,markdownDescription:l.localize(403,"Controls whether remembered suggestion selections are shared between multiple workspaces and windows (needs `#editor.suggestSelection#`).")},"editor.suggest.selectionMode":{type:"string",enum:["always","never","whenTriggerCharacter","whenQuickSuggestion"],enumDescriptions:[l.localize(404,"Always select a suggestion when automatically triggering IntelliSense."),l.localize(405,"Never select a suggestion when automatically triggering IntelliSense."),l.localize(406,"Select a suggestion only when triggering IntelliSense from a trigger character."),l.localize(407,"Select a suggestion only when triggering IntelliSense as you type.")],default:e.selectionMode,markdownDescription:l.localize(408,"Controls whether a suggestion is selected when the widget shows. Note that this only applies to automatically triggered suggestions ({0} and {1}) and that a suggestion is always selected when explicitly invoked, e.g via `Ctrl+Space`.","`#editor.quickSuggestions#`","`#editor.suggestOnTriggerCharacters#`")},"editor.suggest.snippetsPreventQuickSuggestions":{type:"boolean",default:e.snippetsPreventQuickSuggestions,description:l.localize(409,"Controls whether an active snippet prevents quick suggestions.")},"editor.suggest.showIcons":{type:"boolean",default:e.showIcons,description:l.localize(410,"Controls whether to show or hide icons in suggestions.")},"editor.suggest.showStatusBar":{type:"boolean",default:e.showStatusBar,description:l.localize(411,"Controls the visibility of the status bar at the bottom of the suggest widget.")},"editor.suggest.preview":{type:"boolean",default:e.preview,description:l.localize(412,"Controls whether to preview the suggestion outcome in the editor.")},"editor.suggest.showInlineDetails":{type:"boolean",default:e.showInlineDetails,description:l.localize(413,"Controls whether suggest details show inline with the label or only in the details widget.")},"editor.suggest.maxVisibleSuggestions":{type:"number",deprecationMessage:l.localize(414,"This setting is deprecated. The suggest widget can now be resized.")},"editor.suggest.filteredTypes":{type:"object",deprecationMessage:l.localize(415,"This setting is deprecated, please use separate settings like 'editor.suggest.showKeywords' or 'editor.suggest.showSnippets' instead.")},"editor.suggest.showMethods":{type:"boolean",default:!0,markdownDescription:l.localize(416,"When enabled IntelliSense shows `method`-suggestions.")},"editor.suggest.showFunctions":{type:"boolean",default:!0,markdownDescription:l.localize(417,"When enabled IntelliSense shows `function`-suggestions.")},"editor.suggest.showConstructors":{type:"boolean",default:!0,markdownDescription:l.localize(418,"When enabled IntelliSense shows `constructor`-suggestions.")},"editor.suggest.showDeprecated":{type:"boolean",default:!0,markdownDescription:l.localize(419,"When enabled IntelliSense shows `deprecated`-suggestions.")},"editor.suggest.matchOnWordStartOnly":{type:"boolean",default:!0,markdownDescription:l.localize(420,"When enabled IntelliSense filtering requires that the first character matches on a word start. For example, `c` on `Console` or `WebContext` but _not_ on `description`. When disabled IntelliSense will show more results but still sorts them by match quality.")},"editor.suggest.showFields":{type:"boolean",default:!0,markdownDescription:l.localize(421,"When enabled IntelliSense shows `field`-suggestions.")},"editor.suggest.showVariables":{type:"boolean",default:!0,markdownDescription:l.localize(422,"When enabled IntelliSense shows `variable`-suggestions.")},"editor.suggest.showClasses":{type:"boolean",default:!0,markdownDescription:l.localize(423,"When enabled IntelliSense shows `class`-suggestions.")},"editor.suggest.showStructs":{type:"boolean",default:!0,markdownDescription:l.localize(424,"When enabled IntelliSense shows `struct`-suggestions.")},"editor.suggest.showInterfaces":{type:"boolean",default:!0,markdownDescription:l.localize(425,"When enabled IntelliSense shows `interface`-suggestions.")},"editor.suggest.showModules":{type:"boolean",default:!0,markdownDescription:l.localize(426,"When enabled IntelliSense shows `module`-suggestions.")},"editor.suggest.showProperties":{type:"boolean",default:!0,markdownDescription:l.localize(427,"When enabled IntelliSense shows `property`-suggestions.")},"editor.suggest.showEvents":{type:"boolean",default:!0,markdownDescription:l.localize(428,"When enabled IntelliSense shows `event`-suggestions.")},"editor.suggest.showOperators":{type:"boolean",default:!0,markdownDescription:l.localize(429,"When enabled IntelliSense shows `operator`-suggestions.")},"editor.suggest.showUnits":{type:"boolean",default:!0,markdownDescription:l.localize(430,"When enabled IntelliSense shows `unit`-suggestions.")},"editor.suggest.showValues":{type:"boolean",default:!0,markdownDescription:l.localize(431,"When enabled IntelliSense shows `value`-suggestions.")},"editor.suggest.showConstants":{type:"boolean",default:!0,markdownDescription:l.localize(432,"When enabled IntelliSense shows `constant`-suggestions.")},"editor.suggest.showEnums":{type:"boolean",default:!0,markdownDescription:l.localize(433,"When enabled IntelliSense shows `enum`-suggestions.")},"editor.suggest.showEnumMembers":{type:"boolean",default:!0,markdownDescription:l.localize(434,"When enabled IntelliSense shows `enumMember`-suggestions.")},"editor.suggest.showKeywords":{type:"boolean",default:!0,markdownDescription:l.localize(435,"When enabled IntelliSense shows `keyword`-suggestions.")},"editor.suggest.showWords":{type:"boolean",default:!0,markdownDescription:l.localize(436,"When enabled IntelliSense shows `text`-suggestions.")},"editor.suggest.showColors":{type:"boolean",default:!0,markdownDescription:l.localize(437,"When enabled IntelliSense shows `color`-suggestions.")},"editor.suggest.showFiles":{type:"boolean",default:!0,markdownDescription:l.localize(438,"When enabled IntelliSense shows `file`-suggestions.")},"editor.suggest.showReferences":{type:"boolean",default:!0,markdownDescription:l.localize(439,"When enabled IntelliSense shows `reference`-suggestions.")},"editor.suggest.showCustomcolors":{type:"boolean",default:!0,markdownDescription:l.localize(440,"When enabled IntelliSense shows `customcolor`-suggestions.")},"editor.suggest.showFolders":{type:"boolean",default:!0,markdownDescription:l.localize(441,"When enabled IntelliSense shows `folder`-suggestions.")},"editor.suggest.showTypeParameters":{type:"boolean",default:!0,markdownDescription:l.localize(442,"When enabled IntelliSense shows `typeParameter`-suggestions.")},"editor.suggest.showSnippets":{type:"boolean",default:!0,markdownDescription:l.localize(443,"When enabled IntelliSense shows `snippet`-suggestions.")},"editor.suggest.showUsers":{type:"boolean",default:!0,markdownDescription:l.localize(444,"When enabled IntelliSense shows `user`-suggestions.")},"editor.suggest.showIssues":{type:"boolean",default:!0,markdownDescription:l.localize(445,"When enabled IntelliSense shows `issues`-suggestions.")}})}validate(e){if(!e||typeof e!="object")return this.defaultValue;const t=e;return{insertMode:Fe(t.insertMode,this.defaultValue.insertMode,["insert","replace"]),filterGraceful:$(t.filterGraceful,this.defaultValue.filterGraceful),snippetsPreventQuickSuggestions:$(t.snippetsPreventQuickSuggestions,this.defaultValue.filterGraceful),localityBonus:$(t.localityBonus,this.defaultValue.localityBonus),shareSuggestSelections:$(t.shareSuggestSelections,this.defaultValue.shareSuggestSelections),selectionMode:Fe(t.selectionMode,this.defaultValue.selectionMode,["always","never","whenQuickSuggestion","whenTriggerCharacter"]),showIcons:$(t.showIcons,this.defaultValue.showIcons),showStatusBar:$(t.showStatusBar,this.defaultValue.showStatusBar),preview:$(t.preview,this.defaultValue.preview),previewMode:Fe(t.previewMode,this.defaultValue.previewMode,["prefix","subword","subwordSmart"]),showInlineDetails:$(t.showInlineDetails,this.defaultValue.showInlineDetails),showMethods:$(t.showMethods,this.defaultValue.showMethods),showFunctions:$(t.showFunctions,this.defaultValue.showFunctions),showConstructors:$(t.showConstructors,this.defaultValue.showConstructors),showDeprecated:$(t.showDeprecated,this.defaultValue.showDeprecated),matchOnWordStartOnly:$(t.matchOnWordStartOnly,this.defaultValue.matchOnWordStartOnly),showFields:$(t.showFields,this.defaultValue.showFields),showVariables:$(t.showVariables,this.defaultValue.showVariables),showClasses:$(t.showClasses,this.defaultValue.showClasses),showStructs:$(t.showStructs,this.defaultValue.showStructs),showInterfaces:$(t.showInterfaces,this.defaultValue.showInterfaces),showModules:$(t.showModules,this.defaultValue.showModules),showProperties:$(t.showProperties,this.defaultValue.showProperties),showEvents:$(t.showEvents,this.defaultValue.showEvents),showOperators:$(t.showOperators,this.defaultValue.showOperators),showUnits:$(t.showUnits,this.defaultValue.showUnits),showValues:$(t.showValues,this.defaultValue.showValues),showConstants:$(t.showConstants,this.defaultValue.showConstants),showEnums:$(t.showEnums,this.defaultValue.showEnums),showEnumMembers:$(t.showEnumMembers,this.defaultValue.showEnumMembers),showKeywords:$(t.showKeywords,this.defaultValue.showKeywords),showWords:$(t.showWords,this.defaultValue.showWords),showColors:$(t.showColors,this.defaultValue.showColors),showFiles:$(t.showFiles,this.defaultValue.showFiles),showReferences:$(t.showReferences,this.defaultValue.showReferences),showFolders:$(t.showFolders,this.defaultValue.showFolders),showTypeParameters:$(t.showTypeParameters,this.defaultValue.showTypeParameters),showSnippets:$(t.showSnippets,this.defaultValue.showSnippets),showUsers:$(t.showUsers,this.defaultValue.showUsers),showIssues:$(t.showIssues,this.defaultValue.showIssues)}}}class hk extends Ye{constructor(){super(129,"smartSelect",{selectLeadingAndTrailingWhitespace:!0,selectSubwords:!0},{"editor.smartSelect.selectLeadingAndTrailingWhitespace":{description:l.localize(446,"Whether leading and trailing whitespace should always be selected."),default:!0,type:"boolean"},"editor.smartSelect.selectSubwords":{description:l.localize(447,"Whether subwords (like 'foo' in 'fooBar' or 'foo_bar') should be selected."),default:!0,type:"boolean"}})}validate(e){return!e||typeof e!="object"?this.defaultValue:{selectLeadingAndTrailingWhitespace:$(e.selectLeadingAndTrailingWhitespace,this.defaultValue.selectLeadingAndTrailingWhitespace),selectSubwords:$(e.selectSubwords,this.defaultValue.selectSubwords)}}}class dk extends Ye{constructor(){const e=[];super(147,"wordSegmenterLocales",e,{anyOf:[{type:"string"},{type:"array",items:{type:"string"}}],description:l.localize(448,"Locales to be used for word segmentation when doing word related navigations or operations. Specify the BCP 47 language tag of the word you wish to recognize (e.g., ja, zh-CN, zh-Hant-TW, etc.)."),type:"array",items:{type:"string"},default:e})}validate(e){if(typeof e=="string"&&(e=[e]),Array.isArray(e)){const t=[];for(const i of e)if(typeof i=="string")try{Intl.Segmenter.supportedLocalesOf(i).length>0&&t.push(i)}catch{}return t}return this.defaultValue}}class uk extends Ye{constructor(){super(155,"wrappingIndent",1,{"editor.wrappingIndent":{type:"string",enum:["none","same","indent","deepIndent"],enumDescriptions:[l.localize(449,"No indentation. Wrapped lines begin at column 1."),l.localize(450,"Wrapped lines get the same indentation as the parent."),l.localize(451,"Wrapped lines get +1 indentation toward the parent."),l.localize(452,"Wrapped lines get +2 indentation toward the parent.")],description:l.localize(453,"Controls the indentation of wrapped lines."),default:"same"}})}validate(e){switch(e){case"none":return 0;case"same":return 1;case"indent":return 2;case"deepIndent":return 3}return 1}compute(e,t,i){return t.get(2)===2?0:i}}class fk extends Go{constructor(){super(166,{isDominatedByLongLines:!1,isWordWrapMinified:!1,isViewportWrapping:!1,wrappingColumn:-1})}compute(e,t,i){const n=t.get(165);return{isDominatedByLongLines:e.isDominatedByLongLines,isWordWrapMinified:n.isWordWrapMinified,isViewportWrapping:n.isViewportWrapping,wrappingColumn:n.wrappingColumn}}}class gk extends Ye{constructor(){const e={enabled:!0,showDropSelector:"afterDrop"};super(43,"dropIntoEditor",e,{"editor.dropIntoEditor.enabled":{type:"boolean",default:e.enabled,markdownDescription:l.localize(454,"Controls whether you can drag and drop a file into a text editor by holding down the `Shift` key (instead of opening the file in an editor).")},"editor.dropIntoEditor.showDropSelector":{type:"string",markdownDescription:l.localize(455,"Controls if a widget is shown when dropping files into the editor. This widget lets you control how the file is dropped."),enum:["afterDrop","never"],enumDescriptions:[l.localize(456,"Show the drop selector widget after a file is dropped into the editor."),l.localize(457,"Never show the drop selector widget. Instead the default drop provider is always used.")],default:"afterDrop"}})}validate(e){if(!e||typeof e!="object")return this.defaultValue;const t=e;return{enabled:$(t.enabled,this.defaultValue.enabled),showDropSelector:Fe(t.showDropSelector,this.defaultValue.showDropSelector,["afterDrop","never"])}}}class mk extends Ye{constructor(){const e={enabled:!0,showPasteSelector:"afterPaste"};super(97,"pasteAs",e,{"editor.pasteAs.enabled":{type:"boolean",default:e.enabled,markdownDescription:l.localize(458,"Controls whether you can paste content in different ways.")},"editor.pasteAs.showPasteSelector":{type:"string",markdownDescription:l.localize(459,"Controls if a widget is shown when pasting content in to the editor. This widget lets you control how the file is pasted."),enum:["afterPaste","never"],enumDescriptions:[l.localize(460,"Show the paste selector widget after content is pasted into the editor."),l.localize(461,"Never show the paste selector widget. Instead the default pasting behavior is always used.")],default:"afterPaste"}})}validate(e){if(!e||typeof e!="object")return this.defaultValue;const t=e;return{enabled:$(t.enabled,this.defaultValue.enabled),showPasteSelector:Fe(t.showPasteSelector,this.defaultValue.showPasteSelector,["afterPaste","never"])}}}const Vl=[];function A(o){return Vl[o.id]=o,o}const Fi={acceptSuggestionOnCommitCharacter:A(new se(0,"acceptSuggestionOnCommitCharacter",!0,{markdownDescription:l.localize(462,"Controls whether suggestions should be accepted on commit characters. For example, in JavaScript, the semi-colon (`;`) can be a commit character that accepts a suggestion and types that character.")})),acceptSuggestionOnEnter:A(new Ze(1,"acceptSuggestionOnEnter","on",["on","smart","off"],{markdownEnumDescriptions:["",l.localize(463,"Only accept a suggestion with `Enter` when it makes a textual change."),""],markdownDescription:l.localize(464,"Controls whether suggestions should be accepted on `Enter`, in addition to `Tab`. Helps to avoid ambiguity between inserting new lines or accepting suggestions.")})),accessibilitySupport:A(new TP),accessibilityPageSize:A(new Ie(3,"accessibilityPageSize",500,1,1073741824,{description:l.localize(465,"Controls the number of lines in the editor that can be read out by a screen reader at once. When we detect a screen reader we automatically set the default to be 500. Warning: this has a performance implication for numbers larger than the default."),tags:["accessibility"]})),allowOverflow:A(new se(4,"allowOverflow",!0)),allowVariableLineHeights:A(new se(5,"allowVariableLineHeights",!0,{description:l.localize(466,"Controls whether to allow using variable line heights in the editor.")})),allowVariableFonts:A(new se(6,"allowVariableFonts",!0,{description:l.localize(467,"Controls whether to allow using variable fonts in the editor.")})),allowVariableFontsInAccessibilityMode:A(new se(7,"allowVariableFontsInAccessibilityMode",!1,{description:l.localize(468,"Controls whether to allow using variable fonts in the editor in the accessibility mode."),tags:["accessibility"]})),ariaLabel:A(new si(8,"ariaLabel",l.localize(469,"Editor content"))),ariaRequired:A(new se(9,"ariaRequired",!1,void 0)),screenReaderAnnounceInlineSuggestion:A(new se(12,"screenReaderAnnounceInlineSuggestion",!0,{description:l.localize(470,"Control whether inline suggestions are announced by a screen reader."),tags:["accessibility"]})),autoClosingBrackets:A(new Ze(10,"autoClosingBrackets","languageDefined",["always","languageDefined","beforeWhitespace","never"],{enumDescriptions:["",l.localize(471,"Use language configurations to determine when to autoclose brackets."),l.localize(472,"Autoclose brackets only when the cursor is to the left of whitespace."),""],description:l.localize(473,"Controls whether the editor should automatically close brackets after the user adds an opening bracket.")})),autoClosingComments:A(new Ze(11,"autoClosingComments","languageDefined",["always","languageDefined","beforeWhitespace","never"],{enumDescriptions:["",l.localize(474,"Use language configurations to determine when to autoclose comments."),l.localize(475,"Autoclose comments only when the cursor is to the left of whitespace."),""],description:l.localize(476,"Controls whether the editor should automatically close comments after the user adds an opening comment.")})),autoClosingDelete:A(new Ze(13,"autoClosingDelete","auto",["always","auto","never"],{enumDescriptions:["",l.localize(477,"Remove adjacent closing quotes or brackets only if they were automatically inserted."),""],description:l.localize(478,"Controls whether the editor should remove adjacent closing quotes or brackets when deleting.")})),autoClosingOvertype:A(new Ze(14,"autoClosingOvertype","auto",["always","auto","never"],{enumDescriptions:["",l.localize(479,"Type over closing quotes or brackets only if they were automatically inserted."),""],description:l.localize(480,"Controls whether the editor should type over closing quotes or brackets.")})),autoClosingQuotes:A(new Ze(15,"autoClosingQuotes","languageDefined",["always","languageDefined","beforeWhitespace","never"],{enumDescriptions:["",l.localize(481,"Use language configurations to determine when to autoclose quotes."),l.localize(482,"Autoclose quotes only when the cursor is to the left of whitespace."),""],description:l.localize(483,"Controls whether the editor should automatically close quotes after the user adds an opening quote.")})),autoIndent:A(new Gh(16,"autoIndent",4,"full",["none","keep","brackets","advanced","full"],IP,{enumDescriptions:[l.localize(484,"The editor will not insert indentation automatically."),l.localize(485,"The editor will keep the current line's indentation."),l.localize(486,"The editor will keep the current line's indentation and honor language defined brackets."),l.localize(487,"The editor will keep the current line's indentation, honor language defined brackets and invoke special onEnterRules defined by languages."),l.localize(488,"The editor will keep the current line's indentation, honor language defined brackets, invoke special onEnterRules defined by languages, and honor indentationRules defined by languages.")],description:l.localize(489,"Controls whether the editor should automatically adjust the indentation when users type, paste, move or indent lines.")})),autoIndentOnPaste:A(new se(17,"autoIndentOnPaste",!1,{description:l.localize(490,"Controls whether the editor should automatically auto-indent the pasted content.")})),autoIndentOnPasteWithinString:A(new se(18,"autoIndentOnPasteWithinString",!0,{description:l.localize(491,"Controls whether the editor should automatically auto-indent the pasted content when pasted within a string. This takes effect when autoIndentOnPaste is true.")})),automaticLayout:A(new se(19,"automaticLayout",!1)),autoSurround:A(new Ze(20,"autoSurround","languageDefined",["languageDefined","quotes","brackets","never"],{enumDescriptions:[l.localize(492,"Use language configurations to determine when to automatically surround selections."),l.localize(493,"Surround with quotes but not brackets."),l.localize(494,"Surround with brackets but not quotes."),""],description:l.localize(495,"Controls whether the editor should automatically surround selections when typing quotes or brackets.")})),bracketPairColorization:A(new ak),bracketPairGuides:A(new lk),stickyTabStops:A(new se(132,"stickyTabStops",!1,{description:l.localize(496,"Emulate selection behavior of tab characters when using spaces for indentation. Selection will stick to tab stops.")})),codeLens:A(new se(23,"codeLens",!0,{description:l.localize(497,"Controls whether the editor shows CodeLens.")})),codeLensFontFamily:A(new si(24,"codeLensFontFamily","",{description:l.localize(498,"Controls the font family for CodeLens.")})),codeLensFontSize:A(new Ie(25,"codeLensFontSize",0,0,100,{type:"number",default:0,minimum:0,maximum:100,markdownDescription:l.localize(499,"Controls the font size in pixels for CodeLens. When set to 0, 90% of `#editor.fontSize#` is used.")})),colorDecorators:A(new se(26,"colorDecorators",!0,{description:l.localize(500,"Controls whether the editor should render the inline color decorators and color picker.")})),colorDecoratorActivatedOn:A(new Ze(168,"colorDecoratorsActivatedOn","clickAndHover",["clickAndHover","hover","click"],{enumDescriptions:[l.localize(501,"Make the color picker appear both on click and hover of the color decorator"),l.localize(502,"Make the color picker appear on hover of the color decorator"),l.localize(503,"Make the color picker appear on click of the color decorator")],description:l.localize(504,"Controls the condition to make a color picker appear from a color decorator.")})),colorDecoratorsLimit:A(new Ie(27,"colorDecoratorsLimit",500,1,1e6,{markdownDescription:l.localize(505,"Controls the max number of color decorators that can be rendered in an editor at once.")})),columnSelection:A(new se(28,"columnSelection",!1,{description:l.localize(506,"Enable that the selection with the mouse and keys is doing column selection.")})),comments:A(new NP),contextmenu:A(new se(30,"contextmenu",!0)),copyWithSyntaxHighlighting:A(new se(31,"copyWithSyntaxHighlighting",!0,{description:l.localize(507,"Controls whether syntax highlighting should be copied into the clipboard.")})),cursorBlinking:A(new Gh(32,"cursorBlinking",1,"blink",["blink","smooth","phase","expand","solid"],RP,{description:l.localize(508,"Control the cursor animation style.")})),cursorSmoothCaretAnimation:A(new Ze(33,"cursorSmoothCaretAnimation","off",["off","explicit","on"],{enumDescriptions:[l.localize(509,"Smooth caret animation is disabled."),l.localize(510,"Smooth caret animation is enabled only when the user moves the cursor with an explicit gesture."),l.localize(511,"Smooth caret animation is always enabled.")],description:l.localize(512,"Controls whether the smooth caret animation should be enabled.")})),cursorStyle:A(new Gh(34,"cursorStyle",vt.Line,"line",["line","block","underline","line-thin","block-outline","underline-thin"],MD,{description:l.localize(513,"Controls the cursor style in insert input mode.")})),overtypeCursorStyle:A(new Gh(92,"overtypeCursorStyle",vt.Block,"block",["line","block","underline","line-thin","block-outline","underline-thin"],MD,{description:l.localize(514,"Controls the cursor style in overtype input mode.")})),cursorSurroundingLines:A(new Ie(35,"cursorSurroundingLines",0,0,1073741824,{description:l.localize(515,"Controls the minimal number of visible leading lines (minimum 0) and trailing lines (minimum 1) surrounding the cursor. Known as 'scrollOff' or 'scrollOffset' in some other editors.")})),cursorSurroundingLinesStyle:A(new Ze(36,"cursorSurroundingLinesStyle","default",["default","all"],{enumDescriptions:[l.localize(516,"`cursorSurroundingLines` is enforced only when triggered via the keyboard or API."),l.localize(517,"`cursorSurroundingLines` is enforced always.")],markdownDescription:l.localize(518,"Controls when `#editor.cursorSurroundingLines#` should be enforced.")})),cursorWidth:A(new Ie(37,"cursorWidth",0,0,1073741824,{markdownDescription:l.localize(519,"Controls the width of the cursor when `#editor.cursorStyle#` is set to `line`.")})),cursorHeight:A(new Ie(38,"cursorHeight",0,0,1073741824,{markdownDescription:l.localize(520,"Controls the height of the cursor when `#editor.cursorStyle#` is set to `line`. Cursor's max height depends on line height.")})),disableLayerHinting:A(new se(39,"disableLayerHinting",!1)),disableMonospaceOptimizations:A(new se(40,"disableMonospaceOptimizations",!1)),domReadOnly:A(new se(41,"domReadOnly",!1)),doubleClickSelectsBlock:A(new se(173,"doubleClickSelectsBlock",!0,{description:l.localize(521,"Controls whether double-clicking next to a bracket or quote selects the content inside.")})),dragAndDrop:A(new se(42,"dragAndDrop",!0,{description:l.localize(522,"Controls whether the editor should allow moving selections via drag and drop.")})),emptySelectionClipboard:A(new AP),dropIntoEditor:A(new gk),editContext:A(new se(44,"editContext",!0,{description:l.localize(523,"Sets whether the EditContext API should be used instead of the text area to power input in the editor."),included:l.isChrome||l.isEdge||l.isNative})),renderRichScreenReaderContent:A(new se(107,"renderRichScreenReaderContent",!1,{markdownDescription:l.localize(524,"Whether to render rich screen reader content when the `#editor.editContext#` setting is enabled.")})),stickyScroll:A(new GP),experimentalGpuAcceleration:A(new Ze(46,"experimentalGpuAcceleration","off",["off","on"],{tags:["experimental"],enumDescriptions:[l.localize(525,"Use regular DOM-based rendering."),l.localize(526,"Use GPU acceleration.")],description:l.localize(527,"Controls whether to use the experimental GPU acceleration to render the editor.")})),experimentalWhitespaceRendering:A(new Ze(47,"experimentalWhitespaceRendering","svg",["svg","font","off"],{enumDescriptions:[l.localize(528,"Use a new rendering method with svgs."),l.localize(529,"Use a new rendering method with font characters."),l.localize(530,"Use the stable rendering method.")],description:l.localize(531,"Controls whether whitespace is rendered with a new, experimental method.")})),extraEditorClassName:A(new si(48,"extraEditorClassName","")),fastScrollSensitivity:A(new xi(49,"fastScrollSensitivity",5,o=>o<=0?5:o,{markdownDescription:l.localize(532,"Scrolling speed multiplier when pressing `Alt`.")})),find:A(new OP),fixedOverflowWidgets:A(new se(51,"fixedOverflowWidgets",!1)),folding:A(new se(52,"folding",!0,{description:l.localize(533,"Controls whether the editor has code folding enabled.")})),foldingStrategy:A(new Ze(53,"foldingStrategy","auto",["auto","indentation"],{enumDescriptions:[l.localize(534,"Use a language-specific folding strategy if available, else the indentation-based one."),l.localize(535,"Use the indentation-based folding strategy.")],description:l.localize(536,"Controls the strategy for computing folding ranges.")})),foldingHighlight:A(new se(54,"foldingHighlight",!0,{description:l.localize(537,"Controls whether the editor should highlight folded ranges.")})),foldingImportsByDefault:A(new se(55,"foldingImportsByDefault",!1,{description:l.localize(538,"Controls whether the editor automatically collapses import ranges.")})),foldingMaximumRegions:A(new Ie(56,"foldingMaximumRegions",5e3,10,65e3,{description:l.localize(539,"The maximum number of foldable regions. Increasing this value may result in the editor becoming less responsive when the current source has a large number of foldable regions.")})),unfoldOnClickAfterEndOfLine:A(new se(57,"unfoldOnClickAfterEndOfLine",!1,{description:l.localize(540,"Controls whether clicking on the empty content after a folded line will unfold the line.")})),fontFamily:A(new si(58,"fontFamily",Zi.fontFamily,{description:l.localize(541,"Controls the font family.")})),fontInfo:A(new PP),fontLigatures2:A(new io),fontSize:A(new zP),fontWeight:A(new Ub),fontVariations:A(new Vb),formatOnPaste:A(new se(64,"formatOnPaste",!1,{description:l.localize(542,"Controls whether the editor should automatically format the pasted content. A formatter must be available and the formatter should be able to format a range in a document.")})),formatOnType:A(new se(65,"formatOnType",!1,{description:l.localize(543,"Controls whether the editor should automatically format the line after typing.")})),glyphMargin:A(new se(66,"glyphMargin",!0,{description:l.localize(544,"Controls whether the editor should render the vertical glyph margin. Glyph margin is mostly used for debugging.")})),gotoLocation:A(new VP),hideCursorInOverviewRuler:A(new se(68,"hideCursorInOverviewRuler",!1,{description:l.localize(545,"Controls whether the cursor should be hidden in the overview ruler.")})),hover:A(new UP),inDiffEditor:A(new se(70,"inDiffEditor",!1)),inertialScroll:A(new se(158,"inertialScroll",!1,{description:l.localize(546,"Make scrolling inertial - mostly useful with touchpad on linux.")})),letterSpacing:A(new xi(72,"letterSpacing",Zi.letterSpacing,o=>xi.clamp(o,-5,20),{description:l.localize(547,"Controls the letter spacing in pixels.")})),lightbulb:A(new KP),lineDecorationsWidth:A(new qP),lineHeight:A(new YP),lineNumbers:A(new tk),lineNumbersMinChars:A(new Ie(77,"lineNumbersMinChars",5,1,300)),linkedEditing:A(new se(78,"linkedEditing",!1,{description:l.localize(548,"Controls whether the editor has linked editing enabled. Depending on the language, related symbols such as HTML tags, are updated while editing.")})),links:A(new se(79,"links",!0,{description:l.localize(549,"Controls whether the editor should detect links and make them clickable.")})),matchBrackets:A(new Ze(80,"matchBrackets","always",["always","near","never"],{description:l.localize(550,"Highlight matching brackets.")})),minimap:A(new ZP),mouseStyle:A(new Ze(82,"mouseStyle","text",["text","default","copy"])),mouseWheelScrollSensitivity:A(new xi(83,"mouseWheelScrollSensitivity",1,o=>o===0?1:o,{markdownDescription:l.localize(551,"A multiplier to be used on the `deltaX` and `deltaY` of mouse wheel scroll events.")})),mouseWheelZoom:A(new se(84,"mouseWheelZoom",!1,{markdownDescription:l.isMacintosh?l.localize(552,"Zoom the font of the editor when using mouse wheel and holding `Cmd`."):l.localize(553,"Zoom the font of the editor when using mouse wheel and holding `Ctrl`.")})),multiCursorMergeOverlapping:A(new se(85,"multiCursorMergeOverlapping",!0,{description:l.localize(554,"Merge multiple cursors when they are overlapping.")})),multiCursorModifier:A(new Gh(86,"multiCursorModifier","altKey","alt",["ctrlCmd","alt"],QP,{markdownEnumDescriptions:[l.localize(555,"Maps to `Control` on Windows and Linux and to `Command` on macOS."),l.localize(556,"Maps to `Alt` on Windows and Linux and to `Option` on macOS.")],markdownDescription:l.localize(557,"The modifier to be used to add multiple cursors with the mouse. The Go to Definition and Open Link mouse gestures will adapt such that they do not conflict with the [multicursor modifier](https://code.visualstudio.com/docs/editor/codebasics#_multicursor-modifier).")})),mouseMiddleClickAction:A(new Ze(87,"mouseMiddleClickAction","default",["default","openLink","ctrlLeftClick"],{description:l.localize(558,"Controls what happens when middle mouse button is clicked in the editor.")})),multiCursorPaste:A(new Ze(88,"multiCursorPaste","spread",["spread","full"],{markdownEnumDescriptions:[l.localize(559,"Each cursor pastes a single line of the text."),l.localize(560,"Each cursor pastes the full text.")],markdownDescription:l.localize(561,"Controls pasting when the line count of the pasted text matches the cursor count.")})),multiCursorLimit:A(new Ie(89,"multiCursorLimit",1e4,1,1e5,{markdownDescription:l.localize(562,"Controls the max number of cursors that can be in an active editor at once.")})),occurrencesHighlight:A(new Ze(90,"occurrencesHighlight","singleFile",["off","singleFile","multiFile"],{markdownEnumDescriptions:[l.localize(563,"Does not highlight occurrences."),l.localize(564,"Highlights occurrences only in the current file."),l.localize(565,"Experimental: Highlights occurrences across all valid open files.")],markdownDescription:l.localize(566,"Controls whether occurrences should be highlighted across open files.")})),occurrencesHighlightDelay:A(new Ie(91,"occurrencesHighlightDelay",0,0,2e3,{description:l.localize(567,"Controls the delay in milliseconds after which occurrences are highlighted."),tags:["preview"]})),overtypeOnPaste:A(new se(93,"overtypeOnPaste",!0,{description:l.localize(568,"Controls whether pasting should overtype.")})),overviewRulerBorder:A(new se(94,"overviewRulerBorder",!0,{description:l.localize(569,"Controls whether a border should be drawn around the overview ruler.")})),overviewRulerLanes:A(new Ie(95,"overviewRulerLanes",3,0,3)),padding:A(new XP),pasteAs:A(new mk),parameterHints:A(new JP),peekWidgetDefaultFocus:A(new Ze(99,"peekWidgetDefaultFocus","tree",["tree","editor"],{enumDescriptions:[l.localize(570,"Focus the tree when opening peek"),l.localize(571,"Focus the editor when opening peek")],description:l.localize(572,"Controls whether to focus the inline editor or the tree in the peek widget.")})),placeholder:A(new HP),definitionLinkOpensInPeek:A(new se(101,"definitionLinkOpensInPeek",!1,{description:l.localize(573,"Controls whether the Go to Definition mouse gesture always opens the peek widget.")})),quickSuggestions:A(new ek),quickSuggestionsDelay:A(new Ie(103,"quickSuggestionsDelay",10,0,1073741824,{description:l.localize(574,"Controls the delay in milliseconds after which quick suggestions will show up."),experiment:{mode:"auto"}})),readOnly:A(new se(104,"readOnly",!1)),readOnlyMessage:A(new nk),renameOnType:A(new se(106,"renameOnType",!1,{description:l.localize(575,"Controls whether the editor auto renames on type."),markdownDeprecationMessage:l.localize(576,"Deprecated, use `#editor.linkedEditing#` instead.")})),renderControlCharacters:A(new se(108,"renderControlCharacters",!0,{description:l.localize(577,"Controls whether the editor should render control characters."),restricted:!0})),renderFinalNewline:A(new Ze(109,"renderFinalNewline",l.isLinux?"dimmed":"on",["off","on","dimmed"],{description:l.localize(578,"Render last line number when the file ends with a newline.")})),renderLineHighlight:A(new Ze(110,"renderLineHighlight","line",["none","gutter","line","all"],{enumDescriptions:["","","",l.localize(579,"Highlights both the gutter and the current line.")],description:l.localize(580,"Controls how the editor should render the current line highlight.")})),renderLineHighlightOnlyWhenFocus:A(new se(111,"renderLineHighlightOnlyWhenFocus",!1,{description:l.localize(581,"Controls if the editor should render the current line highlight only when the editor is focused.")})),renderValidationDecorations:A(new Ze(112,"renderValidationDecorations","editable",["editable","on","off"])),renderWhitespace:A(new Ze(113,"renderWhitespace","selection",["none","boundary","selection","trailing","all"],{enumDescriptions:["",l.localize(582,"Render whitespace characters except for single spaces between words."),l.localize(583,"Render whitespace characters only on selected text."),l.localize(584,"Render only trailing whitespace characters."),""],description:l.localize(585,"Controls how the editor should render whitespace characters.")})),revealHorizontalRightPadding:A(new Ie(114,"revealHorizontalRightPadding",15,0,1e3)),roundedSelection:A(new se(115,"roundedSelection",!0,{description:l.localize(586,"Controls whether selections should have rounded corners.")})),rulers:A(new ik),scrollbar:A(new sk),scrollBeyondLastColumn:A(new Ie(118,"scrollBeyondLastColumn",4,0,1073741824,{description:l.localize(587,"Controls the number of extra characters beyond which the editor will scroll horizontally.")})),scrollBeyondLastLine:A(new se(119,"scrollBeyondLastLine",!0,{description:l.localize(588,"Controls whether the editor will scroll beyond the last line.")})),scrollOnMiddleClick:A(new se(171,"scrollOnMiddleClick",!1,{description:l.localize(589,"Controls whether the editor will scroll when the middle button is pressed.")})),scrollPredominantAxis:A(new se(120,"scrollPredominantAxis",!0,{description:l.localize(590,"Scroll only along the predominant axis when scrolling both vertically and horizontally at the same time. Prevents horizontal drift when scrolling vertically on a trackpad.")})),selectionClipboard:A(new se(121,"selectionClipboard",!0,{description:l.localize(591,"Controls whether the Linux primary clipboard should be supported."),included:l.isLinux})),selectionHighlight:A(new se(122,"selectionHighlight",!0,{description:l.localize(592,"Controls whether the editor should highlight matches similar to the selection.")})),selectionHighlightMaxLength:A(new Ie(123,"selectionHighlightMaxLength",200,0,1073741824,{description:l.localize(593,"Controls how many characters can be in the selection before similiar matches are not highlighted. Set to zero for unlimited.")})),selectionHighlightMultiline:A(new se(124,"selectionHighlightMultiline",!1,{description:l.localize(594,"Controls whether the editor should highlight selection matches that span multiple lines.")})),selectOnLineNumbers:A(new se(125,"selectOnLineNumbers",!0)),showFoldingControls:A(new Ze(126,"showFoldingControls","mouseover",["always","never","mouseover"],{enumDescriptions:[l.localize(595,"Always show the folding controls."),l.localize(596,"Never show the folding controls and reduce the gutter size."),l.localize(597,"Only show the folding controls when the mouse is over the gutter.")],description:l.localize(598,"Controls when the folding controls on the gutter are shown.")})),showUnused:A(new se(127,"showUnused",!0,{description:l.localize(599,"Controls fading out of unused code.")})),showDeprecated:A(new se(157,"showDeprecated",!0,{description:l.localize(600,"Controls strikethrough deprecated variables.")})),inlayHints:A(new jP),snippetSuggestions:A(new Ze(128,"snippetSuggestions","inline",["top","bottom","inline","none"],{enumDescriptions:[l.localize(601,"Show snippet suggestions on top of other suggestions."),l.localize(602,"Show snippet suggestions below other suggestions."),l.localize(603,"Show snippets suggestions with other suggestions."),l.localize(604,"Do not show snippet suggestions.")],description:l.localize(605,"Controls whether snippets are shown with other suggestions and how they are sorted.")})),smartSelect:A(new hk),smoothScrolling:A(new se(130,"smoothScrolling",!1,{description:l.localize(606,"Controls whether the editor will scroll using an animation.")})),stopRenderingLineAfter:A(new Ie(133,"stopRenderingLineAfter",1e4,-1,1073741824)),suggest:A(new ck),inlineSuggest:A(new rk),inlineCompletionsAccessibilityVerbose:A(new se(169,"inlineCompletionsAccessibilityVerbose",!1,{description:l.localize(607,"Controls whether the accessibility hint should be provided to screen reader users when an inline completion is shown.")})),suggestFontSize:A(new Ie(135,"suggestFontSize",0,0,1e3,{markdownDescription:l.localize(608,"Font size for the suggest widget. When set to {0}, the value of {1} is used.","`0`","`#editor.fontSize#`")})),suggestLineHeight:A(new Ie(136,"suggestLineHeight",0,0,1e3,{markdownDescription:l.localize(609,"Line height for the suggest widget. When set to {0}, the value of {1} is used. The minimum value is 8.","`0`","`#editor.lineHeight#`")})),suggestOnTriggerCharacters:A(new se(137,"suggestOnTriggerCharacters",!0,{description:l.localize(610,"Controls whether suggestions should automatically show up when typing trigger characters.")})),suggestSelection:A(new Ze(138,"suggestSelection","first",["first","recentlyUsed","recentlyUsedByPrefix"],{markdownEnumDescriptions:[l.localize(611,"Always select the first suggestion."),l.localize(612,"Select recent suggestions unless further typing selects one, e.g. `console.| -> console.log` because `log` has been completed recently."),l.localize(613,"Select suggestions based on previous prefixes that have completed those suggestions, e.g. `co -> console` and `con -> const`.")],description:l.localize(614,"Controls how suggestions are pre-selected when showing the suggest list.")})),tabCompletion:A(new Ze(139,"tabCompletion","off",["on","off","onlySnippets"],{enumDescriptions:[l.localize(615,"Tab complete will insert the best matching suggestion when pressing tab."),l.localize(616,"Disable tab completions."),l.localize(617,"Tab complete snippets when their prefix match. Works best when 'quickSuggestions' aren't enabled.")],description:l.localize(618,"Enables tab completions.")})),tabIndex:A(new Ie(140,"tabIndex",0,-1,1073741824)),trimWhitespaceOnDelete:A(new se(141,"trimWhitespaceOnDelete",!1,{description:l.localize(619,"Controls whether the editor will also delete the next line's indentation whitespace when deleting a newline.")})),unicodeHighlight:A(new ok),unusualLineTerminators:A(new Ze(143,"unusualLineTerminators","prompt",["auto","off","prompt"],{enumDescriptions:[l.localize(620,"Unusual line terminators are automatically removed."),l.localize(621,"Unusual line terminators are ignored."),l.localize(622,"Unusual line terminators prompt to be removed.")],description:l.localize(623,"Remove unusual line terminators that might cause problems.")})),useShadowDOM:A(new se(144,"useShadowDOM",!0)),useTabStops:A(new se(145,"useTabStops",!0,{description:l.localize(624,"Spaces and tabs are inserted and deleted in alignment with tab stops.")})),wordBreak:A(new Ze(146,"wordBreak","normal",["normal","keepAll"],{markdownEnumDescriptions:[l.localize(625,"Use the default line break rule."),l.localize(626,"Word breaks should not be used for Chinese/Japanese/Korean (CJK) text. Non-CJK text behavior is the same as for normal.")],description:l.localize(627,"Controls the word break rules used for Chinese/Japanese/Korean (CJK) text.")})),wordSegmenterLocales:A(new dk),wordSeparators:A(new si(148,"wordSeparators",l.USUAL_WORD_SEPARATORS,{description:l.localize(628,"Characters that will be used as word separators when doing word related navigations or operations.")})),wordWrap:A(new Ze(149,"wordWrap","off",["off","on","wordWrapColumn","bounded"],{markdownEnumDescriptions:[l.localize(629,"Lines will never wrap."),l.localize(630,"Lines will wrap at the viewport width."),l.localize(631,"Lines will wrap at `#editor.wordWrapColumn#`."),l.localize(632,"Lines will wrap at the minimum of viewport and `#editor.wordWrapColumn#`.")],description:l.localize(633,"Controls how lines should wrap.")})),wordWrapBreakAfterCharacters:A(new si(150,"wordWrapBreakAfterCharacters"," })]?|/&.,;¢°′″‰℃、。。、¢,.:;?!%・・ゝゞヽヾーァィゥェォッャュョヮヵヶぁぃぅぇぉっゃゅょゎゕゖㇰㇱㇲㇳㇴㇵㇶㇷㇸㇹㇺㇻㇼㇽㇾㇿ々〻ァィゥェォャュョッー”〉》」』】〕)]}」")),wordWrapBreakBeforeCharacters:A(new si(151,"wordWrapBreakBeforeCharacters","([{‘“〈《「『【〔([{「£¥$£¥++")),wordWrapColumn:A(new Ie(152,"wordWrapColumn",80,1,1073741824,{markdownDescription:l.localize(634,"Controls the wrapping column of the editor when `#editor.wordWrap#` is `wordWrapColumn` or `bounded`.")})),wordWrapOverride1:A(new Ze(153,"wordWrapOverride1","inherit",["off","on","inherit"])),wordWrapOverride2:A(new Ze(154,"wordWrapOverride2","inherit",["off","on","inherit"])),wrapOnEscapedLineFeeds:A(new se(160,"wrapOnEscapedLineFeeds",!1,{markdownDescription:l.localize(635,'Controls whether literal `\\n` shall trigger a wordWrap when `#editor.wordWrap#` is enabled.\n\nFor example:\n```c\nchar* str="hello\\nworld"\n```\nwill be displayed as\n```c\nchar* str="hello\\n\n world"\n```')})),effectiveCursorStyle:A(new kP),editorClassName:A(new MP),defaultColorDecorators:A(new Ze(167,"defaultColorDecorators","auto",["auto","always","never"],{enumDescriptions:[l.localize(636,"Show default color decorators only when no extension provides colors decorators."),l.localize(637,"Always show default color decorators."),l.localize(638,"Never show default color decorators.")],description:l.localize(639,"Controls whether inline color decorations should be shown using the default document color provider.")})),pixelRatio:A(new WP),tabFocusMode:A(new se(164,"tabFocusMode",!1,{markdownDescription:l.localize(640,"Controls whether the editor receives tabs or defers them to the workbench for navigation.")})),layoutInfo:A(new Bl),wrappingInfo:A(new fk),wrappingIndent:A(new uk),wrappingStrategy:A(new $P),effectiveEditContextEnabled:A(new FP),effectiveAllowVariableFonts:A(new BP)};function pk(o,e){const t=o;typeof t.vscodeWindowId!="number"&&Object.defineProperty(t,"vscodeWindowId",{get:()=>e})}const Ae=window,$_=class $_{constructor(){this.mapWindowIdToZoomFactor=new Map}getZoomFactor(e){return this.mapWindowIdToZoomFactor.get(this.getWindowId(e))??1}getWindowId(e){return e.vscodeWindowId}};$_.INSTANCE=new $_;let $b=$_;function OD(o,e,t){typeof e=="string"&&(e=o.matchMedia(e)),e.addEventListener("change",t)}function Kb(o){return $b.INSTANCE.getZoomFactor(o)}const Ul=navigator.userAgent,di=Ul.indexOf("Firefox")>=0,Ff=Ul.indexOf("AppleWebKit")>=0,jh=Ul.indexOf("Chrome")>=0,$r=!jh&&Ul.indexOf("Safari")>=0,PD=!jh&&!$r&&Ff;Ul.indexOf("Electron/")>=0;const kD=Ul.indexOf("Android")>=0;let Gb=!1;if(typeof Ae.matchMedia=="function"){const o=Ae.matchMedia("(display-mode: standalone) or (display-mode: window-controls-overlay)"),e=Ae.matchMedia("(display-mode: fullscreen)");Gb=o.matches,OD(Ae,o,({matches:t})=>{Gb&&e.matches||(Gb=t)})}function Bf(){return globalThis.MonacoEnvironment}const qh={clipboard:{writeText:l.isNative||document.queryCommandSupported&&document.queryCommandSupported("copy")||!!(navigator&&navigator.clipboard&&navigator.clipboard.writeText),readText:l.isNative||!!(navigator&&navigator.clipboard&&navigator.clipboard.readText)},pointerEvents:Ae.PointerEvent&&("ontouchstart"in Ae||navigator.maxTouchPoints>0)};function jb(o,e){if(typeof o=="number"){if(o===0)return null;const t=(o&65535)>>>0,i=(o&4294901760)>>>16;return i!==0?new qb([zf(t,e),zf(i,e)]):new qb([zf(t,e)])}else{const t=[];for(let i=0;i<o.length;i++)t.push(zf(o[i],e));return new qb(t)}}function zf(o,e){const t=!!(o&2048),i=!!(o&256),n=e===2?i:t,s=!!(o&1024),r=!!(o&512),a=e===2?t:i,c=o&255;return new Yh(n,s,r,a,c)}class Yh{constructor(e,t,i,n,s){this.ctrlKey=e,this.shiftKey=t,this.altKey=i,this.metaKey=n,this.keyCode=s}isModifierKey(){return this.keyCode===0||this.keyCode===5||this.keyCode===57||this.keyCode===6||this.keyCode===4}isDuplicateModifierCase(){return this.ctrlKey&&this.keyCode===5||this.shiftKey&&this.keyCode===4||this.altKey&&this.keyCode===6||this.metaKey&&this.keyCode===57}}class qb{constructor(e){if(e.length===0)throw l.illegalArgument("chords");this.chords=e}}class _k{constructor(e,t,i,n,s,r){this.ctrlKey=e,this.shiftKey=t,this.altKey=i,this.metaKey=n,this.keyLabel=s,this.keyAriaLabel=r}}class bk{}function Ck(o){if(o.charCode){const t=String.fromCharCode(o.charCode).toUpperCase();return l.KeyCodeUtils.fromString(t)}const e=o.keyCode;if(e===3)return 7;if(di)switch(e){case 59:return 85;case 60:if(l.isLinux)return 97;break;case 61:return 86;case 107:return 109;case 109:return 111;case 173:return 88;case 224:if(l.isMacintosh)return 57;break}else if(Ff){if(l.isMacintosh&&e===93)return 57;if(!l.isMacintosh&&e===92)return 57}return l.EVENT_KEY_CODE_MAP[e]||0}const vk=l.isMacintosh?256:2048,wk=512,Sk=1024,yk=l.isMacintosh?2048:256;class Be{constructor(e){this._standardKeyboardEventBrand=!0;const t=e;this.browserEvent=t,this.target=t.target,this.ctrlKey=t.ctrlKey,this.shiftKey=t.shiftKey,this.altKey=t.altKey,this.metaKey=t.metaKey,this.altGraphKey=t.getModifierState?.("AltGraph"),this.keyCode=Ck(t),this.code=t.code,this.ctrlKey=this.ctrlKey||this.keyCode===5,this.altKey=this.altKey||this.keyCode===6,this.shiftKey=this.shiftKey||this.keyCode===4,this.metaKey=this.metaKey||this.keyCode===57,this._asKeybinding=this._computeKeybinding(),this._asKeyCodeChord=this._computeKeyCodeChord()}preventDefault(){this.browserEvent&&this.browserEvent.preventDefault&&this.browserEvent.preventDefault()}stopPropagation(){this.browserEvent&&this.browserEvent.stopPropagation&&this.browserEvent.stopPropagation()}toKeyCodeChord(){return this._asKeyCodeChord}equals(e){return this._asKeybinding===e}_computeKeybinding(){let e=0;l.isModifierKey(this.keyCode)||(e=this.keyCode);let t=0;return this.ctrlKey&&(t|=vk),this.altKey&&(t|=wk),this.shiftKey&&(t|=Sk),this.metaKey&&(t|=yk),t|=e,t}_computeKeyCodeChord(){let e=0;return l.isModifierKey(this.keyCode)||(e=this.keyCode),new Yh(this.ctrlKey,this.shiftKey,this.altKey,this.metaKey,e)}}const FD=new WeakMap;function Lk(o){if(!o.parent||o.parent===o)return null;try{const e=o.location,t=o.parent.location;if(e.origin!=="null"&&t.origin!=="null"&&e.origin!==t.origin)return null}catch{return null}return o.parent}class Dk{static getSameOriginWindowChain(e){let t=FD.get(e);if(!t){t=[],FD.set(e,t);let i=e,n;do n=Lk(i),n?t.push({window:new WeakRef(i),iframeElement:i.frameElement||null}):t.push({window:new WeakRef(i),iframeElement:null}),i=n;while(i)}return t.slice(0)}static getPositionOfChildWindowRelativeToAncestorWindow(e,t){if(!t||e===t)return{top:0,left:0};let i=0,n=0;const s=this.getSameOriginWindowChain(e);for(const r of s){const a=r.window.deref();if(i+=a?.scrollY??0,n+=a?.scrollX??0,a===t||!r.iframeElement)break;const c=r.iframeElement.getBoundingClientRect();i+=c.top,n+=c.left}return{top:i,left:n}}}class Bi{constructor(e,t){this.timestamp=Date.now(),this.browserEvent=t,this.leftButton=t.button===0,this.middleButton=t.button===1,this.rightButton=t.button===2,this.buttons=t.buttons,this.defaultPrevented=t.defaultPrevented,this.target=t.target,this.detail=t.detail||1,t.type==="dblclick"&&(this.detail=2),this.ctrlKey=t.ctrlKey,this.shiftKey=t.shiftKey,this.altKey=t.altKey,this.metaKey=t.metaKey,this.posx=t.pageX,this.posy=t.pageY;const i=Dk.getPositionOfChildWindowRelativeToAncestorWindow(e,t.view);this.posx-=i.left,this.posy-=i.top}preventDefault(){this.browserEvent.preventDefault()}stopPropagation(){this.browserEvent.stopPropagation()}}class Kr{constructor(e,t=0,i=0){this.browserEvent=e||null,this.target=e?e.target||e.targetNode||e.srcElement:null,this.deltaY=i,this.deltaX=t;let n=!1;if(jh){const s=navigator.userAgent.match(/Chrome\/(\d+)/);n=(s?parseInt(s[1]):123)<=122}if(e){const s=e,r=e,a=e.view?.devicePixelRatio||1;if(typeof s.wheelDeltaY<"u")n?this.deltaY=s.wheelDeltaY/(120*a):this.deltaY=s.wheelDeltaY/120;else if(typeof r.VERTICAL_AXIS<"u"&&r.axis===r.VERTICAL_AXIS)this.deltaY=-r.detail/3;else if(e.type==="wheel"){const c=e;c.deltaMode===c.DOM_DELTA_LINE?di&&!l.isMacintosh?this.deltaY=-e.deltaY/3:this.deltaY=-e.deltaY:this.deltaY=-e.deltaY/40}if(typeof s.wheelDeltaX<"u")$r&&l.isWindows?this.deltaX=-(s.wheelDeltaX/120):n?this.deltaX=s.wheelDeltaX/(120*a):this.deltaX=s.wheelDeltaX/120;else if(typeof r.HORIZONTAL_AXIS<"u"&&r.axis===r.HORIZONTAL_AXIS)this.deltaX=-e.detail/3;else if(e.type==="wheel"){const c=e;c.deltaMode===c.DOM_DELTA_LINE?di&&!l.isMacintosh?this.deltaX=-e.deltaX/3:this.deltaX=-e.deltaX:this.deltaX=-e.deltaX/40}this.deltaY===0&&this.deltaX===0&&e.wheelDelta&&(n?this.deltaY=e.wheelDelta/(120*a):this.deltaY=e.wheelDelta/120)}}preventDefault(){this.browserEvent?.preventDefault()}stopPropagation(){this.browserEvent?.stopPropagation()}}class Vt{constructor(e,t,i){this.owner=e,this.debugNameSource=t,this.referenceFn=i}getDebugName(e){return xk(e,this)}}const BD=new Map,Yb=new WeakMap;function xk(o,e){const t=Yb.get(o);if(t)return t;const i=Ek(o,e);if(i){let n=BD.get(i)??0;n++,BD.set(i,n);const s=n===1?i:`${i}#${n}`;return Yb.set(o,s),s}}function Ek(o,e){const t=Yb.get(o);if(t)return t;const i=e.owner?Tk(e.owner)+".":"";let n;const s=e.debugNameSource;if(s!==void 0)if(typeof s=="function"){if(n=s(),n!==void 0)return i+n}else return i+s;const r=e.referenceFn;if(r!==void 0&&(n=Zb(r),n!==void 0))return i+n;if(e.owner!==void 0){const a=Ik(e.owner,o);if(a!==void 0)return i+a}}function Ik(o,e){for(const t in o)if(o[t]===e)return t}const zD=new Map,VD=new WeakMap;function Tk(o){const e=VD.get(o);if(e)return e;const t=UD(o)??"Object";let i=zD.get(t)??0;i++,zD.set(t,i);const n=i===1?t:`${t}#${i}`;return VD.set(o,n),n}function UD(o){const e=o.constructor;if(e)return e.name==="Object"?void 0:e.name}function Zb(o){const e=o.toString(),i=/\/\*\*\s*@description\s*([^*]*)\*\//.exec(e);return(i?i[1]:void 0)?.trim()}function Ei(o,e){return o===e}function Nk(){return(o,e)=>o===e}function Rk(o,e,t){return l.equals(o,e,t??Ei)}function Zh(o){return(e,t)=>l.equals(e,t,o??Ei)}function Qh(o,e){if(o===e)return!0;if(Array.isArray(o)&&Array.isArray(e)){if(o.length!==e.length)return!1;for(let t=0;t<o.length;t++)if(!Qh(o[t],e[t]))return!1;return!0}if(o&&typeof o=="object"&&e&&typeof e=="object"&&Object.getPrototypeOf(o)===Object.prototype&&Object.getPrototypeOf(e)===Object.prototype){const t=o,i=e,n=Object.keys(t),s=Object.keys(i),r=new Set(s);if(n.length!==s.length)return!1;for(const a of n)if(!r.has(a)||!Qh(t[a],i[a]))return!1;return!0}return!1}function Mk(){return(o,e)=>Qh(o,e)}function Ak(o,e){return JSON.stringify(o)===JSON.stringify(e)}function Ok(){return(o,e)=>JSON.stringify(o)===JSON.stringify(e)}function Qb(){return(o,e)=>o.equals(e)}function $D(o,e,t){return o==null||e===void 0||e===null?e===o:t(o,e)}function Gr(o){return(e,t)=>e==null||t===void 0||t===null?t===e:o(e,t)}_.equals=void 0,(function(o){o.strict=Ei,o.strictC=Nk,o.array=Rk,o.arrayC=Zh,o.structural=Qh,o.structuralC=Mk,o.jsonStringify=Ak,o.jsonStringifyC=Ok,o.thisC=Qb,o.ifDefined=$D,o.ifDefinedC=Gr})(_.equals||(_.equals={}));function KD(o){const e=new Error("BugIndicatingErrorRecovery: "+o);l.onUnexpectedError(e),console.error("recovered from an error that indicates a bug",e)}let jr;function Pk(o){jr?jr instanceof GD?jr.loggers.push(o):jr=new GD([jr,o]):jr=o}function Wt(){return jr}class GD{constructor(e){this.loggers=e}handleObservableCreated(e,t){for(const i of this.loggers)i.handleObservableCreated(e,t)}handleOnListenerCountChanged(e,t){for(const i of this.loggers)i.handleOnListenerCountChanged(e,t)}handleObservableUpdated(e,t){for(const i of this.loggers)i.handleObservableUpdated(e,t)}handleAutorunCreated(e,t){for(const i of this.loggers)i.handleAutorunCreated(e,t)}handleAutorunDisposed(e){for(const t of this.loggers)t.handleAutorunDisposed(e)}handleAutorunDependencyChanged(e,t,i){for(const n of this.loggers)n.handleAutorunDependencyChanged(e,t,i)}handleAutorunStarted(e){for(const t of this.loggers)t.handleAutorunStarted(e)}handleAutorunFinished(e){for(const t of this.loggers)t.handleAutorunFinished(e)}handleDerivedDependencyChanged(e,t,i){for(const n of this.loggers)n.handleDerivedDependencyChanged(e,t,i)}handleDerivedCleared(e){for(const t of this.loggers)t.handleDerivedCleared(e)}handleBeginTransaction(e){for(const t of this.loggers)t.handleBeginTransaction(e)}handleEndTransaction(e){for(const t of this.loggers)t.handleEndTransaction(e)}}function nt(o,e){const t=new $l(o,e);try{o(t)}finally{t.finish()}}let Vf;function Xh(o){if(Vf)o(Vf);else{const e=new $l(o,void 0);Vf=e;try{o(e)}finally{e.finish(),Vf=void 0}}}async function kk(o,e){const t=new $l(o,e);try{await o(t)}finally{t.finish()}}function Uf(o,e,t){o?e(o):nt(e,t)}class $l{constructor(e,t){this._fn=e,this._getDebugName=t,this._updatingObservers=[],Wt()?.handleBeginTransaction(this)}getDebugName(){return this._getDebugName?this._getDebugName():Zb(this._fn)}updateObserver(e,t){if(!this._updatingObservers){KD("Transaction already finished!"),nt(i=>{i.updateObserver(e,t)});return}this._updatingObservers.push({observer:e,observable:t}),e.beginUpdate(t)}finish(){const e=this._updatingObservers;if(!e){KD("transaction.finish() has already been called!");return}for(let t=0;t<e.length;t++){const{observer:i,observable:n}=e[t];i.endUpdate(n)}this._updatingObservers=null,Wt()?.handleEndTransaction(this)}debugGetUpdatingObservers(){return this._updatingObservers}}_.DebugLocation=void 0,(function(o){let e=!1;function t(){e=!0}o.enable=t;function i(){if(!e)return;const n=Error,s=n.stackTraceLimit;n.stackTraceLimit=3;const r=new Error().stack;return n.stackTraceLimit=s,Xb.fromStack(r,2)}o.ofCaller=i})(_.DebugLocation||(_.DebugLocation={}));class Xb{static fromStack(e,t){const i=e.split(`
|
||
`),n=Fk(i[t+1]);if(n)return new Xb(n.fileName,n.line,n.column,n.id)}constructor(e,t,i,n){this.fileName=e,this.line=t,this.column=i,this.id=n}}function Fk(o){const e=o.match(/\((.*):(\d+):(\d+)\)/);if(e)return{fileName:e[1],line:parseInt(e[2]),column:parseInt(e[3]),id:o};const t=o.match(/at ([^\(\)]*):(\d+):(\d+)/);if(t)return{fileName:t[1],line:parseInt(t[2]),column:parseInt(t[3]),id:o}}let Jb;function Bk(o){Jb=o}let jD;function zk(o){jD=o}class qD{get TChange(){return null}reportChanges(){this.get()}read(e){return e?e.readObservable(this):this.get()}map(e,t,i=_.DebugLocation.ofCaller()){const n=t===void 0?void 0:e,s=t===void 0?e:t;return Jb({owner:n,debugName:()=>{const r=Zb(s);if(r!==void 0)return r;const c=/^\s*\(?\s*([a-zA-Z_$][a-zA-Z_$0-9]*)\s*\)?\s*=>\s*\1(?:\??)\.([a-zA-Z_$][a-zA-Z_$0-9]*)\s*$/.exec(s.toString());if(c)return`${this.debugName}.${c[2]}`;if(!n)return`${this.debugName} (mapped)`},debugReferenceFn:s},r=>s(this.read(r),r),i)}flatten(){return Jb({owner:void 0,debugName:()=>`${this.debugName} (flattened)`},e=>this.read(e).read(e))}recomputeInitiallyAndOnChange(e,t){return e.add(jD(this,t)),this}}class Kl extends qD{constructor(e){super(),this._observers=new Set,Wt()?.handleObservableCreated(this,e)}addObserver(e){const t=this._observers.size;this._observers.add(e),t===0&&this.onFirstObserverAdded(),t!==this._observers.size&&Wt()?.handleOnListenerCountChanged(this,this._observers.size)}removeObserver(e){const t=this._observers.delete(e);t&&this._observers.size===0&&this.onLastObserverRemoved(),t&&Wt()?.handleOnListenerCountChanged(this,this._observers.size)}onFirstObserverAdded(){}onLastObserverRemoved(){}debugGetObservers(){return this._observers}}function W(o,e,t=_.DebugLocation.ofCaller()){let i;return typeof o=="string"?i=new Vt(void 0,o,void 0):i=new Vt(o,void 0,void 0),new Jh(i,e,Ei,t)}class Jh extends Kl{get debugName(){return this._debugNameData.getDebugName(this)??"ObservableValue"}constructor(e,t,i,n){super(n),this._debugNameData=e,this._equalityComparator=i,this._value=t,Wt()?.handleObservableUpdated(this,{hadValue:!1,newValue:t,change:void 0,didChange:!0,oldValue:void 0})}get(){return this._value}set(e,t,i){if(i===void 0&&this._equalityComparator(this._value,e))return;let n;t||(t=n=new $l(()=>{},()=>`Setting ${this.debugName}`));try{const s=this._value;this._setValue(e),Wt()?.handleObservableUpdated(this,{oldValue:s,newValue:e,change:i,didChange:!0,hadValue:!0});for(const r of this._observers)t.updateObserver(r,this),r.handleChange(this,i)}finally{n&&n.finish()}}toString(){return`${this.debugName}: ${this._value}`}_setValue(e){this._value=e}debugGetState(){return{value:this._value}}debugSetValue(e){this._value=e}}function Wb(o,e,t=_.DebugLocation.ofCaller()){let i;return typeof o=="string"?i=new Vt(void 0,o,void 0):i=new Vt(o,void 0,void 0),new Vk(i,e,Ei,t)}class Vk extends Jh{_setValue(e){this._value!==e&&(this._value&&this._value.dispose(),this._value=e)}dispose(){this._value?.dispose()}}class Uk extends Kl{get debugName(){return this._debugNameData.getDebugName(this)??"LazyObservableValue"}constructor(e,t,i,n){super(n),this._debugNameData=e,this._equalityComparator=i,this._isUpToDate=!0,this._deltas=[],this._updateCounter=0,this._value=t}get(){return this._update(),this._value}_update(){if(!this._isUpToDate)if(this._isUpToDate=!0,this._deltas.length>0){for(const e of this._deltas){Wt()?.handleObservableUpdated(this,{change:e,didChange:!0,oldValue:"(unknown)",newValue:this._value,hadValue:!0});for(const t of this._observers)t.handleChange(this,e)}this._deltas.length=0}else{Wt()?.handleObservableUpdated(this,{change:void 0,didChange:!0,oldValue:"(unknown)",newValue:this._value,hadValue:!0});for(const e of this._observers)e.handleChange(this,void 0)}}_beginUpdate(){if(this._updateCounter++,this._updateCounter===1)for(const e of this._observers)e.beginUpdate(this)}_endUpdate(){if(this._updateCounter--,this._updateCounter===0){this._update();const e=[...this._observers];for(const t of e)t.endUpdate(this)}}addObserver(e){const t=!this._observers.has(e)&&this._updateCounter>0;super.addObserver(e),t&&e.beginUpdate(this)}removeObserver(e){const t=this._observers.has(e)&&this._updateCounter>0;super.removeObserver(e),t&&e.endUpdate(this)}set(e,t,i){if(i===void 0&&this._equalityComparator(this._value,e))return;let n;t||(t=n=new $l(()=>{},()=>`Setting ${this.debugName}`));try{if(this._isUpToDate=!1,this._setValue(e),i!==void 0&&this._deltas.push(i),t.updateObserver({beginUpdate:()=>this._beginUpdate(),endUpdate:()=>this._endUpdate(),handleChange:(s,r)=>{},handlePossibleChange:s=>{}},this),this._updateCounter>1)for(const s of this._observers)s.handlePossibleChange(this)}finally{n&&n.finish()}}toString(){return`${this.debugName}: ${this._value}`}_setValue(e){this._value=e}}function Wh(o,e,t=_.DebugLocation.ofCaller()){return o.lazy?new Uk(new Vt(o.owner,o.debugName,void 0),e,o.equalsFn??Ei,t):new Jh(new Vt(o.owner,o.debugName,void 0),e,o.equalsFn??Ei,t)}function $k(o){switch(o){case 1:return"dependenciesMightHaveChanged";case 2:return"stale";case 3:return"upToDate";default:return"<unknown>"}}class Hh{get debugName(){return this._debugNameData.getDebugName(this)??"(anonymous)"}constructor(e,t,i,n){this._debugNameData=e,this._runFn=t,this._changeTracker=i,this._state=2,this._updateCount=0,this._disposed=!1,this._dependencies=new Set,this._dependenciesToBeRemoved=new Set,this._isRunning=!1,this._iteration=0,this._store=void 0,this._delayedStore=void 0,this._changeSummary=this._changeTracker?.createChangeSummary(void 0),Wt()?.handleAutorunCreated(this,n),this._run()}dispose(){if(!this._disposed){this._disposed=!0;for(const e of this._dependencies)e.removeObserver(this);this._dependencies.clear(),this._store!==void 0&&this._store.dispose(),this._delayedStore!==void 0&&this._delayedStore.dispose(),Wt()?.handleAutorunDisposed(this)}}_run(){const e=this._dependenciesToBeRemoved;this._dependenciesToBeRemoved=this._dependencies,this._dependencies=e,this._state=3;try{if(!this._disposed){Wt()?.handleAutorunStarted(this);const t=this._changeSummary,i=this._delayedStore;i!==void 0&&(this._delayedStore=void 0);try{this._isRunning=!0,this._changeTracker&&(this._changeTracker.beforeUpdate?.(this,t),this._changeSummary=this._changeTracker.createChangeSummary(t)),this._store!==void 0&&(this._store.dispose(),this._store=void 0),this._runFn(this,t)}catch(n){l.onBugIndicatingError(n)}finally{this._isRunning=!1,i!==void 0&&i.dispose()}}}finally{this._disposed||Wt()?.handleAutorunFinished(this);for(const t of this._dependenciesToBeRemoved)t.removeObserver(this);this._dependenciesToBeRemoved.clear()}}toString(){return`Autorun<${this.debugName}>`}beginUpdate(e){this._state===3&&(this._checkIterations(),this._state=1),this._updateCount++}endUpdate(e){try{if(this._updateCount===1){this._iteration=1;do{if(this._checkIterations())return;if(this._state===1){this._state=3;for(const t of this._dependencies)if(t.reportChanges(),this._state===2)break}this._iteration++,this._state!==3&&this._run()}while(this._state!==3)}}finally{this._updateCount--}l.assertFn(()=>this._updateCount>=0)}handlePossibleChange(e){this._state===3&&this._isDependency(e)&&(this._checkIterations(),this._state=1)}handleChange(e,t){if(this._isDependency(e)){Wt()?.handleAutorunDependencyChanged(this,e,t);try{(!this._changeTracker||this._changeTracker.handleChange({changedObservable:e,change:t,didChange:n=>n===e},this._changeSummary))&&(this._checkIterations(),this._state=2)}catch(i){l.onBugIndicatingError(i)}}}_isDependency(e){return this._dependencies.has(e)&&!this._dependenciesToBeRemoved.has(e)}_ensureNoRunning(){if(!this._isRunning)throw new l.BugIndicatingError("The reader object cannot be used outside its compute function!")}readObservable(e){if(this._ensureNoRunning(),this._disposed)return e.get();e.addObserver(this);const t=e.get();return this._dependencies.add(e),this._dependenciesToBeRemoved.delete(e),t}get store(){if(this._ensureNoRunning(),this._disposed)throw new l.BugIndicatingError("Cannot access store after dispose");return this._store===void 0&&(this._store=new l.DisposableStore),this._store}debugGetState(){return{isRunning:this._isRunning,updateCount:this._updateCount,dependencies:this._dependencies,state:this._state,stateStr:$k(this._state)}}debugRerun(){this._isRunning?this._state=2:this._run()}_checkIterations(){return this._iteration>100?(l.onBugIndicatingError(new l.BugIndicatingError(`Autorun '${this.debugName}' is stuck in an infinite update loop.`)),!0):!1}}function he(o,e=_.DebugLocation.ofCaller()){return new Hh(new Vt(void 0,void 0,o),o,void 0,e)}function $f(o,e,t=_.DebugLocation.ofCaller()){return new Hh(new Vt(o.owner,o.debugName,o.debugReferenceFn??e),e,void 0,t)}function Gl(o,e,t=_.DebugLocation.ofCaller()){return new Hh(new Vt(o.owner,o.debugName,o.debugReferenceFn??e),e,o.changeTracker,t)}function Kk(o,e){const t=new l.DisposableStore,i=Gl({owner:o.owner,debugName:o.debugName,debugReferenceFn:o.debugReferenceFn??e,changeTracker:o.changeTracker},(n,s)=>{t.clear(),e(n,s,t)});return l.toDisposable(()=>{i.dispose(),t.dispose()})}function Kn(o){const e=new l.DisposableStore,t=$f({owner:void 0,debugName:void 0,debugReferenceFn:o},i=>{e.clear(),o(i,e)});return l.toDisposable(()=>{t.dispose(),e.dispose()})}function Gk(o,e){let t;return $f({debugReferenceFn:e},i=>{const n=o.read(i),s=t;t=n,e({lastValue:s,newValue:n})})}function jk(o){switch(o){case 0:return"initial";case 1:return"dependenciesMightHaveChanged";case 2:return"stale";case 3:return"upToDate";default:return"<unknown>"}}class un extends Kl{get debugName(){return this._debugNameData.getDebugName(this)??"(anonymous)"}constructor(e,t,i,n=void 0,s,r){super(r),this._debugNameData=e,this._computeFn=t,this._changeTracker=i,this._handleLastObserverRemoved=n,this._equalityComparator=s,this._state=0,this._value=void 0,this._updateCount=0,this._dependencies=new Set,this._dependenciesToBeRemoved=new Set,this._changeSummary=void 0,this._isUpdating=!1,this._isComputing=!1,this._didReportChange=!1,this._isInBeforeUpdate=!1,this._isReaderValid=!1,this._store=void 0,this._delayedStore=void 0,this._removedObserverToCallEndUpdateOn=null,this._changeSummary=this._changeTracker?.createChangeSummary(void 0)}onLastObserverRemoved(){this._state=0,this._value=void 0,Wt()?.handleDerivedCleared(this);for(const e of this._dependencies)e.removeObserver(this);this._dependencies.clear(),this._store!==void 0&&(this._store.dispose(),this._store=void 0),this._delayedStore!==void 0&&(this._delayedStore.dispose(),this._delayedStore=void 0),this._handleLastObserverRemoved?.()}get(){if(this._isComputing,this._observers.size===0){let t;try{this._isReaderValid=!0;let i;this._changeTracker&&(i=this._changeTracker.createChangeSummary(void 0),this._changeTracker.beforeUpdate?.(this,i)),t=this._computeFn(this,i)}finally{this._isReaderValid=!1}return this.onLastObserverRemoved(),t}else{do{if(this._state===1){for(const t of this._dependencies)if(t.reportChanges(),this._state===2)break}this._state===1&&(this._state=3),this._state!==3&&this._recompute()}while(this._state!==3);return this._value}}_recompute(){let e=!1;this._isComputing=!0,this._didReportChange=!1;const t=this._dependenciesToBeRemoved;this._dependenciesToBeRemoved=this._dependencies,this._dependencies=t;try{const i=this._changeSummary;this._isReaderValid=!0,this._changeTracker&&(this._isInBeforeUpdate=!0,this._changeTracker.beforeUpdate?.(this,i),this._isInBeforeUpdate=!1,this._changeSummary=this._changeTracker?.createChangeSummary(i));const n=this._state!==0,s=this._value;this._state=3;const r=this._delayedStore;r!==void 0&&(this._delayedStore=void 0);try{this._store!==void 0&&(this._store.dispose(),this._store=void 0),this._value=this._computeFn(this,i)}finally{this._isReaderValid=!1;for(const a of this._dependenciesToBeRemoved)a.removeObserver(this);this._dependenciesToBeRemoved.clear(),r!==void 0&&r.dispose()}e=this._didReportChange||n&&!this._equalityComparator(s,this._value),Wt()?.handleObservableUpdated(this,{oldValue:s,newValue:this._value,change:void 0,didChange:e,hadValue:n})}catch(i){l.onBugIndicatingError(i)}if(this._isComputing=!1,!this._didReportChange&&e)for(const i of this._observers)i.handleChange(this,void 0);else this._didReportChange=!1}toString(){return`LazyDerived<${this.debugName}>`}beginUpdate(e){if(this._isUpdating)throw new l.BugIndicatingError("Cyclic deriveds are not supported yet!");this._updateCount++,this._isUpdating=!0;try{const t=this._updateCount===1;if(this._state===3&&(this._state=1,!t))for(const i of this._observers)i.handlePossibleChange(this);if(t)for(const i of this._observers)i.beginUpdate(this)}finally{this._isUpdating=!1}}endUpdate(e){if(this._updateCount--,this._updateCount===0){const t=[...this._observers];for(const i of t)i.endUpdate(this);if(this._removedObserverToCallEndUpdateOn){const i=[...this._removedObserverToCallEndUpdateOn];this._removedObserverToCallEndUpdateOn=null;for(const n of i)n.endUpdate(this)}}l.assertFn(()=>this._updateCount>=0)}handlePossibleChange(e){if(this._state===3&&this._dependencies.has(e)&&!this._dependenciesToBeRemoved.has(e)){this._state=1;for(const t of this._observers)t.handlePossibleChange(this)}}handleChange(e,t){if(this._dependencies.has(e)&&!this._dependenciesToBeRemoved.has(e)||this._isInBeforeUpdate){Wt()?.handleDerivedDependencyChanged(this,e,t);let i=!1;try{i=this._changeTracker?this._changeTracker.handleChange({changedObservable:e,change:t,didChange:s=>s===e},this._changeSummary):!0}catch(s){l.onBugIndicatingError(s)}const n=this._state===3;if(i&&(this._state===1||n)&&(this._state=2,n))for(const s of this._observers)s.handlePossibleChange(this)}}_ensureReaderValid(){if(!this._isReaderValid)throw new l.BugIndicatingError("The reader object cannot be used outside its compute function!")}readObservable(e){this._ensureReaderValid(),e.addObserver(this);const t=e.get();return this._dependencies.add(e),this._dependenciesToBeRemoved.delete(e),t}get store(){return this._ensureReaderValid(),this._store===void 0&&(this._store=new l.DisposableStore),this._store}addObserver(e){const t=!this._observers.has(e)&&this._updateCount>0;super.addObserver(e),t&&(this._removedObserverToCallEndUpdateOn?.delete(e)||e.beginUpdate(this))}removeObserver(e){this._observers.has(e)&&this._updateCount>0&&(this._removedObserverToCallEndUpdateOn||(this._removedObserverToCallEndUpdateOn=new Set),this._removedObserverToCallEndUpdateOn.add(e)),super.removeObserver(e)}debugGetState(){return{state:this._state,stateStr:jk(this._state),updateCount:this._updateCount,isComputing:this._isComputing,dependencies:this._dependencies,value:this._value}}debugSetValue(e){this._value=e}debugRecompute(){this.beginUpdate(this);try{this._isComputing?this._state=2:this._recompute()}finally{this.endUpdate(this)}}setValue(e,t,i){this._value=e;const n=this._observers;t.updateObserver(this,this);for(const s of n)s.handleChange(this,i)}}class YD extends un{constructor(e,t,i,n=void 0,s,r,a){super(e,t,i,n,s,a),this.set=r}}function Z(o,e,t=_.DebugLocation.ofCaller()){return e!==void 0?new un(new Vt(o,void 0,e),e,void 0,void 0,Ei,t):new un(new Vt(void 0,void 0,o),o,void 0,void 0,Ei,t)}function Hb(o,e,t,i=_.DebugLocation.ofCaller()){return new YD(new Vt(o,void 0,e),e,void 0,void 0,Ei,t,i)}function fn(o,e,t=_.DebugLocation.ofCaller()){return new un(new Vt(o.owner,o.debugName,o.debugReferenceFn),e,void 0,o.onLastObserverRemoved,o.equalsFn??Ei,t)}Bk(fn);function qk(o,e,t=_.DebugLocation.ofCaller()){return new un(new Vt(o.owner,o.debugName,void 0),e,o.changeTracker,void 0,o.equalityComparer??Ei,t)}function Gn(o,e,t=_.DebugLocation.ofCaller()){let i,n;e===void 0?(i=o,n=void 0):(n=o,i=e);let s;return new un(new Vt(n,void 0,i),r=>{s?s.clear():s=new l.DisposableStore;const a=i(r);return a&&s.add(a),a},void 0,()=>{s&&(s.dispose(),s=void 0)},Ei,t)}class eC{static resolved(e){return new eC(Promise.resolve(e))}constructor(e){this._value=W(this,void 0),this.promiseResult=this._value,this.promise=e.then(t=>(nt(i=>{this._value.set(new ZD(t,void 0),i)}),t),t=>{throw nt(i=>{this._value.set(new ZD(void 0,t),i)}),t})}}class ZD{constructor(e,t){this.data=e,this.error=t}getDataOrThrow(){if(this.error)throw this.error;return this.data}}function QD(o,e,t,i){return e||(e=n=>n!=null),new Promise((n,s)=>{let r=!0,a=!1;const c=o.map(d=>({isFinished:e(d),error:t?t(d):!1,state:d})),h=he(d=>{const{isFinished:u,error:f,state:g}=c.read(d);(u||f)&&(r?a=!0:h.dispose(),f?s(f===!0?g:f):n(g))});if(i){const d=i.onCancellationRequested(()=>{h.dispose(),d.dispose(),s(new l.CancellationError)});if(i.isCancellationRequested){h.dispose(),d.dispose(),s(new l.CancellationError);return}}r=!1,a&&h.dispose()})}function mt(...o){let e,t,i,n;return o.length===2?[t,i]=o:[e,t,i,n]=o,new no(new Vt(e,void 0,i),t,i,()=>no.globalTransaction,Ei,n??_.DebugLocation.ofCaller())}function An(o,e,t,i=_.DebugLocation.ofCaller()){return new no(new Vt(o.owner,o.debugName,o.debugReferenceFn??t),e,t,()=>o.getTransaction?.()??no.globalTransaction,o.equalsFn??Ei,i)}class no extends Kl{constructor(e,t,i,n,s,r){super(r),this._debugNameData=e,this.event=t,this._getValue=i,this._getTransaction=n,this._equalityComparator=s,this._hasValue=!1,this.handleEvent=a=>{const c=this._getValue(a),h=this._value,d=!this._hasValue||!this._equalityComparator(h,c);let u=!1;d&&(this._value=c,this._hasValue&&(u=!0,Uf(this._getTransaction(),f=>{Wt()?.handleObservableUpdated(this,{oldValue:h,newValue:c,change:void 0,didChange:d,hadValue:this._hasValue});for(const g of this._observers)f.updateObserver(g,this),g.handleChange(this,void 0)},()=>{const f=this.getDebugName();return"Event fired"+(f?`: ${f}`:"")})),this._hasValue=!0),u||Wt()?.handleObservableUpdated(this,{oldValue:h,newValue:c,change:void 0,didChange:d,hadValue:this._hasValue})}}getDebugName(){return this._debugNameData.getDebugName(this)}get debugName(){const e=this.getDebugName();return"From Event"+(e?`: ${e}`:"")}onFirstObserverAdded(){this._subscription=this.event(this.handleEvent)}onLastObserverRemoved(){this._subscription.dispose(),this._subscription=void 0,this._hasValue=!1,this._value=void 0}get(){return this._subscription?(this._hasValue||this.handleEvent(void 0),this._value):this._getValue(void 0)}debugSetValue(e){this._value=e}debugGetState(){return{value:this._value,hasValue:this._hasValue}}}(function(o){o.Observer=no;function e(t,i){let n=!1;no.globalTransaction===void 0&&(no.globalTransaction=t,n=!0);try{i()}finally{n&&(no.globalTransaction=void 0)}}o.batchEventsGlobally=e})(mt||(mt={}));function qr(o,e=_.DebugLocation.ofCaller()){return typeof o=="string"?new XD(o,void 0,e):new XD(void 0,o,e)}class XD extends Kl{get debugName(){return new Vt(this._owner,this._debugName,void 0).getDebugName(this)??"Observable Signal"}toString(){return this.debugName}constructor(e,t,i){super(i),this._debugName=e,this._owner=t}trigger(e,t){if(!e){nt(i=>{this.trigger(i,t)},()=>`Trigger signal ${this.debugName}`);return}for(const i of this._observers)e.updateObserver(i,this),i.handleChange(this,t)}get(){}}function Yk(o){const e=W("promiseValue",{});return o.then(t=>{e.set({value:t},void 0)}),e}function Zk(o,e,t=_.DebugLocation.ofCaller()){let i=!1,n,s;return mt(void 0,r=>{const a=he(c=>{const h=o.read(c);i?(s&&clearTimeout(s),s=setTimeout(()=>{n=h,r()},e)):(i=!0,n=h)});return{dispose(){a.dispose(),i=!1,n=void 0}}},()=>i?n:o.get(),t)}function Qk(o,e,t=_.DebugLocation.ofCaller()){const i=qr("handleTimeout");let n,s;return fn({owner:void 0,onLastObserverRemoved:()=>{n=void 0}},a=>{const c=o.read(a);if(i.read(a),c!==n){const h=typeof e=="number"?e:e(n,c);if(h===0)return n=c,c;s&&clearTimeout(s),s=setTimeout(()=>{n=c,i.trigger(void 0)},h)}return n},t)}function ed(o,e){const t=new Xk(!0,e);o.addObserver(t);try{t.beginUpdate(o)}finally{t.endUpdate(o)}return l.toDisposable(()=>{o.removeObserver(t)})}zk(ed);class Xk{constructor(e,t){this._forceRecompute=e,this._handleValue=t,this._counter=0}beginUpdate(e){this._counter++}endUpdate(e){this._counter===1&&this._forceRecompute&&(this._handleValue?this._handleValue(e.get()):e.reportChanges()),this._counter--}handlePossibleChange(e){}handleChange(e,t){}}function JD(o,e){let t;return fn({owner:o,debugReferenceFn:e},n=>(t=e(n,t),t))}function Jk(o,e,t,i){let n=new WD(t,i);return fn({debugReferenceFn:t,owner:o,onLastObserverRemoved:()=>{n.dispose(),n=new WD(t)}},r=>{const a=e.read(r);return n.setItems(a),n.getItems()})}let WD=class{constructor(e,t){this._map=e,this._keySelector=t,this._cache=new Map,this._items=[]}dispose(){this._cache.forEach(e=>e.store.dispose()),this._cache.clear()}setItems(e){const t=[],i=new Set(this._cache.keys());for(const n of e){const s=this._keySelector?this._keySelector(n):n;let r=this._cache.get(s);if(r)i.delete(s);else{const a=new l.DisposableStore;r={out:this._map(n,a),store:a},this._cache.set(s,r)}t.push(r.out)}for(const n of i)this._cache.get(n).store.dispose(),this._cache.delete(n);this._items=t}getItems(){return this._items}};function Yr(o){return!!o&&o.read!==void 0&&o.reportChanges!==void 0}function Wk(o){return{createChangeSummary:e=>({changes:[]}),handleChange(e,t){for(const i in o)e.didChange(o[i])&&t.changes.push({key:i,change:e.change});return!0},beforeUpdate(e,t){for(const i in o){if(i==="changes")throw new l.BugIndicatingError('property name "changes" is reserved for change tracking');t[i]=o[i].read(e)}}}}function Hk(o){let e;return{createChangeSummary:t=>({changes:[]}),handleChange(t,i){e||(e=o());for(const n in e)t.didChange(e[n])&&i.changes.push({key:n,change:t.change});return!0},beforeUpdate(t,i){e||(e=o());for(const n in e){if(n==="changes")throw new l.BugIndicatingError('property name "changes" is reserved for change tracking');i[n]=e[n].read(t)}}}}function Zr(o){return new eF(o)}class eF extends qD{constructor(e){super(),this.value=e}get debugName(){return this.toString()}get(){return this.value}addObserver(e){}removeObserver(e){}toString(){return`Const: ${this.value}`}}function Ii(o,e,t=_.DebugLocation.ofCaller()){return new tF(typeof o=="string"?o:new Vt(o,void 0,void 0),e,t)}class tF extends Kl{constructor(e,t,i){super(i),this.event=t,this.handleEvent=()=>{nt(n=>{for(const s of this._observers)n.updateObserver(s,this),s.handleChange(this,void 0)},()=>this.debugName)},this.debugName=typeof e=="string"?e:e.getDebugName(this)??"Observable Signal From Event"}onFirstObserverAdded(){this.subscription=this.event(this.handleEvent)}onLastObserverRemoved(){this.subscription.dispose(),this.subscription=void 0}get(){}}function Qr(o,e){let t,i=!0;return Kk({changeTracker:{createChangeSummary:()=>({deltas:[],didChange:!1}),handleChange:(n,s)=>{if(n.didChange(o)){const r=n.change;r!==void 0&&s.deltas.push(r),s.didChange=!0}return!0}}},(n,s)=>{const r=o.read(n),a=t;s.didChange&&(t=r,e(r,a,s.deltas)),i&&(i=!1,t=r)})}function HD(o,e){const t=new l.DisposableStore,i=Qr(o,(n,s,r)=>{t.clear(),e(n,s,r,t)});return{dispose(){i.dispose(),t.dispose()}}}function iF(o,e){return HD(o,(t,i,n,s)=>{e(t,i,n,l.cancelOnDispose(s))})}function nF(o,e){return JD(o,(t,i)=>i??e(t))}function jl(o,e){switch(typeof o){case"number":return""+o;case"string":return o.length+2<=e?`"${o}"`:`"${o.substr(0,e-7)}"+...`;case"boolean":return o?"true":"false";case"undefined":return"undefined";case"object":return o===null?"null":Array.isArray(o)?sF(o,e):oF(o,e);case"symbol":return o.toString();case"function":return`[[Function${o.name?" "+o.name:""}]]`;default:return""+o}}function sF(o,e){let t="[ ",i=!0;for(const n of o){if(i||(t+=", "),t.length-5>e){t+="...";break}i=!1,t+=`${jl(n,e-t.length)}`}return t+=" ]",t}function oF(o,e){if(typeof o.toString=="function"&&o.toString!==Object.prototype.toString){const s=o.toString();return s.length<=e?s:s.substring(0,e-3)+"..."}const t=UD(o);let i=t?t+"(":"{ ",n=!0;for(const[s,r]of Object.entries(o)){if(n||(i+=", "),i.length-5>e){i+="...";break}n=!1,i+=`${s}: ${jl(r,e-i.length)}`}return i+=t?")":" }",i}class tC{static createClient(e,t){return new tC(e,t)}constructor(e,t){this._channelFactory=e,this._getHandler=t,this._channel=this._channelFactory({handleNotification:s=>{const r=s,a=this._getHandler().notifications[r[0]];if(!a)throw new Error(`Unknown notification "${r[0]}"!`);a(...r[1])},handleRequest:s=>{const r=s;try{return{type:"result",value:this._getHandler().requests[r[0]](...r[1])}}catch(a){return{type:"error",value:a}}}});const i=new Proxy({},{get:(s,r)=>async(...a)=>{const c=await this._channel.sendRequest([r,a]);if(c.type==="error")throw c.value;return c.value}}),n=new Proxy({},{get:(s,r)=>(...a)=>{this._channel.sendNotification([r,a])}});this.api={notifications:n,requests:i}}}function rF(o,e){const t=globalThis;let i=[],n;const{channel:s,handler:r}=aF({sendNotification:c=>{n?n.sendNotification(c):i.push(c)}});let a;return(t.$$debugValueEditor_debugChannels??(t.$$debugValueEditor_debugChannels={}))[o]=c=>{a=e(),n=c;for(const h of i)c.sendNotification(h);return i=[],r},tC.createClient(s,()=>{if(!a)throw new Error("Not supported");return a})}function aF(o){let e;return{channel:i=>(e=i,{sendNotification:n=>{o.sendNotification(n)},sendRequest:n=>{throw new Error("not supported")}}),handler:{handleRequest:i=>i.type==="notification"?e?.handleNotification(i.data):e?.handleRequest(i.data)}}}class lF{constructor(){this._timeout=void 0}throttle(e,t){this._timeout===void 0&&(this._timeout=setTimeout(()=>{this._timeout=void 0,e()},t))}dispose(){this._timeout!==void 0&&clearTimeout(this._timeout)}}function ex(o,e){for(const t in e)o[t]&&typeof o[t]=="object"&&e[t]&&typeof e[t]=="object"?ex(o[t],e[t]):o[t]=e[t]}function tx(o,e){for(const t in e)e[t]===null?delete o[t]:o[t]&&typeof o[t]=="object"&&e[t]&&typeof e[t]=="object"?tx(o[t],e[t]):o[t]=e[t]}const bl=class bl{static getInstance(){return bl._instance===void 0&&(bl._instance=new bl),bl._instance}getTransactionState(){const e=[],t=[...this._activeTransactions];if(t.length===0)return;const i=t.flatMap(s=>s.debugGetUpdatingObservers()??[]).map(s=>s.observer),n=new Set;for(;i.length>0;){const s=i.shift();if(n.has(s))continue;n.add(s);const r=this._getInfo(s,a=>{n.has(a)||i.push(a)});r&&e.push(r)}return{names:t.map(s=>s.getDebugName()??"tx"),affected:e}}_getObservableInfo(e){const t=this._instanceInfos.get(e);if(!t){l.onUnexpectedError(new l.BugIndicatingError("No info found"));return}return t}_getAutorunInfo(e){const t=this._instanceInfos.get(e);if(!t){l.onUnexpectedError(new l.BugIndicatingError("No info found"));return}return t}_getInfo(e,t){if(e instanceof un){const i=[...e.debugGetObservers()];for(const c of i)t(c);const n=this._getObservableInfo(e);if(!n)return;const s=e.debugGetState(),r={name:e.debugName,instanceId:n.instanceId,updateCount:s.updateCount},a=[...n.changedObservables].map(c=>this._instanceInfos.get(c)?.instanceId).filter(l.isDefined);if(s.isComputing)return{...r,type:"observable/derived",state:"updating",changedDependencies:a,initialComputation:!1};switch(s.state){case 0:return{...r,type:"observable/derived",state:"noValue"};case 3:return{...r,type:"observable/derived",state:"upToDate"};case 2:return{...r,type:"observable/derived",state:"stale",changedDependencies:a};case 1:return{...r,type:"observable/derived",state:"possiblyStale"}}}else if(e instanceof Hh){const i=this._getAutorunInfo(e);if(!i)return;const n={name:e.debugName,instanceId:i.instanceId,updateCount:i.updateCount},s=[...i.changedObservables].map(r=>this._instanceInfos.get(r).instanceId);if(e.debugGetState().isRunning)return{...n,type:"autorun",state:"updating",changedDependencies:s};switch(e.debugGetState().state){case 3:return{...n,type:"autorun",state:"upToDate"};case 2:return{...n,type:"autorun",state:"stale",changedDependencies:s};case 1:return{...n,type:"autorun",state:"possiblyStale"}}}}_formatObservable(e){const t=this._getObservableInfo(e);if(t)return{name:e.debugName,instanceId:t.instanceId}}_formatObserver(e){if(e instanceof un)return{name:e.toString(),instanceId:this._getObservableInfo(e)?.instanceId};const t=this._getAutorunInfo(e);if(t)return{name:e.toString(),instanceId:t.instanceId}}constructor(){this._declarationId=0,this._instanceId=0,this._declarations=new Map,this._instanceInfos=new WeakMap,this._aliveInstances=new Map,this._activeTransactions=new Set,this._channel=rF("observableDevTools",()=>({notifications:{setDeclarationIdFilter:e=>{},logObservableValue:e=>{console.log("logObservableValue",e)},flushUpdates:()=>{this._flushUpdates()},resetUpdates:()=>{this._pendingChanges=null,this._channel.api.notifications.handleChange(this._fullState,!0)}},requests:{getDeclarations:()=>{const e={};for(const t of this._declarations.values())e[t.id]=t;return{decls:e}},getSummarizedInstances:()=>null,getObservableValueInfo:e=>({observers:[...this._aliveInstances.get(e).debugGetObservers()].map(i=>this._formatObserver(i)).filter(l.isDefined)}),getDerivedInfo:e=>{const t=this._aliveInstances.get(e);return{dependencies:[...t.debugGetState().dependencies].map(i=>this._formatObservable(i)).filter(l.isDefined),observers:[...t.debugGetObservers()].map(i=>this._formatObserver(i)).filter(l.isDefined)}},getAutorunInfo:e=>({dependencies:[...this._aliveInstances.get(e).debugGetState().dependencies].map(i=>this._formatObservable(i)).filter(l.isDefined)}),getTransactionState:()=>this.getTransactionState(),setValue:(e,t)=>{const i=this._aliveInstances.get(e);if(i instanceof un)i.debugSetValue(t);else if(i instanceof Jh)i.debugSetValue(t);else if(i instanceof no)i.debugSetValue(t);else throw new l.BugIndicatingError("Observable is not supported");const n=[...i.debugGetObservers()];for(const s of n)s.beginUpdate(i);for(const s of n)s.handleChange(i,void 0);for(const s of n)s.endUpdate(i)},getValue:e=>{const t=this._aliveInstances.get(e);if(t instanceof un)return jl(t.debugGetState().value,200);if(t instanceof Jh)return jl(t.debugGetState().value,200)},logValue:e=>{const t=this._aliveInstances.get(e);if(t&&"get"in t)console.log("Logged Value:",t.get());else throw new l.BugIndicatingError("Observable is not supported")},rerun:e=>{const t=this._aliveInstances.get(e);if(t instanceof un)t.debugRecompute();else if(t instanceof Hh)t.debugRerun();else throw new l.BugIndicatingError("Observable is not supported")}}})),this._pendingChanges=null,this._changeThrottler=new lF,this._fullState={},this._flushUpdates=()=>{this._pendingChanges!==null&&(this._channel.api.notifications.handleChange(this._pendingChanges,!1),this._pendingChanges=null)},_.DebugLocation.enable()}_handleChange(e){tx(this._fullState,e),this._pendingChanges===null?this._pendingChanges=e:ex(this._pendingChanges,e),this._changeThrottler.throttle(this._flushUpdates,10)}_getDeclarationId(e,t){if(!t)return-1;let i=this._declarations.get(t.id);return i===void 0&&(i={id:this._declarationId++,type:e,url:t.fileName,line:t.line,column:t.column},this._declarations.set(t.id,i),this._handleChange({decls:{[i.id]:i}})),i.id}handleObservableCreated(e,t){const n={declarationId:this._getDeclarationId("observable/value",t),instanceId:this._instanceId++,listenerCount:0,lastValue:void 0,updateCount:0,changedObservables:new Set};this._instanceInfos.set(e,n)}handleOnListenerCountChanged(e,t){const i=this._getObservableInfo(e);if(i){if(i.listenerCount===0&&t>0){const n=e instanceof un?"observable/derived":"observable/value";this._aliveInstances.set(i.instanceId,e),this._handleChange({instances:{[i.instanceId]:{instanceId:i.instanceId,declarationId:i.declarationId,formattedValue:i.lastValue,type:n,name:e.debugName}}})}else i.listenerCount>0&&t===0&&(this._handleChange({instances:{[i.instanceId]:null}}),this._aliveInstances.delete(i.instanceId));i.listenerCount=t}}handleObservableUpdated(e,t){if(e instanceof un){this._handleDerivedRecomputed(e,t);return}const i=this._getObservableInfo(e);i&&t.didChange&&(i.lastValue=jl(t.newValue,30),i.listenerCount>0&&this._handleChange({instances:{[i.instanceId]:{formattedValue:i.lastValue}}}))}handleAutorunCreated(e,t){const n={declarationId:this._getDeclarationId("autorun",t),instanceId:this._instanceId++,updateCount:0,changedObservables:new Set};this._instanceInfos.set(e,n),this._aliveInstances.set(n.instanceId,e),n&&this._handleChange({instances:{[n.instanceId]:{instanceId:n.instanceId,declarationId:n.declarationId,runCount:0,type:"autorun",name:e.debugName}}})}handleAutorunDisposed(e){const t=this._getAutorunInfo(e);t&&(this._handleChange({instances:{[t.instanceId]:null}}),this._instanceInfos.delete(e),this._aliveInstances.delete(t.instanceId))}handleAutorunDependencyChanged(e,t,i){const n=this._getAutorunInfo(e);n&&n.changedObservables.add(t)}handleAutorunStarted(e){}handleAutorunFinished(e){const t=this._getAutorunInfo(e);t&&(t.changedObservables.clear(),t.updateCount++,this._handleChange({instances:{[t.instanceId]:{runCount:t.updateCount}}}))}handleDerivedDependencyChanged(e,t,i){const n=this._getObservableInfo(e);n&&n.changedObservables.add(t)}_handleDerivedRecomputed(e,t){const i=this._getObservableInfo(e);if(!i)return;const n=jl(t.newValue,30);i.updateCount++,i.changedObservables.clear(),i.lastValue=n,i.listenerCount>0&&this._handleChange({instances:{[i.instanceId]:{formattedValue:n,recomputationCount:i.updateCount}}})}handleDerivedCleared(e){const t=this._getObservableInfo(e);t&&(t.lastValue=void 0,t.changedObservables.clear(),t.listenerCount>0&&this._handleChange({instances:{[t.instanceId]:{formattedValue:void 0}}}))}handleBeginTransaction(e){this._activeTransactions.add(e)}handleEndTransaction(e){this._activeTransactions.delete(e)}};bl._instance=void 0;let iC=bl;l.env&&l.env.VSCODE_DEV_DEBUG_OBSERVABLES&&Pk(iC.getInstance());const{getWindow:j,getDocument:cF,getWindows:ix,getWindowsCount:hF,getWindowId:td,getWindowById:nx,onDidRegisterWindow:id,onWillUnregisterWindow:dF,onDidUnregisterWindow:uF}=(function(){const o=new Map;pk(Ae,1);const e={window:Ae,disposables:new l.DisposableStore};o.set(Ae.vscodeWindowId,e);const t=new l.Emitter,i=new l.Emitter,n=new l.Emitter;function s(r,a){return(typeof r=="number"?o.get(r):void 0)??(a?e:void 0)}return{onDidRegisterWindow:t.event,onWillUnregisterWindow:n.event,onDidUnregisterWindow:i.event,registerWindow(r){if(o.has(r.vscodeWindowId))return l.Disposable.None;const a=new l.DisposableStore,c={window:r,disposables:a.add(new l.DisposableStore)};return o.set(r.vscodeWindowId,c),a.add(l.toDisposable(()=>{o.delete(r.vscodeWindowId),i.fire(r)})),a.add(R(r,F.BEFORE_UNLOAD,()=>{n.fire(r)})),t.fire(c),a},getWindows(){return o.values()},getWindowsCount(){return o.size},getWindowId(r){return r.vscodeWindowId},hasWindow(r){return o.has(r)},getWindowById:s,getWindow(r){const a=r;if(a?.ownerDocument?.defaultView)return a.ownerDocument.defaultView.window;const c=r;return c?.view?c.view.window:Ae},getDocument(r){return j(r).document}}})(),fF=new Set;function gF(){for(const o of fF){const e=o();if(e.hasFocus&&e.window)return e.window}}function On(o){for(;o.firstChild;)o.firstChild.remove()}class mF{constructor(e,t,i,n){this._node=e,this._type=t,this._handler=i,this._options=n||!1,this._node.addEventListener(this._type,this._handler,this._options)}dispose(){this._handler&&(this._node.removeEventListener(this._type,this._handler,this._options),this._node=null,this._handler=null)}}function R(o,e,t,i){return new mF(o,e,t,i)}function sx(o,e){return function(t){return e(new Bi(o,t))}}function pF(o){return function(e){return o(new Be(e))}}const At=function(e,t,i,n){let s=i;return t==="click"||t==="mousedown"||t==="contextmenu"?s=sx(j(e),i):(t==="keydown"||t==="keypress"||t==="keyup")&&(s=pF(i)),R(e,t,s,n)},_F=function(e,t,i){const n=sx(j(e),t);return nC(e,n,i)};function nC(o,e,t){return R(o,l.isIOS&&qh.pointerEvents?F.POINTER_DOWN:F.MOUSE_DOWN,e,t)}function bF(o,e,t){return R(o,l.isIOS&&qh.pointerEvents?F.POINTER_MOVE:F.MOUSE_MOVE,e,t)}function ox(o,e,t){return R(o,l.isIOS&&qh.pointerEvents?F.POINTER_UP:F.MOUSE_UP,e,t)}function nd(o,e,t){return l._runWhenIdle(o,e,t)}class CF extends l.AbstractIdleValue{constructor(e,t){super(e,t)}}_.runAtThisOrScheduleAtNextAnimationFrame=void 0;let Ti;class sC extends l.IntervalTimer{constructor(e){super(),this.defaultTarget=e&&j(e)}cancelAndSet(e,t,i){return super.cancelAndSet(e,t,i??this.defaultTarget)}}class oC{constructor(e,t=0){this._runner=e,this.priority=t,this._canceled=!1}dispose(){this._canceled=!0}execute(){if(!this._canceled)try{this._runner()}catch(e){l.onUnexpectedError(e)}}static sort(e,t){return t.priority-e.priority}}(function(){const o=new Map,e=new Map,t=new Map,i=new Map,n=s=>{t.set(s,!1);const r=o.get(s)??[];for(e.set(s,r),o.set(s,[]),i.set(s,!0);r.length>0;)r.sort(oC.sort),r.shift().execute();i.set(s,!1)};Ti=(s,r,a=0)=>{const c=td(s),h=new oC(r,a);let d=o.get(c);return d||(d=[],o.set(c,d)),d.push(h),t.get(c)||(t.set(c,!0),s.requestAnimationFrame(()=>n(c))),h},_.runAtThisOrScheduleAtNextAnimationFrame=(s,r,a)=>{const c=td(s);if(i.get(c)){const h=new oC(r,a);let d=e.get(c);return d||(d=[],e.set(c,d)),d.push(h),h}else return Ti(s,r,a)}})();function Kf(o){return j(o).getComputedStyle(o,null)}function Gf(o,e,t){const i=j(o),n=i.document;if(o!==n.body)return new cs(o.clientWidth,o.clientHeight);if(l.isIOS&&i?.visualViewport)return new cs(i.visualViewport.width,i.visualViewport.height);if(i?.innerWidth&&i.innerHeight)return new cs(i.innerWidth,i.innerHeight);if(n.body&&n.body.clientWidth&&n.body.clientHeight)return new cs(n.body.clientWidth,n.body.clientHeight);if(n.documentElement&&n.documentElement.clientWidth&&n.documentElement.clientHeight)return new cs(n.documentElement.clientWidth,n.documentElement.clientHeight);throw new Error("Unable to figure out browser width and height")}class st{static convertToPixels(e,t){return parseFloat(t)||0}static getDimension(e,t){const i=Kf(e),n=i?i.getPropertyValue(t):"0";return st.convertToPixels(e,n)}static getBorderLeftWidth(e){return st.getDimension(e,"border-left-width")}static getBorderRightWidth(e){return st.getDimension(e,"border-right-width")}static getBorderTopWidth(e){return st.getDimension(e,"border-top-width")}static getBorderBottomWidth(e){return st.getDimension(e,"border-bottom-width")}static getPaddingLeft(e){return st.getDimension(e,"padding-left")}static getPaddingRight(e){return st.getDimension(e,"padding-right")}static getPaddingTop(e){return st.getDimension(e,"padding-top")}static getPaddingBottom(e){return st.getDimension(e,"padding-bottom")}static getMarginLeft(e){return st.getDimension(e,"margin-left")}static getMarginTop(e){return st.getDimension(e,"margin-top")}static getMarginRight(e){return st.getDimension(e,"margin-right")}static getMarginBottom(e){return st.getDimension(e,"margin-bottom")}}const Cl=class Cl{constructor(e,t){this.width=e,this.height=t}with(e=this.width,t=this.height){return e!==this.width||t!==this.height?new Cl(e,t):this}static is(e){return typeof e=="object"&&typeof e.height=="number"&&typeof e.width=="number"}static lift(e){return e instanceof Cl?e:new Cl(e.width,e.height)}static equals(e,t){return e===t?!0:!e||!t?!1:e.width===t.width&&e.height===t.height}};Cl.None=new Cl(0,0);let cs=Cl;function rx(o){let e=o.offsetParent,t=o.offsetTop,i=o.offsetLeft;for(;(o=o.parentNode)!==null&&o!==o.ownerDocument.body&&o!==o.ownerDocument.documentElement;){t-=o.scrollTop;const n=lx(o)?null:Kf(o);n&&(i-=n.direction!=="rtl"?o.scrollLeft:-o.scrollLeft),o===e&&(i+=st.getBorderLeftWidth(o),t+=st.getBorderTopWidth(o),t+=o.offsetTop,i+=o.offsetLeft,e=o.offsetParent)}return{left:i,top:t}}function vF(o,e,t){typeof e=="number"&&(o.style.width=`${e}px`),typeof t=="number"&&(o.style.height=`${t}px`)}function Qi(o){const e=o.getBoundingClientRect(),t=j(o);return{left:e.left+t.scrollX,top:e.top+t.scrollY,width:e.width,height:e.height}}function ax(o){let e=o,t=1;do{const i=Kf(e).zoom;i!=null&&i!=="1"&&(t*=i),e=e.parentElement}while(e!==null&&e!==e.ownerDocument.documentElement);return t}function jf(o){const e=st.getMarginLeft(o)+st.getMarginRight(o);return o.offsetWidth+e}function rC(o){const e=st.getBorderLeftWidth(o)+st.getBorderRightWidth(o),t=st.getPaddingLeft(o)+st.getPaddingRight(o);return o.offsetWidth-e-t}function wF(o){const e=st.getBorderTopWidth(o)+st.getBorderBottomWidth(o),t=st.getPaddingTop(o)+st.getPaddingBottom(o);return o.offsetHeight-e-t}function qf(o){const e=st.getMarginTop(o)+st.getMarginBottom(o);return o.offsetHeight+e}function ut(o,e){return!!e?.contains(o)}function SF(o,e,t){for(;o&&o.nodeType===o.ELEMENT_NODE;){if(o.classList.contains(e))return o;if(t){if(typeof t=="string"){if(o.classList.contains(t))return null}else if(o===t)return null}o=o.parentNode}return null}function aC(o,e,t){return!!SF(o,e,t)}function lx(o){return o&&!!o.host&&!!o.mode}function Yf(o){return!!qo(o)}function qo(o){for(;o.parentNode;){if(o===o.ownerDocument?.body)return null;o=o.parentNode}return lx(o)?o:null}function wt(){let o=od().activeElement;for(;o?.shadowRoot;)o=o.shadowRoot.activeElement;return o}function sd(o){return wt()===o}function Zf(o){return ut(wt(),o)}function od(){if(hF()<=1)return Ae.document;const e=Array.from(ix()).map(({window:i})=>i.document).find(i=>i.hasFocus());if(e)return e;const t=gF();return t?t.document:Ae.document}function Le(){return od().defaultView?.window??Ae}const yF=new class{constructor(){this.mutationObservers=new Map}observe(o,e,t){let i=this.mutationObservers.get(o);i||(i=new Map,this.mutationObservers.set(o,i));const n=l.hash(t);let s=i.get(n);if(s)s.users+=1;else{const r=new l.Emitter,a=new MutationObserver(h=>r.fire(h));a.observe(o,t);const c=s={users:1,observer:a,onDidMutate:r.event};e.add(l.toDisposable(()=>{c.users-=1,c.users===0&&(r.dispose(),a.disconnect(),i?.delete(n),i?.size===0&&this.mutationObservers.delete(o))})),i.set(n,s)}return s.onDidMutate}};function Ve(o){return o instanceof HTMLElement||o instanceof j(o).HTMLElement}function cx(o){return o instanceof HTMLAnchorElement||o instanceof j(o).HTMLAnchorElement}function hx(o){return o instanceof SVGElement||o instanceof j(o).SVGElement}function Qf(o){return o instanceof MouseEvent||o instanceof j(o).MouseEvent}function so(o){return o instanceof KeyboardEvent||o instanceof j(o).KeyboardEvent}const F={CLICK:"click",AUXCLICK:"auxclick",DBLCLICK:"dblclick",MOUSE_UP:"mouseup",MOUSE_DOWN:"mousedown",MOUSE_OVER:"mouseover",MOUSE_MOVE:"mousemove",MOUSE_OUT:"mouseout",MOUSE_ENTER:"mouseenter",MOUSE_LEAVE:"mouseleave",MOUSE_WHEEL:"wheel",POINTER_UP:"pointerup",POINTER_DOWN:"pointerdown",POINTER_MOVE:"pointermove",POINTER_LEAVE:"pointerleave",CONTEXT_MENU:"contextmenu",KEY_DOWN:"keydown",KEY_UP:"keyup",BEFORE_UNLOAD:"beforeunload",RESIZE:"resize",FOCUS:"focus",FOCUS_IN:"focusin",FOCUS_OUT:"focusout",BLUR:"blur",INPUT:"input",DRAG_START:"dragstart",DRAG:"drag",DRAG_ENTER:"dragenter",DRAG_LEAVE:"dragleave",DRAG_OVER:"dragover",DROP:"drop",DRAG_END:"dragend"};function LF(o){const e=o;return!!(e&&typeof e.preventDefault=="function"&&typeof e.stopPropagation=="function")}const ve={stop:(o,e)=>(o.preventDefault(),e&&o.stopPropagation(),o)};function DF(o){const e=[];for(let t=0;o&&o.nodeType===o.ELEMENT_NODE;t++)e[t]=o.scrollTop,o=o.parentNode;return e}function xF(o,e){for(let t=0;o&&o.nodeType===o.ELEMENT_NODE;t++)o.scrollTop!==e[t]&&(o.scrollTop=e[t]),o=o.parentNode}let EF=class ED extends l.Disposable{get onDidFocus(){return this._onDidFocus.event}get onDidBlur(){return this._onDidBlur.event}static hasFocusWithin(e){if(Ve(e)){const t=qo(e),i=t?t.activeElement:e.ownerDocument.activeElement;return ut(i,e)}else{const t=e;return ut(t.document.activeElement,t.document)}}constructor(e){super(),this._onDidFocus=this._register(new l.Emitter),this._onDidBlur=this._register(new l.Emitter);let t=ED.hasFocusWithin(e),i=!1;const n=()=>{i=!1,t||(t=!0,this._onDidFocus.fire())},s=()=>{t&&(i=!0,(Ve(e)?j(e):e).setTimeout(()=>{i&&(i=!1,t=!1,this._onDidBlur.fire())},0))};this._refreshStateHandler=()=>{ED.hasFocusWithin(e)!==t&&(t?s():n())},this._register(R(e,F.FOCUS,n,!0)),this._register(R(e,F.BLUR,s,!0)),Ve(e)&&(this._register(R(e,F.FOCUS_IN,()=>this._refreshStateHandler())),this._register(R(e,F.FOCUS_OUT,()=>this._refreshStateHandler())))}};function Xr(o){return new EF(o)}function IF(o,e){return o.after(e),e}function K(o,...e){if(o.append(...e),e.length===1&&typeof e[0]!="string")return e[0]}function Xf(o,e){return o.insertBefore(e,o.firstChild),e}function oi(o,...e){o.textContent="",K(o,...e)}const TF=/([\w\-]+)?(#([\w\-]+))?((\.([\w\-]+))*)/;var rd;(function(o){o.HTML="http://www.w3.org/1999/xhtml",o.SVG="http://www.w3.org/2000/svg"})(rd||(rd={}));function dx(o,e,t,...i){const n=TF.exec(e);if(!n)throw new Error("Bad use of emmet");const s=n[1]||"div";let r;return o!==rd.HTML?r=document.createElementNS(o,s):r=document.createElement(s),n[3]&&(r.id=n[3]),n[4]&&(r.className=n[4].replace(/\./g," ").trim()),t&&Object.entries(t).forEach(([a,c])=>{typeof c>"u"||(/^on\w+$/.test(a)?r[a]=c:a==="selected"?c&&r.setAttribute(a,"true"):r.setAttribute(a,c))}),r.append(...i),r}function Q(o,e,...t){return dx(rd.HTML,o,e,...t)}Q.SVG=function(o,e,...t){return dx(rd.SVG,o,e,...t)};function NF(o,...e){o?Jf(...e):Wf(...e)}function Jf(...o){for(const e of o)e.style.display="",e.removeAttribute("aria-hidden")}function Wf(...o){for(const e of o)e.style.display="none",e.setAttribute("aria-hidden","true")}function ux(o,e){const t=o.devicePixelRatio*e;return Math.max(1,Math.floor(t))/o.devicePixelRatio}function fx(o){Ae.open(o,"_blank","noopener")}function RF(o,e){const t=()=>{e(),i=Ti(o,t)};let i=Ti(o,t);return l.toDisposable(()=>i.dispose())}l.RemoteAuthorities.setPreferredWebSchema(/^https:/.test(Ae.location.href)?"https":"http");class hs extends l.Emitter{constructor(){super(),this._subscriptions=new l.DisposableStore,this._keyStatus={altKey:!1,shiftKey:!1,ctrlKey:!1,metaKey:!1},this._subscriptions.add(l.Event.runAndSubscribe(id,({window:e,disposables:t})=>this.registerListeners(e,t),{window:Ae,disposables:this._subscriptions}))}registerListeners(e,t){t.add(R(e,"keydown",i=>{if(i.defaultPrevented)return;const n=new Be(i);if(!(n.keyCode===6&&i.repeat)){if(i.altKey&&!this._keyStatus.altKey)this._keyStatus.lastKeyPressed="alt";else if(i.ctrlKey&&!this._keyStatus.ctrlKey)this._keyStatus.lastKeyPressed="ctrl";else if(i.metaKey&&!this._keyStatus.metaKey)this._keyStatus.lastKeyPressed="meta";else if(i.shiftKey&&!this._keyStatus.shiftKey)this._keyStatus.lastKeyPressed="shift";else if(n.keyCode!==6)this._keyStatus.lastKeyPressed=void 0;else return;this._keyStatus.altKey=i.altKey,this._keyStatus.ctrlKey=i.ctrlKey,this._keyStatus.metaKey=i.metaKey,this._keyStatus.shiftKey=i.shiftKey,this._keyStatus.lastKeyPressed&&(this._keyStatus.event=i,this.fire(this._keyStatus))}},!0)),t.add(R(e,"keyup",i=>{i.defaultPrevented||(!i.altKey&&this._keyStatus.altKey?this._keyStatus.lastKeyReleased="alt":!i.ctrlKey&&this._keyStatus.ctrlKey?this._keyStatus.lastKeyReleased="ctrl":!i.metaKey&&this._keyStatus.metaKey?this._keyStatus.lastKeyReleased="meta":!i.shiftKey&&this._keyStatus.shiftKey?this._keyStatus.lastKeyReleased="shift":this._keyStatus.lastKeyReleased=void 0,this._keyStatus.lastKeyPressed!==this._keyStatus.lastKeyReleased&&(this._keyStatus.lastKeyPressed=void 0),this._keyStatus.altKey=i.altKey,this._keyStatus.ctrlKey=i.ctrlKey,this._keyStatus.metaKey=i.metaKey,this._keyStatus.shiftKey=i.shiftKey,this._keyStatus.lastKeyReleased&&(this._keyStatus.event=i,this.fire(this._keyStatus)))},!0)),t.add(R(e.document.body,"mousedown",()=>{this._keyStatus.lastKeyPressed=void 0},!0)),t.add(R(e.document.body,"mouseup",()=>{this._keyStatus.lastKeyPressed=void 0},!0)),t.add(R(e.document.body,"mousemove",i=>{i.buttons&&(this._keyStatus.lastKeyPressed=void 0)},!0)),t.add(R(e,"blur",()=>{this.resetKeyStatus()}))}get keyStatus(){return this._keyStatus}resetKeyStatus(){this.doResetKeyStatus(),this.fire(this._keyStatus)}doResetKeyStatus(){this._keyStatus={altKey:!1,shiftKey:!1,ctrlKey:!1,metaKey:!1}}static getInstance(){return hs.instance||(hs.instance=new hs),hs.instance}dispose(){super.dispose(),this._subscriptions.dispose()}}class MF extends l.Disposable{constructor(e,t){super(),this.element=e,this.callbacks=t,this.counter=0,this.dragStartTime=0,this.registerListeners()}registerListeners(){this.callbacks.onDragStart&&this._register(R(this.element,F.DRAG_START,e=>{this.callbacks.onDragStart?.(e)})),this.callbacks.onDrag&&this._register(R(this.element,F.DRAG,e=>{this.callbacks.onDrag?.(e)})),this._register(R(this.element,F.DRAG_ENTER,e=>{this.counter++,this.dragStartTime=e.timeStamp,this.callbacks.onDragEnter?.(e)})),this._register(R(this.element,F.DRAG_OVER,e=>{e.preventDefault(),this.callbacks.onDragOver?.(e,e.timeStamp-this.dragStartTime)})),this._register(R(this.element,F.DRAG_LEAVE,e=>{this.counter--,this.counter===0&&(this.dragStartTime=0,this.callbacks.onDragLeave?.(e))})),this._register(R(this.element,F.DRAG_END,e=>{this.counter=0,this.dragStartTime=0,this.callbacks.onDragEnd?.(e)})),this._register(R(this.element,F.DROP,e=>{this.counter=0,this.dragStartTime=0,this.callbacks.onDrop?.(e)}))}}const AF=/(?<tag>[\w\-]+)?(?:#(?<id>[\w\-]+))?(?<class>(?:\.(?:[\w\-]+))*)(?:@(?<name>(?:[\w\_])+))?/;function _e(o,...e){let t,i;Array.isArray(e[0])?(t={},i=e[0]):(t=e[0]||{},i=e[1]);const n=AF.exec(o);if(!n||!n.groups)throw new Error("Bad use of h");const s=n.groups.tag||"div",r=document.createElement(s);n.groups.id&&(r.id=n.groups.id);const a=[];if(n.groups.class)for(const h of n.groups.class.split("."))h!==""&&a.push(h);if(t.className!==void 0)for(const h of t.className.split("."))h!==""&&a.push(h);a.length>0&&(r.className=a.join(" "));const c={};if(n.groups.name&&(c[n.groups.name]=r),i)for(const h of i)Ve(h)?r.appendChild(h):typeof h=="string"?r.append(h):"root"in h&&(Object.assign(c,h),r.appendChild(h.root));for(const[h,d]of Object.entries(t))if(h!=="className")if(h==="style")for(const[u,f]of Object.entries(d))r.style.setProperty(ad(u),typeof f=="number"?f+"px":""+f);else h==="tabIndex"?r.tabIndex=d:r.setAttribute(ad(h),d.toString());return c.root=r,c}function ad(o){return o.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()}function jn(o){return o.tagName.toLowerCase()==="input"||o.tagName.toLowerCase()==="textarea"||Ve(o)&&!!o.editContext}_.n=void 0,(function(o){function e(n=void 0){return(s,r,a)=>{const c=r.class;delete r.class;const h=r.ref;delete r.ref;const d=r.obsRef;return delete r.obsRef,new PF(s,h,d,n,c,r,a)}}function t(n,s=void 0){const r=e(s);return(a,c)=>r(n,a,c)}o.div=t("div"),o.elem=e(void 0),o.svg=t("svg","http://www.w3.org/2000/svg"),o.svgElem=e("http://www.w3.org/2000/svg");function i(){let n;const s=function(r){n=r};return Object.defineProperty(s,"element",{get(){if(!n)throw new l.BugIndicatingError("Make sure the ref is set before accessing the element. Maybe wrong initialization order?");return n}}),s}o.ref=i})(_.n||(_.n={}));class lC{constructor(e,t,i,n,s,r,a){this._deriveds=[],this._isHovered=void 0,this._didMouseMoveDuringHover=void 0,this._element=n?document.createElementNS(n,e):document.createElement(e),t&&t(this._element),i&&this._deriveds.push(Z(c=>{i(this),c.store.add({dispose:()=>{i(null)}})})),s&&(_x(s)?this._deriveds.push(Z(this,c=>{gx(this._element,px(s,c))})):gx(this._element,px(s,void 0)));for(const[c,h]of Object.entries(r))if(c==="style")for(const[d,u]of Object.entries(h)){const f=ad(d);Yr(u)?this._deriveds.push(fn({owner:this,debugName:()=>`set.style.${f}`},g=>{this._element.style.setProperty(f,bx(u.read(g)))})):this._element.style.setProperty(f,bx(u))}else c==="tabIndex"?Yr(h)?this._deriveds.push(Z(this,d=>{this._element.tabIndex=h.read(d)})):this._element.tabIndex=h:c.startsWith("on")?this._element[c]=h:Yr(h)?this._deriveds.push(fn({owner:this,debugName:()=>`set.${c}`},d=>{vx(this._element,c,h.read(d))})):vx(this._element,c,h);if(a){let c=function(d,u){return Yr(u)?c(d,u.read(d)):Array.isArray(u)?u.flatMap(f=>c(d,f)):u instanceof lC?(d&&u.readEffect(d),[u._element]):u?[u]:[]};const h=Z(this,d=>{this._element.replaceChildren(...c(d,a))});this._deriveds.push(h),Cx(a)||h.get()}}readEffect(e){for(const t of this._deriveds)t.read(e)}keepUpdated(e){return Z(t=>{this.readEffect(t)}).recomputeInitiallyAndOnChange(e),this}toDisposableLiveElement(){const e=new l.DisposableStore;return this.keepUpdated(e),new OF(this._element,e)}get isHovered(){if(!this._isHovered){const e=W("hovered",!1);this._element.addEventListener("mouseenter",t=>e.set(!0,void 0)),this._element.addEventListener("mouseleave",t=>e.set(!1,void 0)),this._isHovered=e}return this._isHovered}get didMouseMoveDuringHover(){if(!this._didMouseMoveDuringHover){let e=!1;const t=W("didMouseMoveDuringHover",!1);this._element.addEventListener("mouseenter",i=>{e=!0}),this._element.addEventListener("mousemove",i=>{e&&t.set(!0,void 0)}),this._element.addEventListener("mouseleave",i=>{e=!1,t.set(!1,void 0)}),this._didMouseMoveDuringHover=t}return this._didMouseMoveDuringHover}}function gx(o,e){hx(o)?o.setAttribute("class",e):o.className=e}function mx(o,e,t){if(Yr(o)){t(o.read(e));return}if(Array.isArray(o)){for(const i of o)mx(i,e,t);return}t(o)}function px(o,e){let t="";return mx(o,e,i=>{i&&(t.length===0?t=i:t+=" "+i)}),t}function _x(o){return Yr(o)?!0:Array.isArray(o)?o.some(e=>_x(e)):!1}function bx(o){return typeof o=="number"?o+"px":o}function Cx(o){return Yr(o)?!0:Array.isArray(o)?o.some(e=>Cx(e)):!1}class OF{constructor(e,t){this.element=e,this._disposable=t}dispose(){this._disposable.dispose()}}class PF extends lC{get element(){return this._element}}function vx(o,e,t){t==null?o.removeAttribute(ad(e)):o.setAttribute(ad(e),String(t))}class kF extends HTMLElement{disconnectedCallback(){this.onDidDisconnect?.()}connectedCallback(){this.onDidConnect?.()}}customElements.get("connection-observer")||customElements.define("connection-observer",kF);class FF extends l.Disposable{constructor(e){super(),this._onDidChange=this._register(new l.Emitter),this.onDidChange=this._onDidChange.event,this._listener=()=>this._handleChange(e,!0),this._mediaQueryList=null,this._handleChange(e,!1),this._register(l.toDisposable(()=>this._mediaQueryList?.removeEventListener("change",this._listener)))}_handleChange(e,t){this._mediaQueryList?.removeEventListener("change",this._listener),this._mediaQueryList=e.matchMedia(`(resolution: ${e.devicePixelRatio}dppx)`),this._mediaQueryList.addEventListener("change",this._listener),t&&this._onDidChange.fire()}}class BF extends l.Disposable{get value(){return this._value}constructor(e){super(),this._onDidChange=this._register(new l.Emitter),this.onDidChange=this._onDidChange.event,this._value=this._getPixelRatio(e);const t=this._register(new FF(e));this._register(t.onDidChange(()=>{this._value=this._getPixelRatio(e),this._onDidChange.fire(this._value)}))}_getPixelRatio(e){const t=document.createElement("canvas").getContext("2d"),i=e.devicePixelRatio||1,n=t?.webkitBackingStorePixelRatio||t?.mozBackingStorePixelRatio||t?.msBackingStorePixelRatio||t?.oBackingStorePixelRatio||t?.backingStorePixelRatio||1;return i/n}}class zF{constructor(){this.mapWindowIdToPixelRatioMonitor=new Map}_getOrCreatePixelRatioMonitor(e){const t=td(e);let i=this.mapWindowIdToPixelRatioMonitor.get(t);return i||(i=l.markAsSingleton(new BF(e)),this.mapWindowIdToPixelRatioMonitor.set(t,i),l.markAsSingleton(l.Event.once(uF)(({vscodeWindowId:n})=>{n===t&&(i?.dispose(),this.mapWindowIdToPixelRatioMonitor.delete(t))}))),i}getInstance(e){return this._getOrCreatePixelRatioMonitor(e)}}const ld=new zF;class Hf{constructor(e){this.domNode=e,this._maxWidth="",this._width="",this._height="",this._top="",this._left="",this._bottom="",this._right="",this._paddingLeft="",this._fontFamily="",this._fontWeight="",this._fontSize="",this._fontStyle="",this._fontFeatureSettings="",this._fontVariationSettings="",this._textDecoration="",this._lineHeight="",this._letterSpacing="",this._className="",this._display="",this._position="",this._visibility="",this._color="",this._backgroundColor="",this._layerHint=!1,this._contain="none",this._boxShadow=""}focus(){this.domNode.focus()}setMaxWidth(e){const t=qn(e);this._maxWidth!==t&&(this._maxWidth=t,this.domNode.style.maxWidth=this._maxWidth)}setWidth(e){const t=qn(e);this._width!==t&&(this._width=t,this.domNode.style.width=this._width)}setHeight(e){const t=qn(e);this._height!==t&&(this._height=t,this.domNode.style.height=this._height)}setTop(e){const t=qn(e);this._top!==t&&(this._top=t,this.domNode.style.top=this._top)}setLeft(e){const t=qn(e);this._left!==t&&(this._left=t,this.domNode.style.left=this._left)}setBottom(e){const t=qn(e);this._bottom!==t&&(this._bottom=t,this.domNode.style.bottom=this._bottom)}setRight(e){const t=qn(e);this._right!==t&&(this._right=t,this.domNode.style.right=this._right)}setPaddingLeft(e){const t=qn(e);this._paddingLeft!==t&&(this._paddingLeft=t,this.domNode.style.paddingLeft=this._paddingLeft)}setFontFamily(e){this._fontFamily!==e&&(this._fontFamily=e,this.domNode.style.fontFamily=this._fontFamily)}setFontWeight(e){this._fontWeight!==e&&(this._fontWeight=e,this.domNode.style.fontWeight=this._fontWeight)}setFontSize(e){const t=qn(e);this._fontSize!==t&&(this._fontSize=t,this.domNode.style.fontSize=this._fontSize)}setFontStyle(e){this._fontStyle!==e&&(this._fontStyle=e,this.domNode.style.fontStyle=this._fontStyle)}setFontFeatureSettings(e){this._fontFeatureSettings!==e&&(this._fontFeatureSettings=e,this.domNode.style.fontFeatureSettings=this._fontFeatureSettings)}setFontVariationSettings(e){this._fontVariationSettings!==e&&(this._fontVariationSettings=e,this.domNode.style.fontVariationSettings=this._fontVariationSettings)}setTextDecoration(e){this._textDecoration!==e&&(this._textDecoration=e,this.domNode.style.textDecoration=this._textDecoration)}setLineHeight(e){const t=qn(e);this._lineHeight!==t&&(this._lineHeight=t,this.domNode.style.lineHeight=this._lineHeight)}setLetterSpacing(e){const t=qn(e);this._letterSpacing!==t&&(this._letterSpacing=t,this.domNode.style.letterSpacing=this._letterSpacing)}setClassName(e){this._className!==e&&(this._className=e,this.domNode.className=this._className)}toggleClassName(e,t){this.domNode.classList.toggle(e,t),this._className=this.domNode.className}setDisplay(e){this._display!==e&&(this._display=e,this.domNode.style.display=this._display)}setPosition(e){this._position!==e&&(this._position=e,this.domNode.style.position=this._position)}setVisibility(e){this._visibility!==e&&(this._visibility=e,this.domNode.style.visibility=this._visibility)}setColor(e){this._color!==e&&(this._color=e,this.domNode.style.color=this._color)}setBackgroundColor(e){this._backgroundColor!==e&&(this._backgroundColor=e,this.domNode.style.backgroundColor=this._backgroundColor)}setLayerHinting(e){this._layerHint!==e&&(this._layerHint=e,this.domNode.style.transform=this._layerHint?"translate3d(0px, 0px, 0px)":"")}setBoxShadow(e){this._boxShadow!==e&&(this._boxShadow=e,this.domNode.style.boxShadow=e)}setContain(e){this._contain!==e&&(this._contain=e,this.domNode.style.contain=this._contain)}setAttribute(e,t){this.domNode.setAttribute(e,t)}removeAttribute(e){this.domNode.removeAttribute(e)}appendChild(e){this.domNode.appendChild(e.domNode)}removeChild(e){this.domNode.removeChild(e.domNode)}}function qn(o){return typeof o=="number"?`${o}px`:o}function we(o){return new Hf(o)}function Ot(o,e){o instanceof Hf?(o.setFontFamily(e.getMassagedFontFamily()),o.setFontWeight(e.fontWeight),o.setFontSize(e.fontSize),o.setFontFeatureSettings(e.fontFeatureSettings),o.setFontVariationSettings(e.fontVariationSettings),o.setLineHeight(e.lineHeight),o.setLetterSpacing(e.letterSpacing)):(o.style.fontFamily=e.getMassagedFontFamily(),o.style.fontWeight=e.fontWeight,o.style.fontSize=e.fontSize+"px",o.style.fontFeatureSettings=e.fontFeatureSettings,o.style.fontVariationSettings=e.fontVariationSettings,o.style.lineHeight=e.lineHeight+"px",o.style.letterSpacing=e.letterSpacing+"px")}class VF{constructor(e,t){this.chr=e,this.type=t,this.width=0}fulfill(e){this.width=e}}class cC{constructor(e,t){this._bareFontInfo=e,this._requests=t,this._container=null,this._testElements=null}read(e){this._createDomElements(),e.document.body.appendChild(this._container),this._readFromDomElements(),this._container?.remove(),this._container=null,this._testElements=null}_createDomElements(){const e=document.createElement("div");e.style.position="absolute",e.style.top="-50000px",e.style.width="50000px";const t=document.createElement("div");Ot(t,this._bareFontInfo),e.appendChild(t);const i=document.createElement("div");Ot(i,this._bareFontInfo),i.style.fontWeight="bold",e.appendChild(i);const n=document.createElement("div");Ot(n,this._bareFontInfo),n.style.fontStyle="italic",e.appendChild(n);const s=[];for(const r of this._requests){let a;r.type===0&&(a=t),r.type===2&&(a=i),r.type===1&&(a=n),a.appendChild(document.createElement("br"));const c=document.createElement("span");cC._render(c,r),a.appendChild(c),s.push(c)}this._container=e,this._testElements=s}static _render(e,t){if(t.chr===" "){let i=" ";for(let n=0;n<8;n++)i+=i;e.innerText=i}else{let i=t.chr;for(let n=0;n<8;n++)i+=i;e.textContent=i}}_readFromDomElements(){for(let e=0,t=this._requests.length;e<t;e++){const i=this._requests[e],n=this._testElements[e];i.fulfill(n.offsetWidth/256)}}}function UF(o,e,t){new cC(e,t).read(o)}class $F extends l.Disposable{constructor(){super(...arguments),this._cache=new Map,this._evictUntrustedReadingsTimeout=-1,this._onDidChange=this._register(new l.Emitter),this.onDidChange=this._onDidChange.event}dispose(){this._evictUntrustedReadingsTimeout!==-1&&(clearTimeout(this._evictUntrustedReadingsTimeout),this._evictUntrustedReadingsTimeout=-1),super.dispose()}clearAllFontInfos(){this._cache.clear(),this._onDidChange.fire()}_ensureCache(e){const t=td(e);let i=this._cache.get(t);return i||(i=new KF,this._cache.set(t,i)),i}_writeToCache(e,t,i){this._ensureCache(e).put(t,i),!i.isTrusted&&this._evictUntrustedReadingsTimeout===-1&&(this._evictUntrustedReadingsTimeout=e.setTimeout(()=>{this._evictUntrustedReadingsTimeout=-1,this._evictUntrustedReadings(e)},5e3))}_evictUntrustedReadings(e){const t=this._ensureCache(e),i=t.getValues();let n=!1;for(const s of i)s.isTrusted||(n=!0,t.remove(s));n&&this._onDidChange.fire()}readFontInfo(e,t){const i=this._ensureCache(e);if(!i.has(t)){let n=this._actualReadFontInfo(e,t);(n.typicalHalfwidthCharacterWidth<=2||n.typicalFullwidthCharacterWidth<=2||n.spaceWidth<=2||n.maxDigitWidth<=2)&&(n=new Af({pixelRatio:ld.getInstance(e).value,fontFamily:n.fontFamily,fontWeight:n.fontWeight,fontSize:n.fontSize,fontFeatureSettings:n.fontFeatureSettings,fontVariationSettings:n.fontVariationSettings,lineHeight:n.lineHeight,letterSpacing:n.letterSpacing,isMonospace:n.isMonospace,typicalHalfwidthCharacterWidth:Math.max(n.typicalHalfwidthCharacterWidth,5),typicalFullwidthCharacterWidth:Math.max(n.typicalFullwidthCharacterWidth,5),canUseHalfwidthRightwardsArrow:n.canUseHalfwidthRightwardsArrow,spaceWidth:Math.max(n.spaceWidth,5),middotWidth:Math.max(n.middotWidth,5),wsmiddotWidth:Math.max(n.wsmiddotWidth,5),maxDigitWidth:Math.max(n.maxDigitWidth,5)},!1)),this._writeToCache(e,t,n)}return i.get(t)}_createRequest(e,t,i,n){const s=new VF(e,t);return i.push(s),n?.push(s),s}_actualReadFontInfo(e,t){const i=[],n=[],s=this._createRequest("n",0,i,n),r=this._createRequest("m",0,i,null),a=this._createRequest(" ",0,i,n),c=this._createRequest("0",0,i,n),h=this._createRequest("1",0,i,n),d=this._createRequest("2",0,i,n),u=this._createRequest("3",0,i,n),f=this._createRequest("4",0,i,n),g=this._createRequest("5",0,i,n),m=this._createRequest("6",0,i,n),p=this._createRequest("7",0,i,n),b=this._createRequest("8",0,i,n),v=this._createRequest("9",0,i,n),C=this._createRequest("→",0,i,n),w=this._createRequest("→",0,i,null),S=this._createRequest("·",0,i,n),L=this._createRequest("⸱",0,i,null),D="|/-_ilm%";for(let O=0,P=D.length;O<P;O++)this._createRequest(D.charAt(O),0,i,n),this._createRequest(D.charAt(O),1,i,n),this._createRequest(D.charAt(O),2,i,n);UF(e,t,i);const x=Math.max(c.width,h.width,d.width,u.width,f.width,g.width,m.width,p.width,b.width,v.width);let I=t.fontFeatureSettings===io.OFF;const T=n[0].width;for(let O=1,P=n.length;I&&O<P;O++){const k=T-n[O].width;if(k<-.001||k>.001){I=!1;break}}let M=!0;return I&&w.width!==T&&(M=!1),w.width>C.width&&(M=!1),new Af({pixelRatio:ld.getInstance(e).value,fontFamily:t.fontFamily,fontWeight:t.fontWeight,fontSize:t.fontSize,fontFeatureSettings:t.fontFeatureSettings,fontVariationSettings:t.fontVariationSettings,lineHeight:t.lineHeight,letterSpacing:t.letterSpacing,isMonospace:I,typicalHalfwidthCharacterWidth:s.width,typicalFullwidthCharacterWidth:r.width,canUseHalfwidthRightwardsArrow:M,spaceWidth:a.width,middotWidth:S.width,wsmiddotWidth:L.width,maxDigitWidth:x},!0)}}class KF{constructor(){this._keys=Object.create(null),this._values=Object.create(null)}has(e){const t=e.getId();return!!this._values[t]}get(e){const t=e.getId();return this._values[t]}put(e,t){const i=e.getId();this._keys[i]=e,this._values[i]=t}remove(e){const t=e.getId();delete this._keys[t],delete this._values[t]}getValues(){return Object.keys(this._keys).map(e=>this._values[e])}}const hC=new $F;var Yn;(function(o){o.serviceIds=new Map,o.DI_TARGET="$di$target",o.DI_DEPENDENCIES="$di$dependencies";function e(t){return t[o.DI_DEPENDENCIES]||[]}o.getServiceDependencies=e})(Yn||(Yn={}));const me=le("instantiationService");function GF(o,e,t){e[Yn.DI_TARGET]===e?e[Yn.DI_DEPENDENCIES].push({id:o,index:t}):(e[Yn.DI_DEPENDENCIES]=[{id:o,index:t}],e[Yn.DI_TARGET]=e)}function le(o){if(Yn.serviceIds.has(o))return Yn.serviceIds.get(o);const e=function(t,i,n){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");GF(e,t,n)};return e.toString=()=>o,Yn.serviceIds.set(o,e),e}const pt=le("codeEditorService"),ri=le("modelService"),ql=le("textModelService");class oo extends l.Disposable{get onDidChange(){return this._onDidChange.event}constructor(e,t="",i="",n=!0,s){super(),this._onDidChange=this._register(new l.Emitter),this._enabled=!0,this._id=e,this._label=t,this._cssClass=i,this._enabled=n,this._actionCallback=s}get id(){return this._id}get label(){return this._label}set label(e){this._setLabel(e)}_setLabel(e){this._label!==e&&(this._label=e,this._onDidChange.fire({label:e}))}get tooltip(){return this._tooltip||""}set tooltip(e){this._setTooltip(e)}_setTooltip(e){this._tooltip!==e&&(this._tooltip=e,this._onDidChange.fire({tooltip:e}))}get class(){return this._cssClass}set class(e){this._setClass(e)}_setClass(e){this._cssClass!==e&&(this._cssClass=e,this._onDidChange.fire({class:e}))}get enabled(){return this._enabled}set enabled(e){this._setEnabled(e)}_setEnabled(e){this._enabled!==e&&(this._enabled=e,this._onDidChange.fire({enabled:e}))}get checked(){return this._checked}set checked(e){this._setChecked(e)}_setChecked(e){this._checked!==e&&(this._checked=e,this._onDidChange.fire({checked:e}))}async run(e,t){this._actionCallback&&await this._actionCallback(e)}}class Jr extends l.Disposable{constructor(){super(...arguments),this._onWillRun=this._register(new l.Emitter),this._onDidRun=this._register(new l.Emitter)}get onWillRun(){return this._onWillRun.event}get onDidRun(){return this._onDidRun.event}async run(e,t){if(!e.enabled)return;this._onWillRun.fire({action:e});let i;try{await this.runAction(e,t)}catch(n){i=n}this._onDidRun.fire({action:e,error:i})}async runAction(e,t){await e.run(t)}}const Bo=class Bo{constructor(){this.id=Bo.ID,this.label="",this.tooltip="",this.class="separator",this.enabled=!1,this.checked=void 0}static join(...e){let t=[];for(const i of e)i.length&&(t.length?t=[...t,new Bo,...i]:t=i);return t}static clean(e){for(;e.length>0&&e[0].id===Bo.ID;)e.shift();for(;e.length>0&&e[e.length-1].id===Bo.ID;)e.pop();for(let t=e.length-2;t>=0;t--)e[t].id===Bo.ID&&e[t+1].id===Bo.ID&&e.splice(t+1,1);return e}async run(){}};Bo.ID="vs.actions.separator";let ft=Bo;class cd{get actions(){return this._actions}constructor(e,t,i,n){this.tooltip="",this.enabled=!0,this.checked=void 0,this.id=e,this.label=t,this.class=n,this._actions=i}async run(){}}const K_=class K_ extends oo{constructor(){super(K_.ID,l.localize(32,"(empty)"),void 0,!1)}};K_.ID="vs.actions.empty";let dC=K_;function Yo(o){return{id:o.id,label:o.label,tooltip:o.tooltip??o.label,class:o.class,enabled:o.enabled??!0,checked:o.checked,run:async(...e)=>o.run(...e)}}var uC;(function(o){function e(t){return!!t&&typeof t=="object"&&typeof t.id=="string"}o.isThemeColor=e})(uC||(uC={})),_.ThemeIcon=void 0,(function(o){o.iconNameSegment="[A-Za-z0-9]+",o.iconNameExpression="[A-Za-z0-9-]+",o.iconModifierExpression="~[A-Za-z]+",o.iconNameCharacter="[A-Za-z0-9~-]";const e=new RegExp(`^(${o.iconNameExpression})(${o.iconModifierExpression})?$`);function t(m){const p=e.exec(m.id);if(!p)return t(l.Codicon.error);const[,b,v]=p,C=["codicon","codicon-"+b];return v&&C.push("codicon-modifier-"+v.substring(1)),C}o.asClassNameArray=t;function i(m){return t(m).join(" ")}o.asClassName=i;function n(m){return"."+t(m).join(".")}o.asCSSSelector=n;function s(m){return!!m&&typeof m=="object"&&typeof m.id=="string"&&(typeof m.color>"u"||uC.isThemeColor(m.color))}o.isThemeIcon=s;const r=new RegExp(`^\\$\\((${o.iconNameExpression}(?:${o.iconModifierExpression})?)\\)$`);function a(m){const p=r.exec(m);if(!p)return;const[,b]=p;return{id:b}}o.fromString=a;function c(m){return{id:m}}o.fromId=c;function h(m,p){let b=m.id;const v=b.lastIndexOf("~");return v!==-1&&(b=b.substring(0,v)),p&&(b=`${b}~${p}`),{id:b}}o.modify=h;function d(m){const p=m.id.lastIndexOf("~");if(p!==-1)return m.id.substring(p+1)}o.getModifier=d;function u(m,p){return m.id===p.id&&m.color?.id===p.color?.id}o.isEqual=u;function f(m){return m?.id===l.Codicon.file.id}o.isFile=f;function g(m){return m?.id===l.Codicon.folder.id}o.isFolder=g})(_.ThemeIcon||(_.ThemeIcon={}));const zi=le("commandService"),Ut=new class{constructor(){this._commands=new Map,this._onDidRegisterCommand=new l.Emitter,this.onDidRegisterCommand=this._onDidRegisterCommand.event}registerCommand(o,e){if(!o)throw new Error("invalid command");if(typeof o=="string"){if(!e)throw new Error("invalid command");return this.registerCommand({id:o,handler:e})}if(o.metadata&&Array.isArray(o.metadata.args)){const r=[];for(const c of o.metadata.args)r.push(c.constraint);const a=o.handler;o.handler=function(c,...h){return l.validateConstraints(h,r),a(c,...h)}}const{id:t}=o;let i=this._commands.get(t);i||(i=new l.LinkedList,this._commands.set(t,i));const n=i.unshift(o),s=l.toDisposable(()=>{n(),this._commands.get(t)?.isEmpty()&&this._commands.delete(t)});return this._onDidRegisterCommand.fire(t),l.markAsSingleton(s)}registerCommandAlias(o,e){return Ut.registerCommand(o,(t,...i)=>t.get(zi).executeCommand(e,...i))}getCommand(o){const e=this._commands.get(o);if(!(!e||e.isEmpty()))return l.Iterable.first(e)}getCommands(){const o=new Map;for(const e of this._commands.keys()){const t=this.getCommand(e);t&&o.set(e,t)}return o}};Ut.registerCommand("noop",()=>{});function fC(...o){switch(o.length){case 1:return l.localize(1755,"Did you mean {0}?",o[0]);case 2:return l.localize(1756,"Did you mean {0} or {1}?",o[0],o[1]);case 3:return l.localize(1757,"Did you mean {0}, {1} or {2}?",o[0],o[1],o[2]);default:return}}const jF=l.localize(1758,"Did you forget to open or close the quote?"),qF=l.localize(1759,"Did you forget to escape the '/' (slash) character? Put two backslashes before it to escape, e.g., '\\\\/'."),Eh=class Eh{constructor(){this._input="",this._start=0,this._current=0,this._tokens=[],this._errors=[],this.stringRe=/[a-zA-Z0-9_<>\-\./\\:\*\?\+\[\]\^,#@;"%\$\p{L}-]+/uy}static getLexeme(e){switch(e.type){case 0:return"(";case 1:return")";case 2:return"!";case 3:return e.isTripleEq?"===":"==";case 4:return e.isTripleEq?"!==":"!=";case 5:return"<";case 6:return"<=";case 7:return">";case 8:return">=";case 9:return"=~";case 10:return e.lexeme;case 11:return"true";case 12:return"false";case 13:return"in";case 14:return"not";case 15:return"&&";case 16:return"||";case 17:return e.lexeme;case 18:return e.lexeme;case 19:return e.lexeme;case 20:return"EOF";default:throw l.illegalState(`unhandled token type: ${JSON.stringify(e)}; have you forgotten to add a case?`)}}reset(e){return this._input=e,this._start=0,this._current=0,this._tokens=[],this._errors=[],this}scan(){for(;!this._isAtEnd();)switch(this._start=this._current,this._advance()){case 40:this._addToken(0);break;case 41:this._addToken(1);break;case 33:if(this._match(61)){const t=this._match(61);this._tokens.push({type:4,offset:this._start,isTripleEq:t})}else this._addToken(2);break;case 39:this._quotedString();break;case 47:this._regex();break;case 61:if(this._match(61)){const t=this._match(61);this._tokens.push({type:3,offset:this._start,isTripleEq:t})}else this._match(126)?this._addToken(9):this._error(fC("==","=~"));break;case 60:this._addToken(this._match(61)?6:5);break;case 62:this._addToken(this._match(61)?8:7);break;case 38:this._match(38)?this._addToken(15):this._error(fC("&&"));break;case 124:this._match(124)?this._addToken(16):this._error(fC("||"));break;case 32:case 13:case 9:case 10:case 160:break;default:this._string()}return this._start=this._current,this._addToken(20),Array.from(this._tokens)}_match(e){return this._isAtEnd()||this._input.charCodeAt(this._current)!==e?!1:(this._current++,!0)}_advance(){return this._input.charCodeAt(this._current++)}_peek(){return this._isAtEnd()?0:this._input.charCodeAt(this._current)}_addToken(e){this._tokens.push({type:e,offset:this._start})}_error(e){const t=this._start,i=this._input.substring(this._start,this._current),n={type:19,offset:this._start,lexeme:i};this._errors.push({offset:t,lexeme:i,additionalInfo:e}),this._tokens.push(n)}_string(){this.stringRe.lastIndex=this._start;const e=this.stringRe.exec(this._input);if(e){this._current=this._start+e[0].length;const t=this._input.substring(this._start,this._current),i=Eh._keywords.get(t);i?this._addToken(i):this._tokens.push({type:17,lexeme:t,offset:this._start})}}_quotedString(){for(;this._peek()!==39&&!this._isAtEnd();)this._advance();if(this._isAtEnd()){this._error(jF);return}this._advance(),this._tokens.push({type:18,lexeme:this._input.substring(this._start+1,this._current-1),offset:this._start+1})}_regex(){let e=this._current,t=!1,i=!1;for(;;){if(e>=this._input.length){this._current=e,this._error(qF);return}const s=this._input.charCodeAt(e);if(t)t=!1;else if(s===47&&!i){e++;break}else s===91?i=!0:s===92?t=!0:s===93&&(i=!1);e++}for(;e<this._input.length&&Eh._regexFlags.has(this._input.charCodeAt(e));)e++;this._current=e;const n=this._input.substring(this._start,this._current);this._tokens.push({type:10,lexeme:n,offset:this._start})}_isAtEnd(){return this._current>=this._input.length}};Eh._regexFlags=new Set(["i","g","s","m","y","u"].map(e=>e.charCodeAt(0))),Eh._keywords=new Map([["not",14],["in",13],["false",12],["true",11]]);let Wr=Eh;const Ht=new Map;Ht.set("false",!1),Ht.set("true",!0),Ht.set("isMac",l.isMacintosh),Ht.set("isLinux",l.isLinux),Ht.set("isWindows",l.isWindows),Ht.set("isWeb",l.isWeb),Ht.set("isMacNative",l.isMacintosh&&!l.isWeb),Ht.set("isEdge",l.isEdge),Ht.set("isFirefox",l.isFirefox),Ht.set("isChrome",l.isChrome),Ht.set("isSafari",l.isSafari);const YF=Object.prototype.hasOwnProperty,ZF={regexParsingWithErrorRecovery:!0},QF=l.localize(1737,"Empty context key expression"),XF=l.localize(1738,"Did you forget to write an expression? You can also put 'false' or 'true' to always evaluate to false or true, respectively."),JF=l.localize(1739,"'in' after 'not'."),wx=l.localize(1740,"closing parenthesis ')'"),WF=l.localize(1741,"Unexpected token"),HF=l.localize(1742,"Did you forget to put && or || before the token?"),eB=l.localize(1743,"Unexpected end of expression"),tB=l.localize(1744,"Did you forget to put a context key?");let iB=(Qs=class{constructor(e=ZF){this._config=e,this._scanner=new Wr,this._tokens=[],this._current=0,this._parsingErrors=[],this._flagsGYRe=/g|y/g}parse(e){if(e===""){this._parsingErrors.push({message:QF,offset:0,lexeme:"",additionalInfo:XF});return}this._tokens=this._scanner.reset(e).scan(),this._current=0,this._parsingErrors=[];try{const t=this._expr();if(!this._isAtEnd()){const i=this._peek(),n=i.type===17?HF:void 0;throw this._parsingErrors.push({message:WF,offset:i.offset,lexeme:Wr.getLexeme(i),additionalInfo:n}),Qs._parseError}return t}catch(t){if(t!==Qs._parseError)throw t;return}}_expr(){return this._or()}_or(){const e=[this._and()];for(;this._matchOne(16);){const t=this._and();e.push(t)}return e.length===1?e[0]:de.or(...e)}_and(){const e=[this._term()];for(;this._matchOne(15);){const t=this._term();e.push(t)}return e.length===1?e[0]:de.and(...e)}_term(){if(this._matchOne(2)){const e=this._peek();switch(e.type){case 11:return this._advance(),ui.INSTANCE;case 12:return this._advance(),Ni.INSTANCE;case 0:{this._advance();const t=this._expr();return this._consume(1,wx),t?.negate()}case 17:return this._advance(),ea.create(e.lexeme);default:throw this._errExpectedButGot("KEY | true | false | '(' expression ')'",e)}}return this._primary()}_primary(){const e=this._peek();switch(e.type){case 11:return this._advance(),de.true();case 12:return this._advance(),de.false();case 0:{this._advance();const t=this._expr();return this._consume(1,wx),t}case 17:{const t=e.lexeme;if(this._advance(),this._matchOne(9)){const n=this._peek();if(!this._config.regexParsingWithErrorRecovery){if(this._advance(),n.type!==10)throw this._errExpectedButGot("REGEX",n);const s=n.lexeme,r=s.lastIndexOf("/"),a=r===s.length-1?void 0:this._removeFlagsGY(s.substring(r+1));let c;try{c=new RegExp(s.substring(1,r),a)}catch{throw this._errExpectedButGot("REGEX",n)}return dd.create(t,c)}switch(n.type){case 10:case 19:{const s=[n.lexeme];this._advance();let r=this._peek(),a=0;for(let f=0;f<n.lexeme.length;f++)n.lexeme.charCodeAt(f)===40?a++:n.lexeme.charCodeAt(f)===41&&a--;for(;!this._isAtEnd()&&r.type!==15&&r.type!==16;){switch(r.type){case 0:a++;break;case 1:a--;break;case 10:case 18:for(let f=0;f<r.lexeme.length;f++)r.lexeme.charCodeAt(f)===40?a++:n.lexeme.charCodeAt(f)===41&&a--}if(a<0)break;s.push(Wr.getLexeme(r)),this._advance(),r=this._peek()}const c=s.join(""),h=c.lastIndexOf("/"),d=h===c.length-1?void 0:this._removeFlagsGY(c.substring(h+1));let u;try{u=new RegExp(c.substring(1,h),d)}catch{throw this._errExpectedButGot("REGEX",n)}return de.regex(t,u)}case 18:{const s=n.lexeme;this._advance();let r=null;if(!l.isFalsyOrWhitespace(s)){const a=s.indexOf("/"),c=s.lastIndexOf("/");if(a!==c&&a>=0){const h=s.slice(a+1,c),d=s[c+1]==="i"?"i":"";try{r=new RegExp(h,d)}catch{throw this._errExpectedButGot("REGEX",n)}}}if(r===null)throw this._errExpectedButGot("REGEX",n);return dd.create(t,r)}default:throw this._errExpectedButGot("REGEX",this._peek())}}if(this._matchOne(14)){this._consume(13,JF);const n=this._value();return de.notIn(t,n)}switch(this._peek().type){case 3:{this._advance();const n=this._value();if(this._previous().type===18)return de.equals(t,n);switch(n){case"true":return de.has(t);case"false":return de.not(t);default:return de.equals(t,n)}}case 4:{this._advance();const n=this._value();if(this._previous().type===18)return de.notEquals(t,n);switch(n){case"true":return de.not(t);case"false":return de.has(t);default:return de.notEquals(t,n)}}case 5:return this._advance(),rg.create(t,this._value());case 6:return this._advance(),ag.create(t,this._value());case 7:return this._advance(),sg.create(t,this._value());case 8:return this._advance(),og.create(t,this._value());case 13:return this._advance(),de.in(t,this._value());default:return de.has(t)}}case 20:throw this._parsingErrors.push({message:eB,offset:e.offset,lexeme:"",additionalInfo:tB}),Qs._parseError;default:throw this._errExpectedButGot(`true | false | KEY
|
||
| KEY '=~' REGEX
|
||
| KEY ('==' | '!=' | '<' | '<=' | '>' | '>=' | 'in' | 'not' 'in') value`,this._peek())}}_value(){const e=this._peek();switch(e.type){case 17:case 18:return this._advance(),e.lexeme;case 11:return this._advance(),"true";case 12:return this._advance(),"false";case 13:return this._advance(),"in";default:return""}}_removeFlagsGY(e){return e.replaceAll(this._flagsGYRe,"")}_previous(){return this._tokens[this._current-1]}_matchOne(e){return this._check(e)?(this._advance(),!0):!1}_advance(){return this._isAtEnd()||this._current++,this._previous()}_consume(e,t){if(this._check(e))return this._advance();throw this._errExpectedButGot(t,this._peek())}_errExpectedButGot(e,t,i){const n=l.localize(1745,`Expected: {0}
|
||
Received: '{1}'.`,e,Wr.getLexeme(t)),s=t.offset,r=Wr.getLexeme(t);return this._parsingErrors.push({message:n,offset:s,lexeme:r,additionalInfo:i}),Qs._parseError}_check(e){return this._peek().type===e}_peek(){return this._tokens[this._current]}_isAtEnd(){return this._peek().type===20}},Qs._parseError=new Error,Qs);const hD=class hD{static false(){return ui.INSTANCE}static true(){return Ni.INSTANCE}static has(e){return Hr.create(e)}static equals(e,t){return Yl.create(e,t)}static notEquals(e,t){return ig.create(e,t)}static regex(e,t){return dd.create(e,t)}static in(e,t){return eg.create(e,t)}static notIn(e,t){return tg.create(e,t)}static not(e){return ea.create(e)}static and(...e){return ta.create(e,null,!0)}static or(...e){return ro.create(e,null,!0)}static deserialize(e){return e==null?void 0:this._parser.parse(e)}};hD._parser=new iB({regexParsingWithErrorRecovery:!1});let de=hD;function hd(o,e){return o.cmp(e)}const G_=class G_{constructor(){this.type=0}cmp(e){return this.type-e.type}equals(e){return e.type===this.type}substituteConstants(){return this}evaluate(e){return!1}serialize(){return"false"}keys(){return[]}negate(){return Ni.INSTANCE}};G_.INSTANCE=new G_;let ui=G_;const j_=class j_{constructor(){this.type=1}cmp(e){return this.type-e.type}equals(e){return e.type===this.type}substituteConstants(){return this}evaluate(e){return!0}serialize(){return"true"}keys(){return[]}negate(){return ui.INSTANCE}};j_.INSTANCE=new j_;let Ni=j_;class Hr{static create(e,t=null){const i=Ht.get(e);return typeof i=="boolean"?i?Ni.INSTANCE:ui.INSTANCE:new Hr(e,t)}constructor(e,t){this.key=e,this.negated=t,this.type=2}cmp(e){return e.type!==this.type?this.type-e.type:yx(this.key,e.key)}equals(e){return e.type===this.type?this.key===e.key:!1}substituteConstants(){const e=Ht.get(this.key);return typeof e=="boolean"?e?Ni.INSTANCE:ui.INSTANCE:this}evaluate(e){return!!e.getValue(this.key)}serialize(){return this.key}keys(){return[this.key]}negate(){return this.negated||(this.negated=ea.create(this.key,this)),this.negated}}class Yl{static create(e,t,i=null){if(typeof t=="boolean")return t?Hr.create(e,i):ea.create(e,i);const n=Ht.get(e);return typeof n=="boolean"?t===(n?"true":"false")?Ni.INSTANCE:ui.INSTANCE:new Yl(e,t,i)}constructor(e,t,i){this.key=e,this.value=t,this.negated=i,this.type=4}cmp(e){return e.type!==this.type?this.type-e.type:ia(this.key,this.value,e.key,e.value)}equals(e){return e.type===this.type?this.key===e.key&&this.value===e.value:!1}substituteConstants(){const e=Ht.get(this.key);if(typeof e=="boolean"){const t=e?"true":"false";return this.value===t?Ni.INSTANCE:ui.INSTANCE}return this}evaluate(e){return e.getValue(this.key)==this.value}serialize(){return`${this.key} == '${this.value}'`}keys(){return[this.key]}negate(){return this.negated||(this.negated=ig.create(this.key,this.value,this)),this.negated}}class eg{static create(e,t){return new eg(e,t)}constructor(e,t){this.key=e,this.valueKey=t,this.type=10,this.negated=null}cmp(e){return e.type!==this.type?this.type-e.type:ia(this.key,this.valueKey,e.key,e.valueKey)}equals(e){return e.type===this.type?this.key===e.key&&this.valueKey===e.valueKey:!1}substituteConstants(){return this}evaluate(e){const t=e.getValue(this.valueKey),i=e.getValue(this.key);if(Array.isArray(t)){if(t.includes(i))return!0;if(l.isWindows&&typeof i=="string"&&i.startsWith("file:///")){const n=i.toLowerCase();return t.some(s=>typeof s=="string"&&s.toLowerCase()===n)}return!1}if(typeof i=="string"&&typeof t=="object"&&t!==null){if(YF.call(t,i))return!0;if(l.isWindows&&i.startsWith("file:///")){const n=i.toLowerCase();return Object.keys(t).some(s=>s.toLowerCase()===n)}return!1}return!1}serialize(){return`${this.key} in '${this.valueKey}'`}keys(){return[this.key,this.valueKey]}negate(){return this.negated||(this.negated=tg.create(this.key,this.valueKey)),this.negated}}class tg{static create(e,t){return new tg(e,t)}constructor(e,t){this.key=e,this.valueKey=t,this.type=11,this._negated=eg.create(e,t)}cmp(e){return e.type!==this.type?this.type-e.type:this._negated.cmp(e._negated)}equals(e){return e.type===this.type?this._negated.equals(e._negated):!1}substituteConstants(){return this}evaluate(e){return!this._negated.evaluate(e)}serialize(){return`${this.key} not in '${this.valueKey}'`}keys(){return this._negated.keys()}negate(){return this._negated}}class ig{static create(e,t,i=null){if(typeof t=="boolean")return t?ea.create(e,i):Hr.create(e,i);const n=Ht.get(e);return typeof n=="boolean"?t===(n?"true":"false")?ui.INSTANCE:Ni.INSTANCE:new ig(e,t,i)}constructor(e,t,i){this.key=e,this.value=t,this.negated=i,this.type=5}cmp(e){return e.type!==this.type?this.type-e.type:ia(this.key,this.value,e.key,e.value)}equals(e){return e.type===this.type?this.key===e.key&&this.value===e.value:!1}substituteConstants(){const e=Ht.get(this.key);if(typeof e=="boolean"){const t=e?"true":"false";return this.value===t?ui.INSTANCE:Ni.INSTANCE}return this}evaluate(e){return e.getValue(this.key)!=this.value}serialize(){return`${this.key} != '${this.value}'`}keys(){return[this.key]}negate(){return this.negated||(this.negated=Yl.create(this.key,this.value,this)),this.negated}}class ea{static create(e,t=null){const i=Ht.get(e);return typeof i=="boolean"?i?ui.INSTANCE:Ni.INSTANCE:new ea(e,t)}constructor(e,t){this.key=e,this.negated=t,this.type=3}cmp(e){return e.type!==this.type?this.type-e.type:yx(this.key,e.key)}equals(e){return e.type===this.type?this.key===e.key:!1}substituteConstants(){const e=Ht.get(this.key);return typeof e=="boolean"?e?ui.INSTANCE:Ni.INSTANCE:this}evaluate(e){return!e.getValue(this.key)}serialize(){return`!${this.key}`}keys(){return[this.key]}negate(){return this.negated||(this.negated=Hr.create(this.key,this)),this.negated}}function ng(o,e){if(typeof o=="string"){const t=parseFloat(o);isNaN(t)||(o=t)}return typeof o=="string"||typeof o=="number"?e(o):ui.INSTANCE}class sg{static create(e,t,i=null){return ng(t,n=>new sg(e,n,i))}constructor(e,t,i){this.key=e,this.value=t,this.negated=i,this.type=12}cmp(e){return e.type!==this.type?this.type-e.type:ia(this.key,this.value,e.key,e.value)}equals(e){return e.type===this.type?this.key===e.key&&this.value===e.value:!1}substituteConstants(){return this}evaluate(e){return typeof this.value=="string"?!1:parseFloat(e.getValue(this.key))>this.value}serialize(){return`${this.key} > ${this.value}`}keys(){return[this.key]}negate(){return this.negated||(this.negated=ag.create(this.key,this.value,this)),this.negated}}class og{static create(e,t,i=null){return ng(t,n=>new og(e,n,i))}constructor(e,t,i){this.key=e,this.value=t,this.negated=i,this.type=13}cmp(e){return e.type!==this.type?this.type-e.type:ia(this.key,this.value,e.key,e.value)}equals(e){return e.type===this.type?this.key===e.key&&this.value===e.value:!1}substituteConstants(){return this}evaluate(e){return typeof this.value=="string"?!1:parseFloat(e.getValue(this.key))>=this.value}serialize(){return`${this.key} >= ${this.value}`}keys(){return[this.key]}negate(){return this.negated||(this.negated=rg.create(this.key,this.value,this)),this.negated}}class rg{static create(e,t,i=null){return ng(t,n=>new rg(e,n,i))}constructor(e,t,i){this.key=e,this.value=t,this.negated=i,this.type=14}cmp(e){return e.type!==this.type?this.type-e.type:ia(this.key,this.value,e.key,e.value)}equals(e){return e.type===this.type?this.key===e.key&&this.value===e.value:!1}substituteConstants(){return this}evaluate(e){return typeof this.value=="string"?!1:parseFloat(e.getValue(this.key))<this.value}serialize(){return`${this.key} < ${this.value}`}keys(){return[this.key]}negate(){return this.negated||(this.negated=og.create(this.key,this.value,this)),this.negated}}class ag{static create(e,t,i=null){return ng(t,n=>new ag(e,n,i))}constructor(e,t,i){this.key=e,this.value=t,this.negated=i,this.type=15}cmp(e){return e.type!==this.type?this.type-e.type:ia(this.key,this.value,e.key,e.value)}equals(e){return e.type===this.type?this.key===e.key&&this.value===e.value:!1}substituteConstants(){return this}evaluate(e){return typeof this.value=="string"?!1:parseFloat(e.getValue(this.key))<=this.value}serialize(){return`${this.key} <= ${this.value}`}keys(){return[this.key]}negate(){return this.negated||(this.negated=sg.create(this.key,this.value,this)),this.negated}}class dd{static create(e,t){return new dd(e,t)}constructor(e,t){this.key=e,this.regexp=t,this.type=7,this.negated=null}cmp(e){if(e.type!==this.type)return this.type-e.type;if(this.key<e.key)return-1;if(this.key>e.key)return 1;const t=this.regexp?this.regexp.source:"",i=e.regexp?e.regexp.source:"";return t<i?-1:t>i?1:0}equals(e){if(e.type===this.type){const t=this.regexp?this.regexp.source:"",i=e.regexp?e.regexp.source:"";return this.key===e.key&&t===i}return!1}substituteConstants(){return this}evaluate(e){const t=e.getValue(this.key);return this.regexp?this.regexp.test(t):!1}serialize(){const e=this.regexp?`/${this.regexp.source}/${this.regexp.flags}`:"/invalid/";return`${this.key} =~ ${e}`}keys(){return[this.key]}negate(){return this.negated||(this.negated=gC.create(this)),this.negated}}class gC{static create(e){return new gC(e)}constructor(e){this._actual=e,this.type=8}cmp(e){return e.type!==this.type?this.type-e.type:this._actual.cmp(e._actual)}equals(e){return e.type===this.type?this._actual.equals(e._actual):!1}substituteConstants(){return this}evaluate(e){return!this._actual.evaluate(e)}serialize(){return`!(${this._actual.serialize()})`}keys(){return this._actual.keys()}negate(){return this._actual}}function Sx(o){let e=null;for(let t=0,i=o.length;t<i;t++){const n=o[t].substituteConstants();if(o[t]!==n&&e===null){e=[];for(let s=0;s<t;s++)e[s]=o[s]}e!==null&&(e[t]=n)}return e===null?o:e}class ta{static create(e,t,i){return ta._normalizeArr(e,t,i)}constructor(e,t){this.expr=e,this.negated=t,this.type=6}cmp(e){if(e.type!==this.type)return this.type-e.type;if(this.expr.length<e.expr.length)return-1;if(this.expr.length>e.expr.length)return 1;for(let t=0,i=this.expr.length;t<i;t++){const n=hd(this.expr[t],e.expr[t]);if(n!==0)return n}return 0}equals(e){if(e.type===this.type){if(this.expr.length!==e.expr.length)return!1;for(let t=0,i=this.expr.length;t<i;t++)if(!this.expr[t].equals(e.expr[t]))return!1;return!0}return!1}substituteConstants(){const e=Sx(this.expr);return e===this.expr?this:ta.create(e,this.negated,!1)}evaluate(e){for(let t=0,i=this.expr.length;t<i;t++)if(!this.expr[t].evaluate(e))return!1;return!0}static _normalizeArr(e,t,i){const n=[];let s=!1;for(const r of e)if(r){if(r.type===1){s=!0;continue}if(r.type===0)return ui.INSTANCE;if(r.type===6){n.push(...r.expr);continue}n.push(r)}if(n.length===0&&s)return Ni.INSTANCE;if(n.length!==0){if(n.length===1)return n[0];n.sort(hd);for(let r=1;r<n.length;r++)n[r-1].equals(n[r])&&(n.splice(r,1),r--);if(n.length===1)return n[0];for(;n.length>1;){const r=n[n.length-1];if(r.type!==9)break;n.pop();const a=n.pop(),c=n.length===0,h=ro.create(r.expr.map(d=>ta.create([d,a],null,i)),null,c);h&&(n.push(h),n.sort(hd))}if(n.length===1)return n[0];if(i){for(let r=0;r<n.length;r++)for(let a=r+1;a<n.length;a++)if(n[r].negate().equals(n[a]))return ui.INSTANCE;if(n.length===1)return n[0]}return new ta(n,t)}}serialize(){return this.expr.map(e=>e.serialize()).join(" && ")}keys(){const e=[];for(const t of this.expr)e.push(...t.keys());return e}negate(){if(!this.negated){const e=[];for(const t of this.expr)e.push(t.negate());this.negated=ro.create(e,this,!0)}return this.negated}}class ro{static create(e,t,i){return ro._normalizeArr(e,t,i)}constructor(e,t){this.expr=e,this.negated=t,this.type=9}cmp(e){if(e.type!==this.type)return this.type-e.type;if(this.expr.length<e.expr.length)return-1;if(this.expr.length>e.expr.length)return 1;for(let t=0,i=this.expr.length;t<i;t++){const n=hd(this.expr[t],e.expr[t]);if(n!==0)return n}return 0}equals(e){if(e.type===this.type){if(this.expr.length!==e.expr.length)return!1;for(let t=0,i=this.expr.length;t<i;t++)if(!this.expr[t].equals(e.expr[t]))return!1;return!0}return!1}substituteConstants(){const e=Sx(this.expr);return e===this.expr?this:ro.create(e,this.negated,!1)}evaluate(e){for(let t=0,i=this.expr.length;t<i;t++)if(this.expr[t].evaluate(e))return!0;return!1}static _normalizeArr(e,t,i){let n=[],s=!1;if(e){for(let r=0,a=e.length;r<a;r++){const c=e[r];if(c){if(c.type===0){s=!0;continue}if(c.type===1)return Ni.INSTANCE;if(c.type===9){n=n.concat(c.expr);continue}n.push(c)}}if(n.length===0&&s)return ui.INSTANCE;n.sort(hd)}if(n.length!==0){if(n.length===1)return n[0];for(let r=1;r<n.length;r++)n[r-1].equals(n[r])&&(n.splice(r,1),r--);if(n.length===1)return n[0];if(i){for(let r=0;r<n.length;r++)for(let a=r+1;a<n.length;a++)if(n[r].negate().equals(n[a]))return Ni.INSTANCE;if(n.length===1)return n[0]}return new ro(n,t)}}serialize(){return this.expr.map(e=>e.serialize()).join(" || ")}keys(){const e=[];for(const t of this.expr)e.push(...t.keys());return e}negate(){if(!this.negated){const e=[];for(const t of this.expr)e.push(t.negate());for(;e.length>1;){const t=e.shift(),i=e.shift(),n=[];for(const s of Dx(t))for(const r of Dx(i))n.push(ta.create([s,r],null,!1));e.unshift(ro.create(n,null,!1))}this.negated=ro.create(e,this,!0)}return this.negated}}const Ih=class Ih extends Hr{static all(){return Ih._info.values()}constructor(e,t,i){super(e,null),this._defaultValue=t,typeof i=="object"?Ih._info.push({...i,key:e}):i!==!0&&Ih._info.push({key:e,description:i,type:t!=null?typeof t:void 0})}bindTo(e){return e.createKey(this.key,this._defaultValue)}getValue(e){return e.getContextKeyValue(this.key)}toNegated(){return this.negate()}isEqualTo(e){return Yl.create(this.key,e)}};Ih._info=[];let q=Ih;const be=le("contextKeyService");function yx(o,e){return o<e?-1:o>e?1:0}function ia(o,e,t,i){return o<t?-1:o>t?1:e<i?-1:e>i?1:0}function mC(o,e){if(o.type===0||e.type===1)return!0;if(o.type===9)return e.type===9?Lx(o.expr,e.expr):!1;if(e.type===9){for(const t of e.expr)if(mC(o,t))return!0;return!1}if(o.type===6){if(e.type===6)return Lx(e.expr,o.expr);for(const t of o.expr)if(mC(t,e))return!0;return!1}return o.equals(e)}function Lx(o,e){let t=0,i=0;for(;t<o.length&&i<e.length;){const n=o[t].cmp(e[i]);if(n<0)return!1;n===0&&t++,i++}return t===o.length}function Dx(o){return o.type===9?o.expr:[o]}class nB{constructor(){this.data=new Map}add(e,t){l.ok(l.isString(e)),l.ok(l.isObject(t)),l.ok(!this.data.has(e),"There is already an extension with this id"),this.data.set(e,t)}as(e){return this.data.get(e)||null}dispose(){this.data.forEach(e=>{l.isFunction(e.dispose)&&e.dispose()}),this.data.clear()}}const St=new nB;class lg{constructor(){this._coreKeybindings=new l.LinkedList,this._coreKeybindingRules=new l.LinkedList,this._extensionKeybindings=[],this._cachedMergedKeybindings=null}static bindToPlatform(e,t){if(t===1){if(e&&e.win)return e.win}else if(t===2){if(e&&e.mac)return e.mac}else if(e&&e.linux)return e.linux;return e}static bindToCurrentPlatform(e){return lg.bindToPlatform(e,l.OS)}registerKeybindingRule(e){const t=lg.bindToCurrentPlatform(e),i=new l.DisposableStore;if(t&&t.primary){const s=jb(t.primary,l.OS);s&&i.add(this._registerDefaultKeybinding(s,e.id,e.args,e.weight,0,e.when))}if(t&&Array.isArray(t.secondary))for(let s=0,r=t.secondary.length;s<r;s++){const a=t.secondary[s],c=jb(a,l.OS);c&&i.add(this._registerDefaultKeybinding(c,e.id,e.args,e.weight,-s-1,e.when))}const n=this._coreKeybindingRules.push(e);return i.add(l.toDisposable(()=>{n()})),i}registerCommandAndKeybindingRule(e){return l.combinedDisposable(this.registerKeybindingRule(e),Ut.registerCommand(e))}_registerDefaultKeybinding(e,t,i,n,s,r){const a=this._coreKeybindings.push({keybinding:e,command:t,commandArgs:i,when:r,weight1:n,weight2:s,extensionId:null,isBuiltinExtension:!1});return this._cachedMergedKeybindings=null,l.toDisposable(()=>{a(),this._cachedMergedKeybindings=null})}getDefaultKeybindings(){return this._cachedMergedKeybindings||(this._cachedMergedKeybindings=Array.from(this._coreKeybindings).concat(this._extensionKeybindings),this._cachedMergedKeybindings.sort(oB)),this._cachedMergedKeybindings.slice(0)}}const Zn=new lg,sB={EditorModes:"platform.keybindingsRegistry"};St.add(sB.EditorModes,Zn);function oB(o,e){if(o.weight1!==e.weight1)return o.weight1-e.weight1;if(o.command&&e.command){if(o.command<e.command)return-1;if(o.command>e.command)return 1}return o.weight2-e.weight2}var rB=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},xx=function(o,e){return function(t,i){e(t,i,o)}},cg;function Zl(o){return o.command!==void 0}function aB(o){return o.submenu!==void 0}const y=class y{constructor(e){if(y._instances.has(e))throw new TypeError(`MenuId with identifier '${e}' already exists. Use MenuId.for(ident) or a unique identifier`);y._instances.set(e,this),this.id=e}};y._instances=new Map,y.CommandPalette=new y("CommandPalette"),y.DebugBreakpointsContext=new y("DebugBreakpointsContext"),y.DebugCallStackContext=new y("DebugCallStackContext"),y.DebugConsoleContext=new y("DebugConsoleContext"),y.DebugVariablesContext=new y("DebugVariablesContext"),y.NotebookVariablesContext=new y("NotebookVariablesContext"),y.DebugHoverContext=new y("DebugHoverContext"),y.DebugWatchContext=new y("DebugWatchContext"),y.DebugToolBar=new y("DebugToolBar"),y.DebugToolBarStop=new y("DebugToolBarStop"),y.DebugDisassemblyContext=new y("DebugDisassemblyContext"),y.DebugCallStackToolbar=new y("DebugCallStackToolbar"),y.DebugCreateConfiguration=new y("DebugCreateConfiguration"),y.DebugScopesContext=new y("DebugScopesContext"),y.EditorContext=new y("EditorContext"),y.SimpleEditorContext=new y("SimpleEditorContext"),y.EditorContent=new y("EditorContent"),y.EditorLineNumberContext=new y("EditorLineNumberContext"),y.EditorContextCopy=new y("EditorContextCopy"),y.EditorContextPeek=new y("EditorContextPeek"),y.EditorContextShare=new y("EditorContextShare"),y.EditorTitle=new y("EditorTitle"),y.EditorTitleLayout=new y("EditorTitleLayout"),y.ModalEditorTitle=new y("ModalEditorTitle"),y.ModalEditorTitleContext=new y("ModalEditorTitleContext"),y.ModalEditorEditorTitle=new y("ModalEditorEditorTitle"),y.CompactWindowEditorTitle=new y("CompactWindowEditorTitle"),y.EditorTitleRun=new y("EditorTitleRun"),y.EditorTitleContext=new y("EditorTitleContext"),y.EditorTitleContextShare=new y("EditorTitleContextShare"),y.EmptyEditorGroup=new y("EmptyEditorGroup"),y.EmptyEditorGroupContext=new y("EmptyEditorGroupContext"),y.EditorGroupWatermarkToolbar=new y("EditorGroupWatermarkToolbar"),y.EditorTabsBarContext=new y("EditorTabsBarContext"),y.EditorTabsBarShowTabsSubmenu=new y("EditorTabsBarShowTabsSubmenu"),y.EditorTabsBarShowTabsZenModeSubmenu=new y("EditorTabsBarShowTabsZenModeSubmenu"),y.EditorActionsPositionSubmenu=new y("EditorActionsPositionSubmenu"),y.EditorRenderWhitespaceSubmenu=new y("EditorRenderWhitespaceSubmenu"),y.EditorSplitMoveSubmenu=new y("EditorSplitMoveSubmenu"),y.ExplorerContext=new y("ExplorerContext"),y.ExplorerContextShare=new y("ExplorerContextShare"),y.ExtensionContext=new y("ExtensionContext"),y.ExtensionEditorContextMenu=new y("ExtensionEditorContextMenu"),y.GlobalActivity=new y("GlobalActivity"),y.CommandCenter=new y("CommandCenter"),y.CommandCenterCenter=new y("CommandCenterCenter"),y.LayoutControlMenuSubmenu=new y("LayoutControlMenuSubmenu"),y.LayoutControlMenu=new y("LayoutControlMenu"),y.MenubarMainMenu=new y("MenubarMainMenu"),y.MenubarAppearanceMenu=new y("MenubarAppearanceMenu"),y.MenubarDebugMenu=new y("MenubarDebugMenu"),y.MenubarEditMenu=new y("MenubarEditMenu"),y.MenubarCopy=new y("MenubarCopy"),y.MenubarFileMenu=new y("MenubarFileMenu"),y.MenubarGoMenu=new y("MenubarGoMenu"),y.MenubarHelpMenu=new y("MenubarHelpMenu"),y.MenubarLayoutMenu=new y("MenubarLayoutMenu"),y.MenubarNewBreakpointMenu=new y("MenubarNewBreakpointMenu"),y.PanelAlignmentMenu=new y("PanelAlignmentMenu"),y.PanelPositionMenu=new y("PanelPositionMenu"),y.ActivityBarPositionMenu=new y("ActivityBarPositionMenu"),y.NotificationsCenterPositionMenu=new y("NotificationsCenterPositionMenu"),y.MenubarPreferencesMenu=new y("MenubarPreferencesMenu"),y.MenubarRecentMenu=new y("MenubarRecentMenu"),y.MenubarSelectionMenu=new y("MenubarSelectionMenu"),y.MenubarShare=new y("MenubarShare"),y.MenubarSwitchEditorMenu=new y("MenubarSwitchEditorMenu"),y.MenubarSwitchGroupMenu=new y("MenubarSwitchGroupMenu"),y.MenubarTerminalMenu=new y("MenubarTerminalMenu"),y.MenubarTerminalSuggestStatusMenu=new y("MenubarTerminalSuggestStatusMenu"),y.MenubarViewMenu=new y("MenubarViewMenu"),y.MenubarHomeMenu=new y("MenubarHomeMenu"),y.OpenEditorsContext=new y("OpenEditorsContext"),y.OpenEditorsContextShare=new y("OpenEditorsContextShare"),y.ProblemsPanelContext=new y("ProblemsPanelContext"),y.SCMInputBox=new y("SCMInputBox"),y.SCMChangeContext=new y("SCMChangeContext"),y.SCMResourceContext=new y("SCMResourceContext"),y.SCMResourceContextShare=new y("SCMResourceContextShare"),y.SCMResourceFolderContext=new y("SCMResourceFolderContext"),y.SCMResourceGroupContext=new y("SCMResourceGroupContext"),y.SCMSourceControl=new y("SCMSourceControl"),y.SCMSourceControlInline=new y("SCMSourceControlInline"),y.SCMSourceControlTitle=new y("SCMSourceControlTitle"),y.SCMHistoryTitle=new y("SCMHistoryTitle"),y.SCMHistoryItemContext=new y("SCMHistoryItemContext"),y.SCMHistoryItemChangeContext=new y("SCMHistoryItemChangeContext"),y.SCMHistoryItemRefContext=new y("SCMHistoryItemRefContext"),y.SCMArtifactGroupContext=new y("SCMArtifactGroupContext"),y.SCMArtifactContext=new y("SCMArtifactContext"),y.SCMQuickDiffDecorations=new y("SCMQuickDiffDecorations"),y.SCMTitle=new y("SCMTitle"),y.SearchContext=new y("SearchContext"),y.SearchActionMenu=new y("SearchActionContext"),y.StatusBarWindowIndicatorMenu=new y("StatusBarWindowIndicatorMenu"),y.StatusBarRemoteIndicatorMenu=new y("StatusBarRemoteIndicatorMenu"),y.StickyScrollContext=new y("StickyScrollContext"),y.TestItem=new y("TestItem"),y.TestItemGutter=new y("TestItemGutter"),y.TestProfilesContext=new y("TestProfilesContext"),y.TestMessageContext=new y("TestMessageContext"),y.TestMessageContent=new y("TestMessageContent"),y.TestPeekElement=new y("TestPeekElement"),y.TestPeekTitle=new y("TestPeekTitle"),y.TestCallStack=new y("TestCallStack"),y.TestCoverageFilterItem=new y("TestCoverageFilterItem"),y.TouchBarContext=new y("TouchBarContext"),y.TitleBar=new y("TitleBar"),y.TitleBarAdjacentCenter=new y("TitleBarAdjacentCenter"),y.TitleBarContext=new y("TitleBarContext"),y.TitleBarTitleContext=new y("TitleBarTitleContext"),y.TunnelContext=new y("TunnelContext"),y.TunnelPrivacy=new y("TunnelPrivacy"),y.TunnelProtocol=new y("TunnelProtocol"),y.TunnelPortInline=new y("TunnelInline"),y.TunnelTitle=new y("TunnelTitle"),y.TunnelLocalAddressInline=new y("TunnelLocalAddressInline"),y.TunnelOriginInline=new y("TunnelOriginInline"),y.ViewItemContext=new y("ViewItemContext"),y.ViewContainerTitle=new y("ViewContainerTitle"),y.ViewContainerTitleContext=new y("ViewContainerTitleContext"),y.ViewTitle=new y("ViewTitle"),y.ViewTitleContext=new y("ViewTitleContext"),y.CommentEditorActions=new y("CommentEditorActions"),y.CommentThreadTitle=new y("CommentThreadTitle"),y.CommentThreadActions=new y("CommentThreadActions"),y.CommentThreadAdditionalActions=new y("CommentThreadAdditionalActions"),y.CommentThreadTitleContext=new y("CommentThreadTitleContext"),y.CommentThreadCommentContext=new y("CommentThreadCommentContext"),y.CommentTitle=new y("CommentTitle"),y.CommentActions=new y("CommentActions"),y.CommentsViewThreadActions=new y("CommentsViewThreadActions"),y.InteractiveToolbar=new y("InteractiveToolbar"),y.InteractiveCellTitle=new y("InteractiveCellTitle"),y.InteractiveCellDelete=new y("InteractiveCellDelete"),y.InteractiveCellExecute=new y("InteractiveCellExecute"),y.InteractiveInputExecute=new y("InteractiveInputExecute"),y.InteractiveInputConfig=new y("InteractiveInputConfig"),y.ReplInputExecute=new y("ReplInputExecute"),y.IssueReporter=new y("IssueReporter"),y.NotebookToolbar=new y("NotebookToolbar"),y.NotebookToolbarContext=new y("NotebookToolbarContext"),y.NotebookStickyScrollContext=new y("NotebookStickyScrollContext"),y.NotebookCellTitle=new y("NotebookCellTitle"),y.NotebookCellDelete=new y("NotebookCellDelete"),y.NotebookCellInsert=new y("NotebookCellInsert"),y.NotebookCellBetween=new y("NotebookCellBetween"),y.NotebookCellListTop=new y("NotebookCellTop"),y.NotebookCellExecute=new y("NotebookCellExecute"),y.NotebookCellExecuteGoTo=new y("NotebookCellExecuteGoTo"),y.NotebookCellExecutePrimary=new y("NotebookCellExecutePrimary"),y.NotebookDiffCellInputTitle=new y("NotebookDiffCellInputTitle"),y.NotebookDiffDocumentMetadata=new y("NotebookDiffDocumentMetadata"),y.NotebookDiffCellMetadataTitle=new y("NotebookDiffCellMetadataTitle"),y.NotebookDiffCellOutputsTitle=new y("NotebookDiffCellOutputsTitle"),y.NotebookOutputToolbar=new y("NotebookOutputToolbar"),y.NotebookOutlineFilter=new y("NotebookOutlineFilter"),y.NotebookOutlineActionMenu=new y("NotebookOutlineActionMenu"),y.NotebookEditorLayoutConfigure=new y("NotebookEditorLayoutConfigure"),y.NotebookKernelSource=new y("NotebookKernelSource"),y.BulkEditTitle=new y("BulkEditTitle"),y.BulkEditContext=new y("BulkEditContext"),y.TimelineItemContext=new y("TimelineItemContext"),y.TimelineTitle=new y("TimelineTitle"),y.TimelineTitleContext=new y("TimelineTitleContext"),y.TimelineFilterSubMenu=new y("TimelineFilterSubMenu"),y.AccountsContext=new y("AccountsContext"),y.SidebarTitle=new y("SidebarTitle"),y.PanelTitle=new y("PanelTitle"),y.AuxiliaryBarTitle=new y("AuxiliaryBarTitle"),y.TerminalInstanceContext=new y("TerminalInstanceContext"),y.TerminalEditorInstanceContext=new y("TerminalEditorInstanceContext"),y.TerminalNewDropdownContext=new y("TerminalNewDropdownContext"),y.TerminalTabContext=new y("TerminalTabContext"),y.TerminalTabEmptyAreaContext=new y("TerminalTabEmptyAreaContext"),y.TerminalStickyScrollContext=new y("TerminalStickyScrollContext"),y.WebviewContext=new y("WebviewContext"),y.InlineCompletionsActions=new y("InlineCompletionsActions"),y.InlineEditsActions=new y("InlineEditsActions"),y.NewFile=new y("NewFile"),y.MergeInput1Toolbar=new y("MergeToolbar1Toolbar"),y.MergeInput2Toolbar=new y("MergeToolbar2Toolbar"),y.MergeBaseToolbar=new y("MergeBaseToolbar"),y.MergeInputResultToolbar=new y("MergeToolbarResultToolbar"),y.InlineSuggestionToolbar=new y("InlineSuggestionToolbar"),y.InlineEditToolbar=new y("InlineEditToolbar"),y.ChatContext=new y("ChatContext"),y.ChatCodeBlock=new y("ChatCodeblock"),y.ChatCompareBlock=new y("ChatCompareBlock"),y.ChatMessageTitle=new y("ChatMessageTitle"),y.ChatWelcomeContext=new y("ChatWelcomeContext"),y.ChatMessageFooter=new y("ChatMessageFooter"),y.ChatExecute=new y("ChatExecute"),y.ChatExecuteQueue=new y("ChatExecuteQueue"),y.ChatInput=new y("ChatInput"),y.ChatInputSecondary=new y("ChatInputSecondary"),y.ChatInputStatus=new y("ChatInputStatus"),y.ChatInputSide=new y("ChatInputSide"),y.ChatModePicker=new y("ChatModePicker"),y.ChatEditingWidgetToolbar=new y("ChatEditingWidgetToolbar"),y.ChatEditingSessionChangesToolbar=new y("ChatEditingSessionChangesToolbar"),y.ChatEditingSessionTitleToolbar=new y("ChatEditingSessionTitleToolbar"),y.ChatEditingSessionChangesVersionsSubmenu=new y("ChatEditingSessionChangesVersionsSubmenu"),y.ChatEditingSessionChangesFileHeaderToolbar=new y("ChatEditingSessionChangesFileHeaderToolbar"),y.ChatEditingSessionChangesFileHeaderRightToolbar=new y("ChatEditingSessionChangesFileHeaderRightToolbar"),y.ChatEditingEditorContent=new y("ChatEditingEditorContent"),y.ChatEditingEditorHunk=new y("ChatEditingEditorHunk"),y.ChatEditingDeletedNotebookCell=new y("ChatEditingDeletedNotebookCell"),y.ChatInputAttachmentToolbar=new y("ChatInputAttachmentToolbar"),y.ChatEditingWidgetModifiedFilesToolbar=new y("ChatEditingWidgetModifiedFilesToolbar"),y.ChatInputResourceAttachmentContext=new y("ChatInputResourceAttachmentContext"),y.ChatInputSymbolAttachmentContext=new y("ChatInputSymbolAttachmentContext"),y.ChatInlineResourceAnchorContext=new y("ChatInlineResourceAnchorContext"),y.ChatInlineSymbolAnchorContext=new y("ChatInlineSymbolAnchorContext"),y.ChatMessageCheckpoint=new y("ChatMessageCheckpoint"),y.ChatMessageRestoreCheckpoint=new y("ChatMessageRestoreCheckpoint"),y.ChatNewMenu=new y("ChatNewMenu"),y.ChatEditingCodeBlockContext=new y("ChatEditingCodeBlockContext"),y.ChatTitleBarMenu=new y("ChatTitleBarMenu"),y.ChatAttachmentsContext=new y("ChatAttachmentsContext"),y.ChatTipContext=new y("ChatTipContext"),y.ChatTipToolbar=new y("ChatTipToolbar"),y.ChatToolOutputResourceToolbar=new y("ChatToolOutputResourceToolbar"),y.ChatTextEditorMenu=new y("ChatTextEditorMenu"),y.ChatToolOutputResourceContext=new y("ChatToolOutputResourceContext"),y.ChatMultiDiffContext=new y("ChatMultiDiffContext"),y.ChatConfirmationMenu=new y("ChatConfirmationMenu"),y.ChatEditorInlineMenu=new y("ChatEditorInlineGutter"),y.ChatEditorInlineExecute=new y("ChatEditorInputExecute"),y.ChatEditorInlineInputSide=new y("ChatEditorInputSide"),y.InlineChatEditorAffordance=new y("InlineChatEditorAffordance"),y.AccessibleView=new y("AccessibleView"),y.MultiDiffEditorContent=new y("MultiDiffEditorContent"),y.MultiDiffEditorFileToolbar=new y("MultiDiffEditorFileToolbar"),y.DiffEditorHunkToolbar=new y("DiffEditorHunkToolbar"),y.DiffEditorSelectionToolbar=new y("DiffEditorSelectionToolbar"),y.BrowserNavigationToolbar=new y("BrowserNavigationToolbar"),y.BrowserActionsToolbar=new y("BrowserActionsToolbar"),y.BrowserChatActionsMenu=new y("BrowserChatActionsMenu"),y.BrowserEmulationToolbar=new y("BrowserEmulationToolbar"),y.AgentSessionsViewerFilterSubMenu=new y("AgentSessionsViewerFilterSubMenu"),y.AgentSessionsContext=new y("AgentSessionsContext"),y.AgentSessionSectionContext=new y("AgentSessionSectionContext"),y.AgentSessionsCreateSubMenu=new y("AgentSessionsCreateSubMenu"),y.AgentSessionsToolbar=new y("AgentSessionsToolbar"),y.AgentSessionItemToolbar=new y("AgentSessionItemToolbar"),y.AgentSessionSectionToolbar=new y("AgentSessionSectionToolbar"),y.SessionItemContextMenu=new y("SessionItemContextMenu"),y.SessionHeaderContext=new y("SessionsSessionHeaderContext"),y.AgentsTitleBarControlMenu=new y("AgentsTitleBarControlMenu"),y.AgentsChangesToolbar=new y("AgentsChangesToolbar"),y.AgentsChangesPrimaryActionSubMenu=new y("AgentsChangesPrimaryActionSubMenu"),y.AgentsChangeInlineToolbar=new y("AgentsChangeInlineToolbar"),y.ChatViewSessionTitleNavigationToolbar=new y("ChatViewSessionTitleNavigationToolbar"),y.ChatViewSessionTitleToolbar=new y("ChatViewSessionTitleToolbar"),y.ChatContextUsageActions=new y("ChatContextUsageActions"),y.MarkerHoverStatusBar=new y("MarkerHoverParticipant.StatusBar");let ct=y;const Zo=le("menuService"),mf=class mf{static for(e){let t=this._all.get(e);return t||(t=new mf(e),this._all.set(e,t)),t}static merge(e){const t=new Set;for(const i of e)i instanceof mf&&t.add(i.id);return t}constructor(e){this.id=e,this.has=t=>t===e}};mf._all=new Map;let na=mf;const Qn=new class{constructor(){this._commands=new Map,this._menuItems=new Map,this._onDidChangeMenu=new l.MicrotaskEmitter({merge:na.merge}),this.onDidChangeMenu=this._onDidChangeMenu.event}addCommand(o){return this._commands.set(o.id,o),this._onDidChangeMenu.fire(na.for(ct.CommandPalette)),l.markAsSingleton(l.toDisposable(()=>{this._commands.delete(o.id)&&this._onDidChangeMenu.fire(na.for(ct.CommandPalette))}))}getCommand(o){return this._commands.get(o)}getCommands(){const o=new Map;return this._commands.forEach((e,t)=>o.set(t,e)),o}appendMenuItem(o,e){let t=this._menuItems.get(o);t||(t=new l.LinkedList,this._menuItems.set(o,t));const i=t.push(e);return this._onDidChangeMenu.fire(na.for(o)),l.markAsSingleton(l.toDisposable(()=>{i(),this._onDidChangeMenu.fire(na.for(o))}))}appendMenuItems(o){const e=new l.DisposableStore;for(const{id:t,item:i}of o)e.add(this.appendMenuItem(t,i));return e}getMenuItems(o){let e;return this._menuItems.has(o)?e=[...this._menuItems.get(o)]:e=[],o===ct.CommandPalette&&this._appendImplicitItems(e),e}_appendImplicitItems(o){const e=new Set;for(const t of o)Zl(t)&&(e.add(t.command.id),t.alt&&e.add(t.alt.id));this._commands.forEach((t,i)=>{e.has(i)||o.push({command:t})})}};class sa extends cd{constructor(e,t,i){super(`submenuitem.${e.submenu.id}`,typeof e.title=="string"?e.title:e.title.value,i,"submenu"),this.item=e,this.hideActions=t}}_.MenuItemAction=cg=class{static label(e,t){return t?.renderShortTitle&&e.shortTitle?typeof e.shortTitle=="string"?e.shortTitle:e.shortTitle.value:typeof e.title=="string"?e.title:e.title.value}constructor(e,t,i,n,s,r,a){this.hideActions=n,this.menuKeybinding=s,this._commandService=a,this.id=e.id,this.label=cg.label(e,i),this.tooltip=(typeof e.tooltip=="string"?e.tooltip:e.tooltip?.value)??"",this.enabled=!e.precondition||r.contextMatchesRules(e.precondition),this.checked=void 0;let c;if(e.toggled){const h=e.toggled.condition?e.toggled:{condition:e.toggled};this.checked=r.contextMatchesRules(h.condition),this.checked&&h.tooltip&&(this.tooltip=typeof h.tooltip=="string"?h.tooltip:h.tooltip.value),this.checked&&_.ThemeIcon.isThemeIcon(h.icon)&&(c=h.icon),this.checked&&h.title&&(this.label=typeof h.title=="string"?h.title:h.title.value)}c||(c=_.ThemeIcon.isThemeIcon(e.icon)?e.icon:void 0),this.item=e,this.alt=t?new cg(t,void 0,i,n,void 0,r,a):void 0,this._options=i,this.class=c&&_.ThemeIcon.asClassName(c)}run(...e){let t=[];return this._options?.args?t=[...t,...this._options.args]:this._options?.arg&&(t=[...t,this._options.arg]),this._options?.shouldForwardArgs&&(t=[...t,...e]),this._commandService.executeCommand(this.id,...t)}},_.MenuItemAction=cg=rB([xx(5,be),xx(6,zi)],_.MenuItemAction);class hg{constructor(e){this.desc=e}}function lB(o){const e=[],t=new o,{f1:i,menu:n,keybinding:s,...r}=t.desc;if(Ut.getCommand(r.id))throw new Error(`Cannot register two commands with the same id: ${r.id}`);if(e.push(Ut.registerCommand({id:r.id,handler:(a,...c)=>t.run(a,...c),metadata:r.metadata??{description:t.desc.title}})),Array.isArray(n))for(const a of n)e.push(Qn.appendMenuItem(a.id,{command:{...r,precondition:a.precondition===null?void 0:r.precondition},...a}));else n&&e.push(Qn.appendMenuItem(n.id,{command:{...r,precondition:n.precondition===null?void 0:r.precondition},...n}));if(i&&(e.push(Qn.appendMenuItem(ct.CommandPalette,{command:r,when:r.precondition})),e.push(Qn.addCommand(r))),Array.isArray(s))for(const a of s)e.push(Zn.registerKeybindingRule({...a,id:r.id,when:r.precondition?de.and(r.precondition,a.when):a.when}));else s&&e.push(Zn.registerKeybindingRule({...s,id:r.id,when:r.precondition?de.and(r.precondition,s.when):s.when}));return{dispose(){l.dispose(e)}}}const Xn=le("telemetryService");function Qo(o){return o===47||o===92}function Ex(o){return o.replace(/[\\/]/g,l.posix.sep)}function cB(o){return o.indexOf("/")===-1&&(o=Ex(o)),/^[a-zA-Z]:(\/|$)/.test(o)&&(o="/"+o),o}function Ix(o,e=l.posix.sep){if(!o)return"";const t=o.length,i=o.charCodeAt(0);if(Qo(i)){if(Qo(o.charCodeAt(1))&&!Qo(o.charCodeAt(2))){let s=3;const r=s;for(;s<t&&!Qo(o.charCodeAt(s));s++);if(r!==s&&!Qo(o.charCodeAt(s+1))){for(s+=1;s<t;s++)if(Qo(o.charCodeAt(s)))return o.slice(0,s+1).replace(/[\\/]/g,e)}}return e}else if(Tx(i)&&o.charCodeAt(1)===58)return Qo(o.charCodeAt(2))?o.slice(0,2)+e:o.slice(0,2);let n=o.indexOf("://");if(n!==-1){for(n+=3;n<t;n++)if(Qo(o.charCodeAt(n)))return o.slice(0,n+1)}return""}function pC(o,e,t,i=!1){const n=i?l.posix.sep:l.sep;if(o===e)return!0;if(!o||!e||((o.indexOf("..")>=0||e.indexOf("..")>=0)&&(o=i?l.posix.normalize(o):l.normalize(o),e=i?l.posix.normalize(e):l.normalize(e)),e.length>o.length))return!1;if(t){if(!l.startsWithIgnoreCase(o,e))return!1;if(e.length===o.length)return!0;let r=e.length;return e.charAt(e.length-1)===n&&r--,o.charAt(r)===n}return e.charAt(e.length-1)!==n&&(e+=n),o.indexOf(e)===0}function Tx(o){return o>=65&&o<=90||o>=97&&o<=122}function hB(o,e=l.isWindows){return e?Tx(o.charCodeAt(0))&&o.charCodeAt(1)===58:!1}function ds(o){return l.uriToFsPath(o,!0)}class dB{constructor(e){this._ignorePathCasing=e}compare(e,t,i=!1){return e===t?0:l.compare(this.getComparisonKey(e,i),this.getComparisonKey(t,i))}isEqual(e,t,i=!1){return e===t?!0:!e||!t?!1:this.getComparisonKey(e,i)===this.getComparisonKey(t,i)}getComparisonKey(e,t=!1){return e.with({path:this._ignorePathCasing(e)?e.path.toLowerCase():void 0,fragment:t?null:void 0}).toString()}isEqualOrParent(e,t,i=!1){if(e.scheme===t.scheme){if(e.scheme===l.Schemas.file)return pC(ds(e),ds(t),this._ignorePathCasing(e))&&e.query===t.query&&(i||e.fragment===t.fragment);if(Ox(e.authority,t.authority))return pC(e.path,t.path,this._ignorePathCasing(e),!0)&&e.query===t.query&&(i||e.fragment===t.fragment)}return!1}joinPath(e,...t){return l.URI.joinPath(e,...t)}basenameOrAuthority(e){return dg(e)||e.authority}basename(e,t){return l.posix.basename(e.path,t)}extname(e){return l.posix.extname(e.path)}dirname(e){if(e.path.length===0)return e;let t;return e.scheme===l.Schemas.file?t=l.URI.file(l.dirname(ds(e))).path:(t=l.posix.dirname(e.path),e.authority&&t.length&&t.charCodeAt(0)!==47&&(console.error(`dirname("${e.toString})) resulted in a relative path`),t="/")),e.with({path:t})}normalizePath(e){if(!e.path.length)return e;let t;return e.scheme===l.Schemas.file?t=l.URI.file(l.normalize(ds(e))).path:t=l.posix.normalize(e.path),e.with({path:t})}relativePath(e,t){if(e.scheme!==t.scheme||!Ox(e.authority,t.authority))return;if(e.scheme===l.Schemas.file){const s=l.relative(ds(e),ds(t));return l.isWindows?Ex(s):s}let i=e.path||"/";const n=t.path||"/";if(this._ignorePathCasing(e)){let s=0;for(const r=Math.min(i.length,n.length);s<r&&!(i.charCodeAt(s)!==n.charCodeAt(s)&&i.charAt(s).toLowerCase()!==n.charAt(s).toLowerCase());s++);i=n.substr(0,s)+i.substr(s)}return l.posix.relative(i,n)}resolvePath(e,t){if(e.scheme===l.Schemas.file){const i=l.URI.file(l.resolve(ds(e),t));return e.with({authority:i.authority,path:i.path})}return t=cB(t),e.with({path:l.posix.resolve(e.path,t)})}isAbsolutePath(e){return!!e.path&&e.path[0]==="/"}isEqualAuthority(e,t){return e===t||e!==void 0&&t!==void 0&&l.equalsIgnoreCase(e,t)}hasTrailingPathSeparator(e,t=l.sep){if(e.scheme===l.Schemas.file){const i=ds(e);return i.length>Ix(i).length&&i[i.length-1]===t}else{const i=e.path;return i.length>1&&i.charCodeAt(i.length-1)===47&&!/^[a-zA-Z]:(\/$|\\$)/.test(e.fsPath)}}removeTrailingPathSeparator(e,t=l.sep){return Px(e,t)?e.with({path:e.path.substr(0,e.path.length-1)}):e}addTrailingPathSeparator(e,t=l.sep){let i=!1;if(e.scheme===l.Schemas.file){const n=ds(e);i=n!==void 0&&n.length===Ix(n).length&&n[n.length-1]===t}else{t="/";const n=e.path;i=n.length===1&&n.charCodeAt(n.length-1)===47}return!i&&!Px(e,t)?e.with({path:e.path+"/"}):e}}const Qe=new dB(()=>!1),Nx=Qe.isEqual.bind(Qe);Qe.isEqualOrParent.bind(Qe),Qe.getComparisonKey.bind(Qe);const uB=Qe.basenameOrAuthority.bind(Qe),dg=Qe.basename.bind(Qe),fB=Qe.extname.bind(Qe),Rx=Qe.dirname.bind(Qe),Mx=Qe.joinPath.bind(Qe),gB=Qe.normalizePath.bind(Qe),mB=Qe.relativePath.bind(Qe),Ax=Qe.resolvePath.bind(Qe);Qe.isAbsolutePath.bind(Qe);const Ox=Qe.isEqualAuthority.bind(Qe),Px=Qe.hasTrailingPathSeparator.bind(Qe);Qe.removeTrailingPathSeparator.bind(Qe),Qe.addTrailingPathSeparator.bind(Qe),_.DataUri=void 0,(function(o){o.META_DATA_LABEL="label",o.META_DATA_DESCRIPTION="description",o.META_DATA_SIZE="size",o.META_DATA_MIME="mime";function e(t){const i=new Map;t.path.substring(t.path.indexOf(";")+1,t.path.lastIndexOf(";")).split(";").forEach(r=>{const[a,c]=r.split(":");a&&c&&i.set(a,c)});const s=t.path.substring(0,t.path.indexOf(";"));return s&&i.set(o.META_DATA_MIME,s),i}o.parseMetaData=e})(_.DataUri||(_.DataUri={}));const ei=le("logService"),kx=le("loggerService");_.LogLevel=void 0,(function(o){o[o.Off=0]="Off",o[o.Trace=1]="Trace",o[o.Debug=2]="Debug",o[o.Info=3]="Info",o[o.Warning=4]="Warning",o[o.Error=5]="Error"})(_.LogLevel||(_.LogLevel={}));const Fx=_.LogLevel.Info;function Bx(o,e){return o!==_.LogLevel.Off&&o<=e}function pB(o){switch(o){case"debug":return console.debug;case"error":return console.error;case"info":return console.info;case"log":return console.log;case"warn":return console.warn}}function us(o,...e){pB(o).apply(console,e)}class zx extends l.Disposable{constructor(){super(...arguments),this.level=Fx,this._onDidChangeLogLevel=this._register(new l.Emitter)}get onDidChangeLogLevel(){return this._onDidChangeLogLevel.event}setLevel(e){this.level!==e&&(this.level=e,this._onDidChangeLogLevel.fire(this.level))}getLevel(){return this.level}checkLogLevel(e){return Bx(this.level,e)}canLog(e){return this._store.isDisposed?!1:this.checkLogLevel(e)}}class _B extends zx{constructor(e=Fx,t=!0){super(),this.useColors=t,this.setLevel(e)}trace(e,...t){this.canLog(_.LogLevel.Trace)&&(this.useColors?us("log","%cTRACE","color: #888",e,...t):us("log",e,...t))}debug(e,...t){this.canLog(_.LogLevel.Debug)&&(this.useColors?us("log","%cDEBUG","background: #eee; color: #888",e,...t):us("log",e,...t))}info(e,...t){this.canLog(_.LogLevel.Info)&&(this.useColors?us("log","%c INFO","color: #33f",e,...t):us("log",e,...t))}warn(e,...t){this.canLog(_.LogLevel.Warning)&&(this.useColors?us("warn","%c WARN","color: #993",e,...t):us("log",e,...t))}error(e,...t){this.canLog(_.LogLevel.Error)&&(this.useColors?us("error","%c ERR","color: #f33",e,...t):us("error",e,...t))}}class bB extends zx{constructor(e){super(),this.loggers=e,e.length&&this.setLevel(e[0].getLevel())}setLevel(e){for(const t of this.loggers)t.setLevel(e);super.setLevel(e)}trace(e,...t){for(const i of this.loggers)i.trace(e,...t)}debug(e,...t){for(const i of this.loggers)i.debug(e,...t)}info(e,...t){for(const i of this.loggers)i.info(e,...t)}warn(e,...t){for(const i of this.loggers)i.warn(e,...t)}error(e,...t){for(const i of this.loggers)i.error(e,...t)}dispose(){for(const e of this.loggers)e.dispose();super.dispose()}}class CB extends l.Disposable{constructor(e,t,i){if(super(),this.logLevel=e,this.logsHome=t,this._loggers=new l.ResourceMap,this._onDidChangeLoggers=this._register(new l.Emitter),this._onDidChangeVisibility=this._register(new l.Emitter),i)for(const n of i)this._loggers.set(n.resource,{logger:void 0,info:n})}getLoggerEntry(e){return l.isString(e)?[...this._loggers.values()].find(t=>t.info.id===e):this._loggers.get(e)}createLogger(e,t){const i=this.toResource(e),n=l.isString(e)?e:t?.id??l.hash(i.toString()).toString(16);let s=this._loggers.get(i)?.logger;const r=t?.logLevel==="always"?_.LogLevel.Trace:t?.logLevel;s||(s=this.doCreateLogger(i,r??this.getLogLevel(i)??this.logLevel,{...t,id:n}));const a={logger:s,info:{resource:i,id:n,logLevel:r,name:t?.name,hidden:t?.hidden,group:t?.group,extensionId:t?.extensionId,when:t?.when}};return this.registerLogger(a.info),this._loggers.set(i,a),s}toResource(e){return l.isString(e)?Mx(this.logsHome,`${e.replace(/[\\/:\*\?"<>\|]/g,"")}.log`):e}setVisibility(e,t){const i=this.getLoggerEntry(e);i&&t!==!i.info.hidden&&(i.info.hidden=!t,this._loggers.set(i.info.resource,i),this._onDidChangeVisibility.fire([i.info.resource,t]))}getLogLevel(e){let t;return e&&(t=this._loggers.get(e)?.info.logLevel),t??this.logLevel}registerLogger(e){const t=this._loggers.get(e.resource);t?t.info.hidden!==e.hidden&&this.setVisibility(e.resource,!e.hidden):(this._loggers.set(e.resource,{info:e,logger:void 0}),this._onDidChangeLoggers.fire({added:[e],removed:[]}))}dispose(){this._loggers.forEach(e=>e.logger?.dispose()),this._loggers.clear(),super.dispose()}}class vB{constructor(){this.onDidChangeLogLevel=new l.Emitter().event}setLevel(e){}getLevel(){return _.LogLevel.Info}trace(e,...t){}debug(e,...t){}info(e,...t){}warn(e,...t){}error(e,...t){}dispose(){}}class wB extends CB{constructor(){super(_.LogLevel.Off,l.URI.parse("log:///log"))}doCreateLogger(e,t,i){return new vB}}function SB(o){switch(o){case _.LogLevel.Trace:return"trace";case _.LogLevel.Debug:return"debug";case _.LogLevel.Info:return"info";case _.LogLevel.Warning:return"warn";case _.LogLevel.Error:return"error";case _.LogLevel.Off:return"off"}}new q("logLevel",SB(_.LogLevel.Info));const pf=class pf{static getRegisteredCommands(){return[...pf.REGISTERED_COMMANDS]}static registerCommand(e){pf.REGISTERED_COMMANDS.add(e)}};pf.REGISTERED_COMMANDS=new Set;let ug=pf;class fg{constructor(e){this.id=e.id,this.precondition=e.precondition,this._kbOpts=e.kbOpts,this._menuOpts=e.menuOpts,this.metadata=e.metadata,this.canTriggerInlineEdits=e.canTriggerInlineEdits}register(){if(Array.isArray(this._menuOpts)?this._menuOpts.forEach(this._registerMenuItem,this):this._menuOpts&&this._registerMenuItem(this._menuOpts),this._kbOpts){const e=Array.isArray(this._kbOpts)?this._kbOpts:[this._kbOpts];for(const t of e){let i=t.kbExpr;this.precondition&&(i?i=de.and(i,this.precondition):i=this.precondition);const n={id:this.id,weight:t.weight,args:t.args,when:i,primary:t.primary,secondary:t.secondary,win:t.win,linux:t.linux,mac:t.mac};Zn.registerKeybindingRule(n)}}Ut.registerCommand({id:this.id,handler:(e,t)=>this.runCommand(e,t),metadata:this.metadata}),this.canTriggerInlineEdits&&ug.registerCommand(this.id)}_registerMenuItem(e){Qn.appendMenuItem(e.menuId,{group:e.group,command:{id:this.id,title:e.title,icon:e.icon,precondition:this.precondition},when:e.when,order:e.order})}}class gg extends fg{constructor(){super(...arguments),this._implementations=[]}addImplementation(e,t,i,n){return this._implementations.push({priority:e,name:t,implementation:i,when:n}),this._implementations.sort((s,r)=>r.priority-s.priority),{dispose:()=>{for(let s=0;s<this._implementations.length;s++)if(this._implementations[s].implementation===i){this._implementations.splice(s,1);return}}}}runCommand(e,t){const i=e.get(ei),n=e.get(be);i.trace(`Executing Command '${this.id}' which has ${this._implementations.length} bound.`);for(const s of this._implementations){if(s.when){const a=n.getContext(wt());if(!s.when.evaluate(a))continue}const r=s.implementation(e,t);if(r)return i.trace(`Command '${this.id}' was handled by '${s.name}'.`),typeof r=="boolean"?void 0:r}i.trace(`The Command '${this.id}' was not handled by any implementation.`)}}class Vx extends fg{constructor(e,t){super(t),this.command=e}runCommand(e,t){return this.command.runCommand(e,t)}}class ao extends fg{static bindToContribution(e){return class extends ao{constructor(i){super(i),this._callback=i.handler}runEditorCommand(i,n,s){const r=e(n);r&&this._callback(r,s)}}}static runEditorCommand(e,t,i,n){const s=e.get(pt),r=s.getFocusedCodeEditor()||s.getActiveCodeEditor();if(r)return r.invokeWithinContext(a=>{if(a.get(be).contextMatchesRules(i??void 0))return n(a,r,t)})}runCommand(e,t){return ao.runEditorCommand(e,t,this.precondition,(i,n,s)=>this.runEditorCommand(i,n,s))}}class mg extends ao{static convertOptions(e){let t;Array.isArray(e.menuOpts)?t=e.menuOpts:e.menuOpts?t=[e.menuOpts]:t=[];function i(n){return n.menuId||(n.menuId=ct.EditorContext),n.title||(n.title=typeof e.label=="string"?e.label:e.label.value),n.when=de.and(e.precondition,n.when),n}return Array.isArray(e.contextMenuOpts)?t.push(...e.contextMenuOpts.map(i)):e.contextMenuOpts&&t.push(i(e.contextMenuOpts)),e.menuOpts=t,e}constructor(e){super(mg.convertOptions(e)),typeof e.label=="string"?(this.label=e.label,this.alias=e.alias??e.label):(this.label=e.label.value,this.alias=e.alias??e.label.original)}runEditorCommand(e,t,i){return this.reportTelemetry(e,t),this.run(e,t,i||{})}reportTelemetry(e,t){e.get(Xn).publicLog2("editorActionInvoked",{name:this.label,id:this.id})}}class yB extends mg{constructor(){super(...arguments),this._implementations=[]}addImplementation(e,t){return this._implementations.push([e,t]),this._implementations.sort((i,n)=>n[0]-i[0]),{dispose:()=>{for(let i=0;i<this._implementations.length;i++)if(this._implementations[i][1]===t){this._implementations.splice(i,1);return}}}}run(e,t,i){for(const n of this._implementations){const s=n[1](e,t,i);if(s)return typeof s=="boolean"?void 0:s}}}class LB extends hg{run(e,...t){const i=e.get(pt),n=i.getFocusedCodeEditor()||i.getActiveCodeEditor();if(n)return n.invokeWithinContext(s=>{const r=s.get(be),a=s.get(ei);if(!r.contextMatchesRules(this.desc.precondition??void 0)){a.debug("[EditorAction2] NOT running command because its precondition is FALSE",this.desc.id,this.desc.precondition?.serialize());return}return this.runEditorCommand(s,n,...t)})}}function DB(o,e){Ut.registerCommand(o,function(t,...i){const n=t.get(me),[s,r]=i;l.assertType(l.URI.isUri(s)),l.assertType(l.Position.isIPosition(r));const a=t.get(ri).getModel(s);if(a){const c=l.Position.lift(r);return n.invokeFunction(e,a,c,...i.slice(2))}return t.get(ql).createModelReference(s).then(c=>new Promise((h,d)=>{try{const u=n.invokeFunction(e,c.object.textEditorModel,l.Position.lift(r),i.slice(2));h(u)}catch(u){d(u)}}).finally(()=>{c.dispose()}))})}function oe(o){return gn.INSTANCE.registerEditorCommand(o),o}function xB(o){const e=new o;return gn.INSTANCE.registerEditorAction(e),e}function EB(o){return gn.INSTANCE.registerEditorAction(o),o}function IB(o){gn.INSTANCE.registerEditorAction(o)}function _C(o,e,t){gn.INSTANCE.registerEditorContribution(o,e,t)}var Ql;(function(o){function e(r){return gn.INSTANCE.getEditorCommand(r)}o.getEditorCommand=e;function t(){return gn.INSTANCE.getEditorActions()}o.getEditorActions=t;function i(){return gn.INSTANCE.getEditorContributions()}o.getEditorContributions=i;function n(r){return gn.INSTANCE.getEditorContributions().filter(a=>r.indexOf(a.id)>=0)}o.getSomeEditorContributions=n;function s(){return gn.INSTANCE.getDiffEditorContributions()}o.getDiffEditorContributions=s})(Ql||(Ql={}));const TB={EditorCommonContributions:"editor.contributions"},q_=class q_{constructor(){this.editorContributions=[],this.diffEditorContributions=[],this.editorActions=[],this.editorCommands=Object.create(null)}registerEditorContribution(e,t,i){this.editorContributions.push({id:e,ctor:t,instantiation:i})}getEditorContributions(){return this.editorContributions.slice(0)}getDiffEditorContributions(){return this.diffEditorContributions.slice(0)}registerEditorAction(e){e.register(),this.editorActions.push(e)}getEditorActions(){return this.editorActions}registerEditorCommand(e){e.register(),this.editorCommands[e.id]=e}getEditorCommand(e){return this.editorCommands[e]||null}};q_.INSTANCE=new q_;let gn=q_;St.add(TB.EditorCommonContributions,gn.INSTANCE);function ud(o){return o.register(),o}const Ux=ud(new gg({id:"undo",precondition:void 0,kbOpts:{weight:0,primary:2104},menuOpts:[{menuId:ct.MenubarEditMenu,group:"1_do",title:l.localize(73,"&&Undo"),order:1},{menuId:ct.CommandPalette,group:"",title:l.localize(74,"Undo"),order:1},{menuId:ct.SimpleEditorContext,group:"1_do",title:l.localize(75,"Undo"),order:1}]}));ud(new Vx(Ux,{id:"default:undo",precondition:void 0}));const $x=ud(new gg({id:"redo",precondition:void 0,kbOpts:{weight:0,primary:2103,secondary:[3128],mac:{primary:3128}},menuOpts:[{menuId:ct.MenubarEditMenu,group:"1_do",title:l.localize(76,"&&Redo"),order:2},{menuId:ct.CommandPalette,group:"",title:l.localize(77,"Redo"),order:1},{menuId:ct.SimpleEditorContext,group:"1_do",title:l.localize(78,"Redo"),order:2}]}));ud(new Vx($x,{id:"default:redo",precondition:void 0}));const NB=ud(new gg({id:"editor.action.selectAll",precondition:void 0,kbOpts:{weight:0,kbExpr:null,primary:2079},menuOpts:[{menuId:ct.MenubarSelectionMenu,group:"1_basic",title:l.localize(79,"&&Select All"),order:1},{menuId:ct.CommandPalette,group:"",title:l.localize(80,"Select All"),order:1},{menuId:ct.SimpleEditorContext,group:"9_select",title:l.localize(81,"Select All"),order:1}]})),RB=""+new URL(require.toUrl("./assets/editorWebWorkerMain-CA_vMoUU.js"),document.baseURI).href;class MB{constructor(e){this.esmModuleLocation=e.esmModuleLocation,this.esmModuleLocationBundler=e.esmModuleLocationBundler,this.label=e.label}}const fd=le("IWebWorkerService");_.IndentAction=void 0,(function(o){o[o.None=0]="None",o[o.Indent=1]="Indent",o[o.IndentOutdent=2]="IndentOutdent",o[o.Outdent=3]="Outdent"})(_.IndentAction||(_.IndentAction={}));class bC{constructor(e){if(this._neutralCharacter=null,this._neutralCharacterSearched=!1,this.open=e.open,this.close=e.close,this._inString=!0,this._inComment=!0,this._inRegEx=!0,Array.isArray(e.notIn))for(let t=0,i=e.notIn.length;t<i;t++)switch(e.notIn[t]){case"string":this._inString=!1;break;case"comment":this._inComment=!1;break;case"regex":this._inRegEx=!1;break}}isOK(e){switch(e){case 0:return!0;case 1:return this._inComment;case 2:return this._inString;case 3:return this._inRegEx}}shouldAutoClose(e,t){if(e.getTokenCount()===0)return!0;const i=e.findTokenIndexAtOffset(t-2),n=e.getStandardTokenType(i);return this.isOK(n)}_findNeutralCharacterInRange(e,t){for(let i=e;i<=t;i++){const n=String.fromCharCode(i);if(!this.open.includes(n)&&!this.close.includes(n))return n}return null}findNeutralCharacter(){return this._neutralCharacterSearched||(this._neutralCharacterSearched=!0,this._neutralCharacter||(this._neutralCharacter=this._findNeutralCharacterInRange(48,57)),this._neutralCharacter||(this._neutralCharacter=this._findNeutralCharacterInRange(97,122)),this._neutralCharacter||(this._neutralCharacter=this._findNeutralCharacterInRange(65,90))),this._neutralCharacter}}class AB{constructor(e){this.autoClosingPairsOpenByStart=new Map,this.autoClosingPairsOpenByEnd=new Map,this.autoClosingPairsCloseByStart=new Map,this.autoClosingPairsCloseByEnd=new Map,this.autoClosingPairsCloseSingleChar=new Map;for(const t of e)gd(this.autoClosingPairsOpenByStart,t.open.charAt(0),t),gd(this.autoClosingPairsOpenByEnd,t.open.charAt(t.open.length-1),t),gd(this.autoClosingPairsCloseByStart,t.close.charAt(0),t),gd(this.autoClosingPairsCloseByEnd,t.close.charAt(t.close.length-1),t),t.close.length===1&&t.open.length===1&&gd(this.autoClosingPairsCloseSingleChar,t.close,t)}}function gd(o,e,t){o.has(e)?o.get(e).push(t):o.set(e,[t])}const Th=class Th{constructor(e){if(e.autoClosingPairs?this._autoClosingPairs=e.autoClosingPairs.map(t=>new bC(t)):e.brackets?this._autoClosingPairs=e.brackets.map(t=>new bC({open:t[0],close:t[1]})):this._autoClosingPairs=[],e.__electricCharacterSupport&&e.__electricCharacterSupport.docComment){const t=e.__electricCharacterSupport.docComment;this._autoClosingPairs.push(new bC({open:t.open,close:t.close||""}))}this._autoCloseBeforeForQuotes=typeof e.autoCloseBefore=="string"?e.autoCloseBefore:Th.DEFAULT_AUTOCLOSE_BEFORE_LANGUAGE_DEFINED_QUOTES,this._autoCloseBeforeForBrackets=typeof e.autoCloseBefore=="string"?e.autoCloseBefore:Th.DEFAULT_AUTOCLOSE_BEFORE_LANGUAGE_DEFINED_BRACKETS,this._surroundingPairs=e.surroundingPairs||this._autoClosingPairs}getAutoClosingPairs(){return this._autoClosingPairs}getAutoCloseBeforeSet(e){return e?this._autoCloseBeforeForQuotes:this._autoCloseBeforeForBrackets}getSurroundingPairs(){return this._surroundingPairs}};Th.DEFAULT_AUTOCLOSE_BEFORE_LANGUAGE_DEFINED_QUOTES=`;:.,=}])>
|
||
`,Th.DEFAULT_AUTOCLOSE_BEFORE_LANGUAGE_DEFINED_BRACKETS=`'"\`;:.,=}])>
|
||
`;let CC=Th;function oa(o,e){const t=o.getCount(),i=o.findTokenIndexAtOffset(e),n=o.getLanguageId(i);let s=i;for(;s+1<t&&o.getLanguageId(s+1)===n;)s++;let r=i;for(;r>0&&o.getLanguageId(r-1)===n;)r--;return new OB(o,n,r,s+1,o.getStartOffset(r),o.getEndOffset(s))}class OB{constructor(e,t,i,n,s,r){this._scopedLineTokensBrand=void 0,this._actual=e,this.languageId=t,this._firstTokenIndex=i,this._lastTokenIndex=n,this.firstCharOffset=s,this._lastCharOffset=r,this.languageIdCodec=e.languageIdCodec}getLineContent(){return this._actual.getLineContent().substring(this.firstCharOffset,this._lastCharOffset)}getLineLength(){return this._lastCharOffset-this.firstCharOffset}getActualLineContentBefore(e){return this._actual.getLineContent().substring(0,this.firstCharOffset+e)}getTokenCount(){return this._lastTokenIndex-this._firstTokenIndex}findTokenIndexAtOffset(e){return this._actual.findTokenIndexAtOffset(e+this.firstCharOffset)-this._firstTokenIndex}getStandardTokenType(e){return this._actual.getStandardTokenType(e+this._firstTokenIndex)}toIViewLineTokens(){return this._actual.sliceAndInflate(this.firstCharOffset,this._lastCharOffset,0)}}function fs(o){return(o&3)!==0}let vC;function Kx(){return vC||(vC=new TextDecoder("UTF-16LE")),vC}let wC;function PB(){return wC||(wC=new TextDecoder("UTF-16BE")),wC}let SC;function Gx(){return SC||(SC=l.isLittleEndian()?Kx():PB()),SC}function kB(o,e,t){const i=new Uint16Array(o.buffer,e,t);return t>0&&(i[0]===65279||i[0]===65534)?FB(o,e,t):Kx().decode(i)}function FB(o,e,t){const i=[];let n=0;for(let s=0;s<t;s++){const r=l.readUInt16LE(o,e);e+=2,i[n++]=String.fromCharCode(r)}return i.join("")}class ra{constructor(e){this._capacity=e|0,this._buffer=new Uint16Array(this._capacity),this._completedStrings=null,this._bufferLength=0}reset(){this._completedStrings=null,this._bufferLength=0}build(){return this._completedStrings!==null?(this._flushBuffer(),this._completedStrings.join("")):this._buildBuffer()}_buildBuffer(){if(this._bufferLength===0)return"";const e=new Uint16Array(this._buffer.buffer,0,this._bufferLength);return Gx().decode(e)}_flushBuffer(){const e=this._buildBuffer();this._bufferLength=0,this._completedStrings===null?this._completedStrings=[e]:this._completedStrings[this._completedStrings.length]=e}appendCharCode(e){const t=this._capacity-this._bufferLength;t<=1&&(t===0||l.isHighSurrogate(e))&&this._flushBuffer(),this._buffer[this._bufferLength++]=e}appendASCIICharCode(e){this._bufferLength===this._capacity&&this._flushBuffer(),this._buffer[this._bufferLength++]=e}appendString(e){const t=e.length;if(this._bufferLength+t>=this._capacity){this._flushBuffer(),this._completedStrings[this._completedStrings.length]=e;return}for(let i=0;i<t;i++)this._buffer[this._bufferLength++]=e.charCodeAt(i)}}class pg{constructor(e,t,i,n,s,r){this._richEditBracketBrand=void 0,this.languageId=e,this.index=t,this.open=i,this.close=n,this.forwardRegex=s,this.reversedRegex=r,this._openSet=pg._toSet(this.open),this._closeSet=pg._toSet(this.close)}isOpen(e){return this._openSet.has(e)}isClose(e){return this._closeSet.has(e)}static _toSet(e){const t=new Set;for(const i of e)t.add(i);return t}}function BB(o){const e=o.length;o=o.map(r=>[r[0].toLowerCase(),r[1].toLowerCase()]);const t=[];for(let r=0;r<e;r++)t[r]=r;const i=(r,a)=>{const[c,h]=r,[d,u]=a;return c===d||c===u||h===d||h===u},n=(r,a)=>{const c=Math.min(r,a),h=Math.max(r,a);for(let d=0;d<e;d++)t[d]===h&&(t[d]=c)};for(let r=0;r<e;r++){const a=o[r];for(let c=r+1;c<e;c++){const h=o[c];i(a,h)&&n(t[r],t[c])}}const s=[];for(let r=0;r<e;r++){const a=[],c=[];for(let h=0;h<e;h++)if(t[h]===r){const[d,u]=o[h];a.push(d),c.push(u)}a.length>0&&s.push({open:a,close:c})}return s}class zB{constructor(e,t){this._richEditBracketsBrand=void 0;const i=BB(t);this.brackets=i.map((n,s)=>new pg(e,s,n.open,n.close,VB(n.open,n.close,i,s),UB(n.open,n.close,i,s))),this.forwardRegex=$B(this.brackets),this.reversedRegex=KB(this.brackets),this.textIsBracket={},this.textIsOpenBracket={},this.maxBracketLength=0;for(const n of this.brackets){for(const s of n.open)this.textIsBracket[s]=n,this.textIsOpenBracket[s]=!0,this.maxBracketLength=Math.max(this.maxBracketLength,s.length);for(const s of n.close)this.textIsBracket[s]=n,this.textIsOpenBracket[s]=!1,this.maxBracketLength=Math.max(this.maxBracketLength,s.length)}}}function jx(o,e,t,i){for(let n=0,s=e.length;n<s;n++){if(n===t)continue;const r=e[n];for(const a of r.open)a.indexOf(o)>=0&&i.push(a);for(const a of r.close)a.indexOf(o)>=0&&i.push(a)}}function qx(o,e){return o.length-e.length}function _g(o){if(o.length<=1)return o;const e=[],t=new Set;for(const i of o)t.has(i)||(e.push(i),t.add(i));return e}function VB(o,e,t,i){let n=[];n=n.concat(o),n=n.concat(e);for(let s=0,r=n.length;s<r;s++)jx(n[s],t,i,n);return n=_g(n),n.sort(qx),n.reverse(),md(n)}function UB(o,e,t,i){let n=[];n=n.concat(o),n=n.concat(e);for(let s=0,r=n.length;s<r;s++)jx(n[s],t,i,n);return n=_g(n),n.sort(qx),n.reverse(),md(n.map(yC))}function $B(o){let e=[];for(const t of o){for(const i of t.open)e.push(i);for(const i of t.close)e.push(i)}return e=_g(e),md(e)}function KB(o){let e=[];for(const t of o){for(const i of t.open)e.push(i);for(const i of t.close)e.push(i)}return e=_g(e),md(e.map(yC))}function GB(o){const e=/^[\w ]+$/.test(o);return o=l.escapeRegExpCharacters(o),e?`\\b${o}\\b`:o}function md(o,e){const t=`(${o.map(GB).join(")|(")})`;return l.createRegExp(t,!0,e)}const yC=(function(){function o(i){const n=new Uint16Array(i.length);let s=0;for(let r=i.length-1;r>=0;r--)n[s++]=i.charCodeAt(r);return Gx().decode(n)}let e=null,t=null;return function(n){return e!==n&&(e=n,t=o(e)),t}})();class Pn{static _findPrevBracketInText(e,t,i,n){const s=i.match(e);if(!s)return null;const r=i.length-(s.index||0),a=s[0].length,c=n+r;return new l.Range(t,c-a+1,t,c+1)}static findPrevBracketInRange(e,t,i,n,s){const a=yC(i).substring(i.length-s,i.length-n);return this._findPrevBracketInText(e,t,a,n)}static findNextBracketInText(e,t,i,n){const s=i.match(e);if(!s)return null;const r=s.index||0,a=s[0].length;if(a===0)return null;const c=n+r;return new l.Range(t,c+1,t,c+1+a)}static findNextBracketInRange(e,t,i,n,s){const r=i.substring(n,s);return this.findNextBracketInText(e,t,r,n)}}class jB{constructor(e){this._richEditBrackets=e}getElectricCharacters(){const e=[];if(this._richEditBrackets)for(const t of this._richEditBrackets.brackets)for(const i of t.close){const n=i.charAt(i.length-1);e.push(n)}return l.distinct(e)}onElectricCharacter(e,t,i){if(!this._richEditBrackets||this._richEditBrackets.brackets.length===0)return null;const n=t.findTokenIndexAtOffset(i-1);if(fs(t.getStandardTokenType(n)))return null;const s=this._richEditBrackets.reversedRegex,r=t.getLineContent().substring(0,i-1)+e,a=Pn.findPrevBracketInRange(s,1,r,0,r.length);if(!a)return null;const c=r.substring(a.startColumn-1,a.endColumn-1).toLowerCase();if(this._richEditBrackets.textIsOpenBracket[c])return null;const d=t.getActualLineContentBefore(a.startColumn-1);return/^\s*$/.test(d)?{matchOpenBracket:c}:null}}function bg(o){return o.global&&(o.lastIndex=0),!0}class qB{constructor(e){this._indentationRules=e}shouldIncrease(e){return!!(this._indentationRules&&this._indentationRules.increaseIndentPattern&&bg(this._indentationRules.increaseIndentPattern)&&this._indentationRules.increaseIndentPattern.test(e))}shouldDecrease(e){return!!(this._indentationRules&&this._indentationRules.decreaseIndentPattern&&bg(this._indentationRules.decreaseIndentPattern)&&this._indentationRules.decreaseIndentPattern.test(e))}shouldIndentNextLine(e){return!!(this._indentationRules&&this._indentationRules.indentNextLinePattern&&bg(this._indentationRules.indentNextLinePattern)&&this._indentationRules.indentNextLinePattern.test(e))}shouldIgnore(e){return!!(this._indentationRules&&this._indentationRules.unIndentedLinePattern&&bg(this._indentationRules.unIndentedLinePattern)&&this._indentationRules.unIndentedLinePattern.test(e))}getIndentMetadata(e){let t=0;return this.shouldIncrease(e)&&(t+=1),this.shouldDecrease(e)&&(t+=2),this.shouldIndentNextLine(e)&&(t+=4),this.shouldIgnore(e)&&(t+=8),t}}class Xl{constructor(e){e=e||{},e.brackets=e.brackets||[["(",")"],["{","}"],["[","]"]],this._brackets=[],e.brackets.forEach(t=>{const i=Xl._createOpenBracketRegExp(t[0]),n=Xl._createCloseBracketRegExp(t[1]);i&&n&&this._brackets.push({open:t[0],openRegExp:i,close:t[1],closeRegExp:n})}),this._regExpRules=e.onEnterRules||[]}onEnter(e,t,i,n){if(e>=3)for(let s=0,r=this._regExpRules.length;s<r;s++){const a=this._regExpRules[s];if([{reg:a.beforeText,text:i},{reg:a.afterText,text:n},{reg:a.previousLineText,text:t}].every(h=>h.reg?(h.reg.lastIndex=0,h.reg.test(h.text)):!0))return a.action}if(e>=2&&i.length>0&&n.length>0)for(let s=0,r=this._brackets.length;s<r;s++){const a=this._brackets[s];if(a.openRegExp.test(i)&&a.closeRegExp.test(n))return{indentAction:_.IndentAction.IndentOutdent}}if(e>=2&&i.length>0){for(let s=0,r=this._brackets.length;s<r;s++)if(this._brackets[s].openRegExp.test(i))return{indentAction:_.IndentAction.Indent}}return null}static _createOpenBracketRegExp(e){let t=l.escapeRegExpCharacters(e);return/\B/.test(t.charAt(0))||(t="\\b"+t),t+="\\s*$",Xl._safeRegExp(t)}static _createCloseBracketRegExp(e){let t=l.escapeRegExpCharacters(e);return/\B/.test(t.charAt(t.length-1))||(t=t+"\\b"),t="^\\s*"+t,Xl._safeRegExp(t)}static _safeRegExp(e){try{return new RegExp(e)}catch(t){return l.onUnexpectedError(t),null}}}const Ge=le("configurationService");function LC(o,e){const t=Object.create(null);for(const i in o)Yx(t,i,o[i],e);return t}function Yx(o,e,t,i){const n=e.split("."),s=n.pop();let r=o;for(let a=0;a<n.length;a++){const c=n[a];let h=r[c];switch(typeof h){case"undefined":h=r[c]=Object.create(null);break;case"object":if(h===null){i(`Ignoring ${e} as ${n.slice(0,a+1).join(".")} is null`);return}break;default:i(`Ignoring ${e} as ${n.slice(0,a+1).join(".")} is ${JSON.stringify(h)}`);return}r=h}if(typeof r=="object"&&r!==null)try{r[s]=t}catch{i(`Ignoring ${e} as ${n.join(".")} is ${JSON.stringify(r)}`)}else i(`Ignoring ${e} as ${n.join(".")} is ${JSON.stringify(r)}`)}function YB(o,e){const t=e.split(".");Zx(o,t)}function Zx(o,e){if(!o)return;const t=o,i=e.shift();if(e.length===0){delete t[i];return}if(Object.keys(t).indexOf(i)!==-1){const n=t[i];typeof n=="object"&&n!==null&&!Array.isArray(n)&&(Zx(n,e),Object.keys(n).length===0&&delete t[i])}}function Qx(o,e,t){function i(r,a){let c=r;for(const h of a){if(typeof c!="object"||c===null)return;c=c[h]}return c}const n=e.split("."),s=i(o,n);return typeof s>"u"?t:s}function ZB(o){return o.replace(/^\[/,"").replace(/]$/g,"").replace(/\]\[/g,", ")}const yt=le("languageService");class gs{constructor(e,t=[],i=!1){this.ctor=e,this.staticArguments=t,this.supportsDelayedInstantiation=i}}const Xx=[];function fe(o,e,t){e instanceof gs||(e=new gs(e,[],!!t)),Xx.push([o,e])}function Jx(){return Xx}const mn=Object.freeze({text:"text/plain",binary:"application/octet-stream",unknown:"application/unknown",markdown:"text/markdown",latex:"text/latex",uriList:"text/uri-list",html:"text/html"}),Cg={JSONContribution:"base.contributions.json"};function QB(o){return o.length>0&&o.charAt(o.length-1)==="#"?o.substring(0,o.length-1):o}class XB extends l.Disposable{constructor(){super(...arguments),this.schemasById={},this._onDidChangeSchema=this._register(new l.Emitter)}registerSchema(e,t,i){const n=QB(e);this.schemasById[n]=t,this._onDidChangeSchema.fire(e),i&&i.add(l.toDisposable(()=>{delete this.schemasById[n],this._onDidChangeSchema.fire(e)}))}notifySchemaChanged(e){this._onDidChangeSchema.fire(e)}}const JB=new XB;St.add(Cg.JSONContribution,JB);let Xi;const DC=globalThis.vscode;if(typeof DC<"u"&&typeof DC.context<"u"){const o=DC.context.configuration();if(o)Xi=o.product;else throw new Error("Sandbox: unable to resolve product configuration from preload script.")}else if(globalThis._VSCODE_PRODUCT_JSON&&globalThis._VSCODE_PACKAGE_JSON){if(Xi=globalThis._VSCODE_PRODUCT_JSON,l.env.VSCODE_DEV&&Object.assign(Xi,{nameShort:`${Xi.nameShort} Dev`,nameLong:`${Xi.nameLong} Dev`,dataFolderName:`${Xi.dataFolderName}-dev`,serverDataFolderName:Xi.serverDataFolderName?`${Xi.serverDataFolderName}-dev`:void 0}),!Xi.version){const o=globalThis._VSCODE_PACKAGE_JSON;Object.assign(Xi,{version:o.version})}}else Xi={},Object.keys(Xi).length===0&&Object.assign(Xi,{version:"1.104.0-dev",nameShort:"Code - OSS Dev",nameLong:"Code - OSS Dev",applicationName:"code-oss",dataFolderName:".vscode-oss",urlProtocol:"code-oss",reportIssueUrl:"https://github.com/microsoft/vscode/issues/new",licenseName:"MIT",licenseUrl:"https://github.com/microsoft/vscode/blob/main/LICENSE.txt",serverLicenseUrl:"https://github.com/microsoft/vscode/blob/main/LICENSE.txt",defaultChatAgent:{extensionId:"GitHub.copilot",chatExtensionId:"GitHub.copilot-chat",provider:{default:{id:"github",name:"GitHub"},enterprise:{id:"github-enterprise",name:"GitHub Enterprise"}},providerScopes:[]}});const pd=Xi,Xo={Configuration:"base.contributions.configuration"},vg="vscode://schemas/settings/resourceLanguage",Wx=St.as(Cg.JSONContribution);class WB extends l.Disposable{constructor(){super(),this.registeredConfigurationDefaults=[],this.overrideIdentifiers=new Set,this._onDidSchemaChange=this._register(new l.Emitter),this._onDidUpdateConfiguration=this._register(new l.Emitter),this.configurationDefaultsOverrides=new Map,this.defaultLanguageConfigurationOverridesNode={id:"defaultOverrides",title:l.localize(1725,"Default Language Configuration Overrides"),properties:{}},this.configurationContributors=[this.defaultLanguageConfigurationOverridesNode],this.resourceLanguageSettingsSchema={properties:{},patternProperties:{},additionalProperties:!0,allowTrailingCommas:!0,allowComments:!0},this.configurationProperties={},this.policyConfigurations=new Map,this.policyReferenceConfigurations=new Map,this.excludedConfigurationProperties={},Wx.registerSchema(vg,this.resourceLanguageSettingsSchema),this.registerOverridePropertyPatternKey()}registerConfiguration(e,t=!0){return this.registerConfigurations([e],t),e}registerConfigurations(e,t=!0){const i=new Set;this.doRegisterConfigurations(e,t,i),Wx.registerSchema(vg,this.resourceLanguageSettingsSchema),this._onDidSchemaChange.fire(),this._onDidUpdateConfiguration.fire({properties:i})}registerDefaultConfigurations(e){const t=new Set;this.doRegisterDefaultConfigurations(e,t),this._onDidSchemaChange.fire(),this._onDidUpdateConfiguration.fire({properties:t,defaultsOverrides:!0})}doRegisterDefaultConfigurations(e,t){this.registeredConfigurationDefaults.push(...e);const i=[];for(const{overrides:n,source:s}of e)for(const r in n){t.add(r);const a=this.configurationDefaultsOverrides.get(r)??this.configurationDefaultsOverrides.set(r,{configurationDefaultOverrides:[]}).get(r),c=n[r];if(a.configurationDefaultOverrides.push({value:c,source:s}),Jo.test(r)){const h=this.mergeDefaultConfigurationsForOverrideIdentifier(r,c,s,a.configurationDefaultOverrideValue);if(!h)continue;a.configurationDefaultOverrideValue=h,this.updateDefaultOverrideProperty(r,h,s),i.push(...wg(r))}else{const h=this.mergeDefaultConfigurationsForConfigurationProperty(r,c,s,a.configurationDefaultOverrideValue);if(!h)continue;a.configurationDefaultOverrideValue=h;const d=this.configurationProperties[r];d&&(this.updatePropertyDefaultValue(r,d),this.updateSchema(r,d))}}this.doRegisterOverrideIdentifiers(i)}updateDefaultOverrideProperty(e,t,i){const n={section:{id:this.defaultLanguageConfigurationOverridesNode.id,title:this.defaultLanguageConfigurationOverridesNode.title,order:this.defaultLanguageConfigurationOverridesNode.order,extensionInfo:this.defaultLanguageConfigurationOverridesNode.extensionInfo},type:"object",default:t.value,description:l.localize(1726,"Configure settings to be overridden for {0}.",ZB(e)),$ref:vg,defaultDefaultValue:t.value,source:i,defaultValueSource:i};this.configurationProperties[e]=n,this.defaultLanguageConfigurationOverridesNode.properties[e]=n}mergeDefaultConfigurationsForOverrideIdentifier(e,t,i,n){const s=n?.value||{},r=n?.source??new Map;if(!(r instanceof Map)){console.error("objectConfigurationSources is not a Map");return}for(const a of Object.keys(t)){const c=t[a];if(l.isObject(c)&&(l.isUndefined(s[a])||l.isObject(s[a]))){if(s[a]={...s[a]??{},...c},i)for(const d in c)r.set(`${a}.${d}`,i)}else s[a]=c,i?r.set(a,i):r.delete(a)}return{value:s,source:r}}mergeDefaultConfigurationsForConfigurationProperty(e,t,i,n){const s=this.configurationProperties[e],r=n?.value??s?.defaultDefaultValue;let a=i;if(l.isObject(t)&&(s!==void 0&&s.type==="object"||s===void 0&&(l.isUndefined(r)||l.isObject(r)))){if(a=n?.source??new Map,!(a instanceof Map)){console.error("defaultValueSource is not a Map");return}for(const h in t)i&&a.set(`${e}.${h}`,i);t={...l.isObject(r)?r:{},...t}}return{value:t,source:a}}registerOverrideIdentifiers(e){this.doRegisterOverrideIdentifiers(e),this._onDidSchemaChange.fire()}doRegisterOverrideIdentifiers(e){for(const t of e)this.overrideIdentifiers.add(t);this.updateOverridePropertyPatternKey()}doRegisterConfigurations(e,t,i){e.forEach(n=>{this.validateAndRegisterProperties(n,t,n.extensionInfo,n.restrictedProperties,void 0,i),this.configurationContributors.push(n),this.registerJSONConfiguration(n)})}validateAndRegisterProperties(e,t=!0,i,n,s=4,r){s=l.isUndefinedOrNull(e.scope)?s:e.scope;const a=e.properties;if(a)for(const h in a){const d=a[h];if(d.section={id:e.id,title:e.title,order:e.order,extensionInfo:e.extensionInfo},t&&tz(h,d,i?.id)){delete a[h];continue}d.source=i,d.defaultDefaultValue=a[h].default,this.updatePropertyDefaultValue(h,d),Jo.test(h)?d.scope=void 0:(d.scope=l.isUndefinedOrNull(d.scope)?s:d.scope,d.restricted=l.isUndefinedOrNull(d.restricted)?!!n?.includes(h):d.restricted),d.experiment?d.tags?.some(m=>m.toLowerCase()==="onexp")||(d.tags=d.tags??[],d.tags.push("onExP")):d.tags?.some(m=>m.toLowerCase()==="onexp")&&(console.error(`Invalid tag 'onExP' found for property '${h}'. Please use 'experiment' property instead.`),d.experiment={mode:"startup"});const u=a[h].hasOwnProperty("included")&&!a[h].included,f=a[h].policy?.name,g=a[h].policyReference?.name;u?(this.excludedConfigurationProperties[h]=a[h],f&&(this.policyConfigurations.set(f,h),r.add(h)),g&&(this.addPolicyReferenceConfiguration(g,h),r.add(h)),delete a[h]):(r.add(h),f&&this.policyConfigurations.set(f,h),g&&this.addPolicyReferenceConfiguration(g,h),this.configurationProperties[h]=a[h],!a[h].deprecationMessage&&a[h].markdownDeprecationMessage&&(a[h].deprecationMessage=a[h].markdownDeprecationMessage))}const c=e.allOf;if(c)for(const h of c)this.validateAndRegisterProperties(h,t,i,n,s,r)}addPolicyReferenceConfiguration(e,t){let i=this.policyReferenceConfigurations.get(e);i||(i=new Set,this.policyReferenceConfigurations.set(e,i)),i.add(t)}getConfigurationProperties(){return this.configurationProperties}getPolicyConfigurations(){return this.policyConfigurations}getExcludedConfigurationProperties(){return this.excludedConfigurationProperties}registerJSONConfiguration(e){const t=i=>{const n=i.properties;if(n)for(const r in n)this.updateSchema(r,n[r]);i.allOf?.forEach(t)};t(e)}updateSchema(e,t){switch(t.scope){case 1:break;case 2:break;case 3:break;case 7:break;case 4:break;case 5:break;case 6:this.resourceLanguageSettingsSchema.properties[e]=t;break}}updateOverridePropertyPatternKey(){for(const e of this.overrideIdentifiers.values()){const t=`[${e}]`,i={type:"object",description:l.localize(1727,"Configure editor settings to be overridden for a language."),errorMessage:l.localize(1728,"This setting does not support per-language configuration."),$ref:vg};this.updatePropertyDefaultValue(t,i)}}registerOverridePropertyPatternKey(){l.localize(1729,"Configure editor settings to be overridden for a language."),l.localize(1730,"This setting does not support per-language configuration."),this._onDidSchemaChange.fire()}updatePropertyDefaultValue(e,t){const i=this.configurationDefaultsOverrides.get(e)?.configurationDefaultOverrideValue;let n,s;i&&(!t.disallowConfigurationDefault||!i.source)&&(n=i.value,s=i.source),l.isUndefined(n)&&(n=t.defaultDefaultValue,s=void 0),l.isUndefined(n)&&(n=ez(t.type)),t.default=n,t.defaultValueSource=s}}const Hx="\\[([^\\]]+)\\]",eE=new RegExp(Hx,"g"),HB=`^(${Hx})+$`,Jo=new RegExp(HB);function wg(o){const e=[];if(Jo.test(o)){let t=eE.exec(o);for(;t?.length;){const i=t[1].trim();i&&e.push(i),t=eE.exec(o)}}return l.distinct(e)}function ez(o){switch(Array.isArray(o)?o[0]:o){case"boolean":return!1;case"integer":case"number":return 0;case"string":return"";case"array":return[];case"object":return{};default:return null}}const Sg=new WB;St.add(Xo.Configuration,Sg);function tz(o,e,t){return o.trim()?Jo.test(o)?l.localize(1732,"Cannot register '{0}'. This matches property pattern '\\\\[.*\\\\]$' for describing language specific editor settings. Use 'configurationDefaults' contribution.",o):Sg.getConfigurationProperties()[o]!==void 0&&(!t||!iz.has(t.toLowerCase()))?l.localize(1733,"Cannot register '{0}'. This property is already registered.",o):e.policy&&e.policyReference?l.localize(1734,"Cannot register '{0}'. A setting must not declare both 'policy' and 'policyReference'.",o):e.policy?.name&&Sg.getPolicyConfigurations().get(e.policy?.name)!==void 0?l.localize(1735,"Cannot register '{0}'. The associated policy {1} is already registered with {2}. To attach another setting to the same policy, use 'policyReference'.",o,e.policy?.name,Sg.getPolicyConfigurations().get(e.policy?.name)):null:l.localize(1731,"Cannot register an empty property")}const iz=new Set(pd.defaultChatAgent?[pd.defaultChatAgent.extensionId,pd.defaultChatAgent.chatExtensionId].map(o=>o.toLowerCase()):[]),nz={ModesRegistry:"editor.modesRegistry"};class sz extends l.Disposable{constructor(){super(),this._onDidChangeLanguages=this._register(new l.Emitter),this.onDidChangeLanguages=this._onDidChangeLanguages.event,this._languages=[]}registerLanguage(e){return this._languages.push(e),this._onDidChangeLanguages.fire(void 0),{dispose:()=>{for(let t=0,i=this._languages.length;t<i;t++)if(this._languages[t]===e){this._languages.splice(t,1);return}}}}getLanguages(){return this._languages}}const Jl=new sz;St.add(nz.ModesRegistry,Jl);const pn="plaintext";Jl.registerLanguage({id:pn,extensions:[".txt"],aliases:[l.localize(819,"Plain Text"),"text"],mimetypes:[mn.text]}),St.as(Xo.Configuration).registerDefaultConfigurations([{overrides:{"[plaintext]":{"editor.unicodeHighlight.ambiguousCharacters":!1,"editor.unicodeHighlight.invisibleCharacters":!1},"[go]":{"editor.insertSpaces":!1},"[makefile]":{"editor.insertSpaces":!1},"[shellscript]":{"files.eol":`
|
||
`},"[yaml]":{"editor.insertSpaces":!0,"editor.tabSize":2}}}]);class oz{constructor(e,t){this.languageId=e;const i=t.brackets?tE(t.brackets):[],n=new l.CachedFunction(a=>{const c=new Set;return{info:new rz(this,a,c),closing:c}}),s=new l.CachedFunction(a=>{const c=new Set,h=new Set;return{info:new az(this,a,c,h),opening:c,openingColorized:h}});for(const[a,c]of i){const h=n.get(a),d=s.get(c);h.closing.add(d.info),d.opening.add(h.info)}const r=t.colorizedBracketPairs?tE(t.colorizedBracketPairs):i.filter(a=>!(a[0]==="<"&&a[1]===">"));for(const[a,c]of r){const h=n.get(a),d=s.get(c);h.closing.add(d.info),d.openingColorized.add(h.info),d.opening.add(h.info)}this._openingBrackets=new Map([...n.cachedValues].map(([a,c])=>[a,c.info])),this._closingBrackets=new Map([...s.cachedValues].map(([a,c])=>[a,c.info]))}get openingBrackets(){return[...this._openingBrackets.values()]}get closingBrackets(){return[...this._closingBrackets.values()]}getOpeningBracketInfo(e){return this._openingBrackets.get(e)}getClosingBracketInfo(e){return this._closingBrackets.get(e)}getBracketInfo(e){return this.getOpeningBracketInfo(e)||this.getClosingBracketInfo(e)}getBracketRegExp(e){const t=Array.from([...this._openingBrackets.keys(),...this._closingBrackets.keys()]);return md(t,e)}}function tE(o){return o.filter(([e,t])=>e!==""&&t!=="")}class iE{constructor(e,t){this.config=e,this.bracketText=t}get languageId(){return this.config.languageId}}class rz extends iE{constructor(e,t,i){super(e,t),this.openedBrackets=i,this.isOpeningBracket=!0}}class az extends iE{constructor(e,t,i,n){super(e,t),this.openingBrackets=i,this.openingColorizedBrackets=n,this.isOpeningBracket=!1}closes(e){return e.config!==this.config?!1:this.openingBrackets.has(e)}closesColorized(e){return e.config!==this.config?!1:this.openingColorizedBrackets.has(e)}getOpeningBrackets(){return[...this.openingBrackets]}}var lz=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},nE=function(o,e){return function(t,i){e(t,i,o)}};class xC{constructor(e){this.languageId=e}affects(e){return this.languageId?this.languageId===e:!0}}const ms=le("languageConfigurationService");let EC=class extends l.Disposable{constructor(e,t){super(),this.configurationService=e,this.languageService=t,this._registry=this._register(new uz),this.onDidChangeEmitter=this._register(new l.Emitter),this.onDidChange=this.onDidChangeEmitter.event,this.configurations=new Map;const i=new Set(Object.values(IC));this._register(this.configurationService.onDidChangeConfiguration(n=>{const s=n.change.keys.some(a=>i.has(a)),r=n.change.overrides.filter(([a,c])=>c.some(h=>i.has(h))).map(([a])=>a);if(s)this.configurations.clear(),this.onDidChangeEmitter.fire(new xC(void 0));else for(const a of r)this.languageService.isRegisteredLanguageId(a)&&(this.configurations.delete(a),this.onDidChangeEmitter.fire(new xC(a)))})),this._register(this._registry.onDidChange(n=>{this.configurations.delete(n.languageId),this.onDidChangeEmitter.fire(new xC(n.languageId))}))}register(e,t,i){return this._registry.register(e,t,i)}getLanguageConfiguration(e){let t=this.configurations.get(e);return t||(t=cz(e,this._registry,this.configurationService,this.languageService),this.configurations.set(e,t)),t}};EC=lz([nE(0,Ge),nE(1,yt)],EC);function cz(o,e,t,i){let n=e.getLanguageConfiguration(o);if(!n){if(!i.isRegisteredLanguageId(o))return new Wl(o,{});n=new Wl(o,{})}const s=hz(n.languageId,t),r=rE([n.underlyingConfig,s]);return new Wl(n.languageId,r)}const IC={brackets:"editor.language.brackets",colorizedBracketPairs:"editor.language.colorizedBracketPairs"};function hz(o,e){const t=e.getValue(IC.brackets,{overrideIdentifier:o}),i=e.getValue(IC.colorizedBracketPairs,{overrideIdentifier:o});return{brackets:sE(t),colorizedBracketPairs:sE(i)}}function sE(o){if(Array.isArray(o))return o.map(e=>{if(!(!Array.isArray(e)||e.length!==2))return[e[0],e[1]]}).filter(e=>!!e)}function oE(o,e,t){const i=o.getLineContent(e);let n=l.getLeadingWhitespace(i);return n.length>t-1&&(n=n.substring(0,t-1)),n}class dz{constructor(e){this.languageId=e,this._resolved=null,this._entries=[],this._order=0,this._resolved=null}register(e,t){const i=new aE(e,t,++this._order);return this._entries.push(i),this._resolved=null,l.markAsSingleton(l.toDisposable(()=>{for(let n=0;n<this._entries.length;n++)if(this._entries[n]===i){this._entries.splice(n,1),this._resolved=null;break}}))}getResolvedConfiguration(){if(!this._resolved){const e=this._resolve();e&&(this._resolved=new Wl(this.languageId,e))}return this._resolved}_resolve(){return this._entries.length===0?null:(this._entries.sort(aE.cmp),rE(this._entries.map(e=>e.configuration)))}}function rE(o){let e={comments:void 0,brackets:void 0,wordPattern:void 0,indentationRules:void 0,onEnterRules:void 0,autoClosingPairs:void 0,surroundingPairs:void 0,autoCloseBefore:void 0,folding:void 0,colorizedBracketPairs:void 0,__electricCharacterSupport:void 0};for(const t of o)e={comments:t.comments||e.comments,brackets:t.brackets||e.brackets,wordPattern:t.wordPattern||e.wordPattern,indentationRules:t.indentationRules||e.indentationRules,onEnterRules:t.onEnterRules||e.onEnterRules,autoClosingPairs:t.autoClosingPairs||e.autoClosingPairs,surroundingPairs:t.surroundingPairs||e.surroundingPairs,autoCloseBefore:t.autoCloseBefore||e.autoCloseBefore,folding:t.folding||e.folding,colorizedBracketPairs:t.colorizedBracketPairs||e.colorizedBracketPairs,__electricCharacterSupport:t.__electricCharacterSupport||e.__electricCharacterSupport};return e}class aE{constructor(e,t,i){this.configuration=e,this.priority=t,this.order=i}static cmp(e,t){return e.priority===t.priority?e.order-t.order:e.priority-t.priority}}class lE{constructor(e){this.languageId=e}}class uz extends l.Disposable{constructor(){super(),this._entries=new Map,this._onDidChange=this._register(new l.Emitter),this.onDidChange=this._onDidChange.event,this._register(this.register(pn,{brackets:[["(",")"],["[","]"],["{","}"]],surroundingPairs:[{open:"{",close:"}"},{open:"[",close:"]"},{open:"(",close:")"},{open:"<",close:">"},{open:'"',close:'"'},{open:"'",close:"'"},{open:"`",close:"`"}],colorizedBracketPairs:[],folding:{offSide:!0}},0))}register(e,t,i=0){let n=this._entries.get(e);n||(n=new dz(e),this._entries.set(e,n));const s=n.register(t,i);return this._onDidChange.fire(new lE(e)),l.markAsSingleton(l.toDisposable(()=>{s.dispose(),this._onDidChange.fire(new lE(e))}))}getLanguageConfiguration(e){return this._entries.get(e)?.getResolvedConfiguration()||null}}class Wl{constructor(e,t){this.languageId=e,this.underlyingConfig=t,this._brackets=null,this._electricCharacter=null,this._onEnterSupport=this.underlyingConfig.brackets||this.underlyingConfig.indentationRules||this.underlyingConfig.onEnterRules?new Xl(this.underlyingConfig):null,this.comments=Wl._handleComments(this.underlyingConfig),this.characterPair=new CC(this.underlyingConfig),this.wordDefinition=this.underlyingConfig.wordPattern||l.DEFAULT_WORD_REGEXP,this.indentationRules=this.underlyingConfig.indentationRules,this.underlyingConfig.indentationRules?this.indentRulesSupport=new qB(this.underlyingConfig.indentationRules):this.indentRulesSupport=null,this.foldingRules=this.underlyingConfig.folding||{},this.bracketsNew=new oz(e,this.underlyingConfig)}getWordDefinition(){return l.ensureValidWordDefinition(this.wordDefinition)}get brackets(){return!this._brackets&&this.underlyingConfig.brackets&&(this._brackets=new zB(this.languageId,this.underlyingConfig.brackets)),this._brackets}get electricCharacter(){return this._electricCharacter||(this._electricCharacter=new jB(this.brackets)),this._electricCharacter}onEnter(e,t,i,n){return this._onEnterSupport?this._onEnterSupport.onEnter(e,t,i,n):null}getAutoClosingPairs(){return new AB(this.characterPair.getAutoClosingPairs())}getAutoCloseBeforeSet(e){return this.characterPair.getAutoCloseBeforeSet(e)}getSurroundingPairs(){return this.characterPair.getSurroundingPairs()}static _handleComments(e){const t=e.comments;if(!t)return null;const i={};if(t.lineComment&&(typeof t.lineComment=="string"?i.lineCommentToken=t.lineComment:(i.lineCommentToken=t.lineComment.comment,i.lineCommentNoIndent=t.lineComment.noIndent)),t.blockComment){const[n,s]=t.blockComment;i.blockCommentStartToken=n,i.blockCommentEndToken=s}return i}}fe(ms,EC,1);const TC=le("textResourceConfigurationService"),cE=le("textResourcePropertiesService"),ze=le("ILanguageFeaturesService");function fz(){return pd.defaultChatAgent?.completionsEnablementSetting}function gz(o,e,t="*"){const i=fz();return i?hE(o.getValue(e,i),t):!1}function hE(o,e="*"){return l.isObject(o)?typeof o[e]<"u"?!!o[e]:!!o["*"]:!1}var NC=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},ps=function(o,e){return function(t,i){e(t,i,o)}},RC;const dE=300*1e3;function aa(o,e){const t=o.getModel(e);return!(!t||t.isTooLargeForSyncing())}let MC=(vl=class extends l.Disposable{constructor(e,t,i,n,s,r){super(),this._languageConfigurationService=n,this._webWorkerService=r,this._modelService=e,this._workerManager=this._register(new AC(RC.workerDescriptor,this._modelService,this._webWorkerService)),this._logService=i,this._register(s.linkProvider.register({language:"*",hasAccessToAllModels:!0},{provideLinks:async(a,c)=>{if(!aa(this._modelService,a.uri))return Promise.resolve({links:[]});const d=await(await this._workerWithResources([a.uri])).$computeLinks(a.uri.toString());return d&&{links:d}}})),this._register(s.completionProvider.register("*",new mz(this._workerManager,t,this._modelService,this._languageConfigurationService,this._logService,s)))}canComputeUnicodeHighlights(e){return aa(this._modelService,e)}async computedUnicodeHighlights(e,t,i){return(await this._workerWithResources([e])).$computeUnicodeHighlights(e.toString(),t,i)}async computeDiff(e,t,i,n){const r=await(await this._workerWithResources([e,t],!0)).$computeDiff(e.toString(),t.toString(),i,n);if(!r)return null;return{identical:r.identical,quitEarly:r.quitEarly,changes:c(r.changes),moves:r.moves.map(h=>new l.MovedText(new l.LineRangeMapping(new l.LineRange(h[0],h[1]),new l.LineRange(h[2],h[3])),c(h[4])))};function c(h){return h.map(d=>new l.DetailedLineRangeMapping(new l.LineRange(d[0],d[1]),new l.LineRange(d[2],d[3]),d[4]?.map(u=>new l.RangeMapping(new l.Range(u[0],u[1],u[2],u[3]),new l.Range(u[4],u[5],u[6],u[7])))))}}async computeMoreMinimalEdits(e,t,i=!1){if(l.isNonEmptyArray(t)){if(!aa(this._modelService,e))return Promise.resolve(t);const n=l.StopWatch.create(),s=this._workerWithResources([e]).then(r=>r.$computeMoreMinimalEdits(e.toString(),t,i));return s.finally(()=>this._logService.trace("FORMAT#computeMoreMinimalEdits",e.toString(!0),n.elapsed())),Promise.race([s,l.timeout(1e3).then(()=>t)])}else return Promise.resolve(void 0)}canNavigateValueSet(e){return aa(this._modelService,e)}async navigateValueSet(e,t,i){const n=this._modelService.getModel(e);if(!n)return null;const s=this._languageConfigurationService.getLanguageConfiguration(n.getLanguageId()).getWordDefinition(),r=s.source,a=s.flags;return(await this._workerWithResources([e])).$navigateValueSet(e.toString(),t,i,r,a)}canComputeWordRanges(e){return aa(this._modelService,e)}async computeWordRanges(e,t){const i=this._modelService.getModel(e);if(!i)return Promise.resolve(null);const n=this._languageConfigurationService.getLanguageConfiguration(i.getLanguageId()).getWordDefinition(),s=n.source,r=n.flags;return(await this._workerWithResources([e])).$computeWordRanges(e.toString(),t,s,r)}async findSectionHeaders(e,t){return(await this._workerWithResources([e])).$findSectionHeaders(e.toString(),t)}async computeDefaultDocumentColors(e){return(await this._workerWithResources([e])).$computeDefaultDocumentColors(e.toString())}async _workerWithResources(e,t=!1){return await(await this._workerManager.withWorker()).workerWithSyncedResources(e,t)}},RC=vl,vl.workerDescriptor=new MB({esmModuleLocation:()=>l.FileAccess.asBrowserUri("vs/editor/common/services/editorWebWorkerMain.js"),esmModuleLocationBundler:()=>RB,label:"editorWorkerService"}),vl);MC=RC=NC([ps(0,ri),ps(1,TC),ps(2,ei),ps(3,ms),ps(4,ze),ps(5,fd)],MC);class mz{constructor(e,t,i,n,s,r){this.languageConfigurationService=n,this.logService=s,this.languageFeaturesService=r,this._debugDisplayName="wordbasedCompletions",this._workerManager=e,this._configurationService=t,this._modelService=i}async provideCompletionItems(e,t){const i=this._configurationService.getValue(e.uri,t,"editor");if(i.wordBasedSuggestions==="off"||i.wordBasedSuggestions==="offWithInlineSuggestions"&&this.languageFeaturesService.inlineCompletionsProvider.has(e)&&gz(this._configurationService,e.uri,e.getLanguageId()))return;const n=[];if(i.wordBasedSuggestions==="currentDocument")aa(this._modelService,e.uri)&&n.push(e.uri);else for(const u of this._modelService.getModels())aa(this._modelService,u.uri)&&(u===e?n.unshift(u.uri):(i.wordBasedSuggestions==="allDocuments"||u.getLanguageId()===e.getLanguageId())&&n.push(u.uri));if(n.length===0)return;const s=this.languageConfigurationService.getLanguageConfiguration(e.getLanguageId()).getWordDefinition(),r=e.getWordAtPosition(t),a=r?new l.Range(t.lineNumber,r.startColumn,t.lineNumber,r.endColumn):l.Range.fromPositions(t),c=a.setEndPosition(t.lineNumber,t.column);this.logService.trace("[WordBasedCompletionItemProvider]",`word: "${r?.word||""}", wordDef: "${s}", replace: [${a.toString()}], insert: [${c.toString()}]`);const d=await(await this._workerManager.withWorker()).textualSuggest(n,r?.word,s);if(d)return{duration:d.duration,suggestions:d.words.map(u=>({kind:18,label:u,insertText:u,range:{insert:c,replace:a}}))}}}let AC=class extends l.Disposable{constructor(e,t,i){super(),this._workerDescriptor=e,this._modelService=t,this._webWorkerService=i,this._editorWorkerClient=null,this._lastWorkerUsedTime=new Date().getTime(),this._register(new sC).cancelAndSet(()=>this._checkStopIdleWorker(),Math.round(dE/2),Ae),this._register(this._modelService.onModelRemoved(s=>this._checkStopEmptyWorker()))}dispose(){this._editorWorkerClient&&(this._editorWorkerClient.dispose(),this._editorWorkerClient=null),super.dispose()}_checkStopEmptyWorker(){if(!this._editorWorkerClient)return;this._modelService.getModels().length===0&&(this._editorWorkerClient.dispose(),this._editorWorkerClient=null)}_checkStopIdleWorker(){if(!this._editorWorkerClient)return;new Date().getTime()-this._lastWorkerUsedTime>dE&&(this._editorWorkerClient.dispose(),this._editorWorkerClient=null)}withWorker(){return this._lastWorkerUsedTime=new Date().getTime(),this._editorWorkerClient||(this._editorWorkerClient=new yg(this._workerDescriptor,!1,this._modelService,this._webWorkerService)),Promise.resolve(this._editorWorkerClient)}};AC=NC([ps(1,ri),ps(2,fd)],AC);class pz{constructor(e){this._instance=e,this.proxy=this._instance}dispose(){this._instance.dispose()}setChannel(e,t){throw new Error("Not supported")}}let yg=class extends l.Disposable{constructor(e,t,i,n){super(),this._workerDescriptorOrWorker=e,this._disposed=!1,this._modelService=i,this._webWorkerService=n,this._keepIdleModels=t,this._worker=null,this._modelManager=null}fhr(e,t){throw new Error("Not implemented!")}_getOrCreateWorker(){if(!this._worker)try{this._worker=this._register(this._webWorkerService.createWorkerClient(this._workerDescriptorOrWorker)),l.EditorWorkerHost.setChannel(this._worker,this._createEditorWorkerHost())}catch(e){l.logOnceWebWorkerWarning(e),this._worker=this._createFallbackLocalWorker()}return this._worker}async _getProxy(){try{const e=this._getOrCreateWorker().proxy;return await e.$ping(),e}catch(e){return l.logOnceWebWorkerWarning(e),this._worker=this._createFallbackLocalWorker(),this._worker.proxy}}_createFallbackLocalWorker(){return new pz(new l.EditorWorker(null))}_createEditorWorkerHost(){return{$fhr:(e,t)=>this.fhr(e,t)}}_getOrCreateModelManager(e){return this._modelManager||(this._modelManager=this._register(new l.WorkerTextModelSyncClient(e,this._modelService,this._keepIdleModels))),this._modelManager}async workerWithSyncedResources(e,t=!1){if(this._disposed)return Promise.reject(l.canceled());const i=await this._getProxy();return this._getOrCreateModelManager(i).ensureSyncedResources(e,t),i}async textualSuggest(e,t,i){const n=await this.workerWithSyncedResources(e),s=i.source,r=i.flags;return n.$textualSuggest(e.map(a=>a.toString()),t,s,r)}dispose(){super.dispose(),this._disposed=!0}};yg=NC([ps(2,ri),ps(3,fd)],yg);function _z(o,e,t){return new bz(o,e,t)}class bz extends yg{constructor(e,t,i){super(i.worker,i.keepIdleModels||!1,e,t),this._foreignModuleHost=i.host||null,this._foreignProxy=this._getProxy().then(n=>new Proxy({},{get(s,r,a){if(r!=="then"){if(typeof r!="string")throw new Error("Not supported");return(...c)=>n.$fmr(r,c)}}}))}fhr(e,t){if(!this._foreignModuleHost||typeof this._foreignModuleHost[e]!="function")return Promise.reject(new Error("Missing method "+e+" or missing main thread foreign host."));try{return Promise.resolve(this._foreignModuleHost[e].apply(this._foreignModuleHost,t))}catch(i){return Promise.reject(i)}}getProxy(){return this._foreignProxy}withSyncedResources(e){return this.workerWithSyncedResources(e).then(t=>this.getProxy())}}const _d={ICodeEditor:"vs.editor.ICodeEditor",IDiffEditor:"vs.editor.IDiffEditor"},Hl=new class{clone(){return this}equals(o){return this===o}};function OC(o,e){return new l.TokenizationResult([new l.Token(0,"",o)],e)}function Lg(o,e){const t=new Uint32Array(2);return t[0]=0,t[1]=(o<<0|0|0|32768|2<<24)>>>0,new l.EncodedTokenizationResult(t,[],e===null?Hl:e)}function lo(o,e){const t=Bf();if(t?.createTrustedTypesPolicy)try{return t.createTrustedTypesPolicy(o,e)}catch(i){l.onUnexpectedError(i);return}try{return globalThis.trustedTypes?.createPolicy(o,e)}catch(i){l.onUnexpectedError(i);return}}class Vi{static getLanguageId(e){return(e&255)>>>0}static getTokenType(e){return(e&768)>>>8}static containsBalancedBrackets(e){return(e&1024)!==0}static getFontStyle(e){return(e&30720)>>>11}static getForeground(e){return(e&16744448)>>>15}static getBackground(e){return(e&4278190080)>>>24}static getClassNameFromMetadata(e){let i="mtk"+this.getForeground(e);const n=this.getFontStyle(e);return n&1&&(i+=" mtki"),n&2&&(i+=" mtkb"),n&4&&(i+=" mtku"),n&8&&(i+=" mtks"),i}static getInlineStyleFromMetadata(e,t){const i=this.getForeground(e),n=this.getFontStyle(e);let s=`color: ${t[i]};`;n&1&&(s+="font-style: italic;"),n&2&&(s+="font-weight: bold;");let r="";return n&4&&(r+=" underline"),n&8&&(r+=" line-through"),r&&(s+=`text-decoration:${r};`),s}static getPresentationFromMetadata(e){const t=this.getForeground(e),i=this.getFontStyle(e);return{foreground:t,italic:!!(i&1),bold:!!(i&2),underline:!!(i&4),strikethrough:!!(i&8)}}}const zo=class zo{static createEmpty(e,t){const i=zo.defaultTokenMetadata,n=new Uint32Array(2);return n[0]=e.length,n[1]=i,new zo(n,e,t)}static createFromTextAndMetadata(e,t){let i=0,n="";const s=new Array;for(const{text:r,metadata:a}of e)s.push(i+r.length,a),i+=r.length,n+=r;return new zo(new Uint32Array(s),n,t)}static convertToEndOffset(e,t){const n=(e.length>>>1)-1;for(let s=0;s<n;s++)e[s<<1]=e[s+1<<1];e[n<<1]=t}static findIndexInTokensArray(e,t){if(e.length<=2)return 0;let i=0,n=(e.length>>>1)-1;for(;i<n;){const s=i+Math.floor((n-i)/2),r=e[s<<1];if(r===t)return s+1;r<t?i=s+1:r>t&&(n=s)}return i}constructor(e,t,i){this._lineTokensBrand=void 0,(e.length>1?e[e.length-2]:0)!==t.length&&l.onUnexpectedError(new Error("Token length and text length do not match!")),this._tokens=e,this._tokensCount=this._tokens.length>>>1,this._text=t,this.languageIdCodec=i}getTextLength(){return this._text.length}equals(e){return e instanceof zo?this.slicedEquals(e,0,this._tokensCount):!1}slicedEquals(e,t,i){if(this._text!==e._text||this._tokensCount!==e._tokensCount)return!1;const n=t<<1,s=n+(i<<1);for(let r=n;r<s;r++)if(this._tokens[r]!==e._tokens[r])return!1;return!0}getLineContent(){return this._text}getCount(){return this._tokensCount}getStartOffset(e){return e>0?this._tokens[e-1<<1]:0}getMetadata(e){return this._tokens[(e<<1)+1]}getLanguageId(e){const t=this._tokens[(e<<1)+1],i=Vi.getLanguageId(t);return this.languageIdCodec.decodeLanguageId(i)}getStandardTokenType(e){const t=this._tokens[(e<<1)+1];return Vi.getTokenType(t)}getForeground(e){const t=this._tokens[(e<<1)+1];return Vi.getForeground(t)}getClassName(e){const t=this._tokens[(e<<1)+1];return Vi.getClassNameFromMetadata(t)}getInlineStyle(e,t){const i=this._tokens[(e<<1)+1];return Vi.getInlineStyleFromMetadata(i,t)}getPresentation(e){const t=this._tokens[(e<<1)+1];return Vi.getPresentationFromMetadata(t)}getEndOffset(e){return this._tokens[e<<1]}findTokenIndexAtOffset(e){return zo.findIndexInTokensArray(this._tokens,e)}inflate(){return this}sliceAndInflate(e,t,i){return new PC(this,e,t,i)}sliceZeroCopy(e){return this.sliceAndInflate(e.start,e.endExclusive,0)}withInserted(e){if(e.length===0)return this;let t=0,i=0,n="";const s=new Array;let r=0;for(;;){const a=t<this._tokensCount?this._tokens[t<<1]:-1,c=i<e.length?e[i]:null;if(a!==-1&&(c===null||a<=c.offset)){n+=this._text.substring(r,a);const h=this._tokens[(t<<1)+1];s.push(n.length,h),t++,r=a}else if(c){if(c.offset>r){n+=this._text.substring(r,c.offset);const h=this._tokens[(t<<1)+1];s.push(n.length,h),r=c.offset}n+=c.text,s.push(n.length,c.tokenMetadata),i++}else break}return new zo(new Uint32Array(s),n,this.languageIdCodec)}getTokensInRange(e){const t=new vz,i=this.findTokenIndexAtOffset(e.start),n=this.findTokenIndexAtOffset(e.endExclusive);for(let s=i;s<=n;s++){const a=new l.OffsetRange(this.getStartOffset(s),this.getEndOffset(s)).intersectionLength(e);a>0&&t.add(a,this.getMetadata(s))}return t.build()}getTokenText(e){const t=this.getStartOffset(e),i=this.getEndOffset(e);return this._text.substring(t,i)}forEach(e){const t=this.getCount();for(let i=0;i<t;i++)e(i)}toString(){let e="";return this.forEach(t=>{e+=`[${this.getTokenText(t)}]{${this.getClassName(t)}}`}),e}};zo.defaultTokenMetadata=(32768|2<<24)>>>0;let _t=zo;class PC{constructor(e,t,i,n){this._source=e,this._startOffset=t,this._endOffset=i,this._deltaOffset=n,this._firstTokenIndex=e.findTokenIndexAtOffset(t),this.languageIdCodec=e.languageIdCodec,this._tokensCount=0;for(let s=this._firstTokenIndex,r=e.getCount();s<r&&!(e.getStartOffset(s)>=i);s++)this._tokensCount++}getMetadata(e){return this._source.getMetadata(this._firstTokenIndex+e)}getLanguageId(e){return this._source.getLanguageId(this._firstTokenIndex+e)}getLineContent(){return this._source.getLineContent().substring(this._startOffset,this._endOffset)}equals(e){return e instanceof PC?this._startOffset===e._startOffset&&this._endOffset===e._endOffset&&this._deltaOffset===e._deltaOffset&&this._source.slicedEquals(e._source,this._firstTokenIndex,this._tokensCount):!1}getCount(){return this._tokensCount}getStandardTokenType(e){return this._source.getStandardTokenType(this._firstTokenIndex+e)}getForeground(e){return this._source.getForeground(this._firstTokenIndex+e)}getEndOffset(e){const t=this._source.getEndOffset(this._firstTokenIndex+e);return Math.min(this._endOffset,t)-this._startOffset+this._deltaOffset}getClassName(e){return this._source.getClassName(this._firstTokenIndex+e)}getInlineStyle(e,t){return this._source.getInlineStyle(this._firstTokenIndex+e,t)}getPresentation(e){return this._source.getPresentation(this._firstTokenIndex+e)}findTokenIndexAtOffset(e){return this._source.findTokenIndexAtOffset(e+this._startOffset-this._deltaOffset)-this._firstTokenIndex}getTokenText(e){const t=this._firstTokenIndex+e,i=this._source.getStartOffset(t),n=this._source.getEndOffset(t);let s=this._source.getTokenText(t);return i<this._startOffset&&(s=s.substring(this._startOffset-i)),n>this._endOffset&&(s=s.substring(0,s.length-(n-this._endOffset))),s}forEach(e){for(let t=0;t<this.getCount();t++)e(t)}}function Cz(o,e){const t=e.lineNumber;if(!o.tokenization.isCheapToTokenize(t))return;o.tokenization.forceTokenization(t);const i=o.tokenization.getLineTokens(t),n=i.findTokenIndexAtOffset(e.column-1);return i.getStandardTokenType(n)}class ec{static fromLineTokens(e){const t=[];for(let i=0;i<e.getCount();i++)t.push(new kC(e.getEndOffset(i)-e.getStartOffset(i),e.getMetadata(i)));return ec.create(t)}static create(e){return new ec(e)}constructor(e){this._tokenInfo=e}toLineTokens(e,t){return _t.createFromTextAndMetadata(this.map((i,n)=>({text:i.substring(e),metadata:n.metadata})),t)}forEach(e){let t=0;for(const i of this._tokenInfo){const n=new l.OffsetRange(t,t+i.length);e(n,i),t+=i.length}}map(e){const t=[];let i=0;for(const n of this._tokenInfo){const s=new l.OffsetRange(i,i+n.length);t.push(e(s,n)),i+=n.length}return t}slice(e){const t=[];let i=0;for(const n of this._tokenInfo){const s=i,r=s+n.length;if(r>e.start){if(s>=e.endExclusive)break;const a=Math.max(0,e.start-s),c=Math.max(0,r-e.endExclusive);t.push(new kC(n.length-a-c,n.metadata))}i+=n.length}return ec.create(t)}}class kC{constructor(e,t){this.length=e,this.metadata=t}}class vz{constructor(){this._tokens=[]}add(e,t){this._tokens.push(new kC(e,t))}build(){return ec.create(this._tokens)}}class Ji{constructor(e,t,i,n){this.startColumn=e,this.endColumn=t,this.className=i,this.type=n,this._lineDecorationBrand=void 0}static _equals(e,t){return e.startColumn===t.startColumn&&e.endColumn===t.endColumn&&e.className===t.className&&e.type===t.type}static equalsArr(e,t){const i=e.length,n=t.length;if(i!==n)return!1;for(let s=0;s<i;s++)if(!Ji._equals(e[s],t[s]))return!1;return!0}static extractWrapped(e,t,i){if(e.length===0)return e;const n=t+1,s=i+1,r=i-t,a=[];let c=0;for(const h of e)h.endColumn<=n||h.startColumn>=s||(a[c++]=new Ji(Math.max(1,h.startColumn-n+1),Math.min(r+1,h.endColumn-n+1),h.className,h.type));return a}static filter(e,t,i,n){if(e.length===0)return[];const s=[];let r=0;for(let a=0,c=e.length;a<c;a++){const h=e[a],d=h.range;if(d.endLineNumber<t||d.startLineNumber>t||d.isEmpty()&&(h.type===0||h.type===3))continue;const u=d.startLineNumber===t?d.startColumn:i,f=d.endLineNumber===t?d.endColumn:n;s[r++]=new Ji(u,f,h.inlineClassName,h.type)}return s}static _typeCompare(e,t){const i=[2,0,1,3];return i[e]-i[t]}static compare(e,t){if(e.startColumn!==t.startColumn)return e.startColumn-t.startColumn;if(e.endColumn!==t.endColumn)return e.endColumn-t.endColumn;const i=Ji._typeCompare(e.type,t.type);return i!==0?i:e.className!==t.className?e.className<t.className?-1:1:0}}class uE{constructor(e,t,i,n){this.startOffset=e,this.endOffset=t,this.className=i,this.metadata=n}}class Dg{constructor(){this.stopOffsets=[],this.classNames=[],this.metadata=[],this.count=0}static _metadata(e){let t=0;for(let i=0,n=e.length;i<n;i++)t|=e[i];return t}consumeLowerThan(e,t,i){for(;this.count>0&&this.stopOffsets[0]<e;){let n=0;for(;n+1<this.count&&this.stopOffsets[n]===this.stopOffsets[n+1];)n++;i.push(new uE(t,this.stopOffsets[n],this.classNames.join(" "),Dg._metadata(this.metadata))),t=this.stopOffsets[n]+1,this.stopOffsets.splice(0,n+1),this.classNames.splice(0,n+1),this.metadata.splice(0,n+1),this.count-=n+1}return this.count>0&&t<e&&(i.push(new uE(t,e-1,this.classNames.join(" "),Dg._metadata(this.metadata))),t=e),t}insert(e,t,i){if(this.count===0||this.stopOffsets[this.count-1]<=e)this.stopOffsets.push(e),this.classNames.push(t),this.metadata.push(i);else for(let n=0;n<this.count;n++)if(this.stopOffsets[n]>=e){this.stopOffsets.splice(n,0,e),this.classNames.splice(n,0,t),this.metadata.splice(n,0,i);break}this.count++}}class wz{static normalize(e,t){if(t.length===0)return[];const i=[],n=new Dg;let s=0;for(let r=0,a=t.length;r<a;r++){const c=t[r];let h=c.startColumn,d=c.endColumn;const u=c.className,f=c.type===1?2:c.type===2?4:0;if(h>1){const p=e.charCodeAt(h-2);l.isHighSurrogate(p)&&h--}if(d>1){const p=e.charCodeAt(d-2);l.isHighSurrogate(p)&&d--}const g=h-1,m=d-2;s=n.consumeLowerThan(g,s,i),n.count===0&&(s=g),n.insert(m,u,f)}return n.consumeLowerThan(1073741824,s,i),i}}class bt{constructor(e,t,i,n){this.endIndex=e,this.type=t,this.metadata=i,this.containsRTL=n,this._linePartBrand=void 0}isWhitespace(){return!!(this.metadata&1)}isPseudoAfter(){return!!(this.metadata&4)}}class Wo{get isLTR(){return!this.containsRTL&&this.textDirection!==l.TextDirection.RTL}constructor(e,t,i,n,s,r,a,c,h,d,u,f,g,m,p,b,v,C,w,S,L,D=!1){this.useMonospaceOptimizations=e,this.canUseHalfwidthRightwardsArrow=t,this.lineContent=i,this.continuesWithWrappedLine=n,this.isBasicASCII=s,this.containsRTL=r,this.fauxIndentLength=a,this.lineTokens=c,this.lineDecorations=h.sort(Ji.compare),this.tabSize=d,this.startVisibleColumn=u,this.spaceWidth=f,this.stopRenderingLineAfter=p,this.renderWhitespace=b==="all"?4:b==="boundary"?1:b==="selection"?2:b==="trailing"?3:0,this.renderControlCharacters=v,this.fontLigatures=C,this.selectionsOnLine=w&&w.sort((T,M)=>T.start<M.start?-1:1),this.renderNewLineWhenEmpty=D,this.textDirection=S,this.verticalScrollbarSize=L;const x=Math.abs(m-f),I=Math.abs(g-f);x<I?(this.renderSpaceWidth=m,this.renderSpaceCharCode=11825):(this.renderSpaceWidth=g,this.renderSpaceCharCode=183)}sameSelection(e){if(this.selectionsOnLine===null)return e===null;if(e===null||e.length!==this.selectionsOnLine.length)return!1;for(let t=0;t<this.selectionsOnLine.length;t++)if(!this.selectionsOnLine[t].equals(e[t]))return!1;return!0}equals(e){return this.useMonospaceOptimizations===e.useMonospaceOptimizations&&this.canUseHalfwidthRightwardsArrow===e.canUseHalfwidthRightwardsArrow&&this.lineContent===e.lineContent&&this.continuesWithWrappedLine===e.continuesWithWrappedLine&&this.isBasicASCII===e.isBasicASCII&&this.containsRTL===e.containsRTL&&this.fauxIndentLength===e.fauxIndentLength&&this.tabSize===e.tabSize&&this.startVisibleColumn===e.startVisibleColumn&&this.spaceWidth===e.spaceWidth&&this.renderSpaceWidth===e.renderSpaceWidth&&this.renderSpaceCharCode===e.renderSpaceCharCode&&this.stopRenderingLineAfter===e.stopRenderingLineAfter&&this.renderWhitespace===e.renderWhitespace&&this.renderControlCharacters===e.renderControlCharacters&&this.fontLigatures===e.fontLigatures&&Ji.equalsArr(this.lineDecorations,e.lineDecorations)&&this.lineTokens.equals(e.lineTokens)&&this.sameSelection(e.selectionsOnLine)&&this.textDirection===e.textDirection&&this.verticalScrollbarSize===e.verticalScrollbarSize&&this.renderNewLineWhenEmpty===e.renderNewLineWhenEmpty}}class fE{constructor(e,t){this.partIndex=e,this.charIndex=t}}class _s{static getPartIndex(e){return(e&4294901760)>>>16}static getCharIndex(e){return(e&65535)>>>0}constructor(e,t){this.length=e,this._data=new Uint32Array(this.length),this._horizontalOffset=new Uint32Array(this.length)}setColumnInfo(e,t,i,n){const s=(t<<16|i<<0)>>>0;this._data[e-1]=s,this._horizontalOffset[e-1]=n}getHorizontalOffset(e){return this._horizontalOffset.length===0?0:this._horizontalOffset[e-1]}charOffsetToPartData(e){return this.length===0?0:e<0?this._data[0]:e>=this.length?this._data[this.length-1]:this._data[e]}getDomPosition(e){const t=this.charOffsetToPartData(e-1),i=_s.getPartIndex(t),n=_s.getCharIndex(t);return new fE(i,n)}getColumn(e,t){return this.partDataToCharOffset(e.partIndex,t,e.charIndex)+1}partDataToCharOffset(e,t,i){if(this.length===0)return 0;const n=(e<<16|i<<0)>>>0;let s=0,r=this.length-1;for(;s+1<r;){const p=s+r>>>1,b=this._data[p];if(b===n)return p;b>n?r=p:s=p}if(s===r)return s;const a=this._data[s],c=this._data[r];if(a===n)return s;if(c===n)return r;const h=_s.getPartIndex(a),d=_s.getCharIndex(a),u=_s.getPartIndex(c);let f;h!==u?f=t:f=_s.getCharIndex(c);const g=i-d,m=f-i;return g<=m?s:r}}class xg{constructor(e,t){this._renderLineOutputBrand=void 0,this.characterMapping=e,this.containsForeignElements=t}}function bd(o,e){if(o.lineContent.length===0){if(o.lineDecorations.length>0){e.appendString("<span>");let t=0,i=0,n=0;for(const r of o.lineDecorations)(r.type===1||r.type===2)&&(e.appendString('<span class="'),e.appendString(r.className),e.appendString('"></span>'),r.type===1&&(n|=1,t++),r.type===2&&(n|=2,i++));e.appendString("</span>");const s=new _s(1,t+i);return s.setColumnInfo(1,t,0,0),new xg(s,n)}return o.renderNewLineWhenEmpty?e.appendString(`<span><span>
|
||
</span></span>`):e.appendString("<span><span></span></span>"),new xg(new _s(0,0),0)}return Rz(Lz(o),e)}class Sz{constructor(e,t,i){this.characterMapping=e,this.html=t,this.containsForeignElements=i}}function Eg(o){const e=new ra(1e4),t=bd(o,e);return new Sz(t.characterMapping,e.build(),t.containsForeignElements)}class yz{constructor(e,t,i,n,s,r,a,c,h,d,u,f,g,m,p){this.fontIsMonospace=e,this.canUseHalfwidthRightwardsArrow=t,this.lineContent=i,this.len=n,this.isOverflowing=s,this.overflowingCharCount=r,this.parts=a,this.containsForeignElements=c,this.fauxIndentLength=h,this.tabSize=d,this.startVisibleColumn=u,this.spaceWidth=f,this.renderSpaceCharCode=g,this.renderWhitespace=m,this.renderControlCharacters=p}}function Lz(o){const e=o.lineContent;let t,i,n;o.stopRenderingLineAfter!==-1&&o.stopRenderingLineAfter<e.length?(t=!0,i=e.length-o.stopRenderingLineAfter,n=o.stopRenderingLineAfter):(t=!1,i=0,n=e.length);let s=Dz(e,o.containsRTL,o.lineTokens,o.fauxIndentLength,n);o.renderControlCharacters&&!o.isBasicASCII&&(s=Iz(e,s)),(o.renderWhitespace===4||o.renderWhitespace===1||o.renderWhitespace===2&&o.selectionsOnLine||o.renderWhitespace===3&&!o.continuesWithWrappedLine)&&(s=Tz(o,e,n,s));let r=0;if(o.lineDecorations.length>0){for(let a=0,c=o.lineDecorations.length;a<c;a++){const h=o.lineDecorations[a];h.type===3||h.type===1?r|=1:h.type===2&&(r|=2)}s=Nz(e,n,s,o.lineDecorations)}return o.containsRTL?s=Ez(e,s):s=xz(e,s,!o.isBasicASCII||o.fontLigatures),new yz(o.useMonospaceOptimizations,o.canUseHalfwidthRightwardsArrow,e,n,t,i,s,r,o.fauxIndentLength,o.tabSize,o.startVisibleColumn,o.spaceWidth,o.renderSpaceCharCode,o.renderWhitespace,o.renderControlCharacters)}function Dz(o,e,t,i,n){const s=[];let r=0;i>0&&(s[r++]=new bt(i,"",0,!1));let a=i;for(let c=0,h=t.getCount();c<h;c++){const d=t.getEndOffset(c);if(d<=i)continue;const u=t.getClassName(c);if(d>=n){const g=e?l.containsRTL(o.substring(a,n)):!1;s[r++]=new bt(n,u,0,g);break}const f=e?l.containsRTL(o.substring(a,d)):!1;s[r++]=new bt(d,u,0,f),a=d}return s}function xz(o,e,t){let i=0;const n=[];let s=0;if(t)for(let r=0,a=e.length;r<a;r++){const c=e[r],h=c.endIndex;if(i+50<h){const d=c.type,u=c.metadata,f=c.containsRTL;let g=-1,m=i;for(let p=i;p<h;p++)o.charCodeAt(p)===32&&(g=p),g!==-1&&p-m>=50&&(n[s++]=new bt(g+1,d,u,f),m=g+1,g=-1);m!==h&&(n[s++]=new bt(h,d,u,f))}else n[s++]=c;i=h}else for(let r=0,a=e.length;r<a;r++){const c=e[r],h=c.endIndex,d=h-i;if(d>50){const u=c.type,f=c.metadata,g=c.containsRTL,m=Math.ceil(d/50);for(let p=1;p<m;p++){const b=i+p*50;n[s++]=new bt(b,u,f,g)}n[s++]=new bt(h,u,f,g)}else n[s++]=c;i=h}return n}function Ez(o,e){if(e.length===0)return e;const t=e[0];if(!t.containsRTL)return e;const i=t.endIndex;let n=0;for(let r=0;r<i;r++){const a=o.charCodeAt(r);if(a!==32&&a!==9){n=r;break}}if(n===0)return e;const s=[];s.push(new bt(n,t.type,t.metadata,!1)),s.push(new bt(i,t.type,t.metadata,t.containsRTL));for(let r=1;r<e.length;r++)s.push(e[r]);return s}function gE(o){return o<32?o!==9:o===127||o>=8234&&o<=8238||o>=8294&&o<=8297||o>=8206&&o<=8207||o===1564}function Iz(o,e){const t=[];let i=new bt(0,"",0,!1),n=0;for(const s of e){const r=s.endIndex;for(;n<r;n++){const a=o.charCodeAt(n);gE(a)&&(n>i.endIndex&&(i=new bt(n,s.type,s.metadata,s.containsRTL),t.push(i)),i=new bt(n+1,"mtkcontrol",s.metadata,!1),t.push(i))}n>i.endIndex&&(i=new bt(r,s.type,s.metadata,s.containsRTL),t.push(i))}return t}function Tz(o,e,t,i){const n=o.continuesWithWrappedLine,s=o.fauxIndentLength,r=o.tabSize,a=o.startVisibleColumn,c=o.useMonospaceOptimizations,h=o.selectionsOnLine,d=o.renderWhitespace===1,u=o.renderWhitespace===3,f=o.renderSpaceWidth!==o.spaceWidth,g=[];let m=0,p=0,b=i[p].type,v=i[p].containsRTL,C=i[p].endIndex;const w=i.length;let S=!1,L=l.firstNonWhitespaceIndex(e),D;L===-1?(S=!0,L=t,D=t):D=l.lastNonWhitespaceIndex(e);let x=!1,I=0,T=h&&h[I],M=a%r;for(let P=s;P<t;P++){const k=e.charCodeAt(P);T&&T.endExclusive<=P&&(I++,T=h&&h[I]);let U;if(P<L||P>D)U=!0;else if(k===9)U=!0;else if(k===32)if(d)if(x)U=!0;else{const B=P+1<t?e.charCodeAt(P+1):0;U=B===32||B===9}else U=!0;else U=!1;if(U&&h&&(U=!!T&&T.start<=P&&P<T.endExclusive),U&&u&&(U=S||P>D),U&&v&&P>=L&&P<=D&&(U=!1),x){if(!U||!c&&M>=r){if(f){const B=m>0?g[m-1].endIndex:s;for(let G=B+1;G<=P;G++)g[m++]=new bt(G,"mtkw",1,!1)}else g[m++]=new bt(P,"mtkw",1,!1);M=M%r}}else(P===C||U&&P>s)&&(g[m++]=new bt(P,b,0,v),M=M%r);for(k===9?M=r:l.isFullWidthCharacter(k)?M+=2:M++,x=U;P===C&&(p++,p<w);)b=i[p].type,v=i[p].containsRTL,C=i[p].endIndex}let O=!1;if(x)if(n&&d){const P=t>0?e.charCodeAt(t-1):0,k=t>1?e.charCodeAt(t-2):0;P===32&&k!==32&&k!==9||(O=!0)}else O=!0;if(O)if(f){const P=m>0?g[m-1].endIndex:s;for(let k=P+1;k<=t;k++)g[m++]=new bt(k,"mtkw",1,!1)}else g[m++]=new bt(t,"mtkw",1,!1);else g[m++]=new bt(t,b,0,v);return g}function Nz(o,e,t,i){i.sort(Ji.compare);const n=wz.normalize(o,i),s=n.length;let r=0;const a=[];let c=0,h=0;for(let u=0,f=t.length;u<f;u++){const g=t[u],m=g.endIndex,p=g.type,b=g.metadata,v=g.containsRTL;for(;r<s&&n[r].startOffset<m;){const C=n[r];if(C.startOffset>h&&(h=C.startOffset,a[c++]=new bt(h,p,b,v)),C.endOffset+1<=m)h=C.endOffset+1,a[c++]=new bt(h,p+" "+C.className,b|C.metadata,v),r++;else{h=m,a[c++]=new bt(h,p+" "+C.className,b|C.metadata,v);break}}m>h&&(h=m,a[c++]=new bt(h,p,b,v))}const d=t[t.length-1].endIndex;if(r<s&&n[r].startOffset===d)for(;r<s&&n[r].startOffset===d;){const u=n[r];a[c++]=new bt(h,u.className,u.metadata,!1),r++}return a}function Rz(o,e){const t=o.fontIsMonospace,i=o.canUseHalfwidthRightwardsArrow,n=o.containsForeignElements,s=o.lineContent,r=o.len,a=o.isOverflowing,c=o.overflowingCharCount,h=o.parts,d=o.fauxIndentLength,u=o.tabSize,f=o.startVisibleColumn,g=o.spaceWidth,m=o.renderSpaceCharCode,p=o.renderWhitespace,b=o.renderControlCharacters,v=new _s(r+1,h.length);let C=!1,w=0,S=f,L=0,D=0,x=0;e.appendString("<span>");for(let I=0,T=h.length;I<T;I++){const M=h[I],O=M.endIndex,P=M.type,k=M.containsRTL,U=p!==0&&M.isWhitespace(),B=U&&!t&&(P==="mtkw"||!n),G=w===O&&M.isPseudoAfter();if(L=0,e.appendString("<span "),k&&e.appendString('style="unicode-bidi:isolate" '),e.appendString('class="'),e.appendString(B?"mtkz":P),e.appendASCIICharCode(34),U){let X=0;{let re=w,Y=S;for(;re<O;re++){const Ee=(s.charCodeAt(re)===9?u-Y%u:1)|0;X+=Ee,re>=d&&(Y+=Ee)}}for(B&&(e.appendString(' style="width:'),e.appendString(String(g*X)),e.appendString('px"')),e.appendASCIICharCode(62);w<O;w++){v.setColumnInfo(w+1,I-x,L,D),x=0;const re=s.charCodeAt(w);let Y,ee;if(re===9){Y=u-S%u|0,ee=Y,!i||ee>1?e.appendCharCode(8594):e.appendCharCode(65515);for(let Ee=2;Ee<=ee;Ee++)e.appendCharCode(160)}else Y=2,ee=1,e.appendCharCode(m),e.appendCharCode(8204);L+=Y,D+=ee,w>=d&&(S+=ee)}}else for(e.appendASCIICharCode(62);w<O;w++){v.setColumnInfo(w+1,I-x,L,D),x=0;const X=s.charCodeAt(w);let re=1,Y=1;switch(X){case 9:re=u-S%u,Y=re;for(let ee=1;ee<=re;ee++)e.appendCharCode(160);break;case 32:e.appendCharCode(160);break;case 60:e.appendString("<");break;case 62:e.appendString(">");break;case 38:e.appendString("&");break;case 0:b?e.appendCharCode(9216):e.appendString("�");break;case 65279:case 8232:case 8233:case 133:e.appendCharCode(65533);break;default:l.isFullWidthCharacter(X)&&Y++,b&&X<32?e.appendCharCode(9216+X):b&&X===127?e.appendCharCode(9249):b&&gE(X)?(e.appendString("[U+"),e.appendString(Mz(X)),e.appendString("]"),re=8,Y=re):e.appendCharCode(X)}L+=re,D+=Y,w>=d&&(S+=Y)}G?x++:x=0,w>=r&&!C&&M.isPseudoAfter()&&(C=!0,v.setColumnInfo(w+1,I,L,D)),e.appendString("</span>")}return C||v.setColumnInfo(r+1,h.length-1,L,D),a&&(e.appendString('<span class="mtkoverflow">'),e.appendString(l.localize(832,"Show more ({0})",Az(c))),e.appendString("</span>")),e.appendString("</span>"),new xg(v,n)}function Mz(o){return o.toString(16).toUpperCase().padStart(4,"0")}function Az(o){return o<1024?l.localize(833,"{0} chars",o):o<1024*1024?`${(o/1024).toFixed(1)} KB`:`${(o/1024/1024).toFixed(1)} MB`}class mE{constructor(e,t,i,n){this._viewportBrand=void 0,this.top=e|0,this.left=t|0,this.width=i|0,this.height=n|0}}class Oz{constructor(e,t){this.tabSize=e,this.data=t}}class FC{constructor(e,t,i,n,s,r,a){this._viewLineDataBrand=void 0,this.content=e,this.continuesWithWrappedLine=t,this.minColumn=i,this.maxColumn=n,this.startVisibleColumn=s,this.tokens=r,this.inlineDecorations=a}}class Wi{constructor(e,t,i,n,s,r,a,c,h,d,u,f){this.minColumn=e,this.maxColumn=t,this.content=i,this.continuesWithWrappedLine=n,this.isBasicASCII=Wi.isBasicASCII(i,r),this.containsRTL=Wi.containsRTL(i,this.isBasicASCII,s),this.tokens=a,this.inlineDecorations=c,this.tabSize=h,this.startVisibleColumn=d,this.textDirection=u,this.hasVariableFonts=f}static isBasicASCII(e,t){return t?l.isBasicASCII(e):!0}static containsRTL(e,t,i){return!t&&i?l.containsRTL(e):!1}}class Cd{constructor(e,t,i){this.color=e,this.zIndex=t,this.data=i}static compareByRenderingProps(e,t){return e.zIndex===t.zIndex?e.color<t.color?-1:e.color>t.color?1:0:e.zIndex-t.zIndex}static equals(e,t){return e.color===t.color&&e.zIndex===t.zIndex&&l.equals(e.data,t.data)}static equalsArr(e,t){return l.equals(e,t,Cd.equals)}}function Pz(o){return Array.isArray(o)}function kz(o){return!Pz(o)}function pE(o){return typeof o=="string"}function _E(o){return!pE(o)}function la(o){return!o}function co(o,e){return o.ignoreCase&&e?e.toLowerCase():e}function bE(o){return o.replace(/[&<>'"_]/g,"-")}function Fz(o,e){console.log(`${o.languageId}: ${e}`)}function je(o,e){return new Error(`${o.languageId}: ${e}`)}function Ho(o,e,t,i,n){const s=/\$((\$)|(#)|(\d\d?)|[sS](\d\d?)|@(\w+))/g;let r=null;return e.replace(s,function(a,c,h,d,u,f,g,m,p){return la(h)?la(d)?!la(u)&&u<i.length?co(o,i[u]):!la(g)&&o&&typeof o[g]=="string"?o[g]:(r===null&&(r=n.split("."),r.unshift(n)),!la(f)&&f<r.length?co(o,r[f]):""):co(o,t):"$"})}function Bz(o,e,t){const i=/\$[sS](\d\d?)/g;let n=null;return e.replace(i,function(s,r){return n===null&&(n=t.split("."),n.unshift(t)),!la(r)&&r<n.length?l.escapeRegExpCharacters(co(o,n[r])):""})}function Ig(o,e){let t=e;for(;t&&t.length>0;){const i=o.tokenizer[t];if(i)return i;const n=t.lastIndexOf(".");n<0?t=null:t=t.substr(0,n)}return null}function zz(o,e){let t=e;for(;t&&t.length>0;){if(o.stateNames[t])return!0;const n=t.lastIndexOf(".");n<0?t=null:t=t.substr(0,n)}return!1}var Vz=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},Uz=function(o,e){return function(t,i){e(t,i,o)}},BC;const CE=5,Y_=class Y_{static create(e,t){return this._INSTANCE.create(e,t)}constructor(e){this._maxCacheDepth=e,this._entries=Object.create(null)}create(e,t){if(e!==null&&e.depth>=this._maxCacheDepth)return new tc(e,t);let i=tc.getStackElementId(e);i.length>0&&(i+="|"),i+=t;let n=this._entries[i];return n||(n=new tc(e,t),this._entries[i]=n,n)}};Y_._INSTANCE=new Y_(CE);let vd=Y_;class tc{constructor(e,t){this.parent=e,this.state=t,this.depth=(this.parent?this.parent.depth:0)+1}static getStackElementId(e){let t="";for(;e!==null;)t.length>0&&(t+="|"),t+=e.state,e=e.parent;return t}static _equals(e,t){for(;e!==null&&t!==null;){if(e===t)return!0;if(e.state!==t.state)return!1;e=e.parent,t=t.parent}return e===null&&t===null}equals(e){return tc._equals(this,e)}push(e){return vd.create(this,e)}pop(){return this.parent}popall(){let e=this;for(;e.parent;)e=e.parent;return e}switchTo(e){return vd.create(this.parent,e)}}class ic{constructor(e,t){this.languageId=e,this.state=t}equals(e){return this.languageId===e.languageId&&this.state.equals(e.state)}clone(){return this.state.clone()===this.state?this:new ic(this.languageId,this.state)}}const Z_=class Z_{static create(e,t){return this._INSTANCE.create(e,t)}constructor(e){this._maxCacheDepth=e,this._entries=Object.create(null)}create(e,t){if(t!==null)return new wd(e,t);if(e!==null&&e.depth>=this._maxCacheDepth)return new wd(e,t);const i=tc.getStackElementId(e);let n=this._entries[i];return n||(n=new wd(e,null),this._entries[i]=n,n)}};Z_._INSTANCE=new Z_(CE);let er=Z_;class wd{constructor(e,t){this.stack=e,this.embeddedLanguageData=t}clone(){return(this.embeddedLanguageData?this.embeddedLanguageData.clone():null)===this.embeddedLanguageData?this:er.create(this.stack,this.embeddedLanguageData)}equals(e){return!(e instanceof wd)||!this.stack.equals(e.stack)?!1:this.embeddedLanguageData===null&&e.embeddedLanguageData===null?!0:this.embeddedLanguageData===null||e.embeddedLanguageData===null?!1:this.embeddedLanguageData.equals(e.embeddedLanguageData)}}class $z{constructor(){this._tokens=[],this._languageId=null,this._lastTokenType=null,this._lastTokenLanguage=null}enterLanguage(e){this._languageId=e}emit(e,t){this._lastTokenType===t&&this._lastTokenLanguage===this._languageId||(this._lastTokenType=t,this._lastTokenLanguage=this._languageId,this._tokens.push(new l.Token(e,t,this._languageId)))}nestedLanguageTokenize(e,t,i,n){const s=i.languageId,r=i.state,a=l.TokenizationRegistry.get(s);if(!a)return this.enterLanguage(s),this.emit(n,""),r;const c=a.tokenize(e,t,r);if(n!==0)for(const h of c.tokens)this._tokens.push(new l.Token(h.offset+n,h.type,h.language));else this._tokens=this._tokens.concat(c.tokens);return this._lastTokenType=null,this._lastTokenLanguage=null,this._languageId=null,c.endState}finalize(e){return new l.TokenizationResult(this._tokens,e)}}class Tg{constructor(e,t){this._languageService=e,this._theme=t,this._prependTokens=null,this._tokens=[],this._currentLanguageId=0,this._lastTokenMetadata=0}enterLanguage(e){this._currentLanguageId=this._languageService.languageIdCodec.encodeLanguageId(e)}emit(e,t){const i=this._theme.match(this._currentLanguageId,t)|1024;this._lastTokenMetadata!==i&&(this._lastTokenMetadata=i,this._tokens.push(e),this._tokens.push(i))}static _merge(e,t,i){const n=e!==null?e.length:0,s=t.length,r=i!==null?i.length:0;if(n===0&&s===0&&r===0)return new Uint32Array(0);if(n===0&&s===0)return i;if(s===0&&r===0)return e;const a=new Uint32Array(n+s+r);e!==null&&a.set(e);for(let c=0;c<s;c++)a[n+c]=t[c];return i!==null&&a.set(i,n+s),a}nestedLanguageTokenize(e,t,i,n){const s=i.languageId,r=i.state,a=l.TokenizationRegistry.get(s);if(!a)return this.enterLanguage(s),this.emit(n,""),r;const c=a.tokenizeEncoded(e,t,r);if(n!==0)for(let h=0,d=c.tokens.length;h<d;h+=2)c.tokens[h]+=n;return this._prependTokens=Tg._merge(this._prependTokens,this._tokens,c.tokens),this._tokens=[],this._currentLanguageId=0,this._lastTokenMetadata=0,c.endState}finalize(e){return new l.EncodedTokenizationResult(Tg._merge(this._prependTokens,this._tokens,null),[],e)}}let Sd=BC=class extends l.Disposable{constructor(e,t,i,n,s){super(),this._configurationService=s,this._languageService=e,this._standaloneThemeService=t,this._languageId=i,this._lexer=n,this._embeddedLanguages=Object.create(null),this.embeddedLoaded=Promise.resolve(void 0);let r=!1;this._register(l.TokenizationRegistry.onDidChange(a=>{if(r)return;let c=!1;for(let h=0,d=a.changedLanguages.length;h<d;h++){const u=a.changedLanguages[h];if(this._embeddedLanguages[u]){c=!0;break}}c&&(r=!0,l.TokenizationRegistry.handleChange([this._languageId]),r=!1)})),this._maxTokenizationLineLength=this._configurationService.getValue("editor.maxTokenizationLineLength",{overrideIdentifier:this._languageId}),this._register(this._configurationService.onDidChangeConfiguration(a=>{a.affectsConfiguration("editor.maxTokenizationLineLength")&&(this._maxTokenizationLineLength=this._configurationService.getValue("editor.maxTokenizationLineLength",{overrideIdentifier:this._languageId}))}))}getLoadStatus(){const e=[];for(const t in this._embeddedLanguages){const i=l.TokenizationRegistry.get(t);if(i){if(i instanceof BC){const n=i.getLoadStatus();n.loaded===!1&&e.push(n.promise)}continue}l.TokenizationRegistry.isResolved(t)||e.push(l.TokenizationRegistry.getOrCreate(t))}return e.length===0?{loaded:!0}:{loaded:!1,promise:Promise.all(e).then(t=>{})}}getInitialState(){const e=vd.create(null,this._lexer.start);return er.create(e,null)}tokenize(e,t,i){if(e.length>=this._maxTokenizationLineLength)return OC(this._languageId,i);const n=new $z,s=this._tokenize(e,t,i,n);return n.finalize(s)}tokenizeEncoded(e,t,i){if(e.length>=this._maxTokenizationLineLength)return Lg(this._languageService.languageIdCodec.encodeLanguageId(this._languageId),i);const n=new Tg(this._languageService,this._standaloneThemeService.getColorTheme().tokenTheme),s=this._tokenize(e,t,i,n);return n.finalize(s)}_tokenize(e,t,i,n){return i.embeddedLanguageData?this._nestedTokenize(e,t,i,0,n):this._myTokenize(e,t,i,0,n)}_findLeavingNestedLanguageOffset(e,t){let i=this._lexer.tokenizer[t.stack.state];if(!i&&(i=Ig(this._lexer,t.stack.state),!i))throw je(this._lexer,"tokenizer state is not defined: "+t.stack.state);let n=-1,s=!1;for(const r of i){if(!_E(r.action)||!(r.action.nextEmbedded==="@pop"||r.action.hasEmbeddedEndInCases))continue;s=!0;let a=r.resolveRegex(t.stack.state);const c=a.source;if(c.substr(0,4)==="^(?:"&&c.substr(c.length-1,1)===")"){const d=(a.ignoreCase?"i":"")+(a.unicode?"u":"");a=new RegExp(c.substr(4,c.length-5),d)}const h=e.search(a);h===-1||h!==0&&r.matchOnlyAtLineStart||(n===-1||h<n)&&(n=h)}if(!s)throw je(this._lexer,'no rule containing nextEmbedded: "@pop" in tokenizer embedded state: '+t.stack.state);return n}_nestedTokenize(e,t,i,n,s){const r=this._findLeavingNestedLanguageOffset(e,i);if(r===-1){const h=s.nestedLanguageTokenize(e,t,i.embeddedLanguageData,n);return er.create(i.stack,new ic(i.embeddedLanguageData.languageId,h))}const a=e.substring(0,r);a.length>0&&s.nestedLanguageTokenize(a,!1,i.embeddedLanguageData,n);const c=e.substring(r);return this._myTokenize(c,t,i,n+r,s)}_safeRuleName(e){return e?e.name:"(unknown)"}_myTokenize(e,t,i,n,s){s.enterLanguage(this._languageId);const r=e.length,a=t&&this._lexer.includeLF?e+`
|
||
`:e,c=a.length;let h=i.embeddedLanguageData,d=i.stack,u=0,f=null,g=!0;for(;g||u<c;){const m=u,p=d.depth,b=f?f.groups.length:0,v=d.state;let C=null,w=null,S=null,L=null,D=null;if(f){C=f.matches;const T=f.groups.shift();w=T.matched,S=T.action,L=f.rule,f.groups.length===0&&(f=null)}else{if(!g&&u>=c)break;g=!1;let T=this._lexer.tokenizer[v];if(!T&&(T=Ig(this._lexer,v),!T))throw je(this._lexer,"tokenizer state is not defined: "+v);const M=a.substr(u);for(const O of T)if((u===0||!O.matchOnlyAtLineStart)&&(C=M.match(O.resolveRegex(v)),C)){w=C[0],S=O.action;break}}if(C||(C=[""],w=""),S||(u<c&&(C=[a.charAt(u)],w=C[0]),S=this._lexer.defaultToken),w===null)break;for(u+=w.length;kz(S)&&_E(S)&&S.test;)S=S.test(w,C,v,u===c);let x=null;if(typeof S=="string"||Array.isArray(S))x=S;else if(S.group)x=S.group;else if(S.token!==null&&S.token!==void 0){if(S.tokenSubst?x=Ho(this._lexer,S.token,w,C,v):x=S.token,S.nextEmbedded)if(S.nextEmbedded==="@pop"){if(!h)throw je(this._lexer,"cannot pop embedded language if not inside one");h=null}else{if(h)throw je(this._lexer,"cannot enter embedded language from within an embedded language");D=Ho(this._lexer,S.nextEmbedded,w,C,v)}if(S.goBack&&(u=Math.max(0,u-S.goBack)),S.switchTo&&typeof S.switchTo=="string"){let T=Ho(this._lexer,S.switchTo,w,C,v);if(T[0]==="@"&&(T=T.substr(1)),Ig(this._lexer,T))d=d.switchTo(T);else throw je(this._lexer,"trying to switch to a state '"+T+"' that is undefined in rule: "+this._safeRuleName(L))}else{if(S.transform&&typeof S.transform=="function")throw je(this._lexer,"action.transform not supported");if(S.next)if(S.next==="@push"){if(d.depth>=this._lexer.maxStack)throw je(this._lexer,"maximum tokenizer stack size reached: ["+d.state+","+d.parent.state+",...]");d=d.push(v)}else if(S.next==="@pop"){if(d.depth<=1)throw je(this._lexer,"trying to pop an empty stack in rule: "+this._safeRuleName(L));d=d.pop()}else if(S.next==="@popall")d=d.popall();else{let T=Ho(this._lexer,S.next,w,C,v);if(T[0]==="@"&&(T=T.substr(1)),Ig(this._lexer,T))d=d.push(T);else throw je(this._lexer,"trying to set a next state '"+T+"' that is undefined in rule: "+this._safeRuleName(L))}}S.log&&typeof S.log=="string"&&Fz(this._lexer,this._lexer.languageId+": "+Ho(this._lexer,S.log,w,C,v))}if(x===null)throw je(this._lexer,"lexer rule has no well-defined action in rule: "+this._safeRuleName(L));const I=T=>{const M=this._languageService.getLanguageIdByLanguageName(T)||this._languageService.getLanguageIdByMimeType(T)||T,O=this._getNestedEmbeddedLanguageData(M);if(u<c){const P=e.substr(u);return this._nestedTokenize(P,t,er.create(d,O),n+u,s)}else return er.create(d,O)};if(Array.isArray(x)){if(f&&f.groups.length>0)throw je(this._lexer,"groups cannot be nested: "+this._safeRuleName(L));if(C.length!==x.length+1)throw je(this._lexer,"matched number of groups does not match the number of actions in rule: "+this._safeRuleName(L));let T=0;for(let M=1;M<C.length;M++)T+=C[M].length;if(T!==w.length)throw je(this._lexer,"with groups, all characters should be matched in consecutive groups in rule: "+this._safeRuleName(L));f={rule:L,matches:C,groups:[]};for(let M=0;M<x.length;M++)f.groups[M]={action:x[M],matched:C[M+1]};u-=w.length;continue}else{if(x==="@rematch"&&(u-=w.length,w="",C=null,x="",D!==null))return I(D);if(w.length===0){if(c===0||p!==d.depth||v!==d.state||(f?f.groups.length:0)!==b)continue;throw je(this._lexer,"no progress in tokenizer in rule: "+this._safeRuleName(L))}let T=null;if(pE(x)&&x.indexOf("@brackets")===0){const M=x.substr(9),O=Kz(this._lexer,w);if(!O)throw je(this._lexer,"@brackets token returned but no bracket defined as: "+w);T=bE(O.token+M)}else{const M=x===""?"":x+this._lexer.tokenPostfix;T=bE(M)}m<r&&s.emit(m+n,T)}if(D!==null)return I(D)}return er.create(d,h)}_getNestedEmbeddedLanguageData(e){if(!this._languageService.isRegisteredLanguageId(e))return new ic(e,Hl);e!==this._languageId&&(this._languageService.requestBasicLanguageFeatures(e),l.TokenizationRegistry.getOrCreate(e),this._embeddedLanguages[e]=!0);const t=l.TokenizationRegistry.get(e);return t?new ic(e,t.getInitialState()):new ic(e,Hl)}};Sd=BC=Vz([Uz(4,Ge)],Sd);function Kz(o,e){if(!e)return null;e=co(o,e);const t=o.brackets;for(const i of t){if(i.open===e)return{token:i.token,bracketType:1};if(i.close===e)return{token:i.token,bracketType:-1}}return null}const Gz=lo("standaloneColorizer",{createHTML:o=>o});class zC{static colorizeElement(e,t,i,n){n=n||{};const s=n.theme||"vs",r=n.mimeType||i.getAttribute("lang")||i.getAttribute("data-lang");if(!r)return console.error("Mode not detected"),Promise.resolve();const a=t.getLanguageIdByMimeType(r)||r;e.setTheme(s);const c=i.firstChild?i.firstChild.nodeValue:"";i.className+=" "+s;const h=d=>{const u=Gz?.createHTML(d)??d;i.innerHTML=u};return this.colorize(t,c||"",a,n).then(h,d=>console.error(d))}static async colorize(e,t,i,n){const s=e.languageIdCodec;let r=4;n&&typeof n.tabSize=="number"&&(r=n.tabSize),l.startsWithUTF8BOM(t)&&(t=t.substr(1));const a=l.splitLines(t);if(!e.isRegisteredLanguageId(i))return vE(a,r,s);const c=await l.TokenizationRegistry.getOrCreate(i);return c?jz(a,r,c,s):vE(a,r,s)}static colorizeLine(e,t,i,n,s=4){const r=Wi.isBasicASCII(e,t),a=Wi.containsRTL(e,r,i);return Eg(new Wo(!1,!0,e,!1,r,a,0,n,[],s,0,0,0,0,-1,"none",!1,!1,null,null,0)).html}static colorizeModelLine(e,t,i=4){const n=e.getLineContent(t);e.tokenization.forceTokenization(t);const r=e.tokenization.getLineTokens(t).inflate();return this.colorizeLine(n,e.mightContainNonBasicASCII(),e.mightContainRTL(),r,i)}}function jz(o,e,t,i){return new Promise((n,s)=>{const r=()=>{const a=qz(o,e,t,i);if(t instanceof Sd){const c=t.getLoadStatus();if(c.loaded===!1){c.promise.then(r,s);return}}n(a)};r()})}function vE(o,e,t){let i=[];const s=new Uint32Array(2);s[0]=0,s[1]=33587200;for(let r=0,a=o.length;r<a;r++){const c=o[r];s[0]=c.length;const h=new _t(s,c,t),d=Wi.isBasicASCII(c,!0),u=Wi.containsRTL(c,d,!0),f=Eg(new Wo(!1,!0,c,!1,d,u,0,h,[],e,0,0,0,0,-1,"none",!1,!1,null,null,0));i=i.concat(f.html),i.push("<br/>")}return i.join("")}function qz(o,e,t,i){let n=[],s=t.getInitialState();for(let r=0,a=o.length;r<a;r++){const c=o[r],h=t.tokenizeEncoded(c,!0,s);_t.convertToEndOffset(h.tokens,c.length);const d=new _t(h.tokens,c,i),u=Wi.isBasicASCII(c,!0),f=Wi.containsRTL(c,u,!0),g=Eg(new Wo(!1,!0,c,!1,u,f,0,d.inflate(),[],e,0,0,0,0,-1,"none",!1,!1,null,null,0));n=n.concat(g.html),n.push("<br/>"),s=h.endState}return n.join("")}const wE=2e4;let ca,Ng,VC,Rg,UC;function Yz(o){ca=document.createElement("div"),ca.className="monaco-aria-container";const e=()=>{const i=document.createElement("div");return i.className="monaco-alert",i.setAttribute("role","alert"),i.setAttribute("aria-atomic","true"),ca.appendChild(i),i};Ng=e(),VC=e();const t=()=>{const i=document.createElement("div");return i.className="monaco-status",i.setAttribute("aria-live","polite"),i.setAttribute("aria-atomic","true"),ca.appendChild(i),i};Rg=t(),UC=t(),o.appendChild(ca)}function ha(o){ca&&(Ng.textContent!==o?(On(VC),Mg(Ng,o)):(On(Ng),Mg(VC,o)))}function yd(o){ca&&(Rg.textContent!==o?(On(UC),Mg(Rg,o)):(On(Rg),Mg(UC,o)))}function Mg(o,e){On(o),e.length>wE&&(e=e.substr(0,wE)),o.textContent=e,o.style.visibility="hidden",o.style.visibility="visible"}const tr=le("editorWorkerService"),$C=le("markerDecorationsService");var Zz=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},Qz=function(o,e){return function(t,i){e(t,i,o)}};let Ag=(Nh=class{constructor(e,t){}dispose(){}},Nh.ID="editor.contrib.markerDecorations",Nh);Ag=Zz([Qz(1,$C)],Ag),fe(tr,MC,0),_C(Ag.ID,Ag,0);class SE extends l.Disposable{constructor(e,t){super(),this._onDidChange=this._register(new l.Emitter),this.onDidChange=this._onDidChange.event,this._referenceDomElement=e,this._width=-1,this._height=-1,this._resizeObserver=null,this.measureReferenceDomElement(!1,t)}dispose(){this.stopObserving(),super.dispose()}getWidth(){return this._width}getHeight(){return this._height}startObserving(){if(!this._resizeObserver&&this._referenceDomElement){let e=null;const t=()=>{e?this.observe({width:e.width,height:e.height}):this.observe()};let i=!1,n=!1;const s=()=>{if(i&&!n)try{i=!1,n=!0,t()}finally{Ti(j(this._referenceDomElement),()=>{n=!1,s()})}};this._resizeObserver=new ResizeObserver(r=>{r&&r[0]&&r[0].contentRect?e={width:r[0].contentRect.width,height:r[0].contentRect.height}:e=null,i=!0,s()}),this._resizeObserver.observe(this._referenceDomElement)}}stopObserving(){this._resizeObserver&&(this._resizeObserver.disconnect(),this._resizeObserver=null)}observe(e){this.measureReferenceDomElement(!0,e)}measureReferenceDomElement(e,t){let i=0,n=0;t?(i=t.width,n=t.height):this._referenceDomElement&&(i=this._referenceDomElement.clientWidth,n=this._referenceDomElement.clientHeight),i=Math.max(5,i),n=Math.max(5,n),(this._width!==i||this._height!==n)&&(this._width=i,this._height=n,e&&this._onDidChange.fire())}}const Rh=class Rh{constructor(e,t){this.key=e,this.migrate=t}apply(e){const t=Rh._read(e,this.key),i=s=>Rh._read(e,s),n=(s,r)=>Rh._write(e,s,r);this.migrate(t,i,n)}static _read(e,t){if(typeof e>"u"||e===null)return;const i=t.indexOf(".");if(i>=0){const n=t.substring(0,i);return this._read(e[n],t.substring(i+1))}return e[t]}static _write(e,t,i){const n=t.indexOf(".");if(n>=0){const s=t.substring(0,n);e[s]=e[s]||{},this._write(e[s],t.substring(n+1),i);return}e[t]=i}};Rh.items=[];let Ld=Rh;function Hi(o,e){Ld.items.push(new Ld(o,e))}function fi(o,e){Hi(o,(t,i,n)=>{if(typeof t<"u"){for(const[s,r]of e)if(t===s){n(o,r);return}}})}function Xz(o){Ld.items.forEach(e=>e.apply(o))}fi("wordWrap",[[!0,"on"],[!1,"off"]]),fi("lineNumbers",[[!0,"on"],[!1,"off"]]),fi("cursorBlinking",[["visible","solid"]]),fi("renderWhitespace",[[!0,"boundary"],[!1,"none"]]),fi("renderLineHighlight",[[!0,"line"],[!1,"none"]]),fi("acceptSuggestionOnEnter",[[!0,"on"],[!1,"off"]]),fi("tabCompletion",[[!1,"off"],[!0,"onlySnippets"]]),fi("hover",[[!0,{enabled:!0}],[!1,{enabled:!1}]]),fi("parameterHints",[[!0,{enabled:!0}],[!1,{enabled:!1}]]),fi("autoIndent",[[!1,"advanced"],[!0,"full"]]),fi("matchBrackets",[[!0,"always"],[!1,"never"]]),fi("renderFinalNewline",[[!0,"on"],[!1,"off"]]),fi("cursorSmoothCaretAnimation",[[!0,"on"],[!1,"off"]]),fi("occurrencesHighlight",[[!0,"singleFile"],[!1,"off"]]),fi("wordBasedSuggestions",[[!0,"matchingDocuments"],[!1,"off"]]),fi("defaultColorDecorators",[[!0,"auto"],[!1,"never"]]),fi("minimap.autohide",[[!0,"mouseover"],[!1,"none"]]),Hi("autoClosingBrackets",(o,e,t)=>{o===!1&&(t("autoClosingBrackets","never"),typeof e("autoClosingQuotes")>"u"&&t("autoClosingQuotes","never"),typeof e("autoSurround")>"u"&&t("autoSurround","never"))}),Hi("renderIndentGuides",(o,e,t)=>{typeof o<"u"&&(t("renderIndentGuides",void 0),typeof e("guides.indentation")>"u"&&t("guides.indentation",!!o))}),Hi("highlightActiveIndentGuide",(o,e,t)=>{typeof o<"u"&&(t("highlightActiveIndentGuide",void 0),typeof e("guides.highlightActiveIndentation")>"u"&&t("guides.highlightActiveIndentation",!!o))});const Jz={method:"showMethods",function:"showFunctions",constructor:"showConstructors",deprecated:"showDeprecated",field:"showFields",variable:"showVariables",class:"showClasses",struct:"showStructs",interface:"showInterfaces",module:"showModules",property:"showProperties",event:"showEvents",operator:"showOperators",unit:"showUnits",value:"showValues",constant:"showConstants",enum:"showEnums",enumMember:"showEnumMembers",keyword:"showKeywords",text:"showWords",color:"showColors",file:"showFiles",reference:"showReferences",folder:"showFolders",typeParameter:"showTypeParameters",snippet:"showSnippets"};Hi("suggest.filteredTypes",(o,e,t)=>{if(o&&typeof o=="object"){for(const i of Object.entries(Jz))o[i[0]]===!1&&typeof e(`suggest.${i[1]}`)>"u"&&t(`suggest.${i[1]}`,!1);t("suggest.filteredTypes",void 0)}}),Hi("quickSuggestions",(o,e,t)=>{if(typeof o=="boolean"){const i=o?"on":"off";t("quickSuggestions",{comments:i,strings:i,other:i})}}),Hi("experimental.stickyScroll.enabled",(o,e,t)=>{typeof o=="boolean"&&(t("experimental.stickyScroll.enabled",void 0),typeof e("stickyScroll.enabled")>"u"&&t("stickyScroll.enabled",o))}),Hi("experimental.stickyScroll.maxLineCount",(o,e,t)=>{typeof o=="number"&&(t("experimental.stickyScroll.maxLineCount",void 0),typeof e("stickyScroll.maxLineCount")>"u"&&t("stickyScroll.maxLineCount",o))}),Hi("editor.experimentalEditContextEnabled",(o,e,t)=>{typeof o=="boolean"&&(t("editor.experimentalEditContextEnabled",void 0),typeof e("editor.editContext")>"u"&&t("editor.editContext",o))}),Hi("codeActionsOnSave",(o,e,t)=>{if(o&&typeof o=="object"){let i=!1;const n={};for(const s of Object.entries(o))typeof s[1]=="boolean"?(i=!0,n[s[0]]=s[1]?"explicit":"never"):n[s[0]]=s[1];i&&t("codeActionsOnSave",n)}}),Hi("codeActionWidget.includeNearbyQuickfixes",(o,e,t)=>{typeof o=="boolean"&&(t("codeActionWidget.includeNearbyQuickfixes",void 0),typeof e("codeActionWidget.includeNearbyQuickFixes")>"u"&&t("codeActionWidget.includeNearbyQuickFixes",o))}),Hi("lightbulb.enabled",(o,e,t)=>{typeof o=="boolean"&&t("lightbulb.enabled",o?void 0:"off")}),Hi("inlineSuggest.edits.codeShifting",(o,e,t)=>{typeof o=="boolean"&&(t("inlineSuggest.edits.codeShifting",void 0),t("inlineSuggest.edits.allowCodeShifting",o?"always":"never"))}),Hi("hover.enabled",(o,e,t)=>{typeof o=="boolean"&&t("hover.enabled",o?"on":"off")});class Wz extends l.Disposable{constructor(){super(...arguments),this._tabFocus=!1,this._onDidChangeTabFocus=this._register(new l.Emitter),this.onDidChangeTabFocus=this._onDidChangeTabFocus.event}getTabFocusMode(){return this._tabFocus}setTabFocusMode(e){this._tabFocus=e,this._onDidChangeTabFocus.fire(this._tabFocus)}}const Dd=new Wz;function Hz(o,e,t){const i=o.get(58),n=o.get(62),s=o.get(61),r=o.get(60),a=o.get(63),c=o.get(75),h=o.get(72);return Ur._create(i,n,s,r,a,c,h,e,t)}function eV(o,e,t=!1){const i=Fi.fontFamily.validate(o.fontFamily),n=Fi.fontWeight.validate(o.fontWeight),s=Fi.fontSize.validate(o.fontSize),r=Fi.fontLigatures2.validate(o.fontLigatures),a=Fi.fontVariations.validate(o.fontVariations),c=Fi.lineHeight.validate(o.lineHeight),h=Fi.letterSpacing.validate(o.letterSpacing);return Ur._create(i,n,s,r,a,c,h,e,t)}const Ui=le("accessibilityService"),yE=new q("accessibilityModeEnabled",!1);class tV{constructor(){this._inputMode="insert",this._onDidChangeInputMode=new l.Emitter,this.onDidChangeInputMode=this._onDidChangeInputMode.event}getInputMode(){return this._inputMode}}const KC=new tV;var iV=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},nV=function(o,e){return function(t,i){e(t,i,o)}};let GC=class extends l.Disposable{constructor(e,t,i,n,s){super(),this._accessibilityService=s,this._onDidChange=this._register(new l.Emitter),this.onDidChange=this._onDidChange.event,this._onDidChangeFast=this._register(new l.Emitter),this.onDidChangeFast=this._onDidChangeFast.event,this._isDominatedByLongLines=!1,this._viewLineCount=1,this._lineNumbersDigitCount=1,this._reservedHeight=0,this._glyphMarginDecorationLaneCount=1,this._computeOptionsMemory=new RD,this.isSimpleWidget=e,this.contextMenuId=t,this._containerObserver=this._register(new SE(n,i.dimension)),this._targetWindowId=j(n).vscodeWindowId,this._rawOptions=LE(i),this._validatedOptions=ir.validateOptions(this._rawOptions),this.options=this._computeOptions(),this.options.get(19)&&this._containerObserver.startObserving(),this._register(eo.onDidChangeZoomLevel(()=>this._recomputeOptions())),this._register(Dd.onDidChangeTabFocus(()=>this._recomputeOptions())),this._register(this._containerObserver.onDidChange(()=>this._recomputeOptions())),this._register(hC.onDidChange(()=>this._recomputeOptions())),this._register(ld.getInstance(j(n)).onDidChange(()=>this._recomputeOptions())),this._register(this._accessibilityService.onDidChangeScreenReaderOptimized(()=>this._recomputeOptions())),this._register(KC.onDidChangeInputMode(()=>this._recomputeOptions()))}_recomputeOptions(){const e=this._computeOptions(),t=ir.checkEquals(this.options,e);t!==null&&(this.options=e,this._onDidChangeFast.fire(t),this._onDidChange.fire(t))}_computeOptions(){const e=this._readEnvConfiguration(),t=Hz(this._validatedOptions,e.pixelRatio,this.isSimpleWidget),i=this._readFontInfo(t),n={memory:this._computeOptionsMemory,outerWidth:e.outerWidth,outerHeight:e.outerHeight-this._reservedHeight,fontInfo:i,extraEditorClassName:e.extraEditorClassName,isDominatedByLongLines:this._isDominatedByLongLines,viewLineCount:this._viewLineCount,lineNumbersDigitCount:this._lineNumbersDigitCount,emptySelectionClipboard:e.emptySelectionClipboard,pixelRatio:e.pixelRatio,tabFocusMode:this._validatedOptions.get(164)||Dd.getTabFocusMode(),inputMode:KC.getInputMode(),accessibilitySupport:e.accessibilitySupport,glyphMarginDecorationLaneCount:this._glyphMarginDecorationLaneCount,editContextSupported:e.editContextSupported};return ir.computeOptions(this._validatedOptions,n)}_readEnvConfiguration(){return{extraEditorClassName:oV(),outerWidth:this._containerObserver.getWidth(),outerHeight:this._containerObserver.getHeight(),emptySelectionClipboard:Ff||di,pixelRatio:ld.getInstance(nx(this._targetWindowId,!0).window).value,editContextSupported:typeof globalThis.EditContext=="function",accessibilitySupport:this._accessibilityService.isScreenReaderOptimized()?2:this._accessibilityService.getAccessibilitySupport()}}_readFontInfo(e){return hC.readFontInfo(nx(this._targetWindowId,!0).window,e)}getRawOptions(){return this._rawOptions}updateOptions(e){const t=LE(e);ir.applyUpdate(this._rawOptions,t)&&(this._validatedOptions=ir.validateOptions(this._rawOptions),this._recomputeOptions())}observeContainer(e){this._containerObserver.observe(e)}setIsDominatedByLongLines(e){this._isDominatedByLongLines!==e&&(this._isDominatedByLongLines=e,this._recomputeOptions())}setModelLineCount(e){const t=sV(e);this._lineNumbersDigitCount!==t&&(this._lineNumbersDigitCount=t,this._recomputeOptions())}setViewLineCount(e){this._viewLineCount!==e&&(this._viewLineCount=e,this._recomputeOptions())}setReservedHeight(e){this._reservedHeight!==e&&(this._reservedHeight=e,this._recomputeOptions())}setGlyphMarginDecorationLaneCount(e){this._glyphMarginDecorationLaneCount!==e&&(this._glyphMarginDecorationLaneCount=e,this._recomputeOptions())}};GC=iV([nV(4,Ui)],GC);function sV(o){let e=0;for(;o;)o=Math.floor(o/10),e++;return e||1}function oV(){let o="";return $r||PD?(o+="no-minimap-shadow ",o+="enable-user-select "):o+="no-user-select ",l.isMacintosh&&(o+="mac "),o}class rV{constructor(){this._values=[]}_read(e){return this._values[e]}get(e){return this._values[e]}_write(e,t){this._values[e]=t}}class aV{constructor(){this._values=[]}_read(e){if(e>=this._values.length)throw new Error("Cannot read uninitialized value");return this._values[e]}get(e){return this._read(e)}_write(e,t){this._values[e]=t}}class ir{static validateOptions(e){const t=new rV;for(const i of Vl){const n=i.name==="_never_"?void 0:e[i.name];t._write(i.id,i.validate(n))}return t}static computeOptions(e,t){const i=new aV;for(const n of Vl)i._write(n.id,n.compute(t,i,e._read(n.id)));return i}static _deepEquals(e,t){if(typeof e!="object"||typeof t!="object"||!e||!t)return e===t;if(Array.isArray(e)||Array.isArray(t))return Array.isArray(e)&&Array.isArray(t)?l.equals(e,t):!1;if(Object.keys(e).length!==Object.keys(t).length)return!1;for(const i in e)if(!ir._deepEquals(e[i],t[i]))return!1;return!0}static checkEquals(e,t){const i=[];let n=!1;for(const s of Vl){const r=!ir._deepEquals(e._read(s.id),t._read(s.id));i[s.id]=r,r&&(n=!0)}return n?new ND(i):null}static applyUpdate(e,t){let i=!1;for(const n of Vl)if(t.hasOwnProperty(n.name)){const s=n.applyUpdate(e[n.name],t[n.name]);e[n.name]=s.newValue,i=i||s.didChange}return i}}function LE(o){const e=l.deepClone(o);return Xz(e),e}var _n;(function(o){const e={total:0,min:Number.MAX_VALUE,max:0},t={...e},i={...e},n={...e};let s=0;o.sampleCount=W("inputLatency.sampleCount",0);const r={keydown:0,input:0,render:0};function a(){v(),performance.mark("inputlatency/start"),performance.mark("keydown/start"),r.keydown=1,queueMicrotask(c)}o.onKeyDown=a;function c(){r.keydown===1&&(performance.mark("keydown/end"),r.keydown=2)}function h(){performance.mark("input/start"),r.input=1,b()}o.onBeforeInput=h;function d(){r.input===0&&h(),queueMicrotask(u)}o.onInput=d;function u(){r.input===1&&(performance.mark("input/end"),r.input=2)}function f(){v()}o.onKeyUp=f;function g(){v()}o.onSelectionChange=g;function m(){r.keydown===2&&r.input===2&&r.render===0&&(performance.mark("render/start"),r.render=1,queueMicrotask(p),b())}o.onRenderStart=m;function p(){r.render===1&&(performance.mark("render/end"),r.render=2)}function b(){setTimeout(v)}function v(){r.keydown===2&&r.input===2&&r.render===2&&(performance.mark("inputlatency/end"),performance.measure("keydown","keydown/start","keydown/end"),performance.measure("input","input/start","input/end"),performance.measure("render","render/start","render/end"),performance.measure("inputlatency","inputlatency/start","inputlatency/end"),C("keydown",e),C("input",t),C("render",i),C("inputlatency",n),s++,o.sampleCount.set(o.sampleCount.get()+1,void 0),w())}function C(x,I){const T=performance.getEntriesByName(x)[0].duration;I.total+=T,I.min=Math.min(I.min,T),I.max=Math.max(I.max,T)}function w(){performance.clearMarks("keydown/start"),performance.clearMarks("keydown/end"),performance.clearMarks("input/start"),performance.clearMarks("input/end"),performance.clearMarks("render/start"),performance.clearMarks("render/end"),performance.clearMarks("inputlatency/start"),performance.clearMarks("inputlatency/end"),performance.clearMeasures("keydown"),performance.clearMeasures("input"),performance.clearMeasures("render"),performance.clearMeasures("inputlatency"),r.keydown=0,r.input=0,r.render=0}function S(){if(s===0)return;const x={keydown:L(e),input:L(t),render:L(i),total:L(n),sampleCount:s};return D(e),D(t),D(i),D(n),s=0,x}o.getAndClearMeasurements=S;function L(x){return{average:x.total/s,max:x.max,min:x.min}}function D(x){x.total=0,x.min=Number.MAX_VALUE,x.max=0}})(_n||(_n={}));const Og=new Map;class lV extends l.Disposable{constructor(){super(...arguments),this._currentCssStyle="",this._styleSheet=void 0}setStyle(e){e!==this._currentCssStyle&&(this._currentCssStyle=e,this._styleSheet?this._styleSheet.textContent=e:this._styleSheet=bn(Ae.document.head,t=>t.textContent=e,this._store))}dispose(){super.dispose(),this._styleSheet=void 0}}function bn(o=Ae.document.head,e,t){const i=document.createElement("style");if(i.type="text/css",i.media="screen",e?.(i),o.appendChild(i),t&&t.add(l.toDisposable(()=>i.remove())),o===Ae.document.head){const n=new Set;Og.set(i,n),t&&t.add(l.toDisposable(()=>Og.delete(i)));for(const{window:s,disposables:r}of ix()){if(s===Ae)continue;const a=r.add(cV(i,n,s));t?.add(a)}}return i}function cV(o,e,t){const i=new l.DisposableStore,n=o.cloneNode(!0);t.document.head.appendChild(n),i.add(l.toDisposable(()=>n.remove()));for(const s of o.sheet?.cssRules??[])n.sheet?.insertRule(s.cssText,n.sheet?.cssRules.length);return i.add(yF.observe(o,i,{childList:!0,subtree:di,characterData:di})(()=>{n.textContent=o.textContent})),e.add(n),i.add(l.toDisposable(()=>e.delete(n))),i}let jC=null;function DE(){return jC||(jC=bn()),jC}function Pg(o,e,t=DE()){if(!(!t||!e)){t.sheet?.insertRule(`${o} {${e}}`,0);for(const i of Og.get(t)??[])Pg(o,e,i)}}function xE(o,e=DE()){if(!e)return;const t=e.sheet?.cssRules??[],i=[];for(let n=0;n<t.length;n++){const s=t[n];hV(s)&&s.selectorText.indexOf(o)!==-1&&i.push(n)}for(let n=i.length-1;n>=0;n--)e.sheet?.deleteRule(i[n]);for(const n of Og.get(e)??[])xE(o,n)}function hV(o){return typeof o.selectorText=="string"}function dV(o){const e=new l.DisposableStore,t=e.add(new lV);return e.add(he(i=>{t.setStyle(o.read(i))})),e}class xd{constructor(){this._hooks=new l.DisposableStore,this._pointerMoveCallback=null,this._onStopCallback=null}dispose(){this.stopMonitoring(!1),this._hooks.dispose()}stopMonitoring(e,t){if(!this.isMonitoring())return;this._hooks.clear(),this._pointerMoveCallback=null;const i=this._onStopCallback;this._onStopCallback=null,e&&i&&i(t)}isMonitoring(){return!!this._pointerMoveCallback}startMonitoring(e,t,i,n,s){this.isMonitoring()&&this.stopMonitoring(!1),this._pointerMoveCallback=n,this._onStopCallback=s;let r=e;try{e.setPointerCapture(t),this._hooks.add(l.toDisposable(()=>{try{e.releasePointerCapture(t)}catch{}}))}catch{r=j(e)}this._hooks.add(R(r,F.POINTER_MOVE,a=>{if(a.buttons!==i){this.stopMonitoring(!0);return}a.preventDefault(),this._pointerMoveCallback(a)})),this._hooks.add(R(r,F.POINTER_UP,a=>this.stopMonitoring(!0)))}}function qC(o){return`--vscode-${o.replace(/\./g,"-")}`}function z(o){return`var(${qC(o)})`}function EE(o,e){return`var(${qC(o)}, ${e})`}function uV(o){return o!==null&&typeof o=="object"&&"light"in o&&"dark"in o}const IE={ColorContribution:"base.contributions.colors"},fV="default";class gV extends l.Disposable{constructor(){super(),this._onDidChangeSchema=this._register(new l.Emitter),this.onDidChangeSchema=this._onDidChangeSchema.event,this.colorSchema={type:"object",properties:{}},this.colorReferenceSchema={type:"string",enum:[],enumDescriptions:[]},this.colorsById={}}registerColor(e,t,i,n=!1,s){const r={id:e,description:i,defaults:t,needsTransparency:n,deprecationMessage:s};this.colorsById[e]=r;const a={type:"string",format:"color-hex",defaultSnippets:[{body:"${1:#ff0000}"}]};return s&&(a.deprecationMessage=s),n&&(a.pattern="^#(?:(?<rgba>[0-9a-fA-f]{3}[0-9a-eA-E])|(?:[0-9a-fA-F]{6}(?:(?![fF]{2})(?:[0-9a-fA-F]{2}))))?$",a.patternErrorMessage=l.localize(2091,"This color must be transparent or it will obscure content")),this.colorSchema.properties[e]={description:i,oneOf:[a,{type:"string",const:fV,description:l.localize(2092,"Use the default color.")}]},this.colorReferenceSchema.enum.push(e),this.colorReferenceSchema.enumDescriptions.push(i),this._onDidChangeSchema.fire(),e}getColors(){return Object.keys(this.colorsById).map(e=>this.colorsById[e])}resolveDefaultColor(e,t){const i=this.colorsById[e];if(i?.defaults){const n=uV(i.defaults)?i.defaults[t.type]:i.defaults;return Cn(n,t)}}getColorSchema(){return this.colorSchema}toString(){const e=(t,i)=>{const n=t.indexOf(".")===-1?0:1,s=i.indexOf(".")===-1?0:1;return n!==s?n-s:t.localeCompare(i)};return Object.keys(this.colorsById).sort(e).map(t=>`- \`${t}\`: ${this.colorsById[t].description}`).join(`
|
||
`)}}const kg=new gV;St.add(IE.ColorContribution,kg);function E(o,e,t,i,n){return kg.registerColor(o,e,t,i,n)}function mV(o,e){switch(o.op){case 0:return Cn(o.value,e)?.darken(o.factor);case 1:return Cn(o.value,e)?.lighten(o.factor);case 2:return Cn(o.value,e)?.transparent(o.factor);case 7:{const t=Cn(o.color,e)||l.Color.transparent,i=Cn(o.with,e)||l.Color.transparent;return t.mix(i,o.ratio)}case 3:{const t=Cn(o.background,e);return t?Cn(o.value,e)?.makeOpaque(t):Cn(o.value,e)}case 4:for(const t of o.values){const i=Cn(t,e);if(i)return i}return;case 6:return Cn(e.defines(o.if)?o.then:o.else,e);case 5:{const t=Cn(o.value,e);if(!t)return;const i=Cn(o.background,e);return i?t.isDarkerThan(i)?l.Color.getLighterColor(t,i,o.factor).transparent(o.transparency):l.Color.getDarkerColor(t,i,o.factor).transparent(o.transparency):t.transparent(o.factor*o.transparency)}default:throw l.assertNever()}}function da(o,e){return{op:0,value:o,factor:e}}function kn(o,e){return{op:1,value:o,factor:e}}function ce(o,e){return{op:2,value:o,factor:e}}function YC(...o){return{op:4,values:o}}function pV(o,e,t){return{op:6,if:o,then:e,else:t}}function TE(o,e,t,i){return{op:5,value:o,background:e,factor:t,transparency:i}}function Cn(o,e){if(o!==null){if(typeof o=="string")return o[0]==="#"?l.Color.fromHex(o):e.getColor(o);if(o instanceof l.Color)return o;if(typeof o=="object")return mV(o,e)}}const NE="vscode://schemas/workbench-colors",RE=St.as(Cg.JSONContribution);RE.registerSchema(NE,kg.getColorSchema());const ME=new l.RunOnceScheduler(()=>RE.notifySchemaChanged(NE),200);kg.onDidChangeSchema(()=>{ME.isScheduled()||ME.schedule()});const De=E("foreground",{dark:"#CCCCCC",light:"#616161",hcDark:"#FFFFFF",hcLight:"#292929"},l.localize(1838,"Overall foreground color. This color is only used if not overridden by a component."));E("strongForeground",{dark:"#FFFFFF",light:"#000000",hcDark:"#FFFFFF",hcLight:"#000000"},l.localize(1839,"Highest-contrast foreground color, intended for text or icons that need maximum legibility across various backgrounds. This color is only used if not overridden by a component.")),E("disabledForeground",{dark:"#CCCCCC80",light:"#61616180",hcDark:"#A5A5A5",hcLight:"#7F7F7F"},l.localize(1840,"Overall foreground for disabled elements. This color is only used if not overridden by a component.")),E("errorForeground",{dark:"#F48771",light:"#A1260D",hcDark:"#F48771",hcLight:"#B5200D"},l.localize(1841,"Overall foreground color for error messages. This color is only used if not overridden by a component."));const _V=E("descriptionForeground",{light:"#717171",dark:ce(De,.7),hcDark:ce(De,.7),hcLight:ce(De,.7)},l.localize(1842,"Foreground color for description text providing additional information, for example for a label.")),Fg=E("icon.foreground",{dark:"#C5C5C5",light:"#424242",hcDark:"#FFFFFF",hcLight:"#292929"},l.localize(1843,"The default color for icons in the workbench.")),bs=E("focusBorder",{dark:"#007FD4",light:"#0090F1",hcDark:"#F38518",hcLight:"#006BBD"},l.localize(1844,"Overall border color for focused elements. This color is only used if not overridden by a component.")),pe=E("contrastBorder",{light:null,dark:null,hcDark:"#6FC3DF",hcLight:"#0F4A85"},l.localize(1845,"An extra border around elements to separate them from others for greater contrast.")),ot=E("contrastActiveBorder",{light:null,dark:null,hcDark:bs,hcLight:bs},l.localize(1846,"An extra border around active elements to separate them from others for greater contrast."));E("selection.background",null,l.localize(1847,"The background color of text selections in the workbench (e.g. for input fields or text areas). Note that this does not apply to selections within the editor."));const bV=E("textLink.foreground",{light:"#006AB1",dark:"#3794FF",hcDark:"#21A6FF",hcLight:"#0F4A85"},l.localize(1848,"Foreground color for links in text."));E("textLink.activeForeground",{light:"#006AB1",dark:"#3794FF",hcDark:"#21A6FF",hcLight:"#0F4A85"},l.localize(1849,"Foreground color for links in text when clicked on and on mouse hover.")),E("textSeparator.foreground",{light:"#0000002e",dark:"#ffffff2e",hcDark:l.Color.black,hcLight:"#292929"},l.localize(1850,"Color for text separators.")),E("textPreformat.foreground",{light:"#A31515",dark:"#D7BA7D",hcDark:"#FFFFFF",hcLight:"#FFFFFF"},l.localize(1851,"Foreground color for preformatted text segments.")),E("textPreformat.background",{light:"#0000001A",dark:"#FFFFFF1A",hcDark:null,hcLight:"#09345f"},l.localize(1852,"Background color for preformatted text segments.")),E("textPreformat.border",{light:null,dark:null,hcDark:pe,hcLight:null},l.localize(1853,"Border color for preformatted text segments.")),E("textBlockQuote.background",{light:"#f2f2f2",dark:"#222222",hcDark:null,hcLight:"#F2F2F2"},l.localize(1854,"Background color for block quotes in text.")),E("textBlockQuote.border",{light:"#007acc80",dark:"#007acc80",hcDark:l.Color.white,hcLight:"#292929"},l.localize(1855,"Border color for block quotes in text.")),E("textCodeBlock.background",{light:"#dcdcdc66",dark:"#0a0a0a66",hcDark:l.Color.black,hcLight:"#F2F2F2"},l.localize(1856,"Background color for code blocks in text.")),E("sash.hoverBorder",bs,l.localize(2062,"Border color of active sashes."));const Bg=E("badge.background",{dark:"#4D4D4D",light:"#C4C4C4",hcDark:l.Color.black,hcLight:"#0F4A85"},l.localize(2063,"Badge background color. Badges are small information labels, e.g. for search results count.")),CV=E("badge.foreground",{dark:l.Color.white,light:"#333",hcDark:l.Color.white,hcLight:l.Color.white},l.localize(2064,"Badge foreground color. Badges are small information labels, e.g. for search results count."));E("activityWarningBadge.foreground",{dark:l.Color.white,light:l.Color.white,hcDark:l.Color.white,hcLight:l.Color.white},l.localize(2065,"Foreground color of the warning activity badge")),E("activityWarningBadge.background",{dark:"#B27C00",light:"#B27C00",hcDark:null,hcLight:"#B27C00"},l.localize(2066,"Background color of the warning activity badge")),E("activityErrorBadge.foreground",{dark:l.Color.black.lighten(.2),light:l.Color.white,hcDark:null,hcLight:l.Color.black.lighten(.2)},l.localize(2067,"Foreground color of the error activity badge")),E("activityErrorBadge.background",{dark:"#F14C4C",light:"#E51400",hcDark:null,hcLight:"#F14C4C"},l.localize(2068,"Background color of the error activity badge"));const zg=E("scrollbar.shadow",{dark:"#000000",light:"#DDDDDD",hcDark:null,hcLight:null},l.localize(2069,"Scrollbar shadow to indicate that the view is scrolled.")),AE=E("scrollbarSlider.background",{dark:l.Color.fromHex("#797979").transparent(.4),light:l.Color.fromHex("#646464").transparent(.4),hcDark:ce(pe,.6),hcLight:ce(pe,.4)},l.localize(2070,"Scrollbar slider background color.")),OE=E("scrollbarSlider.hoverBackground",{dark:l.Color.fromHex("#646464").transparent(.7),light:l.Color.fromHex("#646464").transparent(.7),hcDark:ce(pe,.8),hcLight:ce(pe,.8)},l.localize(2071,"Scrollbar slider background color when hovering.")),PE=E("scrollbarSlider.activeBackground",{dark:l.Color.fromHex("#BFBFBF").transparent(.4),light:l.Color.fromHex("#000000").transparent(.6),hcDark:pe,hcLight:pe},l.localize(2072,"Scrollbar slider background color when clicked on."));E("scrollbar.background",null,l.localize(2073,"Scrollbar track background color."));const vV=E("progressBar.background",{dark:l.Color.fromHex("#0E70C0"),light:l.Color.fromHex("#0E70C0"),hcDark:pe,hcLight:pe},l.localize(2074,"Background color of the progress bar that can show for long running operations."));E("chart.line",{dark:"#236B8E",light:"#236B8E",hcDark:"#236B8E",hcLight:"#236B8E"},l.localize(2075,"Line color for the chart.")),E("chart.axis",{dark:l.Color.fromHex("#BFBFBF").transparent(.4),light:l.Color.fromHex("#000000").transparent(.6),hcDark:pe,hcLight:pe},l.localize(2076,"Axis color for the chart.")),E("chart.guide",{dark:l.Color.fromHex("#BFBFBF").transparent(.2),light:l.Color.fromHex("#000000").transparent(.2),hcDark:pe,hcLight:pe},l.localize(2077,"Guide line for the chart."));const vn=E("editor.background",{light:"#ffffff",dark:"#1E1E1E",hcDark:l.Color.black,hcLight:l.Color.white},l.localize(1865,"Editor background color.")),nc=E("editor.foreground",{light:"#333333",dark:"#BBBBBB",hcDark:l.Color.white,hcLight:De},l.localize(1866,"Editor default foreground color."));E("editorStickyScroll.background",vn,l.localize(1867,"Background color of sticky scroll in the editor")),E("editorStickyScrollGutter.background",vn,l.localize(1868,"Background color of the gutter part of sticky scroll in the editor")),E("editorStickyScrollHover.background",{dark:"#2A2D2E",light:"#F0F0F0",hcDark:null,hcLight:l.Color.fromHex("#0F4A85").transparent(.1)},l.localize(1869,"Background color of sticky scroll on hover in the editor")),E("editorStickyScroll.border",{dark:null,light:null,hcDark:pe,hcLight:pe},l.localize(1870,"Border color of sticky scroll in the editor")),E("editorStickyScroll.shadow",zg,l.localize(1871," Shadow color of sticky scroll in the editor"));const wn=E("editorWidget.background",{dark:"#252526",light:"#F3F3F3",hcDark:"#0C141F",hcLight:l.Color.white},l.localize(1872,"Background color of editor widgets, such as find/replace.")),sc=E("editorWidget.foreground",De,l.localize(1873,"Foreground color of editor widgets, such as find/replace.")),Vg=E("editorWidget.border",{dark:ce(sc,.2),light:ce(sc,.2),hcDark:pe,hcLight:pe},l.localize(1874,"Border color of editor widgets. The color is only used if the widget chooses to have a border and if the color is not overridden by a widget."));E("editorWidget.resizeBorder",null,l.localize(1875,"Border color of the resize bar of editor widgets. The color is only used if the widget chooses to have a resize border and if the color is not overridden by a widget.")),E("editorError.background",null,l.localize(1876,"Background color of error text in the editor. The color must not be opaque so as not to hide underlying decorations."),!0);const Ug=E("editorError.foreground",{dark:"#F14C4C",light:"#E51400",hcDark:"#F48771",hcLight:"#B5200D"},l.localize(1877,"Foreground color of error squigglies in the editor.")),wV=E("editorError.border",{dark:null,light:null,hcDark:l.Color.fromHex("#E47777").transparent(.8),hcLight:"#B5200D"},l.localize(1878,"If set, color of double underlines for errors in the editor.")),SV=E("editorWarning.background",null,l.localize(1879,"Background color of warning text in the editor. The color must not be opaque so as not to hide underlying decorations."),!0),ho=E("editorWarning.foreground",{dark:"#CCA700",light:"#BF8803",hcDark:"#FFD370",hcLight:"#895503"},l.localize(1880,"Foreground color of warning squigglies in the editor.")),Ed=E("editorWarning.border",{dark:null,light:null,hcDark:l.Color.fromHex("#FFCC00").transparent(.8),hcLight:l.Color.fromHex("#FFCC00").transparent(.8)},l.localize(1881,"If set, color of double underlines for warnings in the editor."));E("editorInfo.background",null,l.localize(1882,"Background color of info text in the editor. The color must not be opaque so as not to hide underlying decorations."),!0);const nr=E("editorInfo.foreground",{dark:"#59a4f9",light:"#0063d3",hcDark:"#59a4f9",hcLight:"#0063d3"},l.localize(1883,"Foreground color of info squigglies in the editor.")),Id=E("editorInfo.border",{dark:null,light:null,hcDark:l.Color.fromHex("#59a4f9").transparent(.8),hcLight:"#292929"},l.localize(1884,"If set, color of double underlines for infos in the editor.")),yV=E("editorHint.foreground",{dark:l.Color.fromHex("#eeeeee").transparent(.7),light:"#6c6c6c",hcDark:null,hcLight:null},l.localize(1885,"Foreground color of hint squigglies in the editor."));E("editorHint.border",{dark:null,light:null,hcDark:l.Color.fromHex("#eeeeee").transparent(.8),hcLight:"#292929"},l.localize(1886,"If set, color of double underlines for hints in the editor."));const LV=E("editorLink.activeForeground",{dark:"#4E94CE",light:l.Color.blue,hcDark:l.Color.cyan,hcLight:"#292929"},l.localize(1887,"Color of active links.")),sr=E("editor.selectionBackground",{light:"#ADD6FF",dark:"#264F78",hcDark:"#f3f518",hcLight:"#0F4A85"},l.localize(1888,"Color of the editor selection.")),DV=E("editor.selectionForeground",{light:null,dark:null,hcDark:"#000000",hcLight:l.Color.white},l.localize(1889,"Color of the selected text for high contrast.")),kE=E("editor.inactiveSelectionBackground",{light:ce(sr,.5),dark:ce(sr,.5),hcDark:ce(sr,.7),hcLight:ce(sr,.5)},l.localize(1890,"Color of the selection in an inactive editor. The color must not be opaque so as not to hide underlying decorations."),!0),$g=E("editor.selectionHighlightBackground",{light:TE(sr,vn,.3,.6),dark:TE(sr,vn,.3,.6),hcDark:null,hcLight:null},l.localize(1891,"Color for regions with the same content as the selection. The color must not be opaque so as not to hide underlying decorations."),!0);E("editor.selectionHighlightBorder",{light:null,dark:null,hcDark:ot,hcLight:ot},l.localize(1892,"Border color for regions with the same content as the selection.")),E("editor.compositionBorder",{light:"#000000",dark:"#ffffff",hcLight:"#000000",hcDark:"#ffffff"},l.localize(1893,"The border color for an IME composition.")),E("editor.findMatchBackground",{light:"#A8AC94",dark:"#515C6A",hcDark:null,hcLight:null},l.localize(1894,"Color of the current search match."));const xV=E("editor.findMatchForeground",null,l.localize(1895,"Text color of the current search match.")),Cs=E("editor.findMatchHighlightBackground",{light:"#EA5C0055",dark:"#EA5C0055",hcDark:null,hcLight:null},l.localize(1896,"Color of the other search matches. The color must not be opaque so as not to hide underlying decorations."),!0),EV=E("editor.findMatchHighlightForeground",null,l.localize(1897,"Foreground color of the other search matches."),!0);E("editor.findRangeHighlightBackground",{dark:"#3a3d4166",light:"#b4b4b44d",hcDark:null,hcLight:null},l.localize(1898,"Color of the range limiting the search. The color must not be opaque so as not to hide underlying decorations."),!0),E("editor.findMatchBorder",{light:null,dark:null,hcDark:ot,hcLight:ot},l.localize(1899,"Border color of the current search match."));const ua=E("editor.findMatchHighlightBorder",{light:null,dark:null,hcDark:ot,hcLight:ot},l.localize(1900,"Border color of the other search matches.")),IV=E("editor.findRangeHighlightBorder",{dark:null,light:null,hcDark:ce(ot,.4),hcLight:ce(ot,.4)},l.localize(1901,"Border color of the range limiting the search. The color must not be opaque so as not to hide underlying decorations."),!0);E("editor.hoverHighlightBackground",{light:"#ADD6FF26",dark:"#264f7840",hcDark:"#ADD6FF26",hcLight:null},l.localize(1902,"Highlight below the word for which a hover is shown. The color must not be opaque so as not to hide underlying decorations."),!0);const ZC=E("editorHoverWidget.background",wn,l.localize(1903,"Background color of the editor hover.")),TV=E("editorHoverWidget.foreground",sc,l.localize(1904,"Foreground color of the editor hover.")),FE=E("editorHoverWidget.border",Vg,l.localize(1905,"Border color of the editor hover."));E("editorHoverWidget.statusBarBackground",{dark:kn(ZC,.2),light:da(ZC,.05),hcDark:wn,hcLight:wn},l.localize(1906,"Background color of the editor hover status bar."));const QC=E("editorInlayHint.foreground",{dark:"#969696",light:"#969696",hcDark:l.Color.white,hcLight:l.Color.black},l.localize(1907,"Foreground color of inline hints")),XC=E("editorInlayHint.background",{dark:ce(Bg,.1),light:ce(Bg,.1),hcDark:ce(l.Color.white,.1),hcLight:ce(Bg,.1)},l.localize(1908,"Background color of inline hints")),NV=E("editorInlayHint.typeForeground",QC,l.localize(1909,"Foreground color of inline hints for types")),RV=E("editorInlayHint.typeBackground",XC,l.localize(1910,"Background color of inline hints for types")),MV=E("editorInlayHint.parameterForeground",QC,l.localize(1911,"Foreground color of inline hints for parameters")),AV=E("editorInlayHint.parameterBackground",XC,l.localize(1912,"Background color of inline hints for parameters")),OV=E("editorLightBulb.foreground",{dark:"#FFCC00",light:"#DDB100",hcDark:"#FFCC00",hcLight:"#007ACC"},l.localize(1913,"The color used for the lightbulb actions icon."));E("editorLightBulbAutoFix.foreground",{dark:"#75BEFF",light:"#007ACC",hcDark:"#75BEFF",hcLight:"#007ACC"},l.localize(1914,"The color used for the lightbulb auto fix actions icon.")),E("editorLightBulbAi.foreground",OV,l.localize(1915,"The color used for the lightbulb AI icon.")),E("editor.snippetTabstopHighlightBackground",{dark:new l.Color(new l.RGBA(124,124,124,.3)),light:new l.Color(new l.RGBA(10,50,100,.2)),hcDark:new l.Color(new l.RGBA(124,124,124,.3)),hcLight:new l.Color(new l.RGBA(10,50,100,.2))},l.localize(1916,"Highlight background color of a snippet tabstop.")),E("editor.snippetTabstopHighlightBorder",null,l.localize(1917,"Highlight border color of a snippet tabstop.")),E("editor.snippetFinalTabstopHighlightBackground",null,l.localize(1918,"Highlight background color of the final tabstop of a snippet.")),E("editor.snippetFinalTabstopHighlightBorder",{dark:"#525252",light:new l.Color(new l.RGBA(10,50,100,.5)),hcDark:"#525252",hcLight:"#292929"},l.localize(1919,"Highlight border color of the final tabstop of a snippet."));const JC=new l.Color(new l.RGBA(155,185,85,.2)),WC=new l.Color(new l.RGBA(255,0,0,.2)),BE=E("diffEditor.insertedTextBackground",{dark:"#9ccc2c33",light:"#9ccc2c40",hcDark:null,hcLight:null},l.localize(1920,"Background color for text that got inserted. The color must not be opaque so as not to hide underlying decorations."),!0),zE=E("diffEditor.removedTextBackground",{dark:"#ff000033",light:"#ff000033",hcDark:null,hcLight:null},l.localize(1921,"Background color for text that got removed. The color must not be opaque so as not to hide underlying decorations."),!0),PV=E("diffEditor.insertedLineBackground",{dark:JC,light:JC,hcDark:null,hcLight:null},l.localize(1922,"Background color for lines that got inserted. The color must not be opaque so as not to hide underlying decorations."),!0);E("diffEditor.removedLineBackground",{dark:WC,light:WC,hcDark:null,hcLight:null},l.localize(1923,"Background color for lines that got removed. The color must not be opaque so as not to hide underlying decorations."),!0),E("diffEditorGutter.insertedLineBackground",null,l.localize(1924,"Background color for the margin where lines got inserted.")),E("diffEditorGutter.removedLineBackground",null,l.localize(1925,"Background color for the margin where lines got removed."));const kV=E("diffEditorOverview.insertedForeground",null,l.localize(1926,"Diff overview ruler foreground for inserted content.")),FV=E("diffEditorOverview.removedForeground",null,l.localize(1927,"Diff overview ruler foreground for removed content."));E("diffEditor.insertedTextBorder",{dark:null,light:null,hcDark:"#33ff2eff",hcLight:"#374E06"},l.localize(1928,"Outline color for the text that got inserted.")),E("diffEditor.removedTextBorder",{dark:null,light:null,hcDark:"#FF008F",hcLight:"#AD0707"},l.localize(1929,"Outline color for text that got removed.")),E("diffEditor.border",{dark:null,light:null,hcDark:pe,hcLight:pe},l.localize(1930,"Border color between the two text editors.")),E("diffEditor.diagonalFill",{dark:"#cccccc33",light:"#22222233",hcDark:null,hcLight:null},l.localize(1931,"Color of the diff editor's diagonal fill. The diagonal fill is used in side-by-side diff views.")),E("diffEditor.unchangedRegionBackground","sideBar.background",l.localize(1932,"The background color of unchanged blocks in the diff editor.")),E("diffEditor.unchangedRegionForeground","foreground",l.localize(1933,"The foreground color of unchanged blocks in the diff editor.")),E("diffEditor.unchangedCodeBackground",{dark:"#74747429",light:"#b8b8b829",hcDark:null,hcLight:null},l.localize(1934,"The background color of unchanged code in the diff editor."));const oc=E("widget.shadow",{dark:ce(l.Color.black,.36),light:ce(l.Color.black,.16),hcDark:null,hcLight:null},l.localize(1935,"Shadow color of widgets such as find/replace inside the editor.")),HC=E("widget.border",{dark:null,light:null,hcDark:pe,hcLight:pe},l.localize(1936,"Border color of widgets such as find/replace inside the editor.")),VE=E("toolbar.hoverBackground",{dark:"#5a5d5e50",light:"#b8b8b850",hcDark:null,hcLight:null},l.localize(1937,"Toolbar background when hovering over actions using the mouse"));E("toolbar.hoverOutline",{dark:null,light:null,hcDark:ot,hcLight:ot},l.localize(1938,"Toolbar outline when hovering over actions using the mouse")),E("toolbar.activeBackground",{dark:kn(VE,.1),light:da(VE,.1),hcDark:null,hcLight:null},l.localize(1939,"Toolbar background when holding the mouse over actions"));const BV=E("breadcrumb.foreground",ce(De,.8),l.localize(1940,"Color of focused breadcrumb items.")),zV=E("breadcrumb.background",vn,l.localize(1941,"Background color of breadcrumb items.")),UE=E("breadcrumb.focusForeground",{light:da(De,.2),dark:kn(De,.1),hcDark:kn(De,.1),hcLight:kn(De,.1)},l.localize(1942,"Color of focused breadcrumb items.")),VV=E("breadcrumb.activeSelectionForeground",{light:da(De,.2),dark:kn(De,.1),hcDark:kn(De,.1),hcLight:kn(De,.1)},l.localize(1943,"Color of selected breadcrumb items."));E("breadcrumbPicker.background",wn,l.localize(1944,"Background color of breadcrumb item picker."));const $E=.5,KE=l.Color.fromHex("#40C8AE").transparent($E),GE=l.Color.fromHex("#40A6FF").transparent($E),jE=l.Color.fromHex("#606060").transparent(.4),ev=.4,rc=1,tv=E("merge.currentHeaderBackground",{dark:KE,light:KE,hcDark:null,hcLight:null},l.localize(1945,"Current header background in inline merge-conflicts. The color must not be opaque so as not to hide underlying decorations."),!0);E("merge.currentContentBackground",ce(tv,ev),l.localize(1946,"Current content background in inline merge-conflicts. The color must not be opaque so as not to hide underlying decorations."),!0);const iv=E("merge.incomingHeaderBackground",{dark:GE,light:GE,hcDark:null,hcLight:null},l.localize(1947,"Incoming header background in inline merge-conflicts. The color must not be opaque so as not to hide underlying decorations."),!0);E("merge.incomingContentBackground",ce(iv,ev),l.localize(1948,"Incoming content background in inline merge-conflicts. The color must not be opaque so as not to hide underlying decorations."),!0);const nv=E("merge.commonHeaderBackground",{dark:jE,light:jE,hcDark:null,hcLight:null},l.localize(1949,"Common ancestor header background in inline merge-conflicts. The color must not be opaque so as not to hide underlying decorations."),!0);E("merge.commonContentBackground",ce(nv,ev),l.localize(1950,"Common ancestor content background in inline merge-conflicts. The color must not be opaque so as not to hide underlying decorations."),!0);const ac=E("merge.border",{dark:null,light:null,hcDark:"#C3DF6F",hcLight:"#007ACC"},l.localize(1951,"Border color on headers and the splitter in inline merge-conflicts."));E("editorOverviewRuler.currentContentForeground",{dark:ce(tv,rc),light:ce(tv,rc),hcDark:ac,hcLight:ac},l.localize(1952,"Current overview ruler foreground for inline merge-conflicts.")),E("editorOverviewRuler.incomingContentForeground",{dark:ce(iv,rc),light:ce(iv,rc),hcDark:ac,hcLight:ac},l.localize(1953,"Incoming overview ruler foreground for inline merge-conflicts.")),E("editorOverviewRuler.commonContentForeground",{dark:ce(nv,rc),light:ce(nv,rc),hcDark:ac,hcLight:ac},l.localize(1954,"Common ancestor overview ruler foreground for inline merge-conflicts."));const UV=E("editorOverviewRuler.findMatchForeground",{dark:"#d186167e",light:"#d186167e",hcDark:"#AB5A00",hcLight:"#AB5A00"},l.localize(1955,"Overview ruler marker color for find matches. The color must not be opaque so as not to hide underlying decorations."),!0),$V=E("editorOverviewRuler.selectionHighlightForeground","#A0A0A0CC",l.localize(1956,"Overview ruler marker color for selection highlights. The color must not be opaque so as not to hide underlying decorations."),!0),KV=E("problemsErrorIcon.foreground",Ug,l.localize(1957,"The color used for the problems error icon.")),GV=E("problemsWarningIcon.foreground",ho,l.localize(1958,"The color used for the problems warning icon.")),jV=E("problemsInfoIcon.foreground",nr,l.localize(1959,"The color used for the problems info icon.")),qE=E("minimap.findMatchHighlight",Cs,l.localize(2051,"Minimap marker color for find matches."),!0),qV=E("minimap.selectionOccurrenceHighlight",$g,l.localize(2052,"Minimap marker color for repeating editor selections."),!0),YE=E("minimap.selectionHighlight",sr,l.localize(2053,"Minimap marker color for the editor selection."),!0),YV=E("minimap.infoHighlight",{dark:nr,light:nr,hcDark:Id,hcLight:Id},l.localize(2054,"Minimap marker color for infos.")),ZV=E("minimap.warningHighlight",{dark:ho,light:ho,hcDark:Ed,hcLight:Ed},l.localize(2055,"Minimap marker color for warnings.")),QV=E("minimap.errorHighlight",{dark:new l.Color(new l.RGBA(255,18,18,.7)),light:new l.Color(new l.RGBA(255,18,18,.7)),hcDark:new l.Color(new l.RGBA(255,50,50,1)),hcLight:"#B5200D"},l.localize(2056,"Minimap marker color for errors.")),XV=E("minimap.background",null,l.localize(2057,"Minimap background color.")),JV=E("minimap.foregroundOpacity",l.Color.fromHex("#000f"),l.localize(2058,'Opacity of foreground elements rendered in the minimap. For example, "#000000c0" will render the elements with 75% opacity.'));E("minimapSlider.background",ce(AE,.5),l.localize(2059,"Minimap slider background color.")),E("minimapSlider.hoverBackground",ce(OE,.5),l.localize(2060,"Minimap slider background color when hovering.")),E("minimapSlider.activeBackground",ce(PE,.5),l.localize(2061,"Minimap slider background color when clicked on.")),E("charts.foreground",De,l.localize(1857,"The foreground color used in charts.")),E("charts.lines",ce(De,.5),l.localize(1858,"The color used for horizontal lines in charts.")),E("charts.red",Ug,l.localize(1859,"The red color used in chart visualizations.")),E("charts.blue",nr,l.localize(1860,"The blue color used in chart visualizations.")),E("charts.yellow",ho,l.localize(1861,"The yellow color used in chart visualizations.")),E("charts.orange",qE,l.localize(1862,"The orange color used in chart visualizations.")),E("charts.green",{dark:"#89D185",light:"#388A34",hcDark:"#89D185",hcLight:"#374e06"},l.localize(1863,"The green color used in chart visualizations.")),E("charts.purple",{dark:"#B180D7",light:"#652D90",hcDark:"#B180D7",hcLight:"#652D90"},l.localize(1864,"The purple color used in chart visualizations."));const WV=E("list.focusBackground",null,l.localize(2008,"List/Tree background color for the focused item when the list/tree is active. An active list/tree has keyboard focus, an inactive does not.")),HV=E("list.focusForeground",null,l.localize(2009,"List/Tree foreground color for the focused item when the list/tree is active. An active list/tree has keyboard focus, an inactive does not.")),e2=E("list.focusOutline",{dark:bs,light:bs,hcDark:ot,hcLight:ot},l.localize(2010,"List/Tree outline color for the focused item when the list/tree is active. An active list/tree has keyboard focus, an inactive does not.")),t2=E("list.focusAndSelectionOutline",null,l.localize(2011,"List/Tree outline color for the focused item when the list/tree is active and selected. An active list/tree has keyboard focus, an inactive does not.")),fa=E("list.activeSelectionBackground",{dark:"#04395E",light:"#0060C0",hcDark:null,hcLight:l.Color.fromHex("#0F4A85").transparent(.1)},l.localize(2012,"List/Tree background color for the selected item when the list/tree is active. An active list/tree has keyboard focus, an inactive does not.")),Td=E("list.activeSelectionForeground",{dark:l.Color.white,light:l.Color.white,hcDark:null,hcLight:null},l.localize(2013,"List/Tree foreground color for the selected item when the list/tree is active. An active list/tree has keyboard focus, an inactive does not.")),ZE=E("list.activeSelectionIconForeground",null,l.localize(2014,"List/Tree icon foreground color for the selected item when the list/tree is active. An active list/tree has keyboard focus, an inactive does not.")),i2=E("list.inactiveSelectionBackground",{dark:"#37373D",light:"#E4E6F1",hcDark:null,hcLight:l.Color.fromHex("#0F4A85").transparent(.1)},l.localize(2015,"List/Tree background color for the selected item when the list/tree is inactive. An active list/tree has keyboard focus, an inactive does not.")),n2=E("list.inactiveSelectionForeground",null,l.localize(2016,"List/Tree foreground color for the selected item when the list/tree is inactive. An active list/tree has keyboard focus, an inactive does not.")),s2=E("list.inactiveSelectionIconForeground",null,l.localize(2017,"List/Tree icon foreground color for the selected item when the list/tree is inactive. An active list/tree has keyboard focus, an inactive does not.")),o2=E("list.inactiveFocusBackground",null,l.localize(2018,"List/Tree background color for the focused item when the list/tree is inactive. An active list/tree has keyboard focus, an inactive does not.")),r2=E("list.inactiveFocusOutline",null,l.localize(2019,"List/Tree outline color for the focused item when the list/tree is inactive. An active list/tree has keyboard focus, an inactive does not.")),ga=E("list.hoverBackground",{dark:"#2A2D2E",light:"#F0F0F0",hcDark:l.Color.white.transparent(.1),hcLight:l.Color.fromHex("#0F4A85").transparent(.1)},l.localize(2020,"List/Tree background when hovering over items using the mouse.")),sv=E("list.hoverForeground",null,l.localize(2021,"List/Tree foreground when hovering over items using the mouse.")),a2=E("list.dropBackground",{dark:"#062F4A",light:"#D6EBFF",hcDark:null,hcLight:null},l.localize(2022,"List/Tree drag and drop background when moving items over other items when using the mouse.")),l2=E("list.dropBetweenBackground",{dark:Fg,light:Fg,hcDark:null,hcLight:null},l.localize(2023,"List/Tree drag and drop border color when moving items between items when using the mouse.")),Nd=E("list.highlightForeground",{dark:"#2AAAFF",light:"#0066BF",hcDark:bs,hcLight:bs},l.localize(2024,"List/Tree foreground color of the match highlights when searching inside the list/tree.")),QE=E("list.focusHighlightForeground",{dark:Nd,light:pV(fa,Nd,"#BBE7FF"),hcDark:Nd,hcLight:Nd},l.localize(2025,"List/Tree foreground color of the match highlights on actively focused items when searching inside the list/tree."));E("list.invalidItemForeground",{dark:"#B89500",light:"#B89500",hcDark:"#B89500",hcLight:"#B5200D"},l.localize(2026,"List/Tree foreground color for invalid items, for example an unresolved root in explorer.")),E("list.errorForeground",{dark:"#F88070",light:"#B01011",hcDark:null,hcLight:null},l.localize(2027,"Foreground color of list items containing errors.")),E("list.warningForeground",{dark:"#CCA700",light:"#855F00",hcDark:null,hcLight:null},l.localize(2028,"Foreground color of list items containing warnings."));const c2=E("listFilterWidget.background",{light:da(wn,0),dark:kn(wn,0),hcDark:wn,hcLight:wn},l.localize(2029,"Background color of the type filter widget in lists and trees.")),h2=E("listFilterWidget.outline",{dark:l.Color.transparent,light:l.Color.transparent,hcDark:"#f38518",hcLight:"#007ACC"},l.localize(2030,"Outline color of the type filter widget in lists and trees.")),d2=E("listFilterWidget.noMatchesOutline",{dark:"#BE1100",light:"#BE1100",hcDark:pe,hcLight:pe},l.localize(2031,"Outline color of the type filter widget in lists and trees, when there are no matches.")),u2=E("listFilterWidget.shadow",oc,l.localize(2032,"Shadow color of the type filter widget in lists and trees."));E("list.filterMatchBackground",{dark:Cs,light:Cs,hcDark:null,hcLight:null},l.localize(2033,"Background color of the filtered match.")),E("list.filterMatchBorder",{dark:ua,light:ua,hcDark:pe,hcLight:ot},l.localize(2034,"Border color of the filtered match.")),E("list.deemphasizedForeground",{dark:"#8C8C8C",light:"#8E8E90",hcDark:"#A7A8A9",hcLight:"#666666"},l.localize(2035,"List/Tree foreground color for items that are deemphasized."));const XE=E("tree.indentGuidesStroke",{dark:"#585858",light:"#a9a9a9",hcDark:"#a9a9a9",hcLight:"#a5a5a5"},l.localize(2036,"Tree stroke color for the indentation guides.")),f2=E("tree.inactiveIndentGuidesStroke",ce(XE,.4),l.localize(2037,"Tree stroke color for the indentation guides that are not active.")),g2=E("tree.tableColumnsBorder",{dark:"#CCCCCC20",light:"#61616120",hcDark:null,hcLight:null},l.localize(2038,"Table border color between columns.")),m2=E("tree.tableOddRowsBackground",{dark:ce(De,.04),light:ce(De,.04),hcDark:null,hcLight:null},l.localize(2039,"Background color for odd table rows."));E("editorActionList.background",wn,l.localize(2040,"Action List background color."));const p2=E("editorActionList.foreground",sc,l.localize(2041,"Action List foreground color."));E("editorActionList.focusForeground",Td,l.localize(2042,"Action List foreground color for the focused item.")),E("editorActionList.focusBackground",fa,l.localize(2043,"Action List background color for the focused item."));const JE=E("input.background",{dark:"#3C3C3C",light:l.Color.white,hcDark:l.Color.black,hcLight:l.Color.white},l.localize(1960,"Input box background.")),WE=E("input.foreground",De,l.localize(1961,"Input box foreground.")),HE=E("input.border",{dark:null,light:null,hcDark:pe,hcLight:pe},l.localize(1962,"Input box border.")),ov=E("inputOption.activeBorder",{dark:"#007ACC",light:"#007ACC",hcDark:pe,hcLight:pe},l.localize(1963,"Border color of activated options in input fields.")),_2=E("inputOption.hoverBackground",{dark:"#5a5d5e80",light:"#b8b8b850",hcDark:null,hcLight:null},l.localize(1964,"Background color of activated options in input fields.")),rv=E("inputOption.activeBackground",{dark:ce(bs,.4),light:ce(bs,.2),hcDark:l.Color.transparent,hcLight:l.Color.transparent},l.localize(1965,"Background hover color of options in input fields.")),av=E("inputOption.activeForeground",{dark:l.Color.white,light:l.Color.black,hcDark:De,hcLight:De},l.localize(1966,"Foreground color of activated options in input fields."));E("input.placeholderForeground",{light:ce(De,.5),dark:ce(De,.5),hcDark:ce(De,.7),hcLight:ce(De,.7)},l.localize(1967,"Input box foreground color for placeholder text."));const b2=E("inputValidation.infoBackground",{dark:"#063B49",light:"#D6ECF2",hcDark:l.Color.black,hcLight:l.Color.white},l.localize(1968,"Input validation background color for information severity.")),C2=E("inputValidation.infoForeground",{dark:null,light:null,hcDark:null,hcLight:De},l.localize(1969,"Input validation foreground color for information severity.")),v2=E("inputValidation.infoBorder",{dark:"#007acc",light:"#007acc",hcDark:pe,hcLight:pe},l.localize(1970,"Input validation border color for information severity.")),w2=E("inputValidation.warningBackground",{dark:"#352A05",light:"#F6F5D2",hcDark:l.Color.black,hcLight:l.Color.white},l.localize(1971,"Input validation background color for warning severity.")),S2=E("inputValidation.warningForeground",{dark:null,light:null,hcDark:null,hcLight:De},l.localize(1972,"Input validation foreground color for warning severity.")),y2=E("inputValidation.warningBorder",{dark:"#B89500",light:"#B89500",hcDark:pe,hcLight:pe},l.localize(1973,"Input validation border color for warning severity.")),L2=E("inputValidation.errorBackground",{dark:"#5A1D1D",light:"#F2DEDE",hcDark:l.Color.black,hcLight:l.Color.white},l.localize(1974,"Input validation background color for error severity.")),D2=E("inputValidation.errorForeground",{dark:null,light:null,hcDark:null,hcLight:De},l.localize(1975,"Input validation foreground color for error severity.")),x2=E("inputValidation.errorBorder",{dark:"#BE1100",light:"#BE1100",hcDark:pe,hcLight:pe},l.localize(1976,"Input validation border color for error severity.")),Kg=E("dropdown.background",{dark:"#3C3C3C",light:l.Color.white,hcDark:l.Color.black,hcLight:l.Color.white},l.localize(1977,"Dropdown background.")),E2=E("dropdown.listBackground",{dark:null,light:null,hcDark:l.Color.black,hcLight:l.Color.white},l.localize(1978,"Dropdown list background.")),lv=E("dropdown.foreground",{dark:"#F0F0F0",light:De,hcDark:l.Color.white,hcLight:De},l.localize(1979,"Dropdown foreground.")),cv=E("dropdown.border",{dark:Kg,light:"#CECECE",hcDark:pe,hcLight:pe},l.localize(1980,"Dropdown border.")),hv=E("button.foreground",l.Color.white,l.localize(1981,"Button foreground color.")),I2=E("button.separator",ce(hv,.4),l.localize(1982,"Button separator color.")),lc=E("button.background",{dark:"#0E639C",light:"#007ACC",hcDark:l.Color.black,hcLight:"#0F4A85"},l.localize(1983,"Button background color.")),T2=E("button.hoverBackground",{dark:kn(lc,.2),light:da(lc,.2),hcDark:lc,hcLight:lc},l.localize(1984,"Button background color when hovering.")),N2=E("button.border",pe,l.localize(1985,"Button border color.")),R2=E("button.secondaryForeground",{dark:De,light:De,hcDark:l.Color.white,hcLight:De},l.localize(1986,"Secondary button foreground color.")),M2=E("button.secondaryBackground",{dark:ga,light:ga,hcDark:null,hcLight:l.Color.white},l.localize(1987,"Secondary button background color.")),A2=E("button.secondaryBorder",{dark:ce(De,.15),light:ce(De,.15),hcDark:pe,hcLight:pe},l.localize(1988,"Secondary button border color.")),O2=E("button.secondaryHoverBackground",{dark:kn(ga,.2),light:kn(ga,.2),hcDark:null,hcLight:null},l.localize(1989,"Secondary button background color when hovering.")),Rd=E("radio.activeForeground",av,l.localize(1990,"Foreground color of active radio option.")),P2=E("radio.activeBackground",rv,l.localize(1991,"Background color of active radio option.")),k2=E("radio.activeBorder",ov,l.localize(1992,"Border color of the active radio option.")),F2=E("radio.inactiveForeground",null,l.localize(1993,"Foreground color of inactive radio option.")),B2=E("radio.inactiveBackground",null,l.localize(1994,"Background color of inactive radio option.")),z2=E("radio.inactiveBorder",{light:ce(Rd,.2),dark:ce(Rd,.2),hcDark:ce(Rd,.4),hcLight:ce(Rd,.2)},l.localize(1995,"Border color of the inactive radio option.")),V2=E("radio.inactiveHoverBackground",_2,l.localize(1996,"Background color of inactive active radio option when hovering.")),dv=E("checkbox.background",Kg,l.localize(1997,"Background color of checkbox widget."));E("checkbox.selectBackground",wn,l.localize(1998,"Background color of checkbox widget when the element it's in is selected."));const uv=E("checkbox.foreground",lv,l.localize(1999,"Foreground color of checkbox widget.")),U2=E("checkbox.border",cv,l.localize(2e3,"Border color of checkbox widget."));E("checkbox.selectBorder",Fg,l.localize(2001,"Border color of checkbox widget when the element it's in is selected."));const $2=E("checkbox.disabled.background",{op:7,color:dv,with:uv,ratio:.33},l.localize(2002,"Background of a disabled checkbox.")),K2=E("checkbox.disabled.foreground",{op:7,color:uv,with:dv,ratio:.33},l.localize(2003,"Foreground of a disabled checkbox.")),G2=E("keybindingLabel.background",{dark:new l.Color(new l.RGBA(128,128,128,.17)),light:new l.Color(new l.RGBA(221,221,221,.4)),hcDark:l.Color.transparent,hcLight:l.Color.transparent},l.localize(2004,"Keybinding label background color. The keybinding label is used to represent a keyboard shortcut.")),j2=E("keybindingLabel.foreground",{dark:l.Color.fromHex("#CCCCCC"),light:l.Color.fromHex("#555555"),hcDark:l.Color.white,hcLight:De},l.localize(2005,"Keybinding label foreground color. The keybinding label is used to represent a keyboard shortcut.")),q2=E("keybindingLabel.border",{dark:new l.Color(new l.RGBA(51,51,51,.6)),light:new l.Color(new l.RGBA(204,204,204,.4)),hcDark:new l.Color(new l.RGBA(111,195,223)),hcLight:pe},l.localize(2006,"Keybinding label border color. The keybinding label is used to represent a keyboard shortcut.")),Y2=E("keybindingLabel.bottomBorder",{dark:new l.Color(new l.RGBA(68,68,68,.6)),light:new l.Color(new l.RGBA(187,187,187,.4)),hcDark:new l.Color(new l.RGBA(111,195,223)),hcLight:De},l.localize(2007,"Keybinding label border bottom color. The keybinding label is used to represent a keyboard shortcut.")),Z2=E("menu.border",{dark:null,light:null,hcDark:pe,hcLight:pe},l.localize(2044,"Border color of menus.")),Q2=E("menu.foreground",lv,l.localize(2045,"Foreground color of menu items.")),X2=E("menu.background",Kg,l.localize(2046,"Background color of menu items."));E("menu.selectionForeground",Td,l.localize(2047,"Foreground color of the selected menu item in menus.")),E("menu.selectionBackground",fa,l.localize(2048,"Background color of the selected menu item in menus."));const J2=E("menu.selectionBorder",{dark:null,light:null,hcDark:ot,hcLight:ot},l.localize(2049,"Border color of the selected menu item in menus.")),W2=E("menu.separatorBackground",{dark:ce(De,.2),light:ce(De,.2),hcDark:pe,hcLight:pe},l.localize(2050,"Color of a separator menu item in menus.")),fv=E("quickInput.background",wn,l.localize(2078,"Quick picker background color. The quick picker widget is the container for pickers like the command palette.")),H2=E("quickInput.foreground",sc,l.localize(2079,"Quick picker foreground color. The quick picker widget is the container for pickers like the command palette.")),e3=E("quickInputTitle.background",{dark:new l.Color(new l.RGBA(255,255,255,.105)),light:new l.Color(new l.RGBA(0,0,0,.06)),hcDark:"#000000",hcLight:l.Color.white},l.localize(2080,"Quick picker title background color. The quick picker widget is the container for pickers like the command palette.")),eI=E("pickerGroup.foreground",{dark:"#3794FF",light:"#0066BF",hcDark:l.Color.white,hcLight:"#0F4A85"},l.localize(2081,"Quick picker color for grouping labels.")),t3=E("pickerGroup.border",{dark:"#3F3F46",light:"#CCCEDB",hcDark:l.Color.white,hcLight:"#0F4A85"},l.localize(2082,"Quick picker color for grouping borders.")),tI=E("quickInput.list.focusBackground",null,"",void 0,l.localize(2083,"Please use quickInputList.focusBackground instead")),Md=E("quickInputList.focusForeground",Td,l.localize(2084,"Quick picker foreground color for the focused item.")),gv=E("quickInputList.focusIconForeground",ZE,l.localize(2085,"Quick picker icon foreground color for the focused item.")),Ad=E("quickInputList.focusBackground",{dark:YC(tI,fa),light:YC(tI,fa),hcDark:null,hcLight:null},l.localize(2086,"Quick picker background color for the focused item."));E("quickInputList.focusHighlightForeground",QE,l.localize(2087,"Quick picker foreground color of the match highlights on the focused item.")),E("search.resultsInfoForeground",{light:De,dark:ce(De,.65),hcDark:De,hcLight:De},l.localize(2088,"Color of the text in the search viewlet's completion message.")),E("searchEditor.findMatchBackground",{light:ce(Cs,.66),dark:ce(Cs,.66),hcDark:Cs,hcLight:Cs},l.localize(2089,"Color of the Search Editor query matches.")),E("searchEditor.findMatchBorder",{light:ce(ua,.66),dark:ce(ua,.66),hcDark:ua,hcLight:ua},l.localize(2090,"Border color of the Search Editor query matches."));class Od{constructor(e,t){this.x=e,this.y=t,this._pageCoordinatesBrand=void 0}toClientCoordinates(e){return new iI(this.x-e.scrollX,this.y-e.scrollY)}}class iI{constructor(e,t){this.clientX=e,this.clientY=t,this._clientCoordinatesBrand=void 0}toPageCoordinates(e){return new Od(this.clientX+e.scrollX,this.clientY+e.scrollY)}}class i3{constructor(e,t,i,n){this.x=e,this.y=t,this.width=i,this.height=n,this._editorPagePositionBrand=void 0}}class n3{constructor(e,t){this.x=e,this.y=t,this._positionRelativeToEditorBrand=void 0}}function Gg(o){const e=Qi(o);return new i3(e.left,e.top,e.width,e.height)}function jg(o,e,t){const i=e.width/o.offsetWidth,n=e.height/o.offsetHeight,s=(t.x-e.x)/i,r=(t.y-e.y)/n;return new n3(s,r)}class uo extends Bi{get editorPos(){return this._editorPos??=Gg(this._editorViewDomNode),this._editorPos}get relativePos(){return this._relativePos??=jg(this._editorViewDomNode,this.editorPos,this.pos),this._relativePos}constructor(e,t,i){super(j(i),e),this._editorMouseEventBrand=void 0,this.isFromPointerCapture=t,this.pos=new Od(this.posx,this.posy),this._editorViewDomNode=i}}class s3{constructor(e){this._editorViewDomNode=e}_create(e){return new uo(e,!1,this._editorViewDomNode)}onContextMenu(e,t){return R(e,F.CONTEXT_MENU,i=>{t(this._create(i))})}onMouseUp(e,t){return R(e,F.MOUSE_UP,i=>{t(this._create(i))})}onMouseDown(e,t){return R(e,F.MOUSE_DOWN,i=>{t(this._create(i))})}onPointerDown(e,t){return R(e,F.POINTER_DOWN,i=>{t(this._create(i),i.pointerId)})}onMouseLeave(e,t){return R(e,F.MOUSE_LEAVE,i=>{t(this._create(i))})}onMouseMove(e,t){return R(e,F.MOUSE_MOVE,i=>t(this._create(i)))}}class o3{constructor(e){this._editorViewDomNode=e}_create(e){return new uo(e,!1,this._editorViewDomNode)}onPointerUp(e,t){return R(e,"pointerup",i=>{t(this._create(i))})}onPointerDown(e,t){return R(e,F.POINTER_DOWN,i=>{t(this._create(i),i.pointerId)})}onPointerLeave(e,t){return R(e,F.POINTER_LEAVE,i=>{t(this._create(i))})}onPointerMove(e,t){return R(e,"pointermove",i=>t(this._create(i)))}}class r3 extends l.Disposable{constructor(e){super(),this._editorViewDomNode=e,this._globalPointerMoveMonitor=this._register(new xd),this._keydownListener=null}startMonitoring(e,t,i,n,s){this._keydownListener=At(e.ownerDocument,"keydown",r=>{r.toKeyCodeChord().isModifierKey()||this._globalPointerMoveMonitor.stopMonitoring(!0,r.browserEvent)},!0),this._globalPointerMoveMonitor.startMonitoring(e,t,i,r=>{n(new uo(r,!0,this._editorViewDomNode))},r=>{this._keydownListener.dispose(),s(r)})}stopMonitoring(){this._globalPointerMoveMonitor.stopMonitoring(!0)}}const Q_=class Q_{constructor(e){this._editor=e,this._instanceId=++Q_._idPool,this._counter=0,this._rules=new l.DisposableMap,this._garbageCollectionScheduler=new l.RunOnceScheduler(()=>this.garbageCollect(),1e3)}dispose(){this._rules.dispose(),this._garbageCollectionScheduler.dispose()}createClassNameRef(e){const t=this.getOrCreateRule(e);return t.increaseRefCount(),{className:t.className,dispose:()=>{t.decreaseRefCount(),this._garbageCollectionScheduler.schedule()}}}getOrCreateRule(e){const t=this.computeUniqueKey(e);let i=this._rules.get(t);if(!i){const n=this._counter++;i=new a3(t,`dyn-rule-${this._instanceId}-${n}`,Yf(this._editor.getContainerDomNode())?this._editor.getContainerDomNode():void 0,e),this._rules.set(t,i)}return i}computeUniqueKey(e){return JSON.stringify(e)}garbageCollect(){for(const e of this._rules.values())e.hasReferences()||this._rules.deleteAndDispose(e.key)}};Q_._idPool=0;let mv=Q_;class a3{constructor(e,t,i,n){this.key=e,this.className=t,this.properties=n,this._referenceCount=0,this._styleElementDisposables=new l.DisposableStore,this._styleElement=bn(i,void 0,this._styleElementDisposables),this._styleElement.textContent=this.getCssText(this.className,this.properties)}getCssText(e,t){let i=`.${e} {`;for(const n in t){const s=t[n];let r;typeof s=="object"?r=z(s.id):r=s;const a=l3(n);i+=`
|
||
${a}: ${r};`}return i+=`
|
||
}`,i}dispose(){this._styleElementDisposables.dispose(),this._styleElement=void 0}increaseRefCount(){this._referenceCount++}decreaseRefCount(){this._referenceCount--}hasReferences(){return this._referenceCount>0}}function l3(o){return o.replace(/(^[A-Z])/,([e])=>e.toLowerCase()).replace(/([A-Z])/g,([e])=>`-${e.toLowerCase()}`)}class ma extends l.Disposable{constructor(){super(),this._shouldRender=!0}shouldRender(){return this._shouldRender}forceShouldRender(){this._shouldRender=!0}setShouldRender(){this._shouldRender=!0}onDidRender(){this._shouldRender=!1}onCompositionStart(e){return!1}onCompositionEnd(e){return!1}onConfigurationChanged(e){return!1}onCursorStateChanged(e){return!1}onDecorationsChanged(e){return!1}onFlushed(e){return!1}onFocusChanged(e){return!1}onLanguageConfigurationChanged(e){return!1}onLineMappingChanged(e){return!1}onLinesChanged(e){return!1}onLinesDeleted(e){return!1}onLinesInserted(e){return!1}onRevealRangeRequest(e){return!1}onScrollChanged(e){return!1}onThemeChanged(e){return!1}onTokensChanged(e){return!1}onTokensColorsChanged(e){return!1}onZonesChanged(e){return!1}handleEvents(e){let t=!1;for(let i=0,n=e.length;i<n;i++){const s=e[i];switch(s.type){case 0:this.onCompositionStart(s)&&(t=!0);break;case 1:this.onCompositionEnd(s)&&(t=!0);break;case 2:this.onConfigurationChanged(s)&&(t=!0);break;case 3:this.onCursorStateChanged(s)&&(t=!0);break;case 4:this.onDecorationsChanged(s)&&(t=!0);break;case 5:this.onFlushed(s)&&(t=!0);break;case 6:this.onFocusChanged(s)&&(t=!0);break;case 7:this.onLanguageConfigurationChanged(s)&&(t=!0);break;case 8:this.onLineMappingChanged(s)&&(t=!0);break;case 9:this.onLinesChanged(s)&&(t=!0);break;case 10:this.onLinesDeleted(s)&&(t=!0);break;case 11:this.onLinesInserted(s)&&(t=!0);break;case 12:this.onRevealRangeRequest(s)&&(t=!0);break;case 13:this.onScrollChanged(s)&&(t=!0);break;case 15:this.onTokensChanged(s)&&(t=!0);break;case 14:this.onThemeChanged(s)&&(t=!0);break;case 16:this.onTokensColorsChanged(s)&&(t=!0);break;case 17:this.onZonesChanged(s)&&(t=!0);break;default:console.info("View received unknown event: "),console.info(s)}}t&&(this._shouldRender=!0)}}class gi extends ma{constructor(e){super(),this._context=e,this._context.addEventHandler(this)}dispose(){this._context.removeEventHandler(this),super.dispose()}onBeforeRender(e){}}class Jn{static write(e,t){e.setAttribute("data-mprt",String(t))}static read(e){const t=e.getAttribute("data-mprt");return t===null?0:parseInt(t,10)}static collect(e,t){const i=[];let n=0;for(;e&&e!==e.ownerDocument.body&&e!==t;)e.nodeType===e.ELEMENT_NODE&&(i[n++]=this.read(e)),e=e.parentElement;const s=new Uint8Array(n);for(let r=0;r<n;r++)s[r]=i[n-r-1];return s}}class c3{constructor(e,t){this._restrictedRenderingContextBrand=void 0,this._viewLayout=e,this.viewportData=t,this.scrollWidth=this._viewLayout.getScrollWidth(),this.scrollHeight=this._viewLayout.getScrollHeight(),this.visibleRange=this.viewportData.visibleRange,this.bigNumbersDelta=this.viewportData.bigNumbersDelta;const i=this._viewLayout.getCurrentViewport();this.scrollTop=i.top,this.scrollLeft=i.left,this.viewportWidth=i.width,this.viewportHeight=i.height}getScrolledTopFromAbsoluteTop(e){return e-this.scrollTop}getVerticalOffsetForLineNumber(e,t){return this._viewLayout.getVerticalOffsetForLineNumber(e,t)}getVerticalOffsetAfterLineNumber(e,t){return this._viewLayout.getVerticalOffsetAfterLineNumber(e,t)}getLineHeightForLineNumber(e){return this._viewLayout.getLineHeightForLineNumber(e)}getDecorationsInViewport(){return this.viewportData.getDecorationsInViewport()}}class h3 extends c3{constructor(e,t,i,n){super(e,t),this._renderingContextBrand=void 0,this._viewLines=i,this._viewLinesGpu=n}linesVisibleRangesForRange(e,t){const i=this._viewLines.linesVisibleRangesForRange(e,t);if(!this._viewLinesGpu)return i;const n=this._viewLinesGpu.linesVisibleRangesForRange(e,t);return i?n?i.concat(n).sort((s,r)=>s.lineNumber-r.lineNumber):i:n}visibleRangeForPosition(e){return this._viewLines.visibleRangeForPosition(e)??this._viewLinesGpu?.visibleRangeForPosition(e)??null}}class nI{constructor(e,t,i,n){this.outsideRenderedLine=e,this.lineNumber=t,this.ranges=i,this.continuesOnNextLine=n}}class Pd{static from(e){const t=new Array(e.length);for(let i=0,n=e.length;i<n;i++){const s=e[i];t[i]=new Pd(s.left,s.width)}return t}constructor(e,t){this._horizontalRangeBrand=void 0,this.left=Math.round(e),this.width=Math.round(t)}toString(){return`[${this.left},${this.width}]`}}class or{constructor(e,t){this._floatHorizontalRangeBrand=void 0,this.left=e,this.width=t}toString(){return`[${this.left},${this.width}]`}static compare(e,t){return e.left-t.left}}class sI{constructor(e,t){this.outsideRenderedLine=e,this.originalLeft=t,this.left=Math.round(this.originalLeft)}}class pv{constructor(e,t){this.outsideRenderedLine=e,this.ranges=t}}class qg{static _createRange(){return this._handyReadyRange||(this._handyReadyRange=document.createRange()),this._handyReadyRange}static _detachRange(e,t){e.selectNodeContents(t)}static _readClientRects(e,t,i,n,s){const r=this._createRange();try{return r.setStart(e,t),r.setEnd(i,n),r.getClientRects()}catch{return null}finally{this._detachRange(r,s)}}static _mergeAdjacentRanges(e){if(e.length===1)return e;e.sort(or.compare);const t=[];let i=0,n=e[0];for(let s=1,r=e.length;s<r;s++){const a=e[s];n.left+n.width+.9>=a.left?n.width=Math.max(n.width,a.left+a.width-n.left):(t[i++]=n,n=a)}return t[i++]=n,t}static _createHorizontalRangesFromClientRects(e,t,i){if(!e||e.length===0)return null;const n=[];for(let s=0,r=e.length;s<r;s++){const a=e[s];n[s]=new or(Math.max(0,(a.left-t)/i),a.width/i)}return this._mergeAdjacentRanges(n)}static readHorizontalRanges(e,t,i,n,s,r){const c=e.children.length-1;if(0>c)return null;if(t=Math.min(c,Math.max(0,t)),n=Math.min(c,Math.max(0,n)),t===n&&i===s&&i===0&&!e.children[t].firstChild){const f=e.children[t].getClientRects();return r.markDidDomLayout(),this._createHorizontalRangesFromClientRects(f,r.clientRectDeltaLeft,r.clientRectScale)}t!==n&&n>0&&s===0&&(n--,s=1073741824);let h=e.children[t].firstChild,d=e.children[n].firstChild;if((!h||!d)&&(!h&&i===0&&t>0&&(h=e.children[t-1].firstChild,i=1073741824),!d&&s===0&&n>0&&(d=e.children[n-1].firstChild,s=1073741824)),!h||!d)return null;i=Math.min(h.textContent.length,Math.max(0,i)),s=Math.min(d.textContent.length,Math.max(0,s));const u=this._readClientRects(h,i,d,s,r.endNode);return r.markDidDomLayout(),this._createHorizontalRangesFromClientRects(u,r.clientRectDeltaLeft,r.clientRectScale)}}var Sn;(function(o){o.DARK="dark",o.LIGHT="light",o.HIGH_CONTRAST_DARK="hcDark",o.HIGH_CONTRAST_LIGHT="hcLight"})(Sn||(Sn={}));var cc;(function(o){o.VS="vs",o.VS_DARK="vs-dark",o.HC_BLACK="hc-black",o.HC_LIGHT="hc-light"})(cc||(cc={}));function pa(o){return o===Sn.HIGH_CONTRAST_DARK||o===Sn.HIGH_CONTRAST_LIGHT}function rr(o){return o===Sn.DARK||o===Sn.HIGH_CONTRAST_DARK}const d3=(function(){return l.isNative?!0:!(l.isLinux||di||$r)})();let hc=!0;const X_=class X_{constructor(e,t){this._viewGpuContext=e,this._options=t,this._isMaybeInvalid=!0,this._renderedViewLine=null}getDomNode(){return this._renderedViewLine&&this._renderedViewLine.domNode?this._renderedViewLine.domNode.domNode:null}setDomNode(e){if(this._renderedViewLine)this._renderedViewLine.domNode=we(e);else throw new Error("I have no rendered view line to set the dom node to...")}onContentChanged(){this._isMaybeInvalid=!0}onTokensChanged(){this._isMaybeInvalid=!0}onDecorationsChanged(){this._isMaybeInvalid=!0}onOptionsChanged(e){this._isMaybeInvalid=!0,this._options=e}onSelectionChanged(){return pa(this._options.themeType)||this._renderedViewLine?.input.renderWhitespace===2?(this._isMaybeInvalid=!0,!0):!1}renderLine(e,t,i,n,s){if(this._options.useGpu&&this._viewGpuContext?.canRender(this._options,n,e))return this._renderedViewLine?.domNode?.domNode.remove(),this._renderedViewLine=null,!1;if(this._isMaybeInvalid===!1)return!1;this._isMaybeInvalid=!1;const r=n.getViewLineRenderingData(e),a=this._options,c=Ji.filter(r.inlineDecorations,e,r.minColumn,r.maxColumn),h=a.experimentalWhitespaceRendering==="off"?a.renderWhitespace:"none",d=!r.hasVariableFonts;let u=null;if(pa(a.themeType)||h==="selection"){const p=n.selections;for(const b of p){if(b.endLineNumber<e||b.startLineNumber>e)continue;const v=b.startLineNumber===e?b.startColumn:r.minColumn,C=b.endLineNumber===e?b.endColumn:r.maxColumn;v<C&&(pa(a.themeType)&&c.push(new Ji(v,C,"inline-selected-text",0)),h==="selection"&&(u||(u=[]),u.push(new l.OffsetRange(v-1,C-1))))}}const f=new Wo(a.useMonospaceOptimizations,a.canUseHalfwidthRightwardsArrow,r.content,r.continuesWithWrappedLine,r.isBasicASCII,r.containsRTL,r.minColumn-1,r.tokens,c,r.tabSize,r.startVisibleColumn,a.spaceWidth,a.middotWidth,a.wsmiddotWidth,a.stopRenderingLineAfter,h,a.renderControlCharacters,a.fontLigatures!==io.OFF,u,r.textDirection,a.verticalScrollbarSize);if(this._renderedViewLine&&this._renderedViewLine.input.equals(f))return!1;s.appendString("<div "),r.textDirection===l.TextDirection.RTL?s.appendString('dir="rtl" '):r.containsRTL&&s.appendString('dir="ltr" '),s.appendString('style="top:'),s.appendString(String(t)),s.appendString("px;height:"),s.appendString(String(i)),s.appendString("px;line-height:"),s.appendString(String(i)),r.textDirection===l.TextDirection.RTL&&(s.appendString("px;padding-right:"),s.appendString(String(a.verticalScrollbarSize))),s.appendString('px;" class="'),s.appendString(X_.CLASS_NAME),s.appendString('">');const g=bd(f,s);s.appendString("</div>");let m=null;return d&&hc&&d3&&r.isBasicASCII&&f.isLTR&&a.useMonospaceOptimizations&&g.containsForeignElements===0&&(m=new Yg(this._renderedViewLine?this._renderedViewLine.domNode:null,f,g.characterMapping)),m||(m=rI(this._renderedViewLine?this._renderedViewLine.domNode:null,f,g.characterMapping,g.containsForeignElements)),this._renderedViewLine=m,!0}layoutLine(e,t,i){this._renderedViewLine&&this._renderedViewLine.domNode&&(this._renderedViewLine.domNode.setTop(t),this._renderedViewLine.domNode.setHeight(i),this._renderedViewLine.domNode.setLineHeight(i))}isRenderedRTL(){return this._renderedViewLine?this._renderedViewLine.input.textDirection===l.TextDirection.RTL:!1}getWidth(e){return this._renderedViewLine?this._renderedViewLine.getWidth(e):0}getWidthIsFast(){return this._renderedViewLine?this._renderedViewLine.getWidthIsFast():!0}needsMonospaceFontCheck(){return this._renderedViewLine?this._renderedViewLine instanceof Yg:!1}monospaceAssumptionsAreValid(){return this._renderedViewLine&&this._renderedViewLine instanceof Yg?this._renderedViewLine.monospaceAssumptionsAreValid():hc}onMonospaceAssumptionsInvalidated(){this._renderedViewLine&&this._renderedViewLine instanceof Yg&&(this._renderedViewLine=this._renderedViewLine.toSlowRenderedLine())}getVisibleRangesForRange(e,t,i,n){if(!this._renderedViewLine)return null;t=Math.min(this._renderedViewLine.input.lineContent.length+1,Math.max(1,t)),i=Math.min(this._renderedViewLine.input.lineContent.length+1,Math.max(1,i));const s=this._renderedViewLine.input.stopRenderingLineAfter;if(s!==-1&&t>s+1&&i>s+1)return new pv(!0,[new or(this.getWidth(n),0)]);s!==-1&&t>s+1&&(t=s+1),s!==-1&&i>s+1&&(i=s+1);const r=this._renderedViewLine.getVisibleRangesForRange(e,t,i,n);return r&&r.length>0?new pv(!1,r):null}getColumnOfNodeOffset(e,t){return this._renderedViewLine?this._renderedViewLine.getColumnOfNodeOffset(e,t):1}resetCachedWidth(){this._renderedViewLine?.resetCachedWidth()}};X_.CLASS_NAME="view-line";let fo=X_;class Yg{constructor(e,t,i){this._cachedWidth=-1,this.domNode=e,this.input=t;const n=Math.floor(t.lineContent.length/300);if(n>0){this._keyColumnPixelOffsetCache=new Float32Array(n);for(let s=0;s<n;s++)this._keyColumnPixelOffsetCache[s]=-1}else this._keyColumnPixelOffsetCache=null;this._characterMapping=i,this._charWidth=t.spaceWidth}getWidth(e){if(!this.domNode||this.input.lineContent.length<300){const t=this._characterMapping.getHorizontalOffset(this._characterMapping.length);return Math.round(this._charWidth*t)}return this._cachedWidth===-1&&(this._cachedWidth=this._getReadingTarget(this.domNode).offsetWidth,e?.markDidDomLayout()),this._cachedWidth}getWidthIsFast(){return this.input.lineContent.length<300||this._cachedWidth!==-1}resetCachedWidth(){this._cachedWidth=-1}monospaceAssumptionsAreValid(){if(!this.domNode)return hc;if(this.input.lineContent.length<300){const e=this.getWidth(null),t=this.domNode.domNode.firstChild.offsetWidth;Math.abs(e-t)>=2&&(console.warn("monospace assumptions have been violated, therefore disabling monospace optimizations!"),hc=!1)}return hc}toSlowRenderedLine(){return rI(this.domNode,this.input,this._characterMapping,0)}getVisibleRangesForRange(e,t,i,n){const s=this._getColumnPixelOffset(e,t,n),r=this._getColumnPixelOffset(e,i,n);return[new or(s,r-s)]}_getColumnPixelOffset(e,t,i){if(t<=300){const h=this._characterMapping.getHorizontalOffset(t);return this._charWidth*h}const n=Math.floor((t-1)/300)-1,s=(n+1)*300+1;let r=-1;if(this._keyColumnPixelOffsetCache&&(r=this._keyColumnPixelOffsetCache[n],r===-1&&(r=this._actualReadPixelOffset(e,s,i),this._keyColumnPixelOffsetCache[n]=r)),r===-1){const h=this._characterMapping.getHorizontalOffset(t);return this._charWidth*h}const a=this._characterMapping.getHorizontalOffset(s),c=this._characterMapping.getHorizontalOffset(t);return r+this._charWidth*(c-a)}_getReadingTarget(e){return e.domNode.firstChild}_actualReadPixelOffset(e,t,i){if(!this.domNode)return-1;const n=this._characterMapping.getDomPosition(t),s=qg.readHorizontalRanges(this._getReadingTarget(this.domNode),n.partIndex,n.charIndex,n.partIndex,n.charIndex,i);return!s||s.length===0?-1:s[0].left}getColumnOfNodeOffset(e,t){return dc(this._characterMapping,e,t)}}class oI{constructor(e,t,i,n){if(this.domNode=e,this.input=t,this._characterMapping=i,this._isWhitespaceOnly=/^\s*$/.test(t.lineContent),this._containsForeignElements=n,this._cachedWidth=-1,this._pixelOffsetCache=null,t.isLTR){this._pixelOffsetCache=new Float32Array(Math.max(2,this._characterMapping.length+1));for(let s=0,r=this._characterMapping.length;s<=r;s++)this._pixelOffsetCache[s]=-1}}_getReadingTarget(e){return e.domNode.firstChild}getWidth(e){return this.domNode?(this._cachedWidth===-1&&(this._cachedWidth=this._getReadingTarget(this.domNode).offsetWidth,e?.markDidDomLayout()),this._cachedWidth):0}getWidthIsFast(){return this._cachedWidth!==-1}resetCachedWidth(){if(this._cachedWidth=-1,this._pixelOffsetCache!==null)for(let e=0,t=this._pixelOffsetCache.length;e<t;e++)this._pixelOffsetCache[e]=-1}getVisibleRangesForRange(e,t,i,n){if(!this.domNode)return null;if(this._pixelOffsetCache!==null){const s=this._readPixelOffset(this.domNode,e,t,n);if(s===-1)return null;const r=this._readPixelOffset(this.domNode,e,i,n);return r===-1?null:[new or(s,r-s)]}return this._readVisibleRangesForRange(this.domNode,e,t,i,n)}_readVisibleRangesForRange(e,t,i,n,s){if(i===n){const r=this._readPixelOffset(e,t,i,s);return r===-1?null:[new or(r,0)]}else return this._readRawVisibleRangesForRange(e,i,n,s)}_readPixelOffset(e,t,i,n){if(this.input.isLTR&&this._characterMapping.length===0){if(this._containsForeignElements===0||this._containsForeignElements===2)return 0;if(this._containsForeignElements===1)return this.getWidth(n);const s=this._getReadingTarget(e);return s.firstChild?(n.markDidDomLayout(),s.firstChild.offsetWidth):0}if(this._pixelOffsetCache!==null){const s=this._pixelOffsetCache[i];if(s!==-1)return s;const r=this._actualReadPixelOffset(e,t,i,n);return this._pixelOffsetCache[i]=r,r}return this._actualReadPixelOffset(e,t,i,n)}_actualReadPixelOffset(e,t,i,n){if(this._characterMapping.length===0){const c=qg.readHorizontalRanges(this._getReadingTarget(e),0,0,0,0,n);return!c||c.length===0?-1:c[0].left}if(this.input.isLTR&&i===this._characterMapping.length&&this._isWhitespaceOnly&&this._containsForeignElements===0)return this.getWidth(n);const s=this._characterMapping.getDomPosition(i),r=qg.readHorizontalRanges(this._getReadingTarget(e),s.partIndex,s.charIndex,s.partIndex,s.charIndex,n);if(!r||r.length===0)return-1;const a=r[0].left;if(this.input.isBasicASCII){const c=this._characterMapping.getHorizontalOffset(i),h=Math.round(this.input.spaceWidth*c);if(Math.abs(h-a)<=1)return h}return a}_readRawVisibleRangesForRange(e,t,i,n){if(this.input.isLTR&&t===1&&i===this._characterMapping.length)return[new or(0,this.getWidth(n))];const s=this._characterMapping.getDomPosition(t),r=this._characterMapping.getDomPosition(i);return qg.readHorizontalRanges(this._getReadingTarget(e),s.partIndex,s.charIndex,r.partIndex,r.charIndex,n)}getColumnOfNodeOffset(e,t){return dc(this._characterMapping,e,t)}}class u3 extends oI{_readVisibleRangesForRange(e,t,i,n,s){const r=super._readVisibleRangesForRange(e,t,i,n,s);if(!r||r.length===0||i===n||i===1&&n===this._characterMapping.length)return r;if(this.input.isLTR){const a=this._readPixelOffset(e,t,n,s);if(a!==-1){const c=r[r.length-1];c.left<a&&(c.width=a-c.left)}}return r}}const rI=(function(){return Ff?f3:g3})();function f3(o,e,t,i){return new u3(o,e,t,i)}function g3(o,e,t,i){return new oI(o,e,t,i)}function dc(o,e,t){const i=e.textContent.length;let n=-1;for(;e;)e=e.previousSibling,n++;return o.getColumn(new fE(n,t),i)}class Xe{static _nextVisibleColumn(e,t,i){return e===9?Xe.nextRenderTabStop(t,i):l.isFullWidthCharacter(e)||l.isEmojiImprecise(e)?t+2:t+1}static visibleColumnFromColumn(e,t,i){const n=Math.min(t-1,e.length),s=e.substring(0,n),r=new l.GraphemeIterator(s);let a=0;for(;!r.eol();){const c=l.getNextCodePoint(s,n,r.offset);r.nextGraphemeLength(),a=this._nextVisibleColumn(c,a,i)}return a}static columnFromVisibleColumn(e,t,i){if(t<=0)return 1;const n=e.length,s=new l.GraphemeIterator(e);let r=0,a=1;for(;!s.eol();){const c=l.getNextCodePoint(e,n,s.offset);s.nextGraphemeLength();const h=this._nextVisibleColumn(c,r,i),d=s.offset+1;if(h>=t){const u=t-r;return h-t<u?d:a}r=h,a=d}return n+1}static nextRenderTabStop(e,t){return e+t-e%t}static nextIndentTabStop(e,t){return Xe.nextRenderTabStop(e,t)}static prevRenderTabStop(e,t){return Math.max(0,e-1-(e-1)%t)}static prevIndentTabStop(e,t){return Xe.prevRenderTabStop(e,t)}}class kd{static whitespaceVisibleColumn(e,t,i){const n=e.length;let s=0,r=-1,a=-1;for(let c=0;c<n;c++){if(c===t)return[r,a,s];switch(s%i===0&&(r=c,a=s),e.charCodeAt(c)){case 32:s+=1;break;case 9:s=Xe.nextRenderTabStop(s,i);break;default:return[-1,-1,-1]}}return t===n?[r,a,s]:[-1,-1,-1]}static atomicPosition(e,t,i,n){const s=e.length,[r,a,c]=kd.whitespaceVisibleColumn(e,t,i);if(c===-1)return-1;let h;switch(n){case 0:h=!0;break;case 1:h=!1;break;case 2:if(c%i===0)return t;h=c%i<=i/2;break}if(h){if(r===-1)return-1;let f=a;for(let g=r;g<s;++g){if(f===a+i)return r;switch(e.charCodeAt(g)){case 32:f+=1;break;case 9:f=Xe.nextRenderTabStop(f,i);break;default:return-1}}return f===a+i?r:-1}const d=Xe.nextRenderTabStop(c,i);let u=c;for(let f=t;f<s;f++){if(u===d)return f;switch(e.charCodeAt(f)){case 32:u+=1;break;case 9:u=Xe.nextRenderTabStop(u,i);break;default:return-1}}return u===d?s:-1}}class ar{constructor(e=null){this.hitTarget=e,this.type=0}}class aI{get hitTarget(){return this.spanNode}constructor(e,t,i){this.position=e,this.spanNode=t,this.injectedText=i,this.type=1}}var _a;(function(o){function e(t,i,n){const s=t.getPositionFromDOMInfo(i,n);return s?new aI(s,i,null):new ar(i)}o.createFromDOMInfo=e})(_a||(_a={}));class m3{constructor(e,t){this.lastViewCursorsRenderData=e,this.lastTextareaPosition=t}}class $t{static _deduceRage(e,t=null){return!t&&e?new l.Range(e.lineNumber,e.column,e.lineNumber,e.column):t??null}static createUnknown(e,t,i){return{type:0,element:e,mouseColumn:t,position:i,range:this._deduceRage(i)}}static createTextarea(e,t){return{type:1,element:e,mouseColumn:t,position:null,range:null}}static createMargin(e,t,i,n,s,r){return{type:e,element:t,mouseColumn:i,position:n,range:s,detail:r}}static createViewZone(e,t,i,n,s){return{type:e,element:t,mouseColumn:i,position:n,range:this._deduceRage(n),detail:s}}static createContentText(e,t,i,n,s){return{type:6,element:e,mouseColumn:t,position:i,range:this._deduceRage(i,n),detail:s}}static createContentEmpty(e,t,i,n){return{type:7,element:e,mouseColumn:t,position:i,range:this._deduceRage(i),detail:n}}static createContentWidget(e,t,i){return{type:9,element:e,mouseColumn:t,position:null,range:null,detail:i}}static createScrollbar(e,t,i){return{type:11,element:e,mouseColumn:t,position:i,range:this._deduceRage(i)}}static createOverlayWidget(e,t,i){return{type:12,element:e,mouseColumn:t,position:null,range:null,detail:i}}static createOutsideEditor(e,t,i,n){return{type:13,element:null,mouseColumn:e,position:t,range:this._deduceRage(t),outsidePosition:i,outsideDistance:n}}static _typeToString(e){return e===1?"TEXTAREA":e===2?"GUTTER_GLYPH_MARGIN":e===3?"GUTTER_LINE_NUMBERS":e===4?"GUTTER_LINE_DECORATIONS":e===5?"GUTTER_VIEW_ZONE":e===6?"CONTENT_TEXT":e===7?"CONTENT_EMPTY":e===8?"CONTENT_VIEW_ZONE":e===9?"CONTENT_WIDGET":e===10?"OVERVIEW_RULER":e===11?"SCROLLBAR":e===12?"OVERLAY_WIDGET":"UNKNOWN"}static toString(e){return this._typeToString(e.type)+": "+e.position+" - "+e.range+" - "+JSON.stringify(e.detail)}}class mi{static isTextArea(e){return e.length===2&&e[0]===3&&e[1]===7}static isChildOfViewLines(e){return e.length>=4&&e[0]===3&&e[3]===8}static isStrictChildOfViewLines(e){return e.length>4&&e[0]===3&&e[3]===8}static isChildOfScrollableElement(e){return e.length>=2&&e[0]===3&&e[1]===6}static isChildOfMinimap(e){return e.length>=2&&e[0]===3&&e[1]===9}static isChildOfContentWidgets(e){return e.length>=4&&e[0]===3&&e[3]===1}static isChildOfOverflowGuard(e){return e.length>=1&&e[0]===3}static isChildOfOverflowingContentWidgets(e){return e.length>=1&&e[0]===2}static isChildOfOverlayWidgets(e){return e.length>=2&&e[0]===3&&e[1]===4}static isChildOfOverflowingOverlayWidgets(e){return e.length>=1&&e[0]===5}}class uc{constructor(e,t,i){this.viewModel=e.viewModel;const n=e.configuration.options;this.layoutInfo=n.get(165),this.viewDomNode=t.viewDomNode,this.viewLinesGpu=t.viewLinesGpu,this.lineHeight=n.get(75),this.stickyTabStops=n.get(132),this.typicalHalfwidthCharacterWidth=n.get(59).typicalHalfwidthCharacterWidth,this.lastRenderData=i,this._context=e,this._viewHelper=t}getZoneAtCoord(e){return uc.getZoneAtCoord(this._context,e)}static getZoneAtCoord(e,t){const i=e.viewLayout.getWhitespaceAtVerticalOffset(t);if(i){const n=i.verticalOffset+i.height/2,s=e.viewModel.getLineCount();let r=null,a,c=null;return i.afterLineNumber!==s&&(c=new l.Position(i.afterLineNumber+1,1)),i.afterLineNumber>0&&(r=new l.Position(i.afterLineNumber,e.viewModel.getLineMaxColumn(i.afterLineNumber))),c===null?a=r:r===null?a=c:t<n?a=r:a=c,{viewZoneId:i.id,afterLineNumber:i.afterLineNumber,positionBefore:r,positionAfter:c,position:a}}return null}getFullLineRangeAtCoord(e){if(this._context.viewLayout.isAfterLines(e)){const n=this._context.viewModel.getLineCount(),s=this._context.viewModel.getLineMaxColumn(n);return{range:new l.Range(n,s,n,s),isAfterLines:!0}}const t=this._context.viewLayout.getLineNumberAtVerticalOffset(e),i=this._context.viewModel.getLineMaxColumn(t);return{range:new l.Range(t,1,t,i),isAfterLines:!1}}getLineNumberAtVerticalOffset(e){return this._context.viewLayout.getLineNumberAtVerticalOffset(e)}isAfterLines(e){return this._context.viewLayout.isAfterLines(e)}isInTopPadding(e){return this._context.viewLayout.isInTopPadding(e)}isInBottomPadding(e){return this._context.viewLayout.isInBottomPadding(e)}getVerticalOffsetForLineNumber(e){return this._context.viewLayout.getVerticalOffsetForLineNumber(e)}findAttribute(e,t){return uc._findAttribute(e,t,this._viewHelper.viewDomNode)}static _findAttribute(e,t,i){for(;e&&e!==e.ownerDocument.body;){if(e.hasAttribute&&e.hasAttribute(t))return e.getAttribute(t);if(e===i)return null;e=e.parentNode}return null}getLineWidth(e){return this._viewHelper.getLineWidth(e)}isRtl(e){return this.viewModel.getTextDirection(e)===l.TextDirection.RTL}visibleRangeForPosition(e,t){return this._viewHelper.visibleRangeForPosition(e,t)}getPositionFromDOMInfo(e,t){return this._viewHelper.getPositionFromDOMInfo(e,t)}getCurrentScrollTop(){return this._context.viewLayout.getCurrentScrollTop()}getCurrentScrollLeft(){return this._context.viewLayout.getCurrentScrollLeft()}}class p3{constructor(e,t,i,n){this.editorPos=t,this.pos=i,this.relativePos=n,this.mouseVerticalOffset=Math.max(0,e.getCurrentScrollTop()+this.relativePos.y),this.mouseContentHorizontalOffset=e.getCurrentScrollLeft()+this.relativePos.x-e.layoutInfo.contentLeft,this.isInMarginArea=this.relativePos.x<e.layoutInfo.contentLeft&&this.relativePos.x>=e.layoutInfo.glyphMarginLeft,this.isInContentArea=!this.isInMarginArea,this.mouseColumn=Math.max(0,ai._getMouseColumn(this.mouseContentHorizontalOffset,e.typicalHalfwidthCharacterWidth))}}class _3 extends p3{get target(){return this._useHitTestTarget?this.hitTestResult.value.hitTarget:this._eventTarget}get targetPath(){return this._targetPathCacheElement!==this.target&&(this._targetPathCacheElement=this.target,this._targetPathCacheValue=Jn.collect(this.target,this._ctx.viewDomNode)),this._targetPathCacheValue}constructor(e,t,i,n,s){super(e,t,i,n),this.hitTestResult=new l.Lazy(()=>ai.doHitTest(this._ctx,this)),this._targetPathCacheElement=null,this._targetPathCacheValue=new Uint8Array(0),this._ctx=e,this._eventTarget=s;const r=!!this._eventTarget;this._useHitTestTarget=!r}toString(){return`pos(${this.pos.x},${this.pos.y}), editorPos(${this.editorPos.x},${this.editorPos.y}), relativePos(${this.relativePos.x},${this.relativePos.y}), mouseVerticalOffset: ${this.mouseVerticalOffset}, mouseContentHorizontalOffset: ${this.mouseContentHorizontalOffset}
|
||
target: ${this.target?this.target.outerHTML:null}`}get wouldBenefitFromHitTestTargetSwitch(){return!this._useHitTestTarget&&this.hitTestResult.value.hitTarget!==null&&this.target!==this.hitTestResult.value.hitTarget}switchToHitTestTarget(){this._useHitTestTarget=!0}_getMouseColumn(e=null){return e&&e.column<this._ctx.viewModel.getLineMaxColumn(e.lineNumber)?Xe.visibleColumnFromColumn(this._ctx.viewModel.getLineContent(e.lineNumber),e.column,this._ctx.viewModel.model.getOptions().tabSize)+1:this.mouseColumn}fulfillUnknown(e=null){return $t.createUnknown(this.target,this._getMouseColumn(e),e)}fulfillTextarea(){return $t.createTextarea(this.target,this._getMouseColumn())}fulfillMargin(e,t,i,n){return $t.createMargin(e,this.target,this._getMouseColumn(t),t,i,n)}fulfillViewZone(e,t,i){return $t.createViewZone(e,this.target,this._getMouseColumn(),t,i)}fulfillContentText(e,t,i){return $t.createContentText(this.target,this._getMouseColumn(e),e,t,i)}fulfillContentEmpty(e,t){return $t.createContentEmpty(this.target,this._getMouseColumn(e),e,t)}fulfillContentWidget(e){return $t.createContentWidget(this.target,this._getMouseColumn(),e)}fulfillScrollbar(e){return $t.createScrollbar(this.target,this._getMouseColumn(e),e)}fulfillOverlayWidget(e){return $t.createOverlayWidget(this.target,this._getMouseColumn(),e)}}const lI={isAfterLines:!0};function ba(o){return{isAfterLines:!1,horizontalDistanceToText:o}}class ai{constructor(e,t){this._context=e,this._viewHelper=t}mouseTargetIsWidget(e){const t=e.target,i=Jn.collect(t,this._viewHelper.viewDomNode);return!!(mi.isChildOfContentWidgets(i)||mi.isChildOfOverflowingContentWidgets(i)||mi.isChildOfOverlayWidgets(i)||mi.isChildOfOverflowingOverlayWidgets(i))}createMouseTarget(e,t,i,n,s){const r=new uc(this._context,this._viewHelper,e),a=new _3(r,t,i,n,s);try{const c=ai._createMouseTarget(r,a);if(c.type===6&&r.stickyTabStops&&c.position!==null){const h=ai._snapToSoftTabBoundary(c.position,r.viewModel),d=l.Range.fromPositions(h,h).plusRange(c.range);return a.fulfillContentText(h,d,c.detail)}return c}catch{return a.fulfillUnknown()}}static _createMouseTarget(e,t){if(t.target===null)return t.fulfillUnknown();const i=t;let n=null;return!mi.isChildOfOverflowGuard(t.targetPath)&&!mi.isChildOfOverflowingContentWidgets(t.targetPath)&&!mi.isChildOfOverflowingOverlayWidgets(t.targetPath)&&(n=n||t.fulfillUnknown()),n=n||ai._hitTestContentWidget(e,i),n=n||ai._hitTestOverlayWidget(e,i),n=n||ai._hitTestMinimap(e,i),n=n||ai._hitTestScrollbarSlider(e,i),n=n||ai._hitTestViewZone(e,i),n=n||ai._hitTestMargin(e,i),n=n||ai._hitTestViewCursor(e,i),n=n||ai._hitTestTextArea(e,i),n=n||ai._hitTestViewLines(e,i),n=n||ai._hitTestScrollbar(e,i),n||t.fulfillUnknown()}static _hitTestContentWidget(e,t){if(mi.isChildOfContentWidgets(t.targetPath)||mi.isChildOfOverflowingContentWidgets(t.targetPath)){const i=e.findAttribute(t.target,"widgetId");return i?t.fulfillContentWidget(i):t.fulfillUnknown()}return null}static _hitTestOverlayWidget(e,t){if(mi.isChildOfOverlayWidgets(t.targetPath)||mi.isChildOfOverflowingOverlayWidgets(t.targetPath)){const i=e.findAttribute(t.target,"widgetId");return i?t.fulfillOverlayWidget(i):t.fulfillUnknown()}return null}static _hitTestViewCursor(e,t){if(t.target){const i=e.lastRenderData.lastViewCursorsRenderData;for(const n of i)if(t.target===n.domNode)return t.fulfillContentText(n.position,null,{mightBeForeignElement:!1,injectedText:null})}if(t.isInContentArea){const i=e.lastRenderData.lastViewCursorsRenderData,n=t.mouseContentHorizontalOffset,s=t.mouseVerticalOffset;for(const r of i){if(n<r.contentLeft||n>r.contentLeft+r.width)continue;const a=e.getVerticalOffsetForLineNumber(r.position.lineNumber);if(a<=s&&s<=a+r.height)return t.fulfillContentText(r.position,null,{mightBeForeignElement:!1,injectedText:null})}}return null}static _hitTestViewZone(e,t){const i=e.getZoneAtCoord(t.mouseVerticalOffset);if(i){const n=t.isInContentArea?8:5;return t.fulfillViewZone(n,i.position,i)}return null}static _hitTestTextArea(e,t){return mi.isTextArea(t.targetPath)?e.lastRenderData.lastTextareaPosition?t.fulfillContentText(e.lastRenderData.lastTextareaPosition,null,{mightBeForeignElement:!1,injectedText:null}):t.fulfillTextarea():null}static _hitTestMargin(e,t){if(t.isInMarginArea){const i=e.getFullLineRangeAtCoord(t.mouseVerticalOffset),n=i.range.getStartPosition();let s=Math.abs(t.relativePos.x);const r={isAfterLines:i.isAfterLines,glyphMarginLeft:e.layoutInfo.glyphMarginLeft,glyphMarginWidth:e.layoutInfo.glyphMarginWidth,lineNumbersWidth:e.layoutInfo.lineNumbersWidth,offsetX:s};if(s-=e.layoutInfo.glyphMarginLeft,s<=e.layoutInfo.glyphMarginWidth){const a=e.viewModel.coordinatesConverter.convertViewPositionToModelPosition(i.range.getStartPosition()),c=e.viewModel.glyphLanes.getLanesAtLine(a.lineNumber);return r.glyphMarginLane=c[Math.floor(s/e.lineHeight)],t.fulfillMargin(2,n,i.range,r)}return s-=e.layoutInfo.glyphMarginWidth,s<=e.layoutInfo.lineNumbersWidth?t.fulfillMargin(3,n,i.range,r):(s-=e.layoutInfo.lineNumbersWidth,t.fulfillMargin(4,n,i.range,r))}return null}static _hitTestViewLines(e,t){if(!mi.isChildOfViewLines(t.targetPath))return null;if(e.isInTopPadding(t.mouseVerticalOffset))return t.fulfillContentEmpty(new l.Position(1,1),lI);if(e.isAfterLines(t.mouseVerticalOffset)||e.isInBottomPadding(t.mouseVerticalOffset)){const n=e.viewModel.getLineCount(),s=e.viewModel.getLineMaxColumn(n);return t.fulfillContentEmpty(new l.Position(n,s),lI)}if(mi.isStrictChildOfViewLines(t.targetPath)){const n=e.getLineNumberAtVerticalOffset(t.mouseVerticalOffset),s=e.viewModel.getLineLength(n),r=e.getLineWidth(n);if(s===0){const c=ba(t.mouseContentHorizontalOffset-r);return t.fulfillContentEmpty(new l.Position(n,1),c)}if(e.isRtl(n)){if(t.mouseContentHorizontalOffset+r<=e.layoutInfo.contentWidth-e.layoutInfo.verticalScrollbarWidth){const c=ba(t.mouseContentHorizontalOffset-r),h=new l.Position(n,e.viewModel.getLineMaxColumn(n));return t.fulfillContentEmpty(h,c)}}else if(t.mouseContentHorizontalOffset>=r){const c=ba(t.mouseContentHorizontalOffset-r),h=new l.Position(n,e.viewModel.getLineMaxColumn(n));return t.fulfillContentEmpty(h,c)}}else if(e.viewLinesGpu){const n=e.getLineNumberAtVerticalOffset(t.mouseVerticalOffset);if(e.viewModel.getLineLength(n)===0){const c=e.getLineWidth(n),h=ba(t.mouseContentHorizontalOffset-c);return t.fulfillContentEmpty(new l.Position(n,1),h)}const s=e.getLineWidth(n);if(e.isRtl(n)){if(t.mouseContentHorizontalOffset+s<=e.layoutInfo.contentWidth-e.layoutInfo.verticalScrollbarWidth){const c=ba(t.mouseContentHorizontalOffset-s),h=new l.Position(n,e.viewModel.getLineMaxColumn(n));return t.fulfillContentEmpty(h,c)}}else if(t.mouseContentHorizontalOffset>=s){const c=ba(t.mouseContentHorizontalOffset-s),h=new l.Position(n,e.viewModel.getLineMaxColumn(n));return t.fulfillContentEmpty(h,c)}const a=e.viewLinesGpu.getPositionAtCoordinate(n,t.mouseContentHorizontalOffset);if(a){const c={injectedText:null,mightBeForeignElement:!1};return t.fulfillContentText(a,l.Range.fromPositions(a,a),c)}}const i=t.hitTestResult.value;return i.type===1?ai.createMouseTargetFromHitTestPosition(e,t,i.spanNode,i.position,i.injectedText):t.wouldBenefitFromHitTestTargetSwitch?(t.switchToHitTestTarget(),this._createMouseTarget(e,t)):t.fulfillUnknown()}static _hitTestMinimap(e,t){if(mi.isChildOfMinimap(t.targetPath)){const i=e.getLineNumberAtVerticalOffset(t.mouseVerticalOffset),n=e.viewModel.getLineMaxColumn(i);return t.fulfillScrollbar(new l.Position(i,n))}return null}static _hitTestScrollbarSlider(e,t){if(mi.isChildOfScrollableElement(t.targetPath)&&t.target&&t.target.nodeType===1){const i=t.target.className;if(i&&/\b(slider|scrollbar)\b/.test(i)){const n=e.getLineNumberAtVerticalOffset(t.mouseVerticalOffset),s=e.viewModel.getLineMaxColumn(n);return t.fulfillScrollbar(new l.Position(n,s))}}return null}static _hitTestScrollbar(e,t){if(mi.isChildOfScrollableElement(t.targetPath)){const i=e.getLineNumberAtVerticalOffset(t.mouseVerticalOffset),n=e.viewModel.getLineMaxColumn(i);return t.fulfillScrollbar(new l.Position(i,n))}return null}getMouseColumn(e){const t=this._context.configuration.options,i=t.get(165),n=this._context.viewLayout.getCurrentScrollLeft()+e.x-i.contentLeft;return ai._getMouseColumn(n,t.get(59).typicalHalfwidthCharacterWidth)}static _getMouseColumn(e,t){return e<0?1:Math.round(e/t)+1}static createMouseTargetFromHitTestPosition(e,t,i,n,s){const r=n.lineNumber,a=n.column,c=e.getLineWidth(r);if(t.mouseContentHorizontalOffset>c){const v=ba(t.mouseContentHorizontalOffset-c);return t.fulfillContentEmpty(n,v)}const h=e.visibleRangeForPosition(r,a);if(!h)return t.fulfillUnknown(n);const d=h.left;if(Math.abs(t.mouseContentHorizontalOffset-d)<1)return t.fulfillContentText(n,null,{mightBeForeignElement:!!s,injectedText:s});const u=[];if(u.push({offset:h.left,column:a}),a>1){const v=e.visibleRangeForPosition(r,a-1);v&&u.push({offset:v.left,column:a-1})}const f=e.viewModel.getLineMaxColumn(r);if(a<f){const v=e.visibleRangeForPosition(r,a+1);v&&u.push({offset:v.left,column:a+1})}u.sort((v,C)=>v.offset-C.offset);const g=t.pos.toClientCoordinates(j(e.viewDomNode)),m=i.getBoundingClientRect(),p=m.left<=g.clientX&&g.clientX<=m.right;let b=null;for(let v=1;v<u.length;v++){const C=u[v-1],w=u[v];if(C.offset<=t.mouseContentHorizontalOffset&&t.mouseContentHorizontalOffset<=w.offset){b=new l.Range(r,C.column,r,w.column);const S=Math.abs(C.offset-t.mouseContentHorizontalOffset),L=Math.abs(w.offset-t.mouseContentHorizontalOffset);n=S<L?new l.Position(r,C.column):new l.Position(r,w.column);break}}return t.fulfillContentText(n,b,{mightBeForeignElement:!p||!!s,injectedText:s})}static _doHitTestWithCaretRangeFromPoint(e,t){const i=e.getLineNumberAtVerticalOffset(t.mouseVerticalOffset),n=e.getVerticalOffsetForLineNumber(i),s=n+e.lineHeight;if(!(i===e.viewModel.getLineCount()&&t.mouseVerticalOffset>s)){const a=Math.floor((n+s)/2);let c=t.pos.y+(a-t.mouseVerticalOffset);c<=t.editorPos.y&&(c=t.editorPos.y+1),c>=t.editorPos.y+t.editorPos.height&&(c=t.editorPos.y+t.editorPos.height-1);const h=new Od(t.pos.x,c),d=this._actualDoHitTestWithCaretRangeFromPoint(e,h.toClientCoordinates(j(e.viewDomNode)));if(d.type===1)return d}return this._actualDoHitTestWithCaretRangeFromPoint(e,t.pos.toClientCoordinates(j(e.viewDomNode)))}static _actualDoHitTestWithCaretRangeFromPoint(e,t){const i=qo(e.viewDomNode);let n;if(i?typeof i.caretRangeFromPoint>"u"?n=b3(i,t.clientX,t.clientY):n=i.caretRangeFromPoint(t.clientX,t.clientY):n=e.viewDomNode.ownerDocument.caretRangeFromPoint(t.clientX,t.clientY),!n||!n.startContainer)return new ar;const s=n.startContainer;if(s.nodeType===s.TEXT_NODE){const r=s.parentNode,a=r?r.parentNode:null,c=a?a.parentNode:null;return(c&&c.nodeType===c.ELEMENT_NODE?c.className:null)===fo.CLASS_NAME?_a.createFromDOMInfo(e,r,n.startOffset):new ar(s.parentNode)}else if(s.nodeType===s.ELEMENT_NODE){const r=s.parentNode,a=r?r.parentNode:null;return(a&&a.nodeType===a.ELEMENT_NODE?a.className:null)===fo.CLASS_NAME?_a.createFromDOMInfo(e,s,s.textContent.length):new ar(s)}return new ar}static _doHitTestWithCaretPositionFromPoint(e,t){const i=e.viewDomNode.ownerDocument.caretPositionFromPoint(t.clientX,t.clientY);if(i.offsetNode.nodeType===i.offsetNode.TEXT_NODE){const n=i.offsetNode.parentNode,s=n?n.parentNode:null,r=s?s.parentNode:null;return(r&&r.nodeType===r.ELEMENT_NODE?r.className:null)===fo.CLASS_NAME?_a.createFromDOMInfo(e,i.offsetNode.parentNode,i.offset):new ar(i.offsetNode.parentNode)}if(i.offsetNode.nodeType===i.offsetNode.ELEMENT_NODE){const n=i.offsetNode.parentNode,s=n&&n.nodeType===n.ELEMENT_NODE?n.className:null,r=n?n.parentNode:null,a=r&&r.nodeType===r.ELEMENT_NODE?r.className:null;if(s===fo.CLASS_NAME){const c=i.offsetNode.childNodes[Math.min(i.offset,i.offsetNode.childNodes.length-1)];if(c)return _a.createFromDOMInfo(e,c,0)}else if(a===fo.CLASS_NAME)return _a.createFromDOMInfo(e,i.offsetNode,0)}return new ar(i.offsetNode)}static _snapToSoftTabBoundary(e,t){const i=t.getLineContent(e.lineNumber),{tabSize:n}=t.model.getOptions(),s=kd.atomicPosition(i,e.column-1,n,2);return s!==-1?new l.Position(e.lineNumber,s+1):e}static doHitTest(e,t){let i=new ar;if(typeof e.viewDomNode.ownerDocument.caretRangeFromPoint=="function"?i=this._doHitTestWithCaretRangeFromPoint(e,t):e.viewDomNode.ownerDocument.caretPositionFromPoint&&(i=this._doHitTestWithCaretPositionFromPoint(e,t.pos.toClientCoordinates(j(e.viewDomNode)))),i.type===1){const n=e.viewModel.getInjectedTextAt(i.position),s=e.viewModel.normalizePosition(i.position,2);(n||!s.equals(i.position))&&(i=new aI(s,i.spanNode,n))}return i}}function b3(o,e,t){const i=document.createRange();let n=o.elementFromPoint(e,t);if(n?.hasChildNodes()){for(;n&&n.firstChild&&n.firstChild.nodeType!==n.firstChild.TEXT_NODE&&n.lastChild&&n.lastChild.firstChild;)n=n.lastChild;const s=n.getBoundingClientRect(),a=j(n).getComputedStyle(n,null),c=a.getPropertyValue("font-style"),h=a.getPropertyValue("font-variant"),d=a.getPropertyValue("font-weight"),u=a.getPropertyValue("font-size"),f=a.getPropertyValue("line-height"),g=a.getPropertyValue("font-family"),m=`${c} ${h} ${d} ${u}/${f} ${g}`,p=n.innerText;let b=s.left,v=0,C;if(e>s.left+s.width)v=p.length;else{const w=_v.getInstance();for(let S=0;S<p.length+1;S++){if(C=w.getCharWidth(p.charAt(S),m)/2,b+=C,e<b){v=S;break}b+=C}}i.setStart(n.firstChild,v),i.setEnd(n.firstChild,v)}return i}const wl=class wl{static getInstance(){return wl._INSTANCE||(wl._INSTANCE=new wl),wl._INSTANCE}constructor(){this._cache={},this._canvas=document.createElement("canvas")}getCharWidth(e,t){const i=e+t;if(this._cache[i])return this._cache[i];const n=this._canvas.getContext("2d");n.font=t;const r=n.measureText(e).width;return this._cache[i]=r,r}};wl._INSTANCE=null;let _v=wl;function et(o,e,t){let i=null,n=null;if(typeof t.value=="function"?(i="value",n=t.value,n.length!==0&&console.warn("Memoize should only be used in functions with zero parameters")):typeof t.get=="function"&&(i="get",n=t.get),!n)throw new Error("not supported");const s=`$memoize$${e}`;t[i]=function(...r){return this.hasOwnProperty(s)||Object.defineProperty(this,s,{configurable:!1,enumerable:!1,writable:!1,value:n.apply(this,r)}),this[s]}}var C3=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s};_.EventType$1=void 0,(function(o){o.Tap="-monaco-gesturetap",o.Change="-monaco-gesturechange",o.Start="-monaco-gesturestart",o.End="-monaco-gesturesend",o.Contextmenu="-monaco-gesturecontextmenu"})(_.EventType$1||(_.EventType$1={}));const Qt=class Qt extends l.Disposable{constructor(){super(),this.dispatched=!1,this.targets=new l.LinkedList,this.ignoreTargets=new l.LinkedList,this.activeTouches={},this.handle=null,this._lastSetTapCountTime=0,this._register(l.Event.runAndSubscribe(id,({window:e,disposables:t})=>{t.add(R(e.document,"touchstart",i=>this.onTouchStart(i),{passive:!1})),t.add(R(e.document,"touchend",i=>this.onTouchEnd(e,i))),t.add(R(e.document,"touchmove",i=>this.onTouchMove(i),{passive:!1}))},{window:Ae,disposables:this._store}))}static addTarget(e){if(!Qt.isTouchDevice())return l.Disposable.None;Qt.INSTANCE||(Qt.INSTANCE=l.markAsSingleton(new Qt));const t=Qt.INSTANCE.targets.push(e);return l.toDisposable(t)}static ignoreTarget(e){if(!Qt.isTouchDevice())return l.Disposable.None;Qt.INSTANCE||(Qt.INSTANCE=l.markAsSingleton(new Qt));const t=Qt.INSTANCE.ignoreTargets.push(e);return l.toDisposable(t)}static isTouchDevice(){return"ontouchstart"in Ae||navigator.maxTouchPoints>0}dispose(){this.handle&&(this.handle.dispose(),this.handle=null),super.dispose()}onTouchStart(e){const t=Date.now();this.handle&&(this.handle.dispose(),this.handle=null);for(let i=0,n=e.targetTouches.length;i<n;i++){const s=e.targetTouches.item(i);this.activeTouches[s.identifier]={id:s.identifier,initialTarget:s.target,initialTimeStamp:t,initialPageX:s.pageX,initialPageY:s.pageY,rollingTimestamps:[t],rollingPageX:[s.pageX],rollingPageY:[s.pageY]};const r=this.newGestureEvent(_.EventType$1.Start,s.target);r.pageX=s.pageX,r.pageY=s.pageY,this.dispatchEvent(r)}this.dispatched&&(e.preventDefault(),e.stopPropagation(),this.dispatched=!1)}onTouchEnd(e,t){const i=Date.now(),n=Object.keys(this.activeTouches).length;for(let s=0,r=t.changedTouches.length;s<r;s++){const a=t.changedTouches.item(s);if(!this.activeTouches.hasOwnProperty(String(a.identifier))){console.warn("move of an UNKNOWN touch",a);continue}const c=this.activeTouches[a.identifier],h=Date.now()-c.initialTimeStamp;if(h<Qt.HOLD_DELAY&&Math.abs(c.initialPageX-c.rollingPageX.at(-1))<30&&Math.abs(c.initialPageY-c.rollingPageY.at(-1))<30){const d=this.newGestureEvent(_.EventType$1.Tap,c.initialTarget);d.pageX=c.rollingPageX.at(-1),d.pageY=c.rollingPageY.at(-1),this.dispatchEvent(d)}else if(h>=Qt.HOLD_DELAY&&Math.abs(c.initialPageX-c.rollingPageX.at(-1))<30&&Math.abs(c.initialPageY-c.rollingPageY.at(-1))<30){const d=this.newGestureEvent(_.EventType$1.Contextmenu,c.initialTarget);d.pageX=c.rollingPageX.at(-1),d.pageY=c.rollingPageY.at(-1),this.dispatchEvent(d)}else if(n===1){const d=c.rollingPageX.at(-1),u=c.rollingPageY.at(-1),f=c.rollingTimestamps.at(-1)-c.rollingTimestamps[0],g=d-c.rollingPageX[0],m=u-c.rollingPageY[0],p=[...this.targets].filter(b=>c.initialTarget instanceof Node&&b.contains(c.initialTarget));this.inertia(e,p,i,Math.abs(g)/f,g>0?1:-1,d,Math.abs(m)/f,m>0?1:-1,u)}this.dispatchEvent(this.newGestureEvent(_.EventType$1.End,c.initialTarget)),delete this.activeTouches[a.identifier]}this.dispatched&&(t.preventDefault(),t.stopPropagation(),this.dispatched=!1)}newGestureEvent(e,t){const i=document.createEvent("CustomEvent");return i.initEvent(e,!1,!0),i.initialTarget=t,i.tapCount=0,i}dispatchEvent(e){if(e.type===_.EventType$1.Tap){const t=new Date().getTime();let i=0;t-this._lastSetTapCountTime>Qt.CLEAR_TAP_COUNT_TIME?i=1:i=2,this._lastSetTapCountTime=t,e.tapCount=i}else(e.type===_.EventType$1.Change||e.type===_.EventType$1.Contextmenu)&&(this._lastSetTapCountTime=0);if(e.initialTarget instanceof Node){for(const i of this.ignoreTargets)if(i.contains(e.initialTarget))return;const t=[];for(const i of this.targets)if(i.contains(e.initialTarget)){let n=0,s=e.initialTarget;for(;s&&s!==i;)n++,s=s.parentElement;t.push([n,i])}t.sort((i,n)=>i[0]-n[0]);for(const[i,n]of t)n.dispatchEvent(e),this.dispatched=!0}}inertia(e,t,i,n,s,r,a,c,h){this.handle=Ti(e,()=>{const d=Date.now(),u=d-i;let f=0,g=0,m=!0;n+=Qt.SCROLL_FRICTION*u,a+=Qt.SCROLL_FRICTION*u,n>0&&(m=!1,f=s*n*u),a>0&&(m=!1,g=c*a*u);const p=this.newGestureEvent(_.EventType$1.Change);p.translationX=f,p.translationY=g,t.forEach(b=>b.dispatchEvent(p)),m||this.inertia(e,t,d,n,s,r+f,a,c,h+g)})}onTouchMove(e){const t=Date.now();for(let i=0,n=e.changedTouches.length;i<n;i++){const s=e.changedTouches.item(i);if(!this.activeTouches.hasOwnProperty(String(s.identifier))){console.warn("end of an UNKNOWN touch",s);continue}const r=this.activeTouches[s.identifier],a=this.newGestureEvent(_.EventType$1.Change,r.initialTarget);a.translationX=s.pageX-r.rollingPageX.at(-1),a.translationY=s.pageY-r.rollingPageY.at(-1),a.pageX=s.pageX,a.pageY=s.pageY,this.dispatchEvent(a),r.rollingPageX.length>3&&(r.rollingPageX.shift(),r.rollingPageY.shift(),r.rollingTimestamps.shift()),r.rollingPageX.push(s.pageX),r.rollingPageY.push(s.pageY),r.rollingTimestamps.push(t)}this.dispatched&&(e.preventDefault(),e.stopPropagation(),this.dispatched=!1)}};Qt.SCROLL_FRICTION=-.005,Qt.HOLD_DELAY=700,Qt.CLEAR_TAP_COUNT_TIME=400;let li=Qt;C3([et],li,"isTouchDevice",null);let Wn=class extends l.Disposable{onclick(e,t){this._register(R(e,F.CLICK,i=>t(new Bi(j(e),i))))}onmousedown(e,t){this._register(R(e,F.MOUSE_DOWN,i=>t(new Bi(j(e),i))))}onmouseover(e,t){this._register(R(e,F.MOUSE_OVER,i=>t(new Bi(j(e),i))))}onmouseleave(e,t){this._register(R(e,F.MOUSE_LEAVE,i=>t(new Bi(j(e),i))))}onkeydown(e,t){this._register(R(e,F.KEY_DOWN,i=>t(new Be(i))))}onkeyup(e,t){this._register(R(e,F.KEY_UP,i=>t(new Be(i))))}oninput(e,t){this._register(R(e,F.INPUT,t))}onblur(e,t){this._register(R(e,F.BLUR,t))}onfocus(e,t){this._register(R(e,F.FOCUS,t))}ignoreGesture(e){return li.ignoreTarget(e)}};const fc=11;class v3 extends Wn{constructor(e){super(),this._onActivate=e.onActivate,this.bgDomNode=document.createElement("div"),this.bgDomNode.className="arrow-background",this.bgDomNode.style.position="absolute",this.bgDomNode.style.width=e.bgWidth+"px",this.bgDomNode.style.height=e.bgHeight+"px",typeof e.top<"u"&&(this.bgDomNode.style.top="0px"),typeof e.left<"u"&&(this.bgDomNode.style.left="0px"),typeof e.bottom<"u"&&(this.bgDomNode.style.bottom="0px"),typeof e.right<"u"&&(this.bgDomNode.style.right="0px"),this.domNode=document.createElement("div"),this.domNode.className=e.className,this.domNode.classList.add(..._.ThemeIcon.asClassNameArray(e.icon)),this.domNode.style.position="absolute",this.domNode.style.width=fc+"px",this.domNode.style.height=fc+"px",typeof e.top<"u"&&(this.domNode.style.top=e.top+"px"),typeof e.left<"u"&&(this.domNode.style.left=e.left+"px"),typeof e.bottom<"u"&&(this.domNode.style.bottom=e.bottom+"px"),typeof e.right<"u"&&(this.domNode.style.right=e.right+"px"),this._pointerMoveMonitor=this._register(new xd),this._register(At(this.bgDomNode,F.POINTER_DOWN,t=>this._arrowPointerDown(t))),this._register(At(this.domNode,F.POINTER_DOWN,t=>this._arrowPointerDown(t))),this._pointerdownRepeatTimer=this._register(new sC),this._pointerdownScheduleRepeatTimer=this._register(new l.TimeoutTimer)}_arrowPointerDown(e){if(!e.target||!(e.target instanceof Element))return;const t=()=>{this._pointerdownRepeatTimer.cancelAndSet(()=>this._onActivate(),1e3/24,j(e))};this._onActivate(),this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancelAndSet(t,200),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,i=>{},()=>{this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancel()}),e.preventDefault()}}class w3 extends l.Disposable{constructor(e,t,i){super(),this._visibility=e,this._visibleClassName=t,this._invisibleClassName=i,this._domNode=null,this._isVisible=!1,this._isNeeded=!1,this._rawShouldBeVisible=!1,this._shouldBeVisible=!1,this._revealTimer=this._register(new l.TimeoutTimer)}setVisibility(e){this._visibility!==e&&(this._visibility=e,this._updateShouldBeVisible())}setShouldBeVisible(e){this._rawShouldBeVisible=e,this._updateShouldBeVisible()}_applyVisibilitySetting(){return this._visibility===2?!1:this._visibility===3?!0:this._rawShouldBeVisible}_updateShouldBeVisible(){const e=this._applyVisibilitySetting();this._shouldBeVisible!==e&&(this._shouldBeVisible=e,this.ensureVisibility())}setIsNeeded(e){this._isNeeded!==e&&(this._isNeeded=e,this.ensureVisibility())}setDomNode(e){this._domNode=e,this._domNode.setClassName(this._invisibleClassName),this.setShouldBeVisible(!1)}ensureVisibility(){if(!this._isNeeded){this._hide(!1);return}this._shouldBeVisible?this._reveal():this._hide(!0)}_reveal(){this._isVisible||(this._isVisible=!0,this._revealTimer.setIfNotSet(()=>{this._domNode?.setClassName(this._visibleClassName)},0))}_hide(e){this._revealTimer.cancel(),this._isVisible&&(this._isVisible=!1,this._domNode?.setClassName(this._invisibleClassName+(e?" fade":"")))}}const S3=140;class cI extends Wn{constructor(e){super(),this._lazyRender=e.lazyRender,this._host=e.host,this._scrollable=e.scrollable,this._scrollByPage=e.scrollByPage,this._scrollbarState=e.scrollbarState,this._visibilityController=this._register(new w3(e.visibility,"visible scrollbar "+e.extraScrollbarClassName,"invisible scrollbar "+e.extraScrollbarClassName)),this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._pointerMoveMonitor=this._register(new xd),this._shouldRender=!0,this.domNode=we(document.createElement("div")),this.domNode.setAttribute("role","presentation"),this.domNode.setAttribute("aria-hidden","true"),this._visibilityController.setDomNode(this.domNode),this.domNode.setPosition("absolute"),this._register(R(this.domNode.domNode,F.POINTER_DOWN,t=>this._domNodePointerDown(t)))}_createArrow(e){const t=this._register(new v3(e));this.domNode.domNode.appendChild(t.bgDomNode),this.domNode.domNode.appendChild(t.domNode)}_createSlider(e,t,i,n){this.slider=we(document.createElement("div")),this.slider.setClassName("slider"),this.slider.setPosition("absolute"),this.slider.setTop(e),this.slider.setLeft(t),typeof i=="number"&&this.slider.setWidth(i),typeof n=="number"&&this.slider.setHeight(n),this.slider.setLayerHinting(!0),this.slider.setContain("strict"),this.domNode.domNode.appendChild(this.slider.domNode),this._register(R(this.slider.domNode,F.POINTER_DOWN,s=>{s.button===0&&(s.preventDefault(),this._sliderPointerDown(s))})),this.onclick(this.slider.domNode,s=>{s.leftButton&&s.stopPropagation()})}_onElementSize(e){return this._scrollbarState.setVisibleSize(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}_onElementScrollSize(e){return this._scrollbarState.setScrollSize(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}_onElementScrollPosition(e){return this._scrollbarState.setScrollPosition(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}beginReveal(){this._visibilityController.setShouldBeVisible(!0)}beginHide(){this._visibilityController.setShouldBeVisible(!1)}render(){this._shouldRender&&(this._shouldRender=!1,this._renderDomNode(this._scrollbarState.getRectangleLargeSize(),this._scrollbarState.getRectangleSmallSize()),this._updateSlider(this._scrollbarState.getSliderSize(),this._scrollbarState.getArrowSize()+this._scrollbarState.getSliderPosition()))}_domNodePointerDown(e){e.target===this.domNode.domNode&&this._onPointerDown(e)}delegatePointerDown(e){const t=this.domNode.domNode.getClientRects()[0].top,i=t+this._scrollbarState.getSliderPosition(),n=t+this._scrollbarState.getSliderPosition()+this._scrollbarState.getSliderSize(),s=this._sliderPointerPosition(e);i<=s&&s<=n?e.button===0&&(e.preventDefault(),this._sliderPointerDown(e)):this._onPointerDown(e)}_onPointerDown(e){let t,i;if(e.target===this.domNode.domNode&&typeof e.offsetX=="number"&&typeof e.offsetY=="number")t=e.offsetX,i=e.offsetY;else{const r=Qi(this.domNode.domNode);t=e.pageX-r.left,i=e.pageY-r.top}const n=e.pointerType==="mouse",s=e.button===0;if(s||!n){const r=this._pointerDownRelativePosition(t,i);this._setDesiredScrollPositionNow(this._scrollByPage?this._scrollbarState.getDesiredScrollPositionFromOffsetPaged(r):this._scrollbarState.getDesiredScrollPositionFromOffset(r))}s&&(e.preventDefault(),this._sliderPointerDown(e))}_sliderPointerDown(e){if(!e.target||!(e.target instanceof Element))return;const t=this._sliderPointerPosition(e),i=this._sliderOrthogonalPointerPosition(e),n=this._scrollbarState.clone();this.slider.toggleClassName("active",!0),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,s=>{const r=this._sliderOrthogonalPointerPosition(s),a=Math.abs(r-i);if(l.isWindows&&a>S3){this._setDesiredScrollPositionNow(n.getScrollPosition());return}const h=this._sliderPointerPosition(s)-t;this._setDesiredScrollPositionNow(n.getDesiredScrollPositionFromDelta(h))},()=>{this.slider.toggleClassName("active",!1),this._host.onDragEnd()}),this._host.onDragStart()}_setDesiredScrollPositionNow(e){const t={};this.writeScrollPosition(t,e),this._scrollable.setScrollPositionNow(t)}updateScrollbarSize(e){this._updateScrollbarSize(e),this._scrollbarState.setScrollbarSize(e),this._shouldRender=!0,this._lazyRender||this.render()}isNeeded(){return this._scrollbarState.isNeeded()}}const y3=20;class gc{constructor(e,t,i,n,s,r){this._scrollbarSize=Math.round(t),this._oppositeScrollbarSize=Math.round(i),this._arrowSize=Math.round(e),this._visibleSize=n,this._scrollSize=s,this._scrollPosition=r,this._computedAvailableSize=0,this._computedIsNeeded=!1,this._computedSliderSize=0,this._computedSliderRatio=0,this._computedSliderPosition=0,this._refreshComputedValues()}clone(){return new gc(this._arrowSize,this._scrollbarSize,this._oppositeScrollbarSize,this._visibleSize,this._scrollSize,this._scrollPosition)}setVisibleSize(e){const t=Math.round(e);return this._visibleSize!==t?(this._visibleSize=t,this._refreshComputedValues(),!0):!1}setScrollSize(e){const t=Math.round(e);return this._scrollSize!==t?(this._scrollSize=t,this._refreshComputedValues(),!0):!1}setScrollPosition(e){const t=Math.round(e);return this._scrollPosition!==t?(this._scrollPosition=t,this._refreshComputedValues(),!0):!1}setScrollbarSize(e){this._scrollbarSize=Math.round(e)}setOppositeScrollbarSize(e){this._oppositeScrollbarSize=Math.round(e)}static _computeValues(e,t,i,n,s){const r=Math.max(0,i-e),a=Math.max(0,r-2*t),c=n>0&&n>i;if(!c)return{computedAvailableSize:Math.round(r),computedIsNeeded:c,computedSliderSize:Math.round(a),computedSliderRatio:0,computedSliderPosition:0};const h=Math.round(Math.max(y3,Math.floor(i*a/n))),d=(a-h)/(n-i),u=s*d;return{computedAvailableSize:Math.round(r),computedIsNeeded:c,computedSliderSize:Math.round(h),computedSliderRatio:d,computedSliderPosition:Math.round(u)}}_refreshComputedValues(){const e=gc._computeValues(this._oppositeScrollbarSize,this._arrowSize,this._visibleSize,this._scrollSize,this._scrollPosition);this._computedAvailableSize=e.computedAvailableSize,this._computedIsNeeded=e.computedIsNeeded,this._computedSliderSize=e.computedSliderSize,this._computedSliderRatio=e.computedSliderRatio,this._computedSliderPosition=e.computedSliderPosition}getArrowSize(){return this._arrowSize}getScrollPosition(){return this._scrollPosition}getRectangleLargeSize(){return this._computedAvailableSize}getRectangleSmallSize(){return this._scrollbarSize}isNeeded(){return this._computedIsNeeded}getSliderSize(){return this._computedSliderSize}getSliderPosition(){return this._computedSliderPosition}getDesiredScrollPositionFromOffset(e){if(!this._computedIsNeeded)return 0;const t=e-this._arrowSize-this._computedSliderSize/2;return Math.round(t/this._computedSliderRatio)}getDesiredScrollPositionFromOffsetPaged(e){if(!this._computedIsNeeded)return 0;const t=e-this._arrowSize;let i=this._scrollPosition;return t<this._computedSliderPosition?i-=this._visibleSize:i+=this._visibleSize,i}getDesiredScrollPositionFromDelta(e){if(!this._computedIsNeeded)return 0;const t=this._computedSliderPosition+e;return Math.round(t/this._computedSliderRatio)}}class L3 extends cI{constructor(e,t,i){const n=e.getScrollDimensions(),s=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:i,scrollbarState:new gc(t.horizontalHasArrows?t.arrowSize:0,t.horizontal===2?0:t.horizontalScrollbarSize,t.vertical===2?0:t.verticalScrollbarSize,n.width,n.scrollWidth,s.scrollLeft),visibility:t.horizontal,extraScrollbarClassName:"horizontal",scrollable:e,scrollByPage:t.scrollByPage}),t.horizontalHasArrows){const r=(t.arrowSize-fc)/2,a=(t.horizontalScrollbarSize-fc)/2;this._createArrow({className:"scra",icon:l.Codicon.scrollbarButtonLeft,top:a,left:r,bottom:void 0,right:void 0,bgWidth:t.arrowSize,bgHeight:t.horizontalScrollbarSize,onActivate:()=>this._host.onMouseWheel(new Kr(null,1,0))}),this._createArrow({className:"scra",icon:l.Codicon.scrollbarButtonRight,top:a,left:void 0,bottom:void 0,right:r,bgWidth:t.arrowSize,bgHeight:t.horizontalScrollbarSize,onActivate:()=>this._host.onMouseWheel(new Kr(null,-1,0))})}this._createSlider(Math.floor((t.horizontalScrollbarSize-t.horizontalSliderSize)/2),0,void 0,t.horizontalSliderSize)}_updateSlider(e,t){this.slider.setWidth(e),this.slider.setLeft(t)}_renderDomNode(e,t){this.domNode.setWidth(e),this.domNode.setHeight(t),this.domNode.setLeft(0),this.domNode.setBottom(0)}onDidScroll(e){return this._shouldRender=this._onElementScrollSize(e.scrollWidth)||this._shouldRender,this._shouldRender=this._onElementScrollPosition(e.scrollLeft)||this._shouldRender,this._shouldRender=this._onElementSize(e.width)||this._shouldRender,this._shouldRender}_pointerDownRelativePosition(e,t){return e}_sliderPointerPosition(e){return e.pageX}_sliderOrthogonalPointerPosition(e){return e.pageY}_updateScrollbarSize(e){this.slider.setHeight(e)}writeScrollPosition(e,t){e.scrollLeft=t}updateOptions(e){this.updateScrollbarSize(e.horizontal===2?0:e.horizontalScrollbarSize),this._scrollbarState.setOppositeScrollbarSize(e.vertical===2?0:e.verticalScrollbarSize),this._visibilityController.setVisibility(e.horizontal),this._scrollByPage=e.scrollByPage}}class D3 extends cI{constructor(e,t,i){const n=e.getScrollDimensions(),s=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:i,scrollbarState:new gc(t.verticalHasArrows?t.arrowSize:0,t.vertical===2?0:t.verticalScrollbarSize,0,n.height,n.scrollHeight,s.scrollTop),visibility:t.vertical,extraScrollbarClassName:"vertical",scrollable:e,scrollByPage:t.scrollByPage}),t.verticalHasArrows){const r=(t.arrowSize-fc)/2,a=(t.verticalScrollbarSize-fc)/2;this._createArrow({className:"scra",icon:l.Codicon.scrollbarButtonUp,top:r,left:a,bottom:void 0,right:void 0,bgWidth:t.verticalScrollbarSize,bgHeight:t.arrowSize,onActivate:()=>this._host.onMouseWheel(new Kr(null,0,1))}),this._createArrow({className:"scra",icon:l.Codicon.scrollbarButtonDown,top:void 0,left:a,bottom:r,right:void 0,bgWidth:t.verticalScrollbarSize,bgHeight:t.arrowSize,onActivate:()=>this._host.onMouseWheel(new Kr(null,0,-1))})}this._createSlider(0,Math.floor((t.verticalScrollbarSize-t.verticalSliderSize)/2),t.verticalSliderSize,void 0)}_updateSlider(e,t){this.slider.setHeight(e),this.slider.setTop(t)}_renderDomNode(e,t){this.domNode.setWidth(t),this.domNode.setHeight(e),this.domNode.setRight(0),this.domNode.setTop(0)}onDidScroll(e){return this._shouldRender=this._onElementScrollSize(e.scrollHeight)||this._shouldRender,this._shouldRender=this._onElementScrollPosition(e.scrollTop)||this._shouldRender,this._shouldRender=this._onElementSize(e.height)||this._shouldRender,this._shouldRender}_pointerDownRelativePosition(e,t){return t}_sliderPointerPosition(e){return e.pageY}_sliderOrthogonalPointerPosition(e){return e.pageX}_updateScrollbarSize(e){this.slider.setWidth(e)}writeScrollPosition(e,t){e.scrollTop=t}updateOptions(e){this.updateScrollbarSize(e.vertical===2?0:e.verticalScrollbarSize),this._scrollbarState.setOppositeScrollbarSize(0),this._visibilityController.setVisibility(e.vertical),this._scrollByPage=e.scrollByPage}}class Zg{constructor(e,t,i,n,s,r,a){this._forceIntegerValues=e,this._scrollStateBrand=void 0,this._forceIntegerValues&&(t=t|0,i=i|0,n=n|0,s=s|0,r=r|0,a=a|0),this.rawScrollLeft=n,this.rawScrollTop=a,t<0&&(t=0),n+t>i&&(n=i-t),n<0&&(n=0),s<0&&(s=0),a+s>r&&(a=r-s),a<0&&(a=0),this.width=t,this.scrollWidth=i,this.scrollLeft=n,this.height=s,this.scrollHeight=r,this.scrollTop=a}equals(e){return this.rawScrollLeft===e.rawScrollLeft&&this.rawScrollTop===e.rawScrollTop&&this.width===e.width&&this.scrollWidth===e.scrollWidth&&this.scrollLeft===e.scrollLeft&&this.height===e.height&&this.scrollHeight===e.scrollHeight&&this.scrollTop===e.scrollTop}withScrollDimensions(e,t){return new Zg(this._forceIntegerValues,typeof e.width<"u"?e.width:this.width,typeof e.scrollWidth<"u"?e.scrollWidth:this.scrollWidth,t?this.rawScrollLeft:this.scrollLeft,typeof e.height<"u"?e.height:this.height,typeof e.scrollHeight<"u"?e.scrollHeight:this.scrollHeight,t?this.rawScrollTop:this.scrollTop)}withScrollPosition(e){return new Zg(this._forceIntegerValues,this.width,this.scrollWidth,typeof e.scrollLeft<"u"?e.scrollLeft:this.rawScrollLeft,this.height,this.scrollHeight,typeof e.scrollTop<"u"?e.scrollTop:this.rawScrollTop)}createScrollEvent(e,t){const i=this.width!==e.width,n=this.scrollWidth!==e.scrollWidth,s=this.scrollLeft!==e.scrollLeft,r=this.height!==e.height,a=this.scrollHeight!==e.scrollHeight,c=this.scrollTop!==e.scrollTop;return{inSmoothScrolling:t,oldWidth:e.width,oldScrollWidth:e.scrollWidth,oldScrollLeft:e.scrollLeft,width:this.width,scrollWidth:this.scrollWidth,scrollLeft:this.scrollLeft,oldHeight:e.height,oldScrollHeight:e.scrollHeight,oldScrollTop:e.scrollTop,height:this.height,scrollHeight:this.scrollHeight,scrollTop:this.scrollTop,widthChanged:i,scrollWidthChanged:n,scrollLeftChanged:s,heightChanged:r,scrollHeightChanged:a,scrollTopChanged:c}}}class mc extends l.Disposable{constructor(e){super(),this._scrollableBrand=void 0,this._onScroll=this._register(new l.Emitter),this.onScroll=this._onScroll.event,this._smoothScrollDuration=e.smoothScrollDuration,this._scheduleAtNextAnimationFrame=e.scheduleAtNextAnimationFrame,this._state=new Zg(e.forceIntegerValues,0,0,0,0,0,0),this._smoothScrolling=null}dispose(){this._smoothScrolling&&(this._smoothScrolling.dispose(),this._smoothScrolling=null),super.dispose()}setSmoothScrollDuration(e){this._smoothScrollDuration=e}validateScrollPosition(e){return this._state.withScrollPosition(e)}getScrollDimensions(){return this._state}setScrollDimensions(e,t){const i=this._state.withScrollDimensions(e,t);this._setState(i,!!this._smoothScrolling),this._smoothScrolling?.acceptScrollDimensions(this._state)}getFutureScrollPosition(){return this._smoothScrolling?this._smoothScrolling.to:this._state}getCurrentScrollPosition(){return this._state}setScrollPositionNow(e){const t=this._state.withScrollPosition(e);this._smoothScrolling&&(this._smoothScrolling.dispose(),this._smoothScrolling=null),this._setState(t,!1)}setScrollPositionSmooth(e,t){if(this._smoothScrollDuration===0)return this.setScrollPositionNow(e);if(this._smoothScrolling){e={scrollLeft:typeof e.scrollLeft>"u"?this._smoothScrolling.to.scrollLeft:e.scrollLeft,scrollTop:typeof e.scrollTop>"u"?this._smoothScrolling.to.scrollTop:e.scrollTop};const i=this._state.withScrollPosition(e);if(this._smoothScrolling.to.scrollLeft===i.scrollLeft&&this._smoothScrolling.to.scrollTop===i.scrollTop)return;let n;t?n=new Fd(this._smoothScrolling.from,i,this._smoothScrolling.startTime,this._smoothScrolling.duration):n=this._smoothScrolling.combine(this._state,i,this._smoothScrollDuration),this._smoothScrolling.dispose(),this._smoothScrolling=n}else{const i=this._state.withScrollPosition(e);this._smoothScrolling=Fd.start(this._state,i,this._smoothScrollDuration)}this._smoothScrolling.animationFrameDisposable=this._scheduleAtNextAnimationFrame(()=>{this._smoothScrolling&&(this._smoothScrolling.animationFrameDisposable=null,this._performSmoothScrolling())})}hasPendingScrollAnimation(){return!!this._smoothScrolling}_performSmoothScrolling(){if(!this._smoothScrolling)return;const e=this._smoothScrolling.tick(),t=this._state.withScrollPosition(e);if(this._setState(t,!0),!!this._smoothScrolling){if(e.isDone){this._smoothScrolling.dispose(),this._smoothScrolling=null;return}this._smoothScrolling.animationFrameDisposable=this._scheduleAtNextAnimationFrame(()=>{this._smoothScrolling&&(this._smoothScrolling.animationFrameDisposable=null,this._performSmoothScrolling())})}}_setState(e,t){const i=this._state;i.equals(e)||(this._state=e,this._onScroll.fire(this._state.createScrollEvent(i,t)))}}class hI{constructor(e,t,i){this.scrollLeft=e,this.scrollTop=t,this.isDone=i}}function bv(o,e){const t=e-o;return function(i){return o+t*I3(i)}}function x3(o,e,t){return function(i){return i<t?o(i/t):e((i-t)/(1-t))}}class Fd{constructor(e,t,i,n){this.from=e,this.to=t,this.duration=n,this.startTime=i,this.animationFrameDisposable=null,this._initAnimations()}_initAnimations(){this.scrollLeft=this._initAnimation(this.from.scrollLeft,this.to.scrollLeft,this.to.width),this.scrollTop=this._initAnimation(this.from.scrollTop,this.to.scrollTop,this.to.height)}_initAnimation(e,t,i){if(Math.abs(e-t)>2.5*i){let s,r;return e<t?(s=e+.75*i,r=t-.75*i):(s=e-.75*i,r=t+.75*i),x3(bv(e,s),bv(r,t),.33)}return bv(e,t)}dispose(){this.animationFrameDisposable!==null&&(this.animationFrameDisposable.dispose(),this.animationFrameDisposable=null)}acceptScrollDimensions(e){this.to=e.withScrollPosition(this.to),this._initAnimations()}tick(){return this._tick(Date.now())}_tick(e){const t=(e-this.startTime)/this.duration;if(t<1){const i=this.scrollLeft(t),n=this.scrollTop(t);return new hI(i,n,!1)}return new hI(this.to.scrollLeft,this.to.scrollTop,!0)}combine(e,t,i){return Fd.start(e,t,i)}static start(e,t,i){i=i+10;const n=Date.now()-10;return new Fd(e,t,n,i)}}function E3(o){return Math.pow(o,3)}function I3(o){return 1-E3(1-o)}const T3=500,dI=50;class N3{constructor(e,t,i){this.timestamp=e,this.deltaX=t,this.deltaY=i,this.score=0}}const J_=class J_{constructor(){this._capacity=5,this._memory=[],this._front=-1,this._rear=-1}isPhysicalMouseWheel(){if(this._front===-1&&this._rear===-1)return!1;let e=1,t=0,i=1,n=this._rear;do{const s=n===this._front?e:Math.pow(2,-i);if(e-=s,t+=this._memory[n].score*s,n===this._front)break;n=(this._capacity+n-1)%this._capacity,i++}while(!0);return t<=.5}acceptStandardWheelEvent(e){if(jh){const t=j(e.browserEvent),i=Kb(t);this.accept(Date.now(),e.deltaX*i,e.deltaY*i)}else this.accept(Date.now(),e.deltaX,e.deltaY)}accept(e,t,i){let n=null;const s=new N3(e,t,i);this._front===-1&&this._rear===-1?(this._memory[0]=s,this._front=0,this._rear=0):(n=this._memory[this._rear],this._rear=(this._rear+1)%this._capacity,this._rear===this._front&&(this._front=(this._front+1)%this._capacity),this._memory[this._rear]=s),s.score=this._computeScore(s,n)}_computeScore(e,t){if(Math.abs(e.deltaX)>0&&Math.abs(e.deltaY)>0)return 1;let i=.5;if((!this._isAlmostInt(e.deltaX)||!this._isAlmostInt(e.deltaY))&&(i+=.25),t){const n=Math.abs(e.deltaX),s=Math.abs(e.deltaY),r=Math.abs(t.deltaX),a=Math.abs(t.deltaY),c=Math.max(Math.min(n,r),1),h=Math.max(Math.min(s,a),1),d=Math.max(n,r),u=Math.max(s,a);d%c===0&&u%h===0&&(i-=.5)}return Math.min(Math.max(i,0),1)}_isAlmostInt(e){const t=Number.EPSILON*100;return Math.abs(Math.round(e)-e)<.01+t}};J_.INSTANCE=new J_;let Qg=J_;class Cv extends Wn{get onScroll(){return this._onScroll.event}get options(){return this._options}constructor(e,t,i){super(),this._inertialTimeout=null,this._inertialSpeed={X:0,Y:0},this._onScroll=this._register(new l.Emitter),this._onWillScroll=this._register(new l.Emitter),e.style.overflow="hidden",this._options=R3(t),this._scrollable=i,this._register(this._scrollable.onScroll(s=>{this._onWillScroll.fire(s),this._onDidScroll(s),this._onScroll.fire(s)}));const n={onMouseWheel:s=>this._onMouseWheel(s),onDragStart:()=>this._onDragStart(),onDragEnd:()=>this._onDragEnd()};this._verticalScrollbar=this._register(new D3(this._scrollable,this._options,n)),this._horizontalScrollbar=this._register(new L3(this._scrollable,this._options,n)),this._domNode=document.createElement("div"),this._domNode.className="monaco-scrollable-element "+this._options.className,this._domNode.setAttribute("role","presentation"),this._domNode.style.position="relative",this._domNode.style.overflow="hidden",this._domNode.appendChild(e),this._domNode.appendChild(this._horizontalScrollbar.domNode.domNode),this._domNode.appendChild(this._verticalScrollbar.domNode.domNode),this._options.useShadows?(this._leftShadowDomNode=we(document.createElement("div")),this._leftShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._leftShadowDomNode.domNode),this._topShadowDomNode=we(document.createElement("div")),this._topShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._topShadowDomNode.domNode),this._topLeftShadowDomNode=we(document.createElement("div")),this._topLeftShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._topLeftShadowDomNode.domNode)):(this._leftShadowDomNode=null,this._topShadowDomNode=null,this._topLeftShadowDomNode=null),this._listenOnDomNode=this._options.listenOnDomNode||this._domNode,this._mouseWheelToDispose=[],this._setListeningToMouseWheel(this._options.handleMouseWheel),this.onmouseover(this._listenOnDomNode,s=>this._onMouseOver(s)),this.onmouseleave(this._listenOnDomNode,s=>this._onMouseLeave(s)),this._hideTimeout=this._register(new l.TimeoutTimer),this._isDragging=!1,this._mouseIsOver=!1,this._shouldRender=!0,this._revealOnScroll=!0}dispose(){this._mouseWheelToDispose=l.dispose(this._mouseWheelToDispose),this._inertialTimeout&&(this._inertialTimeout.dispose(),this._inertialTimeout=null),super.dispose()}getDomNode(){return this._domNode}getOverviewRulerLayoutInfo(){return{parent:this._domNode,insertBefore:this._verticalScrollbar.domNode.domNode}}delegateVerticalScrollbarPointerDown(e){this._verticalScrollbar.delegatePointerDown(e)}getScrollDimensions(){return this._scrollable.getScrollDimensions()}setScrollDimensions(e){this._scrollable.setScrollDimensions(e,!1)}updateClassName(e){this._options.className=e,l.isMacintosh&&(this._options.className+=" mac"),this._domNode.className="monaco-scrollable-element "+this._options.className}updateOptions(e){typeof e.handleMouseWheel<"u"&&(this._options.handleMouseWheel=e.handleMouseWheel,this._setListeningToMouseWheel(this._options.handleMouseWheel)),typeof e.mouseWheelScrollSensitivity<"u"&&(this._options.mouseWheelScrollSensitivity=e.mouseWheelScrollSensitivity),typeof e.fastScrollSensitivity<"u"&&(this._options.fastScrollSensitivity=e.fastScrollSensitivity),typeof e.scrollPredominantAxis<"u"&&(this._options.scrollPredominantAxis=e.scrollPredominantAxis),typeof e.horizontal<"u"&&(this._options.horizontal=e.horizontal),typeof e.vertical<"u"&&(this._options.vertical=e.vertical),typeof e.horizontalScrollbarSize<"u"&&(this._options.horizontalScrollbarSize=e.horizontalScrollbarSize),typeof e.verticalScrollbarSize<"u"&&(this._options.verticalScrollbarSize=e.verticalScrollbarSize),typeof e.scrollByPage<"u"&&(this._options.scrollByPage=e.scrollByPage),this._horizontalScrollbar.updateOptions(this._options),this._verticalScrollbar.updateOptions(this._options),this._options.lazyRender||this._render()}delegateScrollFromMouseWheelEvent(e){this._onMouseWheel(new Kr(e))}async _periodicSync(){let e=!1;(this._inertialSpeed.X!==0||this._inertialSpeed.Y!==0)&&(this._scrollable.setScrollPositionNow({scrollTop:this._scrollable.getCurrentScrollPosition().scrollTop-this._inertialSpeed.Y*100,scrollLeft:this._scrollable.getCurrentScrollPosition().scrollLeft-this._inertialSpeed.X*100}),this._inertialSpeed.X*=.9,this._inertialSpeed.Y*=.9,Math.abs(this._inertialSpeed.X)<.01&&(this._inertialSpeed.X=0),Math.abs(this._inertialSpeed.Y)<.01&&(this._inertialSpeed.Y=0),e=this._inertialSpeed.X!==0||this._inertialSpeed.Y!==0),e?(this._inertialTimeout||(this._inertialTimeout=new l.TimeoutTimer),this._inertialTimeout.cancelAndSet(()=>this._periodicSync(),1e3/60)):(this._inertialTimeout?.dispose(),this._inertialTimeout=null)}_setListeningToMouseWheel(e){if(this._mouseWheelToDispose.length>0!==e&&(this._mouseWheelToDispose=l.dispose(this._mouseWheelToDispose),e)){const i=n=>{this._onMouseWheel(new Kr(n))};this._mouseWheelToDispose.push(R(this._listenOnDomNode,F.MOUSE_WHEEL,i,{passive:!1}))}}_onMouseWheel(e){if(e.browserEvent?.defaultPrevented)return;const t=Qg.INSTANCE;t.acceptStandardWheelEvent(e);let i=!1;if(e.deltaY||e.deltaX){let s=e.deltaY*this._options.mouseWheelScrollSensitivity,r=e.deltaX*this._options.mouseWheelScrollSensitivity;this._options.scrollPredominantAxis&&(this._options.scrollYToX&&r+s===0?r=s=0:Math.abs(s)>=Math.abs(r)?r=0:s=0),this._options.flipAxes&&([s,r]=[r,s]);const a=!l.isMacintosh&&e.browserEvent&&e.browserEvent.shiftKey;(this._options.scrollYToX||a)&&!r&&(r=s,s=0),e.browserEvent&&e.browserEvent.altKey&&(r=r*this._options.fastScrollSensitivity,s=s*this._options.fastScrollSensitivity);const c=this._scrollable.getFutureScrollPosition();let h={};if(s){const d=dI*s,u=c.scrollTop-(d<0?Math.floor(d):Math.ceil(d));this._verticalScrollbar.writeScrollPosition(h,u)}if(r){const d=dI*r,u=c.scrollLeft-(d<0?Math.floor(d):Math.ceil(d));this._horizontalScrollbar.writeScrollPosition(h,u)}if(h=this._scrollable.validateScrollPosition(h),this._options.inertialScroll&&(r||s)&&!t.isPhysicalMouseWheel()){let d=!1;this._inertialSpeed.X===0&&this._inertialSpeed.Y===0&&(d=!0),this._inertialSpeed.Y=(s<0?-1:1)*Math.abs(s)**1.02,this._inertialSpeed.X=(r<0?-1:1)*Math.abs(r)**1.02,d&&this._periodicSync()}(c.scrollLeft!==h.scrollLeft||c.scrollTop!==h.scrollTop)&&(this._options.mouseWheelSmoothScroll&&t.isPhysicalMouseWheel()?this._scrollable.setScrollPositionSmooth(h):this._scrollable.setScrollPositionNow(h),i=!0)}let n=i;!n&&this._options.alwaysConsumeMouseWheel&&(n=!0),!n&&this._options.consumeMouseWheelIfScrollbarIsNeeded&&(this._verticalScrollbar.isNeeded()||this._horizontalScrollbar.isNeeded())&&(n=!0),n&&(e.preventDefault(),e.stopPropagation())}_onDidScroll(e){this._shouldRender=this._horizontalScrollbar.onDidScroll(e)||this._shouldRender,this._shouldRender=this._verticalScrollbar.onDidScroll(e)||this._shouldRender,this._options.useShadows&&(this._shouldRender=!0),this._revealOnScroll&&this._reveal(),this._options.lazyRender||this._render()}renderNow(){if(!this._options.lazyRender)throw new Error("Please use `lazyRender` together with `renderNow`!");this._render()}_render(){if(this._shouldRender&&(this._shouldRender=!1,this._horizontalScrollbar.render(),this._verticalScrollbar.render(),this._options.useShadows)){const e=this._scrollable.getCurrentScrollPosition(),t=e.scrollTop>0,i=e.scrollLeft>0,n=i?" left":"",s=t?" top":"",r=i||t?" top-left-corner":"";this._leftShadowDomNode.setClassName(`shadow${n}`),this._topShadowDomNode.setClassName(`shadow${s}`),this._topLeftShadowDomNode.setClassName(`shadow${r}${s}${n}`)}}_onDragStart(){this._isDragging=!0,this._reveal()}_onDragEnd(){this._isDragging=!1,this._hide()}_onMouseLeave(e){this._mouseIsOver=!1,this._hide()}_onMouseOver(e){this._mouseIsOver=!0,this._reveal()}_reveal(){this._verticalScrollbar.beginReveal(),this._horizontalScrollbar.beginReveal(),this._scheduleHide()}_hide(){!this._mouseIsOver&&!this._isDragging&&(this._verticalScrollbar.beginHide(),this._horizontalScrollbar.beginHide())}_scheduleHide(){!this._mouseIsOver&&!this._isDragging&&this._hideTimeout.cancelAndSet(()=>this._hide(),T3)}}class uI extends Cv{constructor(e,t){t=t||{},t.mouseWheelSmoothScroll=!1;const i=new mc({forceIntegerValues:!0,smoothScrollDuration:0,scheduleAtNextAnimationFrame:n=>Ti(j(e),n)});super(e,t,i),this._register(i)}setScrollPosition(e){this._scrollable.setScrollPositionNow(e)}}class Xg extends Cv{constructor(e,t,i){super(e,t,i)}setScrollPosition(e){e.reuseAnimation?this._scrollable.setScrollPositionSmooth(e,e.reuseAnimation):this._scrollable.setScrollPositionNow(e)}getScrollPosition(){return this._scrollable.getCurrentScrollPosition()}}class Jg extends Cv{constructor(e,t){t=t||{},t.mouseWheelSmoothScroll=!1;const i=new mc({forceIntegerValues:!1,smoothScrollDuration:0,scheduleAtNextAnimationFrame:n=>Ti(j(e),n)});super(e,t,i),this._register(i),this._element=e,this._register(this.onScroll(n=>{n.scrollTopChanged&&(this._element.scrollTop=n.scrollTop),n.scrollLeftChanged&&(this._element.scrollLeft=n.scrollLeft)})),this.scanDomNode()}setScrollPosition(e){this._scrollable.setScrollPositionNow(e)}getScrollPosition(){return this._scrollable.getCurrentScrollPosition()}scanDomNode(){this.setScrollDimensions({width:this._element.clientWidth,scrollWidth:this._element.scrollWidth,height:this._element.clientHeight,scrollHeight:this._element.scrollHeight}),this.setScrollPosition({scrollLeft:this._element.scrollLeft,scrollTop:this._element.scrollTop})}}function R3(o){const e={lazyRender:typeof o.lazyRender<"u"?o.lazyRender:!1,className:typeof o.className<"u"?o.className:"",useShadows:typeof o.useShadows<"u"?o.useShadows:!0,handleMouseWheel:typeof o.handleMouseWheel<"u"?o.handleMouseWheel:!0,flipAxes:typeof o.flipAxes<"u"?o.flipAxes:!1,consumeMouseWheelIfScrollbarIsNeeded:typeof o.consumeMouseWheelIfScrollbarIsNeeded<"u"?o.consumeMouseWheelIfScrollbarIsNeeded:!1,alwaysConsumeMouseWheel:typeof o.alwaysConsumeMouseWheel<"u"?o.alwaysConsumeMouseWheel:!1,scrollYToX:typeof o.scrollYToX<"u"?o.scrollYToX:!1,mouseWheelScrollSensitivity:typeof o.mouseWheelScrollSensitivity<"u"?o.mouseWheelScrollSensitivity:1,fastScrollSensitivity:typeof o.fastScrollSensitivity<"u"?o.fastScrollSensitivity:5,scrollPredominantAxis:typeof o.scrollPredominantAxis<"u"?o.scrollPredominantAxis:!0,mouseWheelSmoothScroll:typeof o.mouseWheelSmoothScroll<"u"?o.mouseWheelSmoothScroll:!0,inertialScroll:typeof o.inertialScroll<"u"?o.inertialScroll:!1,arrowSize:typeof o.arrowSize<"u"?o.arrowSize:11,listenOnDomNode:typeof o.listenOnDomNode<"u"?o.listenOnDomNode:null,horizontal:typeof o.horizontal<"u"?o.horizontal:1,horizontalScrollbarSize:typeof o.horizontalScrollbarSize<"u"?o.horizontalScrollbarSize:10,horizontalSliderSize:typeof o.horizontalSliderSize<"u"?o.horizontalSliderSize:0,horizontalHasArrows:typeof o.horizontalHasArrows<"u"?o.horizontalHasArrows:!1,vertical:typeof o.vertical<"u"?o.vertical:1,verticalScrollbarSize:typeof o.verticalScrollbarSize<"u"?o.verticalScrollbarSize:10,verticalHasArrows:typeof o.verticalHasArrows<"u"?o.verticalHasArrows:!1,verticalSliderSize:typeof o.verticalSliderSize<"u"?o.verticalSliderSize:0,scrollByPage:typeof o.scrollByPage<"u"?o.scrollByPage:!1};return e.horizontalSliderSize=typeof o.horizontalSliderSize<"u"?o.horizontalSliderSize:e.horizontalScrollbarSize,e.verticalSliderSize=typeof o.verticalSliderSize<"u"?o.verticalSliderSize:e.verticalScrollbarSize,l.isMacintosh&&(e.className+=" mac"),e}class fI extends l.Disposable{constructor(e,t,i,n){super(),this._context=e,this._viewHelper=t,this._mouseTargetFactory=i,this._dispatchMouse=n,this._operation=null}dispose(){super.dispose(),this.stop()}start(e,t){this._operation?this._operation.setPosition(e,t):this._operation=this._createDragScrollingOperation(e,t)}stop(){this._operation&&(this._operation.dispose(),this._operation=null)}}class gI extends l.Disposable{constructor(e,t,i,n,s,r){super(),this._context=e,this._viewHelper=t,this._mouseTargetFactory=i,this._dispatchMouse=n,this._position=s,this._mouseEvent=r,this._lastTime=Date.now(),this._animationFrameDisposable=Ti(j(r.browserEvent),()=>this._execute())}dispose(){this._animationFrameDisposable.dispose(),super.dispose()}setPosition(e,t){this._position=e,this._mouseEvent=t}_tick(){const e=Date.now(),t=e-this._lastTime;return this._lastTime=e,t}}class M3 extends fI{_createDragScrollingOperation(e,t){return new A3(this._context,this._viewHelper,this._mouseTargetFactory,this._dispatchMouse,e,t)}}class A3 extends gI{_getScrollSpeed(){const e=this._context.configuration.options.get(75),t=this._context.configuration.options.get(165).height/e,i=this._position.outsideDistance/e;return i<=1.5?Math.max(30,t*(1+i)):i<=3?Math.max(60,t*(2+i)):Math.max(200,t*(7+i))}_execute(){const e=this._context.configuration.options.get(75),t=this._getScrollSpeed(),i=this._tick(),n=t*(i/1e3)*e,s=this._position.outsidePosition==="above"?-n:n;this._context.viewModel.viewLayout.deltaScrollNow(0,s),this._viewHelper.renderNow();const r=this._context.viewLayout.getLinesViewportData(),a=this._position.outsidePosition==="above"?r.startLineNumber:r.endLineNumber,c=this._position.outsidePosition==="above"?r.startLineNumber===1:r.endLineNumber===this._context.viewModel.getLineCount();let h;{const d=Gg(this._viewHelper.viewDomNode),u=this._context.configuration.options.get(165).horizontalScrollbarHeight,f=new Od(this._mouseEvent.pos.x,d.y+d.height-u-.1),g=jg(this._viewHelper.viewDomNode,d,f);h=this._mouseTargetFactory.createMouseTarget(this._viewHelper.getLastRenderData(),d,f,g,null)}(!h.position||h.position.lineNumber!==a||c)&&(this._position.outsidePosition==="above"?h=$t.createOutsideEditor(this._position.mouseColumn,new l.Position(a,1),"above",this._position.outsideDistance):h=$t.createOutsideEditor(this._position.mouseColumn,new l.Position(a,this._context.viewModel.getLineMaxColumn(a)),"below",this._position.outsideDistance)),this._dispatchMouse(h,!0,2),this._animationFrameDisposable=Ti(j(h.element),()=>this._execute())}}class O3 extends fI{_createDragScrollingOperation(e,t){return new P3(this._context,this._viewHelper,this._mouseTargetFactory,this._dispatchMouse,e,t)}}class P3 extends gI{_getScrollSpeed(){const e=this._context.configuration.options.get(59).typicalFullwidthCharacterWidth,t=this._context.configuration.options.get(165).contentWidth/e,i=this._position.outsideDistance/e;return i<=1.5?Math.max(30,t*(1+i)):i<=3?Math.max(60,t*(2+i)):Math.max(200,t*(7+i))}_execute(){const e=this._context.configuration.options.get(59).typicalFullwidthCharacterWidth,t=this._getScrollSpeed(),i=this._tick(),n=t*(i/1e3)*e*.5,s=this._position.outsidePosition==="left"?-n:n;if(this._context.viewModel.viewLayout.deltaScrollNow(s,0),this._viewHelper.renderNow(),!this._position.position)return;const r=this._position.position.lineNumber;let a;{const c=Gg(this._viewHelper.viewDomNode),h=this._context.configuration.options.get(165).horizontalScrollbarHeight,d=new Od(this._mouseEvent.pos.x,c.y+c.height-h-.1),u=jg(this._viewHelper.viewDomNode,c,d);a=this._mouseTargetFactory.createMouseTarget(this._viewHelper.getLastRenderData(),c,d,u,null)}this._position.outsidePosition==="left"?a=$t.createOutsideEditor(a.mouseColumn,new l.Position(r,a.mouseColumn),"left",this._position.outsideDistance):a=$t.createOutsideEditor(a.mouseColumn,new l.Position(r,a.mouseColumn),"right",this._position.outsideDistance),this._dispatchMouse(a,!0,2),this._animationFrameDisposable=Ti(j(a.element),()=>this._execute())}}class vv extends ma{constructor(e,t,i){super(),this._mouseLeaveMonitor=null,this._context=e,this.viewController=t,this.viewHelper=i,this.mouseTargetFactory=new ai(this._context,i),this._mouseDownOperation=this._register(new k3(this._context,this.viewController,this.viewHelper,this.mouseTargetFactory,(r,a)=>this._createMouseTarget(r,a),r=>this._getMouseColumn(r))),this.lastMouseLeaveTime=-1,this._height=this._context.configuration.options.get(165).height;const n=new s3(this.viewHelper.viewDomNode);this._register(n.onContextMenu(this.viewHelper.viewDomNode,r=>this._onContextMenu(r,!0))),this._register(n.onMouseMove(this.viewHelper.viewDomNode,r=>{this._onMouseMove(r),this._mouseLeaveMonitor||(this._mouseLeaveMonitor=R(this.viewHelper.viewDomNode.ownerDocument,"mousemove",a=>{this.viewHelper.viewDomNode.contains(a.target)||this._onMouseLeave(new uo(a,!1,this.viewHelper.viewDomNode))}))})),this._register(n.onMouseUp(this.viewHelper.viewDomNode,r=>this._onMouseUp(r))),this._register(n.onMouseLeave(this.viewHelper.viewDomNode,r=>this._onMouseLeave(r)));let s=0;this._register(n.onPointerDown(this.viewHelper.viewDomNode,(r,a)=>{s=a})),this._register(R(this.viewHelper.viewDomNode,F.POINTER_UP,r=>{this._mouseDownOperation.onPointerUp()})),this._register(n.onMouseDown(this.viewHelper.viewDomNode,r=>this._onMouseDown(r,s))),this._setupMouseWheelZoomListener(),this._context.addEventHandler(this)}_setupMouseWheelZoomListener(){const e=Qg.INSTANCE;let t=0,i=eo.getZoomLevel(),n=!1,s=0;const r=c=>{if(this.viewController.emitMouseWheel(c),!this._context.configuration.options.get(84))return;const h=new Kr(c);if(e.acceptStandardWheelEvent(h),e.isPhysicalMouseWheel()){if(a(c)){const d=eo.getZoomLevel(),u=h.deltaY>0?1:-1;eo.setZoomLevel(d+u),h.preventDefault(),h.stopPropagation()}}else Date.now()-t>50&&(i=eo.getZoomLevel(),n=a(c),s=0),t=Date.now(),s+=h.deltaY,n&&(eo.setZoomLevel(i+s/5),h.preventDefault(),h.stopPropagation())};this._register(R(this.viewHelper.viewDomNode,F.MOUSE_WHEEL,r,{capture:!0,passive:!1}));function a(c){return l.isMacintosh?(c.metaKey||c.ctrlKey)&&!c.shiftKey&&!c.altKey:c.ctrlKey&&!c.metaKey&&!c.shiftKey&&!c.altKey}}dispose(){this._context.removeEventHandler(this),this._mouseLeaveMonitor&&(this._mouseLeaveMonitor.dispose(),this._mouseLeaveMonitor=null),super.dispose()}onConfigurationChanged(e){if(e.hasChanged(165)){const t=this._context.configuration.options.get(165).height;this._height!==t&&(this._height=t,this._mouseDownOperation.onHeightChanged())}return!1}onCursorStateChanged(e){return this._mouseDownOperation.onCursorStateChanged(e),!1}onFocusChanged(e){return!1}getTargetAtClientPoint(e,t){const n=new iI(e,t).toPageCoordinates(j(this.viewHelper.viewDomNode)),s=Gg(this.viewHelper.viewDomNode);if(n.y<s.y||n.y>s.y+s.height||n.x<s.x||n.x>s.x+s.width)return null;const r=jg(this.viewHelper.viewDomNode,s,n);return this.mouseTargetFactory.createMouseTarget(this.viewHelper.getLastRenderData(),s,n,r,null)}_createMouseTarget(e,t){let i=e.target;if(!this.viewHelper.viewDomNode.contains(i)){const n=qo(this.viewHelper.viewDomNode);n&&(i=n.elementsFromPoint(e.posx,e.posy).find(r=>this.viewHelper.viewDomNode.contains(r))??null)}return this.mouseTargetFactory.createMouseTarget(this.viewHelper.getLastRenderData(),e.editorPos,e.pos,e.relativePos,t?i:null)}_getMouseColumn(e){return this.mouseTargetFactory.getMouseColumn(e.relativePos)}_onContextMenu(e,t){this.viewController.emitContextMenu({event:e,target:this._createMouseTarget(e,t)})}_onMouseMove(e){this.mouseTargetFactory.mouseTargetIsWidget(e)||e.preventDefault(),!(this._mouseDownOperation.isActive()||e.timestamp<this.lastMouseLeaveTime)&&this.viewController.emitMouseMove({event:e,target:this._createMouseTarget(e,!0)})}_onMouseLeave(e){this._mouseLeaveMonitor&&(this._mouseLeaveMonitor.dispose(),this._mouseLeaveMonitor=null),this.lastMouseLeaveTime=new Date().getTime(),this.viewController.emitMouseLeave({event:e,target:null})}_onMouseUp(e){this.viewController.emitMouseUp({event:e,target:this._createMouseTarget(e,!0)})}_onMouseDown(e,t){const i=this._createMouseTarget(e,!0),n=i.type===6||i.type===7,s=i.type===2||i.type===3||i.type===4,r=i.type===3,a=this._context.configuration.options.get(125),c=i.type===8||i.type===5,h=i.type===9;let d=e.leftButton||e.middleButton;l.isMacintosh&&e.leftButton&&e.ctrlKey&&(d=!1);const u=()=>{e.preventDefault(),this.viewHelper.focusTextArea()};if(d&&(n||r&&a))u(),this._mouseDownOperation.start(i.type,e,t);else if(s)e.preventDefault();else if(c){const f=i.detail;d&&this.viewHelper.shouldSuppressMouseDownOnViewZone(f.viewZoneId)&&(u(),this._mouseDownOperation.start(i.type,e,t),e.preventDefault())}else h&&this.viewHelper.shouldSuppressMouseDownOnWidget(i.detail)&&(u(),e.preventDefault());this.viewController.emitMouseDown({event:e,target:i})}}class k3 extends l.Disposable{constructor(e,t,i,n,s,r){super(),this._context=e,this._viewController=t,this._viewHelper=i,this._mouseTargetFactory=n,this._createMouseTarget=s,this._getMouseColumn=r,this._mouseMoveMonitor=this._register(new r3(this._viewHelper.viewDomNode)),this._topBottomDragScrolling=this._register(new M3(this._context,this._viewHelper,this._mouseTargetFactory,(a,c,h)=>this._dispatchMouse(a,c,h))),this._leftRightDragScrolling=this._register(new O3(this._context,this._viewHelper,this._mouseTargetFactory,(a,c,h)=>this._dispatchMouse(a,c,h))),this._mouseState=new wv,this._currentSelection=new l.Selection(1,1,1,1),this._isActive=!1,this._lastMouseEvent=null}isActive(){return this._isActive}_onMouseDownThenMove(e){this._lastMouseEvent=e,this._mouseState.setModifiers(e);const t=this._findMousePosition(e,!1);t&&(this._mouseState.isDragAndDrop?this._viewController.emitMouseDrag({event:e,target:t}):t.type===13?t.outsidePosition==="above"||t.outsidePosition==="below"?(this._topBottomDragScrolling.start(t,e),this._leftRightDragScrolling.stop()):(this._leftRightDragScrolling.start(t,e),this._topBottomDragScrolling.stop()):(this._topBottomDragScrolling.stop(),this._leftRightDragScrolling.stop(),this._dispatchMouse(t,!0,1)))}start(e,t,i){this._lastMouseEvent=t,this._mouseState.setStartedOnLineNumbers(e===3),this._mouseState.setStartButtons(t),this._mouseState.setModifiers(t);const n=this._findMousePosition(t,!0);if(!n||!n.position)return;this._mouseState.trySetCount(t.detail,n.position),t.detail=this._mouseState.count;const s=this._context.configuration.options;if(!s.get(104)&&s.get(42)&&!s.get(28)&&!this._mouseState.altKey&&t.detail<2&&!this._isActive&&!this._currentSelection.isEmpty()&&n.type===6&&n.position&&this._currentSelection.containsPosition(n.position)){this._mouseState.isDragAndDrop=!0,this._isActive=!0,this._mouseMoveMonitor.startMonitoring(this._viewHelper.viewLinesDomNode,i,t.buttons,r=>this._onMouseDownThenMove(r),r=>{const a=this._findMousePosition(this._lastMouseEvent,!1);so(r)?this._viewController.emitMouseDropCanceled():this._viewController.emitMouseDrop({event:this._lastMouseEvent,target:a?this._createMouseTarget(this._lastMouseEvent,!0):null}),this._stop()});return}this._mouseState.isDragAndDrop=!1,this._dispatchMouse(n,t.shiftKey,1),this._isActive||(this._isActive=!0,this._mouseMoveMonitor.startMonitoring(this._viewHelper.viewLinesDomNode,i,t.buttons,r=>this._onMouseDownThenMove(r),()=>this._stop()))}_stop(){this._isActive=!1,this._topBottomDragScrolling.stop(),this._leftRightDragScrolling.stop()}onHeightChanged(){this._mouseMoveMonitor.stopMonitoring()}onPointerUp(){this._mouseMoveMonitor.stopMonitoring()}onCursorStateChanged(e){this._currentSelection=e.selections[0]}_getPositionOutsideEditor(e){const t=e.editorPos,i=this._context.viewModel,n=this._context.viewLayout,s=this._getMouseColumn(e);if(e.posy<t.y){const u=t.y-e.posy,f=Math.max(n.getCurrentScrollTop()-u,0),g=uc.getZoneAtCoord(this._context,f);if(g){const p=this._helpPositionJumpOverViewZone(g);if(p)return $t.createOutsideEditor(s,p,"above",u)}const m=n.getLineNumberAtVerticalOffset(f);return $t.createOutsideEditor(s,new l.Position(m,1),"above",u)}if(e.posy>t.y+t.height){const u=e.posy-t.y-t.height,f=n.getCurrentScrollTop()+e.relativePos.y,g=uc.getZoneAtCoord(this._context,f);if(g){const p=this._helpPositionJumpOverViewZone(g);if(p)return $t.createOutsideEditor(s,p,"below",u)}const m=n.getLineNumberAtVerticalOffset(f);return $t.createOutsideEditor(s,new l.Position(m,i.getLineMaxColumn(m)),"below",u)}const r=n.getLineNumberAtVerticalOffset(n.getCurrentScrollTop()+e.relativePos.y),a=this._context.configuration.options.get(165),c=a.contentLeft;if(e.relativePos.x<=c){const u=c-e.relativePos.x,f=i.getTextDirection(r)===l.TextDirection.RTL;return $t.createOutsideEditor(s,new l.Position(r,f?i.getLineMaxColumn(r):1),"left",u)}const d=a.minimap.minimapLeft===0?a.width-a.verticalScrollbarWidth:a.minimap.minimapLeft;if(e.relativePos.x>=d){const u=e.relativePos.x-d,f=i.getTextDirection(r)===l.TextDirection.RTL;return $t.createOutsideEditor(s,new l.Position(r,f?1:i.getLineMaxColumn(r)),"right",u)}return null}_findMousePosition(e,t){const i=this._getPositionOutsideEditor(e);if(i)return i;const n=this._createMouseTarget(e,t);if(!n.position)return null;if(n.type===8||n.type===5){const r=this._helpPositionJumpOverViewZone(n.detail);if(r)return $t.createViewZone(n.type,n.element,n.mouseColumn,r,n.detail)}return n}_helpPositionJumpOverViewZone(e){const t=new l.Position(this._currentSelection.selectionStartLineNumber,this._currentSelection.selectionStartColumn),i=e.positionBefore,n=e.positionAfter;return i&&n?i.isBefore(t)?i:n:null}_dispatchMouse(e,t,i){e.position&&this._viewController.dispatchMouse({position:e.position,mouseColumn:e.mouseColumn,startedOnLineNumbers:this._mouseState.startedOnLineNumbers,revealType:i,inSelectionMode:t,mouseDownCount:this._mouseState.count,altKey:this._mouseState.altKey,ctrlKey:this._mouseState.ctrlKey,metaKey:this._mouseState.metaKey,shiftKey:this._mouseState.shiftKey,leftButton:this._mouseState.leftButton,middleButton:this._mouseState.middleButton,onInjectedText:e.type===6&&e.detail.injectedText!==null})}}const W_=class W_{get altKey(){return this._altKey}get ctrlKey(){return this._ctrlKey}get metaKey(){return this._metaKey}get shiftKey(){return this._shiftKey}get leftButton(){return this._leftButton}get middleButton(){return this._middleButton}get startedOnLineNumbers(){return this._startedOnLineNumbers}constructor(){this._altKey=!1,this._ctrlKey=!1,this._metaKey=!1,this._shiftKey=!1,this._leftButton=!1,this._middleButton=!1,this._startedOnLineNumbers=!1,this._lastMouseDownPosition=null,this._lastMouseDownPositionEqualCount=0,this._lastMouseDownCount=0,this._lastSetMouseDownCountTime=0,this.isDragAndDrop=!1}get count(){return this._lastMouseDownCount}setModifiers(e){this._altKey=e.altKey,this._ctrlKey=e.ctrlKey,this._metaKey=e.metaKey,this._shiftKey=e.shiftKey}setStartButtons(e){this._leftButton=e.leftButton,this._middleButton=e.middleButton}setStartedOnLineNumbers(e){this._startedOnLineNumbers=e}trySetCount(e,t){const i=new Date().getTime();i-this._lastSetMouseDownCountTime>W_.CLEAR_MOUSE_DOWN_COUNT_TIME&&(e=1),this._lastSetMouseDownCountTime=i,e>this._lastMouseDownCount+1&&(e=this._lastMouseDownCount+1),this._lastMouseDownPosition&&this._lastMouseDownPosition.equals(t)?this._lastMouseDownPositionEqualCount++:this._lastMouseDownPositionEqualCount=1,this._lastMouseDownPosition=t,this._lastMouseDownCount=Math.min(e,this._lastMouseDownPositionEqualCount)}};W_.CLEAR_MOUSE_DOWN_COUNT_TIME=400;let wv=W_;class Te{get event(){return this.emitter.event}constructor(e,t,i){const n=s=>this.emitter.fire(s);this.emitter=new l.Emitter({onWillAddFirstListener:()=>e.addEventListener(t,n,i),onDidRemoveLastListener:()=>e.removeEventListener(t,n,i)})}dispose(){this.emitter.dispose()}}const Wg=(function(){if(typeof crypto.randomUUID=="function")return crypto.randomUUID.bind(crypto);const o=new Uint8Array(16),e=[];for(let t=0;t<256;t++)e.push(t.toString(16).padStart(2,"0"));return function(){crypto.getRandomValues(o),o[6]=o[6]&15|64,o[8]=o[8]&63|128;let i=0,n="";return n+=e[o[i++]],n+=e[o[i++]],n+=e[o[i++]],n+=e[o[i++]],n+="-",n+=e[o[i++]],n+=e[o[i++]],n+="-",n+=e[o[i++]],n+=e[o[i++]],n+="-",n+=e[o[i++]],n+=e[o[i++]],n+="-",n+=e[o[i++]],n+=e[o[i++]],n+=e[o[i++]],n+=e[o[i++]],n+=e[o[i++]],n+=e[o[i++]],n}})();function mI(o){return`${o}-${Wg()}`}const pc={RESOURCES:"ResourceURLs",TEXT:mn.text,INTERNAL_URI_LIST:"application/vnd.code.uri-list"};function Sv(o,e){return{id:e,asString:async()=>o,asFile:()=>{},value:typeof o=="string"?o:void 0}}function F3(o,e,t,i){const n={id:Wg(),name:o,uri:e,data:t};return{id:i,asString:async()=>"",asFile:()=>n,value:void 0}}class pI{constructor(){this._entries=new Map}get size(){let e=0;for(const t of this._entries)e++;return e}has(e){return this._entries.has(this.toKey(e))}matches(e){const t=[...this._entries.keys()];return l.Iterable.some(this,([i,n])=>n.asFile())&&t.push("files"),_I(Hg(e),t)}get(e){return this._entries.get(this.toKey(e))?.[0]}append(e,t){const i=this._entries.get(e);i?i.push(t):this._entries.set(this.toKey(e),[t])}replace(e,t){this._entries.set(this.toKey(e),[t])}delete(e){this._entries.delete(this.toKey(e))}*[Symbol.iterator](){for(const[e,t]of this._entries)for(const i of t)yield[e,i]}toKey(e){return Hg(e)}}function Hg(o){return o.toLowerCase()}function B3(o,e){return _I(Hg(o),e.map(Hg))}function _I(o,e){if(o==="*/*")return e.length>0;if(e.includes(o))return!0;const t=o.match(/^([a-z]+)\/([a-z]+|\*)$/i);if(!t)return!1;const[i,n,s]=t;return s==="*"?e.some(r=>r.startsWith(n+"/")):!1}const yv=Object.freeze({create:o=>l.distinct(o.map(e=>e.toString())).join(`\r
|
||
`),split:o=>o.split(`\r
|
||
`),parse:o=>yv.split(o).filter(e=>!e.startsWith("#"))}),bI={EDITORS:"CodeEditors",FILES:"CodeFiles"};class z3{}const V3={DragAndDropContribution:"workbench.contributions.dragAndDrop"};St.add(V3.DragAndDropContribution,new z3);const _f=class _f{constructor(){}static getInstance(){return _f.INSTANCE}hasData(e){return e&&e===this.proto}getData(e){if(this.hasData(e))return this.data}};_f.INSTANCE=new _f;let Lv=_f;function CI(o){if(l.isNative&&typeof globalThis.vscode?.webUtils?.getPathForFile=="function")return globalThis.vscode?.webUtils?.getPathForFile(o)}function U3(o){const e=new pI;for(const t of o.items){const i=t.type;if(t.kind==="string"){const n=new Promise(s=>t.getAsString(s));e.append(i,Sv(n))}else if(t.kind==="file"){const n=t.getAsFile();n&&e.append(i,$3(n))}}return e}function $3(o){const e=CI(o),t=e?l.URI.parse(e):void 0;return F3(o.name,t,async()=>new Uint8Array(await o.arrayBuffer()))}const K3=Object.freeze([bI.EDITORS,bI.FILES,pc.RESOURCES,pc.INTERNAL_URI_LIST]);function vI(o,e=!1){const t=U3(o),i=t.get(pc.INTERNAL_URI_LIST);if(i)t.replace(mn.uriList,i);else if(e||!t.has(mn.uriList)){const n=[];for(const s of o.items){const r=s.getAsFile();if(r){const a=CI(r);try{a?n.push(l.URI.file(a).toString()):n.push(l.URI.parse(r.name,!0).toString())}catch{}}}n.length&&t.replace(mn.uriList,Sv(yv.create(n)))}for(const n of K3)t.delete(n);return t}function G3(o,e,t){const{dataToCopy:i,metadata:n}=SI(o);return wI(i.text,n,t),{dataToCopy:i,metadata:n}}function wI(o,e,t){_c.INSTANCE.set(t?o.replace(/\r\n/g,`
|
||
`):o,e)}function SI(o){const e=o.getEditorOption(45),t=o.getEditorOption(31),i=o.getCursorStates().map(r=>r.modelState.selection),n=j3(o,i,e,t),s={version:1,id:Wg(),isFromEmptySelection:n.isFromEmptySelection,multicursorText:n.multicursorText,mode:n.mode};return{dataToCopy:n,metadata:s}}function j3(o,e,t,i){const{sourceRanges:n,sourceText:s}=o.getPlainTextToCopy(e,t,l.isWindows),r=o.model.getEOL(),a=t&&e.length===1&&e[0].isEmpty(),c=Array.isArray(s)?s:null,h=Array.isArray(s)?s.join(r):s;let d,u=null;if(em.forceCopyWithSyntaxHighlighting||i&&s.length<65536){const g=o.getRichTextToCopy(e,t);g&&(d=g.html,u=g.mode)}return{isFromEmptySelection:a,sourceRanges:n,multicursorText:c,text:h,html:d,mode:u}}const H_=class H_{constructor(){this._lastState=null}set(e,t){this._lastState={lastCopiedValue:e,data:t}}get(e){return this._lastState&&this._lastState.lastCopiedValue===e?this._lastState.data:(this._lastState=null,null)}};H_.INSTANCE=new H_;let _c=H_;const em={forceCopyWithSyntaxHighlighting:!1,electronBugWorkaroundCopyEventHasFired:!1},yI={getTextData(o){const e=o.getData(mn.text);let t=null;const i=o.getData("vscode-editor-data");if(typeof i=="string")try{t=JSON.parse(i),t.version!==1&&(t=null)}catch{}return e.length===0&&t===null&&o.files.length>0?[Array.prototype.slice.call(o.files,0).map(s=>s.name).join(`
|
||
`),null]:[e,t]},setTextData(o,e,t,i){o.setData(mn.text,e),typeof t=="string"&&o.setData("text/html",t),o.setData("vscode-editor-data",JSON.stringify(i))}};function tm(o,e,t,i,n){const{dataToCopy:s,metadata:r}=SI(t.viewModel);let a=!1;return{isCut:e,clipboardData:{setData:(c,h)=>{o.clipboardData?.setData(c,h)}},dataToCopy:s,ensureClipboardGetsEditorData:()=>{o.preventDefault(),o.clipboardData&&yI.setTextData(o.clipboardData,s.text,s.html,r),wI(s.text,r,n),i.trace("ensureClipboardGetsEditorSelection with id : ",r.id," with text.length: ",s.text.length)},setHandled:()=>{a=!0,o.preventDefault(),o.stopImmediatePropagation()},get isHandled(){return a}}}function LI(o){let e=!1,[t,i]=o.clipboardData?yI.getTextData(o.clipboardData):["",null];return i=i||_c.INSTANCE.get(t),{clipboardData:q3(o.clipboardData),metadata:i,text:t,toExternalVSDataTransfer:()=>o.clipboardData?vI(o.clipboardData):void 0,browserEvent:o,setHandled:()=>{e=!0,o.preventDefault(),o.stopImmediatePropagation()},get isHandled(){return e}}}function q3(o){return{types:Array.from(o?.types??[]),files:Array.prototype.slice.call(o?.files??[],0),getData:e=>o?.getData(e)??""}}const Sl=class Sl{constructor(e,t,i,n,s){this.value=e,this.selectionStart=t,this.selectionEnd=i,this.selection=n,this.newlineCountBeforeSelection=s}toString(){return`[ <${this.value}>, selectionStart: ${this.selectionStart}, selectionEnd: ${this.selectionEnd}]`}static readFromTextArea(e,t){const i=e.getValue(),n=e.getSelectionStart(),s=e.getSelectionEnd();let r;if(t){const a=i.substring(0,n),c=t.value.substring(0,t.selectionStart);a===c&&(r=t.newlineCountBeforeSelection)}return new Sl(i,n,s,null,r)}collapseSelection(){return this.selectionStart===this.value.length?this:new Sl(this.value,this.value.length,this.value.length,null,void 0)}isWrittenToTextArea(e,t){const i=this.value===e.getValue();return t?this.selectionStart===e.getSelectionStart()&&this.selectionEnd===e.getSelectionEnd()&&i:i}writeToTextArea(e,t,i){t.setValue(e,this.value),i&&t.setSelectionRange(e,this.selectionStart,this.selectionEnd)}deduceEditorPosition(e){if(e<=this.selectionStart){const n=this.value.substring(e,this.selectionStart);return this._finishDeduceEditorPosition(this.selection?.getStartPosition()??null,n,-1)}if(e>=this.selectionEnd){const n=this.value.substring(this.selectionEnd,e);return this._finishDeduceEditorPosition(this.selection?.getEndPosition()??null,n,1)}const t=this.value.substring(this.selectionStart,e);if(t.indexOf("…")===-1)return this._finishDeduceEditorPosition(this.selection?.getStartPosition()??null,t,1);const i=this.value.substring(e,this.selectionEnd);return this._finishDeduceEditorPosition(this.selection?.getEndPosition()??null,i,-1)}_finishDeduceEditorPosition(e,t,i){let n=0,s=-1;for(;(s=t.indexOf(`
|
||
`,s+1))!==-1;)n++;return[e,i*t.length,n]}static deduceInput(e,t,i){if(!e)return{text:"",replacePrevCharCnt:0,replaceNextCharCnt:0,positionDelta:0};const n=Math.min(l.commonPrefixLength(e.value,t.value),e.selectionStart,t.selectionStart),s=Math.min(l.commonSuffixLength(e.value,t.value),e.value.length-e.selectionEnd,t.value.length-t.selectionEnd);e.value.substring(n,e.value.length-s);const r=t.value.substring(n,t.value.length-s),a=e.selectionStart-n,c=e.selectionEnd-n,h=t.selectionStart-n,d=t.selectionEnd-n;if(h===d){const f=e.selectionStart-n;return{text:r,replacePrevCharCnt:f,replaceNextCharCnt:0,positionDelta:0}}const u=c-a;return{text:r,replacePrevCharCnt:u,replaceNextCharCnt:0,positionDelta:0}}static deduceAndroidCompositionInput(e,t){if(!e)return{text:"",replacePrevCharCnt:0,replaceNextCharCnt:0,positionDelta:0};if(e.value===t.value)return{text:"",replacePrevCharCnt:0,replaceNextCharCnt:0,positionDelta:t.selectionEnd-e.selectionEnd};const i=Math.min(l.commonPrefixLength(e.value,t.value),e.selectionEnd),n=Math.min(l.commonSuffixLength(e.value,t.value),e.value.length-e.selectionEnd),s=e.value.substring(i,e.value.length-n),r=t.value.substring(i,t.value.length-n);e.selectionStart-i;const a=e.selectionEnd-i;t.selectionStart-i;const c=t.selectionEnd-i;return{text:r,replacePrevCharCnt:a,replaceNextCharCnt:s.length-a,positionDelta:c-r.length}}static fromScreenReaderContentState(e){let t,i;switch(e.selection.getDirection()){case 0:t=e.selectionStart,i=e.selectionEnd;break;case 1:t=e.selectionEnd,i=e.selectionStart;break}return new Sl(e.value,t,i,e.selection,e.newlineCountBeforeSelection)}};Sl.EMPTY=new Sl("",0,0,null,void 0);let ci=Sl;var Y3=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},DI=function(o,e){return function(t,i){e(t,i,o)}},im;(function(o){o.Tap="-monaco-textarea-synthetic-tap"})(im||(im={}));class Z3{constructor(){this._lastTypeTextLength=0}handleCompositionUpdate(e){e=e||"";const t={text:e,replacePrevCharCnt:this._lastTypeTextLength,replaceNextCharCnt:0,positionDelta:0};return this._lastTypeTextLength=e.length,t}}let Dv=class extends l.Disposable{get textAreaState(){return this._textAreaState}constructor(e,t,i,n,s,r){super(),this._host=e,this._textArea=t,this._OS=i,this._browser=n,this._accessibilityService=s,this._logService=r,this._onFocus=this._register(new l.Emitter),this.onFocus=this._onFocus.event,this._onBlur=this._register(new l.Emitter),this.onBlur=this._onBlur.event,this._onKeyDown=this._register(new l.Emitter),this.onKeyDown=this._onKeyDown.event,this._onKeyUp=this._register(new l.Emitter),this.onKeyUp=this._onKeyUp.event,this._onCut=this._register(new l.Emitter),this.onCut=this._onCut.event,this._onPaste=this._register(new l.Emitter),this.onPaste=this._onPaste.event,this._onWillCopy=this._register(new l.Emitter),this.onWillCopy=this._onWillCopy.event,this._onWillCut=this._register(new l.Emitter),this.onWillCut=this._onWillCut.event,this._onWillPaste=this._register(new l.Emitter),this.onWillPaste=this._onWillPaste.event,this._onType=this._register(new l.Emitter),this.onType=this._onType.event,this._onCompositionStart=this._register(new l.Emitter),this.onCompositionStart=this._onCompositionStart.event,this._onCompositionUpdate=this._register(new l.Emitter),this.onCompositionUpdate=this._onCompositionUpdate.event,this._onCompositionEnd=this._register(new l.Emitter),this.onCompositionEnd=this._onCompositionEnd.event,this._onSelectionChangeRequest=this._register(new l.Emitter),this.onSelectionChangeRequest=this._onSelectionChangeRequest.event,this._asyncFocusGainWriteScreenReaderContent=this._register(new l.MutableDisposable),this._asyncTriggerCut=this._register(new l.RunOnceScheduler(()=>this._onCut.fire(),0)),this._textAreaState=ci.EMPTY,this._selectionChangeListener=null,this._accessibilityService.isScreenReaderOptimized()&&this.writeNativeTextAreaContent("ctor"),this._register(l.Event.runAndSubscribe(this._accessibilityService.onDidChangeScreenReaderOptimized,()=>{this._accessibilityService.isScreenReaderOptimized()&&!this._asyncFocusGainWriteScreenReaderContent.value?this._asyncFocusGainWriteScreenReaderContent.value=new l.RunOnceScheduler(()=>this.writeNativeTextAreaContent("asyncFocusGain"),0):this._asyncFocusGainWriteScreenReaderContent.clear()})),this._hasFocus=!1,this._currentComposition=null;let a=null;this._register(this._textArea.onKeyDown(c=>{const h=new Be(c);(h.keyCode===114||this._currentComposition&&h.keyCode===1)&&h.stopPropagation(),h.equals(9)&&h.preventDefault(),a=h,this._onKeyDown.fire(h)})),this._register(this._textArea.onKeyUp(c=>{const h=new Be(c);this._onKeyUp.fire(h)})),this._register(this._textArea.onCompositionStart(c=>{const h=new Z3;if(this._currentComposition){this._currentComposition=h;return}if(this._currentComposition=h,this._OS===2&&a&&a.equals(114)&&this._textAreaState.selectionStart===this._textAreaState.selectionEnd&&this._textAreaState.selectionStart>0&&this._textAreaState.value.substr(this._textAreaState.selectionStart-1,1)===c.data&&(a.code==="ArrowRight"||a.code==="ArrowLeft")){h.handleCompositionUpdate("x"),this._onCompositionStart.fire({data:c.data});return}if(this._browser.isAndroid){this._onCompositionStart.fire({data:c.data});return}this._onCompositionStart.fire({data:c.data})})),this._register(this._textArea.onCompositionUpdate(c=>{const h=this._currentComposition;if(!h)return;if(this._browser.isAndroid){const u=ci.readFromTextArea(this._textArea,this._textAreaState),f=ci.deduceAndroidCompositionInput(this._textAreaState,u);this._textAreaState=u,this._onType.fire(f),this._onCompositionUpdate.fire(c);return}const d=h.handleCompositionUpdate(c.data);this._textAreaState=ci.readFromTextArea(this._textArea,this._textAreaState),this._onType.fire(d),this._onCompositionUpdate.fire(c)})),this._register(this._textArea.onCompositionEnd(c=>{const h=this._currentComposition;if(!h)return;if(this._currentComposition=null,this._browser.isAndroid){const u=ci.readFromTextArea(this._textArea,this._textAreaState),f=ci.deduceAndroidCompositionInput(this._textAreaState,u);this._textAreaState=u,this._onType.fire(f),this._onCompositionEnd.fire();return}const d=h.handleCompositionUpdate(c.data);this._textAreaState=ci.readFromTextArea(this._textArea,this._textAreaState),this._onType.fire(d),this._onCompositionEnd.fire()})),this._register(this._textArea.onInput(c=>{if(this._textArea.setIgnoreSelectionChangeTime("received input event"),this._currentComposition)return;const h=ci.readFromTextArea(this._textArea,this._textAreaState),d=ci.deduceInput(this._textAreaState,h,this._OS===2);d.replacePrevCharCnt===0&&d.text.length===1&&(l.isHighSurrogate(d.text.charCodeAt(0))||d.text.charCodeAt(0)===127)||(this._textAreaState=h,(d.text!==""||d.replacePrevCharCnt!==0||d.replaceNextCharCnt!==0||d.positionDelta!==0)&&(c.inputType==="insertFromPaste"?this._onPaste.fire({text:d.text,metadata:_c.INSTANCE.get(d.text)}):this._onType.fire(d)))})),this._register(this._textArea.onCut(c=>{this._logService.trace("TextAreaInput#onCut",c);const h=tm(c,!0,this._host.context,this._logService,this._browser.isFirefox);this._onWillCut.fire(h),!h.isHandled&&(this._textArea.setIgnoreSelectionChangeTime("received cut event"),h.ensureClipboardGetsEditorData(),this._asyncTriggerCut.schedule())})),this._register(this._textArea.onCopy(c=>{this._logService.trace("TextAreaInput#onCopy",c),em.electronBugWorkaroundCopyEventHasFired=!0;const h=tm(c,!1,this._host.context,this._logService,this._browser.isFirefox);this._onWillCopy.fire(h),!h.isHandled&&h.ensureClipboardGetsEditorData()})),this._register(this._textArea.onPaste(c=>{this._logService.trace("TextAreaInput#onPaste",c);const h=LI(c);this._onWillPaste.fire(h),!h.isHandled&&(this._textArea.setIgnoreSelectionChangeTime("received paste event"),c.preventDefault(),this._logService.trace("TextAreaInput#onPaste with id : ",h.metadata?.id," with text.length: ",h.text.length),h.text&&(this._logService.trace("TextAreaInput#onPaste (before onPaste)"),this._onPaste.fire({text:h.text,metadata:h.metadata})))})),this._register(this._textArea.onFocus(()=>{const c=this._hasFocus;this._setHasFocus(!0),this._accessibilityService.isScreenReaderOptimized()&&this._browser.isSafari&&!c&&this._hasFocus&&(this._asyncFocusGainWriteScreenReaderContent.value||(this._asyncFocusGainWriteScreenReaderContent.value=new l.RunOnceScheduler(()=>this.writeNativeTextAreaContent("asyncFocusGain"),0)),this._asyncFocusGainWriteScreenReaderContent.value.schedule())})),this._register(this._textArea.onBlur(()=>{this._currentComposition&&(this._currentComposition=null,this.writeNativeTextAreaContent("blurWithoutCompositionEnd"),this._onCompositionEnd.fire()),this._setHasFocus(!1)})),this._register(this._textArea.onSyntheticTap(()=>{this._browser.isAndroid&&this._currentComposition&&(this._currentComposition=null,this.writeNativeTextAreaContent("tapWithoutCompositionEnd"),this._onCompositionEnd.fire())}))}_installSelectionChangeListener(){let e=0;return R(this._textArea.ownerDocument,"selectionchange",t=>{if(_n.onSelectionChange(),!this._hasFocus||this._currentComposition||!this._browser.isChrome)return;const i=Date.now(),n=i-e;if(e=i,n<5)return;const s=i-this._textArea.getIgnoreSelectionChangeTime();if(this._textArea.resetSelectionChangeTime(),s<100||!this._textAreaState.selection)return;const r=this._textArea.getValue();if(this._textAreaState.value!==r)return;const a=this._textArea.getSelectionStart(),c=this._textArea.getSelectionEnd();if(this._textAreaState.selectionStart===a&&this._textAreaState.selectionEnd===c)return;const h=this._textAreaState.deduceEditorPosition(a),d=this._host.deduceModelPosition(h[0],h[1],h[2]),u=this._textAreaState.deduceEditorPosition(c),f=this._host.deduceModelPosition(u[0],u[1],u[2]),g=new l.Selection(d.lineNumber,d.column,f.lineNumber,f.column);this._onSelectionChangeRequest.fire(g)})}dispose(){super.dispose(),this._selectionChangeListener&&(this._selectionChangeListener.dispose(),this._selectionChangeListener=null)}focusTextArea(){this._setHasFocus(!0),this.refreshFocusState()}isFocused(){return this._hasFocus}refreshFocusState(){this._setHasFocus(this._textArea.hasFocus())}_setHasFocus(e){this._hasFocus!==e&&(this._hasFocus=e,this._selectionChangeListener&&(this._selectionChangeListener.dispose(),this._selectionChangeListener=null),this._hasFocus&&(this._selectionChangeListener=this._installSelectionChangeListener()),this._hasFocus&&this.writeNativeTextAreaContent("focusgain"),this._hasFocus?this._onFocus.fire():this._onBlur.fire())}_setAndWriteTextAreaState(e,t){this._hasFocus||(t=t.collapseSelection()),t.isWrittenToTextArea(this._textArea,this._hasFocus)||this._logService.trace(`writeTextAreaState(reason: ${e})`),t.writeToTextArea(e,this._textArea,this._hasFocus),this._textAreaState=t}writeNativeTextAreaContent(e){!this._accessibilityService.isScreenReaderOptimized()&&e==="render"||this._currentComposition||this._setAndWriteTextAreaState(e,this._host.getScreenReaderContent())}};Dv=Y3([DI(4,Ui),DI(5,ei)],Dv);class Q3 extends l.Disposable{get ownerDocument(){return this._actual.ownerDocument}constructor(e){super(),this._actual=e,this._onSyntheticTap=this._register(new l.Emitter),this.onSyntheticTap=this._onSyntheticTap.event,this._ignoreSelectionChangeTime=0,this.onKeyDown=this._register(new Te(this._actual,"keydown")).event,this.onKeyPress=this._register(new Te(this._actual,"keypress")).event,this.onKeyUp=this._register(new Te(this._actual,"keyup")).event,this.onCompositionStart=this._register(new Te(this._actual,"compositionstart")).event,this.onCompositionUpdate=this._register(new Te(this._actual,"compositionupdate")).event,this.onCompositionEnd=this._register(new Te(this._actual,"compositionend")).event,this.onBeforeInput=this._register(new Te(this._actual,"beforeinput")).event,this.onInput=this._register(new Te(this._actual,"input")).event,this.onCut=this._register(new Te(this._actual,"cut")).event,this.onCopy=this._register(new Te(this._actual,"copy")).event,this.onPaste=this._register(new Te(this._actual,"paste")).event,this.onFocus=this._register(new Te(this._actual,"focus")).event,this.onBlur=this._register(new Te(this._actual,"blur")).event,this._register(this.onKeyDown(()=>_n.onKeyDown())),this._register(this.onBeforeInput(()=>_n.onBeforeInput())),this._register(this.onInput(()=>_n.onInput())),this._register(this.onKeyUp(()=>_n.onKeyUp())),this._register(R(this._actual,im.Tap,()=>this._onSyntheticTap.fire()))}hasFocus(){const e=qo(this._actual);return e?e.activeElement===this._actual:this._actual.isConnected?wt()===this._actual:!1}setIgnoreSelectionChangeTime(e){this._ignoreSelectionChangeTime=Date.now()}getIgnoreSelectionChangeTime(){return this._ignoreSelectionChangeTime}resetSelectionChangeTime(){this._ignoreSelectionChangeTime=0}getValue(){return this._actual.value}setValue(e,t){const i=this._actual;i.value!==t&&(this.setIgnoreSelectionChangeTime("setValue"),i.value=t)}getSelectionStart(){return this._actual.selectionDirection==="backward"?this._actual.selectionEnd:this._actual.selectionStart}getSelectionEnd(){return this._actual.selectionDirection==="backward"?this._actual.selectionStart:this._actual.selectionEnd}setSelectionRange(e,t,i){const n=this._actual;let s=null;const r=qo(n);r?s=r.activeElement:s=wt();const a=j(s),c=s===n,h=n.selectionStart,d=n.selectionEnd;if(c&&h===t&&d===i){di&&a.parent!==a&&n.focus();return}if(c){this.setIgnoreSelectionChangeTime("setSelectionRange"),n.setSelectionRange(t,i),di&&a.parent!==a&&n.focus();return}try{const u=DF(n);this.setIgnoreSelectionChangeTime("setSelectionRange"),n.focus(),n.setSelectionRange(t,i),xF(n,u)}catch{}}}class X3 extends vv{constructor(e,t,i){super(e,t,i),this._register(li.addTarget(this.viewHelper.linesContentDomNode)),this._register(R(this.viewHelper.linesContentDomNode,_.EventType$1.Tap,s=>this.onTap(s))),this._register(R(this.viewHelper.linesContentDomNode,_.EventType$1.Change,s=>this.onChange(s))),this._register(R(this.viewHelper.linesContentDomNode,_.EventType$1.Contextmenu,s=>this._onContextMenu(new uo(s,!1,this.viewHelper.viewDomNode),!1))),this._lastPointerType="mouse",this._register(R(this.viewHelper.linesContentDomNode,"pointerdown",s=>{const r=s.pointerType;if(r==="mouse"){this._lastPointerType="mouse";return}else r==="touch"?this._lastPointerType="touch":this._lastPointerType="pen"}));const n=new o3(this.viewHelper.viewDomNode);this._register(n.onPointerMove(this.viewHelper.viewDomNode,s=>this._onMouseMove(s))),this._register(n.onPointerUp(this.viewHelper.viewDomNode,s=>this._onMouseUp(s))),this._register(n.onPointerLeave(this.viewHelper.viewDomNode,s=>this._onMouseLeave(s))),this._register(n.onPointerDown(this.viewHelper.viewDomNode,(s,r)=>this._onMouseDown(s,r)))}onTap(e){!e.initialTarget||!this.viewHelper.linesContentDomNode.contains(e.initialTarget)||(e.preventDefault(),this.viewHelper.focusTextArea(),this._dispatchGesture(e,!1))}onChange(e){this._lastPointerType==="touch"&&this._context.viewModel.viewLayout.deltaScrollNow(-e.translationX,-e.translationY),this._lastPointerType==="pen"&&this._dispatchGesture(e,!0)}_dispatchGesture(e,t){const i=this._createMouseTarget(new uo(e,!1,this.viewHelper.viewDomNode),!1);i.position&&this.viewController.dispatchMouse({position:i.position,mouseColumn:i.position.column,startedOnLineNumbers:!1,revealType:1,mouseDownCount:e.tapCount,inSelectionMode:t,altKey:!1,ctrlKey:!1,metaKey:!1,shiftKey:!1,leftButton:!1,middleButton:!1,onInjectedText:i.type===6&&i.detail.injectedText!==null})}_onMouseDown(e,t){e.browserEvent.pointerType!=="touch"&&super._onMouseDown(e,t)}}class J3 extends vv{constructor(e,t,i){super(e,t,i),this._register(li.addTarget(this.viewHelper.linesContentDomNode)),this._register(R(this.viewHelper.linesContentDomNode,_.EventType$1.Tap,n=>this.onTap(n))),this._register(R(this.viewHelper.linesContentDomNode,_.EventType$1.Change,n=>this.onChange(n))),this._register(R(this.viewHelper.linesContentDomNode,_.EventType$1.Contextmenu,n=>this._onContextMenu(new uo(n,!1,this.viewHelper.viewDomNode),!1)))}onTap(e){e.preventDefault(),this.viewHelper.focusTextArea();const t=this._createMouseTarget(new uo(e,!1,this.viewHelper.viewDomNode),!1);if(t.position){const i=document.createEvent("CustomEvent");i.initEvent(im.Tap,!1,!0),this.viewHelper.dispatchTextAreaEvent(i),this.viewController.moveTo(t.position,1)}}onChange(e){this._context.viewModel.viewLayout.deltaScrollNow(-e.translationX,-e.translationY)}}class W3 extends l.Disposable{constructor(e,t,i){super(),(l.isIOS||l.isAndroid&&l.isMobile)&&qh.pointerEvents?this.handler=this._register(new X3(e,t,i)):Ae.TouchEvent?this.handler=this._register(new J3(e,t,i)):this.handler=this._register(new vv(e,t,i))}getTargetAtClientPoint(e,t){return this.handler.getTargetAtClientPoint(e,t)}}function H3(o,e,t){let i=0;for(let s=0;s<o.length;s++)o.charAt(s)===" "?i=Xe.nextIndentTabStop(i,e):i++;let n="";if(!t){const s=Math.floor(i/e);i=i%e;for(let r=0;r<s;r++)n+=" "}for(let s=0;s<i;s++)n+=" ";return n}function xv(o,e,t){let i=l.firstNonWhitespaceIndex(o);return i===-1&&(i=o.length),H3(o.substring(0,i),e,t)+o.substring(i)}const eU=()=>!0,tU=()=>!1,iU=o=>o===" "||o===" ";class bc{static shouldRecreate(e){return e.hasChanged(165)||e.hasChanged(148)||e.hasChanged(45)||e.hasChanged(85)||e.hasChanged(88)||e.hasChanged(89)||e.hasChanged(10)||e.hasChanged(11)||e.hasChanged(15)||e.hasChanged(13)||e.hasChanged(14)||e.hasChanged(20)||e.hasChanged(145)||e.hasChanged(141)||e.hasChanged(59)||e.hasChanged(104)||e.hasChanged(147)||e.hasChanged(93)}constructor(e,t,i,n){this.languageConfigurationService=n,this._cursorMoveConfigurationBrand=void 0,this._languageId=e;const s=i.options,r=s.get(165),a=s.get(59);this.readOnly=s.get(104),this.tabSize=t.tabSize,this.indentSize=t.indentSize,this.insertSpaces=t.insertSpaces,this.stickyTabStops=s.get(132),this.lineHeight=a.lineHeight,this.typicalHalfwidthCharacterWidth=a.typicalHalfwidthCharacterWidth,this.pageSize=Math.max(1,Math.floor(r.height/this.lineHeight)-2),this.useTabStops=s.get(145),this.trimWhitespaceOnDelete=s.get(141),this.wordSeparators=s.get(148),this.emptySelectionClipboard=s.get(45),this.copyWithSyntaxHighlighting=s.get(31),this.multiCursorMergeOverlapping=s.get(85),this.multiCursorPaste=s.get(88),this.multiCursorLimit=s.get(89),this.autoClosingBrackets=s.get(10),this.autoClosingComments=s.get(11),this.autoClosingQuotes=s.get(15),this.autoClosingDelete=s.get(13),this.autoClosingOvertype=s.get(14),this.autoSurround=s.get(20),this.autoIndent=s.get(16),this.wordSegmenterLocales=s.get(147),this.overtypeOnPaste=s.get(93),this.surroundingPairs={},this._electricChars=null,this.shouldAutoCloseBefore={quote:this._getShouldAutoClose(e,this.autoClosingQuotes,!0),comment:this._getShouldAutoClose(e,this.autoClosingComments,!1),bracket:this._getShouldAutoClose(e,this.autoClosingBrackets,!1)},this.autoClosingPairs=this.languageConfigurationService.getLanguageConfiguration(e).getAutoClosingPairs();const c=this.languageConfigurationService.getLanguageConfiguration(e).getSurroundingPairs();if(c)for(const d of c)this.surroundingPairs[d.open]=d.close;const h=this.languageConfigurationService.getLanguageConfiguration(e).comments;this.blockCommentStartToken=h?.blockCommentStartToken??null}get electricChars(){if(!this._electricChars){this._electricChars={};const e=this.languageConfigurationService.getLanguageConfiguration(this._languageId).electricCharacter?.getElectricCharacters();if(e)for(const t of e)this._electricChars[t]=!0}return this._electricChars}get inputMode(){return KC.getInputMode()}onElectricCharacter(e,t,i){const n=oa(t,i-1),s=this.languageConfigurationService.getLanguageConfiguration(n.languageId).electricCharacter;return s?s.onElectricCharacter(e,n,i-n.firstCharOffset):null}normalizeIndentation(e){return xv(e,this.indentSize,this.insertSpaces)}_getShouldAutoClose(e,t,i){switch(t){case"beforeWhitespace":return iU;case"languageDefined":return this._getLanguageDefinedShouldAutoClose(e,i);case"always":return eU;case"never":return tU}}_getLanguageDefinedShouldAutoClose(e,t){const i=this.languageConfigurationService.getLanguageConfiguration(e).getAutoCloseBeforeSet(t);return n=>i.indexOf(n)!==-1}visibleColumnFromColumn(e,t){return Xe.visibleColumnFromColumn(e.getLineContent(t.lineNumber),t.column,this.tabSize)}columnFromVisibleColumn(e,t,i){const n=Xe.columnFromVisibleColumn(e.getLineContent(t),i,this.tabSize),s=e.getLineMinColumn(t);if(n<s)return s;const r=e.getLineMaxColumn(t);return n>r?r:n}}class ge{static fromModelState(e){return new nU(e)}static fromViewState(e){return new sU(e)}static fromModelSelection(e){const t=l.Selection.liftSelection(e),i=new Pt(l.Range.fromPositions(t.getSelectionStart()),0,0,t.getPosition(),0);return ge.fromModelState(i)}static fromModelSelections(e){const t=[];for(let i=0,n=e.length;i<n;i++)t[i]=this.fromModelSelection(e[i]);return t}constructor(e,t){this._cursorStateBrand=void 0,this.modelState=e,this.viewState=t}equals(e){return this.viewState.equals(e.viewState)&&this.modelState.equals(e.modelState)}}class nU{constructor(e){this.modelState=e,this.viewState=null}}class sU{constructor(e){this.modelState=null,this.viewState=e}}class Pt{constructor(e,t,i,n,s){this.selectionStart=e,this.selectionStartKind=t,this.selectionStartLeftoverVisibleColumns=i,this.position=n,this.leftoverVisibleColumns=s,this._singleCursorStateBrand=void 0,this.selection=Pt._computeSelection(this.selectionStart,this.position)}equals(e){return this.selectionStartLeftoverVisibleColumns===e.selectionStartLeftoverVisibleColumns&&this.leftoverVisibleColumns===e.leftoverVisibleColumns&&this.selectionStartKind===e.selectionStartKind&&this.position.equals(e.position)&&this.selectionStart.equalsRange(e.selectionStart)}hasSelection(){return!this.selection.isEmpty()||!this.selectionStart.isEmpty()}move(e,t,i,n){return e?new Pt(this.selectionStart,this.selectionStartKind,this.selectionStartLeftoverVisibleColumns,new l.Position(t,i),n):new Pt(new l.Range(t,i,t,i),0,n,new l.Position(t,i),n)}static _computeSelection(e,t){return e.isEmpty()||!t.isBeforeOrEqual(e.getStartPosition())?l.Selection.fromPositions(e.getStartPosition(),t):l.Selection.fromPositions(e.getEndPosition(),t)}}class pi{constructor(e,t,i){this._editOperationResultBrand=void 0,this.type=e,this.commands=t,this.shouldPushStackElementBefore=i.shouldPushStackElementBefore,this.shouldPushStackElementAfter=i.shouldPushStackElementAfter}}function lr(o){return o==="'"||o==='"'||o==="`"}class Ca{static columnSelect(e,t,i,n,s,r){const a=Math.abs(s-i)+1,c=i>s,h=n>r,d=n<r,u=[];for(let f=0;f<a;f++){const g=i+(c?-f:f),m=e.columnFromVisibleColumn(t,g,n),p=e.columnFromVisibleColumn(t,g,r),b=e.visibleColumnFromColumn(t,new l.Position(g,m)),v=e.visibleColumnFromColumn(t,new l.Position(g,p));d&&(b>r||v<n)||h&&(v>n||b<r)||u.push(new Pt(new l.Range(g,m,g,m),0,0,new l.Position(g,p),0))}if(u.length===0)for(let f=0;f<a;f++){const g=i+(c?-f:f),m=t.getLineMaxColumn(g);u.push(new Pt(new l.Range(g,m,g,m),0,0,new l.Position(g,m),0))}return{viewStates:u,reversed:c,fromLineNumber:i,fromVisualColumn:n,toLineNumber:s,toVisualColumn:r}}static columnSelectLeft(e,t,i){let n=i.toViewVisualColumn;return n>0&&n--,Ca.columnSelect(e,t,i.fromViewLineNumber,i.fromViewVisualColumn,i.toViewLineNumber,n)}static columnSelectRight(e,t,i){let n=0;const s=Math.min(i.fromViewLineNumber,i.toViewLineNumber),r=Math.max(i.fromViewLineNumber,i.toViewLineNumber);for(let c=s;c<=r;c++){const h=t.getLineMaxColumn(c),d=e.visibleColumnFromColumn(t,new l.Position(c,h));n=Math.max(n,d)}let a=i.toViewVisualColumn;return a<n&&a++,this.columnSelect(e,t,i.fromViewLineNumber,i.fromViewVisualColumn,i.toViewLineNumber,a)}static columnSelectUp(e,t,i,n){const s=n?e.pageSize:1,r=Math.max(1,i.toViewLineNumber-s);return this.columnSelect(e,t,i.fromViewLineNumber,i.fromViewVisualColumn,r,i.toViewVisualColumn)}static columnSelectDown(e,t,i,n){const s=n?e.pageSize:1,r=Math.min(t.getLineCount(),i.toViewLineNumber+s);return this.columnSelect(e,t,i.fromViewLineNumber,i.fromViewVisualColumn,r,i.toViewVisualColumn)}}class Ri{constructor(e,t,i=!1){this._range=e,this._text=t,this.insertsAutoWhitespace=i}getEditOperations(e,t){t.addTrackedEditOperation(this._range,this._text)}computeCursorState(e,t){const n=t.getInverseEditOperations()[0].range;return l.Selection.fromPositions(n.getEndPosition())}}class Ev{constructor(e,t,i=!1){this._range=e,this._text=t,this.insertsAutoWhitespace=i}getEditOperations(e,t){const i=this._range.getStartPosition(),n=this._range.getEndPosition(),s=n.lineNumber,r=this._text.length+(this._range.isEmpty()?0:-1);let a=EI(e,n,r);a.lineNumber>s&&(a=new l.Position(s,e.getLineMaxColumn(s)));const c=l.Range.fromPositions(i,a);t.addTrackedEditOperation(c,this._text)}computeCursorState(e,t){const n=t.getInverseEditOperations()[0].range;return l.Selection.fromPositions(n.getEndPosition())}}class oU{constructor(e,t){this._range=e,this._text=t}getEditOperations(e,t){t.addTrackedEditOperation(this._range,this._text)}computeCursorState(e,t){const n=t.getInverseEditOperations()[0].range;return l.Selection.fromRange(n,0)}}class nm{constructor(e,t,i=!1){this._range=e,this._text=t,this.insertsAutoWhitespace=i}getEditOperations(e,t){t.addTrackedEditOperation(this._range,this._text)}computeCursorState(e,t){const n=t.getInverseEditOperations()[0].range;return l.Selection.fromPositions(n.getStartPosition())}}class sm{constructor(e,t,i,n,s=!1){this._range=e,this._text=t,this._columnDeltaOffset=n,this._lineNumberDeltaOffset=i,this.insertsAutoWhitespace=s}getEditOperations(e,t){t.addTrackedEditOperation(this._range,this._text)}computeCursorState(e,t){const n=t.getInverseEditOperations()[0].range;return l.Selection.fromPositions(n.getEndPosition().delta(this._lineNumberDeltaOffset,this._columnDeltaOffset))}}class rU{constructor(e){this._range=e}getEditOperations(e,t){const i=e.getValueInRange(this._range),n=this._range.getEndPosition(),s=n.lineNumber;let r=EI(e,n,i.length);r.lineNumber>s&&(r=new l.Position(s,e.getLineMaxColumn(s)));const a=l.Range.fromPositions(n,r);t.addTrackedEditOperation(a,"")}computeCursorState(e,t){const n=t.getInverseEditOperations()[0].range;return l.Selection.fromPositions(n.getEndPosition())}}class xI{constructor(e,t,i,n=!1){this._range=e,this._text=t,this._initialSelection=i,this._forceMoveMarkers=n,this._selectionId=null}getEditOperations(e,t){t.addTrackedEditOperation(this._range,this._text,this._forceMoveMarkers),this._selectionId=t.trackSelection(this._initialSelection)}computeCursorState(e,t){return t.getTrackedSelection(this._selectionId)}}function EI(o,e,t){if(t<0)throw new Error("Unexpected negative delta");const i=o.getLineCount();let n=new l.Position(i,o.getLineMaxColumn(i));for(let s=e.lineNumber;s<=i;s++)if(s===e.lineNumber){const r=t-o.getLineMaxColumn(e.lineNumber)+e.column;if(r<=0){n=new l.Position(e.lineNumber,e.column+t);break}t=r}else{const r=t-o.getLineMaxColumn(s);if(r<=0){n=new l.Position(s,t);break}t=r}return n}class Iv{constructor(e,t,i){this._cursorPositionBrand=void 0,this.lineNumber=e,this.column=t,this.leftoverVisibleColumns=i}}class ye{static leftPosition(e,t){if(t.column>e.getLineMinColumn(t.lineNumber))return t.delta(void 0,-l.prevCharLength(e.getLineContent(t.lineNumber),t.column-1));if(t.lineNumber>1){const i=t.lineNumber-1;return new l.Position(i,e.getLineMaxColumn(i))}else return t}static leftPositionAtomicSoftTabs(e,t,i){if(t.column<=e.getLineIndentColumn(t.lineNumber)){const n=e.getLineMinColumn(t.lineNumber),s=e.getLineContent(t.lineNumber),r=kd.atomicPosition(s,t.column-1,i,0);if(r!==-1&&r+1>=n)return new l.Position(t.lineNumber,r+1)}return this.leftPosition(e,t)}static left(e,t,i){const n=e.stickyTabStops?ye.leftPositionAtomicSoftTabs(t,i,e.tabSize):ye.leftPosition(t,i);return new Iv(n.lineNumber,n.column,0)}static moveLeft(e,t,i,n,s){let r,a;if(i.hasSelection()&&!n)r=i.selection.startLineNumber,a=i.selection.startColumn;else{const c=i.position.delta(void 0,-(s-1)),h=t.normalizePosition(ye.clipPositionColumn(c,t),0),d=ye.left(e,t,h);r=d.lineNumber,a=d.column}return i.move(n,r,a,0)}static clipPositionColumn(e,t){return new l.Position(e.lineNumber,ye.clipRange(e.column,t.getLineMinColumn(e.lineNumber),t.getLineMaxColumn(e.lineNumber)))}static clipRange(e,t,i){return e<t?t:e>i?i:e}static rightPosition(e,t,i){return i<e.getLineMaxColumn(t)?i=i+l.nextCharLength(e.getLineContent(t),i-1):t<e.getLineCount()&&(t=t+1,i=e.getLineMinColumn(t)),new l.Position(t,i)}static rightPositionAtomicSoftTabs(e,t,i,n,s){if(i<e.getLineIndentColumn(t)){const r=e.getLineContent(t),a=kd.atomicPosition(r,i-1,n,1);if(a!==-1)return new l.Position(t,a+1)}return this.rightPosition(e,t,i)}static right(e,t,i){const n=e.stickyTabStops?ye.rightPositionAtomicSoftTabs(t,i.lineNumber,i.column,e.tabSize,e.indentSize):ye.rightPosition(t,i.lineNumber,i.column);return new Iv(n.lineNumber,n.column,0)}static moveRight(e,t,i,n,s){let r,a;if(i.hasSelection()&&!n)r=i.selection.endLineNumber,a=i.selection.endColumn;else{const c=i.position.delta(void 0,s-1),h=t.normalizePosition(ye.clipPositionColumn(c,t),1),d=ye.right(e,t,h);r=d.lineNumber,a=d.column}return i.move(n,r,a,0)}static vertical(e,t,i,n,s,r,a,c){const h=Xe.visibleColumnFromColumn(t.getLineContent(i),n,e.tabSize)+s,d=t.getLineCount(),u=i===1&&n===1,f=i===d&&n===t.getLineMaxColumn(i),g=r<i?u:f;if(i=r,i<1?(i=1,a?n=t.getLineMinColumn(i):n=Math.min(t.getLineMaxColumn(i),n)):i>d?(i=d,a?n=t.getLineMaxColumn(i):n=Math.min(t.getLineMaxColumn(i),n)):n=e.columnFromVisibleColumn(t,i,h),g?s=0:s=h-Xe.visibleColumnFromColumn(t.getLineContent(i),n,e.tabSize),c!==void 0){const m=new l.Position(i,n),p=t.normalizePosition(m,c);s=s+(n-p.column),i=p.lineNumber,n=p.column}return new Iv(i,n,s)}static down(e,t,i,n,s,r,a){return this.vertical(e,t,i,n,s,i+r,a,4)}static moveDown(e,t,i,n,s){let r,a;i.hasSelection()&&!n?(r=i.selection.endLineNumber,a=i.selection.endColumn):(r=i.position.lineNumber,a=i.position.column);let c=0,h;do if(h=ye.down(e,t,r+c,a,i.leftoverVisibleColumns,s,!0),t.normalizePosition(new l.Position(h.lineNumber,h.column),2).lineNumber>r)break;while(c++<10&&r+c<t.getLineCount());return i.move(n,h.lineNumber,h.column,h.leftoverVisibleColumns)}static translateDown(e,t,i){const n=i.selection,s=ye.down(e,t,n.selectionStartLineNumber,n.selectionStartColumn,i.selectionStartLeftoverVisibleColumns,1,!1),r=ye.down(e,t,n.positionLineNumber,n.positionColumn,i.leftoverVisibleColumns,1,!1);return new Pt(new l.Range(s.lineNumber,s.column,s.lineNumber,s.column),0,s.leftoverVisibleColumns,new l.Position(r.lineNumber,r.column),r.leftoverVisibleColumns)}static up(e,t,i,n,s,r,a){return this.vertical(e,t,i,n,s,i-r,a,3)}static moveUp(e,t,i,n,s){let r,a;i.hasSelection()&&!n?(r=i.selection.startLineNumber,a=i.selection.startColumn):(r=i.position.lineNumber,a=i.position.column);const c=ye.up(e,t,r,a,i.leftoverVisibleColumns,s,!0);return i.move(n,c.lineNumber,c.column,c.leftoverVisibleColumns)}static translateUp(e,t,i){const n=i.selection,s=ye.up(e,t,n.selectionStartLineNumber,n.selectionStartColumn,i.selectionStartLeftoverVisibleColumns,1,!1),r=ye.up(e,t,n.positionLineNumber,n.positionColumn,i.leftoverVisibleColumns,1,!1);return new Pt(new l.Range(s.lineNumber,s.column,s.lineNumber,s.column),0,s.leftoverVisibleColumns,new l.Position(r.lineNumber,r.column),r.leftoverVisibleColumns)}static _isBlankLine(e,t){return e.getLineFirstNonWhitespaceColumn(t)===0}static moveToPrevBlankLine(e,t,i,n){let s=i.position.lineNumber;for(;s>1&&this._isBlankLine(t,s);)s--;for(;s>1&&!this._isBlankLine(t,s);)s--;return i.move(n,s,t.getLineMinColumn(s),0)}static moveToNextBlankLine(e,t,i,n){const s=t.getLineCount();let r=i.position.lineNumber;for(;r<s&&this._isBlankLine(t,r);)r++;for(;r<s&&!this._isBlankLine(t,r);)r++;return i.move(n,r,t.getLineMinColumn(r),0)}static moveToBeginningOfLine(e,t,i,n){const s=i.position.lineNumber,r=t.getLineMinColumn(s),a=t.getLineFirstNonWhitespaceColumn(s)||r;let c;return i.position.column===a?c=r:c=a,i.move(n,s,c,0)}static moveToEndOfLine(e,t,i,n,s){const r=i.position.lineNumber,a=t.getLineMaxColumn(r);return i.move(n,r,a,s?1073741824-a:0)}static moveToBeginningOfBuffer(e,t,i,n){return i.move(n,1,1,0)}static moveToEndOfBuffer(e,t,i,n){const s=t.getLineCount(),r=t.getLineMaxColumn(s);return i.move(n,s,r,0)}}class va{static deleteRight(e,t,i,n){const s=[];let r=e!==3;for(let a=0,c=n.length;a<c;a++){const h=n[a],d=this.getDeleteRightRange(h,i,t);if(d.isEmpty()){s[a]=null;continue}d.startLineNumber!==d.endLineNumber&&(r=!0),s[a]=new Ri(d,"")}return[r,s]}static getDeleteRightRange(e,t,i){if(!e.isEmpty())return e;const n=e.getPosition(),s=ye.right(i,t,n);if(i.trimWhitespaceOnDelete&&s.lineNumber!==n.lineNumber){const r=t.getLineFirstNonWhitespaceColumn(n.lineNumber)>0,a=t.getLineFirstNonWhitespaceColumn(s.lineNumber);if(r&&a>0)return new l.Range(s.lineNumber,a,n.lineNumber,n.column)}return new l.Range(s.lineNumber,s.column,n.lineNumber,n.column)}static isAutoClosingPairDelete(e,t,i,n,s,r,a){if(t==="never"&&i==="never"||e==="never")return!1;for(let c=0,h=r.length;c<h;c++){const d=r[c],u=d.getPosition();if(!d.isEmpty())return!1;const f=s.getLineContent(u.lineNumber);if(u.column<2||u.column>=f.length+1)return!1;const g=f.charAt(u.column-2),m=n.get(g);if(!m)return!1;if(lr(g)){if(i==="never")return!1}else if(t==="never")return!1;const p=f.charAt(u.column-1);let b=!1;for(const v of m)v.open===g&&v.close===p&&(b=!0);if(!b)return!1;if(e==="auto"){let v=!1;for(let C=0,w=a.length;C<w;C++){const S=a[C];if(u.lineNumber===S.startLineNumber&&u.column===S.startColumn){v=!0;break}}if(!v)return!1}}return!0}static _runAutoClosingPairDelete(e,t,i){const n=[];for(let s=0,r=i.length;s<r;s++){const a=i[s].getPosition(),c=new l.Range(a.lineNumber,a.column-1,a.lineNumber,a.column+1);n[s]=new Ri(c,"")}return[!0,n]}static deleteLeft(e,t,i,n,s){if(this.isAutoClosingPairDelete(t.autoClosingDelete,t.autoClosingBrackets,t.autoClosingQuotes,t.autoClosingPairs.autoClosingPairsOpenByEnd,i,n,s))return this._runAutoClosingPairDelete(t,i,n);const r=[];let a=e!==2;for(let c=0,h=n.length;c<h;c++){const d=va.getDeleteLeftRange(n[c],i,t);if(d.isEmpty()){r[c]=null;continue}d.startLineNumber!==d.endLineNumber&&(a=!0),r[c]=new Ri(d,"")}return[a,r]}static getDeleteLeftRange(e,t,i){if(!e.isEmpty())return e;const n=e.getPosition();if(i.useTabStops&&n.column>1){const s=t.getLineContent(n.lineNumber),r=l.firstNonWhitespaceIndex(s),a=r===-1?s.length+1:r+1;if(n.column<=a){const c=i.visibleColumnFromColumn(t,n),h=Xe.prevIndentTabStop(c,i.indentSize),d=i.columnFromVisibleColumn(t,n.lineNumber,h);return new l.Range(n.lineNumber,d,n.lineNumber,n.column)}}return l.Range.fromPositions(va.getPositionAfterDeleteLeft(n,t),n)}static getPositionAfterDeleteLeft(e,t){if(e.column>1){const i=l.getLeftDeleteOffset(e.column-1,t.getLineContent(e.lineNumber));return e.with(void 0,i+1)}else if(e.lineNumber>1){const i=e.lineNumber-1;return new l.Position(i,t.getLineMaxColumn(i))}else return e}static cut(e,t,i){const n=[];let s=null;i.sort((r,a)=>l.Position.compare(r.getStartPosition(),a.getEndPosition()));for(let r=0,a=i.length;r<a;r++){const c=i[r];if(c.isEmpty())if(e.emptySelectionClipboard){const h=c.getPosition();let d,u,f,g;h.lineNumber<t.getLineCount()?(d=h.lineNumber,u=1,f=h.lineNumber+1,g=1):h.lineNumber>1&&s?.endLineNumber!==h.lineNumber?(d=h.lineNumber-1,u=t.getLineMaxColumn(h.lineNumber-1),f=h.lineNumber,g=t.getLineMaxColumn(h.lineNumber)):(d=h.lineNumber,u=1,f=h.lineNumber,g=t.getLineMaxColumn(h.lineNumber));const m=new l.Range(d,u,f,g);s=m,m.isEmpty()?n[r]=null:n[r]=new Ri(m,"")}else n[r]=null;else n[r]=new Ri(c,"")}return new pi(0,n,{shouldPushStackElementBefore:!0,shouldPushStackElementAfter:!0})}}class Ne{static _createWord(e,t,i,n,s){return{start:n,end:s,wordType:t,nextCharClass:i}}static _createIntlWord(e,t){return{start:e.index,end:e.index+e.segment.length,wordType:1,nextCharClass:t}}static _findPreviousWordOnLine(e,t,i){const n=t.getLineContent(i.lineNumber);return this._doFindPreviousWordOnLine(n,e,i)}static _doFindPreviousWordOnLine(e,t,i){let n=0;const s=t.findPrevIntlWordBeforeOrAtOffset(e,i.column-2);for(let r=i.column-2;r>=0;r--){const a=e.charCodeAt(r),c=t.get(a);if(s&&r===s.index)return this._createIntlWord(s,c);if(c===0){if(n===2)return this._createWord(e,n,c,r+1,this._findEndOfWord(e,t,n,r+1));n=1}else if(c===2){if(n===1)return this._createWord(e,n,c,r+1,this._findEndOfWord(e,t,n,r+1));n=2}else if(c===1&&n!==0)return this._createWord(e,n,c,r+1,this._findEndOfWord(e,t,n,r+1))}return n!==0?this._createWord(e,n,1,0,this._findEndOfWord(e,t,n,0)):null}static _findEndOfWord(e,t,i,n){const s=t.findNextIntlWordAtOrAfterOffset(e,n),r=e.length;for(let a=n;a<r;a++){const c=e.charCodeAt(a),h=t.get(c);if(s&&a===s.index+s.segment.length||h===1||i===1&&h===2||i===2&&h===0)return a}return r}static _findNextWordOnLine(e,t,i){const n=t.getLineContent(i.lineNumber);return this._doFindNextWordOnLine(n,e,i)}static _doFindNextWordOnLine(e,t,i){let n=0;const s=e.length,r=t.findNextIntlWordAtOrAfterOffset(e,i.column-1);for(let a=i.column-1;a<s;a++){const c=e.charCodeAt(a),h=t.get(c);if(r&&a===r.index)return this._createIntlWord(r,h);if(h===0){if(n===2)return this._createWord(e,n,h,this._findStartOfWord(e,t,n,a-1),a);n=1}else if(h===2){if(n===1)return this._createWord(e,n,h,this._findStartOfWord(e,t,n,a-1),a);n=2}else if(h===1&&n!==0)return this._createWord(e,n,h,this._findStartOfWord(e,t,n,a-1),a)}return n!==0?this._createWord(e,n,1,this._findStartOfWord(e,t,n,s-1),s):null}static _findStartOfWord(e,t,i,n){const s=t.findPrevIntlWordBeforeOrAtOffset(e,n);for(let r=n;r>=0;r--){const a=e.charCodeAt(r),c=t.get(a);if(s&&r===s.index)return r;if(c===1||i===1&&c===2||i===2&&c===0)return r+1}return 0}static moveWordLeft(e,t,i,n,s){let r=i.lineNumber,a=i.column;a===1&&r>1&&(r=r-1,a=t.getLineMaxColumn(r));let c=Ne._findPreviousWordOnLine(e,t,new l.Position(r,a));if(n===0)return new l.Position(r,c?c.start+1:1);if(n===1)return!s&&c&&c.wordType===2&&c.end-c.start===1&&c.nextCharClass===0&&(c=Ne._findPreviousWordOnLine(e,t,new l.Position(r,c.start+1))),new l.Position(r,c?c.start+1:1);if(n===3){for(;c&&c.wordType===2;)c=Ne._findPreviousWordOnLine(e,t,new l.Position(r,c.start+1));return new l.Position(r,c?c.start+1:1)}return c&&a<=c.end+1&&(c=Ne._findPreviousWordOnLine(e,t,new l.Position(r,c.start+1))),new l.Position(r,c?c.end+1:1)}static _moveWordPartLeft(e,t){const i=t.lineNumber,n=e.getLineMaxColumn(i);if(t.column===1)return i>1?new l.Position(i-1,e.getLineMaxColumn(i-1)):t;const s=e.getLineContent(i);for(let r=t.column-1;r>1;r--){const a=s.charCodeAt(r-2),c=s.charCodeAt(r-1);if(a===95&&c!==95)return new l.Position(i,r);if(a===45&&c!==45)return new l.Position(i,r);if((l.isLowerAsciiLetter(a)||l.isAsciiDigit(a))&&l.isUpperAsciiLetter(c))return new l.Position(i,r);if(l.isUpperAsciiLetter(a)&&l.isUpperAsciiLetter(c)&&r+1<n){const h=s.charCodeAt(r);if(l.isLowerAsciiLetter(h)||l.isAsciiDigit(h))return new l.Position(i,r)}}return new l.Position(i,1)}static moveWordRight(e,t,i,n){let s=i.lineNumber,r=i.column,a=!1;r===t.getLineMaxColumn(s)&&s<t.getLineCount()&&(a=!0,s=s+1,r=1);let c=Ne._findNextWordOnLine(e,t,new l.Position(s,r));if(n===2)c&&c.wordType===2&&c.end-c.start===1&&c.nextCharClass===0&&(c=Ne._findNextWordOnLine(e,t,new l.Position(s,c.end+1))),c?r=c.end+1:r=t.getLineMaxColumn(s);else if(n===3){for(a&&(r=0);c&&(c.wordType===2||c.start+1<=r);)c=Ne._findNextWordOnLine(e,t,new l.Position(s,c.end+1));c?r=c.start+1:r=t.getLineMaxColumn(s)}else c&&!a&&r>=c.start+1&&(c=Ne._findNextWordOnLine(e,t,new l.Position(s,c.end+1))),c?r=c.start+1:r=t.getLineMaxColumn(s);return new l.Position(s,r)}static _moveWordPartRight(e,t){const i=t.lineNumber,n=e.getLineMaxColumn(i);if(t.column===n)return i<e.getLineCount()?new l.Position(i+1,1):t;const s=e.getLineContent(i);for(let r=t.column+1;r<n;r++){const a=s.charCodeAt(r-2),c=s.charCodeAt(r-1);if(a!==95&&c===95)return new l.Position(i,r);if(a!==45&&c===45)return new l.Position(i,r);if((l.isLowerAsciiLetter(a)||l.isAsciiDigit(a))&&l.isUpperAsciiLetter(c))return new l.Position(i,r);if(l.isUpperAsciiLetter(a)&&l.isUpperAsciiLetter(c)&&r+1<n){const h=s.charCodeAt(r);if(l.isLowerAsciiLetter(h)||l.isAsciiDigit(h))return new l.Position(i,r)}}return new l.Position(i,n)}static _deleteWordLeftWhitespace(e,t){const i=e.getLineContent(t.lineNumber),n=t.column-2,s=l.lastNonWhitespaceIndex(i,n);return s+1<n?new l.Range(t.lineNumber,s+2,t.lineNumber,t.column):null}static deleteWordLeft(e,t){const i=e.wordSeparators,n=e.model,s=e.selection,r=e.whitespaceHeuristics;if(!s.isEmpty())return s;if(va.isAutoClosingPairDelete(e.autoClosingDelete,e.autoClosingBrackets,e.autoClosingQuotes,e.autoClosingPairs.autoClosingPairsOpenByEnd,e.model,[e.selection],e.autoClosedCharacters)){const u=e.selection.getPosition();return new l.Range(u.lineNumber,u.column-1,u.lineNumber,u.column+1)}const a=new l.Position(s.positionLineNumber,s.positionColumn);let c=a.lineNumber,h=a.column;if(c===1&&h===1)return null;if(r){const u=this._deleteWordLeftWhitespace(n,a);if(u)return u}let d=Ne._findPreviousWordOnLine(i,n,a);return t===0?d?h=d.start+1:h>1?h=1:(c--,h=n.getLineMaxColumn(c)):(d&&h<=d.end+1&&(d=Ne._findPreviousWordOnLine(i,n,new l.Position(c,d.start+1))),d?h=d.end+1:h>1?h=1:(c--,h=n.getLineMaxColumn(c))),new l.Range(c,h,a.lineNumber,a.column)}static deleteInsideWord(e,t,i,n=!1){if(!i.isEmpty())return i;const s=new l.Position(i.positionLineNumber,i.positionColumn),r=this._deleteInsideWordWhitespace(t,s);return r||this._deleteInsideWordDetermineDeleteRange(e,t,s,n)}static _charAtIsWhitespace(e,t){const i=e.charCodeAt(t);return i===32||i===9}static _deleteInsideWordWhitespace(e,t){const i=e.getLineContent(t.lineNumber),n=i.length;if(n===0)return null;let s=Math.max(t.column-2,0);if(!this._charAtIsWhitespace(i,s))return null;let r=Math.min(t.column-1,n-1);if(!this._charAtIsWhitespace(i,r))return null;for(;s>0&&this._charAtIsWhitespace(i,s-1);)s--;for(;r+1<n&&this._charAtIsWhitespace(i,r+1);)r++;return new l.Range(t.lineNumber,s+1,t.lineNumber,r+2)}static _deleteInsideWordDetermineDeleteRange(e,t,i,n){const s=t.getLineContent(i.lineNumber),r=s.length;if(r===0)return i.lineNumber>1?new l.Range(i.lineNumber-1,t.getLineMaxColumn(i.lineNumber-1),i.lineNumber,1):i.lineNumber<t.getLineCount()?new l.Range(i.lineNumber,1,i.lineNumber+1,1):new l.Range(i.lineNumber,1,i.lineNumber,1);const a=f=>f.start+1<=i.column&&i.column<=f.end+1,c=(f,g)=>(f=Math.min(f,i.column),g=Math.max(g,i.column),new l.Range(i.lineNumber,f,i.lineNumber,g)),h=f=>{let g=f.start+1,m=f.end+1;if(n)return c(g,m);let p=!1;for(;m-1<r&&this._charAtIsWhitespace(s,m-1);)p=!0,m++;if(!p)for(;g>1&&this._charAtIsWhitespace(s,g-2);)g--;return c(g,m)},d=Ne._findPreviousWordOnLine(e,t,i);if(d&&a(d))return h(d);const u=Ne._findNextWordOnLine(e,t,i);return u&&a(u)?h(u):d&&u?c(d.end+1,u.start+1):d?c(d.start+1,d.end+1):u?c(u.start+1,u.end+1):c(1,r+1)}static _deleteWordPartLeft(e,t){if(!t.isEmpty())return t;const i=t.getPosition(),n=Ne._moveWordPartLeft(e,i);return new l.Range(i.lineNumber,i.column,n.lineNumber,n.column)}static _findFirstNonWhitespaceChar(e,t){const i=e.length;for(let n=t;n<i;n++){const s=e.charAt(n);if(s!==" "&&s!==" ")return n}return i}static _deleteWordRightWhitespace(e,t){const i=e.getLineContent(t.lineNumber),n=t.column-1,s=this._findFirstNonWhitespaceChar(i,n);return n+1<s?new l.Range(t.lineNumber,t.column,t.lineNumber,s+1):null}static deleteWordRight(e,t){const i=e.wordSeparators,n=e.model,s=e.selection,r=e.whitespaceHeuristics;if(!s.isEmpty())return s;const a=new l.Position(s.positionLineNumber,s.positionColumn);let c=a.lineNumber,h=a.column;const d=n.getLineCount(),u=n.getLineMaxColumn(c);if(c===d&&h===u)return null;if(r){const g=this._deleteWordRightWhitespace(n,a);if(g)return g}let f=Ne._findNextWordOnLine(i,n,a);return t===2?f?h=f.end+1:h<u||c===d?h=u:(c++,f=Ne._findNextWordOnLine(i,n,new l.Position(c,1)),f?h=f.start+1:h=n.getLineMaxColumn(c)):(f&&h>=f.start+1&&(f=Ne._findNextWordOnLine(i,n,new l.Position(c,f.end+1))),f?h=f.start+1:h<u||c===d?h=u:(c++,f=Ne._findNextWordOnLine(i,n,new l.Position(c,1)),f?h=f.start+1:h=n.getLineMaxColumn(c))),new l.Range(c,h,a.lineNumber,a.column)}static _deleteWordPartRight(e,t){if(!t.isEmpty())return t;const i=t.getPosition(),n=Ne._moveWordPartRight(e,i);return new l.Range(i.lineNumber,i.column,n.lineNumber,n.column)}static _createWordAtPosition(e,t,i){const n=new l.Range(t,i.start+1,t,i.end+1);return{word:e.getValueInRange(n),startColumn:n.startColumn,endColumn:n.endColumn}}static getWordAtPosition(e,t,i,n){const s=l.getMapForWordSeparators(t,i),r=Ne._findPreviousWordOnLine(s,e,n);if(r&&r.wordType===1&&r.start<=n.column-1&&n.column-1<=r.end)return Ne._createWordAtPosition(e,n.lineNumber,r);const a=Ne._findNextWordOnLine(s,e,n);return a&&a.wordType===1&&a.start<=n.column-1&&n.column-1<=a.end?Ne._createWordAtPosition(e,n.lineNumber,a):null}static word(e,t,i,n,s){const r=l.getMapForWordSeparators(e.wordSeparators,e.wordSegmenterLocales),a=Ne._findPreviousWordOnLine(r,t,s),c=Ne._findNextWordOnLine(r,t,s);if(!n){let g,m;return a&&a.wordType===1&&a.start<=s.column-1&&s.column-1<=a.end||a&&a.wordType===2&&a.start<=s.column-1&&s.column-1<a.end?(g=a.start+1,m=a.end+1):c&&c.wordType===1&&c.start<=s.column-1&&s.column-1<=c.end||c&&c.wordType===2&&c.start<=s.column-1&&s.column-1<c.end?(g=c.start+1,m=c.end+1):(a?g=a.end+1:g=1,c?m=c.start+1:m=t.getLineMaxColumn(s.lineNumber)),new Pt(new l.Range(s.lineNumber,g,s.lineNumber,m),1,0,new l.Position(s.lineNumber,m),0)}let h,d;a&&a.wordType===1&&a.start<s.column-1&&s.column-1<a.end?(h=a.start+1,d=a.end+1):c&&c.wordType===1&&c.start<s.column-1&&s.column-1<c.end?(h=c.start+1,d=c.end+1):(h=s.column,d=s.column);const u=s.lineNumber;let f;if(i.selectionStart.containsPosition(s))f=i.selectionStart.endColumn;else if(s.isBeforeOrEqual(i.selectionStart.getStartPosition())){f=h;const g=new l.Position(u,f);i.selectionStart.containsPosition(g)&&(f=i.selectionStart.endColumn)}else{f=d;const g=new l.Position(u,f);i.selectionStart.containsPosition(g)&&(f=i.selectionStart.startColumn)}return i.move(!0,u,f,0)}}class aU extends Ne{static deleteWordPartLeft(e){const t=om([Ne.deleteWordLeft(e,0),Ne.deleteWordLeft(e,2),Ne._deleteWordPartLeft(e.model,e.selection)]);return t.sort(l.Range.compareRangesUsingEnds),t[2]}static deleteWordPartRight(e){const t=om([Ne.deleteWordRight(e,0),Ne.deleteWordRight(e,2),Ne._deleteWordPartRight(e.model,e.selection)]);return t.sort(l.Range.compareRangesUsingStarts),t[0]}static moveWordPartLeft(e,t,i,n){const s=om([Ne.moveWordLeft(e,t,i,0,n),Ne.moveWordLeft(e,t,i,2,n),Ne._moveWordPartLeft(t,i)]);return s.sort(l.Position.compare),s[2]}static moveWordPartRight(e,t,i){const n=om([Ne.moveWordRight(e,t,i,0),Ne.moveWordRight(e,t,i,2),Ne._moveWordPartRight(t,i)]);return n.sort(l.Position.compare),n[0]}}function om(o){return o.filter(e=>!!e)}class Dt{static addCursorDown(e,t,i){const n=[];let s=0;for(let r=0,a=t.length;r<a;r++){const c=t[r];n[s++]=new ge(c.modelState,c.viewState),i?n[s++]=ge.fromModelState(ye.translateDown(e.cursorConfig,e.model,c.modelState)):n[s++]=ge.fromViewState(ye.translateDown(e.cursorConfig,e,c.viewState))}return n}static addCursorUp(e,t,i){const n=[];let s=0;for(let r=0,a=t.length;r<a;r++){const c=t[r];n[s++]=new ge(c.modelState,c.viewState),i?n[s++]=ge.fromModelState(ye.translateUp(e.cursorConfig,e.model,c.modelState)):n[s++]=ge.fromViewState(ye.translateUp(e.cursorConfig,e,c.viewState))}return n}static moveToBeginningOfLine(e,t,i){const n=[];for(let s=0,r=t.length;s<r;s++){const a=t[s];n[s]=this._moveToLineStart(e,a,i)}return n}static _moveToLineStart(e,t,i){const n=t.viewState.position.column,s=t.modelState.position.column,r=n===s,a=t.viewState.position.lineNumber,c=e.getLineFirstNonWhitespaceColumn(a);return!r&&!(n===c)?this._moveToLineStartByView(e,t,i):this._moveToLineStartByModel(e,t,i)}static _moveToLineStartByView(e,t,i){return ge.fromViewState(ye.moveToBeginningOfLine(e.cursorConfig,e,t.viewState,i))}static _moveToLineStartByModel(e,t,i){return ge.fromModelState(ye.moveToBeginningOfLine(e.cursorConfig,e.model,t.modelState,i))}static moveToEndOfLine(e,t,i,n){const s=[];for(let r=0,a=t.length;r<a;r++){const c=t[r];s[r]=this._moveToLineEnd(e,c,i,n)}return s}static _moveToLineEnd(e,t,i,n){const s=t.viewState.position,r=e.getLineMaxColumn(s.lineNumber),a=s.column===r,c=t.modelState.position,h=e.model.getLineMaxColumn(c.lineNumber),d=r-s.column===h-c.column;return a||d?this._moveToLineEndByModel(e,t,i,n):this._moveToLineEndByView(e,t,i,n)}static _moveToLineEndByView(e,t,i,n){return ge.fromViewState(ye.moveToEndOfLine(e.cursorConfig,e,t.viewState,i,n))}static _moveToLineEndByModel(e,t,i,n){return ge.fromModelState(ye.moveToEndOfLine(e.cursorConfig,e.model,t.modelState,i,n))}static expandLineSelection(e,t){const i=[];for(let n=0,s=t.length;n<s;n++){const r=t[n],a=r.modelState.selection.startLineNumber,c=e.model.getLineCount();let h=r.modelState.selection.endLineNumber,d;h===c?d=e.model.getLineMaxColumn(c):(h++,d=1),i[n]=ge.fromModelState(new Pt(new l.Range(a,1,a,1),0,0,new l.Position(h,d),0))}return i}static moveToBeginningOfBuffer(e,t,i){const n=[];for(let s=0,r=t.length;s<r;s++){const a=t[s];n[s]=ge.fromModelState(ye.moveToBeginningOfBuffer(e.cursorConfig,e.model,a.modelState,i))}return n}static moveToEndOfBuffer(e,t,i){const n=[];for(let s=0,r=t.length;s<r;s++){const a=t[s];n[s]=ge.fromModelState(ye.moveToEndOfBuffer(e.cursorConfig,e.model,a.modelState,i))}return n}static selectAll(e,t){const i=e.model.getLineCount(),n=e.model.getLineMaxColumn(i);return ge.fromModelState(new Pt(new l.Range(1,1,1,1),0,0,new l.Position(i,n),0))}static line(e,t,i,n,s){const r=e.model.validatePosition(n),a=s?e.coordinatesConverter.validateViewPosition(new l.Position(s.lineNumber,s.column),r):e.coordinatesConverter.convertModelPositionToViewPosition(r);if(!i){const h=e.model.getLineCount();let d=r.lineNumber+1,u=1;return d>h&&(d=h,u=e.model.getLineMaxColumn(d)),ge.fromModelState(new Pt(new l.Range(r.lineNumber,1,d,u),2,0,new l.Position(d,u),0))}const c=t.modelState.selectionStart.getStartPosition().lineNumber;if(r.lineNumber<c)return ge.fromViewState(t.viewState.move(!0,a.lineNumber,1,0));if(r.lineNumber>c){const h=e.getLineCount();let d=a.lineNumber+1,u=1;return d>h&&(d=h,u=e.getLineMaxColumn(d)),ge.fromViewState(t.viewState.move(!0,d,u,0))}else{const h=t.modelState.selectionStart.getEndPosition();return ge.fromModelState(t.modelState.move(!0,h.lineNumber,h.column,0))}}static word(e,t,i,n){const s=e.model.validatePosition(n);return ge.fromModelState(Ne.word(e.cursorConfig,e.model,t.modelState,i,s))}static cancelSelection(e,t){if(!t.modelState.hasSelection())return new ge(t.modelState,t.viewState);const i=t.viewState.position.lineNumber,n=t.viewState.position.column;return ge.fromViewState(new Pt(new l.Range(i,n,i,n),0,0,new l.Position(i,n),0))}static moveTo(e,t,i,n,s){if(i){if(t.modelState.selectionStartKind===1)return this.word(e,t,i,n);if(t.modelState.selectionStartKind===2)return this.line(e,t,i,n,s)}const r=e.model.validatePosition(n),a=s?e.coordinatesConverter.validateViewPosition(new l.Position(s.lineNumber,s.column),r):e.coordinatesConverter.convertModelPositionToViewPosition(r);return ge.fromViewState(t.viewState.move(i,a.lineNumber,a.column,0))}static simpleMove(e,t,i,n,s,r){switch(i){case 0:return r===4?this._moveHalfLineLeft(e,t,n):this._moveLeft(e,t,n,s);case 1:return r===4?this._moveHalfLineRight(e,t,n):this._moveRight(e,t,n,s);case 2:return r===2?this._moveUpByViewLines(e,t,n,s):r===5?this._moveUpByFoldedLines(e,t,n,s):this._moveUpByModelLines(e,t,n,s);case 3:return r===2?this._moveDownByViewLines(e,t,n,s):r===5?this._moveDownByFoldedLines(e,t,n,s):this._moveDownByModelLines(e,t,n,s);case 4:return r===2?t.map(a=>ge.fromViewState(ye.moveToPrevBlankLine(e.cursorConfig,e,a.viewState,n))):t.map(a=>ge.fromModelState(ye.moveToPrevBlankLine(e.cursorConfig,e.model,a.modelState,n)));case 5:return r===2?t.map(a=>ge.fromViewState(ye.moveToNextBlankLine(e.cursorConfig,e,a.viewState,n))):t.map(a=>ge.fromModelState(ye.moveToNextBlankLine(e.cursorConfig,e.model,a.modelState,n)));case 6:return this._moveToViewMinColumn(e,t,n);case 7:return this._moveToViewFirstNonWhitespaceColumn(e,t,n);case 8:return this._moveToViewCenterColumn(e,t,n);case 9:return this._moveToViewMaxColumn(e,t,n);case 10:return this._moveToViewLastNonWhitespaceColumn(e,t,n);default:return null}}static viewportMove(e,t,i,n,s){const r=e.getCompletelyVisibleViewRange(),a=e.coordinatesConverter.convertViewRangeToModelRange(r);switch(i){case 11:{const c=this._firstLineNumberInRange(e.model,a,s),h=e.model.getLineFirstNonWhitespaceColumn(c);return[this._moveToModelPosition(e,t[0],n,c,h)]}case 13:{const c=this._lastLineNumberInRange(e.model,a,s),h=e.model.getLineFirstNonWhitespaceColumn(c);return[this._moveToModelPosition(e,t[0],n,c,h)]}case 12:{const c=Math.round((a.startLineNumber+a.endLineNumber)/2),h=e.model.getLineFirstNonWhitespaceColumn(c);return[this._moveToModelPosition(e,t[0],n,c,h)]}case 14:{const c=[];for(let h=0,d=t.length;h<d;h++){const u=t[h];c[h]=this.findPositionInViewportIfOutside(e,u,r,n)}return c}default:return null}}static findPositionInViewportIfOutside(e,t,i,n){const s=t.viewState.position.lineNumber;if(i.startLineNumber<=s&&s<=i.endLineNumber-1)return new ge(t.modelState,t.viewState);{let r;s>i.endLineNumber-1?r=i.endLineNumber-1:s<i.startLineNumber?r=i.startLineNumber:r=s;const a=ye.vertical(e.cursorConfig,e,s,t.viewState.position.column,t.viewState.leftoverVisibleColumns,r,!1);return ge.fromViewState(t.viewState.move(n,a.lineNumber,a.column,a.leftoverVisibleColumns))}}static _firstLineNumberInRange(e,t,i){let n=t.startLineNumber;return t.startColumn!==e.getLineMinColumn(n)&&n++,Math.min(t.endLineNumber,n+i-1)}static _lastLineNumberInRange(e,t,i){let n=t.startLineNumber;return t.startColumn!==e.getLineMinColumn(n)&&n++,Math.max(n,t.endLineNumber-i+1)}static _moveLeft(e,t,i,n){return t.map(s=>{const a=e.getTextDirection(s.viewState.position.lineNumber)===l.TextDirection.RTL;return ge.fromViewState(a?ye.moveRight(e.cursorConfig,e,s.viewState,i,n):ye.moveLeft(e.cursorConfig,e,s.viewState,i,n))})}static _moveHalfLineLeft(e,t,i){const n=[];for(let s=0,r=t.length;s<r;s++){const a=t[s],c=a.viewState.position.lineNumber,h=Math.round(e.getLineLength(c)/2);n[s]=ge.fromViewState(ye.moveLeft(e.cursorConfig,e,a.viewState,i,h))}return n}static _moveRight(e,t,i,n){return t.map(s=>{const a=e.getTextDirection(s.viewState.position.lineNumber)===l.TextDirection.RTL;return ge.fromViewState(a?ye.moveLeft(e.cursorConfig,e,s.viewState,i,n):ye.moveRight(e.cursorConfig,e,s.viewState,i,n))})}static _moveHalfLineRight(e,t,i){const n=[];for(let s=0,r=t.length;s<r;s++){const a=t[s],c=a.viewState.position.lineNumber,h=Math.round(e.getLineLength(c)/2);n[s]=ge.fromViewState(ye.moveRight(e.cursorConfig,e,a.viewState,i,h))}return n}static _moveDownByViewLines(e,t,i,n){const s=[];for(let r=0,a=t.length;r<a;r++){const c=t[r];s[r]=ge.fromViewState(ye.moveDown(e.cursorConfig,e,c.viewState,i,n))}return s}static _moveDownByModelLines(e,t,i,n){const s=[];for(let r=0,a=t.length;r<a;r++){const c=t[r];s[r]=ge.fromModelState(ye.moveDown(e.cursorConfig,e.model,c.modelState,i,n))}return s}static _moveUpByViewLines(e,t,i,n){const s=[];for(let r=0,a=t.length;r<a;r++){const c=t[r];s[r]=ge.fromViewState(ye.moveUp(e.cursorConfig,e,c.viewState,i,n))}return s}static _moveUpByModelLines(e,t,i,n){const s=[];for(let r=0,a=t.length;r<a;r++){const c=t[r];s[r]=ge.fromModelState(ye.moveUp(e.cursorConfig,e.model,c.modelState,i,n))}return s}static _moveDownByFoldedLines(e,t,i,n){const s=e.model,r=s.getLineCount(),a=e.getHiddenAreas();return t.map(c=>{const h=c.modelState.hasSelection()&&!i?c.modelState.selection.endLineNumber:c.modelState.position.lineNumber,u=Dt._targetFoldedDown(h,n,a,r)-h;return u===0?ge.fromModelState(c.modelState):ge.fromModelState(ye.moveDown(e.cursorConfig,s,c.modelState,i,u))})}static _moveUpByFoldedLines(e,t,i,n){const s=e.model,r=e.getHiddenAreas();return t.map(a=>{const c=a.modelState.hasSelection()&&!i?a.modelState.selection.startLineNumber:a.modelState.position.lineNumber,h=Dt._targetFoldedUp(c,n,r),d=c-h;return d===0?ge.fromModelState(a.modelState):ge.fromModelState(ye.moveUp(e.cursorConfig,s,a.modelState,i,d))})}static _targetFoldedDown(e,t,i,n){let s=e,r=0;for(;r<i.length&&i[r].endLineNumber<s+1;)r++;for(let a=0;a<t;a++){if(s>=n)return n;let c=s+1;for(;r<i.length&&i[r].endLineNumber<c;)r++;if(r<i.length&&i[r].startLineNumber<=c&&(c=i[r].endLineNumber+1),c>n)return s;s=c}return s}static _targetFoldedUp(e,t,i){let n=e,s=i.length-1;for(;s>=0&&i[s].startLineNumber>n-1;)s--;for(let r=0;r<t;r++){if(n<=1)return 1;let a=n-1;for(;s>=0&&i[s].startLineNumber>a;)s--;if(s>=0&&i[s].endLineNumber>=a&&(a=i[s].startLineNumber-1),a<1)return n;n=a}return n}static _moveToViewPosition(e,t,i,n,s){return ge.fromViewState(t.viewState.move(i,n,s,0))}static _moveToModelPosition(e,t,i,n,s){return ge.fromModelState(t.modelState.move(i,n,s,0))}static _moveToViewMinColumn(e,t,i){const n=[];for(let s=0,r=t.length;s<r;s++){const a=t[s],c=a.viewState.position.lineNumber,h=e.getLineMinColumn(c);n[s]=this._moveToViewPosition(e,a,i,c,h)}return n}static _moveToViewFirstNonWhitespaceColumn(e,t,i){const n=[];for(let s=0,r=t.length;s<r;s++){const a=t[s],c=a.viewState.position.lineNumber,h=e.getLineFirstNonWhitespaceColumn(c);n[s]=this._moveToViewPosition(e,a,i,c,h)}return n}static _moveToViewCenterColumn(e,t,i){const n=[];for(let s=0,r=t.length;s<r;s++){const a=t[s],c=a.viewState.position.lineNumber,h=Math.round((e.getLineMaxColumn(c)+e.getLineMinColumn(c))/2);n[s]=this._moveToViewPosition(e,a,i,c,h)}return n}static _moveToViewMaxColumn(e,t,i){const n=[];for(let s=0,r=t.length;s<r;s++){const a=t[s],c=a.viewState.position.lineNumber,h=e.getLineMaxColumn(c);n[s]=this._moveToViewPosition(e,a,i,c,h)}return n}static _moveToViewLastNonWhitespaceColumn(e,t,i){const n=[];for(let s=0,r=t.length;s<r;s++){const a=t[s],c=a.viewState.position.lineNumber,h=e.getLineLastNonWhitespaceColumn(c);n[s]=this._moveToViewPosition(e,a,i,c,h)}return n}}var rm;(function(o){const e=function(i){if(!l.isObject(i))return!1;const n=i;return!(!l.isString(n.to)||!l.isUndefined(n.select)&&!l.isBoolean(n.select)||!l.isUndefined(n.by)&&!l.isString(n.by)||!l.isUndefined(n.value)&&!l.isNumber(n.value)||!l.isUndefined(n.noHistory)&&!l.isBoolean(n.noHistory))};o.metadata={description:"Move cursor to a logical position in the view",args:[{name:"Cursor move argument object",description:`Property-value pairs that can be passed through this argument:
|
||
* 'to': A mandatory logical position value providing where to move the cursor.
|
||
\`\`\`
|
||
'left', 'right', 'up', 'down', 'prevBlankLine', 'nextBlankLine',
|
||
'wrappedLineStart', 'wrappedLineEnd', 'wrappedLineColumnCenter'
|
||
'wrappedLineFirstNonWhitespaceCharacter', 'wrappedLineLastNonWhitespaceCharacter'
|
||
'viewPortTop', 'viewPortCenter', 'viewPortBottom', 'viewPortIfOutside'
|
||
\`\`\`
|
||
* 'by': Unit to move. Default is computed based on 'to' value.
|
||
\`\`\`
|
||
'line', 'wrappedLine', 'character', 'halfLine', 'foldedLine'
|
||
\`\`\`
|
||
Use 'foldedLine' with 'up'/'down' to move by logical lines while treating each
|
||
folded region as a single step.
|
||
* 'value': Number of units to move. Default is '1'.
|
||
* 'select': If 'true' makes the selection. Default is 'false'.
|
||
* 'noHistory': If 'true' does not add the movement to navigation history. Default is 'false'.
|
||
`,constraint:e,schema:{type:"object",required:["to"],properties:{to:{type:"string",enum:["left","right","up","down","prevBlankLine","nextBlankLine","wrappedLineStart","wrappedLineEnd","wrappedLineColumnCenter","wrappedLineFirstNonWhitespaceCharacter","wrappedLineLastNonWhitespaceCharacter","viewPortTop","viewPortCenter","viewPortBottom","viewPortIfOutside"]},by:{type:"string",enum:["line","wrappedLine","character","halfLine","foldedLine"]},value:{type:"number",default:1},select:{type:"boolean",default:!1},noHistory:{type:"boolean",default:!1}}}}]},o.RawDirection={Left:"left",Right:"right",Up:"up",Down:"down",PrevBlankLine:"prevBlankLine",NextBlankLine:"nextBlankLine",WrappedLineStart:"wrappedLineStart",WrappedLineFirstNonWhitespaceCharacter:"wrappedLineFirstNonWhitespaceCharacter",WrappedLineColumnCenter:"wrappedLineColumnCenter",WrappedLineEnd:"wrappedLineEnd",WrappedLineLastNonWhitespaceCharacter:"wrappedLineLastNonWhitespaceCharacter",ViewPortTop:"viewPortTop",ViewPortCenter:"viewPortCenter",ViewPortBottom:"viewPortBottom",ViewPortIfOutside:"viewPortIfOutside"},o.RawUnit={Line:"line",WrappedLine:"wrappedLine",Character:"character",HalfLine:"halfLine",FoldedLine:"foldedLine"};function t(i){if(!i.to)return null;let n;switch(i.to){case o.RawDirection.Left:n=0;break;case o.RawDirection.Right:n=1;break;case o.RawDirection.Up:n=2;break;case o.RawDirection.Down:n=3;break;case o.RawDirection.PrevBlankLine:n=4;break;case o.RawDirection.NextBlankLine:n=5;break;case o.RawDirection.WrappedLineStart:n=6;break;case o.RawDirection.WrappedLineFirstNonWhitespaceCharacter:n=7;break;case o.RawDirection.WrappedLineColumnCenter:n=8;break;case o.RawDirection.WrappedLineEnd:n=9;break;case o.RawDirection.WrappedLineLastNonWhitespaceCharacter:n=10;break;case o.RawDirection.ViewPortTop:n=11;break;case o.RawDirection.ViewPortBottom:n=13;break;case o.RawDirection.ViewPortCenter:n=12;break;case o.RawDirection.ViewPortIfOutside:n=14;break;default:return null}let s=0;switch(i.by){case o.RawUnit.Line:s=1;break;case o.RawUnit.WrappedLine:s=2;break;case o.RawUnit.Character:s=3;break;case o.RawUnit.HalfLine:s=4;break;case o.RawUnit.FoldedLine:s=5;break}return{direction:n,unit:s,select:!!i.select,value:i.value||1,noHistory:!!i.noHistory}}o.parse=t})(rm||(rm={}));class Tv{constructor(e,t,i){this._indentRulesSupport=t,this._indentationLineProcessor=new II(e,i)}shouldIncrease(e,t){const i=this._indentationLineProcessor.getProcessedLine(e,t);return this._indentRulesSupport.shouldIncrease(i)}shouldDecrease(e,t){const i=this._indentationLineProcessor.getProcessedLine(e,t);return this._indentRulesSupport.shouldDecrease(i)}shouldIgnore(e,t){const i=this._indentationLineProcessor.getProcessedLine(e,t);return this._indentRulesSupport.shouldIgnore(i)}shouldIndentNextLine(e,t){const i=this._indentationLineProcessor.getProcessedLine(e,t);return this._indentRulesSupport.shouldIndentNextLine(i)}}class Nv{constructor(e,t){this.model=e,this.indentationLineProcessor=new II(e,t)}getProcessedTokenContextAroundRange(e){const t=this._getProcessedTokensBeforeRange(e),i=this._getProcessedTokensAfterRange(e),n=this._getProcessedPreviousLineTokens(e);return{beforeRangeProcessedTokens:t,afterRangeProcessedTokens:i,previousLineProcessedTokens:n}}_getProcessedTokensBeforeRange(e){this.model.tokenization.forceTokenization(e.startLineNumber);const t=this.model.tokenization.getLineTokens(e.startLineNumber),i=oa(t,e.startColumn-1);let n;if(Rv(this.model,e.getStartPosition())){const r=e.startColumn-1-i.firstCharOffset,a=i.firstCharOffset,c=a+r;n=t.sliceAndInflate(a,c,0)}else{const r=e.startColumn-1;n=t.sliceAndInflate(0,r,0)}return this.indentationLineProcessor.getProcessedTokens(n)}_getProcessedTokensAfterRange(e){const t=e.isEmpty()?e.getStartPosition():e.getEndPosition();this.model.tokenization.forceTokenization(t.lineNumber);const i=this.model.tokenization.getLineTokens(t.lineNumber),n=oa(i,t.column-1),s=t.column-1-n.firstCharOffset,r=n.firstCharOffset+s,a=n.firstCharOffset+n.getLineLength(),c=i.sliceAndInflate(r,a,0);return this.indentationLineProcessor.getProcessedTokens(c)}_getProcessedPreviousLineTokens(e){const t=g=>{this.model.tokenization.forceTokenization(g);const m=this.model.tokenization.getLineTokens(g),p=this.model.getLineMaxColumn(g)-1;return oa(m,p)};this.model.tokenization.forceTokenization(e.startLineNumber);const i=this.model.tokenization.getLineTokens(e.startLineNumber),n=oa(i,e.startColumn-1),s=_t.createEmpty("",n.languageIdCodec),r=e.startLineNumber-1;if(r===0||!(n.firstCharOffset===0))return s;const h=t(r);if(!(n.languageId===h.languageId))return s;const u=h.toIViewLineTokens();return this.indentationLineProcessor.getProcessedTokens(u)}}class II{constructor(e,t){this.model=e,this.languageConfigurationService=t}getProcessedLine(e,t){const i=(r,a)=>{const c=l.getLeadingWhitespace(r);return a+r.substring(c.length)};this.model.tokenization.forceTokenization?.(e);const n=this.model.tokenization.getLineTokens(e);let s=this.getProcessedTokens(n).getLineContent();return t!==void 0&&(s=i(s,t)),s}getProcessedTokens(e){const t=c=>c===2||c===3||c===1,i=e.getLanguageId(0),s=this.languageConfigurationService.getLanguageConfiguration(i).bracketsNew.getBracketRegExp({global:!0}),r=[];return e.forEach(c=>{const h=e.getStandardTokenType(c);let d=e.getTokenText(c);t(h)&&(d=d.replace(s,""));const u=e.getMetadata(c);r.push({text:d,metadata:u})}),_t.createFromTextAndMetadata(r,e.languageIdCodec)}}function Rv(o,e){o.tokenization.forceTokenization(e.lineNumber);const t=o.tokenization.getLineTokens(e.lineNumber),i=oa(t,e.column-1),n=i.firstCharOffset===0,s=t.getLanguageId(0)===i.languageId;return!n&&!s}function am(o,e,t,i){e.tokenization.forceTokenization(t.startLineNumber);const n=e.getLanguageIdAtPosition(t.startLineNumber,t.startColumn),s=i.getLanguageConfiguration(n);if(!s)return null;const a=new Nv(e,i).getProcessedTokenContextAroundRange(t),c=a.previousLineProcessedTokens.getLineContent(),h=a.beforeRangeProcessedTokens.getLineContent(),d=a.afterRangeProcessedTokens.getLineContent(),u=s.onEnter(o,c,h,d);if(!u)return null;const f=u.indentAction;let g=u.appendText;const m=u.removeText||0;g?f===_.IndentAction.Indent&&(g=" "+g):f===_.IndentAction.Indent||f===_.IndentAction.IndentOutdent?g=" ":g="";let p=oE(e,t.startLineNumber,t.startColumn);return m&&(p=p.substring(0,p.length-m)),{indentAction:f,appendText:g,removeText:m,indentation:p}}var lU=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},cU=function(o,e){return function(t,i){e(t,i,o)}},lm;const Mv=Object.create(null);function wa(o,e){if(e<=0)return"";Mv[o]||(Mv[o]=["",o]);const t=Mv[o];for(let i=t.length;i<=e;i++)t[i]=t[i-1]+o;return t[e]}_.ShiftCommand=lm=class{static unshiftIndent(e,t,i,n,s){const r=Xe.visibleColumnFromColumn(e,t,i);if(s){const a=wa(" ",n),h=Xe.prevIndentTabStop(r,n)/n;return wa(a,h)}else{const h=Xe.prevRenderTabStop(r,i)/i;return wa(" ",h)}}static shiftIndent(e,t,i,n,s){const r=Xe.visibleColumnFromColumn(e,t,i);if(s){const a=wa(" ",n),h=Xe.nextIndentTabStop(r,n)/n;return wa(a,h)}else{const h=Xe.nextRenderTabStop(r,i)/i;return wa(" ",h)}}constructor(e,t,i){this._languageConfigurationService=i,this._opts=t,this._selection=e,this._selectionId=null,this._useLastEditRangeForCursorEndPosition=!1,this._selectionStartColumnStaysPut=!1}_addEditOperation(e,t,i){this._useLastEditRangeForCursorEndPosition?e.addTrackedEditOperation(t,i):e.addEditOperation(t,i)}getEditOperations(e,t){const i=this._selection.startLineNumber;let n=this._selection.endLineNumber;this._selection.endColumn===1&&i!==n&&(n=n-1);const{tabSize:s,indentSize:r,insertSpaces:a}=this._opts,c=i===n;if(this._opts.useTabStops){this._selection.isEmpty()&&/^\s*$/.test(e.getLineContent(i))&&(this._useLastEditRangeForCursorEndPosition=!0);let h=0,d=0;for(let u=i;u<=n;u++,h=d){d=0;const f=e.getLineContent(u);let g=l.firstNonWhitespaceIndex(f);if(this._opts.isUnshift&&(f.length===0||g===0)||!c&&!this._opts.isUnshift&&f.length===0)continue;if(g===-1&&(g=f.length),u>1&&Xe.visibleColumnFromColumn(f,g+1,s)%r!==0&&e.tokenization.isCheapToTokenize(u-1)){const b=am(this._opts.autoIndent,e,new l.Range(u-1,e.getLineMaxColumn(u-1),u-1,e.getLineMaxColumn(u-1)),this._languageConfigurationService);if(b){if(d=h,b.appendText)for(let v=0,C=b.appendText.length;v<C&&d<r&&b.appendText.charCodeAt(v)===32;v++)d++;b.removeText&&(d=Math.max(0,d-b.removeText));for(let v=0;v<d&&!(g===0||f.charCodeAt(g-1)!==32);v++)g--}}if(this._opts.isUnshift&&g===0)continue;let m;this._opts.isUnshift?m=lm.unshiftIndent(f,g+1,s,r,a):m=lm.shiftIndent(f,g+1,s,r,a),this._addEditOperation(t,new l.Range(u,1,u,g+1),m),u===i&&!this._selection.isEmpty()&&(this._selectionStartColumnStaysPut=this._selection.startColumn<=g+1)}}else{!this._opts.isUnshift&&this._selection.isEmpty()&&e.getLineLength(i)===0&&(this._useLastEditRangeForCursorEndPosition=!0);const h=a?wa(" ",r):" ";for(let d=i;d<=n;d++){const u=e.getLineContent(d);let f=l.firstNonWhitespaceIndex(u);if(!(this._opts.isUnshift&&(u.length===0||f===0))&&!(!c&&!this._opts.isUnshift&&u.length===0)&&(f===-1&&(f=u.length),!(this._opts.isUnshift&&f===0)))if(this._opts.isUnshift){f=Math.min(f,r);for(let g=0;g<f;g++)if(u.charCodeAt(g)===9){f=g+1;break}this._addEditOperation(t,new l.Range(d,1,d,f+1),"")}else this._addEditOperation(t,new l.Range(d,1,d,1),h),d===i&&!this._selection.isEmpty()&&(this._selectionStartColumnStaysPut=this._selection.startColumn===1)}}this._selectionId=t.trackSelection(this._selection)}computeCursorState(e,t){if(this._useLastEditRangeForCursorEndPosition){const n=t.getInverseEditOperations()[0];return new l.Selection(n.range.endLineNumber,n.range.endColumn,n.range.endLineNumber,n.range.endColumn)}const i=t.getTrackedSelection(this._selectionId);if(this._selectionStartColumnStaysPut){const n=this._selection.startColumn;return i.startColumn<=n?i:i.getDirection()===0?new l.Selection(i.startLineNumber,n,i.endLineNumber,i.endColumn):new l.Selection(i.endLineNumber,i.endColumn,i.startLineNumber,n)}return i}},_.ShiftCommand=lm=lU([cU(2,ms)],_.ShiftCommand);class hU{constructor(e,t,i){this._range=e,this._charBeforeSelection=t,this._charAfterSelection=i}getEditOperations(e,t){t.addTrackedEditOperation(new l.Range(this._range.startLineNumber,this._range.startColumn,this._range.startLineNumber,this._range.startColumn),this._charBeforeSelection),t.addTrackedEditOperation(new l.Range(this._range.endLineNumber,this._range.endColumn,this._range.endLineNumber,this._range.endColumn),this._charAfterSelection||null)}computeCursorState(e,t){const i=t.getInverseEditOperations(),n=i[0].range,s=i[1].range;return new l.Selection(n.endLineNumber,n.endColumn,s.endLineNumber,s.endColumn-this._charAfterSelection.length)}}class dU{constructor(e,t,i){this._position=e,this._text=t,this._charAfter=i}getEditOperations(e,t){t.addTrackedEditOperation(new l.Range(this._position.lineNumber,this._position.column,this._position.lineNumber,this._position.column),this._text+this._charAfter)}computeCursorState(e,t){const n=t.getInverseEditOperations()[0].range;return new l.Selection(n.endLineNumber,n.startColumn,n.endLineNumber,n.endColumn-this._charAfter.length)}}function uU(o,e,t){const i=o.tokenization.getLanguageIdAtPosition(e,0);if(e>1){let n,s=-1;for(n=e-1;n>=1;n--){if(o.tokenization.getLanguageIdAtPosition(n,0)!==i)return s;const r=o.getLineContent(n);if(t.shouldIgnore(n)||/^\s+$/.test(r)||r===""){s=n;continue}return n}}return-1}function Bd(o,e,t,i=!0,n){if(o<4)return null;const s=n.getLanguageConfiguration(e.tokenization.getLanguageId()).indentRulesSupport;if(!s)return null;const r=new Tv(e,s,n);if(t<=1)return{indentation:"",action:null};for(let c=t-1;c>0&&e.getLineContent(c)==="";c--)if(c===1)return{indentation:"",action:null};const a=uU(e,t,r);if(a<0)return null;if(a<1)return{indentation:"",action:null};if(r.shouldIncrease(a)||r.shouldIndentNextLine(a)){const c=e.getLineContent(a);return{indentation:l.getLeadingWhitespace(c),action:_.IndentAction.Indent,line:a}}else if(r.shouldDecrease(a)){const c=e.getLineContent(a);return{indentation:l.getLeadingWhitespace(c),action:null,line:a}}else{if(a===1)return{indentation:l.getLeadingWhitespace(e.getLineContent(a)),action:null,line:a};const c=a-1,h=s.getIndentMetadata(e.getLineContent(c));if(!(h&3)&&h&4){let d=0;for(let u=c-1;u>0;u--)if(!r.shouldIndentNextLine(u)){d=u;break}return{indentation:l.getLeadingWhitespace(e.getLineContent(d+1)),action:null,line:d+1}}if(i)return{indentation:l.getLeadingWhitespace(e.getLineContent(a)),action:null,line:a};for(let d=a;d>0;d--){if(r.shouldIncrease(d))return{indentation:l.getLeadingWhitespace(e.getLineContent(d)),action:_.IndentAction.Indent,line:d};if(r.shouldIndentNextLine(d)){let u=0;for(let f=d-1;f>0;f--)if(!r.shouldIndentNextLine(d)){u=f;break}return{indentation:l.getLeadingWhitespace(e.getLineContent(u+1)),action:null,line:u+1}}else if(r.shouldDecrease(d))return{indentation:l.getLeadingWhitespace(e.getLineContent(d)),action:null,line:d}}return{indentation:l.getLeadingWhitespace(e.getLineContent(1)),action:null,line:1}}}function fU(o,e,t,i,n,s){if(o<4)return null;const r=s.getLanguageConfiguration(t);if(!r)return null;const a=s.getLanguageConfiguration(t).indentRulesSupport;if(!a)return null;const c=new Tv(e,a,s),h=Bd(o,e,i,void 0,s);if(h){const d=h.line;if(d!==void 0){let u=!0;for(let f=d;f<i-1;f++)if(!/^\s*$/.test(e.getLineContent(f))){u=!1;break}if(u){const f=r.onEnter(o,"",e.getLineContent(d),"");if(f){let g=l.getLeadingWhitespace(e.getLineContent(d));return f.removeText&&(g=g.substring(0,g.length-f.removeText)),f.indentAction===_.IndentAction.Indent||f.indentAction===_.IndentAction.IndentOutdent?g=n.shiftIndent(g):f.indentAction===_.IndentAction.Outdent&&(g=n.unshiftIndent(g)),c.shouldDecrease(i)&&(g=n.unshiftIndent(g)),f.appendText&&(g+=f.appendText),l.getLeadingWhitespace(g)}}}return c.shouldDecrease(i)?h.action===_.IndentAction.Indent?h.indentation:n.unshiftIndent(h.indentation):h.action===_.IndentAction.Indent?n.shiftIndent(h.indentation):h.indentation}return null}function gU(o,e,t,i,n){if(o<4)return null;const s=e.getLanguageIdAtPosition(t.startLineNumber,t.startColumn),r=n.getLanguageConfiguration(s).indentRulesSupport;if(!r)return null;e.tokenization.forceTokenization(t.startLineNumber);const c=new Nv(e,n).getProcessedTokenContextAroundRange(t),h=c.afterRangeProcessedTokens,d=c.beforeRangeProcessedTokens,u=l.getLeadingWhitespace(d.getLineContent()),f=_U(e,t.startLineNumber,d),g=Rv(e,t.getStartPosition()),m=e.getLineContent(t.startLineNumber),p=l.getLeadingWhitespace(m),b=Bd(o,f,t.startLineNumber+1,void 0,n);if(!b){const C=g?p:u;return{beforeEnter:C,afterEnter:C}}let v=g?p:b.indentation;return b.action===_.IndentAction.Indent&&(v=i.shiftIndent(v)),r.shouldDecrease(h.getLineContent())&&(v=i.unshiftIndent(v)),{beforeEnter:g?p:u,afterEnter:v}}function mU(o,e,t,i,n,s){const r=o.autoIndent;if(r<4||Rv(e,t.getStartPosition()))return null;const c=e.getLanguageIdAtPosition(t.startLineNumber,t.startColumn),h=s.getLanguageConfiguration(c).indentRulesSupport;if(!h)return null;const u=new Nv(e,s).getProcessedTokenContextAroundRange(t),f=u.beforeRangeProcessedTokens.getLineContent(),g=u.afterRangeProcessedTokens.getLineContent(),m=f+g,p=f+i+g;if(!h.shouldDecrease(m)&&h.shouldDecrease(p)){const v=Bd(r,e,t.startLineNumber,!1,s);if(!v)return null;let C=v.indentation;return v.action!==_.IndentAction.Indent&&(C=n.unshiftIndent(C)),C}const b=t.startLineNumber-1;if(b>0){const v=e.getLineContent(b);if(h.shouldIndentNextLine(v)&&h.shouldIncrease(p)){const w=Bd(r,e,t.startLineNumber,!1,s)?.indentation;if(w!==void 0){const S=e.getLineContent(t.startLineNumber),L=l.getLeadingWhitespace(S),x=n.shiftIndent(w)===L,I=/^\s*$/.test(m),T=o.autoClosingPairs.autoClosingPairsOpenByEnd.get(i),O=T&&T.length>0&&I;if(x&&O)return w}}}return null}function pU(o,e,t){const i=t.getLanguageConfiguration(o.getLanguageId()).indentRulesSupport;return!i||e<1||e>o.getLineCount()?null:i.getIndentMetadata(o.getLineContent(e))}function _U(o,e,t){return{tokenization:{getLineTokens:n=>n===e?t:o.tokenization.getLineTokens(n),getLanguageId:()=>o.getLanguageId(),getLanguageIdAtPosition:(n,s)=>o.getLanguageIdAtPosition(n,s)},getLineContent:n=>n===e?t.getLineContent():o.getLineContent(n)}}class bU{static getEdits(e,t,i,n,s){if(!s&&this._isAutoIndentType(e,t,i)){const r=[];for(const c of i){const h=this._findActualIndentationForSelection(e,t,c,n);if(h===null)return;r.push({selection:c,indentation:h})}const a=Av.getAutoClosingPairClose(e,t,i,n,!1);return this._getIndentationAndAutoClosingPairEdits(e,t,r,n,a)}}static _isAutoIndentType(e,t,i){if(e.autoIndent<4)return!1;for(let n=0,s=i.length;n<s;n++)if(!t.tokenization.isCheapToTokenize(i[n].getEndPosition().lineNumber))return!1;return!0}static _findActualIndentationForSelection(e,t,i,n){const s=mU(e,t,i,n,{shiftIndent:a=>Fv(e,a),unshiftIndent:a=>hm(e,a)},e.languageConfigurationService);if(s===null)return null;const r=oE(t,i.startLineNumber,i.startColumn);return s===e.normalizeIndentation(r)?null:s}static _getIndentationAndAutoClosingPairEdits(e,t,i,n,s){const r=i.map(({selection:c,indentation:h})=>{if(s!==null){const d=this._getEditFromIndentationAndSelection(e,t,h,c,n,!1);return new TU(d,c,n,s)}else{const d=this._getEditFromIndentationAndSelection(e,t,h,c,n,!0);return Sa(d.range,d.text,!1)}}),a={shouldPushStackElementBefore:!0,shouldPushStackElementAfter:!1};return new pi(4,r,a)}static _getEditFromIndentationAndSelection(e,t,i,n,s,r=!0){const a=n.startLineNumber,c=t.getLineFirstNonWhitespaceColumn(a);let h=e.normalizeIndentation(i);if(c!==0){const u=t.getLineContent(a);h+=u.substring(c-1,n.startColumn-1)}return h+=r?s:"",{range:new l.Range(a,1,n.endLineNumber,n.endColumn),text:h}}}class CU{static getEdits(e,t,i,n,s,r){if(MI(t,i,n,s,r))return this._runAutoClosingOvertype(e,n,r)}static _runAutoClosingOvertype(e,t,i){const n=[];for(let s=0,r=t.length;s<r;s++){const c=t[s].getPosition(),h=new l.Range(c.lineNumber,c.column,c.lineNumber,c.column+1);n[s]=new Ri(h,i)}return new pi(4,n,{shouldPushStackElementBefore:cm(e,4),shouldPushStackElementAfter:!1})}}class vU{static getEdits(e,t,i,n,s){if(MI(e,t,i,n,s)){const r=i.map(a=>new Ri(new l.Range(a.positionLineNumber,a.positionColumn,a.positionLineNumber,a.positionColumn+1),"",!1));return new pi(4,r,{shouldPushStackElementBefore:!0,shouldPushStackElementAfter:!1})}}}class Av{static getEdits(e,t,i,n,s,r){if(!r){const a=this.getAutoClosingPairClose(e,t,i,n,s);if(a!==null)return this._runAutoClosingOpenCharType(i,n,s,a)}}static _runAutoClosingOpenCharType(e,t,i,n){const s=[];for(let r=0,a=e.length;r<a;r++){const c=e[r];s[r]=new IU(c,t,!i,n)}return new pi(4,s,{shouldPushStackElementBefore:!0,shouldPushStackElementAfter:!1})}static getAutoClosingPairClose(e,t,i,n,s){for(const m of i)if(!m.isEmpty())return null;const r=i.map(m=>{const p=m.getPosition();return s?{lineNumber:p.lineNumber,beforeColumn:p.column-n.length,afterColumn:p.column}:{lineNumber:p.lineNumber,beforeColumn:p.column,afterColumn:p.column}}),a=this._findAutoClosingPairOpen(e,t,r.map(m=>new l.Position(m.lineNumber,m.beforeColumn)),n);if(!a)return null;let c,h;if(lr(n)?(c=e.autoClosingQuotes,h=e.shouldAutoCloseBefore.quote):(e.blockCommentStartToken?a.open.includes(e.blockCommentStartToken):!1)?(c=e.autoClosingComments,h=e.shouldAutoCloseBefore.comment):(c=e.autoClosingBrackets,h=e.shouldAutoCloseBefore.bracket),c==="never")return null;const u=this._findContainedAutoClosingPair(e,a),f=u?u.close:"";let g=!0;for(const m of r){const{lineNumber:p,beforeColumn:b,afterColumn:v}=m,C=t.getLineContent(p),w=C.substring(0,b-1),S=C.substring(v-1);if(S.startsWith(f)||(g=!1),S.length>0){const I=S.charAt(0);if(!this._isBeforeClosingBrace(e,S)&&!h(I))return null}if(a.open.length===1&&(n==="'"||n==='"')&&c!=="always"){const I=l.getMapForWordSeparators(e.wordSeparators,[]);if(w.length>0){const T=w.charCodeAt(w.length-1);if(I.get(T)===0)return null}}if(!t.tokenization.isCheapToTokenize(p))return null;t.tokenization.forceTokenization(p);const L=t.tokenization.getLineTokens(p),D=oa(L,b-1);if(!a.shouldAutoClose(D,b-D.firstCharOffset))return null;const x=a.findNeutralCharacter();if(x){const I=t.tokenization.getTokenTypeIfInsertingCharacter(p,b,x);if(!a.isOK(I))return null}}return g?a.close.substring(0,a.close.length-f.length):a.close}static _findContainedAutoClosingPair(e,t){if(t.open.length<=1)return null;const i=t.close.charAt(t.close.length-1),n=e.autoClosingPairs.autoClosingPairsCloseByEnd.get(i)||[];let s=null;for(const r of n)r.open!==t.open&&t.open.includes(r.open)&&t.close.endsWith(r.close)&&(!s||r.open.length>s.open.length)&&(s=r);return s}static _findAutoClosingPairOpen(e,t,i,n){const s=e.autoClosingPairs.autoClosingPairsOpenByEnd.get(n);if(!s)return null;let r=null;for(const a of s)if(r===null||a.open.length>r.open.length){let c=!0;for(const h of i)if(t.getValueInRange(new l.Range(h.lineNumber,h.column-a.open.length+1,h.lineNumber,h.column))+n!==a.open){c=!1;break}c&&(r=a)}return r}static _isBeforeClosingBrace(e,t){const i=t.charAt(0),n=e.autoClosingPairs.autoClosingPairsOpenByStart.get(i)||[],s=e.autoClosingPairs.autoClosingPairsCloseByStart.get(i)||[],r=n.some(c=>t.startsWith(c.open)),a=s.some(c=>t.startsWith(c.close));return!r&&a}}class TI{static getEdits(e,t){if(!(e.inputMode==="overtype"))return null;const n=t.map(s=>new rU(s.insertedTextRange));return new pi(4,n,{shouldPushStackElementBefore:!0,shouldPushStackElementAfter:!1})}}class wU{static getEdits(e,t,i,n,s){if(!s&&this._isSurroundSelectionType(e,t,i,n))return this._runSurroundSelectionType(e,i,n)}static _runSurroundSelectionType(e,t,i){const n=[];for(let s=0,r=t.length;s<r;s++){const a=t[s],c=e.surroundingPairs[i];n[s]=new hU(a,i,c)}return new pi(0,n,{shouldPushStackElementBefore:!0,shouldPushStackElementAfter:!0})}static _isSurroundSelectionType(e,t,i,n){if(!AI(e,n)||!e.surroundingPairs.hasOwnProperty(n))return!1;const s=lr(n);for(const r of i){if(r.isEmpty())return!1;let a=!0;for(let c=r.startLineNumber;c<=r.endLineNumber;c++){const h=t.getLineContent(c),d=c===r.startLineNumber?r.startColumn-1:0,u=c===r.endLineNumber?r.endColumn-1:h.length,f=h.substring(d,u);if(/[^ \t]/.test(f)){a=!1;break}}if(a)return!1;if(s&&r.startLineNumber===r.endLineNumber&&r.startColumn+1===r.endColumn){const c=t.getValueInRange(r);if(lr(c))return!1}}return!0}}class SU{static getEdits(e,t,i,n,s,r){if(!r&&this._isTypeInterceptorElectricChar(t,i,n)){const a=this._typeInterceptorElectricChar(e,t,i,n[0],s);if(a)return a}}static _isTypeInterceptorElectricChar(e,t,i){return!!(i.length===1&&t.tokenization.isCheapToTokenize(i[0].getEndPosition().lineNumber))}static _typeInterceptorElectricChar(e,t,i,n,s){if(!t.electricChars.hasOwnProperty(s)||!n.isEmpty())return null;const r=n.getPosition();i.tokenization.forceTokenization(r.lineNumber);const a=i.tokenization.getLineTokens(r.lineNumber);let c;try{c=t.onElectricCharacter(s,a,r.column)}catch(h){return l.onUnexpectedError(h),null}if(!c)return null;if(c.matchOpenBracket){const h=(a.getLineContent()+s).lastIndexOf(c.matchOpenBracket)+1,d=i.bracketPairs.findMatchingBracketUp(c.matchOpenBracket,{lineNumber:r.lineNumber,column:h},500);if(d){if(d.startLineNumber===r.lineNumber)return null;const u=i.getLineContent(d.startLineNumber),f=l.getLeadingWhitespace(u),g=t.normalizeIndentation(f),m=i.getLineContent(r.lineNumber),p=i.getLineFirstNonWhitespaceColumn(r.lineNumber)||r.column,b=m.substring(p-1,r.column-1),v=g+b+s,C=new l.Range(r.lineNumber,1,r.lineNumber,r.column),w=new Ri(C,v);return new pi(kv(v,e),[w],{shouldPushStackElementBefore:!1,shouldPushStackElementAfter:!0})}}return null}}class yU{static getEdits(e,t,i,n,s){const r=[];for(let c=0,h=i.length;c<h;c++){const d=e.inputMode==="overtype"&&!s?Ev:Ri;r[c]=new d(i[c],n)}const a=kv(n,t);return new pi(a,r,{shouldPushStackElementBefore:cm(t,a),shouldPushStackElementAfter:!1})}}class Ov{static getEdits(e,t,i,n,s){if(!s&&n===`
|
||
`){const r=[];for(let a=0,c=i.length;a<c;a++)r[a]=this._enter(e,t,!1,i[a]);return new pi(4,r,{shouldPushStackElementBefore:!0,shouldPushStackElementAfter:!1})}}static _enter(e,t,i,n){if(e.autoIndent===0)return Sa(n,`
|
||
`,i);if(!t.tokenization.isCheapToTokenize(n.getStartPosition().lineNumber)||e.autoIndent===1){const c=t.getLineContent(n.startLineNumber),h=l.getLeadingWhitespace(c).substring(0,n.startColumn-1);return Sa(n,`
|
||
`+e.normalizeIndentation(h),i)}const s=am(e.autoIndent,t,n,e.languageConfigurationService);if(s){if(s.indentAction===_.IndentAction.None)return Sa(n,`
|
||
`+e.normalizeIndentation(s.indentation+s.appendText),i);if(s.indentAction===_.IndentAction.Indent)return Sa(n,`
|
||
`+e.normalizeIndentation(s.indentation+s.appendText),i);if(s.indentAction===_.IndentAction.IndentOutdent){const c=e.normalizeIndentation(s.indentation),h=e.normalizeIndentation(s.indentation+s.appendText),d=`
|
||
`+h+`
|
||
`+c;return i?new nm(n,d,!0):new sm(n,d,-1,h.length-c.length,!0)}else if(s.indentAction===_.IndentAction.Outdent){const c=hm(e,s.indentation);return Sa(n,`
|
||
`+e.normalizeIndentation(c+s.appendText),i)}}const r=t.getLineContent(n.startLineNumber),a=l.getLeadingWhitespace(r).substring(0,n.startColumn-1);if(e.autoIndent>=4){const c=gU(e.autoIndent,t,n,{unshiftIndent:h=>hm(e,h),shiftIndent:h=>Fv(e,h),normalizeIndentation:h=>e.normalizeIndentation(h)},e.languageConfigurationService);if(c){let h=e.visibleColumnFromColumn(t,n.getEndPosition());const d=n.endColumn,u=t.getLineContent(n.endLineNumber),f=l.firstNonWhitespaceIndex(u);if(f>=0?n=n.setEndPosition(n.endLineNumber,Math.max(n.endColumn,f+1)):n=n.setEndPosition(n.endLineNumber,t.getLineMaxColumn(n.endLineNumber)),i)return new nm(n,`
|
||
`+e.normalizeIndentation(c.afterEnter),!0);{let g=0;return d<=f+1&&(e.insertSpaces||(h=Math.ceil(h/e.indentSize)),g=Math.min(h+1-e.normalizeIndentation(c.afterEnter).length-1,0)),new sm(n,`
|
||
`+e.normalizeIndentation(c.afterEnter),0,g,!0)}}}return Sa(n,`
|
||
`+e.normalizeIndentation(a),i)}static lineInsertBefore(e,t,i){if(t===null||i===null)return[];const n=[];for(let s=0,r=i.length;s<r;s++){let a=i[s].positionLineNumber;if(a===1)n[s]=new nm(new l.Range(1,1,1,1),`
|
||
`);else{a--;const c=t.getLineMaxColumn(a);n[s]=this._enter(e,t,!1,new l.Range(a,c,a,c))}}return n}static lineInsertAfter(e,t,i){if(t===null||i===null)return[];const n=[];for(let s=0,r=i.length;s<r;s++){const a=i[s].positionLineNumber,c=t.getLineMaxColumn(a);n[s]=this._enter(e,t,!1,new l.Range(a,c,a,c))}return n}static lineBreakInsert(e,t,i){const n=[];for(let s=0,r=i.length;s<r;s++)n[s]=this._enter(e,t,!0,i[s]);return n}}class LU{static getEdits(e,t,i,n,s,r){const a=this._distributePasteToCursors(e,i,n,s,r);return a?(i=i.sort(l.Range.compareRangesUsingStarts),this._distributedPaste(e,t,i,a)):this._simplePaste(e,t,i,n,s)}static _distributePasteToCursors(e,t,i,n,s){if(t.length===1)return null;if(s&&s.length===t.length)return s;if(n)return null;if(e.multiCursorPaste==="spread"){i.charCodeAt(i.length-1)===10&&(i=i.substring(0,i.length-1)),i.charCodeAt(i.length-1)===13&&(i=i.substring(0,i.length-1));const r=l.splitLines(i);if(r.length===t.length)return r}return null}static _distributedPaste(e,t,i,n){const s=[];for(let r=0,a=i.length;r<a;r++){const h=e.overtypeOnPaste&&e.inputMode==="overtype"?Ev:Ri;s[r]=new h(i[r],n[r])}return new pi(0,s,{shouldPushStackElementBefore:!0,shouldPushStackElementAfter:!0})}static _simplePaste(e,t,i,n,s){const r=[];for(let a=0,c=i.length;a<c;a++){const h=i[a],d=h.getPosition();if(s&&!h.isEmpty()&&(s=!1),s&&n.indexOf(`
|
||
`)!==n.length-1&&(s=!1),s){const u=new l.Range(d.lineNumber,1,d.lineNumber,1);r[a]=new xI(u,n,h,!0)}else{const f=e.overtypeOnPaste&&e.inputMode==="overtype"?Ev:Ri;r[a]=new f(h,n)}}return new pi(0,r,{shouldPushStackElementBefore:!0,shouldPushStackElementAfter:!0})}}class DU{static getEdits(e,t,i,n,s,r,a,c){const h=n.map(d=>this._compositionType(i,d,s,r,a,c));return new pi(4,h,{shouldPushStackElementBefore:cm(e,4),shouldPushStackElementAfter:!1})}static _compositionType(e,t,i,n,s,r){if(!t.isEmpty())return null;const a=t.getPosition(),c=Math.max(1,a.column-n),h=Math.min(e.getLineMaxColumn(a.lineNumber),a.column+s),d=new l.Range(a.lineNumber,c,a.lineNumber,h);return new sm(d,i,0,r)}}class xU{static getEdits(e,t,i){const n=[];for(let r=0,a=t.length;r<a;r++)n[r]=new Ri(t[r],i);const s=kv(i,e);return new pi(s,n,{shouldPushStackElementBefore:cm(e,s),shouldPushStackElementAfter:!1})}}class EU{static getCommands(e,t,i){const n=[];for(let s=0,r=i.length;s<r;s++){const a=i[s];if(a.isEmpty()){const c=t.getLineContent(a.startLineNumber);if(/^\s*$/.test(c)&&t.tokenization.isCheapToTokenize(a.startLineNumber)){let h=this._goodIndentForLine(e,t,a.startLineNumber);h=h||" ";const d=e.normalizeIndentation(h);if(!c.startsWith(d)){n[s]=new Ri(new l.Range(a.startLineNumber,1,a.startLineNumber,c.length+1),d,!0);continue}}n[s]=this._replaceJumpToNextIndent(e,t,a,!0)}else{if(a.startLineNumber===a.endLineNumber){const c=t.getLineMaxColumn(a.startLineNumber);if(a.startColumn!==1||a.endColumn!==c){n[s]=this._replaceJumpToNextIndent(e,t,a,!1);continue}}n[s]=new _.ShiftCommand(a,{isUnshift:!1,tabSize:e.tabSize,indentSize:e.indentSize,insertSpaces:e.insertSpaces,useTabStops:e.useTabStops,autoIndent:e.autoIndent},e.languageConfigurationService)}}return n}static _goodIndentForLine(e,t,i){let n=null,s="";const r=Bd(e.autoIndent,t,i,!1,e.languageConfigurationService);if(r)n=r.action,s=r.indentation;else if(i>1){let a;for(a=i-1;a>=1;a--){const d=t.getLineContent(a);if(l.lastNonWhitespaceIndex(d)>=0)break}if(a<1)return null;const c=t.getLineMaxColumn(a),h=am(e.autoIndent,t,new l.Range(a,c,a,c),e.languageConfigurationService);h&&(s=h.indentation+h.appendText)}return n&&(n===_.IndentAction.Indent&&(s=Fv(e,s)),n===_.IndentAction.Outdent&&(s=hm(e,s)),s=e.normalizeIndentation(s)),s||null}static _replaceJumpToNextIndent(e,t,i,n){let s="";const r=i.getStartPosition();if(e.insertSpaces){const a=e.visibleColumnFromColumn(t,r),c=e.indentSize,h=c-a%c;for(let d=0;d<h;d++)s+=" "}else s=" ";return new Ri(i,s,n)}}class Pv extends sm{constructor(e,t,i,n,s,r){super(e,t,i,n),this._openCharacter=s,this._closeCharacter=r,this.closeCharacterRange=null,this.enclosingRange=null}_computeCursorStateWithRange(e,t,i){return this.closeCharacterRange=new l.Range(t.startLineNumber,t.endColumn-this._closeCharacter.length,t.endLineNumber,t.endColumn),this.enclosingRange=new l.Range(t.startLineNumber,t.endColumn-this._openCharacter.length-this._closeCharacter.length,t.endLineNumber,t.endColumn),super.computeCursorState(e,i)}}class IU extends Pv{constructor(e,t,i,n){const s=(i?t:"")+n,r=0,a=-n.length;super(e,s,r,a,t,n)}computeCursorState(e,t){const n=t.getInverseEditOperations()[0].range;return this._computeCursorStateWithRange(e,n,t)}}class TU extends Pv{constructor(e,t,i,n){const s=i+n,r=0,a=i.length;super(t,s,r,a,i,n),this._autoIndentationEdit=e,this._autoClosingEdit={range:t,text:s}}getEditOperations(e,t){t.addTrackedEditOperation(this._autoIndentationEdit.range,this._autoIndentationEdit.text),t.addTrackedEditOperation(this._autoClosingEdit.range,this._autoClosingEdit.text)}computeCursorState(e,t){const i=t.getInverseEditOperations();if(i.length!==2)throw new Error("There should be two inverse edit operations!");const n=i[0].range,s=i[1].range,r=n.plusRange(s);return this._computeCursorStateWithRange(e,r,t)}}function kv(o,e){return o===" "?e===5||e===6?6:5:4}function cm(o,e){return RI(o)&&!RI(e)?!0:o===5?!1:NI(o)!==NI(e)}function NI(o){return o===6||o===5?"space":o}function RI(o){return o===4||o===5||o===6}function MI(o,e,t,i,n){if(o.autoClosingOvertype==="never"||!o.autoClosingPairs.autoClosingPairsCloseSingleChar.has(n))return!1;for(let s=0,r=t.length;s<r;s++){const a=t[s];if(!a.isEmpty())return!1;const c=a.getPosition(),h=e.getLineContent(c.lineNumber);if(h.charAt(c.column-1)!==n)return!1;const u=lr(n);if((c.column>2?h.charCodeAt(c.column-2):0)===92&&u)return!1;if(o.autoClosingOvertype==="auto"){let g=!1;for(let m=0,p=i.length;m<p;m++){const b=i[m];if(c.lineNumber===b.startLineNumber&&c.column===b.startColumn){g=!0;break}}if(!g)return!1}}return!0}function Sa(o,e,t){return t?new nm(o,e,!0):new Ri(o,e,!0)}function Fv(o,e,t){return t=t||1,_.ShiftCommand.shiftIndent(e,e.length+t,o.tabSize,o.indentSize,o.insertSpaces)}function hm(o,e,t){return t=t||1,_.ShiftCommand.unshiftIndent(e,e.length+t,o.tabSize,o.indentSize,o.insertSpaces)}function AI(o,e){return lr(e)?o.autoSurround==="quotes"||o.autoSurround==="languageDefined":o.autoSurround==="brackets"||o.autoSurround==="languageDefined"}class cr{static indent(e,t,i){if(t===null||i===null)return[];const n=[];for(let s=0,r=i.length;s<r;s++)n[s]=new _.ShiftCommand(i[s],{isUnshift:!1,tabSize:e.tabSize,indentSize:e.indentSize,insertSpaces:e.insertSpaces,useTabStops:e.useTabStops,autoIndent:e.autoIndent},e.languageConfigurationService);return n}static outdent(e,t,i){const n=[];for(let s=0,r=i.length;s<r;s++)n[s]=new _.ShiftCommand(i[s],{isUnshift:!0,tabSize:e.tabSize,indentSize:e.indentSize,insertSpaces:e.insertSpaces,useTabStops:e.useTabStops,autoIndent:e.autoIndent},e.languageConfigurationService);return n}static paste(e,t,i,n,s,r){return LU.getEdits(e,t,i,n,s,r)}static tab(e,t,i){return EU.getCommands(e,t,i)}static compositionType(e,t,i,n,s,r,a,c){return DU.getEdits(e,t,i,n,s,r,a,c)}static compositionEndWithInterceptors(e,t,i,n,s,r){if(!n)return null;let a=null;for(const f of n)if(a===null)a=f.insertedText;else if(a!==f.insertedText)return null;if(!a||a.length!==1)return TI.getEdits(t,n);const c=a;let h=!1;for(const f of n)if(f.deletedText.length!==0){h=!0;break}if(h){if(!AI(t,c)||!t.surroundingPairs.hasOwnProperty(c))return null;const f=lr(c);for(const p of n)if(p.deletedSelectionStart!==0||p.deletedSelectionEnd!==p.deletedText.length||/^[ \t]+$/.test(p.deletedText)||f&&lr(p.deletedText))return null;const g=[];for(const p of s){if(!p.isEmpty())return null;g.push(p.getPosition())}if(g.length!==n.length)return null;const m=[];for(let p=0,b=g.length;p<b;p++)m.push(new dU(g[p],n[p].deletedText,t.surroundingPairs[c]));return new pi(4,m,{shouldPushStackElementBefore:!0,shouldPushStackElementAfter:!1})}const d=vU.getEdits(t,i,s,r,c);if(d!==void 0)return d;const u=Av.getEdits(t,i,s,c,!0,!1);return u!==void 0?u:TI.getEdits(t,n)}static typeWithInterceptors(e,t,i,n,s,r,a){const c=Ov.getEdits(i,n,s,a,e);if(c!==void 0)return c;const h=bU.getEdits(i,n,s,a,e);if(h!==void 0)return h;const d=CU.getEdits(t,i,n,s,r,a);if(d!==void 0)return d;const u=Av.getEdits(i,n,s,a,!1,e);if(u!==void 0)return u;const f=wU.getEdits(i,n,s,a,e);if(f!==void 0)return f;const g=SU.getEdits(t,i,n,s,a,e);return g!==void 0?g:yU.getEdits(i,t,s,a,e)}static typeWithoutInterceptors(e,t,i,n,s){return xU.getEdits(e,n,s)}}class NU{constructor(e,t,i,n,s,r,a){this.deletedText=e,this.deletedSelectionStart=t,this.deletedSelectionEnd=i,this.insertedText=n,this.insertedSelectionStart=s,this.insertedSelectionEnd=r,this.insertedTextRange=a}}_.EditorContextKeys=void 0,(function(o){o.editorSimpleInput=new q("editorSimpleInput",!1,!0),o.editorTextFocus=new q("editorTextFocus",!1,l.localize(714,"Whether the editor text has focus (cursor is blinking)")),o.focus=new q("editorFocus",!1,l.localize(715,"Whether the editor or an editor widget has focus (e.g. focus is in the find widget)")),o.textInputFocus=new q("textInputFocus",!1,l.localize(716,"Whether an editor or a rich text input has focus (cursor is blinking)")),o.readOnly=new q("editorReadonly",!1,l.localize(717,"Whether the editor is read-only")),o.inDiffEditor=new q("inDiffEditor",!1,l.localize(718,"Whether the context is a diff editor")),o.isEmbeddedDiffEditor=new q("isEmbeddedDiffEditor",!1,l.localize(719,"Whether the context is an embedded diff editor")),o.inMultiDiffEditor=new q("inMultiDiffEditor",!1,l.localize(720,"Whether the context is a multi diff editor")),o.multiDiffEditorAllCollapsed=new q("multiDiffEditorAllCollapsed",void 0,l.localize(721,"Whether all files in multi diff editor are collapsed")),o.hasChanges=new q("diffEditorHasChanges",!1,l.localize(722,"Whether the diff editor has changes")),o.comparingMovedCode=new q("comparingMovedCode",!1,l.localize(723,"Whether a moved code block is selected for comparison")),o.accessibleDiffViewerVisible=new q("accessibleDiffViewerVisible",!1,l.localize(724,"Whether the accessible diff viewer is visible")),o.diffEditorRenderSideBySideInlineBreakpointReached=new q("diffEditorRenderSideBySideInlineBreakpointReached",!1,l.localize(725,"Whether the diff editor render side by side inline breakpoint is reached")),o.diffEditorInlineMode=new q("diffEditorInlineMode",!1,l.localize(726,"Whether inline mode is active")),o.diffEditorOriginalWritable=new q("diffEditorOriginalWritable",!1,l.localize(727,"Whether modified is writable in the diff editor")),o.diffEditorModifiedWritable=new q("diffEditorModifiedWritable",!1,l.localize(728,"Whether modified is writable in the diff editor")),o.diffEditorOriginalUri=new q("diffEditorOriginalUri","",l.localize(729,"The uri of the original document")),o.diffEditorModifiedUri=new q("diffEditorModifiedUri","",l.localize(730,"The uri of the modified document")),o.columnSelection=new q("editorColumnSelection",!1,l.localize(731,"Whether `editor.columnSelection` is enabled")),o.writable=o.readOnly.toNegated(),o.hasNonEmptySelection=new q("editorHasSelection",!1,l.localize(732,"Whether the editor has text selected")),o.hasOnlyEmptySelection=o.hasNonEmptySelection.toNegated(),o.hasMultipleSelections=new q("editorHasMultipleSelections",!1,l.localize(733,"Whether the editor has multiple selections")),o.hasSingleSelection=o.hasMultipleSelections.toNegated(),o.tabMovesFocus=new q("editorTabMovesFocus",!1,l.localize(734,"Whether `Tab` will move focus out of the editor")),o.tabDoesNotMoveFocus=o.tabMovesFocus.toNegated(),o.isInEmbeddedEditor=new q("isInEmbeddedEditor",!1,!0),o.canUndo=new q("canUndo",!1,!0),o.canRedo=new q("canRedo",!1,!0),o.hoverVisible=new q("editorHoverVisible",!1,l.localize(735,"Whether the editor hover is visible")),o.hoverFocused=new q("editorHoverFocused",!1,l.localize(736,"Whether the editor hover is focused")),o.stickyScrollFocused=new q("stickyScrollFocused",!1,l.localize(737,"Whether the sticky scroll is focused")),o.stickyScrollVisible=new q("stickyScrollVisible",!1,l.localize(738,"Whether the sticky scroll is visible")),o.standaloneColorPickerVisible=new q("standaloneColorPickerVisible",!1,l.localize(739,"Whether the standalone color picker is visible")),o.standaloneColorPickerFocused=new q("standaloneColorPickerFocused",!1,l.localize(740,"Whether the standalone color picker is focused")),o.isComposing=new q("isComposing",!1,l.localize(741,"Whether the editor is in the composition mode")),o.inCompositeEditor=new q("inCompositeEditor",void 0,l.localize(742,"Whether the editor is part of a larger editor (e.g. notebooks)")),o.notInCompositeEditor=o.inCompositeEditor.toNegated(),o.languageId=new q("editorLangId","",l.localize(743,"The language identifier of the editor")),o.hasCompletionItemProvider=new q("editorHasCompletionItemProvider",!1,l.localize(744,"Whether the editor has a completion item provider")),o.hasCodeActionsProvider=new q("editorHasCodeActionsProvider",!1,l.localize(745,"Whether the editor has a code actions provider")),o.hasCodeLensProvider=new q("editorHasCodeLensProvider",!1,l.localize(746,"Whether the editor has a code lens provider")),o.hasDefinitionProvider=new q("editorHasDefinitionProvider",!1,l.localize(747,"Whether the editor has a definition provider")),o.hasDeclarationProvider=new q("editorHasDeclarationProvider",!1,l.localize(748,"Whether the editor has a declaration provider")),o.hasImplementationProvider=new q("editorHasImplementationProvider",!1,l.localize(749,"Whether the editor has an implementation provider")),o.hasTypeDefinitionProvider=new q("editorHasTypeDefinitionProvider",!1,l.localize(750,"Whether the editor has a type definition provider")),o.hasHoverProvider=new q("editorHasHoverProvider",!1,l.localize(751,"Whether the editor has a hover provider")),o.hasDocumentHighlightProvider=new q("editorHasDocumentHighlightProvider",!1,l.localize(752,"Whether the editor has a document highlight provider")),o.hasDocumentSymbolProvider=new q("editorHasDocumentSymbolProvider",!1,l.localize(753,"Whether the editor has a document symbol provider")),o.hasReferenceProvider=new q("editorHasReferenceProvider",!1,l.localize(754,"Whether the editor has a reference provider")),o.hasRenameProvider=new q("editorHasRenameProvider",!1,l.localize(755,"Whether the editor has a rename provider")),o.hasSignatureHelpProvider=new q("editorHasSignatureHelpProvider",!1,l.localize(756,"Whether the editor has a signature help provider")),o.hasInlayHintsProvider=new q("editorHasInlayHintsProvider",!1,l.localize(757,"Whether the editor has an inline hints provider")),o.hasDocumentFormattingProvider=new q("editorHasDocumentFormattingProvider",!1,l.localize(758,"Whether the editor has a document formatting provider")),o.hasDocumentSelectionFormattingProvider=new q("editorHasDocumentSelectionFormattingProvider",!1,l.localize(759,"Whether the editor has a document selection formatting provider")),o.hasMultipleDocumentFormattingProvider=new q("editorHasMultipleDocumentFormattingProvider",!1,l.localize(760,"Whether the editor has multiple document formatting providers")),o.hasMultipleDocumentSelectionFormattingProvider=new q("editorHasMultipleDocumentSelectionFormattingProvider",!1,l.localize(761,"Whether the editor has multiple document selection formatting providers")),o.selectionHasDiagnostics=new q("editorSelectionHasDiagnostics",!1,l.localize(762,"Whether any diagnostic is present in the current editor selection"))})(_.EditorContextKeys||(_.EditorContextKeys={}));const Se=0;class tt extends ao{runEditorCommand(e,t,i){const n=t._getViewModel();n&&this.runCoreEditorCommand(n,i||{})}}var Kt;(function(o){const e=function(i){if(!l.isObject(i))return!1;const n=i;return!(!l.isString(n.to)||!l.isUndefined(n.by)&&!l.isString(n.by)||!l.isUndefined(n.value)&&!l.isNumber(n.value)||!l.isUndefined(n.revealCursor)&&!l.isBoolean(n.revealCursor))};o.metadata={description:"Scroll editor in the given direction",args:[{name:"Editor scroll argument object",description:"Property-value pairs that can be passed through this argument:\n * 'to': A mandatory direction value.\n ```\n 'up', 'down'\n ```\n * 'by': Unit to move. Default is computed based on 'to' value.\n ```\n 'line', 'wrappedLine', 'page', 'halfPage', 'editor'\n ```\n * 'value': Number of units to move. Default is '1'.\n * 'revealCursor': If 'true' reveals the cursor if it is outside view port.\n ",constraint:e,schema:{type:"object",required:["to"],properties:{to:{type:"string",enum:["up","down"]},by:{type:"string",enum:["line","wrappedLine","page","halfPage","editor"]},value:{type:"number",default:1},revealCursor:{type:"boolean"}}}}]},o.RawDirection={Up:"up",Right:"right",Down:"down",Left:"left"},o.RawUnit={Line:"line",WrappedLine:"wrappedLine",Page:"page",HalfPage:"halfPage",Editor:"editor",Column:"column"};function t(i){let n;switch(i.to){case o.RawDirection.Up:n=1;break;case o.RawDirection.Right:n=2;break;case o.RawDirection.Down:n=3;break;case o.RawDirection.Left:n=4;break;default:return null}let s;switch(i.by){case o.RawUnit.Line:s=1;break;case o.RawUnit.WrappedLine:s=2;break;case o.RawUnit.Page:s=3;break;case o.RawUnit.HalfPage:s=4;break;case o.RawUnit.Editor:s=5;break;case o.RawUnit.Column:s=6;break;default:s=2}const r=Math.floor(i.value||1),a=!!i.revealCursor;return{direction:n,unit:s,value:r,revealCursor:a,select:!!i.select}}o.parse=t})(Kt||(Kt={}));var Cc;(function(o){const e=function(t){if(!l.isObject(t))return!1;const i=t;return!(!l.isNumber(i.lineNumber)&&!l.isString(i.lineNumber)||!l.isUndefined(i.at)&&!l.isString(i.at))};o.metadata={description:"Reveal the given line at the given logical position",args:[{name:"Reveal line argument object",description:"Property-value pairs that can be passed through this argument:\n * 'lineNumber': A mandatory line number value.\n * 'at': Logical position at which line has to be revealed.\n ```\n 'top', 'center', 'bottom'\n ```\n ",constraint:e,schema:{type:"object",required:["lineNumber"],properties:{lineNumber:{type:["number","string"]},at:{type:"string",enum:["top","center","bottom"]}}}}]},o.RawAtArgument={Top:"top",Center:"center",Bottom:"bottom"}})(Cc||(Cc={}));class Bv{constructor(e){e.addImplementation(1e4,"code-editor",(t,i)=>{const n=t.get(pt).getFocusedCodeEditor();return n&&n.hasTextFocus()?this._runEditorCommand(t,n,i):!1}),e.addImplementation(1e3,"generic-dom-input-textarea",(t,i)=>{const n=wt();return n&&jn(n)?(this.runDOMCommand(n),!0):!1}),e.addImplementation(0,"generic-dom",(t,i)=>{const n=t.get(pt).getActiveCodeEditor();return n?(n.focus(),this._runEditorCommand(t,n,i)):!1})}_runEditorCommand(e,t,i){const n=this.runEditorCommand(e,t,i);return n||!0}}var Lt;(function(o){class e extends tt{constructor(C){super(C),this._inSelectionMode=C.inSelectionMode}runCoreEditorCommand(C,w){if(!w.position)return;C.model.pushStackElement(),C.setCursorStates(w.source,3,[Dt.moveTo(C,C.getPrimaryCursorState(),this._inSelectionMode,w.position,w.viewPosition)])&&w.revealType!==2&&C.revealAllCursors(w.source,!0,!0)}}o.MoveTo=oe(new e({id:"_moveTo",inSelectionMode:!1,precondition:void 0})),o.MoveToSelect=oe(new e({id:"_moveToSelect",inSelectionMode:!0,precondition:void 0}));class t extends tt{runCoreEditorCommand(C,w){C.model.pushStackElement();const S=this._getColumnSelectResult(C,C.getPrimaryCursorState(),C.getCursorColumnSelectData(),w);S!==null&&(C.setCursorStates(w.source,3,S.viewStates.map(L=>ge.fromViewState(L))),C.setCursorColumnSelectData({isReal:!0,fromViewLineNumber:S.fromLineNumber,fromViewVisualColumn:S.fromVisualColumn,toViewLineNumber:S.toLineNumber,toViewVisualColumn:S.toVisualColumn}),S.reversed?C.revealTopMostCursor(w.source):C.revealBottomMostCursor(w.source))}}o.ColumnSelect=oe(new class extends t{constructor(){super({id:"columnSelect",precondition:void 0})}_getColumnSelectResult(v,C,w,S){if(typeof S.position>"u"||typeof S.viewPosition>"u"||typeof S.mouseColumn>"u")return null;const L=v.model.validatePosition(S.position),D=v.coordinatesConverter.validateViewPosition(new l.Position(S.viewPosition.lineNumber,S.viewPosition.column),L),x=S.doColumnSelect?w.fromViewLineNumber:D.lineNumber,I=S.doColumnSelect?w.fromViewVisualColumn:S.mouseColumn-1;return Ca.columnSelect(v.cursorConfig,v,x,I,D.lineNumber,S.mouseColumn-1)}}),o.CursorColumnSelectLeft=oe(new class extends t{constructor(){super({id:"cursorColumnSelectLeft",precondition:void 0,kbOpts:{weight:Se,kbExpr:_.EditorContextKeys.textInputFocus,primary:3599,linux:{primary:0}}})}_getColumnSelectResult(v,C,w,S){return Ca.columnSelectLeft(v.cursorConfig,v,w)}}),o.CursorColumnSelectRight=oe(new class extends t{constructor(){super({id:"cursorColumnSelectRight",precondition:void 0,kbOpts:{weight:Se,kbExpr:_.EditorContextKeys.textInputFocus,primary:3601,linux:{primary:0}}})}_getColumnSelectResult(v,C,w,S){return Ca.columnSelectRight(v.cursorConfig,v,w)}});class i extends t{constructor(C){super(C),this._isPaged=C.isPaged}_getColumnSelectResult(C,w,S,L){return Ca.columnSelectUp(C.cursorConfig,C,S,this._isPaged)}}o.CursorColumnSelectUp=oe(new i({isPaged:!1,id:"cursorColumnSelectUp",precondition:void 0,kbOpts:{weight:Se,kbExpr:_.EditorContextKeys.textInputFocus,primary:3600,linux:{primary:0}}})),o.CursorColumnSelectPageUp=oe(new i({isPaged:!0,id:"cursorColumnSelectPageUp",precondition:void 0,kbOpts:{weight:Se,kbExpr:_.EditorContextKeys.textInputFocus,primary:3595,linux:{primary:0}}}));class n extends t{constructor(C){super(C),this._isPaged=C.isPaged}_getColumnSelectResult(C,w,S,L){return Ca.columnSelectDown(C.cursorConfig,C,S,this._isPaged)}}o.CursorColumnSelectDown=oe(new n({isPaged:!1,id:"cursorColumnSelectDown",precondition:void 0,kbOpts:{weight:Se,kbExpr:_.EditorContextKeys.textInputFocus,primary:3602,linux:{primary:0}}})),o.CursorColumnSelectPageDown=oe(new n({isPaged:!0,id:"cursorColumnSelectPageDown",precondition:void 0,kbOpts:{weight:Se,kbExpr:_.EditorContextKeys.textInputFocus,primary:3596,linux:{primary:0}}}));class s extends tt{constructor(){super({id:"cursorMove",precondition:void 0,metadata:rm.metadata})}runCoreEditorCommand(C,w){const S=rm.parse(w);S&&this._runCursorMove(C,w.source,S)}_runCursorMove(C,w,S){const L=S.noHistory?"api":w;C.model.pushStackElement(),C.setCursorStates(L,3,s._move(C,C.getCursorStates(),S)),C.revealAllCursors(L,!0)}static _move(C,w,S){const L=S.select,D=S.value;switch(S.direction){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:case 8:case 9:case 10:return Dt.simpleMove(C,w,S.direction,L,D,S.unit);case 11:case 13:case 12:case 14:return Dt.viewportMove(C,w,S.direction,L,D);default:return null}}}o.CursorMoveImpl=s,o.CursorMove=oe(new s);class r extends tt{constructor(C){super(C),this._staticArgs=C.args}runCoreEditorCommand(C,w){let S=this._staticArgs;this._staticArgs.value===-1&&(S={direction:this._staticArgs.direction,unit:this._staticArgs.unit,select:this._staticArgs.select,value:w.pageSize||C.cursorConfig.pageSize}),C.model.pushStackElement(),C.setCursorStates(w.source,3,Dt.simpleMove(C,C.getCursorStates(),S.direction,S.select,S.value,S.unit)),C.revealAllCursors(w.source,!0)}}o.CursorLeft=oe(new r({args:{direction:0,unit:0,select:!1,value:1},id:"cursorLeft",precondition:void 0,kbOpts:{weight:Se,kbExpr:_.EditorContextKeys.textInputFocus,primary:15,mac:{primary:15,secondary:[288]}}})),o.CursorLeftSelect=oe(new r({args:{direction:0,unit:0,select:!0,value:1},id:"cursorLeftSelect",precondition:void 0,kbOpts:{weight:Se,kbExpr:_.EditorContextKeys.textInputFocus,primary:1039}})),o.CursorRight=oe(new r({args:{direction:1,unit:0,select:!1,value:1},id:"cursorRight",precondition:void 0,kbOpts:{weight:Se,kbExpr:_.EditorContextKeys.textInputFocus,primary:17,mac:{primary:17,secondary:[292]}}})),o.CursorRightSelect=oe(new r({args:{direction:1,unit:0,select:!0,value:1},id:"cursorRightSelect",precondition:void 0,kbOpts:{weight:Se,kbExpr:_.EditorContextKeys.textInputFocus,primary:1041}})),o.CursorUp=oe(new r({args:{direction:2,unit:2,select:!1,value:1},id:"cursorUp",precondition:void 0,kbOpts:{weight:Se,kbExpr:_.EditorContextKeys.textInputFocus,primary:16,mac:{primary:16,secondary:[302]}}})),o.CursorUpSelect=oe(new r({args:{direction:2,unit:2,select:!0,value:1},id:"cursorUpSelect",precondition:void 0,kbOpts:{weight:Se,kbExpr:_.EditorContextKeys.textInputFocus,primary:1040,secondary:[3088],mac:{primary:1040},linux:{primary:1040}}})),o.CursorPageUp=oe(new r({args:{direction:2,unit:2,select:!1,value:-1},id:"cursorPageUp",precondition:void 0,kbOpts:{weight:Se,kbExpr:_.EditorContextKeys.textInputFocus,primary:11}})),o.CursorPageUpSelect=oe(new r({args:{direction:2,unit:2,select:!0,value:-1},id:"cursorPageUpSelect",precondition:void 0,kbOpts:{weight:Se,kbExpr:_.EditorContextKeys.textInputFocus,primary:1035}})),o.CursorDown=oe(new r({args:{direction:3,unit:2,select:!1,value:1},id:"cursorDown",precondition:void 0,kbOpts:{weight:Se,kbExpr:_.EditorContextKeys.textInputFocus,primary:18,mac:{primary:18,secondary:[300]}}})),o.CursorDownSelect=oe(new r({args:{direction:3,unit:2,select:!0,value:1},id:"cursorDownSelect",precondition:void 0,kbOpts:{weight:Se,kbExpr:_.EditorContextKeys.textInputFocus,primary:1042,secondary:[3090],mac:{primary:1042},linux:{primary:1042}}})),o.CursorPageDown=oe(new r({args:{direction:3,unit:2,select:!1,value:-1},id:"cursorPageDown",precondition:void 0,kbOpts:{weight:Se,kbExpr:_.EditorContextKeys.textInputFocus,primary:12}})),o.CursorPageDownSelect=oe(new r({args:{direction:3,unit:2,select:!0,value:-1},id:"cursorPageDownSelect",precondition:void 0,kbOpts:{weight:Se,kbExpr:_.EditorContextKeys.textInputFocus,primary:1036}})),o.CreateCursor=oe(new class extends tt{constructor(){super({id:"createCursor",precondition:void 0})}runCoreEditorCommand(v,C){if(!C.position)return;let w;C.wholeLine?w=Dt.line(v,v.getPrimaryCursorState(),!1,C.position,C.viewPosition):w=Dt.moveTo(v,v.getPrimaryCursorState(),!1,C.position,C.viewPosition);const S=v.getCursorStates();if(S.length>1){const L=w.modelState?w.modelState.position:null,D=w.viewState?w.viewState.position:null;for(let x=0,I=S.length;x<I;x++){const T=S[x];if(!(L&&!T.modelState.selection.containsPosition(L))&&!(D&&!T.viewState.selection.containsPosition(D))){S.splice(x,1),v.model.pushStackElement(),v.setCursorStates(C.source,3,S);return}}}S.push(w),v.model.pushStackElement(),v.setCursorStates(C.source,3,S)}}),o.LastCursorMoveToSelect=oe(new class extends tt{constructor(){super({id:"_lastCursorMoveToSelect",precondition:void 0})}runCoreEditorCommand(v,C){if(!C.position)return;const w=v.getLastAddedCursorIndex(),S=v.getCursorStates(),L=S.slice(0);L[w]=Dt.moveTo(v,S[w],!0,C.position,C.viewPosition),v.model.pushStackElement(),v.setCursorStates(C.source,3,L)}});class a extends tt{constructor(C){super(C),this._inSelectionMode=C.inSelectionMode}runCoreEditorCommand(C,w){C.model.pushStackElement(),C.setCursorStates(w.source,3,Dt.moveToBeginningOfLine(C,C.getCursorStates(),this._inSelectionMode)),C.revealAllCursors(w.source,!0)}}o.CursorHome=oe(new a({inSelectionMode:!1,id:"cursorHome",precondition:void 0,kbOpts:{weight:Se,kbExpr:_.EditorContextKeys.textInputFocus,primary:14,mac:{primary:14,secondary:[2063]}}})),o.CursorHomeSelect=oe(new a({inSelectionMode:!0,id:"cursorHomeSelect",precondition:void 0,kbOpts:{weight:Se,kbExpr:_.EditorContextKeys.textInputFocus,primary:1038,mac:{primary:1038,secondary:[3087]}}}));class c extends tt{constructor(C){super(C),this._inSelectionMode=C.inSelectionMode}runCoreEditorCommand(C,w){C.model.pushStackElement(),C.setCursorStates(w.source,3,this._exec(C.getCursorStates())),C.revealAllCursors(w.source,!0)}_exec(C){const w=[];for(let S=0,L=C.length;S<L;S++){const D=C[S],x=D.modelState.position.lineNumber;w[S]=ge.fromModelState(D.modelState.move(this._inSelectionMode,x,1,0))}return w}}o.CursorLineStart=oe(new c({inSelectionMode:!1,id:"cursorLineStart",precondition:void 0,kbOpts:{weight:Se,kbExpr:_.EditorContextKeys.textInputFocus,primary:0,mac:{primary:287}}})),o.CursorLineStartSelect=oe(new c({inSelectionMode:!0,id:"cursorLineStartSelect",precondition:void 0,kbOpts:{weight:Se,kbExpr:_.EditorContextKeys.textInputFocus,primary:0,mac:{primary:1311}}}));class h extends tt{constructor(C){super(C),this._inSelectionMode=C.inSelectionMode}runCoreEditorCommand(C,w){C.model.pushStackElement(),C.setCursorStates(w.source,3,Dt.moveToEndOfLine(C,C.getCursorStates(),this._inSelectionMode,w.sticky||!1)),C.revealAllCursors(w.source,!0)}}o.CursorEnd=oe(new h({inSelectionMode:!1,id:"cursorEnd",precondition:void 0,kbOpts:{args:{sticky:!1},weight:Se,kbExpr:_.EditorContextKeys.textInputFocus,primary:13,mac:{primary:13,secondary:[2065]}},metadata:{description:"Go to End",args:[{name:"args",schema:{type:"object",properties:{sticky:{description:l.localize(70,"Stick to the end even when going to longer lines"),type:"boolean",default:!1}}}}]}})),o.CursorEndSelect=oe(new h({inSelectionMode:!0,id:"cursorEndSelect",precondition:void 0,kbOpts:{args:{sticky:!1},weight:Se,kbExpr:_.EditorContextKeys.textInputFocus,primary:1037,mac:{primary:1037,secondary:[3089]}},metadata:{description:"Select to End",args:[{name:"args",schema:{type:"object",properties:{sticky:{description:l.localize(71,"Stick to the end even when going to longer lines"),type:"boolean",default:!1}}}}]}}));class d extends tt{constructor(C){super(C),this._inSelectionMode=C.inSelectionMode}runCoreEditorCommand(C,w){C.model.pushStackElement(),C.setCursorStates(w.source,3,this._exec(C,C.getCursorStates())),C.revealAllCursors(w.source,!0)}_exec(C,w){const S=[];for(let L=0,D=w.length;L<D;L++){const x=w[L],I=x.modelState.position.lineNumber,T=C.model.getLineMaxColumn(I);S[L]=ge.fromModelState(x.modelState.move(this._inSelectionMode,I,T,0))}return S}}o.CursorLineEnd=oe(new d({inSelectionMode:!1,id:"cursorLineEnd",precondition:void 0,kbOpts:{weight:Se,kbExpr:_.EditorContextKeys.textInputFocus,primary:0,mac:{primary:291}}})),o.CursorLineEndSelect=oe(new d({inSelectionMode:!0,id:"cursorLineEndSelect",precondition:void 0,kbOpts:{weight:Se,kbExpr:_.EditorContextKeys.textInputFocus,primary:0,mac:{primary:1315}}}));class u extends tt{constructor(C){super(C),this._inSelectionMode=C.inSelectionMode}runCoreEditorCommand(C,w){C.model.pushStackElement(),C.setCursorStates(w.source,3,Dt.moveToBeginningOfBuffer(C,C.getCursorStates(),this._inSelectionMode)),C.revealAllCursors(w.source,!0)}}o.CursorTop=oe(new u({inSelectionMode:!1,id:"cursorTop",precondition:void 0,kbOpts:{weight:Se,kbExpr:_.EditorContextKeys.textInputFocus,primary:2062,mac:{primary:2064}}})),o.CursorTopSelect=oe(new u({inSelectionMode:!0,id:"cursorTopSelect",precondition:void 0,kbOpts:{weight:Se,kbExpr:_.EditorContextKeys.textInputFocus,primary:3086,mac:{primary:3088}}}));class f extends tt{constructor(C){super(C),this._inSelectionMode=C.inSelectionMode}runCoreEditorCommand(C,w){C.model.pushStackElement(),C.setCursorStates(w.source,3,Dt.moveToEndOfBuffer(C,C.getCursorStates(),this._inSelectionMode)),C.revealAllCursors(w.source,!0)}}o.CursorBottom=oe(new f({inSelectionMode:!1,id:"cursorBottom",precondition:void 0,kbOpts:{weight:Se,kbExpr:_.EditorContextKeys.textInputFocus,primary:2061,mac:{primary:2066}}})),o.CursorBottomSelect=oe(new f({inSelectionMode:!0,id:"cursorBottomSelect",precondition:void 0,kbOpts:{weight:Se,kbExpr:_.EditorContextKeys.textInputFocus,primary:3085,mac:{primary:3090}}}));class g extends tt{constructor(){super({id:"editorScroll",precondition:void 0,metadata:Kt.metadata})}determineScrollMethod(C){const w=[6],S=[1,2,3,4,5],L=[4,2],D=[1,3];return w.includes(C.unit)&&L.includes(C.direction)?this._runHorizontalEditorScroll.bind(this):S.includes(C.unit)&&D.includes(C.direction)?this._runVerticalEditorScroll.bind(this):null}runCoreEditorCommand(C,w){const S=Kt.parse(w);if(!S)return;const L=this.determineScrollMethod(S);L&&L(C,w.source,S)}_runVerticalEditorScroll(C,w,S){const L=this._computeDesiredScrollTop(C,S);if(S.revealCursor){const D=C.getCompletelyVisibleViewRangeAtScrollTop(L),x=C.getViewRangeWithCursorPadding(D);C.setCursorStates(w,3,[Dt.findPositionInViewportIfOutside(C,C.getPrimaryCursorState(),x,S.select)])}C.viewLayout.setScrollPosition({scrollTop:L},0)}_computeDesiredScrollTop(C,w){if(w.unit===1){const D=C.viewLayout.getFutureViewport(),x=C.getCompletelyVisibleViewRangeAtScrollTop(D.top),I=C.coordinatesConverter.convertViewRangeToModelRange(x);let T;w.direction===1?T=Math.max(1,I.startLineNumber-w.value):T=Math.min(C.model.getLineCount(),I.startLineNumber+w.value);const M=C.coordinatesConverter.convertModelPositionToViewPosition(new l.Position(T,1));return C.viewLayout.getVerticalOffsetForLineNumber(M.lineNumber)}if(w.unit===5){let D=0;return w.direction===3&&(D=C.model.getLineCount()-C.cursorConfig.pageSize),C.viewLayout.getVerticalOffsetForLineNumber(D)}let S;w.unit===3?S=C.cursorConfig.pageSize*w.value:w.unit===4?S=Math.round(C.cursorConfig.pageSize/2)*w.value:S=w.value;const L=(w.direction===1?-1:1)*S;return C.viewLayout.getCurrentScrollTop()+L*C.cursorConfig.lineHeight}_runHorizontalEditorScroll(C,w,S){const L=this._computeDesiredScrollLeft(C,S);C.viewLayout.setScrollPosition({scrollLeft:L},0)}_computeDesiredScrollLeft(C,w){const S=(w.direction===4?-1:1)*w.value;return C.viewLayout.getCurrentScrollLeft()+S*C.cursorConfig.typicalHalfwidthCharacterWidth}}o.EditorScrollImpl=g,o.EditorScroll=oe(new g),o.ScrollLineUp=oe(new class extends tt{constructor(){super({id:"scrollLineUp",precondition:void 0,kbOpts:{weight:Se,kbExpr:_.EditorContextKeys.textInputFocus,primary:2064,mac:{primary:267}}})}runCoreEditorCommand(v,C){o.EditorScroll.runCoreEditorCommand(v,{to:Kt.RawDirection.Up,by:Kt.RawUnit.WrappedLine,value:1,revealCursor:!1,select:!1,source:C.source})}}),o.ScrollPageUp=oe(new class extends tt{constructor(){super({id:"scrollPageUp",precondition:void 0,kbOpts:{weight:Se,kbExpr:_.EditorContextKeys.textInputFocus,primary:2059,win:{primary:523},linux:{primary:523}}})}runCoreEditorCommand(v,C){o.EditorScroll.runCoreEditorCommand(v,{to:Kt.RawDirection.Up,by:Kt.RawUnit.Page,value:1,revealCursor:!1,select:!1,source:C.source})}}),o.ScrollEditorTop=oe(new class extends tt{constructor(){super({id:"scrollEditorTop",precondition:void 0,kbOpts:{weight:Se,kbExpr:_.EditorContextKeys.textInputFocus}})}runCoreEditorCommand(v,C){o.EditorScroll.runCoreEditorCommand(v,{to:Kt.RawDirection.Up,by:Kt.RawUnit.Editor,value:1,revealCursor:!1,select:!1,source:C.source})}}),o.ScrollLineDown=oe(new class extends tt{constructor(){super({id:"scrollLineDown",precondition:void 0,kbOpts:{weight:Se,kbExpr:_.EditorContextKeys.textInputFocus,primary:2066,mac:{primary:268}}})}runCoreEditorCommand(v,C){o.EditorScroll.runCoreEditorCommand(v,{to:Kt.RawDirection.Down,by:Kt.RawUnit.WrappedLine,value:1,revealCursor:!1,select:!1,source:C.source})}}),o.ScrollPageDown=oe(new class extends tt{constructor(){super({id:"scrollPageDown",precondition:void 0,kbOpts:{weight:Se,kbExpr:_.EditorContextKeys.textInputFocus,primary:2060,win:{primary:524},linux:{primary:524}}})}runCoreEditorCommand(v,C){o.EditorScroll.runCoreEditorCommand(v,{to:Kt.RawDirection.Down,by:Kt.RawUnit.Page,value:1,revealCursor:!1,select:!1,source:C.source})}}),o.ScrollEditorBottom=oe(new class extends tt{constructor(){super({id:"scrollEditorBottom",precondition:void 0,kbOpts:{weight:Se,kbExpr:_.EditorContextKeys.textInputFocus}})}runCoreEditorCommand(v,C){o.EditorScroll.runCoreEditorCommand(v,{to:Kt.RawDirection.Down,by:Kt.RawUnit.Editor,value:1,revealCursor:!1,select:!1,source:C.source})}}),o.ScrollLeft=oe(new class extends tt{constructor(){super({id:"scrollLeft",precondition:void 0,kbOpts:{weight:Se,kbExpr:_.EditorContextKeys.textInputFocus}})}runCoreEditorCommand(v,C){o.EditorScroll.runCoreEditorCommand(v,{to:Kt.RawDirection.Left,by:Kt.RawUnit.Column,value:2,revealCursor:!1,select:!1,source:C.source})}}),o.ScrollRight=oe(new class extends tt{constructor(){super({id:"scrollRight",precondition:void 0,kbOpts:{weight:Se,kbExpr:_.EditorContextKeys.textInputFocus}})}runCoreEditorCommand(v,C){o.EditorScroll.runCoreEditorCommand(v,{to:Kt.RawDirection.Right,by:Kt.RawUnit.Column,value:2,revealCursor:!1,select:!1,source:C.source})}});class m extends tt{constructor(C){super(C),this._inSelectionMode=C.inSelectionMode}runCoreEditorCommand(C,w){w.position&&(C.model.pushStackElement(),C.setCursorStates(w.source,3,[Dt.word(C,C.getPrimaryCursorState(),this._inSelectionMode,w.position)]),w.revealType!==2&&C.revealAllCursors(w.source,!0,!0))}}o.WordSelect=oe(new m({inSelectionMode:!1,id:"_wordSelect",precondition:void 0})),o.WordSelectDrag=oe(new m({inSelectionMode:!0,id:"_wordSelectDrag",precondition:void 0})),o.LastCursorWordSelect=oe(new class extends tt{constructor(){super({id:"lastCursorWordSelect",precondition:void 0})}runCoreEditorCommand(v,C){if(!C.position)return;const w=v.getLastAddedCursorIndex(),S=v.getCursorStates(),L=S.slice(0),D=S[w];L[w]=Dt.word(v,D,D.modelState.hasSelection(),C.position),v.model.pushStackElement(),v.setCursorStates(C.source,3,L)}});class p extends tt{constructor(C){super(C),this._inSelectionMode=C.inSelectionMode}runCoreEditorCommand(C,w){w.position&&(C.model.pushStackElement(),C.setCursorStates(w.source,3,[Dt.line(C,C.getPrimaryCursorState(),this._inSelectionMode,w.position,w.viewPosition)]),w.revealType!==2&&C.revealAllCursors(w.source,!1,!0))}}o.LineSelect=oe(new p({inSelectionMode:!1,id:"_lineSelect",precondition:void 0})),o.LineSelectDrag=oe(new p({inSelectionMode:!0,id:"_lineSelectDrag",precondition:void 0}));class b extends tt{constructor(C){super(C),this._inSelectionMode=C.inSelectionMode}runCoreEditorCommand(C,w){if(!w.position)return;const S=C.getLastAddedCursorIndex(),L=C.getCursorStates(),D=L.slice(0);D[S]=Dt.line(C,L[S],this._inSelectionMode,w.position,w.viewPosition),C.model.pushStackElement(),C.setCursorStates(w.source,3,D)}}o.LastCursorLineSelect=oe(new b({inSelectionMode:!1,id:"lastCursorLineSelect",precondition:void 0})),o.LastCursorLineSelectDrag=oe(new b({inSelectionMode:!0,id:"lastCursorLineSelectDrag",precondition:void 0})),o.CancelSelection=oe(new class extends tt{constructor(){super({id:"cancelSelection",precondition:_.EditorContextKeys.hasNonEmptySelection,kbOpts:{weight:Se,kbExpr:_.EditorContextKeys.textInputFocus,primary:9,secondary:[1033]}})}runCoreEditorCommand(v,C){v.model.pushStackElement(),v.setCursorStates(C.source,3,[Dt.cancelSelection(v,v.getPrimaryCursorState())]),v.revealAllCursors(C.source,!0)}}),o.RemoveSecondaryCursors=oe(new class extends tt{constructor(){super({id:"removeSecondaryCursors",precondition:_.EditorContextKeys.hasMultipleSelections,kbOpts:{weight:Se+1,kbExpr:_.EditorContextKeys.textInputFocus,primary:9,secondary:[1033]}})}runCoreEditorCommand(v,C){v.model.pushStackElement(),v.setCursorStates(C.source,3,[v.getPrimaryCursorState()]),v.revealAllCursors(C.source,!0),yd(l.localize(72,"Removed secondary cursors"))}}),o.RevealLine=oe(new class extends tt{constructor(){super({id:"revealLine",precondition:void 0,metadata:Cc.metadata})}runCoreEditorCommand(v,C){const w=C,S=w.lineNumber||0;let L=typeof S=="number"?S+1:parseInt(S)+1;L<1&&(L=1);const D=v.model.getLineCount();L>D&&(L=D);const x=new l.Range(L,1,L,v.model.getLineMaxColumn(L));let I=0;if(w.at)switch(w.at){case Cc.RawAtArgument.Top:I=3;break;case Cc.RawAtArgument.Center:I=1;break;case Cc.RawAtArgument.Bottom:I=4;break}const T=v.coordinatesConverter.convertModelRangeToViewRange(x);v.revealRange(C.source,!1,T,I,0)}}),o.SelectAll=new class extends Bv{constructor(){super(NB)}runDOMCommand(v){di&&(v.focus(),v.select()),v.ownerDocument.execCommand("selectAll")}runEditorCommand(v,C,w){const S=C._getViewModel();S&&this.runCoreEditorCommand(S,w)}runCoreEditorCommand(v,C){v.model.pushStackElement(),v.setCursorStates("keyboard",3,[Dt.selectAll(v,v.getPrimaryCursorState())])}},o.SetSelection=oe(new class extends tt{constructor(){super({id:"setSelection",precondition:void 0})}runCoreEditorCommand(v,C){C.selection&&(v.model.pushStackElement(),v.setCursorStates(C.source,3,[ge.fromModelSelection(C.selection)]))}})})(Lt||(Lt={}));const RU=de.and(_.EditorContextKeys.textInputFocus,_.EditorContextKeys.columnSelection);function vc(o,e){Zn.registerKeybindingRule({id:o,primary:e,when:RU,weight:Se+1})}vc(Lt.CursorColumnSelectLeft.id,1039),vc(Lt.CursorColumnSelectRight.id,1041),vc(Lt.CursorColumnSelectUp.id,1040),vc(Lt.CursorColumnSelectPageUp.id,1035),vc(Lt.CursorColumnSelectDown.id,1042),vc(Lt.CursorColumnSelectPageDown.id,1036);function OI(o){return o.register(),o}_.CoreEditingCommands=void 0,(function(o){class e extends ao{runEditorCommand(i,n,s){const r=n._getViewModel();r&&this.runCoreEditingCommand(n,r,s||{})}}o.CoreEditingCommand=e,o.LineBreakInsert=oe(new class extends e{constructor(){super({id:"lineBreakInsert",precondition:_.EditorContextKeys.writable,kbOpts:{weight:Se,kbExpr:_.EditorContextKeys.textInputFocus,primary:0,mac:{primary:301}}})}runCoreEditingCommand(t,i,n){t.pushUndoStop(),t.executeCommands(this.id,Ov.lineBreakInsert(i.cursorConfig,i.model,i.getCursorStates().map(s=>s.modelState.selection)))}}),o.Outdent=oe(new class extends e{constructor(){super({id:"outdent",precondition:_.EditorContextKeys.writable,kbOpts:{weight:Se,kbExpr:de.and(_.EditorContextKeys.editorTextFocus,_.EditorContextKeys.tabDoesNotMoveFocus),primary:1026}})}runCoreEditingCommand(t,i,n){t.pushUndoStop(),t.executeCommands(this.id,cr.outdent(i.cursorConfig,i.model,i.getCursorStates().map(s=>s.modelState.selection))),t.pushUndoStop()}}),o.Tab=oe(new class extends e{constructor(){super({id:"tab",precondition:_.EditorContextKeys.writable,kbOpts:{weight:Se,kbExpr:de.and(_.EditorContextKeys.editorTextFocus,_.EditorContextKeys.tabDoesNotMoveFocus),primary:2}})}runCoreEditingCommand(t,i,n){t.pushUndoStop(),t.executeCommands(this.id,cr.tab(i.cursorConfig,i.model,i.getCursorStates().map(s=>s.modelState.selection))),t.pushUndoStop()}}),o.DeleteLeft=oe(new class extends e{constructor(){super({id:"deleteLeft",precondition:void 0,kbOpts:{weight:Se,kbExpr:_.EditorContextKeys.textInputFocus,primary:1,secondary:[1025],mac:{primary:1,secondary:[1025,294,257]}}})}runCoreEditingCommand(t,i,n){const[s,r]=va.deleteLeft(i.getPrevEditOperationType(),i.cursorConfig,i.model,i.getCursorStates().map(a=>a.modelState.selection),i.getCursorAutoClosedCharacters());s&&t.pushUndoStop(),t.executeCommands(this.id,r),i.setPrevEditOperationType(2)}}),o.DeleteRight=oe(new class extends e{constructor(){super({id:"deleteRight",precondition:void 0,kbOpts:{weight:Se,kbExpr:_.EditorContextKeys.textInputFocus,primary:20,mac:{primary:20,secondary:[290,276]}}})}runCoreEditingCommand(t,i,n){const[s,r]=va.deleteRight(i.getPrevEditOperationType(),i.cursorConfig,i.model,i.getCursorStates().map(a=>a.modelState.selection));s&&t.pushUndoStop(),t.executeCommands(this.id,r),i.setPrevEditOperationType(3)}}),o.Undo=new class extends Bv{constructor(){super(Ux)}runDOMCommand(t){t.ownerDocument.execCommand("undo")}runEditorCommand(t,i,n){if(!(!i.hasModel()||i.getOption(104)===!0))return i.getModel().undo()}},o.Redo=new class extends Bv{constructor(){super($x)}runDOMCommand(t){t.ownerDocument.execCommand("redo")}runEditorCommand(t,i,n){if(!(!i.hasModel()||i.getOption(104)===!0))return i.getModel().redo()}}})(_.CoreEditingCommands||(_.CoreEditingCommands={}));class PI extends fg{constructor(e,t,i){super({id:e,precondition:void 0,metadata:i}),this._handlerId=t}runCommand(e,t){const i=e.get(pt).getFocusedCodeEditor();i&&i.trigger("keyboard",this._handlerId,t)}}function ya(o,e){OI(new PI("default:"+o,o)),OI(new PI(o,o,e))}ya("type",{description:"Type",args:[{name:"args",schema:{type:"object",required:["text"],properties:{text:{type:"string"}}}}]}),ya("replacePreviousChar"),ya("compositionType"),ya("compositionStart"),ya("compositionEnd"),ya("paste"),ya("cut");class dm{constructor(e,t,i,n){this.configuration=e,this.viewModel=t,this.userInputEvents=i,this.commandDelegate=n}paste(e,t,i,n){this.commandDelegate.paste(e,t,i,n)}type(e){this.commandDelegate.type(e)}compositionType(e,t,i,n){this.commandDelegate.compositionType(e,t,i,n)}compositionStart(){this.commandDelegate.startComposition()}compositionEnd(){this.commandDelegate.endComposition()}cut(){this.commandDelegate.cut()}setSelection(e){Lt.SetSelection.runCoreEditorCommand(this.viewModel,{source:"keyboard",selection:e})}_validateViewColumn(e){const t=this.viewModel.getLineMinColumn(e.lineNumber);return e.column<t?new l.Position(e.lineNumber,t):e}_hasMulticursorModifier(e){switch(this.configuration.options.get(86)){case"altKey":return e.altKey;case"ctrlKey":return e.ctrlKey;case"metaKey":return e.metaKey;default:return!1}}_hasNonMulticursorModifier(e){switch(this.configuration.options.get(86)){case"altKey":return e.ctrlKey||e.metaKey;case"ctrlKey":return e.altKey||e.metaKey;case"metaKey":return e.ctrlKey||e.altKey;default:return!1}}static _trySelectBracketContent(e,t){if(t.column>1){const i=e.bracketPairs.matchBracket(t.with(void 0,t.column-1));if(i&&i[0].getEndPosition().equals(t))return l.Selection.fromPositions(i[0].getEndPosition(),i[1].getStartPosition())}if(t.column<=e.getLineMaxColumn(t.lineNumber)){const i=e.bracketPairs.matchBracket(t);if(i&&i[1].getStartPosition().equals(t))return l.Selection.fromPositions(i[0].getEndPosition(),i[1].getStartPosition())}}static _trySelectStringContent(e,t){const{lineNumber:i,column:n}=t,{tokenization:s}=e;if(!s.hasAccurateTokensForLine(i))if(s.isCheapToTokenize(i))s.forceTokenization(i);else return;const r=s.getLineTokens(i);let a=r.findTokenIndexAtOffset(n-1),c=a;for(;a>0&&r.getStandardTokenType(a-1)===2;)a--;for(;c+1<r.getCount()&&r.getStandardTokenType(c+1)===2;)c++;const h=r.getStartOffset(a),d=r.getEndOffset(c);if(n!==h+2&&n!==d)return;const u=e.getLineContent(i),f=u.charAt(h);if(f!=='"'&&f!=="'"&&f!=="`"||u.charAt(d-1)!==f)return;const g=u.substring(h+1,d-1);if(!l.containsRTL(g))return new l.Selection(i,h+2,i,d)}dispatchMouse(e){const t=this.configuration.options,i=l.isLinux&&t.get(121),n=t.get(28),s=t.get(171);if(e.middleButton&&!i)s||this._columnSelect(e.position,e.mouseColumn,e.inSelectionMode);else if(e.startedOnLineNumbers)this._hasMulticursorModifier(e)?e.inSelectionMode?this._lastCursorLineSelect(e.position,e.revealType):this._createCursor(e.position,!0):e.inSelectionMode?this._lineSelectDrag(e.position,e.revealType):this._lineSelect(e.position,e.revealType);else if(e.mouseDownCount>=4)this._selectAll();else if(e.mouseDownCount===3)this._hasMulticursorModifier(e)?e.inSelectionMode?this._lastCursorLineSelectDrag(e.position,e.revealType):this._lastCursorLineSelect(e.position,e.revealType):e.inSelectionMode?this._lineSelectDrag(e.position,e.revealType):this._lineSelect(e.position,e.revealType);else if(e.mouseDownCount===2){if(!e.onInjectedText)if(this._hasMulticursorModifier(e))this._lastCursorWordSelect(e.position,e.revealType);else if(e.inSelectionMode)this._wordSelectDrag(e.position,e.revealType);else{let r;if(t.get(173)){const a=this.viewModel.model,c=this._convertViewToModelPosition(e.position);r=dm._trySelectBracketContent(a,c)||dm._trySelectStringContent(a,c)}r?this._select(r):this._wordSelect(e.position,e.revealType)}}else this._hasMulticursorModifier(e)?this._hasNonMulticursorModifier(e)||(e.shiftKey?this._columnSelect(e.position,e.mouseColumn,!0):e.inSelectionMode?this._lastCursorMoveToSelect(e.position,e.revealType):this._createCursor(e.position,!1)):e.inSelectionMode?e.altKey?this._columnSelect(e.position,e.mouseColumn,!0):n?this._columnSelect(e.position,e.mouseColumn,!0):this._moveToSelect(e.position,e.revealType):this.moveTo(e.position,e.revealType)}_usualArgs(e,t){return e=this._validateViewColumn(e),{source:"mouse",position:this._convertViewToModelPosition(e),viewPosition:e,revealType:t}}moveTo(e,t){Lt.MoveTo.runCoreEditorCommand(this.viewModel,this._usualArgs(e,t))}_moveToSelect(e,t){Lt.MoveToSelect.runCoreEditorCommand(this.viewModel,this._usualArgs(e,t))}_columnSelect(e,t,i){e=this._validateViewColumn(e),Lt.ColumnSelect.runCoreEditorCommand(this.viewModel,{source:"mouse",position:this._convertViewToModelPosition(e),viewPosition:e,mouseColumn:t,doColumnSelect:i})}_createCursor(e,t){e=this._validateViewColumn(e),Lt.CreateCursor.runCoreEditorCommand(this.viewModel,{source:"mouse",position:this._convertViewToModelPosition(e),viewPosition:e,wholeLine:t})}_lastCursorMoveToSelect(e,t){Lt.LastCursorMoveToSelect.runCoreEditorCommand(this.viewModel,this._usualArgs(e,t))}_wordSelect(e,t){Lt.WordSelect.runCoreEditorCommand(this.viewModel,this._usualArgs(e,t))}_wordSelectDrag(e,t){Lt.WordSelectDrag.runCoreEditorCommand(this.viewModel,this._usualArgs(e,t))}_lastCursorWordSelect(e,t){Lt.LastCursorWordSelect.runCoreEditorCommand(this.viewModel,this._usualArgs(e,t))}_lineSelect(e,t){Lt.LineSelect.runCoreEditorCommand(this.viewModel,this._usualArgs(e,t))}_lineSelectDrag(e,t){Lt.LineSelectDrag.runCoreEditorCommand(this.viewModel,this._usualArgs(e,t))}_lastCursorLineSelect(e,t){Lt.LastCursorLineSelect.runCoreEditorCommand(this.viewModel,this._usualArgs(e,t))}_lastCursorLineSelectDrag(e,t){Lt.LastCursorLineSelectDrag.runCoreEditorCommand(this.viewModel,this._usualArgs(e,t))}_select(e){Lt.SetSelection.runCoreEditorCommand(this.viewModel,{source:"mouse",selection:e})}_selectAll(){Lt.SelectAll.runCoreEditorCommand(this.viewModel,{source:"mouse"})}_convertViewToModelPosition(e){return this.viewModel.coordinatesConverter.convertViewPositionToModelPosition(e)}emitKeyDown(e){this.userInputEvents.emitKeyDown(e)}emitKeyUp(e){this.userInputEvents.emitKeyUp(e)}emitContextMenu(e){this.userInputEvents.emitContextMenu(e)}emitMouseMove(e){this.userInputEvents.emitMouseMove(e)}emitMouseLeave(e){this.userInputEvents.emitMouseLeave(e)}emitMouseUp(e){this.userInputEvents.emitMouseUp(e)}emitMouseDown(e){this.userInputEvents.emitMouseDown(e)}emitMouseDrag(e){this.userInputEvents.emitMouseDrag(e)}emitMouseDrop(e){this.userInputEvents.emitMouseDrop(e)}emitMouseDropCanceled(){this.userInputEvents.emitMouseDropCanceled()}emitMouseWheel(e){this.userInputEvents.emitMouseWheel(e)}}class kI{constructor(e){this._lineFactory=e,this._set(1,[])}flush(){this._set(1,[])}_set(e,t){this._lines=t,this._rendLineNumberStart=e}_get(){return{rendLineNumberStart:this._rendLineNumberStart,lines:this._lines}}getStartLineNumber(){return this._rendLineNumberStart}getEndLineNumber(){return this._rendLineNumberStart+this._lines.length-1}getCount(){return this._lines.length}getLine(e){const t=e-this._rendLineNumberStart;if(t<0||t>=this._lines.length)throw new l.BugIndicatingError("Illegal value for lineNumber");return this._lines[t]}onLinesDeleted(e,t){if(this.getCount()===0)return null;const i=this.getStartLineNumber(),n=this.getEndLineNumber();if(t<i){const c=t-e+1;return this._rendLineNumberStart-=c,null}if(e>n)return null;let s=0,r=0;for(let c=i;c<=n;c++){const h=c-this._rendLineNumberStart;e<=c&&c<=t&&(r===0?(s=h,r=1):r++)}if(e<i){let c=0;t<i?c=t-e+1:c=i-e,this._rendLineNumberStart-=c}return this._lines.splice(s,r)}onLinesChanged(e,t){const i=e+t-1;if(this.getCount()===0)return!1;const n=this.getStartLineNumber(),s=this.getEndLineNumber();let r=!1;for(let a=e;a<=i;a++)a>=n&&a<=s&&(this._lines[a-this._rendLineNumberStart].onContentChanged(),r=!0);return r}onLinesInserted(e,t){if(this.getCount()===0)return null;const i=t-e+1,n=this.getStartLineNumber(),s=this.getEndLineNumber();if(e<=n)return this._rendLineNumberStart+=i,null;if(e>s)return null;if(i+e>s)return this._lines.splice(e-this._rendLineNumberStart,s-e+1);const r=[];for(let u=0;u<i;u++)r[u]=this._lineFactory.createLine();const a=e-this._rendLineNumberStart,c=this._lines.slice(0,a),h=this._lines.slice(a,this._lines.length-i),d=this._lines.slice(this._lines.length-i,this._lines.length);return this._lines=c.concat(r).concat(h),d}onTokensChanged(e){if(this.getCount()===0)return!1;const t=this.getStartLineNumber(),i=this.getEndLineNumber();let n=!1;for(let s=0,r=e.length;s<r;s++){const a=e[s];if(a.toLineNumber<t||a.fromLineNumber>i)continue;const c=Math.max(t,a.fromLineNumber),h=Math.min(i,a.toLineNumber);for(let d=c;d<=h;d++){const u=d-this._rendLineNumberStart;this._lines[u].onTokensChanged(),n=!0}}return n}}class FI{constructor(e,t){this._viewContext=e,this._lineFactory=t,this.domNode=this._createDomNode(),this._linesCollection=new kI(this._lineFactory)}_createDomNode(){const e=we(document.createElement("div"));return e.setClassName("view-layer"),e.setPosition("absolute"),e.domNode.setAttribute("role","presentation"),e.domNode.setAttribute("aria-hidden","true"),e}onConfigurationChanged(e){return!!e.hasChanged(165)}onFlushed(e,t){if(t){const i=this._linesCollection.getStartLineNumber(),n=this._linesCollection.getEndLineNumber();for(let s=i;s<=n;s++)this._linesCollection.getLine(s).getDomNode()?.remove()}return this._linesCollection.flush(),!0}onLinesChanged(e){return this._linesCollection.onLinesChanged(e.fromLineNumber,e.count)}onLinesDeleted(e){const t=this._linesCollection.onLinesDeleted(e.fromLineNumber,e.toLineNumber);if(t)for(let i=0,n=t.length;i<n;i++)t[i].getDomNode()?.remove();return!0}onLinesInserted(e){const t=this._linesCollection.onLinesInserted(e.fromLineNumber,e.toLineNumber);if(t)for(let i=0,n=t.length;i<n;i++)t[i].getDomNode()?.remove();return!0}onScrollChanged(e){return e.scrollTopChanged}onTokensChanged(e){return this._linesCollection.onTokensChanged(e.ranges)}onZonesChanged(e){return!0}getStartLineNumber(){return this._linesCollection.getStartLineNumber()}getEndLineNumber(){return this._linesCollection.getEndLineNumber()}getVisibleLine(e){return this._linesCollection.getLine(e)}renderLines(e){const t=this._linesCollection._get(),i=new zv(this.domNode.domNode,this._lineFactory,e,this._viewContext),n={rendLineNumberStart:t.rendLineNumberStart,lines:t.lines,linesLength:t.lines.length},s=i.render(n,e.startLineNumber,e.endLineNumber,e.relativeVerticalOffset);this._linesCollection._set(s.rendLineNumberStart,s.lines)}}const Vo=class Vo{constructor(e,t,i,n){this._domNode=e,this._lineFactory=t,this._viewportData=i,this._viewContext=n}render(e,t,i,n){const s={rendLineNumberStart:e.rendLineNumberStart,lines:e.lines.slice(0),linesLength:e.linesLength};if(s.rendLineNumberStart+s.linesLength-1<t||i<s.rendLineNumberStart){s.rendLineNumberStart=t,s.linesLength=i-t+1,s.lines=[];for(let r=t;r<=i;r++)s.lines[r-t]=this._lineFactory.createLine();return this._finishRendering(s,!0,n),s}if(this._renderUntouchedLines(s,Math.max(t-s.rendLineNumberStart,0),Math.min(i-s.rendLineNumberStart,s.linesLength-1),n,t),s.rendLineNumberStart>t){const r=t,a=Math.min(i,s.rendLineNumberStart-1);r<=a&&(this._insertLinesBefore(s,r,a,n,t),s.linesLength+=a-r+1)}else if(s.rendLineNumberStart<t){const r=Math.min(s.linesLength,t-s.rendLineNumberStart);r>0&&(this._removeLinesBefore(s,r),s.linesLength-=r)}if(s.rendLineNumberStart=t,s.rendLineNumberStart+s.linesLength-1<i){const r=s.rendLineNumberStart+s.linesLength,a=i;r<=a&&(this._insertLinesAfter(s,r,a,n,t),s.linesLength+=a-r+1)}else if(s.rendLineNumberStart+s.linesLength-1>i){const r=Math.max(0,i-s.rendLineNumberStart+1),c=s.linesLength-1-r+1;c>0&&(this._removeLinesAfter(s,c),s.linesLength-=c)}return this._finishRendering(s,!1,n),s}_renderUntouchedLines(e,t,i,n,s){const r=e.rendLineNumberStart,a=e.lines;for(let c=t;c<=i;c++){const h=r+c;a[c].layoutLine(h,n[h-s],this._lineHeightForLineNumber(h))}}_insertLinesBefore(e,t,i,n,s){const r=[];let a=0;for(let c=t;c<=i;c++)r[a++]=this._lineFactory.createLine();e.lines=r.concat(e.lines)}_removeLinesBefore(e,t){for(let i=0;i<t;i++)e.lines[i].getDomNode()?.remove();e.lines.splice(0,t)}_insertLinesAfter(e,t,i,n,s){const r=[];let a=0;for(let c=t;c<=i;c++)r[a++]=this._lineFactory.createLine();e.lines=e.lines.concat(r)}_removeLinesAfter(e,t){const i=e.linesLength-t;for(let n=0;n<t;n++)e.lines[i+n].getDomNode()?.remove();e.lines.splice(i,t)}_finishRenderingNewLines(e,t,i,n){Vo._ttPolicy&&(i=Vo._ttPolicy.createHTML(i));const s=this._domNode.lastChild;t||!s?this._domNode.innerHTML=i:s.insertAdjacentHTML("afterend",i);let r=this._domNode.lastChild;for(let a=e.linesLength-1;a>=0;a--){const c=e.lines[a];n[a]&&(c.setDomNode(r),r=r.previousSibling)}}_finishRenderingInvalidLines(e,t,i){const n=document.createElement("div");Vo._ttPolicy&&(t=Vo._ttPolicy.createHTML(t)),n.innerHTML=t;for(let s=0;s<e.linesLength;s++){const r=e.lines[s];if(i[s]){const a=n.firstChild;r.getDomNode().replaceWith(a),r.setDomNode(a)}}}_finishRendering(e,t,i){const n=Vo._sb,s=e.linesLength,r=e.lines,a=e.rendLineNumberStart,c=[];{n.reset();let h=!1;for(let d=0;d<s;d++){const u=r[d];if(c[d]=!1,u.getDomNode())continue;const g=d+a;u.renderLine(g,i[d],this._lineHeightForLineNumber(g),this._viewportData,n)&&(c[d]=!0,h=!0)}h&&this._finishRenderingNewLines(e,t,n.build(),c)}{n.reset();let h=!1;const d=[];for(let u=0;u<s;u++){const f=r[u];if(d[u]=!1,c[u])continue;const g=u+a;f.renderLine(g,i[u],this._lineHeightForLineNumber(g),this._viewportData,n)&&(d[u]=!0,h=!0)}h&&this._finishRenderingInvalidLines(e,n.build(),d)}}_lineHeightForLineNumber(e){return this._viewContext.viewLayout.getLineHeightForLineNumber(e)}};Vo._ttPolicy=lo("editorViewLayer",{createHTML:e=>e}),Vo._sb=new ra(1e5);let zv=Vo;class BI extends gi{constructor(e){super(e),this._dynamicOverlays=[],this._isFocused=!1,this._visibleLines=new FI(this._context,{createLine:()=>new MU(this._dynamicOverlays)}),this.domNode=this._visibleLines.domNode;const i=this._context.configuration.options.get(59);Ot(this.domNode,i),this.domNode.setClassName("view-overlays")}shouldRender(){if(super.shouldRender())return!0;for(let e=0,t=this._dynamicOverlays.length;e<t;e++)if(this._dynamicOverlays[e].shouldRender())return!0;return!1}dispose(){super.dispose();for(let e=0,t=this._dynamicOverlays.length;e<t;e++)this._dynamicOverlays[e].dispose();this._dynamicOverlays=[]}getDomNode(){return this.domNode}addDynamicOverlay(e){this._dynamicOverlays.push(e)}onConfigurationChanged(e){this._visibleLines.onConfigurationChanged(e);const i=this._context.configuration.options.get(59);return Ot(this.domNode,i),!0}onFlushed(e){return this._visibleLines.onFlushed(e)}onFocusChanged(e){return this._isFocused=e.isFocused,!0}onLinesChanged(e){return this._visibleLines.onLinesChanged(e)}onLinesDeleted(e){return this._visibleLines.onLinesDeleted(e)}onLinesInserted(e){return this._visibleLines.onLinesInserted(e)}onScrollChanged(e){return this._visibleLines.onScrollChanged(e)||!0}onTokensChanged(e){return this._visibleLines.onTokensChanged(e)}onZonesChanged(e){return this._visibleLines.onZonesChanged(e)}prepareRender(e){const t=this._dynamicOverlays.filter(i=>i.shouldRender());for(let i=0,n=t.length;i<n;i++){const s=t[i];s.prepareRender(e),s.onDidRender()}}render(e){this._viewOverlaysRender(e),this.domNode.toggleClassName("focused",this._isFocused)}_viewOverlaysRender(e){this._visibleLines.renderLines(e.viewportData)}}class MU{constructor(e){this._dynamicOverlays=e,this._domNode=null,this._renderedContent=null}getDomNode(){return this._domNode?this._domNode.domNode:null}setDomNode(e){this._domNode=we(e)}onContentChanged(){}onTokensChanged(){}renderLine(e,t,i,n,s){let r="";for(let a=0,c=this._dynamicOverlays.length;a<c;a++){const h=this._dynamicOverlays[a];r+=h.render(n.startLineNumber,e)}return this._renderedContent===r?!1:(this._renderedContent=r,s.appendString('<div style="top:'),s.appendString(String(t)),s.appendString("px;height:"),s.appendString(String(i)),s.appendString("px;line-height:"),s.appendString(String(i)),s.appendString('px;">'),s.appendString(r),s.appendString("</div>"),!0)}layoutLine(e,t,i){this._domNode&&(this._domNode.setTop(t),this._domNode.setHeight(i),this._domNode.setLineHeight(i))}}class AU extends BI{constructor(e){super(e);const i=this._context.configuration.options.get(165);this._contentWidth=i.contentWidth,this.domNode.setHeight(0)}onConfigurationChanged(e){const i=this._context.configuration.options.get(165);return this._contentWidth=i.contentWidth,super.onConfigurationChanged(e)||!0}onScrollChanged(e){return super.onScrollChanged(e)||e.scrollWidthChanged}_viewOverlaysRender(e){super._viewOverlaysRender(e),this.domNode.setWidth(Math.max(e.scrollWidth,this._contentWidth))}}class OU extends BI{constructor(e){super(e);const t=this._context.configuration.options,i=t.get(165);this._contentLeft=i.contentLeft,this.domNode.setClassName("margin-view-overlays"),this.domNode.setWidth(1),Ot(this.domNode,t.get(59))}onConfigurationChanged(e){const t=this._context.configuration.options;Ot(this.domNode,t.get(59));const i=t.get(165);return this._contentLeft=i.contentLeft,super.onConfigurationChanged(e)||!0}onScrollChanged(e){return super.onScrollChanged(e)||e.scrollHeightChanged}_viewOverlaysRender(e){super._viewOverlaysRender(e);const t=Math.min(e.scrollHeight,1e6);this.domNode.setHeight(t),this.domNode.setWidth(this._contentLeft)}}class um{constructor(e){this.onKeyDown=null,this.onKeyUp=null,this.onContextMenu=null,this.onMouseMove=null,this.onMouseLeave=null,this.onMouseDown=null,this.onMouseUp=null,this.onMouseDrag=null,this.onMouseDrop=null,this.onMouseDropCanceled=null,this.onMouseWheel=null,this._coordinatesConverter=e}emitKeyDown(e){this.onKeyDown?.(e)}emitKeyUp(e){this.onKeyUp?.(e)}emitContextMenu(e){this.onContextMenu?.(this._convertViewToModelMouseEvent(e))}emitMouseMove(e){this.onMouseMove?.(this._convertViewToModelMouseEvent(e))}emitMouseLeave(e){this.onMouseLeave?.(this._convertViewToModelMouseEvent(e))}emitMouseDown(e){this.onMouseDown?.(this._convertViewToModelMouseEvent(e))}emitMouseUp(e){this.onMouseUp?.(this._convertViewToModelMouseEvent(e))}emitMouseDrag(e){this.onMouseDrag?.(this._convertViewToModelMouseEvent(e))}emitMouseDrop(e){this.onMouseDrop?.(this._convertViewToModelMouseEvent(e))}emitMouseDropCanceled(){this.onMouseDropCanceled?.()}emitMouseWheel(e){this.onMouseWheel?.(e)}_convertViewToModelMouseEvent(e){return e.target?{event:e.event,target:this._convertViewToModelMouseTarget(e.target)}:e}_convertViewToModelMouseTarget(e){return um.convertViewToModelMouseTarget(e,this._coordinatesConverter)}static convertViewToModelMouseTarget(e,t){const i={...e};return i.position&&(i.position=t.convertViewPositionToModelPosition(i.position)),i.range&&(i.range=t.convertViewRangeToModelRange(i.range)),(i.type===5||i.type===8)&&(i.detail=this.convertViewToModelViewZoneData(i.detail,t)),i}static convertViewToModelViewZoneData(e,t){return{viewZoneId:e.viewZoneId,positionBefore:e.positionBefore?t.convertViewPositionToModelPosition(e.positionBefore):e.positionBefore,positionAfter:e.positionAfter?t.convertViewPositionToModelPosition(e.positionAfter):e.positionAfter,position:t.convertViewPositionToModelPosition(e.position),afterLineNumber:t.convertViewPositionToModelPosition(new l.Position(e.afterLineNumber,1)).lineNumber}}}class PU extends gi{constructor(e){super(e),this.blocks=[],this.contentWidth=-1,this.contentLeft=0,this.domNode=we(document.createElement("div")),this.domNode.setAttribute("role","presentation"),this.domNode.setAttribute("aria-hidden","true"),this.domNode.setClassName("blockDecorations-container"),this.update()}update(){let e=!1;const i=this._context.configuration.options.get(165),n=i.contentWidth-i.verticalScrollbarWidth;this.contentWidth!==n&&(this.contentWidth=n,e=!0);const s=i.contentLeft;return this.contentLeft!==s&&(this.contentLeft=s,e=!0),e}onConfigurationChanged(e){return this.update()}onScrollChanged(e){return e.scrollTopChanged||e.scrollLeftChanged}onDecorationsChanged(e){return!0}onZonesChanged(e){return!0}prepareRender(e){}render(e){let t=0;const i=e.getDecorationsInViewport();for(const n of i){if(!n.options.blockClassName)continue;let s=this.blocks[t];s||(s=this.blocks[t]=we(document.createElement("div")),this.domNode.appendChild(s));let r,a;n.options.blockIsAfterEnd?(r=e.getVerticalOffsetAfterLineNumber(n.range.endLineNumber,!1),a=e.getVerticalOffsetAfterLineNumber(n.range.endLineNumber,!0)):(r=e.getVerticalOffsetForLineNumber(n.range.startLineNumber,!0),a=n.range.isEmpty()&&!n.options.blockDoesNotCollapse?e.getVerticalOffsetForLineNumber(n.range.startLineNumber,!1):e.getVerticalOffsetAfterLineNumber(n.range.endLineNumber,!0));const[c,h,d,u]=n.options.blockPadding??[0,0,0,0];s.setClassName("blockDecorations-block "+n.options.blockClassName),s.setLeft(this.contentLeft-u),s.setWidth(this.contentWidth+u+h),s.setTop(r-e.scrollTop-c),s.setHeight(a-r+c+d),t++}for(let n=t;n<this.blocks.length;n++)this.blocks[n].domNode.remove();this.blocks.length=t}}class kU extends gi{constructor(e,t){super(e),this._viewDomNode=t,this._widgets={},this.domNode=we(document.createElement("div")),Jn.write(this.domNode,1),this.domNode.setClassName("contentWidgets"),this.domNode.setPosition("absolute"),this.domNode.setTop(0),this.overflowingContentWidgetsDomNode=we(document.createElement("div")),Jn.write(this.overflowingContentWidgetsDomNode,2),this.overflowingContentWidgetsDomNode.setClassName("overflowingContentWidgets")}dispose(){super.dispose(),this._widgets={}}onConfigurationChanged(e){const t=Object.keys(this._widgets);for(const i of t)this._widgets[i].onConfigurationChanged(e);return!0}onDecorationsChanged(e){return!0}onFlushed(e){return!0}onLineMappingChanged(e){return this._updateAnchorsViewPositions(),!0}onLinesChanged(e){return this._updateAnchorsViewPositions(),!0}onLinesDeleted(e){return this._updateAnchorsViewPositions(),!0}onLinesInserted(e){return this._updateAnchorsViewPositions(),!0}onScrollChanged(e){return!0}onZonesChanged(e){return!0}_updateAnchorsViewPositions(){const e=Object.keys(this._widgets);for(const t of e)this._widgets[t].updateAnchorViewPosition()}addWidget(e){const t=new FU(this._context,this._viewDomNode,e);this._widgets[t.id]=t,t.allowEditorOverflow?this.overflowingContentWidgetsDomNode.appendChild(t.domNode):this.domNode.appendChild(t.domNode),this.setShouldRender()}setWidgetPosition(e,t,i,n,s){const r=this._widgets[e.getId()];r.setPosition(t,i,n,s),r.useDisplayNone||this.setShouldRender()}removeWidget(e){const t=e.getId();if(this._widgets.hasOwnProperty(t)){const i=this._widgets[t];delete this._widgets[t];const n=i.domNode.domNode;n.remove(),n.removeAttribute("monaco-visible-content-widget"),this.setShouldRender()}}shouldSuppressMouseDownOnWidget(e){return this._widgets.hasOwnProperty(e)?this._widgets[e].suppressMouseDown:!1}onBeforeRender(e){const t=Object.keys(this._widgets);for(const i of t)this._widgets[i].onBeforeRender(e)}prepareRender(e){const t=Object.keys(this._widgets);for(const i of t)this._widgets[i].prepareRender(e)}render(e){const t=Object.keys(this._widgets);for(const i of t)this._widgets[i].render(e)}}class FU{constructor(e,t,i){this._primaryAnchor=new zd(null,null),this._secondaryAnchor=new zd(null,null),this._context=e,this._viewDomNode=t,this._actual=i;const n=this._context.configuration.options,s=n.get(165),r=n.get(4);this.domNode=we(this._actual.getDomNode()),this.id=this._actual.getId(),this.allowEditorOverflow=(this._actual.allowEditorOverflow||!1)&&r,this.suppressMouseDown=this._actual.suppressMouseDown||!1,this.useDisplayNone=this._actual.useDisplayNone||!1,this._fixedOverflowWidgets=n.get(51),this._contentWidth=s.contentWidth,this._contentLeft=s.contentLeft,this._affinity=null,this._preference=[],this._cachedDomNodeOffsetWidth=-1,this._cachedDomNodeOffsetHeight=-1,this._maxWidth=this._getMaxWidth(),this._isVisible=!1,this._renderData=null,this.domNode.setPosition(this._fixedOverflowWidgets&&this.allowEditorOverflow?"fixed":"absolute"),this.domNode.setDisplay("none"),this.domNode.setVisibility("hidden"),this.domNode.setAttribute("widgetId",this.id),this.domNode.setMaxWidth(this._maxWidth)}onConfigurationChanged(e){const t=this._context.configuration.options;if(e.hasChanged(165)){const i=t.get(165);this._contentLeft=i.contentLeft,this._contentWidth=i.contentWidth,this._maxWidth=this._getMaxWidth()}}updateAnchorViewPosition(){this._setPosition(this._affinity,this._primaryAnchor.modelPosition,this._secondaryAnchor.modelPosition)}_setPosition(e,t,i){this._affinity=e,this._primaryAnchor=n(t,this._context.viewModel,this._affinity),this._secondaryAnchor=n(i,this._context.viewModel,this._affinity);function n(s,r,a){if(!s)return new zd(null,null);const c=r.model.validatePosition(s);if(r.coordinatesConverter.modelPositionIsVisible(c)){const h=r.coordinatesConverter.convertModelPositionToViewPosition(c,a??void 0);return new zd(s,h)}return new zd(s,null)}}_getMaxWidth(){const e=this.domNode.domNode.ownerDocument,t=e.defaultView;return this.allowEditorOverflow?t?.innerWidth||e.documentElement.offsetWidth||e.body.offsetWidth:this._contentWidth}setPosition(e,t,i,n){this._setPosition(n,e,t),this._preference=i,!this.useDisplayNone&&this._primaryAnchor.viewPosition&&this._preference&&this._preference.length>0?this.domNode.setDisplay("block"):this.domNode.setDisplay("none"),this._cachedDomNodeOffsetWidth=-1,this._cachedDomNodeOffsetHeight=-1}_layoutBoxInViewport(e,t,i,n){const s=e.top,r=s,a=e.top+e.height,c=n.viewportHeight-a,h=s-i,d=r>=i,u=a,f=c>=i;let g=e.left;return g+t>n.scrollLeft+n.viewportWidth&&(g=n.scrollLeft+n.viewportWidth-t),g<n.scrollLeft&&(g=n.scrollLeft),{fitsAbove:d,aboveTop:h,fitsBelow:f,belowTop:u,left:g}}_layoutHorizontalSegmentInPage(e,t,i,n){const a=Math.max(15,t.left-n),c=Math.min(t.left+t.width+n,e.width-15),d=this._viewDomNode.domNode.ownerDocument.defaultView;let u=t.left+i-(d?.scrollX??0);if(u+n>c){const f=u-(c-n);u-=f,i-=f}if(u<a){const f=u-a;u-=f,i-=f}return[i,u]}_layoutBoxInPage(e,t,i,n){const s=e.top-i,r=e.top+e.height,a=Qi(this._viewDomNode.domNode),c=this._viewDomNode.domNode.ownerDocument,h=c.defaultView,d=a.top+s-(h?.scrollY??0),u=a.top+r-(h?.scrollY??0),f=Gf(c.body),[g,m]=this._layoutHorizontalSegmentInPage(f,a,e.left-n.scrollLeft+this._contentLeft,t),p=22,b=22,v=d>=p,C=u+i<=f.height-b;return this._fixedOverflowWidgets?{fitsAbove:v,aboveTop:Math.max(d,p),fitsBelow:C,belowTop:u,left:m}:{fitsAbove:v,aboveTop:s,fitsBelow:C,belowTop:r,left:g}}_prepareRenderWidgetAtExactPositionOverflowing(e){return new Vd(e.top,e.left+this._contentLeft)}_getAnchorsCoordinates(e){const t=s(this._primaryAnchor.viewPosition,this._affinity),i=this._secondaryAnchor.viewPosition?.lineNumber===this._primaryAnchor.viewPosition?.lineNumber?this._secondaryAnchor.viewPosition:null,n=s(i,this._affinity);return{primary:t,secondary:n};function s(r,a){if(!r)return null;const c=e.visibleRangeForPosition(r);if(!c)return null;const h=r.column===1&&a===3?0:c.left,d=e.getVerticalOffsetForLineNumber(r.lineNumber)-e.scrollTop,u=e.getLineHeightForLineNumber(r.lineNumber);return new zI(d,h,u)}}_reduceAnchorCoordinates(e,t,i){if(!t)return e;const n=this._context.configuration.options.get(59);let s=t.left;return s<e.left?s=Math.max(s,e.left-i+n.typicalFullwidthCharacterWidth):s=Math.min(s,e.left+i-n.typicalFullwidthCharacterWidth),new zI(e.top,s,e.height)}_prepareRenderWidget(e){if(!this._preference||this._preference.length===0)return null;const{primary:t,secondary:i}=this._getAnchorsCoordinates(e);if(!t)return{kind:"offViewport",preserveFocus:this.domNode.domNode.contains(this.domNode.domNode.ownerDocument.activeElement)};if(this._cachedDomNodeOffsetWidth===-1||this._cachedDomNodeOffsetHeight===-1){let r=null;if(typeof this._actual.beforeRender=="function"&&(r=Vv(this._actual.beforeRender,this._actual)),r)this._cachedDomNodeOffsetWidth=r.width,this._cachedDomNodeOffsetHeight=r.height;else{const c=this.domNode.domNode.getBoundingClientRect();this._cachedDomNodeOffsetWidth=Math.round(c.width),this._cachedDomNodeOffsetHeight=Math.round(c.height)}}const n=this._reduceAnchorCoordinates(t,i,this._cachedDomNodeOffsetWidth);let s;this.allowEditorOverflow?s=this._layoutBoxInPage(n,this._cachedDomNodeOffsetWidth,this._cachedDomNodeOffsetHeight,e):s=this._layoutBoxInViewport(n,this._cachedDomNodeOffsetWidth,this._cachedDomNodeOffsetHeight,e);for(let r=1;r<=2;r++)for(const a of this._preference)if(a===1){if(!s)return null;if(r===2||s.fitsAbove)return{kind:"inViewport",coordinate:new Vd(s.aboveTop,s.left),position:1}}else if(a===2){if(!s)return null;if(r===2||s.fitsBelow)return{kind:"inViewport",coordinate:new Vd(s.belowTop,s.left),position:2}}else return this.allowEditorOverflow?{kind:"inViewport",coordinate:this._prepareRenderWidgetAtExactPositionOverflowing(new Vd(n.top,n.left)),position:0}:{kind:"inViewport",coordinate:new Vd(n.top,n.left),position:0};return null}onBeforeRender(e){!this._primaryAnchor.viewPosition||!this._preference||this._primaryAnchor.viewPosition.lineNumber<e.startLineNumber||this._primaryAnchor.viewPosition.lineNumber>e.endLineNumber||this.domNode.setMaxWidth(this._maxWidth)}prepareRender(e){this._renderData=this._prepareRenderWidget(e)}render(e){if(!this._renderData||this._renderData.kind==="offViewport"){this._isVisible&&(this.domNode.removeAttribute("monaco-visible-content-widget"),this._isVisible=!1,this._renderData?.kind==="offViewport"&&this._renderData.preserveFocus?this.domNode.setTop(-1e3):this.domNode.setVisibility("hidden")),typeof this._actual.afterRender=="function"&&Vv(this._actual.afterRender,this._actual,null,null);return}this.allowEditorOverflow?(this.domNode.setTop(this._renderData.coordinate.top),this.domNode.setLeft(this._renderData.coordinate.left)):(this.domNode.setTop(this._renderData.coordinate.top+e.scrollTop-e.bigNumbersDelta),this.domNode.setLeft(this._renderData.coordinate.left)),this._isVisible||(this.domNode.setVisibility("inherit"),this.domNode.setAttribute("monaco-visible-content-widget","true"),this._isVisible=!0),typeof this._actual.afterRender=="function"&&Vv(this._actual.afterRender,this._actual,this._renderData.position,this._renderData.coordinate)}}class zd{constructor(e,t){this.modelPosition=e,this.viewPosition=t}}class Vd{constructor(e,t){this.top=e,this.left=t,this._coordinateBrand=void 0}}class zI{constructor(e,t,i){this.top=e,this.left=t,this.height=i,this._anchorCoordinateBrand=void 0}}function Vv(o,e,...t){try{return o.call(e,...t)}catch{return null}}class hr extends ma{}const _i=le("themeService");function La(o){return{id:o}}function Uv(o){switch(o){case Sn.DARK:return cc.VS_DARK;case Sn.HIGH_CONTRAST_DARK:return cc.HC_BLACK;case Sn.HIGH_CONTRAST_LIGHT:return cc.HC_LIGHT;default:return cc.VS}}const VI={ThemingContribution:"base.contributions.theming"};class BU extends l.Disposable{constructor(){super(),this.themingParticipants=[],this.themingParticipants=[],this.onThemingParticipantAddedEmitter=this._register(new l.Emitter)}onColorThemeChange(e){return this.themingParticipants.push(e),this.onThemingParticipantAddedEmitter.fire(e),l.toDisposable(()=>{const t=this.themingParticipants.indexOf(e);this.themingParticipants.splice(t,1)})}getThemingParticipants(){return this.themingParticipants}}const UI=new BU;St.add(VI.ThemingContribution,UI);function vs(o){return UI.onColorThemeChange(o)}class zU extends l.Disposable{constructor(e){super(),this.themeService=e,this.theme=e.getColorTheme(),this._register(this.themeService.onDidColorThemeChange(t=>this.onThemeChange(t)))}onThemeChange(e){this.theme=e,this.updateStyles()}updateStyles(){}}const $v=E("editor.lineHighlightBackground",null,l.localize(641,"Background color for the highlight of line at the cursor position.")),VU=E("editor.inactiveLineHighlightBackground",$v,l.localize(642,"Background color for the highlight of line at the cursor position when the editor is not focused.")),$I=E("editor.lineHighlightBorder",{dark:"#282828",light:"#eeeeee",hcDark:"#f38518",hcLight:pe},l.localize(643,"Background color for the border around the line at the cursor position."));E("editor.rangeHighlightBackground",{dark:"#ffffff0b",light:"#fdff0033",hcDark:null,hcLight:null},l.localize(644,"Background color of highlighted ranges, like by quick open and find features. The color must not be opaque so as not to hide underlying decorations."),!0),E("editor.rangeHighlightBorder",{dark:null,light:null,hcDark:ot,hcLight:ot},l.localize(645,"Background color of the border around highlighted ranges.")),E("editor.symbolHighlightBackground",{dark:Cs,light:Cs,hcDark:null,hcLight:null},l.localize(646,"Background color of highlighted symbol, like for go to definition or go next/previous symbol. The color must not be opaque so as not to hide underlying decorations."),!0),E("editor.symbolHighlightBorder",{dark:null,light:null,hcDark:ot,hcLight:ot},l.localize(647,"Background color of the border around highlighted symbols."));const fm=E("editorCursor.foreground",{dark:"#AEAFAD",light:l.Color.black,hcDark:l.Color.white,hcLight:"#0F4A85"},l.localize(648,"Color of the editor cursor.")),Kv=E("editorCursor.background",null,l.localize(649,"The background color of the editor cursor. Allows customizing the color of a character overlapped by a block cursor.")),KI=E("editorMultiCursor.primary.foreground",fm,l.localize(650,"Color of the primary editor cursor when multiple cursors are present.")),UU=E("editorMultiCursor.primary.background",Kv,l.localize(651,"The background color of the primary editor cursor when multiple cursors are present. Allows customizing the color of a character overlapped by a block cursor.")),GI=E("editorMultiCursor.secondary.foreground",fm,l.localize(652,"Color of secondary editor cursors when multiple cursors are present.")),$U=E("editorMultiCursor.secondary.background",Kv,l.localize(653,"The background color of secondary editor cursors when multiple cursors are present. Allows customizing the color of a character overlapped by a block cursor.")),Gv=E("editorWhitespace.foreground",{dark:"#e3e4e229",light:"#33333333",hcDark:"#e3e4e229",hcLight:"#CCCCCC"},l.localize(654,"Color of whitespace characters in the editor.")),KU=E("editorLineNumber.foreground",{dark:"#858585",light:"#237893",hcDark:l.Color.white,hcLight:"#292929"},l.localize(655,"Color of editor line numbers.")),GU=E("editorIndentGuide.background",Gv,l.localize(656,"Color of the editor indentation guides."),!1,l.localize(657,"'editorIndentGuide.background' is deprecated. Use 'editorIndentGuide.background1' instead.")),jU=E("editorIndentGuide.activeBackground",Gv,l.localize(658,"Color of the active editor indentation guides."),!1,l.localize(659,"'editorIndentGuide.activeBackground' is deprecated. Use 'editorIndentGuide.activeBackground1' instead.")),Ud=E("editorIndentGuide.background1",GU,l.localize(660,"Color of the editor indentation guides (1).")),qU=E("editorIndentGuide.background2","#00000000",l.localize(661,"Color of the editor indentation guides (2).")),YU=E("editorIndentGuide.background3","#00000000",l.localize(662,"Color of the editor indentation guides (3).")),ZU=E("editorIndentGuide.background4","#00000000",l.localize(663,"Color of the editor indentation guides (4).")),QU=E("editorIndentGuide.background5","#00000000",l.localize(664,"Color of the editor indentation guides (5).")),XU=E("editorIndentGuide.background6","#00000000",l.localize(665,"Color of the editor indentation guides (6).")),$d=E("editorIndentGuide.activeBackground1",jU,l.localize(666,"Color of the active editor indentation guides (1).")),JU=E("editorIndentGuide.activeBackground2","#00000000",l.localize(667,"Color of the active editor indentation guides (2).")),WU=E("editorIndentGuide.activeBackground3","#00000000",l.localize(668,"Color of the active editor indentation guides (3).")),HU=E("editorIndentGuide.activeBackground4","#00000000",l.localize(669,"Color of the active editor indentation guides (4).")),e$=E("editorIndentGuide.activeBackground5","#00000000",l.localize(670,"Color of the active editor indentation guides (5).")),t$=E("editorIndentGuide.activeBackground6","#00000000",l.localize(671,"Color of the active editor indentation guides (6).")),i$=E("editorActiveLineNumber.foreground",{dark:"#c6c6c6",light:"#0B216F",hcDark:ot,hcLight:ot},l.localize(672,"Color of editor active line number"),!1,l.localize(673,"Id is deprecated. Use 'editorLineNumber.activeForeground' instead."));E("editorLineNumber.activeForeground",i$,l.localize(674,"Color of editor active line number"));const n$=E("editorLineNumber.dimmedForeground",null,l.localize(675,"Color of the final editor line when editor.renderFinalNewline is set to dimmed.")),s$=E("editorRuler.foreground",{dark:"#5A5A5A",light:l.Color.lightgrey,hcDark:l.Color.white,hcLight:"#292929"},l.localize(676,"Color of the editor rulers."));E("editorCodeLens.foreground",{dark:"#999999",light:"#919191",hcDark:"#999999",hcLight:"#292929"},l.localize(677,"Foreground color of editor CodeLens")),E("editorBracketMatch.background",{dark:"#0064001a",light:"#0064001a",hcDark:"#0064001a",hcLight:"#0000"},l.localize(678,"Background color behind matching brackets")),E("editorBracketMatch.border",{dark:"#888",light:"#B9B9B9",hcDark:pe,hcLight:pe},l.localize(679,"Color for matching brackets boxes"));const o$=E("editorBracketMatch.foreground",null,l.localize(680,"Foreground color for matching brackets")),r$=E("editorOverviewRuler.border",{dark:"#7f7f7f4d",light:"#7f7f7f4d",hcDark:"#7f7f7f4d",hcLight:"#666666"},l.localize(681,"Color of the overview ruler border.")),a$=E("editorOverviewRuler.background",null,l.localize(682,"Background color of the editor overview ruler."));E("editorGutter.background",vn,l.localize(683,"Background color of the editor gutter. The gutter contains the glyph margins and the line numbers.")),E("editorUnnecessaryCode.border",{dark:null,light:null,hcDark:l.Color.fromHex("#fff").transparent(.8),hcLight:pe},l.localize(684,"Border color of unnecessary (unused) source code in the editor."));const l$=E("editorUnnecessaryCode.opacity",{dark:l.Color.fromHex("#000a"),light:l.Color.fromHex("#0007"),hcDark:null,hcLight:null},l.localize(685,`Opacity of unnecessary (unused) source code in the editor. For example, "#000000c0" will render the code with 75% opacity. For high contrast themes, use the 'editorUnnecessaryCode.border' theme color to underline unnecessary code instead of fading it out.`));E("editorGhostText.border",{dark:null,light:null,hcDark:l.Color.fromHex("#fff").transparent(.8),hcLight:l.Color.fromHex("#292929").transparent(.8)},l.localize(686,"Border color of ghost text in the editor."));const c$=E("editorGhostText.foreground",{dark:l.Color.fromHex("#ffffff56"),light:l.Color.fromHex("#0007"),hcDark:null,hcLight:null},l.localize(687,"Foreground color of the ghost text in the editor."));E("editorGhostText.background",null,l.localize(688,"Background color of the ghost text in the editor."));const h$=new l.Color(new l.RGBA(0,122,204,.6)),d$=E("editorOverviewRuler.rangeHighlightForeground",h$,l.localize(689,"Overview ruler marker color for range highlights. The color must not be opaque so as not to hide underlying decorations."),!0),u$=E("editorOverviewRuler.errorForeground",{dark:new l.Color(new l.RGBA(255,18,18,.7)),light:new l.Color(new l.RGBA(255,18,18,.7)),hcDark:new l.Color(new l.RGBA(255,50,50,1)),hcLight:"#B5200D"},l.localize(690,"Overview ruler marker color for errors.")),f$=E("editorOverviewRuler.warningForeground",{dark:ho,light:ho,hcDark:Ed,hcLight:Ed},l.localize(691,"Overview ruler marker color for warnings.")),g$=E("editorOverviewRuler.infoForeground",{dark:nr,light:nr,hcDark:Id,hcLight:Id},l.localize(692,"Overview ruler marker color for infos.")),jI=E("editorBracketHighlight.foreground1",{dark:"#FFD700",light:"#0431FAFF",hcDark:"#FFD700",hcLight:"#0431FAFF"},l.localize(693,"Foreground color of brackets (1). Requires enabling bracket pair colorization.")),qI=E("editorBracketHighlight.foreground2",{dark:"#DA70D6",light:"#319331FF",hcDark:"#DA70D6",hcLight:"#319331FF"},l.localize(694,"Foreground color of brackets (2). Requires enabling bracket pair colorization.")),YI=E("editorBracketHighlight.foreground3",{dark:"#179FFF",light:"#7B3814FF",hcDark:"#87CEFA",hcLight:"#7B3814FF"},l.localize(695,"Foreground color of brackets (3). Requires enabling bracket pair colorization.")),ZI=E("editorBracketHighlight.foreground4","#00000000",l.localize(696,"Foreground color of brackets (4). Requires enabling bracket pair colorization.")),QI=E("editorBracketHighlight.foreground5","#00000000",l.localize(697,"Foreground color of brackets (5). Requires enabling bracket pair colorization.")),XI=E("editorBracketHighlight.foreground6","#00000000",l.localize(698,"Foreground color of brackets (6). Requires enabling bracket pair colorization.")),m$=E("editorBracketHighlight.unexpectedBracket.foreground",{dark:new l.Color(new l.RGBA(255,18,18,.8)),light:new l.Color(new l.RGBA(255,18,18,.8)),hcDark:new l.Color(new l.RGBA(255,50,50,1)),hcLight:"#B5200D"},l.localize(699,"Foreground color of unexpected brackets.")),p$=E("editorBracketPairGuide.background1","#00000000",l.localize(700,"Background color of inactive bracket pair guides (1). Requires enabling bracket pair guides.")),_$=E("editorBracketPairGuide.background2","#00000000",l.localize(701,"Background color of inactive bracket pair guides (2). Requires enabling bracket pair guides.")),b$=E("editorBracketPairGuide.background3","#00000000",l.localize(702,"Background color of inactive bracket pair guides (3). Requires enabling bracket pair guides.")),C$=E("editorBracketPairGuide.background4","#00000000",l.localize(703,"Background color of inactive bracket pair guides (4). Requires enabling bracket pair guides.")),v$=E("editorBracketPairGuide.background5","#00000000",l.localize(704,"Background color of inactive bracket pair guides (5). Requires enabling bracket pair guides.")),w$=E("editorBracketPairGuide.background6","#00000000",l.localize(705,"Background color of inactive bracket pair guides (6). Requires enabling bracket pair guides.")),S$=E("editorBracketPairGuide.activeBackground1","#00000000",l.localize(706,"Background color of active bracket pair guides (1). Requires enabling bracket pair guides.")),y$=E("editorBracketPairGuide.activeBackground2","#00000000",l.localize(707,"Background color of active bracket pair guides (2). Requires enabling bracket pair guides.")),L$=E("editorBracketPairGuide.activeBackground3","#00000000",l.localize(708,"Background color of active bracket pair guides (3). Requires enabling bracket pair guides.")),D$=E("editorBracketPairGuide.activeBackground4","#00000000",l.localize(709,"Background color of active bracket pair guides (4). Requires enabling bracket pair guides.")),x$=E("editorBracketPairGuide.activeBackground5","#00000000",l.localize(710,"Background color of active bracket pair guides (5). Requires enabling bracket pair guides.")),E$=E("editorBracketPairGuide.activeBackground6","#00000000",l.localize(711,"Background color of active bracket pair guides (6). Requires enabling bracket pair guides."));E("editorUnicodeHighlight.border",ho,l.localize(712,"Border color used to highlight unicode characters.")),E("editorUnicodeHighlight.background",SV,l.localize(713,"Background color used to highlight unicode characters.")),vs((o,e)=>{const t=o.getColor(vn),i=o.getColor($v),n=i&&!i.isTransparent()?i:t;n&&e.addRule(`.monaco-editor .inputarea.ime-input { background-color: ${n}; }`)});class JI extends hr{constructor(e){super(),this._context=e;const t=this._context.configuration.options,i=t.get(165);this._renderLineHighlight=t.get(110),this._renderLineHighlightOnlyWhenFocus=t.get(111),this._wordWrap=i.isViewportWrapping,this._contentLeft=i.contentLeft,this._contentWidth=i.contentWidth,this._selectionIsEmpty=!0,this._focused=!1,this._cursorLineNumbers=[1],this._selections=[new l.Selection(1,1,1,1)],this._renderData=null,this._context.addEventHandler(this)}dispose(){this._context.removeEventHandler(this),super.dispose()}_readFromSelections(){let e=!1;const t=new Set;for(const s of this._selections)t.add(s.positionLineNumber);const i=Array.from(t);i.sort((s,r)=>s-r),l.equals(this._cursorLineNumbers,i)||(this._cursorLineNumbers=i,e=!0);const n=this._selections.every(s=>s.isEmpty());return this._selectionIsEmpty!==n&&(this._selectionIsEmpty=n,e=!0),e}onThemeChanged(e){return this._readFromSelections()}onConfigurationChanged(e){const t=this._context.configuration.options,i=t.get(165);return this._renderLineHighlight=t.get(110),this._renderLineHighlightOnlyWhenFocus=t.get(111),this._wordWrap=i.isViewportWrapping,this._contentLeft=i.contentLeft,this._contentWidth=i.contentWidth,!0}onCursorStateChanged(e){return this._selections=e.selections,this._readFromSelections()}onFlushed(e){return!0}onLinesDeleted(e){return!0}onLinesInserted(e){return!0}onScrollChanged(e){return e.scrollWidthChanged||e.scrollTopChanged}onZonesChanged(e){return!0}onFocusChanged(e){return this._renderLineHighlightOnlyWhenFocus?(this._focused=e.isFocused,!0):!1}prepareRender(e){if(!this._shouldRenderThis()){this._renderData=null;return}const t=e.visibleRange.startLineNumber,i=e.visibleRange.endLineNumber,n=[];for(let r=t;r<=i;r++){const a=r-t;n[a]=""}if(this._wordWrap){const r=this._renderOne(e,!1);for(const a of this._cursorLineNumbers){const c=this._context.viewModel.coordinatesConverter,h=c.convertViewPositionToModelPosition(new l.Position(a,1)).lineNumber,d=c.convertModelPositionToViewPosition(new l.Position(h,1)).lineNumber,u=c.convertModelPositionToViewPosition(new l.Position(h,this._context.viewModel.model.getLineMaxColumn(h))).lineNumber,f=Math.max(d,t),g=Math.min(u,i);for(let m=f;m<=g;m++){const p=m-t;n[p]=r}}}const s=this._renderOne(e,!0);for(const r of this._cursorLineNumbers){if(r<t||r>i)continue;const a=r-t;n[a]=s}this._renderData=n}render(e,t){if(!this._renderData)return"";const i=t-e;return i>=this._renderData.length?"":this._renderData[i]}_shouldRenderInMargin(){return(this._renderLineHighlight==="gutter"||this._renderLineHighlight==="all")&&(!this._renderLineHighlightOnlyWhenFocus||this._focused)}_shouldRenderInContent(){return(this._renderLineHighlight==="line"||this._renderLineHighlight==="all")&&this._selectionIsEmpty&&(!this._renderLineHighlightOnlyWhenFocus||this._focused)}}class I$ extends JI{_renderOne(e,t){return`<div class="${"current-line"+(this._shouldRenderInMargin()?" current-line-both":"")+(t?" current-line-exact":"")}" style="width:${Math.max(e.scrollWidth,this._contentWidth)}px;"></div>`}_shouldRenderThis(){return this._shouldRenderInContent()}_shouldRenderOther(){return this._shouldRenderInMargin()}}class T$ extends JI{_renderOne(e,t){return`<div class="${"current-line"+(this._shouldRenderInMargin()?" current-line-margin":"")+(this._shouldRenderOther()?" current-line-margin-both":"")+(this._shouldRenderInMargin()&&t?" current-line-exact-margin":"")}" style="width:${this._contentLeft}px"></div>`}_shouldRenderThis(){return!0}_shouldRenderOther(){return this._shouldRenderInContent()}}vs((o,e)=>{const t=o.getColor($v),i=o.getColor(VU);if(t&&(e.addRule(`.monaco-editor.focused .view-overlays .current-line { background-color: ${t}; }`),e.addRule(`.monaco-editor.focused .margin-view-overlays .current-line-margin { background-color: ${t}; border: none; }`)),i&&(e.addRule(`.monaco-editor .view-overlays .current-line { background-color: ${i}; }`),e.addRule(`.monaco-editor .margin-view-overlays .current-line-margin { background-color: ${i}; border: none; }`)),!t||t.isTransparent()||o.defines($I)){const n=o.getColor($I);n&&(e.addRule(`.monaco-editor .view-overlays .current-line-exact { border: 2px solid ${n}; }`),e.addRule(`.monaco-editor .margin-view-overlays .current-line-exact-margin { border: 2px solid ${n}; }`),pa(o.type)&&(e.addRule(".monaco-editor .view-overlays .current-line-exact { border-width: 1px; }"),e.addRule(".monaco-editor .margin-view-overlays .current-line-exact-margin { border-width: 1px; }")))}});class N$ extends hr{constructor(e){super(),this._context=e;const t=this._context.configuration.options;this._typicalHalfwidthCharacterWidth=t.get(59).typicalHalfwidthCharacterWidth,this._renderResult=null,this._context.addEventHandler(this)}dispose(){this._context.removeEventHandler(this),this._renderResult=null,super.dispose()}onConfigurationChanged(e){const t=this._context.configuration.options;return this._typicalHalfwidthCharacterWidth=t.get(59).typicalHalfwidthCharacterWidth,!0}onDecorationsChanged(e){return!0}onFlushed(e){return!0}onLinesChanged(e){return!0}onLinesDeleted(e){return!0}onLinesInserted(e){return!0}onScrollChanged(e){return e.scrollTopChanged||e.scrollWidthChanged}onZonesChanged(e){return!0}prepareRender(e){const t=e.getDecorationsInViewport();let i=[],n=0;for(let c=0,h=t.length;c<h;c++){const d=t[c];d.options.className&&(i[n++]=d)}i=i.sort((c,h)=>{if(c.options.zIndex<h.options.zIndex)return-1;if(c.options.zIndex>h.options.zIndex)return 1;const d=c.options.className,u=h.options.className;return d<u?-1:d>u?1:l.Range.compareRangesUsingStarts(c.range,h.range)});const s=e.visibleRange.startLineNumber,r=e.visibleRange.endLineNumber,a=[];for(let c=s;c<=r;c++){const h=c-s;a[h]=""}this._renderWholeLineDecorations(e,i,a),this._renderNormalDecorations(e,i,a),this._renderResult=a}_renderWholeLineDecorations(e,t,i){const n=e.visibleRange.startLineNumber,s=e.visibleRange.endLineNumber;for(let r=0,a=t.length;r<a;r++){const c=t[r];if(!c.options.isWholeLine)continue;const h='<div class="cdr '+c.options.className+'" style="left:0;width:100%;"></div>',d=Math.max(c.range.startLineNumber,n),u=Math.min(c.range.endLineNumber,s);for(let f=d;f<=u;f++){const g=f-n;i[g]+=h}}}_renderNormalDecorations(e,t,i){const n=e.visibleRange.startLineNumber;let s=null,r=!1,a=null,c=!1;for(let h=0,d=t.length;h<d;h++){const u=t[h];if(u.options.isWholeLine)continue;const f=u.options.className,g=!!u.options.showIfCollapsed;let m=u.range;if(g&&m.endColumn===1&&m.endLineNumber!==m.startLineNumber&&(m=new l.Range(m.startLineNumber,m.startColumn,m.endLineNumber-1,this._context.viewModel.getLineMaxColumn(m.endLineNumber-1))),s===f&&r===g&&l.Range.areIntersectingOrTouching(a,m)){a=l.Range.plusRange(a,m);continue}s!==null&&this._renderNormalDecoration(e,a,s,c,r,n,i),s=f,r=g,a=m,c=u.options.shouldFillLineOnLineBreak??!1}s!==null&&this._renderNormalDecoration(e,a,s,c,r,n,i)}_renderNormalDecoration(e,t,i,n,s,r,a){const c=e.linesVisibleRangesForRange(t,i==="findMatch");if(c)for(let h=0,d=c.length;h<d;h++){const u=c[h];if(u.outsideRenderedLine)continue;const f=u.lineNumber-r;if(s&&u.ranges.length===1){const g=u.ranges[0];if(g.width<this._typicalHalfwidthCharacterWidth){const m=Math.round(g.left+g.width/2),p=Math.max(0,Math.round(m-this._typicalHalfwidthCharacterWidth/2));u.ranges[0]=new Pd(p,this._typicalHalfwidthCharacterWidth)}}for(let g=0,m=u.ranges.length;g<m;g++){const p=n&&u.continuesOnNextLine&&m===1,b=u.ranges[g],v='<div class="cdr '+i+'" style="left:'+String(b.left)+"px;width:"+(p?"100%;":String(b.width)+"px;")+'"></div>';a[f]+=v}}}render(e,t){if(!this._renderResult)return"";const i=t-e;return i<0||i>=this._renderResult.length?"":this._renderResult[i]}}class R$ extends gi{constructor(e,t,i,n){super(e);const s=this._context.configuration.options,r=s.get(117),a=s.get(83),c=s.get(49),h=s.get(120),d=s.get(158),u={listenOnDomNode:i.domNode,className:"editor-scrollable "+Uv(e.theme.type),useShadows:!1,lazyRender:!0,vertical:r.vertical,horizontal:r.horizontal,verticalHasArrows:r.verticalHasArrows,horizontalHasArrows:r.horizontalHasArrows,verticalScrollbarSize:r.verticalScrollbarSize,verticalSliderSize:r.verticalSliderSize,horizontalScrollbarSize:r.horizontalScrollbarSize,horizontalSliderSize:r.horizontalSliderSize,handleMouseWheel:r.handleMouseWheel,alwaysConsumeMouseWheel:r.alwaysConsumeMouseWheel,arrowSize:r.arrowSize,mouseWheelScrollSensitivity:a,fastScrollSensitivity:c,scrollPredominantAxis:h,scrollByPage:r.scrollByPage,inertialScroll:d};this.scrollbar=this._register(new Xg(t.domNode,u,this._context.viewLayout.getScrollable())),Jn.write(this.scrollbar.getDomNode(),6),this.scrollbarDomNode=we(this.scrollbar.getDomNode()),this.scrollbarDomNode.setPosition("absolute"),this._setLayout();const f=(g,m,p)=>{const b={};{const v=g.scrollTop;v&&(b.scrollTop=this._context.viewLayout.getCurrentScrollTop()+v,g.scrollTop=0)}if(p){const v=g.scrollLeft;v&&(b.scrollLeft=this._context.viewLayout.getCurrentScrollLeft()+v,g.scrollLeft=0)}this._context.viewModel.viewLayout.setScrollPosition(b,1)};this._register(R(i.domNode,"scroll",g=>f(i.domNode,!0,!0))),this._register(R(t.domNode,"scroll",g=>f(t.domNode,!0,!1))),this._register(R(n.domNode,"scroll",g=>f(n.domNode,!0,!1))),this._register(R(this.scrollbarDomNode.domNode,"scroll",g=>f(this.scrollbarDomNode.domNode,!0,!1)))}_setLayout(){const e=this._context.configuration.options,t=e.get(165);this.scrollbarDomNode.setLeft(t.contentLeft),e.get(81).side==="right"?this.scrollbarDomNode.setWidth(t.contentWidth+t.minimap.minimapWidth):this.scrollbarDomNode.setWidth(t.contentWidth),this.scrollbarDomNode.setHeight(t.height)}getOverviewRulerLayoutInfo(){return this.scrollbar.getOverviewRulerLayoutInfo()}getDomNode(){return this.scrollbarDomNode}delegateVerticalScrollbarPointerDown(e){this.scrollbar.delegateVerticalScrollbarPointerDown(e)}delegateScrollFromMouseWheelEvent(e){this.scrollbar.delegateScrollFromMouseWheelEvent(e)}onConfigurationChanged(e){if(e.hasChanged(117)||e.hasChanged(83)||e.hasChanged(49)){const t=this._context.configuration.options,i=t.get(117),n=t.get(83),s=t.get(49),r=t.get(120),a={vertical:i.vertical,horizontal:i.horizontal,verticalScrollbarSize:i.verticalScrollbarSize,horizontalScrollbarSize:i.horizontalScrollbarSize,scrollByPage:i.scrollByPage,handleMouseWheel:i.handleMouseWheel,mouseWheelScrollSensitivity:n,fastScrollSensitivity:s,scrollPredominantAxis:r};this.scrollbar.updateOptions(a)}return e.hasChanged(165)&&this._setLayout(),!0}onScrollChanged(e){return!0}onThemeChanged(e){return this.scrollbar.updateClassName("editor-scrollable "+Uv(this._context.theme.type)),!0}prepareRender(e){}render(e){this.scrollbar.renderNow()}}class jv{constructor(e,t,i,n,s){this.startLineNumber=e,this.endLineNumber=t,this.className=i,this.tooltip=n,this._decorationToRenderBrand=void 0,this.zIndex=s??0}}class M${constructor(e,t,i){this.className=e,this.zIndex=t,this.tooltip=i}}class A${constructor(){this.decorations=[]}add(e){this.decorations.push(e)}getDecorations(){return this.decorations}}class WI extends hr{_render(e,t,i){const n=[];for(let a=e;a<=t;a++){const c=a-e;n[c]=new A$}if(i.length===0)return n;i.sort((a,c)=>a.className===c.className?a.startLineNumber===c.startLineNumber?a.endLineNumber-c.endLineNumber:a.startLineNumber-c.startLineNumber:a.className<c.className?-1:1);let s=null,r=0;for(const a of i){const c=a.className,h=a.zIndex;let d=Math.max(a.startLineNumber,e)-e;const u=Math.min(a.endLineNumber,t)-e;s===c?(d=Math.max(r+1,d),r=Math.max(r,u)):(s=c,r=u);for(let f=d;f<=r;f++)n[f].add(new M$(c,h,a.tooltip))}return n}}class O$ extends gi{constructor(e){super(e),this._widgets={},this._context=e;const t=this._context.configuration.options,i=t.get(165);this.domNode=we(document.createElement("div")),this.domNode.setClassName("glyph-margin-widgets"),this.domNode.setPosition("absolute"),this.domNode.setTop(0),this._lineHeight=t.get(75),this._glyphMargin=t.get(66),this._glyphMarginLeft=i.glyphMarginLeft,this._glyphMarginWidth=i.glyphMarginWidth,this._glyphMarginDecorationLaneCount=i.glyphMarginDecorationLaneCount,this._managedDomNodes=[],this._decorationGlyphsToRender=[]}dispose(){this._managedDomNodes=[],this._decorationGlyphsToRender=[],this._widgets={},super.dispose()}getWidgets(){return Object.values(this._widgets)}onConfigurationChanged(e){const t=this._context.configuration.options,i=t.get(165);return this._lineHeight=t.get(75),this._glyphMargin=t.get(66),this._glyphMarginLeft=i.glyphMarginLeft,this._glyphMarginWidth=i.glyphMarginWidth,this._glyphMarginDecorationLaneCount=i.glyphMarginDecorationLaneCount,!0}onDecorationsChanged(e){return!0}onFlushed(e){return!0}onLinesChanged(e){return!0}onLinesDeleted(e){return!0}onLinesInserted(e){return!0}onScrollChanged(e){return e.scrollTopChanged}onZonesChanged(e){return!0}addWidget(e){const t=we(e.getDomNode());this._widgets[e.getId()]={widget:e,preference:e.getPosition(),domNode:t,renderInfo:null},t.setPosition("absolute"),t.setDisplay("none"),t.setAttribute("widgetId",e.getId()),this.domNode.appendChild(t),this.setShouldRender()}setWidgetPosition(e,t){const i=this._widgets[e.getId()];return i.preference.lane===t.lane&&i.preference.zIndex===t.zIndex&&l.Range.equalsRange(i.preference.range,t.range)?!1:(i.preference=t,this.setShouldRender(),!0)}removeWidget(e){const t=e.getId();if(this._widgets[t]){const n=this._widgets[t].domNode.domNode;delete this._widgets[t],n.remove(),this.setShouldRender()}}_collectDecorationBasedGlyphRenderRequest(e,t){const i=e.visibleRange.startLineNumber,n=e.visibleRange.endLineNumber,s=e.getDecorationsInViewport();for(const r of s){const a=r.options.glyphMarginClassName;if(!a)continue;const c=Math.max(r.range.startLineNumber,i),h=Math.min(r.range.endLineNumber,n),d=r.options.glyphMargin?.position??l.GlyphMarginLane.Center,u=r.options.zIndex??0;for(let f=c;f<=h;f++){const g=this._context.viewModel.coordinatesConverter.convertViewPositionToModelPosition(new l.Position(f,0)),m=this._context.viewModel.glyphLanes.getLanesAtLine(g.lineNumber).indexOf(d);t.push(new P$(f,m,u,a))}}}_collectWidgetBasedGlyphRenderRequest(e,t){const i=e.visibleRange.startLineNumber,n=e.visibleRange.endLineNumber;for(const s of Object.values(this._widgets)){const r=s.preference.range,{startLineNumber:a,endLineNumber:c}=this._context.viewModel.coordinatesConverter.convertModelRangeToViewRange(l.Range.lift(r));if(!a||!c||c<i||a>n)continue;const h=Math.max(a,i),d=this._context.viewModel.coordinatesConverter.convertViewPositionToModelPosition(new l.Position(h,0)),u=this._context.viewModel.glyphLanes.getLanesAtLine(d.lineNumber).indexOf(s.preference.lane);t.push(new k$(h,u,s.preference.zIndex,s))}}_collectSortedGlyphRenderRequests(e){const t=[];return this._collectDecorationBasedGlyphRenderRequest(e,t),this._collectWidgetBasedGlyphRenderRequest(e,t),t.sort((i,n)=>i.lineNumber===n.lineNumber?i.laneIndex===n.laneIndex?i.zIndex===n.zIndex?n.type===i.type?i.type===0&&n.type===0?i.className<n.className?-1:1:0:n.type-i.type:n.zIndex-i.zIndex:i.laneIndex-n.laneIndex:i.lineNumber-n.lineNumber),t}prepareRender(e){if(!this._glyphMargin){this._decorationGlyphsToRender=[];return}for(const n of Object.values(this._widgets))n.renderInfo=null;const t=new l.ArrayQueue(this._collectSortedGlyphRenderRequests(e)),i=[];for(;t.length>0;){const n=t.peek();if(!n)break;const s=t.takeWhile(a=>a.lineNumber===n.lineNumber&&a.laneIndex===n.laneIndex);if(!s||s.length===0)break;const r=s[0];if(r.type===0){const a=[];for(const c of s){if(c.zIndex!==r.zIndex||c.type!==r.type)break;(a.length===0||a[a.length-1]!==c.className)&&a.push(c.className)}i.push(r.accept(a.join(" ")))}else r.widget.renderInfo={lineNumber:r.lineNumber,laneIndex:r.laneIndex}}this._decorationGlyphsToRender=i}render(e){if(!this._glyphMargin){for(const i of Object.values(this._widgets))i.domNode.setDisplay("none");for(;this._managedDomNodes.length>0;)this._managedDomNodes.pop()?.domNode.remove();return}const t=Math.round(this._glyphMarginWidth/this._glyphMarginDecorationLaneCount);for(const i of Object.values(this._widgets))if(!i.renderInfo)i.domNode.setDisplay("none");else{const n=e.viewportData.relativeVerticalOffset[i.renderInfo.lineNumber-e.viewportData.startLineNumber],s=this._glyphMarginLeft+i.renderInfo.laneIndex*this._lineHeight;i.domNode.setDisplay("block"),i.domNode.setTop(n),i.domNode.setLeft(s),i.domNode.setWidth(t),i.domNode.setHeight(this._lineHeight)}for(let i=0;i<this._decorationGlyphsToRender.length;i++){const n=this._decorationGlyphsToRender[i],s=n.lineNumber,r=e.viewportData.relativeVerticalOffset[s-e.viewportData.startLineNumber],a=this._glyphMarginLeft+n.laneIndex*this._lineHeight;let c;i<this._managedDomNodes.length?c=this._managedDomNodes[i]:(c=we(document.createElement("div")),this._managedDomNodes.push(c),this.domNode.appendChild(c));const h=this._context.viewLayout.getLineHeightForLineNumber(s);c.setClassName("cgmr codicon "+n.combinedClassName),c.setPosition("absolute"),c.setTop(r),c.setLeft(a),c.setWidth(t),c.setHeight(h)}for(;this._managedDomNodes.length>this._decorationGlyphsToRender.length;)this._managedDomNodes.pop()?.domNode.remove()}}class P${constructor(e,t,i,n){this.lineNumber=e,this.laneIndex=t,this.zIndex=i,this.className=n,this.type=0}accept(e){return new F$(this.lineNumber,this.laneIndex,e)}}class k${constructor(e,t,i,n){this.lineNumber=e,this.laneIndex=t,this.zIndex=i,this.widget=n,this.type=1}}class F${constructor(e,t,i){this.lineNumber=e,this.laneIndex=t,this.combinedClassName=i}}class HI extends l.Disposable{constructor(){super(...arguments),this._isDisposed=!1}dispose(){super.dispose(),this._isDisposed=!0}assertNotDisposed(){if(this._isDisposed)throw new Error("TextModelPart is disposed!")}}function eT(o,e){let t=0,i=0;const n=o.length;for(;i<n;){const s=o.charCodeAt(i);if(s===32)t++;else if(s===9)t=t-t%e+e;else break;i++}return i===n?-1:t}var Da;(function(o){o[o.Disabled=0]="Disabled",o[o.EnabledForActive=1]="EnabledForActive",o[o.Enabled=2]="Enabled"})(Da||(Da={}));class xa{constructor(e,t,i,n,s,r){if(this.visibleColumn=e,this.column=t,this.className=i,this.horizontalLine=n,this.forWrappedLinesAfterColumn=s,this.forWrappedLinesBeforeOrAtColumn=r,e!==-1==(t!==-1))throw new Error}}class Kd{constructor(e,t){this.top=e,this.endColumn=t}}class B$ extends HI{constructor(e,t){super(),this.textModel=e,this.languageConfigurationService=t}getLanguageConfiguration(e){return this.languageConfigurationService.getLanguageConfiguration(e)}_computeIndentLevel(e){return eT(this.textModel.getLineContent(e+1),this.textModel.getOptions().tabSize)}getActiveIndentGuide(e,t,i){this.assertNotDisposed();const n=this.textModel.getLineCount();if(e<1||e>n)throw new l.BugIndicatingError("Illegal value for lineNumber");const s=this.getLanguageConfiguration(this.textModel.getLanguageId()).foldingRules,r=!!(s&&s.offSide);let a=-2,c=-1,h=-2,d=-1;const u=x=>{if(a!==-1&&(a===-2||a>x-1)){a=-1,c=-1;for(let I=x-2;I>=0;I--){const T=this._computeIndentLevel(I);if(T>=0){a=I,c=T;break}}}if(h===-2){h=-1,d=-1;for(let I=x;I<n;I++){const T=this._computeIndentLevel(I);if(T>=0){h=I,d=T;break}}}};let f=-2,g=-1,m=-2,p=-1;const b=x=>{if(f===-2){f=-1,g=-1;for(let I=x-2;I>=0;I--){const T=this._computeIndentLevel(I);if(T>=0){f=I,g=T;break}}}if(m!==-1&&(m===-2||m<x-1)){m=-1,p=-1;for(let I=x;I<n;I++){const T=this._computeIndentLevel(I);if(T>=0){m=I,p=T;break}}}};let v=0,C=!0,w=0,S=!0,L=0,D=0;for(let x=0;C||S;x++){const I=e-x,T=e+x;x>1&&(I<1||I<t)&&(C=!1),x>1&&(T>n||T>i)&&(S=!1),x>5e4&&(C=!1,S=!1);let M=-1;if(C&&I>=1){const P=this._computeIndentLevel(I-1);P>=0?(h=I-1,d=P,M=Math.ceil(P/this.textModel.getOptions().indentSize)):(u(I),M=this._getIndentLevelForWhitespaceLine(r,c,d))}let O=-1;if(S&&T<=n){const P=this._computeIndentLevel(T-1);P>=0?(f=T-1,g=P,O=Math.ceil(P/this.textModel.getOptions().indentSize)):(b(T),O=this._getIndentLevelForWhitespaceLine(r,g,p))}if(x===0){D=M;continue}if(x===1){if(T<=n&&O>=0&&D+1===O){C=!1,v=T,w=T,L=O;continue}if(I>=1&&M>=0&&M-1===D){S=!1,v=I,w=I,L=M;continue}if(v=e,w=e,L=D,L===0)return{startLineNumber:v,endLineNumber:w,indent:L}}C&&(M>=L?v=I:C=!1),S&&(O>=L?w=T:S=!1)}return{startLineNumber:v,endLineNumber:w,indent:L}}getLinesBracketGuides(e,t,i,n){const s=[];for(let u=e;u<=t;u++)s.push([]);const r=!0,a=this.textModel.bracketPairs.getBracketPairsInRangeWithMinIndentation(new l.Range(e,1,t,this.textModel.getLineMaxColumn(t))).toArray();let c;if(i&&a.length>0){const u=(e<=i.lineNumber&&i.lineNumber<=t?a:this.textModel.bracketPairs.getBracketPairsInRange(l.Range.fromPositions(i)).toArray()).filter(f=>l.Range.strictContainsPosition(f.range,i));c=l.findLast(u,f=>r)?.range}const h=this.textModel.getOptions().bracketPairColorizationOptions.independentColorPoolPerBracketType,d=new tT;for(const u of a){if(!u.closingBracketRange)continue;const f=c&&u.range.equalsRange(c);if(!f&&!n.includeInactive)continue;const g=d.getInlineClassName(u.nestingLevel,u.nestingLevelOfEqualBracketType,h)+(n.highlightActive&&f?" "+d.activeClassName:""),m=u.openingBracketRange.getStartPosition(),p=u.closingBracketRange.getStartPosition(),b=n.horizontalGuides===Da.Enabled||n.horizontalGuides===Da.EnabledForActive&&f;if(u.range.startLineNumber===u.range.endLineNumber){b&&s[u.range.startLineNumber-e].push(new xa(-1,u.openingBracketRange.getEndPosition().column,g,new Kd(!1,p.column),-1,-1));continue}const v=this.getVisibleColumnFromPosition(p),C=this.getVisibleColumnFromPosition(u.openingBracketRange.getStartPosition()),w=Math.min(C,v,u.minVisibleColumnIndentation+1);let S=!1;l.firstNonWhitespaceIndex(this.textModel.getLineContent(u.closingBracketRange.startLineNumber))<u.closingBracketRange.startColumn-1&&(S=!0);const x=Math.max(m.lineNumber,e),I=Math.min(p.lineNumber,t),T=S?1:0;for(let M=x;M<I+T;M++)s[M-e].push(new xa(w,-1,g,null,M===m.lineNumber?m.column:-1,M===p.lineNumber?p.column:-1));b&&(m.lineNumber>=e&&C>w&&s[m.lineNumber-e].push(new xa(w,-1,g,new Kd(!1,m.column),-1,-1)),p.lineNumber<=t&&v>w&&s[p.lineNumber-e].push(new xa(w,-1,g,new Kd(!S,p.column),-1,-1)))}for(const u of s)u.sort((f,g)=>f.visibleColumn-g.visibleColumn);return s}getVisibleColumnFromPosition(e){return Xe.visibleColumnFromColumn(this.textModel.getLineContent(e.lineNumber),e.column,this.textModel.getOptions().tabSize)+1}getLinesIndentGuides(e,t){this.assertNotDisposed();const i=this.textModel.getLineCount();if(e<1||e>i)throw new Error("Illegal value for startLineNumber");if(t<1||t>i)throw new Error("Illegal value for endLineNumber");const n=this.textModel.getOptions(),s=this.getLanguageConfiguration(this.textModel.getLanguageId()).foldingRules,r=!!(s&&s.offSide),a=new Array(t-e+1);let c=-2,h=-1,d=-2,u=-1;for(let f=e;f<=t;f++){const g=f-e,m=this._computeIndentLevel(f-1);if(m>=0){c=f-1,h=m,a[g]=Math.ceil(m/n.indentSize);continue}if(c===-2){c=-1,h=-1;for(let p=f-2;p>=0;p--){const b=this._computeIndentLevel(p);if(b>=0){c=p,h=b;break}}}if(d!==-1&&(d===-2||d<f-1)){d=-1,u=-1;for(let p=f;p<i;p++){const b=this._computeIndentLevel(p);if(b>=0){d=p,u=b;break}}}a[g]=this._getIndentLevelForWhitespaceLine(r,h,u)}return a}_getIndentLevelForWhitespaceLine(e,t,i){const n=this.textModel.getOptions();return t===-1||i===-1?0:t<i?1+Math.floor(t/n.indentSize):t===i||e?Math.ceil(i/n.indentSize):1+Math.floor(i/n.indentSize)}}class tT{constructor(){this.activeClassName="indent-active"}getInlineClassName(e,t,i){return this.getInlineClassNameOfLevel(i?t:e)}getInlineClassNameOfLevel(e){return`bracket-indent-guide lvl-${e%30}`}}class z$ extends hr{constructor(e){super(),this._context=e,this._primaryPosition=null;const t=this._context.configuration.options,i=t.get(166),n=t.get(59);this._spaceWidth=n.spaceWidth,this._maxIndentLeft=i.wrappingColumn===-1?-1:i.wrappingColumn*n.typicalHalfwidthCharacterWidth,this._bracketPairGuideOptions=t.get(22),this._renderResult=null,this._context.addEventHandler(this)}dispose(){this._context.removeEventHandler(this),this._renderResult=null,super.dispose()}onConfigurationChanged(e){const t=this._context.configuration.options,i=t.get(166),n=t.get(59);return this._spaceWidth=n.spaceWidth,this._maxIndentLeft=i.wrappingColumn===-1?-1:i.wrappingColumn*n.typicalHalfwidthCharacterWidth,this._bracketPairGuideOptions=t.get(22),!0}onCursorStateChanged(e){const i=e.selections[0].getPosition();return this._primaryPosition?.equals(i)?!1:(this._primaryPosition=i,!0)}onDecorationsChanged(e){return!0}onFlushed(e){return!0}onLinesChanged(e){return!0}onLinesDeleted(e){return!0}onLinesInserted(e){return!0}onScrollChanged(e){return e.scrollTopChanged}onZonesChanged(e){return!0}onLanguageConfigurationChanged(e){return!0}prepareRender(e){if(!this._bracketPairGuideOptions.indentation&&this._bracketPairGuideOptions.bracketPairs===!1){this._renderResult=null;return}const t=e.visibleRange.startLineNumber,i=e.visibleRange.endLineNumber,n=e.scrollWidth,s=this._primaryPosition,r=this.getGuidesByLine(t,Math.min(i+1,this._context.viewModel.getLineCount()),s),a=[];for(let c=t;c<=i;c++){const h=c-t,d=r[h];let u="";const f=e.visibleRangeForPosition(new l.Position(c,1))?.left??0;for(const g of d){const m=g.column===-1?f+(g.visibleColumn-1)*this._spaceWidth:e.visibleRangeForPosition(new l.Position(c,g.column)).left;if(m>n||this._maxIndentLeft>0&&m>this._maxIndentLeft)break;const p=g.horizontalLine?g.horizontalLine.top?"horizontal-top":"horizontal-bottom":"vertical",b=g.horizontalLine?(e.visibleRangeForPosition(new l.Position(c,g.horizontalLine.endColumn))?.left??m+this._spaceWidth)-m:this._spaceWidth;u+=`<div class="core-guide ${g.className} ${p}" style="left:${m}px;width:${b}px"></div>`}a[h]=u}this._renderResult=a}getGuidesByLine(e,t,i){const n=this._bracketPairGuideOptions.bracketPairs!==!1?this._context.viewModel.getBracketGuidesInRangeByLine(e,t,i,{highlightActive:this._bracketPairGuideOptions.highlightActiveBracketPair,horizontalGuides:this._bracketPairGuideOptions.bracketPairsHorizontal===!0?Da.Enabled:this._bracketPairGuideOptions.bracketPairsHorizontal==="active"?Da.EnabledForActive:Da.Disabled,includeInactive:this._bracketPairGuideOptions.bracketPairs===!0}):null,s=this._bracketPairGuideOptions.indentation?this._context.viewModel.getLinesIndentGuides(e,t):null;let r=0,a=0,c=0;if(this._bracketPairGuideOptions.highlightActiveIndentation!==!1&&i){const u=this._context.viewModel.getActiveIndentGuide(i.lineNumber,e,t);r=u.startLineNumber,a=u.endLineNumber,c=u.indent}const{indentSize:h}=this._context.viewModel.model.getOptions(),d=[];for(let u=e;u<=t;u++){const f=new Array;d.push(f);const g=n?n[u-e]:[],m=new l.ArrayQueue(g),p=s?s[u-e]:0;for(let b=1;b<=p;b++){const v=(b-1)*h+1,C=(this._bracketPairGuideOptions.highlightActiveIndentation==="always"||g.length===0)&&r<=u&&u<=a&&b===c;f.push(...m.takeWhile(S=>S.visibleColumn<v)||[]);const w=m.peek();(!w||w.visibleColumn!==v||w.horizontalLine)&&f.push(new xa(v,-1,`core-guide-indent lvl-${(b-1)%30}`+(C?" indent-active":""),null,-1,-1))}f.push(...m.takeWhile(b=>!0)||[])}return d}render(e,t){if(!this._renderResult)return"";const i=t-e;return i<0||i>=this._renderResult.length?"":this._renderResult[i]}}function wc(o){if(!(o&&o.isTransparent()))return o}vs((o,e)=>{const t=[{bracketColor:jI,guideColor:p$,guideColorActive:S$},{bracketColor:qI,guideColor:_$,guideColorActive:y$},{bracketColor:YI,guideColor:b$,guideColorActive:L$},{bracketColor:ZI,guideColor:C$,guideColorActive:D$},{bracketColor:QI,guideColor:v$,guideColorActive:x$},{bracketColor:XI,guideColor:w$,guideColorActive:E$}],i=new tT,n=[{indentColor:Ud,indentColorActive:$d},{indentColor:qU,indentColorActive:JU},{indentColor:YU,indentColorActive:WU},{indentColor:ZU,indentColorActive:HU},{indentColor:QU,indentColorActive:e$},{indentColor:XU,indentColorActive:t$}],s=t.map(a=>{const c=o.getColor(a.bracketColor),h=o.getColor(a.guideColor),d=o.getColor(a.guideColorActive),u=wc(wc(h)??c?.transparent(.3)),f=wc(wc(d)??c);if(!(!u||!f))return{guideColor:u,guideColorActive:f}}).filter(l.isDefined),r=n.map(a=>{const c=o.getColor(a.indentColor),h=o.getColor(a.indentColorActive),d=wc(c),u=wc(h);if(!(!d||!u))return{indentColor:d,indentColorActive:u}}).filter(l.isDefined);if(s.length>0){for(let a=0;a<30;a++){const c=s[a%s.length];e.addRule(`.monaco-editor .${i.getInlineClassNameOfLevel(a).replace(/ /g,".")} { --guide-color: ${c.guideColor}; --guide-color-active: ${c.guideColorActive}; }`)}e.addRule(".monaco-editor .vertical { box-shadow: 1px 0 0 0 var(--guide-color) inset; }"),e.addRule(".monaco-editor .horizontal-top { border-top: 1px solid var(--guide-color); }"),e.addRule(".monaco-editor .horizontal-bottom { border-bottom: 1px solid var(--guide-color); }"),e.addRule(`.monaco-editor .vertical.${i.activeClassName} { box-shadow: 1px 0 0 0 var(--guide-color-active) inset; }`),e.addRule(`.monaco-editor .horizontal-top.${i.activeClassName} { border-top: 1px solid var(--guide-color-active); }`),e.addRule(`.monaco-editor .horizontal-bottom.${i.activeClassName} { border-bottom: 1px solid var(--guide-color-active); }`)}if(r.length>0){for(let a=0;a<30;a++){const c=r[a%r.length];e.addRule(`.monaco-editor .lines-content .core-guide-indent.lvl-${a} { --indent-color: ${c.indentColor}; --indent-color-active: ${c.indentColorActive}; }`)}e.addRule(".monaco-editor .lines-content .core-guide-indent { box-shadow: 1px 0 0 0 var(--indent-color) inset; }"),e.addRule(".monaco-editor .lines-content .core-guide-indent.indent-active { box-shadow: 1px 0 0 0 var(--indent-color-active) inset; }")}});const eb=class eb extends hr{constructor(e){super(),this._context=e,this._readConfig(),this._lastCursorModelPosition=new l.Position(1,1),this._renderResult=null,this._activeModelLineNumber=1,this._context.addEventHandler(this)}_readConfig(){const e=this._context.configuration.options;this._lineHeight=e.get(75);const t=e.get(76);this._renderLineNumbers=t.renderType,this._renderCustomLineNumbers=t.renderFn,this._renderFinalNewline=e.get(109);const i=e.get(165);this._lineNumbersLeft=i.lineNumbersLeft,this._lineNumbersWidth=i.lineNumbersWidth}dispose(){this._context.removeEventHandler(this),this._renderResult=null,super.dispose()}onConfigurationChanged(e){return this._readConfig(),!0}onCursorStateChanged(e){const t=e.selections[0].getPosition();this._lastCursorModelPosition=this._context.viewModel.coordinatesConverter.convertViewPositionToModelPosition(t);let i=!1;return this._activeModelLineNumber!==this._lastCursorModelPosition.lineNumber&&(this._activeModelLineNumber=this._lastCursorModelPosition.lineNumber,i=!0),(this._renderLineNumbers===2||this._renderLineNumbers===3)&&(i=!0),i}onFlushed(e){return!0}onLinesChanged(e){return!0}onLinesDeleted(e){return!0}onLinesInserted(e){return!0}onScrollChanged(e){return e.scrollTopChanged}onZonesChanged(e){return!0}onDecorationsChanged(e){return e.affectsLineNumber}_getLineRenderLineNumber(e){const t=this._context.viewModel.coordinatesConverter.convertViewPositionToModelPosition(new l.Position(e,1));if(t.column!==1)return"";const i=t.lineNumber;if(this._renderCustomLineNumbers)return this._renderCustomLineNumbers(i);if(this._renderLineNumbers===2){const n=Math.abs(this._lastCursorModelPosition.lineNumber-i);return n===0?'<span class="relative-current-line-number">'+i+"</span>":String(n)}if(this._renderLineNumbers===3){if(this._lastCursorModelPosition.lineNumber===i||i%10===0)return String(i);const n=this._context.viewModel.getLineCount();return i===n?String(i):""}return String(i)}prepareRender(e){if(this._renderLineNumbers===0){this._renderResult=null;return}const t=l.isLinux?this._lineHeight%2===0?" lh-even":" lh-odd":"",i=e.visibleRange.startLineNumber,n=e.visibleRange.endLineNumber,s=this._context.viewModel.getDecorationsInViewport(e.visibleRange).filter(h=>!!h.options.lineNumberClassName);s.sort((h,d)=>l.Range.compareRangesUsingEnds(h.range,d.range));let r=0;const a=this._context.viewModel.getLineCount(),c=[];for(let h=i;h<=n;h++){const d=h-i,u=this._context.viewModel.coordinatesConverter.convertViewPositionToModelPosition(new l.Position(h,1)).lineNumber;let f=this._getLineRenderLineNumber(h),g="";for(;r<s.length&&s[r].range.endLineNumber<h;)r++;for(let m=r;m<s.length;m++){const{range:p,options:b}=s[m];p.startLineNumber<=h&&(g+=" "+b.lineNumberClassName)}if(!f&&!g){c[d]="";continue}h===a&&this._context.viewModel.getLineLength(h)===0&&(this._renderFinalNewline==="off"&&(f=""),this._renderFinalNewline==="dimmed"&&(g+=" dimmed-line-number")),u===this._activeModelLineNumber&&(g+=" active-line-number"),c[d]=`<div class="${eb.CLASS_NAME}${t}${g}" style="left:${this._lineNumbersLeft}px;width:${this._lineNumbersWidth}px;">${f}</div>`}this._renderResult=c}render(e,t){if(!this._renderResult)return"";const i=t-e;return i<0||i>=this._renderResult.length?"":this._renderResult[i]}};eb.CLASS_NAME="line-numbers";let gm=eb;vs((o,e)=>{const t=o.getColor(KU),i=o.getColor(n$);i?e.addRule(`.monaco-editor .line-numbers.dimmed-line-number { color: ${i}; }`):t&&e.addRule(`.monaco-editor .line-numbers.dimmed-line-number { color: ${t.transparent(.4)}; }`)});const Sc="monaco-mouse-cursor-text";class qv{get didDomLayout(){return this._didDomLayout}readClientRect(){if(!this._clientRectRead){this._clientRectRead=!0;const e=this._domNode.getBoundingClientRect();this.markDidDomLayout(),this._clientRectDeltaLeft=e.left;const t=this._domNode.offsetWidth;this._clientRectScale=t>0?e.width/t:1}}get clientRectDeltaLeft(){return this._clientRectRead||this.readClientRect(),this._clientRectDeltaLeft}get clientRectScale(){return this._clientRectRead||this.readClientRect(),this._clientRectScale}constructor(e,t){this._domNode=e,this.endNode=t,this._didDomLayout=!1,this._clientRectDeltaLeft=0,this._clientRectScale=1,this._clientRectRead=!1}markDidDomLayout(){this._didDomLayout=!0}}class mm{constructor(e,t){this.themeType=t;const i=e.options,n=i.get(59);this.renderWhitespace=i.get(113),this.experimentalWhitespaceRendering=i.get(47),this.renderControlCharacters=i.get(108),this.spaceWidth=n.spaceWidth,this.middotWidth=n.middotWidth,this.wsmiddotWidth=n.wsmiddotWidth,this.useMonospaceOptimizations=n.isMonospace&&!i.get(40),this.canUseHalfwidthRightwardsArrow=n.canUseHalfwidthRightwardsArrow,this.lineHeight=i.get(75),this.stopRenderingLineAfter=i.get(133),this.fontLigatures=i.get(60),this.verticalScrollbarSize=i.get(117).verticalScrollbarSize,this.useGpu=i.get(46)==="on"}equals(e){return this.themeType===e.themeType&&this.renderWhitespace===e.renderWhitespace&&this.experimentalWhitespaceRendering===e.experimentalWhitespaceRendering&&this.renderControlCharacters===e.renderControlCharacters&&this.spaceWidth===e.spaceWidth&&this.middotWidth===e.middotWidth&&this.wsmiddotWidth===e.wsmiddotWidth&&this.useMonospaceOptimizations===e.useMonospaceOptimizations&&this.canUseHalfwidthRightwardsArrow===e.canUseHalfwidthRightwardsArrow&&this.lineHeight===e.lineHeight&&this.stopRenderingLineAfter===e.stopRenderingLineAfter&&this.fontLigatures===e.fontLigatures&&this.verticalScrollbarSize===e.verticalScrollbarSize&&this.useGpu===e.useGpu}}class V${constructor(){this._currentVisibleRange=new l.Range(1,1,1,1)}getCurrentVisibleRange(){return this._currentVisibleRange}setCurrentVisibleRange(e){this._currentVisibleRange=e}}class U${constructor(e,t,i,n,s,r,a){this.minimalReveal=e,this.lineNumber=t,this.startColumn=i,this.endColumn=n,this.startScrollTop=s,this.stopScrollTop=r,this.scrollType=a,this.type="range",this.minLineNumber=t,this.maxLineNumber=t}}class $${constructor(e,t,i,n,s){this.minimalReveal=e,this.selections=t,this.startScrollTop=i,this.stopScrollTop=n,this.scrollType=s,this.type="selections";let r=t[0].startLineNumber,a=t[0].endLineNumber;for(let c=1,h=t.length;c<h;c++){const d=t[c];r=Math.min(r,d.startLineNumber),a=Math.max(a,d.endLineNumber)}this.minLineNumber=r,this.maxLineNumber=a}}const tb=class tb extends gi{constructor(e,t,i){super(e);const n=this._context.configuration,s=this._context.configuration.options,r=s.get(59),a=s.get(166);this._lineHeight=s.get(75),this._typicalHalfwidthCharacterWidth=r.typicalHalfwidthCharacterWidth,this._isViewportWrapping=a.isViewportWrapping,this._revealHorizontalRightPadding=s.get(114),this._cursorSurroundingLines=s.get(35),this._cursorSurroundingLinesStyle=s.get(36),this._canUseLayerHinting=!s.get(39),this._viewLineOptions=new mm(n,this._context.theme.type),this._linesContent=i,this._textRangeRestingSpot=document.createElement("div"),this._visibleLines=new FI(this._context,{createLine:()=>new fo(t,this._viewLineOptions)}),this.domNode=this._visibleLines.domNode,Jn.write(this.domNode,8),this.domNode.setClassName(`view-lines ${Sc}`),Ot(this.domNode,r),this._maxLineWidth=0,this._asyncUpdateLineWidths=new l.RunOnceScheduler(()=>{this._updateLineWidthsSlow()},200),this._asyncCheckMonospaceFontAssumptions=new l.RunOnceScheduler(()=>{this._checkMonospaceFontAssumptions()},2e3),this._lastRenderedData=new V$,this._horizontalRevealRequest=null,this._stickyScrollEnabled=s.get(131).enabled,this._maxNumberStickyLines=s.get(131).maxLineCount}dispose(){this._asyncUpdateLineWidths.dispose(),this._asyncCheckMonospaceFontAssumptions.dispose(),super.dispose()}getDomNode(){return this.domNode}onConfigurationChanged(e){this._visibleLines.onConfigurationChanged(e),e.hasChanged(166)&&(this._maxLineWidth=0);const t=this._context.configuration.options,i=t.get(59),n=t.get(166);return this._lineHeight=t.get(75),this._typicalHalfwidthCharacterWidth=i.typicalHalfwidthCharacterWidth,this._isViewportWrapping=n.isViewportWrapping,this._revealHorizontalRightPadding=t.get(114),this._cursorSurroundingLines=t.get(35),this._cursorSurroundingLinesStyle=t.get(36),this._canUseLayerHinting=!t.get(39),this._stickyScrollEnabled=t.get(131).enabled,this._maxNumberStickyLines=t.get(131).maxLineCount,Ot(this.domNode,i),this._onOptionsMaybeChanged(),e.hasChanged(165)&&(this._maxLineWidth=0),!0}_onOptionsMaybeChanged(){const e=this._context.configuration,t=new mm(e,this._context.theme.type);if(!this._viewLineOptions.equals(t)){this._viewLineOptions=t;const i=this._visibleLines.getStartLineNumber(),n=this._visibleLines.getEndLineNumber();for(let s=i;s<=n;s++)this._visibleLines.getVisibleLine(s).onOptionsChanged(this._viewLineOptions);return!0}return!1}onCursorStateChanged(e){const t=this._visibleLines.getStartLineNumber(),i=this._visibleLines.getEndLineNumber();let n=!1;for(let s=t;s<=i;s++)n=this._visibleLines.getVisibleLine(s).onSelectionChanged()||n;return n}onDecorationsChanged(e){const t=this._visibleLines.getStartLineNumber(),i=this._visibleLines.getEndLineNumber();for(let n=t;n<=i;n++)this._visibleLines.getVisibleLine(n).onDecorationsChanged();return!0}onFlushed(e){const t=this._visibleLines.onFlushed(e,this._viewLineOptions.useGpu);return this._maxLineWidth=0,t}onLinesChanged(e){return this._visibleLines.onLinesChanged(e)}onLinesDeleted(e){return this._visibleLines.onLinesDeleted(e)}onLinesInserted(e){return this._visibleLines.onLinesInserted(e)}onRevealRangeRequest(e){const t=this._computeScrollTopToRevealRange(this._context.viewLayout.getFutureViewport(),e.source,e.minimalReveal,e.range,e.selections,e.verticalType);if(t===-1)return!1;let i=this._context.viewLayout.validateScrollPosition({scrollTop:t});e.revealHorizontal?e.range&&e.range.startLineNumber!==e.range.endLineNumber?i={scrollTop:i.scrollTop,scrollLeft:0}:e.range?this._horizontalRevealRequest=new U$(e.minimalReveal,e.range.startLineNumber,e.range.startColumn,e.range.endColumn,this._context.viewLayout.getCurrentScrollTop(),i.scrollTop,e.scrollType):e.selections&&e.selections.length>0&&(this._horizontalRevealRequest=new $$(e.minimalReveal,e.selections,this._context.viewLayout.getCurrentScrollTop(),i.scrollTop,e.scrollType)):this._horizontalRevealRequest=null;const s=Math.abs(this._context.viewLayout.getCurrentScrollTop()-i.scrollTop)<=this._lineHeight?1:e.scrollType;return this._context.viewModel.viewLayout.setScrollPosition(i,s),!0}onScrollChanged(e){if(this._horizontalRevealRequest&&e.scrollLeftChanged&&(this._horizontalRevealRequest=null),this._horizontalRevealRequest&&e.scrollTopChanged){const t=Math.min(this._horizontalRevealRequest.startScrollTop,this._horizontalRevealRequest.stopScrollTop),i=Math.max(this._horizontalRevealRequest.startScrollTop,this._horizontalRevealRequest.stopScrollTop);(e.scrollTop<t||e.scrollTop>i)&&(this._horizontalRevealRequest=null)}return this.domNode.setWidth(e.scrollWidth),this._visibleLines.onScrollChanged(e)||e.scrollTopChanged||e.scrollLeftChanged}onTokensChanged(e){return this._visibleLines.onTokensChanged(e)}onZonesChanged(e){return this._context.viewModel.viewLayout.setMaxLineWidth(this._maxLineWidth),this._visibleLines.onZonesChanged(e)}onThemeChanged(e){return this._onOptionsMaybeChanged()}getPositionFromDOMInfo(e,t){const i=this._getViewLineDomNode(e);if(i===null)return null;const n=this._getLineNumberFor(i);if(n===-1||n<1||n>this._context.viewModel.getLineCount())return null;if(this._context.viewModel.getLineMaxColumn(n)===1)return new l.Position(n,1);const s=this._visibleLines.getStartLineNumber(),r=this._visibleLines.getEndLineNumber();if(n<s||n>r)return null;let a=this._visibleLines.getVisibleLine(n).getColumnOfNodeOffset(e,t);const c=this._context.viewModel.getLineMinColumn(n);return a<c&&(a=c),new l.Position(n,a)}_getViewLineDomNode(e){for(;e&&e.nodeType===1;){if(e.className===fo.CLASS_NAME)return e;e=e.parentElement}return null}_getLineNumberFor(e){const t=this._visibleLines.getStartLineNumber(),i=this._visibleLines.getEndLineNumber();for(let n=t;n<=i;n++){const s=this._visibleLines.getVisibleLine(n);if(e===s.getDomNode())return n}return-1}getLineWidth(e){const t=this._visibleLines.getStartLineNumber(),i=this._visibleLines.getEndLineNumber();if(e<t||e>i)return-1;const n=new qv(this.domNode.domNode,this._textRangeRestingSpot),s=this._visibleLines.getVisibleLine(e).getWidth(n);return this._updateLineWidthsSlowIfDomDidLayout(n),s}resetLineWidthCaches(){const e=this._visibleLines.getStartLineNumber(),t=this._visibleLines.getEndLineNumber();for(let i=e;i<=t;i++)this._visibleLines.getVisibleLine(i).resetCachedWidth()}linesVisibleRangesForRange(e,t){const i=e.endLineNumber,n=l.Range.intersectRanges(e,this._lastRenderedData.getCurrentVisibleRange());if(!n)return null;const s=[];let r=0;const a=new qv(this.domNode.domNode,this._textRangeRestingSpot);let c=0;t&&(c=this._context.viewModel.coordinatesConverter.convertViewPositionToModelPosition(new l.Position(n.startLineNumber,1)).lineNumber);const h=this._visibleLines.getStartLineNumber(),d=this._visibleLines.getEndLineNumber();for(let u=n.startLineNumber;u<=n.endLineNumber;u++){if(u<h||u>d)continue;const f=u===n.startLineNumber?n.startColumn:1,g=u!==i,m=g?this._context.viewModel.getLineMaxColumn(u):n.endColumn,b=this._visibleLines.getVisibleLine(u).getVisibleRangesForRange(u,f,m,a);if(b){if(t&&u<i){const v=c;if(c=this._context.viewModel.coordinatesConverter.convertViewPositionToModelPosition(new l.Position(u+1,1)).lineNumber,v!==c){const C=b.ranges[b.ranges.length-1];C.width+=this._typicalHalfwidthCharacterWidth,this._context.viewModel.getTextDirection(v)===l.TextDirection.RTL&&(C.left-=this._typicalHalfwidthCharacterWidth)}}s[r++]=new nI(b.outsideRenderedLine,u,Pd.from(b.ranges),g)}}return this._updateLineWidthsSlowIfDomDidLayout(a),r===0?null:s}_visibleRangesForLineRange(e,t,i){if(e<this._visibleLines.getStartLineNumber()||e>this._visibleLines.getEndLineNumber())return null;const n=new qv(this.domNode.domNode,this._textRangeRestingSpot),s=this._visibleLines.getVisibleLine(e).getVisibleRangesForRange(e,t,i,n);return this._updateLineWidthsSlowIfDomDidLayout(n),s}_lineIsRenderedRTL(e){return e<this._visibleLines.getStartLineNumber()||e>this._visibleLines.getEndLineNumber()?!1:this._visibleLines.getVisibleLine(e).isRenderedRTL()}visibleRangeForPosition(e){const t=this._visibleRangesForLineRange(e.lineNumber,e.column,e.column);return t?new sI(t.outsideRenderedLine,t.ranges[0].left):null}_updateLineWidthsFast(){return this._updateLineWidths(!0)}_updateLineWidthsSlow(){this._updateLineWidths(!1)}_updateLineWidthsSlowIfDomDidLayout(e){e.didDomLayout&&this._asyncUpdateLineWidths.isScheduled()&&(this._asyncUpdateLineWidths.cancel(),this._updateLineWidthsSlow())}_updateLineWidths(e){const t=this._visibleLines.getStartLineNumber(),i=this._visibleLines.getEndLineNumber();let n=1,s=!0;for(let r=t;r<=i;r++){const a=this._visibleLines.getVisibleLine(r);if(e&&!a.getWidthIsFast()){s=!1;continue}n=Math.max(n,a.getWidth(null))}return s&&t===1&&i===this._context.viewModel.getLineCount()&&(this._maxLineWidth=0),this._ensureMaxLineWidth(n),s}_checkMonospaceFontAssumptions(){let e=-1,t=-1;const i=this._visibleLines.getStartLineNumber(),n=this._visibleLines.getEndLineNumber();for(let s=i;s<=n;s++){const r=this._visibleLines.getVisibleLine(s);if(r.needsMonospaceFontCheck()){const a=r.getWidth(null);a>t&&(t=a,e=s)}}if(e!==-1&&!this._visibleLines.getVisibleLine(e).monospaceAssumptionsAreValid())for(let s=i;s<=n;s++)this._visibleLines.getVisibleLine(s).onMonospaceAssumptionsInvalidated()}prepareRender(){throw new Error("Not supported")}render(){throw new Error("Not supported")}renderText(e){if(this._visibleLines.renderLines(e),this._lastRenderedData.setCurrentVisibleRange(e.visibleRange),this.domNode.setWidth(this._context.viewLayout.getScrollWidth()),this.domNode.setHeight(Math.min(this._context.viewLayout.getScrollHeight(),1e6)),this._horizontalRevealRequest){const i=this._horizontalRevealRequest;if(e.startLineNumber<=i.minLineNumber&&i.maxLineNumber<=e.endLineNumber){this._horizontalRevealRequest=null,this.onDidRender();const n=this._computeScrollLeftToReveal(i);n&&(!this._isViewportWrapping&&!n.hasRTL&&this._ensureMaxLineWidth(n.maxHorizontalOffset),this._context.viewModel.viewLayout.setScrollPosition({scrollLeft:n.scrollLeft},i.scrollType))}}if(this._updateLineWidthsFast()?this._asyncUpdateLineWidths.cancel():this._asyncUpdateLineWidths.schedule(),l.isLinux&&!this._asyncCheckMonospaceFontAssumptions.isScheduled()){const i=this._visibleLines.getStartLineNumber(),n=this._visibleLines.getEndLineNumber();for(let s=i;s<=n;s++)if(this._visibleLines.getVisibleLine(s).needsMonospaceFontCheck()){this._asyncCheckMonospaceFontAssumptions.schedule();break}}this._linesContent.setLayerHinting(this._canUseLayerHinting),this._linesContent.setContain("strict");const t=this._context.viewLayout.getCurrentScrollTop()-e.bigNumbersDelta;this._linesContent.setTop(-t),this._linesContent.setLeft(-this._context.viewLayout.getCurrentScrollLeft())}_ensureMaxLineWidth(e){if(this._viewLineOptions.useGpu)return;const t=Math.ceil(e);this._maxLineWidth<t&&(this._maxLineWidth=t,this._context.viewModel.viewLayout.setMaxLineWidth(this._maxLineWidth))}_computeScrollTopToRevealRange(e,t,i,n,s,r){const a=e.top,c=e.height,h=a+c;let d,u,f;if(s&&s.length>0){let v=s[0].startLineNumber,C=s[0].endLineNumber;for(let w=1,S=s.length;w<S;w++){const L=s[w];v=Math.min(v,L.startLineNumber),C=Math.max(C,L.endLineNumber)}d=!1,u=this._context.viewLayout.getVerticalOffsetForLineNumber(v),f=this._context.viewLayout.getVerticalOffsetForLineNumber(C)+this._lineHeight}else if(n)d=!0,u=this._context.viewLayout.getVerticalOffsetForLineNumber(n.startLineNumber),f=this._context.viewLayout.getVerticalOffsetForLineNumber(n.endLineNumber)+this._lineHeight;else return-1;const g=(t==="mouse"||i)&&this._cursorSurroundingLinesStyle==="default";let m=0,p=0;if(g)i||(m=this._lineHeight);else{const v=c/this._lineHeight,C=Math.max(this._cursorSurroundingLines,this._stickyScrollEnabled?this._maxNumberStickyLines:0),w=Math.min(v/2,C);m=w*this._lineHeight,p=Math.max(0,w-1)*this._lineHeight}i||(r===0||r===4)&&(p+=this._lineHeight),u-=m,f+=p;let b;if(f-u>c){if(!d)return-1;b=u}else if(r===5||r===6)if(r===6&&a<=u&&f<=h)b=a;else{const v=Math.max(5*this._lineHeight,c*.2),C=u-v,w=f-c;b=Math.max(w,C)}else if(r===1||r===2)if(r===2&&a<=u&&f<=h)b=a;else{const v=(u+f)/2;b=Math.max(0,v-c/2)}else b=this._computeMinimumScrolling(a,h,u,f,r===3,r===4);return b}_computeScrollLeftToReveal(e){const t=this._context.viewLayout.getCurrentViewport(),i=this._context.configuration.options.get(165),n=t.left,s=n+t.width-i.verticalScrollbarWidth;let r=1073741824,a=0,c=!1;if(e.type==="range"){c=this._lineIsRenderedRTL(e.lineNumber);const d=this._visibleRangesForLineRange(e.lineNumber,e.startColumn,e.endColumn);if(!d)return null;for(const u of d.ranges)r=Math.min(r,Math.round(u.left)),a=Math.max(a,Math.round(u.left+u.width))}else for(const d of e.selections){if(d.startLineNumber!==d.endLineNumber)return null;const u=this._visibleRangesForLineRange(d.startLineNumber,d.startColumn,d.endColumn);if(c||=this._lineIsRenderedRTL(d.startLineNumber),!u)return null;for(const f of u.ranges)r=Math.min(r,Math.round(f.left)),a=Math.max(a,Math.round(f.left+f.width))}return e.minimalReveal||(r=Math.max(0,r-tb.HORIZONTAL_EXTRA_PX),a+=this._revealHorizontalRightPadding),e.type==="selections"&&a-r>t.width?null:{scrollLeft:this._computeMinimumScrolling(n,s,r,a),maxHorizontalOffset:a,hasRTL:c}}_computeMinimumScrolling(e,t,i,n,s,r){e=e|0,t=t|0,i=i|0,n=n|0,s=!!s,r=!!r;const a=t-e;if(n-i<a){if(s)return i;if(r)return Math.max(0,n-a);if(i<e)return i;if(n>t)return Math.max(0,n-a)}else return i;return e}};tb.HORIZONTAL_EXTRA_PX=30;let Yv=tb;class K$ extends WI{constructor(e){super(),this._context=e;const i=this._context.configuration.options.get(165);this._decorationsLeft=i.decorationsLeft,this._decorationsWidth=i.decorationsWidth,this._renderResult=null,this._context.addEventHandler(this)}dispose(){this._context.removeEventHandler(this),this._renderResult=null,super.dispose()}onConfigurationChanged(e){const i=this._context.configuration.options.get(165);return this._decorationsLeft=i.decorationsLeft,this._decorationsWidth=i.decorationsWidth,!0}onDecorationsChanged(e){return!0}onFlushed(e){return!0}onLinesChanged(e){return!0}onLinesDeleted(e){return!0}onLinesInserted(e){return!0}onScrollChanged(e){return e.scrollTopChanged}onZonesChanged(e){return!0}_getDecorations(e){const t=e.getDecorationsInViewport(),i=[];let n=0;for(let s=0,r=t.length;s<r;s++){const a=t[s],c=a.options.linesDecorationsClassName,h=a.options.zIndex;c&&(i[n++]=new jv(a.range.startLineNumber,a.range.endLineNumber,c,a.options.linesDecorationsTooltip??null,h));const d=a.options.firstLineDecorationClassName;d&&(i[n++]=new jv(a.range.startLineNumber,a.range.startLineNumber,d,a.options.linesDecorationsTooltip??null,h))}return i}prepareRender(e){const t=e.visibleRange.startLineNumber,i=e.visibleRange.endLineNumber,n=this._render(t,i,this._getDecorations(e)),s=this._decorationsLeft.toString(),r=this._decorationsWidth.toString(),a='" style="left:'+s+"px;width:"+r+'px;"></div>',c=[];for(let h=t;h<=i;h++){const d=h-t,u=n[d].getDecorations();let f="";for(const g of u){let m='<div class="cldr '+g.className;g.tooltip!==null&&(m+='" title="'+g.tooltip),m+=a,f+=m}c[d]=f}this._renderResult=c}render(e,t){return this._renderResult?this._renderResult[t-e]:""}}const Mh=class Mh extends gi{constructor(e){super(e);const t=this._context.configuration.options,i=t.get(165);this._canUseLayerHinting=!t.get(39),this._contentLeft=i.contentLeft,this._glyphMarginLeft=i.glyphMarginLeft,this._glyphMarginWidth=i.glyphMarginWidth,this._domNode=we(document.createElement("div")),this._domNode.setClassName(Mh.OUTER_CLASS_NAME),this._domNode.setPosition("absolute"),this._domNode.setAttribute("role","presentation"),this._domNode.setAttribute("aria-hidden","true"),this._glyphMarginBackgroundDomNode=we(document.createElement("div")),this._glyphMarginBackgroundDomNode.setClassName(Mh.CLASS_NAME),this._domNode.appendChild(this._glyphMarginBackgroundDomNode)}getDomNode(){return this._domNode}onConfigurationChanged(e){const t=this._context.configuration.options,i=t.get(165);return this._canUseLayerHinting=!t.get(39),this._contentLeft=i.contentLeft,this._glyphMarginLeft=i.glyphMarginLeft,this._glyphMarginWidth=i.glyphMarginWidth,!0}onScrollChanged(e){return super.onScrollChanged(e)||e.scrollTopChanged}prepareRender(e){}render(e){this._domNode.setLayerHinting(this._canUseLayerHinting),this._domNode.setContain("strict");const t=e.scrollTop-e.bigNumbersDelta;this._domNode.setTop(-t);const i=Math.min(e.scrollHeight,1e6);this._domNode.setHeight(i),this._domNode.setWidth(this._contentLeft),this._glyphMarginBackgroundDomNode.setLeft(this._glyphMarginLeft),this._glyphMarginBackgroundDomNode.setWidth(this._glyphMarginWidth),this._glyphMarginBackgroundDomNode.setHeight(i)}};Mh.CLASS_NAME="glyph-margin",Mh.OUTER_CLASS_NAME="margin";let pm=Mh;class G$ extends WI{constructor(e){super(),this._context=e,this._renderResult=null,this._context.addEventHandler(this)}dispose(){this._context.removeEventHandler(this),this._renderResult=null,super.dispose()}onConfigurationChanged(e){return!0}onDecorationsChanged(e){return!0}onFlushed(e){return!0}onLinesChanged(e){return!0}onLinesDeleted(e){return!0}onLinesInserted(e){return!0}onScrollChanged(e){return e.scrollTopChanged}onZonesChanged(e){return!0}_getDecorations(e){const t=e.getDecorationsInViewport(),i=[];let n=0;for(let s=0,r=t.length;s<r;s++){const a=t[s],c=a.options.marginClassName,h=a.options.zIndex;c&&(i[n++]=new jv(a.range.startLineNumber,a.range.endLineNumber,c,null,h))}return i}prepareRender(e){const t=e.visibleRange.startLineNumber,i=e.visibleRange.endLineNumber,n=this._render(t,i,this._getDecorations(e)),s=[];for(let r=t;r<=i;r++){const a=r-t,c=n[a].getDecorations();let h="";for(const d of c)h+='<div class="cmdr '+d.className+'" style=""></div>';s[a]=h}this._renderResult=s}render(e,t){return this._renderResult?this._renderResult[t-e]:""}}const Ar=class Ar{constructor(e,t,i,n){this._rgba8Brand=void 0,this.r=Ar._clamp(e),this.g=Ar._clamp(t),this.b=Ar._clamp(i),this.a=Ar._clamp(n)}equals(e){return this.r===e.r&&this.g===e.g&&this.b===e.b&&this.a===e.a}static _clamp(e){return e<0?0:e>255?255:e|0}};Ar.Empty=new Ar(0,0,0,0);let ws=Ar;const ib=class ib extends l.Disposable{static getInstance(){return this._INSTANCE||(this._INSTANCE=l.markAsSingleton(new ib)),this._INSTANCE}constructor(){super(),this._onDidChange=this._register(new l.Emitter),this.onDidChange=this._onDidChange.event,this._updateColorMap(),this._register(l.TokenizationRegistry.onDidChange(e=>{e.changedColorMap&&this._updateColorMap()}))}_updateColorMap(){const e=l.TokenizationRegistry.getColorMap();if(!e){this._colors=[];for(let i=0;i<=2;i++)this._colors[i]=ws.Empty;this._backgroundIsLight=!0;return}this._colors=[ws.Empty];for(let i=1;i<e.length;i++){const n=e[i].rgba;this._colors[i]=new ws(n.r,n.g,n.b,Math.round(n.a*255))}const t=e[2].getRelativeLuminance();this._backgroundIsLight=t>=.5,this._onDidChange.fire(void 0)}getColor(e){(e<1||e>=this._colors.length)&&(e=2);let t=this._colors[e];return t||(l.onUnexpectedError(new l.BugIndicatingError(`Missing color for colorId ${e}`)),t=ws.Empty),t}backgroundIsLight(){return this._backgroundIsLight}};ib._INSTANCE=null;let _m=ib;const j$=(()=>{const o=[];for(let e=32;e<=126;e++)o.push(e);return o.push(65533),o})(),q$=(o,e)=>(o-=32,o<0||o>96?e<=2?(o+96)%96:95:o);class Gd{constructor(e,t){this.scale=t,this._minimapCharRendererBrand=void 0,this.charDataNormal=Gd.soften(e,12/15),this.charDataLight=Gd.soften(e,50/60)}static soften(e,t){const i=new Uint8ClampedArray(e.length);for(let n=0,s=e.length;n<s;n++)i[n]=l.toUint8(e[n]*t);return i}renderChar(e,t,i,n,s,r,a,c,h,d,u){const f=1*this.scale,g=2*this.scale,m=u?1:g;if(t+f>e.width||i+m>e.height){console.warn("bad render request outside image data");return}const p=d?this.charDataLight:this.charDataNormal,b=q$(n,h),v=e.width*4,C=a.r,w=a.g,S=a.b,L=s.r-C,D=s.g-w,x=s.b-S,I=Math.max(r,c),T=e.data;let M=b*f*g,O=i*v+t*4;for(let P=0;P<m;P++){let k=O;for(let U=0;U<f;U++){const B=p[M++]/255*(r/255);T[k++]=C+L*B,T[k++]=w+D*B,T[k++]=S+x*B,T[k++]=I}O+=v}}blockRenderChar(e,t,i,n,s,r,a,c){const h=1*this.scale,d=2*this.scale,u=c?1:d;if(t+h>e.width||i+u>e.height){console.warn("bad render request outside image data");return}const f=e.width*4,g=.5*(s/255),m=r.r,p=r.g,b=r.b,v=n.r-m,C=n.g-p,w=n.b-b,S=m+v*g,L=p+C*g,D=b+w*g,x=Math.max(s,a),I=e.data;let T=i*f+t*4;for(let M=0;M<u;M++){let O=T;for(let P=0;P<h;P++)I[O++]=S,I[O++]=L,I[O++]=D,I[O++]=x;T+=f}}}const iT={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,A:10,B:11,C:12,D:13,E:14,F:15},nT=o=>{const e=new Uint8ClampedArray(o.length/2);for(let t=0;t<o.length;t+=2)e[t>>1]=iT[o[t]]<<4|iT[o[t+1]]&15;return e},sT={1:l.createSingleCallFunction(()=>nT("0000511D6300CF609C709645A78432005642574171487021003C451900274D35D762755E8B629C5BA856AF57BA649530C167D1512A272A3F6038604460398526BCA2A968DB6F8957C768BE5FBE2FB467CF5D8D5B795DC7625B5DFF50DE64C466DB2FC47CD860A65E9A2EB96CB54CE06DA763AB2EA26860524D3763536601005116008177A8705E53AB738E6A982F88BAA35B5F5B626D9C636B449B737E5B7B678598869A662F6B5B8542706C704C80736A607578685B70594A49715A4522E792")),2:l.createSingleCallFunction(()=>nT("000000000000000055394F383D2800008B8B1F210002000081B1CBCBCC820000847AAF6B9AAF2119BE08B8881AD60000A44FD07DCCF107015338130C00000000385972265F390B406E2437634B4B48031B12B8A0847000001E15B29A402F0000000000004B33460B00007A752C2A0000000000004D3900000084394B82013400ABA5CFC7AD9C0302A45A3E5A98AB000089A43382D97900008BA54AA087A70A0248A6A7AE6DBE0000BF6F94987EA40A01A06DCFA7A7A9030496C32F77891D0000A99FB1A0AFA80603B29AB9CA75930D010C0948354D3900000C0948354F37460D0028BE673D8400000000AF9D7B6E00002B007AA8933400007AA642675C2700007984CFB9C3985B768772A8A6B7B20000CAAECAAFC4B700009F94A6009F840009D09F9BA4CA9C0000CC8FC76DC87F0000C991C472A2000000A894A48CA7B501079BA2C9C69BA20000B19A5D3FA89000005CA6009DA2960901B0A7F0669FB200009D009E00B7890000DAD0F5D092820000D294D4C48BD10000B5A7A4A3B1A50402CAB6CBA6A2000000B5A7A4A3B1A8044FCDADD19D9CB00000B7778F7B8AAE0803C9AB5D3F5D3F00009EA09EA0BAB006039EA0989A8C7900009B9EF4D6B7C00000A9A7816CACA80000ABAC84705D3F000096DA635CDC8C00006F486F266F263D4784006124097B00374F6D2D6D2D6D4A3A95872322000000030000000000008D8939130000000000002E22A5C9CBC70600AB25C0B5C9B400061A2DB04CA67001082AA6BEBEBFC606002321DACBC19E03087AA08B6768380000282FBAC0B8CA7A88AD25BBA5A29900004C396C5894A6000040485A6E356E9442A32CD17EADA70000B4237923628600003E2DE9C1D7B500002F25BBA5A2990000231DB6AFB4A804023025C0B5CAB588062B2CBDBEC0C706882435A75CA20000002326BD6A82A908048B4B9A5A668000002423A09CB4BB060025259C9D8A7900001C1FCAB2C7C700002A2A9387ABA200002626A4A47D6E9D14333163A0C87500004B6F9C2D643A257049364936493647358A34438355497F1A0000A24C1D590000D38DFFBDD4CD3126"))};class jd{static create(e,t){if(this.lastCreated&&e===this.lastCreated.scale&&t===this.lastFontFamily)return this.lastCreated;let i;return sT[e]?i=new Gd(sT[e](),e):i=jd.createFromSampleData(jd.createSampleData(t).data,e),this.lastFontFamily=t,this.lastCreated=i,i}static createSampleData(e){const t=document.createElement("canvas"),i=t.getContext("2d");t.style.height="16px",t.height=16,t.width=960,t.style.width="960px",i.fillStyle="#ffffff",i.font=`bold 16px ${e}`,i.textBaseline="middle";let n=0;for(const s of j$)i.fillText(String.fromCharCode(s),n,16/2),n+=10;return i.getImageData(0,0,960,16)}static createFromSampleData(e,t){if(e.length!==61440)throw new Error("Unexpected source in MinimapCharRenderer");const n=jd._downsample(e,t);return new Gd(n,t)}static _downsampleChar(e,t,i,n,s){const r=1*s,a=2*s;let c=n,h=0;for(let d=0;d<a;d++){const u=d/a*16,f=(d+1)/a*16;for(let g=0;g<r;g++){const m=g/r*10,p=(g+1)/r*10;let b=0,v=0;for(let w=u;w<f;w++){const S=t+Math.floor(w)*3840,L=1-(w-Math.floor(w));for(let D=m;D<p;D++){const x=1-(D-Math.floor(D)),I=S+Math.floor(D)*4,T=x*L;v+=T,b+=e[I]*e[I+3]/255*T}}const C=b/v;h=Math.max(h,C),i[c++]=l.toUint8(C)}}return h}static _downsample(e,t){const i=2*t*1*t,n=i*96,s=new Uint8ClampedArray(n);let r=0,a=0,c=0;for(let h=0;h<96;h++)c=Math.max(c,this._downsampleChar(e,a,s,r,t)),r+=i,a+=40;if(c>0){const h=255/c;for(let d=0;d<n;d++)s[d]*=h}return s}}const Y$=l.isWindows?'"Segoe WPC", "Segoe UI", sans-serif':l.isMacintosh?"-apple-system, BlinkMacSystemFont, sans-serif":'system-ui, "Ubuntu", "Droid Sans", sans-serif';class oT{constructor(e,t){this._viewModelDecorationBrand=void 0,this.range=e,this.options=t}}function rT(o,e){return!(e.options.hideInCommentTokens&&aT(o,e)||e.options.hideInStringTokens&&lT(o,e))}function aT(o,e){return cT(o,e.range,t=>t===1)}function lT(o,e){return cT(o,e.range,t=>t===2)}function cT(o,e,t){for(let i=e.startLineNumber;i<=e.endLineNumber;i++){const n=o.tokenization.getLineTokens(i),s=i===e.startLineNumber,r=i===e.endLineNumber;let a=s?n.findTokenIndexAtOffset(e.startColumn-1):0;for(;a<n.getCount()&&!(r&&n.getStartOffset(a)>e.endColumn-1);){if(!t(n.getStandardTokenType(a)))return!1;a++}}return!0}const Z$=140,Q$=2;class yc{constructor(e,t,i){const n=e.options,s=n.get(163),r=n.get(165),a=r.minimap,c=n.get(59),h=n.get(81);this.renderMinimap=a.renderMinimap,this.size=h.size,this.minimapHeightIsEditorHeight=a.minimapHeightIsEditorHeight,this.scrollBeyondLastLine=n.get(119),this.paddingTop=n.get(96).top,this.paddingBottom=n.get(96).bottom,this.showSlider=h.showSlider,this.autohide=h.autohide,this.pixelRatio=s,this.typicalHalfwidthCharacterWidth=c.typicalHalfwidthCharacterWidth,this.lineHeight=n.get(75),this.minimapLeft=a.minimapLeft,this.minimapWidth=a.minimapWidth,this.minimapHeight=r.height,this.canvasInnerWidth=a.minimapCanvasInnerWidth,this.canvasInnerHeight=a.minimapCanvasInnerHeight,this.canvasOuterWidth=a.minimapCanvasOuterWidth,this.canvasOuterHeight=a.minimapCanvasOuterHeight,this.isSampling=a.minimapIsSampling,this.editorHeight=r.height,this.fontScale=a.minimapScale,this.minimapLineHeight=a.minimapLineHeight,this.minimapCharWidth=1*this.fontScale,this.sectionHeaderFontFamily=Y$,this.sectionHeaderFontSize=h.sectionHeaderFontSize*s,this.sectionHeaderLetterSpacing=h.sectionHeaderLetterSpacing,this.sectionHeaderFontColor=yc._getSectionHeaderColor(t,i.getColor(1)),this.charRenderer=l.createSingleCallFunction(()=>jd.create(this.fontScale,c.fontFamily)),this.defaultBackgroundColor=i.getColor(2),this.backgroundColor=yc._getMinimapBackground(t,this.defaultBackgroundColor),this.foregroundAlpha=yc._getMinimapForegroundOpacity(t)}static _getMinimapBackground(e,t){const i=e.getColor(XV);return i?new ws(i.rgba.r,i.rgba.g,i.rgba.b,Math.round(255*i.rgba.a)):t}static _getMinimapForegroundOpacity(e){const t=e.getColor(JV);return t?ws._clamp(Math.round(255*t.rgba.a)):255}static _getSectionHeaderColor(e,t){const i=e.getColor(nc);return i?new ws(i.rgba.r,i.rgba.g,i.rgba.b,Math.round(255*i.rgba.a)):t}equals(e){return this.renderMinimap===e.renderMinimap&&this.size===e.size&&this.minimapHeightIsEditorHeight===e.minimapHeightIsEditorHeight&&this.scrollBeyondLastLine===e.scrollBeyondLastLine&&this.paddingTop===e.paddingTop&&this.paddingBottom===e.paddingBottom&&this.showSlider===e.showSlider&&this.autohide===e.autohide&&this.pixelRatio===e.pixelRatio&&this.typicalHalfwidthCharacterWidth===e.typicalHalfwidthCharacterWidth&&this.lineHeight===e.lineHeight&&this.minimapLeft===e.minimapLeft&&this.minimapWidth===e.minimapWidth&&this.minimapHeight===e.minimapHeight&&this.canvasInnerWidth===e.canvasInnerWidth&&this.canvasInnerHeight===e.canvasInnerHeight&&this.canvasOuterWidth===e.canvasOuterWidth&&this.canvasOuterHeight===e.canvasOuterHeight&&this.isSampling===e.isSampling&&this.editorHeight===e.editorHeight&&this.fontScale===e.fontScale&&this.minimapLineHeight===e.minimapLineHeight&&this.minimapCharWidth===e.minimapCharWidth&&this.sectionHeaderFontSize===e.sectionHeaderFontSize&&this.sectionHeaderLetterSpacing===e.sectionHeaderLetterSpacing&&this.defaultBackgroundColor&&this.defaultBackgroundColor.equals(e.defaultBackgroundColor)&&this.backgroundColor&&this.backgroundColor.equals(e.backgroundColor)&&this.foregroundAlpha===e.foregroundAlpha}}class qd{constructor(e,t,i,n,s,r,a,c,h){this.scrollTop=e,this.scrollHeight=t,this.sliderNeeded=i,this._computedSliderRatio=n,this.sliderTop=s,this.sliderHeight=r,this.topPaddingLineCount=a,this.startLineNumber=c,this.endLineNumber=h}getDesiredScrollTopFromDelta(e){return Math.round(this.scrollTop+e/this._computedSliderRatio)}getDesiredScrollTopFromTouchLocation(e){return Math.round((e-this.sliderHeight/2)/this._computedSliderRatio)}intersectWithViewport(e){const t=Math.max(this.startLineNumber,e.startLineNumber),i=Math.min(this.endLineNumber,e.endLineNumber);return t>i?null:[t,i]}getYForLineNumber(e,t){return+(e-this.startLineNumber+this.topPaddingLineCount)*t}static create(e,t,i,n,s,r,a,c,h,d,u){const f=e.pixelRatio,g=e.minimapLineHeight,m=Math.floor(e.canvasInnerHeight/g),p=e.lineHeight;if(e.minimapHeightIsEditorHeight){let D=c*e.lineHeight+e.paddingTop+e.paddingBottom;e.scrollBeyondLastLine&&(D+=Math.max(0,s-e.lineHeight-e.paddingBottom));const x=Math.max(1,Math.floor(s*s/D)),I=Math.max(0,e.minimapHeight-x),T=I/(d-s),M=h*T,O=I>0,P=Math.floor(e.canvasInnerHeight/e.minimapLineHeight),k=Math.floor(e.paddingTop/e.lineHeight);return new qd(h,d,O,T,M,x,k,1,Math.min(a,P))}let b;if(r&&i!==a){const D=i-t+1;b=Math.floor(D*g/f)}else{const D=s/p;b=Math.floor(D*g/f)}const v=Math.floor(e.paddingTop/p);let C=Math.floor(e.paddingBottom/p);if(e.scrollBeyondLastLine){const D=s/p;C=Math.max(C,D-1)}let w;if(C>0){const D=s/p;w=(v+a+C-D-1)*g/f}else w=Math.max(0,(v+a)*g/f-b);w=Math.min(e.minimapHeight-b,w);const S=w/(d-s),L=h*S;if(m>=v+a+C){const D=w>0;return new qd(h,d,D,S,L,b,v,1,a)}else{let D;t>1?D=t+v:D=Math.max(1,h/p);let x,I=Math.max(1,Math.floor(D-L*f/g));I<v?(x=v-I+1,I=1):(x=0,I=Math.max(1,I-v)),u&&u.scrollHeight===d&&(u.scrollTop>h&&(I=Math.min(I,u.startLineNumber),x=Math.max(x,u.topPaddingLineCount)),u.scrollTop<h&&(I=Math.max(I,u.startLineNumber),x=Math.min(x,u.topPaddingLineCount)));const T=Math.min(a,I-x+m-1),M=(h-n)/p;let O;return h>=e.paddingTop?O=(t-I+x+M)*g/f:O=h/e.paddingTop*(x+M)*g/f,new qd(h,d,!0,S,O,b,x,I,T)}}}const nb=class nb{constructor(e){this.dy=e}onContentChanged(){this.dy=-1}onTokensChanged(){this.dy=-1}};nb.INVALID=new nb(-1);let bm=nb;class hT{constructor(e,t,i){this.renderedLayout=e,this._imageData=t,this._renderedLines=new kI({createLine:()=>bm.INVALID}),this._renderedLines._set(e.startLineNumber,i)}linesEquals(e){if(!this.scrollEquals(e))return!1;const i=this._renderedLines._get().lines;for(let n=0,s=i.length;n<s;n++)if(i[n].dy===-1)return!1;return!0}scrollEquals(e){return this.renderedLayout.startLineNumber===e.startLineNumber&&this.renderedLayout.endLineNumber===e.endLineNumber}_get(){const e=this._renderedLines._get();return{imageData:this._imageData,rendLineNumberStart:e.rendLineNumberStart,lines:e.lines}}onLinesChanged(e,t){return this._renderedLines.onLinesChanged(e,t)}onLinesDeleted(e,t){this._renderedLines.onLinesDeleted(e,t)}onLinesInserted(e,t){this._renderedLines.onLinesInserted(e,t)}onTokensChanged(e){return this._renderedLines.onTokensChanged(e)}}class Zv{constructor(e,t,i,n){this._backgroundFillData=Zv._createBackgroundFillData(t,i,n),this._buffers=[e.createImageData(t,i),e.createImageData(t,i)],this._lastUsedBuffer=0}getBuffer(){this._lastUsedBuffer=1-this._lastUsedBuffer;const e=this._buffers[this._lastUsedBuffer];return e.data.set(this._backgroundFillData),e}static _createBackgroundFillData(e,t,i){const n=i.r,s=i.g,r=i.b,a=i.a,c=new Uint8ClampedArray(e*t*4);let h=0;for(let d=0;d<t;d++)for(let u=0;u<e;u++)c[h]=n,c[h+1]=s,c[h+2]=r,c[h+3]=a,h+=4;return c}}class Yd{static compute(e,t,i){if(e.renderMinimap===0||!e.isSampling)return[null,[]];const{minimapLineCount:n}=Bl.computeContainedMinimapLineCount({viewLineCount:t,scrollBeyondLastLine:e.scrollBeyondLastLine,paddingTop:e.paddingTop,paddingBottom:e.paddingBottom,height:e.editorHeight,lineHeight:e.lineHeight,pixelRatio:e.pixelRatio}),s=t/n,r=s/2;if(!i||i.minimapLines.length===0){const b=[];if(b[0]=1,n>1){for(let v=0,C=n-1;v<C;v++)b[v]=Math.round(v*s+r);b[n-1]=t}return[new Yd(s,b),[]]}const a=i.minimapLines,c=a.length,h=[];let d=0,u=0,f=1;const g=10;let m=[],p=null;for(let b=0;b<n;b++){const v=Math.max(f,Math.round(b*s)),C=Math.max(v,Math.round((b+1)*s));for(;d<c&&a[d]<v;){if(m.length<g){const S=d+1+u;p&&p.type==="deleted"&&p._oldIndex===d-1?p.deleteToLineNumber++:(p={type:"deleted",_oldIndex:d,deleteFromLineNumber:S,deleteToLineNumber:S},m.push(p)),u--}d++}let w;if(d<c&&a[d]<=C)w=a[d],d++;else if(b===0?w=1:b+1===n?w=t:w=Math.round(b*s+r),m.length<g){const S=d+1+u;p&&p.type==="inserted"&&p._i===b-1?p.insertToLineNumber++:(p={type:"inserted",_i:b,insertFromLineNumber:S,insertToLineNumber:S},m.push(p)),u++}h[b]=w,f=w}if(m.length<g)for(;d<c;){const b=d+1+u;p&&p.type==="deleted"&&p._oldIndex===d-1?p.deleteToLineNumber++:(p={type:"deleted",_oldIndex:d,deleteFromLineNumber:b,deleteToLineNumber:b},m.push(p)),u--,d++}else m=[{type:"flush"}];return[new Yd(s,h),m]}constructor(e,t){this.samplingRatio=e,this.minimapLines=t}modelLineToMinimapLine(e){return Math.min(this.minimapLines.length,Math.max(1,Math.round(e/this.samplingRatio)))}modelLineRangeToMinimapLineRange(e,t){let i=this.modelLineToMinimapLine(e)-1;for(;i>0&&this.minimapLines[i-1]>=e;)i--;let n=this.modelLineToMinimapLine(t)-1;for(;n+1<this.minimapLines.length&&this.minimapLines[n+1]<=t;)n++;if(i===n){const s=this.minimapLines[i];if(s<e||s>t)return null}return[i+1,n+1]}decorationLineRangeToMinimapLineRange(e,t){let i=this.modelLineToMinimapLine(e),n=this.modelLineToMinimapLine(t);return e!==t&&n===i&&(n===this.minimapLines.length?i>1&&i--:n++),[i,n]}onLinesDeleted(e){const t=e.toLineNumber-e.fromLineNumber+1;let i=this.minimapLines.length,n=0;for(let s=this.minimapLines.length-1;s>=0&&!(this.minimapLines[s]<e.fromLineNumber);s--)this.minimapLines[s]<=e.toLineNumber?(this.minimapLines[s]=Math.max(1,e.fromLineNumber-1),i=Math.min(i,s),n=Math.max(n,s)):this.minimapLines[s]-=t;return[i,n]}onLinesInserted(e){const t=e.toLineNumber-e.fromLineNumber+1;for(let i=this.minimapLines.length-1;i>=0&&!(this.minimapLines[i]<e.fromLineNumber);i--)this.minimapLines[i]+=t}}class X$ extends gi{constructor(e){super(e),this._sectionHeaderCache=new l.LRUCache(10,1.5),this.tokensColorTracker=_m.getInstance(),this._selections=[],this._minimapSelections=null,this.options=new yc(this._context.configuration,this._context.theme,this.tokensColorTracker);const[t]=Yd.compute(this.options,this._context.viewModel.getLineCount(),null);this._samplingState=t,this._shouldCheckSampling=!1,this._actual=new Lc(e.theme,this)}dispose(){this._actual.dispose(),super.dispose()}getDomNode(){return this._actual.getDomNode()}_onOptionsMaybeChanged(){const e=new yc(this._context.configuration,this._context.theme,this.tokensColorTracker);return this.options.equals(e)?!1:(this.options=e,this._recreateLineSampling(),this._actual.onDidChangeOptions(),!0)}onConfigurationChanged(e){return this._onOptionsMaybeChanged()}onCursorStateChanged(e){return this._selections=e.selections,this._minimapSelections=null,this._actual.onSelectionChanged()}onDecorationsChanged(e){return e.affectsMinimap?this._actual.onDecorationsChanged():!1}onFlushed(e){return this._samplingState&&(this._shouldCheckSampling=!0),this._actual.onFlushed()}onLinesChanged(e){if(this._samplingState){const t=this._samplingState.modelLineRangeToMinimapLineRange(e.fromLineNumber,e.fromLineNumber+e.count-1);return t?this._actual.onLinesChanged(t[0],t[1]-t[0]+1):!1}else return this._actual.onLinesChanged(e.fromLineNumber,e.count)}onLinesDeleted(e){if(this._samplingState){const[t,i]=this._samplingState.onLinesDeleted(e);return t<=i&&this._actual.onLinesChanged(t+1,i-t+1),this._shouldCheckSampling=!0,!0}else return this._actual.onLinesDeleted(e.fromLineNumber,e.toLineNumber)}onLinesInserted(e){return this._samplingState?(this._samplingState.onLinesInserted(e),this._shouldCheckSampling=!0,!0):this._actual.onLinesInserted(e.fromLineNumber,e.toLineNumber)}onScrollChanged(e){return this._actual.onScrollChanged(e)}onThemeChanged(e){return this._actual.onThemeChanged(),this._onOptionsMaybeChanged(),!0}onTokensChanged(e){if(this._samplingState){const t=[];for(const i of e.ranges){const n=this._samplingState.modelLineRangeToMinimapLineRange(i.fromLineNumber,i.toLineNumber);n&&t.push({fromLineNumber:n[0],toLineNumber:n[1]})}return t.length?this._actual.onTokensChanged(t):!1}else return this._actual.onTokensChanged(e.ranges)}onTokensColorsChanged(e){return this._onOptionsMaybeChanged(),this._actual.onTokensColorsChanged()}onZonesChanged(e){return this._actual.onZonesChanged()}prepareRender(e){this._shouldCheckSampling&&(this._shouldCheckSampling=!1,this._recreateLineSampling())}render(e){let t=e.visibleRange.startLineNumber,i=e.visibleRange.endLineNumber;this._samplingState&&(t=this._samplingState.modelLineToMinimapLine(t),i=this._samplingState.modelLineToMinimapLine(i));const n={viewportContainsWhitespaceGaps:e.viewportData.whitespaceViewportData.length>0,scrollWidth:e.scrollWidth,scrollHeight:e.scrollHeight,viewportStartLineNumber:t,viewportEndLineNumber:i,viewportStartLineNumberVerticalOffset:e.getVerticalOffsetForLineNumber(t),scrollTop:e.scrollTop,scrollLeft:e.scrollLeft,viewportWidth:e.viewportWidth,viewportHeight:e.viewportHeight};this._actual.render(n)}_recreateLineSampling(){this._minimapSelections=null;const e=!!this._samplingState,[t,i]=Yd.compute(this.options,this._context.viewModel.getLineCount(),this._samplingState);if(this._samplingState=t,e&&this._samplingState)for(const n of i)switch(n.type){case"deleted":this._actual.onLinesDeleted(n.deleteFromLineNumber,n.deleteToLineNumber);break;case"inserted":this._actual.onLinesInserted(n.insertFromLineNumber,n.insertToLineNumber);break;case"flush":this._actual.onFlushed();break}}getLineCount(){return this._samplingState?this._samplingState.minimapLines.length:this._context.viewModel.getLineCount()}getRealLineCount(){return this._context.viewModel.getLineCount()}getLineContent(e){return this._samplingState?this._context.viewModel.getLineContent(this._samplingState.minimapLines[e-1]):this._context.viewModel.getLineContent(e)}getLineMaxColumn(e){return this._samplingState?this._context.viewModel.getLineMaxColumn(this._samplingState.minimapLines[e-1]):this._context.viewModel.getLineMaxColumn(e)}getMinimapLinesRenderingData(e,t,i){if(this._samplingState){const n=[];for(let s=0,r=t-e+1;s<r;s++)i[s]?n[s]=this._context.viewModel.getViewLineData(this._samplingState.minimapLines[e+s-1]):n[s]=null;return n}return this._context.viewModel.getMinimapLinesRenderingData(e,t,i).data}getSelections(){if(this._minimapSelections===null)if(this._samplingState){this._minimapSelections=[];for(const e of this._selections){const[t,i]=this._samplingState.decorationLineRangeToMinimapLineRange(e.startLineNumber,e.endLineNumber);this._minimapSelections.push(new l.Selection(t,e.startColumn,i,e.endColumn))}}else this._minimapSelections=this._selections;return this._minimapSelections}getMinimapDecorationsInViewport(e,t){return this._getMinimapDecorationsInViewport(e,t).filter(i=>!i.options.minimap?.sectionHeaderStyle)}getSectionHeaderDecorationsInViewport(e,t){const i=this.options.sectionHeaderFontSize/this.options.minimapLineHeight;return e=Math.floor(Math.max(1,e-i)),this._getMinimapDecorationsInViewport(e,t).filter(n=>!!n.options.minimap?.sectionHeaderStyle)}_getMinimapDecorationsInViewport(e,t){let i;if(this._samplingState){const s=this._samplingState.minimapLines[e-1],r=this._samplingState.minimapLines[t-1];i=new l.Range(s,1,r,this._context.viewModel.getLineMaxColumn(r))}else i=new l.Range(e,1,t,this._context.viewModel.getLineMaxColumn(t));const n=this._context.viewModel.getMinimapDecorationsInRange(i);if(this._samplingState){const s=[];for(const r of n){if(!r.options.minimap)continue;const a=r.range,c=this._samplingState.modelLineToMinimapLine(a.startLineNumber),h=this._samplingState.modelLineToMinimapLine(a.endLineNumber);s.push(new oT(new l.Range(c,a.startColumn,h,a.endColumn),r.options))}return s}return n}getSectionHeaderText(e,t){const i=e.options.minimap?.sectionHeaderText;if(!i)return null;const n=this._sectionHeaderCache.get(i);if(n)return n;const s=t(i);return this._sectionHeaderCache.set(i,s),s}getOptions(){return this._context.viewModel.model.getOptions()}revealLineNumber(e){this._samplingState&&(e=this._samplingState.minimapLines[e-1]),this._context.viewModel.revealRange("mouse",!1,new l.Range(e,1,e,1),1,0)}setScrollTop(e){this._context.viewModel.viewLayout.setScrollPosition({scrollTop:e},1)}}class Lc extends l.Disposable{constructor(e,t){super(),this._renderDecorations=!1,this._gestureInProgress=!1,this._isMouseOverMinimap=!1,this._theme=e,this._model=t,this._lastRenderData=null,this._buffers=null,this._selectionColor=this._theme.getColor(YE),this._domNode=we(document.createElement("div")),Jn.write(this._domNode,9),this._domNode.setClassName(this._getMinimapDomNodeClassName()),this._domNode.setPosition("absolute"),this._domNode.setAttribute("role","presentation"),this._domNode.setAttribute("aria-hidden","true"),this._shadow=we(document.createElement("div")),this._shadow.setClassName("minimap-shadow-hidden"),this._domNode.appendChild(this._shadow),this._canvas=we(document.createElement("canvas")),this._canvas.setPosition("absolute"),this._canvas.setLeft(0),this._domNode.appendChild(this._canvas),this._decorationsCanvas=we(document.createElement("canvas")),this._decorationsCanvas.setPosition("absolute"),this._decorationsCanvas.setClassName("minimap-decorations-layer"),this._decorationsCanvas.setLeft(0),this._domNode.appendChild(this._decorationsCanvas),this._slider=we(document.createElement("div")),this._slider.setPosition("absolute"),this._slider.setClassName("minimap-slider"),this._slider.setLayerHinting(!0),this._slider.setContain("strict"),this._domNode.appendChild(this._slider),this._sliderHorizontal=we(document.createElement("div")),this._sliderHorizontal.setPosition("absolute"),this._sliderHorizontal.setClassName("minimap-slider-horizontal"),this._slider.appendChild(this._sliderHorizontal),this._applyLayout(),this._hideDelayedScheduler=this._register(new l.RunOnceScheduler(()=>this._hideImmediatelyIfMouseIsOutside(),500)),this._register(At(this._domNode.domNode,F.MOUSE_OVER,()=>{this._isMouseOverMinimap=!0})),this._register(At(this._domNode.domNode,F.MOUSE_LEAVE,()=>{this._isMouseOverMinimap=!1})),this._pointerDownListener=At(this._domNode.domNode,F.POINTER_DOWN,i=>{i.preventDefault();const n=i.pointerType==="mouse",s=i.button===0;if(this._model.options.renderMinimap!==0&&this._lastRenderData){if(this._model.options.size!=="proportional"){if(s&&this._lastRenderData){const a=Qi(this._slider.domNode),c=a.top+a.height/2;this._startSliderDragging(i,c,this._lastRenderData.renderedLayout)}return}if(s||!n){const a=this._model.options.minimapLineHeight,c=this._model.options.canvasInnerHeight/this._model.options.canvasOuterHeight*i.offsetY;let d=Math.floor(c/a)+this._lastRenderData.renderedLayout.startLineNumber-this._lastRenderData.renderedLayout.topPaddingLineCount;d=Math.min(d,this._model.getLineCount()),this._model.revealLineNumber(d)}}}),this._sliderPointerMoveMonitor=new xd,this._sliderPointerDownListener=At(this._slider.domNode,F.POINTER_DOWN,i=>{i.preventDefault(),i.stopPropagation(),i.button===0&&this._lastRenderData&&this._startSliderDragging(i,i.pageY,this._lastRenderData.renderedLayout)}),this._gestureDisposable=li.addTarget(this._domNode.domNode),this._sliderTouchStartListener=R(this._domNode.domNode,_.EventType$1.Start,i=>{i.preventDefault(),i.stopPropagation(),this._lastRenderData&&(this._slider.toggleClassName("active",!0),this._gestureInProgress=!0,this.scrollDueToTouchEvent(i))},{passive:!1}),this._sliderTouchMoveListener=R(this._domNode.domNode,_.EventType$1.Change,i=>{i.preventDefault(),i.stopPropagation(),this._lastRenderData&&this._gestureInProgress&&this.scrollDueToTouchEvent(i)},{passive:!1}),this._sliderTouchEndListener=At(this._domNode.domNode,_.EventType$1.End,i=>{i.preventDefault(),i.stopPropagation(),this._gestureInProgress=!1,this._slider.toggleClassName("active",!1)})}_hideSoon(){this._hideDelayedScheduler.cancel(),this._hideDelayedScheduler.schedule()}_hideImmediatelyIfMouseIsOutside(){if(this._isMouseOverMinimap){this._hideSoon();return}this._domNode.toggleClassName("active",!1)}_startSliderDragging(e,t,i){if(!e.target||!(e.target instanceof Element))return;const n=e.pageX;this._slider.toggleClassName("active",!0);const s=(r,a)=>{const c=Qi(this._domNode.domNode),h=Math.min(Math.abs(a-n),Math.abs(a-c.left),Math.abs(a-c.left-c.width));if(l.isWindows&&h>Z$){this._model.setScrollTop(i.scrollTop);return}const d=r-t;this._model.setScrollTop(i.getDesiredScrollTopFromDelta(d))};e.pageY!==t&&s(e.pageY,n),this._sliderPointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,r=>s(r.pageY,r.pageX),()=>{this._slider.toggleClassName("active",!1)})}scrollDueToTouchEvent(e){const t=this._domNode.domNode.getBoundingClientRect().top,i=this._lastRenderData.renderedLayout.getDesiredScrollTopFromTouchLocation(e.pageY-t);this._model.setScrollTop(i)}dispose(){this._pointerDownListener.dispose(),this._sliderPointerMoveMonitor.dispose(),this._sliderPointerDownListener.dispose(),this._gestureDisposable.dispose(),this._sliderTouchStartListener.dispose(),this._sliderTouchMoveListener.dispose(),this._sliderTouchEndListener.dispose(),super.dispose()}_getMinimapDomNodeClassName(){const e=["minimap"];return this._model.options.showSlider==="always"?e.push("slider-always"):e.push("slider-mouseover"),this._model.options.autohide==="mouseover"?e.push("minimap-autohide-mouseover"):this._model.options.autohide==="scroll"&&e.push("minimap-autohide-scroll"),e.join(" ")}getDomNode(){return this._domNode}_applyLayout(){this._domNode.setLeft(this._model.options.minimapLeft),this._domNode.setWidth(this._model.options.minimapWidth),this._domNode.setHeight(this._model.options.minimapHeight),this._shadow.setHeight(this._model.options.minimapHeight),this._canvas.setWidth(this._model.options.canvasOuterWidth),this._canvas.setHeight(this._model.options.canvasOuterHeight),this._canvas.domNode.width=this._model.options.canvasInnerWidth,this._canvas.domNode.height=this._model.options.canvasInnerHeight,this._decorationsCanvas.setWidth(this._model.options.canvasOuterWidth),this._decorationsCanvas.setHeight(this._model.options.canvasOuterHeight),this._decorationsCanvas.domNode.width=this._model.options.canvasInnerWidth,this._decorationsCanvas.domNode.height=this._model.options.canvasInnerHeight,this._slider.setWidth(this._model.options.minimapWidth)}_getBuffer(){return this._buffers||this._model.options.canvasInnerWidth>0&&this._model.options.canvasInnerHeight>0&&(this._buffers=new Zv(this._canvas.domNode.getContext("2d"),this._model.options.canvasInnerWidth,this._model.options.canvasInnerHeight,this._model.options.backgroundColor)),this._buffers?this._buffers.getBuffer():null}onDidChangeOptions(){this._lastRenderData=null,this._buffers=null,this._applyLayout(),this._domNode.setClassName(this._getMinimapDomNodeClassName())}onSelectionChanged(){return this._renderDecorations=!0,!0}onDecorationsChanged(){return this._renderDecorations=!0,!0}onFlushed(){return this._lastRenderData=null,!0}onLinesChanged(e,t){return this._lastRenderData?this._lastRenderData.onLinesChanged(e,t):!1}onLinesDeleted(e,t){return this._lastRenderData?.onLinesDeleted(e,t),!0}onLinesInserted(e,t){return this._lastRenderData?.onLinesInserted(e,t),!0}onScrollChanged(e){return this._model.options.autohide==="scroll"&&(e.scrollTopChanged||e.scrollHeightChanged)&&(this._domNode.toggleClassName("active",!0),this._hideSoon()),this._renderDecorations=!0,!0}onThemeChanged(){return this._selectionColor=this._theme.getColor(YE),this._renderDecorations=!0,!0}onTokensChanged(e){return this._lastRenderData?this._lastRenderData.onTokensChanged(e):!1}onTokensColorsChanged(){return this._lastRenderData=null,this._buffers=null,!0}onZonesChanged(){return this._lastRenderData=null,!0}render(e){if(this._model.options.renderMinimap===0){this._shadow.setClassName("minimap-shadow-hidden"),this._sliderHorizontal.setWidth(0),this._sliderHorizontal.setHeight(0);return}e.scrollLeft+e.viewportWidth>=e.scrollWidth?this._shadow.setClassName("minimap-shadow-hidden"):this._shadow.setClassName("minimap-shadow-visible");const i=qd.create(this._model.options,e.viewportStartLineNumber,e.viewportEndLineNumber,e.viewportStartLineNumberVerticalOffset,e.viewportHeight,e.viewportContainsWhitespaceGaps,this._model.getLineCount(),this._model.getRealLineCount(),e.scrollTop,e.scrollHeight,this._lastRenderData?this._lastRenderData.renderedLayout:null);this._slider.setDisplay(i.sliderNeeded?"block":"none"),this._slider.setTop(i.sliderTop),this._slider.setHeight(i.sliderHeight),this._sliderHorizontal.setLeft(0),this._sliderHorizontal.setWidth(this._model.options.minimapWidth),this._sliderHorizontal.setTop(0),this._sliderHorizontal.setHeight(i.sliderHeight),this.renderDecorations(i),this._lastRenderData=this.renderLines(i)}renderDecorations(e){if(this._renderDecorations){this._renderDecorations=!1;const t=this._model.getSelections();t.sort(l.Range.compareRangesUsingStarts);const i=this._model.getMinimapDecorationsInViewport(e.startLineNumber,e.endLineNumber);i.sort((f,g)=>(f.options.zIndex||0)-(g.options.zIndex||0));const{canvasInnerWidth:n,canvasInnerHeight:s}=this._model.options,r=this._model.options.minimapLineHeight,a=this._model.options.minimapCharWidth,c=this._model.getOptions().tabSize,h=this._decorationsCanvas.domNode.getContext("2d");h.clearRect(0,0,n,s);const d=new dT(e.startLineNumber,e.endLineNumber,!1);this._renderSelectionLineHighlights(h,t,d,e,r),this._renderDecorationsLineHighlights(h,i,d,e,r);const u=new dT(e.startLineNumber,e.endLineNumber,null);this._renderSelectionsHighlights(h,t,u,e,r,c,a,n),this._renderDecorationsHighlights(h,i,u,e,r,c,a,n),this._renderSectionHeaders(e)}}_renderSelectionLineHighlights(e,t,i,n,s){if(!this._selectionColor||this._selectionColor.isTransparent())return;e.fillStyle=this._selectionColor.transparent(.5).toString();let r=0,a=0;for(const c of t){const h=n.intersectWithViewport(c);if(!h)continue;const[d,u]=h;for(let m=d;m<=u;m++)i.set(m,!0);const f=n.getYForLineNumber(d,s),g=n.getYForLineNumber(u,s);a>=f||(a>r&&e.fillRect(ls,r,e.canvas.width,a-r),r=f),a=g}a>r&&e.fillRect(ls,r,e.canvas.width,a-r)}_renderDecorationsLineHighlights(e,t,i,n,s){const r=new Map;for(let a=t.length-1;a>=0;a--){const c=t[a],h=c.options.minimap;if(!h||h.position!==1)continue;const d=n.intersectWithViewport(c.range);if(!d)continue;const[u,f]=d,g=h.getColor(this._theme.value);if(!g||g.isTransparent())continue;let m=r.get(g.toString());m||(m=g.transparent(.5).toString(),r.set(g.toString(),m)),e.fillStyle=m;for(let p=u;p<=f;p++){if(i.has(p))continue;i.set(p,!0);const b=n.getYForLineNumber(p,s);e.fillRect(ls,b,e.canvas.width,s)}}}_renderSelectionsHighlights(e,t,i,n,s,r,a,c){if(!(!this._selectionColor||this._selectionColor.isTransparent()))for(const h of t){const d=n.intersectWithViewport(h);if(!d)continue;const[u,f]=d;for(let g=u;g<=f;g++)this.renderDecorationOnLine(e,i,h,this._selectionColor,n,g,s,s,r,a,c)}}_renderDecorationsHighlights(e,t,i,n,s,r,a,c){for(const h of t){const d=h.options.minimap;if(!d)continue;const u=n.intersectWithViewport(h.range);if(!u)continue;const[f,g]=u,m=d.getColor(this._theme.value);if(!(!m||m.isTransparent()))for(let p=f;p<=g;p++)switch(d.position){case 1:this.renderDecorationOnLine(e,i,h.range,m,n,p,s,s,r,a,c);continue;case 2:{const b=n.getYForLineNumber(p,s);this.renderDecoration(e,m,2,b,Q$,s);continue}}}}renderDecorationOnLine(e,t,i,n,s,r,a,c,h,d,u){const f=s.getYForLineNumber(r,c);if(f+a<0||f>this._model.options.canvasInnerHeight)return;const{startLineNumber:g,endLineNumber:m}=i,p=g===r?i.startColumn:1,b=m===r?i.endColumn:this._model.getLineMaxColumn(r),v=this.getXOffsetForPosition(t,r,p,h,d,u),C=this.getXOffsetForPosition(t,r,b,h,d,u);this.renderDecoration(e,n,v,f,C-v,a)}getXOffsetForPosition(e,t,i,n,s,r){if(i===1)return ls;if((i-1)*s>=r)return r;let c=e.get(t);if(!c){const h=this._model.getLineContent(t);c=[ls];let d=ls;for(let u=1;u<h.length+1;u++){const f=h.charCodeAt(u-1),g=f===9?n*s:l.isFullWidthCharacter(f)?2*s:s,m=d+g;if(m>=r){c[u]=r;break}c[u]=m,d=m}e.set(t,c)}return i-1<c.length?c[i-1]:r}renderDecoration(e,t,i,n,s,r){e.fillStyle=t&&t.toString()||"",e.fillRect(i,n,s,r)}_renderSectionHeaders(e){const t=this._model.options.minimapLineHeight,i=this._model.options.sectionHeaderFontSize,n=this._model.options.sectionHeaderLetterSpacing,s=i*1.5,{canvasInnerWidth:r}=this._model.options,a=this._model.options.backgroundColor,c=`rgb(${a.r} ${a.g} ${a.b} / .7)`,h=this._model.options.sectionHeaderFontColor,d=`rgb(${h.r} ${h.g} ${h.b})`,u=d,f=this._decorationsCanvas.domNode.getContext("2d");f.letterSpacing=n+"px",f.font="500 "+i+"px "+this._model.options.sectionHeaderFontFamily,f.strokeStyle=u,f.lineWidth=.4;const g=this._model.getSectionHeaderDecorationsInViewport(e.startLineNumber,e.endLineNumber);g.sort((p,b)=>p.range.startLineNumber-b.range.startLineNumber);const m=Lc._fitSectionHeader.bind(null,f,r-ls);for(const p of g){const b=e.getYForLineNumber(p.range.startLineNumber,t)+i,v=b-i,C=v+2,w=this._model.getSectionHeaderText(p,m);Lc._renderSectionLabel(f,w,p.options.minimap?.sectionHeaderStyle===2,c,d,r,v,s,b,C)}}static _fitSectionHeader(e,t,i){if(!i)return i;const n="…",s=e.measureText(i).width,r=e.measureText(n).width;if(s<=t||s<=r)return i;const a=i.length,c=s/i.length,h=Math.floor((t-r)/c)-1;let d=Math.ceil(h/2);for(;d>0&&/\s/.test(i[d-1]);)--d;return i.substring(0,d)+n+i.substring(a-(h-d))}static _renderSectionLabel(e,t,i,n,s,r,a,c,h,d){t&&(e.fillStyle=n,e.fillRect(0,a,r,c),e.fillStyle=s,e.fillText(t,ls,h)),i&&(e.beginPath(),e.moveTo(0,d),e.lineTo(r,d),e.closePath(),e.stroke())}renderLines(e){const t=e.startLineNumber,i=e.endLineNumber,n=this._model.options.minimapLineHeight;if(this._lastRenderData&&this._lastRenderData.linesEquals(e)){const B=this._lastRenderData._get();return new hT(e,B.imageData,B.lines)}const s=this._getBuffer();if(!s)return null;const[r,a,c]=Lc._renderUntouchedLines(s,e.topPaddingLineCount,t,i,n,this._lastRenderData),h=this._model.getMinimapLinesRenderingData(t,i,c),d=this._model.getOptions().tabSize,u=this._model.options.defaultBackgroundColor,f=this._model.options.backgroundColor,g=this._model.options.foregroundAlpha,m=this._model.tokensColorTracker,p=m.backgroundIsLight(),b=this._model.options.renderMinimap,v=this._model.options.charRenderer(),C=this._model.options.fontScale,w=this._model.options.minimapCharWidth,L=(b===1?2:3)*C,D=n>L?Math.floor((n-L)/2):0,x=f.a/255,I=new ws(Math.round((f.r-u.r)*x+u.r),Math.round((f.g-u.g)*x+u.g),Math.round((f.b-u.b)*x+u.b),255);let T=e.topPaddingLineCount*n;const M=[];for(let B=0,G=i-t+1;B<G;B++)c[B]&&Lc._renderLine(s,I,f.a,p,b,w,m,g,v,T,D,d,h[B],C,n),M[B]=new bm(T),T+=n;const O=r===-1?0:r,k=(a===-1?s.height:a)-O;return this._canvas.domNode.getContext("2d").putImageData(s,0,0,0,O,s.width,k),new hT(e,s,M)}static _renderUntouchedLines(e,t,i,n,s,r){const a=[];if(!r){for(let T=0,M=n-i+1;T<M;T++)a[T]=!0;return[-1,-1,a]}const c=r._get(),h=c.imageData.data,d=c.rendLineNumberStart,u=c.lines,f=u.length,g=e.width,m=e.data,p=(n-i+1)*s*g*4;let b=-1,v=-1,C=-1,w=-1,S=-1,L=-1,D=t*s;for(let T=i;T<=n;T++){const M=T-i,O=T-d,P=O>=0&&O<f?u[O].dy:-1;if(P===-1){a[M]=!0,D+=s;continue}const k=P*g*4,U=(P+s)*g*4,B=D*g*4,G=(D+s)*g*4;w===k&&L===B?(w=U,L=G):(C!==-1&&(m.set(h.subarray(C,w),S),b===-1&&C===0&&C===S&&(b=w),v===-1&&w===p&&C===S&&(v=C)),C=k,w=U,S=B,L=G),a[M]=!1,D+=s}C!==-1&&(m.set(h.subarray(C,w),S),b===-1&&C===0&&C===S&&(b=w),v===-1&&w===p&&C===S&&(v=C));const x=b===-1?-1:b/(g*4),I=v===-1?-1:v/(g*4);return[x,I,a]}static _renderLine(e,t,i,n,s,r,a,c,h,d,u,f,g,m,p){const b=g.content,v=g.tokens,C=e.width-r,w=p===1;let S=ls,L=0,D=0;for(let x=0,I=v.getCount();x<I;x++){const T=v.getEndOffset(x),M=v.getForeground(x),O=a.getColor(M);for(;L<T;L++){if(S>C)return;const P=b.charCodeAt(L);if(P===9){const k=f-(L+D)%f;D+=k-1,S+=k*r}else if(P===32)S+=r;else{const k=l.isFullWidthCharacter(P)?2:1;for(let U=0;U<k;U++)if(s===2?h.blockRenderChar(e,S,d+u,O,c,t,i,w):h.renderChar(e,S,d+u,P,O,c,t,i,m,n,w),S+=r,S>C)return}}}}}class dT{constructor(e,t,i){this._startLineNumber=e,this._endLineNumber=t,this._defaultValue=i,this._values=[];for(let n=0,s=this._endLineNumber-this._startLineNumber+1;n<s;n++)this._values[n]=i}has(e){return this.get(e)!==this._defaultValue}set(e,t){e<this._startLineNumber||e>this._endLineNumber||(this._values[e-this._startLineNumber]=t)}get(e){return e<this._startLineNumber||e>this._endLineNumber?this._defaultValue:this._values[e-this._startLineNumber]}}class J$ extends gi{constructor(e,t){super(e),this._viewDomNode=t;const n=this._context.configuration.options.get(165);this._widgets={},this._verticalScrollbarWidth=n.verticalScrollbarWidth,this._minimapWidth=n.minimap.minimapWidth,this._horizontalScrollbarHeight=n.horizontalScrollbarHeight,this._editorHeight=n.height,this._editorWidth=n.width,this._viewDomNodeRect={top:0,left:0,width:0,height:0},this._domNode=we(document.createElement("div")),Jn.write(this._domNode,4),this._domNode.setClassName("overlayWidgets"),this.overflowingOverlayWidgetsDomNode=we(document.createElement("div")),Jn.write(this.overflowingOverlayWidgetsDomNode,5),this.overflowingOverlayWidgetsDomNode.setClassName("overflowingOverlayWidgets")}dispose(){super.dispose(),this._widgets={}}getDomNode(){return this._domNode}onConfigurationChanged(e){const i=this._context.configuration.options.get(165);return this._verticalScrollbarWidth=i.verticalScrollbarWidth,this._minimapWidth=i.minimap.minimapWidth,this._horizontalScrollbarHeight=i.horizontalScrollbarHeight,this._editorHeight=i.height,this._editorWidth=i.width,!0}_widgetCanOverflow(e){const i=this._context.configuration.options.get(4);return(e.allowEditorOverflow||!1)&&i}addWidget(e){const t=we(e.getDomNode());this._widgets[e.getId()]={widget:e,preference:null,domNode:t},t.setPosition("absolute"),t.setAttribute("widgetId",e.getId()),this._widgetCanOverflow(e)?this.overflowingOverlayWidgetsDomNode.appendChild(t):this._domNode.appendChild(t),this.setShouldRender(),this._updateMaxMinWidth()}setWidgetPosition(e,t){const i=this._widgets[e.getId()],n=t?t.preference:null,s=t?.stackOrdinal;return i.preference===n&&i.stack===s?(this._updateMaxMinWidth(),!1):(i.preference=n,i.stack=s,this.setShouldRender(),this._updateMaxMinWidth(),!0)}removeWidget(e){const t=e.getId();if(this._widgets.hasOwnProperty(t)){const n=this._widgets[t].domNode.domNode;delete this._widgets[t],n.remove(),this.setShouldRender(),this._updateMaxMinWidth()}}_updateMaxMinWidth(){let e=0;const t=Object.keys(this._widgets);for(let i=0,n=t.length;i<n;i++){const s=t[i],a=this._widgets[s].widget.getMinContentWidthInPx?.();typeof a<"u"&&(e=Math.max(e,a))}this._context.viewLayout.setOverlayWidgetsMinWidth(e)}_renderWidget(e,t){const i=e.domNode;if(e.preference===null){i.setTop("");return}const n=2*this._verticalScrollbarWidth+this._minimapWidth;if(e.preference===0||e.preference===1){if(e.preference===1){const s=i.domNode.clientHeight;i.setTop(this._editorHeight-s-2*this._horizontalScrollbarHeight)}else i.setTop(0);e.stack!==void 0?(i.setTop(t[e.preference]),t[e.preference]+=i.domNode.clientWidth):i.setRight(n)}else if(e.preference===2)i.domNode.style.right="50%",e.stack!==void 0?(i.setTop(t[2]),t[2]+=i.domNode.clientHeight):i.setTop(0);else{const{top:s,left:r}=e.preference;if(this._context.configuration.options.get(51)&&this._widgetCanOverflow(e.widget)){const c=this._viewDomNodeRect;i.setTop(s+c.top),i.setLeft(r+c.left),i.setPosition("fixed")}else i.setTop(s),i.setLeft(r),i.setPosition("absolute")}}prepareRender(e){this._viewDomNodeRect=Qi(this._viewDomNode.domNode)}render(e){this._domNode.setWidth(this._editorWidth);const t=Object.keys(this._widgets),i=Array.from({length:3},()=>0);t.sort((n,s)=>(this._widgets[n].stack||0)-(this._widgets[s].stack||0));for(let n=0,s=t.length;n<s;n++){const r=t[n];this._renderWidget(this._widgets[r],i)}}}class W${constructor(e,t){const i=e.options;this.lineHeight=i.get(75),this.pixelRatio=i.get(163),this.overviewRulerLanes=i.get(95),this.renderBorder=i.get(94);const n=t.getColor(r$);this.borderColor=n?n.toString():null,this.hideCursor=i.get(68);const s=t.getColor(fm);this.cursorColorSingle=s?s.transparent(.7).toString():null;const r=t.getColor(KI);this.cursorColorPrimary=r?r.transparent(.7).toString():null;const a=t.getColor(GI);this.cursorColorSecondary=a?a.transparent(.7).toString():null,this.themeType=t.type;const c=i.get(81),h=c.enabled,d=c.side,u=t.getColor(a$),f=l.TokenizationRegistry.getDefaultBackground();u?this.backgroundColor=u:h&&d==="right"?this.backgroundColor=f:this.backgroundColor=null;const m=i.get(165).overviewRuler;this.top=m.top,this.right=m.right,this.domWidth=m.width,this.domHeight=m.height,this.overviewRulerLanes===0?(this.canvasWidth=0,this.canvasHeight=0):(this.canvasWidth=this.domWidth*this.pixelRatio|0,this.canvasHeight=this.domHeight*this.pixelRatio|0);const[p,b]=this._initLanes(1,this.canvasWidth,this.overviewRulerLanes);this.x=p,this.w=b}_initLanes(e,t,i){const n=t-e;if(i>=3){const s=Math.floor(n/3),r=Math.floor(n/3),a=n-s-r,c=e,h=c+s,d=c+s+a;return[[0,c,h,c,d,c,h,c],[0,s,a,s+a,r,s+a+r,a+r,s+a+r]]}else if(i===2){const s=Math.floor(n/2),r=n-s,a=e,c=a+s;return[[0,a,a,a,c,a,a,a],[0,s,s,s,r,s+r,s+r,s+r]]}else{const s=e,r=n;return[[0,s,s,s,s,s,s,s],[0,r,r,r,r,r,r,r]]}}equals(e){return this.lineHeight===e.lineHeight&&this.pixelRatio===e.pixelRatio&&this.overviewRulerLanes===e.overviewRulerLanes&&this.renderBorder===e.renderBorder&&this.borderColor===e.borderColor&&this.hideCursor===e.hideCursor&&this.cursorColorSingle===e.cursorColorSingle&&this.cursorColorPrimary===e.cursorColorPrimary&&this.cursorColorSecondary===e.cursorColorSecondary&&this.themeType===e.themeType&&l.Color.equals(this.backgroundColor,e.backgroundColor)&&this.top===e.top&&this.right===e.right&&this.domWidth===e.domWidth&&this.domHeight===e.domHeight&&this.canvasWidth===e.canvasWidth&&this.canvasHeight===e.canvasHeight}}class H$ extends gi{constructor(e){super(e),this._actualShouldRender=0,this._renderedDecorations=[],this._renderedCursorPositions=[],this._domNode=we(document.createElement("canvas")),this._domNode.setClassName("decorationsOverviewRuler"),this._domNode.setPosition("absolute"),this._domNode.setLayerHinting(!0),this._domNode.setContain("strict"),this._domNode.setAttribute("aria-hidden","true"),this._updateSettings(!1),this._tokensColorTrackerListener=l.TokenizationRegistry.onDidChange(t=>{t.changedColorMap&&this._updateSettings(!0)}),this._cursorPositions=[{position:new l.Position(1,1),color:this._settings.cursorColorSingle}]}dispose(){super.dispose(),this._tokensColorTrackerListener.dispose()}_updateSettings(e){const t=new W$(this._context.configuration,this._context.theme);return this._settings&&this._settings.equals(t)?!1:(this._settings=t,this._domNode.setTop(this._settings.top),this._domNode.setRight(this._settings.right),this._domNode.setWidth(this._settings.domWidth),this._domNode.setHeight(this._settings.domHeight),this._domNode.domNode.width=this._settings.canvasWidth,this._domNode.domNode.height=this._settings.canvasHeight,e&&this._render(),!0)}_markRenderingIsNeeded(){return this._actualShouldRender=2,!0}_markRenderingIsMaybeNeeded(){return this._actualShouldRender=1,!0}onConfigurationChanged(e){return this._updateSettings(!1)?this._markRenderingIsNeeded():!1}onCursorStateChanged(e){this._cursorPositions=[];for(let t=0,i=e.selections.length;t<i;t++){let n=this._settings.cursorColorSingle;i>1&&(n=t===0?this._settings.cursorColorPrimary:this._settings.cursorColorSecondary),this._cursorPositions.push({position:e.selections[t].getPosition(),color:n})}return this._cursorPositions.sort((t,i)=>l.Position.compare(t.position,i.position)),this._markRenderingIsMaybeNeeded()}onDecorationsChanged(e){return e.affectsOverviewRuler?this._markRenderingIsMaybeNeeded():!1}onFlushed(e){return this._markRenderingIsNeeded()}onScrollChanged(e){return e.scrollHeightChanged?this._markRenderingIsNeeded():!1}onZonesChanged(e){return this._markRenderingIsNeeded()}onThemeChanged(e){return this._updateSettings(!1)?this._markRenderingIsNeeded():!1}getDomNode(){return this._domNode.domNode}prepareRender(e){}render(e){this._render(),this._actualShouldRender=0}_render(){const e=this._settings.backgroundColor;if(this._settings.overviewRulerLanes===0){this._domNode.setBackgroundColor(e?l.Color.Format.CSS.formatHexA(e):""),this._domNode.setDisplay("none");return}const t=this._context.viewModel.getAllOverviewRulerDecorations(this._context.theme);if(t.sort(Cd.compareByRenderingProps),this._actualShouldRender===1&&!Cd.equalsArr(this._renderedDecorations,t)&&(this._actualShouldRender=2),this._actualShouldRender===1&&!l.equals(this._renderedCursorPositions,this._cursorPositions,(m,p)=>m.position.lineNumber===p.position.lineNumber&&m.color===p.color)&&(this._actualShouldRender=2),this._actualShouldRender===1)return;this._renderedDecorations=t,this._renderedCursorPositions=this._cursorPositions,this._domNode.setDisplay("block");const i=this._settings.canvasWidth,n=this._settings.canvasHeight,s=this._settings.lineHeight,r=this._context.viewLayout,a=this._context.viewLayout.getScrollHeight(),c=n/a,h=6*this._settings.pixelRatio|0,d=h/2|0,u=this._domNode.domNode.getContext("2d");e?e.isOpaque()?(u.fillStyle=l.Color.Format.CSS.formatHexA(e),u.fillRect(0,0,i,n)):(u.clearRect(0,0,i,n),u.fillStyle=l.Color.Format.CSS.formatHexA(e),u.fillRect(0,0,i,n)):u.clearRect(0,0,i,n);const f=this._settings.x,g=this._settings.w;for(const m of t){const p=m.color,b=m.data;u.fillStyle=p;let v=0,C=0,w=0;for(let S=0,L=b.length/3;S<L;S++){const D=b[3*S],x=b[3*S+1],I=b[3*S+2];let T=r.getVerticalOffsetForLineNumber(x)*c|0,M=(r.getVerticalOffsetForLineNumber(I)+s)*c|0;if(M-T<h){let P=(T+M)/2|0;P<d?P=d:P+d>n&&(P=n-d),T=P-d,M=P+d}T>w+1||D!==v?(S!==0&&u.fillRect(f[v],C,g[v],w-C),v=D,C=T,w=M):M>w&&(w=M)}u.fillRect(f[v],C,g[v],w-C)}if(!this._settings.hideCursor){const m=2*this._settings.pixelRatio|0,p=m/2|0,b=this._settings.x[7],v=this._settings.w[7];let C=-100,w=-100,S=null;for(let L=0,D=this._cursorPositions.length;L<D;L++){const x=this._cursorPositions[L].color;if(!x)continue;const I=this._cursorPositions[L].position;let T=r.getVerticalOffsetForLineNumber(I.lineNumber)*c|0;T<p?T=p:T+p>n&&(T=n-p);const M=T-p,O=M+m;M>w+1||x!==S?(L!==0&&S&&u.fillRect(b,C,v,w-C),C=M,w=O):O>w&&(w=O),S=x,u.fillStyle=x}S&&u.fillRect(b,C,v,w-C)}this._settings.renderBorder&&this._settings.borderColor&&this._settings.overviewRulerLanes>0&&(u.beginPath(),u.lineWidth=1,u.strokeStyle=this._settings.borderColor,u.moveTo(0,0),u.lineTo(0,n),u.moveTo(1,0),u.lineTo(i,0),u.stroke())}}class uT{constructor(e,t,i){this._colorZoneBrand=void 0,this.from=e|0,this.to=t|0,this.colorId=i|0}static compare(e,t){return e.colorId===t.colorId?e.from===t.from?e.to-t.to:e.from-t.from:e.colorId-t.colorId}}class fT{constructor(e,t,i,n){this._overviewRulerZoneBrand=void 0,this.startLineNumber=e,this.endLineNumber=t,this.heightInLines=i,this.color=n,this._colorZone=null}static compare(e,t){return e.color===t.color?e.startLineNumber===t.startLineNumber?e.heightInLines===t.heightInLines?e.endLineNumber-t.endLineNumber:e.heightInLines-t.heightInLines:e.startLineNumber-t.startLineNumber:e.color<t.color?-1:1}setColorZone(e){this._colorZone=e}getColorZones(){return this._colorZone}}class e4{constructor(e){this._getVerticalOffsetForLine=e,this._zones=[],this._colorZonesInvalid=!1,this._lineHeight=0,this._domWidth=0,this._domHeight=0,this._outerHeight=0,this._pixelRatio=1,this._lastAssignedId=0,this._color2Id=Object.create(null),this._id2Color=[]}getId2Color(){return this._id2Color}setZones(e){this._zones=e,this._zones.sort(fT.compare)}setLineHeight(e){return this._lineHeight===e?!1:(this._lineHeight=e,this._colorZonesInvalid=!0,!0)}setPixelRatio(e){this._pixelRatio=e,this._colorZonesInvalid=!0}getDOMWidth(){return this._domWidth}getCanvasWidth(){return this._domWidth*this._pixelRatio}setDOMWidth(e){return this._domWidth===e?!1:(this._domWidth=e,this._colorZonesInvalid=!0,!0)}getDOMHeight(){return this._domHeight}getCanvasHeight(){return this._domHeight*this._pixelRatio}setDOMHeight(e){return this._domHeight===e?!1:(this._domHeight=e,this._colorZonesInvalid=!0,!0)}getOuterHeight(){return this._outerHeight}setOuterHeight(e){return this._outerHeight===e?!1:(this._outerHeight=e,this._colorZonesInvalid=!0,!0)}resolveColorZones(){const e=this._colorZonesInvalid,t=Math.floor(this._lineHeight),i=Math.floor(this.getCanvasHeight()),n=Math.floor(this._outerHeight),s=i/n,r=Math.floor(4*this._pixelRatio/2),a=[];for(let c=0,h=this._zones.length;c<h;c++){const d=this._zones[c];if(!e){const S=d.getColorZones();if(S){a.push(S);continue}}const u=this._getVerticalOffsetForLine(d.startLineNumber),f=d.heightInLines===0?this._getVerticalOffsetForLine(d.endLineNumber)+t:u+d.heightInLines*t,g=Math.floor(s*u),m=Math.floor(s*f);let p=Math.floor((g+m)/2),b=m-p;b<r&&(b=r),p-b<0&&(p=b),p+b>i&&(p=i-b);const v=d.color;let C=this._color2Id[v];C||(C=++this._lastAssignedId,this._color2Id[v]=C,this._id2Color[C]=v);const w=new uT(p-b,p+b,C);d.setColorZone(w),a.push(w)}return this._colorZonesInvalid=!1,a.sort(uT.compare),a}}class t4 extends ma{constructor(e,t){super(),this._context=e;const i=this._context.configuration.options;this._domNode=we(document.createElement("canvas")),this._domNode.setClassName(t),this._domNode.setPosition("absolute"),this._domNode.setLayerHinting(!0),this._domNode.setContain("strict"),this._zoneManager=new e4(n=>this._context.viewLayout.getVerticalOffsetForLineNumber(n)),this._zoneManager.setDOMWidth(0),this._zoneManager.setDOMHeight(0),this._zoneManager.setOuterHeight(this._context.viewLayout.getScrollHeight()),this._zoneManager.setLineHeight(i.get(75)),this._zoneManager.setPixelRatio(i.get(163)),this._context.addEventHandler(this)}dispose(){this._context.removeEventHandler(this),super.dispose()}onConfigurationChanged(e){const t=this._context.configuration.options;return e.hasChanged(75)&&(this._zoneManager.setLineHeight(t.get(75)),this._render()),e.hasChanged(163)&&(this._zoneManager.setPixelRatio(t.get(163)),this._domNode.setWidth(this._zoneManager.getDOMWidth()),this._domNode.setHeight(this._zoneManager.getDOMHeight()),this._domNode.domNode.width=this._zoneManager.getCanvasWidth(),this._domNode.domNode.height=this._zoneManager.getCanvasHeight(),this._render()),!0}onFlushed(e){return this._render(),!0}onScrollChanged(e){return e.scrollHeightChanged&&(this._zoneManager.setOuterHeight(e.scrollHeight),this._render()),!0}onZonesChanged(e){return this._render(),!0}getDomNode(){return this._domNode.domNode}setLayout(e){this._domNode.setTop(e.top),this._domNode.setRight(e.right);let t=!1;t=this._zoneManager.setDOMWidth(e.width)||t,t=this._zoneManager.setDOMHeight(e.height)||t,t&&(this._domNode.setWidth(this._zoneManager.getDOMWidth()),this._domNode.setHeight(this._zoneManager.getDOMHeight()),this._domNode.domNode.width=this._zoneManager.getCanvasWidth(),this._domNode.domNode.height=this._zoneManager.getCanvasHeight(),this._render())}setZones(e){this._zoneManager.setZones(e),this._render()}_render(){if(this._zoneManager.getOuterHeight()===0)return!1;const e=this._zoneManager.getCanvasWidth(),t=this._zoneManager.getCanvasHeight(),i=this._zoneManager.resolveColorZones(),n=this._zoneManager.getId2Color(),s=this._domNode.domNode.getContext("2d");return s.clearRect(0,0,e,t),i.length>0&&this._renderOneLane(s,i,n,e),!0}_renderOneLane(e,t,i,n){let s=0,r=0,a=0;for(const c of t){const h=c.colorId,d=c.from,u=c.to;h!==s?(s!==0&&e.fillRect(0,r,n,a-r),s=h,e.fillStyle=i[s],r=d,a=u):a>=d?a=Math.max(a,u):(e.fillRect(0,r,n,a-r),r=d,a=u)}e.fillRect(0,r,n,a-r)}}class i4 extends gi{constructor(e){super(e),this.domNode=we(document.createElement("div")),this.domNode.setAttribute("role","presentation"),this.domNode.setAttribute("aria-hidden","true"),this.domNode.setClassName("view-rulers"),this._renderedRulers=[];const t=this._context.configuration.options;this._rulers=t.get(116),this._typicalHalfwidthCharacterWidth=t.get(59).typicalHalfwidthCharacterWidth}onConfigurationChanged(e){const t=this._context.configuration.options;return this._rulers=t.get(116),this._typicalHalfwidthCharacterWidth=t.get(59).typicalHalfwidthCharacterWidth,!0}onScrollChanged(e){return e.scrollHeightChanged}prepareRender(e){}_ensureRulersCount(){const e=this._renderedRulers.length,t=this._rulers.length;if(e===t)return;if(e<t){let n=t-e;for(;n>0;){const s=we(document.createElement("div"));s.setClassName("view-ruler"),s.setWidth("1ch"),this.domNode.appendChild(s),this._renderedRulers.push(s),n--}return}let i=e-t;for(;i>0;){const n=this._renderedRulers.pop();this.domNode.removeChild(n),i--}}render(e){this._ensureRulersCount();for(let t=0,i=this._rulers.length;t<i;t++){const n=this._renderedRulers[t],s=this._rulers[t];n.setBoxShadow(s.color?`1px 0 0 0 ${s.color} inset`:""),n.setHeight(Math.min(e.scrollHeight,1e6)),n.setLeft(s.column*this._typicalHalfwidthCharacterWidth)}}}class n4 extends gi{constructor(e){super(e),this._scrollTop=0,this._width=0,this._updateWidth(),this._shouldShow=!1;const i=this._context.configuration.options.get(117);this._useShadows=i.useShadows,this._domNode=we(document.createElement("div")),this._domNode.setAttribute("role","presentation"),this._domNode.setAttribute("aria-hidden","true")}_updateShouldShow(){const e=this._useShadows&&this._scrollTop>0;return this._shouldShow!==e?(this._shouldShow=e,!0):!1}getDomNode(){return this._domNode}_updateWidth(){const t=this._context.configuration.options.get(165);t.minimap.renderMinimap===0||t.minimap.minimapWidth>0&&t.minimap.minimapLeft===0?this._width=t.width:this._width=t.width-t.verticalScrollbarWidth}onConfigurationChanged(e){const i=this._context.configuration.options.get(117);return this._useShadows=i.useShadows,this._updateWidth(),this._updateShouldShow(),!0}onScrollChanged(e){return this._scrollTop=e.scrollTop,this._updateShouldShow()}prepareRender(e){}render(e){this._domNode.setWidth(this._width),this._domNode.setClassName(this._shouldShow?"scroll-decoration":"")}}class s4{constructor(e){this.left=e.left,this.width=e.width,this.startStyle=null,this.endStyle=null}}class o4{constructor(e,t){this.lineNumber=e,this.ranges=t}}function r4(o){return new s4(o)}function a4(o){return new o4(o.lineNumber,o.ranges.map(r4))}const lt=class lt extends hr{constructor(e){super(),this._previousFrameVisibleRangesWithStyle=[],this._context=e;const t=this._context.configuration.options;this._roundedSelection=t.get(115),this._typicalHalfwidthCharacterWidth=t.get(59).typicalHalfwidthCharacterWidth,this._selections=[],this._renderResult=null,this._context.addEventHandler(this)}dispose(){this._context.removeEventHandler(this),this._renderResult=null,super.dispose()}onConfigurationChanged(e){const t=this._context.configuration.options;return this._roundedSelection=t.get(115),this._typicalHalfwidthCharacterWidth=t.get(59).typicalHalfwidthCharacterWidth,!0}onCursorStateChanged(e){return this._selections=e.selections.slice(0),!0}onDecorationsChanged(e){return!0}onFlushed(e){return!0}onLinesChanged(e){return!0}onLinesDeleted(e){return!0}onLinesInserted(e){return!0}onScrollChanged(e){return e.scrollTopChanged}onZonesChanged(e){return!0}_visibleRangesHaveGaps(e){for(let t=0,i=e.length;t<i;t++)if(e[t].ranges.length>1)return!0;return!1}_enrichVisibleRangesWithStyle(e,t,i){const n=this._typicalHalfwidthCharacterWidth/4;let s=null,r=null;if(i&&i.length>0&&t.length>0){const a=t[0].lineNumber;if(a===e.startLineNumber)for(let h=0;!s&&h<i.length;h++)i[h].lineNumber===a&&(s=i[h].ranges[0]);const c=t[t.length-1].lineNumber;if(c===e.endLineNumber)for(let h=i.length-1;!r&&h>=0;h--)i[h].lineNumber===c&&(r=i[h].ranges[0]);s&&!s.startStyle&&(s=null),r&&!r.startStyle&&(r=null)}for(let a=0,c=t.length;a<c;a++){const h=t[a].ranges[0],d=h.left,u=h.left+h.width,f={top:0,bottom:0},g={top:0,bottom:0};if(a>0){const m=t[a-1].ranges[0].left,p=t[a-1].ranges[0].left+t[a-1].ranges[0].width;Cm(d-m)<n?f.top=2:d>m&&(f.top=1),Cm(u-p)<n?g.top=2:m<u&&u<p&&(g.top=1)}else s&&(f.top=s.startStyle.top,g.top=s.endStyle.top);if(a+1<c){const m=t[a+1].ranges[0].left,p=t[a+1].ranges[0].left+t[a+1].ranges[0].width;Cm(d-m)<n?f.bottom=2:m<d&&d<p&&(f.bottom=1),Cm(u-p)<n?g.bottom=2:u<p&&(g.bottom=1)}else r&&(f.bottom=r.startStyle.bottom,g.bottom=r.endStyle.bottom);h.startStyle=f,h.endStyle=g}}_getVisibleRangesWithStyle(e,t,i){const s=(t.linesVisibleRangesForRange(e,!0)||[]).map(a4);return!this._visibleRangesHaveGaps(s)&&this._roundedSelection&&this._enrichVisibleRangesWithStyle(t.visibleRange,s,i),s}_createSelectionPiece(e,t,i,n,s){return'<div class="cslr '+i+'" style="top:'+e.toString()+"px;bottom:"+t.toString()+"px;left:"+n.toString()+"px;width:"+s.toString()+'px;"></div>'}_actualRenderOneSelection(e,t,i,n){if(n.length===0)return;const s=!!n[0].ranges[0].startStyle,r=n[0].lineNumber,a=n[n.length-1].lineNumber;for(let c=0,h=n.length;c<h;c++){const d=n[c],u=d.lineNumber,f=u-t,g=i&&u===r?1:0,m=i&&u!==r&&u===a?1:0;let p="",b="";for(let v=0,C=d.ranges.length;v<C;v++){const w=d.ranges[v];if(s){const L=w.startStyle,D=w.endStyle;if(L.top===1||L.bottom===1){p+=this._createSelectionPiece(g,m,lt.SELECTION_CLASS_NAME,w.left-lt.ROUNDED_PIECE_WIDTH,lt.ROUNDED_PIECE_WIDTH);let x=lt.EDITOR_BACKGROUND_CLASS_NAME;L.top===1&&(x+=" "+lt.SELECTION_TOP_RIGHT),L.bottom===1&&(x+=" "+lt.SELECTION_BOTTOM_RIGHT),p+=this._createSelectionPiece(g,m,x,w.left-lt.ROUNDED_PIECE_WIDTH,lt.ROUNDED_PIECE_WIDTH)}if(D.top===1||D.bottom===1){p+=this._createSelectionPiece(g,m,lt.SELECTION_CLASS_NAME,w.left+w.width,lt.ROUNDED_PIECE_WIDTH);let x=lt.EDITOR_BACKGROUND_CLASS_NAME;D.top===1&&(x+=" "+lt.SELECTION_TOP_LEFT),D.bottom===1&&(x+=" "+lt.SELECTION_BOTTOM_LEFT),p+=this._createSelectionPiece(g,m,x,w.left+w.width,lt.ROUNDED_PIECE_WIDTH)}}let S=lt.SELECTION_CLASS_NAME;if(s){const L=w.startStyle,D=w.endStyle;L.top===0&&(S+=" "+lt.SELECTION_TOP_LEFT),L.bottom===0&&(S+=" "+lt.SELECTION_BOTTOM_LEFT),D.top===0&&(S+=" "+lt.SELECTION_TOP_RIGHT),D.bottom===0&&(S+=" "+lt.SELECTION_BOTTOM_RIGHT)}b+=this._createSelectionPiece(g,m,S,w.left,w.width)}e[f][0]+=p,e[f][1]+=b}}prepareRender(e){const t=[],i=e.visibleRange.startLineNumber,n=e.visibleRange.endLineNumber;for(let r=i;r<=n;r++){const a=r-i;t[a]=["",""]}const s=[];for(let r=0,a=this._selections.length;r<a;r++){const c=this._selections[r];if(c.isEmpty()){s[r]=null;continue}const h=this._getVisibleRangesWithStyle(c,e,this._previousFrameVisibleRangesWithStyle[r]);s[r]=h,this._actualRenderOneSelection(t,i,this._selections.length>1,h)}this._previousFrameVisibleRangesWithStyle=s,this._renderResult=t.map(([r,a])=>r+a)}render(e,t){if(!this._renderResult)return"";const i=t-e;return i<0||i>=this._renderResult.length?"":this._renderResult[i]}};lt.SELECTION_CLASS_NAME="selected-text",lt.SELECTION_TOP_LEFT="top-left-radius",lt.SELECTION_BOTTOM_LEFT="bottom-left-radius",lt.SELECTION_TOP_RIGHT="top-right-radius",lt.SELECTION_BOTTOM_RIGHT="bottom-right-radius",lt.EDITOR_BACKGROUND_CLASS_NAME="monaco-editor-background",lt.ROUNDED_PIECE_WIDTH=10;let Qv=lt;vs((o,e)=>{const t=o.getColor(DV);t&&!t.isTransparent()&&e.addRule(`.monaco-editor .view-line span.inline-selected-text { color: ${t}; }`)});function Cm(o){return o<0?-o:o}class gT{constructor(e,t,i,n,s,r,a){this.top=e,this.left=t,this.paddingLeft=i,this.width=n,this.height=s,this.textContent=r,this.textContentClassName=a}}var go;(function(o){o[o.Single=0]="Single",o[o.MultiPrimary=1]="MultiPrimary",o[o.MultiSecondary=2]="MultiSecondary"})(go||(go={}));class mT{constructor(e,t){this._context=e;const i=this._context.configuration.options,n=i.get(59);this._cursorStyle=i.get(161),this._typicalHalfwidthCharacterWidth=n.typicalHalfwidthCharacterWidth,this._lineCursorWidth=Math.min(i.get(37),this._typicalHalfwidthCharacterWidth),this._lineCursorHeight=i.get(38),this._isVisible=!0,this._domNode=we(document.createElement("div")),this._domNode.setClassName(`cursor ${Sc}`),this._domNode.setHeight(this._context.viewLayout.getLineHeightForLineNumber(1)),this._domNode.setTop(0),this._domNode.setLeft(0),Ot(this._domNode,n),this._domNode.setDisplay("none"),this._position=new l.Position(1,1),this._pluralityClass="",this.setPlurality(t),this._lastRenderedContent="",this._renderData=null}getDomNode(){return this._domNode}getPosition(){return this._position}setPlurality(e){switch(e){default:case go.Single:this._pluralityClass="";break;case go.MultiPrimary:this._pluralityClass="cursor-primary";break;case go.MultiSecondary:this._pluralityClass="cursor-secondary";break}}show(){this._isVisible||(this._domNode.setVisibility("inherit"),this._isVisible=!0)}hide(){this._isVisible&&(this._domNode.setVisibility("hidden"),this._isVisible=!1)}onConfigurationChanged(e){const t=this._context.configuration.options,i=t.get(59);return this._cursorStyle=t.get(161),this._typicalHalfwidthCharacterWidth=i.typicalHalfwidthCharacterWidth,this._lineCursorWidth=Math.min(t.get(37),this._typicalHalfwidthCharacterWidth),this._lineCursorHeight=t.get(38),Ot(this._domNode,i),!0}onCursorPositionChanged(e,t){return t?this._domNode.domNode.style.transitionProperty="none":this._domNode.domNode.style.transitionProperty="",this._position=e,!0}_getGraphemeAwarePosition(){const{lineNumber:e,column:t}=this._position,i=this._context.viewModel.getLineContent(e),[n,s]=l.getCharContainingOffset(i,t-1);return[new l.Position(e,n+1),i.substring(n,s)]}_prepareRender(e){let t="",i="";const[n,s]=this._getGraphemeAwarePosition(),r=this._context.viewLayout.getLineHeightForLineNumber(n.lineNumber),a=this._lineCursorHeight===0?r:Math.min(r,this._lineCursorHeight),c=(r-a)/2;if(this._cursorStyle===vt.Line||this._cursorStyle===vt.LineThin){const p=e.visibleRangeForPosition(n);if(!p||p.outsideRenderedLine)return null;const b=j(this._domNode.domNode);let v;this._cursorStyle===vt.Line?(v=ux(b,this._lineCursorWidth>0?this._lineCursorWidth:2),v>2&&(t=s,i=this._getTokenClassName(n))):v=ux(b,1);let C=p.left,w=0;v>=2&&C>=1&&(w=1,C-=w);const S=e.getVerticalOffsetForLineNumber(n.lineNumber)-e.bigNumbersDelta+c;return new gT(S,C,w,v,a,t,i)}const h=e.linesVisibleRangesForRange(new l.Range(n.lineNumber,n.column,n.lineNumber,n.column+s.length),!1);if(!h||h.length===0)return null;const d=h[0];if(d.outsideRenderedLine||d.ranges.length===0)return null;const u=d.ranges[0],f=s===" "?this._typicalHalfwidthCharacterWidth:u.width<1?this._typicalHalfwidthCharacterWidth:u.width;this._cursorStyle===vt.Block&&(t=s,i=this._getTokenClassName(n));let g=e.getVerticalOffsetForLineNumber(n.lineNumber)-e.bigNumbersDelta,m=r;return(this._cursorStyle===vt.Underline||this._cursorStyle===vt.UnderlineThin)&&(g+=r-2,m=2),new gT(g,u.left,0,f,m,t,i)}_getTokenClassName(e){const t=this._context.viewModel.getViewLineData(e.lineNumber),i=t.tokens.findTokenIndexAtOffset(e.column-1);return t.tokens.getClassName(i)}prepareRender(e){this._renderData=this._prepareRender(e)}render(e){return this._renderData?(this._lastRenderedContent!==this._renderData.textContent&&(this._lastRenderedContent=this._renderData.textContent,this._domNode.domNode.textContent=this._lastRenderedContent),this._domNode.setClassName(`cursor ${this._pluralityClass} ${Sc} ${this._renderData.textContentClassName}`),this._domNode.setDisplay("block"),this._domNode.setTop(this._renderData.top),this._domNode.setLeft(this._renderData.left),this._domNode.setPaddingLeft(this._renderData.paddingLeft),this._domNode.setWidth(this._renderData.width),this._domNode.setLineHeight(this._renderData.height),this._domNode.setHeight(this._renderData.height),{domNode:this._domNode.domNode,position:this._position,contentLeft:this._renderData.left,height:this._renderData.height,width:2}):(this._domNode.setDisplay("none"),null)}}const bf=class bf extends gi{constructor(e){super(e);const t=this._context.configuration.options;this._readOnly=t.get(104),this._cursorBlinking=t.get(32),this._cursorStyle=t.get(161),this._cursorSmoothCaretAnimation=t.get(33),this._editContextEnabled=t.get(170),this._selectionIsEmpty=!0,this._isComposingInput=!1,this._isVisible=!1,this._primaryCursor=new mT(this._context,go.Single),this._secondaryCursors=[],this._renderData=[],this._domNode=we(document.createElement("div")),this._domNode.setAttribute("role","presentation"),this._domNode.setAttribute("aria-hidden","true"),this._updateDomClassName(),this._domNode.appendChild(this._primaryCursor.getDomNode()),this._startCursorBlinkAnimation=new l.TimeoutTimer,this._cursorFlatBlinkInterval=new sC,this._blinkingEnabled=!1,this._editorHasFocus=!1,this._updateBlinking()}dispose(){super.dispose(),this._startCursorBlinkAnimation.dispose(),this._cursorFlatBlinkInterval.dispose()}getDomNode(){return this._domNode}onCompositionStart(e){return this._isComposingInput=!0,this._updateBlinking(),!0}onCompositionEnd(e){return this._isComposingInput=!1,this._updateBlinking(),!0}onConfigurationChanged(e){const t=this._context.configuration.options;this._readOnly=t.get(104),this._cursorBlinking=t.get(32),this._cursorStyle=t.get(161),this._cursorSmoothCaretAnimation=t.get(33),this._editContextEnabled=t.get(170),this._updateBlinking(),this._updateDomClassName(),this._primaryCursor.onConfigurationChanged(e);for(let i=0,n=this._secondaryCursors.length;i<n;i++)this._secondaryCursors[i].onConfigurationChanged(e);return!0}_onCursorPositionChanged(e,t,i){const n=this._secondaryCursors.length!==t.length||this._cursorSmoothCaretAnimation==="explicit"&&i!==3;if(this._primaryCursor.setPlurality(t.length?go.MultiPrimary:go.Single),this._primaryCursor.onCursorPositionChanged(e,n),this._updateBlinking(),this._secondaryCursors.length<t.length){const s=t.length-this._secondaryCursors.length;for(let r=0;r<s;r++){const a=new mT(this._context,go.MultiSecondary);this._domNode.domNode.insertBefore(a.getDomNode().domNode,this._primaryCursor.getDomNode().domNode.nextSibling),this._secondaryCursors.push(a)}}else if(this._secondaryCursors.length>t.length){const s=this._secondaryCursors.length-t.length;for(let r=0;r<s;r++)this._domNode.removeChild(this._secondaryCursors[0].getDomNode()),this._secondaryCursors.splice(0,1)}for(let s=0;s<t.length;s++)this._secondaryCursors[s].onCursorPositionChanged(t[s],n)}onCursorStateChanged(e){const t=[];for(let n=0,s=e.selections.length;n<s;n++)t[n]=e.selections[n].getPosition();this._onCursorPositionChanged(t[0],t.slice(1),e.reason);const i=e.selections[0].isEmpty();return this._selectionIsEmpty!==i&&(this._selectionIsEmpty=i,this._updateDomClassName()),!0}onDecorationsChanged(e){return!0}onFlushed(e){return!0}onFocusChanged(e){return this._editorHasFocus=e.isFocused,this._updateBlinking(),!1}onLinesChanged(e){return!0}onLinesDeleted(e){return!0}onLinesInserted(e){return!0}onScrollChanged(e){return!0}onTokensChanged(e){const t=i=>{for(let n=0,s=e.ranges.length;n<s;n++)if(e.ranges[n].fromLineNumber<=i.lineNumber&&i.lineNumber<=e.ranges[n].toLineNumber)return!0;return!1};if(t(this._primaryCursor.getPosition()))return!0;for(const i of this._secondaryCursors)if(t(i.getPosition()))return!0;return!1}onZonesChanged(e){return!0}_getCursorBlinking(){return this._isComposingInput&&!this._editContextEnabled||!this._editorHasFocus?0:this._readOnly?5:this._cursorBlinking}_updateBlinking(){this._startCursorBlinkAnimation.cancel(),this._cursorFlatBlinkInterval.cancel();const e=this._getCursorBlinking(),t=e===0,i=e===5;t?this._hide():this._show(),this._blinkingEnabled=!1,this._updateDomClassName(),!t&&!i&&(e===1?this._cursorFlatBlinkInterval.cancelAndSet(()=>{this._isVisible?this._hide():this._show()},bf.BLINK_INTERVAL,j(this._domNode.domNode)):this._startCursorBlinkAnimation.setIfNotSet(()=>{this._blinkingEnabled=!0,this._updateDomClassName()},bf.BLINK_INTERVAL))}_updateDomClassName(){this._domNode.setClassName(this._getClassName())}_getClassName(){let e="cursors-layer";switch(this._selectionIsEmpty||(e+=" has-selection"),this._cursorStyle){case vt.Line:e+=" cursor-line-style";break;case vt.Block:e+=" cursor-block-style";break;case vt.Underline:e+=" cursor-underline-style";break;case vt.LineThin:e+=" cursor-line-thin-style";break;case vt.BlockOutline:e+=" cursor-block-outline-style";break;case vt.UnderlineThin:e+=" cursor-underline-thin-style";break;default:e+=" cursor-line-style"}if(this._blinkingEnabled)switch(this._getCursorBlinking()){case 1:e+=" cursor-blink";break;case 2:e+=" cursor-smooth";break;case 3:e+=" cursor-phase";break;case 4:e+=" cursor-expand";break;case 5:e+=" cursor-solid";break;default:e+=" cursor-solid"}else e+=" cursor-solid";return(this._cursorSmoothCaretAnimation==="on"||this._cursorSmoothCaretAnimation==="explicit")&&(e+=" cursor-smooth-caret-animation"),e}_show(){this._primaryCursor.show();for(let e=0,t=this._secondaryCursors.length;e<t;e++)this._secondaryCursors[e].show();this._isVisible=!0}_hide(){this._primaryCursor.hide();for(let e=0,t=this._secondaryCursors.length;e<t;e++)this._secondaryCursors[e].hide();this._isVisible=!1}prepareRender(e){this._primaryCursor.prepareRender(e);for(let t=0,i=this._secondaryCursors.length;t<i;t++)this._secondaryCursors[t].prepareRender(e)}render(e){const t=[];let i=0;const n=this._primaryCursor.render(e);n&&(t[i++]=n);for(let s=0,r=this._secondaryCursors.length;s<r;s++){const a=this._secondaryCursors[s].render(e);a&&(t[i++]=a)}this._renderData=t}getLastRenderData(){return this._renderData}};bf.BLINK_INTERVAL=500;let Xv=bf;vs((o,e)=>{const t=[{class:".cursor",foreground:fm,background:Kv},{class:".cursor-primary",foreground:KI,background:UU},{class:".cursor-secondary",foreground:GI,background:$U}];for(const i of t){const n=o.getColor(i.foreground);if(n){let s=o.getColor(i.background);s||(s=n.opposite()),e.addRule(`.monaco-editor .cursors-layer ${i.class} { background-color: ${n}; border-color: ${n}; color: ${s}; }`),pa(o.type)&&e.addRule(`.monaco-editor .cursors-layer.has-selection ${i.class} { border-left: 1px solid ${s}; border-right: 1px solid ${s}; }`)}}});const Jv=()=>{throw new Error("Invalid change accessor")};class l4 extends gi{constructor(e){super(e);const t=this._context.configuration.options,i=t.get(165);this._lineHeight=t.get(75),this._contentWidth=i.contentWidth,this._contentLeft=i.contentLeft,this.domNode=we(document.createElement("div")),this.domNode.setClassName("view-zones"),this.domNode.setPosition("absolute"),this.domNode.setAttribute("role","presentation"),this.domNode.setAttribute("aria-hidden","true"),this.marginDomNode=we(document.createElement("div")),this.marginDomNode.setClassName("margin-view-zones"),this.marginDomNode.setPosition("absolute"),this.marginDomNode.setAttribute("role","presentation"),this.marginDomNode.setAttribute("aria-hidden","true"),this._zones={}}dispose(){super.dispose(),this._zones={}}_recomputeWhitespacesProps(){const e=this._context.viewLayout.getWhitespaces(),t=new Map;for(const n of e)t.set(n.id,n);let i=!1;return this._context.viewModel.changeWhitespace(n=>{const s=Object.keys(this._zones);for(let r=0,a=s.length;r<a;r++){const c=s[r],h=this._zones[c],d=this._computeWhitespaceProps(h.delegate);h.isInHiddenArea=d.isInHiddenArea;const u=t.get(c);u&&(u.afterLineNumber!==d.afterViewLineNumber||u.height!==d.heightInPx)&&(n.changeOneWhitespace(c,d.afterViewLineNumber,d.heightInPx),this._safeCallOnComputedHeight(h.delegate,d.heightInPx),i=!0)}}),i}onConfigurationChanged(e){const t=this._context.configuration.options,i=t.get(165);return this._lineHeight=t.get(75),this._contentWidth=i.contentWidth,this._contentLeft=i.contentLeft,e.hasChanged(75)&&this._recomputeWhitespacesProps(),!0}onLineMappingChanged(e){return this._recomputeWhitespacesProps()}onLinesDeleted(e){return!0}onScrollChanged(e){return e.scrollTopChanged||e.scrollWidthChanged}onZonesChanged(e){return!0}onLinesInserted(e){return!0}_getZoneOrdinal(e){return e.ordinal??e.afterColumn??1e4}_computeWhitespaceProps(e){if(e.afterLineNumber===0)return{isInHiddenArea:!1,afterViewLineNumber:0,heightInPx:this._heightInPixels(e),minWidthInPx:this._minWidthInPixels(e)};let t;if(typeof e.afterColumn<"u")t=this._context.viewModel.model.validatePosition({lineNumber:e.afterLineNumber,column:e.afterColumn});else{const r=this._context.viewModel.model.validatePosition({lineNumber:e.afterLineNumber,column:1}).lineNumber;t=new l.Position(r,this._context.viewModel.model.getLineMaxColumn(r))}let i;t.column===this._context.viewModel.model.getLineMaxColumn(t.lineNumber)?i=this._context.viewModel.model.validatePosition({lineNumber:t.lineNumber+1,column:1}):i=this._context.viewModel.model.validatePosition({lineNumber:t.lineNumber,column:t.column+1});const n=this._context.viewModel.coordinatesConverter.convertModelPositionToViewPosition(t,e.afterColumnAffinity,!0),s=e.showInHiddenAreas||this._context.viewModel.coordinatesConverter.modelPositionIsVisible(i);return{isInHiddenArea:!s,afterViewLineNumber:n.lineNumber,heightInPx:s?this._heightInPixels(e):0,minWidthInPx:this._minWidthInPixels(e)}}changeViewZones(e){let t=!1;return this._context.viewModel.changeWhitespace(i=>{const n={addZone:s=>(t=!0,this._addZone(i,s)),removeZone:s=>{s&&(t=this._removeZone(i,s)||t)},layoutZone:s=>{s&&(t=this._layoutZone(i,s)||t)}};c4(e,n),n.addZone=Jv,n.removeZone=Jv,n.layoutZone=Jv}),t}_addZone(e,t){const i=this._computeWhitespaceProps(t),s={whitespaceId:e.insertWhitespace(i.afterViewLineNumber,this._getZoneOrdinal(t),i.heightInPx,i.minWidthInPx),delegate:t,isInHiddenArea:i.isInHiddenArea,isVisible:!1,domNode:we(t.domNode),marginDomNode:t.marginDomNode?we(t.marginDomNode):null};return this._safeCallOnComputedHeight(s.delegate,i.heightInPx),s.domNode.setPosition("absolute"),s.domNode.domNode.style.width="100%",s.domNode.setDisplay("none"),s.domNode.setAttribute("monaco-view-zone",s.whitespaceId),this.domNode.appendChild(s.domNode),s.marginDomNode&&(s.marginDomNode.setPosition("absolute"),s.marginDomNode.domNode.style.width="100%",s.marginDomNode.setDisplay("none"),s.marginDomNode.setAttribute("monaco-view-zone",s.whitespaceId),this.marginDomNode.appendChild(s.marginDomNode)),this._zones[s.whitespaceId]=s,this.setShouldRender(),s.whitespaceId}_removeZone(e,t){if(this._zones.hasOwnProperty(t)){const i=this._zones[t];return delete this._zones[t],e.removeWhitespace(i.whitespaceId),i.domNode.removeAttribute("monaco-visible-view-zone"),i.domNode.removeAttribute("monaco-view-zone"),i.domNode.domNode.remove(),i.marginDomNode&&(i.marginDomNode.removeAttribute("monaco-visible-view-zone"),i.marginDomNode.removeAttribute("monaco-view-zone"),i.marginDomNode.domNode.remove()),this.setShouldRender(),!0}return!1}_layoutZone(e,t){if(this._zones.hasOwnProperty(t)){const i=this._zones[t],n=this._computeWhitespaceProps(i.delegate);return i.isInHiddenArea=n.isInHiddenArea,e.changeOneWhitespace(i.whitespaceId,n.afterViewLineNumber,n.heightInPx),this._safeCallOnComputedHeight(i.delegate,n.heightInPx),this.setShouldRender(),!0}return!1}shouldSuppressMouseDownOnViewZone(e){return this._zones.hasOwnProperty(e)?!!this._zones[e].delegate.suppressMouseDown:!1}_heightInPixels(e){return typeof e.heightInPx=="number"?e.heightInPx:typeof e.heightInLines=="number"?this._lineHeight*e.heightInLines:this._lineHeight}_minWidthInPixels(e){return typeof e.minWidthInPx=="number"?e.minWidthInPx:0}_safeCallOnComputedHeight(e,t){if(typeof e.onComputedHeight=="function")try{e.onComputedHeight(t)}catch(i){l.onUnexpectedError(i)}}_safeCallOnDomNodeTop(e,t){if(typeof e.onDomNodeTop=="function")try{e.onDomNodeTop(t)}catch(i){l.onUnexpectedError(i)}}prepareRender(e){}render(e){const t=e.viewportData.whitespaceViewportData,i={};let n=!1;for(const r of t)this._zones[r.id].isInHiddenArea||(i[r.id]=r,n=!0);const s=Object.keys(this._zones);for(let r=0,a=s.length;r<a;r++){const c=s[r],h=this._zones[c];let d=0,u=0,f="none";i.hasOwnProperty(c)?(d=i[c].verticalOffset-e.bigNumbersDelta,u=i[c].height,f="block",h.isVisible||(h.domNode.setAttribute("monaco-visible-view-zone","true"),h.isVisible=!0),this._safeCallOnDomNodeTop(h.delegate,e.getScrolledTopFromAbsoluteTop(i[c].verticalOffset))):(h.isVisible&&(h.domNode.removeAttribute("monaco-visible-view-zone"),h.isVisible=!1),this._safeCallOnDomNodeTop(h.delegate,e.getScrolledTopFromAbsoluteTop(-1e6))),h.domNode.setTop(d),h.domNode.setHeight(u),h.domNode.setDisplay(f),h.marginDomNode&&(h.marginDomNode.setTop(d),h.marginDomNode.setHeight(u),h.marginDomNode.setDisplay(f))}n&&(this.domNode.setWidth(Math.max(e.scrollWidth,this._contentWidth)),this.marginDomNode.setWidth(this._contentLeft))}}function c4(o,e){try{return o(e)}catch(t){l.onUnexpectedError(t);return}}class h4 extends hr{constructor(e){super(),this._context=e,this._options=new pT(this._context.configuration),this._selection=[],this._renderResult=null,this._context.addEventHandler(this)}dispose(){this._context.removeEventHandler(this),this._renderResult=null,super.dispose()}onConfigurationChanged(e){const t=new pT(this._context.configuration);return this._options.equals(t)?e.hasChanged(165):(this._options=t,!0)}onCursorStateChanged(e){return this._selection=e.selections,this._options.renderWhitespace==="selection"}onDecorationsChanged(e){return!0}onFlushed(e){return!0}onLinesChanged(e){return!0}onLinesDeleted(e){return!0}onLinesInserted(e){return!0}onScrollChanged(e){return e.scrollTopChanged}onZonesChanged(e){return!0}prepareRender(e){if(this._options.renderWhitespace==="none"){this._renderResult=null;return}this._renderResult=[];for(let t=e.viewportData.startLineNumber;t<=e.viewportData.endLineNumber;t++){const i=t-e.viewportData.startLineNumber,n=this._context.viewModel.getViewLineRenderingData(t);let s=null;if(this._options.renderWhitespace==="selection"){const r=this._selection;for(const a of r){if(a.endLineNumber<t||a.startLineNumber>t)continue;const c=a.startLineNumber===t?a.startColumn:n.minColumn,h=a.endLineNumber===t?a.endColumn:n.maxColumn;c<h&&(s||(s=[]),s.push(new l.OffsetRange(c-1,h-1)))}}this._renderResult[i]=this._applyRenderWhitespace(e,t,s,n)}}_applyRenderWhitespace(e,t,i,n){if(this._options.renderWhitespace==="selection"&&!i||this._options.renderWhitespace==="trailing"&&n.continuesWithWrappedLine)return"";const s=this._context.theme.getColor(Gv),r=this._options.renderWithSVG,a=n.content,c=this._options.stopRenderingLineAfter===-1?a.length:Math.min(this._options.stopRenderingLineAfter,a.length),h=n.continuesWithWrappedLine,d=n.minColumn-1,u=this._options.renderWhitespace==="boundary",f=this._options.renderWhitespace==="trailing",g=e.getLineHeightForLineNumber(t),m=this._options.middotWidth,p=this._options.wsmiddotWidth,b=this._options.spaceWidth,v=Math.abs(p-b),C=Math.abs(m-b),w=v<C?11825:183,S=this._options.canUseHalfwidthRightwardsArrow;let L="",D=!1,x=l.firstNonWhitespaceIndex(a),I;x===-1?(D=!0,x=c,I=c):I=l.lastNonWhitespaceIndex(a);let T=0,M=i&&i[T],O=0;for(let P=d;P<c;P++){const k=a.charCodeAt(P);if(M&&M.endExclusive<=P&&(T++,M=i&&i[T]),k!==9&&k!==32||f&&!D&&P<=I)continue;if(u&&P>=x&&P<=I&&k===32){const B=P-1>=0?a.charCodeAt(P-1):0,G=P+1<c?a.charCodeAt(P+1):0;if(B!==32&&G!==32)continue}if(u&&h&&P===c-1){const B=P-1>=0?a.charCodeAt(P-1):0;if(k===32&&B!==32&&B!==9)continue}if(i&&!(M&&M.start<=P&&P<M.endExclusive))continue;const U=e.visibleRangeForPosition(new l.Position(t,P+1));U&&(r?(O=Math.max(O,U.left),k===9?L+=this._renderArrow(g,b,U.left):L+=`<circle cx="${(U.left+b/2).toFixed(2)}" cy="${(g/2).toFixed(2)}" r="${(b/7).toFixed(2)}" />`):k===9?L+=`<div class="mwh" style="left:${U.left}px;height:${g}px;">${S?"→":"→"}</div>`:L+=`<div class="mwh" style="left:${U.left}px;height:${g}px;">${String.fromCharCode(w)}</div>`)}return r?(O=Math.round(O+b),`<svg style="bottom:0;position:absolute;width:${O}px;height:${g}px" viewBox="0 0 ${O} ${g}" xmlns="http://www.w3.org/2000/svg" fill="${s}">`+L+"</svg>"):L}_renderArrow(e,t,i){const n=t/7,s=t,r=e/2,a=i,c={x:0,y:n/2},h={x:100/125*s,y:c.y},d={x:h.x-.2*h.x,y:h.y+.2*h.x},u={x:d.x+.1*h.x,y:d.y+.1*h.x},f={x:u.x+.35*h.x,y:u.y-.35*h.x},g={x:f.x,y:-f.y},m={x:u.x,y:-u.y},p={x:d.x,y:-d.y},b={x:h.x,y:-h.y},v={x:c.x,y:-c.y};return`<path d="M ${[c,h,d,u,f,g,m,p,b,v].map(S=>`${(a+S.x).toFixed(2)} ${(r+S.y).toFixed(2)}`).join(" L ")}" />`}render(e,t){if(!this._renderResult)return"";const i=t-e;return i<0||i>=this._renderResult.length?"":this._renderResult[i]}}class pT{constructor(e){const t=e.options,i=t.get(59),n=t.get(47);n==="off"?(this.renderWhitespace="none",this.renderWithSVG=!1):n==="svg"?(this.renderWhitespace=t.get(113),this.renderWithSVG=!0):(this.renderWhitespace=t.get(113),this.renderWithSVG=!1),this.spaceWidth=i.spaceWidth,this.middotWidth=i.middotWidth,this.wsmiddotWidth=i.wsmiddotWidth,this.canUseHalfwidthRightwardsArrow=i.canUseHalfwidthRightwardsArrow,this.lineHeight=t.get(75),this.stopRenderingLineAfter=t.get(133)}equals(e){return this.renderWhitespace===e.renderWhitespace&&this.renderWithSVG===e.renderWithSVG&&this.spaceWidth===e.spaceWidth&&this.middotWidth===e.middotWidth&&this.wsmiddotWidth===e.wsmiddotWidth&&this.canUseHalfwidthRightwardsArrow===e.canUseHalfwidthRightwardsArrow&&this.lineHeight===e.lineHeight&&this.stopRenderingLineAfter===e.stopRenderingLineAfter}}class d4{constructor(e,t,i,n){this.selections=e,this.startLineNumber=t.startLineNumber|0,this.endLineNumber=t.endLineNumber|0,this.relativeVerticalOffset=t.relativeVerticalOffset,this.bigNumbersDelta=t.bigNumbersDelta|0,this.lineHeight=t.lineHeight|0,this.whitespaceViewportData=i,this._model=n,this.visibleRange=new l.Range(t.startLineNumber,this._model.getLineMinColumn(t.startLineNumber),t.endLineNumber,this._model.getLineMaxColumn(t.endLineNumber))}getViewLineRenderingData(e){return this._model.getViewportViewLineRenderingData(this.visibleRange,e)}getDecorationsInViewport(){return this._model.getDecorationsInViewport(this.visibleRange)}}class u4{get type(){return this._theme.type}get value(){return this._theme}constructor(e){this._theme=e}update(e){this._theme=e}getColor(e){return this._theme.getColor(e)}}class f4{constructor(e,t,i){this.configuration=e,this.theme=new u4(t),this.viewModel=i,this.viewLayout=i.viewLayout}addEventHandler(e){this.viewModel.addViewEventHandler(e)}removeEventHandler(e){this.viewModel.removeViewEventHandler(e)}}const Ea=new Float32Array([1,0,1,1,0,1,0,0,0,1,1,0]);function Ia(o){if(!o)throw new Error(`Value "${o}" cannot be null`);return o}function _T(o,e,t){let i=new e.ResizeObserver(n=>{const s=n.find(c=>c.target===o);if(!s)return;if(!("devicePixelContentBoxSize"in s)){i?.disconnect(),i=void 0;return}const r=s.devicePixelContentBoxSize[0].inlineSize,a=s.devicePixelContentBoxSize[0].blockSize;r>0&&a>0&&t(r,a)});try{i.observe(o,{box:["device-pixel-content-box"]})}catch{throw i.disconnect(),i=void 0,new l.BugIndicatingError("Could not observe device pixel dimensions")}return l.toDisposable(()=>i?.disconnect())}var g4=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s};let m4=0;class Zd extends l.Disposable{get cacheKey(){return`${this.fontFamily}_${this.fontSize}px`}constructor(e,t,i,n){super(),this.fontSize=e,this.fontFamily=t,this.devicePixelRatio=i,this._decorationStyleCache=n,this.id=m4++,this._workGlyph={source:null,boundingBox:{left:0,bottom:0,right:0,top:0},originOffset:{x:0,y:0},fontBoundingBoxAscent:0,fontBoundingBoxDescent:0},this._workGlyphConfig={chars:void 0,tokenMetadata:0,decorationStyleSetId:0},this._antiAliasing=l.isMacintosh?"greyscale":"subpixel";const s=Math.ceil(this.fontSize*i);this._canvas=new OffscreenCanvas(s*3,s*3),this._ctx=Ia(this._canvas.getContext("2d",{willReadFrequently:!0,alpha:this._antiAliasing==="greyscale"})),this._ctx.textBaseline="top",this._ctx.fillStyle="#FFFFFF",this._ctx.font=`${s}px ${this.fontFamily}`,this._textMetrics=this._ctx.measureText("A")}rasterizeGlyph(e,t,i,n){return e===""?{source:this._canvas,boundingBox:{top:0,left:0,bottom:-1,right:-1},originOffset:{x:0,y:0},fontBoundingBoxAscent:0,fontBoundingBoxDescent:0}:this._workGlyphConfig.chars===e&&this._workGlyphConfig.tokenMetadata===t&&this._workGlyphConfig.decorationStyleSetId===i?this._workGlyph:(this._workGlyphConfig.chars=e,this._workGlyphConfig.tokenMetadata=t,this._workGlyphConfig.decorationStyleSetId=i,this._rasterizeGlyph(e,t,i,n))}_rasterizeGlyph(e,t,i,n){const s=Math.ceil(this.fontSize*this.devicePixelRatio),r=s*3;this._canvas.width!==r&&(this._canvas.width=r,this._canvas.height=r),this._ctx.save();const a=(t&15)/10,c=Vi.getBackground(t),h=n[c]??n[2],d=this._decorationStyleCache.getStyleSet(i);this._antiAliasing==="subpixel"?(this._ctx.fillStyle=h,this._ctx.fillRect(0,0,this._canvas.width,this._canvas.height)):this._ctx.clearRect(0,0,this._canvas.width,this._canvas.height);const u=new ra(200),f=Vi.getFontStyle(t);f&1&&u.appendString("italic "),d?.bold!==void 0?d.bold&&u.appendString("bold "):f&2&&u.appendString("bold "),u.appendString(`${s}px ${this.fontFamily}`),this._ctx.font=u.build();const g=s,m=s;if(d?.color!==void 0?this._ctx.fillStyle=`#${d.color.toString(16).padStart(8,"0")}`:this._ctx.fillStyle=n[Vi.getForeground(t)],d?.opacity!==void 0&&(this._ctx.globalAlpha=d.opacity),this._ctx.textBaseline="top",this._ctx.fillText(e,g+a,m),d?.strikethrough){const b=Math.round(m-this._textMetrics.alphabeticBaseline*.65),v=d?.strikethroughThickness!==void 0?Math.round(d.strikethroughThickness*this.devicePixelRatio):Math.max(1,Math.floor(s/10));d?.strikethroughColor!==void 0&&(this._ctx.fillStyle=`#${d.strikethroughColor.toString(16).padStart(8,"0")}`),this._ctx.fillRect(g,b-Math.floor(v/2),Math.ceil(this._textMetrics.width),v)}this._ctx.restore();const p=this._ctx.getImageData(0,0,this._canvas.width,this._canvas.height);if(this._antiAliasing==="subpixel"){const b=parseInt(h.substring(1,3),16),v=parseInt(h.substring(3,5),16),C=parseInt(h.substring(5,7),16);this._clearColor(p,b,v,C),this._ctx.putImageData(p,0,0)}return this._findGlyphBoundingBox(p,this._workGlyph.boundingBox),this._workGlyph.source=this._canvas,this._workGlyph.originOffset.x=this._workGlyph.boundingBox.left-g,this._workGlyph.originOffset.y=this._workGlyph.boundingBox.top-m,this._workGlyph.fontBoundingBoxAscent=this._textMetrics.fontBoundingBoxAscent,this._workGlyph.fontBoundingBoxDescent=this._textMetrics.fontBoundingBoxDescent,this._workGlyph}_clearColor(e,t,i,n){for(let s=0;s<e.data.length;s+=4)e.data[s]===t&&e.data[s+1]===i&&e.data[s+2]===n&&(e.data[s+3]=0)}_findGlyphBoundingBox(e,t){const i=this._canvas.height,n=this._canvas.width;let s=!1;for(let r=0;r<i;r++){for(let a=0;a<n;a++){const c=r*n*4+a*4+3;if(e.data[c]!==0){t.top=r,s=!0;break}}if(s)break}t.left=0,s=!1;for(let r=0;r<n;r++){for(let a=0;a<i;a++){const c=a*n*4+r*4+3;if(e.data[c]!==0){t.left=r,s=!0;break}}if(s)break}t.right=n,s=!1;for(let r=n-1;r>=t.left;r--){for(let a=0;a<i;a++){const c=a*n*4+r*4+3;if(e.data[c]!==0){t.right=r,s=!0;break}}if(s)break}t.bottom=t.top,s=!1;for(let r=i-1;r>=0;r--){for(let a=0;a<n;a++){const c=r*n*4+a*4+3;if(e.data[c]!==0){t.bottom=r,s=!0;break}}if(s)break}}getTextMetrics(e){return this._ctx.measureText(e)}}g4([et],Zd.prototype,"cacheKey",null);var p4=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},_4=function(o,e){return function(t,i){e(t,i,o)}};let vm=class extends l.Disposable{constructor(e){super(),this._logService=e,this._tasks=[],this._i=0,this._register(l.toDisposable(()=>this.clear()))}enqueue(e){this._tasks.push(e),this._start()}clear(){this._idleCallback&&(this._cancelCallback(this._idleCallback),this._idleCallback=void 0),this._i=0,this._tasks.length=0}_start(){this._idleCallback||(this._idleCallback=this._requestCallback(this._process.bind(this)))}_process(e){this._idleCallback=void 0;let t=0,i=0,n=e.timeRemaining(),s=0;for(;this._i<this._tasks.length;){if(t=Date.now(),this._tasks[this._i]()||this._i++,t=Math.max(1,Date.now()-t),i=Math.max(t,i),s=e.timeRemaining(),i*1.5>s){n-t<-20&&this._logService.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(n-t))}ms`),this._start();return}n=s}this.clear()}};vm=p4([_4(0,ei)],vm);class b4 extends vm{_requestCallback(e){return Le().setTimeout(()=>e(this._createDeadline(16)))}_cancelCallback(e){Le().clearTimeout(e)}_createDeadline(e){const t=Date.now()+e;return{timeRemaining:()=>Math.max(0,t-Date.now())}}}class C4 extends vm{_requestCallback(e){return Le().requestIdleCallback(e)}_cancelCallback(e){Le().cancelIdleCallback(e)}}const v4="requestIdleCallback"in Le()?C4:b4;class w4{constructor(e,t){this._canvas=e,this._textureIndex=t,this._currentRow={x:0,y:0,h:0},this._allocatedGlyphs=new Set,this._nextIndex=0,this._ctx=Ia(this._canvas.getContext("2d",{willReadFrequently:!0}))}allocate(e){const t=e.boundingBox.right-e.boundingBox.left+1,i=e.boundingBox.bottom-e.boundingBox.top+1;if(t>this._canvas.width||i>this._canvas.height)throw new l.BugIndicatingError("Glyph is too large for the atlas page");if(e.boundingBox.right-e.boundingBox.left+1>this._canvas.width-this._currentRow.x&&(this._currentRow.x=0,this._currentRow.y+=this._currentRow.h,this._currentRow.h=1),this._currentRow.y+e.boundingBox.bottom-e.boundingBox.top+1>this._canvas.height)return;this._ctx.drawImage(e.source,e.boundingBox.left,e.boundingBox.top,t,i,this._currentRow.x,this._currentRow.y,t,i);const n={pageIndex:this._textureIndex,glyphIndex:this._nextIndex++,x:this._currentRow.x,y:this._currentRow.y,w:t,h:i,originOffsetX:e.originOffset.x,originOffsetY:e.originOffset.y,fontBoundingBoxAscent:e.fontBoundingBoxAscent,fontBoundingBoxDescent:e.fontBoundingBoxDescent};return this._currentRow.x+=t,this._currentRow.h=Math.max(this._currentRow.h,i),this._allocatedGlyphs.add(n),n}getUsagePreview(){const e=this._canvas.width,t=this._canvas.height,i=new OffscreenCanvas(e,t),n=Ia(i.getContext("2d"));n.fillStyle="#808080",n.fillRect(0,0,e,t);const s=new Map,r=new Map;for(const a of this._allocatedGlyphs)s.set(a.y,Math.max(s.get(a.y)??0,a.h)),r.set(a.y,Math.max(r.get(a.y)??0,a.x+a.w));for(const a of this._allocatedGlyphs)n.fillStyle="#4040FF",n.fillRect(a.x,a.y,a.w,a.h),n.fillStyle="#FF0000",n.fillRect(a.x,a.y+a.h,a.w,s.get(a.y)-a.h);for(const[a,c]of r.entries())a!==this._currentRow.y&&(n.fillStyle="#FF0000",n.fillRect(c,a,e-c,s.get(a)));return i.convertToBlob()}getStats(){const e=this._canvas.width,t=this._canvas.height;let i=0,n=0;const s=e*t,r=new Map,a=new Map;for(const c of this._allocatedGlyphs)r.set(c.y,Math.max(r.get(c.y)??0,c.h)),a.set(c.y,Math.max(a.get(c.y)??0,c.x+c.w));for(const c of this._allocatedGlyphs)i+=c.w*c.h,n+=c.w*(r.get(c.y)-c.h);for(const[c,h]of a.entries())c!==this._currentRow.y&&(n+=(e-h)*r.get(c));return[`page${this._textureIndex}:`,` Total: ${s} (${e}x${t})`,` Used: ${i} (${(i/s*100).toPrecision(2)}%)`,` Wasted: ${n} (${(n/s*100).toPrecision(2)}%)`,`Efficiency: ${(i/(i+n)*100).toPrecision(2)}%`].join(`
|
||
`)}}class S4{constructor(e,t,i){this._canvas=e,this._textureIndex=t,this._slabs=[],this._activeSlabsByDims=new l.NKeyMap,this._unusedRects=[],this._openRegionsByHeight=new Map,this._openRegionsByWidth=new Map,this._allocatedGlyphs=new Set,this._nextIndex=0,this._ctx=Ia(this._canvas.getContext("2d",{willReadFrequently:!0})),this._slabW=Math.min(i?.slabW??64<<Math.max(Math.floor(Le().devicePixelRatio)-1,0),this._canvas.width),this._slabH=Math.min(i?.slabH??this._slabW,this._canvas.height),this._slabsPerRow=Math.floor(this._canvas.width/this._slabW),this._slabsPerColumn=Math.floor(this._canvas.height/this._slabH)}allocate(e){const t=e.boundingBox.right-e.boundingBox.left+1,i=e.boundingBox.bottom-e.boundingBox.top+1;if(t>this._canvas.width||i>this._canvas.height)throw new l.BugIndicatingError("Glyph is too large for the atlas page");if(t>this._slabW||i>this._slabH){if(this._allocatedGlyphs.size>0)return;let h=this._canvas.width;for(;t<h/2&&i<h/2;)h/=2;this._slabW=h,this._slabH=h,this._slabsPerRow=Math.floor(this._canvas.width/this._slabW),this._slabsPerColumn=Math.floor(this._canvas.height/this._slabH)}const n={w:t,h:i};let s=this._activeSlabsByDims.get(n.w,n.h);if(s){const h=Math.floor(this._slabW/s.entryW)*Math.floor(this._slabH/s.entryH);s.count>=h&&(s=void 0)}let r,a;if(!s)if(t<i){const h=this._openRegionsByWidth.get(t);if(h?.length)for(let d=h.length-1;d>=0;d--){const u=h[d];if(u.w>=t&&u.h>=i){r=u.x,a=u.y,t<u.w&&this._unusedRects.push({x:u.x+t,y:u.y,w:u.w-t,h:i}),u.y+=i,u.h-=i,u.h===0&&(d===h.length-1?h.pop():this._unusedRects.splice(d,1));break}}}else{const h=this._openRegionsByHeight.get(i);if(h?.length)for(let d=h.length-1;d>=0;d--){const u=h[d];if(u.w>=t&&u.h>=i){r=u.x,a=u.y,i<u.h&&this._unusedRects.push({x:u.x,y:u.y+i,w:t,h:u.h-i}),u.x+=t,u.w-=t,u.h===0&&(d===h.length-1?h.pop():this._unusedRects.splice(d,1));break}}}if(r===void 0||a===void 0){if(!s){if(this._slabs.length>=this._slabsPerRow*this._slabsPerColumn)return;s={x:Math.floor(this._slabs.length%this._slabsPerRow)*this._slabW,y:Math.floor(this._slabs.length/this._slabsPerRow)*this._slabH,entryW:n.w,entryH:n.h,count:0};const d=this._slabW%s.entryW,u=this._slabH%s.entryH;d&&bT(this._openRegionsByWidth,d,{x:s.x+this._slabW-d,w:d,y:s.y,h:this._slabH-(u??0)}),u&&bT(this._openRegionsByHeight,u,{x:s.x,w:this._slabW,y:s.y+this._slabH-u,h:u}),this._slabs.push(s),this._activeSlabsByDims.set(s,n.w,n.h)}const h=Math.floor(this._slabW/s.entryW);r=s.x+Math.floor(s.count%h)*s.entryW,a=s.y+Math.floor(s.count/h)*s.entryH,s.count++}this._ctx.drawImage(e.source,e.boundingBox.left,e.boundingBox.top,t,i,r,a,t,i);const c={pageIndex:this._textureIndex,glyphIndex:this._nextIndex++,x:r,y:a,w:t,h:i,originOffsetX:e.originOffset.x,originOffsetY:e.originOffset.y,fontBoundingBoxAscent:e.fontBoundingBoxAscent,fontBoundingBoxDescent:e.fontBoundingBoxDescent};return this._allocatedGlyphs.add(c),c}getUsagePreview(){const e=this._canvas.width,t=this._canvas.height,i=new OffscreenCanvas(e,t),n=Ia(i.getContext("2d"));n.fillStyle="#808080",n.fillRect(0,0,e,t);let s=0,r=0,a=0;const c=64<<Math.floor(Le().devicePixelRatio)-1,h=c;for(const u of this._slabs){let f=0,g=0;for(let b=0;b<u.count;b++)f+u.entryW>c&&(f=0,g+=u.entryH),n.fillStyle="#FF0000",n.fillRect(u.x+f,u.y+g,u.entryW,u.entryH),s+=u.entryW*u.entryH,f+=u.entryW;const m=Math.floor(c/u.entryW),p=Math.floor(h/u.entryH);u.entryW*m*u.entryH*p}for(const u of this._allocatedGlyphs)r+=u.w*u.h,n.fillStyle="#4040FF",n.fillRect(u.x,u.y,u.w,u.h);const d=Array.from(this._openRegionsByWidth.values()).flat().concat(Array.from(this._openRegionsByHeight.values()).flat());for(const u of d)n.fillStyle="#FF000088",n.fillRect(u.x,u.y,u.w,u.h),a+=u.w*u.h;return n.globalAlpha=.5,n.drawImage(this._canvas,0,0),n.globalAlpha=1,i.convertToBlob()}getStats(){const e=this._canvas.width,t=this._canvas.height;let i=0,n=0,s=0,r=0,a=0;const c=e*t,h=64<<Math.floor(Le().devicePixelRatio)-1,d=h;for(const m of this._slabs){let p=0,b=0;for(let S=0;S<m.count;S++)p+m.entryW>h&&(p=0,b+=m.entryH),i+=m.entryW*m.entryH,p+=m.entryW;const v=Math.floor(h/m.entryW),C=Math.floor(d/m.entryH),w=m.entryW*v*m.entryH*C;s+=h*d-w}for(const m of this._allocatedGlyphs)n+=m.w*m.h;const u=Array.from(this._openRegionsByWidth.values()).flat().concat(Array.from(this._openRegionsByHeight.values()).flat());for(const m of u)a+=m.w*m.h;const f=s-a;r=i-(n-f);const g=n/(n+r+a);return[`page[${this._textureIndex}]:`,` Total: ${c}px (${e}x${t})`,` Used: ${n}px (${(n/c*100).toFixed(2)}%)`,` Wasted: ${r}px (${(r/c*100).toFixed(2)}%)`,`Restricted: ${a}px (${(a/c*100).toFixed(2)}%) (hard to allocate)`,`Efficiency: ${g===1?"100":(g*100).toFixed(2)}%`,` Slabs: ${this._slabs.length} of ${Math.floor(this._canvas.width/h)*Math.floor(this._canvas.height/d)}`].join(`
|
||
`)}}function bT(o,e,t){let i=o.get(e);i||(i=[],o.set(e,i)),i.push(t)}var y4=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},CT=function(o,e){return function(t,i){e(t,i,o)}},Wv;let Hn=(yl=class extends l.Disposable{get version(){return this._version}get usedArea(){return this._usedArea}get source(){return this._canvas}get glyphs(){return this._glyphInOrderSet.values()}constructor(e,t,i,n,s){switch(super(),this._logService=n,this._version=0,this._usedArea={left:0,top:0,right:0,bottom:0},this._glyphMap=new l.NKeyMap,this._glyphInOrderSet=new Set,this._canvas=new OffscreenCanvas(t,t),this._colorMap=s.getColorTheme().tokenColorMap,i){case"shelf":this._allocator=new w4(this._canvas,e);break;case"slab":this._allocator=new S4(this._canvas,e);break;default:this._allocator=i(this._canvas,e);break}this._register(l.toDisposable(()=>{this._canvas.width=1,this._canvas.height=1}))}getGlyph(e,t,i,n){return this._glyphMap.get(t,i,n,e.cacheKey)??this._createGlyph(e,t,i,n)}_createGlyph(e,t,i,n){if(this._glyphInOrderSet.size>=Wv.maximumGlyphCount)return;const s=e.rasterizeGlyph(t,i,n,this._colorMap),r=this._allocator.allocate(s);if(r!==void 0)return this._glyphMap.set(r,t,i,n,e.cacheKey),this._glyphInOrderSet.add(r),this._version++,this._usedArea.right=Math.max(this._usedArea.right,r.x+r.w-1),this._usedArea.bottom=Math.max(this._usedArea.bottom,r.y+r.h-1),this._logService.getLevel()===_.LogLevel.Trace&&this._logService.trace("New glyph",{chars:t,tokenMetadata:i,decorationStyleSetId:n,rasterizedGlyph:s,glyph:r}),r}getUsagePreview(){return this._allocator.getUsagePreview()}getStats(){return this._allocator.getStats()}},Wv=yl,yl.maximumGlyphCount=5e3,yl);Hn=Wv=y4([CT(3,ei),CT(4,_i)],Hn);var L4=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},vT=function(o,e){return function(t,i){e(t,i,o)}},wm;let dr=(Ll=class extends l.Disposable{get pages(){return this._pages}constructor(e,t,i,n,s){super(),this._maxTextureSize=e,this._decorationStyleCache=i,this._themeService=n,this._instantiationService=s,this._warmUpTask=this._register(new l.MutableDisposable),this._warmedUpRasterizers=new Set,this._pages=[],this._glyphPageIndex=new l.NKeyMap,this._onDidDeleteGlyphs=this._register(new l.Emitter),this.onDidDeleteGlyphs=this._onDidDeleteGlyphs.event,this._allocatorType=t?.allocatorType??"slab",this._register(l.Event.runAndSubscribe(this._themeService.onDidColorThemeChange,()=>{this._colorMap&&this.clear(),this._colorMap=this._themeService.getColorTheme().tokenColorMap}));const r=Math.max(1,Math.floor(Le().devicePixelRatio));this.pageSize=Math.min(1024*r,this._maxTextureSize),this._initFirstPage(),this._register(l.toDisposable(()=>l.dispose(this._pages)))}_initFirstPage(){const e=this._instantiationService.createInstance(Hn,0,this.pageSize,this._allocatorType);this._pages.push(e);const t=new Zd(1,"",1,this._decorationStyleCache);e.getGlyph(t,"",0,0),t.dispose()}clear(){for(const e of this._pages)e.dispose();this._pages.length=0,this._glyphPageIndex.clear(),this._warmedUpRasterizers.clear(),this._warmUpTask.clear(),this._initFirstPage(),this._onDidDeleteGlyphs.fire()}getGlyph(e,t,i,n,s){return i&=-2048,i|=Math.floor(s%1*10),this._warmedUpRasterizers.has(e.id)||(this._warmUpAtlas(e),this._warmedUpRasterizers.add(e.id)),this._tryGetGlyph(this._glyphPageIndex.get(t,i,n,e.cacheKey)??0,e,t,i,n)}_tryGetGlyph(e,t,i,n,s){return this._glyphPageIndex.set(e,i,n,s,t.cacheKey),this._pages[e].getGlyph(t,i,n,s)??(e+1<this._pages.length?this._tryGetGlyph(e+1,t,i,n,s):void 0)??this._getGlyphFromNewPage(t,i,n,s)}_getGlyphFromNewPage(e,t,i,n){if(this._pages.length>=wm.maximumPageCount)throw new Error(`Attempt to create a texture atlas page past the limit ${wm.maximumPageCount}`);return this._pages.push(this._instantiationService.createInstance(Hn,this._pages.length,this.pageSize,this._allocatorType)),this._glyphPageIndex.set(this._pages.length-1,t,i,n,e.cacheKey),this._pages[this._pages.length-1].getGlyph(e,t,i,n)}getStats(){return this._pages.map(e=>e.getStats())}_warmUpAtlas(e){const t=this._colorMap;if(!t)throw new l.BugIndicatingError("Cannot warm atlas without color map");this._warmUpTask.value?.clear();const i=this._warmUpTask.value=this._instantiationService.createInstance(v4);for(let n=65;n<=90;n++)for(const s of t.keys())i.enqueue(()=>{for(let r=0;r<1;r+=.1)this.getGlyph(e,String.fromCharCode(n),s<<15&16744448,0,r)});for(let n=97;n<=122;n++)for(const s of t.keys())i.enqueue(()=>{for(let r=0;r<1;r+=.1)this.getGlyph(e,String.fromCharCode(n),s<<15&16744448,0,r)});for(let n=33;n<=126;n++)for(const s of t.keys())i.enqueue(()=>{for(let r=0;r<1;r+=.1)this.getGlyph(e,String.fromCharCode(n),s<<15&16744448,0,r)})}},wm=Ll,Ll.maximumPageCount=16,Ll);dr=wm=L4([vT(3,_i),vT(4,me)],dr);var Qd;(function(o){o[o.Ignore=0]="Ignore",o[o.Info=1]="Info",o[o.Warning=2]="Warning",o[o.Error=3]="Error"})(Qd||(Qd={})),(function(o){const e="error",t="warning",i="warn",n="info",s="ignore";function r(c){return c?l.equalsIgnoreCase(e,c)?o.Error:l.equalsIgnoreCase(t,c)||l.equalsIgnoreCase(i,c)?o.Warning:l.equalsIgnoreCase(n,c)?o.Info:o.Ignore:o.Ignore}o.fromValue=r;function a(c){switch(c){case o.Error:return e;case o.Warning:return t;case o.Info:return n;default:return s}}o.toString=a})(Qd||(Qd={}));const rt=Qd;var Hv=rt;const yn=le("notificationService");class D4{}var Mi;(function(o){async function e(n){try{if(!navigator.gpu)throw new Error("This browser does not support WebGPU");const s=await navigator.gpu.requestAdapter();if(!s)throw new Error("This browser supports WebGPU but it appears to be disabled");return ew(await s.requestDevice())}catch(s){throw n&&n(s.message),s}}o.requestDevice=e;function t(n,s,r){const a=n.createBuffer(s);return r&&n.queue.writeBuffer(a,0,l.isFunction(r)?r():r),ew(a)}o.createBuffer=t;function i(n,s){return ew(n.createTexture(s))}o.createTexture=i})(Mi||(Mi={}));function ew(o){return{object:o,dispose:()=>o.destroy()}}class x4{get dataOffset(){return this._startIndex}get dirtySize(){if(!(this._startIndex===void 0||this._endIndex===void 0))return this._endIndex-this._startIndex+1}get isDirty(){return this._startIndex!==void 0}flag(e,t=1){return this._flag(e),t>1&&this._flag(e+t-1),e}_flag(e){(this._startIndex===void 0||e<this._startIndex)&&(this._startIndex=e),(this._endIndex===void 0||e>this._endIndex)&&(this._endIndex=e)}clear(){this._startIndex=void 0,this._endIndex=void 0}}function E4(o,e){return new I4(o,e)}class I4 extends l.Disposable{get entryCount(){return this._entries.size}get dirtyTracker(){return this._dirtyTracker}constructor(e,t){super(),this.propertySpecs=e,this.capacity=t,this._dirtyTracker=new x4,this._propertySpecsMap=new Map,this._entries=new l.LinkedList,this._onDidChange=this._register(new l.Emitter),this._onDidChangeBuffer=this._register(new l.Emitter),this.onDidChangeBuffer=this._onDidChangeBuffer.event,this.view=new Float32Array(t*e.length),this.buffer=this.view.buffer,this._entrySize=e.length;for(let i=0;i<e.length;i++){const n={offset:i,...e[i]};this._propertySpecsMap.set(n.name,n)}this._register(l.toDisposable(()=>l.dispose(this._entries)))}createEntry(e){this._entries.size===this.capacity&&(this._expandBuffer(),this._onDidChangeBuffer.fire());const t=new T4(this.view,this._propertySpecsMap,this._dirtyTracker,this._entries.size,e),i=this._entries.push(t),n=[];return n.push(l.Event.forward(t.onDidChange,this._onDidChange)),n.push(t.onWillDispose(()=>{const s=t.i;i(),this.view.set(this.view.subarray(s*this._entrySize+2,this._entries.size*this._entrySize+2),s*this._entrySize);for(const r of this._entries)r.i>s&&r.i--;this._dirtyTracker.flag(s,(this._entries.size-s)*this._entrySize),l.dispose(n)})),t}_expandBuffer(){this.capacity*=2;const e=new Float32Array(this.capacity*this._entrySize);e.set(this.view),this.view=e,this.buffer=this.view.buffer}}class T4 extends l.Disposable{constructor(e,t,i,n,s){super(),this._view=e,this._propertySpecsMap=t,this._dirtyTracker=i,this.i=n,this._onDidChange=this._register(new l.Emitter),this.onDidChange=this._onDidChange.event,this._onWillDispose=this._register(new l.Emitter),this.onWillDispose=this._onWillDispose.event;for(const r of this._propertySpecsMap.values())this._view[this.i*this._propertySpecsMap.size+r.offset]=s[r.name];this._dirtyTracker.flag(this.i*this._propertySpecsMap.size,this._propertySpecsMap.size)}dispose(){this._onWillDispose.fire(),super.dispose()}setRaw(e){if(e.length!==this._propertySpecsMap.size)throw new Error(`Data length ${e.length} does not match the number of properties in the collection (${this._propertySpecsMap.size})`);this._view.set(e,this.i*this._propertySpecsMap.size),this._dirtyTracker.flag(this.i*this._propertySpecsMap.size,this._propertySpecsMap.size)}}const N4=`
|
||
|
||
struct Vertex {
|
||
@location(0) position: vec2f,
|
||
};
|
||
|
||
struct LayoutInfo {
|
||
canvasDims: vec2f,
|
||
viewportOffset: vec2f,
|
||
viewportDims: vec2f,
|
||
}
|
||
|
||
struct ScrollOffset {
|
||
offset: vec2f,
|
||
}
|
||
|
||
struct Shape {
|
||
position: vec2f,
|
||
size: vec2f,
|
||
color: vec4f,
|
||
};
|
||
|
||
struct VSOutput {
|
||
@builtin(position) position: vec4f,
|
||
@location(1) color: vec4f,
|
||
};
|
||
|
||
// Uniforms
|
||
@group(0) @binding(1) var<uniform> layoutInfo: LayoutInfo;
|
||
|
||
// Storage buffers
|
||
@group(0) @binding(0) var<storage, read> shapes: array<Shape>;
|
||
@group(0) @binding(2) var<uniform> scrollOffset: ScrollOffset;
|
||
|
||
@vertex fn vs(
|
||
vert: Vertex,
|
||
@builtin(instance_index) instanceIndex: u32,
|
||
@builtin(vertex_index) vertexIndex : u32
|
||
) -> VSOutput {
|
||
let shape = shapes[instanceIndex];
|
||
|
||
var vsOut: VSOutput;
|
||
vsOut.position = vec4f(
|
||
(
|
||
// Top left corner
|
||
vec2f(-1, 1) +
|
||
// Convert pixel position to clipspace
|
||
vec2f( 2, -2) / layoutInfo.canvasDims *
|
||
// Shape position and size
|
||
(layoutInfo.viewportOffset - scrollOffset.offset + shape.position + vert.position * shape.size)
|
||
),
|
||
0.0,
|
||
1.0
|
||
);
|
||
vsOut.color = shape.color;
|
||
return vsOut;
|
||
}
|
||
|
||
@fragment fn fs(vsOut: VSOutput) -> @location(0) vec4f {
|
||
return vsOut.color;
|
||
}
|
||
`;class R4 extends ma{constructor(e,t,i,n,s,r){super(),this._context=e,this._contentLeft=t,this._devicePixelRatio=i,this._canvas=n,this._ctx=s,this._shapeBindBuffer=this._register(new l.MutableDisposable),this._initialized=!1,this._shapeCollection=this._register(E4([{name:"x"},{name:"y"},{name:"width"},{name:"height"},{name:"red"},{name:"green"},{name:"blue"},{name:"alpha"}],32)),this._context.addEventHandler(this),this._initWebgpu(r)}async _initWebgpu(e){if(this._device=await e,this._store.isDisposed)return;const t=navigator.gpu.getPreferredCanvasFormat();this._ctx.configure({device:this._device,format:t,alphaMode:"premultiplied"}),this._renderPassColorAttachment={view:null,loadOp:"load",storeOp:"store"},this._renderPassDescriptor={label:"Monaco rectangle renderer render pass",colorAttachments:[this._renderPassColorAttachment]};let i;{const a=new Float32Array(6),c=(h=this._canvas.width,d=this._canvas.height)=>(a[0]=h,a[1]=d,a[2]=Math.ceil(this._context.configuration.options.get(165).contentLeft*Le().devicePixelRatio),a[3]=0,a[4]=a[0]-a[2],a[5]=a[1]-a[3],a);i=this._register(Mi.createBuffer(this._device,{label:"Monaco rectangle renderer uniform buffer",size:24,usage:GPUBufferUsage.UNIFORM|GPUBufferUsage.COPY_DST},()=>c())).object,this._register(_T(this._canvas,Le(),(h,d)=>{this._device.queue.writeBuffer(i,0,c(h,d))}))}const n=2;this._scrollOffsetBindBuffer=this._register(Mi.createBuffer(this._device,{label:"Monaco rectangle renderer scroll offset buffer",size:n*Float32Array.BYTES_PER_ELEMENT,usage:GPUBufferUsage.UNIFORM|GPUBufferUsage.COPY_DST})).object,this._scrollOffsetValueBuffer=new Float32Array(n);const s=()=>Mi.createBuffer(this._device,{label:"Monaco rectangle renderer shape buffer",size:this._shapeCollection.buffer.byteLength,usage:GPUBufferUsage.STORAGE|GPUBufferUsage.COPY_DST});this._shapeBindBuffer.value=s(),this._register(l.Event.runAndSubscribe(this._shapeCollection.onDidChangeBuffer,()=>{this._shapeBindBuffer.value=s(),this._pipeline&&this._updateBindGroup(this._pipeline,i)})),this._vertexBuffer=this._register(Mi.createBuffer(this._device,{label:"Monaco rectangle renderer vertex buffer",size:Ea.byteLength,usage:GPUBufferUsage.VERTEX|GPUBufferUsage.COPY_DST},Ea)).object;const r=this._device.createShaderModule({label:"Monaco rectangle renderer shader module",code:N4});this._pipeline=this._device.createRenderPipeline({label:"Monaco rectangle renderer render pipeline",layout:"auto",vertex:{module:r,buffers:[{arrayStride:2*Float32Array.BYTES_PER_ELEMENT,attributes:[{shaderLocation:0,offset:0,format:"float32x2"}]}]},fragment:{module:r,targets:[{format:t,blend:{color:{srcFactor:"src-alpha",dstFactor:"one-minus-src-alpha"},alpha:{srcFactor:"src-alpha",dstFactor:"one-minus-src-alpha"}}}]}}),this._updateBindGroup(this._pipeline,i),this._initialized=!0}_updateBindGroup(e,t){this._bindGroup=this._device.createBindGroup({label:"Monaco rectangle renderer bind group",layout:e.getBindGroupLayout(0),entries:[{binding:0,resource:{buffer:this._shapeBindBuffer.value.object}},{binding:1,resource:{buffer:t}},{binding:2,resource:{buffer:this._scrollOffsetBindBuffer}}]})}register(e,t,i,n,s,r,a,c){return this._shapeCollection.createEntry({x:e,y:t,width:i,height:n,red:s,green:r,blue:a,alpha:c})}onScrollChanged(e){if(this._device){const t=Le().devicePixelRatio;this._scrollOffsetValueBuffer[0]=this._context.viewLayout.getCurrentScrollLeft()*t,this._scrollOffsetValueBuffer[1]=this._context.viewLayout.getCurrentScrollTop()*t,this._device.queue.writeBuffer(this._scrollOffsetBindBuffer,0,this._scrollOffsetValueBuffer)}return!0}_update(){if(!this._device)return;const e=this._shapeCollection;e.dirtyTracker.isDirty&&(this._device.queue.writeBuffer(this._shapeBindBuffer.value.object,0,e.buffer,e.dirtyTracker.dataOffset,e.dirtyTracker.dirtySize*e.view.BYTES_PER_ELEMENT),e.dirtyTracker.clear())}draw(e){if(!this._initialized)return;this._update();const t=this._device.createCommandEncoder({label:"Monaco rectangle renderer command encoder"});this._renderPassColorAttachment.view=this._ctx.getCurrentTexture().createView();const i=t.beginRenderPass(this._renderPassDescriptor);i.setPipeline(this._pipeline),i.setVertexBuffer(0,this._vertexBuffer),i.setBindGroup(0,this._bindGroup);const n=Math.ceil(this._contentLeft.get()*this._devicePixelRatio.get());i.setScissorRect(n,0,this._canvas.width-n,this._canvas.height),i.draw(Ea.length/2,this._shapeCollection.entryCount),i.end();const s=t.finish();this._device.queue.submit([s])}}class M4 extends l.Disposable{constructor(){super(),this._ruleCache=new Map,this._cssVariableCache=new Map,this._container=Q("div.monaco-decoration-css-rule-extractor"),this._dummyElement=Q("span"),this._container.appendChild(this._dummyElement),this._register(l.toDisposable(()=>this._container.remove()))}getStyleRules(e,t){const i=this._ruleCache.get(t);if(i)return i;this._dummyElement.className=t,e.appendChild(this._container);const n=this._getStyleRules(t);return this._ruleCache.set(t,n),e.removeChild(this._container),n}_getStyleRules(e){const t=[],n=[...od().styleSheets],s=e.split(" ").filter(r=>r.length>0);for(let r=0;r<n.length;r++){const a=n[r];this._collectMatchingRules(a.cssRules,s,t)}return t}_collectMatchingRules(e,t,i){for(const n of e)if(n instanceof CSSImportRule)n.styleSheet&&this._collectMatchingRules(n.styleSheet.cssRules,t,i);else if(n instanceof CSSStyleRule){for(const s of t){const r=`.${s}`,a=n.selectorText.indexOf(r);if(a!==-1){const c=a+r.length;if(n.selectorText.length===c||n.selectorText.substring(c,c+1).match(/[ :.]/)){i.push(n);break}}}n.cssRules?.length&&this._collectMatchingRules(n.cssRules,t,i)}}resolveCssVariable(e,t){let i=this._cssVariableCache.get(t);return i===void 0&&(e.appendChild(this._container),i=Le().getComputedStyle(this._container).getPropertyValue(t).trim(),e.removeChild(this._container),this._cssVariableCache.set(t,i)),i}clear(){this._ruleCache.clear(),this._cssVariableCache.clear()}}class A4{constructor(){this._nextId=1,this._cacheById=new Map,this._cacheByStyle=new l.NKeyMap}getOrCreateEntry(e,t,i,n,s,r){if(e===void 0&&t===void 0&&i===void 0&&n===void 0&&s===void 0&&r===void 0)return 0;const a=this._cacheByStyle.get(e??0,t?1:0,i===void 0?"":i.toFixed(2),n?1:0,s===void 0?"":s.toFixed(2),r??0);if(a)return a.id;const c=this._nextId++,h={id:c,color:e,bold:t,opacity:i,strikethrough:n,strikethroughThickness:s,strikethroughColor:r};return this._cacheById.set(c,h),this._cacheByStyle.set(h,e??0,t?1:0,i===void 0?"":i.toFixed(2),n?1:0,s===void 0?"":s.toFixed(2),r??0),c}getStyleSet(e){if(e!==0)return this._cacheById.get(e)}}var O4=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},Sm=function(o,e){return function(t,i){e(t,i,o)}},ti;_.ViewGpuContext=(Or=class extends l.Disposable{static get decorationCssRuleExtractor(){return ti._decorationCssRuleExtractor}static get decorationStyleCache(){return ti._decorationStyleCache}static get atlas(){if(!ti._atlas)throw new l.BugIndicatingError("Cannot call ViewGpuContext.textureAtlas before device is resolved");return ti._atlas}get atlas(){return ti.atlas}constructor(e,t,i,n,s){super(),this._instantiationService=t,this._notificationService=i,this.configurationService=n,this._themeService=s,this.maxGpuCols=2e3,this.canvas=we(document.createElement("canvas")),this.canvas.setClassName("editorCanvas"),this._register(l.Event.runAndSubscribe(n.onDidChangeConfiguration,h=>{if(!h||h.affectsConfiguration("editor.scrollbar.verticalScrollbarSize")){const d=n.getValue("editor").scrollbar?.verticalScrollbarSize??14;this.canvas.domNode.style.boxSizing="border-box",this.canvas.domNode.style.paddingRight=`${d}px`}})),this.ctx=Ia(this.canvas.domNode.getContext("webgpu")),ti.device||(ti.device=Mi.requestDevice(h=>{const d=[{label:l.localize(82,"Use DOM-based rendering"),run:()=>this.configurationService.updateValue("editor.experimentalGpuAcceleration","off")}];this._notificationService.prompt(Hv.Warning,h,d)}).then(h=>(ti.deviceSync=h.object,ti._atlas||(ti._atlas=this._instantiationService.createInstance(dr,h.object.limits.maxTextureDimension2D,void 0,ti.decorationStyleCache)),h.object)));const r=W(this,Le().devicePixelRatio);this._register(R(Le(),"resize",()=>{r.set(Le().devicePixelRatio,void 0)})),this.devicePixelRatio=r,this._register(Qr(this.devicePixelRatio,()=>ti.atlas?.clear())),this._register(this._themeService.onDidColorThemeChange(()=>{ti.decorationCssRuleExtractor.clear(),ti.atlas?.clear()}));const a=W(this,{width:this.canvas.domNode.width,height:this.canvas.domNode.height});this._register(_T(this.canvas.domNode,Le(),(h,d)=>{this.canvas.domNode.width=h,this.canvas.domNode.height=d,a.set({width:h,height:d},void 0)})),this.canvasDevicePixelDimensions=a;const c=W(this,0);this._register(this.configurationService.onDidChangeConfiguration(h=>{c.set(e.configuration.options.get(165).contentLeft,void 0)})),this.contentLeft=c,this.rectangleRenderer=this._register(this._instantiationService.createInstance(R4,e,this.contentLeft,this.devicePixelRatio,this.canvas.domNode,this.ctx,ti.device))}canRender(e,t,i){const n=t.getViewLineRenderingData(i);if(n.containsRTL||n.maxColumn>this.maxGpuCols)return!1;if(n.inlineDecorations.length>0){let s=!0;for(const r of n.inlineDecorations){if(r.type!==0){s=!1;break}const a=ti._decorationCssRuleExtractor.getStyleRules(this.canvas.domNode,r.inlineClassName);if(s&&=a.every(c=>{if(c.selectorText.includes(":"))return!1;for(const h of c.style)if(!wT(h,c.style))return!1;return!0}),!s)break}return s}return!0}canRenderDetailed(e,t,i){const n=t.getViewLineRenderingData(i),s=[];if(n.containsRTL&&s.push("containsRTL"),n.maxColumn>this.maxGpuCols&&s.push("maxColumn > maxGpuCols"),n.inlineDecorations.length>0){let r=!0;const a=[],c=[],h=[];for(const d of n.inlineDecorations){if(d.type!==0){a.push(d.type),r=!1;continue}const u=ti._decorationCssRuleExtractor.getStyleRules(this.canvas.domNode,d.inlineClassName);r&&=u.every(f=>{if(f.selectorText.includes(":"))return c.push(f.selectorText),!1;for(const g of f.style)if(!wT(g,f.style))return h.push(`${g}: ${f.style[g]}`),!1;return!0})}a.length>0&&s.push(`inlineDecorations with unsupported types (${a.map(d=>`\`${d}\``).join(", ")})`),h.length>0&&s.push(`inlineDecorations with unsupported CSS rules (${h.map(d=>`\`${d}\``).join(", ")})`),c.length>0&&s.push(`inlineDecorations with unsupported CSS selectors (${c.map(d=>`\`${d}\``).join(", ")})`)}return s}},ti=Or,Or._decorationCssRuleExtractor=new M4,Or._decorationStyleCache=new A4,Or),_.ViewGpuContext=ti=O4([Sm(1,me),Sm(2,yn),Sm(3,Ge),Sm(4,_i)],_.ViewGpuContext);const P4=["color","font-weight","opacity","text-decoration","text-decoration-color","text-decoration-line","text-decoration-style","text-decoration-thickness"];function wT(o,e){if(!P4.includes(o))return!1;switch(o){case"text-decoration":case"text-decoration-line":return e.getPropertyValue(o)==="line-through";case"text-decoration-color":{const t=e.getPropertyValue(o);return/^var\(--[^,]+,\s*(?:initial|inherit)\)$/.test(t)?!0:l.Color.Format.CSS.parse(t)!==null}case"text-decoration-style":return e.getPropertyValue(o)==="initial";case"text-decoration-thickness":{const t=e.getPropertyValue(o);return t==="initial"||/^\d+(\.\d+)?px$/.test(t)}default:return!0}}function Xd(o,e){return o.isBasicASCII&&e.useMonospaceOptimizations?new k4(o):new F4(o)}class k4{constructor(e){this._content=e.content}getSegmentAtIndex(e){return this._content[e]}}class F4{constructor(e){this._segments=[];const t=e.content,i=l.safeIntl.Segmenter(void 0,{granularity:"grapheme"}).value,n=Array.from(i.segment(t));let s=0;for(let r=0;r<t.length;r++){const a=n[s];if(!a)break;if(a.index!==r){this._segments.push(void 0);continue}s++,this._segments.push(a)}}getSegmentAtIndex(e){return this._segments[e]?.segment}}class ST extends ma{get glyphRasterizer(){return this._glyphRasterizer.value}constructor(e,t,i,n){super(),this._context=e,this._viewGpuContext=t,this._device=i,this._glyphRasterizer=n,this._context.addEventHandler(this)}}const yT=`
|
||
struct GlyphInfo {
|
||
position: vec2f,
|
||
size: vec2f,
|
||
origin: vec2f,
|
||
};
|
||
|
||
struct Vertex {
|
||
@location(0) position: vec2f,
|
||
};
|
||
|
||
struct Cell {
|
||
position: vec2f,
|
||
unused1: vec2f,
|
||
glyphIndex: f32,
|
||
textureIndex: f32
|
||
};
|
||
|
||
struct LayoutInfo {
|
||
canvasDims: vec2f,
|
||
viewportOffset: vec2f,
|
||
viewportDims: vec2f,
|
||
}
|
||
|
||
struct ScrollOffset {
|
||
offset: vec2f
|
||
}
|
||
|
||
struct VSOutput {
|
||
@builtin(position) position: vec4f,
|
||
@location(1) layerIndex: f32,
|
||
@location(0) texcoord: vec2f,
|
||
};
|
||
|
||
// Uniforms
|
||
@group(0) @binding(4) var<uniform> layoutInfo: LayoutInfo;
|
||
@group(0) @binding(5) var<uniform> atlasDims: vec2f;
|
||
@group(0) @binding(6) var<uniform> scrollOffset: ScrollOffset;
|
||
|
||
// Storage buffers
|
||
@group(0) @binding(0) var<storage, read> glyphInfo: array<array<GlyphInfo, ${Hn.maximumGlyphCount}>, ${dr.maximumPageCount}>;
|
||
@group(0) @binding(1) var<storage, read> cells: array<Cell>;
|
||
|
||
@vertex fn vs(
|
||
vert: Vertex,
|
||
@builtin(instance_index) instanceIndex: u32,
|
||
@builtin(vertex_index) vertexIndex : u32
|
||
) -> VSOutput {
|
||
let cell = cells[instanceIndex];
|
||
var glyph = glyphInfo[u32(cell.textureIndex)][u32(cell.glyphIndex)];
|
||
|
||
var vsOut: VSOutput;
|
||
// Multiple vert.position by 2,-2 to get it into clipspace which ranged from -1 to 1
|
||
vsOut.position = vec4f(
|
||
// Make everything relative to top left instead of center
|
||
vec2f(-1, 1) +
|
||
((vert.position * vec2f(2, -2)) / layoutInfo.canvasDims) * glyph.size +
|
||
((cell.position * vec2f(2, -2)) / layoutInfo.canvasDims) +
|
||
((glyph.origin * vec2f(2, -2)) / layoutInfo.canvasDims) +
|
||
(((layoutInfo.viewportOffset - scrollOffset.offset * vec2(1, -1)) * 2) / layoutInfo.canvasDims),
|
||
0.0,
|
||
1.0
|
||
);
|
||
|
||
vsOut.layerIndex = cell.textureIndex;
|
||
// Textures are flipped from natural direction on the y-axis, so flip it back
|
||
vsOut.texcoord = vert.position;
|
||
vsOut.texcoord = (
|
||
// Glyph offset (0-1)
|
||
(glyph.position / atlasDims) +
|
||
// Glyph coordinate (0-1)
|
||
(vsOut.texcoord * (glyph.size / atlasDims))
|
||
);
|
||
|
||
return vsOut;
|
||
}
|
||
|
||
@group(0) @binding(2) var ourSampler: sampler;
|
||
@group(0) @binding(3) var ourTexture: texture_2d_array<f32>;
|
||
|
||
@fragment fn fs(vsOut: VSOutput) -> @location(0) vec4f {
|
||
return textureSample(ourTexture, ourSampler, vsOut.texcoord, u32(vsOut.layerIndex));
|
||
}
|
||
`,Xs=class Xs extends ST{get bindGroupEntries(){return[{binding:1,resource:{buffer:this._cellBindBuffer}},{binding:6,resource:{buffer:this._scrollOffsetBindBuffer}}]}constructor(e,t,i,n){super(e,t,i,n),this.type="viewport",this.wgsl=yT,this._cellBindBufferLineCapacity=63,this._activeDoubleBufferIndex=0,this._visibleObjectCount=0,this._lastViewportLineCount=0,this._scrollInitialized=!1,this._onDidChangeBindGroupEntries=this._register(new l.Emitter),this.onDidChangeBindGroupEntries=this._onDidChangeBindGroupEntries.event,this._rebuildCellBuffer(this._cellBindBufferLineCapacity);const s=2;this._scrollOffsetBindBuffer=this._register(Mi.createBuffer(this._device,{label:"Monaco scroll offset buffer",size:s*Float32Array.BYTES_PER_ELEMENT,usage:GPUBufferUsage.UNIFORM|GPUBufferUsage.COPY_DST})).object,this._scrollOffsetValueBuffer=new Float32Array(s)}_rebuildCellBuffer(e){this._cellBindBuffer?.destroy();const t=(Math.floor(e/32)+1)*32,i=t*Xs.maxSupportedColumns*6*Float32Array.BYTES_PER_ELEMENT;this._cellBindBuffer=this._register(Mi.createBuffer(this._device,{label:"Monaco full file cell buffer",size:i,usage:GPUBufferUsage.STORAGE|GPUBufferUsage.COPY_DST})).object,this._cellValueBuffers=[new ArrayBuffer(i),new ArrayBuffer(i)],this._cellBindBufferLineCapacity=t,this._lastViewportLineCount=0,this._onDidChangeBindGroupEntries.fire()}onConfigurationChanged(e){return!0}onDecorationsChanged(e){return!0}onTokensChanged(e){return!0}onLinesDeleted(e){return!0}onLinesInserted(e){return!0}onLinesChanged(e){return!0}onScrollChanged(e){if(this._store.isDisposed)return!1;const t=Le().devicePixelRatio;return this._scrollOffsetValueBuffer[0]=(e?.scrollLeft??this._context.viewLayout.getCurrentScrollLeft())*t,this._scrollOffsetValueBuffer[1]=(e?.scrollTop??this._context.viewLayout.getCurrentScrollTop())*t,this._device.queue.writeBuffer(this._scrollOffsetBindBuffer,0,this._scrollOffsetValueBuffer),!0}onThemeChanged(e){return!0}onLineMappingChanged(e){return!0}onZonesChanged(e){return!0}reset(){for(const e of[0,1]){const t=new Float32Array(this._cellValueBuffers[e]);t.fill(0,0,t.length),this._device.queue.writeBuffer(this._cellBindBuffer,0,t.buffer,0,t.byteLength)}this._lastViewportLineCount=0}update(e,t){let i="",n,s=0,r=0,a=0,c=0,h=0,d=0,u,f=0,g=0,m=0,p=0,b,v,C,w,S,L,D,x,I=0,T=0,M;const O=Le().devicePixelRatio;let P;this._scrollInitialized||(this.onScrollChanged(),this._scrollInitialized=!0),this._cellBindBufferLineCapacity<e.endLineNumber-e.startLineNumber+1&&this._rebuildCellBuffer(e.endLineNumber-e.startLineNumber+1);const k=new Float32Array(this._cellValueBuffers[this._activeDoubleBufferIndex]);k.fill(0);const U=Xs.maxSupportedColumns*6;for(r=e.startLineNumber;r<=e.endLineNumber;r++)if(this._viewGpuContext.canRender(t,e,r)){D=e.getViewLineRenderingData(r),d=0,P=Xd(D,t),s=t.spaceWidth*O,c=(D.minColumn-1)*s,M=D.tokens,g=D.minColumn-1,m=0;for(let X=0,re=M.getCount();X<re;X++)if(m=M.getEndOffset(X),!(m<=g)){for(p=M.getMetadata(X),a=g;a<m&&!(a>Xs.maxSupportedColumns);a++){if(n=P.getSegmentAtIndex(a),n===void 0)continue;i=n,D.isBasicASCII&&t.useMonospaceOptimizations||(s=this.glyphRasterizer.getTextMetrics(i).width),v=void 0,b=void 0,C=void 0,w=void 0,S=void 0,L=void 0;for(x of D.inlineDecorations){if(r<x.range.startLineNumber||r>x.range.endLineNumber||r===x.range.startLineNumber&&a<x.range.startColumn-1||r===x.range.endLineNumber&&a>=x.range.endColumn-1)continue;const ee=_.ViewGpuContext.decorationCssRuleExtractor.getStyleRules(this._viewGpuContext.canvas.domNode,x.inlineClassName);for(const Ee of ee)for(const Rt of Ee.style){const We=Ee.styleMap.get(Rt)?.toString()??"";switch(Rt){case"color":{const Ke=l.Color.Format.CSS.parse(We);if(!Ke)throw new l.BugIndicatingError("Invalid color format "+We);v=Ke.toNumber32Bit();break}case"font-weight":{B4(We)>=400?b=!0:b=!1;break}case"opacity":{C=z4(We);break}case"text-decoration":case"text-decoration-line":{We==="line-through"&&(w=!0);break}case"text-decoration-thickness":{const Ke=We.match(/^(\d+(?:\.\d+)?)px$/);Ke&&(S=parseFloat(Ke[1]));break}case"text-decoration-color":{let Ke=We;const Mt=We.match(/^var\((--[^,]+),\s*(?:initial|inherit)\)$/);Mt&&(Ke=_.ViewGpuContext.decorationCssRuleExtractor.resolveCssVariable(this._viewGpuContext.canvas.domNode,Mt[1]));const Ce=l.Color.Format.CSS.parse(Ke);Ce&&(L=Ce.toNumber32Bit());break}case"text-decoration-style":break;default:throw new l.BugIndicatingError("Unexpected inline decoration style")}}}if(i===" "||i===" "){if(f=((r-1)*Xs.maxSupportedColumns+a)*6,k.fill(0,f,f+6),i===" "){const ee=a+d;d=Xe.nextRenderTabStop(a+d,D.tabSize),c+=s*(d-ee),d-=a+1}else c+=s;continue}const Y=_.ViewGpuContext.decorationStyleCache.getOrCreateEntry(v,b,C,w,S,L);u=this._viewGpuContext.atlas.getGlyph(this.glyphRasterizer,i,p,Y,c),h=Math.round(e.relativeVerticalOffset[r-e.startLineNumber]*O+Math.floor((e.lineHeight*O-(u.fontBoundingBoxAscent+u.fontBoundingBoxDescent))/2)+u.fontBoundingBoxAscent),f=((r-e.startLineNumber)*Xs.maxSupportedColumns+a)*6,k[f+0]=Math.floor(c),k[f+1]=h,k[f+4]=u.glyphIndex,k[f+5]=u.pageIndex,c+=s}g=m}I=((r-e.startLineNumber)*Xs.maxSupportedColumns+m)*6,T=(r-e.startLineNumber)*Xs.maxSupportedColumns*6,k.fill(0,I,T)}const B=(e.endLineNumber-e.startLineNumber+1)*U,G=e.endLineNumber-e.startLineNumber+1;if(this._device.queue.writeBuffer(this._cellBindBuffer,0,k.buffer,0,B*Float32Array.BYTES_PER_ELEMENT),G<this._lastViewportLineCount){const X=this._lastViewportLineCount-G,re=B*Float32Array.BYTES_PER_ELEMENT,Y=X*U*Float32Array.BYTES_PER_ELEMENT;this._device.queue.writeBuffer(this._cellBindBuffer,re,k.buffer,B*Float32Array.BYTES_PER_ELEMENT,Y)}return this._lastViewportLineCount=G,this._activeDoubleBufferIndex=this._activeDoubleBufferIndex?0:1,this._visibleObjectCount=B,B}draw(e,t){if(this._visibleObjectCount<=0)throw new l.BugIndicatingError("Attempt to draw 0 objects");e.draw(Ea.length/2,this._visibleObjectCount)}};Xs.maxSupportedColumns=2e3;let tw=Xs;function B4(o){switch(o){case"lighter":case"normal":return 400;case"bolder":case"bold":return 700}return parseInt(o)}function z4(o){return o.endsWith("%")?parseFloat(o.substring(0,o.length-1))/100:o.match(/^\d+(?:\.\d*)/)?parseFloat(o):1}const Xt=class Xt extends ST{get bindGroupEntries(){return[{binding:1,resource:{buffer:this._cellBindBuffer}},{binding:6,resource:{buffer:this._scrollOffsetBindBuffer}}]}constructor(e,t,i,n){super(e,t,i,n),this.type="fullfile",this.wgsl=yT,this._activeDoubleBufferIndex=0,this._upToDateLines=[new Set,new Set],this._visibleObjectCount=0,this._finalRenderedLine=0,this._scrollInitialized=!1,this._queuedBufferUpdates=[[],[]];const s=Xt.maxSupportedLines*Xt.maxSupportedColumns*6*Float32Array.BYTES_PER_ELEMENT;this._cellBindBuffer=this._register(Mi.createBuffer(this._device,{label:"Monaco full file cell buffer",size:s,usage:GPUBufferUsage.STORAGE|GPUBufferUsage.COPY_DST})).object,this._cellValueBuffers=[new ArrayBuffer(s),new ArrayBuffer(s)];const r=2;this._scrollOffsetBindBuffer=this._register(Mi.createBuffer(this._device,{label:"Monaco scroll offset buffer",size:r*Float32Array.BYTES_PER_ELEMENT,usage:GPUBufferUsage.UNIFORM|GPUBufferUsage.COPY_DST})).object,this._scrollOffsetValueBuffer=new Float32Array(r)}onConfigurationChanged(e){return this._invalidateAllLines(),this._queueBufferUpdate(e),!0}onDecorationsChanged(e){return this._invalidateAllLines(),!0}onTokensChanged(e){for(const t of e.ranges)this._invalidateLineRange(t.fromLineNumber,t.toLineNumber);return!0}onLinesDeleted(e){return this._invalidateLinesFrom(e.fromLineNumber),this._queueBufferUpdate(e),!0}onLinesInserted(e){return this._invalidateLinesFrom(e.fromLineNumber),!0}onLinesChanged(e){return this._invalidateLineRange(e.fromLineNumber,e.fromLineNumber+e.count),!0}onScrollChanged(e){if(this._store.isDisposed)return!1;const t=Le().devicePixelRatio;return this._scrollOffsetValueBuffer[0]=(e?.scrollLeft??this._context.viewLayout.getCurrentScrollLeft())*t,this._scrollOffsetValueBuffer[1]=(e?.scrollTop??this._context.viewLayout.getCurrentScrollTop())*t,this._device.queue.writeBuffer(this._scrollOffsetBindBuffer,0,this._scrollOffsetValueBuffer),!0}onThemeChanged(e){return this._invalidateAllLines(),!0}onLineMappingChanged(e){return this._invalidateAllLines(),this._queueBufferUpdate(e),!0}onZonesChanged(e){return this._invalidateAllLines(),this._queueBufferUpdate(e),!0}_invalidateAllLines(){this._upToDateLines[0].clear(),this._upToDateLines[1].clear()}_invalidateLinesFrom(e){for(const t of[0,1]){const i=this._upToDateLines[t];for(const n of i)n>=e&&i.delete(n)}}_invalidateLineRange(e,t){for(let i=e;i<=t;i++)this._upToDateLines[0].delete(i),this._upToDateLines[1].delete(i)}reset(){this._invalidateAllLines();for(const e of[0,1]){const t=new Float32Array(this._cellValueBuffers[e]);t.fill(0,0,t.length),this._device.queue.writeBuffer(this._cellBindBuffer,0,t.buffer,0,t.byteLength)}this._finalRenderedLine=0}update(e,t){let i="",n,s=0,r=0,a=0,c=0,h=0,d=0,u,f=0,g=0,m=0,p=0,b,v,C,w,S,L,D,x,I=0,T=0,M;const O=Le().devicePixelRatio;let P;this._scrollInitialized||(this.onScrollChanged(),this._scrollInitialized=!0);const k=new Float32Array(this._cellValueBuffers[this._activeDoubleBufferIndex]),U=Xt.maxSupportedColumns*6,B=this._upToDateLines[this._activeDoubleBufferIndex];let G=3e3,X=0;const re=this._queuedBufferUpdates[this._activeDoubleBufferIndex];for(;re.length;){const ee=re.shift();switch(ee.type){case 2:case 8:case 17:{k.fill(0),G=1,X=Math.max(X,this._finalRenderedLine),this._finalRenderedLine=0;break}case 10:{const Ee=(ee.fromLineNumber-1)*Xt.maxSupportedColumns*6,Rt=ee.toLineNumber*Xt.maxSupportedColumns*6,We=(this._finalRenderedLine-(ee.toLineNumber-ee.fromLineNumber+1))*Xt.maxSupportedColumns*6;k.set(k.subarray(Rt),Ee),k.fill(0,We),G=Math.min(G,ee.fromLineNumber),X=Math.max(X,this._finalRenderedLine),this._finalRenderedLine-=ee.toLineNumber-ee.fromLineNumber+1;break}}}for(r=e.startLineNumber;r<=e.endLineNumber;r++){if(!this._viewGpuContext.canRender(t,e,r)){I=(r-1)*Xt.maxSupportedColumns*6,T=r*Xt.maxSupportedColumns*6,k.fill(0,I,T),G=Math.min(G,r),X=Math.max(X,r);continue}if(!B.has(r)){G=Math.min(G,r),X=Math.max(X,r),D=e.getViewLineRenderingData(r),d=0,P=Xd(D,t),s=t.spaceWidth*O,c=(D.minColumn-1)*s,M=D.tokens,g=D.minColumn-1,m=0;for(let ee=0,Ee=M.getCount();ee<Ee;ee++)if(m=M.getEndOffset(ee),!(m<=g)){for(p=M.getMetadata(ee),a=g;a<m&&!(a>Xt.maxSupportedColumns);a++){if(n=P.getSegmentAtIndex(a),n===void 0)continue;i=n,D.isBasicASCII&&t.useMonospaceOptimizations||(s=this.glyphRasterizer.getTextMetrics(i).width),v=void 0,b=void 0,C=void 0,w=void 0,S=void 0,L=void 0;for(x of D.inlineDecorations){if(r<x.range.startLineNumber||r>x.range.endLineNumber||r===x.range.startLineNumber&&a<x.range.startColumn-1||r===x.range.endLineNumber&&a>=x.range.endColumn-1)continue;const We=_.ViewGpuContext.decorationCssRuleExtractor.getStyleRules(this._viewGpuContext.canvas.domNode,x.inlineClassName);for(const Ke of We)for(const Mt of Ke.style){const Ce=Ke.styleMap.get(Mt)?.toString()??"";switch(Mt){case"color":{const Jt=l.Color.Format.CSS.parse(Ce);if(!Jt)throw new l.BugIndicatingError("Invalid color format "+Ce);v=Jt.toNumber32Bit();break}case"font-weight":{V4(Ce)>=400?b=!0:b=!1;break}case"opacity":{C=U4(Ce);break}case"text-decoration":case"text-decoration-line":{Ce==="line-through"&&(w=!0);break}case"text-decoration-thickness":{const Jt=Ce.match(/^(\d+(?:\.\d+)?)px$/);Jt&&(S=parseFloat(Jt[1]));break}case"text-decoration-color":{let Jt=Ce;const Me=Ce.match(/^var\((--[^,]+),\s*(?:initial|inherit)\)$/);Me&&(Jt=_.ViewGpuContext.decorationCssRuleExtractor.resolveCssVariable(this._viewGpuContext.canvas.domNode,Me[1]));const Rn=l.Color.Format.CSS.parse(Jt);Rn&&(L=Rn.toNumber32Bit());break}case"text-decoration-style":break;default:throw new l.BugIndicatingError("Unexpected inline decoration style")}}}if(i===" "||i===" "){if(f=((r-1)*Xt.maxSupportedColumns+a)*6,k.fill(0,f,f+6),i===" "){const We=a+d;d=Xe.nextRenderTabStop(a+d,D.tabSize),c+=s*(d-We),d-=a+1}else c+=s;continue}const Rt=_.ViewGpuContext.decorationStyleCache.getOrCreateEntry(v,b,C,w,S,L);u=this._viewGpuContext.atlas.getGlyph(this.glyphRasterizer,i,p,Rt,c),h=Math.round(e.relativeVerticalOffset[r-e.startLineNumber]*O+Math.floor((e.lineHeight*O-(u.fontBoundingBoxAscent+u.fontBoundingBoxDescent))/2)+u.fontBoundingBoxAscent),f=((r-1)*Xt.maxSupportedColumns+a)*6,k[f+0]=Math.floor(c),k[f+1]=h,k[f+4]=u.glyphIndex,k[f+5]=u.pageIndex,c+=s}g=m}I=((r-1)*Xt.maxSupportedColumns+m)*6,T=r*Xt.maxSupportedColumns*6,k.fill(0,I,T),B.add(r)}}const Y=(e.endLineNumber-e.startLineNumber+1)*U;return G=Math.min(G,Xt.maxSupportedLines),X=Math.min(X,Xt.maxSupportedLines),G<=X&&this._device.queue.writeBuffer(this._cellBindBuffer,(G-1)*U*Float32Array.BYTES_PER_ELEMENT,k.buffer,(G-1)*U*Float32Array.BYTES_PER_ELEMENT,(X-G+1)*U*Float32Array.BYTES_PER_ELEMENT),this._finalRenderedLine=Math.max(this._finalRenderedLine,X),this._activeDoubleBufferIndex=this._activeDoubleBufferIndex?0:1,this._visibleObjectCount=Y,Y}draw(e,t){if(this._visibleObjectCount<=0)throw new l.BugIndicatingError("Attempt to draw 0 objects");e.draw(Ea.length/2,this._visibleObjectCount,void 0,(t.startLineNumber-1)*Xt.maxSupportedColumns)}_queueBufferUpdate(e){this._queuedBufferUpdates[0].push(e),this._queuedBufferUpdates[1].push(e)}};Xt.maxSupportedLines=3e3,Xt.maxSupportedColumns=200;let Ta=Xt;function V4(o){switch(o){case"lighter":case"normal":return 400;case"bolder":case"bold":return 700}return parseInt(o)}function U4(o){return o.endsWith("%")?parseFloat(o.substring(0,o.length-1))/100:o.match(/^\d+(?:\.\d*)/)?parseFloat(o):1}var $4=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},LT=function(o,e){return function(t,i){e(t,i,o)}};let iw=class extends gi{constructor(e,t,i,n){super(e),this._viewGpuContext=t,this._instantiationService=i,this._logService=n,this._maxLineWidth=0,this._atlasGpuTextureVersions=[],this._initialized=!1,this._glyphRasterizer=this._register(new l.MutableDisposable),this._renderStrategy=this._register(new l.MutableDisposable),this.canvas=this._viewGpuContext.canvas.domNode,this._register(he(s=>{this._viewGpuContext.canvasDevicePixelDimensions.read(s);const r=this._lastViewportData;r&&setTimeout(()=>{r===this._lastViewportData&&this.renderText(r)})})),this.initWebgpu()}async initWebgpu(){if(this._device=_.ViewGpuContext.deviceSync||await _.ViewGpuContext.device,this._store.isDisposed)return;const e=_.ViewGpuContext.atlas;this._register(e.onDidDeleteGlyphs(()=>{this._atlasGpuTextureVersions.length=0,this._atlasGpuTextureVersions[0]=0,this._atlasGpuTextureVersions[1]=0,this._renderStrategy.value.reset()}));const t=navigator.gpu.getPreferredCanvasFormat();this._viewGpuContext.ctx.configure({device:this._device,format:t,alphaMode:"premultiplied"}),this._renderPassColorAttachment={view:null,loadOp:"load",storeOp:"store"},this._renderPassDescriptor={label:"Monaco render pass",colorAttachments:[this._renderPassColorAttachment]};let i;{const c=new Float32Array(6),h=(d=this.canvas.width,u=this.canvas.height)=>(c[0]=d,c[1]=u,c[2]=Math.ceil(this._context.configuration.options.get(165).contentLeft*Le().devicePixelRatio),c[3]=0,c[4]=c[0]-c[2],c[5]=c[1]-c[3],c);i=this._register(Mi.createBuffer(this._device,{label:"Monaco uniform buffer",size:24,usage:GPUBufferUsage.UNIFORM|GPUBufferUsage.COPY_DST},()=>h())).object,this._register(Qr(this._viewGpuContext.canvasDevicePixelDimensions,({width:d,height:u})=>{this._device.queue.writeBuffer(i,0,h(d,u))})),this._register(Qr(this._viewGpuContext.contentLeft,()=>{this._device.queue.writeBuffer(i,0,h())}))}let n;n=this._register(Mi.createBuffer(this._device,{label:"Monaco atlas info uniform buffer",size:8,usage:GPUBufferUsage.UNIFORM|GPUBufferUsage.COPY_DST},()=>{const c=new Float32Array(2);return c[0]=e.pageSize,c[1]=e.pageSize,c})).object;const s=this._context.configuration.options.get(58),r=this._context.configuration.options.get(61);this._glyphRasterizer.value=this._register(new Zd(r,s,this._viewGpuContext.devicePixelRatio.get(),_.ViewGpuContext.decorationStyleCache)),this._register(Qr(this._viewGpuContext.devicePixelRatio,()=>{this._refreshGlyphRasterizer()})),this._renderStrategy.value=this._instantiationService.createInstance(Ta,this._context,this._viewGpuContext,this._device,this._glyphRasterizer),this._glyphStorageBuffer=this._register(Mi.createBuffer(this._device,{label:"Monaco glyph storage buffer",size:dr.maximumPageCount*(Hn.maximumGlyphCount*24),usage:GPUBufferUsage.STORAGE|GPUBufferUsage.COPY_DST})).object,this._atlasGpuTextureVersions[0]=0,this._atlasGpuTextureVersions[1]=0,this._atlasGpuTexture=this._register(Mi.createTexture(this._device,{label:"Monaco atlas texture",format:"rgba8unorm",size:{width:e.pageSize,height:e.pageSize,depthOrArrayLayers:dr.maximumPageCount},dimension:"2d",usage:GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_DST|GPUTextureUsage.RENDER_ATTACHMENT})).object,this._updateAtlasStorageBufferAndTexture(),this._vertexBuffer=this._register(Mi.createBuffer(this._device,{label:"Monaco vertex buffer",size:Ea.byteLength,usage:GPUBufferUsage.VERTEX|GPUBufferUsage.COPY_DST},Ea)).object;const a=this._device.createShaderModule({label:"Monaco shader module",code:this._renderStrategy.value.wgsl});if(this._pipeline=this._device.createRenderPipeline({label:"Monaco render pipeline",layout:"auto",vertex:{module:a,buffers:[{arrayStride:2*Float32Array.BYTES_PER_ELEMENT,attributes:[{shaderLocation:0,offset:0,format:"float32x2"}]}]},fragment:{module:a,targets:[{format:t,blend:{color:{srcFactor:"src-alpha",dstFactor:"one-minus-src-alpha"},alpha:{srcFactor:"src-alpha",dstFactor:"one-minus-src-alpha"}}}]}}),this._rebuildBindGroup=()=>{this._bindGroup=this._device.createBindGroup({label:"Monaco bind group",layout:this._pipeline.getBindGroupLayout(0),entries:[{binding:0,resource:{buffer:this._glyphStorageBuffer}},{binding:2,resource:this._device.createSampler({label:"Monaco atlas sampler",magFilter:"nearest",minFilter:"nearest"})},{binding:3,resource:this._atlasGpuTexture.createView()},{binding:4,resource:{buffer:i}},{binding:5,resource:{buffer:n}},...this._renderStrategy.value.bindGroupEntries]})},this._rebuildBindGroup(),this._initialized=!0,this._initViewportData){for(const c of this._initViewportData)this.renderText(c);this._initViewportData=void 0}}_refreshRenderStrategy(e){if(this._renderStrategy.value?.type==="viewport"||e.endLineNumber<Ta.maxSupportedLines&&this._viewportMaxColumn(e)<Ta.maxSupportedColumns)return;this._logService.trace(`File is larger than ${Ta.maxSupportedLines} lines or ${Ta.maxSupportedColumns} columns, switching to viewport render strategy`);const t=this._instantiationService.createInstance(tw,this._context,this._viewGpuContext,this._device,this._glyphRasterizer);this._renderStrategy.value=t,this._register(t.onDidChangeBindGroupEntries(()=>this._rebuildBindGroup?.())),this._rebuildBindGroup?.()}_viewportMaxColumn(e){let t=0,i;for(let n=e.startLineNumber;n<=e.endLineNumber;n++)i=e.getViewLineRenderingData(n),t=Math.max(t,i.maxColumn);return t}_updateAtlasStorageBufferAndTexture(){for(const[e,t]of _.ViewGpuContext.atlas.pages.entries()){if(e>=dr.maximumPageCount){console.log(`Attempt to upload atlas page [${e}], only ${dr.maximumPageCount} are supported currently`);continue}if(t.version===this._atlasGpuTextureVersions[e])continue;this._logService.trace("Updating atlas page[",e,"] from version ",this._atlasGpuTextureVersions[e]," to version ",t.version);const i=6*Hn.maximumGlyphCount,n=new Float32Array(i);let s=0;for(const r of t.glyphs)n[s+0]=r.x,n[s+0+1]=r.y,n[s+2]=r.w,n[s+2+1]=r.h,n[s+4]=r.originOffsetX,n[s+4+1]=r.originOffsetY,s+=6;if(s/6>Hn.maximumGlyphCount)throw new Error(`Attempting to write more glyphs (${s/6}) than the GPUBuffer can hold (${Hn.maximumGlyphCount})`);this._device.queue.writeBuffer(this._glyphStorageBuffer,e*6*Hn.maximumGlyphCount*Float32Array.BYTES_PER_ELEMENT,n,0,6*Hn.maximumGlyphCount),t.usedArea.right-t.usedArea.left>0&&t.usedArea.bottom-t.usedArea.top>0&&this._device.queue.copyExternalImageToTexture({source:t.source},{texture:this._atlasGpuTexture,origin:{x:t.usedArea.left,y:t.usedArea.top,z:e}},{width:t.usedArea.right-t.usedArea.left+1,height:t.usedArea.bottom-t.usedArea.top+1}),this._atlasGpuTextureVersions[e]=t.version}}prepareRender(e){throw new l.BugIndicatingError("Should not be called")}render(e){throw new l.BugIndicatingError("Should not be called")}onConfigurationChanged(e){return this._refreshGlyphRasterizer(),this._maxLineWidth=0,!0}onCursorStateChanged(e){return!0}onDecorationsChanged(e){return!0}onFlushed(e){return this._maxLineWidth=0,!0}onLinesChanged(e){return!0}onLinesDeleted(e){return this._maxLineWidth=0,!0}onLinesInserted(e){return!0}onLineMappingChanged(e){return!0}onRevealRangeRequest(e){return!0}onScrollChanged(e){return!0}onThemeChanged(e){return!0}onZonesChanged(e){return!0}_refreshGlyphRasterizer(){const e=this._glyphRasterizer.value;if(!e)return;const t=this._context.configuration.options.get(58),i=this._context.configuration.options.get(61),n=this._viewGpuContext.devicePixelRatio.get();(e.fontFamily!==t||e.fontSize!==i||e.devicePixelRatio!==n)&&(this._glyphRasterizer.value=new Zd(i,t,n,_.ViewGpuContext.decorationStyleCache))}renderText(e){if(this._initialized)return this._refreshRenderStrategy(e),this._renderText(e);this._initViewportData=this._initViewportData??[],this._initViewportData.push(e)}_renderText(e){this._viewGpuContext.rectangleRenderer.draw(e);const t=new mm(this._context.configuration,this._context.theme.type);this._renderStrategy.value.update(e,t),this._updateAtlasStorageBufferAndTexture();const i=this._device.createCommandEncoder({label:"Monaco command encoder"});this._renderPassColorAttachment.view=this._viewGpuContext.ctx.getCurrentTexture().createView({label:"Monaco canvas texture view"});const n=i.beginRenderPass(this._renderPassDescriptor);n.setPipeline(this._pipeline),n.setVertexBuffer(0,this._vertexBuffer);const s=Math.ceil(this._viewGpuContext.contentLeft.get()*this._viewGpuContext.devicePixelRatio.get());n.setScissorRect(s,0,this.canvas.width-s,this.canvas.height),n.setBindGroup(0,this._bindGroup),this._renderStrategy.value.draw(n,e),n.end();const r=i.finish();this._device.queue.submit([r]),this._lastViewportData=e,this._lastViewLineOptions=t,this._updateMaxLineWidth(e,t)}_updateMaxLineWidth(e,t){const i=Le().devicePixelRatio;let n=0;for(let r=e.startLineNumber;r<=e.endLineNumber;r++){if(!this._viewGpuContext.canRender(t,e,r))continue;const a=e.getViewLineRenderingData(r),c=this._computeLineWidth(a,t,i);n=Math.max(n,c)}const s=Math.ceil(n);s>this._maxLineWidth&&(this._maxLineWidth=s,this._context.viewModel.viewLayout.setMaxLineWidth(this._maxLineWidth))}_computeLineWidth(e,t,i){const n=e.content;let s;e.isBasicASCII&&t.useMonospaceOptimizations||(s=Xd(e,t));let r=0,a=0;for(let c=0;c<n.length;c++){let h;if(e.isBasicASCII&&t.useMonospaceOptimizations)h=n.charAt(c);else{const d=s.getSegmentAtIndex(c);if(d===void 0)continue;h=d}if(h===" "){const d=c+a;a=Xe.nextRenderTabStop(c+a,e.tabSize),r+=t.spaceWidth*(a-d),a-=c+1}else e.isBasicASCII&&t.useMonospaceOptimizations?r+=t.spaceWidth:r+=this._renderStrategy.value.glyphRasterizer.getTextMetrics(h).width/i}return r}linesVisibleRangesForRange(e,t){if(!this._lastViewportData)return null;const i=e.endLineNumber,n=l.Range.intersectRanges(e,this._lastViewportData.visibleRange);if(!n)return null;const s=this._lastViewportData.startLineNumber,r=this._lastViewportData.endLineNumber,a=this._lastViewportData,c=this._lastViewLineOptions;if(!a||!c)return null;const h=[];let d=0;t&&(d=this._context.viewModel.coordinatesConverter.convertViewPositionToModelPosition(new l.Position(n.startLineNumber,1)).lineNumber);for(let u=n.startLineNumber;u<=n.endLineNumber;u++){if(u<s||u>r)continue;const f=u===n.startLineNumber?n.startColumn:1,g=u!==i,m=g?this._context.viewModel.getLineMaxColumn(u):n.endColumn,p=this._visibleRangesForLineRange(u,f,m);if(p){if(t&&u<i){const b=d;d=this._context.viewModel.coordinatesConverter.convertViewPositionToModelPosition(new l.Position(u+1,1)).lineNumber,b!==d&&(p.ranges[p.ranges.length-1].width+=c.spaceWidth)}h.push(new nI(p.outsideRenderedLine,u,Pd.from(p.ranges),g))}}return h.length===0?null:h}_visibleRangesForLineRange(e,t,i){if(this.shouldRender())return null;const n=this._lastViewportData,s=this._lastViewLineOptions;if(!n||!s||e<n.startLineNumber||e>n.endLineNumber)return null;const r=n.getViewLineRenderingData(e),a=r.content;let c;r.isBasicASCII&&s.useMonospaceOptimizations||(c=Xd(r,s));let h="",d=0,u=0;for(let p=0;p<t-1;p++){if(r.isBasicASCII&&s.useMonospaceOptimizations)h=a.charAt(p);else{if(h=c.getSegmentAtIndex(p),h===void 0)continue;u+=this._renderStrategy.value.glyphRasterizer.getTextMetrics(h).width/Le().devicePixelRatio-s.spaceWidth}h===" "?d=Xe.nextRenderTabStop(d,r.tabSize):d++}let f=d,g=0;for(let p=t-1;p<i-1;p++){if(r.isBasicASCII&&s.useMonospaceOptimizations)h=a.charAt(p);else{if(h=c.getSegmentAtIndex(p),h===void 0)continue;g+=this._renderStrategy.value.glyphRasterizer.getTextMetrics(h).width/Le().devicePixelRatio-s.spaceWidth}h===" "?f=Xe.nextRenderTabStop(f,r.tabSize):f++}return new pv(!1,[new or(d*s.spaceWidth+u,(f-d)*s.spaceWidth+g)])}visibleRangeForPosition(e){const t=this._visibleRangesForLineRange(e.lineNumber,e.column,e.column);return t?new sI(t.outsideRenderedLine,t.ranges[0].left):null}getLineWidth(e){if(!this._lastViewportData||!this._lastViewLineOptions||!this._viewGpuContext.canRender(this._lastViewLineOptions,this._lastViewportData,e))return;const t=this._lastViewportData.getViewLineRenderingData(e),n=this._visibleRangesForLineRange(e,1,t.maxColumn)?.ranges.at(-1);if(n)return n.left+n.width}getPositionAtCoordinate(e,t){if(!this._lastViewportData||!this._lastViewLineOptions||!this._viewGpuContext.canRender(this._lastViewLineOptions,this._lastViewportData,e))return;const i=this._lastViewportData.getViewLineRenderingData(e),n=i.content,s=Le().devicePixelRatio,r=t*s,a=this._lastViewLineOptions.spaceWidth*s,c=Xd(i,this._lastViewLineOptions);let h=0,d=0,u=0,f=0;for(let g=0;g<n.length;g++){const m=c.getSegmentAtIndex(g);if(m===void 0){f++;continue}if(m===" "){const p=g+u;u=Xe.nextRenderTabStop(g+u,i.tabSize),d=a*(u-p),u-=g+1}else i.isBasicASCII&&this._lastViewLineOptions.useMonospaceOptimizations?d=a:d=this._renderStrategy.value.glyphRasterizer.getTextMetrics(m).width;if(r<h+d/2)break;h+=d,f++}return new l.Position(e,f+1)}};iw=$4([LT(2,me),LT(3,ei)],iw);class K4{constructor(){this._onDidChange=new l.Emitter,this.onDidChange=this._onDidChange.event,this._enabled=!0}get enabled(){return this._enabled}enable(){this._enabled=!0,this._onDidChange.fire()}disable(){this._enabled=!1,this._onDidChange.fire()}}const Ss=new K4,xt=le("keybindingService");class DT extends gi{constructor(){super(...arguments),this._onWillCopy=this._register(new l.Emitter),this.onWillCopy=this._onWillCopy.event,this._onWillCut=this._register(new l.Emitter),this.onWillCut=this._onWillCut.event,this._onWillPaste=this._register(new l.Emitter),this.onWillPaste=this._onWillPaste.event}}class xT{_getPageOfLine(e,t){return Math.floor((e-1)/t)}_getRangeForPage(e,t){const i=e*t,n=i+1,s=i+t;return new l.Range(n,1,s+1,1)}fromEditorSelection(e,t,i,n){const r=this._getPageOfLine(t.startLineNumber,i),a=this._getRangeForPage(r,i),c=this._getPageOfLine(t.endLineNumber,i),h=this._getRangeForPage(c,i);let d=a.intersectRanges(new l.Range(1,1,t.startLineNumber,t.startColumn));if(n&&e.getValueLengthInRange(d,1)>500){const w=e.modifyPosition(d.getEndPosition(),-500);d=l.Range.fromPositions(w,d.getEndPosition())}const u=e.getValueInRange(d,1),f=e.getLineCount(),g=e.getLineMaxColumn(f);let m=h.intersectRanges(new l.Range(t.endLineNumber,t.endColumn,f,g));if(n&&e.getValueLengthInRange(m,1)>500){const w=e.modifyPosition(m.getStartPosition(),500);m=l.Range.fromPositions(m.getStartPosition(),w)}const p=e.getValueInRange(m,1);let b;if(r===c||r+1===c)b=e.getValueInRange(t,1);else{const w=a.intersectRanges(t),S=h.intersectRanges(t);b=e.getValueInRange(w,1)+"…"+e.getValueInRange(S,1)}n&&b.length>2*500&&(b=b.substring(0,500)+"…"+b.substring(b.length-500,b.length));let v,C;return t.getDirection()===0?(v=u.length,C=u.length+b.length):(C=u.length,v=u.length+b.length),{value:u+b+p,selection:t,selectionStart:v,selectionEnd:C,startPositionWithinEditor:d.getStartPosition(),newlineCountBeforeSelection:d.endLineNumber-d.startLineNumber}}}function nw(o,e){if(o.get(2)===1){const i=e.lookupKeybinding("editor.action.toggleScreenReaderAccessibilityMode")?.getAriaLabel(),n=e.lookupKeybinding("workbench.action.showCommands")?.getAriaLabel(),s=e.lookupKeybinding("workbench.action.openGlobalKeybindings")?.getAriaLabel(),r=l.localize(65,"The editor is not accessible at this time.");return i?l.localize(66,"{0} To enable screen reader optimized mode, use {1}",r,i):n?l.localize(67,"{0} To enable screen reader optimized mode, open the quick pick with {1} and run the command Toggle Screen Reader Accessibility Mode, which is currently not triggerable via keyboard.",r,n):s?l.localize(68,"{0} Please assign a keybinding for the command Toggle Screen Reader Accessibility Mode by accessing the keybindings editor with {1} and run it.",r,s):r}return o.get(8)}function ET(o){let e=0,t=-1;do{if(t=o.indexOf(`
|
||
`,t+1),t===-1)break;e++}while(!0);return e}class G4{constructor(){this._textAreaEditContextMapping=new Map}register(e,t){return this._textAreaEditContextMapping.set(e,t),{dispose:()=>{this._textAreaEditContextMapping.delete(e)}}}}const j4=new G4;var q4=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},IT=function(o,e){return function(t,i){e(t,i,o)}};class Y4{constructor(e,t,i,n,s){this._context=e,this.modelLineNumber=t,this.distanceToModelLineStart=i,this.widthOfHiddenLineTextBefore=n,this.distanceToModelLineEnd=s,this._visibleTextAreaBrand=void 0,this.startPosition=null,this.endPosition=null,this.visibleTextareaStart=null,this.visibleTextareaEnd=null,this._previousPresentation=null}prepareRender(e){const t=new l.Position(this.modelLineNumber,this.distanceToModelLineStart+1),i=new l.Position(this.modelLineNumber,this._context.viewModel.model.getLineMaxColumn(this.modelLineNumber)-this.distanceToModelLineEnd);this.startPosition=this._context.viewModel.coordinatesConverter.convertModelPositionToViewPosition(t),this.endPosition=this._context.viewModel.coordinatesConverter.convertModelPositionToViewPosition(i),this.startPosition.lineNumber===this.endPosition.lineNumber?(this.visibleTextareaStart=e.visibleRangeForPosition(this.startPosition),this.visibleTextareaEnd=e.visibleRangeForPosition(this.endPosition)):(this.visibleTextareaStart=null,this.visibleTextareaEnd=null)}definePresentation(e){return this._previousPresentation||(e?this._previousPresentation=e:this._previousPresentation={foreground:1,italic:!1,bold:!1,underline:!1,strikethrough:!1}),this._previousPresentation}}const sw=di;let ow=class extends DT{constructor(e,t,i,n,s,r,a){super(t),this._keybindingService=r,this._instantiationService=a,this._primaryCursorPosition=new l.Position(1,1),this._primaryCursorVisibleRange=null,this._viewController=n,this._visibleRangeProvider=s,this._scrollLeft=0,this._scrollTop=0;const c=this._context.configuration.options,h=c.get(165);this._setAccessibilityOptions(c),this._contentLeft=h.contentLeft,this._contentWidth=h.contentWidth,this._contentHeight=h.height,this._fontInfo=c.get(59),this._emptySelectionClipboard=c.get(45),this._visibleTextArea=null,this._selections=[new l.Selection(1,1,1,1)],this._modelSelections=[new l.Selection(1,1,1,1)],this._lastRenderPosition=null,this.textArea=we(document.createElement("textarea")),Jn.write(this.textArea,7),this.textArea.setClassName(`inputarea ${Sc}`),this.textArea.setAttribute("wrap",this._textAreaWrapping&&!this._visibleTextArea?"on":"off");const{tabSize:d}=this._context.viewModel.model.getOptions();this.textArea.domNode.style.tabSize=`${d*this._fontInfo.spaceWidth}px`,this.textArea.setAttribute("autocorrect","off"),this.textArea.setAttribute("autocapitalize","off"),this.textArea.setAttribute("autocomplete","off"),this.textArea.setAttribute("spellcheck","false"),this.textArea.setAttribute("aria-label",nw(c,this._keybindingService)),this.textArea.setAttribute("aria-required",c.get(9)?"true":"false"),this.textArea.setAttribute("tabindex",String(c.get(140))),this.textArea.setAttribute("role","textbox"),this.textArea.setAttribute("aria-roledescription",l.localize(69,"editor")),this.textArea.setAttribute("aria-multiline","true"),this.textArea.setAttribute("aria-autocomplete",c.get(104)?"none":"both"),this._ensureReadOnlyAttribute(),this.textAreaCover=we(document.createElement("div")),this.textAreaCover.setPosition("absolute"),i.appendChild(this.textArea),i.appendChild(this.textAreaCover);const u=new xT,f={context:this._context,getScreenReaderContent:()=>{if(this._accessibilitySupport===1){const p=this._selections[0];if(l.isMacintosh&&p.isEmpty()){const v=p.getStartPosition();let C=this._getWordBeforePosition(v);if(C.length===0&&(C=this._getCharacterBeforePosition(v)),C.length>0)return new ci(C,C.length,C.length,l.Range.fromPositions(v),0)}if(l.isMacintosh&&!p.isEmpty()&&this._context.viewModel.getValueLengthInRange(p,0)<500){const v=this._context.viewModel.getValueInRange(p,0);return new ci(v,0,v.length,p,0)}if($r&&!p.isEmpty()){const v="vscode-placeholder";return new ci(v,0,v.length,null,void 0)}return ci.EMPTY}if(kD){const p=this._selections[0];if(p.isEmpty()){const b=p.getStartPosition(),[v,C]=this._getAndroidWordAtPosition(b);if(v.length>0)return new ci(v,C,C,l.Range.fromPositions(b),0)}return ci.EMPTY}const m=u.fromEditorSelection(this._context.viewModel,this._selections[0],this._accessibilityPageSize,this._accessibilitySupport===0);return ci.fromScreenReaderContentState(m)},deduceModelPosition:(m,p,b)=>this._context.viewModel.deduceModelPositionRelativeToViewPosition(m,p,b)},g=this._register(new Q3(this.textArea.domNode));this._textAreaInput=this._register(this._instantiationService.createInstance(Dv,f,g,l.OS,{isAndroid:kD,isChrome:jh,isFirefox:di,isSafari:$r})),this._register(this._textAreaInput.onWillCopy(m=>this._onWillCopy.fire(m))),this._register(this._textAreaInput.onWillCut(m=>this._onWillCut.fire(m))),this._register(this._textAreaInput.onWillPaste(m=>this._onWillPaste.fire(m))),this._register(this._textAreaInput.onKeyDown(m=>{this._viewController.emitKeyDown(m)})),this._register(this._textAreaInput.onKeyUp(m=>{this._viewController.emitKeyUp(m)})),this._register(this._textAreaInput.onPaste(m=>{let p=!1,b=null,v=null;m.metadata&&(p=this._emptySelectionClipboard&&!!m.metadata.isFromEmptySelection,b=typeof m.metadata.multicursorText<"u"?m.metadata.multicursorText:null,v=m.metadata.mode),this._viewController.paste(m.text,p,b,v)})),this._register(this._textAreaInput.onCut(()=>{this._viewController.cut()})),this._register(this._textAreaInput.onType(m=>{m.replacePrevCharCnt||m.replaceNextCharCnt||m.positionDelta?this._viewController.compositionType(m.text,m.replacePrevCharCnt,m.replaceNextCharCnt,m.positionDelta):this._viewController.type(m.text)})),this._register(this._textAreaInput.onSelectionChangeRequest(m=>{this._viewController.setSelection(m)})),this._register(this._textAreaInput.onCompositionStart(m=>{const p=this.textArea.domNode,b=this._modelSelections[0],{distanceToModelLineStart:v,widthOfHiddenTextBefore:C}=(()=>{const S=p.value.substring(0,Math.min(p.selectionStart,p.selectionEnd)),L=S.lastIndexOf(`
|
||
`),D=S.substring(L+1),x=D.lastIndexOf(" "),I=D.length-x-1,T=b.getStartPosition(),M=Math.min(T.column-1,I),O=T.column-1-M,P=D.substring(0,D.length-M),{tabSize:k}=this._context.viewModel.model.getOptions(),U=Z4(this.textArea.domNode.ownerDocument,P,this._fontInfo,k);return{distanceToModelLineStart:O,widthOfHiddenTextBefore:U}})(),{distanceToModelLineEnd:w}=(()=>{const S=p.value.substring(Math.max(p.selectionStart,p.selectionEnd)),L=S.indexOf(`
|
||
`),D=L===-1?S:S.substring(0,L),x=D.indexOf(" "),I=x===-1?D.length:D.length-x-1,T=b.getEndPosition(),M=Math.min(this._context.viewModel.model.getLineMaxColumn(T.lineNumber)-T.column,I);return{distanceToModelLineEnd:this._context.viewModel.model.getLineMaxColumn(T.lineNumber)-T.column-M}})();this._context.viewModel.revealRange("keyboard",!0,l.Range.fromPositions(this._selections[0].getStartPosition()),0,1),this._visibleTextArea=new Y4(this._context,b.startLineNumber,v,C,w),this.textArea.setAttribute("wrap",this._textAreaWrapping&&!this._visibleTextArea?"on":"off"),this._visibleTextArea.prepareRender(this._visibleRangeProvider),this._render(),this.textArea.setClassName(`inputarea ${Sc} ime-input`),this._viewController.compositionStart(),this._context.viewModel.onCompositionStart()})),this._register(this._textAreaInput.onCompositionUpdate(m=>{this._visibleTextArea&&(this._visibleTextArea.prepareRender(this._visibleRangeProvider),this._render())})),this._register(this._textAreaInput.onCompositionEnd(()=>{this._visibleTextArea=null,this.textArea.setAttribute("wrap",this._textAreaWrapping&&!this._visibleTextArea?"on":"off"),this._render(),this.textArea.setClassName(`inputarea ${Sc}`),this._viewController.compositionEnd(),this._context.viewModel.onCompositionEnd()})),this._register(this._textAreaInput.onFocus(()=>{this._context.viewModel.setHasFocus(!0)})),this._register(this._textAreaInput.onBlur(()=>{this._context.viewModel.setHasFocus(!1)})),this._register(Ss.onDidChange(()=>{this._ensureReadOnlyAttribute()})),this._register(j4.register(e,this))}get domNode(){return this.textArea}writeScreenReaderContent(e){this._textAreaInput.writeNativeTextAreaContent(e)}dispose(){super.dispose(),this.textArea.domNode.remove(),this.textAreaCover.domNode.remove()}_getAndroidWordAtPosition(e){const t='`~!@#$%^&*()-=+[{]}\\|;:",.<>/?',i=this._context.viewModel.getLineContent(e.lineNumber),n=l.getMapForWordSeparators(t,[]);let s=!0,r=e.column,a=!0,c=e.column,h=0;for(;h<50&&(s||a);){if(s&&r<=1&&(s=!1),s){const d=i.charCodeAt(r-2);n.get(d)!==0?s=!1:r--}if(a&&c>i.length&&(a=!1),a){const d=i.charCodeAt(c-1);n.get(d)!==0?a=!1:c++}h++}return[i.substring(r-1,c-1),e.column-r]}_getWordBeforePosition(e){const t=this._context.viewModel.getLineContent(e.lineNumber),i=l.getMapForWordSeparators(this._context.configuration.options.get(148),[]);let n=e.column,s=0;for(;n>1;){const r=t.charCodeAt(n-2);if(i.get(r)!==0||s>50)return t.substring(n-1,e.column-1);s++,n--}return t.substring(0,e.column-1)}_getCharacterBeforePosition(e){if(e.column>1){const i=this._context.viewModel.getLineContent(e.lineNumber).charAt(e.column-2);if(!l.isHighSurrogate(i.charCodeAt(0)))return i}return""}_setAccessibilityOptions(e){this._accessibilitySupport=e.get(2);const t=e.get(3);this._accessibilitySupport===2&&t===Fi.accessibilityPageSize.defaultValue?this._accessibilityPageSize=500:this._accessibilityPageSize=t;const n=e.get(165).wrappingColumn;if(n!==-1&&this._accessibilitySupport!==1){const s=e.get(59);this._textAreaWrapping=!0,this._textAreaWidth=Math.round(n*s.typicalHalfwidthCharacterWidth)}else this._textAreaWrapping=!1,this._textAreaWidth=sw?0:1}onConfigurationChanged(e){const t=this._context.configuration.options,i=t.get(165);this._setAccessibilityOptions(t),this._contentLeft=i.contentLeft,this._contentWidth=i.contentWidth,this._contentHeight=i.height,this._fontInfo=t.get(59),this._emptySelectionClipboard=t.get(45),this.textArea.setAttribute("wrap",this._textAreaWrapping&&!this._visibleTextArea?"on":"off");const{tabSize:n}=this._context.viewModel.model.getOptions();return this.textArea.domNode.style.tabSize=`${n*this._fontInfo.spaceWidth}px`,this.textArea.setAttribute("aria-label",nw(t,this._keybindingService)),this.textArea.setAttribute("aria-required",t.get(9)?"true":"false"),this.textArea.setAttribute("tabindex",String(t.get(140))),(e.hasChanged(41)||e.hasChanged(104))&&this._ensureReadOnlyAttribute(),e.hasChanged(2)&&this._textAreaInput.writeNativeTextAreaContent("strategy changed"),!0}onCursorStateChanged(e){return this._selections=e.selections.slice(0),this._modelSelections=e.modelSelections.slice(0),this._textAreaInput.writeNativeTextAreaContent("selection changed"),!0}onDecorationsChanged(e){return!0}onFlushed(e){return!0}onLinesChanged(e){return!0}onLinesDeleted(e){return!0}onLinesInserted(e){return!0}onScrollChanged(e){return this._scrollLeft=e.scrollLeft,this._scrollTop=e.scrollTop,!0}onZonesChanged(e){return!0}isFocused(){return this._textAreaInput.isFocused()}focus(){this._textAreaInput.focusTextArea()}refreshFocusState(){this._textAreaInput.refreshFocusState()}getLastRenderData(){return this._lastRenderPosition}setAriaOptions(e){e.activeDescendant?(this.textArea.setAttribute("aria-haspopup","true"),this.textArea.setAttribute("aria-autocomplete","list"),this.textArea.setAttribute("aria-activedescendant",e.activeDescendant)):(this.textArea.setAttribute("aria-haspopup","false"),this.textArea.setAttribute("aria-autocomplete","both"),this.textArea.removeAttribute("aria-activedescendant")),e.role&&this.textArea.setAttribute("role",e.role)}_ensureReadOnlyAttribute(){const e=this._context.configuration.options;!Ss.enabled||e.get(41)&&e.get(104)?this.textArea.setAttribute("readonly","true"):this.textArea.removeAttribute("readonly")}prepareRender(e){this._primaryCursorPosition=new l.Position(this._selections[0].positionLineNumber,this._selections[0].positionColumn),this._primaryCursorVisibleRange=e.visibleRangeForPosition(this._primaryCursorPosition),this._visibleTextArea?.prepareRender(e)}render(e){this._textAreaInput.writeNativeTextAreaContent("render"),this._render()}_render(){if(this._visibleTextArea){const i=this._visibleTextArea.visibleTextareaStart,n=this._visibleTextArea.visibleTextareaEnd,s=this._visibleTextArea.startPosition,r=this._visibleTextArea.endPosition;if(s&&r&&i&&n&&n.left>=this._scrollLeft&&i.left<=this._scrollLeft+this._contentWidth){const a=this._context.viewLayout.getVerticalOffsetForLineNumber(this._primaryCursorPosition.lineNumber)-this._scrollTop,c=ET(this.textArea.domNode.value.substr(0,this.textArea.domNode.selectionStart));let h=this._visibleTextArea.widthOfHiddenLineTextBefore,d=this._contentLeft+i.left-this._scrollLeft,u=n.left-i.left+1;if(d<this._contentLeft){const w=this._contentLeft-d;d+=w,h+=w,u-=w}u>this._contentWidth&&(u=this._contentWidth);const f=this._context.viewLayout.getLineHeightForLineNumber(s.lineNumber),g=this._context.viewModel.getFontSizeAtPosition(this._primaryCursorPosition),m=this._context.viewModel.getViewLineData(s.lineNumber),p=m.tokens.findTokenIndexAtOffset(s.column-1),b=m.tokens.findTokenIndexAtOffset(r.column-1),v=p===b,C=this._visibleTextArea.definePresentation(v?m.tokens.getPresentation(p):null);this.textArea.domNode.scrollTop=c*f,this.textArea.domNode.scrollLeft=h,this._doRender({lastRenderPosition:null,top:a,left:d,width:u,height:f,useCover:!1,color:(l.TokenizationRegistry.getColorMap()||[])[C.foreground],italic:C.italic,bold:C.bold,underline:C.underline,strikethrough:C.strikethrough,fontSize:g})}return}if(!this._primaryCursorVisibleRange){this._renderAtTopLeft();return}const e=this._contentLeft+this._primaryCursorVisibleRange.left-this._scrollLeft;if(e<this._contentLeft||e>this._contentLeft+this._contentWidth){this._renderAtTopLeft();return}const t=this._context.viewLayout.getVerticalOffsetForLineNumber(this._selections[0].positionLineNumber)-this._scrollTop;if(t<0||t>this._contentHeight){this._renderAtTopLeft();return}if(l.isMacintosh||this._accessibilitySupport===2){const i=this._primaryCursorPosition.lineNumber,n=this._context.viewLayout.getLineHeightForLineNumber(i);this._doRender({lastRenderPosition:this._primaryCursorPosition,top:t,left:this._textAreaWrapping?this._contentLeft:e,width:this._textAreaWidth,height:n,useCover:!1}),this.textArea.domNode.scrollLeft=this._primaryCursorVisibleRange.left;const s=this._textAreaInput.textAreaState.newlineCountBeforeSelection??ET(this.textArea.domNode.value.substring(0,this.textArea.domNode.selectionStart));this.textArea.domNode.scrollTop=s*n;return}this._doRender({lastRenderPosition:this._primaryCursorPosition,top:t,left:this._textAreaWrapping?this._contentLeft:e,width:this._textAreaWidth,height:sw?0:1,useCover:!1})}_renderAtTopLeft(){this._doRender({lastRenderPosition:null,top:0,left:0,width:this._textAreaWidth,height:sw?0:1,useCover:!0})}_doRender(e){this._lastRenderPosition=e.lastRenderPosition;const t=this.textArea,i=this.textAreaCover;Ot(t,this._fontInfo),t.setTop(e.top),t.setLeft(e.left),t.setWidth(e.width),t.setHeight(e.height),t.setLineHeight(e.height),t.setFontSize(e.fontSize??this._fontInfo.fontSize),t.setColor(e.color?l.Color.Format.CSS.formatHex(e.color):""),t.setFontStyle(e.italic?"italic":""),e.bold&&t.setFontWeight("bold"),t.setTextDecoration(`${e.underline?" underline":""}${e.strikethrough?" line-through":""}`),i.setTop(e.useCover?e.top:0),i.setLeft(e.useCover?e.left:0),i.setWidth(e.useCover?e.width:0),i.setHeight(e.useCover?e.height:0);const n=this._context.configuration.options;n.get(66)?i.setClassName("monaco-editor-background textAreaCover "+pm.OUTER_CLASS_NAME):n.get(76).renderType!==0?i.setClassName("monaco-editor-background textAreaCover "+gm.CLASS_NAME):i.setClassName("monaco-editor-background textAreaCover")}};ow=q4([IT(5,xt),IT(6,me)],ow);function Z4(o,e,t,i){if(e.length===0)return 0;const n=o.createElement("div");n.style.position="absolute",n.style.top="-50000px",n.style.width="50000px";const s=o.createElement("span");Ot(s,t),s.style.whiteSpace="pre",s.style.tabSize=`${i*t.spaceWidth}px`,s.append(e),n.appendChild(s),o.body.appendChild(n);const r=s.offsetWidth;return n.remove(),r}var Q4=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},X4=function(o,e){return function(t,i){e(t,i,o)}};let rw=class extends l.Disposable{constructor(e,t,i){super(),this._domNode=t,this._onFocusChange=i,this._isFocused=!1,this._isPaused=!1,this._register(R(this._domNode,"focus",()=>{e.trace("NativeEditContext.focus"),!this._isPaused&&this.refreshFocusState()})),this._register(R(this._domNode,"blur",()=>{e.trace("NativeEditContext.blur"),!this._isPaused&&this._handleFocusedChanged(!1)}))}pause(){this._isPaused=!0}resume(){this._isPaused=!1,this.refreshFocusState()}_handleFocusedChanged(e){this._isFocused!==e&&(this._isFocused=e,this._onFocusChange(this._isFocused))}focus(){this._domNode.focus(),this.refreshFocusState()}refreshFocusState(){const e=qo(this._domNode),t=e?e.activeElement:wt(),i=this._domNode===t;this._handleFocusedChanged(i)}get isFocused(){return this._isFocused}};rw=Q4([X4(0,ei)],rw);function Jd(o,e,t,i){return o.addEventListener(e,t,i),{dispose(){o.removeEventListener(e,t)}}}var J4=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},W4=function(o,e){return function(t,i){e(t,i,o)}};const H4=lo("richScreenReaderContent",{createHTML:o=>o}),aw="data-line-number";let lw=class extends l.Disposable{constructor(e,t,i,n){super(),this._domNode=e,this._context=t,this._viewController=i,this._accessibilityService=n,this._selectionChangeListener=this._register(new l.MutableDisposable),this._accessibilityPageSize=1,this._ignoreSelectionChangeTime=0,this._state=Wd.NULL,this._strategy=new i5,this._renderedLines=new Map,this._renderedSelection=new l.Selection(1,1,1,1),this.onConfigurationChanged(this._context.configuration.options)}updateScreenReaderContent(e){const t=Le().document.activeElement;if(!t||t!==this._domNode.domNode)return;if(this._accessibilityService.isScreenReaderOptimized()){const n=this._getScreenReaderContentLineIntervals(e);this._state.equals(n)||(this._state=n,this._renderedLines=this._renderScreenReaderContent(n)),this._renderedSelection.equalsSelection(e)||(this._renderedSelection=e,this._setSelectionOnScreenReaderContent(this._context,this._renderedLines,e))}else this._state=Wd.NULL,this._setIgnoreSelectionChangeTime("setValue"),this._domNode.domNode.textContent=""}updateScrollTop(e){const t=this._state.intervals;if(!t.length)return;const i=this._context.viewModel.viewLayout,n=t[0].startLine,s=i.getVerticalOffsetForLineNumber(n),r=i.getVerticalOffsetForLineNumber(e.positionLineNumber);this._domNode.domNode.scrollTop=r-s}onFocusChange(e){e?this._selectionChangeListener.value=this._setSelectionChangeListener():this._selectionChangeListener.value=void 0}onConfigurationChanged(e){this._accessibilityPageSize=e.get(3)}onWillCut(){this._setIgnoreSelectionChangeTime("onCut")}onWillPaste(){this._setIgnoreSelectionChangeTime("onWillPaste")}_setIgnoreSelectionChangeTime(e){this._ignoreSelectionChangeTime=Date.now()}_setSelectionChangeListener(){let e=0;return R(this._domNode.domNode.ownerDocument,"selectionchange",()=>{if(!(Le().document.activeElement===this._domNode.domNode)||!this._accessibilityService.isScreenReaderOptimized()||!Ss.enabled)return;const s=Date.now(),r=s-e;if(e=s,r<5)return;const a=s-this._ignoreSelectionChangeTime;if(this._ignoreSelectionChangeTime=0,a<100)return;const c=this._getEditorSelectionFromDomRange();c&&this._viewController.setSelection(c)})}_renderScreenReaderContent(e){const t=[],i=new Map;for(const n of e.intervals)for(let s=n.startLine;s<=n.endLine;s++){const r=this._renderLine(s);i.set(s,r),t.push(r.domNode)}return this._setIgnoreSelectionChangeTime("setValue"),this._domNode.domNode.replaceChildren(...t),i}_renderLine(e){const t=this._context.viewModel,i=t.getViewLineRenderingData(e),n=this._context.configuration.options,s=n.get(59),r=n.get(133),a=n.get(108),c=n.get(60),h=n.get(40),d=Ji.filter(i.inlineDecorations,e,i.minColumn,i.maxColumn),u=s.isMonospace&&!h,f=c!==io.OFF;let g;n.get(47)==="off"?g=n.get(113):g="none";const p=new Wo(u,s.canUseHalfwidthRightwardsArrow,i.content,i.continuesWithWrappedLine,i.isBasicASCII,i.containsRTL,i.minColumn-1,i.tokens,d,i.tabSize,i.startVisibleColumn,s.spaceWidth,s.middotWidth,s.wsmiddotWidth,r,g,a,f,null,null,0,!0),b=new ra(1e4),v=bd(p,b),C=b.build(),w=H4?.createHTML(C)??C,S=t.viewLayout.getLineHeightForLineNumber(e)+"px",L=document.createElement("div");return L.innerHTML=w,L.style.lineHeight=S,L.style.height=S,L.setAttribute(aw,e.toString()),new e5(L,v.characterMapping)}_setSelectionOnScreenReaderContent(e,t,i){const s=Le().document.getSelection();if(!s)return;const r=i.startLineNumber,a=i.endLineNumber,c=t.get(r),h=t.get(a);if(!c||!h)return;const d=e.viewModel,u=d.model,f=d.coordinatesConverter,g=new l.Range(r,1,r,i.selectionStartColumn),m=f.convertViewRangeToModelRange(g),p=u.getCharacterCountInRange(m),b=new l.Range(a,1,a,i.positionColumn),v=f.convertViewRangeToModelRange(b),C=u.getCharacterCountInRange(v),w=c.characterMapping.getDomPosition(p),S=h.characterMapping.getDomPosition(C),L=c.domNode.firstChild,D=h.domNode.firstChild,x=L.childNodes,I=D.childNodes,T=x.item(w.partIndex),M=I.item(S.partIndex);!T.firstChild||!M.firstChild||(this._setIgnoreSelectionChangeTime("setRange"),s.setBaseAndExtent(T.firstChild,i.startColumn===1?0:w.charIndex+1,M.firstChild,i.endColumn===1?0:S.charIndex+1))}_getScreenReaderContentLineIntervals(e){return this._strategy.fromEditorSelection(this._context.viewModel,e,this._accessibilityPageSize)}_getEditorSelectionFromDomRange(){if(!this._renderedLines)return;const e=Le().document.getSelection();if(!e||e.rangeCount===0)return;const i=e.getRangeAt(0),n=i.startContainer,s=i.endContainer,r=n.parentElement,a=s.parentElement;if(!r||!Ve(r)||!a||!Ve(a))return;const c=r.parentElement?.parentElement,h=a.parentElement?.parentElement;if(!c||!h)return;const d=c.getAttribute(aw),u=h.getAttribute(aw);if(!d||!u)return;const f=parseInt(d),g=parseInt(u),m=this._renderedLines.get(f)?.characterMapping,p=this._renderedLines.get(g)?.characterMapping;if(!m||!p)return;const b=dc(m,r,i.startOffset),v=dc(p,a,i.endOffset);return e.direction==="forward"?new l.Selection(f,b,g,v):new l.Selection(g,v,f,b)}};lw=J4([W4(3,Ui)],lw);class e5{constructor(e,t){this.domNode=e,this.characterMapping=t}}class t5{constructor(e,t){this.startLine=e,this.endLine=t}}class Wd{constructor(e,t){this.intervals=t;let i="";for(const n of t)for(let s=n.startLine;s<=n.endLine;s++)i+=e.getLineContent(s)+`
|
||
`;this.value=i}equals(e){return this.value===e.value}static get NULL(){const e={getLineContent:()=>"",getLineCount:()=>1,getLineMaxColumn:()=>1,getValueInRange:()=>"",getValueLengthInRange:()=>0,modifyPosition:(t,i)=>t};return new Wd(e,[])}}class i5{constructor(){}_getPageOfLine(e,t){return Math.floor((e-1)/t)}_getRangeForPage(e,t,i){const n=t*i,s=n+1,r=Math.min(n+i,e.getLineCount());return new t5(s,r)}fromEditorSelection(e,t,i){const n=this._getPageOfLine(t.startLineNumber,i),s=this._getRangeForPage(e,n,i),r=this._getPageOfLine(t.endLineNumber,i),a=this._getRangeForPage(e,r,i),c=[{startLine:s.startLine,endLine:s.endLine}];return n+1<r&&c.push({startLine:a.startLine,endLine:a.endLine}),new Wd(e,c)}}var n5=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},s5=function(o,e){return function(t,i){e(t,i,o)}};let cw=class extends l.Disposable{constructor(e,t,i,n){super(),this._domNode=e,this._context=t,this._viewController=i,this._accessibilityService=n,this._selectionChangeListener=this._register(new l.MutableDisposable),this._accessibilityPageSize=1,this._ignoreSelectionChangeTime=0,this._strategy=new xT,this.onConfigurationChanged(this._context.configuration.options)}updateScreenReaderContent(e){const t=this._domNode.domNode,i=Le().document.activeElement;if(!i||i!==t)return;if(this._accessibilityService.isScreenReaderOptimized()){this._state=this._getScreenReaderContentState(e),t.textContent!==this._state.value&&(this._setIgnoreSelectionChangeTime("setValue"),t.textContent=this._state.value);const s=Le().document.getSelection();if(!s)return;const r=this._getScreenReaderRange(this._state.selectionStart,this._state.selectionEnd);if(!r)return;this._setIgnoreSelectionChangeTime("setRange"),s.setBaseAndExtent(r.anchorNode,r.anchorOffset,r.focusNode,r.focusOffset)}else this._state=void 0,this._setIgnoreSelectionChangeTime("setValue"),this._domNode.domNode.textContent=""}updateScrollTop(e){if(!this._state)return;const t=this._context.viewModel.viewLayout,i=this._state.startPositionWithinEditor.lineNumber,n=t.getVerticalOffsetForLineNumber(i),s=t.getVerticalOffsetForLineNumber(e.positionLineNumber);this._domNode.domNode.scrollTop=s-n}onFocusChange(e){e?this._selectionChangeListener.value=this._setSelectionChangeListener():this._selectionChangeListener.value=void 0}onConfigurationChanged(e){this._accessibilityPageSize=e.get(3)}onWillCut(){this._setIgnoreSelectionChangeTime("onCut")}onWillPaste(){this._setIgnoreSelectionChangeTime("onWillPaste")}_setIgnoreSelectionChangeTime(e){this._ignoreSelectionChangeTime=Date.now()}_setSelectionChangeListener(){let e=0;return R(this._domNode.domNode.ownerDocument,"selectionchange",()=>{const t=this._accessibilityService.isScreenReaderOptimized();if(!this._state||!t||!Ss.enabled||!(Le().document.activeElement===this._domNode.domNode))return;const s=Le().document.getSelection();if(!s||s.rangeCount===0)return;const a=s.getRangeAt(0),c=Date.now(),h=c-e;if(e=c,h<5)return;const d=c-this._ignoreSelectionChangeTime;this._ignoreSelectionChangeTime=0,!(d<100)&&this._viewController.setSelection(this._getEditorSelectionFromDomRange(this._context,this._state,s.direction,a))})}_getScreenReaderContentState(e){const t=this._strategy.fromEditorSelection(this._context.viewModel,e,this._accessibilityPageSize,this._accessibilityService.getAccessibilitySupport()===0),i=this._context.viewModel.model.getPositionAt(1/0);let n=t.value;return i.column===1&&e.getEndPosition().equals(i)&&(n+=`
|
||
`),t.value=n,t}_getScreenReaderRange(e,t){const i=this._domNode.domNode.firstChild;if(!i)return;const n=new globalThis.Range;return n.setStart(i,e),n.setEnd(i,t),{anchorNode:i,anchorOffset:e,focusNode:i,focusOffset:t}}_getEditorSelectionFromDomRange(e,t,i,n){const s=e.viewModel,r=s.model,c=s.coordinatesConverter.convertViewPositionToModelPosition(t.startPositionWithinEditor),h=r.getOffsetAt(c);let d=n.startOffset+h,u=n.endOffset+h;if(r.getEndOfLineSequence()===1){const v=t.value,C=new l.PositionOffsetTransformer(v),w=C.getPosition(n.startOffset),S=C.getPosition(n.endOffset);d+=w.lineNumber-1,u+=S.lineNumber-1}const g=r.getPositionAt(d),m=r.getPositionAt(u),p=i==="forward"?g:m,b=i==="forward"?m:g;return l.Selection.fromPositions(p,b)}};cw=n5([s5(3,Ui)],cw);var o5=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},TT=function(o,e){return function(t,i){e(t,i,o)}};let hw=class extends l.Disposable{constructor(e,t,i,n,s){super(),this._domNode=e,this._context=t,this._viewController=i,this._keybindingService=n,this._accessibilityService=s,this._contentLeft=1,this._contentWidth=1,this._contentHeight=1,this._divWidth=1,this._primarySelection=new l.Selection(1,1,1,1),this._primaryCursorVisibleRange=null,this._state=this._register(new l.MutableDisposable),this._instantiateScreenReaderContent(),this._updateConfigurationSettings(),this._updateDomAttributes()}onWillPaste(){this._state.value?.onWillPaste()}onWillCut(){this._state.value?.onWillCut()}handleFocusChange(e){this._state.value?.onFocusChange(e),this.writeScreenReaderContent()}onConfigurationChanged(e){this._instantiateScreenReaderContent(),this._updateConfigurationSettings(),this._updateDomAttributes(),e.hasChanged(2)&&this.writeScreenReaderContent()}_instantiateScreenReaderContent(){const e=this._context.configuration.options.get(107);this._renderRichContent!==e&&(this._renderRichContent=e,this._state.value=this._createScreenReaderContent(e))}_createScreenReaderContent(e){return e?new lw(this._domNode,this._context,this._viewController,this._accessibilityService):new cw(this._domNode,this._context,this._viewController,this._accessibilityService)}_updateConfigurationSettings(){const e=this._context.configuration.options,t=e.get(165),i=t.wrappingColumn;this._contentLeft=t.contentLeft,this._contentWidth=t.contentWidth,this._contentHeight=t.height,this._fontInfo=e.get(59),this._divWidth=Math.round(i*this._fontInfo.typicalHalfwidthCharacterWidth),this._state.value?.onConfigurationChanged(e)}_updateDomAttributes(){const e=this._context.configuration.options;this._domNode.domNode.setAttribute("role","textbox"),this._domNode.domNode.setAttribute("aria-required",e.get(9)?"true":"false"),this._domNode.domNode.setAttribute("aria-multiline","true"),this._domNode.domNode.setAttribute("aria-autocomplete",e.get(104)?"none":"both"),this._domNode.domNode.setAttribute("aria-roledescription",l.localize(64,"editor")),this._domNode.domNode.setAttribute("aria-label",nw(e,this._keybindingService));const t=this._context.viewModel.model.getOptions().tabSize,i=e.get(59).spaceWidth;this._domNode.domNode.style.tabSize=`${t*i}px`;const n=e.get(154),s=n==="inherit"?e.get(153):n,r=s==="inherit"?e.get(149):s;this._domNode.domNode.style.textWrap=r==="off"?"nowrap":"wrap"}onCursorStateChanged(e){this._primarySelection=e.selections[0]??new l.Selection(1,1,1,1)}prepareRender(e){this.writeScreenReaderContent(),this._primaryCursorVisibleRange=e.visibleRangeForPosition(this._primarySelection.getPosition())}render(e){if(!this._primaryCursorVisibleRange){this._renderAtTopLeft();return}const t=this._context.viewLayout.getCurrentScrollLeft(),i=this._contentLeft+this._primaryCursorVisibleRange.left-t;if(i<this._contentLeft||i>this._contentLeft+this._contentWidth){this._renderAtTopLeft();return}const n=this._context.viewLayout.getCurrentScrollTop(),s=this._primarySelection.positionLineNumber,r=this._context.viewLayout.getVerticalOffsetForLineNumber(s)-n;if(r<0||r>this._contentHeight){this._renderAtTopLeft();return}const a=this._context.viewLayout.getLineHeightForLineNumber(s);this._doRender(r,this._contentLeft,this._divWidth,a),this._state.value?.updateScrollTop(this._primarySelection)}_renderAtTopLeft(){this._doRender(0,0,this._contentWidth,1)}_doRender(e,t,i,n){Ot(this._domNode,this._fontInfo),this._domNode.setTop(e),this._domNode.setLeft(t),this._domNode.setWidth(i),this._domNode.setHeight(n),this._domNode.setLineHeight(n)}setAriaOptions(e){e.activeDescendant?(this._domNode.setAttribute("aria-haspopup","true"),this._domNode.setAttribute("aria-autocomplete","list"),this._domNode.setAttribute("aria-activedescendant",e.activeDescendant)):(this._domNode.setAttribute("aria-haspopup","false"),this._domNode.setAttribute("aria-autocomplete","both"),this._domNode.removeAttribute("aria-activedescendant")),e.role&&this._domNode.setAttribute("role",e.role)}writeScreenReaderContent(){this._state.value?.updateScreenReaderContent(this._primarySelection)}};hw=o5([TT(3,xt),TT(4,Ui)],hw);var dw;(function(o){function e(t,i){return new t.EditContext(i)}o.create=e})(dw||(dw={}));class r5{constructor(){this._nativeEditContextMapping=new Map}register(e,t){return this._nativeEditContextMapping.set(e,t),{dispose:()=>{this._nativeEditContextMapping.delete(e)}}}get(e){return this._nativeEditContextMapping.get(e)}}const NT=new r5;var a5=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},RT=function(o,e){return function(t,i){e(t,i,o)}},Hd;(function(o){o.NONE="edit-context-composition-none",o.SECONDARY="edit-context-composition-secondary",o.PRIMARY="edit-context-composition-primary"})(Hd||(Hd={}));let ym=class extends DT{constructor(e,t,i,n,s,r,a){super(t),this._viewController=n,this._visibleRangeProvider=s,this.logService=a,this._previousEditContextSelection=new l.OffsetRange(0,0),this._previousEditContextText="",this._editContextPrimarySelection=new l.Selection(1,1,1,1),this._parentBounds=null,this._decorations=[],this._primarySelection=new l.Selection(1,1,1,1),this._targetWindowId=-1,this._scrollTop=0,this._scrollLeft=0,this._linesVisibleRanges=null,this.domNode=new Hf(document.createElement("div")),this.domNode.setClassName("native-edit-context"),this._imeTextArea=new Hf(document.createElement("textarea")),this._imeTextArea.setClassName("ime-text-area"),this._imeTextArea.setAttribute("readonly","true"),this._imeTextArea.setAttribute("tabindex","-1"),this._imeTextArea.setAttribute("aria-hidden","true"),this.domNode.setAttribute("autocorrect","off"),this.domNode.setAttribute("autocapitalize","off"),this.domNode.setAttribute("autocomplete","off"),this.domNode.setAttribute("spellcheck","false"),this._updateDomAttributes(),i.appendChild(this.domNode),i.appendChild(this._imeTextArea),this._parent=i.domNode,this._focusTracker=this._register(new rw(a,this.domNode.domNode,u=>{a.trace("NativeEditContext#handleFocusChange : ",u),this._screenReaderSupport.handleFocusChange(u),this._context.viewModel.setHasFocus(u)}));const c=j(this.domNode.domNode);this._editContext=dw.create(c),this.setEditContextOnDomNode(),this._screenReaderSupport=this._register(r.createInstance(hw,this.domNode,t,this._viewController)),this._register(R(this.domNode.domNode,"copy",u=>{this.logService.trace("NativeEditContext#copy"),em.electronBugWorkaroundCopyEventHasFired=!0;const f=tm(u,!1,this._context,this.logService,di);this._onWillCopy.fire(f),!f.isHandled&&f.ensureClipboardGetsEditorData()})),this._register(R(this.domNode.domNode,"cut",u=>{this.logService.trace("NativeEditContext#cut");const f=tm(u,!0,this._context,this.logService,di);this._onWillCut.fire(f),!f.isHandled&&(this._screenReaderSupport.onWillCut(),f.ensureClipboardGetsEditorData(),this.logService.trace("NativeEditContext#cut (before viewController.cut)"),this._viewController.cut())})),this._register(R(this.domNode.domNode,"selectionchange",()=>{_n.onSelectionChange()})),this._register(R(this.domNode.domNode,"keyup",u=>this._onKeyUp(u))),this._register(R(this.domNode.domNode,"keydown",async u=>this._onKeyDown(u))),this._register(R(this._imeTextArea.domNode,"keyup",u=>this._onKeyUp(u))),this._register(R(this._imeTextArea.domNode,"keydown",async u=>this._onKeyDown(u))),this._register(R(this.domNode.domNode,"beforeinput",async u=>{_n.onBeforeInput(),(u.inputType==="insertParagraph"||u.inputType==="insertLineBreak")&&this._onType(this._viewController,{text:`
|
||
`,replacePrevCharCnt:0,replaceNextCharCnt:0,positionDelta:0})})),this._register(R(this.domNode.domNode,"paste",u=>{this.logService.trace("NativeEditContext#paste");const f=LI(u);if(this._onWillPaste.fire(f),f.isHandled){u.preventDefault();return}if(u.preventDefault(),!u.clipboardData||(this.logService.trace("NativeEditContext#paste with id : ",f.metadata?.id," with text.length: ",f.text.length),!f.text))return;let g=!1,m=null,p=null;f.metadata&&(g=this._context.configuration.options.get(45)&&!!f.metadata.isFromEmptySelection,m=typeof f.metadata.multicursorText<"u"?f.metadata.multicursorText:null,p=f.metadata.mode),this.logService.trace("NativeEditContext#paste (before viewController.paste)"),this._viewController.paste(f.text,g,m,p)})),this._register(Jd(this._editContext,"textformatupdate",u=>this._handleTextFormatUpdate(u))),this._register(Jd(this._editContext,"characterboundsupdate",u=>this._updateCharacterBounds(u)));let h;this._register(Jd(this._editContext,"textupdate",u=>{_n.onInput();const f=u.text;if(f.length===1){const g=f.charCodeAt(0);if(l.isHighSurrogate(g)){h=f;return}if(l.isLowSurrogate(g)&&h){const m={text:h+f,selectionEnd:u.selectionEnd,selectionStart:u.selectionStart,updateRangeStart:u.updateRangeStart-1,updateRangeEnd:u.updateRangeEnd-1};h=void 0,this._emitTypeEvent(this._viewController,m);return}}this._emitTypeEvent(this._viewController,u)})),this._register(Jd(this._editContext,"compositionstart",u=>{this._updateEditContext(),this._viewController.compositionStart(),this._context.viewModel.onCompositionStart()})),this._register(Jd(this._editContext,"compositionend",u=>{this._updateEditContext(),this._viewController.compositionEnd(),this._context.viewModel.onCompositionEnd()}));let d=!1;this._register(Ss.onDidChange(()=>{Ss.enabled&&d&&(this._focusTracker.resume(),this.domNode.focus(),d=!1),!Ss.enabled&&this.isFocused()&&(this._focusTracker.pause(),this._imeTextArea.focus(),d=!0)})),this._register(NT.register(e,this)),this._register(t.viewModel.model.onDidChangeContent(u=>{let f=!1;for(const g of u.changes)if(g.range.startLineNumber<=this._editContextPrimarySelection.endLineNumber&&g.range.endLineNumber>=this._editContextPrimarySelection.startLineNumber){f=!0;break}f&&this._updateEditContext()}))}dispose(){this.domNode.domNode.editContext=void 0,this.domNode.domNode.blur(),this.domNode.domNode.remove(),this._imeTextArea.domNode.remove(),super.dispose()}setAriaOptions(e){this._screenReaderSupport.setAriaOptions(e)}getLastRenderData(){return this._primarySelection.getPosition()}onBeforeRender(e){this._parentBounds=this._parent.getBoundingClientRect()}prepareRender(e){this._screenReaderSupport.prepareRender(e),this._updateSelectionAndControlBoundsData(e)}render(e){this._screenReaderSupport.render(e),this._updateSelectionAndControlBounds()}onCursorStateChanged(e){return this._primarySelection=e.modelSelections[0]??new l.Selection(1,1,1,1),this._screenReaderSupport.onCursorStateChanged(e),this._updateEditContext(),!0}onConfigurationChanged(e){return this._screenReaderSupport.onConfigurationChanged(e),this._updateDomAttributes(),!0}onDecorationsChanged(e){return!0}onFlushed(e){return!0}onLinesChanged(e){return!0}onLinesDeleted(e){return!0}onLinesInserted(e){return!0}onScrollChanged(e){return this._scrollLeft=e.scrollLeft,this._scrollTop=e.scrollTop,!0}onZonesChanged(e){return!0}handleWillPaste(){this.logService.trace("NativeEditContext#handleWillPaste"),this._prepareScreenReaderForPaste()}_prepareScreenReaderForPaste(){this._screenReaderSupport.onWillPaste()}handleWillCopy(){this.logService.trace("NativeEditContext#handleWillCopy"),this.logService.trace("NativeEditContext#isFocused : ",this.domNode.domNode===wt())}writeScreenReaderContent(){this._screenReaderSupport.writeScreenReaderContent()}isFocused(){return this._focusTracker.isFocused}focus(){this._focusTracker.focus(),this.refreshFocusState()}refreshFocusState(){this._focusTracker.refreshFocusState()}setEditContextOnDomNode(){const e=j(this.domNode.domNode),t=td(e);this._targetWindowId!==t&&(this.domNode.domNode.editContext=this._editContext,this._targetWindowId=t)}_onKeyUp(e){_n.onKeyUp(),this._viewController.emitKeyUp(new Be(e))}_onKeyDown(e){_n.onKeyDown();const t=new Be(e);t.keyCode===114&&t.stopPropagation(),this._viewController.emitKeyDown(t)}_updateDomAttributes(){const e=this._context.configuration.options;this.domNode.domNode.setAttribute("tabindex",String(e.get(140)))}_updateEditContext(){const e=this._getNewEditContextState();if(!e)return;const t=e.text??" ";t!==this._previousEditContextText&&(this._editContext.updateText(0,this._previousEditContextText.length,t),this._previousEditContextText=t),(e.selectionStartOffset!==this._previousEditContextSelection.start||e.selectionEndOffset!==this._previousEditContextSelection.endExclusive)&&this._editContext.updateSelection(e.selectionStartOffset,e.selectionEndOffset),this._editContextPrimarySelection=e.editContextPrimarySelection,this._previousEditContextSelection=new l.OffsetRange(e.selectionStartOffset,e.selectionEndOffset)}_emitTypeEvent(e,t){if(!this._editContext)return;const i=this._previousEditContextSelection.endExclusive,n=this._previousEditContextSelection.start;this._previousEditContextSelection=new l.OffsetRange(t.selectionStart,t.selectionEnd);let s=0,r=0;t.updateRangeEnd>i&&(s=t.updateRangeEnd-i),t.updateRangeStart<n&&(r=n-t.updateRangeStart);let a="";n<t.updateRangeStart&&(a+=this._editContext.text.substring(n,t.updateRangeStart)),a+=t.text,i>t.updateRangeEnd&&(a+=this._editContext.text.substring(t.updateRangeEnd,i));let c=0;t.selectionStart===t.selectionEnd&&n===i&&(c=t.selectionStart-(t.updateRangeStart+t.text.length));const h={text:a,replacePrevCharCnt:r,replaceNextCharCnt:s,positionDelta:c};this._onType(e,h)}_onType(e,t){t.replacePrevCharCnt||t.replaceNextCharCnt||t.positionDelta?e.compositionType(t.text,t.replacePrevCharCnt,t.replaceNextCharCnt,t.positionDelta):e.type(t.text)}_getNewEditContextState(){const e=this._primarySelection,t=this._context.viewModel.model;if(!t.isValidRange(e))return;const i=e.startLineNumber,n=e.endLineNumber,s=t.getLineMaxColumn(n),r=new l.Range(i,1,n,s),a=t.getValueInRange(r,0),c=e.startColumn-1,h=a.length+e.endColumn-s;return{text:a,selectionStartOffset:c,selectionEndOffset:h,editContextPrimarySelection:e}}_editContextStartPosition(){return new l.Position(this._editContextPrimarySelection.startLineNumber,1)}_handleTextFormatUpdate(e){if(!this._editContext)return;const t=e.getTextFormats(),i=this._editContextStartPosition(),n=[];t.forEach(s=>{const r=this._context.viewModel.model,a=r.getOffsetAt(i),c=r.getPositionAt(a+s.rangeStart),h=r.getPositionAt(a+s.rangeEnd),d=l.Range.fromPositions(c,h),u=s.underlineThickness.toLowerCase();let f=Hd.NONE;switch(u){case"thin":f=Hd.SECONDARY;break;case"thick":f=Hd.PRIMARY;break}n.push({range:d,options:{description:"textFormatDecoration",inlineClassName:f}})}),this._decorations=this._context.viewModel.model.deltaDecorations(this._decorations,n)}_updateSelectionAndControlBoundsData(e){const t=this._context.viewModel.coordinatesConverter.convertModelRangeToViewRange(this._primarySelection);if(this._primarySelection.isEmpty()){const i=e.visibleRangeForPosition(t.getStartPosition());this._linesVisibleRanges=i}else this._linesVisibleRanges=null}_updateSelectionAndControlBounds(){const t=this._context.configuration.options.get(165).contentLeft,i=this._context.viewModel.coordinatesConverter.convertModelRangeToViewRange(this._primarySelection),n=this._context.viewLayout.getVerticalOffsetForLineNumber(i.startLineNumber),s=this._context.viewLayout.getVerticalOffsetAfterLineNumber(i.endLineNumber),r=this._parentBounds,a=r.top+n-this._scrollTop,c=s-n;let h=r.left+t-this._scrollLeft,d;this._primarySelection.isEmpty()?(this._linesVisibleRanges&&(h+=this._linesVisibleRanges.left),d=0):d=r.width-t;const u=new DOMRect(h,a,d,c);this._editContext.updateSelectionBounds(u),this._editContext.updateControlBounds(u)}_updateCharacterBounds(e){const t=this._context.configuration.options,i=t.get(59).typicalHalfwidthCharacterWidth,n=t.get(165).contentLeft,s=this._parentBounds,r=[],a=new l.PositionOffsetTransformer(this._editContext.text);for(let c=e.rangeStart;c<e.rangeEnd;c++){const h=a.getPosition(c),d=this._editContextPrimarySelection.startLineNumber-1,u=new l.Position(d+h.lineNumber,h.column),f=u.delta(0,1),g=l.Range.fromPositions(u,f),m=this._context.viewModel.coordinatesConverter.convertModelRangeToViewRange(g),p=this._visibleRangeProvider.linesVisibleRangesForRange(m,!0)??[],b=m.startLineNumber,v=this._context.viewLayout.getVerticalOffsetForLineNumber(b),C=s.top+v-this._scrollTop;let w=0,S=i;if(p.length>0)for(const D of p[0].ranges){w=D.left,S=D.width;break}const L=this._context.viewLayout.getLineHeightForLineNumber(b);r.push(new DOMRect(s.left+n+w-this._scrollLeft,C,S,L))}this._editContext.updateCharacterBounds(e.rangeStart,r)}};ym=a5([RT(5,me),RT(6,ei)],ym);class l5 extends gi{constructor(e,t){super(e),this._viewGpuContext=t,this._gpuShapes=[],this._register(he(i=>this._updateEntries(i)))}onConfigurationChanged(e){return this._updateEntries(void 0),!0}prepareRender(e){}render(e){}_updateEntries(e){const t=this._context.configuration.options,i=t.get(116),n=t.get(59).typicalHalfwidthCharacterWidth,s=this._viewGpuContext.devicePixelRatio.read(e);for(let r=0,a=i.length;r<a;r++){const c=i[r],h=this._gpuShapes[r],d=c.color?l.Color.fromHex(c.color):this._context.theme.getColor(s$)??l.Color.white,u=[c.column*n*s,0,Math.max(1,Math.ceil(s)),Number.MAX_SAFE_INTEGER,d.rgba.r/255,d.rgba.g/255,d.rgba.b/255,d.rgba.a];h?h.setRaw(u):this._gpuShapes[r]=this._viewGpuContext.rectangleRenderer.register(...u)}for(;this._gpuShapes.length>i.length;)this._gpuShapes.splice(-1,1)[0].dispose()}}const sb=class sb extends hr{constructor(e,t){super(),this._viewGpuContext=t,this._context=e,this._renderResult=null,this._context.addEventHandler(this)}dispose(){this._context.removeEventHandler(this),this._renderResult=null,super.dispose()}onConfigurationChanged(e){return!0}onCursorStateChanged(e){return!0}onFlushed(e){return!0}onLinesChanged(e){return!0}onLinesDeleted(e){return!0}onLinesInserted(e){return!0}onScrollChanged(e){return e.scrollTopChanged}onZonesChanged(e){return!0}onDecorationsChanged(e){return!0}prepareRender(e){const t=e.visibleRange.startLineNumber,i=e.visibleRange.endLineNumber,n=e.viewportData,s=new mm(this._context.configuration,this._context.theme.type),r=[];for(let a=t;a<=i;a++){const c=a-t,h=this._viewGpuContext.canRenderDetailed(s,n,a);r[c]=h.length?`<div class="${sb.CLASS_NAME}" title="Cannot render on GPU: ${h.join(", ")}"></div>`:""}this._renderResult=r}render(e,t){if(!this._renderResult)return"";const i=t-e;return i<0||i>=this._renderResult.length?"":this._renderResult[i]}};sb.CLASS_NAME="gpu-mark";let uw=sb;const Na=le("userInteractionService");var c5=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},MT=function(o,e){return function(t,i){e(t,i,o)}};let fw=class extends ma{constructor(e,t,i,n,s,r,a,c,h,d){super(),this._instantiationService=h,this._userInteractionService=d,this._editContextClipboardListeners=new l.DisposableStore,this._onWillCopy=this._register(new l.Emitter),this.onWillCopy=this._onWillCopy.event,this._onWillCut=this._register(new l.Emitter),this.onWillCut=this._onWillCut.event,this._onWillPaste=this._register(new l.Emitter),this.onWillPaste=this._onWillPaste.event,this._shouldRecomputeGlyphMarginLanes=!1,this._ownerID=t,this._widgetFocusTracker=this._register(new h5(e,c,this._userInteractionService)),this._register(this._widgetFocusTracker.onChange(()=>{this._context.viewModel.setHasWidgetFocus(this._widgetFocusTracker.hasFocus())})),this._selections=[new l.Selection(1,1,1,1)],this._renderAnimationFrame=null,this._overflowGuardContainer=we(document.createElement("div")),Jn.write(this._overflowGuardContainer,3),this._overflowGuardContainer.setClassName("overflow-guard"),this._viewController=new dm(n,r,a,i),this._context=new f4(n,s,r),this._context.addEventHandler(this),this._viewParts=[],this._editContextEnabled=this._context.configuration.options.get(170),this._accessibilitySupport=this._context.configuration.options.get(2),this._editContext=this._instantiateEditContext(),this._connectEditContextClipboardEvents(),this._viewParts.push(this._editContext),this._linesContent=we(document.createElement("div")),this._linesContent.setClassName("lines-content monaco-editor-background"),this._linesContent.setPosition("absolute"),this.domNode=we(document.createElement("div")),this.domNode.setClassName(this._getEditorClassName()),this.domNode.setAttribute("role","code"),this._context.configuration.options.get(46)==="on"&&(this._viewGpuContext=this._instantiationService.createInstance(_.ViewGpuContext,this._context)),this._scrollbar=new R$(this._context,this._linesContent,this.domNode,this._overflowGuardContainer),this._viewParts.push(this._scrollbar),this._viewLines=new Yv(this._context,this._viewGpuContext,this._linesContent),this._viewGpuContext&&(this._viewLinesGpu=this._instantiationService.createInstance(iw,this._context,this._viewGpuContext)),this._viewZones=new l4(this._context),this._viewParts.push(this._viewZones);const u=new H$(this._context);this._viewParts.push(u);const f=new n4(this._context);this._viewParts.push(f);const g=new AU(this._context);this._viewParts.push(g),g.addDynamicOverlay(new I$(this._context)),g.addDynamicOverlay(new Qv(this._context)),g.addDynamicOverlay(new z$(this._context)),g.addDynamicOverlay(new N$(this._context)),g.addDynamicOverlay(new h4(this._context));const m=new OU(this._context);this._viewParts.push(m),m.addDynamicOverlay(new T$(this._context)),m.addDynamicOverlay(new G$(this._context)),m.addDynamicOverlay(new K$(this._context)),m.addDynamicOverlay(new gm(this._context)),this._viewGpuContext&&m.addDynamicOverlay(new uw(this._context,this._viewGpuContext)),this._glyphMarginWidgets=new O$(this._context),this._viewParts.push(this._glyphMarginWidgets);const p=new pm(this._context);p.getDomNode().appendChild(this._viewZones.marginDomNode),p.getDomNode().appendChild(m.getDomNode()),p.getDomNode().appendChild(this._glyphMarginWidgets.domNode),this._viewParts.push(p),this._contentWidgets=new kU(this._context,this.domNode),this._viewParts.push(this._contentWidgets),this._viewCursors=new Xv(this._context),this._viewParts.push(this._viewCursors),this._overlayWidgets=new J$(this._context,this.domNode),this._viewParts.push(this._overlayWidgets);const b=this._viewGpuContext?new l5(this._context,this._viewGpuContext):new i4(this._context);this._viewParts.push(b);const v=new PU(this._context);this._viewParts.push(v);const C=new X$(this._context);if(this._viewParts.push(C),u){const w=this._scrollbar.getOverviewRulerLayoutInfo();w.parent.insertBefore(u.getDomNode(),w.insertBefore)}this._linesContent.appendChild(g.getDomNode()),"domNode"in b&&this._linesContent.appendChild(b.domNode),this._linesContent.appendChild(this._viewZones.domNode),this._linesContent.appendChild(this._viewLines.getDomNode()),this._linesContent.appendChild(this._contentWidgets.domNode),this._linesContent.appendChild(this._viewCursors.getDomNode()),this._overflowGuardContainer.appendChild(p.getDomNode()),this._overflowGuardContainer.appendChild(this._scrollbar.getDomNode()),this._viewGpuContext&&this._overflowGuardContainer.appendChild(this._viewGpuContext.canvas),this._overflowGuardContainer.appendChild(f.getDomNode()),this._overflowGuardContainer.appendChild(this._overlayWidgets.getDomNode()),this._overflowGuardContainer.appendChild(C.getDomNode()),this._overflowGuardContainer.appendChild(v.domNode),this.domNode.appendChild(this._overflowGuardContainer),c?(c.appendChild(this._contentWidgets.overflowingContentWidgetsDomNode.domNode),c.appendChild(this._overlayWidgets.overflowingOverlayWidgetsDomNode.domNode)):(this.domNode.appendChild(this._contentWidgets.overflowingContentWidgetsDomNode),this.domNode.appendChild(this._overlayWidgets.overflowingOverlayWidgetsDomNode)),this._applyLayout(),this._pointerHandler=this._register(new W3(this._context,this._viewController,this._createPointerHandlerHelper()))}_instantiateEditContext(){return this._context.configuration.options.get(170)?this._instantiationService.createInstance(ym,this._ownerID,this._context,this._overflowGuardContainer,this._viewController,this._createTextAreaHandlerHelper()):this._instantiationService.createInstance(ow,this._ownerID,this._context,this._overflowGuardContainer,this._viewController,this._createTextAreaHandlerHelper())}_updateEditContext(){const e=this._context.configuration.options.get(170),t=this._context.configuration.options.get(2);if(this._editContextEnabled===e&&this._accessibilitySupport===t)return;this._editContextEnabled=e,this._accessibilitySupport=t;const i=this._editContext.isFocused(),n=this._viewParts.indexOf(this._editContext);this._editContext.dispose(),this._editContext=this._instantiateEditContext(),this._connectEditContextClipboardEvents(),i&&this._editContext.focus(),n!==-1&&this._viewParts.splice(n,1,this._editContext)}_connectEditContextClipboardEvents(){this._editContextClipboardListeners.clear(),this._editContextClipboardListeners.add(this._editContext.onWillCopy(e=>this._onWillCopy.fire(e))),this._editContextClipboardListeners.add(this._editContext.onWillCut(e=>this._onWillCut.fire(e))),this._editContextClipboardListeners.add(this._editContext.onWillPaste(e=>this._onWillPaste.fire(e)))}_computeGlyphMarginLanes(){const e=this._context.viewModel.model,t=this._context.viewModel.glyphLanes;let i=[],n=0;i=i.concat(e.getAllMarginDecorations().map(s=>{const r=s.options.glyphMargin?.position??l.GlyphMarginLane.Center;return n=Math.max(n,s.range.endLineNumber),{range:s.range,lane:r,persist:s.options.glyphMargin?.persistLane}})),i=i.concat(this._glyphMarginWidgets.getWidgets().map(s=>{const r=e.validateRange(s.preference.range);return n=Math.max(n,r.endLineNumber),{range:r,lane:s.preference.lane}})),i.sort((s,r)=>l.Range.compareRangesUsingStarts(s.range,r.range)),t.reset(n);for(const s of i)t.push(s.lane,s.range,s.persist);return t}_createPointerHandlerHelper(){return{viewDomNode:this.domNode.domNode,linesContentDomNode:this._linesContent.domNode,viewLinesDomNode:this._viewLines.getDomNode().domNode,viewLinesGpu:this._viewLinesGpu,focusTextArea:()=>{this.focus()},dispatchTextAreaEvent:e=>{this._editContext.domNode.domNode.dispatchEvent(e)},getLastRenderData:()=>{const e=this._viewCursors.getLastRenderData()||[],t=this._editContext.getLastRenderData();return new m3(e,t)},renderNow:()=>{this.render(!0,!1)},shouldSuppressMouseDownOnViewZone:e=>this._viewZones.shouldSuppressMouseDownOnViewZone(e),shouldSuppressMouseDownOnWidget:e=>this._contentWidgets.shouldSuppressMouseDownOnWidget(e),getPositionFromDOMInfo:(e,t)=>(this._flushAccumulatedAndRenderNow(),this._viewLines.getPositionFromDOMInfo(e,t)),visibleRangeForPosition:(e,t)=>{this._flushAccumulatedAndRenderNow();const i=new l.Position(e,t);return this._viewLines.visibleRangeForPosition(i)??this._viewLinesGpu?.visibleRangeForPosition(i)??null},getLineWidth:e=>{if(this._flushAccumulatedAndRenderNow(),this._viewLinesGpu){const t=this._viewLinesGpu.getLineWidth(e);if(t!==void 0)return t}return this._viewLines.getLineWidth(e)}}}_createTextAreaHandlerHelper(){return{visibleRangeForPosition:e=>(this._flushAccumulatedAndRenderNow(),this._viewLines.visibleRangeForPosition(e)),linesVisibleRangesForRange:(e,t)=>(this._flushAccumulatedAndRenderNow(),this._viewLines.linesVisibleRangesForRange(e,t))}}_applyLayout(){const t=this._context.configuration.options.get(165);this.domNode.setWidth(t.width),this.domNode.setHeight(t.height),this._overflowGuardContainer.setWidth(t.width),this._overflowGuardContainer.setHeight(t.height),this._linesContent.setWidth(16777216),this._linesContent.setHeight(16777216)}_getEditorClassName(){const e=this._editContext.isFocused()?" focused":"";return this._context.configuration.options.get(162)+" "+Uv(this._context.theme.type)+e}handleEvents(e){super.handleEvents(e),this._scheduleRender()}onConfigurationChanged(e){return this.domNode.setClassName(this._getEditorClassName()),this._updateEditContext(),this._applyLayout(),!1}onCursorStateChanged(e){return this._selections=e.selections,!1}onDecorationsChanged(e){return e.affectsGlyphMargin&&(this._shouldRecomputeGlyphMarginLanes=!0),!1}onFocusChanged(e){return this.domNode.setClassName(this._getEditorClassName()),!1}onThemeChanged(e){return this._context.theme.update(e.theme),this.domNode.setClassName(this._getEditorClassName()),!1}dispose(){this._renderAnimationFrame!==null&&(this._renderAnimationFrame.dispose(),this._renderAnimationFrame=null),this._editContextClipboardListeners.dispose(),this._contentWidgets.overflowingContentWidgetsDomNode.domNode.remove(),this._overlayWidgets.overflowingOverlayWidgetsDomNode.domNode.remove(),this._context.removeEventHandler(this),this._viewGpuContext?.dispose(),this._viewLines.dispose(),this._viewLinesGpu?.dispose();for(const e of this._viewParts)e.dispose();super.dispose()}_scheduleRender(){if(this._store.isDisposed)throw new l.BugIndicatingError;if(this._renderAnimationFrame===null){this._editContext instanceof ym&&this._editContext.setEditContextOnDomNode();const e=this._createCoordinatedRendering();this._renderAnimationFrame=gw.INSTANCE.scheduleCoordinatedRendering({window:j(this.domNode?.domNode),prepareRenderText:()=>{if(this._store.isDisposed)throw new l.BugIndicatingError;try{return e.prepareRenderText()}finally{this._renderAnimationFrame=null}},renderText:t=>{if(this._store.isDisposed)throw new l.BugIndicatingError;return e.renderText(t)},prepareRender:(t,i)=>{if(this._store.isDisposed)throw new l.BugIndicatingError;return e.prepareRender(t,i)},render:(t,i)=>{if(this._store.isDisposed)throw new l.BugIndicatingError;return e.render(t,i)}})}}_flushAccumulatedAndRenderNow(){const e=this._createCoordinatedRendering(),t=ur(()=>e.prepareRenderText());if(!t)return;const i=ur(()=>e.renderText(t));if(!i)return;const[n,s]=i;ur(()=>e.prepareRender(n,s)),ur(()=>e.render(n,s))}_getViewPartsToRender(){const e=[];let t=0;for(const i of this._viewParts)i.shouldRender()&&(e[t++]=i);return e}_createCoordinatedRendering(){return{prepareRenderText:()=>{if(this._shouldRecomputeGlyphMarginLanes){this._shouldRecomputeGlyphMarginLanes=!1;const s=this._computeGlyphMarginLanes();this._context.configuration.setGlyphMarginDecorationLaneCount(s.requiredLanes)}if(_n.onRenderStart(),!this.domNode.domNode.isConnected)return null;const e=this._getViewPartsToRender();if(!this._viewLines.shouldRender()&&e.length===0)return null;const i=this._context.viewLayout.getLinesViewportData();this._context.viewModel.setViewport(i.startLineNumber,i.endLineNumber,i.centeredLineNumber);const n=new d4(this._selections,i,this._context.viewLayout.getWhitespaceViewportData(),this._context.viewModel);for(const s of this._viewParts)s.shouldRender()&&s.onBeforeRender(n);return n},renderText:e=>(this._viewLines.shouldRender()&&(this._viewLines.renderText(e),this._viewLines.onDidRender()),this._viewLinesGpu?.shouldRender()&&(this._viewLinesGpu.renderText(e),this._viewLinesGpu.onDidRender()),[this._getViewPartsToRender(),new h3(this._context.viewLayout,e,this._viewLines,this._viewLinesGpu)]),prepareRender:(e,t)=>{for(const i of e)i.prepareRender(t)},render:(e,t)=>{for(const i of e)i.render(t),i.onDidRender()}}}delegateVerticalScrollbarPointerDown(e){this._scrollbar.delegateVerticalScrollbarPointerDown(e)}delegateScrollFromMouseWheelEvent(e){this._scrollbar.delegateScrollFromMouseWheelEvent(e)}restoreState(e){this._context.viewModel.viewLayout.setScrollPosition({scrollTop:e.scrollTop,scrollLeft:e.scrollLeft},1),this._context.viewModel.visibleLinesStabilized()}getOffsetForColumn(e,t){const i=this._context.viewModel.model.validatePosition({lineNumber:e,column:t}),n=this._context.viewModel.coordinatesConverter.convertModelPositionToViewPosition(i);this._flushAccumulatedAndRenderNow();const s=this._viewLines.visibleRangeForPosition(new l.Position(n.lineNumber,n.column));return s?s.left:-1}getLineWidth(e){const t=this._context.viewModel.model,i=this._context.viewModel.coordinatesConverter.convertModelPositionToViewPosition(new l.Position(e,t.getLineMaxColumn(e))).lineNumber;return this._flushAccumulatedAndRenderNow(),this._viewLines.getLineWidth(i)}resetLineWidthCaches(){this._viewLines.resetLineWidthCaches()}getTargetAtClientPoint(e,t){const i=this._pointerHandler.getTargetAtClientPoint(e,t);return i?um.convertViewToModelMouseTarget(i,this._context.viewModel.coordinatesConverter):null}createOverviewRuler(e){return new t4(this._context,e)}change(e){this._viewZones.changeViewZones(e),this._scheduleRender()}render(e,t){if(t){this._viewLines.forceShouldRender();for(const i of this._viewParts)i.forceShouldRender()}e?this._flushAccumulatedAndRenderNow():this._scheduleRender()}writeScreenReaderContent(e){this._editContext.writeScreenReaderContent(e)}focus(){this._editContext.focus()}isFocused(){return this._editContext.isFocused()}isWidgetFocused(){return this._widgetFocusTracker.hasFocus()}setAriaOptions(e){this._editContext.setAriaOptions(e)}addContentWidget(e){this._contentWidgets.addWidget(e.widget),this.layoutContentWidget(e),this._scheduleRender()}layoutContentWidget(e){this._contentWidgets.setWidgetPosition(e.widget,e.position?.position??null,e.position?.secondaryPosition??null,e.position?.preference??null,e.position?.positionAffinity??null),this._contentWidgets.shouldRender()&&this._scheduleRender()}removeContentWidget(e){this._contentWidgets.removeWidget(e.widget),this._scheduleRender()}addOverlayWidget(e){this._overlayWidgets.addWidget(e.widget),this.layoutOverlayWidget(e),this._scheduleRender()}layoutOverlayWidget(e){this._overlayWidgets.setWidgetPosition(e.widget,e.position)&&this._scheduleRender()}removeOverlayWidget(e){this._overlayWidgets.removeWidget(e.widget),this._scheduleRender()}addGlyphMarginWidget(e){this._glyphMarginWidgets.addWidget(e.widget),this._shouldRecomputeGlyphMarginLanes=!0,this._scheduleRender()}layoutGlyphMarginWidget(e){const t=e.position;this._glyphMarginWidgets.setWidgetPosition(e.widget,t)&&(this._shouldRecomputeGlyphMarginLanes=!0,this._scheduleRender())}removeGlyphMarginWidget(e){this._glyphMarginWidgets.removeWidget(e.widget),this._shouldRecomputeGlyphMarginLanes=!0,this._scheduleRender()}};fw=c5([MT(8,me),MT(9,Na)],fw);function ur(o){try{return o()}catch(e){return l.onUnexpectedError(e),null}}const ob=class ob{constructor(){this._coordinatedRenderings=[],this._animationFrameRunners=new Map}scheduleCoordinatedRendering(e){return this._coordinatedRenderings.push(e),this._scheduleRender(e.window),{dispose:()=>{const t=this._coordinatedRenderings.indexOf(e);if(t!==-1&&(this._coordinatedRenderings.splice(t,1),this._coordinatedRenderings.length===0)){for(const[i,n]of this._animationFrameRunners)n.dispose();this._animationFrameRunners.clear()}}}}_scheduleRender(e){if(!this._animationFrameRunners.has(e)){const t=()=>{this._animationFrameRunners.delete(e),this._onRenderScheduled()};this._animationFrameRunners.set(e,_.runAtThisOrScheduleAtNextAnimationFrame(e,t,100))}}_onRenderScheduled(){const e=this._coordinatedRenderings.slice(0);this._coordinatedRenderings=[];const t=[];for(let n=0,s=e.length;n<s;n++){const r=e[n];t[n]=ur(()=>r.prepareRenderText())}const i=[];for(let n=0,s=e.length;n<s;n++){const r=e[n],a=t[n];if(!a){i[n]=null;continue}i[n]=ur(()=>r.renderText(a))}for(let n=0,s=e.length;n<s;n++){const r=e[n],a=i[n];if(!a)continue;const[c,h]=a;ur(()=>r.prepareRender(c,h))}for(let n=0,s=e.length;n<s;n++){const r=e[n],a=i[n];if(!a)continue;const[c,h]=a;ur(()=>r.render(c,h))}}};ob.INSTANCE=new ob;let gw=ob;class h5 extends l.Disposable{constructor(e,t,i){super(),this._onChange=this._register(new l.Emitter),this.onChange=this._onChange.event,this._hadFocus=void 0,this._hasDomElementFocus=!1,this._domFocusTracker=this._register(i.createDomFocusTracker(e)),this._overflowWidgetsDomNodeHasFocus=!1,this._register(this._domFocusTracker.onDidFocus(()=>{this._hasDomElementFocus=!0,this._update()})),this._register(this._domFocusTracker.onDidBlur(()=>{this._hasDomElementFocus=!1,this._update()})),t&&(this._overflowWidgetsDomNode=this._register(i.createDomFocusTracker(t)),this._register(this._overflowWidgetsDomNode.onDidFocus(()=>{this._overflowWidgetsDomNodeHasFocus=!0,this._update()})),this._register(this._overflowWidgetsDomNode.onDidBlur(()=>{this._overflowWidgetsDomNodeHasFocus=!1,this._update()})))}_update(){const e=this._hasDomElementFocus||this._overflowWidgetsDomNodeHasFocus;this._hadFocus!==e&&(this._hadFocus=e,this._onChange.fire(void 0))}hasFocus(){return this._hadFocus??!1}}class eu{constructor(e,t,i,n,s){this.injectionOffsets=e,this.injectionOptions=t,this.breakOffsets=i,this.breakOffsetsVisibleColumn=n,this.wrappedTextIndentLength=s}getOutputLineCount(){return this.breakOffsets.length}getMinOutputOffset(e){return e>0?this.wrappedTextIndentLength:0}getLineLength(e){const t=e>0?this.breakOffsets[e-1]:0;let n=this.breakOffsets[e]-t;return e>0&&(n+=this.wrappedTextIndentLength),n}getMaxOutputOffset(e){return this.getLineLength(e)}translateToInputOffset(e,t){e>0&&(t=Math.max(0,t-this.wrappedTextIndentLength));let n=e===0?t:this.breakOffsets[e-1]+t;if(this.injectionOffsets!==null)for(let s=0;s<this.injectionOffsets.length&&n>this.injectionOffsets[s];s++)n<this.injectionOffsets[s]+this.injectionOptions[s].content.length?n=this.injectionOffsets[s]:n-=this.injectionOptions[s].content.length;return n}translateToOutputPosition(e,t=2){let i=e;if(this.injectionOffsets!==null)for(let n=0;n<this.injectionOffsets.length&&!(e<this.injectionOffsets[n]||t!==1&&e===this.injectionOffsets[n]);n++)i+=this.injectionOptions[n].content.length;return this.offsetInInputWithInjectionsToOutputPosition(i,t)}offsetInInputWithInjectionsToOutputPosition(e,t=2){let i=0,n=this.breakOffsets.length-1,s=0,r=0;for(;i<=n;){s=i+(n-i)/2|0;const c=this.breakOffsets[s];if(r=s>0?this.breakOffsets[s-1]:0,t===0)if(e<=r)n=s-1;else if(e>c)i=s+1;else break;else if(e<r)n=s-1;else if(e>=c)i=s+1;else break}let a=e-r;return s>0&&(a+=this.wrappedTextIndentLength),new Lm(s,a)}normalizeOutputPosition(e,t,i){if(this.injectionOffsets!==null){const n=this.outputPositionToOffsetInInputWithInjections(e,t),s=this.normalizeOffsetInInputWithInjectionsAroundInjections(n,i);if(s!==n)return this.offsetInInputWithInjectionsToOutputPosition(s,i)}if(i===0){if(e>0&&t===this.getMinOutputOffset(e))return new Lm(e-1,this.getMaxOutputOffset(e-1))}else if(i===1){const n=this.getOutputLineCount()-1;if(e<n&&t===this.getMaxOutputOffset(e))return new Lm(e+1,this.getMinOutputOffset(e+1))}return new Lm(e,t)}outputPositionToOffsetInInputWithInjections(e,t){return e>0&&(t=Math.max(0,t-this.wrappedTextIndentLength)),(e>0?this.breakOffsets[e-1]:0)+t}normalizeOffsetInInputWithInjectionsAroundInjections(e,t){const i=this.getInjectedTextAtOffset(e);if(!i)return e;if(t===2){if(e===i.offsetInInputWithInjections+i.length&&AT(this.injectionOptions[i.injectedTextIndex].cursorStops))return i.offsetInInputWithInjections+i.length;{let n=i.offsetInInputWithInjections;if(OT(this.injectionOptions[i.injectedTextIndex].cursorStops))return n;let s=i.injectedTextIndex-1;for(;s>=0&&this.injectionOffsets[s]===this.injectionOffsets[i.injectedTextIndex]&&!(AT(this.injectionOptions[s].cursorStops)||(n-=this.injectionOptions[s].content.length,OT(this.injectionOptions[s].cursorStops)));)s--;return n}}else if(t===1||t===4){let n=i.offsetInInputWithInjections+i.length,s=i.injectedTextIndex;for(;s+1<this.injectionOffsets.length&&this.injectionOffsets[s+1]===this.injectionOffsets[s];)n+=this.injectionOptions[s+1].content.length,s++;return n}else if(t===0||t===3){let n=i.offsetInInputWithInjections,s=i.injectedTextIndex;for(;s-1>=0&&this.injectionOffsets[s-1]===this.injectionOffsets[s];)n-=this.injectionOptions[s-1].content.length,s--;return n}l.assertNever()}getInjectedText(e,t){const i=this.outputPositionToOffsetInInputWithInjections(e,t),n=this.getInjectedTextAtOffset(i);return n?{options:this.injectionOptions[n.injectedTextIndex]}:null}getInjectedTextAtOffset(e){const t=this.injectionOffsets,i=this.injectionOptions;if(t!==null){let n=0;for(let s=0;s<t.length;s++){const r=i[s].content.length,a=t[s]+n,c=t[s]+n+r;if(a>e)break;if(e<=c)return{injectedTextIndex:s,offsetInInputWithInjections:a,length:r};n+=r}}}}function AT(o){return o==null?!0:o===l.InjectedTextCursorStops.Right||o===l.InjectedTextCursorStops.Both}function OT(o){return o==null?!0:o===l.InjectedTextCursorStops.Left||o===l.InjectedTextCursorStops.Both}class Lm{constructor(e,t){this.outputLineIndex=e,this.outputOffset=t}toString(){return`${this.outputLineIndex}:${this.outputOffset}`}toPosition(e){return new l.Position(e+this.outputLineIndex,this.outputOffset+1)}}class d5{constructor(){this.changeType=1}}class mo{static applyInjectedText(e,t){if(!t||t.length===0)return e;let i="",n=0;for(const s of t)i+=e.substring(n,s.column-1),n=s.column-1,i+=s.options.content;return i+=e.substring(n),i}static fromDecorations(e){const t=[];for(const i of e)i.options.before&&i.options.before.content.length>0&&t.push(new mo(i.ownerId,i.range.startLineNumber,i.range.startColumn,i.options.before,0)),i.options.after&&i.options.after.content.length>0&&t.push(new mo(i.ownerId,i.range.endLineNumber,i.range.endColumn,i.options.after,1));return t.sort((i,n)=>i.lineNumber===n.lineNumber?i.column===n.column?i.order-n.order:i.column-n.column:i.lineNumber-n.lineNumber),t}constructor(e,t,i,n,s){this.ownerId=e,this.lineNumber=t,this.column=i,this.options=n,this.order=s}}class PT{constructor(e,t){this.changeType=2,this.lineNumber=e,this.lineNumberPostEdit=t}}class u5{constructor(e,t,i,n){this.ownerId=e,this.decorationId=t,this.lineNumber=i,this.lineHeightMultiplier=n}}class f5{constructor(e,t){this.ownerId=e,this.lineNumber=t}}class g5{constructor(e,t,i){this.changeType=3,this.fromLineNumber=e,this.toLineNumber=t,this.lastUntouchedLinePostEdit=i}}class m5{get toLineNumber(){return this.fromLineNumber+this.count-1}get toLineNumberPostEdit(){return this.fromLineNumberPostEdit+this.count-1}constructor(e,t,i){this.changeType=4,this.fromLineNumber=e,this.fromLineNumberPostEdit=t,this.count=i}}class p5{constructor(){this.changeType=5}}class Dc{constructor(e,t,i,n){this.changes=e,this.versionId=t,this.isUndoing=i,this.isRedoing=n,this.resultingSelection=null}containsEvent(e){for(let t=0,i=this.changes.length;t<i;t++)if(this.changes[t].changeType===e)return!0;return!1}static merge(e,t){const i=[].concat(e.changes).concat(t.changes),n=t.versionId,s=e.isUndoing||t.isUndoing,r=e.isRedoing||t.isRedoing;return new Dc(i,n,s,r)}}class kT{constructor(e){this.changes=e}}let FT=class{constructor(e){this.changes=e}},BT=class{constructor(e){this.changes=e}};class Ra{constructor(e,t){this.rawContentChangedEvent=e,this.contentChangedEvent=t}merge(e){const t=Dc.merge(this.rawContentChangedEvent,e.rawContentChangedEvent),i=Ra._mergeChangeEvents(this.contentChangedEvent,e.contentChangedEvent);return new Ra(t,i)}static _mergeChangeEvents(e,t){const i=[].concat(e.changes).concat(t.changes),n=t.eol,s=t.versionId,r=e.isUndoing||t.isUndoing,a=e.isRedoing||t.isRedoing,c=e.isFlush||t.isFlush,h=e.isEolChange&&t.isEolChange;return{changes:i,eol:n,isEolChange:h,versionId:s,isUndoing:r,isRedoing:a,isFlush:c,detailedReasons:e.detailedReasons.concat(t.detailedReasons),detailedReasonsChangeLengths:e.detailedReasonsChangeLengths.concat(t.detailedReasonsChangeLengths)}}}const _5=lo("domLineBreaksComputer",{createHTML:o=>o});class mw{static create(e){return new mw(new WeakRef(e))}constructor(e){this.targetWindow=e}createLineBreaksComputer(e,t,i,n,s,r,a){const c=[];return{addRequest:(h,d)=>{c.push(h)},finalize:()=>b5(l.assertReturnsDefined(this.targetWindow.deref()),e,c,t,i,n,s,r)}}}function b5(o,e,t,i,n,s,r,a){function c(T){const M=e.getLineInjectedText(T);if(M){const O=e.getLineContent(T),P=mo.applyInjectedText(O,M),k=M.map(B=>B.options),U=M.map(B=>B.column-1);return new eu(U,k,[P.length],[],0)}else return null}if(s===-1){const T=[];for(let M=0,O=t.length;M<O;M++)T[M]=c(t[M]);return T}const h=Math.round(s*i.typicalHalfwidthCharacterWidth),u=Math.round(n*(r===3?2:r===2?1:0)),f=Math.ceil(i.spaceWidth*u),g=document.createElement("div");Ot(g,i);const m=new ra(1e4),p=[],b=[],v=[],C=[],w=[];for(let T=0;T<t.length;T++){const M=t[T],O=mo.applyInjectedText(e.getLineContent(M),e.getLineInjectedText(M));let P=0,k=0,U=h;if(r!==0)if(P=l.firstNonWhitespaceIndex(O),P===-1)P=0;else{for(let re=0;re<P;re++){const Y=O.charCodeAt(re)===9?n-k%n:1;k+=Y}const X=Math.ceil(i.spaceWidth*k);X+i.typicalFullwidthCharacterWidth>h?(P=0,k=0):U=h-X}const B=O.substr(P),G=C5(B,k,n,U,m,f);p[T]=P,b[T]=k,v[T]=B,C[T]=G[0],w[T]=G[1]}const S=m.build(),L=_5?.createHTML(S)??S;g.innerHTML=L,g.style.position="absolute",g.style.top="10000px",a==="keepAll"?(g.style.wordBreak="keep-all",g.style.overflowWrap="anywhere"):(g.style.wordBreak="inherit",g.style.overflowWrap="break-word"),o.document.body.appendChild(g);const D=document.createRange(),x=Array.prototype.slice.call(g.children,0),I=[];for(let T=0;T<t.length;T++){const M=t[T],O=x[T],P=v5(D,O,v[T],C[T]);if(P===null){I[T]=c(M);continue}const k=p[T],U=b[T]+u,B=w[T],G=[];for(let ee=0,Ee=P.length;ee<Ee;ee++)G[ee]=B[P[ee]];if(k!==0)for(let ee=0,Ee=P.length;ee<Ee;ee++)P[ee]+=k;let X,re;const Y=e.getLineInjectedText(M);Y?(X=Y.map(ee=>ee.options),re=Y.map(ee=>ee.column-1)):(X=null,re=null),I[T]=new eu(re,X,P,G,U)}return g.remove(),I}function C5(o,e,t,i,n,s){if(s!==0){const f=String(s);n.appendString('<div style="text-indent: -'),n.appendString(f),n.appendString("px; padding-left: "),n.appendString(f),n.appendString("px; box-sizing: border-box; width:")}else n.appendString('<div style="width:');n.appendString(String(i)),n.appendString('px;">');const r=o.length;let a=e,c=0;const h=[],d=[];let u=0<r?o.charCodeAt(0):0;n.appendString("<span>");for(let f=0;f<r;f++){f!==0&&f%16384===0&&n.appendString("</span><span>"),h[f]=c,d[f]=a;const g=u;u=f+1<r?o.charCodeAt(f+1):0;let m=1,p=1;switch(g){case 9:m=t-a%t,p=m;for(let b=1;b<=m;b++)b<m?n.appendCharCode(160):n.appendASCIICharCode(32);break;case 32:u===32?n.appendCharCode(160):n.appendASCIICharCode(32);break;case 60:n.appendString("<");break;case 62:n.appendString(">");break;case 38:n.appendString("&");break;case 0:n.appendString("�");break;case 65279:case 8232:case 8233:case 133:n.appendCharCode(65533);break;default:l.isFullWidthCharacter(g)&&p++,g<32?n.appendCharCode(9216+g):n.appendCharCode(g)}c+=m,a+=p}return n.appendString("</span>"),h[o.length]=c,d[o.length]=a,n.appendString("</div>"),[h,d]}function v5(o,e,t,i){if(t.length<=1)return null;const n=Array.prototype.slice.call(e.children,0),s=[];try{pw(o,n,i,0,null,t.length-1,null,s)}catch(r){return console.error(r),null}return s.length===0?null:(s.push(t.length),s)}function pw(o,e,t,i,n,s,r,a){if(i===s||(n=n||_w(o,e,t[i],t[i+1]),r=r||_w(o,e,t[s],t[s+1]),Math.abs(n[0].top-r[0].top)<=.1))return;if(i+1===s){a.push(s);return}const c=i+(s-i)/2|0,h=_w(o,e,t[c],t[c+1]);pw(o,e,t,i,n,c,h,a),pw(o,e,t,c,h,s,r,a)}function _w(o,e,t,i){return o.setStart(e[t/16384|0].firstChild,t%16384),o.setEnd(e[i/16384|0].firstChild,i%16384),o.getClientRects()}class w5 extends l.Disposable{constructor(){super(),this._editor=null,this._instantiationService=null,this._instances=this._register(new l.DisposableMap),this._pending=new Map,this._finishedInstantiation=[],this._finishedInstantiation[0]=!1,this._finishedInstantiation[1]=!1,this._finishedInstantiation[2]=!1,this._finishedInstantiation[3]=!1}initialize(e,t,i){this._editor=e,this._instantiationService=i;for(const n of t){if(this._pending.has(n.id)){l.onUnexpectedError(new Error(`Cannot have two contributions with the same id ${n.id}`));continue}this._pending.set(n.id,n)}this._instantiateSome(0),this._register(nd(j(this._editor.getDomNode()),()=>{this._instantiateSome(1)})),this._register(nd(j(this._editor.getDomNode()),()=>{this._instantiateSome(2)})),this._register(nd(j(this._editor.getDomNode()),()=>{this._instantiateSome(3)},5e3))}saveViewState(){const e={};for(const[t,i]of this._instances)typeof i.saveViewState=="function"&&(e[t]=i.saveViewState());return e}restoreViewState(e){for(const[t,i]of this._instances)typeof i.restoreViewState=="function"&&i.restoreViewState(e[t])}get(e){return this._instantiateById(e),this._instances.get(e)||null}onBeforeInteractionEvent(){this._instantiateSome(2)}onAfterModelAttached(){return nd(j(this._editor?.getDomNode()),()=>{this._instantiateSome(1)},50)}_instantiateSome(e){if(this._finishedInstantiation[e])return;this._finishedInstantiation[e]=!0;const t=this._findPendingContributionsByInstantiation(e);for(const i of t)this._instantiateById(i.id)}_findPendingContributionsByInstantiation(e){const t=[];for(const[,i]of this._pending)i.instantiation===e&&t.push(i);return t}_instantiateById(e){const t=this._pending.get(e);if(t){if(this._pending.delete(e),!this._instantiationService||!this._editor)throw new Error("Cannot instantiate contributions before being initialized!");try{const i=this._instantiationService.createInstance(t.ctor,this._editor);this._instances.set(t.id,i),typeof i.restoreViewState=="function"&&t.instantiation!==0&&console.warn(`Editor contribution '${t.id}' should be eager instantiated because it uses saveViewState / restoreViewState.`)}catch(i){l.onUnexpectedError(i)}}}}class zT{constructor(e,t,i,n,s,r,a){this.id=e,this.label=t,this.alias=i,this.metadata=n,this._precondition=s,this._run=r,this._contextKeyService=a}isSupported(){return this._contextKeyService.contextMatchesRules(this._precondition)}run(e){return this.isSupported()?this._run(e):Promise.resolve(void 0)}}var VT;function S5(o,e){const t=new Map;for(const i of o){const n=e(i);let s=t.get(n);s||(s=[],t.set(n,s)),s.push(i)}return t}function y5(o,e){const t=[],i=[];for(const n of o)e.has(n)||t.push(n);for(const n of e)o.has(n)||i.push(n);return{removed:t,added:i}}function UT(o,e){const t=new Set;for(const i of e)o.has(i)&&t.add(i);return t}class $T{constructor(e,t){this.toKey=t,this._map=new Map,this[VT]="SetWithKey";for(const i of e)this.add(i)}get size(){return this._map.size}add(e){const t=this.toKey(e);return this._map.set(t,e),this}delete(e){return this._map.delete(this.toKey(e))}has(e){return this._map.has(this.toKey(e))}*entries(){for(const e of this._map.values())yield[e,e]}keys(){return this.values()}*values(){for(const e of this._map.values())yield e}clear(){this._map.clear()}forEach(e,t){this._map.forEach(i=>e.call(t,i,i,this))}[Symbol.iterator](){return this.values()}}VT=Symbol.toStringTag;const bw=le("undoRedoService");class KT{constructor(e,t){this.resource=e,this.elements=t}}const Ah=class Ah{constructor(){this.id=Ah._ID++,this.order=1}nextOrder(){return this.id===0?0:this.order++}};Ah._ID=0,Ah.None=new Ah;let Cw=Ah;const Oh=class Oh{constructor(){this.id=Oh._ID++,this.order=1}nextOrder(){return this.id===0?0:this.order++}};Oh._ID=0,Oh.None=new Oh;let Ma=Oh;function fr(o){let e=0,t=0,i=0,n=0;for(let s=0,r=o.length;s<r;s++){const a=o.charCodeAt(s);a===13?(e===0&&(t=s),e++,s+1<r&&o.charCodeAt(s+1)===10?(n|=2,s++):n|=3,i=s+1):a===10&&(n|=1,e===0&&(t=s),e++,i=s+1)}return e===0&&(t=o.length),[e,t,o.length-i,n]}const L5=Symbol("TextModelEditSource");class GT{constructor(e,t){this.metadata=e}toString(){return`${this.metadata.source}`}getType(){const e=this.metadata;switch(e.source){case"cursor":return e.kind;case"inlineCompletionAccept":return e.source+(e.$nes?":nes":"");case"unknown":return e.name||"unknown";default:return e.source}}toKey(e,t={}){const i=this.metadata;return Object.entries(i).filter(([s,r])=>{const a=t[s];return a!==void 0?a:(s.match(/\$/g)||[]).length<=e&&r!==void 0&&r!==null&&r!==""}).map(([s,r])=>`${s}:${r}`).join("-")}}function Ai(o){return new GT(o,L5)}const $i={unknown(o){return Ai({source:"unknown",name:o.name})},rename:(o,e)=>Ai({source:"rename",$$$oldName:o,$$$newName:e}),chatApplyEdits(o){return Ai({source:"Chat.applyEdits",$modelId:jT(o.modelId),$extensionId:o.extensionId?.extensionId,$extensionVersion:o.extensionId?.version,$$languageId:o.languageId,$$sessionId:o.sessionId,$$requestId:o.requestId,$$mode:o.mode,$$codeBlockSuggestionId:o.codeBlockSuggestionId})},chatUndoEdits:()=>Ai({source:"Chat.undoEdits"}),chatReset:()=>Ai({source:"Chat.reset"}),inlineCompletionAccept(o){return Ai({source:"inlineCompletionAccept",$nes:o.nes,...Dm(o.providerId),$$correlationId:o.correlationId,$$requestUuid:o.requestUuid,$$languageId:o.languageId})},inlineCompletionPartialAccept(o){return Ai({source:"inlineCompletionPartialAccept",type:o.type,$nes:o.nes,...Dm(o.providerId),$$correlationId:o.correlationId,$$requestUuid:o.requestUuid,$$languageId:o.languageId})},inlineChatApplyEdit(o){return Ai({source:"inlineChat.applyEdits",$modelId:jT(o.modelId),$extensionId:o.extensionId?.extensionId,$extensionVersion:o.extensionId?.version,$$sessionId:o.sessionId,$$requestId:o.requestId,$$languageId:o.languageId})},reloadFromDisk:()=>Ai({source:"reloadFromDisk"}),cursor(o){return Ai({source:"cursor",kind:o.kind,detailedSource:o.detailedSource})},setValue:()=>Ai({source:"setValue"}),eolChange:()=>Ai({source:"eolChange"}),applyEdits:()=>Ai({source:"applyEdits"}),snippet:()=>Ai({source:"snippet"}),suggest:o=>Ai({source:"suggest",...Dm(o.providerId)}),codeAction:o=>Ai({source:"codeAction",$kind:o.kind,...Dm(o.providerId)})};function Dm(o){return o?{$extensionId:o.extensionId,$extensionVersion:o.extensionVersion,$providerId:o.providerId}:{}}function jT(o){if(o!==void 0)return o.replaceAll("/","|")}class tu{static fromText(e){const t=l.TextLength.ofText(e).lineCount,i=e.length;return new tu(t,0,i,0)}static tryCreate(e,t,i,n){if(!(e===void 0||t===void 0||i===void 0||n===void 0))return new tu(e,t,i,n)}constructor(e,t,i,n){this.linesAdded=e,this.linesRemoved=t,this.charsAdded=i,this.charsRemoved=n}}var qT;(function(o){function e(t){const i=t?t("sgt"):mI("sgt");return i}o.newId=e})(qT||(qT={}));function LH(o){return o}class YT{constructor(e,t,i,n){this.range=e,this.nestingLevel=t,this.nestingLevelOfEqualBracketType=i,this.isInvalid=n}}class D5{constructor(e,t,i,n,s,r){this.range=e,this.openingBracketRange=t,this.closingBracketRange=i,this.nestingLevel=n,this.nestingLevelOfEqualBracketType=s,this.bracketPairNode=r}get openingBracketInfo(){return this.bracketPairNode.openingBracket.bracketInfo}}class x5 extends D5{constructor(e,t,i,n,s,r,a){super(e,t,i,n,s,r),this.minVisibleColumnIndentation=a}}function E5(o,e,t,i){return o!==t?ht(t-o,i):ht(0,i-e)}const bi=0;function xm(o){return o===0}const en=2**26;function ht(o,e){return o*en+e}function Ln(o){const e=o,t=Math.floor(e/en),i=e-t*en;return new l.TextLength(t,i)}function I5(o){return Math.floor(o/en)}function T5(o){return o}function gt(o,e){let t=o+e;return e>=en&&(t=t-o%en),t}function N5(o,e){return o.reduce((t,i)=>gt(t,e(i)),bi)}function ZT(o,e){return o===e}function iu(o,e){const t=o,i=e;if(i-t<=0)return bi;const s=Math.floor(t/en),r=Math.floor(i/en),a=i-r*en;if(s===r){const c=t-s*en;return ht(0,a-c)}else return ht(r-s,a)}function xc(o,e){return o<e}function Ec(o,e){return o<=e}function nu(o,e){return o>=e}function Ic(o){return ht(o.lineNumber-1,o.column-1)}function Aa(o,e){const t=o,i=Math.floor(t/en),n=t-i*en,s=e,r=Math.floor(s/en),a=s-r*en;return new l.Range(i+1,n+1,r+1,a+1)}function R5(o){const e=l.splitLines(o);return ht(e.length-1,e[e.length-1].length)}class po{static fromModelContentChanges(e){return e.map(i=>{const n=l.Range.lift(i.range);return new po(Ic(n.getStartPosition()),Ic(n.getEndPosition()),R5(i.text))}).reverse()}constructor(e,t,i){this.startOffset=e,this.endOffset=t,this.newLength=i}toString(){return`[${Ln(this.startOffset)}...${Ln(this.endOffset)}) -> ${Ln(this.newLength)}`}}class M5{constructor(e){this.nextEditIdx=0,this.deltaOldToNewLineCount=0,this.deltaOldToNewColumnCount=0,this.deltaLineIdxInOld=-1,this.edits=e.map(t=>vw.from(t))}getOffsetBeforeChange(e){return this.adjustNextEdit(e),this.translateCurToOld(e)}getDistanceToNextChange(e){this.adjustNextEdit(e);const t=this.edits[this.nextEditIdx],i=t?this.translateOldToCur(t.offsetObj):null;return i===null?null:iu(e,i)}translateOldToCur(e){return e.lineCount===this.deltaLineIdxInOld?ht(e.lineCount+this.deltaOldToNewLineCount,e.columnCount+this.deltaOldToNewColumnCount):ht(e.lineCount+this.deltaOldToNewLineCount,e.columnCount)}translateCurToOld(e){const t=Ln(e);return t.lineCount-this.deltaOldToNewLineCount===this.deltaLineIdxInOld?ht(t.lineCount-this.deltaOldToNewLineCount,t.columnCount-this.deltaOldToNewColumnCount):ht(t.lineCount-this.deltaOldToNewLineCount,t.columnCount)}adjustNextEdit(e){for(;this.nextEditIdx<this.edits.length;){const t=this.edits[this.nextEditIdx],i=this.translateOldToCur(t.endOffsetAfterObj);if(Ec(i,e)){this.nextEditIdx++;const n=Ln(i),s=Ln(this.translateOldToCur(t.endOffsetBeforeObj)),r=n.lineCount-s.lineCount;this.deltaOldToNewLineCount+=r;const a=this.deltaLineIdxInOld===t.endOffsetBeforeObj.lineCount?this.deltaOldToNewColumnCount:0,c=n.columnCount-s.columnCount;this.deltaOldToNewColumnCount=a+c,this.deltaLineIdxInOld=t.endOffsetBeforeObj.lineCount}else break}}}class vw{static from(e){return new vw(e.startOffset,e.endOffset,e.newLength)}constructor(e,t,i){this.endOffsetBeforeObj=Ln(t),this.endOffsetAfterObj=Ln(gt(e,i)),this.offsetObj=Ln(e)}}const Em=[],Nn=class Nn{static create(e,t){if(e<=128&&t.length===0){let i=Nn.cache[e];return i||(i=new Nn(e,t),Nn.cache[e]=i),i}return new Nn(e,t)}static getEmpty(){return this.empty}constructor(e,t){this.items=e,this.additionalItems=t}add(e,t){const i=t.getKey(e);let n=i>>5;if(n===0){const r=1<<i|this.items;return r===this.items?this:Nn.create(r,this.additionalItems)}n--;const s=this.additionalItems.slice(0);for(;s.length<n;)s.push(0);return s[n]|=1<<(i&31),Nn.create(this.items,s)}merge(e){const t=this.items|e.items;if(this.additionalItems===Em&&e.additionalItems===Em)return t===this.items?this:t===e.items?e:Nn.create(t,Em);const i=[];for(let n=0;n<Math.max(this.additionalItems.length,e.additionalItems.length);n++){const s=this.additionalItems[n]||0,r=e.additionalItems[n]||0;i.push(s|r)}return Nn.create(t,i)}intersects(e){if((this.items&e.items)!==0)return!0;for(let t=0;t<Math.min(this.additionalItems.length,e.additionalItems.length);t++)if((this.additionalItems[t]&e.additionalItems[t])!==0)return!0;return!1}};Nn.cache=new Array(129),Nn.empty=Nn.create(0,Em);let Ki=Nn;const QT={getKey(o){return o}};class XT{constructor(){this.items=new Map}getKey(e){let t=this.items.get(e);return t===void 0&&(t=this.items.size,this.items.set(e,t)),t}}class ww{get length(){return this._length}constructor(e){this._length=e}}class su extends ww{static create(e,t,i){let n=e.length;return t&&(n=gt(n,t.length)),i&&(n=gt(n,i.length)),new su(n,e,t,i,t?t.missingOpeningBracketIds:Ki.getEmpty())}get kind(){return 2}get listHeight(){return 0}get childrenLength(){return 3}getChild(e){switch(e){case 0:return this.openingBracket;case 1:return this.child;case 2:return this.closingBracket}throw new Error("Invalid child index")}get children(){const e=[];return e.push(this.openingBracket),this.child&&e.push(this.child),this.closingBracket&&e.push(this.closingBracket),e}constructor(e,t,i,n,s){super(e),this.openingBracket=t,this.child=i,this.closingBracket=n,this.missingOpeningBracketIds=s}canBeReused(e){return!(this.closingBracket===null||e.intersects(this.missingOpeningBracketIds))}deepClone(){return new su(this.length,this.openingBracket.deepClone(),this.child&&this.child.deepClone(),this.closingBracket&&this.closingBracket.deepClone(),this.missingOpeningBracketIds)}computeMinIndentation(e,t){return this.child?this.child.computeMinIndentation(gt(e,this.openingBracket.length),t):Number.MAX_SAFE_INTEGER}}class ys extends ww{static create23(e,t,i,n=!1){let s=e.length,r=e.missingOpeningBracketIds;if(e.listHeight!==t.listHeight)throw new Error("Invalid list heights");if(s=gt(s,t.length),r=r.merge(t.missingOpeningBracketIds),i){if(e.listHeight!==i.listHeight)throw new Error("Invalid list heights");s=gt(s,i.length),r=r.merge(i.missingOpeningBracketIds)}return n?new A5(s,e.listHeight+1,e,t,i,r):new ou(s,e.listHeight+1,e,t,i,r)}static getEmpty(){return new O5(bi,0,[],Ki.getEmpty())}get kind(){return 4}get missingOpeningBracketIds(){return this._missingOpeningBracketIds}constructor(e,t,i){super(e),this.listHeight=t,this._missingOpeningBracketIds=i,this.cachedMinIndentation=-1}throwIfImmutable(){}makeLastElementMutable(){this.throwIfImmutable();const e=this.childrenLength;if(e===0)return;const t=this.getChild(e-1),i=t.kind===4?t.toMutable():t;return t!==i&&this.setChild(e-1,i),i}makeFirstElementMutable(){if(this.throwIfImmutable(),this.childrenLength===0)return;const t=this.getChild(0),i=t.kind===4?t.toMutable():t;return t!==i&&this.setChild(0,i),i}canBeReused(e){if(e.intersects(this.missingOpeningBracketIds)||this.childrenLength===0)return!1;let t=this;for(;t.kind===4;){const i=t.childrenLength;if(i===0)throw new l.BugIndicatingError;t=t.getChild(i-1)}return t.canBeReused(e)}handleChildrenChanged(){this.throwIfImmutable();const e=this.childrenLength;let t=this.getChild(0).length,i=this.getChild(0).missingOpeningBracketIds;for(let n=1;n<e;n++){const s=this.getChild(n);t=gt(t,s.length),i=i.merge(s.missingOpeningBracketIds)}this._length=t,this._missingOpeningBracketIds=i,this.cachedMinIndentation=-1}computeMinIndentation(e,t){if(this.cachedMinIndentation!==-1)return this.cachedMinIndentation;let i=Number.MAX_SAFE_INTEGER,n=e;for(let s=0;s<this.childrenLength;s++){const r=this.getChild(s);r&&(i=Math.min(i,r.computeMinIndentation(n,t)),n=gt(n,r.length))}return this.cachedMinIndentation=i,i}}class ou extends ys{get childrenLength(){return this._item3!==null?3:2}getChild(e){switch(e){case 0:return this._item1;case 1:return this._item2;case 2:return this._item3}throw new Error("Invalid child index")}setChild(e,t){switch(e){case 0:this._item1=t;return;case 1:this._item2=t;return;case 2:this._item3=t;return}throw new Error("Invalid child index")}get children(){return this._item3?[this._item1,this._item2,this._item3]:[this._item1,this._item2]}get item1(){return this._item1}get item2(){return this._item2}get item3(){return this._item3}constructor(e,t,i,n,s,r){super(e,t,r),this._item1=i,this._item2=n,this._item3=s}deepClone(){return new ou(this.length,this.listHeight,this._item1.deepClone(),this._item2.deepClone(),this._item3?this._item3.deepClone():null,this.missingOpeningBracketIds)}appendChildOfSameHeight(e){if(this._item3)throw new Error("Cannot append to a full (2,3) tree node");this.throwIfImmutable(),this._item3=e,this.handleChildrenChanged()}unappendChild(){if(!this._item3)throw new Error("Cannot remove from a non-full (2,3) tree node");this.throwIfImmutable();const e=this._item3;return this._item3=null,this.handleChildrenChanged(),e}prependChildOfSameHeight(e){if(this._item3)throw new Error("Cannot prepend to a full (2,3) tree node");this.throwIfImmutable(),this._item3=this._item2,this._item2=this._item1,this._item1=e,this.handleChildrenChanged()}unprependChild(){if(!this._item3)throw new Error("Cannot remove from a non-full (2,3) tree node");this.throwIfImmutable();const e=this._item1;return this._item1=this._item2,this._item2=this._item3,this._item3=null,this.handleChildrenChanged(),e}toMutable(){return this}}class A5 extends ou{toMutable(){return new ou(this.length,this.listHeight,this.item1,this.item2,this.item3,this.missingOpeningBracketIds)}throwIfImmutable(){throw new Error("this instance is immutable")}}class Im extends ys{get childrenLength(){return this._children.length}getChild(e){return this._children[e]}setChild(e,t){this._children[e]=t}get children(){return this._children}constructor(e,t,i,n){super(e,t,n),this._children=i}deepClone(){const e=new Array(this._children.length);for(let t=0;t<this._children.length;t++)e[t]=this._children[t].deepClone();return new Im(this.length,this.listHeight,e,this.missingOpeningBracketIds)}appendChildOfSameHeight(e){this.throwIfImmutable(),this._children.push(e),this.handleChildrenChanged()}unappendChild(){this.throwIfImmutable();const e=this._children.pop();return this.handleChildrenChanged(),e}prependChildOfSameHeight(e){this.throwIfImmutable(),this._children.unshift(e),this.handleChildrenChanged()}unprependChild(){this.throwIfImmutable();const e=this._children.shift();return this.handleChildrenChanged(),e}toMutable(){return this}}class O5 extends Im{toMutable(){return new Im(this.length,this.listHeight,[...this.children],this.missingOpeningBracketIds)}throwIfImmutable(){throw new Error("this instance is immutable")}}const P5=[];class Sw extends ww{get listHeight(){return 0}get childrenLength(){return 0}getChild(e){return null}get children(){return P5}deepClone(){return this}}class Oa extends Sw{get kind(){return 0}get missingOpeningBracketIds(){return Ki.getEmpty()}canBeReused(e){return!0}computeMinIndentation(e,t){const i=Ln(e),n=(i.columnCount===0?i.lineCount:i.lineCount+1)+1,s=I5(gt(e,this.length))+1;let r=Number.MAX_SAFE_INTEGER;for(let a=n;a<=s;a++){const c=t.getLineFirstNonWhitespaceColumn(a),h=t.getLineContent(a);if(c===0)continue;const d=Xe.visibleColumnFromColumn(h,c,t.getOptions().tabSize);r=Math.min(r,d)}return r}}class Tm extends Sw{static create(e,t,i){return new Tm(e,t,i)}get kind(){return 1}get missingOpeningBracketIds(){return Ki.getEmpty()}constructor(e,t,i){super(e),this.bracketInfo=t,this.bracketIds=i}get text(){return this.bracketInfo.bracketText}get languageId(){return this.bracketInfo.languageId}canBeReused(e){return!1}computeMinIndentation(e,t){return Number.MAX_SAFE_INTEGER}}class k5 extends Sw{get kind(){return 3}constructor(e,t){super(t),this.missingOpeningBracketIds=e}canBeReused(e){return!e.intersects(this.missingOpeningBracketIds)}computeMinIndentation(e,t){return Number.MAX_SAFE_INTEGER}}let gr=class{constructor(e,t,i,n,s){this.length=e,this.kind=t,this.bracketId=i,this.bracketIds=n,this.astNode=s}};class JT{constructor(e,t){this.textModel=e,this.bracketTokens=t,this.reader=new F5(this.textModel,this.bracketTokens),this._offset=bi,this.didPeek=!1,this.peeked=null,this.textBufferLineCount=e.getLineCount(),this.textBufferLastLineLength=e.getLineLength(this.textBufferLineCount)}get offset(){return this._offset}get length(){return ht(this.textBufferLineCount-1,this.textBufferLastLineLength)}skip(e){this.didPeek=!1,this._offset=gt(this._offset,e);const t=Ln(this._offset);this.reader.setPosition(t.lineCount,t.columnCount)}read(){let e;return this.peeked?(this.didPeek=!1,e=this.peeked):e=this.reader.read(),e&&(this._offset=gt(this._offset,e.length)),e}peek(){return this.didPeek||(this.peeked=this.reader.read(),this.didPeek=!0),this.peeked}}class F5{constructor(e,t){this.textModel=e,this.bracketTokens=t,this.lineIdx=0,this.line=null,this.lineCharOffset=0,this.lineTokens=null,this.lineTokenOffset=0,this.peekedToken=null,this.textBufferLineCount=e.getLineCount(),this.textBufferLastLineLength=e.getLineLength(this.textBufferLineCount)}setPosition(e,t){e===this.lineIdx?(this.lineCharOffset=t,this.line!==null&&(this.lineTokenOffset=this.lineCharOffset===0?0:this.lineTokens.findTokenIndexAtOffset(this.lineCharOffset))):(this.lineIdx=e,this.lineCharOffset=t,this.line=null),this.peekedToken=null}read(){if(this.peekedToken){const s=this.peekedToken;return this.peekedToken=null,this.lineCharOffset+=s.length,s}if(this.lineIdx>this.textBufferLineCount-1||this.lineIdx===this.textBufferLineCount-1&&this.lineCharOffset>=this.textBufferLastLineLength)return null;this.line===null&&(this.lineTokens=this.textModel.tokenization.getLineTokens(this.lineIdx+1),this.line=this.lineTokens.getLineContent(),this.lineTokenOffset=this.lineCharOffset===0?0:this.lineTokens.findTokenIndexAtOffset(this.lineCharOffset));const e=this.lineIdx,t=this.lineCharOffset;let i=0;for(;;){const s=this.lineTokens,r=s.getCount();let a=null;if(this.lineTokenOffset<r){const c=s.getMetadata(this.lineTokenOffset);for(;this.lineTokenOffset+1<r&&c===s.getMetadata(this.lineTokenOffset+1);)this.lineTokenOffset++;const h=Vi.getTokenType(c)===0,d=Vi.containsBalancedBrackets(c),u=s.getEndOffset(this.lineTokenOffset);if(d&&h&&this.lineCharOffset<u){const f=s.getLanguageId(this.lineTokenOffset),g=this.line.substring(this.lineCharOffset,u),m=this.bracketTokens.getSingleLanguageBracketTokens(f),p=m.regExpGlobal;if(p){p.lastIndex=0;const b=p.exec(g);b&&(a=m.getToken(b[0]),a&&(this.lineCharOffset+=b.index))}}if(i+=u-this.lineCharOffset,a)if(e!==this.lineIdx||t!==this.lineCharOffset){this.peekedToken=a;break}else return this.lineCharOffset+=a.length,a;else this.lineTokenOffset++,this.lineCharOffset=u}else if(this.lineIdx===this.textBufferLineCount-1||(this.lineIdx++,this.lineTokens=this.textModel.tokenization.getLineTokens(this.lineIdx+1),this.lineTokenOffset=0,this.line=this.lineTokens.getLineContent(),this.lineCharOffset=0,i+=33,i>1e3))break;if(i>1500)break}const n=E5(e,t,this.lineIdx,this.lineCharOffset);return new gr(n,0,-1,Ki.getEmpty(),new Oa(n))}}class B5{constructor(e,t){this.text=e,this._offset=bi,this.idx=0;const i=t.getRegExpStr(),n=i?new RegExp(i+`|
|
||
`,"gi"):null,s=[];let r,a=0,c=0,h=0,d=0;const u=[];for(let m=0;m<60;m++)u.push(new gr(ht(0,m),0,-1,Ki.getEmpty(),new Oa(ht(0,m))));const f=[];for(let m=0;m<60;m++)f.push(new gr(ht(1,m),0,-1,Ki.getEmpty(),new Oa(ht(1,m))));if(n)for(n.lastIndex=0;(r=n.exec(e))!==null;){const m=r.index,p=r[0];if(p===`
|
||
`)a++,c=m+1;else{if(h!==m){let b;if(d===a){const v=m-h;if(v<u.length)b=u[v];else{const C=ht(0,v);b=new gr(C,0,-1,Ki.getEmpty(),new Oa(C))}}else{const v=a-d,C=m-c;if(v===1&&C<f.length)b=f[C];else{const w=ht(v,C);b=new gr(w,0,-1,Ki.getEmpty(),new Oa(w))}}s.push(b)}s.push(t.getToken(p)),h=m+p.length,d=a}}const g=e.length;if(h!==g){const m=d===a?ht(0,g-h):ht(a-d,g-c);s.push(new gr(m,0,-1,Ki.getEmpty(),new Oa(m)))}this.length=ht(a,g-c),this.tokens=s}get offset(){return this._offset}read(){return this.tokens[this.idx++]||null}peek(){return this.tokens[this.idx]||null}skip(e){throw new l.NotSupportedError}}class yw{static createFromLanguage(e,t){function i(s){return t.getKey(`${s.languageId}:::${s.bracketText}`)}const n=new Map;for(const s of e.bracketsNew.openingBrackets){const r=ht(0,s.bracketText.length),a=i(s),c=Ki.getEmpty().add(a,QT);n.set(s.bracketText,new gr(r,1,a,c,Tm.create(r,s,c)))}for(const s of e.bracketsNew.closingBrackets){const r=ht(0,s.bracketText.length);let a=Ki.getEmpty();const c=s.getOpeningBrackets();for(const h of c)a=a.add(i(h),QT);n.set(s.bracketText,new gr(r,2,i(c[0]),a,Tm.create(r,s,a)))}return new yw(n)}constructor(e){this.map=e,this.hasRegExp=!1,this._regExpGlobal=null}getRegExpStr(){if(this.isEmpty)return null;{const e=[...this.map.keys()];return e.sort(),e.reverse(),e.map(t=>z5(t)).join("|")}}get regExpGlobal(){if(!this.hasRegExp){const e=this.getRegExpStr();this._regExpGlobal=e?new RegExp(e,"gi"):null,this.hasRegExp=!0}return this._regExpGlobal}getToken(e){return this.map.get(e.toLowerCase())}findClosingTokenText(e){for(const[t,i]of this.map)if(i.kind===2&&i.bracketIds.intersects(e))return t}get isEmpty(){return this.map.size===0}}function z5(o){let e=l.escapeRegExpCharacters(o);return/^[\w ]+/.test(o)&&(e=`\\b${e}`),/[\w ]+$/.test(o)&&(e=`${e}\\b`),e}class WT{constructor(e,t){this.denseKeyProvider=e,this.getLanguageConfiguration=t,this.languageIdToBracketTokens=new Map}didLanguageChange(e){return this.languageIdToBracketTokens.has(e)}getSingleLanguageBracketTokens(e){let t=this.languageIdToBracketTokens.get(e);return t||(t=yw.createFromLanguage(this.getLanguageConfiguration(e),this.denseKeyProvider),this.languageIdToBracketTokens.set(e,t)),t}}function V5(o){if(o.length===0)return null;if(o.length===1)return o[0];let e=0;function t(){if(e>=o.length)return null;const r=e,a=o[r].listHeight;for(e++;e<o.length&&o[e].listHeight===a;)e++;return e-r>=2?HT(r===0&&e===o.length?o:o.slice(r,e),!1):o[r]}let i=t(),n=t();if(!n)return i;for(let r=t();r;r=t())e1(i,n)<=e1(n,r)?(i=Lw(i,n),n=r):n=Lw(n,r);return Lw(i,n)}function HT(o,e=!1){if(o.length===0)return null;if(o.length===1)return o[0];let t=o.length;for(;t>3;){const i=t>>1;for(let n=0;n<i;n++){const s=n<<1;o[n]=ys.create23(o[s],o[s+1],s+3===t?o[s+2]:null,e)}t=i}return ys.create23(o[0],o[1],t>=3?o[2]:null,e)}function e1(o,e){return Math.abs(o.listHeight-e.listHeight)}function Lw(o,e){return o.listHeight===e.listHeight?ys.create23(o,e,null,!1):o.listHeight>e.listHeight?U5(o,e):$5(e,o)}function U5(o,e){o=o.toMutable();let t=o;const i=[];let n;for(;;){if(e.listHeight===t.listHeight){n=e;break}if(t.kind!==4)throw new Error("unexpected");i.push(t),t=t.makeLastElementMutable()}for(let s=i.length-1;s>=0;s--){const r=i[s];n?r.childrenLength>=3?n=ys.create23(r.unappendChild(),n,null,!1):(r.appendChildOfSameHeight(n),n=void 0):r.handleChildrenChanged()}return n?ys.create23(o,n,null,!1):o}function $5(o,e){o=o.toMutable();let t=o;const i=[];for(;e.listHeight!==t.listHeight;){if(t.kind!==4)throw new Error("unexpected");i.push(t),t=t.makeFirstElementMutable()}let n=e;for(let s=i.length-1;s>=0;s--){const r=i[s];n?r.childrenLength>=3?n=ys.create23(n,r.unprependChild(),null,!1):(r.prependChildOfSameHeight(n),n=void 0):r.handleChildrenChanged()}return n?ys.create23(n,o,null,!1):o}class K5{constructor(e){this.lastOffset=bi,this.nextNodes=[e],this.offsets=[bi],this.idxs=[]}readLongestNodeAt(e,t){if(xc(e,this.lastOffset))throw new Error("Invalid offset");for(this.lastOffset=e;;){const i=ru(this.nextNodes);if(!i)return;const n=ru(this.offsets);if(xc(e,n))return;if(xc(n,e))if(gt(n,i.length)<=e)this.nextNodeAfterCurrent();else{const s=Dw(i);s!==-1?(this.nextNodes.push(i.getChild(s)),this.offsets.push(n),this.idxs.push(s)):this.nextNodeAfterCurrent()}else{if(t(i))return this.nextNodeAfterCurrent(),i;{const s=Dw(i);if(s===-1){this.nextNodeAfterCurrent();return}else this.nextNodes.push(i.getChild(s)),this.offsets.push(n),this.idxs.push(s)}}}}nextNodeAfterCurrent(){for(;;){const e=ru(this.offsets),t=ru(this.nextNodes);if(this.nextNodes.pop(),this.offsets.pop(),this.idxs.length===0)break;const i=ru(this.nextNodes),n=Dw(i,this.idxs[this.idxs.length-1]);if(n!==-1){this.nextNodes.push(i.getChild(n)),this.offsets.push(gt(e,t.length)),this.idxs[this.idxs.length-1]=n;break}else this.idxs.pop()}}}function Dw(o,e=-1){for(;;){if(e++,e>=o.childrenLength)return-1;if(o.getChild(e))return e}}function ru(o){return o.length>0?o[o.length-1]:void 0}function xw(o,e,t,i){return new G5(o,e,t,i).parseDocument()}class G5{constructor(e,t,i,n){if(this.tokenizer=e,this.createImmutableLists=n,this._itemsConstructed=0,this._itemsFromCache=0,i&&n)throw new Error("Not supported");this.oldNodeReader=i?new K5(i):void 0,this.positionMapper=new M5(t)}parseDocument(){this._itemsConstructed=0,this._itemsFromCache=0;let e=this.parseList(Ki.getEmpty(),0);return e||(e=ys.getEmpty()),e}parseList(e,t){const i=[];for(;;){let s=this.tryReadChildFromCache(e);if(!s){const r=this.tokenizer.peek();if(!r||r.kind===2&&r.bracketIds.intersects(e))break;s=this.parseChild(e,t+1)}s.kind===4&&s.childrenLength===0||i.push(s)}return this.oldNodeReader?V5(i):HT(i,this.createImmutableLists)}tryReadChildFromCache(e){if(this.oldNodeReader){const t=this.positionMapper.getDistanceToNextChange(this.tokenizer.offset);if(t===null||!xm(t)){const i=this.oldNodeReader.readLongestNodeAt(this.positionMapper.getOffsetBeforeChange(this.tokenizer.offset),n=>t!==null&&!xc(n.length,t)?!1:n.canBeReused(e));if(i)return this._itemsFromCache++,this.tokenizer.skip(i.length),i}}}parseChild(e,t){this._itemsConstructed++;const i=this.tokenizer.read();switch(i.kind){case 2:return new k5(i.bracketIds,i.length);case 0:return i.astNode;case 1:{if(t>300)return new Oa(i.length);const n=e.merge(i.bracketIds),s=this.parseList(n,t+1),r=this.tokenizer.peek();return r&&r.kind===2&&(r.bracketId===i.bracketId||r.bracketIds.intersects(i.bracketIds))?(this.tokenizer.read(),su.create(i.astNode,s,r.astNode)):su.create(i.astNode,s,null)}default:throw new Error("unexpected")}}}function Nm(o,e){if(o.length===0)return e;if(e.length===0)return o;const t=new l.ArrayQueue(t1(o)),i=t1(e);i.push({modified:!1,lengthBefore:void 0,lengthAfter:void 0});let n=t.dequeue();function s(h){if(h===void 0){const u=t.takeWhile(f=>!0)||[];return n&&u.unshift(n),u}const d=[];for(;n&&!xm(h);){const[u,f]=n.splitAt(h);d.push(u),h=iu(u.lengthAfter,h),n=f??t.dequeue()}return xm(h)||d.push(new mr(!1,h,h)),d}const r=[];function a(h,d,u){if(r.length>0&&ZT(r[r.length-1].endOffset,h)){const f=r[r.length-1];r[r.length-1]=new po(f.startOffset,d,gt(f.newLength,u))}else r.push({startOffset:h,endOffset:d,newLength:u})}let c=bi;for(const h of i){const d=s(h.lengthBefore);if(h.modified){const u=N5(d,g=>g.lengthBefore),f=gt(c,u);a(c,f,h.lengthAfter),c=f}else for(const u of d){const f=c;c=gt(c,u.lengthBefore),u.modified&&a(f,c,u.lengthAfter)}}return r}class mr{constructor(e,t,i){this.modified=e,this.lengthBefore=t,this.lengthAfter=i}splitAt(e){const t=iu(e,this.lengthAfter);return ZT(t,bi)?[this,void 0]:this.modified?[new mr(this.modified,this.lengthBefore,e),new mr(this.modified,bi,t)]:[new mr(this.modified,e,e),new mr(this.modified,t,t)]}toString(){return`${this.modified?"M":"U"}:${Ln(this.lengthBefore)} -> ${Ln(this.lengthAfter)}`}}function t1(o){const e=[];let t=bi;for(const i of o){const n=iu(t,i.startOffset);xm(n)||e.push(new mr(!1,n,n));const s=iu(i.startOffset,i.endOffset);e.push(new mr(!0,s,i.newLength)),t=i.endOffset}return e}class j5 extends l.Disposable{didLanguageChange(e){return this.brackets.didLanguageChange(e)}constructor(e,t){if(super(),this.textModel=e,this.getLanguageConfiguration=t,this.didChangeEmitter=this._register(new l.Emitter),this.denseKeyProvider=new XT,this.brackets=new WT(this.denseKeyProvider,this.getLanguageConfiguration),this.onDidChange=this.didChangeEmitter.event,this.queuedTextEditsForInitialAstWithoutTokens=[],this.queuedTextEdits=[],e.tokenization.hasTokens)e.tokenization.backgroundTokenizationState===2?(this.initialAstWithoutTokens=void 0,this.astWithTokens=this.parseDocumentFromTextBuffer([],void 0,!1)):(this.initialAstWithoutTokens=this.parseDocumentFromTextBuffer([],void 0,!0),this.astWithTokens=this.initialAstWithoutTokens);else{const i=this.brackets.getSingleLanguageBracketTokens(this.textModel.getLanguageId()),n=new B5(this.textModel.getValue(),i);this.initialAstWithoutTokens=xw(n,[],void 0,!0),this.astWithTokens=this.initialAstWithoutTokens}}handleDidChangeBackgroundTokenizationState(){if(this.textModel.tokenization.backgroundTokenizationState===2){const e=this.initialAstWithoutTokens===void 0;this.initialAstWithoutTokens=void 0,e||this.didChangeEmitter.fire()}}handleDidChangeTokens({ranges:e}){const t=e.map(i=>new po(ht(i.fromLineNumber-1,0),ht(i.toLineNumber,0),ht(i.toLineNumber-i.fromLineNumber+1,0)));this.handleEdits(t,!0),this.initialAstWithoutTokens||this.didChangeEmitter.fire()}handleContentChanged(e){const t=po.fromModelContentChanges(e.changes);this.handleEdits(t,!1)}handleEdits(e,t){const i=Nm(this.queuedTextEdits,e);this.queuedTextEdits=i,this.initialAstWithoutTokens&&!t&&(this.queuedTextEditsForInitialAstWithoutTokens=Nm(this.queuedTextEditsForInitialAstWithoutTokens,e))}flushQueue(){this.queuedTextEdits.length>0&&(this.astWithTokens=this.parseDocumentFromTextBuffer(this.queuedTextEdits,this.astWithTokens,!1),this.queuedTextEdits=[]),this.queuedTextEditsForInitialAstWithoutTokens.length>0&&(this.initialAstWithoutTokens&&(this.initialAstWithoutTokens=this.parseDocumentFromTextBuffer(this.queuedTextEditsForInitialAstWithoutTokens,this.initialAstWithoutTokens,!1)),this.queuedTextEditsForInitialAstWithoutTokens=[])}parseDocumentFromTextBuffer(e,t,i){const n=t,s=new JT(this.textModel,this.brackets);return xw(s,e,n,i)}getBracketsInRange(e,t){this.flushQueue();const i=ht(e.startLineNumber-1,e.startColumn-1),n=ht(e.endLineNumber-1,e.endColumn-1);return new l.CallbackIterable(s=>{const r=this.initialAstWithoutTokens||this.astWithTokens;Ew(r,bi,r.length,i,n,s,0,0,new Map,t)})}getBracketPairsInRange(e,t){this.flushQueue();const i=Ic(e.getStartPosition()),n=Ic(e.getEndPosition());return new l.CallbackIterable(s=>{const r=this.initialAstWithoutTokens||this.astWithTokens,a=new q5(s,t,this.textModel);Iw(r,bi,r.length,i,n,a,0,new Map)})}getFirstBracketAfter(e){this.flushQueue();const t=this.initialAstWithoutTokens||this.astWithTokens;return n1(t,bi,t.length,Ic(e))}getFirstBracketBefore(e){this.flushQueue();const t=this.initialAstWithoutTokens||this.astWithTokens;return i1(t,bi,t.length,Ic(e))}}function i1(o,e,t,i){if(o.kind===4||o.kind===2){const n=[];for(const s of o.children)t=gt(e,s.length),n.push({nodeOffsetStart:e,nodeOffsetEnd:t}),e=t;for(let s=n.length-1;s>=0;s--){const{nodeOffsetStart:r,nodeOffsetEnd:a}=n[s];if(xc(r,i)){const c=i1(o.children[s],r,a,i);if(c)return c}}return null}else{if(o.kind===3)return null;if(o.kind===1){const n=Aa(e,t);return{bracketInfo:o.bracketInfo,range:n}}}return null}function n1(o,e,t,i){if(o.kind===4||o.kind===2){for(const n of o.children){if(t=gt(e,n.length),xc(i,t)){const s=n1(n,e,t,i);if(s)return s}e=t}return null}else{if(o.kind===3)return null;if(o.kind===1){const n=Aa(e,t);return{bracketInfo:o.bracketInfo,range:n}}}return null}function Ew(o,e,t,i,n,s,r,a,c,h,d=!1){if(r>200)return!0;e:for(;;)switch(o.kind){case 4:{const u=o.childrenLength;for(let f=0;f<u;f++){const g=o.getChild(f);if(g){if(t=gt(e,g.length),Ec(e,n)&&nu(t,i)){if(nu(t,n)){o=g;continue e}if(!Ew(g,e,t,i,n,s,r,0,c,h))return!1}e=t}}return!0}case 2:{const u=!h||!o.closingBracket||o.closingBracket.bracketInfo.closesColorized(o.openingBracket.bracketInfo);let f=0;if(c){let m=c.get(o.openingBracket.text);m===void 0&&(m=0),f=m,u&&(m++,c.set(o.openingBracket.text,m))}const g=o.childrenLength;for(let m=0;m<g;m++){const p=o.getChild(m);if(p){if(t=gt(e,p.length),Ec(e,n)&&nu(t,i)){if(nu(t,n)&&p.kind!==1){o=p,u?(r++,a=f+1):a=f;continue e}if((u||p.kind!==1||!o.closingBracket)&&!Ew(p,e,t,i,n,s,u?r+1:r,u?f+1:f,c,h,!o.closingBracket))return!1}e=t}}return c?.set(o.openingBracket.text,f),!0}case 3:{const u=Aa(e,t);return s(new YT(u,r-1,0,!0))}case 1:{const u=Aa(e,t);return s(new YT(u,r-1,a-1,d))}case 0:return!0}}class q5{constructor(e,t,i){this.push=e,this.includeMinIndentation=t,this.textModel=i}}function Iw(o,e,t,i,n,s,r,a){if(r>200)return!0;let c=!0;if(o.kind===2){let h=0;if(a){let f=a.get(o.openingBracket.text);f===void 0&&(f=0),h=f,f++,a.set(o.openingBracket.text,f)}const d=gt(e,o.openingBracket.length);let u=-1;if(s.includeMinIndentation&&(u=o.computeMinIndentation(e,s.textModel)),c=s.push(new x5(Aa(e,t),Aa(e,d),o.closingBracket?Aa(gt(d,o.child?.length||bi),t):void 0,r,h,o,u)),e=d,c&&o.child){const f=o.child;if(t=gt(e,f.length),Ec(e,n)&&nu(t,i)&&(c=Iw(f,e,t,i,n,s,r+1,a),!c))return!1}a?.set(o.openingBracket.text,h)}else{let h=e;for(const d of o.children){const u=h;if(h=gt(h,d.length),Ec(u,n)&&Ec(i,h)&&(c=Iw(d,u,h,i,n,s,r,a),!c))return!1}}return c}class Y5 extends l.Disposable{get canBuildAST(){return this.textModel.getValueLength()<=5e6}constructor(e,t){super(),this.textModel=e,this.languageConfigurationService=t,this.bracketPairsTree=this._register(new l.MutableDisposable),this.onDidChangeEmitter=this._register(new l.Emitter),this.onDidChange=this.onDidChangeEmitter.event,this.bracketsRequested=!1}handleLanguageConfigurationServiceChange(e){(!e.languageId||this.bracketPairsTree.value?.object.didLanguageChange(e.languageId))&&(this.bracketPairsTree.clear(),this.updateBracketPairsTree())}handleDidChangeOptions(e){this.bracketPairsTree.clear(),this.updateBracketPairsTree()}handleDidChangeLanguage(e){this.bracketPairsTree.clear(),this.updateBracketPairsTree()}handleDidChangeContent(e){this.bracketPairsTree.value?.object.handleContentChanged(e)}handleDidChangeBackgroundTokenizationState(){this.bracketPairsTree.value?.object.handleDidChangeBackgroundTokenizationState()}handleDidChangeTokens(e){this.bracketPairsTree.value?.object.handleDidChangeTokens(e)}updateBracketPairsTree(){if(this.bracketsRequested&&this.canBuildAST){if(!this.bracketPairsTree.value){const e=new l.DisposableStore;this.bracketPairsTree.value=Z5(e.add(new j5(this.textModel,t=>this.languageConfigurationService.getLanguageConfiguration(t))),e),e.add(this.bracketPairsTree.value.object.onDidChange(t=>this.onDidChangeEmitter.fire(t))),this.onDidChangeEmitter.fire()}}else this.bracketPairsTree.value&&(this.bracketPairsTree.clear(),this.onDidChangeEmitter.fire())}getBracketPairsInRange(e){return this.bracketsRequested=!0,this.updateBracketPairsTree(),this.bracketPairsTree.value?.object.getBracketPairsInRange(e,!1)||l.CallbackIterable.empty}getBracketPairsInRangeWithMinIndentation(e){return this.bracketsRequested=!0,this.updateBracketPairsTree(),this.bracketPairsTree.value?.object.getBracketPairsInRange(e,!0)||l.CallbackIterable.empty}getBracketsInRange(e,t=!1){return this.bracketsRequested=!0,this.updateBracketPairsTree(),this.bracketPairsTree.value?.object.getBracketsInRange(e,t)||l.CallbackIterable.empty}findMatchingBracketUp(e,t,i){const n=this.textModel.validatePosition(t),s=this.textModel.getLanguageIdAtPosition(n.lineNumber,n.column);if(this.canBuildAST){const r=this.languageConfigurationService.getLanguageConfiguration(s).bracketsNew.getClosingBracketInfo(e);if(!r)return null;const a=this.getBracketPairsInRange(l.Range.fromPositions(t,t)).findLast(c=>r.closes(c.openingBracketInfo));return a?a.openingBracketRange:null}else{const r=e.toLowerCase(),a=this.languageConfigurationService.getLanguageConfiguration(s).brackets;if(!a)return null;const c=a.textIsBracket[r];return c?Rm(this._findMatchingBracketUp(c,n,Tw(i))):null}}matchBracket(e,t){if(this.canBuildAST){const i=this.getBracketPairsInRange(l.Range.fromPositions(e,e)).filter(n=>n.closingBracketRange!==void 0&&(n.openingBracketRange.containsPosition(e)||n.closingBracketRange.containsPosition(e))).findLastMaxBy(l.compareBy(n=>n.openingBracketRange.containsPosition(e)?n.openingBracketRange:n.closingBracketRange,l.Range.compareRangesUsingStarts));return i?[i.openingBracketRange,i.closingBracketRange]:null}else{const i=Tw(t);return this._matchBracket(this.textModel.validatePosition(e),i)}}_establishBracketSearchOffsets(e,t,i,n){const s=t.getCount(),r=t.getLanguageId(n);let a=Math.max(0,e.column-1-i.maxBracketLength);for(let h=n-1;h>=0;h--){const d=t.getEndOffset(h);if(d<=a)break;if(fs(t.getStandardTokenType(h))||t.getLanguageId(h)!==r){a=d;break}}let c=Math.min(t.getLineContent().length,e.column-1+i.maxBracketLength);for(let h=n+1;h<s;h++){const d=t.getStartOffset(h);if(d>=c)break;if(fs(t.getStandardTokenType(h))||t.getLanguageId(h)!==r){c=d;break}}return{searchStartOffset:a,searchEndOffset:c}}_matchBracket(e,t){const i=e.lineNumber,n=this.textModel.tokenization.getLineTokens(i),s=this.textModel.getLineContent(i),r=n.findTokenIndexAtOffset(e.column-1);if(r<0)return null;const a=this.languageConfigurationService.getLanguageConfiguration(n.getLanguageId(r)).brackets;if(a&&!fs(n.getStandardTokenType(r))){let{searchStartOffset:c,searchEndOffset:h}=this._establishBracketSearchOffsets(e,n,a,r),d=null;for(;;){const u=Pn.findNextBracketInRange(a.forwardRegex,i,s,c,h);if(!u)break;if(u.startColumn<=e.column&&e.column<=u.endColumn){const f=s.substring(u.startColumn-1,u.endColumn-1).toLowerCase(),g=this._matchFoundBracket(u,a.textIsBracket[f],a.textIsOpenBracket[f],t);if(g){if(g instanceof _o)return null;d=g}}c=u.endColumn-1}if(d)return d}if(r>0&&n.getStartOffset(r)===e.column-1){const c=r-1,h=this.languageConfigurationService.getLanguageConfiguration(n.getLanguageId(c)).brackets;if(h&&!fs(n.getStandardTokenType(c))){const{searchStartOffset:d,searchEndOffset:u}=this._establishBracketSearchOffsets(e,n,h,c),f=Pn.findPrevBracketInRange(h.reversedRegex,i,s,d,u);if(f&&f.startColumn<=e.column&&e.column<=f.endColumn){const g=s.substring(f.startColumn-1,f.endColumn-1).toLowerCase(),m=this._matchFoundBracket(f,h.textIsBracket[g],h.textIsOpenBracket[g],t);if(m)return m instanceof _o?null:m}}}return null}_matchFoundBracket(e,t,i,n){if(!t)return null;const s=i?this._findMatchingBracketDown(t,e.getEndPosition(),n):this._findMatchingBracketUp(t,e.getStartPosition(),n);return s?s instanceof _o?s:[e,s]:null}_findMatchingBracketUp(e,t,i){const n=e.languageId,s=e.reversedRegex;let r=-1,a=0;const c=(h,d,u,f)=>{for(;;){if(i&&++a%100===0&&!i())return _o.INSTANCE;const g=Pn.findPrevBracketInRange(s,h,d,u,f);if(!g)break;const m=d.substring(g.startColumn-1,g.endColumn-1).toLowerCase();if(e.isOpen(m)?r++:e.isClose(m)&&r--,r===0)return g;f=g.startColumn-1}return null};for(let h=t.lineNumber;h>=1;h--){const d=this.textModel.tokenization.getLineTokens(h),u=d.getCount(),f=this.textModel.getLineContent(h);let g=u-1,m=f.length,p=f.length;h===t.lineNumber&&(g=d.findTokenIndexAtOffset(t.column-1),m=t.column-1,p=t.column-1);let b=!0;for(;g>=0;g--){const v=d.getLanguageId(g)===n&&!fs(d.getStandardTokenType(g));if(v)b?m=d.getStartOffset(g):(m=d.getStartOffset(g),p=d.getEndOffset(g));else if(b&&m!==p){const C=c(h,f,m,p);if(C)return C}b=v}if(b&&m!==p){const v=c(h,f,m,p);if(v)return v}}return null}_findMatchingBracketDown(e,t,i){const n=e.languageId,s=e.forwardRegex;let r=1,a=0;const c=(d,u,f,g)=>{for(;;){if(i&&++a%100===0&&!i())return _o.INSTANCE;const m=Pn.findNextBracketInRange(s,d,u,f,g);if(!m)break;const p=u.substring(m.startColumn-1,m.endColumn-1).toLowerCase();if(e.isOpen(p)?r++:e.isClose(p)&&r--,r===0)return m;f=m.endColumn-1}return null},h=this.textModel.getLineCount();for(let d=t.lineNumber;d<=h;d++){const u=this.textModel.tokenization.getLineTokens(d),f=u.getCount(),g=this.textModel.getLineContent(d);let m=0,p=0,b=0;d===t.lineNumber&&(m=u.findTokenIndexAtOffset(t.column-1),p=t.column-1,b=t.column-1);let v=!0;for(;m<f;m++){const C=u.getLanguageId(m)===n&&!fs(u.getStandardTokenType(m));if(C)v||(p=u.getStartOffset(m)),b=u.getEndOffset(m);else if(v&&p!==b){const w=c(d,g,p,b);if(w)return w}v=C}if(v&&p!==b){const C=c(d,g,p,b);if(C)return C}}return null}findPrevBracket(e){const t=this.textModel.validatePosition(e);if(this.canBuildAST)return this.bracketsRequested=!0,this.updateBracketPairsTree(),this.bracketPairsTree.value?.object.getFirstBracketBefore(t)||null;let i=null,n=null,s=null;for(let r=t.lineNumber;r>=1;r--){const a=this.textModel.tokenization.getLineTokens(r),c=a.getCount(),h=this.textModel.getLineContent(r);let d=c-1,u=h.length,f=h.length;if(r===t.lineNumber){d=a.findTokenIndexAtOffset(t.column-1),u=t.column-1,f=t.column-1;const m=a.getLanguageId(d);i!==m&&(i=m,n=this.languageConfigurationService.getLanguageConfiguration(i).brackets,s=this.languageConfigurationService.getLanguageConfiguration(i).bracketsNew)}let g=!0;for(;d>=0;d--){const m=a.getLanguageId(d);if(i!==m){if(n&&s&&g&&u!==f){const b=Pn.findPrevBracketInRange(n.reversedRegex,r,h,u,f);if(b)return this._toFoundBracket(s,b);g=!1}i=m,n=this.languageConfigurationService.getLanguageConfiguration(i).brackets,s=this.languageConfigurationService.getLanguageConfiguration(i).bracketsNew}const p=!!n&&!fs(a.getStandardTokenType(d));if(p)g?u=a.getStartOffset(d):(u=a.getStartOffset(d),f=a.getEndOffset(d));else if(s&&n&&g&&u!==f){const b=Pn.findPrevBracketInRange(n.reversedRegex,r,h,u,f);if(b)return this._toFoundBracket(s,b)}g=p}if(s&&n&&g&&u!==f){const m=Pn.findPrevBracketInRange(n.reversedRegex,r,h,u,f);if(m)return this._toFoundBracket(s,m)}}return null}findNextBracket(e){const t=this.textModel.validatePosition(e);if(this.canBuildAST)return this.bracketsRequested=!0,this.updateBracketPairsTree(),this.bracketPairsTree.value?.object.getFirstBracketAfter(t)||null;const i=this.textModel.getLineCount();let n=null,s=null,r=null;for(let a=t.lineNumber;a<=i;a++){const c=this.textModel.tokenization.getLineTokens(a),h=c.getCount(),d=this.textModel.getLineContent(a);let u=0,f=0,g=0;if(a===t.lineNumber){u=c.findTokenIndexAtOffset(t.column-1),f=t.column-1,g=t.column-1;const p=c.getLanguageId(u);n!==p&&(n=p,s=this.languageConfigurationService.getLanguageConfiguration(n).brackets,r=this.languageConfigurationService.getLanguageConfiguration(n).bracketsNew)}let m=!0;for(;u<h;u++){const p=c.getLanguageId(u);if(n!==p){if(r&&s&&m&&f!==g){const v=Pn.findNextBracketInRange(s.forwardRegex,a,d,f,g);if(v)return this._toFoundBracket(r,v);m=!1}n=p,s=this.languageConfigurationService.getLanguageConfiguration(n).brackets,r=this.languageConfigurationService.getLanguageConfiguration(n).bracketsNew}const b=!!s&&!fs(c.getStandardTokenType(u));if(b)m||(f=c.getStartOffset(u)),g=c.getEndOffset(u);else if(r&&s&&m&&f!==g){const v=Pn.findNextBracketInRange(s.forwardRegex,a,d,f,g);if(v)return this._toFoundBracket(r,v)}m=b}if(r&&s&&m&&f!==g){const p=Pn.findNextBracketInRange(s.forwardRegex,a,d,f,g);if(p)return this._toFoundBracket(r,p)}}return null}findEnclosingBrackets(e,t){const i=this.textModel.validatePosition(e);if(this.canBuildAST){const g=l.Range.fromPositions(i),m=this.getBracketPairsInRange(l.Range.fromPositions(i,i)).findLast(p=>p.closingBracketRange!==void 0&&p.range.strictContainsRange(g));return m?[m.openingBracketRange,m.closingBracketRange]:null}const n=Tw(t),s=this.textModel.getLineCount(),r=new Map;let a=[];const c=(g,m)=>{if(!r.has(g)){const p=[];for(let b=0,v=m?m.brackets.length:0;b<v;b++)p[b]=0;r.set(g,p)}a=r.get(g)};let h=0;const d=(g,m,p,b,v)=>{for(;;){if(n&&++h%100===0&&!n())return _o.INSTANCE;const C=Pn.findNextBracketInRange(g.forwardRegex,m,p,b,v);if(!C)break;const w=p.substring(C.startColumn-1,C.endColumn-1).toLowerCase(),S=g.textIsBracket[w];if(S&&(S.isOpen(w)?a[S.index]++:S.isClose(w)&&a[S.index]--,a[S.index]===-1))return this._matchFoundBracket(C,S,!1,n);b=C.endColumn-1}return null};let u=null,f=null;for(let g=i.lineNumber;g<=s;g++){const m=this.textModel.tokenization.getLineTokens(g),p=m.getCount(),b=this.textModel.getLineContent(g);let v=0,C=0,w=0;if(g===i.lineNumber){v=m.findTokenIndexAtOffset(i.column-1),C=i.column-1,w=i.column-1;const L=m.getLanguageId(v);u!==L&&(u=L,f=this.languageConfigurationService.getLanguageConfiguration(u).brackets,c(u,f))}let S=!0;for(;v<p;v++){const L=m.getLanguageId(v);if(u!==L){if(f&&S&&C!==w){const x=d(f,g,b,C,w);if(x)return Rm(x);S=!1}u=L,f=this.languageConfigurationService.getLanguageConfiguration(u).brackets,c(u,f)}const D=!!f&&!fs(m.getStandardTokenType(v));if(D)S||(C=m.getStartOffset(v)),w=m.getEndOffset(v);else if(f&&S&&C!==w){const x=d(f,g,b,C,w);if(x)return Rm(x)}S=D}if(f&&S&&C!==w){const L=d(f,g,b,C,w);if(L)return Rm(L)}}return null}_toFoundBracket(e,t){if(!t)return null;let i=this.textModel.getValueInRange(t);i=i.toLowerCase();const n=e.getBracketInfo(i);return n?{range:t,bracketInfo:n}:null}}function Z5(o,e){return{object:o,dispose:()=>e?.dispose()}}function Tw(o){if(typeof o>"u")return()=>!0;{const e=Date.now();return()=>Date.now()-e<=o}}const rb=class rb{constructor(){this._searchCanceledBrand=void 0}};rb.INSTANCE=new rb;let _o=rb;function Rm(o){return o instanceof _o?null:o}class Q5 extends l.Disposable{constructor(e){super(),this.textModel=e,this.colorProvider=new s1,this.onDidChangeEmitter=this._register(new l.Emitter),this.onDidChange=this.onDidChangeEmitter.event,this.colorizationOptions=e.getOptions().bracketPairColorizationOptions,this._register(e.bracketPairs.onDidChange(t=>{this.onDidChangeEmitter.fire()}))}handleDidChangeOptions(e){this.colorizationOptions=this.textModel.getOptions().bracketPairColorizationOptions}getDecorationsInRange(e,t,i,n,s){return s?[]:t===void 0?[]:this.colorizationOptions.enabled?this.textModel.bracketPairs.getBracketsInRange(e,!0).map(a=>({id:`bracket${a.range.toString()}-${a.nestingLevel}`,options:{description:"BracketPairColorization",inlineClassName:this.colorProvider.getInlineClassName(a,this.colorizationOptions.independentColorPoolPerBracketType)},ownerId:0,range:a.range})).toArray():[]}getAllDecorations(e,t,i){return e===void 0?[]:this.colorizationOptions.enabled?this.getDecorationsInRange(new l.Range(1,1,this.textModel.getLineCount(),1),e,t,i):[]}}class s1{constructor(){this.unexpectedClosingBracketClassName="unexpected-closing-bracket"}getInlineClassName(e,t){return e.isInvalid?this.unexpectedClosingBracketClassName:this.getInlineClassNameOfLevel(t?e.nestingLevelOfEqualBracketType:e.nestingLevel)}getInlineClassNameOfLevel(e){return`bracket-highlighting-${e%30}`}}vs((o,e)=>{const t=[jI,qI,YI,ZI,QI,XI],i=new s1;e.addRule(`.monaco-editor .${i.unexpectedClosingBracketClassName} { color: ${o.getColor(m$)}; }`);const n=t.map(s=>o.getColor(s)).filter(s=>!!s).filter(s=>!s.isTransparent());for(let s=0;s<30;s++){const r=n[s%n.length];e.addRule(`.monaco-editor .${i.getInlineClassNameOfLevel(s)} { color: ${r}; }`)}});function Mm(o){return o.replace(/\n/g,"\\n").replace(/\r/g,"\\r")}class Gt{get oldLength(){return this.oldText.length}get oldEnd(){return this.oldPosition+this.oldText.length}get newLength(){return this.newText.length}get newEnd(){return this.newPosition+this.newText.length}constructor(e,t,i,n){this.oldPosition=e,this.oldText=t,this.newPosition=i,this.newText=n}toString(){return this.oldText.length===0?`(insert@${this.oldPosition} "${Mm(this.newText)}")`:this.newText.length===0?`(delete@${this.oldPosition} "${Mm(this.oldText)}")`:`(replace@${this.oldPosition} "${Mm(this.oldText)}" with "${Mm(this.newText)}")`}static _writeStringSize(e){return 4+2*e.length}static _writeString(e,t,i){const n=t.length;l.writeUInt32BE(e,n,i),i+=4;for(let s=0;s<n;s++)l.writeUInt16LE(e,t.charCodeAt(s),i),i+=2;return i}static _readString(e,t){const i=l.readUInt32BE(e,t);return t+=4,kB(e,t,i)}writeSize(){return 8+Gt._writeStringSize(this.oldText)+Gt._writeStringSize(this.newText)}write(e,t){return l.writeUInt32BE(e,this.oldPosition,t),t+=4,l.writeUInt32BE(e,this.newPosition,t),t+=4,t=Gt._writeString(e,this.oldText,t),t=Gt._writeString(e,this.newText,t),t}static read(e,t,i){const n=l.readUInt32BE(e,t);t+=4;const s=l.readUInt32BE(e,t);t+=4;const r=Gt._readString(e,t);t+=Gt._writeStringSize(r);const a=Gt._readString(e,t);return t+=Gt._writeStringSize(a),i.push(new Gt(n,r,s,a)),t}}function X5(o,e){return o===null||o.length===0?e:new Ls(o,e).compress()}class Ls{constructor(e,t){this._prevEdits=e,this._currEdits=t,this._result=[],this._resultLen=0,this._prevLen=this._prevEdits.length,this._prevDeltaOffset=0,this._currLen=this._currEdits.length,this._currDeltaOffset=0}compress(){let e=0,t=0,i=this._getPrev(e),n=this._getCurr(t);for(;e<this._prevLen||t<this._currLen;){if(i===null){this._acceptCurr(n),n=this._getCurr(++t);continue}if(n===null){this._acceptPrev(i),i=this._getPrev(++e);continue}if(n.oldEnd<=i.newPosition){this._acceptCurr(n),n=this._getCurr(++t);continue}if(i.newEnd<=n.oldPosition){this._acceptPrev(i),i=this._getPrev(++e);continue}if(n.oldPosition<i.newPosition){const[h,d]=Ls._splitCurr(n,i.newPosition-n.oldPosition);this._acceptCurr(h),n=d;continue}if(i.newPosition<n.oldPosition){const[h,d]=Ls._splitPrev(i,n.oldPosition-i.newPosition);this._acceptPrev(h),i=d;continue}let a,c;if(n.oldEnd===i.newEnd)a=i,c=n,i=this._getPrev(++e),n=this._getCurr(++t);else if(n.oldEnd<i.newEnd){const[h,d]=Ls._splitPrev(i,n.oldLength);a=h,c=n,i=d,n=this._getCurr(++t)}else{const[h,d]=Ls._splitCurr(n,i.newLength);a=i,c=h,i=this._getPrev(++e),n=d}this._result[this._resultLen++]=new Gt(a.oldPosition,a.oldText,c.newPosition,c.newText),this._prevDeltaOffset+=a.newLength-a.oldLength,this._currDeltaOffset+=c.newLength-c.oldLength}const s=Ls._merge(this._result);return Ls._removeNoOps(s)}_acceptCurr(e){this._result[this._resultLen++]=Ls._rebaseCurr(this._prevDeltaOffset,e),this._currDeltaOffset+=e.newLength-e.oldLength}_getCurr(e){return e<this._currLen?this._currEdits[e]:null}_acceptPrev(e){this._result[this._resultLen++]=Ls._rebasePrev(this._currDeltaOffset,e),this._prevDeltaOffset+=e.newLength-e.oldLength}_getPrev(e){return e<this._prevLen?this._prevEdits[e]:null}static _rebaseCurr(e,t){return new Gt(t.oldPosition-e,t.oldText,t.newPosition,t.newText)}static _rebasePrev(e,t){return new Gt(t.oldPosition,t.oldText,t.newPosition+e,t.newText)}static _splitPrev(e,t){const i=e.newText.substr(0,t),n=e.newText.substr(t);return[new Gt(e.oldPosition,e.oldText,e.newPosition,i),new Gt(e.oldEnd,"",e.newPosition+t,n)]}static _splitCurr(e,t){const i=e.oldText.substr(0,t),n=e.oldText.substr(t);return[new Gt(e.oldPosition,i,e.newPosition,e.newText),new Gt(e.oldPosition+t,n,e.newEnd,"")]}static _merge(e){if(e.length===0)return e;const t=[];let i=0,n=e[0];for(let s=1;s<e.length;s++){const r=e[s];n.oldEnd===r.oldPosition?n=new Gt(n.oldPosition,n.oldText+r.oldText,n.newPosition,n.newText+r.newText):(t[i++]=n,n=r)}return t[i++]=n,t}static _removeNoOps(e){if(e.length===0)return e;const t=[];let i=0;for(let n=0;n<e.length;n++){const s=e[n];s.oldText!==s.newText&&(t[i++]=s)}return t}}function Tc(o){return o.toString()}class Et{static create(e,t){const i=e.getAlternativeVersionId(),n=Nw(e);return new Et(i,i,n,n,t,t,[])}constructor(e,t,i,n,s,r,a){this.beforeVersionId=e,this.afterVersionId=t,this.beforeEOL=i,this.afterEOL=n,this.beforeCursorState=s,this.afterCursorState=r,this.changes=a}append(e,t,i,n,s){t.length>0&&(this.changes=X5(this.changes,t)),this.afterEOL=i,this.afterVersionId=n,this.afterCursorState=s}static _writeSelectionsSize(e){return 4+16*(e?e.length:0)}static _writeSelections(e,t,i){if(l.writeUInt32BE(e,t?t.length:0,i),i+=4,t)for(const n of t)l.writeUInt32BE(e,n.selectionStartLineNumber,i),i+=4,l.writeUInt32BE(e,n.selectionStartColumn,i),i+=4,l.writeUInt32BE(e,n.positionLineNumber,i),i+=4,l.writeUInt32BE(e,n.positionColumn,i),i+=4;return i}static _readSelections(e,t,i){const n=l.readUInt32BE(e,t);t+=4;for(let s=0;s<n;s++){const r=l.readUInt32BE(e,t);t+=4;const a=l.readUInt32BE(e,t);t+=4;const c=l.readUInt32BE(e,t);t+=4;const h=l.readUInt32BE(e,t);t+=4,i.push(new l.Selection(r,a,c,h))}return t}serialize(){let e=10+Et._writeSelectionsSize(this.beforeCursorState)+Et._writeSelectionsSize(this.afterCursorState)+4;for(const n of this.changes)e+=n.writeSize();const t=new Uint8Array(e);let i=0;l.writeUInt32BE(t,this.beforeVersionId,i),i+=4,l.writeUInt32BE(t,this.afterVersionId,i),i+=4,l.writeUInt8(t,this.beforeEOL,i),i+=1,l.writeUInt8(t,this.afterEOL,i),i+=1,i=Et._writeSelections(t,this.beforeCursorState,i),i=Et._writeSelections(t,this.afterCursorState,i),l.writeUInt32BE(t,this.changes.length,i),i+=4;for(const n of this.changes)i=n.write(t,i);return t.buffer}static deserialize(e){const t=new Uint8Array(e);let i=0;const n=l.readUInt32BE(t,i);i+=4;const s=l.readUInt32BE(t,i);i+=4;const r=l.readUInt8(t,i);i+=1;const a=l.readUInt8(t,i);i+=1;const c=[];i=Et._readSelections(t,i,c);const h=[];i=Et._readSelections(t,i,h);const d=l.readUInt32BE(t,i);i+=4;const u=[];for(let f=0;f<d;f++)i=Gt.read(t,i,u);return new Et(n,s,r,a,c,h,u)}}class o1{get type(){return 0}get resource(){return l.URI.isUri(this.model)?this.model:this.model.uri}constructor(e,t,i,n){this.label=e,this.code=t,this.model=i,this._data=Et.create(i,n)}toString(){return(this._data instanceof Et?this._data:Et.deserialize(this._data)).changes.map(t=>t.toString()).join(", ")}matchesResource(e){return(l.URI.isUri(this.model)?this.model:this.model.uri).toString()===e.toString()}setModel(e){this.model=e}canAppend(e){return this.model===e&&this._data instanceof Et}append(e,t,i,n,s){this._data instanceof Et&&this._data.append(e,t,i,n,s)}close(){this._data instanceof Et&&(this._data=this._data.serialize())}open(){this._data instanceof Et||(this._data=Et.deserialize(this._data))}undo(){if(l.URI.isUri(this.model))throw new Error("Invalid SingleModelEditStackElement");this._data instanceof Et&&(this._data=this._data.serialize());const e=Et.deserialize(this._data);this.model._applyUndo(e.changes,e.beforeEOL,e.beforeVersionId,e.beforeCursorState)}redo(){if(l.URI.isUri(this.model))throw new Error("Invalid SingleModelEditStackElement");this._data instanceof Et&&(this._data=this._data.serialize());const e=Et.deserialize(this._data);this.model._applyRedo(e.changes,e.afterEOL,e.afterVersionId,e.afterCursorState)}heapSize(){return this._data instanceof Et&&(this._data=this._data.serialize()),this._data.byteLength+168}}class J5{get resources(){return this._editStackElementsArr.map(e=>e.resource)}constructor(e,t,i){this.label=e,this.code=t,this.type=1,this._isOpen=!0,this._editStackElementsArr=i.slice(0),this._editStackElementsMap=new Map;for(const n of this._editStackElementsArr){const s=Tc(n.resource);this._editStackElementsMap.set(s,n)}this._delegate=null}prepareUndoRedo(){if(this._delegate)return this._delegate.prepareUndoRedo(this)}matchesResource(e){const t=Tc(e);return this._editStackElementsMap.has(t)}setModel(e){const t=Tc(l.URI.isUri(e)?e:e.uri);this._editStackElementsMap.has(t)&&this._editStackElementsMap.get(t).setModel(e)}canAppend(e){if(!this._isOpen)return!1;const t=Tc(e.uri);return this._editStackElementsMap.has(t)?this._editStackElementsMap.get(t).canAppend(e):!1}append(e,t,i,n,s){const r=Tc(e.uri);this._editStackElementsMap.get(r).append(e,t,i,n,s)}close(){this._isOpen=!1}open(){}undo(){this._isOpen=!1;for(const e of this._editStackElementsArr)e.undo()}redo(){for(const e of this._editStackElementsArr)e.redo()}heapSize(e){const t=Tc(e);return this._editStackElementsMap.has(t)?this._editStackElementsMap.get(t).heapSize():0}split(){return this._editStackElementsArr}toString(){const e=[];for(const t of this._editStackElementsArr)e.push(`${dg(t.resource)}: ${t}`);return`{${e.join(", ")}}`}}function Nw(o){return o.getEOL()===`
|
||
`?0:1}function bo(o){return o?o instanceof o1||o instanceof J5:!1}class Rw{constructor(e,t){this._model=e,this._undoRedoService=t}pushStackElement(){const e=this._undoRedoService.getLastElement(this._model.uri);bo(e)&&e.close()}popStackElement(){const e=this._undoRedoService.getLastElement(this._model.uri);bo(e)&&e.open()}clear(){this._undoRedoService.removeElements(this._model.uri)}_getOrCreateEditStackElement(e,t){const i=this._undoRedoService.getLastElement(this._model.uri);if(bo(i)&&i.canAppend(this._model))return i;const n=new o1(l.localize(820,"Typing"),"undoredo.textBufferEdit",this._model,e);return this._undoRedoService.pushElement(n,t),n}pushEOL(e){const t=this._getOrCreateEditStackElement(null,void 0);this._model.setEOL(e),t.append(this._model,[],Nw(this._model),this._model.getAlternativeVersionId(),null)}pushEditOperation(e,t,i,n,s=$i.unknown({name:"pushEditOperation"})){const r=this._getOrCreateEditStackElement(e,n),a=this._model.applyEdits(t,!0,s),c=Rw._computeCursorState(i,a),h=a.map((d,u)=>({index:u,textChange:d.textChange}));return h.sort((d,u)=>d.textChange.oldPosition===u.textChange.oldPosition?d.index-u.index:d.textChange.oldPosition-u.textChange.oldPosition),r.append(this._model,h.map(d=>d.textChange),Nw(this._model),this._model.getAlternativeVersionId(),c),c}static _computeCursorState(e,t){try{return e?e(t):null}catch(i){return l.onUnexpectedError(i),null}}}class W5{constructor(){this.spacesDiff=0,this.looksLikeAlignment=!1}}function H5(o,e,t,i,n){n.spacesDiff=0,n.looksLikeAlignment=!1;let s;for(s=0;s<e&&s<i;s++){const f=o.charCodeAt(s),g=t.charCodeAt(s);if(f!==g)break}let r=0,a=0;for(let f=s;f<e;f++)o.charCodeAt(f)===32?r++:a++;let c=0,h=0;for(let f=s;f<i;f++)t.charCodeAt(f)===32?c++:h++;if(r>0&&a>0||c>0&&h>0)return;const d=Math.abs(a-h),u=Math.abs(r-c);if(d===0){n.spacesDiff=u,u>0&&0<=c-1&&c-1<o.length&&c<t.length&&t.charCodeAt(c)!==32&&o.charCodeAt(c-1)===32&&o.charCodeAt(o.length-1)===44&&(n.looksLikeAlignment=!0);return}if(u%d===0){n.spacesDiff=u/d;return}}function r1(o,e,t){const i=Math.min(o.getLineCount(),1e4);let n=0,s=0,r="",a=0;const c=[2,4,6,8,3,5,7],h=8,d=[0,0,0,0,0,0,0,0,0],u=new W5;for(let m=1;m<=i;m++){const p=o.getLineLength(m),b=o.getLineContent(m),v=p<=65536;let C=!1,w=0,S=0,L=0;for(let x=0,I=p;x<I;x++){const T=v?b.charCodeAt(x):o.getLineCharCode(m,x);if(T===9)L++;else if(T===32)S++;else{C=!0,w=x;break}}if(!C||(L>0?n++:S>1&&s++,H5(r,a,b,w,u),u.looksLikeAlignment&&!(t&&e===u.spacesDiff)))continue;const D=u.spacesDiff;D<=h&&d[D]++,r=b,a=w}let f=t;n!==s&&(f=n<s);let g=e;if(f){let m=0;c.forEach(p=>{const b=d[p];b>m&&(m=b,g=p)}),g===4&&d[4]>0&&d[2]>0&&d[2]>=d[4]*2/3&&(g=2)}return{insertSpaces:f,tabSize:g}}function Oi(o){return(o.metadata&1)>>>0}function qe(o,e){o.metadata=o.metadata&254|e<<0}function jt(o){return(o.metadata&2)>>>1===1}function Ue(o,e){o.metadata=o.metadata&253|(e?1:0)<<1}function a1(o){return(o.metadata&4)>>>2===1}function l1(o,e){o.metadata=o.metadata&251|(e?1:0)<<2}function c1(o){return(o.metadata&64)>>>6===1}function h1(o,e){o.metadata=o.metadata&191|(e?1:0)<<6}function d1(o){return(o.metadata&128)>>>7===1}function u1(o,e){o.metadata=o.metadata&127|(e?1:0)<<7}function eK(o){return(o.metadata&24)>>>3}function f1(o,e){o.metadata=o.metadata&231|e<<3}function tK(o){return(o.metadata&32)>>>5===1}function g1(o,e){o.metadata=o.metadata&223|(e?1:0)<<5}class m1{constructor(e,t,i){this.metadata=0,this.parent=this,this.left=this,this.right=this,qe(this,1),this.start=t,this.end=i,this.delta=0,this.maxEnd=i,this.id=e,this.ownerId=0,this.options=null,l1(this,!1),h1(this,!1),f1(this,1),g1(this,!1),u1(this,!1),this.cachedVersionId=0,this.cachedAbsoluteStart=t,this.cachedAbsoluteEnd=i,this.range=null,Ue(this,!1)}reset(e,t,i,n){this.start=t,this.end=i,this.maxEnd=i,this.cachedVersionId=e,this.cachedAbsoluteStart=t,this.cachedAbsoluteEnd=i,this.range=n}setOptions(e){this.options=e;const t=this.options.className;l1(this,t==="squiggly-error"||t==="squiggly-warning"||t==="squiggly-info"),h1(this,this.options.glyphMarginClassName!==null),f1(this,this.options.stickiness),g1(this,this.options.collapseOnReplaceEdit),u1(this,this.options.affectsFont??!1)}setCachedOffsets(e,t,i){this.cachedVersionId!==i&&(this.range=null),this.cachedVersionId=i,this.cachedAbsoluteStart=e,this.cachedAbsoluteEnd=t}detach(){this.parent=null,this.left=null,this.right=null}}const ue=new m1(null,0,0);ue.parent=ue,ue.left=ue,ue.right=ue,qe(ue,0);class Mw{constructor(){this.root=ue,this.requestNormalizeDelta=!1}intervalSearch(e,t,i,n,s,r,a){return this.root===ue?[]:cK(this,e,t,i,n,s,r,a)}search(e,t,i,n,s){return this.root===ue?[]:lK(this,e,t,i,n,s)}collectNodesFromOwner(e){return rK(this,e)}collectNodesPostOrder(){return aK(this)}insert(e){p1(this,e),this._normalizeDeltaIfNecessary()}delete(e){_1(this,e),this._normalizeDeltaIfNecessary()}resolveNode(e,t){const i=e;let n=0;for(;e!==this.root;)e===e.parent.right&&(n+=e.parent.delta),e=e.parent;const s=i.start+n,r=i.end+n;i.setCachedOffsets(s,r,t)}acceptReplace(e,t,i,n){const s=sK(this,e,e+t);for(let r=0,a=s.length;r<a;r++){const c=s[r];_1(this,c)}this._normalizeDeltaIfNecessary(),oK(this,e,e+t,i),this._normalizeDeltaIfNecessary();for(let r=0,a=s.length;r<a;r++){const c=s[r];c.start=c.cachedAbsoluteStart,c.end=c.cachedAbsoluteEnd,nK(c,e,e+t,i,n),c.maxEnd=c.end,p1(this,c)}this._normalizeDeltaIfNecessary()}_normalizeDeltaIfNecessary(){this.requestNormalizeDelta&&(this.requestNormalizeDelta=!1,iK(this))}}function iK(o){let e=o.root,t=0;for(;e!==ue;){if(e.left!==ue&&!jt(e.left)){e=e.left;continue}if(e.right!==ue&&!jt(e.right)){t+=e.delta,e=e.right;continue}e.start=t+e.start,e.end=t+e.end,e.delta=0,pr(e),Ue(e,!0),Ue(e.left,!1),Ue(e.right,!1),e===e.parent.right&&(t-=e.parent.delta),e=e.parent}Ue(o.root,!1)}function Nc(o,e,t,i){return o<t?!0:o>t||i===1?!1:i===2?!0:e}function nK(o,e,t,i,n){const s=eK(o),r=s===0||s===2,a=s===1||s===2,c=t-e,h=i,d=Math.min(c,h),u=o.start;let f=!1;const g=o.end;let m=!1;e<=u&&g<=t&&tK(o)&&(o.start=e,f=!0,o.end=e,m=!0);{const b=n?1:c>0?2:0;!f&&Nc(u,r,e,b)&&(f=!0),!m&&Nc(g,a,e,b)&&(m=!0)}if(d>0&&!n){const b=c>h?2:0;!f&&Nc(u,r,e+d,b)&&(f=!0),!m&&Nc(g,a,e+d,b)&&(m=!0)}{const b=n?1:0;!f&&Nc(u,r,t,b)&&(o.start=e+h,f=!0),!m&&Nc(g,a,t,b)&&(o.end=e+h,m=!0)}const p=h-c;f||(o.start=Math.max(0,u+p)),m||(o.end=Math.max(0,g+p)),o.start>o.end&&(o.end=o.start)}function sK(o,e,t){let i=o.root,n=0,s=0,r=0,a=0;const c=[];let h=0;for(;i!==ue;){if(jt(i)){Ue(i.left,!1),Ue(i.right,!1),i===i.parent.right&&(n-=i.parent.delta),i=i.parent;continue}if(!jt(i.left)){if(s=n+i.maxEnd,s<e){Ue(i,!0);continue}if(i.left!==ue){i=i.left;continue}}if(r=n+i.start,r>t){Ue(i,!0);continue}if(a=n+i.end,a>=e&&(i.setCachedOffsets(r,a,0),c[h++]=i),Ue(i,!0),i.right!==ue&&!jt(i.right)){n+=i.delta,i=i.right;continue}}return Ue(o.root,!1),c}function oK(o,e,t,i){let n=o.root,s=0,r=0,a=0;const c=i-(t-e);for(;n!==ue;){if(jt(n)){Ue(n.left,!1),Ue(n.right,!1),n===n.parent.right&&(s-=n.parent.delta),pr(n),n=n.parent;continue}if(!jt(n.left)){if(r=s+n.maxEnd,r<e){Ue(n,!0);continue}if(n.left!==ue){n=n.left;continue}}if(a=s+n.start,a>t){n.start+=c,n.end+=c,n.delta+=c,(n.delta<-1073741824||n.delta>1073741824)&&(o.requestNormalizeDelta=!0),Ue(n,!0);continue}if(Ue(n,!0),n.right!==ue&&!jt(n.right)){s+=n.delta,n=n.right;continue}}Ue(o.root,!1)}function rK(o,e){let t=o.root;const i=[];let n=0;for(;t!==ue;){if(jt(t)){Ue(t.left,!1),Ue(t.right,!1),t=t.parent;continue}if(t.left!==ue&&!jt(t.left)){t=t.left;continue}if(t.ownerId===e&&(i[n++]=t),Ue(t,!0),t.right!==ue&&!jt(t.right)){t=t.right;continue}}return Ue(o.root,!1),i}function aK(o){let e=o.root;const t=[];let i=0;for(;e!==ue;){if(jt(e)){Ue(e.left,!1),Ue(e.right,!1),e=e.parent;continue}if(e.left!==ue&&!jt(e.left)){e=e.left;continue}if(e.right!==ue&&!jt(e.right)){e=e.right;continue}t[i++]=e,Ue(e,!0)}return Ue(o.root,!1),t}function lK(o,e,t,i,n,s){let r=o.root,a=0,c=0,h=0;const d=[];let u=0;for(;r!==ue;){if(jt(r)){Ue(r.left,!1),Ue(r.right,!1),r===r.parent.right&&(a-=r.parent.delta),r=r.parent;continue}if(r.left!==ue&&!jt(r.left)){r=r.left;continue}c=a+r.start,h=a+r.end,r.setCachedOffsets(c,h,n);let f=!0;if(e&&r.ownerId&&r.ownerId!==e&&(f=!1),t&&a1(r)&&(f=!1),i&&d1(r)&&(f=!1),s&&!c1(r)&&(f=!1),f&&(d[u++]=r),Ue(r,!0),r.right!==ue&&!jt(r.right)){a+=r.delta,r=r.right;continue}}return Ue(o.root,!1),d}function cK(o,e,t,i,n,s,r,a){let c=o.root,h=0,d=0,u=0,f=0;const g=[];let m=0;for(;c!==ue;){if(jt(c)){Ue(c.left,!1),Ue(c.right,!1),c===c.parent.right&&(h-=c.parent.delta),c=c.parent;continue}if(!jt(c.left)){if(d=h+c.maxEnd,d<e){Ue(c,!0);continue}if(c.left!==ue){c=c.left;continue}}if(u=h+c.start,u>t){Ue(c,!0);continue}if(f=h+c.end,f>=e){c.setCachedOffsets(u,f,r);let p=!0;i&&c.ownerId&&c.ownerId!==i&&(p=!1),n&&a1(c)&&(p=!1),s&&d1(c)&&(p=!1),a&&!c1(c)&&(p=!1),p&&(g[m++]=c)}if(Ue(c,!0),c.right!==ue&&!jt(c.right)){h+=c.delta,c=c.right;continue}}return Ue(o.root,!1),g}function p1(o,e){if(o.root===ue)return e.parent=ue,e.left=ue,e.right=ue,qe(e,0),o.root=e,o.root;hK(o,e),_r(e.parent);let t=e;for(;t!==o.root&&Oi(t.parent)===1;)if(t.parent===t.parent.parent.left){const i=t.parent.parent.right;Oi(i)===1?(qe(t.parent,0),qe(i,0),qe(t.parent.parent,1),t=t.parent.parent):(t===t.parent.right&&(t=t.parent,au(o,t)),qe(t.parent,0),qe(t.parent.parent,1),lu(o,t.parent.parent))}else{const i=t.parent.parent.left;Oi(i)===1?(qe(t.parent,0),qe(i,0),qe(t.parent.parent,1),t=t.parent.parent):(t===t.parent.left&&(t=t.parent,lu(o,t)),qe(t.parent,0),qe(t.parent.parent,1),au(o,t.parent.parent))}return qe(o.root,0),e}function hK(o,e){let t=0,i=o.root;const n=e.start,s=e.end;for(;;)if(uK(n,s,i.start+t,i.end+t)<0)if(i.left===ue){e.start-=t,e.end-=t,e.maxEnd-=t,i.left=e;break}else i=i.left;else if(i.right===ue){e.start-=t+i.delta,e.end-=t+i.delta,e.maxEnd-=t+i.delta,i.right=e;break}else t+=i.delta,i=i.right;e.parent=i,e.left=ue,e.right=ue,qe(e,1)}function _1(o,e){let t,i;if(e.left===ue?(t=e.right,i=e,t.delta+=e.delta,(t.delta<-1073741824||t.delta>1073741824)&&(o.requestNormalizeDelta=!0),t.start+=e.delta,t.end+=e.delta):e.right===ue?(t=e.left,i=e):(i=dK(e.right),t=i.right,t.start+=i.delta,t.end+=i.delta,t.delta+=i.delta,(t.delta<-1073741824||t.delta>1073741824)&&(o.requestNormalizeDelta=!0),i.start+=e.delta,i.end+=e.delta,i.delta=e.delta,(i.delta<-1073741824||i.delta>1073741824)&&(o.requestNormalizeDelta=!0)),i===o.root){o.root=t,qe(t,0),e.detach(),Aw(),pr(t),o.root.parent=ue;return}const n=Oi(i)===1;if(i===i.parent.left?i.parent.left=t:i.parent.right=t,i===e?t.parent=i.parent:(i.parent===e?t.parent=i:t.parent=i.parent,i.left=e.left,i.right=e.right,i.parent=e.parent,qe(i,Oi(e)),e===o.root?o.root=i:e===e.parent.left?e.parent.left=i:e.parent.right=i,i.left!==ue&&(i.left.parent=i),i.right!==ue&&(i.right.parent=i)),e.detach(),n){_r(t.parent),i!==e&&(_r(i),_r(i.parent)),Aw();return}_r(t),_r(t.parent),i!==e&&(_r(i),_r(i.parent));let s;for(;t!==o.root&&Oi(t)===0;)t===t.parent.left?(s=t.parent.right,Oi(s)===1&&(qe(s,0),qe(t.parent,1),au(o,t.parent),s=t.parent.right),Oi(s.left)===0&&Oi(s.right)===0?(qe(s,1),t=t.parent):(Oi(s.right)===0&&(qe(s.left,0),qe(s,1),lu(o,s),s=t.parent.right),qe(s,Oi(t.parent)),qe(t.parent,0),qe(s.right,0),au(o,t.parent),t=o.root)):(s=t.parent.left,Oi(s)===1&&(qe(s,0),qe(t.parent,1),lu(o,t.parent),s=t.parent.left),Oi(s.left)===0&&Oi(s.right)===0?(qe(s,1),t=t.parent):(Oi(s.left)===0&&(qe(s.right,0),qe(s,1),au(o,s),s=t.parent.left),qe(s,Oi(t.parent)),qe(t.parent,0),qe(s.left,0),lu(o,t.parent),t=o.root));qe(t,0),Aw()}function dK(o){for(;o.left!==ue;)o=o.left;return o}function Aw(){ue.parent=ue,ue.delta=0,ue.start=0,ue.end=0}function au(o,e){const t=e.right;t.delta+=e.delta,(t.delta<-1073741824||t.delta>1073741824)&&(o.requestNormalizeDelta=!0),t.start+=e.delta,t.end+=e.delta,e.right=t.left,t.left!==ue&&(t.left.parent=e),t.parent=e.parent,e.parent===ue?o.root=t:e===e.parent.left?e.parent.left=t:e.parent.right=t,t.left=e,e.parent=t,pr(e),pr(t)}function lu(o,e){const t=e.left;e.delta-=t.delta,(e.delta<-1073741824||e.delta>1073741824)&&(o.requestNormalizeDelta=!0),e.start-=t.delta,e.end-=t.delta,e.left=t.right,t.right!==ue&&(t.right.parent=e),t.parent=e.parent,e.parent===ue?o.root=t:e===e.parent.right?e.parent.right=t:e.parent.left=t,t.right=e,e.parent=t,pr(e),pr(t)}function b1(o){let e=o.end;if(o.left!==ue){const t=o.left.maxEnd;t>e&&(e=t)}if(o.right!==ue){const t=o.right.maxEnd+o.delta;t>e&&(e=t)}return e}function pr(o){o.maxEnd=b1(o)}function _r(o){for(;o!==ue;){const e=b1(o);if(o.maxEnd===e)return;o.maxEnd=e,o=o.parent}}function uK(o,e,t,i){return o===t?e-i:o-t}class Ow{constructor(e,t){this.piece=e,this.color=t,this.size_left=0,this.lf_left=0,this.parent=this,this.left=this,this.right=this}next(){if(this.right!==ie)return Pw(this.right);let e=this;for(;e.parent!==ie&&e.parent.left!==e;)e=e.parent;return e.parent===ie?ie:e.parent}prev(){if(this.left!==ie)return C1(this.left);let e=this;for(;e.parent!==ie&&e.parent.right!==e;)e=e.parent;return e.parent===ie?ie:e.parent}detach(){this.parent=null,this.left=null,this.right=null}}const ie=new Ow(null,0);ie.parent=ie,ie.left=ie,ie.right=ie,ie.color=0;function Pw(o){for(;o.left!==ie;)o=o.left;return o}function C1(o){for(;o.right!==ie;)o=o.right;return o}function kw(o){return o===ie?0:o.size_left+o.piece.length+kw(o.right)}function Fw(o){return o===ie?0:o.lf_left+o.piece.lineFeedCnt+Fw(o.right)}function Bw(){ie.parent=ie}function cu(o,e){const t=e.right;t.size_left+=e.size_left+(e.piece?e.piece.length:0),t.lf_left+=e.lf_left+(e.piece?e.piece.lineFeedCnt:0),e.right=t.left,t.left!==ie&&(t.left.parent=e),t.parent=e.parent,e.parent===ie?o.root=t:e.parent.left===e?e.parent.left=t:e.parent.right=t,t.left=e,e.parent=t}function hu(o,e){const t=e.left;e.left=t.right,t.right!==ie&&(t.right.parent=e),t.parent=e.parent,e.size_left-=t.size_left+(t.piece?t.piece.length:0),e.lf_left-=t.lf_left+(t.piece?t.piece.lineFeedCnt:0),e.parent===ie?o.root=t:e===e.parent.right?e.parent.right=t:e.parent.left=t,t.right=e,e.parent=t}function Am(o,e){let t,i;if(e.left===ie?(i=e,t=i.right):e.right===ie?(i=e,t=i.left):(i=Pw(e.right),t=i.right),i===o.root){o.root=t,t.color=0,e.detach(),Bw(),o.root.parent=ie;return}const n=i.color===1;if(i===i.parent.left?i.parent.left=t:i.parent.right=t,i===e?(t.parent=i.parent,du(o,t)):(i.parent===e?t.parent=i:t.parent=i.parent,du(o,t),i.left=e.left,i.right=e.right,i.parent=e.parent,i.color=e.color,e===o.root?o.root=i:e===e.parent.left?e.parent.left=i:e.parent.right=i,i.left!==ie&&(i.left.parent=i),i.right!==ie&&(i.right.parent=i),i.size_left=e.size_left,i.lf_left=e.lf_left,du(o,i)),e.detach(),t.parent.left===t){const r=kw(t),a=Fw(t);if(r!==t.parent.size_left||a!==t.parent.lf_left){const c=r-t.parent.size_left,h=a-t.parent.lf_left;t.parent.size_left=r,t.parent.lf_left=a,Co(o,t.parent,c,h)}}if(du(o,t.parent),n){Bw();return}let s;for(;t!==o.root&&t.color===0;)t===t.parent.left?(s=t.parent.right,s.color===1&&(s.color=0,t.parent.color=1,cu(o,t.parent),s=t.parent.right),s.left.color===0&&s.right.color===0?(s.color=1,t=t.parent):(s.right.color===0&&(s.left.color=0,s.color=1,hu(o,s),s=t.parent.right),s.color=t.parent.color,t.parent.color=0,s.right.color=0,cu(o,t.parent),t=o.root)):(s=t.parent.left,s.color===1&&(s.color=0,t.parent.color=1,hu(o,t.parent),s=t.parent.left),s.left.color===0&&s.right.color===0?(s.color=1,t=t.parent):(s.left.color===0&&(s.right.color=0,s.color=1,cu(o,s),s=t.parent.left),s.color=t.parent.color,t.parent.color=0,s.left.color=0,hu(o,t.parent),t=o.root));t.color=0,Bw()}function v1(o,e){for(du(o,e);e!==o.root&&e.parent.color===1;)if(e.parent===e.parent.parent.left){const t=e.parent.parent.right;t.color===1?(e.parent.color=0,t.color=0,e.parent.parent.color=1,e=e.parent.parent):(e===e.parent.right&&(e=e.parent,cu(o,e)),e.parent.color=0,e.parent.parent.color=1,hu(o,e.parent.parent))}else{const t=e.parent.parent.left;t.color===1?(e.parent.color=0,t.color=0,e.parent.parent.color=1,e=e.parent.parent):(e===e.parent.left&&(e=e.parent,hu(o,e)),e.parent.color=0,e.parent.parent.color=1,cu(o,e.parent.parent))}o.root.color=0}function Co(o,e,t,i){for(;e!==o.root&&e!==ie;)e.parent.left===e&&(e.parent.size_left+=t,e.parent.lf_left+=i),e=e.parent}function du(o,e){let t=0,i=0;if(e!==o.root){for(;e!==o.root&&e===e.parent.right;)e=e.parent;if(e!==o.root)for(e=e.parent,t=kw(e.left)-e.size_left,i=Fw(e.left)-e.lf_left,e.size_left+=t,e.lf_left+=i;e!==o.root&&(t!==0||i!==0);)e.parent.left===e&&(e.parent.size_left+=t,e.parent.lf_left+=i),e=e.parent}}const vo=65535;function w1(o){let e;return o[o.length-1]<65536?e=new Uint16Array(o.length):e=new Uint32Array(o.length),e.set(o,0),e}class fK{constructor(e,t,i,n,s){this.lineStarts=e,this.cr=t,this.lf=i,this.crlf=n,this.isBasicASCII=s}}function wo(o,e=!0){const t=[0];let i=1;for(let n=0,s=o.length;n<s;n++){const r=o.charCodeAt(n);r===13?n+1<s&&o.charCodeAt(n+1)===10?(t[i++]=n+2,n++):t[i++]=n+1:r===10&&(t[i++]=n+1)}return e?w1(t):t}function gK(o,e){o.length=0,o[0]=0;let t=1,i=0,n=0,s=0,r=!0;for(let c=0,h=e.length;c<h;c++){const d=e.charCodeAt(c);d===13?c+1<h&&e.charCodeAt(c+1)===10?(s++,o[t++]=c+2,c++):(i++,o[t++]=c+1):d===10?(n++,o[t++]=c+1):r&&d!==9&&(d<32||d>126)&&(r=!1)}const a=new fK(w1(o),i,n,s,r);return o.length=0,a}class Gi{constructor(e,t,i,n,s){this.bufferIndex=e,this.start=t,this.end=i,this.lineFeedCnt=n,this.length=s}}class Pa{constructor(e,t){this.buffer=e,this.lineStarts=t}}class mK{constructor(e,t){this._pieces=[],this._tree=e,this._BOM=t,this._index=0,e.root!==ie&&e.iterate(e.root,i=>(i!==ie&&this._pieces.push(i.piece),!0))}read(){return this._pieces.length===0?this._index===0?(this._index++,this._BOM):null:this._index>this._pieces.length-1?null:this._index===0?this._BOM+this._tree.getPieceContent(this._pieces[this._index++]):this._tree.getPieceContent(this._pieces[this._index++])}}class pK{constructor(e){this._limit=e,this._cache=[]}get(e){for(let t=this._cache.length-1;t>=0;t--){const i=this._cache[t];if(i.nodeStartOffset<=e&&i.nodeStartOffset+i.node.piece.length>=e)return i}return null}get2(e){for(let t=this._cache.length-1;t>=0;t--){const i=this._cache[t];if(i.nodeStartLineNumber&&i.nodeStartLineNumber<e&&i.nodeStartLineNumber+i.node.piece.lineFeedCnt>=e)return i}return null}set(e){this._cache.length>=this._limit&&this._cache.shift(),this._cache.push(e)}validate(e){let t=!1;const i=this._cache;for(let n=0;n<i.length;n++){const s=i[n];if(s.node.parent===null||s.nodeStartOffset>=e){i[n]=null,t=!0;continue}}if(t){const n=[];for(const s of i)s!==null&&n.push(s);this._cache=n}}}class _K{constructor(e,t,i){this.create(e,t,i)}create(e,t,i){this._buffers=[new Pa("",[0])],this._lastChangeBufferPos={line:0,column:0},this.root=ie,this._lineCnt=1,this._length=0,this._EOL=t,this._EOLLength=t.length,this._EOLNormalized=i;let n=null;for(let s=0,r=e.length;s<r;s++)if(e[s].buffer.length>0){e[s].lineStarts||(e[s].lineStarts=wo(e[s].buffer));const a=new Gi(s+1,{line:0,column:0},{line:e[s].lineStarts.length-1,column:e[s].buffer.length-e[s].lineStarts[e[s].lineStarts.length-1]},e[s].lineStarts.length-1,e[s].buffer.length);this._buffers.push(e[s]),n=this.rbInsertRight(n,a)}this._searchCache=new pK(1),this._lastVisitedLine={lineNumber:0,value:""},this.computeBufferMetadata()}normalizeEOL(e){const t=vo,i=t-Math.floor(t/3),n=i*2;let s="",r=0;const a=[];if(this.iterate(this.root,c=>{const h=this.getNodeContent(c),d=h.length;if(r<=i||r+d<n)return s+=h,r+=d,!0;const u=s.replace(/\r\n|\r|\n/g,e);return a.push(new Pa(u,wo(u))),s=h,r=d,!0}),r>0){const c=s.replace(/\r\n|\r|\n/g,e);a.push(new Pa(c,wo(c)))}this.create(a,e,!0)}getEOL(){return this._EOL}setEOL(e){this._EOL=e,this._EOLLength=this._EOL.length,this.normalizeEOL(e)}createSnapshot(e){return new mK(this,e)}getOffsetAt(e,t){let i=0,n=this.root;for(;n!==ie;)if(n.left!==ie&&n.lf_left+1>=e)n=n.left;else if(n.lf_left+n.piece.lineFeedCnt+1>=e){i+=n.size_left;const s=this.getAccumulatedValue(n,e-n.lf_left-2);return i+=s+t-1}else e-=n.lf_left+n.piece.lineFeedCnt,i+=n.size_left+n.piece.length,n=n.right;return i}getPositionAt(e){e=Math.floor(e),e=Math.max(0,e);let t=this.root,i=0;const n=e;for(;t!==ie;)if(t.size_left!==0&&t.size_left>=e)t=t.left;else if(t.size_left+t.piece.length>=e){const s=this.getIndexOf(t,e-t.size_left);if(i+=t.lf_left+s.index,s.index===0){const r=this.getOffsetAt(i+1,1),a=n-r;return new l.Position(i+1,a+1)}return new l.Position(i+1,s.remainder+1)}else if(e-=t.size_left+t.piece.length,i+=t.lf_left+t.piece.lineFeedCnt,t.right===ie){const s=this.getOffsetAt(i+1,1),r=n-e-s;return new l.Position(i+1,r+1)}else t=t.right;return new l.Position(1,1)}getValueInRange(e,t){if(e.startLineNumber===e.endLineNumber&&e.startColumn===e.endColumn)return"";const i=this.nodeAt2(e.startLineNumber,e.startColumn),n=this.nodeAt2(e.endLineNumber,e.endColumn),s=this.getValueInRange2(i,n);return t?t!==this._EOL||!this._EOLNormalized?s.replace(/\r\n|\r|\n/g,t):t===this.getEOL()&&this._EOLNormalized?s:s.replace(/\r\n|\r|\n/g,t):s}getValueInRange2(e,t){if(e.node===t.node){const a=e.node,c=this._buffers[a.piece.bufferIndex].buffer,h=this.offsetInBuffer(a.piece.bufferIndex,a.piece.start);return c.substring(h+e.remainder,h+t.remainder)}let i=e.node;const n=this._buffers[i.piece.bufferIndex].buffer,s=this.offsetInBuffer(i.piece.bufferIndex,i.piece.start);let r=n.substring(s+e.remainder,s+i.piece.length);for(i=i.next();i!==ie;){const a=this._buffers[i.piece.bufferIndex].buffer,c=this.offsetInBuffer(i.piece.bufferIndex,i.piece.start);if(i===t.node){r+=a.substring(c,c+t.remainder);break}else r+=a.substr(c,i.piece.length);i=i.next()}return r}getLinesContent(){const e=[];let t=0,i="",n=!1;return this.iterate(this.root,s=>{if(s===ie)return!0;const r=s.piece;let a=r.length;if(a===0)return!0;const c=this._buffers[r.bufferIndex].buffer,h=this._buffers[r.bufferIndex].lineStarts,d=r.start.line,u=r.end.line;let f=h[d]+r.start.column;if(n&&(c.charCodeAt(f)===10&&(f++,a--),e[t++]=i,i="",n=!1,a===0))return!0;if(d===u)return!this._EOLNormalized&&c.charCodeAt(f+a-1)===13?(n=!0,i+=c.substr(f,a-1)):i+=c.substr(f,a),!0;i+=this._EOLNormalized?c.substring(f,Math.max(f,h[d+1]-this._EOLLength)):c.substring(f,h[d+1]).replace(/(\r\n|\r|\n)$/,""),e[t++]=i;for(let g=d+1;g<u;g++)i=this._EOLNormalized?c.substring(h[g],h[g+1]-this._EOLLength):c.substring(h[g],h[g+1]).replace(/(\r\n|\r|\n)$/,""),e[t++]=i;return!this._EOLNormalized&&c.charCodeAt(h[u]+r.end.column-1)===13?(n=!0,r.end.column===0?t--:i=c.substr(h[u],r.end.column-1)):i=c.substr(h[u],r.end.column),!0}),n&&(e[t++]=i,i=""),e[t++]=i,e}getLength(){return this._length}getLineCount(){return this._lineCnt}getLineContent(e){return this._lastVisitedLine.lineNumber===e?this._lastVisitedLine.value:(this._lastVisitedLine.lineNumber=e,e===this._lineCnt?this._lastVisitedLine.value=this.getLineRawContent(e):this._EOLNormalized?this._lastVisitedLine.value=this.getLineRawContent(e,this._EOLLength):this._lastVisitedLine.value=this.getLineRawContent(e).replace(/(\r\n|\r|\n)$/,""),this._lastVisitedLine.value)}_getCharCode(e){if(e.remainder===e.node.piece.length){const t=e.node.next();if(!t)return 0;const i=this._buffers[t.piece.bufferIndex],n=this.offsetInBuffer(t.piece.bufferIndex,t.piece.start);return i.buffer.charCodeAt(n)}else{const t=this._buffers[e.node.piece.bufferIndex],n=this.offsetInBuffer(e.node.piece.bufferIndex,e.node.piece.start)+e.remainder;return t.buffer.charCodeAt(n)}}getLineCharCode(e,t){const i=this.nodeAt2(e,t+1);return this._getCharCode(i)}getLineLength(e){if(e===this.getLineCount()){const t=this.getOffsetAt(e,1);return this.getLength()-t}return this.getOffsetAt(e+1,1)-this.getOffsetAt(e,1)-this._EOLLength}getNearestChunk(e){const t=this.nodeAt(e);if(t.remainder===t.node.piece.length){const i=t.node.next();if(!i||i===ie)return"";const n=this._buffers[i.piece.bufferIndex],s=this.offsetInBuffer(i.piece.bufferIndex,i.piece.start);return n.buffer.substring(s,s+i.piece.length)}else{const i=this._buffers[t.node.piece.bufferIndex],n=this.offsetInBuffer(t.node.piece.bufferIndex,t.node.piece.start),s=n+t.remainder,r=n+t.node.piece.length;return i.buffer.substring(s,r)}}findMatchesInNode(e,t,i,n,s,r,a,c,h,d,u){const f=this._buffers[e.piece.bufferIndex],g=this.offsetInBuffer(e.piece.bufferIndex,e.piece.start),m=this.offsetInBuffer(e.piece.bufferIndex,s),p=this.offsetInBuffer(e.piece.bufferIndex,r);let b;const v={line:0,column:0};let C,w;t._wordSeparators?(C=f.buffer.substring(m,p),w=S=>S+m,t.reset(0)):(C=f.buffer,w=S=>S,t.reset(m));do if(b=t.next(C),b){if(w(b.index)>=p)return d;this.positionInBuffer(e,w(b.index)-g,v);const S=this.getLineFeedCnt(e.piece.bufferIndex,s,v),L=v.line===s.line?v.column-s.column+n:v.column+1,D=L+b[0].length;if(u[d++]=l.createFindMatch(new l.Range(i+S,L,i+S,D),b,c),w(b.index)+b[0].length>=p||d>=h)return d}while(b);return d}findMatchesLineByLine(e,t,i,n){const s=[];let r=0;const a=new l.Searcher(t.wordSeparators,t.regex);let c=this.nodeAt2(e.startLineNumber,e.startColumn);if(c===null)return[];const h=this.nodeAt2(e.endLineNumber,e.endColumn);if(h===null)return[];let d=this.positionInBuffer(c.node,c.remainder);const u=this.positionInBuffer(h.node,h.remainder);if(c.node===h.node)return this.findMatchesInNode(c.node,a,e.startLineNumber,e.startColumn,d,u,t,i,n,r,s),s;let f=e.startLineNumber,g=c.node;for(;g!==h.node;){const p=this.getLineFeedCnt(g.piece.bufferIndex,d,g.piece.end);if(p>=1){const v=this._buffers[g.piece.bufferIndex].lineStarts,C=this.offsetInBuffer(g.piece.bufferIndex,g.piece.start),w=v[d.line+p],S=f===e.startLineNumber?e.startColumn:1;if(r=this.findMatchesInNode(g,a,f,S,d,this.positionInBuffer(g,w-C),t,i,n,r,s),r>=n)return s;f+=p}const b=f===e.startLineNumber?e.startColumn-1:0;if(f===e.endLineNumber){const v=this.getLineContent(f).substring(b,e.endColumn-1);return r=this._findMatchesInLine(t,a,v,e.endLineNumber,b,r,s,i,n),s}if(r=this._findMatchesInLine(t,a,this.getLineContent(f).substr(b),f,b,r,s,i,n),r>=n)return s;f++,c=this.nodeAt2(f,1),g=c.node,d=this.positionInBuffer(c.node,c.remainder)}if(f===e.endLineNumber){const p=f===e.startLineNumber?e.startColumn-1:0,b=this.getLineContent(f).substring(p,e.endColumn-1);return r=this._findMatchesInLine(t,a,b,e.endLineNumber,p,r,s,i,n),s}const m=f===e.startLineNumber?e.startColumn:1;return r=this.findMatchesInNode(h.node,a,f,m,d,u,t,i,n,r,s),s}_findMatchesInLine(e,t,i,n,s,r,a,c,h){const d=e.wordSeparators;if(!c&&e.simpleSearch){const f=e.simpleSearch,g=f.length,m=i.length;let p=-g;for(;(p=i.indexOf(f,p+g))!==-1;)if((!d||l.isValidMatch(d,i,m,p,g))&&(a[r++]=new l.FindMatch(new l.Range(n,p+1+s,n,p+1+g+s),null),r>=h))return r;return r}let u;t.reset(0);do if(u=t.next(i),u&&(a[r++]=l.createFindMatch(new l.Range(n,u.index+1+s,n,u.index+1+u[0].length+s),u,c),r>=h))return r;while(u);return r}insert(e,t,i=!1){if(this._EOLNormalized=this._EOLNormalized&&i,this._lastVisitedLine.lineNumber=0,this._lastVisitedLine.value="",this.root!==ie){const{node:n,remainder:s,nodeStartOffset:r}=this.nodeAt(e),a=n.piece,c=a.bufferIndex,h=this.positionInBuffer(n,s);if(n.piece.bufferIndex===0&&a.end.line===this._lastChangeBufferPos.line&&a.end.column===this._lastChangeBufferPos.column&&r+a.length===e&&t.length<vo){this.appendToNode(n,t),this.computeBufferMetadata();return}if(r===e)this.insertContentToNodeLeft(t,n),this._searchCache.validate(e);else if(r+n.piece.length>e){const d=[];let u=new Gi(a.bufferIndex,h,a.end,this.getLineFeedCnt(a.bufferIndex,h,a.end),this.offsetInBuffer(c,a.end)-this.offsetInBuffer(c,h));if(this.shouldCheckCRLF()&&this.endWithCR(t)&&this.nodeCharCodeAt(n,s)===10){const p={line:u.start.line+1,column:0};u=new Gi(u.bufferIndex,p,u.end,this.getLineFeedCnt(u.bufferIndex,p,u.end),u.length-1),t+=`
|
||
`}if(this.shouldCheckCRLF()&&this.startWithLF(t))if(this.nodeCharCodeAt(n,s-1)===13){const p=this.positionInBuffer(n,s-1);this.deleteNodeTail(n,p),t="\r"+t,n.piece.length===0&&d.push(n)}else this.deleteNodeTail(n,h);else this.deleteNodeTail(n,h);const f=this.createNewPieces(t);u.length>0&&this.rbInsertRight(n,u);let g=n;for(let m=0;m<f.length;m++)g=this.rbInsertRight(g,f[m]);this.deleteNodes(d)}else this.insertContentToNodeRight(t,n)}else{const n=this.createNewPieces(t);let s=this.rbInsertLeft(null,n[0]);for(let r=1;r<n.length;r++)s=this.rbInsertRight(s,n[r])}this.computeBufferMetadata()}delete(e,t){if(this._lastVisitedLine.lineNumber=0,this._lastVisitedLine.value="",t<=0||this.root===ie)return;const i=this.nodeAt(e),n=this.nodeAt(e+t),s=i.node,r=n.node;if(s===r){const f=this.positionInBuffer(s,i.remainder),g=this.positionInBuffer(s,n.remainder);if(i.nodeStartOffset===e){if(t===s.piece.length){const m=s.next();Am(this,s),this.validateCRLFWithPrevNode(m),this.computeBufferMetadata();return}this.deleteNodeHead(s,g),this._searchCache.validate(e),this.validateCRLFWithPrevNode(s),this.computeBufferMetadata();return}if(i.nodeStartOffset+s.piece.length===e+t){this.deleteNodeTail(s,f),this.validateCRLFWithNextNode(s),this.computeBufferMetadata();return}this.shrinkNode(s,f,g),this.computeBufferMetadata();return}const a=[],c=this.positionInBuffer(s,i.remainder);this.deleteNodeTail(s,c),this._searchCache.validate(e),s.piece.length===0&&a.push(s);const h=this.positionInBuffer(r,n.remainder);this.deleteNodeHead(r,h),r.piece.length===0&&a.push(r);const d=s.next();for(let f=d;f!==ie&&f!==r;f=f.next())a.push(f);const u=s.piece.length===0?s.prev():s;this.deleteNodes(a),this.validateCRLFWithNextNode(u),this.computeBufferMetadata()}insertContentToNodeLeft(e,t){const i=[];if(this.shouldCheckCRLF()&&this.endWithCR(e)&&this.startWithLF(t)){const r=t.piece,a={line:r.start.line+1,column:0},c=new Gi(r.bufferIndex,a,r.end,this.getLineFeedCnt(r.bufferIndex,a,r.end),r.length-1);t.piece=c,e+=`
|
||
`,Co(this,t,-1,-1),t.piece.length===0&&i.push(t)}const n=this.createNewPieces(e);let s=this.rbInsertLeft(t,n[n.length-1]);for(let r=n.length-2;r>=0;r--)s=this.rbInsertLeft(s,n[r]);this.validateCRLFWithPrevNode(s),this.deleteNodes(i)}insertContentToNodeRight(e,t){this.adjustCarriageReturnFromNext(e,t)&&(e+=`
|
||
`);const i=this.createNewPieces(e),n=this.rbInsertRight(t,i[0]);let s=n;for(let r=1;r<i.length;r++)s=this.rbInsertRight(s,i[r]);this.validateCRLFWithPrevNode(n)}positionInBuffer(e,t,i){const n=e.piece,s=e.piece.bufferIndex,r=this._buffers[s].lineStarts,c=r[n.start.line]+n.start.column+t;let h=n.start.line,d=n.end.line,u=0,f=0,g=0;for(;h<=d&&(u=h+(d-h)/2|0,g=r[u],u!==d);)if(f=r[u+1],c<g)d=u-1;else if(c>=f)h=u+1;else break;return i?(i.line=u,i.column=c-g,null):{line:u,column:c-g}}getLineFeedCnt(e,t,i){if(i.column===0)return i.line-t.line;const n=this._buffers[e].lineStarts;if(i.line===n.length-1)return i.line-t.line;const s=n[i.line+1],r=n[i.line]+i.column;if(s>r+1)return i.line-t.line;const a=r-1;return this._buffers[e].buffer.charCodeAt(a)===13?i.line-t.line+1:i.line-t.line}offsetInBuffer(e,t){return this._buffers[e].lineStarts[t.line]+t.column}deleteNodes(e){for(let t=0;t<e.length;t++)Am(this,e[t])}createNewPieces(e){if(e.length>vo){const d=[];for(;e.length>vo;){const f=e.charCodeAt(vo-1);let g;f===13||f>=55296&&f<=56319?(g=e.substring(0,vo-1),e=e.substring(vo-1)):(g=e.substring(0,vo),e=e.substring(vo));const m=wo(g);d.push(new Gi(this._buffers.length,{line:0,column:0},{line:m.length-1,column:g.length-m[m.length-1]},m.length-1,g.length)),this._buffers.push(new Pa(g,m))}const u=wo(e);return d.push(new Gi(this._buffers.length,{line:0,column:0},{line:u.length-1,column:e.length-u[u.length-1]},u.length-1,e.length)),this._buffers.push(new Pa(e,u)),d}let t=this._buffers[0].buffer.length;const i=wo(e,!1);let n=this._lastChangeBufferPos;if(this._buffers[0].lineStarts[this._buffers[0].lineStarts.length-1]===t&&t!==0&&this.startWithLF(e)&&this.endWithCR(this._buffers[0].buffer)){this._lastChangeBufferPos={line:this._lastChangeBufferPos.line,column:this._lastChangeBufferPos.column+1},n=this._lastChangeBufferPos;for(let d=0;d<i.length;d++)i[d]+=t+1;this._buffers[0].lineStarts=this._buffers[0].lineStarts.concat(i.slice(1)),this._buffers[0].buffer+="_"+e,t+=1}else{if(t!==0)for(let d=0;d<i.length;d++)i[d]+=t;this._buffers[0].lineStarts=this._buffers[0].lineStarts.concat(i.slice(1)),this._buffers[0].buffer+=e}const s=this._buffers[0].buffer.length,r=this._buffers[0].lineStarts.length-1,a=s-this._buffers[0].lineStarts[r],c={line:r,column:a},h=new Gi(0,n,c,this.getLineFeedCnt(0,n,c),s-t);return this._lastChangeBufferPos=c,[h]}getLineRawContent(e,t=0){let i=this.root,n="";const s=this._searchCache.get2(e);if(s){i=s.node;const r=this.getAccumulatedValue(i,e-s.nodeStartLineNumber-1),a=this._buffers[i.piece.bufferIndex].buffer,c=this.offsetInBuffer(i.piece.bufferIndex,i.piece.start);if(s.nodeStartLineNumber+i.piece.lineFeedCnt===e)n=a.substring(c+r,c+i.piece.length);else{const h=this.getAccumulatedValue(i,e-s.nodeStartLineNumber);return a.substring(c+r,c+h-t)}}else{let r=0;const a=e;for(;i!==ie;)if(i.left!==ie&&i.lf_left>=e-1)i=i.left;else if(i.lf_left+i.piece.lineFeedCnt>e-1){const c=this.getAccumulatedValue(i,e-i.lf_left-2),h=this.getAccumulatedValue(i,e-i.lf_left-1),d=this._buffers[i.piece.bufferIndex].buffer,u=this.offsetInBuffer(i.piece.bufferIndex,i.piece.start);return r+=i.size_left,this._searchCache.set({node:i,nodeStartOffset:r,nodeStartLineNumber:a-(e-1-i.lf_left)}),d.substring(u+c,u+h-t)}else if(i.lf_left+i.piece.lineFeedCnt===e-1){const c=this.getAccumulatedValue(i,e-i.lf_left-2),h=this._buffers[i.piece.bufferIndex].buffer,d=this.offsetInBuffer(i.piece.bufferIndex,i.piece.start);n=h.substring(d+c,d+i.piece.length);break}else e-=i.lf_left+i.piece.lineFeedCnt,r+=i.size_left+i.piece.length,i=i.right}for(i=i.next();i!==ie;){const r=this._buffers[i.piece.bufferIndex].buffer;if(i.piece.lineFeedCnt>0){const a=this.getAccumulatedValue(i,0),c=this.offsetInBuffer(i.piece.bufferIndex,i.piece.start);return n+=r.substring(c,c+a-t),n}else{const a=this.offsetInBuffer(i.piece.bufferIndex,i.piece.start);n+=r.substr(a,i.piece.length)}i=i.next()}return n}computeBufferMetadata(){let e=this.root,t=1,i=0;for(;e!==ie;)t+=e.lf_left+e.piece.lineFeedCnt,i+=e.size_left+e.piece.length,e=e.right;this._lineCnt=t,this._length=i,this._searchCache.validate(this._length)}getIndexOf(e,t){const i=e.piece,n=this.positionInBuffer(e,t),s=n.line-i.start.line;if(this.offsetInBuffer(i.bufferIndex,i.end)-this.offsetInBuffer(i.bufferIndex,i.start)===t){const r=this.getLineFeedCnt(e.piece.bufferIndex,i.start,n);if(r!==s)return{index:r,remainder:0}}return{index:s,remainder:n.column}}getAccumulatedValue(e,t){if(t<0)return 0;const i=e.piece,n=this._buffers[i.bufferIndex].lineStarts,s=i.start.line+t+1;return s>i.end.line?n[i.end.line]+i.end.column-n[i.start.line]-i.start.column:n[s]-n[i.start.line]-i.start.column}deleteNodeTail(e,t){const i=e.piece,n=i.lineFeedCnt,s=this.offsetInBuffer(i.bufferIndex,i.end),r=t,a=this.offsetInBuffer(i.bufferIndex,r),c=this.getLineFeedCnt(i.bufferIndex,i.start,r),h=c-n,d=a-s,u=i.length+d;e.piece=new Gi(i.bufferIndex,i.start,r,c,u),Co(this,e,d,h)}deleteNodeHead(e,t){const i=e.piece,n=i.lineFeedCnt,s=this.offsetInBuffer(i.bufferIndex,i.start),r=t,a=this.getLineFeedCnt(i.bufferIndex,r,i.end),c=this.offsetInBuffer(i.bufferIndex,r),h=a-n,d=s-c,u=i.length+d;e.piece=new Gi(i.bufferIndex,r,i.end,a,u),Co(this,e,d,h)}shrinkNode(e,t,i){const n=e.piece,s=n.start,r=n.end,a=n.length,c=n.lineFeedCnt,h=t,d=this.getLineFeedCnt(n.bufferIndex,n.start,h),u=this.offsetInBuffer(n.bufferIndex,t)-this.offsetInBuffer(n.bufferIndex,s);e.piece=new Gi(n.bufferIndex,n.start,h,d,u),Co(this,e,u-a,d-c);const f=new Gi(n.bufferIndex,i,r,this.getLineFeedCnt(n.bufferIndex,i,r),this.offsetInBuffer(n.bufferIndex,r)-this.offsetInBuffer(n.bufferIndex,i)),g=this.rbInsertRight(e,f);this.validateCRLFWithPrevNode(g)}appendToNode(e,t){this.adjustCarriageReturnFromNext(t,e)&&(t+=`
|
||
`);const i=this.shouldCheckCRLF()&&this.startWithLF(t)&&this.endWithCR(e),n=this._buffers[0].buffer.length;this._buffers[0].buffer+=t;const s=wo(t,!1);for(let g=0;g<s.length;g++)s[g]+=n;if(i){const g=this._buffers[0].lineStarts[this._buffers[0].lineStarts.length-2];this._buffers[0].lineStarts.pop(),this._lastChangeBufferPos={line:this._lastChangeBufferPos.line-1,column:n-g}}this._buffers[0].lineStarts=this._buffers[0].lineStarts.concat(s.slice(1));const r=this._buffers[0].lineStarts.length-1,a=this._buffers[0].buffer.length-this._buffers[0].lineStarts[r],c={line:r,column:a},h=e.piece.length+t.length,d=e.piece.lineFeedCnt,u=this.getLineFeedCnt(0,e.piece.start,c),f=u-d;e.piece=new Gi(e.piece.bufferIndex,e.piece.start,c,u,h),this._lastChangeBufferPos=c,Co(this,e,t.length,f)}nodeAt(e){let t=this.root;const i=this._searchCache.get(e);if(i)return{node:i.node,nodeStartOffset:i.nodeStartOffset,remainder:e-i.nodeStartOffset};let n=0;for(;t!==ie;)if(t.size_left>e)t=t.left;else if(t.size_left+t.piece.length>=e){n+=t.size_left;const s={node:t,remainder:e-t.size_left,nodeStartOffset:n};return this._searchCache.set(s),s}else e-=t.size_left+t.piece.length,n+=t.size_left+t.piece.length,t=t.right;return null}nodeAt2(e,t){let i=this.root,n=0;for(;i!==ie;)if(i.left!==ie&&i.lf_left>=e-1)i=i.left;else if(i.lf_left+i.piece.lineFeedCnt>e-1){const s=this.getAccumulatedValue(i,e-i.lf_left-2),r=this.getAccumulatedValue(i,e-i.lf_left-1);return n+=i.size_left,{node:i,remainder:Math.min(s+t-1,r),nodeStartOffset:n}}else if(i.lf_left+i.piece.lineFeedCnt===e-1){const s=this.getAccumulatedValue(i,e-i.lf_left-2);if(s+t-1<=i.piece.length)return{node:i,remainder:s+t-1,nodeStartOffset:n};t-=i.piece.length-s;break}else e-=i.lf_left+i.piece.lineFeedCnt,n+=i.size_left+i.piece.length,i=i.right;for(i=i.next();i!==ie;){if(i.piece.lineFeedCnt>0){const s=this.getAccumulatedValue(i,0),r=this.offsetOfNode(i);return{node:i,remainder:Math.min(t-1,s),nodeStartOffset:r}}else if(i.piece.length>=t-1){const s=this.offsetOfNode(i);return{node:i,remainder:t-1,nodeStartOffset:s}}else t-=i.piece.length;i=i.next()}return null}nodeCharCodeAt(e,t){if(e.piece.lineFeedCnt<1)return-1;const i=this._buffers[e.piece.bufferIndex],n=this.offsetInBuffer(e.piece.bufferIndex,e.piece.start)+t;return i.buffer.charCodeAt(n)}offsetOfNode(e){if(!e)return 0;let t=e.size_left;for(;e!==this.root;)e.parent.right===e&&(t+=e.parent.size_left+e.parent.piece.length),e=e.parent;return t}shouldCheckCRLF(){return!(this._EOLNormalized&&this._EOL===`
|
||
`)}startWithLF(e){if(typeof e=="string")return e.charCodeAt(0)===10;if(e===ie||e.piece.lineFeedCnt===0)return!1;const t=e.piece,i=this._buffers[t.bufferIndex].lineStarts,n=t.start.line,s=i[n]+t.start.column;return n===i.length-1||i[n+1]>s+1?!1:this._buffers[t.bufferIndex].buffer.charCodeAt(s)===10}endWithCR(e){return typeof e=="string"?e.charCodeAt(e.length-1)===13:e===ie||e.piece.lineFeedCnt===0?!1:this.nodeCharCodeAt(e,e.piece.length-1)===13}validateCRLFWithPrevNode(e){if(this.shouldCheckCRLF()&&this.startWithLF(e)){const t=e.prev();this.endWithCR(t)&&this.fixCRLF(t,e)}}validateCRLFWithNextNode(e){if(this.shouldCheckCRLF()&&this.endWithCR(e)){const t=e.next();this.startWithLF(t)&&this.fixCRLF(e,t)}}fixCRLF(e,t){const i=[],n=this._buffers[e.piece.bufferIndex].lineStarts;let s;e.piece.end.column===0?s={line:e.piece.end.line-1,column:n[e.piece.end.line]-n[e.piece.end.line-1]-1}:s={line:e.piece.end.line,column:e.piece.end.column-1};const r=e.piece.length-1,a=e.piece.lineFeedCnt-1;e.piece=new Gi(e.piece.bufferIndex,e.piece.start,s,a,r),Co(this,e,-1,-1),e.piece.length===0&&i.push(e);const c={line:t.piece.start.line+1,column:0},h=t.piece.length-1,d=this.getLineFeedCnt(t.piece.bufferIndex,c,t.piece.end);t.piece=new Gi(t.piece.bufferIndex,c,t.piece.end,d,h),Co(this,t,-1,-1),t.piece.length===0&&i.push(t);const u=this.createNewPieces(`\r
|
||
`);this.rbInsertRight(e,u[0]);for(let f=0;f<i.length;f++)Am(this,i[f])}adjustCarriageReturnFromNext(e,t){if(this.shouldCheckCRLF()&&this.endWithCR(e)){const i=t.next();if(this.startWithLF(i)){if(e+=`
|
||
`,i.piece.length===1)Am(this,i);else{const n=i.piece,s={line:n.start.line+1,column:0},r=n.length-1,a=this.getLineFeedCnt(n.bufferIndex,s,n.end);i.piece=new Gi(n.bufferIndex,s,n.end,a,r),Co(this,i,-1,-1)}return!0}}return!1}iterate(e,t){if(e===ie)return t(ie);const i=this.iterate(e.left,t);return i&&t(e)&&this.iterate(e.right,t)}getNodeContent(e){if(e===ie)return"";const t=this._buffers[e.piece.bufferIndex],i=e.piece,n=this.offsetInBuffer(i.bufferIndex,i.start),s=this.offsetInBuffer(i.bufferIndex,i.end);return t.buffer.substring(n,s)}getPieceContent(e){const t=this._buffers[e.bufferIndex],i=this.offsetInBuffer(e.bufferIndex,e.start),n=this.offsetInBuffer(e.bufferIndex,e.end);return t.buffer.substring(i,n)}rbInsertRight(e,t){const i=new Ow(t,1);if(i.left=ie,i.right=ie,i.parent=ie,i.size_left=0,i.lf_left=0,this.root===ie)this.root=i,i.color=0;else if(e.right===ie)e.right=i,i.parent=e;else{const s=Pw(e.right);s.left=i,i.parent=s}return v1(this,i),i}rbInsertLeft(e,t){const i=new Ow(t,1);if(i.left=ie,i.right=ie,i.parent=ie,i.size_left=0,i.lf_left=0,this.root===ie)this.root=i,i.color=0;else if(e.left===ie)e.left=i,i.parent=e;else{const n=C1(e.left);n.right=i,i.parent=n}return v1(this,i),i}}class Rc extends l.Disposable{constructor(e,t,i,n,s,r,a){super(),this._onDidChangeContent=this._register(new l.Emitter),this._BOM=t,this._mightContainNonBasicASCII=!r,this._mightContainRTL=n,this._mightContainUnusualLineTerminators=s,this._pieceTree=new _K(e,i,a)}mightContainRTL(){return this._mightContainRTL}mightContainUnusualLineTerminators(){return this._mightContainUnusualLineTerminators}resetMightContainUnusualLineTerminators(){this._mightContainUnusualLineTerminators=!1}mightContainNonBasicASCII(){return this._mightContainNonBasicASCII}getBOM(){return this._BOM}getEOL(){return this._pieceTree.getEOL()}createSnapshot(e){return this._pieceTree.createSnapshot(e?this._BOM:"")}getOffsetAt(e,t){return this._pieceTree.getOffsetAt(e,t)}getPositionAt(e){return this._pieceTree.getPositionAt(e)}getRangeAt(e,t){const i=e+t,n=this.getPositionAt(e),s=this.getPositionAt(i);return new l.Range(n.lineNumber,n.column,s.lineNumber,s.column)}getValueInRange(e,t=0){if(e.isEmpty())return"";const i=this._getEndOfLine(t);return this._pieceTree.getValueInRange(e,i)}getValueLengthInRange(e,t=0){if(e.isEmpty())return 0;if(e.startLineNumber===e.endLineNumber)return e.endColumn-e.startColumn;const i=this.getOffsetAt(e.startLineNumber,e.startColumn),n=this.getOffsetAt(e.endLineNumber,e.endColumn);let s=0;const r=this._getEndOfLine(t),a=this.getEOL();if(r.length!==a.length){const c=r.length-a.length,h=e.endLineNumber-e.startLineNumber;s=c*h}return n-i+s}getCharacterCountInRange(e,t=0){if(this._mightContainNonBasicASCII){let i=0;const n=e.startLineNumber,s=e.endLineNumber;for(let r=n;r<=s;r++){const a=this.getLineContent(r),c=r===n?e.startColumn-1:0,h=r===s?e.endColumn-1:a.length;for(let d=c;d<h;d++)l.isHighSurrogate(a.charCodeAt(d))?(i=i+1,d=d+1):i=i+1}return i+=this._getEndOfLine(t).length*(s-n),i}return this.getValueLengthInRange(e,t)}getNearestChunk(e){return this._pieceTree.getNearestChunk(e)}getLength(){return this._pieceTree.getLength()}getLineCount(){return this._pieceTree.getLineCount()}getLinesContent(){return this._pieceTree.getLinesContent()}getLineContent(e){return this._pieceTree.getLineContent(e)}getLineCharCode(e,t){return this._pieceTree.getLineCharCode(e,t)}getLineLength(e){return this._pieceTree.getLineLength(e)}getLineFirstNonWhitespaceColumn(e){const t=l.firstNonWhitespaceIndex(this.getLineContent(e));return t===-1?0:t+1}getLineLastNonWhitespaceColumn(e){const t=l.lastNonWhitespaceIndex(this.getLineContent(e));return t===-1?0:t+2}_getEndOfLine(e){switch(e){case 1:return`
|
||
`;case 2:return`\r
|
||
`;case 0:return this.getEOL();default:throw new Error("Unknown EOL preference")}}setEOL(e){this._pieceTree.setEOL(e)}applyEdits(e,t,i){let n=this._mightContainRTL,s=this._mightContainUnusualLineTerminators,r=this._mightContainNonBasicASCII,a=!0,c=[];for(let p=0;p<e.length;p++){const b=e[p];a&&b._isTracked&&(a=!1);const v=b.range;if(b.text){let D=!0;r||(D=!l.isBasicASCII(b.text),r=D),!n&&D&&(n=l.containsRTL(b.text)),!s&&D&&(s=l.containsUnusualLineTerminators(b.text))}let C="",w=0,S=0,L=0;if(b.text){let D;[w,S,L,D]=fr(b.text);const x=this.getEOL();D===0||D===(x===`\r
|
||
`?2:1)?C=b.text:C=b.text.replace(/\r\n|\r|\n/g,x)}c[p]={sortIndex:p,identifier:b.identifier||null,range:v,rangeOffset:this.getOffsetAt(v.startLineNumber,v.startColumn),rangeLength:this.getValueLengthInRange(v),text:C,eolCount:w,firstLineLength:S,lastLineLength:L,forceMoveMarkers:!!b.forceMoveMarkers,isAutoWhitespaceEdit:b.isAutoWhitespaceEdit||!1}}c.sort(Rc._sortOpsAscending);let h=!1;for(let p=0,b=c.length-1;p<b;p++){const v=c[p].range.getEndPosition(),C=c[p+1].range.getStartPosition();if(C.isBeforeOrEqual(v)){if(C.isBefore(v))throw new Error("Overlapping ranges are not allowed!");h=!0}}a&&(c=this._reduceOperations(c));const d=i||t?Rc._getInverseEditRanges(c):[],u=[];if(t)for(let p=0;p<c.length;p++){const b=c[p],v=d[p];if(b.isAutoWhitespaceEdit&&b.range.isEmpty())for(let C=v.startLineNumber;C<=v.endLineNumber;C++){let w="";C===v.startLineNumber&&(w=this.getLineContent(b.range.startLineNumber),l.firstNonWhitespaceIndex(w)!==-1)||u.push({lineNumber:C,oldContent:w})}}let f=null;if(i){let p=0;f=[];for(let b=0;b<c.length;b++){const v=c[b],C=d[b],w=this.getValueInRange(v.range),S=v.rangeOffset+p;p+=v.text.length-w.length,f[b]={sortIndex:v.sortIndex,identifier:v.identifier,range:C,text:w,textChange:new Gt(v.rangeOffset,w,S,v.text)}}h||f.sort((b,v)=>b.sortIndex-v.sortIndex)}this._mightContainRTL=n,this._mightContainUnusualLineTerminators=s,this._mightContainNonBasicASCII=r;const g=this._doApplyEdits(c);let m=null;if(t&&u.length>0){u.sort((p,b)=>b.lineNumber-p.lineNumber),m=[];for(let p=0,b=u.length;p<b;p++){const v=u[p].lineNumber;if(p>0&&u[p-1].lineNumber===v)continue;const C=u[p].oldContent,w=this.getLineContent(v);w.length===0||w===C||l.firstNonWhitespaceIndex(w)!==-1||m.push(v)}}return this._onDidChangeContent.fire(),new l.ApplyEditsResult(f,g,m)}_reduceOperations(e){return e.length<1e3?e:[this._toSingleEditOperation(e)]}_toSingleEditOperation(e){let t=!1;const i=e[0].range,n=e[e.length-1].range,s=new l.Range(i.startLineNumber,i.startColumn,n.endLineNumber,n.endColumn);let r=i.startLineNumber,a=i.startColumn;const c=[];for(let g=0,m=e.length;g<m;g++){const p=e[g],b=p.range;t=t||p.forceMoveMarkers,c.push(this.getValueInRange(new l.Range(r,a,b.startLineNumber,b.startColumn))),p.text.length>0&&c.push(p.text),r=b.endLineNumber,a=b.endColumn}const h=c.join(""),[d,u,f]=fr(h);return{sortIndex:0,identifier:e[0].identifier,range:s,rangeOffset:this.getOffsetAt(s.startLineNumber,s.startColumn),rangeLength:this.getValueLengthInRange(s,0),text:h,eolCount:d,firstLineLength:u,lastLineLength:f,forceMoveMarkers:t,isAutoWhitespaceEdit:!1}}_doApplyEdits(e){e.sort(Rc._sortOpsDescending);const t=[];for(let i=0;i<e.length;i++){const n=e[i],s=n.range.startLineNumber,r=n.range.startColumn,a=n.range.endLineNumber,c=n.range.endColumn;if(s===a&&r===c&&n.text.length===0)continue;n.text?(this._pieceTree.delete(n.rangeOffset,n.rangeLength),this._pieceTree.insert(n.rangeOffset,n.text,!0)):this._pieceTree.delete(n.rangeOffset,n.rangeLength);const h=new l.Range(s,r,a,c);t.push({range:h,rangeLength:n.rangeLength,text:n.text,rangeOffset:n.rangeOffset,forceMoveMarkers:n.forceMoveMarkers})}return t}findMatchesLineByLine(e,t,i,n){return this._pieceTree.findMatchesLineByLine(e,t,i,n)}static _getInverseEditRanges(e){const t=[];let i=0,n=0,s=null;for(let r=0,a=e.length;r<a;r++){const c=e[r];let h,d;s?s.range.endLineNumber===c.range.startLineNumber?(h=i,d=n+(c.range.startColumn-s.range.endColumn)):(h=i+(c.range.startLineNumber-s.range.endLineNumber),d=c.range.startColumn):(h=c.range.startLineNumber,d=c.range.startColumn);let u;if(c.text.length>0){const f=c.eolCount+1;f===1?u=new l.Range(h,d,h,d+c.firstLineLength):u=new l.Range(h,d,h+f-1,c.lastLineLength+1)}else u=new l.Range(h,d,h,d);i=u.endLineNumber,n=u.endColumn,t.push(u),s=c}return t}static _sortOpsAscending(e,t){const i=l.Range.compareRangesUsingEnds(e.range,t.range);return i===0?e.sortIndex-t.sortIndex:i}static _sortOpsDescending(e,t){const i=l.Range.compareRangesUsingEnds(e.range,t.range);return i===0?t.sortIndex-e.sortIndex:-i}}class bK{constructor(e,t,i,n,s,r,a,c,h){this._chunks=e,this._bom=t,this._cr=i,this._lf=n,this._crlf=s,this._containsRTL=r,this._containsUnusualLineTerminators=a,this._isBasicASCII=c,this._normalizeEOL=h}_getEOL(e){const t=this._cr+this._lf+this._crlf,i=this._cr+this._crlf;return t===0?e===1?`
|
||
`:`\r
|
||
`:i>t/2?`\r
|
||
`:`
|
||
`}create(e){const t=this._getEOL(e),i=this._chunks;if(this._normalizeEOL&&(t===`\r
|
||
`&&(this._cr>0||this._lf>0)||t===`
|
||
`&&(this._cr>0||this._crlf>0)))for(let s=0,r=i.length;s<r;s++){const a=i[s].buffer.replace(/\r\n|\r|\n/g,t),c=wo(a);i[s]=new Pa(a,c)}const n=new Rc(i,this._bom,t,this._containsRTL,this._containsUnusualLineTerminators,this._isBasicASCII,this._normalizeEOL);return{textBuffer:n,disposable:n}}}class S1{constructor(){this.chunks=[],this.BOM="",this._hasPreviousChar=!1,this._previousChar=0,this._tmpLineStarts=[],this.cr=0,this.lf=0,this.crlf=0,this.containsRTL=!1,this.containsUnusualLineTerminators=!1,this.isBasicASCII=!0}acceptChunk(e){if(e.length===0)return;this.chunks.length===0&&l.startsWithUTF8BOM(e)&&(this.BOM=l.UTF8_BOM_CHARACTER,e=e.substr(1));const t=e.charCodeAt(e.length-1);t===13||t>=55296&&t<=56319?(this._acceptChunk1(e.substr(0,e.length-1),!1),this._hasPreviousChar=!0,this._previousChar=t):(this._acceptChunk1(e,!1),this._hasPreviousChar=!1,this._previousChar=t)}_acceptChunk1(e,t){!t&&e.length===0||(this._hasPreviousChar?this._acceptChunk2(String.fromCharCode(this._previousChar)+e):this._acceptChunk2(e))}_acceptChunk2(e){const t=gK(this._tmpLineStarts,e);this.chunks.push(new Pa(e,t.lineStarts)),this.cr+=t.cr,this.lf+=t.lf,this.crlf+=t.crlf,t.isBasicASCII||(this.isBasicASCII=!1,this.containsRTL||(this.containsRTL=l.containsRTL(e)),this.containsUnusualLineTerminators||(this.containsUnusualLineTerminators=l.containsUnusualLineTerminators(e)))}finish(e=!0){return this._finish(),new bK(this.chunks,this.BOM,this.cr,this.lf,this.crlf,this.containsRTL,this.containsUnusualLineTerminators,this.isBasicASCII,e)}_finish(){if(this.chunks.length===0&&this._acceptChunk1("",!0),this._hasPreviousChar){this._hasPreviousChar=!1;const e=this.chunks[this.chunks.length-1];e.buffer+=String.fromCharCode(this._previousChar);const t=wo(e.buffer);e.lineStarts=t,this._previousChar===13&&this.cr++}}}class CK{constructor(){this._onDidChangeVisibleRanges=new l.Emitter,this.onDidChangeVisibleRanges=this._onDidChangeVisibleRanges.event,this._views=new Set,this._viewsChanged=qr(this),this.visibleLineRanges=fn({owner:this,equalsFn:Zh(Qb())},e=>(this._viewsChanged.read(e),l.LineRange.joinMany([...this._views].map(i=>i.state.read(e)?.visibleLineRanges??[]))))}attachView(){const e=new wK(t=>{this._onDidChangeVisibleRanges.fire({view:e,state:t})});return this._views.add(e),this._viewsChanged.trigger(void 0),e}detachView(e){this._views.delete(e),this._onDidChangeVisibleRanges.fire({view:e,state:void 0}),this._viewsChanged.trigger(void 0)}dispose(){this._onDidChangeVisibleRanges.dispose()}}class vK{constructor(e,t){this.visibleLineRanges=e,this.stabilized=t}equals(e){return this===e?!0:!(!l.equals(this.visibleLineRanges,e.visibleLineRanges,(t,i)=>t.equals(i))||this.stabilized!==e.stabilized)}}class wK{get state(){return this._state}constructor(e){this.handleStateChange=e,this._state=Wh({owner:this,equalsFn:Gr((t,i)=>t.equals(i))},void 0)}setVisibleLines(e,t){const i=e.map(s=>new l.LineRange(s.startLineNumber,s.endLineNumber+1)),n=new vK(i,t);this._state.set(n,void 0,void 0),this.handleStateChange(n)}}class SK extends l.Disposable{get lineRanges(){return this._lineRanges}constructor(e){super(),this._refreshTokens=e,this.runner=this._register(new l.RunOnceScheduler(()=>this.update(),50)),this._computedLineRanges=[],this._lineRanges=[]}update(){l.equals(this._computedLineRanges,this._lineRanges,(e,t)=>e.equals(t))||(this._computedLineRanges=this._lineRanges,this._refreshTokens())}handleStateChange(e){this._lineRanges=e.visibleLineRanges,e.stabilized?(this.runner.cancel(),this.update()):this.runner.schedule()}}class y1 extends l.Disposable{get backgroundTokenizationState(){return this._backgroundTokenizationState}constructor(e,t){super(),this._languageIdCodec=e,this._textModel=t,this._onDidChangeTokens=this._register(new l.Emitter),this.onDidChangeTokens=this._onDidChangeTokens.event,this._onDidChangeFontTokens=this._register(new l.Emitter),this.onDidChangeFontTokens=this._onDidChangeFontTokens.event}tokenizeIfCheap(e){this.isCheapToTokenize(e)&&this.forceTokenization(e)}}class uu{static toKey(e){return`${e.ownerId};${e.decorationId};${e.lineNumber}`}constructor(e,t,i,n){this.ownerId=e,this.decorationId=t,this.lineNumber=i,this.lineHeight=n}}class fu{static toKey(e){return`${e.ownerId};${e.decorationId};${e.lineNumber}`}constructor(e,t,i){this.ownerId=e,this.decorationId=t,this.lineNumber=i}}class yK{constructor(e,t,i,n,s){this._parsedThemeRuleBrand=void 0,this.token=e,this.index=t,this.fontStyle=i,this.foreground=n,this.background=s}}function LK(o){if(!o||!Array.isArray(o))return[];const e=[];let t=0;for(let i=0,n=o.length;i<n;i++){const s=o[i];let r=-1;if(typeof s.fontStyle=="string"){r=0;const h=s.fontStyle.split(" ");for(let d=0,u=h.length;d<u;d++)switch(h[d]){case"italic":r=r|1;break;case"bold":r=r|2;break;case"underline":r=r|4;break;case"strikethrough":r=r|8;break}}let a=null;typeof s.foreground=="string"&&(a=s.foreground);let c=null;typeof s.background=="string"&&(c=s.background),e[t++]=new yK(s.token||"",i,r,a,c)}return e}function DK(o,e){o.sort((d,u)=>{const f=NK(d.token,u.token);return f!==0?f:d.index-u.index});let t=0,i="000000",n="ffffff";for(;o.length>=1&&o[0].token==="";){const d=o.shift();d.fontStyle!==-1&&(t=d.fontStyle),d.foreground!==null&&(i=d.foreground),d.background!==null&&(n=d.background)}const s=new EK;for(const d of e)s.getId(d);const r=s.getId(i),a=s.getId(n),c=new zw(t,r,a),h=new Vw(c);for(let d=0,u=o.length;d<u;d++){const f=o[d];h.insert(f.token,f.fontStyle,s.getId(f.foreground),s.getId(f.background))}return new L1(s,h)}const xK=/^#?([0-9A-Fa-f]{6})([0-9A-Fa-f]{2})?$/;class EK{constructor(){this._lastColorId=0,this._id2color=[],this._color2id=new Map}getId(e){if(e===null)return 0;const t=e.match(xK);if(!t)throw new Error("Illegal value for token color: "+e);e=t[1].toUpperCase();let i=this._color2id.get(e);return i||(i=++this._lastColorId,this._color2id.set(e,i),this._id2color[i]=l.Color.fromHex("#"+e),i)}getColorMap(){return this._id2color.slice(0)}}class L1{static createFromRawTokenTheme(e,t){return this.createFromParsedTokenTheme(LK(e),t)}static createFromParsedTokenTheme(e,t){return DK(e,t)}constructor(e,t){this._colorMap=e,this._root=t,this._cache=new Map}getColorMap(){return this._colorMap.getColorMap()}_match(e){return this._root.match(e)}match(e,t){let i=this._cache.get(t);if(typeof i>"u"){const n=this._match(t),s=TK(t);i=(n.metadata|s<<8)>>>0,this._cache.set(t,i)}return(i|e<<0)>>>0}}const IK=/\b(comment|string|regex|regexp)\b/;function TK(o){const e=o.match(IK);if(!e)return 0;switch(e[1]){case"comment":return 1;case"string":return 2;case"regex":return 3;case"regexp":return 3}throw new Error("Unexpected match for standard token type!")}function NK(o,e){return o<e?-1:o>e?1:0}class zw{constructor(e,t,i){this._themeTrieElementRuleBrand=void 0,this._fontStyle=e,this._foreground=t,this._background=i,this.metadata=(this._fontStyle<<11|this._foreground<<15|this._background<<24)>>>0}clone(){return new zw(this._fontStyle,this._foreground,this._background)}acceptOverwrite(e,t,i){e!==-1&&(this._fontStyle=e),t!==0&&(this._foreground=t),i!==0&&(this._background=i),this.metadata=(this._fontStyle<<11|this._foreground<<15|this._background<<24)>>>0}}class Vw{constructor(e){this._themeTrieElementBrand=void 0,this._mainRule=e,this._children=new Map}match(e){if(e==="")return this._mainRule;const t=e.indexOf(".");let i,n;t===-1?(i=e,n=""):(i=e.substring(0,t),n=e.substring(t+1));const s=this._children.get(i);return typeof s<"u"?s.match(n):this._mainRule}insert(e,t,i,n){if(e===""){this._mainRule.acceptOverwrite(t,i,n);return}const s=e.indexOf(".");let r,a;s===-1?(r=e,a=""):(r=e.substring(0,s),a=e.substring(s+1));let c=this._children.get(r);typeof c>"u"&&(c=new Vw(this._mainRule.clone()),this._children.set(r,c)),c.insert(a,t,i,n)}}function RK(o){const e=[];for(let t=1,i=o.length;t<i;t++){const n=o[t];e[t]=`.mtk${t} { color: ${n}; }`}return e.push(".mtki { font-style: italic; }"),e.push(".mtkb { font-weight: bold; }"),e.push(".mtku { text-decoration: underline; text-underline-position: under; }"),e.push(".mtks { text-decoration: line-through; }"),e.push(".mtks.mtku { text-decoration: underline line-through; text-underline-position: under; }"),e.join(`
|
||
`)}function MK(o,e){const t=AK(o);return D1(`font-decoration-${t}-${e}`)}function AK(o){const e=o.toLowerCase().trim();return e?D1(e):"default"}function D1(o){return o.replace(/[^a-z0-9_-]/gi,"-")}class OK{constructor(e=[]){this._annotations=[],this._annotations=e}setAnnotations(e){for(const t of e.annotations){const i=this._getStartIndexOfIntersectingAnnotation(t.range.start),n=this._getEndIndexOfIntersectingAnnotation(t.range.endExclusive);t.annotation!==void 0?this._annotations.splice(i,n-i,{range:t.range,annotation:t.annotation}):this._annotations.splice(i,n-i)}}getAnnotationsIntersecting(e){const t=this._getStartIndexOfIntersectingAnnotation(e.start),i=this._getEndIndexOfIntersectingAnnotation(e.endExclusive);return this._annotations.slice(t,i)}_getStartIndexOfIntersectingAnnotation(e){const t=l.binarySearch2(this._annotations.length,n=>this._annotations[n].range.start-e);let i;if(t>=0){i=t;const n=this._annotations[i]?.range;n&&n.endExclusive===e&&i--}else{const n=this._annotations[-(t+2)]?.range;n&&e>=n.start&&e<n.endExclusive?i=-(t+2):i=-(t+1)}return i}_getEndIndexOfIntersectingAnnotation(e){const t=l.binarySearch2(this._annotations.length,n=>this._annotations[n].range.endExclusive-e);let i;if(t>=0){i=t+1;const n=this._annotations[i]?.range;n&&n.start===e&&i++}else{const n=this._annotations[-(t+1)]?.range;n&&e>=n.start&&e<=n.endExclusive?i=-t:i=-(t+1)}return i}applyEdit(e){const t=this._annotations.slice(),i=[],n=[];let s=0;for(const r of e.replacements){for(;;){const c=t[0];if(!c)break;const h=c.range;if(h.endExclusive>=r.replaceRange.start)break;t.shift();const d={range:h.delta(s),annotation:c.annotation};d.range.isEmpty?n.push(d):i.push(d)}const a=[];for(;;){const c=t[0];if(!c||!c.range.intersectsOrTouches(r.replaceRange))break;t.shift(),a.push(c)}for(let c=a.length-1;c>=0;c--){const h=a[c];let d=h.range;const u=c===0&&r.replaceRange.endExclusive>d.start&&r.replaceRange.start<d.endExclusive,f=d.intersect(r.replaceRange).length;d=d.deltaEnd(-f+(u?r.newText.length:0));const g=d.start-r.replaceRange.start;g>0&&(d=d.delta(-g)),!u&&g>=0&&(d=d.delta(r.newText.length)),d=d.delta(-(r.newText.length-r.replaceRange.length)),t.unshift({annotation:h.annotation,range:d})}s+=r.newText.length-r.replaceRange.length}for(;;){const r=t[0];if(!r)break;t.shift();const a={annotation:r.annotation,range:r.range.delta(s)};a.range.isEmpty?n.push(a):i.push(a)}return this._annotations=i,n}}class Uw{static create(e){return new Uw(e)}constructor(e){this._annotations=e}get annotations(){return this._annotations}}function x1(o){const e=o.map(i=>new l.StringReplacement(l.OffsetRange.ofStartAndLength(i.rangeOffset,i.rangeLength),i.text));return e.reverse(),new l.StringEdit(e)}const Cf=class Cf extends l.Disposable{constructor(e,t){super(),this.textModel=e,this.tokenizationTextModelPart=t,this._onDidChangeLineHeight=this._register(new l.Emitter),this.onDidChangeLineHeight=this._onDidChangeLineHeight.event,this._onDidChangeFont=this._register(new l.Emitter),this.onDidChangeFont=this._onDidChangeFont.event,this._fontAnnotatedString=new OK,this._register(this.tokenizationTextModelPart.onDidChangeFontTokens(i=>{const n=new Set,s=[],r=new Set,a=new Set;for(const c of i.changes.annotations){const d=this.textModel.getPositionAt(c.range.start).lineNumber;let u;if(c.annotation===void 0)u={range:c.range,annotation:void 0};else{const f=`tokenization-font-decoration-${Cf.DECORATION_COUNT}`,g={fontToken:c.annotation,decorationId:f};u={range:c.range,annotation:g},Cf.DECORATION_COUNT++,c.annotation.lineHeightMultiplier&&r.add(new uu(0,f,d,c.annotation.lineHeightMultiplier)),a.add(new fu(0,f,d))}if(s.push(u),!n.has(d)){const f=this.textModel.getOffsetAt(new l.Position(d,1)),g=this.textModel.getOffsetAt(new l.Position(d,this.textModel.getLineMaxColumn(d))),m=new l.OffsetRange(f,g),p=this._fontAnnotatedString.getAnnotationsIntersecting(m);for(const b of p){const v=b.annotation.decorationId;r.add(new uu(0,v,d,null)),a.add(new fu(0,v,d))}n.add(d)}}this._fontAnnotatedString.setAnnotations(Uw.create(s)),this._onDidChangeLineHeight.fire(r),this._onDidChangeFont.fire(a)}))}handleDidChangeContent(e){const t=x1(e.changes),i=this._fontAnnotatedString.applyEdit(t);if(i.length===0)return;const n=new Set,s=new Set;for(const r of i){const c=this.textModel.getPositionAt(r.range.start).lineNumber,h=r.annotation.decorationId;n.add(new uu(0,h,c,null)),s.add(new fu(0,h,c))}this._onDidChangeLineHeight.fire(n),this._onDidChangeFont.fire(s)}getDecorationsInRange(e,t,i,n,s){const r=this.textModel.getOffsetAt(e.getStartPosition()),a=this.textModel.getOffsetAt(e.getEndPosition()),c=this._fontAnnotatedString.getAnnotationsIntersecting(new l.OffsetRange(r,a)),h=[];for(const d of c){const u=d.annotation,f=!!(u.fontToken.fontFamily||u.fontToken.fontSizeMultiplier);if(!(f&&n)){const g=this.textModel.getPositionAt(d.range.start),m=this.textModel.getPositionAt(d.range.endExclusive),p=l.Range.fromPositions(g,m),b=d.annotation,v=MK(b.fontToken.fontFamily??"",b.fontToken.fontSizeMultiplier??0),C=b.decorationId;h.push({id:C,options:{description:"FontOptionDecoration",inlineClassName:v,lineHeight:b.fontToken.lineHeightMultiplier,affectsFont:f},ownerId:0,range:p})}}return h}getAllDecorations(e,t){return this.getDecorationsInRange(new l.Range(1,1,this.textModel.getLineCount(),this.textModel.getLineMaxColumn(this.textModel.getLineCount())),e,t)}};Cf.DECORATION_COUNT=0;let $w=Cf;function PK(o,e){const t=o.gotoNextSibling(),i=e.gotoNextSibling();if(t!==i)throw new Error("Trees are out of sync");return t&&i}function E1(o,e){const t=o.gotoParent(),i=e.gotoParent();if(t!==i)throw new Error("Trees are out of sync");return t&&i}function kK(o,e,t){const i=o.gotoFirstChild(),n=e.gotoFirstChild();if(i!==n)throw new Error("Trees are out of sync");if(t===0)return i&&n;for(let s=1;s<=t;s++){const r=o.gotoNextSibling(),a=e.gotoNextSibling();if(r!==a)throw new Error("Trees are out of sync");if(!r||!a)return!1}return i&&n}function I1(o,e){do{if(o.currentNode.nextSibling)return PK(o,e);o.currentNode.parent&&E1(o,e)}while(o.currentNode.nextSibling||o.currentNode.parent);return!1}function FK(o,e){const t=e.walk();t.resetTo(o);const i=o.currentNode;do if(t.currentNode.previousSibling&&t.currentNode.endIndex-t.currentNode.startIndex!==0)t.gotoPreviousSibling();else{for(;!t.currentNode.previousSibling&&t.currentNode.parent;)t.gotoParent();t.gotoPreviousSibling()}while(t.currentNode.endIndex>i.startIndex&&(t.currentNode.parent||t.currentNode.previousSibling)&&t.currentNode.id!==i.id);if(t.currentNode.id!==i.id&&t.currentNode.endIndex<=i.startIndex)return t.currentNode}var BK=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},T1=function(o,e){return function(t,i){e(t,i,o)}};let Kw=class extends l.Disposable{constructor(e,t,i,n,s,r,a){super(),this.languageId=e,this._ranges=t,this._parser=i,this._parserClass=n,this.textModel=s,this._logService=r,this._telemetryService=a,this._tree=W(this,void 0),this.tree=this._tree,this._treeLastParsedVersion=W(this,-1),this.treeLastParsedVersion=this._treeLastParsedVersion,this._onDidChangeContentQueue=new l.TaskQueue,this._tree=W(this,void 0),this.tree=this._tree,this._register(l.toDisposable(()=>{this._tree.get()?.delete(),this._lastFullyParsed?.delete(),this._lastFullyParsedWithEdits?.delete(),this._parser.delete()})),this.handleContentChange(void 0,this._ranges)}handleContentChange(e,t){const i=this.textModel.getVersionId();let n=[];t&&(n=this._setRanges(t)),e&&this._applyEdits(e.changes),this._onDidChangeContentQueue.clearPending(),this._onDidChangeContentQueue.schedule(async()=>{if(this._store.isDisposed)return;const s=this._lastFullyParsed;let r;this._lastFullyParsedWithEdits&&this._lastFullyParsed&&(r=this._findChangedNodes(this._lastFullyParsedWithEdits,this._lastFullyParsed));const a=await this._parseAndUpdateTree(i);if(a){let c;r?s&&r&&(c=this._findTreeChanges(a,r,n)):this._ranges&&(c=this._ranges.map(d=>({newRange:new l.Range(d.startPosition.row+1,d.startPosition.column+1,d.endPosition.row+1,d.endPosition.column+1),oldRangeLength:d.endIndex-d.startIndex,newRangeStartOffset:d.startIndex,newRangeEndOffset:d.endIndex}))),c||(c=[{newRange:this.textModel.getFullModelRange(),newRangeStartOffset:0,newRangeEndOffset:this.textModel.getValueLength()}]);const h=this._tree.get();nt(d=>{this._tree.set(a,d,{ranges:c,versionId:i}),this._treeLastParsedVersion.set(i,d)}),h?.delete()}})}_applyEdits(e){for(const t of e){const i=l.TextLength.ofRange(l.Range.lift(t.range)),n=l.TextLength.ofText(t.text),s=t.text.length===0?n:i.add(n),r={startIndex:t.rangeOffset,oldEndIndex:t.rangeOffset+t.rangeLength,newEndIndex:t.rangeOffset+t.text.length,startPosition:{row:t.range.startLineNumber-1,column:t.range.startColumn-1},oldEndPosition:{row:t.range.endLineNumber-1,column:t.range.endColumn-1},newEndPosition:{row:t.range.startLineNumber+s.lineCount-1,column:s.lineCount?s.columnCount:t.range.endColumn+s.columnCount}};this._tree.get()?.edit(r),this._lastFullyParsedWithEdits?.edit(r)}}_findChangedNodes(e,t){if(this._ranges&&this._ranges.every(a=>a.startPosition.row!==e.rootNode.startPosition.row)||e.rootNode.startPosition.row!==0)return[];const i=e.walk(),n=t.walk(),s=[];let r=!0;do if(i.currentNode.hasChanges){const a=i.currentNode.children,c=[],h=a.filter((d,u)=>d?.hasChanges||n.currentNode.children.length<=u?(c.push(u),!0):!1);if(h.length===0||i.currentNode.hasError!==n.currentNode.hasError){for(;i.currentNode.parent&&r&&!i.currentNode.isNamed;)r=E1(i,n);const d=i.currentNode,u=FK(i,e)??d;s.push({startIndex:u.startIndex,endIndex:d.endIndex,startPosition:u.startPosition,endPosition:d.endPosition}),r=I1(i,n)}else h.length>=1&&(r=kK(i,n,c[0]))}else r=I1(i,n);while(r);return i.delete(),n.delete(),s}_findTreeChanges(e,t,i){let n=0;const s=[];for(let r=0;r<t.length;r++){const a=t[r];if(s.length>0&&a.startIndex>=s[s.length-1].newRangeStartOffset&&a.endIndex<=s[s.length-1].newRangeEndOffset)continue;const c=e.walk(),h=()=>c.startIndex<a.startIndex&&c.endIndex>a.endIndex;for(;h();){let p=c.gotoFirstChild(),b=!1;for(;p;)if(h()&&c.currentNode.isNamed){b=!0;break}else p=c.gotoNextSibling();if(!b){c.gotoParent();break}if(c.currentNode.childCount===0)break}const d=c.currentNode.startPosition,u=c.currentNode.endPosition,f=c.currentNode.startIndex,g=c.currentNode.endIndex,m={newRange:new l.Range(d.row+1,d.column+1,u.row+1,u.column+1),newRangeStartOffset:f,newRangeEndOffset:g};n<i.length&&N1(i[n],{startIndex:f,endIndex:g})?(i[n].startIndex<m.newRangeStartOffset&&(m.newRange=m.newRange.setStartPosition(i[n].startPosition.row+1,i[n].startPosition.column+1),m.newRangeStartOffset=i[n].startIndex),i[n].endIndex>m.newRangeEndOffset&&(m.newRange=m.newRange.setEndPosition(i[n].endPosition.row+1,i[n].endPosition.column+1),m.newRangeEndOffset=i[n].endIndex),n++):n<i.length&&i[n].endIndex<m.newRangeStartOffset&&s.push({newRange:new l.Range(i[n].startPosition.row+1,i[n].startPosition.column+1,i[n].endPosition.row+1,i[n].endPosition.column+1),newRangeStartOffset:i[n].startIndex,newRangeEndOffset:i[n].endIndex}),s.length>0&&s[s.length-1].newRangeEndOffset>=m.newRangeStartOffset?(s[s.length-1].newRange=l.Range.fromPositions(s[s.length-1].newRange.getStartPosition(),m.newRange.getEndPosition()),s[s.length-1].newRangeEndOffset=m.newRangeEndOffset):s.push(m)}return this._constrainRanges(s)}_constrainRanges(e){if(!this._ranges)return e;const t=[];let i=0,n=0;for(;i<e.length&&n<this._ranges.length;){const s=e[i],r=this._ranges[n];if(s.newRangeEndOffset<r.startIndex)i++;else if(s.newRangeStartOffset>r.endIndex)n++;else{const a=Math.max(s.newRangeStartOffset,r.startIndex),c=Math.min(s.newRangeEndOffset,r.endIndex),h=s.newRange.intersectRanges(new l.Range(r.startPosition.row+1,r.startPosition.column+1,r.endPosition.row+1,r.endPosition.column+1));t.push({newRange:h,newRangeEndOffset:c,newRangeStartOffset:a}),c<s.newRangeEndOffset?(s.newRange=l.Range.fromPositions(h.getEndPosition(),s.newRange.getEndPosition()),s.newRangeStartOffset=c+1):i++}}return t}async _parseAndUpdateTree(e){const t=await this._parse();if(t)return this._lastFullyParsed?.delete(),this._lastFullyParsed=t.copy(),this._lastFullyParsedWithEdits?.delete(),this._lastFullyParsedWithEdits=t.copy(),t;this._tree.get()||this._parser.reset()}_parse(){let e="fullParse";return this._tree.get()&&(e="incrementalParse"),this._parseAndYield(e)}async _parseAndYield(e){let t=0,i=0;const n=this.textModel.getVersionId();let s;const r=zK();do{const a=performance.now();s=this._parser.parse((c,h)=>this._parseCallback(c),this._tree.get(),{progressCallback:r,includedRanges:this._ranges}),t+=performance.now()-a,i++,await new Promise(c=>l.setTimeout0(c))}while(!this._store.isDisposed&&!s&&n===this.textModel.getVersionId());return this._sendParseTimeTelemetry(e,t,i),s&&n===this.textModel.getVersionId()?s:void 0}_parseCallback(e){try{return this.textModel.getTextBuffer().getNearestChunk(e)}catch(t){this._logService.debug("Error getting chunk for tree-sitter parsing",t)}}_setRanges(e){const t=[];if(this._ranges)for(const i of e){let n=!1;for(let s=0;s<this._ranges.length;s++){const r=this._ranges[s];if(VK(r,i)||N1(r,i)){n=!0;break}}n||t.push(i)}else t.push(...e);return this._ranges=e,t}_sendParseTimeTelemetry(e,t,i){this._logService.debug(`Tree parsing (${e}) took ${t} ms and ${i} passes.`),e==="fullParse"?this._telemetryService.publicLog2("treeSitter.fullParse",{languageId:this.languageId,time:t,passes:i}):this._telemetryService.publicLog2("treeSitter.incrementalParse",{languageId:this.languageId,time:t,passes:i})}createParsedTreeSync(e){const t=new this._parserClass;t.setLanguage(this._parser.language);const i=t.parse(e);return t.delete(),i??void 0}};Kw=BK([T1(5,ei),T1(6,Xn)],Kw);function zK(){let o=performance.now();return function(t){const i=performance.now();return i-o>50?(o=i,!0):!1}}function VK(o,e){return o.startPosition.row===e.startPosition.row&&o.startPosition.column===e.startPosition.column&&o.endPosition.row===e.endPosition.row&&o.endPosition.column===e.endPosition.column&&o.startIndex===e.startIndex&&o.endIndex===e.endIndex}function N1(o,e){return o.startIndex<=e.startIndex&&o.endIndex>=e.startIndex||e.startIndex<=o.startIndex&&e.endIndex>=o.startIndex}class UK{constructor(e){this._default=e,this._store=[]}get(e){return e<this._store.length?this._store[e]:this._default}set(e,t){for(;e>=this._store.length;)this._store[this._store.length]=this._default;this._store[e]=t}replace(e,t,i){if(e>=this._store.length)return;if(t===0){this.insert(e,i);return}else if(i===0){this.delete(e,t);return}const n=this._store.slice(0,e),s=this._store.slice(e+t),r=$K(i,this._default);this._store=n.concat(r,s)}delete(e,t){t===0||e>=this._store.length||this._store.splice(e,t)}insert(e,t){if(t===0||e>=this._store.length)return;const i=[];for(let n=0;n<t;n++)i[n]=this._default;this._store=l.arrayInsert(this._store,e,i)}}function $K(o,e){const t=[];for(let i=0;i<o;i++)t[i]=e;return t}class KK{get startLineNumber(){return this._startLineNumber}get endLineNumber(){return this._startLineNumber+this._tokens.length-1}constructor(e,t){this._startLineNumber=e,this._tokens=t}getLineTokens(e){return this._tokens[e-this._startLineNumber]}appendLineTokens(e){this._tokens.push(e)}}class Gw{constructor(){this._tokens=[]}add(e,t){if(this._tokens.length>0){const i=this._tokens[this._tokens.length-1];if(i.endLineNumber+1===e){i.appendLineTokens(t);return}}this._tokens.push(new KK(e,[t]))}finalize(){return this._tokens}}class GK{constructor(e,t){this.tokenizationSupport=t,this.initialState=this.tokenizationSupport.getInitialState(),this.store=new jw(e)}getStartState(e){return this.store.getStartState(e,this.initialState)}getFirstInvalidLine(){return this.store.getFirstInvalidLine(this.initialState)}}class jK extends GK{constructor(e,t,i,n){super(e,t),this._textModel=i,this._languageIdCodec=n}updateTokensUntilLine(e,t){const i=this._textModel.getLanguageId();for(;;){const n=this.getFirstInvalidLine();if(!n||n.lineNumber>t)break;const s=this._textModel.getLineContent(n.lineNumber),r=gu(this._languageIdCodec,i,this.tokenizationSupport,s,!0,n.startState);e.add(n.lineNumber,r.tokens),this.store.setEndState(n.lineNumber,r.endState)}}getTokenTypeIfInsertingCharacter(e,t){const i=this.getStartState(e.lineNumber);if(!i)return 0;const n=this._textModel.getLanguageId(),s=this._textModel.getLineContent(e.lineNumber),r=s.substring(0,e.column-1)+t+s.substring(e.column-1),a=gu(this._languageIdCodec,n,this.tokenizationSupport,r,!0,i),c=new _t(a.tokens,r,this._languageIdCodec);if(c.getCount()===0)return 0;const h=c.findTokenIndexAtOffset(e.column-1);return c.getStandardTokenType(h)}tokenizeLinesAt(e,t){const i=this.getStartState(e);if(!i)return null;const n=this._textModel.getLanguageId(),s=[];let r=i;for(const a of t){const c=gu(this._languageIdCodec,n,this.tokenizationSupport,a,!0,r);s.push(new _t(c.tokens,a,this._languageIdCodec)),r=c.endState}return s}hasAccurateTokensForLine(e){const t=this.store.getFirstInvalidEndStateLineNumberOrMax();return e<t}isCheapToTokenize(e){const t=this.store.getFirstInvalidEndStateLineNumberOrMax();return e<t||e===t&&this._textModel.getLineLength(e)<2048}tokenizeHeuristically(e,t,i){if(i<=this.store.getFirstInvalidEndStateLineNumberOrMax())return{heuristicTokens:!1};if(t<=this.store.getFirstInvalidEndStateLineNumberOrMax())return this.updateTokensUntilLine(e,i),{heuristicTokens:!1};let n=this.guessStartState(t);const s=this._textModel.getLanguageId();for(let r=t;r<=i;r++){const a=this._textModel.getLineContent(r),c=gu(this._languageIdCodec,s,this.tokenizationSupport,a,!0,n);e.add(r,c.tokens),n=c.endState}return{heuristicTokens:!0}}guessStartState(e){let{likelyRelevantLines:t,initialState:i}=R1(this._textModel,e,this);i||(i=this.tokenizationSupport.getInitialState());const n=this._textModel.getLanguageId();let s=i;for(const r of t)s=gu(this._languageIdCodec,n,this.tokenizationSupport,r,!1,s).endState;return s}}function R1(o,e,t){let i=o.getLineFirstNonWhitespaceColumn(e);const n=[];let s=null;for(let r=e-1;i>1&&r>=1;r--){const a=o.getLineFirstNonWhitespaceColumn(r);if(a!==0&&a<i&&(n.push(o.getLineContent(r)),i=a,s=t?.getStartState(r),s))break}return n.reverse(),{likelyRelevantLines:n,initialState:s??void 0}}class jw{constructor(e){this.lineCount=e,this._tokenizationStateStore=new qK,this._invalidEndStatesLineNumbers=new YK,this._invalidEndStatesLineNumbers.addRange(new l.OffsetRange(1,e+1))}getEndState(e){return this._tokenizationStateStore.getEndState(e)}setEndState(e,t){if(!t)throw new l.BugIndicatingError("Cannot set null/undefined state");this._invalidEndStatesLineNumbers.delete(e);const i=this._tokenizationStateStore.setEndState(e,t);return i&&e<this.lineCount&&this._invalidEndStatesLineNumbers.addRange(new l.OffsetRange(e+1,e+2)),i}acceptChange(e,t){this.lineCount+=t-e.length,this._tokenizationStateStore.acceptChange(e,t),this._invalidEndStatesLineNumbers.addRangeAndResize(new l.OffsetRange(e.startLineNumber,e.endLineNumberExclusive),t)}acceptChanges(e){for(const t of e){const[i]=fr(t.text);this.acceptChange(new l.LineRange(t.range.startLineNumber,t.range.endLineNumber+1),i+1)}}invalidateEndStateRange(e){this._invalidEndStatesLineNumbers.addRange(new l.OffsetRange(e.startLineNumber,e.endLineNumberExclusive))}getFirstInvalidEndStateLineNumber(){return this._invalidEndStatesLineNumbers.min}getFirstInvalidEndStateLineNumberOrMax(){return this.getFirstInvalidEndStateLineNumber()||Number.MAX_SAFE_INTEGER}allStatesValid(){return this._invalidEndStatesLineNumbers.min===null}getStartState(e,t){return e===1?t:this.getEndState(e-1)}getFirstInvalidLine(e){const t=this.getFirstInvalidEndStateLineNumber();if(t===null)return null;const i=this.getStartState(t,e);if(!i)throw new l.BugIndicatingError("Start state must be defined");return{lineNumber:t,startState:i}}}class qK{constructor(){this._lineEndStates=new UK(null)}getEndState(e){return this._lineEndStates.get(e)}setEndState(e,t){const i=this._lineEndStates.get(e);return i&&i.equals(t)?!1:(this._lineEndStates.set(e,t),!0)}acceptChange(e,t){let i=e.length;t>0&&i>0&&(i--,t--),this._lineEndStates.replace(e.startLineNumber,i,t)}}class YK{constructor(){this._ranges=[]}get min(){return this._ranges.length===0?null:this._ranges[0].start}delete(e){const t=this._ranges.findIndex(i=>i.contains(e));if(t!==-1){const i=this._ranges[t];i.start===e?i.endExclusive===e+1?this._ranges.splice(t,1):this._ranges[t]=new l.OffsetRange(e+1,i.endExclusive):i.endExclusive===e+1?this._ranges[t]=new l.OffsetRange(i.start,e):this._ranges.splice(t,1,new l.OffsetRange(i.start,e),new l.OffsetRange(e+1,i.endExclusive))}}addRange(e){l.OffsetRange.addRange(e,this._ranges)}addRangeAndResize(e,t){let i=0;for(;!(i>=this._ranges.length||e.start<=this._ranges[i].endExclusive);)i++;let n=i;for(;!(n>=this._ranges.length||e.endExclusive<this._ranges[n].start);)n++;const s=t-e.length;for(let r=n;r<this._ranges.length;r++)this._ranges[r]=this._ranges[r].delta(s);if(i===n){const r=new l.OffsetRange(e.start,e.start+t);r.isEmpty||this._ranges.splice(i,0,r)}else{const r=Math.min(e.start,this._ranges[i].start),a=Math.max(e.endExclusive,this._ranges[n-1].endExclusive),c=new l.OffsetRange(r,a+s);c.isEmpty?this._ranges.splice(i,n-i):this._ranges.splice(i,n-i,c)}}toString(){return this._ranges.map(e=>e.toString()).join(" + ")}}function gu(o,e,t,i,n,s){let r=null;if(t)try{r=t.tokenizeEncoded(i,n,s.clone())}catch(a){l.onUnexpectedError(a)}return r||(r=Lg(o.encodeLanguageId(e),s)),_t.convertToEndOffset(r.tokens,i.length),r}class ZK{constructor(e,t){this._tokenizerWithStateStore=e,this._backgroundTokenStore=t,this._isDisposed=!1,this._isScheduled=!1}dispose(){this._isDisposed=!0}handleChanges(){this._beginBackgroundTokenization()}_beginBackgroundTokenization(){this._isScheduled||!this._tokenizerWithStateStore._textModel.isAttachedToEditor()||!this._hasLinesToTokenize()||(this._isScheduled=!0,l.runWhenGlobalIdle(e=>{this._isScheduled=!1,this._backgroundTokenizeWithDeadline(e)}))}_backgroundTokenizeWithDeadline(e){const t=Date.now()+e.timeRemaining(),i=()=>{this._isDisposed||!this._tokenizerWithStateStore._textModel.isAttachedToEditor()||!this._hasLinesToTokenize()||(this._backgroundTokenizeForAtLeast1ms(),Date.now()<t?l.setTimeout0(i):this._beginBackgroundTokenization())};i()}_backgroundTokenizeForAtLeast1ms(){const e=this._tokenizerWithStateStore._textModel.getLineCount(),t=new Gw,i=l.StopWatch.create(!1);do if(i.elapsed()>1||this._tokenizeOneInvalidLine(t)>=e)break;while(this._hasLinesToTokenize());this._backgroundTokenStore.setTokens(t.finalize()),this.checkFinished()}_hasLinesToTokenize(){return this._tokenizerWithStateStore?!this._tokenizerWithStateStore.store.allStatesValid():!1}_tokenizeOneInvalidLine(e){const t=this._tokenizerWithStateStore?.getFirstInvalidLine();return t?(this._tokenizerWithStateStore.updateTokensUntilLine(e,t.lineNumber),t.lineNumber):this._tokenizerWithStateStore._textModel.getLineCount()+1}checkFinished(){this._isDisposed||this._tokenizerWithStateStore.store.allStatesValid()&&this._backgroundTokenStore.backgroundTokenizationFinished()}requestTokens(e,t){this._tokenizerWithStateStore.store.invalidateEndStateRange(new l.LineRange(e,t))}}class ka{get children(){return this._children}get length(){return this._length}constructor(e){this.height=e,this._children=[],this._length=0}static create(e,t){const i=new ka(e.height+1);return i.appendChild(e),i.appendChild(t),i}canAppendChild(){return this._children.length<3}appendChild(e){if(!this.canAppendChild())throw new Error("Cannot insert more than 3 children in a ListNode");this._children.push(e),this._length+=e.length,this._updateParentLength(e.length),Ci(e)||(e.parent=this)}_updateParentLength(e){let t=this.parent;for(;t;)t._length+=e,t=t.parent}unappendChild(){const e=this._children.pop();return this._length-=e.length,this._updateParentLength(-e.length),e}prependChild(e){if(this._children.length>=3)throw new Error("Cannot prepend more than 3 children in a ListNode");this._children.unshift(e),this._length+=e.length,this._updateParentLength(e.length),Ci(e)||(e.parent=this)}unprependChild(){const e=this._children.shift();return this._length-=e.length,this._updateParentLength(-e.length),e}lastChild(){return this._children[this._children.length-1]}dispose(){this._children.splice(0,this._children.length)}}var tn;(function(o){o[o.None=0]="None",o[o.ViewportGuess=1]="ViewportGuess",o[o.EditGuess=2]="EditGuess",o[o.Accurate=3]="Accurate"})(tn||(tn={}));function Ci(o){return o.token!==void 0}function M1(o,e){let t=o;const i=[];let n;for(;;){if(e.height===t.height){n=e;break}if(Ci(t))throw new Error("unexpected");i.push(t),t=t.lastChild()}for(let s=i.length-1;s>=0;s--){const r=i[s];n&&(r.children.length>=3?n=ka.create(r.unappendChild(),n):(r.appendChild(n),n=void 0))}if(n){const s=new ka(n.height+1);return s.appendChild(o),s.appendChild(n),s}else return o}function QK(o,e){let t=o;const i=[];for(;e.height!==t.height;){if(Ci(t))throw new Error("unexpected");i.push(t),t=t.children[0]}let n=e;for(let s=i.length-1;s>=0;s--){const r=i[s];n&&(r.children.length>=3?n=ka.create(n,r.unprependChild()):(r.prependChild(n),n=void 0))}return n?ka.create(n,o):o}function XK(o,e){return o.height===e.height?ka.create(o,e):o.height>e.height?M1(o,e):QK(e,o)}class JK{constructor(e){this._textModel=e,this._root=this.createEmptyRoot()}createEmptyRoot(){return{length:this._textModel.getValueLength(),token:0,height:0,tokenQuality:tn.None}}buildStore(e,t){this._root=this.createFromUpdates(e,t)}createFromUpdates(e,t){if(e.length===0)return this.createEmptyRoot();let i={length:e[0].length,token:e[0].token,height:0,tokenQuality:t};for(let n=1;n<e.length;n++)i=M1(i,{length:e[n].length,token:e[n].token,height:0,tokenQuality:t});return i}update(e,t,i){t.length!==0&&this.replace(e,t[0].startOffsetInclusive,t,i)}delete(e,t){this.replace(e,t,[],tn.EditGuess)}replace(e,t,i,n){const s=t+e,r=[],a=[],c=[{node:this._root,offset:0}];for(;c.length>0;){const u=c.pop(),f=u.offset;if(f<t&&f+u.node.length<=t){Ci(u.node)||(u.node.parent=void 0),r.push(u.node);continue}else Ci(u.node)&&f<t&&r.push({length:t-f,token:u.node.token,height:0,tokenQuality:u.node.tokenQuality});if(!(t<=f&&f+u.node.length<=s)){if(f>=s){Ci(u.node)||(u.node.parent=void 0),a.push(u.node);continue}else if(Ci(u.node)&&f+u.node.length>s){a.push({length:f+u.node.length-s,token:u.node.token,height:0,tokenQuality:u.node.tokenQuality});continue}if(!Ci(u.node)){let g=f+u.node.length;for(let m=u.node.children.length-1;m>=0;m--)g-=u.node.children[m].length,c.push({node:u.node.children[m],offset:g})}}}let h;i.length>0?h=r.concat(this.createFromUpdates(i,n),a):h=r.concat(a);let d=h[0];for(let u=1;u<h.length;u++)d=XK(d,h[u]);this._root=d??this.createEmptyRoot()}traverseInOrderInRange(e,t,i){const n=[{node:this._root,offset:0}];for(;n.length>0;){const{node:s,offset:r}=n.pop();if(!(r+s.length<=e||r>=t)){if(i(s,r))return;if(!Ci(s)){let c=r+s.length;for(let h=s.children.length-1;h>=0;h--)c-=s.children[h].length,n.push({node:s.children[h],offset:c})}}}}getTokenAt(e){let t;return this.traverseInOrderInRange(e,this._root.length,(i,n)=>Ci(i)?(t={token:i.token,startOffsetInclusive:n,length:i.length},!0):!1),t}getTokensInRange(e,t){const i=[];return this.traverseInOrderInRange(e,t,(n,s)=>{if(Ci(n)){let r=n.length,a=s;s<e&&s+n.length>t?(a=e,r=t-e):s<e?(r-=e-s,a=e):s+n.length>t&&(r-=s+n.length-t),i.push({token:n.token,startOffsetInclusive:a,length:r})}return!1}),i}markForRefresh(e,t){this.traverseInOrderInRange(e,t,i=>(Ci(i)&&(i.tokenQuality=tn.None),!1))}rangeHasTokens(e,t,i){let n=!0;return this.traverseInOrderInRange(e,t,s=>(Ci(s)&&s.tokenQuality<i&&(n=!1),!1)),n}rangeNeedsRefresh(e,t){let i=!1;return this.traverseInOrderInRange(e,t,n=>(Ci(n)&&n.tokenQuality!==tn.Accurate&&(i=!0),!1)),i}getNeedsRefresh(){const e=[];return this.traverseInOrderInRange(0,this._textModel.getValueLength(),(t,i)=>(Ci(t)&&t.tokenQuality!==tn.Accurate&&(e.length>0&&e[e.length-1].endOffset===i?e[e.length-1].endOffset+=t.length:e.push({startOffset:i,endOffset:i+t.length})),!1)),e}dispose(){const e=[[this._root,!1]];for(;e.length>0;){const[t,i]=e.pop();if(!Ci(t))if(i)t.dispose(),t.parent=void 0;else{e.push([t,!0]);for(let n=t.children.length-1;n>=0;n--)e.push([t.children[n],!1])}}this._root=void 0}}const WK=le("treeSitterThemeService");var HK=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},e6=function(o,e){return function(t,i){e(t,i,o)}};let qw=class extends l.Disposable{get _textModel(){return this._tree.textModel}constructor(e,t,i,n,s){super(),this._tree=e,this._highlightingQueries=t,this._languageIdCodec=i,this._visibleLineRanges=n,this._treeSitterThemeService=s,this._onDidChangeTokens=this._register(new l.Emitter),this.onDidChangeTokens=this._onDidChangeTokens.event,this._onDidCompleteBackgroundTokenization=this._register(new l.Emitter),this.onDidChangeBackgroundTokenization=this._onDidCompleteBackgroundTokenization.event,this._encodedLanguageId=this._languageIdCodec.encodeLanguageId(this._tree.languageId),this._register(Qr(this._treeSitterThemeService.onChange,()=>{this._updateTheme()})),this._tokenStore=this._register(new JK(this._textModel)),this._accurateVersion=this._textModel.getVersionId(),this._guessVersion=this._textModel.getVersionId(),this._tokenStore.buildStore(this._createEmptyTokens(),tn.None),this._register(he(r=>{const a=this._visibleLineRanges.read(r);this._parseAndTokenizeViewPort(a)})),this._register(Gl({owner:this,changeTracker:Wk({tree:this._tree.tree})},(r,a)=>{const c=a.changes.at(0)?.change;if(a.changes.length>1)throw new l.BugIndicatingError("The tree changed twice in one transaction. This is currently not supported and should not happen.");if(!c)a.tree&&this._firstTreeUpdate(this._tree.treeLastParsedVersion.read(r));else{if(this.hasTokens())for(const h of c.ranges)this._markForRefresh(h.newRange);this.hasTokens()?this._handleTreeUpdate(c.ranges,c.versionId):this._firstTreeUpdate(c.versionId)}}))}handleContentChanged(e){this._guessVersion=e.versionId;for(const t of e.changes)if(t.text.length>t.rangeLength){const i=t.rangeOffset>0?t.rangeOffset-1:t.rangeOffset,n=this._tokenStore.getTokenAt(i);let s;n?(s={startOffsetInclusive:n.startOffsetInclusive,length:n.length+t.text.length-t.rangeLength,token:n.token},this._tokenStore.markForRefresh(i,t.rangeOffset+(t.text.length>t.rangeLength?t.text.length:t.rangeLength))):s={startOffsetInclusive:i,length:t.text.length,token:0},this._tokenStore.update(n?.length??0,[s],tn.EditGuess)}else if(t.text.length<t.rangeLength){const i=t.rangeLength-t.text.length;this._tokenStore.delete(i,t.rangeOffset)}}getLineTokens(e){const t=this._textModel.getLineContent(e),i=this.getTokens(e);return new _t(i,t,this._languageIdCodec)}_createEmptyTokens(){const e=this._emptyToken(),t=this._textModel.getValueLength();return[this._emptyTokensForOffsetAndLength(0,t,e)]}_emptyToken(){return this._treeSitterThemeService.findMetadata([],this._encodedLanguageId,!1,void 0)}_emptyTokensForOffsetAndLength(e,t,i){return{token:i,length:e+t,startOffsetInclusive:0}}hasAccurateTokensForLine(e){return this.hasTokens(new l.Range(e,1,e,this._textModel.getLineMaxColumn(e)))}tokenizeLinesAt(e,t){const i=this._guessTokensForLinesContent(e,t),n=[];if(!i)return null;for(let s=0;s<i.length;s++)n.push(new _t(i[s],t[s],this._languageIdCodec));return n}_rangeHasTokens(e,t){return this._tokenStore.rangeHasTokens(this._textModel.getOffsetAt(e.getStartPosition()),this._textModel.getOffsetAt(e.getEndPosition()),t)}hasTokens(e){return!e||this._guessVersion===this._accurateVersion?!0:!this._tokenStore.rangeNeedsRefresh(this._textModel.getOffsetAt(e.getStartPosition()),this._textModel.getOffsetAt(e.getEndPosition()))}getTokens(e){const t=this._textModel.getOffsetAt({lineNumber:e,column:1}),i=this._textModel.getOffsetAt({lineNumber:e,column:this._textModel.getLineLength(e)+1}),n=this._tokenStore.getTokensInRange(t,i),s=new Uint32Array(n.length*2);for(let r=0;r<n.length;r++)s[r*2]=n[r].startOffsetInclusive-t+n[r].length,s[r*2+1]=n[r].token;return s}getTokensInRange(e,t,i,n){const s=n?this._tokenizeCapturesWithMetadata(n,t,i):this._tokenize(e,t,i);if(s?.endOffsetsAndMetadata)return this._rangeTokensAsUpdates(t,s.endOffsetsAndMetadata)}_updateTokensInStore(e,t,i){this._accurateVersion=e;for(const n of t){const s=n.newTokens.length>0?n.newTokens[n.newTokens.length-1]:void 0;let r;s&&this._guessVersion>=e?r=s.startOffsetInclusive+s.length-n.newTokens[0].startOffsetInclusive:n.oldRangeLength?r=n.oldRangeLength:r=0,this._tokenStore.update(r,n.newTokens,i)}}_markForRefresh(e){this._tokenStore.markForRefresh(this._textModel.getOffsetAt(e.getStartPosition()),this._textModel.getOffsetAt(e.getEndPosition()))}_getNeedsRefresh(){const e=this._tokenStore.getNeedsRefresh();return e?e.map(t=>({range:l.Range.fromPositions(this._textModel.getPositionAt(t.startOffset),this._textModel.getPositionAt(t.endOffset)),startOffset:t.startOffset,endOffset:t.endOffset})):[]}_parseAndTokenizeViewPort(e){const t=e.map(i=>i.toInclusiveRange()).filter(l.isDefined);for(const i of t){const n=this._textModel.getOffsetAt(i.getStartPosition()),s=this._textModel.getOffsetAt(i.getEndPosition()),r=this._textModel.getVersionId();if(this._rangeHasTokens(i,tn.ViewportGuess))continue;const a=this._textModel.getValueInRange(i),c=this._forceParseAndTokenizeContent(i,n,s,a,!0);if(!c||this._rangeHasTokens(i,tn.ViewportGuess)||c.length===0)continue;const h=c[c.length-1],d=h.startOffsetInclusive+h.length-c[0].startOffsetInclusive;this._updateTokensInStore(r,[{newTokens:c,oldRangeLength:d}],tn.ViewportGuess),this._onDidChangeTokens.fire({changes:{semanticTokensApplied:!1,ranges:[{fromLineNumber:i.startLineNumber,toLineNumber:i.endLineNumber}]}})}}_guessTokensForLinesContent(e,t){if(t.length===0)return;const i=t.join(this._textModel.getEOL()),n=new l.Range(1,1,e+t.length,t[t.length-1].length+1),s=this._textModel.getOffsetAt({lineNumber:e,column:1}),r=this._forceParseAndTokenizeContent(n,s,s+i.length,i,!1);if(!r)return;const a=new Array(t.length);let c=0,h=0,d=0;for(let u=0;u<t.length;u++){const f=[];let g=!1;for(let m=c;!g&&m<r.length;m++){const p=r[m],b=p.endOffset-d,v=h-d;if(b<=t[u].length)f.push({endOffset:b,metadata:p.metadata}),c++;else if(v<t[u].length){const C={endOffset:t[u].length,metadata:p.metadata};f.push(C),g=!0}else g=!0;h=p.endOffset}a[u]=this._endOffsetTokensToUint32Array(f),d+=t[u].length+this._textModel.getEOL().length}return a}_forceParseAndTokenizeContent(e,t,i,n,s){const r=R1(this._textModel,e.startLineNumber).likelyRelevantLines,a=r.join(this._textModel.getEOL()),c=this._tree.createParsedTreeSync(`${a}${n}`);if(!c)return;const h=new l.Range(1,1,e.endLineNumber-e.startLineNumber+1+r.length,e.endColumn),d=this.captureAtRange(h),u=this._tokenizeCapturesWithMetadata(d,a.length,i-t+a.length);if(c.delete(),!!u)return s?this._rangeTokensAsUpdates(t,u.endOffsetsAndMetadata,a.length):u.endOffsetsAndMetadata}_firstTreeUpdate(e){return this._setViewPortTokens(e)}_setViewPortTokens(e){const t=this._visibleLineRanges.get().map(i=>{const n=i.toInclusiveRange();if(!n)return;const s=this._textModel.getOffsetAt(n.getStartPosition()),r=this._textModel.getOffsetAt(n.getEndPosition());return{newRange:n,newRangeEndOffset:r,newRangeStartOffset:s}}).filter(l.isDefined);return this._handleTreeUpdate(t,e)}_handleTreeUpdate(e,t){const i=[];for(let r=0;r<e.length;r++)if(e[r].newRange.endLineNumber-e[r].newRange.startLineNumber>1e3){const c=e[r].newRange.endLineNumber;let h=e[r].newRange.startLineNumber,d=e[r].newRange.startColumn,u=h+1e3;do{const f=new l.Position(h,d),g=u===e[r].newRange.endLineNumber?e[r].newRange.endColumn:this._textModel.getLineMaxColumn(u),m=new l.Position(u,g),p=l.Range.fromPositions(f,m);i.push({range:p,startOffset:this._textModel.getOffsetAt(p.getStartPosition()),endOffset:this._textModel.getOffsetAt(p.getEndPosition())}),h=u+1,d=1,u<c&&u+1e3>c?u=c:u=u+1e3}while(u<=c)}else if(r===0||i[r-1].endOffset<e[r].newRangeStartOffset)i.push({range:e[r].newRange,startOffset:e[r].newRangeStartOffset,endOffset:e[r].newRangeEndOffset});else if(i[r-1].endOffset<e[r].newRangeEndOffset){const c=this._textModel.getPositionAt(i[r-1].endOffset+1),h=new l.Range(c.lineNumber,c.column,e[r].newRange.endLineNumber,e[r].newRange.endColumn);i.push({range:h,startOffset:i[r-1].endOffset+1,endOffset:e[r].newRangeEndOffset})}const s=i.map(r=>this._getCaptures(r.range));return this._updateTreeForRanges(i,t,s).then(()=>{!this._textModel.isDisposed()&&this._tree.treeLastParsedVersion.get()===this._textModel.getVersionId()&&this._refreshNeedsRefresh(t)})}async _updateTreeForRanges(e,t,i){let n;for(let s=0;s<e.length&&!(!this._textModel.isDisposed()&&t!==this._textModel.getVersionId());s++){const r=i[s],a=e[s],c=this.getTokensInRange(a.range,a.startOffset,a.endOffset,r);c?n={newTokens:c}:n={newTokens:[]},this._updateTokensInStore(t,[n],tn.Accurate),this._onDidChangeTokens.fire({changes:{semanticTokensApplied:!1,ranges:[{fromLineNumber:a.range.getStartPosition().lineNumber,toLineNumber:a.range.getEndPosition().lineNumber}]}}),await new Promise(h=>l.setTimeout0(h))}this._onDidCompleteBackgroundTokenization.fire()}_refreshNeedsRefresh(e){const t=this._getNeedsRefresh();if(t.length===0)return;const i=new Array(t.length);for(let n=0;n<t.length;n++){const s=t[n];i[n]={newRange:s.range,newRangeStartOffset:s.startOffset,newRangeEndOffset:s.endOffset}}this._handleTreeUpdate(i,e)}_rangeTokensAsUpdates(e,t,i){const n=[];let s=0;for(const r of t){if(r.endOffset<=s||i&&r.endOffset<i)continue;let a;i&&s<i?a={startOffsetInclusive:e+i,length:r.endOffset-i,token:r.metadata}:a={startOffsetInclusive:e+s,length:r.endOffset-s,token:r.metadata},n.push(a),s=r.endOffset}return n}_updateTheme(){const e=this._textModel.getFullModelRange();this._markForRefresh(e),this._parseAndTokenizeViewPort(this._visibleLineRanges.get())}captureAtRange(e){const t=this._tree.tree.get();return t?this._highlightingQueries.captures(t.rootNode,{startPosition:{row:e.startLineNumber-1,column:e.startColumn-1},endPosition:{row:e.endLineNumber-1,column:e.endColumn-1}}).map(i=>({name:i.name,text:i.node.text,node:{startIndex:i.node.startIndex,endIndex:i.node.endIndex,startPosition:{lineNumber:i.node.startPosition.row+1,column:i.node.startPosition.column+1},endPosition:{lineNumber:i.node.endPosition.row+1,column:i.node.endPosition.column+1}},encodedLanguageId:this._encodedLanguageId})):[]}captureAtRangeWithInjections(e){const t=this.captureAtRange(e);for(let i=0;i<t.length;i++){const n=t[i],s=n.node.startPosition.lineNumber,r=n.node.endPosition.lineNumber,a=n.node.startPosition.column,c=n.node.endPosition.column,h=s>e.startLineNumber&&s<e.endLineNumber?s:e.startLineNumber,d=r>e.startLineNumber&&r<e.endLineNumber?r:e.endLineNumber,u=s===e.startLineNumber?a<e.startColumn?e.startColumn:a:s<e.startLineNumber?e.startColumn:a,f=r===e.endLineNumber?c>e.endColumn?e.endColumn:c:r>e.endLineNumber?e.endColumn:c,g=new l.Range(h,u,d,f),m=this._getInjectionCaptures(n,g);m&&m.length>0&&(t.splice(i+1,0,...m),i+=m.length)}return t}tokenizeEncoded(e){const t=this._tokenizeEncoded(e);if(!t)return;const i=this._rangeTokensAsUpdates(this._textModel.getOffsetAt({lineNumber:e,column:1}),t.result);t.versionId===this._textModel.getVersionId()&&this._updateTokensInStore(t.versionId,[{newTokens:i,oldRangeLength:this._textModel.getLineLength(e)}],tn.Accurate)}_getCaptures(e){return this.captureAtRangeWithInjections(e)}_tokenize(e,t,i){const n=this._getCaptures(e),s=this._tokenizeCapturesWithMetadata(n,t,i);if(s)return{...s,versionId:this._tree.treeLastParsedVersion.get()}}_createTokensFromCaptures(e,t,i){const n=this._tree.tree.get(),s=l.StopWatch.create(),r=i-t,a=this._languageIdCodec.encodeLanguageId(this._tree.languageId),c=t6[this._tree.languageId]||"source";if(e.length===0)return n?(s.stop(),{endOffsets:[{endOffset:r,scopes:[],encodedLanguageId:a}],captureTime:s.elapsed()}):void 0;const h=Array(e.length);h.fill({endOffset:0,scopes:[c],encodedLanguageId:a});let d=0;const u=()=>{h.push({endOffset:0,scopes:[c],encodedLanguageId:a})},f=(p,b)=>p.name.includes("punctuation")&&p.text?Array.from(p.text.matchAll(i6)).map(v=>b+v.index):void 0,g=(p,b,v,C)=>{if(C!==void 0){const w=h[C].scopes;let S=h[C].bracket;if((C>0?h[C-1].endOffset:0)!==b){let D;if(S&&S.length>0){D=[];const x=[];for(let I=0;I<S.length;I++){const T=S[I];T<b?D.push(T):T>v&&x.push(T)}D.length===0&&(D=void 0),x.length===0?S=void 0:S=x}h.splice(C,0,{endOffset:b,scopes:[...w],bracket:D,encodedLanguageId:p.encodedLanguageId}),C++,u(),d++}h.splice(C,0,{endOffset:v,scopes:[...w,p.name],bracket:f(p,b),encodedLanguageId:p.encodedLanguageId}),h[d].bracket=S}else h[d]={endOffset:v,scopes:[c,p.name],bracket:f(p,b),encodedLanguageId:p.encodedLanguageId};d++};for(let p=0;p<e.length;p++){const b=e[p],v=b.node.endIndex<i?b.node.endIndex<t?t:b.node.endIndex:i,C=b.node.startIndex<t?t:b.node.startIndex,w=v-t;let S;const L=v-C;p>0?S=h[d-1].endOffset:S=C-t-1;const D=w-L;if(S>=0&&S<D&&(h[d]={endOffset:D,scopes:[c],encodedLanguageId:this._encodedLanguageId},d++,u()),!(L<0))if(S>=w){let x=d-1,I=h[x].endOffset,T=x>=2?h[x-1].endOffset:0;do{if(T+L===I){if(T===D){h[x].scopes.push(b.name);const M=h[x].bracket;h[x].bracket=M&&M.length>0?M:f(b,D)}}else if(T<=D){g(b,D,w,x);break}x--,T=x>=1?h[x-1].endOffset:0,I=x>=0?h[x].endOffset:0}while(I>D)}else g(b,D,w)}h[d-1].endOffset<r&&r-h[d-1].endOffset>0&&(u(),h[d]={endOffset:r,scopes:h[d].scopes,encodedLanguageId:this._encodedLanguageId},d++);for(let p=0;p<h.length;p++)if(h[p].endOffset===0&&p!==0){h.splice(p,h.length-p);break}const m=s.elapsed();return{endOffsets:h,captureTime:m}}_getInjectionCaptures(e,t){return[]}_tokenizeCapturesWithMetadata(e,t,i){const n=l.StopWatch.create(),s=this._createTokensFromCaptures(e,t,i);if(!s)return;const r=s.endOffsets;for(let c=0;c<r.length;c++){const h=r[c];h.metadata=this._treeSitterThemeService.findMetadata(h.scopes,h.encodedLanguageId,!!h.bracket&&h.bracket.length>0,void 0)}const a=n.elapsed();return{endOffsetsAndMetadata:r,captureTime:s.captureTime,metadataTime:a}}_tokenizeEncoded(e){const t=this._textModel.getOffsetAt({lineNumber:e,column:1}),i=this._textModel.getLineCount(),n=e+1<=i?this._textModel.getOffsetAt({lineNumber:e+1,column:1}):this._textModel.getValueLength(),s=n-t,r=this._tokenize(new l.Range(e,1,e,s+1),t,n);if(r)return{result:r.endOffsetsAndMetadata,captureTime:r.captureTime,metadataTime:r.metadataTime,versionId:r.versionId}}_endOffsetTokensToUint32Array(e){const t=new Uint32Array(e.length*2);for(let i=0;i<e.length;i++)t[i*2]=e[i].endOffset,t[i*2+1]=e[i].metadata;return t}};qw=HK([e6(4,WK)],qw);const t6={css:"source.css",typescript:"source.ts",ini:"source.ini",regex:"source.regex"},i6=/[\{\}\[\]\<\>\(\)]/g,Yw=le("treeSitterLibraryService");var n6=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},A1=function(o,e){return function(t,i){e(t,i,o)}};let Zw=class extends y1{constructor(e,t,i,n,s,r){super(t,i),this._languageIdObs=e,this._treeSitterLibraryService=s,this._instantiationService=r,this._backgroundTokenizationState=1,this._onDidChangeBackgroundTokenizationState=this._register(new l.Emitter),this.onDidChangeBackgroundTokenizationState=this._onDidChangeBackgroundTokenizationState.event;const a=new eC(this._treeSitterLibraryService.getParserClass()),c=Z(this,h=>a.promiseResult?.read(h)?.getDataOrThrow());this._tree=Z(this,h=>{const d=c.read(h);if(!d)return;const u=this._languageIdObs.read(h),f=this._treeSitterLibraryService.getLanguage(u,!1,h);if(!f)return;const g=new d;if(h.store.add(l.toDisposable(()=>{g.delete()})),g.setLanguage(f),this._treeSitterLibraryService.getInjectionQueries(u,h)!==void 0)return h.store.add(this._instantiationService.createInstance(Kw,u,void 0,g,d,this._textModel))}),this._tokenizationImpl=Z(this,h=>{const d=this._tree.read(h);if(!d)return;const u=this._treeSitterLibraryService.getHighlightingQueries(d.languageId,h);if(u)return h.store.add(this._instantiationService.createInstance(qw,d,u,this._languageIdCodec,n))}),this._register(he(h=>{const d=this._tokenizationImpl.read(h);d&&(h.store.add(d.onDidChangeTokens(u=>{this._onDidChangeTokens.fire(u.changes)})),h.store.add(d.onDidChangeBackgroundTokenization(u=>{this._backgroundTokenizationState=2,this._onDidChangeBackgroundTokenizationState.fire()})))}))}getLineTokens(e){const t=this._tokenizationImpl.get();if(!t){const i=this._textModel.getLineContent(e);return _t.createEmpty(i,this._languageIdCodec)}return t.getLineTokens(e)}todo_resetTokenization(e=!0){e&&this._onDidChangeTokens.fire({semanticTokensApplied:!1,ranges:[{fromLineNumber:1,toLineNumber:this._textModel.getLineCount()}]})}handleDidChangeAttached(){}handleDidChangeContent(e){e.isFlush?this.todo_resetTokenization(!1):this._tokenizationImpl.get()?.handleContentChanged(e),this._tree.get()?.handleContentChange(e)}forceTokenization(e){const t=this._tokenizationImpl.get();t&&(t.hasAccurateTokensForLine(e)||t.tokenizeEncoded(e))}hasAccurateTokensForLine(e){const t=this._tokenizationImpl.get();return t?t.hasAccurateTokensForLine(e):!1}isCheapToTokenize(e){return!0}getTokenTypeIfInsertingCharacter(e,t,i){return 0}tokenizeLinesAt(e,t){const i=this._tokenizationImpl.get();return i?i.tokenizeLinesAt(e,t):null}get hasTokens(){const e=this._tokenizationImpl.get();return e?e.hasTokens():!1}};Zw=n6([A1(4,Yw),A1(5,me)],Zw);class Qw{constructor(e){this._pieces=[],this._isComplete=!1,this._languageIdCodec=e}flush(){this._pieces=[],this._isComplete=!1}isEmpty(){return this._pieces.length===0}set(e,t,i=void 0){if(this._pieces=e||[],this._isComplete=t,i)for(const n of this._pieces)n.reportIfInvalid(i)}setPartial(e,t){let i=e;if(t.length>0){const s=t[0].getRange(),r=t[t.length-1].getRange();if(!s||!r)return e;i=e.plusRange(s).plusRange(r)}let n=null;for(let s=0,r=this._pieces.length;s<r;s++){const a=this._pieces[s];if(a.endLineNumber<i.startLineNumber)continue;if(a.startLineNumber>i.endLineNumber){n=n||{index:s};break}if(a.removeTokens(i),a.isEmpty()){this._pieces.splice(s,1),s--,r--;continue}if(a.endLineNumber<i.startLineNumber)continue;if(a.startLineNumber>i.endLineNumber){n=n||{index:s};continue}const[c,h]=a.split(i);if(c.isEmpty()){n=n||{index:s};continue}h.isEmpty()||(this._pieces.splice(s,1,c,h),s++,r++,n=n||{index:s})}return n=n||{index:this._pieces.length},t.length>0&&(this._pieces=l.arrayInsert(this._pieces,n.index,t)),i}isComplete(){return this._isComplete}addSparseTokens(e,t){if(t.getTextLength()===0)return t;const i=this._pieces;if(i.length===0)return t;const n=Qw._findFirstPieceWithLine(i,e),s=i[n].getLineTokens(e);if(!s)return t;const r=t.getCount(),a=s.getCount();let c=0;const h=[];let d=0,u=0;const f=(g,m)=>{g<=u||(u=g,h[d++]=g,h[d++]=m)};for(let g=0;g<a;g++){const m=Math.min(s.getStartCharacter(g),t.getTextLength()),p=Math.min(s.getEndCharacter(g),t.getTextLength()),b=s.getMetadata(g),v=((b&1?2048:0)|(b&2?4096:0)|(b&4?8192:0)|(b&8?16384:0)|(b&16?16744448:0)|(b&32?4278190080:0))>>>0,C=~v>>>0;for(;c<r&&t.getEndOffset(c)<=m;)f(t.getEndOffset(c),t.getMetadata(c)),c++;for(c<r&&t.getStartOffset(c)<m&&f(m,t.getMetadata(c));c<r&&t.getEndOffset(c)<p;)f(t.getEndOffset(c),t.getMetadata(c)&C|b&v),c++;if(c<r)f(p,t.getMetadata(c)&C|b&v),t.getEndOffset(c)===p&&c++;else{const w=Math.min(Math.max(0,c-1),r-1);f(p,t.getMetadata(w)&C|b&v)}}for(;c<r;)f(t.getEndOffset(c),t.getMetadata(c)),c++;return new _t(new Uint32Array(h),t.getLineContent(),this._languageIdCodec)}static _findFirstPieceWithLine(e,t){let i=0,n=e.length-1;for(;i<n;){let s=i+Math.floor((n-i)/2);if(e[s].endLineNumber<t)i=s+1;else if(e[s].startLineNumber>t)n=s-1;else{for(;s>i&&e[s-1].startLineNumber<=t&&t<=e[s-1].endLineNumber;)s--;return s}}return i}acceptEdit(e,t,i,n,s){for(let r=0;r<this._pieces.length;r++){const a=this._pieces[r];a.acceptEdit(e,t,i,n,s),a.isEmpty()&&(this._pieces.splice(r,1),r--)}}}const So=new Uint32Array(0).buffer;class Ds{static deleteBeginning(e,t){return e===null||e===So?e:Ds.delete(e,0,t)}static deleteEnding(e,t){if(e===null||e===So)return e;const i=yo(e),n=i[i.length-2];return Ds.delete(e,t,n)}static delete(e,t,i){if(e===null||e===So||t===i)return e;const n=yo(e),s=n.length>>>1;if(t===0&&n[n.length-2]===i)return So;const r=_t.findIndexInTokensArray(n,t),a=r>0?n[r-1<<1]:0,c=n[r<<1];if(i<c){const g=i-t;for(let m=r;m<s;m++)n[m<<1]-=g;return e}let h,d;a!==t?(n[r<<1]=t,h=r+1<<1,d=t):(h=r<<1,d=a);const u=i-t;for(let g=r+1;g<s;g++){const m=n[g<<1]-u;m>d&&(n[h++]=m,n[h++]=n[(g<<1)+1],d=m)}if(h===n.length)return e;const f=new Uint32Array(h);return f.set(n.subarray(0,h),0),f.buffer}static append(e,t){if(t===So)return e;if(e===So)return t;if(e===null)return e;if(t===null)return null;const i=yo(e),n=yo(t),s=n.length>>>1,r=new Uint32Array(i.length+n.length);r.set(i,0);let a=i.length;const c=i[i.length-2];for(let h=0;h<s;h++)r[a++]=n[h<<1]+c,r[a++]=n[(h<<1)+1];return r.buffer}static insert(e,t,i){if(e===null||e===So)return e;const n=yo(e),s=n.length>>>1;let r=_t.findIndexInTokensArray(n,t);r>0&&n[r-1<<1]===t&&r--;for(let a=r;a<s;a++)n[a<<1]+=i;return e}}function yo(o){return o instanceof Uint32Array?o:new Uint32Array(o)}class mu{constructor(e){this._lineTokens=[],this._len=0,this._languageIdCodec=e}flush(){this._lineTokens=[],this._len=0}get hasTokens(){return this._lineTokens.length>0}getTokens(e,t,i){let n=null;if(t<this._len&&(n=this._lineTokens[t]),n!==null&&n!==So)return new _t(yo(n),i,this._languageIdCodec);const s=new Uint32Array(2);return s[0]=i.length,s[1]=O1(this._languageIdCodec.encodeLanguageId(e)),new _t(s,i,this._languageIdCodec)}static _massageTokens(e,t,i){const n=i?yo(i):null;if(t===0){let s=!1;if(n&&n.length>1&&(s=Vi.getLanguageId(n[1])!==e),!s)return So}if(!n||n.length===0){const s=new Uint32Array(2);return s[0]=t,s[1]=O1(e),s.buffer}return n[n.length-2]=t,n.byteOffset===0&&n.byteLength===n.buffer.byteLength?n.buffer:n}_ensureLine(e){for(;e>=this._len;)this._lineTokens[this._len]=null,this._len++}_deleteLines(e,t){t!==0&&(e+t>this._len&&(t=this._len-e),this._lineTokens.splice(e,t),this._len-=t)}_insertLines(e,t){if(t===0)return;const i=[];for(let n=0;n<t;n++)i[n]=null;this._lineTokens=l.arrayInsert(this._lineTokens,e,i),this._len+=t}setTokens(e,t,i,n,s){const r=mu._massageTokens(this._languageIdCodec.encodeLanguageId(e),i,n);this._ensureLine(t);const a=this._lineTokens[t];return this._lineTokens[t]=r,s?!mu._equals(a,r):!1}static _equals(e,t){if(!e||!t)return!e&&!t;const i=yo(e),n=yo(t);if(i.length!==n.length)return!1;for(let s=0,r=i.length;s<r;s++)if(i[s]!==n[s])return!1;return!0}acceptEdit(e,t,i){this._acceptDeleteRange(e),this._acceptInsertText(new l.Position(e.startLineNumber,e.startColumn),t,i)}_acceptDeleteRange(e){const t=e.startLineNumber-1;if(t>=this._len)return;if(e.startLineNumber===e.endLineNumber){if(e.startColumn===e.endColumn)return;this._lineTokens[t]=Ds.delete(this._lineTokens[t],e.startColumn-1,e.endColumn-1);return}this._lineTokens[t]=Ds.deleteEnding(this._lineTokens[t],e.startColumn-1);const i=e.endLineNumber-1;let n=null;i<this._len&&(n=Ds.deleteBeginning(this._lineTokens[i],e.endColumn-1)),this._lineTokens[t]=Ds.append(this._lineTokens[t],n),this._deleteLines(e.startLineNumber,e.endLineNumber-e.startLineNumber)}_acceptInsertText(e,t,i){if(t===0&&i===0)return;const n=e.lineNumber-1;if(!(n>=this._len)){if(t===0){this._lineTokens[n]=Ds.insert(this._lineTokens[n],e.column-1,i);return}this._lineTokens[n]=Ds.deleteEnding(this._lineTokens[n],e.column-1),this._lineTokens[n]=Ds.insert(this._lineTokens[n],e.column-1,i),this._insertLines(e.lineNumber,t)}}setMultilineTokens(e,t){if(e.length===0)return{changes:[]};const i=[];for(let n=0,s=e.length;n<s;n++){const r=e[n];let a=0,c=0,h=!1;for(let d=r.startLineNumber;d<=r.endLineNumber;d++)h?(this.setTokens(t.getLanguageId(),d-1,t.getLineLength(d),r.getLineTokens(d),!1),c=d):this.setTokens(t.getLanguageId(),d-1,t.getLineLength(d),r.getLineTokens(d),!0)&&(h=!0,a=d,c=d);h&&i.push({fromLineNumber:a,toLineNumber:c})}return{changes:i}}}function O1(o){return(o<<0|0|0|32768|2<<24|1024)>>>0}class s6 extends y1{constructor(e,t,i,n){super(e,t),this.getLanguageId=i,this._tokenizer=null,this._backgroundTokenizationState=1,this._onDidChangeBackgroundTokenizationState=this._register(new l.Emitter),this.onDidChangeBackgroundTokenizationState=this._onDidChangeBackgroundTokenizationState.event,this._defaultBackgroundTokenizer=null,this._backgroundTokenizer=this._register(new l.MutableDisposable),this._tokens=new mu(this._languageIdCodec),this._debugBackgroundTokenizer=this._register(new l.MutableDisposable),this._attachedViewStates=this._register(new l.DisposableMap),this._register(l.TokenizationRegistry.onDidChange(s=>{const r=this.getLanguageId();s.changedLanguages.indexOf(r)!==-1&&this.todo_resetTokenization()})),this.todo_resetTokenization(),this._register(n.onDidChangeVisibleRanges(({view:s,state:r})=>{if(r){let a=this._attachedViewStates.get(s);a||(a=new SK(()=>this.refreshRanges(a.lineRanges)),this._attachedViewStates.set(s,a)),a.handleStateChange(r)}else this._attachedViewStates.deleteAndDispose(s)}))}todo_resetTokenization(e=!0){this._tokens.flush(),this._debugBackgroundTokens?.flush(),this._debugBackgroundStates&&(this._debugBackgroundStates=new jw(this._textModel.getLineCount())),e&&this._onDidChangeTokens.fire({semanticTokensApplied:!1,ranges:[{fromLineNumber:1,toLineNumber:this._textModel.getLineCount()}]});const t=()=>{if(this._textModel.isTooLargeForTokenization())return[null,null];const s=l.TokenizationRegistry.get(this.getLanguageId());if(!s)return[null,null];let r;try{r=s.getInitialState()}catch(a){return l.onUnexpectedError(a),[null,null]}return[s,r]},[i,n]=t();if(i&&n?this._tokenizer=new jK(this._textModel.getLineCount(),i,this._textModel,this._languageIdCodec):this._tokenizer=null,this._backgroundTokenizer.clear(),this._defaultBackgroundTokenizer=null,this._tokenizer){const s={setTokens:r=>{this.setTokens(r)},setFontInfo:r=>{this.setFontInfo(r)},backgroundTokenizationFinished:()=>{if(this._backgroundTokenizationState===2)return;const r=2;this._backgroundTokenizationState=r,this._onDidChangeBackgroundTokenizationState.fire()},setEndState:(r,a)=>{if(!this._tokenizer)return;const c=this._tokenizer.store.getFirstInvalidEndStateLineNumber();c!==null&&r>=c&&this._tokenizer?.store.setEndState(r,a)}};i&&i.createBackgroundTokenizer&&!i.backgroundTokenizerShouldOnlyVerifyTokens&&(this._backgroundTokenizer.value=i.createBackgroundTokenizer(this._textModel,s)),!this._backgroundTokenizer.value&&!this._textModel.isTooLargeForTokenization()&&(this._backgroundTokenizer.value=this._defaultBackgroundTokenizer=new ZK(this._tokenizer,s),this._defaultBackgroundTokenizer.handleChanges()),i?.backgroundTokenizerShouldOnlyVerifyTokens&&i.createBackgroundTokenizer?(this._debugBackgroundTokens=new mu(this._languageIdCodec),this._debugBackgroundStates=new jw(this._textModel.getLineCount()),this._debugBackgroundTokenizer.clear(),this._debugBackgroundTokenizer.value=i.createBackgroundTokenizer(this._textModel,{setTokens:r=>{this._debugBackgroundTokens?.setMultilineTokens(r,this._textModel)},setFontInfo:r=>{this.setFontInfo(r)},backgroundTokenizationFinished(){},setEndState:(r,a)=>{this._debugBackgroundStates?.setEndState(r,a)}})):(this._debugBackgroundTokens=void 0,this._debugBackgroundStates=void 0,this._debugBackgroundTokenizer.value=void 0)}this.refreshAllVisibleLineTokens()}handleDidChangeAttached(){this._defaultBackgroundTokenizer?.handleChanges()}handleDidChangeContent(e){if(e.isFlush)this.todo_resetTokenization(!1);else if(!e.isEolChange){for(const t of e.changes){const[i,n]=fr(t.text);this._tokens.acceptEdit(t.range,i,n),this._debugBackgroundTokens?.acceptEdit(t.range,i,n)}this._debugBackgroundStates?.acceptChanges(e.changes),this._tokenizer&&this._tokenizer.store.acceptChanges(e.changes),this._defaultBackgroundTokenizer?.handleChanges()}}setTokens(e){const{changes:t}=this._tokens.setMultilineTokens(e,this._textModel);return t.length>0&&this._onDidChangeTokens.fire({semanticTokensApplied:!1,ranges:t}),{changes:t}}setFontInfo(e){this._onDidChangeFontTokens.fire({changes:e})}refreshAllVisibleLineTokens(){const e=l.LineRange.joinMany([...this._attachedViewStates].map(([t,i])=>i.lineRanges));this.refreshRanges(e)}refreshRanges(e){for(const t of e)this.refreshRange(t.startLineNumber,t.endLineNumberExclusive-1)}refreshRange(e,t){if(!this._tokenizer)return;e=Math.max(1,Math.min(this._textModel.getLineCount(),e)),t=Math.min(this._textModel.getLineCount(),t);const i=new Gw,{heuristicTokens:n}=this._tokenizer.tokenizeHeuristically(i,e,t),s=this.setTokens(i.finalize());if(n)for(const r of s.changes)this._backgroundTokenizer.value?.requestTokens(r.fromLineNumber,r.toLineNumber+1);this._defaultBackgroundTokenizer?.checkFinished()}forceTokenization(e){const t=new Gw;this._tokenizer?.updateTokensUntilLine(t,e),this.setTokens(t.finalize()),this._defaultBackgroundTokenizer?.checkFinished()}hasAccurateTokensForLine(e){return this._tokenizer?this._tokenizer.hasAccurateTokensForLine(e):!0}isCheapToTokenize(e){return this._tokenizer?this._tokenizer.isCheapToTokenize(e):!0}getLineTokens(e){const t=this._textModel.getLineContent(e),i=this._tokens.getTokens(this._textModel.getLanguageId(),e-1,t);if(this._debugBackgroundTokens&&this._debugBackgroundStates&&this._tokenizer&&this._debugBackgroundStates.getFirstInvalidEndStateLineNumberOrMax()>e&&this._tokenizer.store.getFirstInvalidEndStateLineNumberOrMax()>e){const n=this._debugBackgroundTokens.getTokens(this._textModel.getLanguageId(),e-1,t);!i.equals(n)&&this._debugBackgroundTokenizer.value?.reportMismatchingTokens&&this._debugBackgroundTokenizer.value.reportMismatchingTokens(e)}return i}getTokenTypeIfInsertingCharacter(e,t,i){if(!this._tokenizer)return 0;const n=this._textModel.validatePosition(new l.Position(e,t));return this.forceTokenization(n.lineNumber),this._tokenizer.getTokenTypeIfInsertingCharacter(n,i)}tokenizeLinesAt(e,t){return this._tokenizer?(this.forceTokenization(e),this._tokenizer.tokenizeLinesAt(e,t)):null}get hasTokens(){return this._tokens.hasTokens}}var o6=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},Om=function(o,e){return function(t,i){e(t,i,o)}},Pm;let Xw=Pm=class extends HI{constructor(e,t,i,n,s,r,a,c){super(),this._textModel=e,this._bracketPairsTextModelPart=t,this._languageId=i,this._attachedViews=n,this._languageService=s,this._languageConfigurationService=r,this._instantiationService=a,this._treeSitterLibraryService=c,this._onDidChangeFontTokens=this._register(new l.Emitter),this.onDidChangeFontTokens=this._onDidChangeFontTokens.event,this._languageIdObs=W(this,this._languageId),this._useTreeSitter=Z(this,d=>{const u=this._languageIdObs.read(d);return this._treeSitterLibraryService.supportsLanguage(u,d)}),this.tokens=Z(this,d=>{let u;return this._useTreeSitter.read(d)?u=d.store.add(this._instantiationService.createInstance(Zw,this._languageIdObs,this._languageService.languageIdCodec,this._textModel,this._attachedViews.visibleLineRanges)):u=d.store.add(new s6(this._languageService.languageIdCodec,this._textModel,()=>this._languageId,this._attachedViews)),d.store.add(u.onDidChangeTokens(f=>{this._emitModelTokensChangedEvent(f)})),d.store.add(u.onDidChangeFontTokens(f=>{this._textModel._isDisposing()||this._onDidChangeFontTokens.fire(f)})),d.store.add(u.onDidChangeBackgroundTokenizationState(f=>{this._bracketPairsTextModelPart.handleDidChangeBackgroundTokenizationState()})),u});let h=!1;this.tokens.recomputeInitiallyAndOnChange(this._store,d=>{h&&d.todo_resetTokenization(),h=!0}),this._semanticTokens=new Qw(this._languageService.languageIdCodec),this._onDidChangeLanguage=this._register(new l.Emitter),this.onDidChangeLanguage=this._onDidChangeLanguage.event,this._onDidChangeLanguageConfiguration=this._register(new l.Emitter),this.onDidChangeLanguageConfiguration=this._onDidChangeLanguageConfiguration.event,this._onDidChangeTokens=this._register(new l.Emitter),this.onDidChangeTokens=this._onDidChangeTokens.event,this._onDidChangeFontTokens=this._register(new l.Emitter),this.onDidChangeFontTokens=this._onDidChangeFontTokens.event}handleLanguageConfigurationServiceChange(e){e.affects(this._languageId)&&this._onDidChangeLanguageConfiguration.fire({})}handleDidChangeContent(e){if(e.isFlush)this._semanticTokens.flush();else if(!e.isEolChange)for(const t of e.changes){const[i,n,s]=fr(t.text);this._semanticTokens.acceptEdit(t.range,i,n,s,t.text.length>0?t.text.charCodeAt(0):0)}this.tokens.get().handleDidChangeContent(e)}handleDidChangeAttached(){this.tokens.get().handleDidChangeAttached()}getLineTokens(e){this.validateLineNumber(e);const t=this.tokens.get().getLineTokens(e);return this._semanticTokens.addSparseTokens(e,t)}_emitModelTokensChangedEvent(e){this._textModel._isDisposing()||(this._bracketPairsTextModelPart.handleDidChangeTokens(e),this._onDidChangeTokens.fire(e))}validateLineNumber(e){if(e<1||e>this._textModel.getLineCount())throw new l.BugIndicatingError("Illegal value for lineNumber")}get hasTokens(){return this.tokens.get().hasTokens}resetTokenization(){this.tokens.get().todo_resetTokenization()}get backgroundTokenizationState(){return this.tokens.get().backgroundTokenizationState}forceTokenization(e){this.validateLineNumber(e),this.tokens.get().forceTokenization(e)}hasAccurateTokensForLine(e){return this.validateLineNumber(e),this.tokens.get().hasAccurateTokensForLine(e)}isCheapToTokenize(e){return this.validateLineNumber(e),this.tokens.get().isCheapToTokenize(e)}tokenizeIfCheap(e){this.validateLineNumber(e),this.tokens.get().tokenizeIfCheap(e)}getTokenTypeIfInsertingCharacter(e,t,i){return this.tokens.get().getTokenTypeIfInsertingCharacter(e,t,i)}tokenizeLinesAt(e,t){return this.tokens.get().tokenizeLinesAt(e,t)}setSemanticTokens(e,t){this._semanticTokens.set(e,t,this._textModel),this._emitModelTokensChangedEvent({semanticTokensApplied:e!==null,ranges:[{fromLineNumber:1,toLineNumber:this._textModel.getLineCount()}]})}hasCompleteSemanticTokens(){return this._semanticTokens.isComplete()}hasSomeSemanticTokens(){return!this._semanticTokens.isEmpty()}setPartialSemanticTokens(e,t){if(this.hasCompleteSemanticTokens())return;const i=this._textModel.validateRange(this._semanticTokens.setPartial(e,t));this._emitModelTokensChangedEvent({semanticTokensApplied:!0,ranges:[{fromLineNumber:i.startLineNumber,toLineNumber:i.endLineNumber}]})}getWordAtPosition(e){this.assertNotDisposed();const t=this._textModel.validatePosition(e),i=this._textModel.getLineContent(t.lineNumber),n=this.getLineTokens(t.lineNumber),s=n.findTokenIndexAtOffset(t.column-1),[r,a]=Pm._findLanguageBoundaries(n,s),c=l.getWordAtText(t.column,this.getLanguageConfiguration(n.getLanguageId(s)).getWordDefinition(),i.substring(r,a),r);if(c&&c.startColumn<=e.column&&e.column<=c.endColumn)return c;if(s>0&&r===t.column-1){const[h,d]=Pm._findLanguageBoundaries(n,s-1),u=l.getWordAtText(t.column,this.getLanguageConfiguration(n.getLanguageId(s-1)).getWordDefinition(),i.substring(h,d),h);if(u&&u.startColumn<=e.column&&e.column<=u.endColumn)return u}return null}getLanguageConfiguration(e){return this._languageConfigurationService.getLanguageConfiguration(e)}static _findLanguageBoundaries(e,t){const i=e.getLanguageId(t);let n=0;for(let r=t;r>=0&&e.getLanguageId(r)===i;r--)n=e.getStartOffset(r);let s=e.getLineContent().length;for(let r=t,a=e.getCount();r<a&&e.getLanguageId(r)===i;r++)s=e.getEndOffset(r);return[n,s]}getWordUntilPosition(e){const t=this.getWordAtPosition(e);return t?{word:t.word.substr(0,e.column-t.startColumn),startColumn:t.startColumn,endColumn:e.column}:{word:"",startColumn:e.column,endColumn:e.column}}getLanguageId(){return this._languageId}getLanguageIdAtPosition(e,t){const i=this._textModel.validatePosition(new l.Position(e,t)),n=this.getLineTokens(i.lineNumber);return n.getLanguageId(n.findTokenIndexAtOffset(i.column-1))}setLanguageId(e,t="api"){if(this._languageId===e)return;const i={oldLanguage:this._languageId,newLanguage:e,source:t};this._languageId=e,this._languageIdObs.set(e,void 0),this._bracketPairsTextModelPart.handleDidChangeLanguage(i),this._onDidChangeLanguage.fire(i),this._onDidChangeLanguageConfiguration.fire({})}};Xw=Pm=o6([Om(4,yt),Om(5,ms),Om(6,me),Om(7,Yw)],Xw);var r6=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},km=function(o,e){return function(t,i){e(t,i,o)}},Fa;function a6(o){const e=new S1;return e.acceptChunk(o),e.finish()}function l6(o){const e=new S1;let t;for(;typeof(t=o.read())=="string";)e.acceptChunk(t);return e.finish()}function P1(o,e){let t;return typeof o=="string"?t=a6(o):l.isITextSnapshot(o)?t=l6(o):t=o,t.create(e)}let Fm=0;const c6=999,h6=1e4,d6=300;class u6{constructor(e){this._source=e,this._eos=!1}read(){if(this._eos)return null;const e=[];let t=0,i=0;do{const n=this._source.read();if(n===null)return this._eos=!0,t===0?null:e.join("");if(n.length>0&&(e[t++]=n,i+=n.length),i>=64*1024)return e.join("")}while(!0)}}const pu=()=>{throw new Error("Invalid change accessor")};_.TextModel=(os=class extends l.Disposable{static resolveOptions(e,t){if(t.detectIndentation){const i=r1(e,t.tabSize,t.insertSpaces);return new l.TextModelResolvedOptions({tabSize:i.tabSize,indentSize:"tabSize",insertSpaces:i.insertSpaces,trimAutoWhitespace:t.trimAutoWhitespace,defaultEOL:t.defaultEOL,bracketPairColorizationOptions:t.bracketPairColorizationOptions})}return new l.TextModelResolvedOptions(t)}get onDidChangeLanguage(){return this._tokenizationTextModelPart.onDidChangeLanguage}get onDidChangeLanguageConfiguration(){return this._tokenizationTextModelPart.onDidChangeLanguageConfiguration}get onDidChangeTokens(){return this._tokenizationTextModelPart.onDidChangeTokens}get onDidChangeOptions(){return this._onDidChangeOptions.event}get onDidChangeAttached(){return this._onDidChangeAttached.event}get onDidChangeLineHeight(){return this._onDidChangeLineHeight.event}get onDidChangeFont(){return this._onDidChangeFont.event}onDidChangeContent(e){return this._eventEmitter.event(t=>e(t.contentChangedEvent))}_isDisposing(){return this.__isDisposing}get tokenization(){return this._tokenizationTextModelPart}get bracketPairs(){return this._bracketPairs}get guides(){return this._guidesTextModelPart}constructor(e,t,i,n=null,s,r,a,c){super(),this._undoRedoService=s,this._languageService=r,this._languageConfigurationService=a,this.instantiationService=c,this._onWillDispose=this._register(new l.Emitter),this.onWillDispose=this._onWillDispose.event,this._onDidChangeDecorations=this._register(new b6((m,p,b)=>this.handleBeforeFireDecorationsChangedEvent(m,p,b))),this.onDidChangeDecorations=this._onDidChangeDecorations.event,this._onDidChangeOptions=this._register(new l.Emitter),this._onDidChangeAttached=this._register(new l.Emitter),this._onDidChangeLineHeight=this._register(new l.Emitter),this._onDidChangeFont=this._register(new l.Emitter),this._eventEmitter=this._register(new C6),this._languageSelectionListener=this._register(new l.MutableDisposable),this._deltaDecorationCallCnt=0,this._attachedViews=this._register(new CK),this._viewModels=new Set,Fm++,this.id="$model"+Fm,this.isForSimpleWidget=i.isForSimpleWidget,typeof n>"u"||n===null?this._associatedResource=l.URI.parse("inmemory://model/"+Fm):this._associatedResource=n,this._attachedEditorCount=0;const{textBuffer:h,disposable:d}=P1(e,i.defaultEOL);this._buffer=h,this._bufferDisposable=d;const u=this._buffer.getLineCount(),f=this._buffer.getValueLengthInRange(new l.Range(1,1,u,this._buffer.getLineLength(u)+1),0);i.largeFileOptimizations?(this._isTooLargeForTokenization=f>Fa.LARGE_FILE_SIZE_THRESHOLD||u>Fa.LARGE_FILE_LINE_COUNT_THRESHOLD,this._isTooLargeForHeapOperation=f>Fa.LARGE_FILE_HEAP_OPERATION_THRESHOLD):(this._isTooLargeForTokenization=!1,this._isTooLargeForHeapOperation=!1),this._options=Fa.resolveOptions(this._buffer,i);const g=typeof t=="string"?t:t.languageId;typeof t!="string"&&(this._languageSelectionListener.value=t.onDidChange(()=>this._setLanguage(t.languageId))),this._bracketPairs=this._register(new Y5(this,this._languageConfigurationService)),this._guidesTextModelPart=this._register(new B$(this,this._languageConfigurationService)),this._decorationProvider=this._register(new Q5(this)),this._tokenizationTextModelPart=this.instantiationService.createInstance(Xw,this,this._bracketPairs,g,this._attachedViews),this._fontTokenDecorationsProvider=this._register(new $w(this,this._tokenizationTextModelPart)),this._isTooLargeForSyncing=f>Fa._MODEL_SYNC_LIMIT,this._versionId=1,this._alternativeVersionId=1,this._initialUndoRedoSnapshot=null,this._isDisposed=!1,this.__isDisposing=!1,this._instanceId=l.singleLetterHash(Fm),this._lastDecorationId=0,this._decorations=Object.create(null),this._decorationsTree=new F1,this._commandManager=new Rw(this,this._undoRedoService),this._isUndoing=!1,this._isRedoing=!1,this._trimAutoWhitespaceLines=null,this._register(this._decorationProvider.onDidChange(()=>{this._onDidChangeDecorations.beginDeferredEmit(),this._onDidChangeDecorations.fire(),this._onDidChangeDecorations.endDeferredEmit()})),this._register(this._fontTokenDecorationsProvider.onDidChangeLineHeight(m=>{this._onDidChangeDecorations.beginDeferredEmit(),this._onDidChangeDecorations.fire(),this._fireOnDidChangeLineHeight(m),this._onDidChangeDecorations.endDeferredEmit()})),this._register(this._fontTokenDecorationsProvider.onDidChangeFont(m=>{this._onDidChangeDecorations.beginDeferredEmit(),this._onDidChangeDecorations.fire(),this._fireOnDidChangeFont(m),this._onDidChangeDecorations.endDeferredEmit()})),this._languageService.requestRichLanguageFeatures(g),this._register(this._languageConfigurationService.onDidChange(m=>{this._bracketPairs.handleLanguageConfigurationServiceChange(m),this._tokenizationTextModelPart.handleLanguageConfigurationServiceChange(m)}))}dispose(){this.__isDisposing=!0,this._onWillDispose.fire(),this._tokenizationTextModelPart.dispose(),this._isDisposed=!0,super.dispose(),this._bufferDisposable.dispose(),this.__isDisposing=!1;const e=new Rc([],"",`
|
||
`,!1,!1,!0,!0);e.dispose(),this._buffer=e,this._bufferDisposable=l.Disposable.None}_assertNotDisposed(){if(this._isDisposed)throw new l.BugIndicatingError("Model is disposed!")}registerViewModel(e){this._viewModels.add(e)}unregisterViewModel(e){this._viewModels.delete(e)}getTextBuffer(){return this._assertNotDisposed(),this._buffer}_emitContentChangedEvent(e,t,i=null){if(this.__isDisposing)return;this._tokenizationTextModelPart.handleDidChangeContent(t),this._bracketPairs.handleDidChangeContent(t),this._fontTokenDecorationsProvider.handleDidChangeContent(t);const n=new Ra(e,t);i&&(n.rawContentChangedEvent.resultingSelection=i),this._onDidChangeContentOrInjectedText(n),this._eventEmitter.fire(n)}setValue(e,t=$i.setValue()){if(this._assertNotDisposed(),e==null)throw l.illegalArgument();const{textBuffer:i,disposable:n}=P1(e,this._options.defaultEOL);this._setValueFromTextBuffer(i,n,t)}_createContentChanged2(e,t,i,n,s,r,a,c,h,d){return{changes:[{range:e,rangeOffset:t,rangeLength:i,text:s}],eol:this._buffer.getEOL(),isEolChange:h,versionId:this.getVersionId(),isUndoing:r,isRedoing:a,isFlush:c,detailedReasons:[d],detailedReasonsChangeLengths:[1]}}_setValueFromTextBuffer(e,t,i){this._assertNotDisposed();const n=this.getFullModelRange(),s=this.getValueLengthInRange(n),r=this.getLineCount(),a=this.getLineMaxColumn(r);this._buffer=e,this._bufferDisposable.dispose(),this._bufferDisposable=t,this._increaseVersionId(),this._decorations=Object.create(null),this._decorationsTree=new F1,this._commandManager.clear(),this._trimAutoWhitespaceLines=null,this._emitContentChangedEvent(new Dc([new d5],this._versionId,!1,!1),this._createContentChanged2(new l.Range(1,1,r,a),0,s,new l.Position(r,a),this.getValue(),!1,!1,!0,!1,i))}setEOL(e){this._assertNotDisposed();const t=e===1?`\r
|
||
`:`
|
||
`;if(this._buffer.getEOL()===t)return;const i=this.getFullModelRange(),n=this.getValueLengthInRange(i),s=this.getLineCount(),r=this.getLineMaxColumn(s);this._onBeforeEOLChange(),this._buffer.setEOL(t),this._increaseVersionId(),this._onAfterEOLChange(),this._emitContentChangedEvent(new Dc([new p5],this._versionId,!1,!1),this._createContentChanged2(new l.Range(1,1,s,r),0,n,new l.Position(s,r),this.getValue(),!1,!1,!1,!0,$i.eolChange()))}_onBeforeEOLChange(){this._decorationsTree.ensureAllNodesHaveRanges(this)}_onAfterEOLChange(){const e=this.getVersionId(),t=this._decorationsTree.collectNodesPostOrder();for(let i=0,n=t.length;i<n;i++){const s=t[i],r=s.range,a=s.cachedAbsoluteStart-s.start,c=this._buffer.getOffsetAt(r.startLineNumber,r.startColumn),h=this._buffer.getOffsetAt(r.endLineNumber,r.endColumn);s.cachedAbsoluteStart=c,s.cachedAbsoluteEnd=h,s.cachedVersionId=e,s.start=c-a,s.end=h-a,pr(s)}}onBeforeAttached(){return this._attachedEditorCount++,this._attachedEditorCount===1&&(this._tokenizationTextModelPart.handleDidChangeAttached(),this._onDidChangeAttached.fire(void 0)),this._attachedViews.attachView()}onBeforeDetached(e){this._attachedEditorCount--,this._attachedEditorCount===0&&(this._tokenizationTextModelPart.handleDidChangeAttached(),this._onDidChangeAttached.fire(void 0)),this._attachedViews.detachView(e)}isAttachedToEditor(){return this._attachedEditorCount>0}getAttachedEditorCount(){return this._attachedEditorCount}isTooLargeForSyncing(){return this._isTooLargeForSyncing}isTooLargeForTokenization(){return this._isTooLargeForTokenization}isTooLargeForHeapOperation(){return this._isTooLargeForHeapOperation}isDisposed(){return this._isDisposed}isDominatedByLongLines(){if(this._assertNotDisposed(),this.isTooLargeForTokenization())return!1;let e=0,t=0;const i=this._buffer.getLineCount();for(let n=1;n<=i;n++){const s=this._buffer.getLineLength(n);s>=h6?t+=s:e+=s}return t>e}get uri(){return this._associatedResource}getOptions(){return this._assertNotDisposed(),this._options}getFormattingOptions(){return{tabSize:this._options.indentSize,insertSpaces:this._options.insertSpaces}}updateOptions(e){this._assertNotDisposed();const t=typeof e.tabSize<"u"?e.tabSize:this._options.tabSize,i=typeof e.indentSize<"u"?e.indentSize:this._options.originalIndentSize,n=typeof e.insertSpaces<"u"?e.insertSpaces:this._options.insertSpaces,s=typeof e.trimAutoWhitespace<"u"?e.trimAutoWhitespace:this._options.trimAutoWhitespace,r=typeof e.bracketColorizationOptions<"u"?e.bracketColorizationOptions:this._options.bracketPairColorizationOptions,a=new l.TextModelResolvedOptions({tabSize:t,indentSize:i,insertSpaces:n,defaultEOL:this._options.defaultEOL,trimAutoWhitespace:s,bracketPairColorizationOptions:r});if(this._options.equals(a))return;const c=this._options.createChangeEvent(a);this._options=a,this._bracketPairs.handleDidChangeOptions(c),this._decorationProvider.handleDidChangeOptions(c),this._onDidChangeOptions.fire(c)}detectIndentation(e,t){this._assertNotDisposed();const i=r1(this._buffer,t,e);this.updateOptions({insertSpaces:i.insertSpaces,tabSize:i.tabSize,indentSize:i.tabSize})}normalizeIndentation(e){return this._assertNotDisposed(),xv(e,this._options.indentSize,this._options.insertSpaces)}getVersionId(){return this._assertNotDisposed(),this._versionId}mightContainRTL(){return this._buffer.mightContainRTL()}mightContainUnusualLineTerminators(){return this._buffer.mightContainUnusualLineTerminators()}removeUnusualLineTerminators(e=null){const t=this.findMatches(l.UNUSUAL_LINE_TERMINATORS.source,!1,!0,!1,null,!1,1073741824);this._buffer.resetMightContainUnusualLineTerminators(),this.pushEditOperations(e,t.map(i=>({range:i.range,text:null})),()=>null)}mightContainNonBasicASCII(){return this._buffer.mightContainNonBasicASCII()}getAlternativeVersionId(){return this._assertNotDisposed(),this._alternativeVersionId}getInitialUndoRedoSnapshot(){return this._assertNotDisposed(),this._initialUndoRedoSnapshot}getOffsetAt(e){this._assertNotDisposed();const t=this._validatePosition(e.lineNumber,e.column,0);return this._buffer.getOffsetAt(t.lineNumber,t.column)}getPositionAt(e){this._assertNotDisposed();const t=Math.min(this._buffer.getLength(),Math.max(0,e));return this._buffer.getPositionAt(t)}_increaseVersionId(){this._versionId=this._versionId+1,this._alternativeVersionId=this._versionId}_overwriteVersionId(e){this._versionId=e}_overwriteAlternativeVersionId(e){this._alternativeVersionId=e}_overwriteInitialUndoRedoSnapshot(e){this._initialUndoRedoSnapshot=e}getValue(e,t=!1){if(this._assertNotDisposed(),this.isTooLargeForHeapOperation())throw new l.BugIndicatingError("Operation would exceed heap memory limits");const i=this.getFullModelRange(),n=this.getValueInRange(i,e);return t?this._buffer.getBOM()+n:n}createSnapshot(e=!1){return new u6(this._buffer.createSnapshot(e))}getValueLength(e,t=!1){this._assertNotDisposed();const i=this.getFullModelRange(),n=this.getValueLengthInRange(i,e);return t?this._buffer.getBOM().length+n:n}getValueInRange(e,t=0){return this._assertNotDisposed(),this._buffer.getValueInRange(this.validateRange(e),t)}getValueLengthInRange(e,t=0){return this._assertNotDisposed(),this._buffer.getValueLengthInRange(this.validateRange(e),t)}getCharacterCountInRange(e,t=0){return this._assertNotDisposed(),this._buffer.getCharacterCountInRange(this.validateRange(e),t)}getLineCount(){return this._assertNotDisposed(),this._buffer.getLineCount()}getLineContent(e){if(this._assertNotDisposed(),e<1||e>this.getLineCount())throw new l.BugIndicatingError("Illegal value for lineNumber");return this._buffer.getLineContent(e)}getLineLength(e){if(this._assertNotDisposed(),e<1||e>this.getLineCount())throw new l.BugIndicatingError("Illegal value for lineNumber");return this._buffer.getLineLength(e)}getLinesContent(){if(this._assertNotDisposed(),this.isTooLargeForHeapOperation())throw new l.BugIndicatingError("Operation would exceed heap memory limits");return this._buffer.getLinesContent()}getEOL(){return this._assertNotDisposed(),this._buffer.getEOL()}getEndOfLineSequence(){return this._assertNotDisposed(),this._buffer.getEOL()===`
|
||
`?0:1}getLineMinColumn(e){return this._assertNotDisposed(),1}getLineMaxColumn(e){if(this._assertNotDisposed(),e<1||e>this.getLineCount())throw new l.BugIndicatingError("Illegal value for lineNumber");return this._buffer.getLineLength(e)+1}getLineFirstNonWhitespaceColumn(e){if(this._assertNotDisposed(),e<1||e>this.getLineCount())throw new l.BugIndicatingError("Illegal value for lineNumber");return this._buffer.getLineFirstNonWhitespaceColumn(e)}getLineLastNonWhitespaceColumn(e){if(this._assertNotDisposed(),e<1||e>this.getLineCount())throw new l.BugIndicatingError("Illegal value for lineNumber");return this._buffer.getLineLastNonWhitespaceColumn(e)}_validateRangeRelaxedNoAllocations(e){const t=this._buffer.getLineCount(),i=e.startLineNumber,n=e.startColumn;let s=Math.floor(typeof i=="number"&&!isNaN(i)?i:1),r=Math.floor(typeof n=="number"&&!isNaN(n)?n:1);if(s<1)s=1,r=1;else if(s>t)s=t,r=this.getLineMaxColumn(s);else if(r<=1)r=1;else{const u=this.getLineMaxColumn(s);r>=u&&(r=u)}const a=e.endLineNumber,c=e.endColumn;let h=Math.floor(typeof a=="number"&&!isNaN(a)?a:1),d=Math.floor(typeof c=="number"&&!isNaN(c)?c:1);if(h<1)h=1,d=1;else if(h>t)h=t,d=this.getLineMaxColumn(h);else if(d<=1)d=1;else{const u=this.getLineMaxColumn(h);d>=u&&(d=u)}return i===s&&n===r&&a===h&&c===d&&e instanceof l.Range&&!(e instanceof l.Selection)?e:new l.Range(s,r,h,d)}_isValidPosition(e,t,i){if(typeof e!="number"||typeof t!="number"||isNaN(e)||isNaN(t)||e<1||t<1||(e|0)!==e||(t|0)!==t)return!1;const n=this._buffer.getLineCount();if(e>n)return!1;if(t===1)return!0;const s=this.getLineMaxColumn(e);if(t>s)return!1;if(i===1){const r=this._buffer.getLineCharCode(e,t-2);if(l.isHighSurrogate(r))return!1}return!0}_validatePosition(e,t,i){const n=Math.floor(typeof e=="number"&&!isNaN(e)?e:1),s=Math.floor(typeof t=="number"&&!isNaN(t)?t:1),r=this._buffer.getLineCount();if(n<1)return new l.Position(1,1);if(n>r)return new l.Position(r,this.getLineMaxColumn(r));if(s<=1)return new l.Position(n,1);const a=this.getLineMaxColumn(n);if(s>=a)return new l.Position(n,a);if(i===1){const c=this._buffer.getLineCharCode(n,s-2);if(l.isHighSurrogate(c))return new l.Position(n,s-1)}return new l.Position(n,s)}validatePosition(e){return this._assertNotDisposed(),e instanceof l.Position&&this._isValidPosition(e.lineNumber,e.column,1)?e:this._validatePosition(e.lineNumber,e.column,1)}isValidRange(e){return this._isValidRange(e,1)}_isValidRange(e,t){const i=e.startLineNumber,n=e.startColumn,s=e.endLineNumber,r=e.endColumn;if(!this._isValidPosition(i,n,0)||!this._isValidPosition(s,r,0))return!1;if(t===1){const a=n>1?this._buffer.getLineCharCode(i,n-2):0,c=r>1&&r<=this._buffer.getLineLength(s)?this._buffer.getLineCharCode(s,r-2):0,h=l.isHighSurrogate(a),d=l.isHighSurrogate(c);return!h&&!d}return!0}validateRange(e){if(this._assertNotDisposed(),e instanceof l.Range&&!(e instanceof l.Selection)&&this._isValidRange(e,1))return e;const i=this._validatePosition(e.startLineNumber,e.startColumn,0),n=this._validatePosition(e.endLineNumber,e.endColumn,0),s=i.lineNumber,r=i.column,a=n.lineNumber,c=n.column;{const h=r>1?this._buffer.getLineCharCode(s,r-2):0,d=c>1&&c<=this._buffer.getLineLength(a)?this._buffer.getLineCharCode(a,c-2):0,u=l.isHighSurrogate(h),f=l.isHighSurrogate(d);return!u&&!f?new l.Range(s,r,a,c):s===a&&r===c?new l.Range(s,r-1,a,c-1):u&&f?new l.Range(s,r-1,a,c+1):u?new l.Range(s,r-1,a,c):new l.Range(s,r,a,c+1)}}modifyPosition(e,t){this._assertNotDisposed();const i=this.getOffsetAt(e)+t;return this.getPositionAt(Math.min(this._buffer.getLength(),Math.max(0,i)))}getFullModelRange(){this._assertNotDisposed();const e=this.getLineCount();return new l.Range(1,1,e,this.getLineMaxColumn(e))}findMatchesLineByLine(e,t,i,n){return this._buffer.findMatchesLineByLine(e,t,i,n)}findMatches(e,t,i,n,s,r,a=c6){this._assertNotDisposed();let c=null;t!==null&&typeof t!="boolean"&&(Array.isArray(t)||(t=[t]),t.every(u=>l.Range.isIRange(u))&&(c=t.map(u=>this.validateRange(u)))),c===null&&(c=[this.getFullModelRange()]),c=c.sort((u,f)=>u.startLineNumber-f.startLineNumber||u.startColumn-f.startColumn);const h=[];h.push(c.reduce((u,f)=>l.Range.areIntersecting(u,f)?u.plusRange(f):(h.push(u),f)));let d;if(!i&&e.indexOf(`
|
||
`)<0){const f=new l.SearchParams(e,i,n,s).parseSearchRequest();if(!f)return[];d=g=>this.findMatchesLineByLine(g,f,r,a)}else d=u=>l.TextModelSearch.findMatches(this,new l.SearchParams(e,i,n,s),u,r,a);return h.map(d).reduce((u,f)=>u.concat(f),[])}findNextMatch(e,t,i,n,s,r){this._assertNotDisposed();const a=this.validatePosition(t);if(!i&&e.indexOf(`
|
||
`)<0){const h=new l.SearchParams(e,i,n,s).parseSearchRequest();if(!h)return null;const d=this.getLineCount();let u=new l.Range(a.lineNumber,a.column,d,this.getLineMaxColumn(d)),f=this.findMatchesLineByLine(u,h,r,1);return l.TextModelSearch.findNextMatch(this,new l.SearchParams(e,i,n,s),a,r),f.length>0||(u=new l.Range(1,1,a.lineNumber,this.getLineMaxColumn(a.lineNumber)),f=this.findMatchesLineByLine(u,h,r,1),f.length>0)?f[0]:null}return l.TextModelSearch.findNextMatch(this,new l.SearchParams(e,i,n,s),a,r)}findPreviousMatch(e,t,i,n,s,r){this._assertNotDisposed();const a=this.validatePosition(t);return l.TextModelSearch.findPreviousMatch(this,new l.SearchParams(e,i,n,s),a,r)}pushStackElement(){this._commandManager.pushStackElement()}popStackElement(){this._commandManager.popStackElement()}pushEOL(e){if((this.getEOL()===`
|
||
`?0:1)!==e)try{this._onDidChangeDecorations.beginDeferredEmit(),this._eventEmitter.beginDeferredEmit(),this._initialUndoRedoSnapshot===null&&(this._initialUndoRedoSnapshot=this._undoRedoService.createSnapshot(this.uri)),this._commandManager.pushEOL(e)}finally{this._eventEmitter.endDeferredEmit(),this._onDidChangeDecorations.endDeferredEmit()}}_validateEditOperation(e){if(e instanceof l.ValidAnnotatedEditOperation)return e;const t=this.validateRange(e.range);let i=e.text;if(i){const n=i.length>0&&i.charCodeAt(i.length-1)===13;this.getEOL()===`\r
|
||
`&&n&&t.endColumn===this.getLineMaxColumn(t.endLineNumber)&&(i=i.substring(0,i.length-1))}return new l.ValidAnnotatedEditOperation(e.identifier||null,t,i,e.forceMoveMarkers||!1,e.isAutoWhitespaceEdit||!1,e._isTracked||!1)}_validateEditOperations(e){const t=[];for(let i=0,n=e.length;i<n;i++)t[i]=this._validateEditOperation(e[i]);return t}edit(e,t){this.pushEditOperations(null,e.replacements.map(i=>({range:i.range,text:i.text})),null)}pushEditOperations(e,t,i,n,s){try{return this._onDidChangeDecorations.beginDeferredEmit(),this._eventEmitter.beginDeferredEmit(),this._pushEditOperations(e,this._validateEditOperations(t),i,n,s)}finally{this._eventEmitter.endDeferredEmit(),this._onDidChangeDecorations.endDeferredEmit()}}_pushEditOperations(e,t,i,n,s){if(this._options.trimAutoWhitespace&&this._trimAutoWhitespaceLines){const r=t.map(c=>({range:this.validateRange(c.range),text:c.text}));let a=!0;if(e)for(let c=0,h=e.length;c<h;c++){const d=e[c];let u=!1;for(let f=0,g=r.length;f<g;f++){const m=r[f].range,p=m.startLineNumber>d.endLineNumber,b=d.startLineNumber>m.endLineNumber;if(!p&&!b){u=!0;break}}if(!u){a=!1;break}}if(a)for(let c=0,h=this._trimAutoWhitespaceLines.length;c<h;c++){const d=this._trimAutoWhitespaceLines[c],u=this.getLineMaxColumn(d);let f=!0;for(let g=0,m=r.length;g<m;g++){const p=r[g].range,b=r[g].text;if(!(d<p.startLineNumber||d>p.endLineNumber)&&!(d===p.startLineNumber&&p.startColumn===u&&p.isEmpty()&&b&&b.length>0&&b.charAt(0)===`
|
||
`)&&!(d===p.startLineNumber&&p.startColumn===1&&p.isEmpty()&&b&&b.length>0&&b.charAt(b.length-1)===`
|
||
`)){f=!1;break}}if(f){const g=new l.Range(d,1,d,u);t.push(new l.ValidAnnotatedEditOperation(null,g,null,!1,!1,!1))}}this._trimAutoWhitespaceLines=null}return this._initialUndoRedoSnapshot===null&&(this._initialUndoRedoSnapshot=this._undoRedoService.createSnapshot(this.uri)),this._commandManager.pushEditOperation(e,t,i,n,s)}_applyUndo(e,t,i,n){const s=e.map(r=>{const a=this.getPositionAt(r.newPosition),c=this.getPositionAt(r.newEnd);return{range:new l.Range(a.lineNumber,a.column,c.lineNumber,c.column),text:r.oldText}});this._applyUndoRedoEdits(s,t,!0,!1,i,n)}_applyRedo(e,t,i,n){const s=e.map(r=>{const a=this.getPositionAt(r.oldPosition),c=this.getPositionAt(r.oldEnd);return{range:new l.Range(a.lineNumber,a.column,c.lineNumber,c.column),text:r.newText}});this._applyUndoRedoEdits(s,t,!1,!0,i,n)}_applyUndoRedoEdits(e,t,i,n,s,r){try{this._onDidChangeDecorations.beginDeferredEmit(),this._eventEmitter.beginDeferredEmit(),this._isUndoing=i,this._isRedoing=n;const a=this._validateEditOperations(e);this._doApplyEdits(a,!1,$i.applyEdits(),r),this.setEOL(t),this._overwriteAlternativeVersionId(s)}finally{this._isUndoing=!1,this._isRedoing=!1,this._eventEmitter.endDeferredEmit(r),this._onDidChangeDecorations.endDeferredEmit()}}applyEdits(e,t,i){try{this._onDidChangeDecorations.beginDeferredEmit(),this._eventEmitter.beginDeferredEmit();const n=this._validateEditOperations(e);return this._doApplyEdits(n,t??!1,i??$i.applyEdits())}finally{this._eventEmitter.endDeferredEmit(),this._onDidChangeDecorations.endDeferredEmit()}}_doApplyEdits(e,t,i,n=null){const s=this._buffer.getLineCount(),r=this._buffer.applyEdits(e,this._options.trimAutoWhitespace,t),a=this._buffer.getLineCount(),c=r.changes;if(this._trimAutoWhitespaceLines=r.trimAutoWhitespaceLineNumbers,c.length!==0){for(let u=0,f=c.length;u<f;u++){const g=c[u];this._decorationsTree.acceptReplace(g.rangeOffset,g.rangeLength,g.text.length,g.forceMoveMarkers)}const h=[];this._increaseVersionId();let d=s;for(let u=0,f=c.length;u<f;u++){const g=c[u],[m]=fr(g.text);this._onDidChangeDecorations.fire();const p=g.range.startLineNumber,b=g.range.endLineNumber,v=b-p,C=m,w=Math.min(v,C),S=C-v,L=a-d-S+p;for(let D=w;D>=0;D--){const x=p+D,I=L+D;h.push(new PT(x,I))}if(w<v){const D=p+w,x=C-v,I=a-d-x+D;h.push(new g5(D+1,b,I))}if(w<C){const D=p+w,x=C-w,I=a-d-x+D+1;h.push(new m5(D+1,I,x))}d+=S}this._emitContentChangedEvent(new Dc(h,this.getVersionId(),this._isUndoing,this._isRedoing),{changes:c,eol:this._buffer.getEOL(),isEolChange:!1,versionId:this.getVersionId(),isUndoing:this._isUndoing,isRedoing:this._isRedoing,isFlush:!1,detailedReasons:[i],detailedReasonsChangeLengths:[c.length]},n)}return r.reverseEdits===null?void 0:r.reverseEdits}undo(){return this._undoRedoService.undo(this.uri)}canUndo(){return this._undoRedoService.canUndo(this.uri)}redo(){return this._undoRedoService.redo(this.uri)}canRedo(){return this._undoRedoService.canRedo(this.uri)}handleBeforeFireDecorationsChangedEvent(e,t,i){if(e&&e.size>0){const s=Array.from(e).map(r=>new PT(r,r));this._onDidChangeContentOrInjectedText(new kT(s))}this._fireOnDidChangeLineHeight(t),this._fireOnDidChangeFont(i)}_fireOnDidChangeLineHeight(e){if(e&&e.size>0){const i=Array.from(e).map(n=>new u5(n.ownerId,n.decorationId,n.lineNumber,n.lineHeight));this._onDidChangeLineHeight.fire(new FT(i))}}_fireOnDidChangeFont(e){if(e&&e.size>0){const i=Array.from(e).map(n=>new f5(n.ownerId,n.lineNumber));this._onDidChangeFont.fire(new BT(i))}}_onDidChangeContentOrInjectedText(e){for(const t of this._viewModels)try{t.onDidChangeContentOrInjectedText(e)}catch(i){l.onUnexpectedError(i)}for(const t of this._viewModels)try{t.emitContentChangeEvent(e)}catch(i){l.onUnexpectedError(i)}}changeDecorations(e,t=0){this._assertNotDisposed();try{return this._onDidChangeDecorations.beginDeferredEmit(),this._changeDecorations(t,e)}finally{this._onDidChangeDecorations.endDeferredEmit()}}_changeDecorations(e,t){const i={addDecoration:(s,r)=>this._deltaDecorationsImpl(e,[],[{range:s,options:r}])[0],changeDecoration:(s,r)=>{this._changeDecorationImpl(e,s,r)},changeDecorationOptions:(s,r)=>{this._changeDecorationOptionsImpl(e,s,V1(r))},removeDecoration:s=>{this._deltaDecorationsImpl(e,[s],[])},deltaDecorations:(s,r)=>s.length===0&&r.length===0?[]:this._deltaDecorationsImpl(e,s,r)};let n=null;try{n=t(i)}catch(s){l.onUnexpectedError(s)}return i.addDecoration=pu,i.changeDecoration=pu,i.changeDecorationOptions=pu,i.removeDecoration=pu,i.deltaDecorations=pu,n}deltaDecorations(e,t,i=0){if(this._assertNotDisposed(),e||(e=[]),e.length===0&&t.length===0)return[];try{return this._deltaDecorationCallCnt++,this._deltaDecorationCallCnt>1&&(console.warn("Invoking deltaDecorations recursively could lead to leaking decorations."),l.onUnexpectedError(new Error("Invoking deltaDecorations recursively could lead to leaking decorations."))),this._onDidChangeDecorations.beginDeferredEmit(),this._deltaDecorationsImpl(i,e,t)}finally{this._onDidChangeDecorations.endDeferredEmit(),this._deltaDecorationCallCnt--}}_getTrackedRange(e){return this.getDecorationRange(e)}_setTrackedRange(e,t,i){const n=e?this._decorations[e]:null;if(!n)return t?this._deltaDecorationsImpl(0,[],[{range:t,options:z1[i]}],!0)[0]:null;if(!t)return this._decorationsTree.delete(n),delete this._decorations[n.id],null;const s=this._validateRangeRelaxedNoAllocations(t),r=this._buffer.getOffsetAt(s.startLineNumber,s.startColumn),a=this._buffer.getOffsetAt(s.endLineNumber,s.endColumn);return this._decorationsTree.delete(n),n.reset(this.getVersionId(),r,a,s),n.setOptions(z1[i]),this._decorationsTree.insert(n),n.id}removeAllDecorationsWithOwnerId(e){if(this._isDisposed)return;const t=this._decorationsTree.collectNodesFromOwner(e);for(let i=0,n=t.length;i<n;i++){const s=t[i];this._decorationsTree.delete(s),delete this._decorations[s.id]}}getDecorationOptions(e){const t=this._decorations[e];return t?t.options:null}getDecorationRange(e){const t=this._decorations[e];return t?this._decorationsTree.getNodeRange(this,t):null}getLineDecorations(e,t=0,i=!1,n=!1){return e<1||e>this.getLineCount()?[]:this.getLinesDecorations(e,e,t,i,n)}getLinesDecorations(e,t,i=0,n=!1,s=!1,r=!1){const a=this.getLineCount(),c=Math.min(a,Math.max(1,e)),h=Math.min(a,Math.max(1,t)),d=this.getLineMaxColumn(h),u=new l.Range(c,1,h,d),f=this._getDecorationsInRange(u,i,n,s,r);return l.pushMany(f,this._decorationProvider.getDecorationsInRange(u,i,n,s)),l.pushMany(f,this._fontTokenDecorationsProvider.getDecorationsInRange(u,i,n,s)),f}getDecorationsInRange(e,t=0,i=!1,n=!1,s=!1,r=!1){const a=this.validateRange(e),c=this._getDecorationsInRange(a,t,i,n,r);return l.pushMany(c,this._decorationProvider.getDecorationsInRange(a,t,i,n,s)),l.pushMany(c,this._fontTokenDecorationsProvider.getDecorationsInRange(a,t,i,n,s)),c}getOverviewRulerDecorations(e=0,t=!1,i=!1){return this._decorationsTree.getAll(this,e,t,i,!0,!1)}getInjectedTextDecorations(e=0){return this._decorationsTree.getAllInjectedText(this,e)}getCustomLineHeightsDecorations(e=0){const t=this._decorationsTree.getAllCustomLineHeights(this,e);return l.pushMany(t,this._fontTokenDecorationsProvider.getAllDecorations(e)),t}getCustomLineHeightsDecorationsInRange(e,t=0){const i=this._decorationsTree.getCustomLineHeightsInInterval(this,this.getOffsetAt(e.getStartPosition()),this.getOffsetAt(e.getEndPosition()),t);return l.pushMany(i,this._fontTokenDecorationsProvider.getDecorationsInRange(e,t)),i}getLineInjectedText(e,t=0){const i=this._buffer.getOffsetAt(e,1),n=i+this._buffer.getLineLength(e),s=this._decorationsTree.getInjectedTextInInterval(this,i,n,t);return mo.fromDecorations(s).filter(r=>r.lineNumber===e)}getFontDecorationsInRange(e,t=0){const i=this._buffer.getOffsetAt(e.startLineNumber,e.startColumn),n=this._buffer.getOffsetAt(e.endLineNumber,e.endColumn);return this._decorationsTree.getFontDecorationsInInterval(this,i,n,t)}getAllDecorations(e=0,t=!1,i=!1){let n=this._decorationsTree.getAll(this,e,t,i,!1,!1);return n=n.concat(this._decorationProvider.getAllDecorations(e,t)),n=n.concat(this._fontTokenDecorationsProvider.getAllDecorations(e,t)),n}getAllMarginDecorations(e=0){return this._decorationsTree.getAll(this,e,!1,!1,!1,!0)}_getDecorationsInRange(e,t,i,n,s){const r=this._buffer.getOffsetAt(e.startLineNumber,e.startColumn),a=this._buffer.getOffsetAt(e.endLineNumber,e.endColumn);return this._decorationsTree.getAllInInterval(this,r,a,t,i,n,s)}getRangeAt(e,t){return this._buffer.getRangeAt(e,t-e)}_changeDecorationImpl(e,t,i){const n=this._decorations[t];if(!n)return;if(n.options.after){const c=this.getDecorationRange(t);this._onDidChangeDecorations.recordLineAffectedByInjectedText(c.endLineNumber)}if(n.options.before){const c=this.getDecorationRange(t);this._onDidChangeDecorations.recordLineAffectedByInjectedText(c.startLineNumber)}if(n.options.lineHeight!==null){const c=this.getDecorationRange(t);this._onDidChangeDecorations.recordLineAffectedByLineHeightChange(e,t,c.startLineNumber,null)}if(n.options.affectsFont){const c=this.getDecorationRange(t);this._onDidChangeDecorations.recordLineAffectedByFontChange(e,n.id,c.startLineNumber)}const s=this._validateRangeRelaxedNoAllocations(i),r=this._buffer.getOffsetAt(s.startLineNumber,s.startColumn),a=this._buffer.getOffsetAt(s.endLineNumber,s.endColumn);this._decorationsTree.delete(n),n.reset(this.getVersionId(),r,a,s),this._decorationsTree.insert(n),this._onDidChangeDecorations.checkAffectedAndFire(n.options),n.options.after&&this._onDidChangeDecorations.recordLineAffectedByInjectedText(s.endLineNumber),n.options.before&&this._onDidChangeDecorations.recordLineAffectedByInjectedText(s.startLineNumber),n.options.lineHeight!==null&&this._onDidChangeDecorations.recordLineAffectedByLineHeightChange(e,t,s.startLineNumber,n.options.lineHeight),n.options.affectsFont&&this._onDidChangeDecorations.recordLineAffectedByFontChange(e,n.id,s.startLineNumber)}_changeDecorationOptionsImpl(e,t,i){const n=this._decorations[t];if(!n)return;const s=!!(n.options.overviewRuler&&n.options.overviewRuler.color),r=!!(i.overviewRuler&&i.overviewRuler.color);if(this._onDidChangeDecorations.checkAffectedAndFire(n.options),this._onDidChangeDecorations.checkAffectedAndFire(i),n.options.after||i.after){const h=this._decorationsTree.getNodeRange(this,n);this._onDidChangeDecorations.recordLineAffectedByInjectedText(h.endLineNumber)}if(n.options.before||i.before){const h=this._decorationsTree.getNodeRange(this,n);this._onDidChangeDecorations.recordLineAffectedByInjectedText(h.startLineNumber)}if(n.options.lineHeight!==null||i.lineHeight!==null){const h=this._decorationsTree.getNodeRange(this,n);this._onDidChangeDecorations.recordLineAffectedByLineHeightChange(e,t,h.startLineNumber,i.lineHeight)}if(n.options.affectsFont||i.affectsFont){const h=this._decorationsTree.getNodeRange(this,n);this._onDidChangeDecorations.recordLineAffectedByFontChange(e,t,h.startLineNumber)}const a=s!==r,c=g6(i)!==Bm(n);a||c?(this._decorationsTree.delete(n),n.setOptions(i),this._decorationsTree.insert(n)):n.setOptions(i)}_deltaDecorationsImpl(e,t,i,n=!1){const s=this.getVersionId(),r=t.length;let a=0;const c=i.length;let h=0;this._onDidChangeDecorations.beginDeferredEmit();try{const d=new Array(c);for(;a<r||h<c;){let u=null;if(a<r){let f;do f=t[a++],u=this._decorations[f];while(!u&&a<r);if(u){if(u.options.after){const g=this._decorationsTree.getNodeRange(this,u);this._onDidChangeDecorations.recordLineAffectedByInjectedText(g.endLineNumber)}if(u.options.before){const g=this._decorationsTree.getNodeRange(this,u);this._onDidChangeDecorations.recordLineAffectedByInjectedText(g.startLineNumber)}if(u.options.lineHeight!==null){const g=this._decorationsTree.getNodeRange(this,u);this._onDidChangeDecorations.recordLineAffectedByLineHeightChange(e,f,g.startLineNumber,null)}if(u.options.affectsFont){const g=this._decorationsTree.getNodeRange(this,u);this._onDidChangeDecorations.recordLineAffectedByFontChange(e,f,g.startLineNumber)}this._decorationsTree.delete(u),n||this._onDidChangeDecorations.checkAffectedAndFire(u.options)}}if(h<c){if(!u){const v=++this._lastDecorationId,C=`${this._instanceId};${v}`;u=new m1(C,0,0),this._decorations[C]=u}const f=i[h],g=this._validateRangeRelaxedNoAllocations(f.range),m=V1(f.options),p=this._buffer.getOffsetAt(g.startLineNumber,g.startColumn),b=this._buffer.getOffsetAt(g.endLineNumber,g.endColumn);u.ownerId=e,u.reset(s,p,b,g),u.setOptions(m),u.options.after&&this._onDidChangeDecorations.recordLineAffectedByInjectedText(g.endLineNumber),u.options.before&&this._onDidChangeDecorations.recordLineAffectedByInjectedText(g.startLineNumber),u.options.lineHeight!==null&&this._onDidChangeDecorations.recordLineAffectedByLineHeightChange(e,u.id,g.startLineNumber,u.options.lineHeight),u.options.affectsFont&&this._onDidChangeDecorations.recordLineAffectedByFontChange(e,u.id,g.startLineNumber),n||this._onDidChangeDecorations.checkAffectedAndFire(m),this._decorationsTree.insert(u),d[h]=u.id,h++}else u&&delete this._decorations[u.id]}return d}finally{this._onDidChangeDecorations.endDeferredEmit()}}getLanguageId(){return this.tokenization.getLanguageId()}setLanguage(e,t){typeof e=="string"?(this._languageSelectionListener.clear(),this._setLanguage(e,t)):(this._languageSelectionListener.value=e.onDidChange(()=>this._setLanguage(e.languageId,t)),this._setLanguage(e.languageId,t))}_setLanguage(e,t){this.tokenization.setLanguageId(e,t),this._languageService.requestRichLanguageFeatures(e)}getLanguageIdAtPosition(e,t){return this.tokenization.getLanguageIdAtPosition(e,t)}getWordAtPosition(e){return this._tokenizationTextModelPart.getWordAtPosition(e)}getWordUntilPosition(e){return this._tokenizationTextModelPart.getWordUntilPosition(e)}normalizePosition(e,t){return e}getLineIndentColumn(e){return k1(this.getLineContent(e))+1}toString(){return`TextModel(${this.uri.toString()})`}},Fa=os,os._MODEL_SYNC_LIMIT=50*1024*1024,os.LARGE_FILE_SIZE_THRESHOLD=20*1024*1024,os.LARGE_FILE_LINE_COUNT_THRESHOLD=300*1e3,os.LARGE_FILE_HEAP_OPERATION_THRESHOLD=256*1024*1024,os.DEFAULT_CREATION_OPTIONS={isForSimpleWidget:!1,tabSize:zt.tabSize,indentSize:zt.indentSize,insertSpaces:zt.insertSpaces,detectIndentation:!1,defaultEOL:1,trimAutoWhitespace:zt.trimAutoWhitespace,largeFileOptimizations:zt.largeFileOptimizations,bracketPairColorizationOptions:zt.bracketPairColorizationOptions},os),_.TextModel=Fa=r6([km(4,bw),km(5,yt),km(6,ms),km(7,me)],_.TextModel);function f6(o,e,t){let i;if(t){const n=[];for(let s=0;s<t.length;s++){const r=t[s],a=e[s].tokens;a?a.forEach((c,h)=>{n.push({offset:r,text:c.substring(e[s].content),tokenMetadata:h.metadata})}):n.push({offset:r,text:e[s].content,tokenMetadata:_t.defaultTokenMetadata})}i=o.withInserted(n)}else i=o;return i}function k1(o){let e=0;for(const t of o)if(t===" "||t===" ")e++;else break;return e}function Jw(o){return!!(o.options.overviewRuler&&o.options.overviewRuler.color)}function g6(o){return!!o.after||!!o.before}function Bm(o){return!!o.options.after||!!o.options.before}class F1{constructor(){this._decorationsTree0=new Mw,this._decorationsTree1=new Mw,this._injectedTextDecorationsTree=new Mw}ensureAllNodesHaveRanges(e){this.getAll(e,0,!1,!1,!1,!1)}_ensureNodesHaveRanges(e,t){for(const i of t)i.range===null&&(i.range=e.getRangeAt(i.cachedAbsoluteStart,i.cachedAbsoluteEnd));return t}getAllInInterval(e,t,i,n,s,r,a){const c=e.getVersionId(),h=this._intervalSearch(t,i,n,s,r,c,a);return this._ensureNodesHaveRanges(e,h)}_intervalSearch(e,t,i,n,s,r,a){const c=this._decorationsTree0.intervalSearch(e,t,i,n,s,r,a),h=this._decorationsTree1.intervalSearch(e,t,i,n,s,r,a),d=this._injectedTextDecorationsTree.intervalSearch(e,t,i,n,s,r,a);return c.concat(h).concat(d)}getInjectedTextInInterval(e,t,i,n){const s=e.getVersionId(),r=this._injectedTextDecorationsTree.intervalSearch(t,i,n,!1,!1,s,!1);return this._ensureNodesHaveRanges(e,r).filter(a=>a.options.showIfCollapsed||!a.range.isEmpty())}getFontDecorationsInInterval(e,t,i,n){const s=e.getVersionId(),r=this._decorationsTree0.intervalSearch(t,i,n,!1,!1,s,!1);return this._ensureNodesHaveRanges(e,r).filter(a=>a.options.affectsFont)}getAllInjectedText(e,t){const i=e.getVersionId(),n=this._injectedTextDecorationsTree.search(t,!1,!1,i,!1);return this._ensureNodesHaveRanges(e,n).filter(s=>s.options.showIfCollapsed||!s.range.isEmpty())}getAllCustomLineHeights(e,t){const i=e.getVersionId(),n=this._search(t,!1,!1,!1,i,!1);return this._ensureNodesHaveRanges(e,n).filter(s=>typeof s.options.lineHeight=="number")}getCustomLineHeightsInInterval(e,t,i,n){const s=e.getVersionId(),r=this._intervalSearch(t,i,n,!1,!1,s,!1);return this._ensureNodesHaveRanges(e,r).filter(a=>typeof a.options.lineHeight=="number")}getAll(e,t,i,n,s,r){const a=e.getVersionId(),c=this._search(t,i,n,s,a,r);return this._ensureNodesHaveRanges(e,c)}_search(e,t,i,n,s,r){if(n)return this._decorationsTree1.search(e,t,i,s,r);{const a=this._decorationsTree0.search(e,t,i,s,r),c=this._decorationsTree1.search(e,t,i,s,r),h=this._injectedTextDecorationsTree.search(e,t,i,s,r);return a.concat(c).concat(h)}}collectNodesFromOwner(e){const t=this._decorationsTree0.collectNodesFromOwner(e),i=this._decorationsTree1.collectNodesFromOwner(e),n=this._injectedTextDecorationsTree.collectNodesFromOwner(e);return t.concat(i).concat(n)}collectNodesPostOrder(){const e=this._decorationsTree0.collectNodesPostOrder(),t=this._decorationsTree1.collectNodesPostOrder(),i=this._injectedTextDecorationsTree.collectNodesPostOrder();return e.concat(t).concat(i)}insert(e){Bm(e)?this._injectedTextDecorationsTree.insert(e):Jw(e)?this._decorationsTree1.insert(e):this._decorationsTree0.insert(e)}delete(e){Bm(e)?this._injectedTextDecorationsTree.delete(e):Jw(e)?this._decorationsTree1.delete(e):this._decorationsTree0.delete(e)}getNodeRange(e,t){const i=e.getVersionId();return t.cachedVersionId!==i&&this._resolveNode(t,i),t.range===null&&(t.range=e.getRangeAt(t.cachedAbsoluteStart,t.cachedAbsoluteEnd)),t.range}_resolveNode(e,t){Bm(e)?this._injectedTextDecorationsTree.resolveNode(e,t):Jw(e)?this._decorationsTree1.resolveNode(e,t):this._decorationsTree0.resolveNode(e,t)}acceptReplace(e,t,i,n){this._decorationsTree0.acceptReplace(e,t,i,n),this._decorationsTree1.acceptReplace(e,t,i,n),this._injectedTextDecorationsTree.acceptReplace(e,t,i,n)}}function xs(o){return o.replace(/[^a-z0-9\-_]/gi," ")}class B1{constructor(e){this.color=e.color||"",this.darkColor=e.darkColor||""}}class m6 extends B1{constructor(e){super(e),this._resolvedColor=null,this.position=typeof e.position=="number"?e.position:l.OverviewRulerLane.Center}getColor(e){return this._resolvedColor||(rr(e.type)&&this.darkColor?this._resolvedColor=this._resolveColor(this.darkColor,e):this._resolvedColor=this._resolveColor(this.color,e)),this._resolvedColor}invalidateCachedColor(){this._resolvedColor=null}_resolveColor(e,t){if(typeof e=="string")return e;const i=e?t.getColor(e.id):null;return i?i.toString():""}}class p6{constructor(e){this.position=e?.position??l.GlyphMarginLane.Center,this.persistLane=e?.persistLane}}class _6 extends B1{constructor(e){super(e),this.position=e.position,this.sectionHeaderStyle=e.sectionHeaderStyle??null,this.sectionHeaderText=e.sectionHeaderText??null}getColor(e){return this._resolvedColor||(rr(e.type)&&this.darkColor?this._resolvedColor=this._resolveColor(this.darkColor,e):this._resolvedColor=this._resolveColor(this.color,e)),this._resolvedColor}invalidateCachedColor(){this._resolvedColor=void 0}_resolveColor(e,t){return typeof e=="string"?l.Color.fromHex(e):t.getColor(e.id)}}class Mc{static from(e){return e instanceof Mc?e:new Mc(e)}constructor(e){this.content=e.content||"",this.tokens=e.tokens??null,this.inlineClassName=e.inlineClassName||null,this.inlineClassNameAffectsLetterSpacing=e.inlineClassNameAffectsLetterSpacing||!1,this.attachedData=e.attachedData||null,this.cursorStops=e.cursorStops||null}}class Ct{static register(e){return new Ct(e)}static createDynamic(e){return new Ct(e)}constructor(e){this.description=e.description,this.blockClassName=e.blockClassName?xs(e.blockClassName):null,this.blockDoesNotCollapse=e.blockDoesNotCollapse??null,this.blockIsAfterEnd=e.blockIsAfterEnd??null,this.blockPadding=e.blockPadding??null,this.stickiness=e.stickiness||0,this.zIndex=e.zIndex||0,this.className=e.className?xs(e.className):null,this.shouldFillLineOnLineBreak=e.shouldFillLineOnLineBreak??null,this.hoverMessage=e.hoverMessage||null,this.glyphMarginHoverMessage=e.glyphMarginHoverMessage||null,this.lineNumberHoverMessage=e.lineNumberHoverMessage||null,this.isWholeLine=e.isWholeLine||!1,this.lineHeight=e.lineHeight?Math.min(e.lineHeight,d6):null,this.fontSize=e.fontSize||null,this.affectsFont=!!e.fontSize||!!e.fontFamily||!!e.fontWeight||!!e.fontStyle,this.showIfCollapsed=e.showIfCollapsed||!1,this.collapseOnReplaceEdit=e.collapseOnReplaceEdit||!1,this.overviewRuler=e.overviewRuler?new m6(e.overviewRuler):null,this.minimap=e.minimap?new _6(e.minimap):null,this.glyphMargin=e.glyphMarginClassName?new p6(e.glyphMargin):null,this.glyphMarginClassName=e.glyphMarginClassName?xs(e.glyphMarginClassName):null,this.linesDecorationsClassName=e.linesDecorationsClassName?xs(e.linesDecorationsClassName):null,this.lineNumberClassName=e.lineNumberClassName?xs(e.lineNumberClassName):null,this.linesDecorationsTooltip=e.linesDecorationsTooltip?l.htmlAttributeEncodeValue(e.linesDecorationsTooltip):null,this.firstLineDecorationClassName=e.firstLineDecorationClassName?xs(e.firstLineDecorationClassName):null,this.marginClassName=e.marginClassName?xs(e.marginClassName):null,this.inlineClassName=e.inlineClassName?xs(e.inlineClassName):null,this.inlineClassNameAffectsLetterSpacing=e.inlineClassNameAffectsLetterSpacing||!1,this.beforeContentClassName=e.beforeContentClassName?xs(e.beforeContentClassName):null,this.afterContentClassName=e.afterContentClassName?xs(e.afterContentClassName):null,this.after=e.after?Mc.from(e.after):null,this.before=e.before?Mc.from(e.before):null,this.hideInCommentTokens=e.hideInCommentTokens??!1,this.hideInStringTokens=e.hideInStringTokens??!1,this.textDirection=e.textDirection??null}}Ct.EMPTY=Ct.register({description:"empty"});const z1=[Ct.register({description:"tracked-range-always-grows-when-typing-at-edges",stickiness:0}),Ct.register({description:"tracked-range-never-grows-when-typing-at-edges",stickiness:1}),Ct.register({description:"tracked-range-grows-only-when-typing-before",stickiness:2}),Ct.register({description:"tracked-range-grows-only-when-typing-after",stickiness:3})];function V1(o){return o instanceof Ct?o:Ct.createDynamic(o)}class b6 extends l.Disposable{constructor(e){super(),this.handleBeforeFire=e,this._actual=this._register(new l.Emitter),this.event=this._actual.event,this._affectedInjectedTextLines=null,this._affectedLineHeights=null,this._affectedFontLines=null,this._deferredCnt=0,this._shouldFireDeferred=!1,this._affectsMinimap=!1,this._affectsOverviewRuler=!1,this._affectsGlyphMargin=!1,this._affectsLineNumber=!1}beginDeferredEmit(){this._deferredCnt++}endDeferredEmit(){this._deferredCnt--,this._deferredCnt===0&&(this._shouldFireDeferred&&this.doFire(),this._affectedInjectedTextLines?.clear(),this._affectedInjectedTextLines=null,this._affectedLineHeights?.clear(),this._affectedLineHeights=null,this._affectedFontLines?.clear(),this._affectedFontLines=null)}recordLineAffectedByInjectedText(e){this._affectedInjectedTextLines||(this._affectedInjectedTextLines=new Set),this._affectedInjectedTextLines.add(e)}recordLineAffectedByLineHeightChange(e,t,i,n){this._affectedLineHeights||(this._affectedLineHeights=new $T([],uu.toKey)),this._affectedLineHeights.add(new uu(e,t,i,n))}recordLineAffectedByFontChange(e,t,i){this._affectedFontLines||(this._affectedFontLines=new $T([],fu.toKey)),this._affectedFontLines.add(new fu(e,t,i))}checkAffectedAndFire(e){this._affectsMinimap||=!!e.minimap?.position,this._affectsOverviewRuler||=!!e.overviewRuler?.color,this._affectsGlyphMargin||=!!e.glyphMarginClassName,this._affectsLineNumber||=!!e.lineNumberClassName,this.tryFire()}fire(){this._affectsMinimap=!0,this._affectsOverviewRuler=!0,this._affectsGlyphMargin=!0,this.tryFire()}tryFire(){this._deferredCnt===0?this.doFire():this._shouldFireDeferred=!0}doFire(){this.handleBeforeFire(this._affectedInjectedTextLines,this._affectedLineHeights,this._affectedFontLines);const e={affectsMinimap:this._affectsMinimap,affectsOverviewRuler:this._affectsOverviewRuler,affectsGlyphMargin:this._affectsGlyphMargin,affectsLineNumber:this._affectsLineNumber};this._shouldFireDeferred=!1,this._affectsMinimap=!1,this._affectsOverviewRuler=!1,this._affectsGlyphMargin=!1,this._actual.fire(e)}}class C6 extends l.Disposable{constructor(){super(),this._emitter=this._register(new l.Emitter),this.event=this._emitter.event,this._deferredCnt=0,this._deferredEvent=null}beginDeferredEmit(){this._deferredCnt++}endDeferredEmit(e=null){if(this._deferredCnt--,this._deferredCnt===0&&this._deferredEvent!==null){this._deferredEvent.rawContentChangedEvent.resultingSelection=e;const t=this._deferredEvent;this._deferredEvent=null,this._emitter.fire(t)}}fire(e){if(this._deferredCnt>0){this._deferredEvent?this._deferredEvent=this._deferredEvent.merge(e):this._deferredEvent=e;return}this._emitter.fire(e)}}class Ww{static create(e){return new Ww(e.get(151),e.get(150))}constructor(e,t){this.classifier=new v6(e,t)}createLineBreaksComputer(e,t,i,n,s,r,a){const c=[],h=[];return{addRequest:(d,u)=>{c.push(d),h.push(u)},finalize:()=>{const d=t.typicalFullwidthCharacterWidth/t.typicalHalfwidthCharacterWidth,u=[];for(let f=0,g=c.length;f<g;f++){const m=c[f],p=e.getLineInjectedText(m),b=e.getLineContent(m),v=h[f],C=a&&b.includes('"')&&b.includes("\\n");v&&!v.injectionOptions&&!p&&!C?u[f]=w6(this.classifier,v,b,i,n,d,s,r):u[f]=S6(this.classifier,b,p,i,n,d,s,r,C)}return Hw.length=0,eS.length=0,u}}}}class v6 extends l.CharacterClassifier{constructor(e,t){super(0);for(let i=0;i<e.length;i++)this.set(e.charCodeAt(i),1);for(let i=0;i<t.length;i++)this.set(t.charCodeAt(i),2)}get(e){return e>=0&&e<256?this._asciiMap[e]:e>=12352&&e<=12543||e>=13312&&e<=19903||e>=19968&&e<=40959?3:this._map.get(e)||this._defaultValue}}let Hw=[],eS=[];function w6(o,e,t,i,n,s,r,a){if(n===-1)return null;const c=t.length;if(c<=1)return null;const h=a==="keepAll",d=e.breakOffsets,u=e.breakOffsetsVisibleColumn,f=$1(t,i,n,s,r),g=n-f,m=Hw,p=eS;let b=0,v=0,C=0,w=n;const S=d.length;let L=0;if(L>=0){let D=Math.abs(u[L]-w);for(;L+1<S;){const x=Math.abs(u[L+1]-w);if(x>=D)break;D=x,L++}}for(;L<S;){let D=L<0?0:d[L],x=L<0?0:u[L];v>D&&(D=v,x=C);let I=0,T=0,M=0,O=0;if(x<=w){let k=x,U=D===0?0:t.charCodeAt(D-1),B=D===0?0:o.get(U),G=!0;for(let X=D;X<c;X++){const re=X,Y=t.charCodeAt(X);let ee,Ee;if(l.isHighSurrogate(Y)?(X++,ee=0,Ee=2):(ee=o.get(Y),Ee=_u(Y,k,i,s)),re>v&&tS(U,B,Y,ee,h)&&(I=re,T=k),k+=Ee,k>w){re>v?(M=re,O=k-Ee):(M=X+1,O=k),k-T>g&&(I=0),G=!1;break}U=Y,B=ee}if(G){b>0&&(m[b]=d[d.length-1],p[b]=u[d.length-1],b++);break}}if(I===0){let k=x,U=t.charCodeAt(D),B=o.get(U),G=!1;for(let X=D-1;X>=v;X--){const re=X+1,Y=t.charCodeAt(X);if(Y===9){G=!0;break}let ee,Ee;if(l.isLowSurrogate(Y)?(X--,ee=0,Ee=2):(ee=o.get(Y),Ee=l.isFullWidthCharacter(Y)?s:1),k<=w){if(M===0&&(M=re,O=k),k<=w-g)break;if(tS(Y,ee,U,B,h)){I=re,T=k;break}}k-=Ee,U=Y,B=ee}if(I!==0){const X=g-(O-T);if(X<=i){const re=t.charCodeAt(M);let Y;l.isHighSurrogate(re)?Y=2:Y=_u(re,O,i,s),X-Y<0&&(I=0)}}if(G){L--;continue}}if(I===0&&(I=M,T=O),I<=v){const k=t.charCodeAt(v);l.isHighSurrogate(k)?(I=v+2,T=C+2):(I=v+1,T=C+_u(k,C,i,s))}for(v=I,m[b]=I,C=T,p[b]=T,b++,w=T+g;L<0||L<S&&u[L]<T;)L++;let P=Math.abs(u[L]-w);for(;L+1<S;){const k=Math.abs(u[L+1]-w);if(k>=P)break;P=k,L++}}return b===0?null:(m.length=b,p.length=b,Hw=e.breakOffsets,eS=e.breakOffsetsVisibleColumn,e.breakOffsets=m,e.breakOffsetsVisibleColumn=p,e.wrappedTextIndentLength=f,e)}function S6(o,e,t,i,n,s,r,a,c){const h=mo.applyInjectedText(e,t);let d,u;if(t&&t.length>0?(d=t.map(M=>M.options),u=t.map(M=>M.column-1)):(d=null,u=null),n===-1)return d?new eu(u,d,[h.length],[],0):null;const f=h.length;if(f<=1)return d?new eu(u,d,[h.length],[],0):null;const g=a==="keepAll",m=$1(h,i,n,s,r),p=n-m,b=[],v=[];let C=0,w=0,S=0,L=n,D=h.charCodeAt(0),x=o.get(D),I=_u(D,0,i,s),T=1;l.isHighSurrogate(D)&&(I+=1,D=h.charCodeAt(1),x=o.get(D),T++);for(let M=T;M<f;M++){const O=M,P=h.charCodeAt(M);let k,U,B=!1;l.isHighSurrogate(P)?(M++,k=0,U=2):(k=o.get(P),U=_u(P,I,i,s)),c&&y6(h,M)?(w=O,S=I,B=!0):tS(D,x,P,k,g)&&(w=O,S=I),I+=U,(I>L||B)&&((w===0||I-S>p)&&(w=O,S=I-U),b[C]=w,v[C]=S,C++,L=S+p,w=0),D=P,x=k}return C===0&&(!t||t.length===0)?null:(b[C]=f,v[C]=I,new eu(u,d,b,v,m))}function _u(o,e,t,i){return o===9?t-e%t:l.isFullWidthCharacter(o)||o<32?i:1}function U1(o,e){return e-o%e}function y6(o,e){if(e>=2&&o.charAt(e-1)==="n"){let t=0;for(let i=e-2;i>=0;i--)if(o.charAt(i)==="\\")t++;else return t%2===1}return!1}function tS(o,e,t,i,n){return t!==32&&(e===2&&i!==2||e!==1&&i===1||!n&&e===3&&i!==2||!n&&i===3&&e!==1)}function $1(o,e,t,i,n){let s=0;if(n!==0){const r=l.firstNonWhitespaceIndex(o);if(r!==-1){for(let c=0;c<r;c++){const h=o.charCodeAt(c)===9?U1(s,e):1;s+=h}const a=n===3?2:n===2?1:0;for(let c=0;c<a;c++){const h=U1(s,e);s+=h}s+i>t&&(s=0)}}return s}class zm{constructor(e){this._selTrackedRange=null,this._trackSelection=!0,this._setState(e,new Pt(new l.Range(1,1,1,1),0,0,new l.Position(1,1),0),new Pt(new l.Range(1,1,1,1),0,0,new l.Position(1,1),0))}dispose(e){this._removeTrackedRange(e)}startTrackingSelection(e){this._trackSelection=!0,this._updateTrackedRange(e)}stopTrackingSelection(e){this._trackSelection=!1,this._removeTrackedRange(e)}_updateTrackedRange(e){this._trackSelection&&(this._selTrackedRange=e.model._setTrackedRange(this._selTrackedRange,this.modelState.selection,0))}_removeTrackedRange(e){this._selTrackedRange=e.model._setTrackedRange(this._selTrackedRange,null,0)}asCursorState(){return new ge(this.modelState,this.viewState)}readSelectionFromMarkers(e){const t=e.model._getTrackedRange(this._selTrackedRange);return this.modelState.selection.isEmpty()&&!t.isEmpty()?l.Selection.fromRange(t.collapseToEnd(),this.modelState.selection.getDirection()):l.Selection.fromRange(t,this.modelState.selection.getDirection())}ensureValidState(e){this._setState(e,this.modelState,this.viewState)}setState(e,t,i){this._setState(e,t,i)}static _validatePositionWithCache(e,t,i,n){return t.equals(i)?n:e.normalizePosition(t,2)}static _validateViewState(e,t){const i=t.position,n=t.selectionStart.getStartPosition(),s=t.selectionStart.getEndPosition(),r=e.normalizePosition(i,2),a=this._validatePositionWithCache(e,n,i,r),c=this._validatePositionWithCache(e,s,n,a);return i.equals(r)&&n.equals(a)&&s.equals(c)?t:new Pt(l.Range.fromPositions(a,c),t.selectionStartKind,t.selectionStartLeftoverVisibleColumns+n.column-a.column,r,t.leftoverVisibleColumns+i.column-r.column)}_setState(e,t,i){if(i&&(i=zm._validateViewState(e.viewModel,i)),t){const n=e.model.validateRange(t.selectionStart),s=t.selectionStart.equalsRange(n)?t.selectionStartLeftoverVisibleColumns:0,r=e.model.validatePosition(t.position),a=t.position.equals(r)?t.leftoverVisibleColumns:0;t=new Pt(n,t.selectionStartKind,s,r,a)}else{if(!i)return;const n=e.model.validateRange(e.coordinatesConverter.convertViewRangeToModelRange(i.selectionStart)),s=e.model.validatePosition(e.coordinatesConverter.convertViewPositionToModelPosition(i.position));t=new Pt(n,i.selectionStartKind,i.selectionStartLeftoverVisibleColumns,s,i.leftoverVisibleColumns)}if(i){const n=e.coordinatesConverter.validateViewRange(i.selectionStart,t.selectionStart),s=e.coordinatesConverter.validateViewPosition(i.position,t.position);i=new Pt(n,t.selectionStartKind,t.selectionStartLeftoverVisibleColumns,s,t.leftoverVisibleColumns)}else{const n=e.coordinatesConverter.convertModelPositionToViewPosition(new l.Position(t.selectionStart.startLineNumber,t.selectionStart.startColumn)),s=e.coordinatesConverter.convertModelPositionToViewPosition(new l.Position(t.selectionStart.endLineNumber,t.selectionStart.endColumn)),r=new l.Range(n.lineNumber,n.column,s.lineNumber,s.column),a=e.coordinatesConverter.convertModelPositionToViewPosition(t.position);i=new Pt(r,t.selectionStartKind,t.selectionStartLeftoverVisibleColumns,a,t.leftoverVisibleColumns)}this.modelState=t,this.viewState=i,this._updateTrackedRange(e)}}class K1{constructor(e){this.context=e,this.cursors=[new zm(e)],this.lastAddedCursorIndex=0}dispose(){for(const e of this.cursors)e.dispose(this.context)}startTrackingSelections(){for(const e of this.cursors)e.startTrackingSelection(this.context)}stopTrackingSelections(){for(const e of this.cursors)e.stopTrackingSelection(this.context)}updateContext(e){this.context=e}ensureValidState(){for(const e of this.cursors)e.ensureValidState(this.context)}readSelectionFromMarkers(){return this.cursors.map(e=>e.readSelectionFromMarkers(this.context))}getAll(){return this.cursors.map(e=>e.asCursorState())}getViewPositions(){return this.cursors.map(e=>e.viewState.position)}getTopMostViewPosition(){return l.findFirstMin(this.cursors,l.compareBy(e=>e.viewState.position,l.Position.compare)).viewState.position}getBottomMostViewPosition(){return l.findLastMax(this.cursors,l.compareBy(e=>e.viewState.position,l.Position.compare)).viewState.position}getSelections(){return this.cursors.map(e=>e.modelState.selection)}getViewSelections(){return this.cursors.map(e=>e.viewState.selection)}setSelections(e){this.setStates(ge.fromModelSelections(e))}getPrimaryCursor(){return this.cursors[0].asCursorState()}setStates(e){e!==null&&(this.cursors[0].setState(this.context,e[0].modelState,e[0].viewState),this._setSecondaryStates(e.slice(1)))}_setSecondaryStates(e){const t=this.cursors.length-1,i=e.length;if(t<i){const n=i-t;for(let s=0;s<n;s++)this._addSecondaryCursor()}else if(t>i){const n=t-i;for(let s=0;s<n;s++)this._removeSecondaryCursor(this.cursors.length-2)}for(let n=0;n<i;n++)this.cursors[n+1].setState(this.context,e[n].modelState,e[n].viewState)}killSecondaryCursors(){this._setSecondaryStates([])}_addSecondaryCursor(){this.cursors.push(new zm(this.context)),this.lastAddedCursorIndex=this.cursors.length-1}getLastAddedCursorIndex(){return this.cursors.length===1||this.lastAddedCursorIndex===0?0:this.lastAddedCursorIndex}_removeSecondaryCursor(e){this.lastAddedCursorIndex>=e+1&&this.lastAddedCursorIndex--,this.cursors[e+1].dispose(this.context),this.cursors.splice(e+1,1)}normalize(){if(this.cursors.length===1)return;const e=this.cursors.slice(0),t=[];for(let i=0,n=e.length;i<n;i++)t.push({index:i,selection:e[i].modelState.selection});t.sort(l.compareBy(i=>i.selection,l.Range.compareRangesUsingStarts));for(let i=0;i<t.length-1;i++){const n=t[i],s=t[i+1],r=n.selection,a=s.selection;if(!this.context.cursorConfig.multiCursorMergeOverlapping)continue;let c;if(a.isEmpty()||r.isEmpty()?c=a.getStartPosition().isBeforeOrEqual(r.getEndPosition()):c=a.getStartPosition().isBefore(r.getEndPosition()),c){const h=n.index<s.index?i:i+1,d=n.index<s.index?i+1:i,u=t[d].index,f=t[h].index,g=t[d].selection,m=t[h].selection;if(!g.equalsSelection(m)){const p=g.plusRange(m),b=g.selectionStartLineNumber===g.startLineNumber&&g.selectionStartColumn===g.startColumn,v=m.selectionStartLineNumber===m.startLineNumber&&m.selectionStartColumn===m.startColumn;let C;u===this.lastAddedCursorIndex?(C=b,this.lastAddedCursorIndex=f):C=v;let w;C?w=new l.Selection(p.startLineNumber,p.startColumn,p.endLineNumber,p.endColumn):w=new l.Selection(p.endLineNumber,p.endColumn,p.startLineNumber,p.startColumn),t[h].selection=w;const S=ge.fromModelSelection(w);e[f].setState(this.context,S.modelState,S.viewState)}for(const p of t)p.index>u&&p.index--;e.splice(u,1),t.splice(d,1),this._removeSecondaryCursor(u-1),i--}}}}class G1{constructor(e,t,i,n){this._cursorContextBrand=void 0,this.model=e,this.viewModel=t,this.coordinatesConverter=i,this.cursorConfig=n}}class L6{constructor(){this.type=0}}class D6{constructor(){this.type=1}}class x6{constructor(e){this.type=2,this._source=e}hasChanged(e){return this._source.hasChanged(e)}}class E6{constructor(e,t,i){this.selections=e,this.modelSelections=t,this.reason=i,this.type=3}}class Ba{constructor(e){this.type=4,e?(this.affectsMinimap=e.affectsMinimap,this.affectsOverviewRuler=e.affectsOverviewRuler,this.affectsGlyphMargin=e.affectsGlyphMargin,this.affectsLineNumber=e.affectsLineNumber):(this.affectsMinimap=!0,this.affectsOverviewRuler=!0,this.affectsGlyphMargin=!0,this.affectsLineNumber=!0)}}class Vm{constructor(){this.type=5}}class I6{constructor(e){this.type=6,this.isFocused=e}}class T6{constructor(){this.type=7}}class Um{constructor(){this.type=8}}class j1{constructor(e,t){this.fromLineNumber=e,this.count=t,this.type=9}}class iS{constructor(e,t){this.type=10,this.fromLineNumber=e,this.toLineNumber=t}}class nS{constructor(e,t){this.type=11,this.fromLineNumber=e,this.toLineNumber=t}}class bu{constructor(e,t,i,n,s,r,a){this.source=e,this.minimalReveal=t,this.range=i,this.selections=n,this.verticalType=s,this.revealHorizontal=r,this.scrollType=a,this.type=12}}class N6{constructor(e){this.type=13,this.scrollWidth=e.scrollWidth,this.scrollLeft=e.scrollLeft,this.scrollHeight=e.scrollHeight,this.scrollTop=e.scrollTop,this.scrollWidthChanged=e.scrollWidthChanged,this.scrollLeftChanged=e.scrollLeftChanged,this.scrollHeightChanged=e.scrollHeightChanged,this.scrollTopChanged=e.scrollTopChanged}}class R6{constructor(e){this.theme=e,this.type=14}}class M6{constructor(e){this.type=15,this.ranges=e}}class A6{constructor(){this.type=16}}let O6=class{constructor(){this.type=17}};class P6 extends l.Disposable{constructor(){super(),this._onEvent=this._register(new l.Emitter),this.onEvent=this._onEvent.event,this._eventHandlers=[],this._viewEventQueue=null,this._isConsumingViewEventQueue=!1,this._collector=null,this._collectorCnt=0,this._outgoingEvents=[]}emitOutgoingEvent(e){this._addOutgoingEvent(e),this._emitOutgoingEvents()}_addOutgoingEvent(e){for(let t=0,i=this._outgoingEvents.length;t<i;t++){const n=this._outgoingEvents[t].kind===e.kind?this._outgoingEvents[t].attemptToMerge(e):null;if(n){this._outgoingEvents[t]=n;return}}this._outgoingEvents.push(e)}_emitOutgoingEvents(){for(;this._outgoingEvents.length>0;){if(this._collector||this._isConsumingViewEventQueue)return;const e=this._outgoingEvents.shift();e.isNoOp()||this._onEvent.fire(e)}}addViewEventHandler(e){for(let t=0,i=this._eventHandlers.length;t<i;t++)this._eventHandlers[t]===e&&console.warn("Detected duplicate listener in ViewEventDispatcher",e);this._eventHandlers.push(e)}removeViewEventHandler(e){for(let t=0;t<this._eventHandlers.length;t++)if(this._eventHandlers[t]===e){this._eventHandlers.splice(t,1);break}}beginEmitViewEvents(){return this._collectorCnt++,this._collectorCnt===1&&(this._collector=new k6),this._collector}endEmitViewEvents(){if(this._collectorCnt--,this._collectorCnt===0){const e=this._collector.outgoingEvents,t=this._collector.viewEvents;this._collector=null;for(const i of e)this._addOutgoingEvent(i);t.length>0&&this._emitMany(t)}this._emitOutgoingEvents()}emitSingleViewEvent(e){try{this.beginEmitViewEvents().emitViewEvent(e)}finally{this.endEmitViewEvents()}}_emitMany(e){this._viewEventQueue?this._viewEventQueue=this._viewEventQueue.concat(e):this._viewEventQueue=e,this._isConsumingViewEventQueue||this._consumeViewEventQueue()}_consumeViewEventQueue(){try{this._isConsumingViewEventQueue=!0,this._doConsumeQueue()}finally{this._isConsumingViewEventQueue=!1}}_doConsumeQueue(){for(;this._viewEventQueue;){const e=this._viewEventQueue;this._viewEventQueue=null;const t=this._eventHandlers.slice(0);for(const i of t)i.handleEvents(e)}}}class k6{constructor(){this.viewEvents=[],this.outgoingEvents=[]}emitViewEvent(e){this.viewEvents.push(e)}emitOutgoingEvent(e){this.outgoingEvents.push(e)}}class sS{constructor(e,t,i,n){this.kind=0,this._oldContentWidth=e,this._oldContentHeight=t,this.contentWidth=i,this.contentHeight=n,this.contentWidthChanged=this._oldContentWidth!==this.contentWidth,this.contentHeightChanged=this._oldContentHeight!==this.contentHeight}isNoOp(){return!this.contentWidthChanged&&!this.contentHeightChanged}attemptToMerge(e){return e.kind!==this.kind?null:new sS(this._oldContentWidth,this._oldContentHeight,e.contentWidth,e.contentHeight)}}class $m{constructor(e,t){this.kind=1,this.oldHasFocus=e,this.hasFocus=t}isNoOp(){return this.oldHasFocus===this.hasFocus}attemptToMerge(e){return e.kind!==this.kind?null:new $m(this.oldHasFocus,e.hasFocus)}}class F6{constructor(e,t){this.kind=2,this.oldHasFocus=e,this.hasFocus=t}isNoOp(){return this.oldHasFocus===this.hasFocus}attemptToMerge(e){return e.kind!==this.kind?null:new $m(this.oldHasFocus,e.hasFocus)}}class oS{constructor(e,t,i,n,s,r,a,c){this.kind=3,this._oldScrollWidth=e,this._oldScrollLeft=t,this._oldScrollHeight=i,this._oldScrollTop=n,this.scrollWidth=s,this.scrollLeft=r,this.scrollHeight=a,this.scrollTop=c,this.scrollWidthChanged=this._oldScrollWidth!==this.scrollWidth,this.scrollLeftChanged=this._oldScrollLeft!==this.scrollLeft,this.scrollHeightChanged=this._oldScrollHeight!==this.scrollHeight,this.scrollTopChanged=this._oldScrollTop!==this.scrollTop}isNoOp(){return!this.scrollWidthChanged&&!this.scrollLeftChanged&&!this.scrollHeightChanged&&!this.scrollTopChanged}attemptToMerge(e){return e.kind!==this.kind?null:new oS(this._oldScrollWidth,this._oldScrollLeft,this._oldScrollHeight,this._oldScrollTop,e.scrollWidth,e.scrollLeft,e.scrollHeight,e.scrollTop)}}class B6{constructor(){this.kind=4}isNoOp(){return!1}attemptToMerge(e){return e.kind!==this.kind?null:this}}class z6{constructor(){this.kind=5}isNoOp(){return!1}attemptToMerge(e){return e.kind!==this.kind?null:this}}class Km{constructor(e,t,i,n,s,r,a){this.kind=7,this.oldSelections=e,this.selections=t,this.oldModelVersionId=i,this.modelVersionId=n,this.source=s,this.reason=r,this.reachedMaxCursorCount=a}static _selectionsAreEqual(e,t){if(!e&&!t)return!0;if(!e||!t)return!1;const i=e.length,n=t.length;if(i!==n)return!1;for(let s=0;s<i;s++)if(!e[s].equalsSelection(t[s]))return!1;return!0}isNoOp(){return Km._selectionsAreEqual(this.oldSelections,this.selections)&&this.oldModelVersionId===this.modelVersionId}attemptToMerge(e){return e.kind!==this.kind?null:new Km(this.oldSelections,e.selections,this.oldModelVersionId,e.modelVersionId,e.source,e.reason,this.reachedMaxCursorCount||e.reachedMaxCursorCount)}}class V6{constructor(){this.kind=6}isNoOp(){return!1}attemptToMerge(e){return e.kind!==this.kind?null:this}}class U6{constructor(e){this.event=e,this.kind=8}isNoOp(){return!1}attemptToMerge(e){return null}}class $6{constructor(e){this.event=e,this.kind=9}isNoOp(){return!1}attemptToMerge(e){return null}}class K6{constructor(e){this.event=e,this.kind=10}isNoOp(){return!1}attemptToMerge(e){return null}}class G6{constructor(e){this.event=e,this.kind=11}isNoOp(){return!1}attemptToMerge(e){return null}}class j6{constructor(e){this.event=e,this.kind=12}isNoOp(){return!1}attemptToMerge(e){return null}}class q6{constructor(e){this.event=e,this.kind=13}isNoOp(){return!1}attemptToMerge(e){return null}}class Y6{constructor(e){this.event=e,this.kind=14}isNoOp(){return!1}attemptToMerge(e){return null}}class Z6{constructor(e){this.event=e,this.kind=15}isNoOp(){return!1}attemptToMerge(e){return null}}class Q6 extends l.Disposable{constructor(e,t,i,n){super(),this._model=e,this._knownModelVersionId=this._model.getVersionId(),this._viewModel=t,this._coordinatesConverter=i,this.context=new G1(this._model,this._viewModel,this._coordinatesConverter,n),this._cursors=new K1(this.context),this._hasFocus=!1,this._isHandling=!1,this._compositionState=null,this._columnSelectData=null,this._autoClosedActions=[],this._prevEditOperationType=0}dispose(){this._cursors.dispose(),this._autoClosedActions=l.dispose(this._autoClosedActions),super.dispose()}updateConfiguration(e){this.context=new G1(this._model,this._viewModel,this._coordinatesConverter,e),this._cursors.updateContext(this.context)}onLineMappingChanged(e){this._knownModelVersionId===this._model.getVersionId()&&this.setStates(e,"viewModel",0,this.getCursorStates())}setHasFocus(e){this._hasFocus=e}_validateAutoClosedActions(){if(this._autoClosedActions.length>0){const e=this._cursors.getSelections();for(let t=0;t<this._autoClosedActions.length;t++){const i=this._autoClosedActions[t];i.isValid(e)||(i.dispose(),this._autoClosedActions.splice(t,1),t--)}}}getPrimaryCursorState(){return this._cursors.getPrimaryCursor()}getLastAddedCursorIndex(){return this._cursors.getLastAddedCursorIndex()}getCursorStates(){return this._cursors.getAll()}setStates(e,t,i,n){let s=!1;const r=this.context.cursorConfig.multiCursorLimit;n!==null&&n.length>r&&(n=n.slice(0,r),s=!0);const a=Cu.from(this._model,this);return this._cursors.setStates(n),this._cursors.normalize(),this._columnSelectData=null,this._validateAutoClosedActions(),this._emitStateChangedIfNecessary(e,t,i,a,s)}setCursorColumnSelectData(e){this._columnSelectData=e}revealAll(e,t,i,n,s,r){const a=this._cursors.getViewPositions();let c=null,h=null;a.length>1?h=this._cursors.getViewSelections():c=l.Range.fromPositions(a[0],a[0]),e.emitViewEvent(new bu(t,i,c,h,n,s,r))}revealPrimary(e,t,i,n,s,r){const c=[this._cursors.getPrimaryCursor().viewState.selection];e.emitViewEvent(new bu(t,i,null,c,n,s,r))}saveState(){const e=[],t=this._cursors.getSelections();for(let i=0,n=t.length;i<n;i++){const s=t[i];e.push({inSelectionMode:!s.isEmpty(),selectionStart:{lineNumber:s.selectionStartLineNumber,column:s.selectionStartColumn},position:{lineNumber:s.positionLineNumber,column:s.positionColumn}})}return e}restoreState(e,t){const i=[];for(let n=0,s=t.length;n<s;n++){const r=t[n];let a=1,c=1;r.position&&r.position.lineNumber&&(a=r.position.lineNumber),r.position&&r.position.column&&(c=r.position.column);let h=a,d=c;r.selectionStart&&r.selectionStart.lineNumber&&(h=r.selectionStart.lineNumber),r.selectionStart&&r.selectionStart.column&&(d=r.selectionStart.column),i.push({selectionStartLineNumber:h,selectionStartColumn:d,positionLineNumber:a,positionColumn:c})}this.setStates(e,"restoreState",0,ge.fromModelSelections(i)),this.revealAll(e,"restoreState",!1,0,!0,1)}onModelContentChanged(e,t){if(t instanceof kT){if(this._isHandling)return;this._isHandling=!0;try{this.setStates(e,"modelChange",0,this.getCursorStates())}finally{this._isHandling=!1}}else{const i=t.rawContentChangedEvent;if(this._knownModelVersionId=i.versionId,this._isHandling)return;const n=i.containsEvent(1);if(this._prevEditOperationType=0,n)this._cursors.dispose(),this._cursors=new K1(this.context),this._validateAutoClosedActions(),this._emitStateChangedIfNecessary(e,"model",1,null,!1);else if(this._hasFocus&&i.resultingSelection&&i.resultingSelection.length>0){const s=ge.fromModelSelections(i.resultingSelection);this.setStates(e,"modelChange",i.isUndoing?5:i.isRedoing?6:2,s)&&this.revealAll(e,"modelChange",!1,0,!0,0)}else{const s=this._cursors.readSelectionFromMarkers();this.setStates(e,"modelChange",2,ge.fromModelSelections(s))}}}getSelection(){return this._cursors.getPrimaryCursor().modelState.selection}getTopMostViewPosition(){return this._cursors.getTopMostViewPosition()}getBottomMostViewPosition(){return this._cursors.getBottomMostViewPosition()}getCursorColumnSelectData(){if(this._columnSelectData)return this._columnSelectData;const e=this._cursors.getPrimaryCursor(),t=e.viewState.selectionStart.getStartPosition(),i=e.viewState.position;return{isReal:!1,fromViewLineNumber:t.lineNumber,fromViewVisualColumn:this.context.cursorConfig.visibleColumnFromColumn(this._viewModel,t),toViewLineNumber:i.lineNumber,toViewVisualColumn:this.context.cursorConfig.visibleColumnFromColumn(this._viewModel,i)}}getSelections(){return this._cursors.getSelections()}setSelections(e,t,i,n){this.setStates(e,t,n,ge.fromModelSelections(i))}getPrevEditOperationType(){return this._prevEditOperationType}setPrevEditOperationType(e){this._prevEditOperationType=e}_pushAutoClosedAction(e,t){const i=[],n=[];for(let a=0,c=e.length;a<c;a++)i.push({range:e[a],options:{description:"auto-closed-character",inlineClassName:"auto-closed-character",stickiness:1}}),n.push({range:t[a],options:{description:"auto-closed-enclosing",stickiness:1}});const s=this._model.deltaDecorations([],i),r=this._model.deltaDecorations([],n);this._autoClosedActions.push(new q1(this._model,s,r))}_executeEditOperation(e,t){if(!e)return;e.shouldPushStackElementBefore&&this._model.pushStackElement();const i=X6.executeCommands(this._model,this._cursors.getSelections(),e.commands,t);if(i){this._interpretCommandResult(i);const n=[],s=[];for(let r=0;r<e.commands.length;r++){const a=e.commands[r];a instanceof Pv&&a.enclosingRange&&a.closeCharacterRange&&(n.push(a.closeCharacterRange),s.push(a.enclosingRange))}n.length>0&&this._pushAutoClosedAction(n,s),this._prevEditOperationType=e.type}e.shouldPushStackElementAfter&&this._model.pushStackElement()}_interpretCommandResult(e){(!e||e.length===0)&&(e=this._cursors.readSelectionFromMarkers()),this._columnSelectData=null,this._cursors.setSelections(e),this._cursors.normalize()}_emitStateChangedIfNecessary(e,t,i,n,s){const r=Cu.from(this._model,this);if(r.equals(n))return!1;const a=this._cursors.getSelections(),c=this._cursors.getViewSelections();if(e.emitViewEvent(new E6(c,a,i)),!n||n.cursorState.length!==r.cursorState.length||r.cursorState.some((h,d)=>!h.modelState.equals(n.cursorState[d].modelState))){const h=n?n.cursorState.map(u=>u.modelState.selection):null,d=n?n.modelVersionId:0;e.emitOutgoingEvent(new Km(h,a,d,r.modelVersionId,t||"keyboard",i,s))}return!0}_findAutoClosingPairs(e){if(!e.length)return null;const t=[];for(let i=0,n=e.length;i<n;i++){const s=e[i];if(!s.text||s.text.indexOf(`
|
||
`)>=0)return null;const r=s.text.match(/([)\]}>'"`])([^)\]}>'"`]*)$/);if(!r)return null;const a=r[1],c=this.context.cursorConfig.autoClosingPairs.autoClosingPairsCloseSingleChar.get(a);if(!c||c.length!==1)return null;const h=c[0].open,d=s.text.length-r[2].length-1,u=s.text.lastIndexOf(h,d-1);if(u===-1)return null;t.push([u,d])}return t}executeEdits(e,t,i,n,s){let r=null;t==="snippet"&&(r=this._findAutoClosingPairs(i)),r&&(i[0]._isTracked=!0);const a=[],c=[],h=this._model.pushEditOperations(this.getSelections(),i,d=>{if(r)for(let f=0,g=r.length;f<g;f++){const[m,p]=r[f],b=d[f],v=b.range.startLineNumber,C=b.range.startColumn-1+m,w=b.range.startColumn-1+p;a.push(new l.Range(v,w+1,v,w+2)),c.push(new l.Range(v,C+1,v,w+2))}const u=n(d);return u&&(this._isHandling=!0),u},void 0,s);h&&(this._isHandling=!1,this.setSelections(e,t,h,0)),a.length>0&&this._pushAutoClosedAction(a,c)}_executeEdit(e,t,i,n=0){if(this.context.cursorConfig.readOnly)return;const s=Cu.from(this._model,this);this._cursors.stopTrackingSelections(),this._isHandling=!0;try{this._cursors.ensureValidState(),e()}catch(r){l.onUnexpectedError(r)}this._isHandling=!1,this._cursors.startTrackingSelections(),this._validateAutoClosedActions(),this._emitStateChangedIfNecessary(t,i,n,s,!1)&&this.revealAll(t,i,!1,0,!0,0)}getAutoClosedCharacters(){return q1.getAllAutoClosedCharacters(this._autoClosedActions)}startComposition(e){this._compositionState=new vu(this._model,this.getSelections())}endComposition(e,t){const i=$i.cursor({kind:"compositionEnd",detailedSource:t}),n=this._compositionState?this._compositionState.deduceOutcome(this._model,this.getSelections()):null;this._compositionState=null,this._executeEdit(()=>{t==="keyboard"&&this._executeEditOperation(cr.compositionEndWithInterceptors(this._prevEditOperationType,this.context.cursorConfig,this._model,n,this.getSelections(),this.getAutoClosedCharacters()),i)},e,t)}type(e,t,i){const n=$i.cursor({kind:"type",detailedSource:i});this._executeEdit(()=>{if(i==="keyboard"){const s=t.length;let r=0;for(;r<s;){const a=l.nextCharLength(t,r),c=t.substr(r,a);this._executeEditOperation(cr.typeWithInterceptors(!!this._compositionState,this._prevEditOperationType,this.context.cursorConfig,this._model,this.getSelections(),this.getAutoClosedCharacters(),c),n),r+=a}}else this._executeEditOperation(cr.typeWithoutInterceptors(this._prevEditOperationType,this.context.cursorConfig,this._model,this.getSelections(),t),n)},e,i)}compositionType(e,t,i,n,s,r){const a=$i.cursor({kind:"compositionType",detailedSource:r});if(t.length===0&&i===0&&n===0){if(s!==0){const c=this.getSelections().map(h=>{const d=h.getPosition();return new l.Selection(d.lineNumber,d.column+s,d.lineNumber,d.column+s)});this.setSelections(e,r,c,0)}return}this._executeEdit(()=>{this._executeEditOperation(cr.compositionType(this._prevEditOperationType,this.context.cursorConfig,this._model,this.getSelections(),t,i,n,s),a)},e,r)}paste(e,t,i,n,s){const r=$i.cursor({kind:"paste",detailedSource:s});this._executeEdit(()=>{this._executeEditOperation(cr.paste(this.context.cursorConfig,this._model,this.getSelections(),t,i,n||[]),r)},e,s,4)}cut(e,t){const i=$i.cursor({kind:"cut",detailedSource:t});this._executeEdit(()=>{this._executeEditOperation(va.cut(this.context.cursorConfig,this._model,this.getSelections()),i)},e,t)}executeCommand(e,t,i){const n=$i.cursor({kind:"executeCommand",detailedSource:i});this._executeEdit(()=>{this._cursors.killSecondaryCursors(),this._executeEditOperation(new pi(0,[t],{shouldPushStackElementBefore:!1,shouldPushStackElementAfter:!1}),n)},e,i)}executeCommands(e,t,i){const n=$i.cursor({kind:"executeCommands",detailedSource:i});this._executeEdit(()=>{this._executeEditOperation(new pi(0,t,{shouldPushStackElementBefore:!1,shouldPushStackElementAfter:!1}),n)},e,i)}}class Cu{static from(e,t){return new Cu(e.getVersionId(),t.getCursorStates())}constructor(e,t){this.modelVersionId=e,this.cursorState=t}equals(e){if(!e||this.modelVersionId!==e.modelVersionId||this.cursorState.length!==e.cursorState.length)return!1;for(let t=0,i=this.cursorState.length;t<i;t++)if(!this.cursorState[t].equals(e.cursorState[t]))return!1;return!0}}class q1{static getAllAutoClosedCharacters(e){let t=[];for(const i of e)t=t.concat(i.getAutoClosedCharactersRanges());return t}constructor(e,t,i){this._model=e,this._autoClosedCharactersDecorations=t,this._autoClosedEnclosingDecorations=i}dispose(){this._autoClosedCharactersDecorations=this._model.deltaDecorations(this._autoClosedCharactersDecorations,[]),this._autoClosedEnclosingDecorations=this._model.deltaDecorations(this._autoClosedEnclosingDecorations,[])}getAutoClosedCharactersRanges(){const e=[];for(let t=0;t<this._autoClosedCharactersDecorations.length;t++){const i=this._model.getDecorationRange(this._autoClosedCharactersDecorations[t]);i&&e.push(i)}return e}isValid(e){const t=[];for(let i=0;i<this._autoClosedEnclosingDecorations.length;i++){const n=this._model.getDecorationRange(this._autoClosedEnclosingDecorations[i]);if(n&&(t.push(n),n.startLineNumber!==n.endLineNumber))return!1}t.sort(l.Range.compareRangesUsingStarts),e.sort(l.Range.compareRangesUsingStarts);for(let i=0;i<e.length;i++)if(i>=t.length||!t[i].strictContainsRange(e[i]))return!1;return!0}}class X6{static executeCommands(e,t,i,n=$i.unknown({name:"executeCommands"})){const s={model:e,selectionsBefore:t,trackedRanges:[],trackedRangesDirection:[]},r=this._innerExecuteCommands(s,i,n);for(let a=0,c=s.trackedRanges.length;a<c;a++)s.model._setTrackedRange(s.trackedRanges[a],null,0);return r}static _innerExecuteCommands(e,t,i){if(this._arrayIsEmpty(t))return null;const n=this._getEditOperations(e,t);if(n.operations.length===0)return null;const s=n.operations,r=this._getLoserCursorMap(s);if(r.hasOwnProperty("0"))return console.warn("Ignoring commands"),null;const a=[];for(let d=0,u=s.length;d<u;d++)r.hasOwnProperty(s[d].identifier.major.toString())||a.push(s[d]);n.hadTrackedEditOperation&&a.length>0&&(a[0]._isTracked=!0);let c=e.model.pushEditOperations(e.selectionsBefore,a,d=>{const u=[];for(let m=0;m<e.selectionsBefore.length;m++)u[m]=[];for(const m of d)m.identifier&&u[m.identifier.major].push(m);const f=(m,p)=>m.identifier.minor-p.identifier.minor,g=[];for(let m=0;m<e.selectionsBefore.length;m++)u[m].length>0?(u[m].sort(f),g[m]=t[m].computeCursorState(e.model,{getInverseEditOperations:()=>u[m],getTrackedSelection:p=>{const b=parseInt(p,10),v=e.model._getTrackedRange(e.trackedRanges[b]);return e.trackedRangesDirection[b]===0?new l.Selection(v.startLineNumber,v.startColumn,v.endLineNumber,v.endColumn):new l.Selection(v.endLineNumber,v.endColumn,v.startLineNumber,v.startColumn)}})):g[m]=e.selectionsBefore[m];return g},void 0,i);c||(c=e.selectionsBefore);const h=[];for(const d in r)r.hasOwnProperty(d)&&h.push(parseInt(d,10));h.sort((d,u)=>u-d);for(const d of h)c.splice(d,1);return c}static _arrayIsEmpty(e){for(let t=0,i=e.length;t<i;t++)if(e[t])return!1;return!0}static _getEditOperations(e,t){let i=[],n=!1;for(let s=0,r=t.length;s<r;s++){const a=t[s];if(a){const c=this._getEditOperationsFromCommand(e,s,a);i=i.concat(c.operations),n=n||c.hadTrackedEditOperation}}return{operations:i,hadTrackedEditOperation:n}}static _getEditOperationsFromCommand(e,t,i){const n=[];let s=0;const r=(u,f,g=!1)=>{l.Range.isEmpty(u)&&f===""||n.push({identifier:{major:t,minor:s++},range:u,text:f,forceMoveMarkers:g,isAutoWhitespaceEdit:i.insertsAutoWhitespace})};let a=!1;const d={addEditOperation:r,addTrackedEditOperation:(u,f,g)=>{a=!0,r(u,f,g)},trackSelection:(u,f)=>{const g=l.Selection.liftSelection(u);let m;if(g.isEmpty())if(typeof f=="boolean")f?m=2:m=3;else{const v=e.model.getLineMaxColumn(g.startLineNumber);g.startColumn===v?m=2:m=3}else m=1;const p=e.trackedRanges.length,b=e.model._setTrackedRange(null,g,m);return e.trackedRanges[p]=b,e.trackedRangesDirection[p]=g.getDirection(),p.toString()}};try{i.getEditOperations(e.model,d)}catch(u){return l.onUnexpectedError(u),{operations:[],hadTrackedEditOperation:!1}}return{operations:n,hadTrackedEditOperation:a}}static _getLoserCursorMap(e){e=e.slice(0),e.sort((i,n)=>-l.Range.compareRangesUsingEnds(i.range,n.range));const t={};for(let i=1;i<e.length;i++){const n=e[i-1],s=e[i];if(l.Range.getStartPosition(n.range).isBefore(l.Range.getEndPosition(s.range))){let r;n.identifier.major>s.identifier.major?r=n.identifier.major:r=s.identifier.major,t[r.toString()]=!0;for(let a=0;a<e.length;a++)e[a].identifier.major===r&&(e.splice(a,1),a<i&&i--,a--);i>0&&i--}}return t}}class J6{constructor(e,t,i,n){this.text=e,this.lineNumber=t,this.startSelectionOffset=i,this.endSelectionOffset=n}}class vu{static _capture(e,t){const i=[];for(const n of t){if(n.startLineNumber!==n.endLineNumber)return null;const s=n.startLineNumber;i.push(new J6(e.getLineContent(s),s,n.startColumn-1,n.endColumn-1))}return i}constructor(e,t){this._original=vu._capture(e,t)}deduceOutcome(e,t){if(!this._original)return null;const i=vu._capture(e,t);if(!i||this._original.length!==i.length)return null;const n=[];for(let s=0,r=this._original.length;s<r;s++)n.push(vu._deduceOutcome(this._original[s],i[s]));return n}static _deduceOutcome(e,t){const i=Math.min(e.startSelectionOffset,t.startSelectionOffset,l.commonPrefixLength(e.text,t.text)),n=Math.min(e.text.length-e.endSelectionOffset,t.text.length-t.endSelectionOffset,l.commonSuffixLength(e.text,t.text)),s=e.text.substring(i,e.text.length-n),r=i,a=t.text.length-n,c=t.text.substring(r,a),h=new l.Range(t.lineNumber,r+1,t.lineNumber,a+1);return new NU(s,e.startSelectionOffset-i,e.endSelectionOffset-i,c,t.startSelectionOffset-i,t.endSelectionOffset-i,h)}}const Y1={getInitialState:()=>Hl,tokenizeEncoded:(o,e,t)=>Lg(0,t)};async function W6(o,e,t){if(!t)return Z1(e,o.languageIdCodec,Y1);const i=await l.TokenizationRegistry.getOrCreate(t);return Z1(e,o.languageIdCodec,i||Y1)}function H6(o,e,t,i,n,s,r){let a="<div>",c=0,h=0,d=!0;for(let u=0,f=e.getCount();u<f;u++){const g=e.getEndOffset(u);let m="";for(;c<g&&c<n;c++){const p=o.charCodeAt(c),b=p===9;if(h+=l.isFullWidthCharacter(p)?2:b?0:1,c<i){if(b){const v=h%s;h+=v===0?s:s-v}continue}switch(p){case 9:{const v=h%s,C=v===0?s:s-v;h+=C;let w=C;for(;w>0;)r&&d?(m+=" ",d=!1):(m+=" ",d=!0),w--;break}case 60:m+="<",d=!1;break;case 62:m+=">",d=!1;break;case 38:m+="&",d=!1;break;case 0:m+="�",d=!1;break;case 65279:case 8232:case 8233:case 133:m+="<22>",d=!1;break;case 13:m+="​",d=!1;break;case 32:r&&d?(m+=" ",d=!1):(m+=" ",d=!0);break;default:m+=String.fromCharCode(p),d=!1}}if(!(g<=i)&&(a+=`<span style="${e.getInlineStyle(u,t)}">${m}</span>`,g>n||c>=n||i>=n))break}return a+="</div>",a}function Z1(o,e,t){let i='<div class="monaco-tokenized-source">';const n=l.splitLines(o);let s=t.getInitialState();for(let r=0,a=n.length;r<a;r++){const c=n[r];r>0&&(i+="<br/>");const h=t.tokenizeEncoded(c,!0,s);_t.convertToEndOffset(h.tokens,c.length);const u=new _t(h.tokens,c,e).inflate();let f=0;for(let g=0,m=u.getCount();g<m;g++){const p=u.getClassName(g),b=u.getEndOffset(g);i+=`<span class="${p}">${l.escape(c.substring(f,b))}</span>`,f=b}s=h.endState}return i+="</div>",i}class e8{constructor(e,t,i,n,s){this.decorationId=e,this.index=t,this.lineNumber=i,this.specialHeight=n,this.prefixSum=s,this.maximumSpecialHeight=n,this.deleted=!1}}class Q1{constructor(e,t){this._decorationIDToCustomLine=new jm,this._orderedCustomLines=[],this._pendingChanges=[],this._invalidIndex=1/0,this._hasPending=!1,this._defaultLineHeight=e;for(const i of t)this.insertOrChangeCustomLineHeight(i.decorationId,i.startLineNumber,i.endLineNumber,i.lineHeight)}set defaultLineHeight(e){this._defaultLineHeight=e}get defaultLineHeight(){return this._defaultLineHeight}removeCustomLineHeight(e){this._pendingChanges.push({kind:1,decorationId:e}),this._hasPending=!0}insertOrChangeCustomLineHeight(e,t,i,n){this._pendingChanges.push({kind:0,decorationId:e,startLineNumber:t,endLineNumber:i,lineHeight:n}),this._hasPending=!0}heightForLineNumber(e){this._commit();const t=this._binarySearchOverOrderedCustomLinesArray(e);return t>=0?this._orderedCustomLines[t].maximumSpecialHeight:this._defaultLineHeight}getAccumulatedLineHeightsIncludingLineNumber(e){this._commit();const t=this._binarySearchOverOrderedCustomLinesArray(e);if(t>=0)return this._orderedCustomLines[t].prefixSum+this._orderedCustomLines[t].maximumSpecialHeight;if(t===-1)return this._defaultLineHeight*e;const i=-(t+1),n=this._orderedCustomLines[i-1];return n.prefixSum+n.maximumSpecialHeight+this._defaultLineHeight*(e-n.lineNumber)}onLinesDeleted(e,t){this._pendingChanges.push({kind:2,fromLineNumber:e,toLineNumber:t}),this._hasPending=!0}onLinesInserted(e,t){this._pendingChanges.push({kind:3,fromLineNumber:e,toLineNumber:t}),this._hasPending=!0}_commit(){if(!this._hasPending)return;const e=this._pendingChanges;this._pendingChanges=[],this._hasPending=!1;const t=[],i=new jm;for(const n of e)switch(n.kind){case 1:this._doRemoveCustomLineHeight(n.decorationId,i);break;case 0:this._doInsertOrChangeCustomLineHeight(n.decorationId,n.startLineNumber,n.endLineNumber,n.lineHeight,t,i);break;case 2:this._flushStagedDecorationChanges(t,i),this._doLinesDeleted(n.fromLineNumber,n.toLineNumber);break;case 3:this._flushStagedDecorationChanges(t,i),this._doLinesInserted(n.fromLineNumber,n.toLineNumber,t,i);break}this._flushStagedDecorationChanges(t,i)}_doRemoveCustomLineHeight(e,t){const i=this._decorationIDToCustomLine.get(e);if(i){this._decorationIDToCustomLine.delete(e);for(const s of i)s.deleted=!0,this._invalidIndex=Math.min(this._invalidIndex,s.index)}const n=t.get(e);if(n){t.delete(e);for(const s of n)s.deleted=!0}}_doInsertOrChangeCustomLineHeight(e,t,i,n,s,r){this._doRemoveCustomLineHeight(e,r);for(let a=t;a<=i;a++){const c=new e8(e,-1,a,n,0);s.push(c),r.add(e,c)}}_flushStagedDecorationChanges(e,t){if(e.length===0&&this._invalidIndex===1/0)return;for(const a of e){if(a.deleted)continue;const c=this._binarySearchOverOrderedCustomLinesArray(a.lineNumber),h=c>=0?c:-(c+1);this._orderedCustomLines.splice(h,0,a),this._invalidIndex=Math.min(this._invalidIndex,h)}if(e.length=0,t.clear(),this._invalidIndex===1/0)return;const i=new jm,n=[];for(let a=0;a<this._invalidIndex;a++){const c=this._orderedCustomLines[a];n.push(c),i.add(c.decorationId,c)}let s=0,r=this._invalidIndex>0?n[this._invalidIndex-1]:void 0;for(let a=this._invalidIndex;a<this._orderedCustomLines.length;a++){const c=this._orderedCustomLines[a];if(c.deleted){s++;continue}if(c.index=a-s,r&&r.lineNumber===c.lineNumber)c.maximumSpecialHeight=r.maximumSpecialHeight,c.prefixSum=r.prefixSum;else{let h=c.specialHeight;for(let u=a;u<this._orderedCustomLines.length;u++){const f=this._orderedCustomLines[u];if(!f.deleted){if(f.lineNumber!==c.lineNumber)break;h=Math.max(h,f.specialHeight)}}c.maximumSpecialHeight=h;let d;r?d=r.prefixSum+r.maximumSpecialHeight+this._defaultLineHeight*(c.lineNumber-r.lineNumber-1):d=this._defaultLineHeight*(c.lineNumber-1),c.prefixSum=d}r=c,n.push(c),i.add(c.decorationId,c)}this._orderedCustomLines=n,this._decorationIDToCustomLine=i,this._invalidIndex=1/0}_doLinesDeleted(e,t){const i=t-e+1,n=this._orderedCustomLines.length,s=this._binarySearchOverOrderedCustomLinesArray(e);let r;if(s>=0){r=s;for(let u=s-1;u>=0&&this._orderedCustomLines[u].lineNumber===e;u--)r--}else r=s===-(n+1)&&s!==-1?n-1:-(s+1);const a=this._binarySearchOverOrderedCustomLinesArray(t);let c;if(a>=0){c=a;for(let u=a+1;u<n&&this._orderedCustomLines[u].lineNumber===t;u++)c++}else c=a===-(n+1)&&a!==-1?n-1:-(a+1);const h=c>r,d=c===r&&this._orderedCustomLines[r]&&this._orderedCustomLines[r].lineNumber>=e&&this._orderedCustomLines[r].lineNumber<=t;if(h||d){let u=0;for(let D=r;D<=c;D++)u=Math.max(u,this._orderedCustomLines[D].maximumSpecialHeight);let f=0;if(r>0){const D=this._orderedCustomLines[r-1];f=D.prefixSum+D.maximumSpecialHeight+this._defaultLineHeight*(e-D.lineNumber-1)}else f=e>0?(e-1)*this._defaultLineHeight:0;const g=this._orderedCustomLines[r],m=this._orderedCustomLines[c],p=this._orderedCustomLines[c+1],b=p&&p.lineNumber===t+1?p.maximumSpecialHeight:this._defaultLineHeight,v=m.prefixSum+m.maximumSpecialHeight-g.prefixSum+this._defaultLineHeight*(t-m.lineNumber)+this._defaultLineHeight*(g.lineNumber-e)+b-u,C=new Set,w=[],S=new jm;let L=0;for(let D=0;D<this._orderedCustomLines.length;D++){const x=this._orderedCustomLines[D];if(D<r)w.push(x),S.add(x.decorationId,x);else if(D>=r&&D<=c){const I=x.decorationId;C.has(I)?L++:(x.index-=L,x.lineNumber=e,x.prefixSum=f,x.maximumSpecialHeight=u,w.push(x),S.add(x.decorationId,x))}else D>c&&(x.index-=L,x.lineNumber-=i,x.prefixSum-=v,w.push(x),S.add(x.decorationId,x));C.add(x.decorationId)}this._orderedCustomLines=w,this._decorationIDToCustomLine=S}else{const u=i*this._defaultLineHeight;for(let f=c;f<this._orderedCustomLines.length;f++){const g=this._orderedCustomLines[f];g.lineNumber>t&&(g.lineNumber-=i,g.prefixSum-=u)}}}_doLinesInserted(e,t,i,n){const s=t-e+1,r=this._binarySearchOverOrderedCustomLinesArray(e);let a;if(r>=0){a=r;for(let g=r-1;g>=0&&this._orderedCustomLines[g].lineNumber===e;g--)a--}else a=-(r+1);const c=[],h=new Set;for(let g=a;g<this._orderedCustomLines.length;g++)this._orderedCustomLines[g].lineNumber===e&&h.add(this._orderedCustomLines[g].decorationId);const d=new Set;for(let g=a-1;g>=0;g--)this._orderedCustomLines[g].lineNumber===e-1&&d.add(this._orderedCustomLines[g].decorationId);const u=UT(d,h),f=s*this._defaultLineHeight;for(let g=a;g<this._orderedCustomLines.length;g++)this._orderedCustomLines[g].lineNumber+=s,this._orderedCustomLines[g].prefixSum+=f;if(u.size>0){for(const g of u){const m=this._decorationIDToCustomLine.get(g);if(m){const p=m.reduce((C,w)=>Math.min(C,w.lineNumber),e),b=m.reduce((C,w)=>Math.max(C,w.lineNumber),e),v=m.reduce((C,w)=>Math.max(C,w.specialHeight),0);c.push({decorationId:g,startLineNumber:p,endLineNumber:b,lineHeight:v})}}for(const g of c)this._doInsertOrChangeCustomLineHeight(g.decorationId,g.startLineNumber,g.endLineNumber,g.lineHeight,i,n)}}_binarySearchOverOrderedCustomLinesArray(e){return l.binarySearch2(this._orderedCustomLines.length,t=>{const i=this._orderedCustomLines[t];return i.lineNumber===e?0:i.lineNumber<e?-1:1})}}class Gm{constructor(e,t,i,n){this.decorationId=e,this.startLineNumber=t,this.endLineNumber=i,this.lineHeight=n}static fromDecorations(e,t,i){const n=i.options.get(75);return e.map(s=>{const r=t.convertModelRangeToViewRange(s.range);return new Gm(s.id,r.startLineNumber,r.endLineNumber,s.options.lineHeight?s.options.lineHeight*n:0)})}}class jm{constructor(){this._map=new Map}add(e,t){const i=this._map.get(e);i?i.push(t):this._map.set(e,[t])}get(e){return this._map.get(e)}delete(e){this._map.delete(e)}clear(){this._map.clear()}}class t8{constructor(){this._hasPending=!1,this._inserts=[],this._changes=[],this._removes=[]}insert(e){this._hasPending=!0,this._inserts.push(e)}change(e){this._hasPending=!0,this._changes.push(e)}remove(e){this._hasPending=!0,this._removes.push(e)}commit(e){if(!this._hasPending)return;const t=this._inserts,i=this._changes,n=this._removes;this._hasPending=!1,this._inserts=[],this._changes=[],this._removes=[],e._commitPendingChanges(t,i,n)}}class i8{constructor(e,t,i,n,s){this.id=e,this.afterLineNumber=t,this.ordinal=i,this.height=n,this.minWidth=s,this.prefixSum=0}}let n8=(Pr=class{constructor(e,t,i,n,s){this._instanceId=l.singleLetterHash(++Pr.INSTANCE_COUNT),this._pendingChanges=new t8,this._lastWhitespaceId=0,this._arr=[],this._prefixSumValidIndex=-1,this._minWidth=-1,this._lineCount=e,this._paddingTop=i,this._paddingBottom=n,this._lineHeightsManager=new Q1(t,s)}static findInsertionIndex(e,t,i){let n=0,s=e.length;for(;n<s;){const r=n+s>>>1;t===e[r].afterLineNumber?i<e[r].ordinal?s=r:n=r+1:t<e[r].afterLineNumber?s=r:n=r+1}return n}setDefaultLineHeight(e){this._lineHeightsManager.defaultLineHeight=e}setPadding(e,t){this._paddingTop=e,this._paddingBottom=t}onFlushed(e,t){this._lineCount=e,this._lineHeightsManager=new Q1(this._lineHeightsManager.defaultLineHeight,t)}changeLineHeights(e){let t=!1;return e({insertOrChangeCustomLineHeight:(n,s,r,a)=>{t=!0,this._lineHeightsManager.insertOrChangeCustomLineHeight(n,s,r,a)},removeCustomLineHeight:n=>{t=!0,this._lineHeightsManager.removeCustomLineHeight(n)}}),t}changeWhitespace(e){let t=!1;try{e({insertWhitespace:(n,s,r,a)=>{t=!0,n=n|0,s=s|0,r=r|0,a=a|0;const c=this._instanceId+ ++this._lastWhitespaceId;return this._pendingChanges.insert(new i8(c,n,s,r,a)),c},changeOneWhitespace:(n,s,r)=>{t=!0,s=s|0,r=r|0,this._pendingChanges.change({id:n,newAfterLineNumber:s,newHeight:r})},removeWhitespace:n=>{t=!0,this._pendingChanges.remove({id:n})}})}finally{this._pendingChanges.commit(this)}return t}_commitPendingChanges(e,t,i){if((e.length>0||i.length>0)&&(this._minWidth=-1),e.length+t.length+i.length<=1){for(const c of e)this._insertWhitespace(c);for(const c of t)this._changeOneWhitespace(c.id,c.newAfterLineNumber,c.newHeight);for(const c of i){const h=this._findWhitespaceIndex(c.id);h!==-1&&this._removeWhitespace(h)}return}const n=new Set;for(const c of i)n.add(c.id);const s=new Map;for(const c of t)s.set(c.id,c);const r=c=>{const h=[];for(const d of c)if(!n.has(d.id)){if(s.has(d.id)){const u=s.get(d.id);d.afterLineNumber=u.newAfterLineNumber,d.height=u.newHeight}h.push(d)}return h},a=r(this._arr).concat(r(e));a.sort((c,h)=>c.afterLineNumber===h.afterLineNumber?c.ordinal-h.ordinal:c.afterLineNumber-h.afterLineNumber),this._arr=a,this._prefixSumValidIndex=-1}_insertWhitespace(e){const t=Pr.findInsertionIndex(this._arr,e.afterLineNumber,e.ordinal);this._arr.splice(t,0,e),this._prefixSumValidIndex=Math.min(this._prefixSumValidIndex,t-1)}_findWhitespaceIndex(e){const t=this._arr;for(let i=0,n=t.length;i<n;i++)if(t[i].id===e)return i;return-1}_changeOneWhitespace(e,t,i){const n=this._findWhitespaceIndex(e);if(n!==-1&&(this._arr[n].height!==i&&(this._arr[n].height=i,this._prefixSumValidIndex=Math.min(this._prefixSumValidIndex,n-1)),this._arr[n].afterLineNumber!==t)){const s=this._arr[n];this._removeWhitespace(n),s.afterLineNumber=t,this._insertWhitespace(s)}}_removeWhitespace(e){this._arr.splice(e,1),this._prefixSumValidIndex=Math.min(this._prefixSumValidIndex,e-1)}onLinesDeleted(e,t){e=e|0,t=t|0,this._lineCount-=t-e+1;for(let i=0,n=this._arr.length;i<n;i++){const s=this._arr[i].afterLineNumber;e<=s&&s<=t?this._arr[i].afterLineNumber=e-1:s>t&&(this._arr[i].afterLineNumber-=t-e+1)}this._lineHeightsManager.onLinesDeleted(e,t)}onLinesInserted(e,t){e=e|0,t=t|0,this._lineCount+=t-e+1;for(let i=0,n=this._arr.length;i<n;i++){const s=this._arr[i].afterLineNumber;e<=s&&(this._arr[i].afterLineNumber+=t-e+1)}this._lineHeightsManager.onLinesInserted(e,t)}getWhitespacesTotalHeight(){return this._arr.length===0?0:this.getWhitespacesAccumulatedHeight(this._arr.length-1)}getWhitespacesAccumulatedHeight(e){e=e|0;let t=Math.max(0,this._prefixSumValidIndex+1);t===0&&(this._arr[0].prefixSum=this._arr[0].height,t++);for(let i=t;i<=e;i++)this._arr[i].prefixSum=this._arr[i-1].prefixSum+this._arr[i].height;return this._prefixSumValidIndex=Math.max(this._prefixSumValidIndex,e),this._arr[e].prefixSum}getLinesTotalHeight(){const e=this._lineHeightsManager.getAccumulatedLineHeightsIncludingLineNumber(this._lineCount),t=this.getWhitespacesTotalHeight();return e+t+this._paddingTop+this._paddingBottom}getWhitespaceAccumulatedHeightBeforeLineNumber(e){e=e|0;const t=this._findLastWhitespaceBeforeLineNumber(e);return t===-1?0:this.getWhitespacesAccumulatedHeight(t)}_findLastWhitespaceBeforeLineNumber(e){e=e|0;const t=this._arr;let i=0,n=t.length-1;for(;i<=n;){const r=(n-i|0)/2|0,a=i+r|0;if(t[a].afterLineNumber<e){if(a+1>=t.length||t[a+1].afterLineNumber>=e)return a;i=a+1|0}else n=a-1|0}return-1}_findFirstWhitespaceAfterLineNumber(e){e=e|0;const i=this._findLastWhitespaceBeforeLineNumber(e)+1;return i<this._arr.length?i:-1}getFirstWhitespaceIndexAfterLineNumber(e){return e=e|0,this._findFirstWhitespaceAfterLineNumber(e)}getVerticalOffsetForLineNumber(e,t=!1){e=e|0;let i;e>1?i=this._lineHeightsManager.getAccumulatedLineHeightsIncludingLineNumber(e-1):i=0;const n=this.getWhitespaceAccumulatedHeightBeforeLineNumber(e-(t?1:0));return i+n+this._paddingTop}getLineHeightForLineNumber(e){return this._lineHeightsManager.heightForLineNumber(e)}getVerticalOffsetAfterLineNumber(e,t=!1){e=e|0;const i=this._lineHeightsManager.getAccumulatedLineHeightsIncludingLineNumber(e),n=this.getWhitespaceAccumulatedHeightBeforeLineNumber(e+(t?1:0));return i+n+this._paddingTop}getWhitespaceMinWidth(){if(this._minWidth===-1){let e=0;for(let t=0,i=this._arr.length;t<i;t++)e=Math.max(e,this._arr[t].minWidth);this._minWidth=e}return this._minWidth}isAfterLines(e){const t=this.getLinesTotalHeight();return e>t}isInTopPadding(e){return this._paddingTop===0?!1:e<this._paddingTop}isInBottomPadding(e){if(this._paddingBottom===0)return!1;const t=this.getLinesTotalHeight();return e>=t-this._paddingBottom}getLineNumberAtOrAfterVerticalOffset(e){if(e=e|0,e<0)return 1;const t=this._lineCount|0;let i=1,n=t;for(;i<n;){const s=(i+n)/2|0,r=this.getLineHeightForLineNumber(s),a=this.getVerticalOffsetForLineNumber(s)|0;if(e>=a+r)i=s+1;else{if(e>=a)return s;n=s}}return i>t?t:i}getLinesViewportData(e,t){e=e|0,t=t|0;const i=this.getLineNumberAtOrAfterVerticalOffset(e)|0,n=this.getVerticalOffsetForLineNumber(i)|0;let s=this._lineCount|0,r=this.getFirstWhitespaceIndexAfterLineNumber(i)|0;const a=this.getWhitespacesCount()|0;let c,h;r===-1?(r=a,h=s+1,c=0):(h=this.getAfterLineNumberForWhitespaceIndex(r)|0,c=this.getHeightForWhitespaceIndex(r)|0);let d=n,u=d;const f=5e5;let g=0;n>=f&&(g=Math.floor(n/f)*f,g=Math.floor(g/this._lineHeightsManager.defaultLineHeight)*this._lineHeightsManager.defaultLineHeight,u-=g);const m=[],p=e+(t-e)/2;let b=-1;for(let S=i;S<=s;S++){const L=this.getLineHeightForLineNumber(S);if(b===-1){const D=d,x=d+L;(D<=p&&p<x||D>p)&&(b=S)}for(d+=L,m[S-i]=u,u+=L;h===S;)u+=c,d+=c,r++,r>=a?h=s+1:(h=this.getAfterLineNumberForWhitespaceIndex(r)|0,c=this.getHeightForWhitespaceIndex(r)|0);if(d>=t){s=S;break}}b===-1&&(b=s);const v=this.getVerticalOffsetForLineNumber(s)|0;let C=i,w=s;if(C<w&&n<e&&C++,C<w){const S=this.getLineHeightForLineNumber(s);v+S>t&&w--}return{bigNumbersDelta:g,startLineNumber:i,endLineNumber:s,relativeVerticalOffset:m,centeredLineNumber:b,completelyVisibleStartLineNumber:C,completelyVisibleEndLineNumber:w,lineHeight:this._lineHeightsManager.defaultLineHeight}}getVerticalOffsetForWhitespaceIndex(e){e=e|0;const t=this.getAfterLineNumberForWhitespaceIndex(e);let i;t>=1?i=this._lineHeightsManager.getAccumulatedLineHeightsIncludingLineNumber(t):i=0;let n;return e>0?n=this.getWhitespacesAccumulatedHeight(e-1):n=0,i+n+this._paddingTop}getWhitespaceIndexAtOrAfterVerticallOffset(e){e=e|0;let t=0,i=this.getWhitespacesCount()-1;if(i<0)return-1;const n=this.getVerticalOffsetForWhitespaceIndex(i),s=this.getHeightForWhitespaceIndex(i);if(e>=n+s)return-1;for(;t<i;){const r=Math.floor((t+i)/2),a=this.getVerticalOffsetForWhitespaceIndex(r),c=this.getHeightForWhitespaceIndex(r);if(e>=a+c)t=r+1;else{if(e>=a)return r;i=r}}return t}getWhitespaceAtVerticalOffset(e){e=e|0;const t=this.getWhitespaceIndexAtOrAfterVerticallOffset(e);if(t<0||t>=this.getWhitespacesCount())return null;const i=this.getVerticalOffsetForWhitespaceIndex(t);if(i>e)return null;const n=this.getHeightForWhitespaceIndex(t),s=this.getIdForWhitespaceIndex(t),r=this.getAfterLineNumberForWhitespaceIndex(t);return{id:s,afterLineNumber:r,verticalOffset:i,height:n}}getWhitespaceViewportData(e,t){e=e|0,t=t|0;const i=this.getWhitespaceIndexAtOrAfterVerticallOffset(e),n=this.getWhitespacesCount()-1;if(i<0)return[];const s=[];for(let r=i;r<=n;r++){const a=this.getVerticalOffsetForWhitespaceIndex(r),c=this.getHeightForWhitespaceIndex(r);if(a>=t)break;s.push({id:this.getIdForWhitespaceIndex(r),afterLineNumber:this.getAfterLineNumberForWhitespaceIndex(r),verticalOffset:a,height:c})}return s}getWhitespaces(){return this._arr.slice(0)}getWhitespacesCount(){return this._arr.length}getIdForWhitespaceIndex(e){return e=e|0,this._arr[e].id}getAfterLineNumberForWhitespaceIndex(e){return e=e|0,this._arr[e].afterLineNumber}getHeightForWhitespaceIndex(e){return e=e|0,this._arr[e].height}},Pr.INSTANCE_COUNT=0,Pr);const s8=125;class wu{constructor(e,t,i,n){e=e|0,t=t|0,i=i|0,n=n|0,e<0&&(e=0),t<0&&(t=0),i<0&&(i=0),n<0&&(n=0),this.width=e,this.contentWidth=t,this.scrollWidth=Math.max(e,t),this.height=i,this.contentHeight=n,this.scrollHeight=Math.max(i,n)}equals(e){return this.width===e.width&&this.contentWidth===e.contentWidth&&this.height===e.height&&this.contentHeight===e.contentHeight}}class o8 extends l.Disposable{constructor(e,t){super(),this._onDidContentSizeChange=this._register(new l.Emitter),this.onDidContentSizeChange=this._onDidContentSizeChange.event,this._dimensions=new wu(0,0,0,0),this._scrollable=this._register(new mc({forceIntegerValues:!0,smoothScrollDuration:e,scheduleAtNextAnimationFrame:t})),this.onDidScroll=this._scrollable.onScroll}getScrollable(){return this._scrollable}setSmoothScrollDuration(e){this._scrollable.setSmoothScrollDuration(e)}validateScrollPosition(e){return this._scrollable.validateScrollPosition(e)}getScrollDimensions(){return this._dimensions}setScrollDimensions(e){if(this._dimensions.equals(e))return;const t=this._dimensions;this._dimensions=e,this._scrollable.setScrollDimensions({width:e.width,scrollWidth:e.scrollWidth,height:e.height,scrollHeight:e.scrollHeight},!0);const i=t.contentWidth!==e.contentWidth,n=t.contentHeight!==e.contentHeight;(i||n)&&this._onDidContentSizeChange.fire(new sS(t.contentWidth,t.contentHeight,e.contentWidth,e.contentHeight))}getFutureScrollPosition(){return this._scrollable.getFutureScrollPosition()}getCurrentScrollPosition(){return this._scrollable.getCurrentScrollPosition()}setScrollPositionNow(e){this._scrollable.setScrollPositionNow(e)}setScrollPositionSmooth(e){this._scrollable.setScrollPositionSmooth(e)}hasPendingScrollAnimation(){return this._scrollable.hasPendingScrollAnimation()}}class r8 extends l.Disposable{constructor(e,t,i,n){super(),this._configuration=e;const s=this._configuration.options,r=s.get(165),a=s.get(96);this._linesLayout=new n8(t,s.get(75),a.top,a.bottom,i),this._maxLineWidth=0,this._overlayWidgetsMinWidth=0,this._scrollable=this._register(new o8(0,n)),this._configureSmoothScrollDuration(),this._scrollable.setScrollDimensions(new wu(r.contentWidth,0,r.height,0)),this.onDidScroll=this._scrollable.onDidScroll,this.onDidContentSizeChange=this._scrollable.onDidContentSizeChange,this._updateHeight()}getScrollable(){return this._scrollable.getScrollable()}onHeightMaybeChanged(){this._updateHeight()}_configureSmoothScrollDuration(){this._scrollable.setSmoothScrollDuration(this._configuration.options.get(130)?s8:0)}onConfigurationChanged(e){const t=this._configuration.options;if(e.hasChanged(75)&&this._linesLayout.setDefaultLineHeight(t.get(75)),e.hasChanged(96)){const i=t.get(96);this._linesLayout.setPadding(i.top,i.bottom)}if(e.hasChanged(165)){const i=t.get(165),n=i.contentWidth,s=i.height,r=this._scrollable.getScrollDimensions(),a=r.contentWidth;this._scrollable.setScrollDimensions(new wu(n,r.contentWidth,s,this._getContentHeight(n,s,a)))}else this._updateHeight();e.hasChanged(130)&&this._configureSmoothScrollDuration()}onFlushed(e,t){this._linesLayout.onFlushed(e,t)}onLinesDeleted(e,t){this._linesLayout.onLinesDeleted(e,t)}onLinesInserted(e,t){this._linesLayout.onLinesInserted(e,t)}_getHorizontalScrollbarHeight(e,t){const n=this._configuration.options.get(117);return n.horizontal===2||e>=t?0:n.horizontalScrollbarSize}_getContentHeight(e,t,i){const n=this._configuration.options;let s=this._linesLayout.getLinesTotalHeight();return n.get(119)?s+=Math.max(0,t-n.get(75)-n.get(96).bottom):n.get(117).ignoreHorizontalScrollbarInContentHeight||(s+=this._getHorizontalScrollbarHeight(e,i)),s}_updateHeight(){const e=this._scrollable.getScrollDimensions(),t=e.width,i=e.height,n=e.contentWidth;this._scrollable.setScrollDimensions(new wu(t,e.contentWidth,i,this._getContentHeight(t,i,n)))}getCurrentViewport(){const e=this._scrollable.getScrollDimensions(),t=this._scrollable.getCurrentScrollPosition();return new mE(t.scrollTop,t.scrollLeft,e.width,e.height)}getFutureViewport(){const e=this._scrollable.getScrollDimensions(),t=this._scrollable.getFutureScrollPosition();return new mE(t.scrollTop,t.scrollLeft,e.width,e.height)}_computeContentWidth(){const e=this._configuration.options,t=this._maxLineWidth,i=e.get(166),n=e.get(59),s=e.get(165);if(i.isViewportWrapping){const r=e.get(81);return t>s.contentWidth+n.typicalHalfwidthCharacterWidth&&r.enabled&&r.side==="right"?t+s.verticalScrollbarWidth:t}else{const r=e.get(118)*n.typicalHalfwidthCharacterWidth,a=this._linesLayout.getWhitespaceMinWidth();return Math.max(t+r+s.verticalScrollbarWidth,a,this._overlayWidgetsMinWidth)}}setMaxLineWidth(e){this._maxLineWidth=e,this._updateContentWidth()}setOverlayWidgetsMinWidth(e){this._overlayWidgetsMinWidth=e,this._updateContentWidth()}_updateContentWidth(){const e=this._scrollable.getScrollDimensions();this._scrollable.setScrollDimensions(new wu(e.width,this._computeContentWidth(),e.height,e.contentHeight)),this._updateHeight()}saveState(){const e=this._scrollable.getFutureScrollPosition(),t=e.scrollTop,i=this._linesLayout.getLineNumberAtOrAfterVerticalOffset(t),n=this._linesLayout.getWhitespaceAccumulatedHeightBeforeLineNumber(i);return{scrollTop:t,scrollTopWithoutViewZones:t-n,scrollLeft:e.scrollLeft}}changeWhitespace(e){const t=this._linesLayout.changeWhitespace(e);return t&&this.onHeightMaybeChanged(),t}changeSpecialLineHeights(e){const t=this._linesLayout.changeLineHeights(e);return t&&this.onHeightMaybeChanged(),t}getVerticalOffsetForLineNumber(e,t=!1){return this._linesLayout.getVerticalOffsetForLineNumber(e,t)}getVerticalOffsetAfterLineNumber(e,t=!1){return this._linesLayout.getVerticalOffsetAfterLineNumber(e,t)}getLineHeightForLineNumber(e){return this._linesLayout.getLineHeightForLineNumber(e)}isAfterLines(e){return this._linesLayout.isAfterLines(e)}isInTopPadding(e){return this._linesLayout.isInTopPadding(e)}isInBottomPadding(e){return this._linesLayout.isInBottomPadding(e)}getLineNumberAtVerticalOffset(e){return this._linesLayout.getLineNumberAtOrAfterVerticalOffset(e)}getWhitespaceAtVerticalOffset(e){return this._linesLayout.getWhitespaceAtVerticalOffset(e)}getLinesViewportData(){const e=this.getCurrentViewport();return this._linesLayout.getLinesViewportData(e.top,e.top+e.height)}getLinesViewportDataAtScrollTop(e){const t=this._scrollable.getScrollDimensions();return e+t.height>t.scrollHeight&&(e=t.scrollHeight-t.height),e<0&&(e=0),this._linesLayout.getLinesViewportData(e,e+t.height)}getWhitespaceViewportData(){const e=this.getCurrentViewport();return this._linesLayout.getWhitespaceViewportData(e.top,e.top+e.height)}getWhitespaces(){return this._linesLayout.getWhitespaces()}getContentWidth(){return this._scrollable.getScrollDimensions().contentWidth}getScrollWidth(){return this._scrollable.getScrollDimensions().scrollWidth}getContentHeight(){return this._scrollable.getScrollDimensions().contentHeight}getScrollHeight(){return this._scrollable.getScrollDimensions().scrollHeight}getCurrentScrollLeft(){return this._scrollable.getCurrentScrollPosition().scrollLeft}getCurrentScrollTop(){return this._scrollable.getCurrentScrollPosition().scrollTop}validateScrollPosition(e){return this._scrollable.validateScrollPosition(e)}setScrollPosition(e,t){t===1?this._scrollable.setScrollPositionNow(e):this._scrollable.setScrollPositionSmooth(e)}hasPendingScrollAnimation(){return this._scrollable.hasPendingScrollAnimation()}deltaScrollNow(e,t){const i=this._scrollable.getCurrentScrollPosition();this._scrollable.setScrollPositionNow({scrollLeft:i.scrollLeft+e,scrollTop:i.scrollTop+t})}}class Ac{constructor(e,t,i){this.range=e,this.inlineClassName=t,this.type=i}}class a8{constructor(e,t,i){this.context=e,this.model=t,this.coordinatesConverter=i,this._decorationsCache=Object.create(null)}getInlineDecorations(e){const t=new l.Range(e,1,e,this.model.getLineMaxColumn(e)),i=this.coordinatesConverter.convertModelRangeToViewRange(t);return this.getDecorations(i,!1,!1).inlineDecorations}getDecorations(e,t,i){const n=this.context.getModelDecorations(e,t,i),s=e.startLineNumber,r=e.endLineNumber,a=[];let c=0;const h=[],d=[];for(let u=s;u<=r;u++)h[u-s]=[],d[u-s]=!1;for(let u=0,f=n.length;u<f;u++){const g=n[u],m=g.options;if(!rT(this.model,g))continue;const p=this._getOrCreateViewModelDecoration(g),b=p.range;if(a[c++]=p,m.inlineClassName){const v=new Ac(b,m.inlineClassName,m.inlineClassNameAffectsLetterSpacing?3:0),C=Math.max(s,b.startLineNumber),w=Math.min(r,b.endLineNumber);for(let S=C;S<=w;S++)h[S-s].push(v),m.affectsFont&&(d[S-s]=!0)}if(m.beforeContentClassName&&s<=b.startLineNumber&&b.startLineNumber<=r){const v=new Ac(new l.Range(b.startLineNumber,b.startColumn,b.startLineNumber,b.startColumn),m.beforeContentClassName,1);h[b.startLineNumber-s].push(v),m.affectsFont&&(d[b.startLineNumber-s]=!0)}if(m.afterContentClassName&&s<=b.endLineNumber&&b.endLineNumber<=r){const v=new Ac(new l.Range(b.endLineNumber,b.endColumn,b.endLineNumber,b.endColumn),m.afterContentClassName,2);h[b.endLineNumber-s].push(v),m.affectsFont&&(d[b.endLineNumber-s]=!0)}}return{decorations:a,inlineDecorations:h,hasVariableFonts:d}}reset(){this._decorationsCache=Object.create(null)}onModelDecorationsChanged(){this.reset()}onLineMappingChanged(){this.reset()}_getOrCreateViewModelDecoration(e){const t=e.id;let i=this._decorationsCache[t];if(!i){const n=e.range,s=e.options;let r;if(s.isWholeLine){const a=this.coordinatesConverter.convertModelPositionToViewPosition(new l.Position(n.startLineNumber,1),0,!1,!0),c=this.coordinatesConverter.convertModelPositionToViewPosition(new l.Position(n.endLineNumber,this.model.getLineMaxColumn(n.endLineNumber)),1);r=new l.Range(a.lineNumber,a.column,c.lineNumber,c.column)}else r=this.coordinatesConverter.convertModelRangeToViewRange(n,1);i=new oT(r,s),this._decorationsCache[t]=i}return i}}class l8{constructor(e){this.context=e}getInlineDecorations(e){const t=this.context.getInjectionOffsets(e);if(!t)return[];const i=[];let n=0,s=0;const r=this.context.getInjectionOptions(e),a=this.context.getBreakOffsets(e);for(let c=0;c<a.length;c++){const h=new Array;i[c]=h;const d=c>0?a[c-1]:0,u=a[c];for(;s<t.length;){const f=r[s].content.length,g=t[s]+n,m=g+f;if(g>u)break;if(d<m){const p=r[s];if(p.inlineClassName){const b=this.context.getWrappedTextIndentLength(e),v=c>0?b:0,C=v+Math.max(g-d,0),w=v+Math.min(m-d,u-d);if(C!==w){const S=this.context.getBaseViewLineNumber(e)+c,L=new l.Range(S,C+1,S,w+1),D=p.inlineClassNameAffectsLetterSpacing?3:0;h.push(new Ac(L,p.inlineClassName,D))}}}if(m<=u)n+=f,s++;else break}}return i}}class c8{constructor(e,t,i,n,s){this.editorId=e,this.configuration=i,this._linesCollection=n;const r={getModelDecorations:(a,c,h)=>this._linesCollection.getDecorationsInRange(a,this.editorId,Pf(this.configuration.options),kf(this.configuration.options),c,h)};this._inlineDecorationsComputer=new a8(r,t,s),this._cachedModelDecorationsResolver=null,this._cachedModelDecorationsResolverViewRange=null}_clearCachedModelDecorationsResolver(){this._cachedModelDecorationsResolver=null,this._cachedModelDecorationsResolverViewRange=null}dispose(){this._inlineDecorationsComputer.reset(),this._clearCachedModelDecorationsResolver()}reset(){this._inlineDecorationsComputer.reset(),this._clearCachedModelDecorationsResolver()}onModelDecorationsChanged(){this._inlineDecorationsComputer.onModelDecorationsChanged(),this._clearCachedModelDecorationsResolver()}onLineMappingChanged(){this._inlineDecorationsComputer.onLineMappingChanged(),this._clearCachedModelDecorationsResolver()}getMinimapDecorationsInRange(e){return this._inlineDecorationsComputer.getDecorations(e,!0,!1).decorations}getDecorationsViewportData(e){let t=this._cachedModelDecorationsResolver!==null;return t=t&&e.equalsRange(this._cachedModelDecorationsResolverViewRange),t||(this._cachedModelDecorationsResolver=this._inlineDecorationsComputer.getDecorations(e,!1,!1),this._cachedModelDecorationsResolverViewRange=e),this._cachedModelDecorationsResolver}getDecorationsOnLine(e,t=!1,i=!1){const n=new l.Range(e,this._linesCollection.getViewLineMinColumn(e),e,this._linesCollection.getViewLineMaxColumn(e));return this._inlineDecorationsComputer.getDecorations(n,t,i)}}function rS(o,e){return o===null?e?qm.INSTANCE:Ym.INSTANCE:new h8(o,e)}class h8{constructor(e,t){this._projectionData=e,this._isVisible=t}isVisible(){return this._isVisible}setVisible(e){return this._isVisible=e,this}getProjectionData(){return this._projectionData}getViewLineCount(){return this._isVisible?this._projectionData.getOutputLineCount():0}getViewLineContent(e,t,i){this._assertVisible();const n=i>0?this._projectionData.breakOffsets[i-1]:0,s=this._projectionData.breakOffsets[i];let r;if(this._projectionData.injectionOffsets!==null){const a=this._projectionData.injectionOffsets.map((h,d)=>new mo(0,0,h+1,this._projectionData.injectionOptions[d],0));r=mo.applyInjectedText(e.getLineContent(t),a).substring(n,s)}else r=e.getValueInRange({startLineNumber:t,startColumn:n+1,endLineNumber:t,endColumn:s+1});return i>0&&(r=X1(this._projectionData.wrappedTextIndentLength)+r),r}getViewLineLength(e,t,i){return this._assertVisible(),this._projectionData.getLineLength(i)}getViewLineMinColumn(e,t,i){return this._assertVisible(),this._projectionData.getMinOutputOffset(i)+1}getViewLineMaxColumn(e,t,i){return this._assertVisible(),this._projectionData.getMaxOutputOffset(i)+1}getViewLineData(e,t,i,n){const s=new Array;return this.getViewLinesData(e,t,i,1,n,0,[!0],s),s[0]}getViewLinesData(e,t,i,n,s,r,a,c){this._assertVisible();const h=this._projectionData,d=h.injectionOffsets,u=h.injectionOptions,f={getInjectionOptions:()=>u,getInjectionOffsets:()=>d,getBreakOffsets:()=>h.breakOffsets,getWrappedTextIndentLength:()=>h.wrappedTextIndentLength,getBaseViewLineNumber:()=>s},m=new l8(f).getInlineDecorations(t),p=e.tokenization.getLineTokens(t),b=f6(p,u,d);for(let v=i;v<i+n;v++){const C=r+v-i;if(!a[C]){c[C]=null;continue}c[C]=this._getViewLineData(b,m?m[v]:null,v)}}_getViewLineData(e,t,i){this._assertVisible();const n=this._projectionData,s=i>0?n.wrappedTextIndentLength:0,r=i>0?n.breakOffsets[i-1]:0,a=n.breakOffsets[i],c=e.sliceAndInflate(r,a,s);let h=c.getLineContent();i>0&&(h=X1(n.wrappedTextIndentLength)+h);const d=this._projectionData.getMinOutputOffset(i)+1,u=h.length+1,f=i+1<this.getViewLineCount(),g=i===0?0:n.breakOffsetsVisibleColumn[i-1];return new FC(h,f,d,u,g,c,t)}getModelColumnOfViewPosition(e,t){return this._assertVisible(),this._projectionData.translateToInputOffset(e,t-1)+1}getViewPositionOfModelPosition(e,t,i=2){return this._assertVisible(),this._projectionData.translateToOutputPosition(t-1,i).toPosition(e)}getViewLineNumberOfModelPosition(e,t){this._assertVisible();const i=this._projectionData.translateToOutputPosition(t-1);return e+i.outputLineIndex}normalizePosition(e,t,i){const n=t.lineNumber-e;return this._projectionData.normalizeOutputPosition(e,t.column-1,i).toPosition(n)}getInjectedTextAt(e,t){return this._projectionData.getInjectedText(e,t-1)}_assertVisible(){if(!this._isVisible)throw new Error("Not supported")}}const ab=class ab{constructor(){}isVisible(){return!0}setVisible(e){return e?this:Ym.INSTANCE}getProjectionData(){return null}getViewLineCount(){return 1}getViewLineContent(e,t,i){return e.getLineContent(t)}getViewLineLength(e,t,i){return e.getLineLength(t)}getViewLineMinColumn(e,t,i){return e.getLineMinColumn(t)}getViewLineMaxColumn(e,t,i){return e.getLineMaxColumn(t)}getViewLineData(e,t,i,n){const s=e.tokenization.getLineTokens(t),r=s.getLineContent();return new FC(r,!1,1,r.length+1,0,s.inflate(),null)}getViewLinesData(e,t,i,n,s,r,a,c){if(!a[r]){c[r]=null;return}c[r]=this.getViewLineData(e,t,0,s)}getModelColumnOfViewPosition(e,t){return t}getViewPositionOfModelPosition(e,t){return new l.Position(e,t)}getViewLineNumberOfModelPosition(e,t){return e}normalizePosition(e,t,i){return t}getInjectedTextAt(e,t){return null}};ab.INSTANCE=new ab;let qm=ab;const lb=class lb{constructor(){}isVisible(){return!1}setVisible(e){return e?qm.INSTANCE:this}getProjectionData(){return null}getViewLineCount(){return 0}getViewLineContent(e,t,i){throw new Error("Not supported")}getViewLineLength(e,t,i){throw new Error("Not supported")}getViewLineMinColumn(e,t,i){throw new Error("Not supported")}getViewLineMaxColumn(e,t,i){throw new Error("Not supported")}getViewLineData(e,t,i,n){throw new Error("Not supported")}getViewLinesData(e,t,i,n,s,r,a,c){throw new Error("Not supported")}getModelColumnOfViewPosition(e,t){throw new Error("Not supported")}getViewPositionOfModelPosition(e,t){throw new Error("Not supported")}getViewLineNumberOfModelPosition(e,t){throw new Error("Not supported")}normalizePosition(e,t,i){throw new Error("Not supported")}getInjectedTextAt(e,t){throw new Error("Not supported")}};lb.INSTANCE=new lb;let Ym=lb;const aS=[""];function X1(o){if(o>=aS.length)for(let e=1;e<=o;e++)aS[e]=d8(e);return aS[o]}function d8(o){return new Array(o+1).join(" ")}class u8{constructor(e){this._model=e}_validPosition(e){return this._model.validatePosition(e)}_validRange(e){return this._model.validateRange(e)}convertViewPositionToModelPosition(e){return this._validPosition(e)}convertViewRangeToModelRange(e){return this._validRange(e)}validateViewPosition(e,t){return this._validPosition(t)}validateViewRange(e,t){return this._validRange(t)}convertModelPositionToViewPosition(e){return this._validPosition(e)}convertModelRangeToViewRange(e){return this._validRange(e)}modelPositionIsVisible(e){const t=this._model.getLineCount();return!(e.lineNumber<1||e.lineNumber>t)}getModelLineViewLineCount(e){return 1}getViewLineNumberOfModelPosition(e,t){return e}}class f8{constructor(e,t,i,n,s,r,a,c,h,d,u){this._editorId=e,this.model=t,this._validModelVersionId=-1,this._domLineBreaksComputerFactory=i,this._monospaceLineBreaksComputerFactory=n,this.fontInfo=s,this.tabSize=r,this.wrappingStrategy=a,this.wrappingColumn=c,this.wrappingIndent=h,this.wordBreak=d,this.wrapOnEscapedLineFeeds=u,this._constructLines(!0,null)}dispose(){this.hiddenAreasDecorationIds=this.model.deltaDecorations(this.hiddenAreasDecorationIds,[])}createCoordinatesConverter(){return new m8(this)}_constructLines(e,t){this.modelLineProjections=[],e&&(this.hiddenAreasDecorationIds=this.model.deltaDecorations(this.hiddenAreasDecorationIds,[]));const n=this.model.getLinesContent().length,s=this.createLineBreaksComputer();for(let g=0;g<n;g++)s.addRequest(g+1,t?t[g]:null);const r=s.finalize(),a=[],c=this.hiddenAreasDecorationIds.map(g=>this.model.getDecorationRange(g)).sort(l.Range.compareRangesUsingStarts);let h=1,d=0,u=-1,f=u+1<c.length?d+1:n+2;for(let g=0;g<n;g++){const m=g+1;m===f&&(u++,h=c[u].startLineNumber,d=c[u].endLineNumber,f=u+1<c.length?d+1:n+2);const p=m>=h&&m<=d,b=rS(r[g],!p);a[g]=b.getViewLineCount(),this.modelLineProjections[g]=b}this._validModelVersionId=this.model.getVersionId(),this.projectedModelLineLineCounts=new l.ConstantTimePrefixSumComputer(a),this._ensureAtLeastOneVisibleLine()}getHiddenAreas(){return this.hiddenAreasDecorationIds.map(e=>this.model.getDecorationRange(e))}setHiddenAreas(e){const t=e.map(f=>this.model.validateRange(f)),i=g8(t),n=this.hiddenAreasDecorationIds.map(f=>this.model.getDecorationRange(f)).sort(l.Range.compareRangesUsingStarts);if(i.length===n.length){let f=!1;for(let g=0;g<i.length;g++)if(!i[g].equalsRange(n[g])){f=!0;break}if(!f)return!1}const s=i.map(f=>({range:f,options:Ct.EMPTY}));this.hiddenAreasDecorationIds=this.model.deltaDecorations(this.hiddenAreasDecorationIds,s);const r=i;let a=1,c=0,h=-1,d=h+1<r.length?c+1:this.modelLineProjections.length+2,u=!1;for(let f=0;f<this.modelLineProjections.length;f++){const g=f+1;g===d&&(h++,a=r[h].startLineNumber,c=r[h].endLineNumber,d=h+1<r.length?c+1:this.modelLineProjections.length+2);let m=!1;if(g>=a&&g<=c?this.modelLineProjections[f].isVisible()&&(this.modelLineProjections[f]=this.modelLineProjections[f].setVisible(!1),m=!0):(u=!0,this.modelLineProjections[f].isVisible()||(this.modelLineProjections[f]=this.modelLineProjections[f].setVisible(!0),m=!0)),m){const p=this.modelLineProjections[f].getViewLineCount();this.projectedModelLineLineCounts.setValue(f,p)}}return u||this.setHiddenAreas([]),!0}modelPositionIsVisible(e,t){return e<1||e>this.modelLineProjections.length?!1:this.modelLineProjections[e-1].isVisible()}getModelLineViewLineCount(e){return e<1||e>this.modelLineProjections.length?1:this.modelLineProjections[e-1].getViewLineCount()}setTabSize(e){return this.tabSize===e?!1:(this.tabSize=e,this._constructLines(!1,null),!0)}setWrappingSettings(e,t,i,n,s){const r=this.fontInfo.equals(e),a=this.wrappingStrategy===t,c=this.wrappingColumn===i,h=this.wrappingIndent===n,d=this.wordBreak===s;if(r&&a&&c&&h&&d)return!1;const u=r&&a&&!c&&h&&d;this.fontInfo=e,this.wrappingStrategy=t,this.wrappingColumn=i,this.wrappingIndent=n,this.wordBreak=s;let f=null;if(u){f=[];for(let g=0,m=this.modelLineProjections.length;g<m;g++)f[g]=this.modelLineProjections[g].getProjectionData()}return this._constructLines(!1,f),!0}createLineBreaksComputer(e){const t=this.wrappingStrategy==="advanced"?this._domLineBreaksComputerFactory:this._monospaceLineBreaksComputerFactory,i=e??{getLineContent:n=>this.model.getLineContent(n),getLineInjectedText:n=>this.model.getLineInjectedText(n,this._editorId)};return t.createLineBreaksComputer(i,this.fontInfo,this.tabSize,this.wrappingColumn,this.wrappingIndent,this.wordBreak,this.wrapOnEscapedLineFeeds)}onModelFlushed(){this._constructLines(!0,null)}onModelLinesDeleted(e,t,i){if(!e||e<=this._validModelVersionId)return null;const n=t===1?1:this.projectedModelLineLineCounts.getPrefixSum(t-1)+1,s=this.projectedModelLineLineCounts.getPrefixSum(i);return this.modelLineProjections.splice(t-1,i-t+1),this.projectedModelLineLineCounts.removeValues(t-1,i-t+1),new iS(n,s)}onModelLinesInserted(e,t,i,n){if(!e||e<=this._validModelVersionId)return null;const s=t>2&&!this.modelLineProjections[t-2].isVisible(),r=t===1?1:this.projectedModelLineLineCounts.getPrefixSum(t-1)+1;let a=0;const c=[],h=[];for(let d=0,u=n.length;d<u;d++){const f=rS(n[d],!s);c.push(f);const g=f.getViewLineCount();a+=g,h[d]=g}return this.modelLineProjections=this.modelLineProjections.slice(0,t-1).concat(c).concat(this.modelLineProjections.slice(t-1)),this.projectedModelLineLineCounts.insertValues(t-1,h),new nS(r,r+a-1)}onModelLineChanged(e,t,i){if(e!==null&&e<=this._validModelVersionId)return[!1,null,null,null];const n=t-1,s=this.modelLineProjections[n].getViewLineCount(),r=this.modelLineProjections[n].isVisible(),a=rS(i,r);this.modelLineProjections[n]=a;const c=this.modelLineProjections[n].getViewLineCount();let h=!1,d=0,u=-1,f=0,g=-1,m=0,p=-1;s>c?(d=this.projectedModelLineLineCounts.getPrefixSum(t-1)+1,u=d+c-1,m=u+1,p=m+(s-c)-1,h=!0):s<c?(d=this.projectedModelLineLineCounts.getPrefixSum(t-1)+1,u=d+s-1,f=u+1,g=f+(c-s)-1,h=!0):(d=this.projectedModelLineLineCounts.getPrefixSum(t-1)+1,u=d+c-1),this.projectedModelLineLineCounts.setValue(n,c);const b=d<=u?new j1(d,u-d+1):null,v=f<=g?new nS(f,g):null,C=m<=p?new iS(m,p):null;return[h,b,v,C]}acceptVersionId(e){this._validModelVersionId=e,this._ensureAtLeastOneVisibleLine()}_ensureAtLeastOneVisibleLine(){this.getViewLineCount()===0&&this.modelLineProjections.length>0&&(this.modelLineProjections[0]=this.modelLineProjections[0].setVisible(!0),this.projectedModelLineLineCounts.setValue(0,this.modelLineProjections[0].getViewLineCount()))}getViewLineCount(){return this.projectedModelLineLineCounts.getTotalSum()}_toValidViewLineNumber(e){if(e<1)return 1;const t=this.getViewLineCount();return e>t?t:e|0}getActiveIndentGuide(e,t,i){e=this._toValidViewLineNumber(e),t=this._toValidViewLineNumber(t),i=this._toValidViewLineNumber(i);const n=this.convertViewPositionToModelPosition(e,this.getViewLineMinColumn(e)),s=this.convertViewPositionToModelPosition(t,this.getViewLineMinColumn(t)),r=this.convertViewPositionToModelPosition(i,this.getViewLineMinColumn(i)),a=this.model.guides.getActiveIndentGuide(n.lineNumber,s.lineNumber,r.lineNumber),c=this.convertModelPositionToViewPosition(a.startLineNumber,1),h=this.convertModelPositionToViewPosition(a.endLineNumber,this.model.getLineMaxColumn(a.endLineNumber));return{startLineNumber:c.lineNumber,endLineNumber:h.lineNumber,indent:a.indent}}getViewLineInfo(e){e=this._toValidViewLineNumber(e);const t=this.projectedModelLineLineCounts.getIndexOf(e-1),i=t.index,n=t.remainder;return new J1(i+1,n)}getMinColumnOfViewLine(e){return this.modelLineProjections[e.modelLineNumber-1].getViewLineMinColumn(this.model,e.modelLineNumber,e.modelLineWrappedLineIdx)}getMaxColumnOfViewLine(e){return this.modelLineProjections[e.modelLineNumber-1].getViewLineMaxColumn(this.model,e.modelLineNumber,e.modelLineWrappedLineIdx)}getModelStartPositionOfViewLine(e){const t=this.modelLineProjections[e.modelLineNumber-1],i=t.getViewLineMinColumn(this.model,e.modelLineNumber,e.modelLineWrappedLineIdx),n=t.getModelColumnOfViewPosition(e.modelLineWrappedLineIdx,i);return new l.Position(e.modelLineNumber,n)}getModelEndPositionOfViewLine(e){const t=this.modelLineProjections[e.modelLineNumber-1],i=t.getViewLineMaxColumn(this.model,e.modelLineNumber,e.modelLineWrappedLineIdx),n=t.getModelColumnOfViewPosition(e.modelLineWrappedLineIdx,i);return new l.Position(e.modelLineNumber,n)}getViewLineInfosGroupedByModelRanges(e,t){const i=this.getViewLineInfo(e),n=this.getViewLineInfo(t),s=new Array;let r=this.getModelStartPositionOfViewLine(i),a=new Array;for(let c=i.modelLineNumber;c<=n.modelLineNumber;c++){const h=this.modelLineProjections[c-1];if(h.isVisible()){const d=c===i.modelLineNumber?i.modelLineWrappedLineIdx:0,u=c===n.modelLineNumber?n.modelLineWrappedLineIdx+1:h.getViewLineCount();for(let f=d;f<u;f++)a.push(new J1(c,f))}if(!h.isVisible()&&r){const d=new l.Position(c-1,this.model.getLineMaxColumn(c-1)+1),u=l.Range.fromPositions(r,d);s.push(new W1(u,a)),a=[],r=null}else h.isVisible()&&!r&&(r=new l.Position(c,1))}if(r){const c=l.Range.fromPositions(r,this.getModelEndPositionOfViewLine(n));s.push(new W1(c,a))}return s}getViewLinesBracketGuides(e,t,i,n){const s=i?this.convertViewPositionToModelPosition(i.lineNumber,i.column):null,r=[];for(const a of this.getViewLineInfosGroupedByModelRanges(e,t)){const c=a.modelRange.startLineNumber,h=this.model.guides.getLinesBracketGuides(c,a.modelRange.endLineNumber,s,n);for(const d of a.viewLines){const f=h[d.modelLineNumber-c].map(g=>{if(g.forWrappedLinesAfterColumn!==-1&&this.modelLineProjections[d.modelLineNumber-1].getViewPositionOfModelPosition(0,g.forWrappedLinesAfterColumn).lineNumber>=d.modelLineWrappedLineIdx||g.forWrappedLinesBeforeOrAtColumn!==-1&&this.modelLineProjections[d.modelLineNumber-1].getViewPositionOfModelPosition(0,g.forWrappedLinesBeforeOrAtColumn).lineNumber<d.modelLineWrappedLineIdx)return;if(!g.horizontalLine)return g;let m=-1;if(g.column!==-1){const v=this.modelLineProjections[d.modelLineNumber-1].getViewPositionOfModelPosition(0,g.column);if(v.lineNumber===d.modelLineWrappedLineIdx)m=v.column;else if(v.lineNumber<d.modelLineWrappedLineIdx)m=this.getMinColumnOfViewLine(d);else if(v.lineNumber>d.modelLineWrappedLineIdx)return}const p=this.convertModelPositionToViewPosition(d.modelLineNumber,g.horizontalLine.endColumn),b=this.modelLineProjections[d.modelLineNumber-1].getViewPositionOfModelPosition(0,g.horizontalLine.endColumn);return b.lineNumber===d.modelLineWrappedLineIdx?new xa(g.visibleColumn,m,g.className,new Kd(g.horizontalLine.top,p.column),-1,-1):b.lineNumber<d.modelLineWrappedLineIdx||g.visibleColumn!==-1?void 0:new xa(g.visibleColumn,m,g.className,new Kd(g.horizontalLine.top,this.getMaxColumnOfViewLine(d)),-1,-1)});r.push(f.filter(g=>!!g))}}return r}getViewLinesIndentGuides(e,t){e=this._toValidViewLineNumber(e),t=this._toValidViewLineNumber(t);const i=this.convertViewPositionToModelPosition(e,this.getViewLineMinColumn(e)),n=this.convertViewPositionToModelPosition(t,this.getViewLineMaxColumn(t));let s=[];const r=[],a=[],c=i.lineNumber-1,h=n.lineNumber-1;let d=null;for(let m=c;m<=h;m++){const p=this.modelLineProjections[m];if(p.isVisible()){const b=p.getViewLineNumberOfModelPosition(0,m===c?i.column:1),v=p.getViewLineNumberOfModelPosition(0,this.model.getLineMaxColumn(m+1)),C=v-b+1;let w=0;C>1&&p.getViewLineMinColumn(this.model,m+1,v)===1&&(w=b===0?1:2),r.push(C),a.push(w),d===null&&(d=new l.Position(m+1,0))}else d!==null&&(s=s.concat(this.model.guides.getLinesIndentGuides(d.lineNumber,m)),d=null)}d!==null&&(s=s.concat(this.model.guides.getLinesIndentGuides(d.lineNumber,n.lineNumber)),d=null);const u=t-e+1,f=new Array(u);let g=0;for(let m=0,p=s.length;m<p;m++){let b=s[m];const v=Math.min(u-g,r[m]),C=a[m];let w;C===2?w=0:C===1?w=1:w=v;for(let S=0;S<v;S++)S===w&&(b=0),f[g++]=b}return f}getViewLineContent(e){const t=this.getViewLineInfo(e);return this.modelLineProjections[t.modelLineNumber-1].getViewLineContent(this.model,t.modelLineNumber,t.modelLineWrappedLineIdx)}getViewLineLength(e){const t=this.getViewLineInfo(e);return this.modelLineProjections[t.modelLineNumber-1].getViewLineLength(this.model,t.modelLineNumber,t.modelLineWrappedLineIdx)}getViewLineMinColumn(e){const t=this.getViewLineInfo(e);return this.modelLineProjections[t.modelLineNumber-1].getViewLineMinColumn(this.model,t.modelLineNumber,t.modelLineWrappedLineIdx)}getViewLineMaxColumn(e){const t=this.getViewLineInfo(e);return this.modelLineProjections[t.modelLineNumber-1].getViewLineMaxColumn(this.model,t.modelLineNumber,t.modelLineWrappedLineIdx)}getViewLineData(e){const t=this.getViewLineInfo(e),i=this.projectedModelLineLineCounts.getPrefixSum(t.modelLineNumber-1)+1;return this.modelLineProjections[t.modelLineNumber-1].getViewLineData(this.model,t.modelLineNumber,t.modelLineWrappedLineIdx,i)}getViewLinesData(e,t,i){e=this._toValidViewLineNumber(e),t=this._toValidViewLineNumber(t);const n=this.projectedModelLineLineCounts.getIndexOf(e-1);let s=e;const r=n.index,a=n.remainder,c=[];for(let h=r,d=this.model.getLineCount();h<d;h++){const u=this.modelLineProjections[h];if(!u.isVisible())continue;const f=h===r?a:0;let g=u.getViewLineCount()-f,m=!1;s+g>t&&(m=!0,g=t-s+1);const p=this.projectedModelLineLineCounts.getPrefixSum(h)+1;if(u.getViewLinesData(this.model,h+1,f,g,p,s-e,i,c),s+=g,m)break}return c}validateViewPosition(e,t,i){e=this._toValidViewLineNumber(e);const n=this.projectedModelLineLineCounts.getIndexOf(e-1),s=n.index,r=n.remainder,a=this.modelLineProjections[s],c=a.getViewLineMinColumn(this.model,s+1,r),h=a.getViewLineMaxColumn(this.model,s+1,r);t<c&&(t=c),t>h&&(t=h);const d=a.getModelColumnOfViewPosition(r,t);return this.model.validatePosition(new l.Position(s+1,d)).equals(i)?new l.Position(e,t):this.convertModelPositionToViewPosition(i.lineNumber,i.column)}validateViewRange(e,t){const i=this.validateViewPosition(e.startLineNumber,e.startColumn,t.getStartPosition()),n=this.validateViewPosition(e.endLineNumber,e.endColumn,t.getEndPosition());return new l.Range(i.lineNumber,i.column,n.lineNumber,n.column)}convertViewPositionToModelPosition(e,t){const i=this.getViewLineInfo(e),n=this.modelLineProjections[i.modelLineNumber-1].getModelColumnOfViewPosition(i.modelLineWrappedLineIdx,t);return this.model.validatePosition(new l.Position(i.modelLineNumber,n))}convertViewRangeToModelRange(e){const t=this.convertViewPositionToModelPosition(e.startLineNumber,e.startColumn),i=this.convertViewPositionToModelPosition(e.endLineNumber,e.endColumn);return new l.Range(t.lineNumber,t.column,i.lineNumber,i.column)}convertModelPositionToViewPosition(e,t,i=2,n=!1,s=!1){const r=this.model.validatePosition(new l.Position(e,t)),a=r.lineNumber,c=r.column;let h=a-1,d=!1;if(s)for(;h<this.modelLineProjections.length&&!this.modelLineProjections[h].isVisible();)h++,d=!0;else for(;h>0&&!this.modelLineProjections[h].isVisible();)h--,d=!0;if(h===0&&!this.modelLineProjections[h].isVisible())return new l.Position(n?0:1,1);const u=1+this.projectedModelLineLineCounts.getPrefixSum(h);let f;return d?s?f=this.modelLineProjections[h].getViewPositionOfModelPosition(u,1,i):f=this.modelLineProjections[h].getViewPositionOfModelPosition(u,this.model.getLineMaxColumn(h+1),i):f=this.modelLineProjections[a-1].getViewPositionOfModelPosition(u,c,i),f}convertModelRangeToViewRange(e,t=0){if(e.isEmpty()){const i=this.convertModelPositionToViewPosition(e.startLineNumber,e.startColumn,t);return l.Range.fromPositions(i)}else{const i=this.convertModelPositionToViewPosition(e.startLineNumber,e.startColumn,1),n=this.convertModelPositionToViewPosition(e.endLineNumber,e.endColumn,0);return new l.Range(i.lineNumber,i.column,n.lineNumber,n.column)}}getViewLineNumberOfModelPosition(e,t){let i=e-1;if(this.modelLineProjections[i].isVisible()){const s=1+this.projectedModelLineLineCounts.getPrefixSum(i);return this.modelLineProjections[i].getViewLineNumberOfModelPosition(s,t)}for(;i>0&&!this.modelLineProjections[i].isVisible();)i--;if(i===0&&!this.modelLineProjections[i].isVisible())return 1;const n=1+this.projectedModelLineLineCounts.getPrefixSum(i);return this.modelLineProjections[i].getViewLineNumberOfModelPosition(n,this.model.getLineMaxColumn(i+1))}getDecorationsInRange(e,t,i,n,s,r){const a=this.convertViewPositionToModelPosition(e.startLineNumber,e.startColumn),c=this.convertViewPositionToModelPosition(e.endLineNumber,e.endColumn);if(c.lineNumber-a.lineNumber<=e.endLineNumber-e.startLineNumber)return this.model.getDecorationsInRange(new l.Range(a.lineNumber,1,c.lineNumber,c.column),t,i,n,s,r);let h=[];const d=a.lineNumber-1,u=c.lineNumber-1;let f=null;for(let b=d;b<=u;b++)if(this.modelLineProjections[b].isVisible())f===null&&(f=new l.Position(b+1,b===d?a.column:1));else if(f!==null){const C=this.model.getLineMaxColumn(b);h=h.concat(this.model.getDecorationsInRange(new l.Range(f.lineNumber,f.column,b,C),t,i,n,s)),f=null}f!==null&&(h=h.concat(this.model.getDecorationsInRange(new l.Range(f.lineNumber,f.column,c.lineNumber,c.column),t,i,n,s)),f=null),h.sort((b,v)=>{const C=l.Range.compareRangesUsingStarts(b.range,v.range);return C===0?b.id<v.id?-1:b.id>v.id?1:0:C});const g=[];let m=0,p=null;for(const b of h){const v=b.id;p!==v&&(p=v,g[m++]=b)}return g}getInjectedTextAt(e){const t=this.getViewLineInfo(e.lineNumber);return this.modelLineProjections[t.modelLineNumber-1].getInjectedTextAt(t.modelLineWrappedLineIdx,e.column)}normalizePosition(e,t){const i=this.getViewLineInfo(e.lineNumber);return this.modelLineProjections[i.modelLineNumber-1].normalizePosition(i.modelLineWrappedLineIdx,e,t)}getLineIndentColumn(e){const t=this.getViewLineInfo(e);return t.modelLineWrappedLineIdx===0?this.model.getLineIndentColumn(t.modelLineNumber):0}}function g8(o){if(o.length===0)return[];const e=o.slice();e.sort(l.Range.compareRangesUsingStarts);const t=[];let i=e[0].startLineNumber,n=e[0].endLineNumber;for(let s=1,r=e.length;s<r;s++){const a=e[s];a.startLineNumber>n+1?(t.push(new l.Range(i,1,n,1)),i=a.startLineNumber,n=a.endLineNumber):a.endLineNumber>n&&(n=a.endLineNumber)}return t.push(new l.Range(i,1,n,1)),t}class J1{constructor(e,t){this.modelLineNumber=e,this.modelLineWrappedLineIdx=t}}class W1{constructor(e,t){this.modelRange=e,this.viewLines=t}}class m8{constructor(e){this._lines=e}convertViewPositionToModelPosition(e){return this._lines.convertViewPositionToModelPosition(e.lineNumber,e.column)}convertViewRangeToModelRange(e){return this._lines.convertViewRangeToModelRange(e)}validateViewPosition(e,t){return this._lines.validateViewPosition(e.lineNumber,e.column,t)}validateViewRange(e,t){return this._lines.validateViewRange(e,t)}convertModelPositionToViewPosition(e,t,i,n){return this._lines.convertModelPositionToViewPosition(e.lineNumber,e.column,t,i,n)}convertModelRangeToViewRange(e,t){return this._lines.convertModelRangeToViewRange(e,t)}modelPositionIsVisible(e){return this._lines.modelPositionIsVisible(e.lineNumber,e.column)}getModelLineViewLineCount(e){return this._lines.getModelLineViewLineCount(e)}getViewLineNumberOfModelPosition(e,t){return this._lines.getViewLineNumberOfModelPosition(e,t)}}class p8{constructor(e){this.model=e}dispose(){}createCoordinatesConverter(){return new u8(this.model)}getHiddenAreas(){return[]}setHiddenAreas(e){return!1}setTabSize(e){return!1}setWrappingSettings(e,t,i,n){return!1}createLineBreaksComputer(){const e=[];return{addRequest:(t,i)=>{e.push(null)},finalize:()=>e}}onModelFlushed(){}onModelLinesDeleted(e,t,i){return new iS(t,i)}onModelLinesInserted(e,t,i,n){return new nS(t,i)}onModelLineChanged(e,t,i){return[!1,new j1(t,1),null,null]}acceptVersionId(e){}getViewLineCount(){return this.model.getLineCount()}getActiveIndentGuide(e,t,i){return{startLineNumber:e,endLineNumber:e,indent:0}}getViewLinesBracketGuides(e,t,i){return new Array(t-e+1).fill([])}getViewLinesIndentGuides(e,t){const i=t-e+1,n=new Array(i);for(let s=0;s<i;s++)n[s]=0;return n}getViewLineContent(e){return this.model.getLineContent(e)}getViewLineLength(e){return this.model.getLineLength(e)}getViewLineMinColumn(e){return this.model.getLineMinColumn(e)}getViewLineMaxColumn(e){return this.model.getLineMaxColumn(e)}getViewLineData(e){const t=this.model.tokenization.getLineTokens(e),i=t.getLineContent();return new FC(i,!1,1,i.length+1,0,t.inflate(),null)}getViewLinesData(e,t,i){const n=this.model.getLineCount();e=Math.min(Math.max(1,e),n),t=Math.min(Math.max(1,t),n);const s=[];for(let r=e;r<=t;r++){const a=r-e;s[a]=i[a]?this.getViewLineData(r):null}return s}getDecorationsInRange(e,t,i,n,s,r){return this.model.getDecorationsInRange(e,t,i,n,s,r)}normalizePosition(e,t){return this.model.normalizePosition(e,t)}getLineIndentColumn(e){return this.model.getLineIndentColumn(e)}getInjectedTextAt(e){return null}}const za=l.GlyphMarginLane.Right;class _8{constructor(e){this.persist=0,this._requiredLanes=1,this.lanes=new Uint8Array(Math.ceil((e+1)*za/8))}reset(e){const t=Math.ceil((e+1)*za/8);this.lanes.length<t?this.lanes=new Uint8Array(t):this.lanes.fill(0),this._requiredLanes=1}get requiredLanes(){return this._requiredLanes}push(e,t,i){i&&(this.persist|=1<<e-1);for(let n=t.startLineNumber;n<=t.endLineNumber;n++){const s=za*n+(e-1);this.lanes[s>>>3]|=1<<s%8,this._requiredLanes=Math.max(this._requiredLanes,this.countAtLine(n))}}getLanesAtLine(e){const t=[];let i=za*e;for(let n=0;n<za;n++)(this.persist&1<<n||this.lanes[i>>>3]&1<<i%8)&&t.push(n+1),i++;return t.length?t:[l.GlyphMarginLane.Center]}countAtLine(e){let t=za*e,i=0;for(let n=0;n<za;n++)(this.persist&1<<n||this.lanes[t>>>3]&1<<t%8)&&i++,t++;return i}}let b8=class extends l.Disposable{constructor(e,t,i,n,s,r,a,c,h,d){if(super(),this.languageConfigurationService=a,this._themeService=c,this._attachedView=h,this._transactionalTarget=d,this.hiddenAreasModel=new v8,this.previousHiddenAreas=[],this._editorId=e,this._configuration=t,this.model=i,this._eventDispatcher=new P6,this.onEvent=this._eventDispatcher.onEvent,this.cursorConfig=new bc(this.model.getLanguageId(),this.model.getOptions(),this._configuration,this.languageConfigurationService),this._updateConfigurationViewLineCount=this._register(new l.RunOnceScheduler(()=>this._updateConfigurationViewLineCountNow(),0)),this._hasFocus=!1,this._viewportStart=lS.create(this.model),this.glyphLanes=new _8(0),this.model.isTooLargeForTokenization())this._lines=new p8(this.model);else{const u=this._configuration.options,f=u.get(59),g=u.get(156),m=u.get(166),p=u.get(155),b=u.get(146),v=u.get(160);this._lines=new f8(this._editorId,this.model,n,s,f,this.model.getOptions().tabSize,g,m.wrappingColumn,p,b,v)}this.coordinatesConverter=this._lines.createCoordinatesConverter(),this._cursor=this._register(new Q6(i,this,this.coordinatesConverter,this.cursorConfig)),this.viewLayout=this._register(new r8(this._configuration,this.getLineCount(),this._getCustomLineHeights(),r)),this._register(this.viewLayout.onDidScroll(u=>{u.scrollTopChanged&&this._handleVisibleLinesChanged(),u.scrollTopChanged&&this._viewportStart.invalidate(),this._eventDispatcher.emitSingleViewEvent(new N6(u)),this._eventDispatcher.emitOutgoingEvent(new oS(u.oldScrollWidth,u.oldScrollLeft,u.oldScrollHeight,u.oldScrollTop,u.scrollWidth,u.scrollLeft,u.scrollHeight,u.scrollTop))})),this._register(this.viewLayout.onDidContentSizeChange(u=>{this._eventDispatcher.emitOutgoingEvent(u)})),this._decorations=new c8(this._editorId,this.model,this._configuration,this._lines,this.coordinatesConverter),this._registerModelEvents(),this._register(this._configuration.onDidChangeFast(u=>{try{const f=this._eventDispatcher.beginEmitViewEvents();this._onConfigurationChanged(f,u)}finally{this._eventDispatcher.endEmitViewEvents()}})),this._register(_m.getInstance().onDidChange(()=>{this._eventDispatcher.emitSingleViewEvent(new A6)})),this._register(this._themeService.onDidColorThemeChange(u=>{this._invalidateDecorationsColorCache(),this._eventDispatcher.emitSingleViewEvent(new R6(u))})),this._updateConfigurationViewLineCountNow(),this.model.registerViewModel(this)}dispose(){super.dispose(),this._decorations.dispose(),this._lines.dispose(),this._viewportStart.dispose(),this._eventDispatcher.dispose(),this.model.unregisterViewModel(this)}getEditorOption(e){return this._configuration.options.get(e)}createLineBreaksComputer(e){return this._lines.createLineBreaksComputer(e)}addViewEventHandler(e){this._eventDispatcher.addViewEventHandler(e)}removeViewEventHandler(e){this._eventDispatcher.removeViewEventHandler(e)}_getCustomLineHeights(){if(!this._configuration.options.get(5))return[];const t=this.model.getCustomLineHeightsDecorations(this._editorId);return Gm.fromDecorations(t,this.coordinatesConverter,this._configuration)}_getCustomLineHeightsForLines(e,t){if(!this._configuration.options.get(5))return[];const n=new l.Range(e,1,t,this.model.getLineMaxColumn(t)),s=this.model.getCustomLineHeightsDecorationsInRange(n,this._editorId);return Gm.fromDecorations(s,this.coordinatesConverter,this._configuration)}_updateConfigurationViewLineCountNow(){this._configuration.setViewLineCount(this._lines.getViewLineCount())}getModelVisibleRanges(){const e=this.viewLayout.getLinesViewportData(),t=new l.Range(e.startLineNumber,this.getLineMinColumn(e.startLineNumber),e.endLineNumber,this.getLineMaxColumn(e.endLineNumber));return this._toModelVisibleRanges(t)}visibleLinesStabilized(){const e=this.getModelVisibleRanges();this._attachedView.setVisibleLines(e,!0)}_handleVisibleLinesChanged(){const e=this.getModelVisibleRanges();this._attachedView.setVisibleLines(e,!1)}setHasFocus(e){this._hasFocus=e,this._cursor.setHasFocus(e),this._eventDispatcher.emitSingleViewEvent(new I6(e)),this._eventDispatcher.emitOutgoingEvent(new $m(!e,e))}setHasWidgetFocus(e){this._eventDispatcher.emitOutgoingEvent(new F6(!e,e))}onCompositionStart(){this._eventDispatcher.emitSingleViewEvent(new L6)}onCompositionEnd(){this._eventDispatcher.emitSingleViewEvent(new D6)}_captureStableViewport(){if(this._viewportStart.isValid&&this.viewLayout.getCurrentScrollTop()>0){const e=new l.Position(this._viewportStart.viewLineNumber,this.getLineMinColumn(this._viewportStart.viewLineNumber)),t=this.coordinatesConverter.convertViewPositionToModelPosition(e);return new eN(t,this._viewportStart.startLineDelta)}return new eN(null,0)}_onConfigurationChanged(e,t){const i=this._captureStableViewport(),n=this._configuration.options,s=n.get(59),r=n.get(156),a=n.get(166),c=n.get(155),h=n.get(146);this._lines.setWrappingSettings(s,r,a.wrappingColumn,c,h)&&(e.emitViewEvent(new Vm),e.emitViewEvent(new Um),e.emitViewEvent(new Ba(null)),this._cursor.onLineMappingChanged(e),this._decorations.onLineMappingChanged(),this.viewLayout.onFlushed(this.getLineCount(),this._getCustomLineHeights()),this._updateConfigurationViewLineCount.schedule()),t.hasChanged(104)&&(this._decorations.reset(),e.emitViewEvent(new Ba(null))),t.hasChanged(112)&&(this._decorations.reset(),e.emitViewEvent(new Ba(null))),e.emitViewEvent(new x6(t)),this.viewLayout.onConfigurationChanged(t),i.recoverViewportStart(this.coordinatesConverter,this.viewLayout),bc.shouldRecreate(t)&&(this.cursorConfig=new bc(this.model.getLanguageId(),this.model.getOptions(),this._configuration,this.languageConfigurationService),this._cursor.updateConfiguration(this.cursorConfig))}onDidChangeContentOrInjectedText(e){try{const i=this._eventDispatcher.beginEmitViewEvents();let n=!1,s=!1;const r=e instanceof Ra?e.rawContentChangedEvent.changes:e.changes,a=e instanceof Ra?e.rawContentChangedEvent.versionId:null,c=this._lines.createLineBreaksComputer();for(const f of r)switch(f.changeType){case 4:{for(let g=0;g<f.count;g++)c.addRequest(f.fromLineNumberPostEdit+g,null);break}case 2:{c.addRequest(f.lineNumberPostEdit,null);break}}const h=c.finalize(),d=new l.ArrayQueue(h),u=[];for(const f of r)switch(f.changeType){case 1:{this._lines.onModelFlushed(),i.emitViewEvent(new Vm),this._decorations.reset(),this.viewLayout.onFlushed(this.getLineCount(),this._getCustomLineHeights()),n=!0;break}case 3:{const g=this._lines.onModelLinesDeleted(a,f.fromLineNumber,f.toLineNumber);g!==null&&(i.emitViewEvent(g),this.viewLayout.onLinesDeleted(g.fromLineNumber,g.toLineNumber),u.push({fromLineNumber:f.lastUntouchedLinePostEdit,toLineNumber:f.lastUntouchedLinePostEdit})),n=!0;break}case 4:{const g=d.takeCount(f.count),m=this._lines.onModelLinesInserted(a,f.fromLineNumber,f.toLineNumber,g);m!==null&&(i.emitViewEvent(m),this.viewLayout.onLinesInserted(m.fromLineNumber,m.toLineNumber),u.push({fromLineNumber:f.fromLineNumberPostEdit,toLineNumber:f.toLineNumberPostEdit})),n=!0;break}case 2:{const g=d.dequeue(),[m,p,b,v]=this._lines.onModelLineChanged(a,f.lineNumber,g);s=m,p&&i.emitViewEvent(p),b&&(i.emitViewEvent(b),this.viewLayout.onLinesInserted(b.fromLineNumber,b.toLineNumber),u.push({fromLineNumber:f.lineNumberPostEdit,toLineNumber:f.lineNumberPostEdit})),v&&(i.emitViewEvent(v),this.viewLayout.onLinesDeleted(v.fromLineNumber,v.toLineNumber),u.push({fromLineNumber:f.lineNumberPostEdit,toLineNumber:f.lineNumberPostEdit}));break}case 5:break}a!==null&&this._lines.acceptVersionId(a),u.length>0&&this.viewLayout.changeSpecialLineHeights(f=>{for(const g of u){const m=this._getCustomLineHeightsForLines(g.fromLineNumber,g.toLineNumber);for(const p of m)f.insertOrChangeCustomLineHeight(p.decorationId,p.startLineNumber,p.endLineNumber,p.lineHeight)}}),this.viewLayout.onHeightMaybeChanged(),!n&&s&&(i.emitViewEvent(new Um),i.emitViewEvent(new Ba(null)),this._cursor.onLineMappingChanged(i),this._decorations.onLineMappingChanged())}finally{this._eventDispatcher.endEmitViewEvents()}const t=this._viewportStart.isValid;if(this._viewportStart.invalidate(),this._configuration.setModelLineCount(this.model.getLineCount()),this._updateConfigurationViewLineCountNow(),!this._hasFocus&&this.model.getAttachedEditorCount()>=2&&t){const i=this.model._getTrackedRange(this._viewportStart.modelTrackedRange);if(i){const n=this.coordinatesConverter.convertModelPositionToViewPosition(i.getStartPosition()),s=this.viewLayout.getVerticalOffsetForLineNumber(n.lineNumber);this.viewLayout.setScrollPosition({scrollTop:s+this._viewportStart.startLineDelta},1)}}this._handleVisibleLinesChanged()}emitContentChangeEvent(e){this._emitViewEvent(t=>{e instanceof Ra&&t.emitOutgoingEvent(new G6(e.contentChangedEvent)),this._cursor.onModelContentChanged(t,e)})}_registerModelEvents(){this._configuration.options.get(5)&&this._register(this.model.onDidChangeLineHeight(i=>{const n=i.changes.filter(s=>s.ownerId===this._editorId||s.ownerId===0);if(this.viewLayout.changeSpecialLineHeights(s=>{for(const r of n){const{decorationId:a,lineNumber:c,lineHeightMultiplier:h}=r,d=this.coordinatesConverter.convertModelRangeToViewRange(new l.Range(c,1,c,this.model.getLineMaxColumn(c)));h!==null?s.insertOrChangeCustomLineHeight(a,d.startLineNumber,d.endLineNumber,h*this._configuration.options.get(75)):s.removeCustomLineHeight(a)}}),n.length>0){const s=new FT(n);this._eventDispatcher.emitOutgoingEvent(new Y6(s))}})),this._configuration.options.get(172)&&this._register(this.model.onDidChangeFont(i=>{const n=i.changes.filter(s=>s.ownerId===this._editorId||s.ownerId===0);if(n.length>0){const s=new BT(n);this._eventDispatcher.emitOutgoingEvent(new Z6(s))}})),this._register(this.model.onDidChangeTokens(i=>{const n=[];for(let s=0,r=i.ranges.length;s<r;s++){const a=i.ranges[s],c=this.coordinatesConverter.convertModelPositionToViewPosition(new l.Position(a.fromLineNumber,1)).lineNumber,h=this.coordinatesConverter.convertModelPositionToViewPosition(new l.Position(a.toLineNumber,this.model.getLineMaxColumn(a.toLineNumber))).lineNumber;n[s]={fromLineNumber:c,toLineNumber:h}}this._eventDispatcher.emitSingleViewEvent(new M6(n)),this._eventDispatcher.emitOutgoingEvent(new q6(i))})),this._register(this.model.onDidChangeLanguageConfiguration(i=>{this._eventDispatcher.emitSingleViewEvent(new T6),this.cursorConfig=new bc(this.model.getLanguageId(),this.model.getOptions(),this._configuration,this.languageConfigurationService),this._cursor.updateConfiguration(this.cursorConfig),this._eventDispatcher.emitOutgoingEvent(new K6(i))})),this._register(this.model.onDidChangeLanguage(i=>{this.cursorConfig=new bc(this.model.getLanguageId(),this.model.getOptions(),this._configuration,this.languageConfigurationService),this._cursor.updateConfiguration(this.cursorConfig),this._eventDispatcher.emitOutgoingEvent(new $6(i))})),this._register(this.model.onDidChangeOptions(i=>{if(this._lines.setTabSize(this.model.getOptions().tabSize)){try{const n=this._eventDispatcher.beginEmitViewEvents();n.emitViewEvent(new Vm),n.emitViewEvent(new Um),n.emitViewEvent(new Ba(null)),this._cursor.onLineMappingChanged(n),this._decorations.onLineMappingChanged(),this.viewLayout.onFlushed(this.getLineCount(),this._getCustomLineHeights())}finally{this._eventDispatcher.endEmitViewEvents()}this._updateConfigurationViewLineCount.schedule()}this.cursorConfig=new bc(this.model.getLanguageId(),this.model.getOptions(),this._configuration,this.languageConfigurationService),this._cursor.updateConfiguration(this.cursorConfig),this._eventDispatcher.emitOutgoingEvent(new j6(i))})),this._register(this.model.onDidChangeDecorations(i=>{this._decorations.onModelDecorationsChanged(),this._eventDispatcher.emitSingleViewEvent(new Ba(i)),this._eventDispatcher.emitOutgoingEvent(new U6(i))}))}getFontSizeAtPosition(e){if(!this._configuration.options.get(172))return null;const i=this.model.getFontDecorationsInRange(l.Range.fromPositions(e),this._editorId);let n=this._configuration.options.get(59).fontSize+"px";for(const s of i)if(s.options.fontSize){n=s.options.fontSize;break}return n}setHiddenAreas(e,t,i){this.hiddenAreasModel.setHiddenAreas(t,e);const n=this.hiddenAreasModel.getMergedRanges();if(n===this.previousHiddenAreas&&!i)return;this.previousHiddenAreas=n;const s=this._captureStableViewport();let r=!1;try{const a=this._eventDispatcher.beginEmitViewEvents();r=this._lines.setHiddenAreas(n),r&&(a.emitViewEvent(new Vm),a.emitViewEvent(new Um),a.emitViewEvent(new Ba(null)),this._cursor.onLineMappingChanged(a),this._decorations.onLineMappingChanged(),this.viewLayout.onFlushed(this.getLineCount(),this._getCustomLineHeights()),this.viewLayout.onHeightMaybeChanged());const c=s.viewportStartModelPosition?.lineNumber;c&&n.some(d=>d.startLineNumber<=c&&c<=d.endLineNumber)||s.recoverViewportStart(this.coordinatesConverter,this.viewLayout)}finally{this._eventDispatcher.endEmitViewEvents()}this._updateConfigurationViewLineCount.schedule(),r&&this._eventDispatcher.emitOutgoingEvent(new z6)}getVisibleRangesPlusViewportAboveBelow(){const e=this._configuration.options.get(165),t=this._configuration.options.get(75),i=Math.max(20,Math.round(e.height/t)),n=this.viewLayout.getLinesViewportData(),s=Math.max(1,n.completelyVisibleStartLineNumber-i),r=Math.min(this.getLineCount(),n.completelyVisibleEndLineNumber+i);return this._toModelVisibleRanges(new l.Range(s,this.getLineMinColumn(s),r,this.getLineMaxColumn(r)))}getVisibleRanges(){const e=this.getCompletelyVisibleViewRange();return this._toModelVisibleRanges(e)}getHiddenAreas(){return this._lines.getHiddenAreas()}_toModelVisibleRanges(e){const t=this.coordinatesConverter.convertViewRangeToModelRange(e),i=this._lines.getHiddenAreas();if(i.length===0)return[t];const n=[];let s=0,r=t.startLineNumber,a=t.startColumn;const c=t.endLineNumber,h=t.endColumn;for(let d=0,u=i.length;d<u;d++){const f=i[d].startLineNumber,g=i[d].endLineNumber;g<r||f>c||(r<f&&(n[s++]=new l.Range(r,a,f-1,this.model.getLineMaxColumn(f-1))),r=g+1,a=1)}return(r<c||r===c&&a<h)&&(n[s++]=new l.Range(r,a,c,h)),n}getCompletelyVisibleViewRange(){const e=this.viewLayout.getLinesViewportData(),t=e.completelyVisibleStartLineNumber,i=e.completelyVisibleEndLineNumber;return new l.Range(t,this.getLineMinColumn(t),i,this.getLineMaxColumn(i))}getCompletelyVisibleViewRangeAtScrollTop(e){const t=this.viewLayout.getLinesViewportDataAtScrollTop(e),i=t.completelyVisibleStartLineNumber,n=t.completelyVisibleEndLineNumber;return new l.Range(i,this.getLineMinColumn(i),n,this.getLineMaxColumn(n))}getViewRangeWithCursorPadding(e){const t=this._configuration.options,i=t.get(35),n=t.get(131);let{startLineNumber:s,endLineNumber:r}=e;const a=Math.min(Math.max(i,n.enabled?n.maxLineCount:0),Math.floor((r-s+1)/2));return s+=a,r-=Math.max(0,a-1),a===0||s>r?e:new l.Range(s,this.getLineMinColumn(s),r,this.getLineMaxColumn(r))}saveState(){const e=this.viewLayout.saveState(),t=e.scrollTop,i=this.viewLayout.getLineNumberAtVerticalOffset(t),n=this.coordinatesConverter.convertViewPositionToModelPosition(new l.Position(i,this.getLineMinColumn(i))),s=this.viewLayout.getVerticalOffsetForLineNumber(i)-t;return{scrollLeft:e.scrollLeft,firstPosition:n,firstPositionDeltaTop:s}}reduceRestoreState(e){if(typeof e.firstPosition>"u")return this._reduceRestoreStateCompatibility(e);const t=this.model.validatePosition(e.firstPosition),i=this.coordinatesConverter.convertModelPositionToViewPosition(t),n=this.viewLayout.getVerticalOffsetForLineNumber(i.lineNumber)-e.firstPositionDeltaTop;return{scrollLeft:e.scrollLeft,scrollTop:n}}_reduceRestoreStateCompatibility(e){return{scrollLeft:e.scrollLeft,scrollTop:e.scrollTopWithoutViewZones}}getTabSize(){return this.model.getOptions().tabSize}getLineCount(){return this._lines.getViewLineCount()}setViewport(e,t,i){this._viewportStart.update(this,e)}getActiveIndentGuide(e,t,i){return this._lines.getActiveIndentGuide(e,t,i)}getLinesIndentGuides(e,t){return this._lines.getViewLinesIndentGuides(e,t)}getBracketGuidesInRangeByLine(e,t,i,n){return this._lines.getViewLinesBracketGuides(e,t,i,n)}getLineContent(e){return this._lines.getViewLineContent(e)}getLineLength(e){return this._lines.getViewLineLength(e)}getLineMinColumn(e){return this._lines.getViewLineMinColumn(e)}getLineMaxColumn(e){return this._lines.getViewLineMaxColumn(e)}getLineFirstNonWhitespaceColumn(e){const t=l.firstNonWhitespaceIndex(this.getLineContent(e));return t===-1?0:t+1}getLineLastNonWhitespaceColumn(e){const t=l.lastNonWhitespaceIndex(this.getLineContent(e));return t===-1?0:t+2}getMinimapDecorationsInRange(e){return this._decorations.getMinimapDecorationsInRange(e)}getDecorationsInViewport(e){return this._decorations.getDecorationsViewportData(e).decorations}getInjectedTextAt(e){return this._lines.getInjectedTextAt(e)}_getTextDirection(e,t){let i=0;for(const n of t){const s=n.range;if(s.startLineNumber>e||s.endLineNumber<e)continue;const r=n.options.textDirection;r===l.TextDirection.RTL?i++:r===l.TextDirection.LTR&&i--}return i>0?l.TextDirection.RTL:l.TextDirection.LTR}getTextDirection(e){const t=this._decorations.getDecorationsOnLine(e);return this._getTextDirection(e,t.decorations)}getViewportViewLineRenderingData(e,t){const i=this._decorations.getDecorationsViewportData(e),n=t-e.startLineNumber,s=i.inlineDecorations[n],r=i.hasVariableFonts[n];return this._getViewLineRenderingData(t,s,r,i.decorations)}getViewLineRenderingData(e){const t=this._decorations.getDecorationsOnLine(e);return this._getViewLineRenderingData(e,t.inlineDecorations[0],t.hasVariableFonts[0],t.decorations)}_getViewLineRenderingData(e,t,i,n){const s=this.model.mightContainRTL(),r=this.model.mightContainNonBasicASCII(),a=this.getTabSize(),c=this._lines.getViewLineData(e);return c.inlineDecorations&&(t=[...t,...c.inlineDecorations]),new Wi(c.minColumn,c.maxColumn,c.content,c.continuesWithWrappedLine,s,r,c.tokens,t,a,c.startVisibleColumn,this._getTextDirection(e,n),i)}getViewLineData(e){return this._lines.getViewLineData(e)}getMinimapLinesRenderingData(e,t,i){const n=this._lines.getViewLinesData(e,t,i);return new Oz(this.getTabSize(),n)}getAllOverviewRulerDecorations(e){const t=this.model.getOverviewRulerDecorations(this._editorId,Pf(this._configuration.options),kf(this._configuration.options)),i=new C8;for(const n of t){const s=n.options,r=s.overviewRuler;if(!r)continue;const a=r.position;if(a===0)continue;const c=r.getColor(e.value),h=this.coordinatesConverter.getViewLineNumberOfModelPosition(n.range.startLineNumber,n.range.startColumn),d=this.coordinatesConverter.getViewLineNumberOfModelPosition(n.range.endLineNumber,n.range.endColumn);i.accept(c,s.zIndex,h,d,a)}return i.asArray}_invalidateDecorationsColorCache(){const e=this.model.getOverviewRulerDecorations();for(const t of e)t.options.overviewRuler?.invalidateCachedColor(),t.options.minimap?.invalidateCachedColor()}getValueInRange(e,t){const i=this.coordinatesConverter.convertViewRangeToModelRange(e);return this.model.getValueInRange(i,t)}getValueLengthInRange(e,t){const i=this.coordinatesConverter.convertViewRangeToModelRange(e);return this.model.getValueLengthInRange(i,t)}modifyPosition(e,t){const i=this.coordinatesConverter.convertViewPositionToModelPosition(e),n=this.model.modifyPosition(i,t);return this.coordinatesConverter.convertModelPositionToViewPosition(n)}deduceModelPositionRelativeToViewPosition(e,t,i){const n=this.coordinatesConverter.convertViewPositionToModelPosition(e);this.model.getEOL().length===2&&(t<0?t-=i:t+=i);const r=this.model.getOffsetAt(n)+t;return this.model.getPositionAt(r)}getPlainTextToCopy(e,t,i){const n=i?`\r
|
||
`:this.model.getEOL();e=e.slice(0),e.sort(l.Range.compareRangesUsingStarts);let s=!1,r=!1;for(const d of e)d.isEmpty()?s=!0:r=!0;if(!r&&!t)return{sourceRanges:[],sourceText:""};const a=[],c=[],h=(d,u="")=>{a.push(d),c.push(this.model.getValueInRange(d,i?2:0)+u)};if(s&&t){let d=0;for(const u of e){const f=u.startLineNumber;u.isEmpty()?f!==d&&h(new l.Range(f,this.model.getLineMinColumn(f),f,this.model.getLineMaxColumn(f)),n):h(u),d=f}}else for(const d of e)d.isEmpty()||h(d);return{sourceRanges:a,sourceText:c.length===1?c[0]:c}}getRichTextToCopy(e,t){const i=this.model.getLanguageId();if(i===pn||e.length!==1)return null;let n=e[0];if(n.isEmpty()){if(!t)return null;const d=n.startLineNumber;n=new l.Range(d,this.model.getLineMinColumn(d),d,this.model.getLineMaxColumn(d))}const s=this._configuration.options.get(59),r=this._getColorMap(),c=/[:;\\\/<>]/.test(s.fontFamily)||s.fontFamily===Zi.fontFamily;let h;return c?h=Zi.fontFamily:(h=s.fontFamily,h=h.replace(/"/g,"'"),/[,']/.test(h)||/[+ ]/.test(h)&&(h=`'${h}'`),h=`${h}, ${Zi.fontFamily}`),{mode:i,html:`<div style="color: ${r[1]};background-color: ${r[2]};font-family: ${h};font-weight: ${s.fontWeight};font-size: ${s.fontSize}px;line-height: ${s.lineHeight}px;white-space: pre;">`+this._getHTMLToCopy(n,r)+"</div>"}}_getHTMLToCopy(e,t){const i=e.startLineNumber,n=e.startColumn,s=e.endLineNumber,r=e.endColumn,a=this.getTabSize();let c="";for(let h=i;h<=s;h++){const d=this.model.tokenization.getLineTokens(h),u=d.getLineContent(),f=h===i?n-1:0,g=h===s?r-1:u.length;u===""?c+="<br>":c+=H6(u,d.inflate(),t,f,g,a,l.isWindows)}return c}_getColorMap(){const e=l.TokenizationRegistry.getColorMap(),t=["#000000"];if(e)for(let i=1,n=e.length;i<n;i++)t[i]=l.Color.Format.CSS.formatHex(e[i]);return t}getPrimaryCursorState(){return this._cursor.getPrimaryCursorState()}getLastAddedCursorIndex(){return this._cursor.getLastAddedCursorIndex()}getCursorStates(){return this._cursor.getCursorStates()}setCursorStates(e,t,i){return this._withViewEventsCollector(n=>this._cursor.setStates(n,e,t,i))}getCursorColumnSelectData(){return this._cursor.getCursorColumnSelectData()}getCursorAutoClosedCharacters(){return this._cursor.getAutoClosedCharacters()}setCursorColumnSelectData(e){this._cursor.setCursorColumnSelectData(e)}getPrevEditOperationType(){return this._cursor.getPrevEditOperationType()}setPrevEditOperationType(e){this._cursor.setPrevEditOperationType(e)}getSelection(){return this._cursor.getSelection()}getSelections(){return this._cursor.getSelections()}getPosition(){return this._cursor.getPrimaryCursorState().modelState.position}setSelections(e,t,i=0){this._withViewEventsCollector(n=>this._cursor.setSelections(n,e,t,i))}saveCursorState(){return this._cursor.saveState()}restoreCursorState(e){this._withViewEventsCollector(t=>this._cursor.restoreState(t,e))}_executeCursorEdit(e){if(this._cursor.context.cursorConfig.readOnly){this._eventDispatcher.emitOutgoingEvent(new V6);return}this._withViewEventsCollector(e)}executeEdits(e,t,i,n){this._executeCursorEdit(s=>this._cursor.executeEdits(s,e,t,i,n))}startComposition(){this._executeCursorEdit(e=>this._cursor.startComposition(e))}endComposition(e){this._executeCursorEdit(t=>this._cursor.endComposition(t,e))}type(e,t){this._executeCursorEdit(i=>this._cursor.type(i,e,t))}compositionType(e,t,i,n,s){this._executeCursorEdit(r=>this._cursor.compositionType(r,e,t,i,n,s))}paste(e,t,i,n){this._executeCursorEdit(s=>this._cursor.paste(s,e,t,i,n))}cut(e){this._executeCursorEdit(t=>this._cursor.cut(t,e))}executeCommand(e,t){this._executeCursorEdit(i=>this._cursor.executeCommand(i,e,t))}executeCommands(e,t){this._executeCursorEdit(i=>this._cursor.executeCommands(i,e,t))}revealAllCursors(e,t,i=!1){this._withViewEventsCollector(n=>this._cursor.revealAll(n,e,i,0,t,0))}revealPrimaryCursor(e,t,i=!1){this._withViewEventsCollector(n=>this._cursor.revealPrimary(n,e,i,0,t,0))}revealTopMostCursor(e){const t=this._cursor.getTopMostViewPosition(),i=new l.Range(t.lineNumber,t.column,t.lineNumber,t.column);this._withViewEventsCollector(n=>n.emitViewEvent(new bu(e,!1,i,null,0,!0,0)))}revealBottomMostCursor(e){const t=this._cursor.getBottomMostViewPosition(),i=new l.Range(t.lineNumber,t.column,t.lineNumber,t.column);this._withViewEventsCollector(n=>n.emitViewEvent(new bu(e,!1,i,null,0,!0,0)))}revealRange(e,t,i,n,s){this._withViewEventsCollector(r=>r.emitViewEvent(new bu(e,!1,i,null,n,t,s)))}changeWhitespace(e){this.viewLayout.changeWhitespace(e)&&(this._eventDispatcher.emitSingleViewEvent(new O6),this._eventDispatcher.emitOutgoingEvent(new B6))}_withViewEventsCollector(e){return this._transactionalTarget.batchChanges(()=>this._emitViewEvent(e))}_emitViewEvent(e){try{const t=this._eventDispatcher.beginEmitViewEvents();return e(t)}finally{this._eventDispatcher.endEmitViewEvents()}}batchEvents(e){this._withViewEventsCollector(()=>{e()})}normalizePosition(e,t){return this._lines.normalizePosition(e,t)}getLineIndentColumn(e){return this._lines.getLineIndentColumn(e)}};class lS{static create(e){const t=e._setTrackedRange(null,new l.Range(1,1,1,1),1);return new lS(e,1,!1,t,0)}get viewLineNumber(){return this._viewLineNumber}get isValid(){return this._isValid}get modelTrackedRange(){return this._modelTrackedRange}get startLineDelta(){return this._startLineDelta}constructor(e,t,i,n,s){this._model=e,this._viewLineNumber=t,this._isValid=i,this._modelTrackedRange=n,this._startLineDelta=s}dispose(){this._model._setTrackedRange(this._modelTrackedRange,null,1)}update(e,t){const i=e.coordinatesConverter.convertViewPositionToModelPosition(new l.Position(t,e.getLineMinColumn(t))),n=e.model._setTrackedRange(this._modelTrackedRange,new l.Range(i.lineNumber,i.column,i.lineNumber,i.column),1),s=e.viewLayout.getVerticalOffsetForLineNumber(t),r=e.viewLayout.getCurrentScrollTop();this._viewLineNumber=t,this._isValid=!0,this._modelTrackedRange=n,this._startLineDelta=r-s}invalidate(){this._isValid=!1}}class C8{constructor(){this._asMap=Object.create(null),this.asArray=[]}accept(e,t,i,n,s){const r=this._asMap[e];if(r){const a=r.data,c=a[a.length-3],h=a[a.length-1];if(c===s&&h+1>=i){n>h&&(a[a.length-1]=n);return}a.push(s,i,n)}else{const a=new Cd(e,t,[s,i,n]);this._asMap[e]=a,this.asArray.push(a)}}}class v8{constructor(){this.hiddenAreas=new Map,this.shouldRecompute=!1,this.ranges=[]}setHiddenAreas(e,t){const i=this.hiddenAreas.get(e);i&&H1(i,t)||(this.hiddenAreas.set(e,t),this.shouldRecompute=!0)}getMergedRanges(){if(!this.shouldRecompute)return this.ranges;this.shouldRecompute=!1;const e=Array.from(this.hiddenAreas.values()).reduce((t,i)=>w8(t,i),[]);return H1(this.ranges,e)?this.ranges:(this.ranges=e,this.ranges)}}function w8(o,e){const t=[];let i=0,n=0;for(;i<o.length&&n<e.length;){const s=o[i],r=e[n];if(s.endLineNumber<r.startLineNumber-1)t.push(o[i++]);else if(r.endLineNumber<s.startLineNumber-1)t.push(e[n++]);else{const a=Math.min(s.startLineNumber,r.startLineNumber),c=Math.max(s.endLineNumber,r.endLineNumber);t.push(new l.Range(a,1,c,1)),i++,n++}}for(;i<o.length;)t.push(o[i++]);for(;n<e.length;)t.push(e[n++]);return t}function H1(o,e){if(o.length!==e.length)return!1;for(let t=0;t<o.length;t++)if(!o[t].equalsRange(e[t]))return!1;return!0}class eN{constructor(e,t){this.viewportStartModelPosition=e,this.startLineDelta=t}recoverViewportStart(e,t){if(!this.viewportStartModelPosition)return;const i=e.convertModelPositionToViewPosition(this.viewportStartModelPosition),n=t.getVerticalOffsetForLineNumber(i.lineNumber);t.setScrollPosition({scrollTop:n+this.startLineDelta},1)}}class Oc{constructor(...e){this._entries=new Map;for(const[t,i]of e)this.set(t,i)}set(e,t){const i=this._entries.get(e);return this._entries.set(e,t),i}get(e){return this._entries.get(e)}}var S8=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},Es=function(o,e){return function(t,i){e(t,i,o)}},Va;_.CodeEditorWidget=(Dl=class extends l.Disposable{get isSimpleWidget(){return this._configuration.isSimpleWidget}get contextMenuId(){return this._configuration.contextMenuId}get contextKeyService(){return this._contextKeyService}constructor(e,t,i,n,s,r,a,c,h,d,u,f,g){super(),this.languageConfigurationService=u,this._deliveryQueue=l.createEventDeliveryQueue(),this._contributions=this._register(new w5),this._onDidDispose=this._register(new l.Emitter),this.onDidDispose=this._onDidDispose.event,this._onDidChangeModelContent=this._register(new l.Emitter({deliveryQueue:this._deliveryQueue})),this.onDidChangeModelContent=this._onDidChangeModelContent.event,this._onDidChangeModelLanguage=this._register(new l.Emitter({deliveryQueue:this._deliveryQueue})),this.onDidChangeModelLanguage=this._onDidChangeModelLanguage.event,this._onDidChangeModelLanguageConfiguration=this._register(new l.Emitter({deliveryQueue:this._deliveryQueue})),this.onDidChangeModelLanguageConfiguration=this._onDidChangeModelLanguageConfiguration.event,this._onDidChangeModelOptions=this._register(new l.Emitter({deliveryQueue:this._deliveryQueue})),this.onDidChangeModelOptions=this._onDidChangeModelOptions.event,this._onDidChangeModelDecorations=this._register(new l.Emitter({deliveryQueue:this._deliveryQueue})),this.onDidChangeModelDecorations=this._onDidChangeModelDecorations.event,this._onDidChangeLineHeight=this._register(new l.Emitter({deliveryQueue:this._deliveryQueue})),this.onDidChangeLineHeight=this._onDidChangeLineHeight.event,this._onDidChangeFont=this._register(new l.Emitter({deliveryQueue:this._deliveryQueue})),this.onDidChangeFont=this._onDidChangeFont.event,this._onDidChangeModelTokens=this._register(new l.Emitter({deliveryQueue:this._deliveryQueue})),this.onDidChangeModelTokens=this._onDidChangeModelTokens.event,this._onDidChangeConfiguration=this._register(new l.Emitter({deliveryQueue:this._deliveryQueue})),this.onDidChangeConfiguration=this._onDidChangeConfiguration.event,this._onWillChangeModel=this._register(new l.Emitter({deliveryQueue:this._deliveryQueue})),this.onWillChangeModel=this._onWillChangeModel.event,this._onDidChangeModel=this._register(new l.Emitter({deliveryQueue:this._deliveryQueue})),this.onDidChangeModel=this._onDidChangeModel.event,this._onDidChangeCursorPosition=this._register(new l.Emitter({deliveryQueue:this._deliveryQueue})),this.onDidChangeCursorPosition=this._onDidChangeCursorPosition.event,this._onDidChangeCursorSelection=this._register(new l.Emitter({deliveryQueue:this._deliveryQueue})),this.onDidChangeCursorSelection=this._onDidChangeCursorSelection.event,this._onDidAttemptReadOnlyEdit=this._register(new kt(this._contributions,this._deliveryQueue)),this.onDidAttemptReadOnlyEdit=this._onDidAttemptReadOnlyEdit.event,this._onDidLayoutChange=this._register(new l.Emitter({deliveryQueue:this._deliveryQueue})),this.onDidLayoutChange=this._onDidLayoutChange.event,this._editorTextFocus=this._register(new tN({deliveryQueue:this._deliveryQueue})),this.onDidFocusEditorText=this._editorTextFocus.onDidChangeToTrue,this.onDidBlurEditorText=this._editorTextFocus.onDidChangeToFalse,this._editorWidgetFocus=this._register(new tN({deliveryQueue:this._deliveryQueue})),this.onDidFocusEditorWidget=this._editorWidgetFocus.onDidChangeToTrue,this.onDidBlurEditorWidget=this._editorWidgetFocus.onDidChangeToFalse,this._onWillType=this._register(new kt(this._contributions,this._deliveryQueue)),this.onWillType=this._onWillType.event,this._onDidType=this._register(new kt(this._contributions,this._deliveryQueue)),this.onDidType=this._onDidType.event,this._onDidCompositionStart=this._register(new kt(this._contributions,this._deliveryQueue)),this.onDidCompositionStart=this._onDidCompositionStart.event,this._onDidCompositionEnd=this._register(new kt(this._contributions,this._deliveryQueue)),this.onDidCompositionEnd=this._onDidCompositionEnd.event,this._onDidPaste=this._register(new kt(this._contributions,this._deliveryQueue)),this.onDidPaste=this._onDidPaste.event,this._onWillCopy=this._register(new kt(this._contributions,this._deliveryQueue)),this.onWillCopy=this._onWillCopy.event,this._onWillCut=this._register(new kt(this._contributions,this._deliveryQueue)),this.onWillCut=this._onWillCut.event,this._onWillPaste=this._register(new kt(this._contributions,this._deliveryQueue)),this.onWillPaste=this._onWillPaste.event,this._onMouseUp=this._register(new kt(this._contributions,this._deliveryQueue)),this.onMouseUp=this._onMouseUp.event,this._onMouseDown=this._register(new kt(this._contributions,this._deliveryQueue)),this.onMouseDown=this._onMouseDown.event,this._onMouseDrag=this._register(new kt(this._contributions,this._deliveryQueue)),this.onMouseDrag=this._onMouseDrag.event,this._onMouseDrop=this._register(new kt(this._contributions,this._deliveryQueue)),this.onMouseDrop=this._onMouseDrop.event,this._onMouseDropCanceled=this._register(new kt(this._contributions,this._deliveryQueue)),this.onMouseDropCanceled=this._onMouseDropCanceled.event,this._onDropIntoEditor=this._register(new kt(this._contributions,this._deliveryQueue)),this.onDropIntoEditor=this._onDropIntoEditor.event,this._onContextMenu=this._register(new kt(this._contributions,this._deliveryQueue)),this.onContextMenu=this._onContextMenu.event,this._onMouseMove=this._register(new kt(this._contributions,this._deliveryQueue)),this.onMouseMove=this._onMouseMove.event,this._onMouseLeave=this._register(new kt(this._contributions,this._deliveryQueue)),this.onMouseLeave=this._onMouseLeave.event,this._onMouseWheel=this._register(new kt(this._contributions,this._deliveryQueue)),this.onMouseWheel=this._onMouseWheel.event,this._onKeyUp=this._register(new kt(this._contributions,this._deliveryQueue)),this.onKeyUp=this._onKeyUp.event,this._onKeyDown=this._register(new kt(this._contributions,this._deliveryQueue)),this.onKeyDown=this._onKeyDown.event,this._onDidContentSizeChange=this._register(new l.Emitter({deliveryQueue:this._deliveryQueue})),this.onDidContentSizeChange=this._onDidContentSizeChange.event,this._onDidScrollChange=this._register(new l.Emitter({deliveryQueue:this._deliveryQueue})),this.onDidScrollChange=this._onDidScrollChange.event,this._onDidChangeViewZones=this._register(new l.Emitter({deliveryQueue:this._deliveryQueue})),this.onDidChangeViewZones=this._onDidChangeViewZones.event,this._onDidChangeHiddenAreas=this._register(new l.Emitter({deliveryQueue:this._deliveryQueue})),this.onDidChangeHiddenAreas=this._onDidChangeHiddenAreas.event,this._updateCounter=0,this._onWillTriggerEditorOperationEvent=this._register(new l.Emitter),this._onBeginUpdate=this._register(new l.Emitter),this.onBeginUpdate=this._onBeginUpdate.event,this._onEndUpdate=this._register(new l.Emitter),this.onEndUpdate=this._onEndUpdate.event,this._onBeforeExecuteEdit=this._register(new l.Emitter),this.onBeforeExecuteEdit=this._onBeforeExecuteEdit.event,this._actions=new Map,this._bannerDomNode=null,this._dropIntoEditorDecorations=this.createDecorationsCollection(),this.inComposition=!1,s.willCreateCodeEditor();const m={...t};if(this._domElement=e,this._userInteractionService=g,this._overflowWidgetsDomNode=m.overflowWidgetsDomNode,delete m.overflowWidgetsDomNode,this._id=++y8,this._decorationTypeKeysToIds={},this._decorationTypeSubtypes={},this._telemetryData=i.telemetryData,this._configuration=this._register(this._createConfiguration(i.isSimpleWidget||!1,i.contextMenuId??(i.isSimpleWidget?ct.SimpleEditorContext:ct.EditorContext),m,d)),this._domElement.style?.setProperty("--editor-font-size",this._configuration.options.get(61)+"px"),this._register(this._configuration.onDidChange(v=>{this._onDidChangeConfiguration.fire(v);const C=this._configuration.options;if(v.hasChanged(165)){const w=C.get(165);this._onDidLayoutChange.fire(w)}v.hasChanged(61)&&this._domElement.style.setProperty("--editor-font-size",C.get(61)+"px")})),this._contextKeyService=this._register(a.createScoped(this._domElement)),i.contextKeyValues)for(const[v,C]of Object.entries(i.contextKeyValues))this._contextKeyService.createKey(v,C);this._notificationService=h,this._codeEditorService=s,this._commandService=r,this._themeService=c,this._register(new D8(this,this._contextKeyService)),this._register(new x8(this,this._contextKeyService,f)),this._instantiationService=this._register(n.createChild(new Oc([be,this._contextKeyService]))),this._modelData=null,this._contentWidgets={},this._overlayWidgets={},this._glyphMarginWidgets={};let p;Array.isArray(i.contributions)?p=i.contributions:p=Ql.getEditorContributions(),this._contributions.initialize(this,p,this._instantiationService);for(const v of Ql.getEditorActions()){if(this._actions.has(v.id)){l.onUnexpectedError(new Error(`Cannot have two actions with the same id ${v.id}`));continue}const C=new zT(v.id,v.label,v.alias,v.metadata,v.precondition??void 0,w=>this._instantiationService.invokeFunction(S=>Promise.resolve(v.runEditorCommand(S,this,w))),this._contextKeyService);this._actions.set(C.id,C)}const b=()=>!this._configuration.options.get(104)&&this._configuration.options.get(43).enabled;this._register(new MF(this._domElement,{onDragOver:v=>{if(!b())return;const C=this.getTargetAtClientPoint(v.clientX,v.clientY);C?.position&&this.showDropIndicatorAt(C.position)},onDrop:async v=>{if(!b()||(this.removeDropIndicator(),!v.dataTransfer))return;const C=this.getTargetAtClientPoint(v.clientX,v.clientY);C?.position&&this._onDropIntoEditor.fire({position:C.position,event:v})},onDragLeave:()=>{this.removeDropIndicator()},onDragEnd:()=>{this.removeDropIndicator()}})),this._codeEditorService.addCodeEditor(this)}writeScreenReaderContent(e){this._modelData?.view.writeScreenReaderContent(e)}_createConfiguration(e,t,i,n){return new GC(e,t,i,this._domElement,n)}getId(){return this.getEditorType()+":"+this._id}getEditorType(){return _d.ICodeEditor}dispose(){this._codeEditorService.removeCodeEditor(this),this._actions.clear(),this._contentWidgets={},this._overlayWidgets={},this._removeDecorationTypes(),this._postDetachModelCleanup(this._detachModel()),this._onDidDispose.fire(),super.dispose()}invokeWithinContext(e){return this._instantiationService.invokeFunction(e)}updateOptions(e){this._configuration.updateOptions(e||{})}getOptions(){return this._configuration.options}getOption(e){return this._configuration.options.get(e)}getRawOptions(){return this._configuration.getRawOptions()}getOverflowWidgetsDomNode(){return this._overflowWidgetsDomNode}getConfiguredWordAtPosition(e){return this._modelData?Ne.getWordAtPosition(this._modelData.model,this._configuration.options.get(148),this._configuration.options.get(147),e):null}getValue(e=null){if(!this._modelData)return"";const t=!!(e&&e.preserveBOM);let i=0;return e&&e.lineEnding&&e.lineEnding===`
|
||
`?i=1:e&&e.lineEnding&&e.lineEnding===`\r
|
||
`&&(i=2),this._modelData.model.getValue(i,t)}setValue(e){try{if(this._beginUpdate(),!this._modelData)return;this._modelData.model.setValue(e)}finally{this._endUpdate()}}getModel(){return this._modelData?this._modelData.model:null}setModel(e=null){try{this._beginUpdate();const t=e;if(this._modelData===null&&t===null||this._modelData&&this._modelData.model===t)return;const i={oldModelUrl:this._modelData?.model.uri||null,newModelUrl:t?.uri||null};this._onWillChangeModel.fire(i);const n=this.hasTextFocus(),s=this._detachModel();this._attachModel(t),this.hasModel()?n&&this.focus():(this._editorTextFocus.setValue(!1),this._editorWidgetFocus.setValue(!1)),this._removeDecorationTypes(),this._onDidChangeModel.fire(i),this._postDetachModelCleanup(s),this._contributionsDisposable=this._contributions.onAfterModelAttached()}finally{this._endUpdate()}}_removeDecorationTypes(){if(this._decorationTypeKeysToIds={},this._decorationTypeSubtypes){for(const e in this._decorationTypeSubtypes){const t=this._decorationTypeSubtypes[e];for(const i in t)this._removeDecorationType(e+"-"+i)}this._decorationTypeSubtypes={}}}getVisibleRanges(){return this._modelData?this._modelData.viewModel.getVisibleRanges():[]}getVisibleRangesPlusViewportAboveBelow(){return this._modelData?this._modelData.viewModel.getVisibleRangesPlusViewportAboveBelow():[]}getWhitespaces(){return this._modelData?this._modelData.viewModel.viewLayout.getWhitespaces():[]}static _getVerticalOffsetAfterPosition(e,t,i,n){const s=e.model.validatePosition({lineNumber:t,column:i}),r=e.viewModel.coordinatesConverter.convertModelPositionToViewPosition(s);return e.viewModel.viewLayout.getVerticalOffsetAfterLineNumber(r.lineNumber,n)}getTopForLineNumber(e,t=!1){return this._modelData?Va._getVerticalOffsetForPosition(this._modelData,e,1,t):-1}getTopForPosition(e,t){return this._modelData?Va._getVerticalOffsetForPosition(this._modelData,e,t,!1):-1}static _getVerticalOffsetForPosition(e,t,i,n=!1){const s=e.model.validatePosition({lineNumber:t,column:i}),r=e.viewModel.coordinatesConverter.convertModelPositionToViewPosition(s);return e.viewModel.viewLayout.getVerticalOffsetForLineNumber(r.lineNumber,n)}getBottomForLineNumber(e,t=!1){return this._modelData?Va._getVerticalOffsetAfterPosition(this._modelData,e,Number.MAX_SAFE_INTEGER,t):-1}getLineHeightForPosition(e){if(!this._modelData)return-1;const t=this._modelData.viewModel,i=t.coordinatesConverter,n=l.Position.lift(e);if(i.modelPositionIsVisible(n)){const s=i.convertModelPositionToViewPosition(n);return t.viewLayout.getLineHeightForLineNumber(s.lineNumber)}return 0}setHiddenAreas(e,t,i){this._modelData?.viewModel.setHiddenAreas(e.map(n=>l.Range.lift(n)),t,i)}getVisibleColumnFromPosition(e){if(!this._modelData)return e.column;const t=this._modelData.model.validatePosition(e),i=this._modelData.model.getOptions().tabSize;return Xe.visibleColumnFromColumn(this._modelData.model.getLineContent(t.lineNumber),t.column,i)+1}getPosition(){return this._modelData?this._modelData.viewModel.getPosition():null}setPosition(e,t="api"){if(this._modelData){if(!l.Position.isIPosition(e))throw new Error("Invalid arguments");this._modelData.viewModel.setSelections(t,[{selectionStartLineNumber:e.lineNumber,selectionStartColumn:e.column,positionLineNumber:e.lineNumber,positionColumn:e.column}])}}_sendRevealRange(e,t,i,n){if(!this._modelData)return;if(!l.Range.isIRange(e))throw new Error("Invalid arguments");const s=this._modelData.model.validateRange(e),r=this._modelData.viewModel.coordinatesConverter.convertModelRangeToViewRange(s);this._modelData.viewModel.revealRange("api",i,r,t,n)}revealAllCursors(e,t){this._modelData&&this._modelData.viewModel.revealAllCursors("api",e,t)}revealLine(e,t=0){this._revealLine(e,0,t)}revealLineInCenter(e,t=0){this._revealLine(e,1,t)}revealLineInCenterIfOutsideViewport(e,t=0){this._revealLine(e,2,t)}revealLineNearTop(e,t=0){this._revealLine(e,5,t)}_revealLine(e,t,i){if(typeof e!="number")throw new Error("Invalid arguments");this._sendRevealRange(new l.Range(e,1,e,1),t,!1,i)}revealPosition(e,t=0){this._revealPosition(e,0,!0,t)}revealPositionInCenter(e,t=0){this._revealPosition(e,1,!0,t)}revealPositionInCenterIfOutsideViewport(e,t=0){this._revealPosition(e,2,!0,t)}revealPositionNearTop(e,t=0){this._revealPosition(e,5,!0,t)}_revealPosition(e,t,i,n){if(!l.Position.isIPosition(e))throw new Error("Invalid arguments");this._sendRevealRange(new l.Range(e.lineNumber,e.column,e.lineNumber,e.column),t,i,n)}getSelection(){return this._modelData?this._modelData.viewModel.getSelection():null}getSelections(){return this._modelData?this._modelData.viewModel.getSelections():null}setSelection(e,t="api"){const i=l.Selection.isISelection(e),n=l.Range.isIRange(e);if(!i&&!n)throw new Error("Invalid arguments");if(i)this._setSelectionImpl(e,t);else if(n){const s={selectionStartLineNumber:e.startLineNumber,selectionStartColumn:e.startColumn,positionLineNumber:e.endLineNumber,positionColumn:e.endColumn};this._setSelectionImpl(s,t)}}_setSelectionImpl(e,t){if(!this._modelData)return;const i=new l.Selection(e.selectionStartLineNumber,e.selectionStartColumn,e.positionLineNumber,e.positionColumn);this._modelData.viewModel.setSelections(t,[i])}revealLines(e,t,i=0){this._revealLines(e,t,0,i)}revealLinesInCenter(e,t,i=0){this._revealLines(e,t,1,i)}revealLinesInCenterIfOutsideViewport(e,t,i=0){this._revealLines(e,t,2,i)}revealLinesNearTop(e,t,i=0){this._revealLines(e,t,5,i)}_revealLines(e,t,i,n){if(typeof e!="number"||typeof t!="number")throw new Error("Invalid arguments");this._sendRevealRange(new l.Range(e,1,t,1),i,!1,n)}revealRange(e,t=0,i=!1,n=!0){this._revealRange(e,i?1:0,n,t)}revealRangeInCenter(e,t=0){this._revealRange(e,1,!0,t)}revealRangeInCenterIfOutsideViewport(e,t=0){this._revealRange(e,2,!0,t)}revealRangeNearTop(e,t=0){this._revealRange(e,5,!0,t)}revealRangeNearTopIfOutsideViewport(e,t=0){this._revealRange(e,6,!0,t)}revealRangeAtTop(e,t=0){this._revealRange(e,3,!0,t)}_revealRange(e,t,i,n){if(!l.Range.isIRange(e))throw new Error("Invalid arguments");this._sendRevealRange(l.Range.lift(e),t,i,n)}setSelections(e,t="api",i=0){if(this._modelData){if(!e||e.length===0)throw new Error("Invalid arguments");for(let n=0,s=e.length;n<s;n++)if(!l.Selection.isISelection(e[n]))throw new Error("Invalid arguments");this._modelData.viewModel.setSelections(t,e,i)}}getContentWidth(){return this._modelData?this._modelData.viewModel.viewLayout.getContentWidth():-1}getScrollWidth(){return this._modelData?this._modelData.viewModel.viewLayout.getScrollWidth():-1}getScrollLeft(){return this._modelData?this._modelData.viewModel.viewLayout.getCurrentScrollLeft():-1}getContentHeight(){return this._modelData?this._modelData.viewModel.viewLayout.getContentHeight():-1}getScrollHeight(){return this._modelData?this._modelData.viewModel.viewLayout.getScrollHeight():-1}getScrollTop(){return this._modelData?this._modelData.viewModel.viewLayout.getCurrentScrollTop():-1}setScrollLeft(e,t=1){if(this._modelData){if(typeof e!="number")throw new Error("Invalid arguments");this._modelData.viewModel.viewLayout.setScrollPosition({scrollLeft:e},t)}}setScrollTop(e,t=1){if(this._modelData){if(typeof e!="number")throw new Error("Invalid arguments");this._modelData.viewModel.viewLayout.setScrollPosition({scrollTop:e},t)}}setScrollPosition(e,t=1){this._modelData&&this._modelData.viewModel.viewLayout.setScrollPosition(e,t)}hasPendingScrollAnimation(){return this._modelData?this._modelData.viewModel.viewLayout.hasPendingScrollAnimation():!1}saveViewState(){if(!this._modelData)return null;const e=this._contributions.saveViewState(),t=this._modelData.viewModel.saveCursorState(),i=this._modelData.viewModel.saveState();return{cursorState:t,viewState:i,contributionsState:e}}restoreViewState(e){if(!this._modelData||!this._modelData.hasRealView)return;const t=e;if(t&&t.cursorState&&t.viewState){const i=t.cursorState;Array.isArray(i)?i.length>0&&this._modelData.viewModel.restoreCursorState(i):this._modelData.viewModel.restoreCursorState([i]),this._contributions.restoreViewState(t.contributionsState||{});const n=this._modelData.viewModel.reduceRestoreState(t.viewState);this._modelData.view.restoreState(n)}}handleInitialized(){this._getViewModel()?.visibleLinesStabilized()}getContribution(e){return this._contributions.get(e)}getActions(){return Array.from(this._actions.values())}getSupportedActions(){let e=this.getActions();return e=e.filter(t=>t.isSupported()),e}getAction(e){return this._actions.get(e)||null}trigger(e,t,i){i=i||{};try{switch(this._onWillTriggerEditorOperationEvent.fire({source:e,handlerId:t,payload:i}),this._beginUpdate(),t){case"compositionStart":this._startComposition();return;case"compositionEnd":this._endComposition(e);return;case"type":{const s=i;this._type(e,s.text||"");return}case"replacePreviousChar":{const s=i;this._compositionType(e,s.text||"",s.replaceCharCnt||0,0,0);return}case"compositionType":{const s=i;this._compositionType(e,s.text||"",s.replacePrevCharCnt||0,s.replaceNextCharCnt||0,s.positionDelta||0);return}case"paste":{const s=i;this._paste(e,s.text||"",s.pasteOnNewLine||!1,s.multicursorText||null,s.mode||null,s.clipboardEvent);return}case"cut":this._cut(e);return}const n=this.getAction(t);if(n){Promise.resolve(n.run(i)).then(void 0,l.onUnexpectedError);return}if(!this._modelData||this._triggerEditorCommand(e,t,i))return;this._triggerCommand(t,i)}finally{this._endUpdate()}}_triggerCommand(e,t){this._commandService.executeCommand(e,t)}_startComposition(){this._modelData&&(this.inComposition=!0,this._modelData.viewModel.startComposition(),this._onDidCompositionStart.fire())}_endComposition(e){this._modelData&&(this.inComposition=!1,this._modelData.viewModel.endComposition(e),this._onDidCompositionEnd.fire())}_type(e,t){!this._modelData||t.length===0||(e==="keyboard"&&this._onWillType.fire(t),this._modelData.viewModel.type(t,e),e==="keyboard"&&this._onDidType.fire(t))}_compositionType(e,t,i,n,s){this._modelData&&this._modelData.viewModel.compositionType(t,i,n,s,e)}_paste(e,t,i,n,s,r){if(!this._modelData)return;const a=this._modelData.viewModel,c=a.getSelection().getStartPosition();a.paste(t,i,n,e);const h=a.getSelection().getStartPosition();e==="keyboard"&&this._onDidPaste.fire({clipboardEvent:r,range:new l.Range(c.lineNumber,c.column,h.lineNumber,h.column),languageId:s})}_cut(e){this._modelData&&this._modelData.viewModel.cut(e)}_triggerEditorCommand(e,t,i){const n=Ql.getEditorCommand(t);return n?(i=i||{},l.isObject(i)&&(i.source=e),this._instantiationService.invokeFunction(s=>{Promise.resolve(n.runEditorCommand(s,this,i)).then(void 0,l.onUnexpectedError)}),!0):!1}_getViewModel(){return this._modelData?this._modelData.viewModel:null}pushUndoStop(){return!this._modelData||this._configuration.options.get(104)?!1:(this._modelData.model.pushStackElement(),!0)}popUndoStop(){return!this._modelData||this._configuration.options.get(104)?!1:(this._modelData.model.popStackElement(),!0)}edit(e,t){return this.executeEdits(t,e.replacements.map(i=>({range:i.range,text:i.text})),void 0)}executeEdits(e,t,i){if(!this._modelData||this._configuration.options.get(104))return!1;let n;i?Array.isArray(i)?n=()=>i:n=i:n=()=>null;let s,r;return e instanceof GT?(r=e,s=e.metadata.source):(r=$i.unknown({name:e}),s=e),this._onBeforeExecuteEdit.fire({source:s??void 0}),this._modelData.viewModel.executeEdits(s,t,n,r),!0}executeCommand(e,t){this._modelData&&this._modelData.viewModel.executeCommand(t,e)}executeCommands(e,t){this._modelData&&this._modelData.viewModel.executeCommands(t,e)}createDecorationsCollection(e){return new E8(this,e)}changeDecorations(e){return this._modelData?this._modelData.model.changeDecorations(e,this._id):null}getLineDecorations(e){if(!this._modelData)return null;const t=this._configuration.options;return this._modelData.model.getLineDecorations(e,this._id,Pf(t),kf(t))}getDecorationsInRange(e){if(!this._modelData)return null;const t=this._configuration.options;return this._modelData.model.getDecorationsInRange(e,this._id,Pf(t),kf(t))}getFontSizeAtPosition(e){return this._modelData?this._modelData.viewModel.getFontSizeAtPosition(e):null}deltaDecorations(e,t){return this._modelData?e.length===0&&t.length===0?e:this._modelData.model.deltaDecorations(e,t,this._id):[]}removeDecorations(e){!this._modelData||e.length===0||this._modelData.model.changeDecorations(t=>{t.deltaDecorations(e,[])})}removeDecorationsByType(e){const t=this._decorationTypeKeysToIds[e];if(t&&this.changeDecorations(i=>i.deltaDecorations(t,[])),this._decorationTypeKeysToIds.hasOwnProperty(e)&&delete this._decorationTypeKeysToIds[e],this._decorationTypeSubtypes.hasOwnProperty(e)){const i=this._decorationTypeSubtypes[e];for(const n of Object.keys(i))this._removeDecorationType(e+"-"+n);delete this._decorationTypeSubtypes[e]}}getLayoutInfo(){return this._configuration.options.get(165)}createOverviewRuler(e){return!this._modelData||!this._modelData.hasRealView?null:this._modelData.view.createOverviewRuler(e)}getContainerDomNode(){return this._domElement}getDomNode(){return!this._modelData||!this._modelData.hasRealView?null:this._modelData.view.domNode.domNode}delegateVerticalScrollbarPointerDown(e){!this._modelData||!this._modelData.hasRealView||this._modelData.view.delegateVerticalScrollbarPointerDown(e)}delegateScrollFromMouseWheelEvent(e){!this._modelData||!this._modelData.hasRealView||this._modelData.view.delegateScrollFromMouseWheelEvent(e)}layout(e,t=!1){this._configuration.observeContainer(e),t||this.render()}focus(){!this._modelData||!this._modelData.hasRealView||this._modelData.view.focus()}hasTextFocus(){return!this._modelData||!this._modelData.hasRealView?!1:this._modelData.view.isFocused()}hasWidgetFocus(){return!this._modelData||!this._modelData.hasRealView?!1:this._modelData.view.isWidgetFocused()}addContentWidget(e){const t={widget:e,position:e.getPosition()};this._contentWidgets.hasOwnProperty(e.getId())&&console.warn("Overwriting a content widget with the same id:"+e.getId()),this._contentWidgets[e.getId()]=t,this._modelData&&this._modelData.hasRealView&&this._modelData.view.addContentWidget(t)}layoutContentWidget(e){const t=e.getId();if(this._contentWidgets.hasOwnProperty(t)){const i=this._contentWidgets[t];i.position=e.getPosition(),this._modelData&&this._modelData.hasRealView&&this._modelData.view.layoutContentWidget(i)}}removeContentWidget(e){const t=e.getId();if(this._contentWidgets.hasOwnProperty(t)){const i=this._contentWidgets[t];delete this._contentWidgets[t],this._modelData&&this._modelData.hasRealView&&this._modelData.view.removeContentWidget(i)}}addOverlayWidget(e){const t={widget:e,position:e.getPosition()};this._overlayWidgets.hasOwnProperty(e.getId())&&console.warn("Overwriting an overlay widget with the same id."),this._overlayWidgets[e.getId()]=t,this._modelData&&this._modelData.hasRealView&&this._modelData.view.addOverlayWidget(t)}layoutOverlayWidget(e){const t=e.getId();if(this._overlayWidgets.hasOwnProperty(t)){const i=this._overlayWidgets[t];i.position=e.getPosition(),this._modelData&&this._modelData.hasRealView&&this._modelData.view.layoutOverlayWidget(i)}}removeOverlayWidget(e){const t=e.getId();if(this._overlayWidgets.hasOwnProperty(t)){const i=this._overlayWidgets[t];delete this._overlayWidgets[t],this._modelData&&this._modelData.hasRealView&&this._modelData.view.removeOverlayWidget(i)}}addGlyphMarginWidget(e){const t={widget:e,position:e.getPosition()};this._glyphMarginWidgets.hasOwnProperty(e.getId())&&console.warn("Overwriting a glyph margin widget with the same id."),this._glyphMarginWidgets[e.getId()]=t,this._modelData&&this._modelData.hasRealView&&this._modelData.view.addGlyphMarginWidget(t)}layoutGlyphMarginWidget(e){const t=e.getId();if(this._glyphMarginWidgets.hasOwnProperty(t)){const i=this._glyphMarginWidgets[t];i.position=e.getPosition(),this._modelData&&this._modelData.hasRealView&&this._modelData.view.layoutGlyphMarginWidget(i)}}removeGlyphMarginWidget(e){const t=e.getId();if(this._glyphMarginWidgets.hasOwnProperty(t)){const i=this._glyphMarginWidgets[t];delete this._glyphMarginWidgets[t],this._modelData&&this._modelData.hasRealView&&this._modelData.view.removeGlyphMarginWidget(i)}}changeViewZones(e){!this._modelData||!this._modelData.hasRealView||this._modelData.view.change(e)}getTargetAtClientPoint(e,t){return!this._modelData||!this._modelData.hasRealView?null:this._modelData.view.getTargetAtClientPoint(e,t)}getScrolledVisiblePosition(e){if(!this._modelData||!this._modelData.hasRealView)return null;const t=this._modelData.model.validatePosition(e),n=this._configuration.options.get(165),s=Va._getVerticalOffsetForPosition(this._modelData,t.lineNumber,t.column)-this.getScrollTop(),r=this._modelData.view.getOffsetForColumn(t.lineNumber,t.column)+n.glyphMarginWidth+n.lineNumbersWidth+n.decorationsWidth-this.getScrollLeft(),a=this.getLineHeightForPosition(t);return{top:s,left:r,height:a}}getOffsetForColumn(e,t){return!this._modelData||!this._modelData.hasRealView?-1:this._modelData.view.getOffsetForColumn(e,t)}getWidthOfLine(e){return!this._modelData||!this._modelData.hasRealView?-1:this._modelData.view.getLineWidth(e)}resetLineWidthCaches(){!this._modelData||!this._modelData.hasRealView||this._modelData.view.resetLineWidthCaches()}render(e=!1){!this._modelData||!this._modelData.hasRealView||this._modelData.viewModel.batchEvents(()=>{this._modelData.view.render(!0,e)})}renderAsync(e=!1){!this._modelData||!this._modelData.hasRealView||this._modelData.viewModel.batchEvents(()=>{this._modelData.view.render(!1,e)})}setAriaOptions(e){!this._modelData||!this._modelData.hasRealView||this._modelData.view.setAriaOptions(e)}applyFontInfo(e){Ot(e,this._configuration.options.get(59))}setBanner(e,t){this._bannerDomNode&&this._domElement.contains(this._bannerDomNode)&&this._bannerDomNode.remove(),this._bannerDomNode=e,this._configuration.setReservedHeight(e?t:0),this._bannerDomNode&&this._domElement.prepend(this._bannerDomNode)}_attachModel(e){if(!e){this._modelData=null;return}const t=[];this._domElement.setAttribute("data-mode-id",e.getLanguageId()),this._configuration.setIsDominatedByLongLines(e.isDominatedByLongLines()),this._configuration.setModelLineCount(e.getLineCount());const i=e.onBeforeAttached(),n=new b8(this._id,this._configuration,e,mw.create(j(this._domElement)),Ww.create(this._configuration.options),a=>Ti(j(this._domElement),a),this.languageConfigurationService,this._themeService,i,{batchChanges:a=>{try{return this._beginUpdate(),a()}finally{this._endUpdate()}}});t.push(e.onWillDispose(()=>this.setModel(null))),t.push(n.onEvent(a=>{switch(a.kind){case 0:this._onDidContentSizeChange.fire(a);break;case 1:this._editorTextFocus.setValue(a.hasFocus);break;case 2:this._editorWidgetFocus.setValue(a.hasFocus);break;case 3:this._onDidScrollChange.fire(a);break;case 4:this._onDidChangeViewZones.fire();break;case 5:this._onDidChangeHiddenAreas.fire();break;case 6:this._onDidAttemptReadOnlyEdit.fire();break;case 7:{if(a.reachedMaxCursorCount){const u=this.getOption(89),f=l.localize(99,"The number of cursors has been limited to {0}. Consider using [find and replace](https://code.visualstudio.com/docs/editor/codebasics#_find-and-replace) for larger changes or increase the editor multi cursor limit setting.",u);this._notificationService.prompt(Hv.Warning,f,[{label:"Find and Replace",run:()=>{this._commandService.executeCommand("editor.action.startFindReplaceAction")}},{label:l.localize(100,"Increase Multi Cursor Limit"),run:()=>{this._commandService.executeCommand("workbench.action.openSettings2",{query:"editor.multiCursorLimit"})}}])}const c=[];for(let u=0,f=a.selections.length;u<f;u++)c[u]=a.selections[u].getPosition();const h={position:c[0],secondaryPositions:c.slice(1),reason:a.reason,source:a.source};this._onDidChangeCursorPosition.fire(h);const d={selection:a.selections[0],secondarySelections:a.selections.slice(1),modelVersionId:a.modelVersionId,oldSelections:a.oldSelections,oldModelVersionId:a.oldModelVersionId,source:a.source,reason:a.reason};this._onDidChangeCursorSelection.fire(d);break}case 8:this._onDidChangeModelDecorations.fire(a.event);break;case 9:this._domElement.setAttribute("data-mode-id",e.getLanguageId()),this._onDidChangeModelLanguage.fire(a.event);break;case 10:this._onDidChangeModelLanguageConfiguration.fire(a.event);break;case 11:this._onDidChangeModelContent.fire(a.event);break;case 12:this._onDidChangeModelOptions.fire(a.event);break;case 13:this._onDidChangeModelTokens.fire(a.event);break;case 14:this._onDidChangeLineHeight.fire(a.event);break;case 15:this._onDidChangeFont.fire(a.event);break}}));const[s,r]=this._createView(n);if(r){this._domElement.appendChild(s.domNode.domNode);let a=Object.keys(this._contentWidgets);for(let c=0,h=a.length;c<h;c++){const d=a[c];s.addContentWidget(this._contentWidgets[d])}a=Object.keys(this._overlayWidgets);for(let c=0,h=a.length;c<h;c++){const d=a[c];s.addOverlayWidget(this._overlayWidgets[d])}a=Object.keys(this._glyphMarginWidgets);for(let c=0,h=a.length;c<h;c++){const d=a[c];s.addGlyphMarginWidget(this._glyphMarginWidgets[d])}s.render(!1,!0),s.domNode.domNode.setAttribute("data-uri",e.uri.toString()),t.push(s.onWillCopy(c=>this._onWillCopy.fire(c))),t.push(s.onWillCut(c=>this._onWillCut.fire(c))),t.push(s.onWillPaste(c=>this._onWillPaste.fire(c)))}this._modelData=new L8(e,n,s,r,t,i)}_createView(e){let t;this.isSimpleWidget?t={paste:(s,r,a,c)=>{this._paste("keyboard",s,r,a,c)},type:s=>{this._type("keyboard",s)},compositionType:(s,r,a,c)=>{this._compositionType("keyboard",s,r,a,c)},startComposition:()=>{this._startComposition()},endComposition:()=>{this._endComposition("keyboard")},cut:()=>{this._cut("keyboard")}}:t={paste:(s,r,a,c)=>{const h={text:s,pasteOnNewLine:r,multicursorText:a,mode:c};this._commandService.executeCommand("paste",h)},type:s=>{const r={text:s};this._commandService.executeCommand("type",r)},compositionType:(s,r,a,c)=>{if(a||c){const h={text:s,replacePrevCharCnt:r,replaceNextCharCnt:a,positionDelta:c};this._commandService.executeCommand("compositionType",h)}else{const h={text:s,replaceCharCnt:r};this._commandService.executeCommand("replacePreviousChar",h)}},startComposition:()=>{this._commandService.executeCommand("compositionStart",{})},endComposition:()=>{this._commandService.executeCommand("compositionEnd",{})},cut:()=>{this._commandService.executeCommand("cut",{})}};const i=new um(e.coordinatesConverter);return i.onKeyDown=s=>this._onKeyDown.fire(s),i.onKeyUp=s=>this._onKeyUp.fire(s),i.onContextMenu=s=>this._onContextMenu.fire(s),i.onMouseMove=s=>this._onMouseMove.fire(s),i.onMouseLeave=s=>this._onMouseLeave.fire(s),i.onMouseDown=s=>this._onMouseDown.fire(s),i.onMouseUp=s=>this._onMouseUp.fire(s),i.onMouseDrag=s=>this._onMouseDrag.fire(s),i.onMouseDrop=s=>this._onMouseDrop.fire(s),i.onMouseDropCanceled=s=>this._onMouseDropCanceled.fire(s),i.onMouseWheel=s=>this._onMouseWheel.fire(s),[new fw(this._domElement,this.getId(),t,this._configuration,this._themeService.getColorTheme(),e,i,this._overflowWidgetsDomNode,this._instantiationService,this._userInteractionService),!0]}_postDetachModelCleanup(e){e?.removeAllDecorationsWithOwnerId(this._id)}_detachModel(){if(this._contributionsDisposable?.dispose(),this._contributionsDisposable=void 0,!this._modelData)return null;const e=this._modelData.model,t=this._modelData.hasRealView?this._modelData.view.domNode.domNode:null;return this._modelData.dispose(),this._modelData=null,this._domElement.removeAttribute("data-mode-id"),t&&this._domElement.contains(t)&&t.remove(),this._bannerDomNode&&this._domElement.contains(this._bannerDomNode)&&this._bannerDomNode.remove(),e}_removeDecorationType(e){this._codeEditorService.removeDecorationType(e)}hasModel(){return this._modelData!==null}showDropIndicatorAt(e){const t=[{range:new l.Range(e.lineNumber,e.column,e.lineNumber,e.column),options:Va.dropIntoEditorDecorationOptions}];this._dropIntoEditorDecorations.set(t),this.revealPosition(e,1)}removeDropIndicator(){this._dropIntoEditorDecorations.clear()}_beginUpdate(){this._updateCounter++,this._updateCounter===1&&this._onBeginUpdate.fire()}_endUpdate(){this._updateCounter--,this._updateCounter===0&&this._onEndUpdate.fire()}},Va=Dl,Dl.dropIntoEditorDecorationOptions=Ct.register({description:"workbench-dnd-target",className:"dnd-target"}),Dl),_.CodeEditorWidget=Va=S8([Es(3,me),Es(4,pt),Es(5,zi),Es(6,be),Es(7,_i),Es(8,yn),Es(9,Ui),Es(10,ms),Es(11,ze),Es(12,Na)],_.CodeEditorWidget);let y8=0,L8=class{constructor(e,t,i,n,s,r){this.model=e,this.viewModel=t,this.view=i,this.hasRealView=n,this.listenersToRemove=s,this.attachedView=r}dispose(){l.dispose(this.listenersToRemove),this.model.onBeforeDetached(this.attachedView),this.hasRealView&&this.view.dispose(),this.viewModel.dispose()}};class tN extends l.Disposable{constructor(e){super(),this._emitterOptions=e,this._onDidChangeToTrue=this._register(new l.Emitter(this._emitterOptions)),this.onDidChangeToTrue=this._onDidChangeToTrue.event,this._onDidChangeToFalse=this._register(new l.Emitter(this._emitterOptions)),this.onDidChangeToFalse=this._onDidChangeToFalse.event,this._value=0}setValue(e){const t=e?2:1;this._value!==t&&(this._value=t,this._value===2?this._onDidChangeToTrue.fire():this._value===1&&this._onDidChangeToFalse.fire())}}class kt extends l.Emitter{constructor(e,t){super({deliveryQueue:t}),this._contributions=e}fire(e){this._contributions.onBeforeInteractionEvent(),super.fire(e)}}class D8 extends l.Disposable{constructor(e,t){super(),this._editor=e,t.createKey("editorId",e.getId()),this._editorSimpleInput=_.EditorContextKeys.editorSimpleInput.bindTo(t),this._editorFocus=_.EditorContextKeys.focus.bindTo(t),this._textInputFocus=_.EditorContextKeys.textInputFocus.bindTo(t),this._editorTextFocus=_.EditorContextKeys.editorTextFocus.bindTo(t),this._tabMovesFocus=_.EditorContextKeys.tabMovesFocus.bindTo(t),this._editorReadonly=_.EditorContextKeys.readOnly.bindTo(t),this._inDiffEditor=_.EditorContextKeys.inDiffEditor.bindTo(t),this._editorColumnSelection=_.EditorContextKeys.columnSelection.bindTo(t),this._hasMultipleSelections=_.EditorContextKeys.hasMultipleSelections.bindTo(t),this._hasNonEmptySelection=_.EditorContextKeys.hasNonEmptySelection.bindTo(t),this._canUndo=_.EditorContextKeys.canUndo.bindTo(t),this._canRedo=_.EditorContextKeys.canRedo.bindTo(t),this._register(this._editor.onDidChangeConfiguration(()=>this._updateFromConfig())),this._register(this._editor.onDidChangeCursorSelection(()=>this._updateFromSelection())),this._register(this._editor.onDidFocusEditorWidget(()=>this._updateFromFocus())),this._register(this._editor.onDidBlurEditorWidget(()=>this._updateFromFocus())),this._register(this._editor.onDidFocusEditorText(()=>this._updateFromFocus())),this._register(this._editor.onDidBlurEditorText(()=>this._updateFromFocus())),this._register(this._editor.onDidChangeModel(()=>this._updateFromModel())),this._register(this._editor.onDidChangeConfiguration(()=>this._updateFromModel())),this._register(Dd.onDidChangeTabFocus(i=>this._tabMovesFocus.set(i))),this._updateFromConfig(),this._updateFromSelection(),this._updateFromFocus(),this._updateFromModel(),this._editorSimpleInput.set(this._editor.isSimpleWidget)}_updateFromConfig(){const e=this._editor.getOptions();this._tabMovesFocus.set(e.get(164)||Dd.getTabFocusMode()),this._editorReadonly.set(e.get(104)),this._inDiffEditor.set(e.get(70)),this._editorColumnSelection.set(e.get(28))}_updateFromSelection(){const e=this._editor.getSelections();e?(this._hasMultipleSelections.set(e.length>1),this._hasNonEmptySelection.set(e.some(t=>!t.isEmpty()))):(this._hasMultipleSelections.reset(),this._hasNonEmptySelection.reset())}_updateFromFocus(){this._editorFocus.set(this._editor.hasWidgetFocus()&&!this._editor.isSimpleWidget),this._editorTextFocus.set(this._editor.hasTextFocus()&&!this._editor.isSimpleWidget),this._textInputFocus.set(this._editor.hasTextFocus())}_updateFromModel(){const e=this._editor.getModel();this._canUndo.set(!!(e&&e.canUndo())),this._canRedo.set(!!(e&&e.canRedo()))}}class x8 extends l.Disposable{constructor(e,t,i){super(),this._editor=e,this._contextKeyService=t,this._languageFeaturesService=i,this._langId=_.EditorContextKeys.languageId.bindTo(t),this._hasCompletionItemProvider=_.EditorContextKeys.hasCompletionItemProvider.bindTo(t),this._hasCodeActionsProvider=_.EditorContextKeys.hasCodeActionsProvider.bindTo(t),this._hasCodeLensProvider=_.EditorContextKeys.hasCodeLensProvider.bindTo(t),this._hasDefinitionProvider=_.EditorContextKeys.hasDefinitionProvider.bindTo(t),this._hasDeclarationProvider=_.EditorContextKeys.hasDeclarationProvider.bindTo(t),this._hasImplementationProvider=_.EditorContextKeys.hasImplementationProvider.bindTo(t),this._hasTypeDefinitionProvider=_.EditorContextKeys.hasTypeDefinitionProvider.bindTo(t),this._hasHoverProvider=_.EditorContextKeys.hasHoverProvider.bindTo(t),this._hasDocumentHighlightProvider=_.EditorContextKeys.hasDocumentHighlightProvider.bindTo(t),this._hasDocumentSymbolProvider=_.EditorContextKeys.hasDocumentSymbolProvider.bindTo(t),this._hasReferenceProvider=_.EditorContextKeys.hasReferenceProvider.bindTo(t),this._hasRenameProvider=_.EditorContextKeys.hasRenameProvider.bindTo(t),this._hasSignatureHelpProvider=_.EditorContextKeys.hasSignatureHelpProvider.bindTo(t),this._hasInlayHintsProvider=_.EditorContextKeys.hasInlayHintsProvider.bindTo(t),this._hasDocumentFormattingProvider=_.EditorContextKeys.hasDocumentFormattingProvider.bindTo(t),this._hasDocumentSelectionFormattingProvider=_.EditorContextKeys.hasDocumentSelectionFormattingProvider.bindTo(t),this._hasMultipleDocumentFormattingProvider=_.EditorContextKeys.hasMultipleDocumentFormattingProvider.bindTo(t),this._hasMultipleDocumentSelectionFormattingProvider=_.EditorContextKeys.hasMultipleDocumentSelectionFormattingProvider.bindTo(t),this._isInEmbeddedEditor=_.EditorContextKeys.isInEmbeddedEditor.bindTo(t);const n=()=>this._update();this._register(e.onDidChangeModel(n)),this._register(e.onDidChangeModelLanguage(n)),this._register(i.completionProvider.onDidChange(n)),this._register(i.codeActionProvider.onDidChange(n)),this._register(i.codeLensProvider.onDidChange(n)),this._register(i.definitionProvider.onDidChange(n)),this._register(i.declarationProvider.onDidChange(n)),this._register(i.implementationProvider.onDidChange(n)),this._register(i.typeDefinitionProvider.onDidChange(n)),this._register(i.hoverProvider.onDidChange(n)),this._register(i.documentHighlightProvider.onDidChange(n)),this._register(i.documentSymbolProvider.onDidChange(n)),this._register(i.referenceProvider.onDidChange(n)),this._register(i.renameProvider.onDidChange(n)),this._register(i.documentFormattingEditProvider.onDidChange(n)),this._register(i.documentRangeFormattingEditProvider.onDidChange(n)),this._register(i.signatureHelpProvider.onDidChange(n)),this._register(i.inlayHintsProvider.onDidChange(n)),n()}dispose(){super.dispose()}reset(){this._contextKeyService.bufferChangeEvents(()=>{this._langId.reset(),this._hasCompletionItemProvider.reset(),this._hasCodeActionsProvider.reset(),this._hasCodeLensProvider.reset(),this._hasDefinitionProvider.reset(),this._hasDeclarationProvider.reset(),this._hasImplementationProvider.reset(),this._hasTypeDefinitionProvider.reset(),this._hasHoverProvider.reset(),this._hasDocumentHighlightProvider.reset(),this._hasDocumentSymbolProvider.reset(),this._hasReferenceProvider.reset(),this._hasRenameProvider.reset(),this._hasDocumentFormattingProvider.reset(),this._hasDocumentSelectionFormattingProvider.reset(),this._hasSignatureHelpProvider.reset(),this._isInEmbeddedEditor.reset()})}_update(){const e=this._editor.getModel();if(!e){this.reset();return}this._contextKeyService.bufferChangeEvents(()=>{this._langId.set(e.getLanguageId()),this._hasCompletionItemProvider.set(this._languageFeaturesService.completionProvider.has(e)),this._hasCodeActionsProvider.set(this._languageFeaturesService.codeActionProvider.has(e)),this._hasCodeLensProvider.set(this._languageFeaturesService.codeLensProvider.has(e)),this._hasDefinitionProvider.set(this._languageFeaturesService.definitionProvider.has(e)),this._hasDeclarationProvider.set(this._languageFeaturesService.declarationProvider.has(e)),this._hasImplementationProvider.set(this._languageFeaturesService.implementationProvider.has(e)),this._hasTypeDefinitionProvider.set(this._languageFeaturesService.typeDefinitionProvider.has(e)),this._hasHoverProvider.set(this._languageFeaturesService.hoverProvider.has(e)),this._hasDocumentHighlightProvider.set(this._languageFeaturesService.documentHighlightProvider.has(e)),this._hasDocumentSymbolProvider.set(this._languageFeaturesService.documentSymbolProvider.has(e)),this._hasReferenceProvider.set(this._languageFeaturesService.referenceProvider.has(e)),this._hasRenameProvider.set(this._languageFeaturesService.renameProvider.has(e)),this._hasSignatureHelpProvider.set(this._languageFeaturesService.signatureHelpProvider.has(e)),this._hasInlayHintsProvider.set(this._languageFeaturesService.inlayHintsProvider.has(e)),this._hasDocumentFormattingProvider.set(this._languageFeaturesService.documentFormattingEditProvider.has(e)||this._languageFeaturesService.documentRangeFormattingEditProvider.has(e)),this._hasDocumentSelectionFormattingProvider.set(this._languageFeaturesService.documentRangeFormattingEditProvider.has(e)),this._hasMultipleDocumentFormattingProvider.set(this._languageFeaturesService.documentFormattingEditProvider.all(e).length+this._languageFeaturesService.documentRangeFormattingEditProvider.all(e).length>1),this._hasMultipleDocumentSelectionFormattingProvider.set(this._languageFeaturesService.documentRangeFormattingEditProvider.all(e).length>1),this._isInEmbeddedEditor.set(e.uri.scheme===l.Schemas.walkThroughSnippet||e.uri.scheme===l.Schemas.vscodeChatCodeBlock)})}}class E8{get length(){return this._decorationIds.length}constructor(e,t){this._editor=e,this._decorationIds=[],this._isChangingDecorations=!1,Array.isArray(t)&&t.length>0&&this.set(t)}onDidChange(e,t,i){return this._editor.onDidChangeModelDecorations(n=>{this._isChangingDecorations||e.call(t,n)},i)}getRange(e){return!this._editor.hasModel()||e>=this._decorationIds.length?null:this._editor.getModel().getDecorationRange(this._decorationIds[e])}getRanges(){if(!this._editor.hasModel())return[];const e=this._editor.getModel(),t=[];for(const i of this._decorationIds){const n=e.getDecorationRange(i);n&&t.push(n)}return t}has(e){return this._decorationIds.includes(e.id)}clear(){this._decorationIds.length!==0&&this.set([])}set(e){try{this._isChangingDecorations=!0,this._editor.changeDecorations(t=>{this._decorationIds=t.deltaDecorations(this._decorationIds,e)})}finally{this._isChangingDecorations=!1}return this._decorationIds}append(e){let t=[];try{this._isChangingDecorations=!0,this._editor.changeDecorations(i=>{t=i.deltaDecorations([],e),this._decorationIds=this._decorationIds.concat(t)})}finally{this._isChangingDecorations=!1}return t}}const I8=encodeURIComponent("<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 6 3' enable-background='new 0 0 6 3' height='3' width='6'><g fill='"),T8=encodeURIComponent("'><polygon points='5.5,0 2.5,3 1.1,3 4.1,0'/><polygon points='4,0 6,2 6,0.6 5.4,0'/><polygon points='0,2 1,3 2.4,3 0,0.6'/></g></svg>");function Pc(o){return I8+encodeURIComponent(o.toString())+T8}const N8=encodeURIComponent('<svg xmlns="http://www.w3.org/2000/svg" height="3" width="12"><g fill="'),R8=encodeURIComponent('"><circle cx="1" cy="1" r="1"/><circle cx="5" cy="1" r="1"/><circle cx="9" cy="1" r="1"/></g></svg>');function iN(o){return N8+encodeURIComponent(o.toString())+R8}vs((o,e)=>{const t=o.getColor(Ug);t&&(e.addRule(`.monaco-editor .squiggly-error { background: url("data:image/svg+xml,${Pc(t)}") repeat-x bottom left; }`),e.addRule(`:root { --monaco-editor-error-decoration: url("data:image/svg+xml,${Pc(t)}"); }`));const i=o.getColor(ho);i&&(e.addRule(`.monaco-editor .squiggly-warning { background: url("data:image/svg+xml,${Pc(i)}") repeat-x bottom left; }`),e.addRule(`:root { --monaco-editor-warning-decoration: url("data:image/svg+xml,${Pc(i)}"); }`));const n=o.getColor(nr);n&&(e.addRule(`.monaco-editor .squiggly-info { background: url("data:image/svg+xml,${Pc(n)}") repeat-x bottom left; }`),e.addRule(`:root { --monaco-editor-info-decoration: url("data:image/svg+xml,${Pc(n)}"); }`));const s=o.getColor(yV);s&&(e.addRule(`.monaco-editor .squiggly-hint { background: url("data:image/svg+xml,${iN(s)}") no-repeat bottom left; }`),e.addRule(`:root { --monaco-editor-hint-decoration: url("data:image/svg+xml,${iN(s)}"); }`));const r=o.getColor(l$);r&&(e.addRule(`.monaco-editor.showUnused .squiggly-inline-unnecessary { opacity: ${r.rgba.a}; }`),e.addRule(`:root { --monaco-editor-unnecessary-decoration-opacity: ${r.rgba.a}; }`))});var M8=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},nN=function(o,e){return function(t,i){e(t,i,o)}};const kc=le("hoverService");_.WorkbenchHoverDelegate=class extends l.Disposable{get delay(){return this.isInstantlyHovering()?0:this.hoverOptions?.dynamicDelay?e=>this.hoverOptions?.dynamicDelay?.(e)??this._delay:this._delay}constructor(e,t,i={},n,s){super(),this.placement=e,this.hoverOptions=t,this.overrideOptions=i,this.configurationService=n,this.hoverService=s,this.lastHoverHideTime=0,this.timeLimit=200,this.hoverDisposables=this._register(new l.DisposableStore),this._delay=this.configurationService.getValue("workbench.hover.delay"),this._register(this.configurationService.onDidChangeConfiguration(r=>{r.affectsConfiguration("workbench.hover.delay")&&(this._delay=this.configurationService.getValue("workbench.hover.delay"))}))}showHover(e,t){const i=typeof this.overrideOptions=="function"?this.overrideOptions(e,t):this.overrideOptions;this.hoverDisposables.clear();const n=Ve(e.target)?[e.target]:e.target.targetElements;for(const r of n)this.hoverDisposables.add(At(r,"keydown",a=>{a.equals(9)&&this.hoverService.hideHover()}));const s=Ve(e.content)?void 0:typeof e.content=="string"?e.content.toString():e.content.value;return this.hoverService.showInstantHover({...e,...i,persistence:{hideOnKeyDown:!0,...i.persistence},id:s,appearance:{...e.appearance,compact:!0,skipFadeInAnimation:this.isInstantlyHovering(),...i.appearance}},t)}isInstantlyHovering(){return!!this.hoverOptions?.instantHover&&Date.now()-this.lastHoverHideTime<this.timeLimit}onDidHideHover(){this.hoverDisposables.clear(),this.hoverOptions?.instantHover&&(this.lastHoverHideTime=Date.now())}},_.WorkbenchHoverDelegate=M8([nN(3,Ge),nN(4,kc)],_.WorkbenchHoverDelegate);const A8={showHover:function(){throw new Error("Native hover function not implemented.")},delay:0,showNativeHover:!0},Fc=le("contextViewService"),nn=le("contextMenuService"),Zm=Q;let sN=class extends l.Disposable{constructor(e){super(),this.containerDomNode=document.createElement("div"),this.containerDomNode.className="monaco-hover",this.containerDomNode.classList.toggle("fade-in",!!e),this.containerDomNode.tabIndex=0,this.containerDomNode.setAttribute("role","tooltip"),this.contentsDomNode=document.createElement("div"),this.contentsDomNode.className="monaco-hover-content",this.scrollbar=this._register(new Jg(this.contentsDomNode,{consumeMouseWheelIfScrollbarIsNeeded:!0})),this.containerDomNode.appendChild(this.scrollbar.getDomNode())}onContentsChanged(){this.scrollbar.scanDomNode()}};class Qm extends l.Disposable{static render(e,t,i){return new Qm(e,t,i)}constructor(e,t,i){super(),this.actionLabel=t.label,this.actionKeybindingLabel=i,this.actionContainer=K(e,Zm("div.action-container")),this.actionContainer.setAttribute("tabindex","0"),this.action=K(this.actionContainer,Zm("a.action")),this.action.setAttribute("role","button"),t.iconClass&&K(this.action,Zm("span.icon")).classList.add(...t.iconClass.split(" ")),this.actionRenderedLabel=i?`${t.label} (${i})`:t.label;const n=K(this.action,Zm("span"));n.textContent=this.actionRenderedLabel,this._store.add(new rN(this.actionContainer,t.run)),this._store.add(new aN(this.actionContainer,t.run,[3,10])),this.setEnabled(!0)}setEnabled(e){e?(this.actionContainer.classList.remove("disabled"),this.actionContainer.removeAttribute("aria-disabled")):(this.actionContainer.classList.add("disabled"),this.actionContainer.setAttribute("aria-disabled","true"))}}function oN(o,e){return o&&e?l.localize(7,"Inspect this in the accessible view with {0}.",e):o?l.localize(8,"Inspect this in the accessible view via the command Open Accessible View which is currently not triggerable via keybinding."):""}class rN extends l.Disposable{constructor(e,t){super(),this._register(R(e,F.CLICK,i=>{i.stopPropagation(),i.preventDefault(),t(e)}))}}class aN extends l.Disposable{constructor(e,t,i){super(),this._register(R(e,F.KEY_DOWN,n=>{const s=new Be(n);i.some(r=>s.equals(r))&&(n.stopPropagation(),n.preventDefault(),t(e))}))}}function O8(o){const e=P8(o);if(e&&e.length>0)return new Uint32Array(e)}let sn=0;const br=new Uint32Array(10);function P8(o){if(sn=0,Is(o,cS,4352),sn>0||(Is(o,hS,4449),sn>0)||(Is(o,dS,4520),sn>0)||(Is(o,Ua,12593),sn))return br.subarray(0,sn);if(o>=44032&&o<=55203){const e=o-44032,t=e%588,i=Math.floor(e/588),n=Math.floor(t/28),s=t%28-1;if(i<cS.length?Is(i,cS,0):4352+i-12593<Ua.length&&Is(4352+i,Ua,12593),n<hS.length?Is(n,hS,0):4449+n-12593<Ua.length&&Is(4449+n-12593,Ua,12593),s>=0&&(s<dS.length?Is(s,dS,0):4520+s-12593<Ua.length&&Is(4520+s-12593,Ua,12593)),sn>0)return br.subarray(0,sn)}}function Is(o,e,t){o>=t&&o<t+e.length&&k8(e[o-t])}function k8(o){o!==0&&(br[sn++]=o&255,o>>8&&(br[sn++]=o>>8&255),o>>16&&(br[sn++]=o>>16&255))}const cS=new Uint8Array([114,82,115,101,69,102,97,113,81,116,84,100,119,87,99,122,120,118,103]),hS=new Uint16Array([107,111,105,79,106,112,117,80,104,27496,28520,27752,121,110,27246,28782,27758,98,109,27757,108]),dS=new Uint16Array([114,82,29810,115,30579,26483,101,102,29286,24934,29030,29798,30822,30310,26470,97,113,29809,116,84,100,119,99,122,120,118,103]),Ua=new Uint16Array([114,82,29810,115,30579,26483,101,69,102,29286,24934,29030,29798,30822,30310,26470,97,113,81,29809,116,84,100,119,87,99,122,120,118,103,107,111,105,79,106,112,117,80,104,27496,28520,27752,121,110,27246,28782,27758,98,109,27757,108]);new l.LRUCache(1e4);const F8=new l.LRUCache(1e4);function B8(o){return V8(o,"NFD",F8)}const z8=/[^\u0000-\u0080]/;function V8(o,e,t){if(!o)return o;const i=t.get(o);if(i)return i;let n;return z8.test(o)?n=o.normalize(e):n=o,t.set(o,n),n}const Xm=(function(){const o=new l.LRUCache(1e4),e=/[\u0300-\u036f]/g;return function(t){const i=o.get(t);if(i)return i;const n=B8(t).replace(e,""),s=(n.length===t.length?n:t).toLowerCase();return o.set(t,s),s}})();function uS(...o){return function(e,t){for(let i=0,n=o.length;i<n;i++){const s=o[i](e,t);if(s)return s}return null}}lN.bind(void 0,!1);const Jm=lN.bind(void 0,!0);function lN(o,e,t){if(!t||t.length<e.length)return null;let i;return o?i=l.startsWithIgnoreCase(t,e):i=t.indexOf(e)===0,i?e.length>0?[{start:0,end:e.length}]:[]:null}function U8(o,e){if(o.length>e.length)return null;const t=e.toLowerCase().indexOf(o.toLowerCase());return t===-1?null:[{start:t,end:t+o.length}]}function $8(o,e){if(o.length>e.length)return null;o=Xm(o),e=Xm(e);const t=e.indexOf(o);return t===-1?null:[{start:t,end:t+o.length}]}function cN(o,e){return o.length>e.length?null:fS(o.toLowerCase(),e.toLowerCase(),0,0)}function fS(o,e,t,i){if(t===o.length)return[];if(i===e.length)return null;if(o[t]===e[i]){let n=null;return(n=fS(o,e,t+1,i+1))?_S({start:i,end:i+1},n):null}return fS(o,e,t,i+1)}function gS(o){return 97<=o&&o<=122}function Wm(o){return 65<=o&&o<=90}function mS(o){return 48<=o&&o<=57}function hN(o){return o===32||o===9||o===10||o===13}const dN=new Set;"()[]{}<>`'\"-/;:,.?!".split("").forEach(o=>dN.add(o.charCodeAt(0)));function Hm(o){return hN(o)||dN.has(o)}function uN(o,e){return o===e||Hm(o)&&Hm(e)}const pS=new Map;function fN(o){if(pS.has(o))return pS.get(o);let e;const t=O8(o);return t&&(e=t),pS.set(o,e),e}function gN(o){return gS(o)||Wm(o)||mS(o)}function _S(o,e){return e.length===0?e=[o]:o.end===e[0].start?e[0].start=o.start:e.unshift(o),e}function mN(o,e){for(let t=e;t<o.length;t++){const i=o.charCodeAt(t);if(Wm(i)||mS(i)||t>0&&!gN(o.charCodeAt(t-1)))return t}return o.length}function bS(o,e,t,i){if(t===o.length)return[];if(i===e.length)return null;if(o[t]!==e[i].toLowerCase())return null;{let n=null,s=i+1;for(n=bS(o,e,t+1,i+1);!n&&(s=mN(e,s))<e.length;)n=bS(o,e,t+1,s),s++;return n===null?null:_S({start:i,end:i+1},n)}}function K8(o){let e=0,t=0,i=0,n=0,s=0;for(let d=0;d<o.length;d++)s=o.charCodeAt(d),Wm(s)&&e++,gS(s)&&t++,gN(s)&&i++,mS(s)&&n++;const r=e/o.length,a=t/o.length,c=i/o.length,h=n/o.length;return{upperPercent:r,lowerPercent:a,alphaPercent:c,numericPercent:h}}function G8(o){const{upperPercent:e,lowerPercent:t}=o;return t===0&&e>.6}function j8(o){const{upperPercent:e,lowerPercent:t,alphaPercent:i,numericPercent:n}=o;return t>.2&&e<.8&&i>.6&&n<.2}function q8(o){let e=0,t=0,i=0,n=0;for(let s=0;s<o.length;s++)i=o.charCodeAt(s),Wm(i)&&e++,gS(i)&&t++,hN(i)&&n++;return(e===0||t===0)&&n===0?o.length<=30:e<=5}function pN(o,e){if(!e||(e=e.trim(),e.length===0)||!q8(o))return null;e.length>60&&(e=e.substring(0,60));const t=K8(e);if(!j8(t)){if(!G8(t))return null;e=e.toLowerCase()}let i=null,n=0;for(o=o.toLowerCase();n<e.length&&(i=bS(o,e,0,n))===null;)n=mN(e,n+1);return i}function Y8(o,e,t=!1){if(!e||e.length===0)return null;let i=null,n=0;o=Xm(o),e=Xm(e);const s=new Map;for(;n<e.length&&(i=CS(o,e,0,n,t,s),i===null);)n=bN(e,n+1);return i}function _N(o){if(o===null)return null;const e=[];for(const t of o)e.push({start:t.start,end:t.end});return e}function CS(o,e,t,i,n,s){if(t===o.length)return[];if(i===e.length)return null;const r=t*(e.length+1)+i,a=s.get(r);if(a!==void 0)return _N(a);const c=Z8(o,e,t,i,n,s);return s.set(r,_N(c)),c}function Z8(o,e,t,i,n,s){let r=0;if(!uN(o.charCodeAt(t),e.charCodeAt(i))){const h=fN(o.charCodeAt(t));if(!h)return null;for(let d=0;d<h.length;d++)if(!uN(h[d],e.charCodeAt(i+d)))return null;r+=h.length-1}let a=null,c=i+r+1;if(a=CS(o,e,t+1,c,n,s),!n)for(;!a&&(c=bN(e,c))<e.length;)a=CS(o,e,t+1,c,n,s),c++;if(!a)return null;if(o.charCodeAt(t)!==e.charCodeAt(i)){const h=fN(o.charCodeAt(t));if(!h)return a;for(let d=0;d<h.length;d++)if(h[d]!==e.charCodeAt(i+d))return a}return _S({start:i,end:i+r+1},a)}function bN(o,e){for(let t=e;t<o.length;t++)if(Hm(o.charCodeAt(t))||t>0&&Hm(o.charCodeAt(t-1)))return t;return o.length}const Q8=uS(Jm,pN,U8),X8=uS(Jm,pN,cN),CN=new l.LRUCache(1e4);function vN(o,e,t=!1){if(typeof o!="string"||typeof e!="string")return null;let i=CN.get(o);i||(i=new RegExp(l.convertSimple2RegExpPattern(o),"i"),CN.set(o,i));const n=i.exec(e);return n?[{start:n.index,end:n.index+n[0].length}]:t?X8(o,e):Q8(o,e)}function J8(o,e){const t=Bc(o,o.toLowerCase(),0,e,e.toLowerCase(),0,{firstMatchCanBeWeak:!0,boostFullMatch:!0});return t?wN(t):null}function W8(o,e,t,i,n,s){const r=Math.min(13,o.length);for(;t<r;t++){const a=Bc(o,e,t,i,n,s,{firstMatchCanBeWeak:!0,boostFullMatch:!0});if(a)return a}return[0,s]}function wN(o){if(typeof o>"u")return[];const e=[],t=o[1];for(let i=o.length-1;i>1;i--){const n=o[i]+t,s=e[e.length-1];s&&s.end===n?s.end=n+1:e.push({start:n,end:n+1})}return e}const Cr=128;function vS(){const o=[],e=[];for(let t=0;t<=Cr;t++)e[t]=0;for(let t=0;t<=Cr;t++)o.push(e.slice(0));return o}function SN(o){const e=[];for(let t=0;t<=o;t++)e[t]=0;return e}const yN=SN(2*Cr),wS=SN(2*Cr),Lo=vS(),$a=vS(),ep=vS();function tp(o,e){if(e<0||e>=o.length)return!1;const t=o.codePointAt(e);switch(t){case 95:case 45:case 46:case 32:case 47:case 92:case 39:case 34:case 58:case 36:case 60:case 62:case 40:case 41:case 91:case 93:case 123:case 125:return!0;case void 0:return!1;default:return!!l.isEmojiImprecise(t)}}function LN(o,e){if(e<0||e>=o.length)return!1;switch(o.charCodeAt(e)){case 32:case 9:return!0;default:return!1}}function ip(o,e,t){return e[o]!==t[o]}function H8(o,e,t,i,n,s,r=!1){for(;e<t&&n<s;)o[e]===i[n]&&(r&&(yN[e]=n),e+=1),n+=1;return e===t}_.FuzzyScore=void 0,(function(o){o.Default=[-100,0];function e(t){return!t||t.length===2&&t[0]===-100&&t[1]===0}o.isDefault=e})(_.FuzzyScore||(_.FuzzyScore={}));const dD=class dD{constructor(e,t){this.firstMatchCanBeWeak=e,this.boostFullMatch=t}};dD.default={boostFullMatch:!0,firstMatchCanBeWeak:!1};let np=dD;function Bc(o,e,t,i,n,s,r=np.default){const a=o.length>Cr?Cr:o.length,c=i.length>Cr?Cr:i.length;if(t>=a||s>=c||a-t>c-s||!H8(e,t,a,n,s,c,!0))return;eG(a,c,t,s,e,n);let h=1,d=1,u=t,f=s;const g=[!1];for(h=1,u=t;u<a;h++,u++){const C=yN[u],w=wS[u],S=u+1<a?wS[u+1]:c;for(d=C-s+1,f=C;f<S;d++,f++){let L=Number.MIN_SAFE_INTEGER,D=!1;f<=w&&(L=tG(o,e,u,t,i,n,f,c,s,Lo[h-1][d-1]===0,g));let x=0;L!==Number.MIN_SAFE_INTEGER&&(D=!0,x=L+$a[h-1][d-1]);const I=f>C,T=I?$a[h][d-1]+(Lo[h][d-1]>0?-5:0):0,M=f>C+1&&Lo[h][d-1]>0,O=M?$a[h][d-2]+(Lo[h][d-2]>0?-5:0):0;if(M&&(!I||O>=T)&&(!D||O>=x))$a[h][d]=O,ep[h][d]=3,Lo[h][d]=0;else if(I&&(!D||T>=x))$a[h][d]=T,ep[h][d]=2,Lo[h][d]=0;else if(D)$a[h][d]=x,ep[h][d]=1,Lo[h][d]=Lo[h-1][d-1]+1;else throw new Error("not possible")}}if(!g[0]&&!r.firstMatchCanBeWeak)return;h--,d--;const m=[$a[h][d],s];let p=0,b=0;for(;h>=1;){let C=d;do{const w=ep[h][C];if(w===3)C=C-2;else if(w===2)C=C-1;else break}while(C>=1);p>1&&e[t+h-1]===n[s+d-1]&&!ip(C+s-1,i,n)&&p+1>Lo[h][C]&&(C=d),C===d?p++:p=1,b||(b=C),h--,d=C-1,m.push(d)}c-s===a&&r.boostFullMatch&&(m[0]+=2);const v=b-a;return m[0]-=v,m}function eG(o,e,t,i,n,s){let r=o-1,a=e-1;for(;r>=t&&a>=i;)n[r]===s[a]&&(wS[r]=a,r--),a--}function tG(o,e,t,i,n,s,r,a,c,h,d){if(e[t]!==s[r])return Number.MIN_SAFE_INTEGER;let u=1,f=!1;return r===t-i?u=o[t]===n[r]?7:5:ip(r,n,s)&&(r===0||!ip(r-1,n,s))?(u=o[t]===n[r]?7:5,f=!0):tp(s,r)&&(r===0||!tp(s,r-1))?u=5:(tp(s,r-1)||LN(s,r-1))&&(u=5,f=!0),u>1&&t===i&&(d[0]=!0),f||(f=ip(r,n,s)||tp(s,r-1)||LN(s,r-1)),t===i?r>c&&(u-=f?3:5):h?u+=f?2:0:u+=f?0:1,r+1===a&&(u-=f?3:5),u}function iG(o,e,t,i,n,s,r){return nG(o,e,t,i,n,s,!0,r)}function nG(o,e,t,i,n,s,r,a){let c=Bc(o,e,t,i,n,s,a);if(o.length>=3){const h=Math.min(7,o.length-1);for(let d=t+1;d<h;d++){const u=sG(o,d);if(u){const f=Bc(u,u.toLowerCase(),t,i,n,s,a);f&&(f[0]-=3,(!c||f[0]>c[0])&&(c=f))}}}return c}function sG(o,e){if(e+1>=o.length)return;const t=o[e],i=o[e+1];if(t!==i)return o.slice(0,e)+i+t+o.slice(e+2)}const oG="$(",SS=new RegExp(`\\$\\(${_.ThemeIcon.iconNameExpression}(?:${_.ThemeIcon.iconModifierExpression})?\\)`,"g"),rG=new RegExp(`(\\\\)?${SS.source}`,"g");function aG(o){return o.replace(rG,(e,t)=>t?e:`\\${e}`)}const lG=new RegExp(`\\\\${SS.source}`,"g");function cG(o){return o.replace(lG,e=>`\\${e}`)}const hG=new RegExp(`(\\s)?(\\\\)?${SS.source}(\\s)?`,"g");function sp(o){return o.indexOf(oG)===-1?o:o.replace(hG,(e,t,i,n)=>i?e:t||n||"")}function yS(o){return o?o.replace(/\$\((.*?)\)/g,(e,t)=>` ${t} `).trim():""}const LS=new RegExp(`\\$\\(${_.ThemeIcon.iconNameCharacter}+\\)`,"g");function Ka(o){LS.lastIndex=0;let e="";const t=[];let i=0;for(;;){const n=LS.lastIndex,s=LS.exec(o),r=o.substring(n,s?.index);if(r.length>0){e+=r;for(let a=0;a<r.length;a++)t.push(i)}if(!s)break;i+=s[0].length}return{text:e,iconOffsets:t}}function Su(o,e,t=!1){const{text:i,iconOffsets:n}=e;if(!n||n.length===0)return vN(o,i,t);const s=l.ltrim(i," "),r=i.length-s.length,a=vN(o,s,t);if(a)for(const c of a){const h=n[c.start+r]+r;c.start+=h,c.end+=h}return a}class DS{constructor(e="",t=!1){if(this.value=e,typeof this.value!="string")throw l.illegalArgument("value");typeof t=="boolean"?(this.isTrusted=t,this.supportThemeIcons=!1,this.supportHtml=!1,this.supportAlertSyntax=!1):(this.isTrusted=t.isTrusted??void 0,this.supportThemeIcons=t.supportThemeIcons??!1,this.supportHtml=t.supportHtml??!1,this.supportAlertSyntax=t.supportAlertSyntax??!1)}appendText(e,t=0){return this.value+=uG(this.supportThemeIcons?aG(e):e).replace(/([ \t]+)/g,(i,n)=>" ".repeat(n.length)).replace(/\>/gm,"\\>").replace(/\n/g,t===1?`\\
|
||
`:`
|
||
|
||
`),this}appendMarkdown(e){return this.value+=e,this}appendCodeblock(e,t){return this.value+=`
|
||
${fG(t,e)}
|
||
`,this}appendLink(e,t,i){return this.value+="[",this.value+=this._escape(t,"]"),this.value+="](",this.value+=this._escape(String(e),")"),i&&(this.value+=` "${this._escape(this._escape(i,'"'),")")}"`),this.value+=")",this}_escape(e,t){const i=new RegExp(l.escapeRegExpCharacters(t),"g");return e.replace(i,(n,s)=>e.charAt(s-1)!=="\\"?`\\${n}`:n)}}function DN(o){return Do(o)?!o.value:Array.isArray(o)?o.every(DN):!0}function Do(o){return o instanceof DS?!0:o&&typeof o=="object"?typeof o.value=="string"&&(typeof o.isTrusted=="boolean"||typeof o.isTrusted=="object"||o.isTrusted===void 0)&&(typeof o.supportThemeIcons=="boolean"||o.supportThemeIcons===void 0)&&(typeof o.supportAlertSyntax=="boolean"||o.supportAlertSyntax===void 0):!1}function dG(o,e){return o===e?!0:!o||!e?!1:o.value===e.value&&o.isTrusted===e.isTrusted&&o.supportThemeIcons===e.supportThemeIcons&&o.supportHtml===e.supportHtml&&o.supportAlertSyntax===e.supportAlertSyntax&&(o.baseUri===e.baseUri||!!o.baseUri&&!!e.baseUri&&Nx(l.URI.from(o.baseUri),l.URI.from(e.baseUri)))}function uG(o){return o.replace(/[\\`*_{}[\]()#+!~]/g,"\\$&").replace(/^([ \t]*)-/gm,"$1\\-")}function fG(o,e){const t=o.match(/^`+/gm)?.reduce((n,s)=>n.length>s.length?n:s).length??0,i=t>=3?t+1:3;return[`${"`".repeat(i)}${e}`,o,`${"`".repeat(i)}`].join(`
|
||
`)}function yu(o){return o.replace(/"/g,""")}function xS(o){return o&&o.replace(/\\([\\`*_{}[\]()#+\-.!~])/g,"$1")}function gG(o){const e=[],t=o.split("|").map(n=>n.trim());o=t[0];const i=t[1];if(i){const n=/height=(\d+)/.exec(i),s=/width=(\d+)/.exec(i),r=n?n[1]:"",a=s?s[1]:"",c=isFinite(parseInt(a)),h=isFinite(parseInt(r));c&&e.push(`width="${a}"`),h&&e.push(`height="${r}"`)}return{href:o,dimensions:e}}function mG(o,...e){return l.URI.from({scheme:l.Schemas.command,path:o,query:e.length?encodeURIComponent(JSON.stringify(e)):void 0})}class ES{constructor(e){this._prefix=e,this._lastId=0}nextId(){return this._prefix+ ++this._lastId}}const IS=new ES("id#");function TS(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}let Ga=TS();function xN(o){Ga=o}const EN=/[&<>"']/,pG=new RegExp(EN.source,"g"),IN=/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,_G=new RegExp(IN.source,"g"),bG={"&":"&","<":"<",">":">",'"':""","'":"'"},TN=o=>bG[o];function Dn(o,e){if(e){if(EN.test(o))return o.replace(pG,TN)}else if(IN.test(o))return o.replace(_G,TN);return o}const CG=/(^|[^\[])\^/g;function at(o,e){let t=typeof o=="string"?o:o.source;e=e||"";const i={replace:(n,s)=>{let r=typeof s=="string"?s:s.source;return r=r.replace(CG,"$1"),t=t.replace(n,r),i},getRegex:()=>new RegExp(t,e)};return i}function NN(o){try{o=encodeURI(o).replace(/%25/g,"%")}catch{return null}return o}const Lu={exec:()=>null};function RN(o,e){const t=o.replace(/\|/g,(s,r,a)=>{let c=!1,h=r;for(;--h>=0&&a[h]==="\\";)c=!c;return c?"|":" |"}),i=t.split(/ \|/);let n=0;if(i[0].trim()||i.shift(),i.length>0&&!i[i.length-1].trim()&&i.pop(),e)if(i.length>e)i.splice(e);else for(;i.length<e;)i.push("");for(;n<i.length;n++)i[n]=i[n].trim().replace(/\\\|/g,"|");return i}function Du(o,e,t){const i=o.length;if(i===0)return"";let n=0;for(;n<i&&o.charAt(i-n-1)===e;)n++;return o.slice(0,i-n)}function vG(o,e){if(o.indexOf(e[1])===-1)return-1;let t=0;for(let i=0;i<o.length;i++)if(o[i]==="\\")i++;else if(o[i]===e[0])t++;else if(o[i]===e[1]&&(t--,t<0))return i;return-1}function MN(o,e,t,i){const n=e.href,s=e.title?Dn(e.title):null,r=o[1].replace(/\\([\[\]])/g,"$1");if(o[0].charAt(0)!=="!"){i.state.inLink=!0;const a={type:"link",raw:t,href:n,title:s,text:r,tokens:i.inlineTokens(r)};return i.state.inLink=!1,a}return{type:"image",raw:t,href:n,title:s,text:Dn(r)}}function wG(o,e){const t=o.match(/^(\s+)(?:```)/);if(t===null)return e;const i=t[1];return e.split(`
|
||
`).map(n=>{const s=n.match(/^\s+/);if(s===null)return n;const[r]=s;return r.length>=i.length?n.slice(i.length):n}).join(`
|
||
`)}class op{options;rules;lexer;constructor(e){this.options=e||Ga}space(e){const t=this.rules.block.newline.exec(e);if(t&&t[0].length>0)return{type:"space",raw:t[0]}}code(e){const t=this.rules.block.code.exec(e);if(t){const i=t[0].replace(/^ {1,4}/gm,"");return{type:"code",raw:t[0],codeBlockStyle:"indented",text:this.options.pedantic?i:Du(i,`
|
||
`)}}}fences(e){const t=this.rules.block.fences.exec(e);if(t){const i=t[0],n=wG(i,t[3]||"");return{type:"code",raw:i,lang:t[2]?t[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):t[2],text:n}}}heading(e){const t=this.rules.block.heading.exec(e);if(t){let i=t[2].trim();if(/#$/.test(i)){const n=Du(i,"#");(this.options.pedantic||!n||/ $/.test(n))&&(i=n.trim())}return{type:"heading",raw:t[0],depth:t[1].length,text:i,tokens:this.lexer.inline(i)}}}hr(e){const t=this.rules.block.hr.exec(e);if(t)return{type:"hr",raw:Du(t[0],`
|
||
`)}}blockquote(e){const t=this.rules.block.blockquote.exec(e);if(t){let i=Du(t[0],`
|
||
`).split(`
|
||
`),n="",s="";const r=[];for(;i.length>0;){let a=!1;const c=[];let h;for(h=0;h<i.length;h++)if(/^ {0,3}>/.test(i[h]))c.push(i[h]),a=!0;else if(!a)c.push(i[h]);else break;i=i.slice(h);const d=c.join(`
|
||
`),u=d.replace(/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,`
|
||
$1`).replace(/^ {0,3}>[ \t]?/gm,"");n=n?`${n}
|
||
${d}`:d,s=s?`${s}
|
||
${u}`:u;const f=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(u,r,!0),this.lexer.state.top=f,i.length===0)break;const g=r[r.length-1];if(g?.type==="code")break;if(g?.type==="blockquote"){const m=g,p=m.raw+`
|
||
`+i.join(`
|
||
`),b=this.blockquote(p);r[r.length-1]=b,n=n.substring(0,n.length-m.raw.length)+b.raw,s=s.substring(0,s.length-m.text.length)+b.text;break}else if(g?.type==="list"){const m=g,p=m.raw+`
|
||
`+i.join(`
|
||
`),b=this.list(p);r[r.length-1]=b,n=n.substring(0,n.length-g.raw.length)+b.raw,s=s.substring(0,s.length-m.raw.length)+b.raw,i=p.substring(r[r.length-1].raw.length).split(`
|
||
`);continue}}return{type:"blockquote",raw:n,tokens:r,text:s}}}list(e){let t=this.rules.block.list.exec(e);if(t){let i=t[1].trim();const n=i.length>1,s={type:"list",raw:"",ordered:n,start:n?+i.slice(0,-1):"",loose:!1,items:[]};i=n?`\\d{1,9}\\${i.slice(-1)}`:`\\${i}`,this.options.pedantic&&(i=n?i:"[*+-]");const r=new RegExp(`^( {0,3}${i})((?:[ ][^\\n]*)?(?:\\n|$))`);let a=!1;for(;e;){let c=!1,h="",d="";if(!(t=r.exec(e))||this.rules.block.hr.test(e))break;h=t[0],e=e.substring(h.length);let u=t[2].split(`
|
||
`,1)[0].replace(/^\t+/,v=>" ".repeat(3*v.length)),f=e.split(`
|
||
`,1)[0],g=!u.trim(),m=0;if(this.options.pedantic?(m=2,d=u.trimStart()):g?m=t[1].length+1:(m=t[2].search(/[^ ]/),m=m>4?1:m,d=u.slice(m),m+=t[1].length),g&&/^ *$/.test(f)&&(h+=f+`
|
||
`,e=e.substring(f.length+1),c=!0),!c){const v=new RegExp(`^ {0,${Math.min(3,m-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),C=new RegExp(`^ {0,${Math.min(3,m-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),w=new RegExp(`^ {0,${Math.min(3,m-1)}}(?:\`\`\`|~~~)`),S=new RegExp(`^ {0,${Math.min(3,m-1)}}#`);for(;e;){const L=e.split(`
|
||
`,1)[0];if(f=L,this.options.pedantic&&(f=f.replace(/^ {1,4}(?=( {4})*[^ ])/g," ")),w.test(f)||S.test(f)||v.test(f)||C.test(e))break;if(f.search(/[^ ]/)>=m||!f.trim())d+=`
|
||
`+f.slice(m);else{if(g||u.search(/[^ ]/)>=4||w.test(u)||S.test(u)||C.test(u))break;d+=`
|
||
`+f}!g&&!f.trim()&&(g=!0),h+=L+`
|
||
`,e=e.substring(L.length+1),u=f.slice(m)}}s.loose||(a?s.loose=!0:/\n *\n *$/.test(h)&&(a=!0));let p=null,b;this.options.gfm&&(p=/^\[[ xX]\] /.exec(d),p&&(b=p[0]!=="[ ] ",d=d.replace(/^\[[ xX]\] +/,""))),s.items.push({type:"list_item",raw:h,task:!!p,checked:b,loose:!1,text:d,tokens:[]}),s.raw+=h}s.items[s.items.length-1].raw=s.items[s.items.length-1].raw.trimEnd(),s.items[s.items.length-1].text=s.items[s.items.length-1].text.trimEnd(),s.raw=s.raw.trimEnd();for(let c=0;c<s.items.length;c++)if(this.lexer.state.top=!1,s.items[c].tokens=this.lexer.blockTokens(s.items[c].text,[]),!s.loose){const h=s.items[c].tokens.filter(u=>u.type==="space"),d=h.length>0&&h.some(u=>/\n.*\n/.test(u.raw));s.loose=d}if(s.loose)for(let c=0;c<s.items.length;c++)s.items[c].loose=!0;return s}}html(e){const t=this.rules.block.html.exec(e);if(t)return{type:"html",block:!0,raw:t[0],pre:t[1]==="pre"||t[1]==="script"||t[1]==="style",text:t[0]}}def(e){const t=this.rules.block.def.exec(e);if(t){const i=t[1].toLowerCase().replace(/\s+/g," "),n=t[2]?t[2].replace(/^<(.*)>$/,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",s=t[3]?t[3].substring(1,t[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):t[3];return{type:"def",tag:i,raw:t[0],href:n,title:s}}}table(e){const t=this.rules.block.table.exec(e);if(!t||!/[:|]/.test(t[2]))return;const i=RN(t[1]),n=t[2].replace(/^\||\| *$/g,"").split("|"),s=t[3]&&t[3].trim()?t[3].replace(/\n[ \t]*$/,"").split(`
|
||
`):[],r={type:"table",raw:t[0],header:[],align:[],rows:[]};if(i.length===n.length){for(const a of n)/^ *-+: *$/.test(a)?r.align.push("right"):/^ *:-+: *$/.test(a)?r.align.push("center"):/^ *:-+ *$/.test(a)?r.align.push("left"):r.align.push(null);for(let a=0;a<i.length;a++)r.header.push({text:i[a],tokens:this.lexer.inline(i[a]),header:!0,align:r.align[a]});for(const a of s)r.rows.push(RN(a,r.header.length).map((c,h)=>({text:c,tokens:this.lexer.inline(c),header:!1,align:r.align[h]})));return r}}lheading(e){const t=this.rules.block.lheading.exec(e);if(t)return{type:"heading",raw:t[0],depth:t[2].charAt(0)==="="?1:2,text:t[1],tokens:this.lexer.inline(t[1])}}paragraph(e){const t=this.rules.block.paragraph.exec(e);if(t){const i=t[1].charAt(t[1].length-1)===`
|
||
`?t[1].slice(0,-1):t[1];return{type:"paragraph",raw:t[0],text:i,tokens:this.lexer.inline(i)}}}text(e){const t=this.rules.block.text.exec(e);if(t)return{type:"text",raw:t[0],text:t[0],tokens:this.lexer.inline(t[0])}}escape(e){const t=this.rules.inline.escape.exec(e);if(t)return{type:"escape",raw:t[0],text:Dn(t[1])}}tag(e){const t=this.rules.inline.tag.exec(e);if(t)return!this.lexer.state.inLink&&/^<a /i.test(t[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&/^<\/a>/i.test(t[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&/^<(pre|code|kbd|script)(\s|>)/i.test(t[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(t[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:t[0]}}link(e){const t=this.rules.inline.link.exec(e);if(t){const i=t[2].trim();if(!this.options.pedantic&&/^</.test(i)){if(!/>$/.test(i))return;const r=Du(i.slice(0,-1),"\\");if((i.length-r.length)%2===0)return}else{const r=vG(t[2],"()");if(r>-1){const c=(t[0].indexOf("!")===0?5:4)+t[1].length+r;t[2]=t[2].substring(0,r),t[0]=t[0].substring(0,c).trim(),t[3]=""}}let n=t[2],s="";if(this.options.pedantic){const r=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(n);r&&(n=r[1],s=r[3])}else s=t[3]?t[3].slice(1,-1):"";return n=n.trim(),/^</.test(n)&&(this.options.pedantic&&!/>$/.test(i)?n=n.slice(1):n=n.slice(1,-1)),MN(t,{href:n&&n.replace(this.rules.inline.anyPunctuation,"$1"),title:s&&s.replace(this.rules.inline.anyPunctuation,"$1")},t[0],this.lexer)}}reflink(e,t){let i;if((i=this.rules.inline.reflink.exec(e))||(i=this.rules.inline.nolink.exec(e))){const n=(i[2]||i[1]).replace(/\s+/g," "),s=t[n.toLowerCase()];if(!s){const r=i[0].charAt(0);return{type:"text",raw:r,text:r}}return MN(i,s,i[0],this.lexer)}}emStrong(e,t,i=""){let n=this.rules.inline.emStrongLDelim.exec(e);if(!n||n[3]&&i.match(/[\p{L}\p{N}]/u))return;if(!(n[1]||n[2]||"")||!i||this.rules.inline.punctuation.exec(i)){const r=[...n[0]].length-1;let a,c,h=r,d=0;const u=n[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(u.lastIndex=0,t=t.slice(-1*e.length+r);(n=u.exec(t))!=null;){if(a=n[1]||n[2]||n[3]||n[4]||n[5]||n[6],!a)continue;if(c=[...a].length,n[3]||n[4]){h+=c;continue}else if((n[5]||n[6])&&r%3&&!((r+c)%3)){d+=c;continue}if(h-=c,h>0)continue;c=Math.min(c,c+h+d);const f=[...n[0]][0].length,g=e.slice(0,r+n.index+f+c);if(Math.min(r,c)%2){const p=g.slice(1,-1);return{type:"em",raw:g,text:p,tokens:this.lexer.inlineTokens(p)}}const m=g.slice(2,-2);return{type:"strong",raw:g,text:m,tokens:this.lexer.inlineTokens(m)}}}}codespan(e){const t=this.rules.inline.code.exec(e);if(t){let i=t[2].replace(/\n/g," ");const n=/[^ ]/.test(i),s=/^ /.test(i)&&/ $/.test(i);return n&&s&&(i=i.substring(1,i.length-1)),i=Dn(i,!0),{type:"codespan",raw:t[0],text:i}}}br(e){const t=this.rules.inline.br.exec(e);if(t)return{type:"br",raw:t[0]}}del(e){const t=this.rules.inline.del.exec(e);if(t)return{type:"del",raw:t[0],text:t[2],tokens:this.lexer.inlineTokens(t[2])}}autolink(e){const t=this.rules.inline.autolink.exec(e);if(t){let i,n;return t[2]==="@"?(i=Dn(t[1]),n="mailto:"+i):(i=Dn(t[1]),n=i),{type:"link",raw:t[0],text:i,href:n,tokens:[{type:"text",raw:i,text:i}]}}}url(e){let t;if(t=this.rules.inline.url.exec(e)){let i,n;if(t[2]==="@")i=Dn(t[0]),n="mailto:"+i;else{let s;do s=t[0],t[0]=this.rules.inline._backpedal.exec(t[0])?.[0]??"";while(s!==t[0]);i=Dn(t[0]),t[1]==="www."?n="http://"+t[0]:n=t[0]}return{type:"link",raw:t[0],text:i,href:n,tokens:[{type:"text",raw:i,text:i}]}}}inlineText(e){const t=this.rules.inline.text.exec(e);if(t){let i;return this.lexer.state.inRawBlock?i=t[0]:i=Dn(t[0]),{type:"text",raw:t[0],text:i}}}}const SG=/^(?: *(?:\n|$))+/,yG=/^( {4}[^\n]+(?:\n(?: *(?:\n|$))*)?)+/,LG=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,xu=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,DG=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,AN=/(?:[*+-]|\d{1,9}[.)])/,ON=at(/^(?!bull |blockCode|fences|blockquote|heading|html)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html))+?)\n {0,3}(=+|-+) *(?:\n+|$)/).replace(/bull/g,AN).replace(/blockCode/g,/ {4}/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).getRegex(),NS=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,xG=/^[^\n]+/,RS=/(?!\s*\])(?:\\.|[^\[\]\\])+/,EG=at(/^ {0,3}\[(label)\]: *(?:\n *)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n *)?| *\n *)(title))? *(?:\n+|$)/).replace("label",RS).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),IG=at(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,AN).getRegex(),rp="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",MS=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,TG=at("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n *)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$))","i").replace("comment",MS).replace("tag",rp).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),PN=at(NS).replace("hr",xu).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",rp).getRegex(),AS={blockquote:at(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",PN).getRegex(),code:yG,def:EG,fences:LG,heading:DG,hr:xu,html:TG,lheading:ON,list:IG,newline:SG,paragraph:PN,table:Lu,text:xG},kN=at("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",xu).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code"," {4}[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",rp).getRegex(),NG={...AS,table:kN,paragraph:at(NS).replace("hr",xu).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",kN).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",rp).getRegex()},RG={...AS,html:at(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",MS).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:Lu,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:at(NS).replace("hr",xu).replace("heading",` *#{1,6} *[^
|
||
]`).replace("lheading",ON).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},FN=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,MG=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,BN=/^( {2,}|\\)\n(?!\s*$)/,AG=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,Eu="\\p{P}\\p{S}",OG=at(/^((?![*_])[\spunctuation])/,"u").replace(/punctuation/g,Eu).getRegex(),PG=/\[[^[\]]*?\]\([^\(\)]*?\)|`[^`]*?`|<[^<>]*?>/g,kG=at(/^(?:\*+(?:((?!\*)[punct])|[^\s*]))|^_+(?:((?!_)[punct])|([^\s_]))/,"u").replace(/punct/g,Eu).getRegex(),FG=at("^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)[punct](\\*+)(?=[\\s]|$)|[^punct\\s](\\*+)(?!\\*)(?=[punct\\s]|$)|(?!\\*)[punct\\s](\\*+)(?=[^punct\\s])|[\\s](\\*+)(?!\\*)(?=[punct])|(?!\\*)[punct](\\*+)(?!\\*)(?=[punct])|[^punct\\s](\\*+)(?=[^punct\\s])","gu").replace(/punct/g,Eu).getRegex(),BG=at("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)[punct](_+)(?=[\\s]|$)|[^punct\\s](_+)(?!_)(?=[punct\\s]|$)|(?!_)[punct\\s](_+)(?=[^punct\\s])|[\\s](_+)(?!_)(?=[punct])|(?!_)[punct](_+)(?!_)(?=[punct])","gu").replace(/punct/g,Eu).getRegex(),zG=at(/\\([punct])/,"gu").replace(/punct/g,Eu).getRegex(),VG=at(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),UG=at(MS).replace("(?:-->|$)","-->").getRegex(),$G=at("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",UG).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),ap=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,KG=at(/^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/).replace("label",ap).replace("href",/<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),zN=at(/^!?\[(label)\]\[(ref)\]/).replace("label",ap).replace("ref",RS).getRegex(),VN=at(/^!?\[(ref)\](?:\[\])?/).replace("ref",RS).getRegex(),GG=at("reflink|nolink(?!\\()","g").replace("reflink",zN).replace("nolink",VN).getRegex(),OS={_backpedal:Lu,anyPunctuation:zG,autolink:VG,blockSkip:PG,br:BN,code:MG,del:Lu,emStrongLDelim:kG,emStrongRDelimAst:FG,emStrongRDelimUnd:BG,escape:FN,link:KG,nolink:VN,punctuation:OG,reflink:zN,reflinkSearch:GG,tag:$G,text:AG,url:Lu},jG={...OS,link:at(/^!?\[(label)\]\((.*?)\)/).replace("label",ap).getRegex(),reflink:at(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",ap).getRegex()},PS={...OS,escape:at(FN).replace("])","~|])").getRegex(),url:at(/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,"i").replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])([\s\S]*?[^\s~])\1(?=[^~]|$)/,text:/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/},qG={...PS,br:at(BN).replace("{2,}","*").getRegex(),text:at(PS.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},lp={normal:AS,gfm:NG,pedantic:RG},Iu={normal:OS,gfm:PS,breaks:qG,pedantic:jG};class Ts{tokens;options;state;tokenizer;inlineQueue;constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||Ga,this.options.tokenizer=this.options.tokenizer||new op,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};const t={block:lp.normal,inline:Iu.normal};this.options.pedantic?(t.block=lp.pedantic,t.inline=Iu.pedantic):this.options.gfm&&(t.block=lp.gfm,this.options.breaks?t.inline=Iu.breaks:t.inline=Iu.gfm),this.tokenizer.rules=t}static get rules(){return{block:lp,inline:Iu}}static lex(e,t){return new Ts(t).lex(e)}static lexInline(e,t){return new Ts(t).inlineTokens(e)}lex(e){e=e.replace(/\r\n|\r/g,`
|
||
`),this.blockTokens(e,this.tokens);for(let t=0;t<this.inlineQueue.length;t++){const i=this.inlineQueue[t];this.inlineTokens(i.src,i.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(e,t=[],i=!1){this.options.pedantic?e=e.replace(/\t/g," ").replace(/^ +$/gm,""):e=e.replace(/^( *)(\t+)/gm,(a,c,h)=>c+" ".repeat(h.length));let n,s,r;for(;e;)if(!(this.options.extensions&&this.options.extensions.block&&this.options.extensions.block.some(a=>(n=a.call({lexer:this},e,t))?(e=e.substring(n.raw.length),t.push(n),!0):!1))){if(n=this.tokenizer.space(e)){e=e.substring(n.raw.length),n.raw.length===1&&t.length>0?t[t.length-1].raw+=`
|
||
`:t.push(n);continue}if(n=this.tokenizer.code(e)){e=e.substring(n.raw.length),s=t[t.length-1],s&&(s.type==="paragraph"||s.type==="text")?(s.raw+=`
|
||
`+n.raw,s.text+=`
|
||
`+n.text,this.inlineQueue[this.inlineQueue.length-1].src=s.text):t.push(n);continue}if(n=this.tokenizer.fences(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.heading(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.hr(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.blockquote(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.list(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.html(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.def(e)){e=e.substring(n.raw.length),s=t[t.length-1],s&&(s.type==="paragraph"||s.type==="text")?(s.raw+=`
|
||
`+n.raw,s.text+=`
|
||
`+n.raw,this.inlineQueue[this.inlineQueue.length-1].src=s.text):this.tokens.links[n.tag]||(this.tokens.links[n.tag]={href:n.href,title:n.title});continue}if(n=this.tokenizer.table(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.lheading(e)){e=e.substring(n.raw.length),t.push(n);continue}if(r=e,this.options.extensions&&this.options.extensions.startBlock){let a=1/0;const c=e.slice(1);let h;this.options.extensions.startBlock.forEach(d=>{h=d.call({lexer:this},c),typeof h=="number"&&h>=0&&(a=Math.min(a,h))}),a<1/0&&a>=0&&(r=e.substring(0,a+1))}if(this.state.top&&(n=this.tokenizer.paragraph(r))){s=t[t.length-1],i&&s?.type==="paragraph"?(s.raw+=`
|
||
`+n.raw,s.text+=`
|
||
`+n.text,this.inlineQueue.pop(),this.inlineQueue[this.inlineQueue.length-1].src=s.text):t.push(n),i=r.length!==e.length,e=e.substring(n.raw.length);continue}if(n=this.tokenizer.text(e)){e=e.substring(n.raw.length),s=t[t.length-1],s&&s.type==="text"?(s.raw+=`
|
||
`+n.raw,s.text+=`
|
||
`+n.text,this.inlineQueue.pop(),this.inlineQueue[this.inlineQueue.length-1].src=s.text):t.push(n);continue}if(e){const a="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(a);break}else throw new Error(a)}}return this.state.top=!0,t}inline(e,t=[]){return this.inlineQueue.push({src:e,tokens:t}),t}inlineTokens(e,t=[]){let i,n,s,r=e,a,c,h;if(this.tokens.links){const d=Object.keys(this.tokens.links);if(d.length>0)for(;(a=this.tokenizer.rules.inline.reflinkSearch.exec(r))!=null;)d.includes(a[0].slice(a[0].lastIndexOf("[")+1,-1))&&(r=r.slice(0,a.index)+"["+"a".repeat(a[0].length-2)+"]"+r.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(a=this.tokenizer.rules.inline.blockSkip.exec(r))!=null;)r=r.slice(0,a.index)+"["+"a".repeat(a[0].length-2)+"]"+r.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;(a=this.tokenizer.rules.inline.anyPunctuation.exec(r))!=null;)r=r.slice(0,a.index)+"++"+r.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);for(;e;)if(c||(h=""),c=!1,!(this.options.extensions&&this.options.extensions.inline&&this.options.extensions.inline.some(d=>(i=d.call({lexer:this},e,t))?(e=e.substring(i.raw.length),t.push(i),!0):!1))){if(i=this.tokenizer.escape(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.tag(e)){e=e.substring(i.raw.length),n=t[t.length-1],n&&i.type==="text"&&n.type==="text"?(n.raw+=i.raw,n.text+=i.text):t.push(i);continue}if(i=this.tokenizer.link(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(i.raw.length),n=t[t.length-1],n&&i.type==="text"&&n.type==="text"?(n.raw+=i.raw,n.text+=i.text):t.push(i);continue}if(i=this.tokenizer.emStrong(e,r,h)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.codespan(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.br(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.del(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.autolink(e)){e=e.substring(i.raw.length),t.push(i);continue}if(!this.state.inLink&&(i=this.tokenizer.url(e))){e=e.substring(i.raw.length),t.push(i);continue}if(s=e,this.options.extensions&&this.options.extensions.startInline){let d=1/0;const u=e.slice(1);let f;this.options.extensions.startInline.forEach(g=>{f=g.call({lexer:this},u),typeof f=="number"&&f>=0&&(d=Math.min(d,f))}),d<1/0&&d>=0&&(s=e.substring(0,d+1))}if(i=this.tokenizer.inlineText(s)){e=e.substring(i.raw.length),i.raw.slice(-1)!=="_"&&(h=i.raw.slice(-1)),c=!0,n=t[t.length-1],n&&n.type==="text"?(n.raw+=i.raw,n.text+=i.text):t.push(i);continue}if(e){const d="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(d);break}else throw new Error(d)}}return t}}class Tu{options;parser;constructor(e){this.options=e||Ga}space(e){return""}code({text:e,lang:t,escaped:i}){const n=(t||"").match(/^\S*/)?.[0],s=e.replace(/\n$/,"")+`
|
||
`;return n?'<pre><code class="language-'+Dn(n)+'">'+(i?s:Dn(s,!0))+`</code></pre>
|
||
`:"<pre><code>"+(i?s:Dn(s,!0))+`</code></pre>
|
||
`}blockquote({tokens:e}){return`<blockquote>
|
||
${this.parser.parse(e)}</blockquote>
|
||
`}html({text:e}){return e}heading({tokens:e,depth:t}){return`<h${t}>${this.parser.parseInline(e)}</h${t}>
|
||
`}hr(e){return`<hr>
|
||
`}list(e){const t=e.ordered,i=e.start;let n="";for(let a=0;a<e.items.length;a++){const c=e.items[a];n+=this.listitem(c)}const s=t?"ol":"ul",r=t&&i!==1?' start="'+i+'"':"";return"<"+s+r+`>
|
||
`+n+"</"+s+`>
|
||
`}listitem(e){let t="";if(e.task){const i=this.checkbox({checked:!!e.checked});e.loose?e.tokens.length>0&&e.tokens[0].type==="paragraph"?(e.tokens[0].text=i+" "+e.tokens[0].text,e.tokens[0].tokens&&e.tokens[0].tokens.length>0&&e.tokens[0].tokens[0].type==="text"&&(e.tokens[0].tokens[0].text=i+" "+e.tokens[0].tokens[0].text)):e.tokens.unshift({type:"text",raw:i+" ",text:i+" "}):t+=i+" "}return t+=this.parser.parse(e.tokens,!!e.loose),`<li>${t}</li>
|
||
`}checkbox({checked:e}){return"<input "+(e?'checked="" ':"")+'disabled="" type="checkbox">'}paragraph({tokens:e}){return`<p>${this.parser.parseInline(e)}</p>
|
||
`}table(e){let t="",i="";for(let s=0;s<e.header.length;s++)i+=this.tablecell(e.header[s]);t+=this.tablerow({text:i});let n="";for(let s=0;s<e.rows.length;s++){const r=e.rows[s];i="";for(let a=0;a<r.length;a++)i+=this.tablecell(r[a]);n+=this.tablerow({text:i})}return n&&(n=`<tbody>${n}</tbody>`),`<table>
|
||
<thead>
|
||
`+t+`</thead>
|
||
`+n+`</table>
|
||
`}tablerow({text:e}){return`<tr>
|
||
${e}</tr>
|
||
`}tablecell(e){const t=this.parser.parseInline(e.tokens),i=e.header?"th":"td";return(e.align?`<${i} align="${e.align}">`:`<${i}>`)+t+`</${i}>
|
||
`}strong({tokens:e}){return`<strong>${this.parser.parseInline(e)}</strong>`}em({tokens:e}){return`<em>${this.parser.parseInline(e)}</em>`}codespan({text:e}){return`<code>${e}</code>`}br(e){return"<br>"}del({tokens:e}){return`<del>${this.parser.parseInline(e)}</del>`}link({href:e,title:t,tokens:i}){const n=this.parser.parseInline(i),s=NN(e);if(s===null)return n;e=s;let r='<a href="'+e+'"';return t&&(r+=' title="'+t+'"'),r+=">"+n+"</a>",r}image({href:e,title:t,text:i}){const n=NN(e);if(n===null)return i;e=n;let s=`<img src="${e}" alt="${i}"`;return t&&(s+=` title="${t}"`),s+=">",s}text(e){return"tokens"in e&&e.tokens?this.parser.parseInline(e.tokens):e.text}}class kS{strong({text:e}){return e}em({text:e}){return e}codespan({text:e}){return e}del({text:e}){return e}html({text:e}){return e}text({text:e}){return e}link({text:e}){return""+e}image({text:e}){return""+e}br(){return""}}class Ns{options;renderer;textRenderer;constructor(e){this.options=e||Ga,this.options.renderer=this.options.renderer||new Tu,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new kS}static parse(e,t){return new Ns(t).parse(e)}static parseInline(e,t){return new Ns(t).parseInline(e)}parse(e,t=!0){let i="";for(let n=0;n<e.length;n++){const s=e[n];if(this.options.extensions&&this.options.extensions.renderers&&this.options.extensions.renderers[s.type]){const a=s,c=this.options.extensions.renderers[a.type].call({parser:this},a);if(c!==!1||!["space","hr","heading","code","table","blockquote","list","html","paragraph","text"].includes(a.type)){i+=c||"";continue}}const r=s;switch(r.type){case"space":{i+=this.renderer.space(r);continue}case"hr":{i+=this.renderer.hr(r);continue}case"heading":{i+=this.renderer.heading(r);continue}case"code":{i+=this.renderer.code(r);continue}case"table":{i+=this.renderer.table(r);continue}case"blockquote":{i+=this.renderer.blockquote(r);continue}case"list":{i+=this.renderer.list(r);continue}case"html":{i+=this.renderer.html(r);continue}case"paragraph":{i+=this.renderer.paragraph(r);continue}case"text":{let a=r,c=this.renderer.text(a);for(;n+1<e.length&&e[n+1].type==="text";)a=e[++n],c+=`
|
||
`+this.renderer.text(a);t?i+=this.renderer.paragraph({type:"paragraph",raw:c,text:c,tokens:[{type:"text",raw:c,text:c}]}):i+=c;continue}default:{const a='Token with "'+r.type+'" type was not found.';if(this.options.silent)return console.error(a),"";throw new Error(a)}}}return i}parseInline(e,t){t=t||this.renderer;let i="";for(let n=0;n<e.length;n++){const s=e[n];if(this.options.extensions&&this.options.extensions.renderers&&this.options.extensions.renderers[s.type]){const a=this.options.extensions.renderers[s.type].call({parser:this},s);if(a!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(s.type)){i+=a||"";continue}}const r=s;switch(r.type){case"escape":{i+=t.text(r);break}case"html":{i+=t.html(r);break}case"link":{i+=t.link(r);break}case"image":{i+=t.image(r);break}case"strong":{i+=t.strong(r);break}case"em":{i+=t.em(r);break}case"codespan":{i+=t.codespan(r);break}case"br":{i+=t.br(r);break}case"del":{i+=t.del(r);break}case"text":{i+=t.text(r);break}default:{const a='Token with "'+r.type+'" type was not found.';if(this.options.silent)return console.error(a),"";throw new Error(a)}}}return i}}class cp{options;constructor(e){this.options=e||Ga}static passThroughHooks=new Set(["preprocess","postprocess","processAllTokens"]);preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}}class UN{defaults=TS();options=this.setOptions;parse=this.parseMarkdown(Ts.lex,Ns.parse);parseInline=this.parseMarkdown(Ts.lexInline,Ns.parseInline);Parser=Ns;Renderer=Tu;TextRenderer=kS;Lexer=Ts;Tokenizer=op;Hooks=cp;constructor(...e){this.use(...e)}walkTokens(e,t){let i=[];for(const n of e)switch(i=i.concat(t.call(this,n)),n.type){case"table":{const s=n;for(const r of s.header)i=i.concat(this.walkTokens(r.tokens,t));for(const r of s.rows)for(const a of r)i=i.concat(this.walkTokens(a.tokens,t));break}case"list":{const s=n;i=i.concat(this.walkTokens(s.items,t));break}default:{const s=n;this.defaults.extensions?.childTokens?.[s.type]?this.defaults.extensions.childTokens[s.type].forEach(r=>{const a=s[r].flat(1/0);i=i.concat(this.walkTokens(a,t))}):s.tokens&&(i=i.concat(this.walkTokens(s.tokens,t)))}}return i}use(...e){const t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(i=>{const n={...i};if(n.async=this.defaults.async||n.async||!1,i.extensions&&(i.extensions.forEach(s=>{if(!s.name)throw new Error("extension name required");if("renderer"in s){const r=t.renderers[s.name];r?t.renderers[s.name]=function(...a){let c=s.renderer.apply(this,a);return c===!1&&(c=r.apply(this,a)),c}:t.renderers[s.name]=s.renderer}if("tokenizer"in s){if(!s.level||s.level!=="block"&&s.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");const r=t[s.level];r?r.unshift(s.tokenizer):t[s.level]=[s.tokenizer],s.start&&(s.level==="block"?t.startBlock?t.startBlock.push(s.start):t.startBlock=[s.start]:s.level==="inline"&&(t.startInline?t.startInline.push(s.start):t.startInline=[s.start]))}"childTokens"in s&&s.childTokens&&(t.childTokens[s.name]=s.childTokens)}),n.extensions=t),i.renderer){const s=this.defaults.renderer||new Tu(this.defaults);for(const r in i.renderer){if(!(r in s))throw new Error(`renderer '${r}' does not exist`);if(["options","parser"].includes(r))continue;const a=r,c=i.renderer[a],h=s[a];s[a]=(...d)=>{let u=c.apply(s,d);return u===!1&&(u=h.apply(s,d)),u||""}}n.renderer=s}if(i.tokenizer){const s=this.defaults.tokenizer||new op(this.defaults);for(const r in i.tokenizer){if(!(r in s))throw new Error(`tokenizer '${r}' does not exist`);if(["options","rules","lexer"].includes(r))continue;const a=r,c=i.tokenizer[a],h=s[a];s[a]=(...d)=>{let u=c.apply(s,d);return u===!1&&(u=h.apply(s,d)),u}}n.tokenizer=s}if(i.hooks){const s=this.defaults.hooks||new cp;for(const r in i.hooks){if(!(r in s))throw new Error(`hook '${r}' does not exist`);if(r==="options")continue;const a=r,c=i.hooks[a],h=s[a];cp.passThroughHooks.has(r)?s[a]=d=>{if(this.defaults.async)return Promise.resolve(c.call(s,d)).then(f=>h.call(s,f));const u=c.call(s,d);return h.call(s,u)}:s[a]=(...d)=>{let u=c.apply(s,d);return u===!1&&(u=h.apply(s,d)),u}}n.hooks=s}if(i.walkTokens){const s=this.defaults.walkTokens,r=i.walkTokens;n.walkTokens=function(a){let c=[];return c.push(r.call(this,a)),s&&(c=c.concat(s.call(this,a))),c}}this.defaults={...this.defaults,...n}}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,t){return Ts.lex(e,t??this.defaults)}parser(e,t){return Ns.parse(e,t??this.defaults)}parseMarkdown(e,t){return(n,s)=>{const r={...s},a={...this.defaults,...r},c=this.onError(!!a.silent,!!a.async);if(this.defaults.async===!0&&r.async===!1)return c(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof n>"u"||n===null)return c(new Error("marked(): input parameter is undefined or null"));if(typeof n!="string")return c(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(n)+", string expected"));if(a.hooks&&(a.hooks.options=a),a.async)return Promise.resolve(a.hooks?a.hooks.preprocess(n):n).then(h=>e(h,a)).then(h=>a.hooks?a.hooks.processAllTokens(h):h).then(h=>a.walkTokens?Promise.all(this.walkTokens(h,a.walkTokens)).then(()=>h):h).then(h=>t(h,a)).then(h=>a.hooks?a.hooks.postprocess(h):h).catch(c);try{a.hooks&&(n=a.hooks.preprocess(n));let h=e(n,a);a.hooks&&(h=a.hooks.processAllTokens(h)),a.walkTokens&&this.walkTokens(h,a.walkTokens);let d=t(h,a);return a.hooks&&(d=a.hooks.postprocess(d)),d}catch(h){return c(h)}}}onError(e,t){return i=>{if(i.message+=`
|
||
Please report this to https://github.com/markedjs/marked.`,e){const n="<p>An error occurred:</p><pre>"+Dn(i.message+"",!0)+"</pre>";return t?Promise.resolve(n):n}if(t)return Promise.reject(i);throw i}}}const ja=new UN;function it(o,e){return ja.parse(o,e)}it.options=it.setOptions=function(o){return ja.setOptions(o),it.defaults=ja.defaults,xN(it.defaults),it},it.getDefaults=TS,it.defaults=Ga,it.use=function(...o){return ja.use(...o),it.defaults=ja.defaults,xN(it.defaults),it},it.walkTokens=function(o,e){return ja.walkTokens(o,e)},it.parseInline=ja.parseInline,it.Parser=Ns,it.parser=Ns.parse,it.Renderer=Tu,it.TextRenderer=kS,it.Lexer=Ts,it.lexer=Ts.lex,it.Tokenizer=op,it.Hooks=cp,it.parse=it,it.options,it.setOptions,it.use,it.walkTokens,it.parseInline;const YG=it;Ns.parse;const Nu=Ts.lex;function ZG(o){return JSON.stringify(o,QG)}function FS(o){let e=JSON.parse(o);return e=BS(e),e}function QG(o,e){return e instanceof RegExp?{$mid:2,source:e.source,flags:e.flags}:e}function BS(o,e=0){if(!o||e>200)return o;if(typeof o=="object"){switch(o.$mid){case 1:return l.URI.revive(o);case 2:return new RegExp(o.source,o.flags);case 17:return new Date(o.source)}if(o instanceof l.VSBuffer||o instanceof Uint8Array)return o;if(Array.isArray(o))for(let t=0;t<o.length;++t)o[t]=BS(o[t],e+1);else for(const t in o)Object.hasOwnProperty.call(o,t)&&(o[t]=BS(o[t],e+1))}return o}function $N(o,e){(e==null||e>o.length)&&(e=o.length);for(var t=0,i=Array(e);t<e;t++)i[t]=o[t];return i}function XG(o){if(Array.isArray(o))return o}function JG(o,e){var t=o==null?null:typeof Symbol<"u"&&o[Symbol.iterator]||o["@@iterator"];if(t!=null){var i,n,s,r,a=[],c=!0,h=!1;try{if(s=(t=t.call(o)).next,e!==0)for(;!(c=(i=s.call(t)).done)&&(a.push(i.value),a.length!==e);c=!0);}catch(d){h=!0,n=d}finally{try{if(!c&&t.return!=null&&(r=t.return(),Object(r)!==r))return}finally{if(h)throw n}}return a}}function WG(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
||
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function HG(o,e){return XG(o)||JG(o,e)||ej(o,e)||WG()}function ej(o,e){if(o){if(typeof o=="string")return $N(o,e);var t={}.toString.call(o).slice(8,-1);return t==="Object"&&o.constructor&&(t=o.constructor.name),t==="Map"||t==="Set"?Array.from(o):t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?$N(o,e):void 0}}const KN=Object.entries,GN=Object.setPrototypeOf,tj=Object.isFrozen,ij=Object.getPrototypeOf,nj=Object.getOwnPropertyDescriptor;let ji=Object.freeze,Fn=Object.seal,zc=Object.create,jN=typeof Reflect<"u"&&Reflect,zS=jN.apply,VS=jN.construct;ji||(ji=function(e){return e}),Fn||(Fn=function(e){return e}),zS||(zS=function(e,t){for(var i=arguments.length,n=new Array(i>2?i-2:0),s=2;s<i;s++)n[s-2]=arguments[s];return e.apply(t,n)}),VS||(VS=function(e){for(var t=arguments.length,i=new Array(t>1?t-1:0),n=1;n<t;n++)i[n-1]=arguments[n];return new e(...i)});const qa=qt(Array.prototype.forEach),sj=qt(Array.prototype.lastIndexOf),qN=qt(Array.prototype.pop),Vc=qt(Array.prototype.push),oj=qt(Array.prototype.splice),qi=Array.isArray,Ru=qt(String.prototype.toLowerCase),US=qt(String.prototype.toString),YN=qt(String.prototype.match),Uc=qt(String.prototype.replace),ZN=qt(String.prototype.indexOf),rj=qt(String.prototype.trim),aj=qt(Number.prototype.toString),lj=qt(Boolean.prototype.toString),QN=typeof BigInt>"u"?null:qt(BigInt.prototype.toString),XN=typeof Symbol>"u"?null:qt(Symbol.prototype.toString),It=qt(Object.prototype.hasOwnProperty),Mu=qt(Object.prototype.toString),vi=qt(RegExp.prototype.test),$c=cj(TypeError);function qt(o){return function(e){e instanceof RegExp&&(e.lastIndex=0);for(var t=arguments.length,i=new Array(t>1?t-1:0),n=1;n<t;n++)i[n-1]=arguments[n];return zS(o,e,i)}}function cj(o){return function(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];return VS(o,t)}}function Re(o,e){let t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Ru;if(GN&&GN(o,null),!qi(e))return o;let i=e.length;for(;i--;){let n=e[i];if(typeof n=="string"){const s=t(n);s!==n&&(tj(e)||(e[i]=s),n=s)}o[n]=!0}return o}function hj(o){for(let e=0;e<o.length;e++)It(o,e)||(o[e]=null);return o}function Pi(o){const e=zc(null);for(const i of KN(o)){var t=HG(i,2);const n=t[0],s=t[1];It(o,n)&&(qi(s)?e[n]=hj(s):s&&typeof s=="object"&&s.constructor===Object?e[n]=Pi(s):e[n]=s)}return e}function dj(o){switch(typeof o){case"string":return o;case"number":return aj(o);case"boolean":return lj(o);case"bigint":return QN?QN(o):"0";case"symbol":return XN?XN(o):"Symbol()";case"undefined":return Mu(o);case"function":case"object":{if(o===null)return Mu(o);const e=o,t=Rs(e,"toString");if(typeof t=="function"){const i=t(e);return typeof i=="string"?i:Mu(i)}return Mu(o)}default:return Mu(o)}}function Rs(o,e){for(;o!==null;){const i=nj(o,e);if(i){if(i.get)return qt(i.get);if(typeof i.value=="function")return qt(i.value)}o=ij(o)}function t(){return null}return t}function uj(o){try{return vi(o,""),!0}catch{return!1}}const JN=ji(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),$S=ji(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),KS=ji(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),fj=ji(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),GS=ji(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),gj=ji(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),WN=ji(["#text"]),HN=ji(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","command","commandfor","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns"]),jS=ji(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","mask-type","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),eR=ji(["accent","accentunder","align","bevelled","close","columnalign","columnlines","columnspacing","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lquote","lspace","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),hp=ji(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),mj=Fn(/{{[\w\W]*|^[\w\W]*}}/g),pj=Fn(/<%[\w\W]*|^[\w\W]*%>/g),_j=Fn(/\${[\w\W]*/g),bj=Fn(/^data-[\-\w.\u00B7-\uFFFF]+$/),Cj=Fn(/^aria-[\-\w]+$/),tR=Fn(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),vj=Fn(/^(?:\w+script|data):/i),wj=Fn(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Sj=Fn(/^html$/i),yj=Fn(/^[a-z][.\w]*(-[.\w]+)+$/i),Ms={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,progressingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},Lj=function(){return typeof window>"u"?null:window},Dj=function(e,t){if(typeof e!="object"||typeof e.createPolicy!="function")return null;let i=null;const n="data-tt-policy-suffix";t&&t.hasAttribute(n)&&(i=t.getAttribute(n));const s="dompurify"+(i?"#"+i:"");try{return e.createPolicy(s,{createHTML(r){return r},createScriptURL(r){return r}})}catch{return console.warn("TrustedTypes policy "+s+" could not be created."),null}},iR=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function nR(){let o=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Lj();const e=ae=>nR(ae);if(e.version="3.4.8",e.removed=[],!o||!o.document||o.document.nodeType!==Ms.document||!o.Element)return e.isSupported=!1,e;let t=o.document;const i=t,n=i.currentScript;o.DocumentFragment;const s=o.HTMLTemplateElement,r=o.Node,a=o.Element,c=o.NodeFilter,h=o.NamedNodeMap;h===void 0&&(o.NamedNodeMap||o.MozNamedAttrMap),o.HTMLFormElement;const d=o.DOMParser,u=o.trustedTypes,f=a.prototype,g=Rs(f,"cloneNode"),m=Rs(f,"remove"),p=Rs(f,"nextSibling"),b=Rs(f,"childNodes"),v=Rs(f,"parentNode"),C=Rs(f,"shadowRoot"),w=Rs(f,"attributes"),S=r&&r.prototype?Rs(r.prototype,"nodeType"):null,L=r&&r.prototype?Rs(r.prototype,"nodeName"):null;if(typeof s=="function"){const ae=t.createElement("template");ae.content&&ae.content.ownerDocument&&(t=ae.content.ownerDocument)}let D,x="",I=0;const T=function(N){if(I>0)throw $c('The configured TRUSTED_TYPES_POLICY.createHTML must not call DOMPurify.sanitize, as that causes infinite recursion. Do not pass a policy whose createHTML wraps DOMPurify as TRUSTED_TYPES_POLICY; see the "DOMPurify and Trusted Types" section of the README.');I++;try{return D.createHTML(N)}finally{I--}},M=t,O=M.implementation,P=M.createNodeIterator,k=M.createDocumentFragment,U=M.getElementsByTagName,B=i.importNode;let G=iR();e.isSupported=typeof KN=="function"&&typeof v=="function"&&O&&O.createHTMLDocument!==void 0;const X=mj,re=pj,Y=_j,ee=bj,Ee=Cj,Rt=vj,We=wj,Ke=yj;let Mt=tR,Ce=null;const Jt=Re({},[...JN,...$S,...KS,...GS,...WN]);let Me=null;const Rn=Re({},[...HN,...jS,...eR,...hp]);let Ft=Object.seal(zc(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),Tf=null,Rb=null;const zr=Object.seal(zc(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let oP=!0,gD=!0,rP=!1,aP=!0,Vr=!1,Nf=!0,Pl=!1,mD=!1,pD=!1,Fh=!1,Mb=!1,Ab=!1,lP=!0,cP=!1;const hP="user-content-";let _D=!0,Rf=!1,Bh={},Ws=null;const bD=Re({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let dP=null;const uP=Re({},["audio","video","img","source","image","track"]);let CD=null;const fP=Re({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),Ob="http://www.w3.org/1998/Math/MathML",Pb="http://www.w3.org/2000/svg",Hs="http://www.w3.org/1999/xhtml";let zh=Hs,vD=!1,wD=null;const fH=Re({},[Ob,Pb,Hs],US);let SD=Re({},["mi","mo","mn","ms","mtext"]),yD=Re({},["annotation-xml"]);const gH=Re({},["title","style","font","a","script"]);let Mf=null;const mH=["application/xhtml+xml","text/html"],pH="text/html";let Bt=null,Vh=null;const _H=t.createElement("form"),gP=function(N){return N instanceof RegExp||N instanceof Function},LD=function(){let N=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(Vh&&Vh===N)return;(!N||typeof N!="object")&&(N={}),N=Pi(N),Mf=mH.indexOf(N.PARSER_MEDIA_TYPE)===-1?pH:N.PARSER_MEDIA_TYPE,Bt=Mf==="application/xhtml+xml"?US:Ru,Ce=It(N,"ALLOWED_TAGS")&&qi(N.ALLOWED_TAGS)?Re({},N.ALLOWED_TAGS,Bt):Jt,Me=It(N,"ALLOWED_ATTR")&&qi(N.ALLOWED_ATTR)?Re({},N.ALLOWED_ATTR,Bt):Rn,wD=It(N,"ALLOWED_NAMESPACES")&&qi(N.ALLOWED_NAMESPACES)?Re({},N.ALLOWED_NAMESPACES,US):fH,CD=It(N,"ADD_URI_SAFE_ATTR")&&qi(N.ADD_URI_SAFE_ATTR)?Re(Pi(fP),N.ADD_URI_SAFE_ATTR,Bt):fP,dP=It(N,"ADD_DATA_URI_TAGS")&&qi(N.ADD_DATA_URI_TAGS)?Re(Pi(uP),N.ADD_DATA_URI_TAGS,Bt):uP,Ws=It(N,"FORBID_CONTENTS")&&qi(N.FORBID_CONTENTS)?Re({},N.FORBID_CONTENTS,Bt):bD,Tf=It(N,"FORBID_TAGS")&&qi(N.FORBID_TAGS)?Re({},N.FORBID_TAGS,Bt):Pi({}),Rb=It(N,"FORBID_ATTR")&&qi(N.FORBID_ATTR)?Re({},N.FORBID_ATTR,Bt):Pi({}),Bh=It(N,"USE_PROFILES")?N.USE_PROFILES&&typeof N.USE_PROFILES=="object"?Pi(N.USE_PROFILES):N.USE_PROFILES:!1,oP=N.ALLOW_ARIA_ATTR!==!1,gD=N.ALLOW_DATA_ATTR!==!1,rP=N.ALLOW_UNKNOWN_PROTOCOLS||!1,aP=N.ALLOW_SELF_CLOSE_IN_ATTR!==!1,Vr=N.SAFE_FOR_TEMPLATES||!1,Nf=N.SAFE_FOR_XML!==!1,Pl=N.WHOLE_DOCUMENT||!1,Fh=N.RETURN_DOM||!1,Mb=N.RETURN_DOM_FRAGMENT||!1,Ab=N.RETURN_TRUSTED_TYPE||!1,pD=N.FORCE_BODY||!1,lP=N.SANITIZE_DOM!==!1,cP=N.SANITIZE_NAMED_PROPS||!1,_D=N.KEEP_CONTENT!==!1,Rf=N.IN_PLACE||!1,Mt=uj(N.ALLOWED_URI_REGEXP)?N.ALLOWED_URI_REGEXP:tR,zh=typeof N.NAMESPACE=="string"?N.NAMESPACE:Hs,SD=It(N,"MATHML_TEXT_INTEGRATION_POINTS")&&N.MATHML_TEXT_INTEGRATION_POINTS&&typeof N.MATHML_TEXT_INTEGRATION_POINTS=="object"?Pi(N.MATHML_TEXT_INTEGRATION_POINTS):Re({},["mi","mo","mn","ms","mtext"]),yD=It(N,"HTML_INTEGRATION_POINTS")&&N.HTML_INTEGRATION_POINTS&&typeof N.HTML_INTEGRATION_POINTS=="object"?Pi(N.HTML_INTEGRATION_POINTS):Re({},["annotation-xml"]);const V=It(N,"CUSTOM_ELEMENT_HANDLING")&&N.CUSTOM_ELEMENT_HANDLING&&typeof N.CUSTOM_ELEMENT_HANDLING=="object"?Pi(N.CUSTOM_ELEMENT_HANDLING):zc(null);if(Ft=zc(null),It(V,"tagNameCheck")&&gP(V.tagNameCheck)&&(Ft.tagNameCheck=V.tagNameCheck),It(V,"attributeNameCheck")&&gP(V.attributeNameCheck)&&(Ft.attributeNameCheck=V.attributeNameCheck),It(V,"allowCustomizedBuiltInElements")&&typeof V.allowCustomizedBuiltInElements=="boolean"&&(Ft.allowCustomizedBuiltInElements=V.allowCustomizedBuiltInElements),Vr&&(gD=!1),Mb&&(Fh=!0),Bh&&(Ce=Re({},WN),Me=zc(null),Bh.html===!0&&(Re(Ce,JN),Re(Me,HN)),Bh.svg===!0&&(Re(Ce,$S),Re(Me,jS),Re(Me,hp)),Bh.svgFilters===!0&&(Re(Ce,KS),Re(Me,jS),Re(Me,hp)),Bh.mathMl===!0&&(Re(Ce,GS),Re(Me,eR),Re(Me,hp))),zr.tagCheck=null,zr.attributeCheck=null,It(N,"ADD_TAGS")&&(typeof N.ADD_TAGS=="function"?zr.tagCheck=N.ADD_TAGS:qi(N.ADD_TAGS)&&(Ce===Jt&&(Ce=Pi(Ce)),Re(Ce,N.ADD_TAGS,Bt))),It(N,"ADD_ATTR")&&(typeof N.ADD_ATTR=="function"?zr.attributeCheck=N.ADD_ATTR:qi(N.ADD_ATTR)&&(Me===Rn&&(Me=Pi(Me)),Re(Me,N.ADD_ATTR,Bt))),It(N,"ADD_URI_SAFE_ATTR")&&qi(N.ADD_URI_SAFE_ATTR)&&Re(CD,N.ADD_URI_SAFE_ATTR,Bt),It(N,"FORBID_CONTENTS")&&qi(N.FORBID_CONTENTS)&&(Ws===bD&&(Ws=Pi(Ws)),Re(Ws,N.FORBID_CONTENTS,Bt)),It(N,"ADD_FORBID_CONTENTS")&&qi(N.ADD_FORBID_CONTENTS)&&(Ws===bD&&(Ws=Pi(Ws)),Re(Ws,N.ADD_FORBID_CONTENTS,Bt)),_D&&(Ce["#text"]=!0),Pl&&Re(Ce,["html","head","body"]),Ce.table&&(Re(Ce,["tbody"]),delete Tf.tbody),N.TRUSTED_TYPES_POLICY){if(typeof N.TRUSTED_TYPES_POLICY.createHTML!="function")throw $c('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof N.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw $c('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');const te=D;D=N.TRUSTED_TYPES_POLICY;try{x=T("")}catch(He){throw D=te,He}}else D===void 0&&N.TRUSTED_TYPES_POLICY!==null&&(D=Dj(u,n)),D&&typeof x=="string"&&(x=T(""));(G.uponSanitizeElement.length>0||G.uponSanitizeAttribute.length>0)&&Ce===Jt&&(Ce=Pi(Ce)),G.uponSanitizeAttribute.length>0&&Me===Rn&&(Me=Pi(Me)),ji&&ji(N),Vh=N},mP=Re({},[...$S,...KS,...fj]),pP=Re({},[...GS,...gj]),bH=function(N){let V=v(N);(!V||!V.tagName)&&(V={namespaceURI:zh,tagName:"template"});const te=Ru(N.tagName),He=Ru(V.tagName);return wD[N.namespaceURI]?N.namespaceURI===Pb?V.namespaceURI===Hs?te==="svg":V.namespaceURI===Ob?te==="svg"&&(He==="annotation-xml"||SD[He]):!!mP[te]:N.namespaceURI===Ob?V.namespaceURI===Hs?te==="math":V.namespaceURI===Pb?te==="math"&&yD[He]:!!pP[te]:N.namespaceURI===Hs?V.namespaceURI===Pb&&!yD[He]||V.namespaceURI===Ob&&!SD[He]?!1:!pP[te]&&(gH[te]||!mP[te]):!!(Mf==="application/xhtml+xml"&&wD[N.namespaceURI]):!1},rs=function(N){Vc(e.removed,{element:N});try{v(N).removeChild(N)}catch{m(N)}},kl=function(N,V){try{Vc(e.removed,{attribute:V.getAttributeNode(N),from:V})}catch{Vc(e.removed,{attribute:null,from:V})}if(V.removeAttribute(N),N==="is")if(Fh||Mb)try{rs(V)}catch{}else try{V.setAttribute(N,"")}catch{}},_P=function(N){let V=null,te=null;if(pD)N="<remove></remove>"+N;else{const dt=YN(N,/^[\r\n\t ]+/);te=dt&&dt[0]}Mf==="application/xhtml+xml"&&zh===Hs&&(N='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+N+"</body></html>");const He=D?T(N):N;if(zh===Hs)try{V=new d().parseFromString(He,Mf)}catch{}if(!V||!V.documentElement){V=O.createDocument(zh,"template",null);try{V.documentElement.innerHTML=vD?x:He}catch{}}const ke=V.body||V.documentElement;return N&&te&&ke.insertBefore(t.createTextNode(te),ke.childNodes[0]||null),zh===Hs?U.call(V,Pl?"html":"body")[0]:Pl?V.documentElement:ke},bP=function(N){return P.call(N.ownerDocument||N,N,c.SHOW_ELEMENT|c.SHOW_COMMENT|c.SHOW_TEXT|c.SHOW_PROCESSING_INSTRUCTION|c.SHOW_CDATA_SECTION,null)},DD=function(N){var V,te;N.normalize();const He=P.call(N.ownerDocument||N,N,c.SHOW_TEXT|c.SHOW_COMMENT|c.SHOW_CDATA_SECTION|c.SHOW_PROCESSING_INSTRUCTION,null);let ke=He.nextNode();for(;ke;){let ni=ke.data;qa([X,re,Y],$n=>{ni=Uc(ni,$n," ")}),ke.data=ni,ke=He.nextNode()}const dt=(V=(te=N.querySelectorAll)===null||te===void 0?void 0:te.call(N,"template"))!==null&&V!==void 0?V:[];qa(Array.from(dt),ni=>{Uh(ni.content)&&DD(ni.content)})},kb=function(N){const V=L?L(N):null;return typeof V!="string"||Bt(V)!=="form"?!1:typeof N.nodeName!="string"||typeof N.textContent!="string"||typeof N.removeChild!="function"||N.attributes!==w(N)||typeof N.removeAttribute!="function"||typeof N.setAttribute!="function"||typeof N.namespaceURI!="string"||typeof N.insertBefore!="function"||typeof N.hasChildNodes!="function"||N.nodeType!==S(N)||N.childNodes!==b(N)},Uh=function(N){if(!S||typeof N!="object"||N===null)return!1;try{return S(N)===Ms.documentFragment}catch{return!1}},Fb=function(N){if(!S||typeof N!="object"||N===null)return!1;try{return typeof S(N)=="number"}catch{return!1}};function Ko(ae,N,V){qa(ae,te=>{te.call(e,N,V,Vh)})}const CP=function(N){let V=null;if(Ko(G.beforeSanitizeElements,N,null),kb(N))return rs(N),!0;const te=Bt(L?L(N):N.nodeName);if(Ko(G.uponSanitizeElement,N,{tagName:te,allowedTags:Ce}),Nf&&N.hasChildNodes()&&!Fb(N.firstElementChild)&&vi(/<[/\w!]/g,N.innerHTML)&&vi(/<[/\w!]/g,N.textContent)||Nf&&N.namespaceURI===Hs&&te==="style"&&Fb(N.firstElementChild)||N.nodeType===Ms.progressingInstruction||Nf&&N.nodeType===Ms.comment&&vi(/<[/\w]/g,N.data))return rs(N),!0;if(Tf[te]||!(zr.tagCheck instanceof Function&&zr.tagCheck(te))&&!Ce[te]){if(!Tf[te]&&wP(te)&&(Ft.tagNameCheck instanceof RegExp&&vi(Ft.tagNameCheck,te)||Ft.tagNameCheck instanceof Function&&Ft.tagNameCheck(te)))return!1;if(_D&&!Ws[te]){const ke=v(N),dt=b(N);if(dt&&ke){const ni=dt.length;for(let $n=ni-1;$n>=0;--$n){const as=g(dt[$n],!0);ke.insertBefore(as,p(N))}}}return rs(N),!0}return(S?S(N):N.nodeType)===Ms.element&&!bH(N)||(te==="noscript"||te==="noembed"||te==="noframes")&&vi(/<\/no(script|embed|frames)/i,N.innerHTML)?(rs(N),!0):(Vr&&N.nodeType===Ms.text&&(V=N.textContent,qa([X,re,Y],ke=>{V=Uc(V,ke," ")}),N.textContent!==V&&(Vc(e.removed,{element:N.cloneNode()}),N.textContent=V)),Ko(G.afterSanitizeElements,N,null),!1)},vP=function(N,V,te){if(Rb[V]||lP&&(V==="id"||V==="name")&&(te in t||te in _H))return!1;const He=Me[V]||zr.attributeCheck instanceof Function&&zr.attributeCheck(V,N);if(!(gD&&!Rb[V]&&vi(ee,V))){if(!(oP&&vi(Ee,V))){if(!He||Rb[V]){if(!(wP(N)&&(Ft.tagNameCheck instanceof RegExp&&vi(Ft.tagNameCheck,N)||Ft.tagNameCheck instanceof Function&&Ft.tagNameCheck(N))&&(Ft.attributeNameCheck instanceof RegExp&&vi(Ft.attributeNameCheck,V)||Ft.attributeNameCheck instanceof Function&&Ft.attributeNameCheck(V,N))||V==="is"&&Ft.allowCustomizedBuiltInElements&&(Ft.tagNameCheck instanceof RegExp&&vi(Ft.tagNameCheck,te)||Ft.tagNameCheck instanceof Function&&Ft.tagNameCheck(te))))return!1}else if(!CD[V]){if(!vi(Mt,Uc(te,We,""))){if(!((V==="src"||V==="xlink:href"||V==="href")&&N!=="script"&&ZN(te,"data:")===0&&dP[N])){if(!(rP&&!vi(Rt,Uc(te,We,"")))){if(te)return!1}}}}}}return!0},CH=Re({},["annotation-xml","color-profile","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","missing-glyph"]),wP=function(N){return!CH[Ru(N)]&&vi(Ke,N)},SP=function(N){Ko(G.beforeSanitizeAttributes,N,null);const V=N.attributes;if(!V||kb(N))return;const te={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:Me,forceKeepAttr:void 0};let He=V.length;for(;He--;){const ke=V[He],dt=ke.name,ni=ke.namespaceURI,$n=ke.value,as=Bt(dt),xD=$n;let hi=dt==="value"?xD:rj(xD);if(te.attrName=as,te.attrValue=hi,te.keepAttr=!0,te.forceKeepAttr=void 0,Ko(G.uponSanitizeAttribute,N,te),hi=te.attrValue,cP&&(as==="id"||as==="name")&&ZN(hi,hP)!==0&&(kl(dt,N),hi=hP+hi),Nf&&vi(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,hi)){kl(dt,N);continue}if(as==="attributename"&&YN(hi,"href")){kl(dt,N);continue}if(te.forceKeepAttr)continue;if(!te.keepAttr){kl(dt,N);continue}if(!aP&&vi(/\/>/i,hi)){kl(dt,N);continue}Vr&&qa([X,re,Y],LP=>{hi=Uc(hi,LP," ")});const yP=Bt(N.nodeName);if(!vP(yP,as,hi)){kl(dt,N);continue}if(D&&typeof u=="object"&&typeof u.getAttributeType=="function"&&!ni)switch(u.getAttributeType(yP,as)){case"TrustedHTML":{hi=T(hi);break}case"TrustedScriptURL":{hi=D.createScriptURL(hi);break}}if(hi!==xD)try{ni?N.setAttributeNS(ni,dt,hi):N.setAttribute(dt,hi),kb(N)?rs(N):qN(e.removed)}catch{kl(dt,N)}}Ko(G.afterSanitizeAttributes,N,null)},Bb=function(N){let V=null;const te=bP(N);for(Ko(G.beforeSanitizeShadowDOM,N,null);V=te.nextNode();)if(Ko(G.uponSanitizeShadowNode,V,null),CP(V),SP(V),Uh(V.content)&&Bb(V.content),(S?S(V):V.nodeType)===Ms.element){const ke=C?C(V):V.shadowRoot;Uh(ke)&&($h(ke),Bb(ke))}Ko(G.afterSanitizeShadowDOM,N,null)},$h=function(N){const V=S?S(N):N.nodeType;if(V===Ms.element){const ke=C?C(N):N.shadowRoot;Uh(ke)&&($h(ke),Bb(ke))}const te=b?b(N):N.childNodes;if(!te)return;const He=[];qa(te,ke=>{Vc(He,ke)});for(const ke of He)$h(ke);if(V===Ms.element){const ke=L?L(N):null;if(typeof ke=="string"&&Bt(ke)==="template"){const dt=N.content;Uh(dt)&&$h(dt)}}};return e.sanitize=function(ae){let N=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},V=null,te=null,He=null,ke=null;if(vD=!ae,vD&&(ae="<!-->"),typeof ae!="string"&&!Fb(ae)&&(ae=dj(ae),typeof ae!="string"))throw $c("dirty is not a string, aborting");if(!e.isSupported)return ae;if(mD||LD(N),e.removed=[],typeof ae=="string"&&(Rf=!1),Rf){const $n=L?L(ae):ae.nodeName;if(typeof $n=="string"){const as=Bt($n);if(!Ce[as]||Tf[as])throw $c("root node is forbidden and cannot be sanitized in-place")}if(kb(ae))throw $c("root node is clobbered and cannot be sanitized in-place");$h(ae)}else if(Fb(ae))V=_P("<!---->"),te=V.ownerDocument.importNode(ae,!0),te.nodeType===Ms.element&&te.nodeName==="BODY"||te.nodeName==="HTML"?V=te:V.appendChild(te),$h(te);else{if(!Fh&&!Vr&&!Pl&&ae.indexOf("<")===-1)return D&&Ab?T(ae):ae;if(V=_P(ae),!V)return Fh?null:Ab?x:""}V&&pD&&rs(V.firstChild);const dt=bP(Rf?ae:V);for(;He=dt.nextNode();)CP(He),SP(He),Uh(He.content)&&Bb(He.content);if(Rf)return Vr&&DD(ae),ae;if(Fh){if(Vr&&DD(V),Mb)for(ke=k.call(V.ownerDocument);V.firstChild;)ke.appendChild(V.firstChild);else ke=V;return(Me.shadowroot||Me.shadowrootmode)&&(ke=B.call(i,ke,!0)),ke}let ni=Pl?V.outerHTML:V.innerHTML;return Pl&&Ce["!doctype"]&&V.ownerDocument&&V.ownerDocument.doctype&&V.ownerDocument.doctype.name&&vi(Sj,V.ownerDocument.doctype.name)&&(ni="<!DOCTYPE "+V.ownerDocument.doctype.name+`>
|
||
`+ni),Vr&&qa([X,re,Y],$n=>{ni=Uc(ni,$n," ")}),D&&Ab?T(ni):ni},e.setConfig=function(){let ae=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};LD(ae),mD=!0},e.clearConfig=function(){Vh=null,mD=!1},e.isValidAttribute=function(ae,N,V){Vh||LD({});const te=Bt(ae),He=Bt(N);return vP(te,He,V)},e.addHook=function(ae,N){typeof N=="function"&&Vc(G[ae],N)},e.removeHook=function(ae,N){if(N!==void 0){const V=sj(G[ae],N);return V===-1?void 0:oj(G[ae],V,1)[0]}return qN(G[ae])},e.removeHooks=function(ae){G[ae]=[]},e.removeAllHooks=function(){G=iR()},e}var Kc=nR();const sR=Object.freeze(["a","abbr","b","bdo","blockquote","br","caption","cite","code","col","colgroup","dd","del","details","dfn","div","dl","dt","em","figcaption","figure","h1","h2","h3","h4","h5","h6","hr","i","img","ins","kbd","label","li","mark","ol","p","pre","q","rp","rt","ruby","s","samp","small","small","source","span","strike","strong","sub","summary","sup","table","tbody","td","tfoot","th","thead","time","tr","tt","u","ul","var","video","wbr"]),oR=Object.freeze(["href","target","src","alt","title","for","name","role","tabindex","x-dispatch","required","checked","placeholder","type","start","width","height","align"]),qS="vscode-relative-path";function rR(o,e){if(e.override==="*")return!0;try{const t=new URL(o,qS+"://");return!!(e.override.includes(t.protocol.replace(/:$/,""))||e.allowRelativePaths&&t.protocol===qS+":"&&!o.trim().toLowerCase().startsWith(qS))}catch{return!1}}function xj(o,e){Kc.addHook("afterSanitizeAttributes",t=>{for(const i of["href","src"])if(t.hasAttribute(i)){const n=t.getAttribute(i);i==="href"?!n.startsWith("#")&&!rR(n,o)&&t.removeAttribute(i):rR(n,e)||t.removeAttribute(i)}})}const Ej=Object.freeze({ALLOWED_TAGS:[...sR],ALLOWED_ATTR:[...oR],ALLOW_UNKNOWN_PROTOCOLS:!0});function Ij(o,e){return aR(o,e,"trusted")}function aR(o,e,t){try{const i={...Ej};e?.allowedTags&&(e.allowedTags.override&&(i.ALLOWED_TAGS=[...e.allowedTags.override]),e.allowedTags.augment&&(i.ALLOWED_TAGS=[...i.ALLOWED_TAGS??[],...e.allowedTags.augment]));let n=[...oR];e?.allowedAttributes&&(e.allowedAttributes.override&&(n=[...e.allowedAttributes.override]),e.allowedAttributes.augment&&(n=[...n,...e.allowedAttributes.augment])),n=n.map(a=>typeof a=="string"?a.toLowerCase():{attributeName:a.attributeName.toLowerCase(),shouldKeep:a.shouldKeep});const s=new Set(n.map(a=>typeof a=="string"?a:a.attributeName)),r=new Map;for(const a of n)typeof a=="string"?r.delete(a):r.set(a.attributeName,a);return i.ALLOWED_ATTR=Array.from(s),xj({override:e?.allowedLinkProtocols?.override??[l.Schemas.http,l.Schemas.https],allowRelativePaths:e?.allowRelativeLinkPaths??!1},{override:e?.allowedMediaProtocols?.override??[l.Schemas.http,l.Schemas.https],allowRelativePaths:e?.allowRelativeMediaPaths??!1}),e?.replaceWithPlaintext&&Kc.addHook("uponSanitizeElement",Nj),r.size&&Kc.addHook("uponSanitizeAttribute",(a,c)=>{const h=r.get(c.attrName);if(h){const d=h.shouldKeep(a,c);typeof d=="string"?(c.keepAttr=!0,c.attrValue=d):c.keepAttr=d}else c.keepAttr=s.has(c.attrName)}),t==="dom"?Kc.sanitize(o,{...i,RETURN_DOM_FRAGMENT:!0}):Kc.sanitize(o,{...i,RETURN_TRUSTED_TYPE:!0})}finally{Kc.removeAllHooks()}}const Tj=["area","base","br","col","command","embed","hr","img","input","keygen","link","meta","param","source","track","wbr"],Nj=(o,e,t)=>{if(!e.allowedTags[e.tagName]&&e.tagName!=="body"){const i=lR(o);i&&(o.nodeType===Node.COMMENT_NODE?o.parentElement?.insertBefore(i,o):o.parentElement?.replaceChild(i,o))}};function lR(o){if(!o.ownerDocument)return;let e,t;if(o.nodeType===Node.COMMENT_NODE)e=`<!--${o.textContent}-->`;else if(o instanceof Element){const r=o.tagName.toLowerCase(),a=Tj.includes(r),c=o.attributes.length?" "+Array.from(o.attributes).map(h=>`${h.name}="${h.value}"`).join(" "):"";e=`<${r}${c}>`,a||(t=`</${r}>`)}else return;const i=document.createDocumentFragment(),n=o.ownerDocument.createTextNode(e);for(i.appendChild(n);o.firstChild;)i.appendChild(o.firstChild);const s=t?o.ownerDocument.createTextNode(t):void 0;return s&&i.appendChild(s),i}function cR(o,e,t){const i=aR(e,t,"dom");oi(o,i)}const Rj=new RegExp(`(\\\\)?\\$\\((${_.ThemeIcon.iconNameExpression}(?:${_.ThemeIcon.iconModifierExpression})?)\\)`,"g");function vr(o,e){const t=new Array;let i,n=0,s=0;for(;(i=Rj.exec(o))!==null;){s=i.index||0,n<s&&t.push(o.substring(n,s)),n=(i.index||0)+i[0].length;const[,r,a]=i;t.push(r?`$(${a})`:Gc({id:a},e))}return n<o.length&&t.push(o.substring(n)),t}function Gc(o,e){const t=Q("span"),i=_.ThemeIcon.asClassNameArray(o);return e&&i.push("codicon-colored"),t.classList.add(...i),t}function Mj(o){try{const e=l.URI.parse(o);if(e.scheme===l.Schemas.file){const t=e.fsPath,i=e.fragment;return yu(i?`${t}#${i}`:t)}}catch{}return""}const YS=Object.freeze({image:({href:o,title:e,text:t})=>{let i=[],n=[];return o&&({href:o,dimensions:i}=gG(o),n.push(`src="${yu(o)}"`)),t&&n.push(`alt="${yu(t)}"`),e&&n.push(`title="${yu(e)}"`),i.length&&(n=n.concat(i)),"<img "+n.join(" ")+">"},paragraph({tokens:o}){return`<p>${this.parser.parseInline(o)}</p>`},link({href:o,title:e,tokens:t}){let i=this.parser.parseInline(t);if(typeof o!="string")return"";o===i&&(i=xS(i)),e=typeof e=="string"?yu(xS(e)):"",o=xS(o),!e&&o.startsWith(`${l.Schemas.file}:`)&&(e=Mj(o));const n=o.startsWith(`${l.Schemas.command}:`);return o=o.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'"),`<a href="${o}" title="${e||(n?"":o)}" draggable="false">${i}</a>`}});function Aj(o){return function(e){const{tokens:t}=e,i=t[0];if(i?.type!=="paragraph")return o.call(this,e);const n=i.tokens;if(!n||n.length===0)return o.call(this,e);const s=n[0];if(s?.type!=="text")return o.call(this,e);const r=/^\s*\[!(NOTE|TIP|IMPORTANT|WARNING|CAUTION)\]\s*?\n*/i,a=s.raw.match(r);if(!a)return o.call(this,e);s.raw=s.raw.replace(r,""),s.text=s.text.replace(r,"");const c={note:"info",tip:"light-bulb",important:"comment",warning:"alert",caution:"stop"},h=a[1],d=h.charAt(0).toUpperCase()+h.slice(1).toLowerCase(),u=h.toLowerCase(),f=Gc({id:c[u]}).outerHTML,g=this.parser.parse(t);return`<blockquote data-severity="${u}"><p><span>${f}${d}</span>${g.substring(3)}</blockquote>
|
||
`}}function dp(o,e={},t){const i=new l.DisposableStore;let n=!1;const s=new UN(...e.markedExtensions??[]),{renderer:r,codeBlocks:a,syncCodeBlocks:c}=Pj(s,e,o),h=kj(o);let d;if(e.fillInIncompleteTokens){const m={...s.defaults,...e.markedOptions,renderer:r},p=s.lexer(h,m),b=Qj(p);d=s.parser(b,m)}else d=s.parse(h,{...e?.markedOptions,renderer:r,async:!1});o.supportThemeIcons&&(d=vr(d).map(p=>typeof p=="string"?p:p.outerHTML).join(""));const u=document.createElement("div"),f=fR(o,e.sanitizerConfig??{});cR(u,d,f),Oj(o,e,u);let g;if(t?(g=t,oi(t,...u.childNodes)):g=u,a.length>0)Promise.all(a).then(m=>{if(n)return;const p=new Map(m),b=g.querySelectorAll("div[data-code]");for(const v of b){const C=p.get(v.dataset.code??"");C&&oi(v,C)}e.asyncRenderCallback?.()});else if(c.length>0){const m=new Map(c),p=g.querySelectorAll("div[data-code]");for(const b of p){const v=m.get(b.dataset.code??"");v&&oi(b,v)}}if(e.asyncRenderCallback)for(const m of g.getElementsByTagName("img")){const p=i.add(R(m,"load",()=>{p.dispose(),e.asyncRenderCallback()}))}if(e.actionHandler){const m=p=>{const b=new Bi(j(g),p);!b.leftButton&&!b.middleButton||hR(o,e,b)};i.add(R(g,"click",m)),i.add(R(g,"auxclick",m)),i.add(R(g,"keydown",p=>{const b=new Be(p);!b.equals(10)&&!b.equals(3)||hR(o,e,b)}))}for(const m of[...g.getElementsByTagName("input")])if(m.attributes.getNamedItem("type")?.value==="checkbox")m.setAttribute("disabled","");else if(e.sanitizerConfig?.replaceWithPlaintext){const p=lR(m);p?m.parentElement?.replaceChild(p,m):m.remove()}else m.remove();return{element:g,dispose:()=>{n=!0,i.dispose()}}}function Oj(o,e,t){for(const i of t.querySelectorAll("img, audio, video, source")){const n=i.getAttribute("src");if(n){let s=n;try{o.baseUri&&(s=ZS(l.URI.from(o.baseUri),s))}catch{}if(i.setAttribute("src",dR(o,s,!0)),e.sanitizerConfig?.remoteImageIsAllowed){const r=l.URI.parse(s);r.scheme!==l.Schemas.file&&r.scheme!==l.Schemas.data&&!e.sanitizerConfig.remoteImageIsAllowed(r)&&i.replaceWith(Q("",void 0,i.outerHTML))}}}for(const i of t.querySelectorAll("a")){const n=i.getAttribute("href");if(i.setAttribute("href",""),!n||/^data:|javascript:/i.test(n)||/^command:/i.test(n)&&!o.isTrusted||/^command:(\/\/\/)?_workbench\.downloadResource/i.test(n))i.replaceWith(...i.childNodes);else{let s=dR(o,n,!1);o.baseUri&&(s=ZS(l.URI.from(o.baseUri),n)),i.dataset.href=s}}}function Pj(o,e,t){const i=new o.Renderer(e.markedOptions);i.image=YS.image,i.link=YS.link,i.paragraph=YS.paragraph,t.supportAlertSyntax&&(i.blockquote=Aj(i.blockquote));const n=[],s=[];return e.codeBlockRendererSync?i.code=({text:r,lang:a,raw:c})=>{const h=IS.nextId(),d=e.codeBlockRendererSync(uR(a),r,c);return s.push([h,d]),`<div class="code" data-code="${h}">${l.escape(r)}</div>`}:e.codeBlockRenderer&&(i.code=({text:r,lang:a})=>{const c=IS.nextId(),h=e.codeBlockRenderer(uR(a),r);return n.push(h.then(d=>[c,d])),`<div class="code" data-code="${c}">${l.escape(r)}</div>`}),t.supportHtml||(i.html=({text:r})=>e.sanitizerConfig?.replaceWithPlaintext?l.escape(r):(t.isTrusted?r.match(/^(<span[^>]+>)|(<\/\s*span>)$/):void 0)?r:""),{renderer:i,codeBlocks:n,syncCodeBlocks:s}}function kj(o){let e=o.value;return e.length>1e5&&(e=`${e.substr(0,1e5)}…`),o.supportThemeIcons&&(e=cG(e)),e}function hR(o,e,t){const i=t.target.closest("a[data-href]");if(Ve(i))try{let n=i.dataset.href;n&&(o.baseUri&&(n=ZS(l.URI.from(o.baseUri),n)),e.actionHandler?.(n,o))}catch(n){l.onUnexpectedError(n)}finally{t.preventDefault(),t.stopPropagation()}}function Fj(o,e){let t;try{t=FS(decodeURIComponent(e))}catch{}return t?(t=l.cloneAndChange(t,i=>{if(o.uris&&o.uris[i])return l.URI.revive(o.uris[i])}),encodeURIComponent(JSON.stringify(t))):e}function dR(o,e,t){const i=o.uris&&o.uris[e];let n=l.URI.revive(i);return t?e.startsWith(l.Schemas.data+":")?e:(n||(n=l.URI.parse(e)),l.FileAccess.uriToBrowserUri(n).toString(!0)):!n||l.URI.parse(e).toString()===n.toString()?e:(n.query&&(n=n.with({query:Fj(o,n.query)})),n.toString())}function uR(o){if(!o)return"";const e=o.split(/[\s+|:|,|\{|\?]/,1);return e.length?e[0]:o}function ZS(o,e){return/^\w[\w\d+.-]*:/.test(e)?e:o.path.endsWith("/")?Ax(o,e).toString():Ax(Rx(o),e).toString()}function Bj(o,e,t={}){const i=fR(e,t);return Ij(o,i)}const zj=Object.freeze([...sR,"input"]),Vj=Object.freeze(["align","autoplay","alt","colspan","controls","draggable","height","href","loop","muted","playsinline","poster","rowspan","src","target","title","type","width","start","checked","disabled","value","data-code","data-href","data-severity",{attributeName:"style",shouldKeep:(o,e)=>o.tagName==="SPAN"&&e.attrName==="style"?/^(color\:(#[0-9a-fA-F]+|var\(--vscode(-[a-zA-Z0-9]+)+\));)?(background-color\:(#[0-9a-fA-F]+|var\(--vscode(-[a-zA-Z0-9]+)+\));)?(border-radius:[0-9]+px;)?$/.test(e.attrValue):!1},{attributeName:"class",shouldKeep:(o,e)=>o.tagName==="SPAN"&&e.attrName==="class"?/^codicon codicon-[a-z\-]+( codicon-modifier-[a-z\-]+)?$/.test(e.attrValue):!1}]);function fR(o,e){const t=o.isTrusted??!1,i=[l.Schemas.http,l.Schemas.https,l.Schemas.mailto,l.Schemas.file,l.Schemas.vscodeFileResource,l.Schemas.vscodeRemote,l.Schemas.vscodeRemoteResource,l.Schemas.vscodeNotebookCell,l.Schemas.internal];return t&&i.push(l.Schemas.command),e.allowedLinkSchemes?.augment&&i.push(...e.allowedLinkSchemes.augment),{allowedTags:{override:e.allowedTags?.override??zj},allowedAttributes:{override:e.allowedAttributes?.override??Vj},allowedLinkProtocols:{override:i},allowRelativeLinkPaths:!!o.baseUri,allowedMediaProtocols:{override:[l.Schemas.http,l.Schemas.https,l.Schemas.data,l.Schemas.file,l.Schemas.vscodeFileResource,l.Schemas.vscodeRemote,l.Schemas.vscodeRemoteResource]},allowRelativeMediaPaths:!!o.baseUri,replaceWithPlaintext:e.replaceWithPlaintext}}function Uj(o,e){if(typeof o=="string")return o;let t=o.value??"";t.length>1e5&&(t=`${t.substr(0,1e5)}…`);const i=Kj(),n=YG(t,{async:!1,renderer:i});return Bj(n,{isTrusted:!1},{}).toString().replace(/&(#\d+|[a-zA-Z]+);/g,s=>$j.get(s)??s).trim()}const $j=new Map([[""",'"'],[" "," "],["&","&"],["'","'"],["<","<"],[">",">"]]);function Kj(){const o=new Tu;return o.code=({text:e})=>l.escape(e),o.blockquote=({text:e})=>e+`
|
||
`,o.html=e=>"",o.heading=function({tokens:e}){return this.parser.parseInline(e)+`
|
||
`},o.hr=()=>"",o.list=function({items:e}){return e.map(t=>this.listitem(t)).join(`
|
||
`)+`
|
||
`},o.listitem=({text:e})=>e+`
|
||
`,o.paragraph=function({tokens:e}){return this.parser.parseInline(e)+`
|
||
`},o.table=function({header:e,rows:t}){return e.map(i=>this.tablecell(i)).join(" ")+`
|
||
`+t.map(i=>i.map(n=>this.tablecell(n)).join(" ")).join(`
|
||
`)+`
|
||
`},o.tablerow=({text:e})=>e,o.tablecell=function({tokens:e}){return this.parser.parseInline(e)},o.strong=({text:e})=>e,o.em=({text:e})=>e,o.codespan=({text:e})=>e,o.br=e=>`
|
||
`,o.del=({text:e})=>e,o.image=e=>"",o.text=({text:e})=>e,o.link=({text:e})=>e,o}function Au(o){let e="";return o.forEach(t=>{e+=t.raw}),e}function gR(o){if(o.tokens)for(let e=o.tokens.length-1;e>=0;e--){const t=o.tokens[e];if(t.type==="text"){const i=t.raw.split(`
|
||
`),n=i[i.length-1];if(n.includes("`"))return Jj(o);if(n.includes("**"))return n7(o);if(n.match(/\*\w/))return Wj(o);if(n.match(/(^|\s)__\w/))return s7(o);if(n.match(/(^|\s)_\w/))return Hj(o);if(Gj(n)||jj(n)&&o.tokens.slice(0,e).some(s=>s.type==="text"&&s.raw.match(/\[[^\]]*$/))){const s=o.tokens.slice(e+1);return s[0]?.type==="link"&&s[1]?.type==="text"&&s[1].raw.match(/^ *"[^"]*$/)||n.match(/^[^"]* +"[^"]*$/)?t7(o):e7(o)}else if(n.match(/(^|\s)\[\w*[^\]]*$/))return i7(o)}}}function Gj(o){return!!o.match(/(^|\s)\[.*\]\(\w*/)}function jj(o){return!!o.match(/^[^\[]*\]\([^\)]*$/)}function qj(o){const e=o.items[o.items.length-1],t=e.tokens?e.tokens[e.tokens.length-1]:void 0,i=h=>{const u=h.items.at(-1)?.tokens.at(-1);return u?.type==="heading"||u?.type==="list"&&i(u)};let n;if(t?.type==="text"&&!("inRawBlock"in e))n=gR(t);else if(i(o)){const h=Nu(o.raw.trim()+" ")[0];return h.type!=="list"?void 0:h}if(!n||n.type!=="paragraph")return;const s=Au(o.items.slice(0,-1)),r=e.raw.match(/^(\s*(-|\d+\.|\*) +)/)?.[0];if(!r)return;const a=r+Au(e.tokens.slice(0,-1))+n.raw,c=Nu(s+a)[0];if(c.type==="list")return c}function Yj(o,e){if(o.raw.match(/-\s*$/))return Nu(e+" ")}const Zj=3;function Qj(o){for(let e=0;e<Zj;e++){const t=Xj(o);if(t)o=t;else break}return o}function Xj(o){let e,t;for(e=0;e<o.length;e++){const a=o[e];if(a.type==="paragraph"&&a.raw.match(/(\n|^)\|/)){t=o7(o.slice(e));break}}let i=o.length-1;for(;i>=0&&(o[i].type==="space"||o[i].type==="html");)i--;const n=i>=0?o[i]:void 0,s=o.slice(i+1);if(!t&&n?.type==="list"){const a=qj(n);a&&(t=[a,...s],e=i)}if(!t&&n?.type==="paragraph"){const a=gR(n);a&&(t=[a,...s],e=i)}if(t){const a=[...o.slice(0,e),...t];return a.links=o.links,a}const r=o.at(-1);if(r?.type==="heading"){const a=Yj(r,Au(o));if(a)return a}return null}function Jj(o){return wr(o,"`")}function Wj(o){return wr(o,"*")}function Hj(o){return wr(o,"_")}function e7(o){return wr(o,")",!1)}function t7(o){return wr(o,'")',!1)}function i7(o){return wr(o,"](https://microsoft.com)",!1)}function n7(o){return wr(o,"**")}function s7(o){return wr(o,"__")}function wr(o,e,t=!0){const i=Au(Array.isArray(o)?o:[o]),n=t?i.trimEnd():i;return Nu(n+e)[0]}function o7(o){const e=Au(o),t=e.split(`
|
||
`);let i,n=!1;for(let s=0;s<t.length;s++){const r=t[s].trim();if(typeof i>"u"&&r.match(/^\s*\|/)){const a=r.match(/(\|[^\|]+)(?=\||$)/g);a&&(i=a.length)}else if(typeof i=="number")if(r.match(/^\s*\|/)){if(s!==t.length-1)return;n=!0}else return}if(typeof i=="number"&&i>0){const s=n?t.slice(0,-1).join(`
|
||
`):e,r=!!s.match(/\|\s*$/),a=s+(r?"":"|")+`
|
||
|${" --- |".repeat(i)}`;return Nu(a)}}const Ou=le("openerService");function r7(o,e){return o.with({fragment:`${e.startLineNumber},${e.startColumn}${e.endLineNumber?`-${e.endLineNumber}${e.endColumn?`,${e.endColumn}`:""}`:""}`})}function a7(o){let e;const t=/^L?(\d+)(?:,(\d+))?(-L?(\d+)(?:,(\d+))?)?/.exec(o.fragment);return t&&(e={startLineNumber:parseInt(t[1]),startColumn:t[2]?parseInt(t[2]):1,endLineNumber:t[4]?parseInt(t[4]):void 0,endColumn:t[4]?t[5]?parseInt(t[5]):1:void 0},o=o.with({fragment:""})),{selection:e,uri:o}}var l7=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},c7=function(o,e){return function(t,i){e(t,i,o)}};const Pu=le("markdownRendererService");let QS=class{constructor(e){this._openerService=e}render(e,t,i){const n={...t};n.actionHandler||(n.actionHandler=(r,a)=>mR(this._openerService,r,a.isTrusted)),n.codeBlockRenderer||(n.codeBlockRenderer=(r,a)=>this._defaultCodeBlockRenderer?.renderCodeBlock(r,a,n??{})??Promise.resolve(document.createElement("span")));const s=dp(e,n,i);return s.element.classList.add("rendered-markdown"),s}setDefaultCodeBlockRenderer(e){this._defaultCodeBlockRenderer=e}};QS=l7([c7(0,Ou)],QS);async function mR(o,e,t,i){try{return await o.open(e,{fromUserGesture:!0,allowContributedOpeners:!0,allowCommands:h7(t),skipValidation:i})}catch(n){return l.onUnexpectedError(n),!1}}function h7(o){return o===!0?!0:o&&Array.isArray(o.enabledCommands)?o.enabledCommands:!1}fe(Pu,QS,1);var d7=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},up=function(o,e){return function(t,i){e(t,i,o)}};const As=Q;let XS=class extends Wn{get _targetWindow(){return j(this._target.targetElements[0])}get _targetDocumentElement(){return j(this._target.targetElements[0]).document.documentElement}get isDisposed(){return this._isDisposed}get isMouseIn(){return this._lockMouseTracker.isMouseIn}get domNode(){return this._hover.containerDomNode}get onDispose(){return this._onDispose.event}get onRequestLayout(){return this._onRequestLayout.event}get anchor(){return this._hoverPosition===2?0:1}get x(){return this._x}get y(){return this._y}get isLocked(){return this._isLocked}set isLocked(e){this._isLocked!==e&&(this._isLocked=e,this._hoverContainer.classList.toggle("locked",this._isLocked))}addMouseTrackingElement(e){return this._lockMouseTracker.addElement(e)}constructor(e,t,i,n,s){if(super(),this._keybindingService=t,this._configurationService=i,this._markdownRenderer=n,this._accessibilityService=s,this._messageListeners=new l.DisposableStore,this._isDisposed=!1,this._forcePosition=!1,this._x=0,this._y=0,this._isLocked=!1,this._enableFocusTraps=!1,this._addedFocusTrap=!1,this._maxHeightRatioRelativeToWindow=.5,this._onDispose=this._register(new l.Emitter),this._onRequestLayout=this._register(new l.Emitter),this._linkHandler=e.linkHandler,this._target="targetElements"in e.target?e.target:new u7(e.target),e.style)switch(e.style){case 1:{e.appearance??={},e.appearance.compact??=!0,e.appearance.showPointer??=!0;break}case 2:{e.appearance??={},e.appearance.compact??=!0;break}}this._hoverPointer=e.appearance?.showPointer?As("div.workbench-hover-pointer"):void 0,this._hover=this._register(new sN(!e.appearance?.skipFadeInAnimation)),this._hover.containerDomNode.classList.add("workbench-hover"),e.appearance?.compact&&this._hover.containerDomNode.classList.add("workbench-hover","compact"),this._hoverPointer&&this._hover.containerDomNode.classList.add("with-pointer"),e.additionalClasses&&this._hover.containerDomNode.classList.add(...e.additionalClasses),e.position?.forcePosition&&(this._forcePosition=!0),e.trapFocus&&(this._enableFocusTraps=!0);const r=e.appearance?.maxHeightRatio;r!==void 0&&r>0&&r<=1&&(this._maxHeightRatioRelativeToWindow=r),this._hoverPosition=e.position?.hoverPosition===void 0?3:l.isNumber(e.position.hoverPosition)?e.position.hoverPosition:2,this.onmousedown(this._hover.containerDomNode,f=>f.stopPropagation()),this.onkeydown(this._hover.containerDomNode,f=>{f.equals(9)&&this.dispose()}),this._register(R(this._targetWindow,"blur",()=>this.dispose()));const a=As("div.hover-row.markdown-hover"),c=As("div.hover-contents");if(typeof e.content=="string")c.textContent=e.content,c.style.whiteSpace="pre-wrap";else if(Ve(e.content)){c.appendChild(e.content),c.classList.add("html-hover-contents");const f=new ResizeObserver(()=>{this.layout(),this._onRequestLayout.fire()});f.observe(c),this._register(l.toDisposable(()=>f.disconnect()))}else{const f=e.content,{element:g}=this._register(this._markdownRenderer.render(f,{actionHandler:this._linkHandler,asyncRenderCallback:()=>{c.classList.add("code-hover-contents"),this.layout(),this._onRequestLayout.fire()}}));c.appendChild(g)}if(a.appendChild(c),this._hover.contentsDomNode.appendChild(a),e.actions&&e.actions.length>0){const f=As("div.hover-row.status-bar"),g=As("div.actions");e.actions.forEach(m=>{const p=this._keybindingService.lookupKeybinding(m.commandId),b=p?p.getLabel():null;this._register(Qm.render(g,{label:m.label,commandId:m.commandId,run:v=>{m.run(v),this.dispose()},iconClass:m.iconClass},b))}),f.appendChild(g),this._hover.containerDomNode.appendChild(f)}this._hoverContainer=As("div.workbench-hover-container"),this._hoverPointer&&this._hoverContainer.appendChild(this._hoverPointer),this._hoverContainer.appendChild(this._hover.containerDomNode);let h;if(e.actions&&e.actions.length>0?h=!1:e.persistence?.hideOnHover===void 0?h=typeof e.content=="string"||Do(e.content)&&!e.content.value.includes("](")&&!e.content.value.includes("</a>"):h=e.persistence.hideOnHover,e.appearance?.showHoverHint){const f=As("div.hover-row.status-bar"),g=As("div.info");g.textContent=l.localize(1761,"Hold {0} key to mouse over",l.isMacintosh?"Option":"Alt"),f.appendChild(g),this._hover.containerDomNode.appendChild(f)}const d=[...this._target.targetElements];h||d.push(this._hoverContainer);const u=this._mouseTracker=this._register(new pR(d));if(this._register(u.onMouseOut(()=>{this._isLocked||this.dispose()})),h){const f=[...this._target.targetElements,this._hoverContainer];this._lockMouseTracker=this._register(new pR(f)),this._register(this._lockMouseTracker.onMouseOut(()=>{this._isLocked||this.dispose()}))}else this._lockMouseTracker=u}addFocusTrap(){if(!this._enableFocusTraps||this._addedFocusTrap)return;this._addedFocusTrap=!0;const e=this._hover.containerDomNode,t=this.findLastFocusableChild(this._hover.containerDomNode);if(t){const i=Xf(this._hoverContainer,As("div")),n=K(this._hoverContainer,As("div"));i.tabIndex=0,n.tabIndex=0,this._register(R(n,"focus",s=>{e.focus(),s.preventDefault()})),this._register(R(i,"focus",s=>{t.focus(),s.preventDefault()}))}}findLastFocusableChild(e){if(e.hasChildNodes())for(let t=0;t<e.childNodes.length;t++){const i=e.childNodes.item(e.childNodes.length-t-1);if(i.nodeType===i.ELEMENT_NODE){const s=i;if(typeof s.tabIndex=="number"&&s.tabIndex>=0)return s}const n=this.findLastFocusableChild(i);if(n)return n}}render(e){e.appendChild(this._hoverContainer);const i=this._hoverContainer.contains(this._hoverContainer.ownerDocument.activeElement)&&oN(this._configurationService.getValue("accessibility.verbosity.hover")===!0&&this._accessibilityService.isScreenReaderOptimized(),this._keybindingService.lookupKeybinding("editor.action.accessibleView")?.getAriaLabel());i&&yd(i),this.layout(),this.addFocusTrap()}layout(){this._mouseTracker?.suppressPendingMouseOut(),this._lockMouseTracker!==this._mouseTracker&&this._lockMouseTracker?.suppressPendingMouseOut(),this._hover.containerDomNode.classList.remove("right-aligned"),this._hover.contentsDomNode.style.maxHeight="";const e=d=>{const u=ax(d),f=d.getBoundingClientRect();return{top:f.top*u,bottom:f.bottom*u,right:f.right*u,left:f.left*u}},t=this._target.targetElements.map(d=>e(d)),{top:i,right:n,bottom:s,left:r}=t[0],a=n-r,c=s-i,h={top:i,right:n,bottom:s,left:r,width:a,height:c,center:{x:r+a/2,y:i+c/2}};if(this.adjustHorizontalHoverPosition(h),this.adjustVerticalHoverPosition(h),this.adjustHoverMaxHeight(h),this._hoverContainer.style.padding="",this._hoverContainer.style.margin="",this._hoverPointer){switch(this._hoverPosition){case 1:h.left+=3,h.right+=3,this._hoverContainer.style.paddingLeft="3px",this._hoverContainer.style.marginLeft="-3px";break;case 0:h.left-=3,h.right-=3,this._hoverContainer.style.paddingRight="3px",this._hoverContainer.style.marginRight="-3px";break;case 2:h.top+=3,h.bottom+=3,this._hoverContainer.style.paddingTop="3px",this._hoverContainer.style.marginTop="-3px";break;case 3:h.top-=3,h.bottom-=3,this._hoverContainer.style.paddingBottom="3px",this._hoverContainer.style.marginBottom="-3px";break}h.center.x=h.left+a/2,h.center.y=h.top+c/2}this.computeXCordinate(h),this.computeYCordinate(h),this._hoverPointer&&(this._hoverPointer.classList.remove("top"),this._hoverPointer.classList.remove("left"),this._hoverPointer.classList.remove("right"),this._hoverPointer.classList.remove("bottom"),this.setHoverPointerPosition(h)),this._hover.onContentsChanged()}computeXCordinate(e){const t=this._hover.containerDomNode.clientWidth+2;this._target.x!==void 0?this._x=this._target.x:this._hoverPosition===1?this._x=e.right:this._hoverPosition===0?this._x=e.left-t:(this._hoverPointer?this._x=e.center.x-this._hover.containerDomNode.clientWidth/2:this._x=e.left,this._x+t>=this._targetDocumentElement.clientWidth&&(this._hover.containerDomNode.classList.add("right-aligned"),this._x=Math.max(this._targetDocumentElement.clientWidth-t-2,this._targetDocumentElement.clientLeft))),this._x<this._targetDocumentElement.clientLeft&&(this._x=e.left+2)}computeYCordinate(e){this._target.y!==void 0?this._y=this._target.y:this._hoverPosition===3?this._y=e.top:this._hoverPosition===2?this._y=e.bottom-2:this._hoverPointer?this._y=e.center.y+this._hover.containerDomNode.clientHeight/2:this._y=e.bottom,this._y>this._targetWindow.innerHeight&&(this._y=e.bottom)}adjustHorizontalHoverPosition(e){if(this._target.x!==void 0)return;const t=this._hoverPointer?3:0;if(this._forcePosition){const i=t+2;this._hoverPosition===1?this._hover.containerDomNode.style.maxWidth=`${this._targetDocumentElement.clientWidth-e.right-i}px`:this._hoverPosition===0&&(this._hover.containerDomNode.style.maxWidth=`${e.left-i}px`);return}this._hoverPosition===1?this._targetDocumentElement.clientWidth-e.right<this._hover.containerDomNode.clientWidth+t&&(e.left>=this._hover.containerDomNode.clientWidth+t?this._hoverPosition=0:this._hoverPosition=2):this._hoverPosition===0&&(e.left<this._hover.containerDomNode.clientWidth+t&&(this._targetDocumentElement.clientWidth-e.right>=this._hover.containerDomNode.clientWidth+t?this._hoverPosition=1:this._hoverPosition=2),e.left-this._hover.containerDomNode.clientWidth-t<=this._targetDocumentElement.clientLeft&&(this._hoverPosition=1))}adjustVerticalHoverPosition(e){if(this._target.y!==void 0||this._forcePosition)return;const t=this._hoverPointer?3:0;this._hoverPosition===3?e.top-this._hover.containerDomNode.clientHeight-t<0&&(this._hoverPosition=2):this._hoverPosition===2&&e.bottom+this._hover.containerDomNode.offsetHeight+t>this._targetWindow.innerHeight&&(this._hoverPosition=3)}adjustHoverMaxHeight(e){let t=this._targetWindow.innerHeight*this._maxHeightRatioRelativeToWindow;if(this._forcePosition){const i=(this._hoverPointer?3:0)+2;this._hoverPosition===3?t=Math.min(t,e.top-i):this._hoverPosition===2&&(t=Math.min(t,this._targetWindow.innerHeight-e.bottom-i))}if(this._hover.containerDomNode.style.maxHeight=`${t}px`,this._hover.contentsDomNode.clientHeight<this._hover.contentsDomNode.scrollHeight){const i=`${this._hover.scrollbar.options.verticalScrollbarSize}px`;this._hover.contentsDomNode.style.paddingRight!==i&&(this._hover.contentsDomNode.style.paddingRight=i)}}setHoverPointerPosition(e){if(this._hoverPointer)switch(this._hoverPosition){case 0:case 1:{this._hoverPointer.classList.add(this._hoverPosition===0?"right":"left");const t=this._hover.containerDomNode.clientHeight;t>e.height?this._hoverPointer.style.top=`${e.center.y-(this._y-t)-3}px`:this._hoverPointer.style.top=`${Math.round(t/2)-3}px`;break}case 3:case 2:{this._hoverPointer.classList.add(this._hoverPosition===3?"bottom":"top");const t=this._hover.containerDomNode.clientWidth;let i=Math.round(t/2)-3;const n=this._x+i;(n<e.left||n>e.right)&&(i=e.center.x-this._x-3),this._hoverPointer.style.left=`${i}px`;break}}}focus(){this._hover.containerDomNode.focus()}dispose(){this._isDisposed||(this._onDispose.fire(),this._target.dispose?.(),this._hoverContainer.remove(),this._messageListeners.dispose(),super.dispose()),this._isDisposed=!0}};XS=d7([up(1,xt),up(2,Ge),up(3,Pu),up(4,Ui)],XS);class pR extends Wn{get onMouseOut(){return this._onMouseOut.event}get isMouseIn(){return this._isMouseIn}constructor(e,t=200){super(),this._elements=e,this._eventDebounceDelay=t,this._isMouseIn=!0,this._suppressNextMouseOut=!1,this._mouseTimer=this._register(new l.MutableDisposable),this._onMouseOut=this._register(new l.Emitter);for(const i of this._elements)this.onmouseover(i,()=>this._onTargetMouseOver()),this.onmouseleave(i,()=>this._onTargetMouseLeave())}_onTargetMouseOver(){this._isMouseIn=!0,this._suppressNextMouseOut=!1,this._mouseTimer.clear()}_onTargetMouseLeave(){this._isMouseIn=!1,this._mouseTimer.value=new l.TimeoutTimer(()=>this._fireIfMouseOutside(),this._eventDebounceDelay)}_fireIfMouseOutside(){!this._isMouseIn&&!this._suppressNextMouseOut&&this._onMouseOut.fire()}suppressPendingMouseOut(){this._isMouseIn||(this._suppressNextMouseOut=!0)}addElement(e){if(this._elements.includes(e))return l.Disposable.None;this._elements.push(e);const t=new l.DisposableStore;return t.add(R(e,F.MOUSE_OVER,()=>this._onTargetMouseOver())),t.add(R(e,F.MOUSE_LEAVE,()=>this._onTargetMouseLeave())),t.add(l.toDisposable(()=>{const i=this._elements.indexOf(e);i>=0&&this._elements.splice(i,1)})),t}}class u7{constructor(e){this._element=e,this.targetElements=[this._element]}dispose(){}}var ii;(function(o){function e(s,r){if(s.start>=r.end||r.start>=s.end)return{start:0,end:0};const a=Math.max(s.start,r.start),c=Math.min(s.end,r.end);return c-a<=0?{start:0,end:0}:{start:a,end:c}}o.intersect=e;function t(s){return s.end-s.start<=0}o.isEmpty=t;function i(s,r){return!t(e(s,r))}o.intersects=i;function n(s,r){const a=[],c={start:s.start,end:Math.min(r.start,s.end)},h={start:Math.max(r.end,s.start),end:s.end};return t(c)||a.push(c),t(h)||a.push(h),a}o.relativeComplement=n})(ii||(ii={}));var Sr;(function(o){o[o.AVOID=0]="AVOID",o[o.ALIGN=1]="ALIGN"})(Sr||(Sr={}));function jc(o,e,t){const i=t.mode===Sr.ALIGN?t.offset:t.offset+t.size,n=t.mode===Sr.ALIGN?t.offset+t.size:t.offset;return t.position===0?e<=o-i?{position:i,result:"ok"}:e<=n?{position:n-e,result:"flipped"}:{position:Math.max(o-e,0),result:"overlap"}:e<=n?{position:n-e,result:"ok"}:e<=o-i&&n<e/2?{position:i,result:"flipped"}:{position:0,result:"overlap"}}function _R(o,e,t,i){let n=i?.anchorAlignment??0,s=i?.anchorPosition??0;const r=i?.anchorAxisAlignment??0;let a,c;if(r===0){const u={offset:t.top-o.top,size:t.height,position:s===0?0:1},f={offset:t.left,size:t.width,position:n===0?0:1,mode:Sr.ALIGN},g=jc(o.height,e.height,u);a=g.position+o.top,g.result==="flipped"&&(s=s===0?1:0),ii.intersects({start:a,end:a+e.height},{start:u.offset,end:u.offset+u.size})&&(f.mode=Sr.AVOID);const m=jc(o.width,e.width,f);c=m.position,m.result==="flipped"&&(n=n===0?1:0)}else{const u={offset:t.left,size:t.width,position:n===0?0:1},f={offset:t.top,size:t.height,position:s===0?0:1,mode:Sr.ALIGN},g=jc(o.width,e.width,u);c=g.position,g.result==="flipped"&&(n=n===0?1:0),ii.intersects({start:c,end:c+e.width},{start:u.offset,end:u.offset+u.size})&&(f.mode=Sr.AVOID);const m=jc(o.height,e.height,f);a=m.position+o.top,m.result==="flipped"&&(s=s===0?1:0)}const h=o.width-(c+e.width),d=o.height-(a+e.height);return{top:a,left:c,bottom:d,right:h,anchorAlignment:n,anchorPosition:s}}function f7(o){const e=o;return!!e&&typeof e.x=="number"&&typeof e.y=="number"}function JS(o){if(Ve(o)){const e=Qi(o),t=ax(o);return{top:e.top*t,left:e.left*t,width:e.width*t,height:e.height*t}}else return f7(o)?{top:o.y,left:o.x,width:o.width||1,height:o.height||2}:{top:o.posy,left:o.posx,width:2,height:2}}const Ph=class Ph extends l.Disposable{constructor(e,t){super(),this.container=null,this.useFixedPosition=!1,this.useShadowDOM=!1,this.delegate=null,this.toDisposeOnClean=l.Disposable.None,this.toDisposeOnSetContainer=l.Disposable.None,this.shadowRoot=null,this.shadowRootHostElement=null,this.view=Q(".context-view"),Wf(this.view),this.setContainer(e,t),this._register(l.toDisposable(()=>this.setContainer(null,1)))}setContainer(e,t){this.useFixedPosition=t!==1;const i=this.useShadowDOM;if(this.useShadowDOM=t===3,!(e===this.container&&i===this.useShadowDOM)&&(this.container&&(this.toDisposeOnSetContainer.dispose(),this.view.remove(),this.shadowRoot&&(this.shadowRoot=null,this.shadowRootHostElement?.remove(),this.shadowRootHostElement=null),this.container=null),e)){if(this.container=e,this.useShadowDOM){this.shadowRootHostElement=Q(".shadow-root-host"),this.container.appendChild(this.shadowRootHostElement),this.shadowRoot=this.shadowRootHostElement.attachShadow({mode:"open"});const s=document.createElement("style");s.textContent=g7,this.shadowRoot.appendChild(s),this.shadowRoot.appendChild(this.view),this.shadowRoot.appendChild(Q("slot"))}else this.container.appendChild(this.view);const n=new l.DisposableStore;Ph.BUBBLE_UP_EVENTS.forEach(s=>{n.add(At(this.container,s,r=>{this.onDOMEvent(r,!1)}))}),Ph.BUBBLE_DOWN_EVENTS.forEach(s=>{n.add(At(this.container,s,r=>{this.onDOMEvent(r,!0)},!0))}),this.toDisposeOnSetContainer=n}}show(e){this.isVisible()&&this.hide(),On(this.view),this.view.className="context-view monaco-component",this.view.style.top="0px",this.view.style.left="0px",this.view.style.zIndex=`${2575+(e.layer??0)}`,this.view.style.position=this.useFixedPosition?"fixed":"absolute",Jf(this.view),this.toDisposeOnClean=e.render(this.view)||l.Disposable.None,this.delegate=e,this.doLayout(),this.delegate.focus?.()}getViewElement(){return this.view}layout(){if(this.isVisible()){if(this.delegate.canRelayout===!1&&!(l.isIOS&&qh.pointerEvents)){this.hide();return}this.delegate?.layout?.(),this.doLayout()}}doLayout(){if(!this.isVisible())return;const e=JS(this.delegate.getAnchor()),t=this.container?j(this.container):Le(),i={top:t.pageYOffset,left:t.pageXOffset,width:t.innerWidth,height:t.innerHeight},n={width:jf(this.view),height:qf(this.view)},s=this.delegate.anchorPosition,r=this.delegate.anchorAlignment,a=this.delegate.anchorAxisAlignment,{top:c,left:h}=_R(i,n,e,{anchorAlignment:r,anchorPosition:s,anchorAxisAlignment:a});this.view.classList.remove("top","bottom","left","right"),this.view.classList.add(s===0?"bottom":"top"),this.view.classList.add(r===0?"left":"right"),this.view.classList.toggle("fixed",this.useFixedPosition);const d=Qi(this.container),u=this.container.scrollTop||0,f=this.container.scrollLeft||0;this.view.style.top=`${c-(this.useFixedPosition?Qi(this.view).top:d.top)+u}px`,this.view.style.left=`${h-(this.useFixedPosition?Qi(this.view).left:d.left)+f}px`,this.view.style.width="initial"}hide(e){const t=this.delegate;this.delegate=null,t?.onHide&&t.onHide(e);const i=this.toDisposeOnClean;this.toDisposeOnClean=l.Disposable.None,i.dispose(),Wf(this.view)}isVisible(){return!!this.delegate}onDOMEvent(e,t){this.delegate&&(this.delegate.onDOMEvent?this.delegate.onDOMEvent(e,j(e).document.activeElement):t&&!ut(e.target,this.container)&&this.hide())}dispose(){this.hide(),super.dispose()}};Ph.BUBBLE_UP_EVENTS=["click","keydown","focus","blur"],Ph.BUBBLE_DOWN_EVENTS=["click"];let fp=Ph;const g7=`
|
||
:host {
|
||
all: initial; /* 1st rule so subsequent properties are reset. */
|
||
}
|
||
|
||
.codicon[class*='codicon-'] {
|
||
font: normal normal normal 16px/1 codicon;
|
||
display: inline-block;
|
||
text-decoration: none;
|
||
text-rendering: auto;
|
||
text-align: center;
|
||
-webkit-font-smoothing: antialiased;
|
||
-moz-osx-font-smoothing: grayscale;
|
||
user-select: none;
|
||
-webkit-user-select: none;
|
||
-ms-user-select: none;
|
||
}
|
||
|
||
:host {
|
||
font-family: -apple-system, BlinkMacSystemFont, "Segoe WPC", "Segoe UI", "HelveticaNeue-Light", system-ui, "Ubuntu", "Droid Sans", sans-serif;
|
||
}
|
||
|
||
:host-context(.mac) { font-family: -apple-system, BlinkMacSystemFont, sans-serif; }
|
||
:host-context(.mac:lang(zh-Hans)) { font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", sans-serif; }
|
||
:host-context(.mac:lang(zh-Hant)) { font-family: -apple-system, BlinkMacSystemFont, "PingFang TC", sans-serif; }
|
||
:host-context(.mac:lang(ja)) { font-family: -apple-system, BlinkMacSystemFont, "Hiragino Kaku Gothic Pro", sans-serif; }
|
||
:host-context(.mac:lang(ko)) { font-family: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Nanum Gothic", "AppleGothic", sans-serif; }
|
||
|
||
:host-context(.windows) { font-family: "Segoe WPC", "Segoe UI", sans-serif; }
|
||
:host-context(.windows:lang(zh-Hans)) { font-family: "Segoe WPC", "Segoe UI", "Microsoft YaHei", sans-serif; }
|
||
:host-context(.windows:lang(zh-Hant)) { font-family: "Segoe WPC", "Segoe UI", "Microsoft Jhenghei", sans-serif; }
|
||
:host-context(.windows:lang(ja)) { font-family: "Segoe WPC", "Segoe UI", "Yu Gothic UI", "Meiryo UI", sans-serif; }
|
||
:host-context(.windows:lang(ko)) { font-family: "Segoe WPC", "Segoe UI", "Malgun Gothic", "Dotom", sans-serif; }
|
||
|
||
:host-context(.linux) { font-family: system-ui, "Ubuntu", "Droid Sans", sans-serif; }
|
||
:host-context(.linux:lang(zh-Hans)) { font-family: system-ui, "Ubuntu", "Droid Sans", "Source Han Sans SC", "Source Han Sans CN", "Source Han Sans", sans-serif; }
|
||
:host-context(.linux:lang(zh-Hant)) { font-family: system-ui, "Ubuntu", "Droid Sans", "Source Han Sans TC", "Source Han Sans TW", "Source Han Sans", sans-serif; }
|
||
:host-context(.linux:lang(ja)) { font-family: system-ui, "Ubuntu", "Droid Sans", "Source Han Sans J", "Source Han Sans JP", "Source Han Sans", sans-serif; }
|
||
:host-context(.linux:lang(ko)) { font-family: system-ui, "Ubuntu", "Droid Sans", "Source Han Sans K", "Source Han Sans JR", "Source Han Sans", "UnDotum", "FBaekmuk Gulim", sans-serif; }
|
||
`,Os=le("layoutService");function bR(o){const e=o;return typeof e=="object"&&"markdown"in e&&"markdownNotSupportedFallback"in e}class m7{constructor(e,t,i){this.hoverDelegate=e,this.target=t,this.fadeInAnimation=i}async update(e,t,i){if(this._cancellationTokenSource&&(this._cancellationTokenSource.dispose(!0),this._cancellationTokenSource=void 0),this.isDisposed)return;let n;if(l.isString(e)||Ve(e)||e===void 0)n=e;else{this._cancellationTokenSource=new l.CancellationTokenSource;const s=this._cancellationTokenSource.token;let r;if(bR(e)?l.isFunction(e.markdown)?r=e.markdown(s).then(a=>a??e.markdownNotSupportedFallback):r=e.markdown??e.markdownNotSupportedFallback:r=e.element(s),r instanceof Promise?(this._hoverWidget||this.show(l.localize(1762,"Loading..."),t,i),n=await r):n=r,this.isDisposed||s.isCancellationRequested)return}this.show(n,t,i)}show(e,t,i){const n=this._hoverWidget;if(this.hasContent(e)){const s={content:e,target:this.target,actions:i?.actions,linkHandler:i?.linkHandler,trapFocus:i?.trapFocus,appearance:{showPointer:this.hoverDelegate.placement==="element",skipFadeInAnimation:!this.fadeInAnimation||!!n,showHoverHint:i?.appearance?.showHoverHint},position:{hoverPosition:2}};this._hoverWidget=this.hoverDelegate.showHover(s,t)}n?.dispose()}hasContent(e){return e?Do(e)?!!e.value:!0:!1}get isDisposed(){return this._hoverWidget?.isDisposed}dispose(){this._hoverWidget?.dispose(),this._cancellationTokenSource?.dispose(!0),this._cancellationTokenSource=void 0}}var p7=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},qc=function(o,e){return function(t,i){e(t,i,o)}};const _7=3;let WS=class extends l.Disposable{get _currentHover(){return this._hoverStack.at(-1)?.hover}get _currentHoverOptions(){return this._hoverStack.at(-1)?.options}_getContainingHoverIndex(e){const t=Ve(e)?[e]:e.targetElements;for(let i=this._hoverStack.length-1;i>=0;i--)for(const n of t)if(ut(n,this._hoverStack[i].hover.domNode))return i;return-1}constructor(e,t,i,n,s,r){super(),this._instantiationService=e,this._configurationService=t,this._keybindingService=n,this._layoutService=s,this._accessibilityService=r,this._hoverStack=[],this._currentDelayedHoverWasShown=!1,this._delayedHovers=new Map,this._managedHovers=new Map,this._register(i.onDidShowContextMenu(()=>this.hideHover())),this._register(Zn.registerCommandAndKeybindingRule({id:"workbench.action.showHover",weight:0,primary:l.KeyChord(2089,2087),handler:()=>{this._showAndFocusHoverForActiveElement()}}))}showInstantHover(e,t,i,n){const s=this._createHover(e,i);if(s)return this._showHover(s,e,t),s.hover}showDelayedHover(e,t){if(e.id===void 0&&(e.id=CR(e.content)),!this._currentDelayedHover||this._currentDelayedHoverWasShown){if(this._currentHover?.isLocked&&this._getContainingHoverIndex(e.target)<0)return;if(Yc(this._currentHoverOptions)===Yc(e))return this._currentHover;if(this._currentHover&&!this._currentHover.isDisposed&&this._currentDelayedHoverGroupId!==void 0&&this._currentDelayedHoverGroupId===t?.groupId)return this.showInstantHover({...e,appearance:{...e.appearance,skipFadeInAnimation:!0}})}else if(this._currentDelayedHover&&Yc(this._currentHoverOptions)===Yc(e))return this._currentDelayedHover;const i=this._createHover(e,void 0);if(!i){this._currentDelayedHover=void 0,this._currentDelayedHoverWasShown=!1,this._currentDelayedHoverGroupId=void 0;return}this._currentDelayedHover=i.hover,this._currentDelayedHoverWasShown=!1,this._currentDelayedHoverGroupId=t?.groupId;const n=t?.reducedDelay?this._configurationService.getValue("workbench.hover.reducedDelay"):this._configurationService.getValue("workbench.hover.delay");return l.timeout(n).then(()=>{i.hover&&!i.hover.isDisposed&&(this._currentDelayedHoverWasShown=!0,this._showHover(i,e))}),i.hover}setupDelayedHover(e,t,i){const n=s=>{const r={...typeof t=="function"?t():t,target:e};return r.style===2&&s&&(r.target=wR(e,s)),r};return this._setupDelayedHover(e,n,i)}setupDelayedHoverAtMouse(e,t,i){const n=s=>({...typeof t=="function"?t():t,target:s?wR(e,s):e});return this._setupDelayedHover(e,n,i)}_setupDelayedHover(e,t,i){const n=new l.DisposableStore;return n.add(R(e,F.MOUSE_OVER,s=>{this.showDelayedHover(t(s),{groupId:i?.groupId,reducedDelay:i?.reducedDelay})})),i?.setupKeyboardEvents&&n.add(R(e,F.KEY_DOWN,s=>{const r=new Be(s);(r.equals(10)||r.equals(3))&&this.showInstantHover(t(),!0)})),this._delayedHovers.set(e,{show:s=>{this.showInstantHover(t(),s)}}),n.add(l.toDisposable(()=>this._delayedHovers.delete(e))),n}_createHover(e,t){if(this._currentDelayedHover?.dispose(),this._currentDelayedHover=void 0,e.content==="")return;if(e.id===void 0&&(e.id=CR(e.content)),this._getContainingHoverIndex(e.target)>=0){if(this._hoverStack.length>=_7)return}else if(this._currentHover?.isLocked||Yc(this._currentHoverOptions)===Yc(e))return;this._lastHoverOptions=e;const s=e.trapFocus||this._accessibilityService.isScreenReaderOptimized(),r=wt();let a;t||s&&r&&(r.classList.contains("monaco-hover")||(a=r));const c=new l.DisposableStore,h=this._instantiationService.createInstance(XS,e);if(e.persistence?.sticky&&(h.isLocked=!0),e.position?.hoverPosition&&!l.isNumber(e.position.hoverPosition)&&(e.target={targetElements:Ve(e.target)?[e.target]:e.target.targetElements,x:e.position.hoverPosition.x+10}),h.onDispose(()=>{const d=this._hoverStack.findIndex(u=>u.hover===h);if(d>=0){const u=this._hoverStack[d];for(Zf(h.domNode)&&u.lastFocusedElementBeforeOpen&&u.lastFocusedElementBeforeOpen.focus();this._hoverStack.length>d+1;){const g=this._hoverStack.pop();g.contextView.dispose(),g.hover.dispose()}this._hoverStack.splice(d,1),u.contextView.dispose()}c.dispose()},void 0,c),!e.container){const d=Ve(e.target)?e.target:e.target.targetElements[0];e.container=this._layoutService.getContainer(j(d))}if(c.add(R(j(e.container).document,F.MOUSE_DOWN,d=>{ut(d.target,h.domNode)||this._hideHoverAndDescendants(h)})),!e.persistence?.sticky){if("targetElements"in e.target)for(const u of e.target.targetElements)c.add(R(u,F.CLICK,()=>this._hideHoverAndDescendants(h)));else c.add(R(e.target,F.CLICK,()=>this._hideHoverAndDescendants(h)));const d=wt();if(d){const u=j(d).document;c.add(R(d,F.KEY_DOWN,f=>this._keyDown(f,h,!!e.persistence?.hideOnKeyDown))),c.add(R(u,F.KEY_DOWN,f=>this._keyDown(f,h,!!e.persistence?.hideOnKeyDown))),c.add(R(d,F.KEY_UP,f=>this._keyUp(f,h))),c.add(R(u,F.KEY_UP,f=>this._keyUp(f,h)))}}if("IntersectionObserver"in Ae){const d=new IntersectionObserver(f=>this._intersectionChange(f,h),{threshold:0}),u="targetElements"in e.target?e.target.targetElements[0]:e.target;d.observe(u),c.add(l.toDisposable(()=>d.disconnect()))}return{hover:h,lastFocusedElementBeforeOpen:a,store:c}}_showHover(e,t,i){const{hover:n,lastFocusedElementBeforeOpen:s,store:r}=e,a=this._getContainingHoverIndex(t.target),c=a>=0;if(!c)this._hideAllHovers();else{for(let g=this._hoverStack.length-1;g>a;g--)this._hoverStack[g].hover.dispose();this._hoverStack.length=a+1}if(c)for(let g=0;g<=a;g++)r.add(this._hoverStack[g].hover.addMouseTrackingElement(n.domNode));const h=t.container??this._layoutService.getContainer(j(Ve(t.target)?t.target:t.target.targetElements[0])),d=new fp(h,1),u={hover:n,options:t,contextView:d,lastFocusedElementBeforeOpen:s};this._hoverStack.push(u);const f=new C7(n,i,this._hoverStack.length);if(d.show(f),r.add(n.onRequestLayout(()=>d.layout())),i||t.persistence?.sticky){const g=j(h);r.add(R(g,F.RESIZE,()=>d.layout()))}if(t.onDidHide){const g=t.onDidHide;r.add(l.toDisposable(()=>g()))}t.onDidShow?.()}_hideHoverAndDescendants(e){const t=this._hoverStack.findIndex(i=>i.hover===e);if(!(t<0)){for(let i=this._hoverStack.length-1;i>=t;i--)this._hoverStack[i].hover.dispose();this._hoverStack.length=t}}_hideAllHovers(){for(let e=this._hoverStack.length-1;e>=0;e--)this._hoverStack[e].hover.dispose();this._hoverStack.length=0}hideHover(e){this._hoverStack.length!==0&&(!e&&this._currentHover?.isLocked||this.doHideHover())}doHideHover(){const e=this._hoverStack.length;this._hoverStack[e-1]?.hover.dispose(),this._hoverStack.length=e-1}_intersectionChange(e,t){e[e.length-1].isIntersecting||t.dispose()}showAndFocusLastHover(){this._lastHoverOptions&&this.showInstantHover(this._lastHoverOptions,!0,!0)}_showAndFocusHoverForActiveElement(){let e=wt();for(;e;){const t=this._delayedHovers.get(e)??this._managedHovers.get(e);if(t){t.show(!0);return}e=e.parentElement}}_keyDown(e,t,i){if(e.key==="Alt"){for(const r of this._hoverStack)r.hover.isLocked=!0;return}const n=new Be(e);if(!(this._keybindingService.resolveKeyboardEvent(n).getSingleModifierDispatchChords().some(r=>!!r)||this._keybindingService.softDispatch(n,n.target).kind!==0)&&i&&(!this._currentHoverOptions?.trapFocus||e.key!=="Tab")){const r=this._hoverStack.find(a=>a.hover===t);this._hideHoverAndDescendants(t),r?.lastFocusedElementBeforeOpen?.focus()}}_keyUp(e,t){if(e.key==="Alt"){for(const n of this._hoverStack)n.options.persistence?.sticky||(n.hover.isLocked=!1);if(!this._hoverStack.some(n=>n.hover.isMouseIn)){const n=this._hoverStack[this._hoverStack.length-1];this._hideAllHovers(),n?.lastFocusedElementBeforeOpen?.focus()}}}setupManagedHover(e,t,i,n){if(e.showNativeHover)return b7(t,i);t.setAttribute("custom-hover","true"),t.title!==""&&(console.warn("HTML element already has a title attribute, which will conflict with the custom hover. Please remove the title attribute."),t.title="");let s,r;const a=(g,m)=>{const p=r!==void 0;g&&(r?.dispose(),r=void 0),m&&(s?.dispose(),s=void 0),p&&(e.onDidHideHover?.(),r=void 0)},c=(g,m,p,b)=>new l.TimeoutTimer(async()=>{(!r||r.isDisposed)&&(r=new m7(e,p||t,g>0),await r.update(typeof i=="function"?i():i,m,{...n,trapFocus:b}))},g),h=new l.DisposableStore;let d=!1;h.add(R(t,F.MOUSE_DOWN,()=>{d=!0,a(!0,!0)},!0)),h.add(R(t,F.MOUSE_UP,()=>{d=!1},!0)),h.add(R(t,F.MOUSE_LEAVE,g=>{d=!1,a(!1,g.fromElement===t)},!0)),h.add(R(t,F.MOUSE_OVER,g=>{if(s)return;const m=new l.DisposableStore,p={targetElements:[t],dispose:()=>{}};if(e.placement===void 0||e.placement==="mouse"){const b=v=>{p.x=v.x+10,HS(v,t)||a(!0,!0)};m.add(R(t,F.MOUSE_MOVE,b,!0))}s=m,HS(g,t)&&m.add(c(typeof e.delay=="function"?e.delay(i):e.delay,!1,p))},!0));const u=g=>{if(d||s||(r?.isDisposed&&(r=void 0),Ve(g.relatedTarget)&&g.relatedTarget.closest(".monaco-hover")||!g.relatedTarget)||!HS(g,t))return;const p={targetElements:[t],dispose:()=>{}},b=new l.DisposableStore,v=()=>a(!0,!0);b.add(R(t,F.BLUR,v,!0)),b.add(c(typeof e.delay=="function"?e.delay(i):e.delay,!1,p)),s=b};jn(t)||h.add(R(t,F.FOCUS,u,!0));const f={show:g=>{a(!1,!0),c(0,g,void 0,g)},hide:()=>{a(!0,!0)},update:async(g,m)=>{i=g,await r?.update(i,void 0,m)},dispose:()=>{this._managedHovers.delete(t),h.dispose(),a(!0,!0)}};return this._managedHovers.set(t,f),f}showManagedHover(e){const t=this._managedHovers.get(e);t&&t.show(!0)}dispose(){this._managedHovers.forEach(e=>e.dispose()),super.dispose()}};WS=p7([qc(0,me),qc(1,Ge),qc(2,nn),qc(3,xt),qc(4,Os),qc(5,Ui)],WS);function Yc(o){if(o!==void 0)return o?.id??o}function CR(o){if(!Ve(o))return typeof o=="string"?o.toString():o.value}function vR(o){const e=typeof o=="function"?o():o;if(l.isString(e))return sp(e);if(bR(e))return e.markdownNotSupportedFallback}function b7(o,e){function t(i){i?o.setAttribute("title",i):o.removeAttribute("title")}return t(vR(e)),{update:i=>t(vR(i)),show:()=>{},hide:()=>{},dispose:()=>t(void 0)}}class C7{get anchorPosition(){return this._hover.anchor}constructor(e,t=!1,i=1){this._hover=e,this._focus=t,this.layer=i}render(e){return this._hover.render(e),this._focus&&this._hover.focus(),this._hover}getAnchor(){return{x:this._hover.x,y:this._hover.y}}layout(){this._hover.layout()}}function HS(o,e){return Ve(o.target)&&v7(o.target,e)===e}function v7(o,e){for(e=e??j(o).document.body;!o.hasAttribute("custom-hover")&&o!==e;)o=o.parentElement;return o}function wR(o,e){return{targetElements:[o],x:e.x+10}}fe(kc,WS,1),vs((o,e)=>{const t=o.getColor(FE);t&&(e.addRule(`.monaco-hover.workbench-hover .hover-row:not(:first-child):not(:empty) { border-top: 1px solid ${t.transparent(.5)}; }`),e.addRule(`.monaco-hover.workbench-hover hr { border-top: 1px solid ${t.transparent(.5)}; }`))});const ey=le("dialogService");var w7=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},SR=function(o,e){return function(t,i){e(t,i,o)}};function gp(o){return o.scheme===l.Schemas.file?o.fsPath:o.path}let yR=0;class mp{constructor(e,t,i,n,s,r,a){this.id=++yR,this.type=0,this.actual=e,this.label=e.label,this.confirmBeforeUndo=e.confirmBeforeUndo||!1,this.resourceLabel=t,this.strResource=i,this.resourceLabels=[this.resourceLabel],this.strResources=[this.strResource],this.groupId=n,this.groupOrder=s,this.sourceId=r,this.sourceOrder=a,this.isValid=!0}setValid(e){this.isValid=e}toString(){return`[id:${this.id}] [group:${this.groupId}] [${this.isValid?" VALID":"INVALID"}] ${this.actual.constructor.name} - ${this.actual}`}}class LR{constructor(e,t){this.resourceLabel=e,this.reason=t}}class DR{constructor(){this.elements=new Map}createMessage(){const e=[],t=[];for(const[,n]of this.elements)(n.reason===0?e:t).push(n.resourceLabel);const i=[];return e.length>0&&i.push(l.localize(2099,"The following files have been closed and modified on disk: {0}.",e.join(", "))),t.length>0&&i.push(l.localize(2100,"The following files have been modified in an incompatible way: {0}.",t.join(", "))),i.join(`
|
||
`)}get size(){return this.elements.size}has(e){return this.elements.has(e)}set(e,t){this.elements.set(e,t)}delete(e){return this.elements.delete(e)}}class S7{constructor(e,t,i,n,s,r,a){this.id=++yR,this.type=1,this.actual=e,this.label=e.label,this.confirmBeforeUndo=e.confirmBeforeUndo||!1,this.resourceLabels=t,this.strResources=i,this.groupId=n,this.groupOrder=s,this.sourceId=r,this.sourceOrder=a,this.removedResources=null,this.invalidatedResources=null}canSplit(){return typeof this.actual.split=="function"}removeResource(e,t,i){this.removedResources||(this.removedResources=new DR),this.removedResources.has(t)||this.removedResources.set(t,new LR(e,i))}setValid(e,t,i){i?this.invalidatedResources&&(this.invalidatedResources.delete(t),this.invalidatedResources.size===0&&(this.invalidatedResources=null)):(this.invalidatedResources||(this.invalidatedResources=new DR),this.invalidatedResources.has(t)||this.invalidatedResources.set(t,new LR(e,0)))}toString(){return`[id:${this.id}] [group:${this.groupId}] [${this.invalidatedResources?"INVALID":" VALID"}] ${this.actual.constructor.name} - ${this.actual}`}}class xR{constructor(e,t){this.resourceLabel=e,this.strResource=t,this._past=[],this._future=[],this.locked=!1,this.versionId=1}dispose(){for(const e of this._past)e.type===1&&e.removeResource(this.resourceLabel,this.strResource,0);for(const e of this._future)e.type===1&&e.removeResource(this.resourceLabel,this.strResource,0);this.versionId++}toString(){const e=[];e.push(`* ${this.strResource}:`);for(let t=0;t<this._past.length;t++)e.push(` * [UNDO] ${this._past[t]}`);for(let t=this._future.length-1;t>=0;t--)e.push(` * [REDO] ${this._future[t]}`);return e.join(`
|
||
`)}flushAllElements(){this._past=[],this._future=[],this.versionId++}_setElementValidFlag(e,t){e.type===1?e.setValid(this.resourceLabel,this.strResource,t):e.setValid(t)}setElementsValidFlag(e,t){for(const i of this._past)t(i.actual)&&this._setElementValidFlag(i,e);for(const i of this._future)t(i.actual)&&this._setElementValidFlag(i,e)}pushElement(e){for(const t of this._future)t.type===1&&t.removeResource(this.resourceLabel,this.strResource,1);this._future=[],this._past.push(e),this.versionId++}createSnapshot(e){const t=[];for(let i=0,n=this._past.length;i<n;i++)t.push(this._past[i].id);for(let i=this._future.length-1;i>=0;i--)t.push(this._future[i].id);return new KT(e,t)}restoreSnapshot(e){const t=e.elements.length;let i=!0,n=0,s=-1;for(let a=0,c=this._past.length;a<c;a++,n++){const h=this._past[a];i&&(n>=t||h.id!==e.elements[n])&&(i=!1,s=a),!i&&h.type===1&&h.removeResource(this.resourceLabel,this.strResource,0)}let r=-1;for(let a=this._future.length-1;a>=0;a--,n++){const c=this._future[a];i&&(n>=t||c.id!==e.elements[n])&&(i=!1,r=a),!i&&c.type===1&&c.removeResource(this.resourceLabel,this.strResource,0)}s!==-1&&(this._past=this._past.slice(0,s)),r!==-1&&(this._future=this._future.slice(r+1)),this.versionId++}getElements(){const e=[],t=[];for(const i of this._past)e.push(i.actual);for(const i of this._future)t.push(i.actual);return{past:e,future:t}}getClosestPastElement(){return this._past.length===0?null:this._past[this._past.length-1]}getSecondClosestPastElement(){return this._past.length<2?null:this._past[this._past.length-2]}getClosestFutureElement(){return this._future.length===0?null:this._future[this._future.length-1]}hasPastElements(){return this._past.length>0}hasFutureElements(){return this._future.length>0}splitPastWorkspaceElement(e,t){for(let i=this._past.length-1;i>=0;i--)if(this._past[i]===e){t.has(this.strResource)?this._past[i]=t.get(this.strResource):this._past.splice(i,1);break}this.versionId++}splitFutureWorkspaceElement(e,t){for(let i=this._future.length-1;i>=0;i--)if(this._future[i]===e){t.has(this.strResource)?this._future[i]=t.get(this.strResource):this._future.splice(i,1);break}this.versionId++}moveBackward(e){this._past.pop(),this._future.push(e),this.versionId++}moveForward(e){this._future.pop(),this._past.push(e),this.versionId++}}class ty{constructor(e){this.editStacks=e,this._versionIds=[];for(let t=0,i=this.editStacks.length;t<i;t++)this._versionIds[t]=this.editStacks[t].versionId}isValid(){for(let e=0,t=this.editStacks.length;e<t;e++)if(this._versionIds[e]!==this.editStacks[e].versionId)return!1;return!0}}const ER=new xR("","");ER.locked=!0;let iy=class{constructor(e,t){this._dialogService=e,this._notificationService=t,this._editStacks=new Map,this._uriComparisonKeyComputers=[]}getUriComparisonKey(e){for(const t of this._uriComparisonKeyComputers)if(t[0]===e.scheme)return t[1].getComparisonKey(e);return e.toString()}_print(e){console.log("------------------------------------"),console.log(`AFTER ${e}: `);const t=[];for(const i of this._editStacks)t.push(i[1].toString());console.log(t.join(`
|
||
`))}pushElement(e,t=Cw.None,i=Ma.None){if(e.type===0){const n=gp(e.resource),s=this.getUriComparisonKey(e.resource);this._pushElement(new mp(e,n,s,t.id,t.nextOrder(),i.id,i.nextOrder()))}else{const n=new Set,s=[],r=[];for(const a of e.resources){const c=gp(a),h=this.getUriComparisonKey(a);n.has(h)||(n.add(h),s.push(c),r.push(h))}s.length===1?this._pushElement(new mp(e,s[0],r[0],t.id,t.nextOrder(),i.id,i.nextOrder())):this._pushElement(new S7(e,s,r,t.id,t.nextOrder(),i.id,i.nextOrder()))}}_pushElement(e){for(let t=0,i=e.strResources.length;t<i;t++){const n=e.resourceLabels[t],s=e.strResources[t];let r;this._editStacks.has(s)?r=this._editStacks.get(s):(r=new xR(n,s),this._editStacks.set(s,r)),r.pushElement(e)}}getLastElement(e){const t=this.getUriComparisonKey(e);if(this._editStacks.has(t)){const i=this._editStacks.get(t);if(i.hasFutureElements())return null;const n=i.getClosestPastElement();return n?n.actual:null}return null}_splitPastWorkspaceElement(e,t){const i=e.actual.split(),n=new Map;for(const s of i){const r=gp(s.resource),a=this.getUriComparisonKey(s.resource),c=new mp(s,r,a,0,0,0,0);n.set(c.strResource,c)}for(const s of e.strResources){if(t&&t.has(s))continue;this._editStacks.get(s).splitPastWorkspaceElement(e,n)}}_splitFutureWorkspaceElement(e,t){const i=e.actual.split(),n=new Map;for(const s of i){const r=gp(s.resource),a=this.getUriComparisonKey(s.resource),c=new mp(s,r,a,0,0,0,0);n.set(c.strResource,c)}for(const s of e.strResources){if(t&&t.has(s))continue;this._editStacks.get(s).splitFutureWorkspaceElement(e,n)}}removeElements(e){const t=typeof e=="string"?e:this.getUriComparisonKey(e);this._editStacks.has(t)&&(this._editStacks.get(t).dispose(),this._editStacks.delete(t))}setElementsValidFlag(e,t,i){const n=this.getUriComparisonKey(e);this._editStacks.has(n)&&this._editStacks.get(n).setElementsValidFlag(t,i)}createSnapshot(e){const t=this.getUriComparisonKey(e);return this._editStacks.has(t)?this._editStacks.get(t).createSnapshot(e):new KT(e,[])}restoreSnapshot(e){const t=this.getUriComparisonKey(e.resource);if(this._editStacks.has(t)){const i=this._editStacks.get(t);i.restoreSnapshot(e),!i.hasPastElements()&&!i.hasFutureElements()&&(i.dispose(),this._editStacks.delete(t))}}getElements(e){const t=this.getUriComparisonKey(e);return this._editStacks.has(t)?this._editStacks.get(t).getElements():{past:[],future:[]}}_findClosestUndoElementWithSource(e){if(!e)return[null,null];let t=null,i=null;for(const[n,s]of this._editStacks){const r=s.getClosestPastElement();r&&r.sourceId===e&&(!t||r.sourceOrder>t.sourceOrder)&&(t=r,i=n)}return[t,i]}canUndo(e){if(e instanceof Ma){const[,i]=this._findClosestUndoElementWithSource(e.id);return!!i}const t=this.getUriComparisonKey(e);return this._editStacks.has(t)?this._editStacks.get(t).hasPastElements():!1}_onError(e,t){l.onUnexpectedError(e);for(const i of t.strResources)this.removeElements(i);this._notificationService.error(e)}_acquireLocks(e){for(const t of e.editStacks)if(t.locked)throw new Error("Cannot acquire edit stack lock");for(const t of e.editStacks)t.locked=!0;return()=>{for(const t of e.editStacks)t.locked=!1}}_safeInvokeWithLocks(e,t,i,n,s){const r=this._acquireLocks(i);let a;try{a=t()}catch(c){return r(),n.dispose(),this._onError(c,e)}return a?a.then(()=>(r(),n.dispose(),s()),c=>(r(),n.dispose(),this._onError(c,e))):(r(),n.dispose(),s())}async _invokeWorkspacePrepare(e){if(typeof e.actual.prepareUndoRedo>"u")return l.Disposable.None;const t=e.actual.prepareUndoRedo();return typeof t>"u"?l.Disposable.None:t}_invokeResourcePrepare(e,t){if(e.actual.type!==1||typeof e.actual.prepareUndoRedo>"u")return t(l.Disposable.None);const i=e.actual.prepareUndoRedo();return i?l.isDisposable(i)?t(i):i.then(n=>t(n)):t(l.Disposable.None)}_getAffectedEditStacks(e){const t=[];for(const i of e.strResources)t.push(this._editStacks.get(i)||ER);return new ty(t)}_tryToSplitAndUndo(e,t,i,n){if(t.canSplit())return this._splitPastWorkspaceElement(t,i),this._notificationService.warn(n),new pp(this._undo(e,0,!0));for(const s of t.strResources)this.removeElements(s);return this._notificationService.warn(n),new pp}_checkWorkspaceUndo(e,t,i,n){if(t.removedResources)return this._tryToSplitAndUndo(e,t,t.removedResources,l.localize(2101,"Could not undo '{0}' across all files. {1}",t.label,t.removedResources.createMessage()));if(n&&t.invalidatedResources)return this._tryToSplitAndUndo(e,t,t.invalidatedResources,l.localize(2102,"Could not undo '{0}' across all files. {1}",t.label,t.invalidatedResources.createMessage()));const s=[];for(const a of i.editStacks)a.getClosestPastElement()!==t&&s.push(a.resourceLabel);if(s.length>0)return this._tryToSplitAndUndo(e,t,null,l.localize(2103,"Could not undo '{0}' across all files because changes were made to {1}",t.label,s.join(", ")));const r=[];for(const a of i.editStacks)a.locked&&r.push(a.resourceLabel);return r.length>0?this._tryToSplitAndUndo(e,t,null,l.localize(2104,"Could not undo '{0}' across all files because there is already an undo or redo operation running on {1}",t.label,r.join(", "))):i.isValid()?null:this._tryToSplitAndUndo(e,t,null,l.localize(2105,"Could not undo '{0}' across all files because an undo or redo operation occurred in the meantime",t.label))}_workspaceUndo(e,t,i){const n=this._getAffectedEditStacks(t),s=this._checkWorkspaceUndo(e,t,n,!1);return s?s.returnValue:this._confirmAndExecuteWorkspaceUndo(e,t,n,i)}_isPartOfUndoGroup(e){if(!e.groupId)return!1;for(const[,t]of this._editStacks){const i=t.getClosestPastElement();if(i){if(i===e){const n=t.getSecondClosestPastElement();if(n&&n.groupId===e.groupId)return!0}if(i.groupId===e.groupId)return!0}}return!1}async _confirmAndExecuteWorkspaceUndo(e,t,i,n){if(t.canSplit()&&!this._isPartOfUndoGroup(t)){let a;(function(d){d[d.All=0]="All",d[d.This=1]="This",d[d.Cancel=2]="Cancel"})(a||(a={}));const{result:c}=await this._dialogService.prompt({type:rt.Info,message:l.localize(2106,"Would you like to undo '{0}' across all files?",t.label),buttons:[{label:l.localize(2107,"&&Undo in {0} Files",i.editStacks.length),run:()=>a.All},{label:l.localize(2108,"Undo this &&File"),run:()=>a.This}],cancelButton:{run:()=>a.Cancel}});if(c===a.Cancel)return;if(c===a.This)return this._splitPastWorkspaceElement(t,null),this._undo(e,0,!0);const h=this._checkWorkspaceUndo(e,t,i,!1);if(h)return h.returnValue;n=!0}let s;try{s=await this._invokeWorkspacePrepare(t)}catch(a){return this._onError(a,t)}const r=this._checkWorkspaceUndo(e,t,i,!0);if(r)return s.dispose(),r.returnValue;for(const a of i.editStacks)a.moveBackward(t);return this._safeInvokeWithLocks(t,()=>t.actual.undo(),i,s,()=>this._continueUndoInGroup(t.groupId,n))}_resourceUndo(e,t,i){if(!t.isValid){e.flushAllElements();return}if(e.locked){const n=l.localize(2109,"Could not undo '{0}' because there is already an undo or redo operation running.",t.label);this._notificationService.warn(n);return}return this._invokeResourcePrepare(t,n=>(e.moveBackward(t),this._safeInvokeWithLocks(t,()=>t.actual.undo(),new ty([e]),n,()=>this._continueUndoInGroup(t.groupId,i))))}_findClosestUndoElementInGroup(e){if(!e)return[null,null];let t=null,i=null;for(const[n,s]of this._editStacks){const r=s.getClosestPastElement();r&&r.groupId===e&&(!t||r.groupOrder>t.groupOrder)&&(t=r,i=n)}return[t,i]}_continueUndoInGroup(e,t){if(!e)return;const[,i]=this._findClosestUndoElementInGroup(e);if(i)return this._undo(i,0,t)}undo(e){if(e instanceof Ma){const[,t]=this._findClosestUndoElementWithSource(e.id);return t?this._undo(t,e.id,!1):void 0}return typeof e=="string"?this._undo(e,0,!1):this._undo(this.getUriComparisonKey(e),0,!1)}_undo(e,t=0,i){if(!this._editStacks.has(e))return;const n=this._editStacks.get(e),s=n.getClosestPastElement();if(!s)return;if(s.groupId){const[a,c]=this._findClosestUndoElementInGroup(s.groupId);if(s!==a&&c)return this._undo(c,t,i)}return(s.sourceId!==t||s.confirmBeforeUndo)&&!i?this._confirmAndContinueUndo(e,t,s):s.type===1?this._workspaceUndo(e,s,i):this._resourceUndo(n,s,i)}async _confirmAndContinueUndo(e,t,i){if((await this._dialogService.confirm({message:l.localize(2110,"Would you like to undo '{0}'?",i.label),primaryButton:l.localize(2111,"&&Yes"),cancelButton:l.localize(2112,"No")})).confirmed)return this._undo(e,t,!0)}_findClosestRedoElementWithSource(e){if(!e)return[null,null];let t=null,i=null;for(const[n,s]of this._editStacks){const r=s.getClosestFutureElement();r&&r.sourceId===e&&(!t||r.sourceOrder<t.sourceOrder)&&(t=r,i=n)}return[t,i]}canRedo(e){if(e instanceof Ma){const[,i]=this._findClosestRedoElementWithSource(e.id);return!!i}const t=this.getUriComparisonKey(e);return this._editStacks.has(t)?this._editStacks.get(t).hasFutureElements():!1}_tryToSplitAndRedo(e,t,i,n){if(t.canSplit())return this._splitFutureWorkspaceElement(t,i),this._notificationService.warn(n),new pp(this._redo(e));for(const s of t.strResources)this.removeElements(s);return this._notificationService.warn(n),new pp}_checkWorkspaceRedo(e,t,i,n){if(t.removedResources)return this._tryToSplitAndRedo(e,t,t.removedResources,l.localize(2113,"Could not redo '{0}' across all files. {1}",t.label,t.removedResources.createMessage()));if(n&&t.invalidatedResources)return this._tryToSplitAndRedo(e,t,t.invalidatedResources,l.localize(2114,"Could not redo '{0}' across all files. {1}",t.label,t.invalidatedResources.createMessage()));const s=[];for(const a of i.editStacks)a.getClosestFutureElement()!==t&&s.push(a.resourceLabel);if(s.length>0)return this._tryToSplitAndRedo(e,t,null,l.localize(2115,"Could not redo '{0}' across all files because changes were made to {1}",t.label,s.join(", ")));const r=[];for(const a of i.editStacks)a.locked&&r.push(a.resourceLabel);return r.length>0?this._tryToSplitAndRedo(e,t,null,l.localize(2116,"Could not redo '{0}' across all files because there is already an undo or redo operation running on {1}",t.label,r.join(", "))):i.isValid()?null:this._tryToSplitAndRedo(e,t,null,l.localize(2117,"Could not redo '{0}' across all files because an undo or redo operation occurred in the meantime",t.label))}_workspaceRedo(e,t){const i=this._getAffectedEditStacks(t),n=this._checkWorkspaceRedo(e,t,i,!1);return n?n.returnValue:this._executeWorkspaceRedo(e,t,i)}async _executeWorkspaceRedo(e,t,i){let n;try{n=await this._invokeWorkspacePrepare(t)}catch(r){return this._onError(r,t)}const s=this._checkWorkspaceRedo(e,t,i,!0);if(s)return n.dispose(),s.returnValue;for(const r of i.editStacks)r.moveForward(t);return this._safeInvokeWithLocks(t,()=>t.actual.redo(),i,n,()=>this._continueRedoInGroup(t.groupId))}_resourceRedo(e,t){if(!t.isValid){e.flushAllElements();return}if(e.locked){const i=l.localize(2118,"Could not redo '{0}' because there is already an undo or redo operation running.",t.label);this._notificationService.warn(i);return}return this._invokeResourcePrepare(t,i=>(e.moveForward(t),this._safeInvokeWithLocks(t,()=>t.actual.redo(),new ty([e]),i,()=>this._continueRedoInGroup(t.groupId))))}_findClosestRedoElementInGroup(e){if(!e)return[null,null];let t=null,i=null;for(const[n,s]of this._editStacks){const r=s.getClosestFutureElement();r&&r.groupId===e&&(!t||r.groupOrder<t.groupOrder)&&(t=r,i=n)}return[t,i]}_continueRedoInGroup(e){if(!e)return;const[,t]=this._findClosestRedoElementInGroup(e);if(t)return this._redo(t)}redo(e){if(e instanceof Ma){const[,t]=this._findClosestRedoElementWithSource(e.id);return t?this._redo(t):void 0}return typeof e=="string"?this._redo(e):this._redo(this.getUriComparisonKey(e))}_redo(e){if(!this._editStacks.has(e))return;const t=this._editStacks.get(e),i=t.getClosestFutureElement();if(i){if(i.groupId){const[n,s]=this._findClosestRedoElementInGroup(i.groupId);if(i!==n&&s)return this._redo(s)}return i.type===1?this._workspaceRedo(e,i):this._resourceRedo(t,i)}}};iy=w7([SR(0,ey),SR(1,yn)],iy);class pp{constructor(e){this.returnValue=e}}fe(bw,iy,1);function y7(o){return o.ctrlCmd||o.alt||o.shift}const L7={ctrlCmd:!1,alt:!1,shift:!1};var ku;(function(o){o[o.Blur=1]="Blur",o[o.Gesture=2]="Gesture",o[o.Other=3]="Other"})(ku||(ku={})),_.ItemActivation=void 0,(function(o){o[o.NONE=0]="NONE",o[o.FIRST=1]="FIRST",o[o.SECOND=2]="SECOND",o[o.LAST=3]="LAST"})(_.ItemActivation||(_.ItemActivation={}));var xe;(function(o){o[o.First=1]="First",o[o.Second=2]="Second",o[o.Last=3]="Last",o[o.Next=4]="Next",o[o.Previous=5]="Previous",o[o.NextPage=6]="NextPage",o[o.PreviousPage=7]="PreviousPage",o[o.NextSeparator=8]="NextSeparator",o[o.PreviousSeparator=9]="PreviousSeparator"})(xe||(xe={})),_.QuickInputButtonLocation=void 0,(function(o){o[o.Title=1]="Title",o[o.Inline=2]="Inline",o[o.Input=3]="Input"})(_.QuickInputButtonLocation||(_.QuickInputButtonLocation={}));const Ps=le("quickInputService");var Ya;(function(o){o[o.STORAGE_DOES_NOT_EXIST=0]="STORAGE_DOES_NOT_EXIST",o[o.STORAGE_IN_MEMORY=1]="STORAGE_IN_MEMORY"})(Ya||(Ya={}));var Za;(function(o){o[o.None=0]="None",o[o.Initialized=1]="Initialized",o[o.Closed=2]="Closed"})(Za||(Za={}));const cb=class cb extends l.Disposable{constructor(e,t=Object.create(null)){super(),this.database=e,this.options=t,this._onDidChangeStorage=this._register(new l.PauseableEmitter),this.onDidChangeStorage=this._onDidChangeStorage.event,this.state=Za.None,this.cache=new Map,this.flushDelayer=this._register(new l.ThrottledDelayer(cb.DEFAULT_FLUSH_DELAY)),this.pendingDeletes=new Set,this.pendingInserts=new Map,this.pendingClose=void 0,this.whenFlushedCallbacks=[],this.registerListeners()}registerListeners(){this._register(this.database.onDidChangeItemsExternal(e=>this.onDidChangeItemsExternal(e)))}onDidChangeItemsExternal(e){this._onDidChangeStorage.pause();try{e.changed?.forEach((t,i)=>this.acceptExternal(i,t)),e.deleted?.forEach(t=>this.acceptExternal(t,void 0))}finally{this._onDidChangeStorage.resume()}}acceptExternal(e,t){if(this.state===Za.Closed)return;let i=!1;l.isUndefinedOrNull(t)?i=this.cache.delete(e):this.cache.get(e)!==t&&(this.cache.set(e,t),i=!0),i&&this._onDidChangeStorage.fire({key:e,external:!0})}get(e,t){const i=this.cache.get(e);return l.isUndefinedOrNull(i)?t:i}getBoolean(e,t){const i=this.get(e);return l.isUndefinedOrNull(i)?t:i==="true"}getNumber(e,t){const i=this.get(e);return l.isUndefinedOrNull(i)?t:parseInt(i,10)}async set(e,t,i=!1){if(this.state===Za.Closed)return;if(l.isUndefinedOrNull(t))return this.delete(e,i);const n=l.isObject(t)||Array.isArray(t)?ZG(t):String(t);if(this.cache.get(e)!==n)return this.cache.set(e,n),this.pendingInserts.set(e,n),this.pendingDeletes.delete(e),this._onDidChangeStorage.fire({key:e,external:i}),this.doFlush()}async delete(e,t=!1){if(!(this.state===Za.Closed||!this.cache.delete(e)))return this.pendingDeletes.has(e)||this.pendingDeletes.add(e),this.pendingInserts.delete(e),this._onDidChangeStorage.fire({key:e,external:t}),this.doFlush()}get hasPending(){return this.pendingInserts.size>0||this.pendingDeletes.size>0}async flushPending(){if(!this.hasPending)return;const e={insert:this.pendingInserts,delete:this.pendingDeletes};return this.pendingDeletes=new Set,this.pendingInserts=new Map,this.database.updateItems(e).finally(()=>{if(!this.hasPending)for(;this.whenFlushedCallbacks.length;)this.whenFlushedCallbacks.pop()?.()})}async flush(e){if(!(this.state===Za.Closed||this.pendingClose))return this.doFlush(e)}async doFlush(e){return this.options.hint===Ya.STORAGE_IN_MEMORY?this.flushPending():this.flushDelayer.trigger(()=>this.flushPending(),e)}async whenFlushed(){if(this.hasPending)return new Promise(e=>this.whenFlushedCallbacks.push(e))}};cb.DEFAULT_FLUSH_DELAY=100;let Zc=cb;class _p{constructor(){this.onDidChangeItemsExternal=l.Event.None,this.items=new Map}async updateItems(e){e.insert?.forEach((t,i)=>this.items.set(i,t)),e.delete?.forEach(t=>this.items.delete(t))}}const bp="__$__targetStorageMarker",Qa=le("storageService");_.WillSaveStateReason=void 0,(function(o){o[o.NONE=0]="NONE",o[o.SHUTDOWN=1]="SHUTDOWN"})(_.WillSaveStateReason||(_.WillSaveStateReason={}));function D7(o){const e=o.get(bp);if(e)try{return JSON.parse(e)}catch{}return Object.create(null)}const hb=class hb extends l.Disposable{constructor(e={flushInterval:hb.DEFAULT_FLUSH_INTERVAL}){super(),this._onDidChangeValue=this._register(new l.PauseableEmitter),this._onDidChangeTarget=this._register(new l.PauseableEmitter),this._onWillSaveState=this._register(new l.Emitter),this.onWillSaveState=this._onWillSaveState.event,this.runFlushWhenIdle=this._register(new l.MutableDisposable),this._workspaceKeyTargets=void 0,this._profileKeyTargets=void 0,this._applicationKeyTargets=void 0,this._applicationSharedKeyTargets=void 0,this.flushWhenIdleScheduler=this._register(new l.RunOnceScheduler(()=>this.doFlushWhenIdle(),e.flushInterval))}onDidChangeValue(e,t,i){return l.Event.filter(this._onDidChangeValue.event,n=>n.scope===e&&(t===void 0||n.key===t),i)}doFlushWhenIdle(){this.runFlushWhenIdle.value=l.runWhenGlobalIdle(()=>{this.shouldFlushWhenIdle()&&this.flush(),this.flushWhenIdleScheduler.schedule()})}shouldFlushWhenIdle(){return!0}emitDidChangeValue(e,t){const{key:i,external:n}=t;if(i===bp){switch(e){case-2:this._applicationSharedKeyTargets=void 0;break;case-1:this._applicationKeyTargets=void 0;break;case 0:this._profileKeyTargets=void 0;break;case 1:this._workspaceKeyTargets=void 0;break}this._onDidChangeTarget.fire({scope:e})}else this._onDidChangeValue.fire({scope:e,key:i,target:this.getKeyTargets(e)[i],external:n})}get(e,t,i){return this.getStorage(t)?.get(e,i)}getBoolean(e,t,i){return this.getStorage(t)?.getBoolean(e,i)}getNumber(e,t,i){return this.getStorage(t)?.getNumber(e,i)}store(e,t,i,n,s=!1){if(l.isUndefinedOrNull(t)){this.remove(e,i,s);return}this.withPausedEmitters(()=>{this.updateKeyTarget(e,i,n),this.getStorage(i)?.set(e,t,s)})}remove(e,t,i=!1){this.withPausedEmitters(()=>{this.updateKeyTarget(e,t,void 0),this.getStorage(t)?.delete(e,i)})}withPausedEmitters(e){this._onDidChangeValue.pause(),this._onDidChangeTarget.pause();try{e()}finally{this._onDidChangeValue.resume(),this._onDidChangeTarget.resume()}}updateKeyTarget(e,t,i,n=!1){const s=this.getKeyTargets(t);typeof i=="number"?s[e]!==i&&(s[e]=i,this.getStorage(t)?.set(bp,JSON.stringify(s),n)):typeof s[e]=="number"&&(delete s[e],this.getStorage(t)?.set(bp,JSON.stringify(s),n))}get workspaceKeyTargets(){return this._workspaceKeyTargets||(this._workspaceKeyTargets=this.loadKeyTargets(1)),this._workspaceKeyTargets}get profileKeyTargets(){return this._profileKeyTargets||(this._profileKeyTargets=this.loadKeyTargets(0)),this._profileKeyTargets}get applicationKeyTargets(){return this._applicationKeyTargets||(this._applicationKeyTargets=this.loadKeyTargets(-1)),this._applicationKeyTargets}get applicationSharedKeyTargets(){return this._applicationSharedKeyTargets||(this._applicationSharedKeyTargets=this.loadKeyTargets(-2)),this._applicationSharedKeyTargets}getKeyTargets(e){switch(e){case-2:return this.applicationSharedKeyTargets;case-1:return this.applicationKeyTargets;case 0:return this.profileKeyTargets;default:return this.workspaceKeyTargets}}loadKeyTargets(e){const t=this.getStorage(e);return t?D7(t):Object.create(null)}async flush(e=_.WillSaveStateReason.NONE){this._onWillSaveState.fire({reason:e});const t=this.getStorage(-1),i=this.getStorage(-2),n=this.getStorage(0),s=this.getStorage(1);switch(e){case _.WillSaveStateReason.NONE:await l.Promises.settled([t?.whenFlushed()??Promise.resolve(),i?.whenFlushed()??Promise.resolve(),n?.whenFlushed()??Promise.resolve(),s?.whenFlushed()??Promise.resolve()]);break;case _.WillSaveStateReason.SHUTDOWN:await l.Promises.settled([t?.flush(0)??Promise.resolve(),i?.flush(0)??Promise.resolve(),n?.flush(0)??Promise.resolve(),s?.flush(0)??Promise.resolve()]);break}}};hb.DEFAULT_FLUSH_INTERVAL=60*1e3;let ny=hb;class x7 extends ny{constructor(){super(),this.applicationStorage=this._register(new Zc(new _p,{hint:Ya.STORAGE_IN_MEMORY})),this.applicationSharedStorage=this._register(new Zc(new _p,{hint:Ya.STORAGE_IN_MEMORY})),this.profileStorage=this._register(new Zc(new _p,{hint:Ya.STORAGE_IN_MEMORY})),this.workspaceStorage=this._register(new Zc(new _p,{hint:Ya.STORAGE_IN_MEMORY})),this._register(this.workspaceStorage.onDidChangeStorage(e=>this.emitDidChangeValue(1,e))),this._register(this.profileStorage.onDidChangeStorage(e=>this.emitDidChangeValue(0,e))),this._register(this.applicationStorage.onDidChangeStorage(e=>this.emitDidChangeValue(-1,e))),this._register(this.applicationSharedStorage.onDidChangeStorage(e=>this.emitDidChangeValue(-2,e)))}getStorage(e){switch(e){case-2:return this.applicationSharedStorage;case-1:return this.applicationStorage;case 0:return this.profileStorage;default:return this.workspaceStorage}}shouldFlushWhenIdle(){return!1}}var E7=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},IR=function(o,e){return function(t,i){e(t,i,o)}};const Cp=le("IInlineCompletionsService"),TR=new q("inlineCompletions.snoozed",!1,l.localize(83,"Whether inline completions are currently snoozed"));let sy=class extends l.Disposable{get snoozeTimeLeft(){return this._snoozeTimeEnd===void 0?0:Math.max(0,this._snoozeTimeEnd-Date.now())}constructor(e,t){super(),this._contextKeyService=e,this._telemetryService=t,this._onDidChangeIsSnoozing=this._register(new l.Emitter),this.onDidChangeIsSnoozing=this._onDidChangeIsSnoozing.event,this._snoozeTimeEnd=void 0,this._recentCompletionIds=[],this._timer=this._register(new l.TimeoutTimer);const i=TR.bindTo(this._contextKeyService);this._register(this.onDidChangeIsSnoozing(()=>i.set(this.isSnoozing())))}setSnoozeDuration(e){if(e<0)throw new l.BugIndicatingError(`Invalid snooze duration: ${e}. Duration must be non-negative.`);if(e===0){this.cancelSnooze();return}const t=this.isSnoozing(),i=this.snoozeTimeLeft;this._snoozeTimeEnd=Date.now()+e,t||this._onDidChangeIsSnoozing.fire(!0),this._timer.cancelAndSet(()=>{if(!this.isSnoozing())this._onDidChangeIsSnoozing.fire(!1);else throw new l.BugIndicatingError("Snooze timer did not fire as expected")},this.snoozeTimeLeft+1),this._reportSnooze(e-i,e)}isSnoozing(){return this.snoozeTimeLeft>0}cancelSnooze(){this.isSnoozing()&&(this._reportSnooze(-this.snoozeTimeLeft,0),this._snoozeTimeEnd=void 0,this._timer.cancel(),this._onDidChangeIsSnoozing.fire(!1))}reportNewCompletion(e){this._lastCompletionId=e,this._recentCompletionIds.unshift(e),this._recentCompletionIds.length>5&&this._recentCompletionIds.pop()}_reportSnooze(e,t){const i=Math.round(e/1e3),n=Math.round(t/1e3);this._telemetryService.publicLog2("inlineCompletions.snooze",{deltaSeconds:i,totalSeconds:n,lastCompletionId:this._lastCompletionId,recentCompletionIds:this._recentCompletionIds})}};sy=E7([IR(0,be),IR(1,Xn)],sy),fe(Cp,sy,1);const I7="editor.action.inlineSuggest.snooze",T7="editor.action.inlineSuggest.cancelSnooze",oy="inlineCompletions.lastSnoozeDuration",db=class db extends hg{constructor(){super({id:db.ID,title:l.localize2(97,"Snooze Inline Suggestions"),precondition:de.true(),f1:!0})}async run(e,...t){const i=e.get(Ps),n=e.get(Cp),s=e.get(Qa);let r;t.length>0&&typeof t[0]=="number"&&(r=t[0]*6e4),r||(r=await this.getDurationFromUser(i,s)),r&&n.setSnoozeDuration(r)}async getDurationFromUser(e,t){const i=t.getNumber(oy,0,3e5),n=[{label:l.localize(84,"1 minute"),id:"1",value:6e4},{label:l.localize(85,"5 minutes"),id:"5",value:3e5},{label:l.localize(86,"10 minutes"),id:"10",value:6e5},{label:l.localize(87,"15 minutes"),id:"15",value:9e5},{label:l.localize(88,"30 minutes"),id:"30",value:18e5},{label:l.localize(89,"60 minutes"),id:"60",value:36e5}];let s=n;if(i>0&&!n.some(a=>a.value===i)){const a=i/6e4,c={label:l.localize(90,"{0} minutes (Last used)",a),id:"last-custom",value:i,description:l.localize(91,"Last used custom duration")},h=n.findIndex(d=>d.value>i);h===-1?s=[...n,c]:s=[...n.slice(0,h),c,...n.slice(h)]}s.push({label:l.localize(92,"Custom..."),id:"custom",value:-1});const r=await e.pick(s,{placeHolder:l.localize(93,"Select snooze duration for Inline Suggestions"),activeItem:s.find(a=>a.value===i)});if(r)return r.id==="custom"?this.getCustomDurationFromUser(e,t):(t.store(oy,r.value,0,0),r.value)}async getCustomDurationFromUser(e,t){const i=await e.input({placeHolder:l.localize(94,"Duration in minutes (e.g. 90)"),prompt:l.localize(95,"Enter snooze duration in minutes"),validateInput:async n=>{const s=Number(n);if(isNaN(s)||s<=0||!Number.isFinite(s))return l.localize(96,"Please enter a positive number")}});if(i){const n=Number(i)*6e4;return t.store(oy,n,0,0),n}}};db.ID=I7;let ry=db;const ub=class ub extends hg{constructor(){super({id:ub.ID,title:l.localize2(98,"Cancel Snooze Inline Suggestions"),precondition:TR,f1:!0})}async run(e){e.get(Cp).cancelSnooze()}};ub.ID=T7;let ay=ub;function wi(o,e,t){return Math.min(Math.max(o,e),t)}class NR{constructor(){this._n=1,this._val=0}update(e){return this._val=this._val+(e-this._val)/this._n,this._n+=1,this._val}get value(){return this._val}}class N7{constructor(e){this._n=0,this._val=0,this._values=[],this._index=0,this._sum=0,this._values=new Array(e),this._values.fill(0,0,e)}update(e){const t=this._values[this._index];return this._values[this._index]=e,this._index=(this._index+1)%this._values.length,this._sum-=t,this._sum+=e,this._n<this._values.length&&(this._n+=1),this._val=this._sum/this._n,this._val}get value(){return this._val}}const ly=le("environmentService");var R7=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},RR=function(o,e){return function(t,i){e(t,i,o)}};const MR=le("ILanguageFeatureDebounceService");var vp;(function(o){const e=new WeakMap;let t=0;function i(n){let s=e.get(n);return s===void 0&&(s=++t,e.set(n,s)),s}o.of=i})(vp||(vp={}));class M7{constructor(e){this._default=e}get(e){return this._default}update(e,t){return this._default}default(){return this._default}}class A7{constructor(e,t,i,n,s,r){this._logService=e,this._name=t,this._registry=i,this._default=n,this._min=s,this._max=r,this._cache=new l.LRUCache(50,.7)}_key(e){return e.id+this._registry.all(e).reduce((t,i)=>l.doHash(vp.of(i),t),0)}get(e){const t=this._key(e),i=this._cache.get(t);return i?wi(i.value,this._min,this._max):this.default()}update(e,t){const i=this._key(e);let n=this._cache.get(i);n||(n=new N7(6),this._cache.set(i,n));const s=wi(n.update(t),this._min,this._max);return l.matchesScheme(e.uri,"output")||this._logService.trace(`[DEBOUNCE: ${this._name}] for ${e.uri.toString()} is ${s}ms`),s}_overall(){const e=new NR;for(const[,t]of this._cache)e.update(t.value);return e.value}default(){const e=this._overall()|0||this._default;return wi(e,this._min,this._max)}}let cy=class{constructor(e,t){this._logService=e,this._data=new Map,this._isDev=t.isExtensionDevelopment||!t.isBuilt}for(e,t,i){const n=i?.min??50,s=i?.max??n**2,r=i?.key??void 0,a=`${vp.of(e)},${n}${r?","+r:""}`;let c=this._data.get(a);return c||(this._isDev?(this._logService.debug(`[DEBOUNCE: ${t}] is disabled in developed mode`),c=new M7(n*1.5)):c=new A7(this._logService,t,e,this._overallAverage()|0||n*1.5,n,s),this._data.set(a,c)),c}_overallAverage(){const e=new NR;for(const t of this._data.values())e.update(t.default());return e.value}};cy=R7([RR(0,ei),RR(1,ly)],cy),fe(MR,cy,1);const wp="**",AR="/",Sp="[/\\\\]",yp="[^/\\\\]",O7=/\//g;function OR(o,e){switch(o){case 0:return"";case 1:return`${yp}*?`;default:return`(?:${Sp}|${yp}+${Sp}${e?`|${Sp}${yp}+`:""})*?`}}function PR(o,e){if(!o)return[];const t=[];let i=!1,n=!1,s="";for(const r of o){switch(r){case e:if(!i&&!n){t.push(s),s="";continue}break;case"{":i=!0;break;case"}":i=!1;break;case"[":n=!0;break;case"]":n=!1;break}s+=r}return s&&t.push(s),t}function kR(o){if(!o)return"";let e="";const t=PR(o,AR);if(t.every(i=>i===wp))e=".*";else{let i=!1;t.forEach((n,s)=>{if(n===wp){if(i)return;e+=OR(2,s===t.length-1)}else{let r=!1,a="",c=!1,h="";for(const d of n){if(d!=="}"&&r){a+=d;continue}if(c&&(d!=="]"||!h)){let u;d==="-"?u=d:(d==="^"||d==="!")&&!h?u="^":d===AR?u="":u=l.escapeRegExpCharacters(d),h+=u;continue}switch(d){case"{":r=!0;continue;case"[":c=!0;continue;case"}":{const f=`(?:${PR(a,",").map(g=>kR(g)).join("|")})`;e+=f,r=!1,a="";break}case"]":{e+="["+h+"]",c=!1,h="";break}case"?":e+=yp;continue;case"*":e+=OR(1);continue;default:e+=l.escapeRegExpCharacters(d)}}s<t.length-1&&(t[s+1]!==wp||s+2<t.length)&&(e+=Sp)}i=n===wp})}return e}const P7=/^\*\*\/\*\.[\w\.-]+$/,k7=/^\*\*\/([\w\.-]+)\/?$/,F7=/^{\*\*\/\*?[\w\.-]+\/?(,\*\*\/\*?[\w\.-]+\/?)*}$/,B7=/^{\*\*\/\*?[\w\.-]+(\/(\*\*)?)?(,\*\*\/\*?[\w\.-]+(\/(\*\*)?)?)*}$/,z7=/^\*\*((\/[\w\.-]+)+)\/?$/,V7=/^([\w\.-]+(\/[\w\.-]+)*)\/?$/,FR=new l.LRUCache(1e4),BR=function(){return!1},ks=function(){return null};function hy(o,e){if(!o)return ks;let t;typeof o!="string"?t=o.pattern:t=o,t=t.trim();const i=e.ignoreCase??!1,n={...e,equals:i?l.equalsIgnoreCase:(c,h)=>c===h,endsWith:i?l.endsWithIgnoreCase:(c,h)=>c.endsWith(h),isEqualOrParent:(c,h)=>pC(c,h,e.ignoreCase??!l.isLinux)},s=`${i?t.toLowerCase():t}_${!!e.trimForExclusions}_${i}`;let r=FR.get(s);if(r)return zR(r,o,n);let a;return P7.test(t)?r=U7(t.substring(4),t,n):(a=k7.exec(dy(t,n)))?r=$7(a[1],t,n):(e.trimForExclusions?B7:F7).test(t)?r=K7(t,n):(a=z7.exec(dy(t,n)))?r=VR(a[1].substring(1),t,!0,n):(a=V7.exec(dy(t,n)))?r=VR(a[1],t,!1,n):r=G7(t,n),FR.set(s,r),zR(r,o,n)}function zR(o,e,t){if(typeof e=="string")return o;const i=function(n,s){return t.isEqualOrParent(n,e.base)?o(l.ltrim(n.substring(e.base.length),l.sep),s):null};return i.allBasenames=o.allBasenames,i.allPaths=o.allPaths,i.basenames=o.basenames,i.patterns=o.patterns,i}function dy(o,e){return e.trimForExclusions&&o.endsWith("/**")?o.substring(0,o.length-2):o}function U7(o,e,t){return function(i,n){return typeof i=="string"&&t.endsWith(i,o)?e:null}}function $7(o,e,t){const i=`/${o}`,n=`\\${o}`,s=function(a,c){return typeof a!="string"?null:c?t.equals(c,o)?e:null:t.equals(a,o)||t.endsWith(a,i)||t.endsWith(a,n)?e:null},r=[o];return s.basenames=r,s.patterns=[e],s.allBasenames=r,s}function K7(o,e){const t=$R(o.slice(1,-1).split(",").map(a=>hy(a,e)).filter(a=>a!==ks),o),i=t.length;if(!i)return ks;if(i===1)return t[0];const n=function(a,c){for(let h=0,d=t.length;h<d;h++)if(t[h](a,c))return o;return null},s=t.find(a=>!!a.allBasenames);s&&(n.allBasenames=s.allBasenames);const r=t.reduce((a,c)=>c.allPaths?a.concat(c.allPaths):a,[]);return r.length&&(n.allPaths=r),n}function VR(o,e,t,i){const n=l.sep===l.posix.sep,s=n?o:o.replace(O7,l.sep),r=l.sep+s,a=l.posix.sep+o;let c;return t?c=function(h,d){return typeof h=="string"&&(i.equals(h,s)||i.endsWith(h,r)||!n&&(i.equals(h,o)||i.endsWith(h,a)))?e:null}:c=function(h,d){return typeof h=="string"&&(i.equals(h,s)||!n&&i.equals(h,o))?e:null},c.allPaths=[(t?"*/":"./")+o],c}function G7(o,e){try{const t=new RegExp(`^${kR(o)}$`,e.ignoreCase?"i":void 0);return function(i){return t.lastIndex=0,typeof i=="string"&&t.test(i)?o:null}}catch{return ks}}function j7(o,e,t){return!o||typeof e!="string"?!1:UR(o,t)(e)}function UR(o,e={}){if(!o)return BR;if(typeof o=="string"||q7(o)){const t=hy(o,e);if(t===ks)return BR;const i=function(n,s){return!!t(n,s)};return t.allBasenames&&(i.allBasenames=t.allBasenames),t.allPaths&&(i.allPaths=t.allPaths),i}return Y7(o,e)}function q7(o){const e=o;return e?typeof e.base=="string"&&typeof e.pattern=="string":!1}function Y7(o,e){const t=$R(Object.getOwnPropertyNames(o).map(a=>Z7(a,o[a],e)).filter(a=>a!==ks)),i=t.length;if(!i)return ks;if(!t.some(a=>!!a.requiresSiblings)){if(i===1)return t[0];const a=function(d,u){let f;for(let g=0,m=t.length;g<m;g++){const p=t[g](d,u);if(typeof p=="string")return p;l.isThenable(p)&&(f||(f=[]),f.push(p))}return f?(async()=>{for(const g of f){const m=await g;if(typeof m=="string")return m}return null})():null},c=t.find(d=>!!d.allBasenames);c&&(a.allBasenames=c.allBasenames);const h=t.reduce((d,u)=>u.allPaths?d.concat(u.allPaths):d,[]);return h.length&&(a.allPaths=h),a}const n=function(a,c,h){let d,u;for(let f=0,g=t.length;f<g;f++){const m=t[f];m.requiresSiblings&&h&&(c||(c=l.basename(a)),d||(d=c.substring(0,c.length-l.extname(a).length)));const p=m(a,c,d,h);if(typeof p=="string")return p;l.isThenable(p)&&(u||(u=[]),u.push(p))}return u?(async()=>{for(const f of u){const g=await f;if(typeof g=="string")return g}return null})():null},s=t.find(a=>!!a.allBasenames);s&&(n.allBasenames=s.allBasenames);const r=t.reduce((a,c)=>c.allPaths?a.concat(c.allPaths):a,[]);return r.length&&(n.allPaths=r),n}function Z7(o,e,t){if(e===!1)return ks;const i=hy(o,t);if(i===ks)return ks;if(typeof e=="boolean")return i;if(e){const n=e.when;if(typeof n=="string"){const s=(r,a,c,h)=>{if(!h||!i(r,a))return null;const d=n.replace("$(basename)",()=>c),u=h(d);return l.isThenable(u)?u.then(f=>f?o:null):u?o:null};return s.requiresSiblings=!0,s}}return i}function $R(o,e){const t=o.filter(a=>!!a.basenames);if(t.length<2)return o;const i=t.reduce((a,c)=>{const h=c.basenames;return h?a.concat(h):a},[]);let n;if(e){n=[];for(let a=0,c=i.length;a<c;a++)n.push(e)}else n=t.reduce((a,c)=>{const h=c.patterns;return h?a.concat(h):a},[]);const s=function(a,c){if(typeof a!="string")return null;if(!c){let d;for(d=a.length;d>0;d--){const u=a.charCodeAt(d-1);if(u===47||u===92)break}c=a.substring(d)}const h=i.indexOf(c);return h!==-1?n[h]:null};s.basenames=i,s.patterns=n,s.allBasenames=i;const r=o.filter(a=>!a.basenames);return r.push(s),r}function uy(o,e,t,i,n,s){if(Array.isArray(o)){let r=0;for(const a of o){const c=uy(a,e,t,i,n,s);if(c===10)return c;c>r&&(r=c)}return r}else{if(typeof o=="string")return i?o==="*"?5:o===t?10:0:0;if(o){const{language:r,pattern:a,scheme:c,hasAccessToAllModels:h,notebookType:d}=o;if(!i&&!h)return 0;d&&n&&(e=n);let u=0;if(c)if(c===e.scheme)u=10;else if(c==="*")u=5;else return 0;if(r)if(r===t)u=10;else if(r==="*")u=Math.max(u,5);else return 0;if(d)if(d===s)u=10;else if(d==="*"&&s!==void 0)u=Math.max(u,5);else return 0;if(a){let f;if(typeof a=="string"?f=a:f={...a,base:l.normalize(a.base)},f===e.fsPath||j7(f,e.fsPath))u=10;else return 0}return u}else return 0}}function KR(o){return typeof o=="string"?!1:Array.isArray(o)?o.every(KR):!!o.exclusive}class GR{constructor(e,t,i,n,s){this.uri=e,this.languageId=t,this.notebookUri=i,this.notebookType=n,this.recursive=s}equals(e){return this.notebookType===e.notebookType&&this.languageId===e.languageId&&this.uri.toString()===e.uri.toString()&&this.notebookUri?.toString()===e.notebookUri?.toString()&&this.recursive===e.recursive}}class Je{get onDidChange(){return this._onDidChange.event}constructor(e){this._notebookInfoResolver=e,this._clock=0,this._entries=[],this._onDidChange=new l.Emitter}register(e,t){let i={selector:e,provider:t,_score:-1,_time:this._clock++};return this._entries.push(i),this._lastCandidate=void 0,this._onDidChange.fire(this._entries.length),l.toDisposable(()=>{if(i){const n=this._entries.indexOf(i);n>=0&&(this._entries.splice(n,1),this._lastCandidate=void 0,this._onDidChange.fire(this._entries.length),i=void 0)}})}has(e){return this.all(e).length>0}all(e){if(!e)return[];this._updateScores(e,!1);const t=[];for(const i of this._entries)i._score>0&&t.push(i.provider);return t}allNoModel(){return this._entries.map(e=>e.provider)}ordered(e,t=!1){const i=[];return this._orderedForEach(e,t,n=>i.push(n.provider)),i}orderedGroups(e){const t=[];let i,n;return this._orderedForEach(e,!1,s=>{i&&n===s._score?i.push(s.provider):(n=s._score,i=[s.provider],t.push(i))}),t}_orderedForEach(e,t,i){this._updateScores(e,t);for(const n of this._entries)n._score>0&&i(n)}_updateScores(e,t){const i=this._notebookInfoResolver?.(e.uri),n=i?new GR(e.uri,e.getLanguageId(),i.uri,i.type,t):new GR(e.uri,e.getLanguageId(),void 0,void 0,t);if(!this._lastCandidate?.equals(n)){this._lastCandidate=n;for(const s of this._entries)if(s._score=uy(s.selector,n.uri,n.languageId,l.shouldSynchronizeModel(e),n.notebookUri,n.notebookType),KR(s.selector)&&s._score>0)if(t)s._score=0;else{for(const r of this._entries)r._score=0;s._score=1e3;break}this._entries.sort(Je._compareByScoreAndTime)}}static _compareByScoreAndTime(e,t){return e._score<t._score?1:e._score>t._score?-1:Fu(e.selector)&&!Fu(t.selector)?1:!Fu(e.selector)&&Fu(t.selector)?-1:e._time<t._time?1:e._time>t._time?-1:0}}function Fu(o){return typeof o=="string"?!1:Array.isArray(o)?o.some(Fu):!!o.isBuiltin}class Q7{constructor(){this.referenceProvider=new Je(this._score.bind(this)),this.renameProvider=new Je(this._score.bind(this)),this.newSymbolNamesProvider=new Je(this._score.bind(this)),this.codeActionProvider=new Je(this._score.bind(this)),this.definitionProvider=new Je(this._score.bind(this)),this.typeDefinitionProvider=new Je(this._score.bind(this)),this.declarationProvider=new Je(this._score.bind(this)),this.implementationProvider=new Je(this._score.bind(this)),this.documentSymbolProvider=new Je(this._score.bind(this)),this.inlayHintsProvider=new Je(this._score.bind(this)),this.colorProvider=new Je(this._score.bind(this)),this.codeLensProvider=new Je(this._score.bind(this)),this.documentFormattingEditProvider=new Je(this._score.bind(this)),this.documentRangeFormattingEditProvider=new Je(this._score.bind(this)),this.onTypeFormattingEditProvider=new Je(this._score.bind(this)),this.signatureHelpProvider=new Je(this._score.bind(this)),this.hoverProvider=new Je(this._score.bind(this)),this.documentHighlightProvider=new Je(this._score.bind(this)),this.multiDocumentHighlightProvider=new Je(this._score.bind(this)),this.selectionRangeProvider=new Je(this._score.bind(this)),this.foldingRangeProvider=new Je(this._score.bind(this)),this.linkProvider=new Je(this._score.bind(this)),this.inlineCompletionsProvider=new Je(this._score.bind(this)),this.completionProvider=new Je(this._score.bind(this)),this.linkedEditingRangeProvider=new Je(this._score.bind(this)),this.documentRangeSemanticTokensProvider=new Je(this._score.bind(this)),this.documentSemanticTokensProvider=new Je(this._score.bind(this)),this.documentDropEditProvider=new Je(this._score.bind(this)),this.documentPasteEditProvider=new Je(this._score.bind(this))}_score(e){return this._notebookTypeResolver?.(e)}}fe(ze,Q7,1);class X7{constructor(e=5){this.timesPerSecond=e,this._lastRun=0,this._minimumTimeBetweenRuns=1e3/e}runIfNotLimited(e){const t=Date.now();t-this._lastRun>=this._minimumTimeBetweenRuns&&(this._lastRun=t,e())}}class Bu{static create(e,t){return new Bu(e,new fy(t))}get startLineNumber(){return this._startLineNumber}get endLineNumber(){return this._endLineNumber}constructor(e,t){this._startLineNumber=e,this._tokens=t,this._endLineNumber=this._startLineNumber+this._tokens.getMaxDeltaLine()}toString(){return this._tokens.toString(this._startLineNumber)}_updateEndLineNumber(){this._endLineNumber=this._startLineNumber+this._tokens.getMaxDeltaLine()}isEmpty(){return this._tokens.isEmpty()}getLineTokens(e){return this._startLineNumber<=e&&e<=this._endLineNumber?this._tokens.getLineTokens(e-this._startLineNumber):null}getRange(){const e=this._tokens.getRange();return e&&new l.Range(this._startLineNumber+e.startLineNumber,e.startColumn,this._startLineNumber+e.endLineNumber,e.endColumn)}removeTokens(e){const t=e.startLineNumber-this._startLineNumber,i=e.endLineNumber-this._startLineNumber;this._startLineNumber+=this._tokens.removeTokens(t,e.startColumn-1,i,e.endColumn-1),this._updateEndLineNumber()}split(e){const t=e.startLineNumber-this._startLineNumber,i=e.endLineNumber-this._startLineNumber,[n,s,r]=this._tokens.split(t,e.startColumn-1,i,e.endColumn-1);return[new Bu(this._startLineNumber,n),new Bu(this._startLineNumber+r,s)]}applyEdit(e,t){const[i,n,s]=fr(t);this.acceptEdit(e,i,n,s,t.length>0?t.charCodeAt(0):0)}acceptEdit(e,t,i,n,s){this._acceptDeleteRange(e),this._acceptInsertText(new l.Position(e.startLineNumber,e.startColumn),t,i,n,s),this._updateEndLineNumber()}_acceptDeleteRange(e){if(e.startLineNumber===e.endLineNumber&&e.startColumn===e.endColumn)return;const t=e.startLineNumber-this._startLineNumber,i=e.endLineNumber-this._startLineNumber;if(i<0){const s=i-t;this._startLineNumber-=s;return}const n=this._tokens.getMaxDeltaLine();if(!(t>=n+1)){if(t<0&&i>=n+1){this._startLineNumber=0,this._tokens.clear();return}if(t<0){const s=-t;this._startLineNumber-=s,this._tokens.acceptDeleteRange(e.startColumn-1,0,0,i,e.endColumn-1)}else this._tokens.acceptDeleteRange(0,t,e.startColumn-1,i,e.endColumn-1)}}_acceptInsertText(e,t,i,n,s){if(t===0&&i===0)return;const r=e.lineNumber-this._startLineNumber;if(r<0){this._startLineNumber+=t;return}const a=this._tokens.getMaxDeltaLine();r>=a+1||this._tokens.acceptInsertText(r,e.column-1,t,i,n,s)}reportIfInvalid(e){this._tokens.reportIfInvalid(e,this._startLineNumber)}}const kr=class kr{constructor(e){this._tokens=e,this._tokenCount=e.length/4}toString(e){const t=[];for(let i=0;i<this._tokenCount;i++)t.push(`(${this._getDeltaLine(i)+e},${this._getStartCharacter(i)}-${this._getEndCharacter(i)})`);return`[${t.join(",")}]`}getMaxDeltaLine(){const e=this._getTokenCount();return e===0?-1:this._getDeltaLine(e-1)}getRange(){const e=this._getTokenCount();if(e===0)return null;const t=this._getStartCharacter(0),i=this._getDeltaLine(e-1),n=this._getEndCharacter(e-1);return new l.Range(0,t+1,i,n+1)}_getTokenCount(){return this._tokenCount}_getDeltaLine(e){return this._tokens[4*e]}_getStartCharacter(e){return this._tokens[4*e+1]}_getEndCharacter(e){return this._tokens[4*e+2]}isEmpty(){return this._getTokenCount()===0}getLineTokens(e){let t=0,i=this._getTokenCount()-1;for(;t<i;){const n=t+Math.floor((i-t)/2),s=this._getDeltaLine(n);if(s<e)t=n+1;else if(s>e)i=n-1;else{let r=n;for(;r>t&&this._getDeltaLine(r-1)===e;)r--;let a=n;for(;a<i&&this._getDeltaLine(a+1)===e;)a++;return new jR(this._tokens.subarray(4*r,4*a+4))}}return this._getDeltaLine(t)===e?new jR(this._tokens.subarray(4*t,4*t+4)):null}clear(){this._tokenCount=0}removeTokens(e,t,i,n){const s=this._tokens,r=this._tokenCount;let a=0,c=!1,h=0;for(let d=0;d<r;d++){const u=4*d,f=s[u],g=s[u+1],m=s[u+2],p=s[u+3];if((f>e||f===e&&m>=t)&&(f<i||f===i&&g<=n))c=!0;else{if(a===0&&(h=f),c){const b=4*a;s[b]=f-h,s[b+1]=g,s[b+2]=m,s[b+3]=p}else h!==0&&(s[u]=f-h);a++}}return this._tokenCount=a,h}split(e,t,i,n){const s=this._tokens,r=this._tokenCount,a=[],c=[];let h=a,d=0,u=0;for(let f=0;f<r;f++){const g=4*f,m=s[g],p=s[g+1],b=s[g+2],v=s[g+3];if(m>e||m===e&&b>=t){if(m<i||m===i&&p<=n)continue;h!==c&&(h=c,d=0,u=m)}h[d++]=m-u,h[d++]=p,h[d++]=b,h[d++]=v}return[new kr(new Uint32Array(a)),new kr(new Uint32Array(c)),u]}acceptDeleteRange(e,t,i,n,s){const r=this._tokens,a=this._tokenCount,c=n-t;let h=0,d=!1;for(let u=0;u<a;u++){const f=4*u;let g=r[f],m=r[f+1],p=r[f+2];const b=r[f+3];if(g<t||g===t&&p<=i){h++;continue}else if(g===t&&m<i)g===n&&p>s?p-=s-i:p=i;else if(g===t&&m===i)if(g===n&&p>s)p-=s-i;else{d=!0;continue}else if(g<n||g===n&&m<s)if(g===n&&p>s)g=t,m=i,p=m+(p-s);else{d=!0;continue}else if(g>n){if(c===0&&!d){h=a;break}g-=c}else if(g===n&&m>=s)e&&g===0&&(m+=e,p+=e),g-=c,m-=s-i,p-=s-i;else throw new Error("Not possible!");const v=4*h;r[v]=g,r[v+1]=m,r[v+2]=p,r[v+3]=b,h++}this._tokenCount=h}acceptInsertText(e,t,i,n,s,r){const a=i===0&&n===1&&(r>=48&&r<=57||r>=65&&r<=90||r>=97&&r<=122),c=this._tokens,h=this._tokenCount;for(let d=0;d<h;d++){const u=4*d;let f=c[u],g=c[u+1],m=c[u+2];if(!(f<e||f===e&&m<t)){if(f===e&&m===t)if(a)m+=1;else continue;else if(f===e&&g<t&&t<m)i===0?m+=n:m=t;else{if(f===e&&g===t&&a)continue;if(f===e)if(f+=i,i===0)g+=n,m+=n;else{const p=m-g;g=s+(g-t),m=g+p}else f+=i}c[u]=f,c[u+1]=g,c[u+2]=m}}}reportIfInvalid(e,t){for(let i=0;i<this._tokenCount;i++){const n=this._getDeltaLine(i)+t;n<1?kr._rateLimiter.runIfNotLimited(()=>{console.error("Invalid Semantic Tokens Data From Extension: lineNumber < 1")}):n>e.getLineCount()?kr._rateLimiter.runIfNotLimited(()=>{console.error("Invalid Semantic Tokens Data From Extension: lineNumber > model.getLineCount()")}):this._getEndCharacter(i)>e.getLineLength(n)&&kr._rateLimiter.runIfNotLimited(()=>{console.error("Invalid Semantic Tokens Data From Extension: end character > model.getLineLength(lineNumber)")})}}};kr._rateLimiter=new X7(10/60);let fy=kr;class jR{constructor(e){this._tokens=e}getCount(){return this._tokens.length/4}getStartCharacter(e){return this._tokens[4*e+1]}getEndCharacter(e){return this._tokens[4*e+2]}getMetadata(e){return this._tokens[4*e+3]}}var J7=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},gy=function(o,e){return function(t,i){e(t,i,o)}};let my=class{constructor(e,t,i,n){this._legend=e,this._themeService=t,this._languageService=i,this._logService=n,this._hasWarnedOverlappingTokens=!1,this._hasWarnedInvalidLengthTokens=!1,this._hasWarnedInvalidEditStart=!1,this._hashTable=new py}getMetadata(e,t,i){const n=this._languageService.languageIdCodec.encodeLanguageId(i),s=this._hashTable.get(e,t,n);let r;if(s)r=s.metadata;else{let a=this._legend.tokenTypes[e];const c=[];if(a){let h=t;for(let u=0;h>0&&u<this._legend.tokenModifiers.length;u++)h&1&&c.push(this._legend.tokenModifiers[u]),h=h>>1;const d=this._themeService.getColorTheme().getTokenStyleMetadata(a,c,i);if(typeof d>"u")r=2147483647;else{if(r=0,typeof d.italic<"u"){const u=(d.italic?1:0)<<11;r|=u|1}if(typeof d.bold<"u"){const u=(d.bold?2:0)<<11;r|=u|2}if(typeof d.underline<"u"){const u=(d.underline?4:0)<<11;r|=u|4}if(typeof d.strikethrough<"u"){const u=(d.strikethrough?8:0)<<11;r|=u|8}if(d.foreground){const u=d.foreground<<15;r|=u|16}r===0&&(r=2147483647)}}else r=2147483647,a="not-in-legend";this._hashTable.add(e,t,n,r)}return r}warnOverlappingSemanticTokens(e,t){this._hasWarnedOverlappingTokens||(this._hasWarnedOverlappingTokens=!0,this._logService.warn(`Overlapping semantic tokens detected at lineNumber ${e}, column ${t}`))}warnInvalidLengthSemanticTokens(e,t){this._hasWarnedInvalidLengthTokens||(this._hasWarnedInvalidLengthTokens=!0,this._logService.warn(`Semantic token with invalid length detected at lineNumber ${e}, column ${t}`))}warnInvalidEditStart(e,t,i,n,s){this._hasWarnedInvalidEditStart||(this._hasWarnedInvalidEditStart=!0,this._logService.warn(`Invalid semantic tokens edit detected (previousResultId: ${e}, resultId: ${t}) at edit #${i}: The provided start offset ${n} is outside the previous data (length ${s}).`))}};my=J7([gy(1,_i),gy(2,yt),gy(3,ei)],my);function W7(o,e,t){const i=o.data,n=o.data.length/5|0,s=Math.max(Math.ceil(n/1024),400),r=[];let a=0,c=1,h=0;for(;a<n;){const d=a;let u=Math.min(d+s,n);if(u<n){let C=u;for(;C-1>d&&i[5*C]===0;)C--;if(C-1===d){let w=u;for(;w+1<n&&i[5*w]===0;)w++;u=w}else u=C}let f=new Uint32Array((u-d)*4),g=0,m=0,p=0,b=0;for(;a<u;){const C=5*a,w=i[C],S=i[C+1],L=c+w|0,D=w===0?h+S|0:S,x=i[C+2],I=D+x|0,T=i[C+3],M=i[C+4];if(I<=D)e.warnInvalidLengthSemanticTokens(L,D+1);else if(p===L&&b>D)e.warnOverlappingSemanticTokens(L,D+1);else{const O=e.getMetadata(T,M,t);O!==2147483647&&(m===0&&(m=L),f[g]=L-m,f[g+1]=D,f[g+2]=I,f[g+3]=O,g+=4,p=L,b=I)}c=L,h=D,a++}g!==f.length&&(f=f.subarray(0,g));const v=Bu.create(m,f);r.push(v)}return r}class H7{constructor(e,t,i,n){this.tokenTypeIndex=e,this.tokenModifierSet=t,this.languageId=i,this.metadata=n,this.next=null}}const Uo=class Uo{constructor(){this._elementsCount=0,this._currentLengthIndex=0,this._currentLength=Uo._SIZES[this._currentLengthIndex],this._growCount=Math.round(this._currentLengthIndex+1<Uo._SIZES.length?2/3*this._currentLength:0),this._elements=[],Uo._nullOutEntries(this._elements,this._currentLength)}static _nullOutEntries(e,t){for(let i=0;i<t;i++)e[i]=null}_hash2(e,t){return(e<<5)-e+t|0}_hashFunc(e,t,i){return this._hash2(this._hash2(e,t),i)%this._currentLength}get(e,t,i){const n=this._hashFunc(e,t,i);let s=this._elements[n];for(;s;){if(s.tokenTypeIndex===e&&s.tokenModifierSet===t&&s.languageId===i)return s;s=s.next}return null}add(e,t,i,n){if(this._elementsCount++,this._growCount!==0&&this._elementsCount>=this._growCount){const s=this._elements;this._currentLengthIndex++,this._currentLength=Uo._SIZES[this._currentLengthIndex],this._growCount=Math.round(this._currentLengthIndex+1<Uo._SIZES.length?2/3*this._currentLength:0),this._elements=[],Uo._nullOutEntries(this._elements,this._currentLength);for(const r of s){let a=r;for(;a;){const c=a.next;a.next=null,this._add(a),a=c}}}this._add(new H7(e,t,i,n))}_add(e){const t=this._hashFunc(e.tokenTypeIndex,e.tokenModifierSet,e.languageId);e.next=this._elements[t],this._elements[t]=e}};Uo._SIZES=[3,7,13,31,61,127,251,509,1021,2039,4093,8191,16381,32749,65521,131071,262139,524287,1048573,2097143];let py=Uo;const qR=le("semanticTokensStylingService");var e9=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},_y=function(o,e){return function(t,i){e(t,i,o)}};let by=class extends l.Disposable{constructor(e,t,i){super(),this._themeService=e,this._logService=t,this._languageService=i,this._caches=new WeakMap,this._register(this._themeService.onDidColorThemeChange(()=>{this._caches=new WeakMap}))}getStyling(e){return this._caches.has(e)||this._caches.set(e,new my(e.getLegend(),this._themeService,this._languageService,this._logService)),this._caches.get(e)}};by=e9([_y(0,_i),_y(1,ei),_y(2,yt)],by),fe(qR,by,1);var t9=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},i9=function(o,e){return function(t,i){e(t,i,o)}};let Cy=class extends l.Disposable{constructor(e){super(),this._themeService=e,this._onWillCreateCodeEditor=this._register(new l.Emitter),this._onCodeEditorAdd=this._register(new l.Emitter),this.onCodeEditorAdd=this._onCodeEditorAdd.event,this._onCodeEditorRemove=this._register(new l.Emitter),this.onCodeEditorRemove=this._onCodeEditorRemove.event,this._onWillCreateDiffEditor=this._register(new l.Emitter),this._onDiffEditorAdd=this._register(new l.Emitter),this.onDiffEditorAdd=this._onDiffEditorAdd.event,this._onDiffEditorRemove=this._register(new l.Emitter),this.onDiffEditorRemove=this._onDiffEditorRemove.event,this._decorationOptionProviders=new Map,this._codeEditorOpenHandlers=new l.LinkedList,this._modelProperties=new Map,this._codeEditors=Object.create(null),this._diffEditors=Object.create(null),this._globalStyleSheet=null}willCreateCodeEditor(){this._onWillCreateCodeEditor.fire()}addCodeEditor(e){this._codeEditors[e.getId()]=e,this._onCodeEditorAdd.fire(e)}removeCodeEditor(e){delete this._codeEditors[e.getId()]&&this._onCodeEditorRemove.fire(e)}listCodeEditors(){return Object.keys(this._codeEditors).map(e=>this._codeEditors[e])}willCreateDiffEditor(){this._onWillCreateDiffEditor.fire()}addDiffEditor(e){this._diffEditors[e.getId()]=e,this._onDiffEditorAdd.fire(e)}removeDiffEditor(e){delete this._diffEditors[e.getId()]&&this._onDiffEditorRemove.fire(e)}listDiffEditors(){return Object.keys(this._diffEditors).map(e=>this._diffEditors[e])}getFocusedCodeEditor(){let e=null;const t=this.listCodeEditors();for(const i of t){if(i.hasTextFocus())return i;i.hasWidgetFocus()&&(e=i)}return e}removeDecorationType(e){const t=this._decorationOptionProviders.get(e);t&&(t.refCount--,t.refCount<=0&&(this._decorationOptionProviders.delete(e),t.dispose(),this.listCodeEditors().forEach(i=>i.removeDecorationsByType(e))))}setModelProperty(e,t,i){const n=e.toString();let s;this._modelProperties.has(n)?s=this._modelProperties.get(n):(s=new Map,this._modelProperties.set(n,s)),s.set(t,i)}getModelProperty(e,t){const i=e.toString();if(this._modelProperties.has(i))return this._modelProperties.get(i).get(t)}async openCodeEditor(e,t,i){for(const n of this._codeEditorOpenHandlers){const s=await n(e,t,i);if(s!==null)return s}return null}registerCodeEditorOpenHandler(e){const t=this._codeEditorOpenHandlers.unshift(e);return l.toDisposable(t)}};Cy=t9([i9(0,_i)],Cy);var n9=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},YR=function(o,e){return function(t,i){e(t,i,o)}};let Lp=class extends Cy{constructor(e,t){super(t),this._register(this.onCodeEditorAdd(()=>this._checkContextKey())),this._register(this.onCodeEditorRemove(()=>this._checkContextKey())),this._editorIsOpen=e.createKey("editorIsOpen",!1),this._activeCodeEditor=null,this._register(this.registerCodeEditorOpenHandler(async(i,n,s)=>n?this.doOpenEditor(n,i):null))}_checkContextKey(){let e=!1;for(const t of this.listCodeEditors())if(!t.isSimpleWidget){e=!0;break}this._editorIsOpen.set(e)}setActiveCodeEditor(e){this._activeCodeEditor=e}getActiveCodeEditor(){return this._activeCodeEditor}doOpenEditor(e,t){if(!this.findModel(e,t.resource)){if(t.resource){const s=t.resource.scheme;if(s===l.Schemas.http||s===l.Schemas.https)return fx(t.resource.toString()),e}return null}const n=t.options?t.options.selection:null;if(n)if(typeof n.endLineNumber=="number"&&typeof n.endColumn=="number")e.setSelection(n),e.revealRangeInCenter(n,1);else{const s={lineNumber:n.startLineNumber,column:n.startColumn};e.setPosition(s),e.revealPositionInCenter(s,1)}return e}findModel(e,t){const i=e.getModel();return i&&i.uri.toString()!==t.toString()?null:i}};Lp=n9([YR(0,be),YR(1,_i)],Lp),fe(pt,Lp,0);var ZR=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},QR=function(o,e){return function(t,i){e(t,i,o)}};let Dp=class{get mainContainer(){return this._codeEditorService.listCodeEditors().at(0)?.getContainerDomNode()??Ae.document.body}get activeContainer(){return(this._codeEditorService.getFocusedCodeEditor()??this._codeEditorService.getActiveCodeEditor())?.getContainerDomNode()??this.mainContainer}get mainContainerDimension(){return Gf(this.mainContainer)}get activeContainerDimension(){return Gf(this.activeContainer)}get containers(){return l.coalesce(this._codeEditorService.listCodeEditors().map(e=>e.getContainerDomNode()))}getContainer(){return this.activeContainer}whenContainerStylesLoaded(){}focus(){this._codeEditorService.getFocusedCodeEditor()?.focus()}constructor(e){this._codeEditorService=e,this.onDidLayoutMainContainer=l.Event.None,this.onDidLayoutActiveContainer=l.Event.None,this.onDidLayoutContainer=l.Event.None,this.onDidChangeActiveContainer=l.Event.None,this.onDidAddContainer=l.Event.None,this.mainContainerOffset={top:0,quickPickTop:0},this.activeContainerOffset={top:0,quickPickTop:0}}};Dp=ZR([QR(0,pt)],Dp);let vy=class extends Dp{get mainContainer(){return this._container}constructor(e,t){super(t),this._container=e}};vy=ZR([QR(1,pt)],vy),fe(Os,Dp,1);var s9=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},wy=function(o,e){return function(t,i){e(t,i,o)}};let Sy=class extends l.Disposable{constructor(e,t,i){super(),this._contextKeyService=e,this._layoutService=t,this._configurationService=i,this._accessibilitySupport=0,this._onDidChangeScreenReaderOptimized=this._register(new l.Emitter),this._onDidChangeReducedMotion=this._register(new l.Emitter),this._onDidChangeReducedTransparency=this._register(new l.Emitter),this._onDidChangeLinkUnderline=this._register(new l.Emitter),this._accessibilityModeEnabledContext=yE.bindTo(this._contextKeyService);const n=()=>this._accessibilityModeEnabledContext.set(this.isScreenReaderOptimized());this._register(this._configurationService.onDidChangeConfiguration(a=>{a.affectsConfiguration("editor.accessibilitySupport")&&(n(),this._onDidChangeScreenReaderOptimized.fire()),a.affectsConfiguration("workbench.reduceMotion")&&(this._configMotionReduced=this._configurationService.getValue("workbench.reduceMotion"),this._onDidChangeReducedMotion.fire()),a.affectsConfiguration("workbench.reduceTransparency")&&(this._configTransparencyReduced=this._configurationService.getValue("workbench.reduceTransparency"),this._onDidChangeReducedTransparency.fire())})),n(),this._register(this.onDidChangeScreenReaderOptimized(()=>n()));const s=Ae.matchMedia("(prefers-reduced-motion: reduce)");this._systemMotionReduced=s.matches,this._configMotionReduced=this._configurationService.getValue("workbench.reduceMotion");const r=Ae.matchMedia("(prefers-reduced-transparency: reduce)");this._systemTransparencyReduced=r.matches,this._configTransparencyReduced=this._configurationService.getValue("workbench.reduceTransparency"),this._linkUnderlinesEnabled=this._configurationService.getValue("accessibility.underlineLinks"),this.initReducedMotionListeners(s),this.initReducedTransparencyListeners(r),this.initLinkUnderlineListeners()}initReducedMotionListeners(e){this._register(R(e,"change",()=>{this._systemMotionReduced=e.matches,this._configMotionReduced==="auto"&&this._onDidChangeReducedMotion.fire()}));const t=()=>{const i=this.isMotionReduced();this._layoutService.mainContainer.classList.toggle("monaco-reduce-motion",i),this._layoutService.mainContainer.classList.toggle("monaco-enable-motion",!i)};t(),this._register(this.onDidChangeReducedMotion(()=>t()))}initReducedTransparencyListeners(e){this._register(R(e,"change",()=>{this._systemTransparencyReduced=e.matches,this._configTransparencyReduced==="auto"&&this._onDidChangeReducedTransparency.fire()}));const t=()=>{const i=this.isTransparencyReduced();this._layoutService.mainContainer.classList.toggle("monaco-reduce-transparency",i)};t(),this._register(this.onDidChangeReducedTransparency(()=>t()))}initLinkUnderlineListeners(){this._register(this._configurationService.onDidChangeConfiguration(t=>{if(t.affectsConfiguration("accessibility.underlineLinks")){const i=this._configurationService.getValue("accessibility.underlineLinks");this._linkUnderlinesEnabled=i,this._onDidChangeLinkUnderline.fire()}}));const e=()=>{const t=this._linkUnderlinesEnabled;this._layoutService.mainContainer.classList.toggle("underline-links",t)};e(),this._register(this.onDidChangeLinkUnderlines(()=>e()))}onDidChangeLinkUnderlines(e){return this._onDidChangeLinkUnderline.event(e)}get onDidChangeScreenReaderOptimized(){return this._onDidChangeScreenReaderOptimized.event}isScreenReaderOptimized(){const e=this.getAccessibilitySupportConfigurationValue();return e==="on"||e==="auto"&&this._accessibilitySupport===2}getAccessibilitySupportConfigurationValue(){const e=this._configurationService.inspect("editor.accessibilitySupport");return e.policyValue??e.memoryValue??e.workspaceFolderValue??e.workspaceValue??e.userValue??e.applicationValue??e.defaultValue??"auto"}get onDidChangeReducedMotion(){return this._onDidChangeReducedMotion.event}isMotionReduced(){const e=this._configMotionReduced;return e==="on"||e==="auto"&&this._systemMotionReduced}get onDidChangeReducedTransparency(){return this._onDidChangeReducedTransparency.event}isTransparencyReduced(){const e=this._configTransparencyReduced;return e==="on"||e==="auto"&&this._systemTransparencyReduced}getAccessibilitySupport(){return this._accessibilitySupport}};Sy=s9([wy(0,be),wy(1,Os),wy(2,Ge)],Sy);const Xa=le("accessibilitySignalService"),ne=class ne{static register(e){return new ne(e.fileName)}constructor(e){this.fileName=e}};ne.error=ne.register({fileName:"error.mp3"}),ne.warning=ne.register({fileName:"warning.mp3"}),ne.success=ne.register({fileName:"success.mp3"}),ne.foldedArea=ne.register({fileName:"foldedAreas.mp3"}),ne.break=ne.register({fileName:"break.mp3"}),ne.quickFixes=ne.register({fileName:"quickFixes.mp3"}),ne.taskCompleted=ne.register({fileName:"taskCompleted.mp3"}),ne.taskFailed=ne.register({fileName:"taskFailed.mp3"}),ne.terminalBell=ne.register({fileName:"terminalBell.mp3"}),ne.diffLineInserted=ne.register({fileName:"diffLineInserted.mp3"}),ne.diffLineDeleted=ne.register({fileName:"diffLineDeleted.mp3"}),ne.diffLineModified=ne.register({fileName:"diffLineModified.mp3"}),ne.requestSent=ne.register({fileName:"requestSent.mp3"}),ne.responseReceived1=ne.register({fileName:"responseReceived1.mp3"}),ne.responseReceived2=ne.register({fileName:"responseReceived2.mp3"}),ne.responseReceived3=ne.register({fileName:"responseReceived3.mp3"}),ne.responseReceived4=ne.register({fileName:"responseReceived4.mp3"}),ne.clear=ne.register({fileName:"clear.mp3"}),ne.save=ne.register({fileName:"save.mp3"}),ne.format=ne.register({fileName:"format.mp3"}),ne.voiceRecordingStarted=ne.register({fileName:"voiceRecordingStarted.mp3"}),ne.voiceRecordingStopped=ne.register({fileName:"voiceRecordingStopped.mp3"}),ne.progress=ne.register({fileName:"progress.mp3"}),ne.chatEditModifiedFile=ne.register({fileName:"chatEditModifiedFile.mp3"}),ne.editsKept=ne.register({fileName:"editsKept.mp3"}),ne.editsUndone=ne.register({fileName:"editsUndone.mp3"}),ne.nextEditSuggestion=ne.register({fileName:"nextEditSuggestion.mp3"}),ne.terminalCommandSucceeded=ne.register({fileName:"terminalCommandSucceeded.mp3"}),ne.chatUserActionRequired=ne.register({fileName:"chatUserActionRequired.mp3"}),ne.codeActionTriggered=ne.register({fileName:"codeActionTriggered.mp3"}),ne.codeActionApplied=ne.register({fileName:"codeActionApplied.mp3"});let Oe=ne;class o9{constructor(e){this.randomOneOf=e}}const H=class H{constructor(e,t,i,n,s,r,a=!1){this.sound=e,this.name=t,this.legacySoundSettingsKey=i,this.settingsKey=n,this.legacyAnnouncementSettingsKey=s,this.announcementMessage=r,this.managesOwnEnablement=a}static register(e){const t=new o9("randomOneOf"in e.sound?e.sound.randomOneOf:[e.sound]),i=new H(t,e.name,e.legacySoundSettingsKey,e.settingsKey,e.legacyAnnouncementSettingsKey,e.announcementMessage,e.managesOwnEnablement);return H._signals.add(i),i}};H._signals=new Set,H.errorAtPosition=H.register({name:l.localize(1630,"Error at Position"),sound:Oe.error,announcementMessage:l.localize(1631,"Error"),settingsKey:"accessibility.signals.positionHasError",delaySettingsKey:"accessibility.signalOptions.delays.errorAtPosition"}),H.warningAtPosition=H.register({name:l.localize(1632,"Warning at Position"),sound:Oe.warning,announcementMessage:l.localize(1633,"Warning"),settingsKey:"accessibility.signals.positionHasWarning",delaySettingsKey:"accessibility.signalOptions.delays.warningAtPosition"}),H.errorOnLine=H.register({name:l.localize(1634,"Error on Line"),sound:Oe.error,legacySoundSettingsKey:"audioCues.lineHasError",legacyAnnouncementSettingsKey:"accessibility.alert.error",announcementMessage:l.localize(1635,"Error on Line"),settingsKey:"accessibility.signals.lineHasError"}),H.warningOnLine=H.register({name:l.localize(1636,"Warning on Line"),sound:Oe.warning,legacySoundSettingsKey:"audioCues.lineHasWarning",legacyAnnouncementSettingsKey:"accessibility.alert.warning",announcementMessage:l.localize(1637,"Warning on Line"),settingsKey:"accessibility.signals.lineHasWarning"}),H.foldedArea=H.register({name:l.localize(1638,"Folded Area on Line"),sound:Oe.foldedArea,legacySoundSettingsKey:"audioCues.lineHasFoldedArea",legacyAnnouncementSettingsKey:"accessibility.alert.foldedArea",announcementMessage:l.localize(1639,"Folded"),settingsKey:"accessibility.signals.lineHasFoldedArea"}),H.break=H.register({name:l.localize(1640,"Breakpoint on Line"),sound:Oe.break,legacySoundSettingsKey:"audioCues.lineHasBreakpoint",legacyAnnouncementSettingsKey:"accessibility.alert.breakpoint",announcementMessage:l.localize(1641,"Breakpoint"),settingsKey:"accessibility.signals.lineHasBreakpoint"}),H.inlineSuggestion=H.register({name:l.localize(1642,"Inline Suggestion on Line"),sound:Oe.quickFixes,legacySoundSettingsKey:"audioCues.lineHasInlineSuggestion",settingsKey:"accessibility.signals.lineHasInlineSuggestion"}),H.nextEditSuggestion=H.register({name:l.localize(1643,"Next Edit Suggestion on Line"),sound:Oe.nextEditSuggestion,legacySoundSettingsKey:"audioCues.nextEditSuggestion",settingsKey:"accessibility.signals.nextEditSuggestion",announcementMessage:l.localize(1644,"Next Edit Suggestion")}),H.terminalQuickFix=H.register({name:l.localize(1645,"Terminal Quick Fix"),sound:Oe.quickFixes,legacySoundSettingsKey:"audioCues.terminalQuickFix",legacyAnnouncementSettingsKey:"accessibility.alert.terminalQuickFix",announcementMessage:l.localize(1646,"Quick Fix"),settingsKey:"accessibility.signals.terminalQuickFix"}),H.onDebugBreak=H.register({name:l.localize(1647,"Debugger Stopped on Breakpoint"),sound:Oe.break,legacySoundSettingsKey:"audioCues.onDebugBreak",legacyAnnouncementSettingsKey:"accessibility.alert.onDebugBreak",announcementMessage:l.localize(1648,"Breakpoint"),settingsKey:"accessibility.signals.onDebugBreak"}),H.noInlayHints=H.register({name:l.localize(1649,"No Inlay Hints on Line"),sound:Oe.error,legacySoundSettingsKey:"audioCues.noInlayHints",legacyAnnouncementSettingsKey:"accessibility.alert.noInlayHints",announcementMessage:l.localize(1650,"No Inlay Hints"),settingsKey:"accessibility.signals.noInlayHints"}),H.taskCompleted=H.register({name:l.localize(1651,"Task Completed"),sound:Oe.taskCompleted,legacySoundSettingsKey:"audioCues.taskCompleted",legacyAnnouncementSettingsKey:"accessibility.alert.taskCompleted",announcementMessage:l.localize(1652,"Task Completed"),settingsKey:"accessibility.signals.taskCompleted"}),H.taskFailed=H.register({name:l.localize(1653,"Task Failed"),sound:Oe.taskFailed,legacySoundSettingsKey:"audioCues.taskFailed",legacyAnnouncementSettingsKey:"accessibility.alert.taskFailed",announcementMessage:l.localize(1654,"Task Failed"),settingsKey:"accessibility.signals.taskFailed"}),H.terminalCommandFailed=H.register({name:l.localize(1655,"Terminal Command Failed"),sound:Oe.error,legacySoundSettingsKey:"audioCues.terminalCommandFailed",legacyAnnouncementSettingsKey:"accessibility.alert.terminalCommandFailed",announcementMessage:l.localize(1656,"Command Failed"),settingsKey:"accessibility.signals.terminalCommandFailed"}),H.terminalCommandSucceeded=H.register({name:l.localize(1657,"Terminal Command Succeeded"),sound:Oe.terminalCommandSucceeded,announcementMessage:l.localize(1658,"Command Succeeded"),settingsKey:"accessibility.signals.terminalCommandSucceeded"}),H.terminalBell=H.register({name:l.localize(1659,"Terminal Bell"),sound:Oe.terminalBell,legacySoundSettingsKey:"audioCues.terminalBell",legacyAnnouncementSettingsKey:"accessibility.alert.terminalBell",announcementMessage:l.localize(1660,"Terminal Bell"),settingsKey:"accessibility.signals.terminalBell"}),H.notebookCellCompleted=H.register({name:l.localize(1661,"Notebook Cell Completed"),sound:Oe.taskCompleted,legacySoundSettingsKey:"audioCues.notebookCellCompleted",legacyAnnouncementSettingsKey:"accessibility.alert.notebookCellCompleted",announcementMessage:l.localize(1662,"Notebook Cell Completed"),settingsKey:"accessibility.signals.notebookCellCompleted"}),H.notebookCellFailed=H.register({name:l.localize(1663,"Notebook Cell Failed"),sound:Oe.taskFailed,legacySoundSettingsKey:"audioCues.notebookCellFailed",legacyAnnouncementSettingsKey:"accessibility.alert.notebookCellFailed",announcementMessage:l.localize(1664,"Notebook Cell Failed"),settingsKey:"accessibility.signals.notebookCellFailed"}),H.diffLineInserted=H.register({name:l.localize(1665,"Diff Line Inserted"),sound:Oe.diffLineInserted,legacySoundSettingsKey:"audioCues.diffLineInserted",settingsKey:"accessibility.signals.diffLineInserted"}),H.diffLineDeleted=H.register({name:l.localize(1666,"Diff Line Deleted"),sound:Oe.diffLineDeleted,legacySoundSettingsKey:"audioCues.diffLineDeleted",settingsKey:"accessibility.signals.diffLineDeleted"}),H.diffLineModified=H.register({name:l.localize(1667,"Diff Line Modified"),sound:Oe.diffLineModified,legacySoundSettingsKey:"audioCues.diffLineModified",settingsKey:"accessibility.signals.diffLineModified"}),H.chatEditModifiedFile=H.register({name:l.localize(1668,"Chat Edit Modified File"),sound:Oe.chatEditModifiedFile,announcementMessage:l.localize(1669,"File Modified from Chat Edits"),settingsKey:"accessibility.signals.chatEditModifiedFile"}),H.chatRequestSent=H.register({name:l.localize(1670,"Chat Request Sent"),sound:Oe.requestSent,legacySoundSettingsKey:"audioCues.chatRequestSent",legacyAnnouncementSettingsKey:"accessibility.alert.chatRequestSent",announcementMessage:l.localize(1671,"Chat Request Sent"),settingsKey:"accessibility.signals.chatRequestSent"}),H.chatResponseReceived=H.register({name:l.localize(1672,"Chat Response Received"),legacySoundSettingsKey:"audioCues.chatResponseReceived",sound:{randomOneOf:[Oe.responseReceived1,Oe.responseReceived2,Oe.responseReceived3,Oe.responseReceived4]},settingsKey:"accessibility.signals.chatResponseReceived"}),H.codeActionTriggered=H.register({name:l.localize(1673,"Code Action Request Triggered"),sound:Oe.codeActionTriggered,legacySoundSettingsKey:"audioCues.codeActionRequestTriggered",legacyAnnouncementSettingsKey:"accessibility.alert.codeActionRequestTriggered",announcementMessage:l.localize(1674,"Code Action Request Triggered"),settingsKey:"accessibility.signals.codeActionTriggered"}),H.codeActionApplied=H.register({name:l.localize(1675,"Code Action Applied"),legacySoundSettingsKey:"audioCues.codeActionApplied",sound:Oe.codeActionApplied,settingsKey:"accessibility.signals.codeActionApplied"}),H.progress=H.register({name:l.localize(1676,"Progress"),sound:Oe.progress,legacySoundSettingsKey:"audioCues.chatResponsePending",legacyAnnouncementSettingsKey:"accessibility.alert.progress",announcementMessage:l.localize(1677,"Progress"),settingsKey:"accessibility.signals.progress"}),H.clear=H.register({name:l.localize(1678,"Clear"),sound:Oe.clear,legacySoundSettingsKey:"audioCues.clear",legacyAnnouncementSettingsKey:"accessibility.alert.clear",announcementMessage:l.localize(1679,"Clear"),settingsKey:"accessibility.signals.clear"}),H.save=H.register({name:l.localize(1680,"Save"),sound:Oe.save,legacySoundSettingsKey:"audioCues.save",legacyAnnouncementSettingsKey:"accessibility.alert.save",announcementMessage:l.localize(1681,"Save"),settingsKey:"accessibility.signals.save"}),H.format=H.register({name:l.localize(1682,"Format"),sound:Oe.format,legacySoundSettingsKey:"audioCues.format",legacyAnnouncementSettingsKey:"accessibility.alert.format",announcementMessage:l.localize(1683,"Format"),settingsKey:"accessibility.signals.format"}),H.voiceRecordingStarted=H.register({name:l.localize(1684,"Voice Recording Started"),sound:Oe.voiceRecordingStarted,legacySoundSettingsKey:"audioCues.voiceRecordingStarted",settingsKey:"accessibility.signals.voiceRecordingStarted"}),H.voiceRecordingStopped=H.register({name:l.localize(1685,"Voice Recording Stopped"),sound:Oe.voiceRecordingStopped,legacySoundSettingsKey:"audioCues.voiceRecordingStopped",settingsKey:"accessibility.signals.voiceRecordingStopped"}),H.editsKept=H.register({name:l.localize(1686,"Edits Kept"),sound:Oe.editsKept,announcementMessage:l.localize(1687,"Edits Kept"),settingsKey:"accessibility.signals.editsKept"}),H.editsUndone=H.register({name:l.localize(1688,"Undo Edits"),sound:Oe.editsUndone,announcementMessage:l.localize(1689,"Edits Undone"),settingsKey:"accessibility.signals.editsUndone"}),H.chatUserActionRequired=H.register({name:l.localize(1690,"Chat User Action Required"),sound:Oe.chatUserActionRequired,announcementMessage:l.localize(1691,"Chat User Action Required"),settingsKey:"accessibility.signals.chatUserActionRequired"});let xn=H;var xp=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},Fs=function(o,e){return function(t,i){e(t,i,o)}},Qc,zu;let yy=class extends l.Disposable{constructor(e,t,i){super(),this._commandService=e,this._keybindingService=t,this._hiddenStates=this._register(new Ly(i))}createMenu(e,t,i){return new Ep(e,this._hiddenStates,{emitEventsForSubmenuChanges:!1,eventDebounceDelay:50,...i},this._commandService,this._keybindingService,t)}getMenuActions(e,t,i){const n=new Ep(e,this._hiddenStates,{emitEventsForSubmenuChanges:!1,eventDebounceDelay:50,...i},this._commandService,this._keybindingService,t),s=n.getActions(i);return n.dispose(),s}resetHiddenStates(e){this._hiddenStates.reset(e)}};yy=xp([Fs(0,zi),Fs(1,xt),Fs(2,Qa)],yy);let Ly=(xl=class{constructor(e){this._storageService=e,this._disposables=new l.DisposableStore,this._onDidChange=new l.Emitter,this.onDidChange=this._onDidChange.event,this._ignoreChangeEvent=!1,this._hiddenByDefaultCache=new Map;try{const t=e.get(Qc._key,0,"{}");this._data=JSON.parse(t)}catch{this._data=Object.create(null)}this._disposables.add(e.onDidChangeValue(0,Qc._key,this._disposables)(()=>{if(!this._ignoreChangeEvent)try{const t=e.get(Qc._key,0,"{}");this._data=JSON.parse(t)}catch(t){console.log("FAILED to read storage after UPDATE",t)}this._onDidChange.fire()}))}dispose(){this._onDidChange.dispose(),this._disposables.dispose()}_isHiddenByDefault(e,t){return this._hiddenByDefaultCache.get(`${e.id}/${t}`)??!1}setDefaultState(e,t,i){this._hiddenByDefaultCache.set(`${e.id}/${t}`,i)}isHidden(e,t){const i=this._isHiddenByDefault(e,t),n=this._data[e.id]?.includes(t)??!1;return i?!n:n}updateHidden(e,t,i){this._isHiddenByDefault(e,t)&&(i=!i);const s=this._data[e.id];if(i)s?s.indexOf(t)<0&&s.push(t):this._data[e.id]=[t];else if(s){const r=s.indexOf(t);r>=0&&l.removeFastWithoutKeepingOrder(s,r),s.length===0&&delete this._data[e.id]}this._persist()}reset(e){if(e===void 0)this._data=Object.create(null),this._persist();else{for(const{id:t}of e)this._data[t]&&delete this._data[t];this._persist()}}_persist(){try{this._ignoreChangeEvent=!0;const e=JSON.stringify(this._data);this._storageService.store(Qc._key,e,0,0)}finally{this._ignoreChangeEvent=!1}}},Qc=xl,xl._key="menu.hiddenCommands",xl);Ly=Qc=xp([Fs(0,Qa)],Ly);class Vu{constructor(e,t){this._id=e,this._collectContextKeysForSubmenus=t,this._menuGroups=[],this._allMenuIds=new Set,this._structureContextKeys=new Set,this._preconditionContextKeys=new Set,this._toggledContextKeys=new Set,this.refresh()}get allMenuIds(){return this._allMenuIds}get structureContextKeys(){return this._structureContextKeys}get preconditionContextKeys(){return this._preconditionContextKeys}get toggledContextKeys(){return this._toggledContextKeys}refresh(){this._menuGroups.length=0,this._allMenuIds.clear(),this._structureContextKeys.clear(),this._preconditionContextKeys.clear(),this._toggledContextKeys.clear();const e=this._sort(Qn.getMenuItems(this._id));let t;for(const i of e){const n=i.group||"";(!t||t[0]!==n)&&(t=[n,[]],this._menuGroups.push(t)),t[1].push(i),this._collectContextKeysAndSubmenuIds(i)}this._allMenuIds.add(this._id)}_sort(e){return e}_collectContextKeysAndSubmenuIds(e){if(Vu._fillInKbExprKeys(e.when,this._structureContextKeys),Zl(e)){if(e.command.precondition&&Vu._fillInKbExprKeys(e.command.precondition,this._preconditionContextKeys),e.command.toggled){const t=e.command.toggled.condition||e.command.toggled;Vu._fillInKbExprKeys(t,this._toggledContextKeys)}}else this._collectContextKeysForSubmenus&&(Qn.getMenuItems(e.submenu).forEach(this._collectContextKeysAndSubmenuIds,this),this._allMenuIds.add(e.submenu))}static _fillInKbExprKeys(e,t){if(e)for(const i of e.keys())t.add(i)}}let Dy=zu=class extends Vu{constructor(e,t,i,n,s,r){super(e,i),this._hiddenStates=t,this._commandService=n,this._keybindingService=s,this._contextKeyService=r,this.refresh()}createActionGroups(e){const t=[];for(const i of this._menuGroups){const[n,s]=i;let r;for(const a of s)if(this._contextKeyService.contextMatchesRules(a.when)){const c=Zl(a);c&&this._hiddenStates.setDefaultState(this._id,a.command.id,!!a.isHiddenByDefault);const h=r9(this._id,c?a.command:a,this._hiddenStates);if(c){const d=XR(this._commandService,this._keybindingService,a.command.id,a.when);(r??=[]).push(new _.MenuItemAction(a.command,a.alt,e,h,d,this._contextKeyService,this._commandService))}else{const d=new zu(a.submenu,this._hiddenStates,this._collectContextKeysForSubmenus,this._commandService,this._keybindingService,this._contextKeyService).createActionGroups(e),u=ft.join(...d.map(f=>f[1]));u.length>0&&(r??=[]).push(new sa(a,h,u))}}r&&r.length>0&&t.push([n,r])}return t}_sort(e){return e.sort(zu._compareMenuItems)}static _compareMenuItems(e,t){const i=e.group,n=t.group;if(i!==n){if(i){if(!n)return-1}else return 1;if(i==="navigation")return-1;if(n==="navigation")return 1;const a=i.localeCompare(n);if(a!==0)return a}const s=e.order||0,r=t.order||0;return s<r?-1:s>r?1:zu._compareTitles(Zl(e)?e.command.title:e.title,Zl(t)?t.command.title:t.title)}static _compareTitles(e,t){const i=typeof e=="string"?e:e.original,n=typeof t=="string"?t:t.original;return i.localeCompare(n)}};Dy=zu=xp([Fs(3,zi),Fs(4,xt),Fs(5,be)],Dy);let Ep=class{constructor(e,t,i,n,s,r){this._disposables=new l.DisposableStore,this._menuInfo=new Dy(e,t,i.emitEventsForSubmenuChanges,n,s,r);const a=new l.RunOnceScheduler(()=>{this._menuInfo.refresh(),this._onDidChange.fire({menu:this,isStructuralChange:!0,isEnablementChange:!0,isToggleChange:!0})},i.eventDebounceDelay);this._disposables.add(a),this._disposables.add(Qn.onDidChangeMenu(u=>{for(const f of this._menuInfo.allMenuIds)if(u.has(f)){a.schedule();break}}));const c=this._disposables.add(new l.DisposableStore),h=u=>{let f=!1,g=!1,m=!1;for(const p of u)if(f=f||p.isStructuralChange,g=g||p.isEnablementChange,m=m||p.isToggleChange,f&&g&&m)break;return{menu:this,isStructuralChange:f,isEnablementChange:g,isToggleChange:m}},d=()=>{c.add(r.onDidChangeContext(u=>{const f=u.affectsSome(this._menuInfo.structureContextKeys),g=u.affectsSome(this._menuInfo.preconditionContextKeys),m=u.affectsSome(this._menuInfo.toggledContextKeys);(f||g||m)&&this._onDidChange.fire({menu:this,isStructuralChange:f,isEnablementChange:g,isToggleChange:m})})),c.add(t.onDidChange(u=>{this._onDidChange.fire({menu:this,isStructuralChange:!0,isEnablementChange:!1,isToggleChange:!1})}))};this._onDidChange=new l.DebounceEmitter({onWillAddFirstListener:d,onDidRemoveLastListener:c.clear.bind(c),delay:i.eventDebounceDelay,merge:h}),this.onDidChange=this._onDidChange.event}getActions(e){return this._menuInfo.createActionGroups(e)}dispose(){this._disposables.dispose(),this._onDidChange.dispose()}};Ep=xp([Fs(3,zi),Fs(4,xt),Fs(5,be)],Ep);function r9(o,e,t){const i=aB(e)?e.submenu.id:e.id,n=typeof e.title=="string"?e.title:e.title.value,s=Yo({id:`hide/${o.id}/${i}`,label:l.localize(1703,"Hide '{0}'",n),run(){t.updateHidden(o,i,!0)}}),r=Yo({id:`toggle/${o.id}/${i}`,label:n,get checked(){return!t.isHidden(o,i)},run(){t.updateHidden(o,i,!!this.checked)}});return{hide:s,toggle:r,get isHidden(){return!r.checked}}}function XR(o,e,t,i=void 0,n=!0){return Yo({id:`configureKeybinding/${t}`,label:l.localize(1704,"Configure Keybinding"),enabled:n,run(){const r=!!!e.lookupKeybinding(t)&&i?i.serialize():void 0;o.executeCommand("workbench.action.openGlobalKeybindings",`@command:${t}`+(r?` +when:${r}`:""))}})}var a9=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},JR=function(o,e){return function(t,i){e(t,i,o)}},xy;const WR="application/vnd.code.resources";let Ey=(El=class extends l.Disposable{constructor(e,t){super(),this.layoutService=e,this.logService=t,this.mapTextToType=new Map,this.findText="",this.resources=[],this.resourcesStateHash=void 0,($r||PD)&&this.installWebKitWriteTextWorkaround(),this._register(l.Event.runAndSubscribe(id,({window:i,disposables:n})=>{n.add(R(i.document,"copy",()=>this.clearResourcesState()))},{window:Ae,disposables:this._store}))}triggerPaste(){this.logService.trace("BrowserClipboardService#triggerPaste")}installWebKitWriteTextWorkaround(){const e=()=>{const t=new l.DeferredPromise;this.webKitPendingClipboardWritePromise&&!this.webKitPendingClipboardWritePromise.isSettled&&this.webKitPendingClipboardWritePromise.cancel(),this.webKitPendingClipboardWritePromise=t,Le().navigator.clipboard.write([new ClipboardItem({"text/plain":t.p})]).catch(async i=>{(!(i instanceof Error)||i.name!=="NotAllowedError"||!t.isRejected)&&this.logService.error(i)})};this._register(l.Event.runAndSubscribe(this.layoutService.onDidAddContainer,({container:t,disposables:i})=>{i.add(R(t,"click",e)),i.add(R(t,"keydown",e))},{container:this.layoutService.mainContainer,disposables:this._store}))}async writeText(e,t){if(this.logService.trace("BrowserClipboardService#writeText called with type:",t," text.length:",e.length),this.clearResourcesState(),t){this.mapTextToType.set(t,e),this.logService.trace("BrowserClipboardService#writeText");return}if(this.webKitPendingClipboardWritePromise)return this.webKitPendingClipboardWritePromise.complete(e);try{return this.logService.trace("before navigator.clipboard.writeText"),await Le().navigator.clipboard.writeText(e)}catch(i){console.error(i)}this.fallbackWriteText(e)}fallbackWriteText(e){this.logService.trace("BrowserClipboardService#fallbackWriteText");const t=od(),i=t.activeElement,n=t.body.appendChild(Q("textarea",{"aria-hidden":!0}));n.style.height="1px",n.style.width="1px",n.style.position="absolute",n.value=e,n.focus(),n.select(),t.execCommand("copy"),Ve(i)&&i.focus(),n.remove()}async readText(e){if(this.logService.trace("BrowserClipboardService#readText called with type:",e),e){const t=this.mapTextToType.get(e)||"";return this.logService.trace("BrowserClipboardService#readText text.length:",t.length),t}try{const t=await Le().navigator.clipboard.readText();return this.logService.trace("BrowserClipboardService#readText text.length:",t.length),t}catch(t){console.error(t)}return""}async readFindText(){return this.findText}async writeFindText(e){this.findText=e}async readResources(){try{const t=await Le().navigator.clipboard.read();for(const i of t)if(i.types.includes(`web ${WR}`)){const n=await i.getType(`web ${WR}`);return JSON.parse(await n.text()).map(r=>l.URI.from(r))}}catch{}const e=await this.computeResourcesStateHash();return this.resourcesStateHash!==e&&this.clearResourcesState(),this.resources}async computeResourcesStateHash(){if(this.resources.length===0)return;const e=await this.readText();return l.hash(e.substring(0,xy.MAX_RESOURCE_STATE_SOURCE_LENGTH))}clearInternalState(){this.clearResourcesState()}clearResourcesState(){this.resources=[],this.resourcesStateHash=void 0}},xy=El,El.MAX_RESOURCE_STATE_SOURCE_LENGTH=1e3,El);Ey=xy=a9([JR(0,Os),JR(1,ei)],Ey);const Ip=le("clipboardService");function Tp(o){return Object.isFrozen(o)?o:l.deepFreeze(o)}class Tt{static createEmptyModel(e){return new Tt({},[],[],void 0,e)}constructor(e,t,i,n,s){this._contents=e,this._keys=t,this._overrides=i,this._raw=n,this.logService=s,this.overrideConfigurations=new Map}get rawConfiguration(){if(!this._rawConfiguration)if(this._raw){const e=(Array.isArray(this._raw)?this._raw:[this._raw]).map(t=>{if(t instanceof Tt)return t;const i=new l9("",this.logService);return i.parseRaw(t),i.configurationModel});this._rawConfiguration=e.reduce((t,i)=>i===t?i:t.merge(i),e[0])}else this._rawConfiguration=this;return this._rawConfiguration}get contents(){return this._contents}get overrides(){return this._overrides}get keys(){return this._keys}get raw(){if(this._raw&&!(Array.isArray(this._raw)&&this._raw.every(e=>e instanceof Tt)))return this._raw}isEmpty(){return this._keys.length===0&&Object.keys(this._contents).length===0&&this._overrides.length===0}getValue(e){return e?Qx(this.contents,e):this.contents}inspect(e,t){const i=this;return{get value(){return Tp(i.rawConfiguration.getValue(e))},get override(){return t?Tp(i.rawConfiguration.getOverrideValue(e,t)):void 0},get merged(){return Tp(t?i.rawConfiguration.override(t).getValue(e):i.rawConfiguration.getValue(e))},get overrides(){const n=[];for(const{contents:s,identifiers:r,keys:a}of i.rawConfiguration.overrides){const c=new Tt(s,a,[],void 0,i.logService).getValue(e);c!==void 0&&n.push({identifiers:r,value:c})}return n.length?Tp(n):void 0}}}getOverrideValue(e,t){const i=this.getContentsForOverrideIdentifer(t);return i?e?Qx(i,e):i:void 0}override(e){let t=this.overrideConfigurations.get(e);return t||(t=this.createOverrideConfigurationModel(e),this.overrideConfigurations.set(e,t)),t}merge(...e){const t=l.deepClone(this.contents),i=l.deepClone(this.overrides),n=[...this.keys],s=this._raw?Array.isArray(this._raw)?[...this._raw]:[this._raw]:[this];for(const r of e)if(s.push(...r._raw?Array.isArray(r._raw)?r._raw:[r._raw]:[r]),!r.isEmpty()){this.mergeContents(t,r.contents);for(const a of r.overrides){const[c]=i.filter(h=>l.equals(h.identifiers,a.identifiers));c?(this.mergeContents(c.contents,a.contents),c.keys.push(...a.keys),c.keys=l.distinct(c.keys)):i.push(l.deepClone(a))}for(const a of r.keys)n.indexOf(a)===-1&&n.push(a)}return new Tt(t,n,i,!s.length||s.every(r=>r instanceof Tt)?void 0:s,this.logService)}createOverrideConfigurationModel(e){const t=this.getContentsForOverrideIdentifer(e);if(!t||typeof t!="object"||!Object.keys(t).length)return this;const i={};for(const n of l.distinct([...Object.keys(this.contents),...Object.keys(t)])){let s=this.contents[n];const r=t[n];r&&(typeof s=="object"&&typeof r=="object"?(s=l.deepClone(s),this.mergeContents(s,r)):s=r),i[n]=s}return new Tt(i,this.keys,this.overrides,void 0,this.logService)}mergeContents(e,t){for(const i of Object.keys(t)){if(i in e&&l.isObject(e[i])&&l.isObject(t[i])){this.mergeContents(e[i],t[i]);continue}e[i]=l.deepClone(t[i])}}getContentsForOverrideIdentifer(e){let t=null,i=null;const n=s=>{s&&(i?this.mergeContents(i,s):i=l.deepClone(s))};for(const s of this.overrides)s.identifiers.length===1&&s.identifiers[0]===e?t=s.contents:s.identifiers.includes(e)&&n(s.contents);return n(t),i}toJSON(){return{contents:this.contents,overrides:this.overrides,keys:this.keys}}setValue(e,t){this.updateValue(e,t,!1)}removeValue(e){const t=this.keys.indexOf(e);t!==-1&&(this.keys.splice(t,1),YB(this.contents,e),Jo.test(e)&&this.overrides.splice(this.overrides.findIndex(i=>l.equals(i.identifiers,wg(e))),1))}updateValue(e,t,i){if(Yx(this.contents,e,t,n=>this.logService.error(n)),i=i||this.keys.indexOf(e)===-1,i&&this.keys.push(e),Jo.test(e)){const n=this.contents[e],s=wg(e),r={identifiers:s,keys:Object.keys(n),contents:LC(n,c=>this.logService.error(c))},a=this.overrides.findIndex(c=>l.equals(c.identifiers,s));a!==-1?this.overrides[a]=r:this.overrides.push(r)}}}class l9{constructor(e,t){this._name=e,this.logService=t,this._raw=null,this._configurationModel=null,this._restrictedConfigurations=[]}get configurationModel(){return this._configurationModel||Tt.createEmptyModel(this.logService)}parseRaw(e,t){this._raw=e;const{contents:i,keys:n,overrides:s,restricted:r,hasExcludedProperties:a}=this.doParseRaw(e,t);this._configurationModel=new Tt(i,n,s,a?[e]:void 0,this.logService),this._restrictedConfigurations=r||[]}doParseRaw(e,t){const i=St.as(Xo.Configuration),n=i.getConfigurationProperties(),s=i.getExcludedConfigurationProperties(),r=this.filter(e,n,s,!0,t);e=r.raw;const a=LC(e,d=>this.logService.error(`Conflict in settings file ${this._name}: ${d}`)),c=Object.keys(e),h=this.toOverrides(e,d=>this.logService.error(`Conflict in settings file ${this._name}: ${d}`));return{contents:a,keys:c,overrides:h,restricted:r.restricted,hasExcludedProperties:r.hasExcludedProperties}}filter(e,t,i,n,s){let r=!1;if(!s?.scopes&&!s?.skipRestricted&&!s?.skipUnregistered&&!s?.exclude?.length)return{raw:e,restricted:[],hasExcludedProperties:r};const a={},c=[];for(const h in e)if(Jo.test(h)&&n){const d=this.filter(e[h],t,i,!1,s);a[h]=d.raw,r=r||d.hasExcludedProperties,c.push(...d.restricted)}else{const d=t[h];d?.restricted&&c.push(h),this.shouldInclude(h,d,i,s)?a[h]=e[h]:r=!0}return{raw:a,restricted:c,hasExcludedProperties:r}}shouldInclude(e,t,i,n){if(n.exclude?.includes(e))return!1;if(n.include?.includes(e))return!0;if(n.skipRestricted&&t?.restricted||n.skipUnregistered&&!t)return!1;const s=t??i[e],r=s?typeof s.scope<"u"?s.scope:4:void 0;return r===void 0||n.scopes===void 0?!0:n.scopes.includes(r)}toOverrides(e,t){const i=[];for(const n of Object.keys(e))if(Jo.test(n)){const s={},r=e[n];for(const a in r)s[a]=r[a];i.push({identifiers:wg(n),keys:Object.keys(s),contents:LC(s,t)})}return i}}class c9{constructor(e,t,i,n,s,r,a,c,h,d,u,f,g){this.key=e,this.overrides=t,this._value=i,this.overrideIdentifiers=n,this.defaultConfiguration=s,this.policyConfiguration=r,this.applicationConfiguration=a,this.userConfiguration=c,this.localUserConfiguration=h,this.remoteUserConfiguration=d,this.workspaceConfiguration=u,this.folderConfigurationModel=f,this.memoryConfigurationModel=g}toInspectValue(e){return e?.value!==void 0||e?.override!==void 0||e?.overrides!==void 0?e:void 0}get defaultInspectValue(){return this._defaultInspectValue||(this._defaultInspectValue=this.defaultConfiguration.inspect(this.key,this.overrides.overrideIdentifier)),this._defaultInspectValue}get defaultValue(){return this.defaultInspectValue.merged}get policyInspectValue(){return this._policyInspectValue===void 0&&(this._policyInspectValue=this.policyConfiguration?this.policyConfiguration.inspect(this.key):null),this._policyInspectValue}get policyValue(){return this.policyInspectValue?.merged}get applicationInspectValue(){return this._applicationInspectValue===void 0&&(this._applicationInspectValue=this.applicationConfiguration?this.applicationConfiguration.inspect(this.key):null),this._applicationInspectValue}get applicationValue(){return this.applicationInspectValue?.merged}get userInspectValue(){return this._userInspectValue||(this._userInspectValue=this.userConfiguration.inspect(this.key,this.overrides.overrideIdentifier)),this._userInspectValue}get userValue(){return this.userInspectValue.merged}get user(){return this.toInspectValue(this.userInspectValue)}get workspaceInspectValue(){return this._workspaceInspectValue===void 0&&(this._workspaceInspectValue=this.workspaceConfiguration?this.workspaceConfiguration.inspect(this.key,this.overrides.overrideIdentifier):null),this._workspaceInspectValue}get workspaceValue(){return this.workspaceInspectValue?.merged}get workspaceFolderInspectValue(){return this._workspaceFolderInspectValue===void 0&&(this._workspaceFolderInspectValue=this.folderConfigurationModel?this.folderConfigurationModel.inspect(this.key,this.overrides.overrideIdentifier):null),this._workspaceFolderInspectValue}get workspaceFolderValue(){return this.workspaceFolderInspectValue?.merged}get memoryInspectValue(){return this._memoryInspectValue===void 0&&(this._memoryInspectValue=this.memoryConfigurationModel.inspect(this.key,this.overrides.overrideIdentifier)),this._memoryInspectValue}get memoryValue(){return this.memoryInspectValue.merged}}class Np{constructor(e,t,i,n,s,r,a,c,h,d){this._defaultConfiguration=e,this._policyConfiguration=t,this._applicationConfiguration=i,this._localUserConfiguration=n,this._remoteUserConfiguration=s,this._workspaceConfiguration=r,this._folderConfigurations=a,this._memoryConfiguration=c,this._memoryConfigurationByResource=h,this.logService=d,this._workspaceConsolidatedConfiguration=null,this._foldersConsolidatedConfigurations=new l.ResourceMap,this._userConfiguration=null}getValue(e,t,i){return this.getConsolidatedConfigurationModel(e,t,i).getValue(e)}updateValue(e,t,i={}){let n;i.resource?(n=this._memoryConfigurationByResource.get(i.resource),n||(n=Tt.createEmptyModel(this.logService),this._memoryConfigurationByResource.set(i.resource,n))):n=this._memoryConfiguration,t===void 0?n.removeValue(e):n.setValue(e,t),i.resource||(this._workspaceConsolidatedConfiguration=null)}inspect(e,t,i){const n=this.getConsolidatedConfigurationModel(e,t,i),s=this.getFolderConfigurationModelForResource(t.resource,i),r=t.resource?this._memoryConfigurationByResource.get(t.resource)||this._memoryConfiguration:this._memoryConfiguration,a=new Set;for(const c of n.overrides)for(const h of c.identifiers)n.getOverrideValue(e,h)!==void 0&&a.add(h);return new c9(e,t,n.getValue(e),a.size?[...a]:void 0,this._defaultConfiguration,this._policyConfiguration.isEmpty()?void 0:this._policyConfiguration,this.applicationConfiguration.isEmpty()?void 0:this.applicationConfiguration,this.userConfiguration,this.localUserConfiguration,this.remoteUserConfiguration,i?this._workspaceConfiguration:void 0,s||void 0,r)}get applicationConfiguration(){return this._applicationConfiguration}get userConfiguration(){if(!this._userConfiguration)if(this._remoteUserConfiguration.isEmpty())this._userConfiguration=this._localUserConfiguration;else{const e=this._localUserConfiguration.merge(this._remoteUserConfiguration);this._userConfiguration=new Tt(e.contents,e.keys,e.overrides,void 0,this.logService)}return this._userConfiguration}get localUserConfiguration(){return this._localUserConfiguration}get remoteUserConfiguration(){return this._remoteUserConfiguration}getConsolidatedConfigurationModel(e,t,i){let n=this.getConsolidatedConfigurationModelForResource(t,i);if(t.overrideIdentifier&&(n=n.override(t.overrideIdentifier)),!this._policyConfiguration.isEmpty()&&this._policyConfiguration.getValue(e)!==void 0){n=n.merge();for(const s of this._policyConfiguration.keys)n.setValue(s,this._policyConfiguration.getValue(s))}return n}getConsolidatedConfigurationModelForResource({resource:e},t){let i=this.getWorkspaceConsolidatedConfiguration();if(t&&e){const n=t.getFolder(e);n&&(i=this.getFolderConsolidatedConfiguration(n.uri)||i);const s=this._memoryConfigurationByResource.get(e);s&&(i=i.merge(s))}return i}getWorkspaceConsolidatedConfiguration(){return this._workspaceConsolidatedConfiguration||(this._workspaceConsolidatedConfiguration=this._defaultConfiguration.merge(this.applicationConfiguration,this.userConfiguration,this._workspaceConfiguration,this._memoryConfiguration)),this._workspaceConsolidatedConfiguration}getFolderConsolidatedConfiguration(e){let t=this._foldersConsolidatedConfigurations.get(e);if(!t){const i=this.getWorkspaceConsolidatedConfiguration(),n=this._folderConfigurations.get(e);n?(t=i.merge(n),this._foldersConsolidatedConfigurations.set(e,t)):t=i}return t}getFolderConfigurationModelForResource(e,t){if(t&&e){const i=t.getFolder(e);if(i)return this._folderConfigurations.get(i.uri)}}toData(){return{defaults:{contents:this._defaultConfiguration.contents,overrides:this._defaultConfiguration.overrides,keys:this._defaultConfiguration.keys},policy:{contents:this._policyConfiguration.contents,overrides:this._policyConfiguration.overrides,keys:this._policyConfiguration.keys},application:{contents:this.applicationConfiguration.contents,overrides:this.applicationConfiguration.overrides,keys:this.applicationConfiguration.keys,raw:Array.isArray(this.applicationConfiguration.raw)?void 0:this.applicationConfiguration.raw},userLocal:{contents:this.localUserConfiguration.contents,overrides:this.localUserConfiguration.overrides,keys:this.localUserConfiguration.keys,raw:Array.isArray(this.localUserConfiguration.raw)?void 0:this.localUserConfiguration.raw},userRemote:{contents:this.remoteUserConfiguration.contents,overrides:this.remoteUserConfiguration.overrides,keys:this.remoteUserConfiguration.keys,raw:Array.isArray(this.remoteUserConfiguration.raw)?void 0:this.remoteUserConfiguration.raw},workspace:{contents:this._workspaceConfiguration.contents,overrides:this._workspaceConfiguration.overrides,keys:this._workspaceConfiguration.keys},folders:[...this._folderConfigurations.keys()].reduce((e,t)=>{const{contents:i,overrides:n,keys:s}=this._folderConfigurations.get(t);return e.push([t,{contents:i,overrides:n,keys:s}]),e},[])}}static parse(e,t){const i=this.parseConfigurationModel(e.defaults,t),n=this.parseConfigurationModel(e.policy,t),s=this.parseConfigurationModel(e.application,t),r=this.parseConfigurationModel(e.userLocal,t),a=this.parseConfigurationModel(e.userRemote,t),c=this.parseConfigurationModel(e.workspace,t),h=e.folders.reduce((d,u)=>(d.set(l.URI.revive(u[0]),this.parseConfigurationModel(u[1],t)),d),new l.ResourceMap);return new Np(i,n,s,r,a,c,h,Tt.createEmptyModel(t),new l.ResourceMap,t)}static parseConfigurationModel(e,t){return new Tt(e.contents,e.keys,e.overrides,e.raw,t)}}class h9{constructor(e,t,i,n,s){this.change=e,this.previous=t,this.currentConfiguraiton=i,this.currentWorkspace=n,this.logService=s,this._marker=`
|
||
`,this._markerCode1=this._marker.charCodeAt(0),this._markerCode2=46,this.affectedKeys=new Set,this._previousConfiguration=void 0;for(const r of e.keys)this.affectedKeys.add(r);for(const[,r]of e.overrides)for(const a of r)this.affectedKeys.add(a);this._affectsConfigStr=this._marker;for(const r of this.affectedKeys)this._affectsConfigStr+=r+this._marker}get previousConfiguration(){return!this._previousConfiguration&&this.previous&&(this._previousConfiguration=Np.parse(this.previous.data,this.logService)),this._previousConfiguration}affectsConfiguration(e,t){const i=this._marker+e,n=this._affectsConfigStr.indexOf(i);if(n<0)return!1;const s=n+i.length;if(s>=this._affectsConfigStr.length)return!1;const r=this._affectsConfigStr.charCodeAt(s);if(r!==this._markerCode1&&r!==this._markerCode2)return!1;if(t){const a=this.previousConfiguration?this.previousConfiguration.getValue(e,t,this.previous?.workspace):void 0,c=this.currentConfiguraiton.getValue(e,t,this.currentWorkspace);return!l.equals$1(a,c)}return!0}}class d9 extends l.Disposable{get configurationModel(){return this._configurationModel}constructor(e){super(),this.logService=e,this._configurationModel=Tt.createEmptyModel(e)}reload(){return this.resetConfigurationModel(),this.configurationModel}getConfigurationDefaultOverrides(){return{}}resetConfigurationModel(){this._configurationModel=Tt.createEmptyModel(this.logService);const e=St.as(Xo.Configuration).getConfigurationProperties();this.updateConfigurationModel(Object.keys(e),e)}updateConfigurationModel(e,t){const i=this.getConfigurationDefaultOverrides();for(const n of e){const s=i[n],r=t[n];s!==void 0?this._configurationModel.setValue(n,s):r?this._configurationModel.setValue(n,this.getDefaultValue(n,r)):this._configurationModel.removeValue(n)}}getDefaultValue(e,t){return l.deepClone(t.default)}}class u9{constructor(){this._value="",this._pos=0}reset(e){return this._value=e,this._pos=0,this}next(){return this._pos+=1,this}hasNext(){return this._pos<this._value.length-1}cmp(e){const t=e.charCodeAt(0),i=this._value.charCodeAt(this._pos);return t-i}value(){return this._value[this._pos]}}class f9{constructor(e=!0){this._caseSensitive=e}reset(e){return this._value=e,this._from=0,this._to=0,this.next()}hasNext(){return this._to<this._value.length}next(){this._from=this._to;let e=!0;for(;this._to<this._value.length;this._to++)if(this._value.charCodeAt(this._to)===46)if(e)this._from++;else break;else e=!1;return this}cmp(e){return this._caseSensitive?l.compareSubstring(e,this._value,0,e.length,this._from,this._to):l.compareSubstringIgnoreCase(e,this._value,0,e.length,this._from,this._to)}value(){return this._value.substring(this._from,this._to)}}class g9{constructor(e=!0,t=!0){this._splitOnBackslash=e,this._caseSensitive=t}reset(e){this._from=0,this._to=0,this._value=e,this._valueLen=e.length;for(let t=e.length-1;t>=0;t--,this._valueLen--){const i=this._value.charCodeAt(t);if(!(i===47||this._splitOnBackslash&&i===92))break}return this.next()}hasNext(){return this._to<this._valueLen}next(){this._from=this._to;let e=!0;for(;this._to<this._valueLen;this._to++){const t=this._value.charCodeAt(this._to);if(t===47||this._splitOnBackslash&&t===92)if(e)this._from++;else break;else e=!1}return this}cmp(e){return this._caseSensitive?l.compareSubstring(e,this._value,0,e.length,this._from,this._to):l.compareSubstringIgnoreCase(e,this._value,0,e.length,this._from,this._to)}value(){return this._value.substring(this._from,this._to)}}class m9{constructor(e,t){this._ignorePathCasing=e,this._ignoreQueryAndFragment=t,this._states=[],this._stateIdx=0}reset(e){return this._value=e,this._states=[],this._value.scheme&&this._states.push(1),this._value.authority&&this._states.push(2),this._value.path&&(this._pathIterator=new g9(!1,!this._ignorePathCasing(e)),this._pathIterator.reset(e.path),this._pathIterator.value()&&this._states.push(3)),this._ignoreQueryAndFragment(e)||(this._value.query&&this._states.push(4),this._value.fragment&&this._states.push(5)),this._stateIdx=0,this}next(){return this._states[this._stateIdx]===3&&this._pathIterator.hasNext()?this._pathIterator.next():this._stateIdx+=1,this}hasNext(){return this._states[this._stateIdx]===3&&this._pathIterator.hasNext()||this._stateIdx<this._states.length-1}cmp(e){if(this._states[this._stateIdx]===1)return l.compareIgnoreCase(e,this._value.scheme);if(this._states[this._stateIdx]===2)return l.compareIgnoreCase(e,this._value.authority);if(this._states[this._stateIdx]===3)return this._pathIterator.cmp(e);if(this._states[this._stateIdx]===4)return l.compare(e,this._value.query);if(this._states[this._stateIdx]===5)return l.compare(e,this._value.fragment);throw new Error}value(){if(this._states[this._stateIdx]===1)return this._value.scheme;if(this._states[this._stateIdx]===2)return this._value.authority;if(this._states[this._stateIdx]===3)return this._pathIterator.value();if(this._states[this._stateIdx]===4)return this._value.query;if(this._states[this._stateIdx]===5)return this._value.fragment;throw new Error}}const vf=class vf{static wrap(e){return e===void 0?vf.Val:e}static unwrap(e){return e===vf.Val?void 0:e}};vf.Val=Symbol("undefined_placeholder");let xo=vf;class Rp{constructor(){this.height=1,this.value=void 0,this.key=void 0,this.left=void 0,this.mid=void 0,this.right=void 0}rotateLeft(){const e=this.right;return this.right=e.left,e.left=this,this.updateHeight(),e.updateHeight(),e}rotateRight(){const e=this.left;return this.left=e.right,e.right=this,this.updateHeight(),e.updateHeight(),e}updateHeight(){this.height=1+Math.max(this.heightLeft,this.heightRight)}balanceFactor(){return this.heightRight-this.heightLeft}get heightLeft(){return this.left?.height??0}get heightRight(){return this.right?.height??0}}class Xc{static forUris(e=()=>!1,t=()=>!1){return new Xc(new m9(e,t))}static forStrings(){return new Xc(new u9)}static forConfigKeys(){return new Xc(new f9)}constructor(e){this._iter=e}clear(){this._root=void 0}set(e,t){const i=this._iter.reset(e);let n;this._root||(this._root=new Rp,this._root.segment=i.value());const s=[];for(n=this._root;;){const a=i.cmp(n.segment);if(a>0)n.left||(n.left=new Rp,n.left.segment=i.value()),s.push([-1,n]),n=n.left;else if(a<0)n.right||(n.right=new Rp,n.right.segment=i.value()),s.push([1,n]),n=n.right;else if(i.hasNext())i.next(),n.mid||(n.mid=new Rp,n.mid.segment=i.value()),s.push([0,n]),n=n.mid;else break}const r=xo.unwrap(n.value);n.value=xo.wrap(t),n.key=e;for(let a=s.length-1;a>=0;a--){const c=s[a][1];c.updateHeight();const h=c.balanceFactor();if(h<-1||h>1){const d=s[a][0],u=s[a+1][0];if(d===1&&u===1)s[a][1]=c.rotateLeft();else if(d===-1&&u===-1)s[a][1]=c.rotateRight();else if(d===1&&u===-1)c.right=s[a+1][1]=s[a+1][1].rotateRight(),s[a][1]=c.rotateLeft();else if(d===-1&&u===1)c.left=s[a+1][1]=s[a+1][1].rotateLeft(),s[a][1]=c.rotateRight();else throw new Error;if(a>0)switch(s[a-1][0]){case-1:s[a-1][1].left=s[a][1];break;case 1:s[a-1][1].right=s[a][1];break;case 0:s[a-1][1].mid=s[a][1];break}else this._root=s[0][1]}}return r}get(e){return xo.unwrap(this._getNode(e)?.value)}_getNode(e){const t=this._iter.reset(e);let i=this._root;for(;i;){const n=t.cmp(i.segment);if(n>0)i=i.left;else if(n<0)i=i.right;else if(t.hasNext())t.next(),i=i.mid;else break}return i}has(e){const t=this._getNode(e);return!(t?.value===void 0&&t?.mid===void 0)}delete(e){return this._delete(e,!1)}deleteSuperstr(e){return this._delete(e,!0)}_delete(e,t){const i=this._iter.reset(e),n=[];let s=this._root;for(;s;){const r=i.cmp(s.segment);if(r>0)n.push([-1,s]),s=s.left;else if(r<0)n.push([1,s]),s=s.right;else if(i.hasNext())i.next(),n.push([0,s]),s=s.mid;else break}if(s){if(t?(s.left=void 0,s.mid=void 0,s.right=void 0,s.height=1):(s.key=void 0,s.value=void 0),!s.mid&&!s.value)if(s.left&&s.right){const r=[[1,s]],a=this._min(s.right,r);if(a.key){s.key=a.key,s.value=a.value,s.segment=a.segment;const c=a.right;if(r.length>1){const[d,u]=r[r.length-1];switch(d){case-1:u.left=c;break;case 0:l.assert(!1);case 1:l.assert(!1)}}else s.right=c;const h=this._balanceByStack(r);if(n.length>0){const[d,u]=n[n.length-1];switch(d){case-1:u.left=h;break;case 0:u.mid=h;break;case 1:u.right=h;break}}else this._root=h}}else{const r=s.left??s.right;if(n.length>0){const[a,c]=n[n.length-1];switch(a){case-1:c.left=r;break;case 0:c.mid=r;break;case 1:c.right=r;break}}else this._root=r}this._root=this._balanceByStack(n)??this._root}}_min(e,t){for(;e.left;)t.push([-1,e]),e=e.left;return e}_balanceByStack(e){for(let t=e.length-1;t>=0;t--){const i=e[t][1];i.updateHeight();const n=i.balanceFactor();if(n>1?(i.right.balanceFactor()>=0||(i.right=i.right.rotateRight()),e[t][1]=i.rotateLeft()):n<-1&&(i.left.balanceFactor()<=0||(i.left=i.left.rotateLeft()),e[t][1]=i.rotateRight()),t>0)switch(e[t-1][0]){case-1:e[t-1][1].left=e[t][1];break;case 1:e[t-1][1].right=e[t][1];break;case 0:e[t-1][1].mid=e[t][1];break}else return e[0][1]}}findSubstr(e){const t=this._iter.reset(e);let i=this._root,n;for(;i;){const s=t.cmp(i.segment);if(s>0)i=i.left;else if(s<0)i=i.right;else if(t.hasNext())t.next(),n=xo.unwrap(i.value)||n,i=i.mid;else break}return i&&xo.unwrap(i.value)||n}findSuperstr(e){return this._findSuperstrOrElement(e,!1)}_findSuperstrOrElement(e,t){const i=this._iter.reset(e);let n=this._root;for(;n;){const s=i.cmp(n.segment);if(s>0)n=n.left;else if(s<0)n=n.right;else if(i.hasNext())i.next(),n=n.mid;else return n.mid?this._entries(n.mid):t?xo.unwrap(n.value):void 0}}forEach(e){for(const[t,i]of this)e(i,t)}*[Symbol.iterator](){yield*this._entries(this._root)}_entries(e){const t=[];return this._dfsEntries(e,t),t[Symbol.iterator]()}_dfsEntries(e,t){e&&(e.left&&this._dfsEntries(e.left,t),e.value!==void 0&&t.push([e.key,xo.unwrap(e.value)]),e.mid&&this._dfsEntries(e.mid,t),e.right&&this._dfsEntries(e.right,t))}}new q("isMac",l.isMacintosh,l.localize(1746,"Whether the operating system is macOS")),new q("isLinux",l.isLinux,l.localize(1747,"Whether the operating system is Linux"));const p9=new q("isWindows",l.isWindows,l.localize(1748,"Whether the operating system is Windows")),_9=new q("isWeb",l.isWeb,l.localize(1749,"Whether the platform is a web browser"));new q("isMacNative",l.isMacintosh&&!l.isWeb,l.localize(1750,"Whether the operating system is macOS on a non-browser platform")),new q("isIOS",l.isIOS,l.localize(1751,"Whether the operating system is iOS")),new q("isMobile",l.isMobile,l.localize(1752,"Whether the platform is a mobile web browser")),new q("isDevelopment",!1,!0),new q("productQualityType","",l.localize(1753,"Quality type of VS Code"));const HR="inputFocus",Mp=new q(HR,!1,l.localize(1754,"Whether keyboard focus is inside an input box"));var b9=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},C9=function(o,e){return function(t,i){e(t,i,o)}};const Uu="data-keybinding-context";class Iy{constructor(e,t){this._id=e,this._parent=t,this._value=Object.create(null),this._value._contextId=e}get value(){return{...this._value}}setValue(e,t){return l.equals$1(this._value[e],t)?!1:(this._value[e]=t,!0)}removeValue(e){return e in this._value?(delete this._value[e],!0):!1}getValue(e){const t=this._value[e];return typeof t>"u"&&this._parent?this._parent.getValue(e):t}}const fb=class fb extends Iy{constructor(){super(-1,null)}setValue(e,t){return!1}removeValue(e){return!1}getValue(e){}};fb.INSTANCE=new fb;let Jc=fb;const wf=class wf extends Iy{constructor(e,t,i){super(e,null),this._configurationService=t,this._values=Xc.forConfigKeys(),this._listener=this._configurationService.onDidChangeConfiguration(n=>{if(n.source===7){const s=Array.from(this._values,([r])=>r);this._values.clear(),i.fire(new tM(s))}else{const s=[];for(const r of n.affectedKeys){const a=`config.${r}`,c=this._values.findSuperstr(a);c!==void 0&&(s.push(...l.Iterable.map(c,([h])=>h)),this._values.deleteSuperstr(a)),this._values.has(a)&&(s.push(a),this._values.delete(a))}i.fire(new tM(s))}})}dispose(){this._listener.dispose()}getValue(e){if(e.indexOf(wf._keyPrefix)!==0)return super.getValue(e);if(this._values.has(e))return this._values.get(e);const t=e.substr(wf._keyPrefix.length),i=this._configurationService.getValue(t);let n;switch(typeof i){case"number":case"boolean":case"string":n=i;break;default:Array.isArray(i)?n=JSON.stringify(i):n=i}return this._values.set(e,n),n}setValue(e,t){return super.setValue(e,t)}removeValue(e){return super.removeValue(e)}};wf._keyPrefix="config.";let Ty=wf;class v9{constructor(e,t,i){this._service=e,this._key=t,this._defaultValue=i,this.reset()}set(e){this._service.setContext(this._key,e)}reset(){typeof this._defaultValue>"u"?this._service.removeContext(this._key):this._service.setContext(this._key,this._defaultValue)}get(){return this._service.getContextKeyValue(this._key)}}class eM{constructor(e){this.key=e}affectsSome(e){return e.has(this.key)}allKeysContainedIn(e){return this.affectsSome(e)}}class tM{constructor(e){this.keys=e}affectsSome(e){for(const t of this.keys)if(e.has(t))return!0;return!1}allKeysContainedIn(e){return this.keys.every(t=>e.has(t))}}class w9{constructor(e){this.events=e}affectsSome(e){for(const t of this.events)if(t.affectsSome(e))return!0;return!1}allKeysContainedIn(e){return this.events.every(t=>t.allKeysContainedIn(e))}}function S9(o,e){return o.allKeysContainedIn(new Set(Object.keys(e)))}class iM extends l.Disposable{get onDidChangeContext(){return this._onDidChangeContext.event}constructor(e){super(),this._onDidChangeContext=this._register(new l.PauseableEmitter({merge:t=>new w9(t)})),this._isDisposed=!1,this._myContextId=e}createKey(e,t){if(this._isDisposed)throw new Error("AbstractContextKeyService has been disposed");return new v9(this,e,t)}bufferChangeEvents(e){this._onDidChangeContext.pause();try{e()}finally{this._onDidChangeContext.resume()}}createScoped(e){if(this._isDisposed)throw new Error("AbstractContextKeyService has been disposed");return new y9(this,e)}contextMatchesRules(e){if(this._isDisposed)throw new Error("AbstractContextKeyService has been disposed");const t=this.getContextValuesContainer(this._myContextId);return e?e.evaluate(t):!0}getContextKeyValue(e){if(!this._isDisposed)return this.getContextValuesContainer(this._myContextId).getValue(e)}setContext(e,t){if(this._isDisposed)return;const i=this.getContextValuesContainer(this._myContextId);i&&i.setValue(e,t)&&this._onDidChangeContext.fire(new eM(e))}removeContext(e){this._isDisposed||this.getContextValuesContainer(this._myContextId).removeValue(e)&&this._onDidChangeContext.fire(new eM(e))}getContext(e){return this._isDisposed?Jc.INSTANCE:this.getContextValuesContainer(L9(e))}dispose(){super.dispose(),this._isDisposed=!0}}let Ny=class extends iM{constructor(e){super(0),this._contexts=new Map,this._lastContextId=0,this.inputFocusedContext=Mp.bindTo(this);const t=this._register(new Ty(this._myContextId,e,this._onDidChangeContext));this._contexts.set(this._myContextId,t),this._register(l.Event.runAndSubscribe(id,({window:i,disposables:n})=>{const s=n.add(new l.MutableDisposable);n.add(R(i,F.FOCUS_IN,()=>{s.value=new l.DisposableStore,this.updateInputContextKeys(i.document,s.value)},!0))},{window:Ae,disposables:this._store}))}updateInputContextKeys(e,t){function i(){return!!e.activeElement&&jn(e.activeElement)}const n=i();if(this.inputFocusedContext.set(n),n){const s=t.add(Xr(e.activeElement));l.Event.once(s.onDidBlur)(()=>{Le().document===e&&this.inputFocusedContext.set(i()),s.dispose()},void 0,t)}}getContextValuesContainer(e){return this._isDisposed?Jc.INSTANCE:this._contexts.get(e)||Jc.INSTANCE}createChildContext(e=this._myContextId){if(this._isDisposed)throw new Error("ContextKeyService has been disposed");const t=++this._lastContextId;return this._contexts.set(t,new Iy(t,this.getContextValuesContainer(e))),t}disposeContext(e){this._isDisposed||this._contexts.delete(e)}};Ny=b9([C9(0,Ge)],Ny);class y9 extends iM{constructor(e,t){if(super(e.createChildContext()),this._parentChangeListener=this._register(new l.MutableDisposable),this._parent=e,this._updateParentChangeListener(),this._domNode=t,this._domNode.hasAttribute(Uu)){let i="";this._domNode.classList&&(i=Array.from(this._domNode.classList.values()).join(", ")),console.error(`Element already has context attribute${i?": "+i:""}`)}this._domNode.setAttribute(Uu,String(this._myContextId))}_updateParentChangeListener(){this._parentChangeListener.value=this._parent.onDidChangeContext(e=>{const i=this._parent.getContextValuesContainer(this._myContextId).value;S9(e,i)||this._onDidChangeContext.fire(e)})}dispose(){this._isDisposed||(this._parentChangeListener.clear(),this._parent.disposeContext(this._myContextId),this._domNode.removeAttribute(Uu),super.dispose())}getContextValuesContainer(e){return this._isDisposed?Jc.INSTANCE:this._parent.getContextValuesContainer(e)}createChildContext(e=this._myContextId){if(this._isDisposed)throw new Error("ScopedContextKeyService has been disposed");return this._parent.createChildContext(e)}disposeContext(e){this._parent.disposeContext(e)}}function L9(o){for(;o;){if(o.hasAttribute(Uu)){const e=o.getAttribute(Uu);return e?parseInt(e,10):NaN}o=o.parentElement}return 0}function D9(o,e,t){o.get(be).createKey(String(e),x9(t))}function x9(o){return l.cloneAndChange(o,e=>{if(typeof e=="object"&&e.$mid===1)return l.URI.revive(e).toString();if(e instanceof l.URI)return e.toString()})}Ut.registerCommand("_setContext",D9),Ut.registerCommand({id:"getContextKeyInfo",handler(){return[...q.all()].sort((o,e)=>o.key.localeCompare(e.key))},metadata:{description:l.localize(1736,"A command that returns information about context keys"),args:[]}}),Ut.registerCommand("_generateContextKeyInfo",function(){const o=[],e=new Set;for(const t of q.all())e.has(t.key)||(e.add(t.key),o.push(t));o.sort((t,i)=>t.key.localeCompare(i.key)),console.log(JSON.stringify(o,void 0,2))});function xH(o){return o}function Eo(o,e){if(o!==void 0){const t=o.match(/^\s*var\((.+)\)$/);if(t){const i=t[1].split(",",2);return i.length===2&&(e=Eo(i[1].trim(),e)),`var(${i[0]}, ${e})`}return o}return e}function nM(o){const e=o.replaceAll(/[^_\-a-z0-9]/gi,"");return e!==o&&console.warn(`CSS ident value ${o} modified to ${e} to be safe for CSS`),e}function yr(o){return`'${o.replaceAll(/'/g,"\\000027")}'`}function Bs(o){return o?Yi`url('${CSS.escape(l.FileAccess.uriToBrowserUri(o).toString(!0))}')`:"url('')"}function Ap(o,e=!1){const t=CSS.escape(o);return!e&&t!==o&&console.warn(`CSS class name ${o} modified to ${t} to be safe for CSS`),t}function Yi(o,...e){return o.reduce((t,i,n)=>{const s=e[n]||"";return t+i+s},"")}class Ry{constructor(){this._parts=[]}push(...e){this._parts.push(...e)}join(e=`
|
||
`){return this._parts.join(e)}}let Op=()=>({get delay(){return-1},dispose:()=>{},showHover:()=>{}});const E9=new l.Lazy(()=>Op("mouse",!1)),I9=new l.Lazy(()=>Op("element",!1));function T9(o){Op=o}function Io(o){return o==="element"?I9.value:E9.value}function sM(){return Op("element",!0)}let oM={showInstantHover:()=>{},showDelayedHover:()=>{},setupDelayedHover:()=>l.Disposable.None,setupDelayedHoverAtMouse:()=>l.Disposable.None,hideHover:()=>{},showAndFocusLastHover:()=>{},setupManagedHover:()=>({dispose:()=>{},show:()=>{},hide:()=>{},update:()=>{}}),showManagedHover:()=>{}};function N9(o){oM=o}function En(){return oM}class R9{constructor(e){this.spliceables=e}splice(e,t,i){this.spliceables.forEach(n=>n.splice(e,t,i))}}const Pp="notSelectable";class Ja extends Error{constructor(e,t){super(`ListError [${e}] ${t}`)}}function rM(o,e){const t=[];for(const i of e){if(o.start>=i.range.end)continue;if(o.end<i.range.start)break;const n=ii.intersect(o,i.range);ii.isEmpty(n)||t.push({range:n,size:i.size})}return t}function My({start:o,end:e},t){return{start:o+t,end:e+t}}function M9(o){const e=[];let t=null;for(const i of o){const n=i.range.start,s=i.range.end,r=i.size;if(t&&r===t.size){t.range.end=s;continue}t={range:{start:n,end:s},size:r},e.push(t)}return e}function A9(...o){return M9(o.reduce((e,t)=>e.concat(t),[]))}class O9{get paddingTop(){return this._paddingTop}set paddingTop(e){this._size=this._size+e-this._paddingTop,this._paddingTop=e}constructor(e){this.groups=[],this._size=0,this._paddingTop=0,this._paddingTop=e??0,this._size=this._paddingTop}splice(e,t,i=[]){const n=i.length-t,s=rM({start:0,end:e},this.groups),r=rM({start:e+t,end:Number.POSITIVE_INFINITY},this.groups).map(c=>({range:My(c.range,n),size:c.size})),a=i.map((c,h)=>({range:{start:e+h,end:e+h+1},size:c.size}));this.groups=A9(s,a,r),this._size=this._paddingTop+this.groups.reduce((c,h)=>c+h.size*(h.range.end-h.range.start),0)}get count(){const e=this.groups.length;return e?this.groups[e-1].range.end:0}get size(){return this._size}indexAt(e){if(e<0)return-1;if(e<this._paddingTop)return 0;let t=0,i=this._paddingTop;for(const n of this.groups){const s=n.range.end-n.range.start,r=i+s*n.size;if(e<r)return t+Math.floor((e-i)/n.size);t+=s,i=r}return t}indexAfter(e){return Math.min(this.indexAt(e)+1,this.count)}positionAt(e){if(e<0)return-1;let t=0,i=0;for(const n of this.groups){const s=n.range.end-n.range.start,r=i+s;if(e<r)return this._paddingTop+t+(e-i)*n.size;t+=s*n.size,i=r}return-1}}class P9{constructor(e){this.renderers=e,this.cache=new Map,this.transactionNodesPendingRemoval=new Set,this.inTransaction=!1}alloc(e){let t=this.getTemplateCache(e).pop(),i=!1;if(t)i=this.transactionNodesPendingRemoval.delete(t.domNode);else{const n=Q(".monaco-list-row"),r=this.getRenderer(e).renderTemplate(n);t={domNode:n,templateId:e,templateData:r}}return{row:t,isReusingConnectedDomNode:i}}release(e){e&&this.releaseRow(e)}transact(e){if(this.inTransaction)throw new Error("Already in transaction");this.inTransaction=!0;try{e()}finally{for(const t of this.transactionNodesPendingRemoval)this.doRemoveNode(t);this.transactionNodesPendingRemoval.clear(),this.inTransaction=!1}}releaseRow(e){const{domNode:t,templateId:i}=e;t&&(this.inTransaction?this.transactionNodesPendingRemoval.add(t):this.doRemoveNode(t)),this.getTemplateCache(i).push(e)}doRemoveNode(e){e.classList.remove("scrolling"),e.remove()}getTemplateCache(e){let t=this.cache.get(e);return t||(t=[],this.cache.set(e,t)),t}dispose(){this.cache.forEach((e,t)=>{for(const i of e)this.getRenderer(t).disposeTemplate(i.templateData),i.templateData=null}),this.cache.clear(),this.transactionNodesPendingRemoval.clear()}getRenderer(e){const t=this.renderers.get(e);if(!t)throw new Error(`No renderer found for ${e}`);return t}}function k9(o,e,t,i=[]){if(!o.dataTransfer)return;const n=Q(".monaco-drag-image");n.textContent=t,n.classList.add(...i),(a=>{for(;a&&!a.classList.contains("monaco-workbench");)a=a.parentElement;return a||e.ownerDocument.body})(e).appendChild(n),o.dataTransfer.setDragImage(n,-10,-10),setTimeout(()=>n.remove(),0)}var To=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s};const Wa={CurrentDragAndDropData:void 0},zs={useShadows:!0,verticalScrollMode:1,setRowLineHeight:!0,setRowHeight:!0,supportDynamicHeights:!1,dnd:{getDragElements(o){return[o]},getDragURI(){return null},onDragStart(){},onDragOver(){return!1},drop(){},dispose(){}},horizontalScrolling:!1,transformOptimization:!0,alwaysConsumeMouseWheel:!0};class $u{constructor(e){this.elements=e}update(){}getData(){return this.elements}}class F9{constructor(e){this.elements=e}update(){}getData(){return this.elements}}class B9{constructor(){this.types=[],this.files=[]}update(e){if(e.types&&this.types.splice(0,this.types.length,...e.types),e.files){this.files.splice(0,this.files.length);for(let t=0;t<e.files.length;t++){const i=e.files.item(t);i&&(i.size||i.type)&&this.files.push(i)}}}getData(){return{types:this.types,files:this.files}}}function z9(o,e){return Array.isArray(o)&&Array.isArray(e)?l.equals(o,e):o===e}class V9{constructor(e){e?.getSetSize?this.getSetSize=e.getSetSize.bind(e):this.getSetSize=(t,i,n)=>n,e?.getPosInSet?this.getPosInSet=e.getPosInSet.bind(e):this.getPosInSet=(t,i)=>i+1,e?.getRole?this.getRole=e.getRole.bind(e):this.getRole=t=>"listitem",e?.isChecked?this.isChecked=e.isChecked.bind(e):this.isChecked=t=>{}}}const gb=class gb{get contentHeight(){return this.rangeMap.size}get onDidScroll(){return this.scrollableElement.onScroll}get scrollableElementDomNode(){return this.scrollableElement.getDomNode()}get horizontalScrolling(){return this._horizontalScrolling}set horizontalScrolling(e){if(e!==this._horizontalScrolling){if(e&&this.supportDynamicHeights)throw new Error("Horizontal scrolling and dynamic heights not supported simultaneously");if(this._horizontalScrolling=e,this.domNode.classList.toggle("horizontal-scrolling",this._horizontalScrolling),this._horizontalScrolling){for(const t of this.items)this.measureItemWidth(t);this.updateScrollWidth(),this.scrollableElement.setScrollDimensions({width:rC(this.domNode)}),this.rowsContainer.style.width=`${Math.max(this.scrollWidth||0,this.renderWidth)}px`}else this.scrollableElementWidthDelayer.cancel(),this.scrollableElement.setScrollDimensions({width:this.renderWidth,scrollWidth:this.renderWidth}),this.rowsContainer.style.width="",this.domNode.style.removeProperty("--list-scroll-right-offset")}}constructor(e,t,i,n=zs){if(this.virtualDelegate=t,this.domId=`list_id_${++gb.InstanceCount}`,this.renderers=new Map,this.renderWidth=0,this._scrollHeight=0,this.scrollableElementUpdateDisposable=null,this.scrollableElementWidthDelayer=new l.Delayer(50),this.splicing=!1,this.dragOverAnimationStopDisposable=l.Disposable.None,this.dragOverMouseY=0,this.canDrop=!1,this.currentDragFeedbackDisposable=l.Disposable.None,this.onDragLeaveTimeout=l.Disposable.None,this.currentSelectionDisposable=l.Disposable.None,this.disposables=new l.DisposableStore,this._onDidChangeContentHeight=this.disposables.add(new l.Emitter),this._onDidChangeContentWidth=this.disposables.add(new l.Emitter),this.onDidChangeContentHeight=l.Event.latch(this._onDidChangeContentHeight.event,void 0,this.disposables),this._horizontalScrolling=!1,n.horizontalScrolling&&n.supportDynamicHeights)throw new Error("Horizontal scrolling and dynamic heights not supported simultaneously");this.items=[],this.itemId=0,this.rangeMap=this.createRangeMap(n.paddingTop??0);for(const r of i)this.renderers.set(r.templateId,r);if(this.cache=this.disposables.add(new P9(this.renderers)),this.lastRenderTop=0,this.lastRenderHeight=0,this.domNode=document.createElement("div"),this.domNode.className="monaco-list",this.domNode.classList.add(this.domId),this.domNode.tabIndex=0,this.domNode.classList.toggle("mouse-support",typeof n.mouseSupport=="boolean"?n.mouseSupport:!0),this._horizontalScrolling=n.horizontalScrolling??zs.horizontalScrolling,this.domNode.classList.toggle("horizontal-scrolling",this._horizontalScrolling),this.paddingBottom=typeof n.paddingBottom>"u"?0:n.paddingBottom,this.accessibilityProvider=new V9(n.accessibilityProvider),this.rowsContainer=document.createElement("div"),this.rowsContainer.className="monaco-list-rows",(n.transformOptimization??zs.transformOptimization)&&(this.rowsContainer.style.transform="translate3d(0px, 0px, 0px)",this.rowsContainer.style.overflow="hidden",this.rowsContainer.style.contain="strict"),this.disposables.add(li.addTarget(this.rowsContainer)),this.scrollable=this.disposables.add(new mc({forceIntegerValues:!0,smoothScrollDuration:n.smoothScrolling??!1?125:0,scheduleAtNextAnimationFrame:r=>Ti(j(this.domNode),r)})),this.scrollableElement=this.disposables.add(new Xg(this.rowsContainer,{alwaysConsumeMouseWheel:n.alwaysConsumeMouseWheel??zs.alwaysConsumeMouseWheel,horizontal:1,vertical:n.verticalScrollMode??zs.verticalScrollMode,useShadows:n.useShadows??zs.useShadows,mouseWheelScrollSensitivity:n.mouseWheelScrollSensitivity,fastScrollSensitivity:n.fastScrollSensitivity,scrollByPage:n.scrollByPage},this.scrollable)),this.domNode.appendChild(this.scrollableElement.getDomNode()),e.appendChild(this.domNode),this.scrollableElement.onScroll(this.onScroll,this,this.disposables),this.disposables.add(R(this.rowsContainer,_.EventType$1.Change,r=>this.onTouchChange(r))),this.disposables.add(R(this.scrollableElement.getDomNode(),"scroll",r=>{const a=r.target,c=a.scrollTop;a.scrollTop=0,n.scrollToActiveElement&&this.setScrollTop(this.scrollTop+c)})),this.disposables.add(R(this.domNode,"dragover",r=>this.onDragOver(this.toDragEvent(r)))),this.disposables.add(R(this.domNode,"drop",r=>this.onDrop(this.toDragEvent(r)))),this.disposables.add(R(this.domNode,"dragleave",r=>this.onDragLeave(this.toDragEvent(r)))),this.disposables.add(R(this.domNode,"dragend",r=>this.onDragEnd(r))),n.userSelection){if(n.dnd)throw new Error("DND and user selection cannot be used simultaneously");this.disposables.add(R(this.domNode,"mousedown",r=>this.onPotentialSelectionStart(r)))}this.setRowLineHeight=n.setRowLineHeight??zs.setRowLineHeight,this.setRowHeight=n.setRowHeight??zs.setRowHeight,this.supportDynamicHeights=n.supportDynamicHeights??zs.supportDynamicHeights,this.dnd=n.dnd??this.disposables.add(zs.dnd),this.layout(n.initialSize?.height,n.initialSize?.width),n.scrollToActiveElement&&this._setupFocusObserver(e)}_setupFocusObserver(e){this.disposables.add(R(e,"focus",()=>{const t=wt();this.activeElement!==t&&t!==null&&(this.activeElement=t,this._scrollToActiveElement(this.activeElement,e))},!0))}_scrollToActiveElement(e,t){const i=t.getBoundingClientRect(),s=e.getBoundingClientRect().top-i.top;s<0&&this.setScrollTop(this.scrollTop+s)}updateOptions(e){e.paddingBottom!==void 0&&(this.paddingBottom=e.paddingBottom,this.scrollableElement.setScrollDimensions({scrollHeight:this.scrollHeight})),e.smoothScrolling!==void 0&&this.scrollable.setSmoothScrollDuration(e.smoothScrolling?125:0),e.horizontalScrolling!==void 0&&(this.horizontalScrolling=e.horizontalScrolling);let t;if(e.scrollByPage!==void 0&&(t={...t??{},scrollByPage:e.scrollByPage}),e.mouseWheelScrollSensitivity!==void 0&&(t={...t??{},mouseWheelScrollSensitivity:e.mouseWheelScrollSensitivity}),e.fastScrollSensitivity!==void 0&&(t={...t??{},fastScrollSensitivity:e.fastScrollSensitivity}),t&&this.scrollableElement.updateOptions(t),e.paddingTop!==void 0&&e.paddingTop!==this.rangeMap.paddingTop){const i=this.getRenderRange(this.lastRenderTop,this.lastRenderHeight),n=e.paddingTop-this.rangeMap.paddingTop;this.rangeMap.paddingTop=e.paddingTop,this.render(i,Math.max(0,this.lastRenderTop+n),this.lastRenderHeight,void 0,void 0,!0),this.setScrollTop(this.lastRenderTop),this.eventuallyUpdateScrollDimensions(),this.supportDynamicHeights&&this._rerender(this.lastRenderTop,this.lastRenderHeight)}}createRangeMap(e){return new O9(e)}splice(e,t,i=[]){if(this.splicing)throw new Error("Can't run recursive splices.");this.splicing=!0;try{return this._splice(e,t,i)}finally{this.splicing=!1,this._onDidChangeContentHeight.fire(this.contentHeight)}}_splice(e,t,i=[]){const n=this.getRenderRange(this.lastRenderTop,this.lastRenderHeight),s={start:e,end:e+t},r=ii.intersect(n,s),a=new Map;for(let L=r.end-1;L>=r.start;L--){const D=this.items[L];if(D.dragStartDisposable.dispose(),D.checkedDisposable.dispose(),D.row){let x=a.get(D.templateId);x||(x=[],a.set(D.templateId,x));const I=this.renderers.get(D.templateId);I&&I.disposeElement&&I.disposeElement(D.element,L,D.row.templateData,{height:D.size}),x.unshift(D.row)}D.row=null,D.stale=!0}const c={start:e+t,end:this.items.length},h=ii.intersect(c,n),d=ii.relativeComplement(c,n),u=i.map(L=>({id:String(this.itemId++),element:L,templateId:this.virtualDelegate.getTemplateId(L),size:this.virtualDelegate.getHeight(L),width:void 0,hasDynamicHeight:!!this.virtualDelegate.hasDynamicHeight&&this.virtualDelegate.hasDynamicHeight(L),lastDynamicHeightWidth:void 0,row:null,uri:void 0,dropTarget:!1,dragStartDisposable:l.Disposable.None,checkedDisposable:l.Disposable.None,stale:!1}));let f;e===0&&t>=this.items.length?(this.rangeMap=this.createRangeMap(this.rangeMap.paddingTop),this.rangeMap.splice(0,0,u),f=this.items,this.items=u):(this.rangeMap.splice(e,t,u),f=l.splice(this.items,e,t,u));const g=i.length-t,m=this.getRenderRange(this.lastRenderTop,this.lastRenderHeight),p=My(h,g),b=ii.intersect(m,p);for(let L=b.start;L<b.end;L++)this.updateItemInDOM(this.items[L],L);const v=ii.relativeComplement(p,m);for(const L of v)for(let D=L.start;D<L.end;D++)this.removeItemFromDOM(D);const C=d.map(L=>My(L,g)),S=[{start:e,end:e+i.length},...C].map(L=>ii.intersect(m,L)).reverse();for(const L of S)for(let D=L.end-1;D>=L.start;D--){const x=this.items[D],T=a.get(x.templateId)?.pop();this.insertItemInDOM(D,T)}for(const L of a.values())for(const D of L)this.cache.release(D);return this.eventuallyUpdateScrollDimensions(),this.supportDynamicHeights&&this._rerender(this.scrollTop,this.renderHeight),f.map(L=>L.element)}eventuallyUpdateScrollDimensions(){this._scrollHeight=this.contentHeight,this.rowsContainer.style.height=`${this._scrollHeight}px`,this.scrollableElementUpdateDisposable||(this.scrollableElementUpdateDisposable=Ti(j(this.domNode),()=>{this.scrollableElement.setScrollDimensions({scrollHeight:this.scrollHeight}),this.updateScrollWidth(),this.scrollableElementUpdateDisposable=null}))}eventuallyUpdateScrollWidth(){if(!this.horizontalScrolling){this.scrollableElementWidthDelayer.cancel();return}this.scrollableElementWidthDelayer.trigger(()=>this.updateScrollWidth())}updateScrollWidth(){if(!this.horizontalScrolling)return;let e=0;for(const t of this.items)typeof t.width<"u"&&(e=Math.max(e,t.width));this.scrollWidth=e,this.scrollableElement.setScrollDimensions({scrollWidth:e===0?0:e+10}),this._onDidChangeContentWidth.fire(this.scrollWidth)}rerender(){if(this.supportDynamicHeights){for(const e of this.items)e.lastDynamicHeightWidth=void 0;this._rerender(this.lastRenderTop,this.lastRenderHeight)}}get length(){return this.items.length}get renderHeight(){return this.scrollableElement.getScrollDimensions().height}get firstVisibleIndex(){return this.getVisibleRange(this.lastRenderTop,this.lastRenderHeight).start}element(e){return this.items[e].element}indexOf(e){return this.items.findIndex(t=>t.element===e)}domElement(e){const t=this.items[e].row;return t&&t.domNode}elementHeight(e){return this.items[e].size}elementTop(e){return this.rangeMap.positionAt(e)}indexAt(e){return this.rangeMap.indexAt(e)}indexAfter(e){return this.rangeMap.indexAfter(e)}layout(e,t){const i={height:typeof e=="number"?e:wF(this.domNode)};if(this.scrollableElementUpdateDisposable&&(this.scrollableElementUpdateDisposable.dispose(),this.scrollableElementUpdateDisposable=null,i.scrollHeight=this.scrollHeight),this.scrollableElement.setScrollDimensions(i),typeof t<"u"&&(this.renderWidth=t,this.supportDynamicHeights&&this._rerender(this.scrollTop,this.renderHeight)),this.horizontalScrolling){this.scrollableElement.setScrollDimensions({width:typeof t=="number"?t:rC(this.domNode)});const n=this.scrollableElement.getScrollPosition(),s=this.scrollableElement.getScrollDimensions(),r=Math.max(0,s.scrollWidth-n.scrollLeft-this.renderWidth);this.domNode.style.setProperty("--list-scroll-right-offset",`${Math.max(r-12,0)}px`)}}render(e,t,i,n,s,r=!1,a=!1){const c=this.getRenderRange(t,i),h=ii.relativeComplement(c,e).reverse(),d=ii.relativeComplement(e,c);if(r){const u=ii.intersect(e,c);for(let f=u.start;f<u.end;f++)this.updateItemInDOM(this.items[f],f)}if(this.cache.transact(()=>{for(const u of d)for(let f=u.start;f<u.end;f++)this.removeItemFromDOM(f,a);for(const u of h)for(let f=u.end-1;f>=u.start;f--)this.insertItemInDOM(f)}),n!==void 0&&(this.rowsContainer.style.left=`-${n}px`),this.rowsContainer.style.top=`-${t}px`,this.horizontalScrolling&&s!==void 0){this.rowsContainer.style.width=`${Math.max(s,this.renderWidth)}px`;const u=Math.max(0,s-(n??0)-this.renderWidth);this.domNode.style.setProperty("--list-scroll-right-offset",`${Math.max(u-12,0)}px`)}this.lastRenderTop=t,this.lastRenderHeight=i}insertItemInDOM(e,t){const i=this.items[e];if(!i.row)if(t)i.row=t,i.stale=!0;else{const h=this.cache.alloc(i.templateId);i.row=h.row,i.stale||=h.isReusingConnectedDomNode}const n=this.accessibilityProvider.getRole(i.element)||"listitem";i.row.domNode.setAttribute("role",n);const s=this.accessibilityProvider.isChecked(i.element),r=h=>h==="mixed"?"mixed":String(!!h);if(typeof s=="boolean"||s==="mixed")i.row.domNode.setAttribute("aria-checked",r(s));else if(s){const h=d=>i.row.domNode.setAttribute("aria-checked",r(d));h(s.value),i.checkedDisposable=s.onDidChange(()=>h(s.value))}if(i.stale||!i.row.domNode.parentElement){const h=this.items.at(e+1)?.row?.domNode??null;(i.row.domNode.parentElement!==this.rowsContainer||i.row.domNode.nextElementSibling!==h)&&this.rowsContainer.insertBefore(i.row.domNode,h),i.stale=!1}this.updateItemInDOM(i,e);const a=this.renderers.get(i.templateId);if(!a)throw new Error(`No renderer found for template id ${i.templateId}`);a?.renderElement(i.element,e,i.row.templateData,{height:i.size});const c=this.dnd.getDragURI(i.element);i.dragStartDisposable.dispose(),i.row.domNode.draggable=!!c,c&&(i.dragStartDisposable=R(i.row.domNode,"dragstart",h=>this.onDragStart(i.element,c,h))),this.horizontalScrolling&&(this.measureItemWidth(i),this.eventuallyUpdateScrollWidth())}measureItemWidth(e){if(!e.row||!e.row.domNode)return;e.row.domNode.style.width="fit-content",e.width=rC(e.row.domNode);const t=j(e.row.domNode).getComputedStyle(e.row.domNode);t.paddingLeft&&(e.width+=parseFloat(t.paddingLeft)),t.paddingRight&&(e.width+=parseFloat(t.paddingRight)),e.row.domNode.style.width=""}updateItemInDOM(e,t){e.row.domNode.style.top=`${this.elementTop(t)}px`,this.setRowHeight&&(e.row.domNode.style.height=`${e.size}px`),this.setRowLineHeight&&(e.row.domNode.style.lineHeight=`${e.size}px`),e.row.domNode.setAttribute("data-index",`${t}`),e.row.domNode.setAttribute("data-last-element",t===this.length-1?"true":"false"),e.row.domNode.setAttribute("data-parity",t%2===0?"even":"odd"),e.row.domNode.setAttribute("aria-setsize",String(this.accessibilityProvider.getSetSize(e.element,t,this.length))),e.row.domNode.setAttribute("aria-posinset",String(this.accessibilityProvider.getPosInSet(e.element,t))),e.row.domNode.setAttribute("id",this.getElementDomId(t)),e.row.domNode.classList.toggle("drop-target",e.dropTarget)}removeItemFromDOM(e,t){const i=this.items[e];if(i.dragStartDisposable.dispose(),i.checkedDisposable.dispose(),i.row){const n=this.renderers.get(i.templateId);n&&n.disposeElement&&n.disposeElement(i.element,e,i.row.templateData,{height:i.size,onScroll:t}),this.cache.release(i.row),i.row=null}this.horizontalScrolling&&this.eventuallyUpdateScrollWidth()}getScrollTop(){return this.scrollableElement.getScrollPosition().scrollTop}setScrollTop(e,t){this.scrollableElementUpdateDisposable&&(this.scrollableElementUpdateDisposable.dispose(),this.scrollableElementUpdateDisposable=null,this.scrollableElement.setScrollDimensions({scrollHeight:this.scrollHeight})),this.scrollableElement.setScrollPosition({scrollTop:e,reuseAnimation:t})}get scrollTop(){return this.getScrollTop()}set scrollTop(e){this.setScrollTop(e)}get scrollHeight(){return this._scrollHeight+(this.horizontalScrolling?10:0)+this.paddingBottom}get onMouseClick(){return l.Event.map(this.disposables.add(new Te(this.domNode,"click")).event,e=>this.toMouseEvent(e),this.disposables)}get onMouseDblClick(){return l.Event.map(this.disposables.add(new Te(this.domNode,"dblclick")).event,e=>this.toMouseEvent(e),this.disposables)}get onMouseMiddleClick(){return l.Event.filter(l.Event.map(this.disposables.add(new Te(this.domNode,"auxclick")).event,e=>this.toMouseEvent(e),this.disposables),e=>e.browserEvent.button===1,this.disposables)}get onMouseDown(){return l.Event.map(this.disposables.add(new Te(this.domNode,"mousedown")).event,e=>this.toMouseEvent(e),this.disposables)}get onMouseOver(){return l.Event.map(this.disposables.add(new Te(this.domNode,"mouseover")).event,e=>this.toMouseEvent(e),this.disposables)}get onMouseOut(){return l.Event.map(this.disposables.add(new Te(this.domNode,"mouseout")).event,e=>this.toMouseEvent(e),this.disposables)}get onContextMenu(){return l.Event.any(l.Event.map(this.disposables.add(new Te(this.domNode,"contextmenu")).event,e=>this.toMouseEvent(e),this.disposables),l.Event.map(this.disposables.add(new Te(this.domNode,_.EventType$1.Contextmenu)).event,e=>this.toGestureEvent(e),this.disposables))}get onTouchStart(){return l.Event.map(this.disposables.add(new Te(this.domNode,"touchstart")).event,e=>this.toTouchEvent(e),this.disposables)}get onTap(){return l.Event.map(this.disposables.add(new Te(this.rowsContainer,_.EventType$1.Tap)).event,e=>this.toGestureEvent(e),this.disposables)}toMouseEvent(e){const t=this.getItemIndexFromEventTarget(e.target||null),i=typeof t>"u"?void 0:this.items[t],n=i&&i.element;return{browserEvent:e,index:t,element:n}}toTouchEvent(e){const t=this.getItemIndexFromEventTarget(e.target||null),i=typeof t>"u"?void 0:this.items[t],n=i&&i.element;return{browserEvent:e,index:t,element:n}}toGestureEvent(e){const t=this.getItemIndexFromEventTarget(e.initialTarget||null),i=typeof t>"u"?void 0:this.items[t],n=i&&i.element;return{browserEvent:e,index:t,element:n}}toDragEvent(e){const t=this.getItemIndexFromEventTarget(e.target||null),i=typeof t>"u"?void 0:this.items[t],n=i&&i.element,s=this.getTargetSector(e,t);return{browserEvent:e,index:t,element:n,sector:s}}onScroll(e){try{const t=this.getRenderRange(this.lastRenderTop,this.lastRenderHeight);this.render(t,e.scrollTop,e.height,e.scrollLeft,e.scrollWidth,void 0,!0),this.supportDynamicHeights&&this._rerender(e.scrollTop,e.height,e.inSmoothScrolling)}catch(t){throw console.error("Got bad scroll event:",e),t}}onTouchChange(e){e.preventDefault(),e.stopPropagation(),this.scrollTop-=e.translationY}onDragStart(e,t,i){if(!i.dataTransfer)return;const n=this.dnd.getDragElements(e);i.dataTransfer.effectAllowed="copyMove",i.dataTransfer.setData(pc.TEXT,t);let s;this.dnd.getDragLabel&&(s=this.dnd.getDragLabel(n,i)),typeof s>"u"&&(s=String(n.length)),k9(i,this.domNode,s,[this.domId]),this.domNode.classList.add("dragging"),this.currentDragData=new $u(n),Wa.CurrentDragAndDropData=new F9(n),this.dnd.onDragStart?.(this.currentDragData,i)}onPotentialSelectionStart(e){this.currentSelectionDisposable.dispose();const t=cF(this.domNode),i=this.currentSelectionDisposable=new l.DisposableStore,n=i.add(new l.DisposableStore);n.add(R(this.domNode,"selectstart",()=>{n.add(R(t,"mousemove",s=>{t.getSelection()?.isCollapsed===!1&&this.setupDragAndDropScrollTopAnimation(s)})),i.add(l.toDisposable(()=>{const s=this.getRenderRange(this.lastRenderTop,this.lastRenderHeight);this.currentSelectionBounds=void 0,this.render(s,this.lastRenderTop,this.lastRenderHeight,void 0,void 0)})),i.add(R(t,"selectionchange",()=>{const s=t.getSelection();if(!s||s.isCollapsed){n.isDisposed&&i.dispose();return}let r=this.getIndexOfListElement(s.anchorNode),a=this.getIndexOfListElement(s.focusNode);r!==void 0&&a!==void 0&&(a<r&&([r,a]=[a,r]),this.currentSelectionBounds={start:r,end:a})}))})),n.add(R(t,"mouseup",()=>{n.dispose(),this.teardownDragAndDropScrollTopAnimation(),t.getSelection()?.isCollapsed!==!1&&i.dispose()}))}getIndexOfListElement(e){if(!(!e||!this.domNode.contains(e)))for(;e&&e!==this.domNode;){if(e.dataset?.index)return Number(e.dataset.index);e=e.parentElement}}onDragOver(e){if(e.browserEvent.preventDefault(),this.onDragLeaveTimeout.dispose(),Wa.CurrentDragAndDropData&&Wa.CurrentDragAndDropData.getData()==="vscode-ui"||(this.setupDragAndDropScrollTopAnimation(e.browserEvent),!e.browserEvent.dataTransfer))return!1;if(!this.currentDragData)if(Wa.CurrentDragAndDropData)this.currentDragData=Wa.CurrentDragAndDropData;else{if(!e.browserEvent.dataTransfer.types)return!1;this.currentDragData=new B9}const t=this.dnd.onDragOver(this.currentDragData,e.element,e.index,e.sector,e.browserEvent);if(this.canDrop=typeof t=="boolean"?t:t.accept,!this.canDrop)return this.currentDragFeedback=void 0,this.currentDragFeedbackDisposable.dispose(),!1;e.browserEvent.dataTransfer.dropEffect=typeof t!="boolean"&&t.effect?.type===0?"copy":"move";let i;typeof t!="boolean"&&t.feedback?i=t.feedback:typeof e.index>"u"?i=[-1]:i=[e.index],i=l.distinct(i).filter(s=>s>=-1&&s<this.length).sort((s,r)=>s-r),i=i[0]===-1?[-1]:i;let n=typeof t!="boolean"&&t.effect&&t.effect.position?t.effect.position:"drop-target";if(z9(this.currentDragFeedback,i)&&this.currentDragFeedbackPosition===n)return!0;if(this.currentDragFeedback=i,this.currentDragFeedbackPosition=n,this.currentDragFeedbackDisposable.dispose(),i[0]===-1)this.domNode.classList.add(n),this.rowsContainer.classList.add(n),this.currentDragFeedbackDisposable=l.toDisposable(()=>{this.domNode.classList.remove(n),this.rowsContainer.classList.remove(n)});else{if(i.length>1&&n!=="drop-target")throw new Error("Can't use multiple feedbacks with position different than 'over'");n==="drop-target-after"&&i[0]<this.length-1&&(i[0]+=1,n="drop-target-before");for(const s of i){const r=this.items[s];r.dropTarget=!0,r.row?.domNode.classList.add(n)}this.currentDragFeedbackDisposable=l.toDisposable(()=>{for(const s of i){const r=this.items[s];r.dropTarget=!1,r.row?.domNode.classList.remove(n)}})}return!0}onDragLeave(e){this.onDragLeaveTimeout.dispose(),this.onDragLeaveTimeout=l.disposableTimeout(()=>this.clearDragOverFeedback(),100,this.disposables),this.currentDragData&&this.dnd.onDragLeave?.(this.currentDragData,e.element,e.index,e.browserEvent)}onDrop(e){if(!this.canDrop)return;const t=this.currentDragData;this.teardownDragAndDropScrollTopAnimation(),this.clearDragOverFeedback(),this.domNode.classList.remove("dragging"),this.currentDragData=void 0,Wa.CurrentDragAndDropData=void 0,!(!t||!e.browserEvent.dataTransfer)&&(e.browserEvent.preventDefault(),t.update(e.browserEvent.dataTransfer),this.dnd.drop(t,e.element,e.index,e.sector,e.browserEvent))}onDragEnd(e){this.canDrop=!1,this.teardownDragAndDropScrollTopAnimation(),this.clearDragOverFeedback(),this.domNode.classList.remove("dragging"),this.currentDragData=void 0,Wa.CurrentDragAndDropData=void 0,this.dnd.onDragEnd?.(e)}clearDragOverFeedback(){this.currentDragFeedback=void 0,this.currentDragFeedbackPosition=void 0,this.currentDragFeedbackDisposable.dispose(),this.currentDragFeedbackDisposable=l.Disposable.None}setupDragAndDropScrollTopAnimation(e){if(!this.dragOverAnimationDisposable){const t=rx(this.domNode).top;this.dragOverAnimationDisposable=RF(j(this.domNode),this.animateDragAndDropScrollTop.bind(this,t))}this.dragOverAnimationStopDisposable.dispose(),this.dragOverAnimationStopDisposable=l.disposableTimeout(()=>{this.dragOverAnimationDisposable&&(this.dragOverAnimationDisposable.dispose(),this.dragOverAnimationDisposable=void 0)},1e3,this.disposables),this.dragOverMouseY=e.pageY}animateDragAndDropScrollTop(e){if(this.dragOverMouseY===void 0)return;const t=this.dragOverMouseY-e,i=this.renderHeight-35;t<35?this.scrollTop+=Math.max(-14,Math.floor(.3*(t-35))):t>i&&(this.scrollTop+=Math.min(14,Math.floor(.3*(t-i))))}teardownDragAndDropScrollTopAnimation(){this.dragOverAnimationStopDisposable.dispose(),this.dragOverAnimationDisposable&&(this.dragOverAnimationDisposable.dispose(),this.dragOverAnimationDisposable=void 0)}getTargetSector(e,t){if(t===void 0)return;const i=e.offsetY/this.items[t].size,n=Math.floor(i/.25);return wi(n,0,3)}getItemIndexFromEventTarget(e){const t=this.scrollableElement.getDomNode();let i=e;for(;(Ve(i)||hx(i))&&i!==this.rowsContainer&&t.contains(i);){const n=i.getAttribute("data-index");if(n){const s=Number(n);if(!isNaN(s))return s}i=i.parentElement}}getVisibleRange(e,t){return{start:this.rangeMap.indexAt(e),end:this.rangeMap.indexAfter(e+t-1)}}getRenderRange(e,t){const i=this.getVisibleRange(e,t);if(this.currentSelectionBounds){const n=this.rangeMap.count;i.start=Math.min(i.start,this.currentSelectionBounds.start,n),i.end=Math.min(Math.max(i.end,this.currentSelectionBounds.end+1),n)}return i}_rerender(e,t,i){const n=this.getRenderRange(e,t);let s,r;e===this.elementTop(n.start)?(s=n.start,r=0):n.end-n.start>1&&(s=n.start+1,r=this.elementTop(s)-e);let a=0;for(;;){const c=this.getRenderRange(e,t);let h=!1;for(let d=c.start;d<c.end;d++){const u=this.probeDynamicHeight(d);u!==0&&this.rangeMap.splice(d,1,[this.items[d]]),a+=u,h=h||u!==0}if(!h){a!==0&&this.eventuallyUpdateScrollDimensions();const d=ii.relativeComplement(n,c);for(const f of d)for(let g=f.start;g<f.end;g++)this.items[g].row&&this.removeItemFromDOM(g);const u=ii.relativeComplement(c,n).reverse();for(const f of u)for(let g=f.end-1;g>=f.start;g--)this.insertItemInDOM(g);for(let f=c.start;f<c.end;f++)this.items[f].row&&this.updateItemInDOM(this.items[f],f);if(typeof s=="number"){const f=this.scrollable.getFutureScrollPosition().scrollTop-e,g=this.elementTop(s)-r+f;this.setScrollTop(g,i)}this._onDidChangeContentHeight.fire(this.contentHeight);return}}}probeDynamicHeight(e){const t=this.items[e],i=this.probeDynamicHeightForItem(t,e);return i>0&&this.virtualDelegate.setDynamicHeight?.(t.element,t.size),i}probeDynamicHeightForItem(e,t){if(this.virtualDelegate.getDynamicHeight){const r=this.virtualDelegate.getDynamicHeight(e.element);if(r!==null){const a=e.size;return e.size=r,e.lastDynamicHeightWidth=this.renderWidth,r-a}}if(!e.hasDynamicHeight||e.lastDynamicHeightWidth===this.renderWidth||this.virtualDelegate.hasDynamicHeight&&!this.virtualDelegate.hasDynamicHeight(e.element))return 0;const i=e.size;if(e.row)return e.row.domNode.style.height="",e.size=e.row.domNode.offsetHeight,e.size===0&&(ut(e.row.domNode,j(e.row.domNode).document.body)?console.warn("Measured item node at 0px- ensure that ListView is not display:none before measuring row height!",new Error().stack):console.warn("Measuring item node that is not in DOM! Add ListView to the DOM before measuring row height!",new Error().stack)),e.lastDynamicHeightWidth=this.renderWidth,e.size-i;const{row:n}=this.cache.alloc(e.templateId);n.domNode.style.height="",this.rowsContainer.appendChild(n.domNode);const s=this.renderers.get(e.templateId);if(!s)throw new l.BugIndicatingError("Missing renderer for templateId: "+e.templateId);return s.renderElement(e.element,t,n.templateData),e.size=n.domNode.offsetHeight,s.disposeElement?.(e.element,t,n.templateData),e.lastDynamicHeightWidth=this.renderWidth,n.domNode.remove(),this.cache.release(n),e.size-i}getElementDomId(e){return`${this.domId}_${e}`}dispose(){for(const e of this.items)if(e.dragStartDisposable.dispose(),e.checkedDisposable.dispose(),e.row){const t=this.renderers.get(e.row.templateId);t&&(t.disposeElement?.(e.element,-1,e.row.templateData,void 0),t.disposeTemplate(e.row.templateData))}this.items=[],this.domNode?.remove(),this.dragOverAnimationDisposable?.dispose(),this.disposables.dispose()}};gb.InstanceCount=0;let Bn=gb;To([et],Bn.prototype,"onMouseClick",null),To([et],Bn.prototype,"onMouseDblClick",null),To([et],Bn.prototype,"onMouseMiddleClick",null),To([et],Bn.prototype,"onMouseDown",null),To([et],Bn.prototype,"onMouseOver",null),To([et],Bn.prototype,"onMouseOut",null),To([et],Bn.prototype,"onContextMenu",null),To([et],Bn.prototype,"onTouchStart",null),To([et],Bn.prototype,"onTap",null);var Lr=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s};class U9{constructor(e){this.trait=e,this.renderedElements=[]}get templateId(){return`template:${this.trait.name}`}renderTemplate(e){return e}renderElement(e,t,i){const n=this.renderedElements.findIndex(s=>s.templateData===i);if(n>=0){const s=this.renderedElements[n];this.trait.unrender(i),s.index=t}else{const s={index:t,templateData:i};this.renderedElements.push(s)}this.trait.renderIndex(t,i)}splice(e,t,i){const n=[];for(const s of this.renderedElements)s.index<e?n.push(s):s.index>=e+t&&n.push({index:s.index+i-t,templateData:s.templateData});this.renderedElements=n}renderIndexes(e){for(const{index:t,templateData:i}of this.renderedElements)e.indexOf(t)>-1&&this.trait.renderIndex(t,i)}disposeTemplate(e){const t=this.renderedElements.findIndex(i=>i.templateData===e);t<0||this.renderedElements.splice(t,1)}}let kp=class{get onChange(){return this._onChange.event}get name(){return this._trait}get renderer(){return new U9(this)}constructor(e){this._trait=e,this.indexes=[],this.sortedIndexes=[],this._onChange=new l.Emitter}splice(e,t,i){const n=i.length-t,s=e+t,r=[];let a=0;for(;a<this.sortedIndexes.length&&this.sortedIndexes[a]<e;)r.push(this.sortedIndexes[a++]);for(let c=0;c<i.length;c++)i[c]&&r.push(c+e);for(;a<this.sortedIndexes.length&&this.sortedIndexes[a]>=s;)r.push(this.sortedIndexes[a++]+n);this.renderer.splice(e,t,i.length),this._set(r,r)}renderIndex(e,t){t.classList.toggle(this._trait,this.contains(e))}unrender(e){e.classList.remove(this._trait)}set(e,t){return this._set(e,[...e].sort(fM),t)}_set(e,t,i){const n=this.indexes,s=this.sortedIndexes;this.indexes=e,this.sortedIndexes=t;const r=Oy(s,e);return this.renderer.renderIndexes(r),this._onChange.fire({indexes:e,browserEvent:i}),n}get(){return this.indexes}contains(e){return l.binarySearch(this.sortedIndexes,e,fM)>=0}dispose(){l.dispose(this._onChange)}};Lr([et],kp.prototype,"renderer",null);class $9 extends kp{constructor(e){super("selected"),this.setAriaSelected=e}renderIndex(e,t){super.renderIndex(e,t),this.setAriaSelected&&(this.contains(e)?t.setAttribute("aria-selected","true"):t.setAttribute("aria-selected","false"))}}class Ay{constructor(e,t,i){this.trait=e,this.view=t,this.identityProvider=i}splice(e,t,i){if(!this.identityProvider)return this.trait.splice(e,t,new Array(i.length).fill(!1));const n=this.trait.get().map(a=>this.identityProvider.getId(this.view.element(a)).toString());if(n.length===0)return this.trait.splice(e,t,new Array(i.length).fill(!1));const s=new Set(n),r=i.map(a=>s.has(this.identityProvider.getId(a).toString()));this.trait.splice(e,t,r)}}function Ku(o,e){return o.classList.contains(e)?!0:o.classList.contains("monaco-list")||!o.parentElement?!1:Ku(o.parentElement,e)}function Gu(o){return Ku(o,"monaco-editor")}function K9(o){return Ku(o,"monaco-custom-toggle")}function G9(o){return Ku(o,"action-item")}function ju(o){return Ku(o,"monaco-tree-sticky-row")}function qu(o){return o.classList.contains("monaco-tree-sticky-container")}function aM(o){return o.tagName==="A"&&o.classList.contains("monaco-button")||o.tagName==="DIV"&&o.classList.contains("monaco-button-dropdown")?!0:o.classList.contains("monaco-list")||!o.parentElement?!1:aM(o.parentElement)}class lM{get onKeyDown(){return l.Event.chain(this.disposables.add(new Te(this.view.domNode,"keydown")).event,e=>e.filter(t=>!jn(t.target)).map(t=>new Be(t)))}constructor(e,t,i){this.list=e,this.view=t,this.disposables=new l.DisposableStore,this.multipleSelectionDisposables=new l.DisposableStore,this.multipleSelectionSupport=i.multipleSelectionSupport,this.disposables.add(this.onKeyDown(n=>{switch(n.keyCode){case 3:return this.onEnter(n);case 16:return this.onUpArrow(n);case 18:return this.onDownArrow(n);case 11:return this.onPageUpArrow(n);case 12:return this.onPageDownArrow(n);case 9:return this.onEscape(n);case 31:this.multipleSelectionSupport&&(l.isMacintosh?n.metaKey:n.ctrlKey)&&this.onCtrlA(n)}}))}updateOptions(e){e.multipleSelectionSupport!==void 0&&(this.multipleSelectionSupport=e.multipleSelectionSupport)}onEnter(e){e.preventDefault(),e.stopPropagation(),this.list.setSelection(this.list.getFocus(),e.browserEvent)}onUpArrow(e){e.preventDefault(),e.stopPropagation(),this.list.focusPrevious(1,!1,e.browserEvent);const t=this.list.getFocus()[0];this.list.setAnchor(t),this.list.reveal(t),this.view.domNode.focus()}onDownArrow(e){e.preventDefault(),e.stopPropagation(),this.list.focusNext(1,!1,e.browserEvent);const t=this.list.getFocus()[0];this.list.setAnchor(t),this.list.reveal(t),this.view.domNode.focus()}onPageUpArrow(e){e.preventDefault(),e.stopPropagation(),this.list.focusPreviousPage(e.browserEvent);const t=this.list.getFocus()[0];this.list.setAnchor(t),this.list.reveal(t),this.view.domNode.focus()}onPageDownArrow(e){e.preventDefault(),e.stopPropagation(),this.list.focusNextPage(e.browserEvent);const t=this.list.getFocus()[0];this.list.setAnchor(t),this.list.reveal(t),this.view.domNode.focus()}onCtrlA(e){e.preventDefault(),e.stopPropagation();let t=l.range(this.list.length);const i=this.list.getFocus(),n=i.length>0?this.list.getElementGroupId(i[0]):void 0;n!==void 0&&(t=this.list.filterIndicesByGroup(t,n)),this.list.setSelection(t,e.browserEvent),this.list.setAnchor(void 0),this.view.domNode.focus()}onEscape(e){this.list.getSelection().length&&(e.preventDefault(),e.stopPropagation(),this.list.setSelection([],e.browserEvent),this.list.setAnchor(void 0),this.view.domNode.focus())}dispose(){this.disposables.dispose(),this.multipleSelectionDisposables.dispose()}}Lr([et],lM.prototype,"onKeyDown",null);var Vs;(function(o){o[o.Automatic=0]="Automatic",o[o.Trigger=1]="Trigger"})(Vs||(Vs={}));var Wc;(function(o){o[o.Idle=0]="Idle",o[o.Typing=1]="Typing"})(Wc||(Wc={}));const j9=new class{mightProducePrintableCharacter(o){return o.ctrlKey||o.metaKey||o.altKey?!1:o.keyCode>=31&&o.keyCode<=56||o.keyCode>=21&&o.keyCode<=30||o.keyCode>=98&&o.keyCode<=107||o.keyCode>=85&&o.keyCode<=95}};class q9{constructor(e,t,i,n,s){this.list=e,this.view=t,this.keyboardNavigationLabelProvider=i,this.keyboardNavigationEventFilter=n,this.delegate=s,this.enabled=!1,this.state=Wc.Idle,this.mode=Vs.Automatic,this.triggered=!1,this.previouslyFocused=-1,this.enabledDisposables=new l.DisposableStore,this.disposables=new l.DisposableStore,this.updateOptions(e.options)}updateOptions(e){e.typeNavigationEnabled??!0?this.enable():this.disable(),this.mode=e.typeNavigationMode??Vs.Automatic}enable(){if(this.enabled)return;let e=!1;const t=l.Event.chain(this.enabledDisposables.add(new Te(this.view.domNode,"keydown")).event,s=>s.filter(r=>!jn(r.target)).filter(()=>this.mode===Vs.Automatic||this.triggered).map(r=>new Be(r)).filter(r=>e||this.keyboardNavigationEventFilter(r)).filter(r=>this.delegate.mightProducePrintableCharacter(r)).forEach(r=>ve.stop(r,!0)).map(r=>r.browserEvent.key)),i=l.Event.debounce(t,()=>null,800,void 0,void 0,void 0,this.enabledDisposables);l.Event.reduce(l.Event.any(t,i),(s,r)=>r===null?null:(s||"")+r,void 0,this.enabledDisposables)(this.onInput,this,this.enabledDisposables),i(this.onClear,this,this.enabledDisposables),t(()=>e=!0,void 0,this.enabledDisposables),i(()=>e=!1,void 0,this.enabledDisposables),this.enabled=!0,this.triggered=!1}disable(){this.enabled&&(this.enabledDisposables.clear(),this.enabled=!1,this.triggered=!1)}onClear(){const e=this.list.getFocus();if(e.length>0&&e[0]===this.previouslyFocused){const t=this.list.options.accessibilityProvider?.getAriaLabel(this.list.element(e[0]));typeof t=="string"?ha(t):t&&ha(t.get())}this.previouslyFocused=-1}onInput(e){if(!e){this.state=Wc.Idle,this.triggered=!1;return}const t=this.list.getFocus(),i=t.length>0?t[0]:0,n=this.state===Wc.Idle?1:0;this.state=Wc.Typing;for(let s=0;s<this.list.length;s++){const r=(i+s+n)%this.list.length,a=this.keyboardNavigationLabelProvider.getKeyboardNavigationLabel(this.view.element(r)),c=a&&a.toString();if(this.list.options.typeNavigationEnabled){if(typeof c<"u"){if(Jm(e,c)){this.previouslyFocused=i,this.list.setFocus([r]),this.list.reveal(r);return}const h=J8(e,c);if(h&&h[0].end-h[0].start>1&&h.length===1){this.previouslyFocused=i,this.list.setFocus([r]),this.list.reveal(r);return}}}else if(typeof c>"u"||Jm(e,c)){this.previouslyFocused=i,this.list.setFocus([r]),this.list.reveal(r);return}}}dispose(){this.disable(),this.enabledDisposables.dispose(),this.disposables.dispose()}}class Y9{constructor(e,t){this.list=e,this.view=t,this.disposables=new l.DisposableStore;const i=l.Event.chain(this.disposables.add(new Te(t.domNode,"keydown")).event,s=>s.filter(r=>!jn(r.target)).map(r=>new Be(r)));l.Event.chain(i,s=>s.filter(r=>r.keyCode===2&&!r.ctrlKey&&!r.metaKey&&!r.shiftKey&&!r.altKey))(this.onTab,this,this.disposables)}onTab(e){if(e.target!==this.view.domNode)return;const t=this.list.getFocus();if(t.length===0)return;const i=this.view.domElement(t[0]);if(!i)return;const n=i.querySelector("[tabIndex]");if(!n||!Ve(n)||n.tabIndex===-1)return;const s=j(n).getComputedStyle(n);s.visibility==="hidden"||s.display==="none"||(e.preventDefault(),e.stopPropagation(),n.focus())}dispose(){this.disposables.dispose()}}function cM(o){return l.isMacintosh?o.browserEvent.metaKey:o.browserEvent.ctrlKey}function hM(o){return o.browserEvent.shiftKey}function Z9(o){return Qf(o)&&o.button===2}const dM={isSelectionSingleChangeEvent:cM,isSelectionRangeChangeEvent:hM};class uM{get onPointer(){return this._onPointer.event}constructor(e){this.list=e,this.disposables=new l.DisposableStore,this._onPointer=this.disposables.add(new l.Emitter),e.options.multipleSelectionSupport!==!1&&(this.multipleSelectionController=this.list.options.multipleSelectionController||dM),this.mouseSupport=typeof e.options.mouseSupport>"u"||!!e.options.mouseSupport,this.mouseSupport&&(e.onMouseDown(this.onMouseDown,this,this.disposables),e.onContextMenu(this.onContextMenu,this,this.disposables),e.onMouseDblClick(this.onDoubleClick,this,this.disposables),e.onTouchStart(this.onMouseDown,this,this.disposables),this.disposables.add(li.addTarget(e.getHTMLElement()))),l.Event.any(e.onMouseClick,e.onMouseMiddleClick,e.onTap)(this.onViewPointer,this,this.disposables)}updateOptions(e){e.multipleSelectionSupport!==void 0&&(this.multipleSelectionController=void 0,e.multipleSelectionSupport&&(this.multipleSelectionController=this.list.options.multipleSelectionController||dM))}isSelectionSingleChangeEvent(e){return this.multipleSelectionController?this.multipleSelectionController.isSelectionSingleChangeEvent(e):!1}isSelectionRangeChangeEvent(e){return this.multipleSelectionController?this.multipleSelectionController.isSelectionRangeChangeEvent(e):!1}isSelectionChangeEvent(e){return this.isSelectionSingleChangeEvent(e)||this.isSelectionRangeChangeEvent(e)}onMouseDown(e){Gu(e.browserEvent.target)||wt()!==e.browserEvent.target&&this.list.domFocus()}onContextMenu(e){if(jn(e.browserEvent.target)||Gu(e.browserEvent.target))return;const t=typeof e.index>"u"?[]:[e.index];this.list.setFocus(t,e.browserEvent)}onViewPointer(e){if(!this.mouseSupport||jn(e.browserEvent.target)||Gu(e.browserEvent.target)||e.browserEvent.isHandledByList)return;e.browserEvent.isHandledByList=!0;const t=e.index;if(typeof t>"u"){this.list.setFocus([],e.browserEvent),this.list.setSelection([],e.browserEvent),this.list.setAnchor(void 0);return}if(this.isSelectionChangeEvent(e))return this.changeSelection(e);this.list.setFocus([t],e.browserEvent),this.list.setAnchor(t),Z9(e.browserEvent)||this.list.getElementGroupId(t)!==Pp&&this.list.setSelection([t],e.browserEvent),this._onPointer.fire(e)}onDoubleClick(e){if(jn(e.browserEvent.target)||Gu(e.browserEvent.target)||this.isSelectionChangeEvent(e)||e.browserEvent.isHandledByList)return;e.browserEvent.isHandledByList=!0;const t=this.list.getFocus();this.list.setSelection(t,e.browserEvent)}changeSelection(e){const t=e.index;let i=this.list.getAnchor();if(this.isSelectionRangeChangeEvent(e)){typeof i>"u"&&(i=this.list.getFocus()[0]??t,this.list.setAnchor(i));const n=Math.min(i,t),s=Math.max(i,t);let r=l.range(n,s+1);const a=this.list.getSelection()[0];if(a!==void 0){const u=this.list.getElementGroupId(a);u!==void 0&&(r=this.list.filterIndicesByGroup(r,u))}const c=this.list.getSelection(),h=W9(Oy(c,[i]),i);if(h.length===0)return;const d=Oy(r,H9(c,h));this.list.setSelection(d,e.browserEvent),this.list.setFocus([t],e.browserEvent)}else if(this.isSelectionSingleChangeEvent(e)){const n=this.list.getSelection(),s=n.filter(a=>a!==t);this.list.setFocus([t]),this.list.setAnchor(t);const r=this.list.getElementGroupId(t);if(r===Pp)return;if(n.length===s.length){const a=r!==void 0?this.list.filterIndicesByGroup([...s,t],r):[...s,t];this.list.setSelection(a,e.browserEvent)}else this.list.setSelection(s,e.browserEvent)}}dispose(){this.disposables.dispose()}}class Q9{constructor(e,t){this.styleElement=e,this.selectorSuffix=t}style(e){const t=this.selectorSuffix&&`.${this.selectorSuffix}`,i=[];e.listBackground&&i.push(`.monaco-list${t} .monaco-list-rows { background: ${e.listBackground}; }`),e.listFocusBackground&&(i.push(`.monaco-list${t}:focus .monaco-list-row.focused { background-color: ${e.listFocusBackground}; }`),i.push(`.monaco-list${t}:focus .monaco-list-row.focused:hover { background-color: ${e.listFocusBackground}; }`)),e.listFocusForeground&&i.push(`.monaco-list${t}:focus .monaco-list-row.focused { color: ${e.listFocusForeground}; }`),e.listActiveSelectionBackground&&(i.push(`.monaco-list${t}:focus .monaco-list-row.selected { background-color: ${e.listActiveSelectionBackground}; }`),i.push(`.monaco-list${t}:focus .monaco-list-row.selected:hover { background-color: ${e.listActiveSelectionBackground}; }`)),e.listActiveSelectionForeground&&i.push(`.monaco-list${t}:focus .monaco-list-row.selected { color: ${e.listActiveSelectionForeground}; }`),e.listActiveSelectionIconForeground&&i.push(`.monaco-list${t}:focus .monaco-list-row.selected .codicon { color: ${e.listActiveSelectionIconForeground}; }`),e.listFocusAndSelectionBackground&&i.push(`
|
||
.monaco-drag-image${t},
|
||
.monaco-list${t}:focus .monaco-list-row.selected.focused { background-color: ${e.listFocusAndSelectionBackground}; }
|
||
`),e.listFocusAndSelectionForeground&&i.push(`
|
||
.monaco-drag-image${t},
|
||
.monaco-list${t}:focus .monaco-list-row.selected.focused { color: ${e.listFocusAndSelectionForeground}; }
|
||
`),e.listInactiveFocusForeground&&(i.push(`.monaco-list${t} .monaco-list-row.focused { color: ${e.listInactiveFocusForeground}; }`),i.push(`.monaco-list${t} .monaco-list-row.focused:hover { color: ${e.listInactiveFocusForeground}; }`)),e.listInactiveSelectionIconForeground&&i.push(`.monaco-list${t} .monaco-list-row.focused .codicon { color: ${e.listInactiveSelectionIconForeground}; }`),e.listInactiveFocusBackground&&(i.push(`.monaco-list${t} .monaco-list-row.focused { background-color: ${e.listInactiveFocusBackground}; }`),i.push(`.monaco-list${t} .monaco-list-row.focused:hover { background-color: ${e.listInactiveFocusBackground}; }`)),e.listInactiveSelectionBackground&&(i.push(`.monaco-list${t} .monaco-list-row.selected { background-color: ${e.listInactiveSelectionBackground}; }`),i.push(`.monaco-list${t} .monaco-list-row.selected:hover { background-color: ${e.listInactiveSelectionBackground}; }`)),e.listInactiveSelectionForeground&&i.push(`.monaco-list${t} .monaco-list-row.selected { color: ${e.listInactiveSelectionForeground}; }`),e.listHoverBackground&&i.push(`.monaco-list${t}:not(.drop-target):not(.dragging) .monaco-list-row:hover:not(.selected):not(.focused) { background-color: ${e.listHoverBackground}; }`),e.listHoverForeground&&i.push(`.monaco-list${t}:not(.drop-target):not(.dragging) .monaco-list-row:hover:not(.selected):not(.focused) { color: ${e.listHoverForeground}; }`);const n=Eo(e.listFocusAndSelectionOutline,Eo(e.listSelectionOutline,e.listFocusOutline??""));n&&i.push(`.monaco-list${t}:focus .monaco-list-row.focused.selected { outline: 1px solid ${n}; outline-offset: -1px;}`),e.listFocusOutline&&i.push(`
|
||
.monaco-drag-image${t},
|
||
.monaco-list${t}:focus .monaco-list-row.focused,
|
||
.context-menu-visible .monaco-list${t}.last-focused .monaco-list-row.focused { outline: 1px solid ${e.listFocusOutline}; outline-offset: -1px; }
|
||
`);const s=Eo(e.listSelectionOutline,e.listInactiveFocusOutline??"");s&&i.push(`.monaco-list${t} .monaco-list-row.focused.selected { outline: 1px dotted ${s}; outline-offset: -1px; }`),e.listSelectionOutline&&i.push(`.monaco-list${t} .monaco-list-row.selected { outline: 1px dotted ${e.listSelectionOutline}; outline-offset: -1px; }`),e.listInactiveFocusOutline&&i.push(`.monaco-list${t} .monaco-list-row.focused { outline: 1px dotted ${e.listInactiveFocusOutline}; outline-offset: -1px; }`),e.listHoverOutline&&i.push(`.monaco-list${t} .monaco-list-row:hover { outline: 1px dashed ${e.listHoverOutline}; outline-offset: -1px; }`),e.listDropOverBackground&&i.push(`
|
||
.monaco-list${t}.drop-target,
|
||
.monaco-list${t} .monaco-list-rows.drop-target,
|
||
.monaco-list${t} .monaco-list-row.drop-target { background-color: ${e.listDropOverBackground} !important; color: inherit !important; }
|
||
`),e.listDropBetweenBackground&&(i.push(`
|
||
.monaco-list${t} .monaco-list-rows.drop-target-before .monaco-list-row:first-child::before,
|
||
.monaco-list${t} .monaco-list-row.drop-target-before::before {
|
||
content: ""; position: absolute; top: 0px; left: 0px; width: 100%; height: 1px;
|
||
background-color: ${e.listDropBetweenBackground};
|
||
}`),i.push(`
|
||
.monaco-list${t} .monaco-list-rows.drop-target-after .monaco-list-row:last-child::after,
|
||
.monaco-list${t} .monaco-list-row.drop-target-after::after {
|
||
content: ""; position: absolute; bottom: 0px; left: 0px; width: 100%; height: 1px;
|
||
background-color: ${e.listDropBetweenBackground};
|
||
}`)),e.tableColumnsBorder&&i.push(`
|
||
.monaco-table > .monaco-split-view2,
|
||
.monaco-table > .monaco-split-view2 .monaco-sash.vertical::before,
|
||
.monaco-enable-motion .monaco-table:hover > .monaco-split-view2,
|
||
.monaco-enable-motion .monaco-table:hover > .monaco-split-view2 .monaco-sash.vertical::before {
|
||
border-color: ${e.tableColumnsBorder};
|
||
}
|
||
|
||
.monaco-enable-motion .monaco-table > .monaco-split-view2,
|
||
.monaco-enable-motion .monaco-table > .monaco-split-view2 .monaco-sash.vertical::before {
|
||
border-color: transparent;
|
||
}
|
||
`),e.tableOddRowsBackgroundColor&&i.push(`
|
||
.monaco-table .monaco-list-row[data-parity=odd]:not(.focused):not(.selected):not(:hover) .monaco-table-tr,
|
||
.monaco-table .monaco-list:not(:focus) .monaco-list-row[data-parity=odd].focused:not(.selected):not(:hover) .monaco-table-tr,
|
||
.monaco-table .monaco-list:not(.focused) .monaco-list-row[data-parity=odd].focused:not(.selected):not(:hover) .monaco-table-tr {
|
||
background-color: ${e.tableOddRowsBackgroundColor};
|
||
}
|
||
`),this.styleElement.textContent=i.join(`
|
||
`)}}const X9={listFocusBackground:"#7FB0D0",listActiveSelectionBackground:"#0E639C",listActiveSelectionForeground:"#FFFFFF",listActiveSelectionIconForeground:"#FFFFFF",listFocusAndSelectionOutline:"#90C2F9",listFocusAndSelectionBackground:"#094771",listFocusAndSelectionForeground:"#FFFFFF",listInactiveSelectionBackground:"#3F3F46",listInactiveSelectionIconForeground:"#FFFFFF",listHoverBackground:"#2A2D2E",listDropOverBackground:"#383B3D",listDropBetweenBackground:"#EEEEEE",treeIndentGuidesStroke:"#a9a9a9",treeInactiveIndentGuidesStroke:l.Color.fromHex("#a9a9a9").transparent(.4).toString(),tableColumnsBorder:l.Color.fromHex("#cccccc").transparent(.2).toString(),tableOddRowsBackgroundColor:l.Color.fromHex("#cccccc").transparent(.04).toString(),listBackground:void 0,listFocusForeground:void 0,listInactiveSelectionForeground:void 0,listInactiveFocusForeground:void 0,listInactiveFocusBackground:void 0,listHoverForeground:void 0,listFocusOutline:void 0,listInactiveFocusOutline:void 0,listSelectionOutline:void 0,listHoverOutline:void 0,treeStickyScrollBackground:void 0,treeStickyScrollBorder:void 0,treeStickyScrollShadow:void 0},J9={keyboardSupport:!0,mouseSupport:!0,multipleSelectionSupport:!0,dnd:{getDragURI(){return null},onDragStart(){},onDragOver(){return!1},drop(){},dispose(){}}};function W9(o,e){const t=o.indexOf(e);if(t===-1)return[];const i=[];let n=t-1;for(;n>=0&&o[n]===e-(t-n);)i.push(o[n--]);for(i.reverse(),n=t;n<o.length&&o[n]===e+(n-t);)i.push(o[n++]);return i}function Oy(o,e){const t=[];let i=0,n=0;for(;i<o.length||n<e.length;)if(i>=o.length)t.push(e[n++]);else if(n>=e.length)t.push(o[i++]);else if(o[i]===e[n]){t.push(o[i]),i++,n++;continue}else o[i]<e[n]?t.push(o[i++]):t.push(e[n++]);return t}function H9(o,e){const t=[];let i=0,n=0;for(;i<o.length||n<e.length;)if(i>=o.length)t.push(e[n++]);else if(n>=e.length)t.push(o[i++]);else if(o[i]===e[n]){i++,n++;continue}else o[i]<e[n]?t.push(o[i++]):n++;return t}const fM=(o,e)=>o-e;class eq{constructor(e,t){this._templateId=e,this.renderers=t}get templateId(){return this._templateId}renderTemplate(e){return this.renderers.map(t=>t.renderTemplate(e))}renderElement(e,t,i,n){let s=0;for(const r of this.renderers)r.renderElement(e,t,i[s++],n)}disposeElement(e,t,i,n){let s=0;for(const r of this.renderers)r.disposeElement?.(e,t,i[s],n),s+=1}disposeTemplate(e){let t=0;for(const i of this.renderers)i.disposeTemplate(e[t++])}}class tq{constructor(e){this.accessibilityProvider=e,this.templateId="a18n"}renderTemplate(e){return{container:e,disposables:new l.DisposableStore}}renderElement(e,t,i){const n=this.accessibilityProvider.getAriaLabel(e),s=n&&typeof n!="string"?n:Zr(n);i.disposables.add(he(a=>{this.setAriaLabel(a.readObservable(s),i.container)}));const r=this.accessibilityProvider.getAriaLevel&&this.accessibilityProvider.getAriaLevel(e);typeof r=="number"?i.container.setAttribute("aria-level",`${r}`):i.container.removeAttribute("aria-level")}setAriaLabel(e,t){e?t.setAttribute("aria-label",e):t.removeAttribute("aria-label")}disposeElement(e,t,i){i.disposables.clear()}disposeTemplate(e){e.disposables.dispose()}}class iq{constructor(e,t){this.list=e,this.dnd=t}getDragElements(e){const t=this.list.getSelectedElements();return t.indexOf(e)>-1?t:[e]}getDragURI(e){return this.dnd.getDragURI(e)}getDragLabel(e,t){if(this.dnd.getDragLabel)return this.dnd.getDragLabel(e,t)}onDragStart(e,t){this.dnd.onDragStart?.(e,t)}onDragOver(e,t,i,n,s){return this.dnd.onDragOver(e,t,i,n,s)}onDragLeave(e,t,i,n){this.dnd.onDragLeave?.(e,t,i,n)}onDragEnd(e){this.dnd.onDragEnd?.(e)}drop(e,t,i,n,s){this.dnd.drop(e,t,i,n,s)}dispose(){this.dnd.dispose()}}class zn{get onDidChangeFocus(){return l.Event.map(this.eventBufferer.wrapEvent(this.focus.onChange),e=>this.toListEvent(e),this.disposables)}get onDidChangeSelection(){return l.Event.map(this.eventBufferer.wrapEvent(this.selection.onChange),e=>this.toListEvent(e),this.disposables)}get domId(){return this.view.domId}get onDidScroll(){return this.view.onDidScroll}get onMouseClick(){return this.view.onMouseClick}get onMouseDblClick(){return this.view.onMouseDblClick}get onMouseMiddleClick(){return this.view.onMouseMiddleClick}get onPointer(){return this.mouseController.onPointer}get onMouseDown(){return this.view.onMouseDown}get onMouseOver(){return this.view.onMouseOver}get onMouseOut(){return this.view.onMouseOut}get onTouchStart(){return this.view.onTouchStart}get onTap(){return this.view.onTap}get onContextMenu(){let e=!1;const t=l.Event.chain(this.disposables.add(new Te(this.view.domNode,"keydown")).event,s=>s.map(r=>new Be(r)).filter(r=>e=r.keyCode===58||r.shiftKey&&r.keyCode===68).map(r=>ve.stop(r,!0)).filter(()=>!1)),i=l.Event.chain(this.disposables.add(new Te(this.view.domNode,"keyup")).event,s=>s.forEach(()=>e=!1).map(r=>new Be(r)).filter(r=>r.keyCode===58||r.shiftKey&&r.keyCode===68).map(r=>ve.stop(r,!0)).map(({browserEvent:r})=>{const a=this.getFocus(),c=a.length?a[0]:void 0,h=typeof c<"u"?this.view.element(c):void 0,d=typeof c<"u"?this.view.domElement(c):this.view.domNode;return{index:c,element:h,anchor:d,browserEvent:r}})),n=l.Event.chain(this.view.onContextMenu,s=>s.filter(r=>!e).map(({element:r,index:a,browserEvent:c})=>({element:r,index:a,anchor:new Bi(j(this.view.domNode),c),browserEvent:c})));return l.Event.any(t,i,n)}get onKeyDown(){return this.disposables.add(new Te(this.view.domNode,"keydown")).event}get onDidFocus(){return l.Event.signal(this.disposables.add(new Te(this.view.domNode,"focus",!0)).event)}get onDidBlur(){return l.Event.signal(this.disposables.add(new Te(this.view.domNode,"blur",!0)).event)}constructor(e,t,i,n,s=J9){this.user=e,this._options=s,this.focus=new kp("focused"),this.anchor=new kp("anchor"),this.eventBufferer=new l.EventBufferer,this._ariaLabel="",this.disposables=new l.DisposableStore,this._onDidDispose=new l.Emitter,this.onDidDispose=this._onDidDispose.event;const r=this._options.accessibilityProvider&&this._options.accessibilityProvider.getWidgetRole?this._options.accessibilityProvider?.getWidgetRole():"list";this.selection=new $9(r!=="listbox");const a=[this.focus.renderer,this.selection.renderer];this.accessibilityProvider=s.accessibilityProvider,this.accessibilityProvider&&(a.push(new tq(this.accessibilityProvider)),this.accessibilityProvider.onDidChangeActiveDescendant?.(this.onDidChangeActiveDescendant,this,this.disposables)),n=n.map(h=>new eq(h.templateId,[...a,h]));const c={...s,dnd:s.dnd&&new iq(this,s.dnd)};if(this.view=this.createListView(t,i,n,c),this.view.domNode.setAttribute("role",r),s.styleController)this.styleController=s.styleController(this.view.domId);else{const h=bn(this.view.domNode);this.styleController=new Q9(h,this.view.domId)}if(this.spliceable=new R9([new Ay(this.focus,this.view,s.identityProvider),new Ay(this.selection,this.view,s.identityProvider),new Ay(this.anchor,this.view,s.identityProvider),this.view]),this.disposables.add(this.focus),this.disposables.add(this.selection),this.disposables.add(this.anchor),this.disposables.add(this.view),this.disposables.add(this._onDidDispose),this.disposables.add(new Y9(this,this.view)),(typeof s.keyboardSupport!="boolean"||s.keyboardSupport)&&(this.keyboardController=new lM(this,this.view,s),this.disposables.add(this.keyboardController)),s.keyboardNavigationLabelProvider){const h=s.keyboardNavigationDelegate||j9;this.typeNavigationController=new q9(this,this.view,s.keyboardNavigationLabelProvider,s.keyboardNavigationEventFilter??(()=>!0),h),this.disposables.add(this.typeNavigationController)}if(this.mouseController=this.createMouseController(s),this.disposables.add(this.mouseController),this.onDidChangeFocus(this._onFocusChange,this,this.disposables),this.onDidChangeSelection(this._onSelectionChange,this,this.disposables),this.accessibilityProvider){const h=this.accessibilityProvider.getWidgetAriaLabel(),d=h&&typeof h!="string"?h:Zr(h);this.disposables.add(he(u=>{this.ariaLabel=u.readObservable(d)}))}this._options.multipleSelectionSupport!==!1&&this.view.domNode.setAttribute("aria-multiselectable","true")}createListView(e,t,i,n){return new Bn(e,t,i,n)}createMouseController(e){return new uM(this)}updateOptions(e={}){this._options={...this._options,...e},this.typeNavigationController?.updateOptions(this._options),this._options.multipleSelectionController!==void 0&&(this._options.multipleSelectionSupport?this.view.domNode.setAttribute("aria-multiselectable","true"):this.view.domNode.removeAttribute("aria-multiselectable")),this.mouseController.updateOptions(e),this.keyboardController?.updateOptions(e),this.view.updateOptions(e)}get options(){return this._options}splice(e,t,i=[]){if(e<0||e>this.view.length)throw new Ja(this.user,`Invalid start index: ${e}`);if(t<0)throw new Ja(this.user,`Invalid delete count: ${t}`);t===0&&i.length===0||this.eventBufferer.bufferEvents(()=>this.spliceable.splice(e,t,i))}rerender(){this.view.rerender()}element(e){return this.view.element(e)}indexOf(e){return this.view.indexOf(e)}indexAt(e){return this.view.indexAt(e)}get length(){return this.view.length}get contentHeight(){return this.view.contentHeight}get onDidChangeContentHeight(){return this.view.onDidChangeContentHeight}get scrollTop(){return this.view.getScrollTop()}set scrollTop(e){this.view.setScrollTop(e)}get scrollHeight(){return this.view.scrollHeight}get renderHeight(){return this.view.renderHeight}get firstVisibleIndex(){return this.view.firstVisibleIndex}get ariaLabel(){return this._ariaLabel}set ariaLabel(e){this._ariaLabel=e,this.view.domNode.setAttribute("aria-label",e)}domFocus(){this.view.domNode.focus({preventScroll:!0})}layout(e,t){this.view.layout(e,t)}setSelection(e,t){for(const i of e)if(i<0||i>=this.length)throw new Ja(this.user,`Invalid index ${i}`);e=e.filter(i=>this.getElementGroupId(i)!==Pp),this.selection.set(e,t)}getSelection(){return this.selection.get()}getSelectedElements(){return this.getSelection().map(e=>this.view.element(e))}setAnchor(e){if(typeof e>"u"){this.anchor.set([]);return}if(e<0||e>=this.length)throw new Ja(this.user,`Invalid index ${e}`);this.anchor.set([e])}getAnchor(){return this.anchor.get().at(0)}getAnchorElement(){const e=this.getAnchor();return typeof e>"u"?void 0:this.element(e)}getElementGroupId(e){const t=this.options.identityProvider;if(!t?.getGroupId)return;const i=this.element(e);return t.getGroupId(i)}filterIndicesByGroup(e,t){const i=this.options.identityProvider;return i?.getGroupId?t===Pp?[]:e.filter(n=>{const s=this.element(n);return i.getGroupId(s)===t}):e}setFocus(e,t){for(const i of e)if(i<0||i>=this.length)throw new Ja(this.user,`Invalid index ${i}`);this.focus.set(e,t)}focusNext(e=1,t=!1,i,n){if(this.length===0)return;const s=this.focus.get(),r=this.findNextIndex(s.length>0?s[0]+e:0,t,n);r>-1&&this.setFocus([r],i)}focusPrevious(e=1,t=!1,i,n){if(this.length===0)return;const s=this.focus.get(),r=this.findPreviousIndex(s.length>0?s[0]-e:0,t,n);r>-1&&this.setFocus([r],i)}async focusNextPage(e,t){let i=this.view.indexAt(this.view.getScrollTop()+this.view.renderHeight);i=i===0?0:i-1;const n=this.getFocus()[0];if(n!==i&&(n===void 0||i>n)){const s=this.findPreviousIndex(i,!1,t);s>-1&&n!==s?this.setFocus([s],e):this.setFocus([i],e)}else{const s=this.view.getScrollTop();let r=s+this.view.renderHeight;i>n&&(r-=this.view.elementHeight(i)),this.view.setScrollTop(r),this.view.getScrollTop()!==s&&(this.setFocus([]),await l.timeout(0),await this.focusNextPage(e,t))}}async focusPreviousPage(e,t,i=()=>0){let n;const s=i(),r=this.view.getScrollTop()+s;r===0?n=this.view.indexAt(r):n=this.view.indexAfter(r-1);const a=this.getFocus()[0];if(a!==n&&(a===void 0||a>=n)){const c=this.findNextIndex(n,!1,t);c>-1&&a!==c?this.setFocus([c],e):this.setFocus([n],e)}else{const c=r;this.view.setScrollTop(r-this.view.renderHeight-s),this.view.getScrollTop()+i()!==c&&(this.setFocus([]),await l.timeout(0),await this.focusPreviousPage(e,t,i))}}focusLast(e,t){if(this.length===0)return;const i=this.findPreviousIndex(this.length-1,!1,t);i>-1&&this.setFocus([i],e)}focusFirst(e,t){this.focusNth(0,e,t)}focusNth(e,t,i){if(this.length===0)return;const n=this.findNextIndex(e,!1,i);n>-1&&this.setFocus([n],t)}findNextIndex(e,t=!1,i){for(let n=0;n<this.length;n++){if(e>=this.length&&!t)return-1;if(e=e%this.length,!i||i(this.element(e)))return e;e++}return-1}findPreviousIndex(e,t=!1,i){for(let n=0;n<this.length;n++){if(e<0&&!t)return-1;if(e=(this.length+e%this.length)%this.length,!i||i(this.element(e)))return e;e--}return-1}getFocus(){return this.focus.get()}getFocusedElements(){return this.getFocus().map(e=>this.view.element(e))}reveal(e,t,i=0){if(e<0||e>=this.length)throw new Ja(this.user,`Invalid index ${e}`);const n=this.view.getScrollTop(),s=this.view.elementTop(e),r=this.view.elementHeight(e);if(l.isNumber(t)){const a=r-this.view.renderHeight+i;this.view.setScrollTop(a*wi(t,0,1)+s-i)}else{const a=s+r,c=n+this.view.renderHeight;s<n+i&&a>=c||(s<n+i||a>=c&&r>=this.view.renderHeight?this.view.setScrollTop(s-i):a>=c&&this.view.setScrollTop(a-this.view.renderHeight))}}getRelativeTop(e,t=0){if(e<0||e>=this.length)throw new Ja(this.user,`Invalid index ${e}`);const i=this.view.getScrollTop(),n=this.view.elementTop(e),s=this.view.elementHeight(e);if(n<i+t||n+s>i+this.view.renderHeight)return null;const r=s-this.view.renderHeight+t;return Math.abs((i+t-n)/r)}getHTMLElement(){return this.view.domNode}getScrollableElement(){return this.view.scrollableElementDomNode}getElementID(e){return this.view.getElementDomId(e)}getElementTop(e){return this.view.elementTop(e)}style(e){this.styleController.style(e)}toListEvent({indexes:e,browserEvent:t}){return{indexes:e,elements:e.map(i=>this.view.element(i)),browserEvent:t}}_onFocusChange(){const e=this.focus.get();this.view.domNode.classList.toggle("element-focused",e.length>0),this.onDidChangeActiveDescendant()}onDidChangeActiveDescendant(){const e=this.focus.get();if(e.length>0){let t;this.accessibilityProvider?.getActiveDescendantId&&(t=this.accessibilityProvider.getActiveDescendantId(this.view.element(e[0]))),this.view.domNode.setAttribute("aria-activedescendant",t||this.view.getElementDomId(e[0]))}else this.view.domNode.removeAttribute("aria-activedescendant")}_onSelectionChange(){const e=this.selection.get();this.view.domNode.classList.toggle("selection-none",e.length===0),this.view.domNode.classList.toggle("selection-single",e.length===1),this.view.domNode.classList.toggle("selection-multiple",e.length>1)}dispose(){this._onDidDispose.fire(),this.disposables.dispose(),this._onDidDispose.dispose()}}Lr([et],zn.prototype,"onDidChangeFocus",null),Lr([et],zn.prototype,"onDidChangeSelection",null),Lr([et],zn.prototype,"onContextMenu",null),Lr([et],zn.prototype,"onKeyDown",null),Lr([et],zn.prototype,"onDidFocus",null),Lr([et],zn.prototype,"onDidBlur",null);const Ha=Q,gM="selectOption.entry.template";class nq{get templateId(){return gM}renderTemplate(e){const t=Object.create(null);return t.root=e,t.text=K(e,Ha(".option-text")),t.detail=K(e,Ha(".option-detail")),t.decoratorRight=K(e,Ha(".option-decorator-right")),t}renderElement(e,t,i){const n=i,s=e.text,r=e.detail,a=e.decoratorRight,c=e.isDisabled;n.text.textContent=s,n.detail.textContent=r||"",n.decoratorRight.textContent=a||"",c?n.root.classList.add("option-disabled"):n.root.classList.remove("option-disabled"),e.isSeparator?(n.root.classList.add("option-separator"),n.root.classList.add("option-disabled")):n.root.classList.remove("option-separator")}disposeTemplate(e){}}const Js=class Js extends l.Disposable{constructor(e,t,i,n,s){super(),this.options=[],this._currentSelection=0,this._hasDetails=!1,this._selectionDetailsDisposables=this._register(new l.DisposableStore),this._skipLayout=!1,this._sticky=!1,this._isVisible=!1,this.styles=n,this.selectBoxOptions=s||Object.create(null),typeof this.selectBoxOptions.minBottomMargin!="number"?this.selectBoxOptions.minBottomMargin=Js.DEFAULT_DROPDOWN_MINIMUM_BOTTOM_MARGIN:this.selectBoxOptions.minBottomMargin<0&&(this.selectBoxOptions.minBottomMargin=0),this.selectElement=document.createElement("select"),this.selectElement.className="monaco-select-box",typeof this.selectBoxOptions.ariaLabel=="string"&&this.selectElement.setAttribute("aria-label",this.selectBoxOptions.ariaLabel),typeof this.selectBoxOptions.ariaDescription=="string"&&this.selectElement.setAttribute("aria-description",this.selectBoxOptions.ariaDescription),this._onDidSelect=new l.Emitter,this._register(this._onDidSelect),this.registerListeners(),this.constructSelectDropDown(i),this.selected=t||0,e&&this.setOptions(e,t),this.initStyleSheet()}setTitle(e){!this._hover&&e?this._hover=this._register(En().setupManagedHover(Io("mouse"),this.selectElement,e)):this._hover&&this._hover.update(e)}getHeight(){return 22}getTemplateId(){return gM}constructSelectDropDown(e){this.contextViewProvider=e,this.selectDropDownContainer=Q(".monaco-select-box-dropdown-container"),this.selectionDetailsPane=K(this.selectDropDownContainer,Ha(".select-box-details-pane"));const t=K(this.selectDropDownContainer,Ha(".select-box-dropdown-container-width-control")),i=K(t,Ha(".width-control-div"));this.widthControlElement=document.createElement("span"),this.widthControlElement.className="option-text-width-control",K(i,this.widthControlElement),this._dropDownPosition=0,this.styleElement=bn(this.selectDropDownContainer),this.selectDropDownContainer.setAttribute("draggable","true"),this._register(R(this.selectDropDownContainer,F.DRAG_START,n=>{ve.stop(n,!0)}))}registerListeners(){this._register(At(this.selectElement,"change",t=>{this.selected=t.target.selectedIndex,this._onDidSelect.fire({index:t.target.selectedIndex,selected:t.target.value}),this.options[this.selected]&&this.options[this.selected].text&&this.setTitle(this.options[this.selected].text)})),this._register(R(this.selectElement,F.CLICK,t=>{ve.stop(t),this._isVisible?this.hideSelectDropDown(!0):this.showSelectDropDown()})),this._register(R(this.selectElement,F.MOUSE_DOWN,t=>{ve.stop(t)}));let e;this._register(R(this.selectElement,"touchstart",t=>{e=this._isVisible})),this._register(R(this.selectElement,"touchend",t=>{ve.stop(t),e?this.hideSelectDropDown(!0):this.showSelectDropDown()})),this._register(R(this.selectElement,F.KEY_DOWN,t=>{const i=new Be(t);let n=!1;l.isMacintosh?(i.keyCode===18||i.keyCode===16||i.keyCode===10||i.keyCode===3)&&(n=!0):(i.keyCode===18&&i.altKey||i.keyCode===16&&i.altKey||i.keyCode===10||i.keyCode===3)&&(n=!0),n&&(this.showSelectDropDown(),ve.stop(t,!0))}))}get onDidSelect(){return this._onDidSelect.event}setOptions(e,t){l.equals(this.options,e)||(this.options=e,this.selectElement.options.length=0,this._hasDetails=!1,this._cachedMaxDetailsHeight=void 0,this.options.forEach((i,n)=>{this.selectElement.add(this.createOption(i.text,n,i.isDisabled)),typeof i.description=="string"&&(this._hasDetails=!0)})),t!==void 0&&(this.select(t),this._currentSelection=this.selected)}setOptionsList(){this.selectList?.splice(0,this.selectList.length,this.options)}select(e){e>=0&&e<this.options.length?this.selected=e:e>this.options.length-1?this.select(this.options.length-1):this.selected<0&&(this.selected=0),this.selectElement.selectedIndex=this.selected,this.options[this.selected]&&this.options[this.selected].text&&this.setTitle(this.options[this.selected].text)}focus(){this.selectElement&&(this.selectElement.tabIndex=0,this.selectElement.focus())}blur(){this.selectElement&&(this.selectElement.tabIndex=-1,this.selectElement.blur())}setFocusable(e){this.selectElement.tabIndex=e?0:-1}render(e){this.container=e,e.classList.add("select-container"),e.appendChild(this.selectElement),this.styleSelectElement()}initStyleSheet(){const e=[];this.styles.listFocusBackground&&e.push(`.monaco-select-box-dropdown-container > .select-box-dropdown-list-container .monaco-list .monaco-list-row.focused { background-color: ${this.styles.listFocusBackground} !important; }`),this.styles.listFocusForeground&&e.push(`.monaco-select-box-dropdown-container > .select-box-dropdown-list-container .monaco-list .monaco-list-row.focused { color: ${this.styles.listFocusForeground} !important; }`),this.styles.decoratorRightForeground&&e.push(`.monaco-select-box-dropdown-container > .select-box-dropdown-list-container .monaco-list .monaco-list-row:not(.focused) .option-decorator-right { color: ${this.styles.decoratorRightForeground}; }`),this.styles.selectBackground&&this.styles.selectBorder&&this.styles.selectBorder!==this.styles.selectBackground?(e.push(`.monaco-select-box-dropdown-container { border: 1px solid ${this.styles.selectBorder} } `),e.push(`.monaco-select-box-dropdown-container > .select-box-details-pane.border-top { border-top: 1px solid ${this.styles.selectBorder} } `),e.push(`.monaco-select-box-dropdown-container > .select-box-details-pane.border-bottom { border-bottom: 1px solid ${this.styles.selectBorder} } `)):this.styles.selectListBorder&&(e.push(`.monaco-select-box-dropdown-container > .select-box-details-pane.border-top { border-top: 1px solid ${this.styles.selectListBorder} } `),e.push(`.monaco-select-box-dropdown-container > .select-box-details-pane.border-bottom { border-bottom: 1px solid ${this.styles.selectListBorder} } `)),this.styles.listHoverForeground&&e.push(`.monaco-select-box-dropdown-container > .select-box-dropdown-list-container .monaco-list .monaco-list-row:not(.option-disabled):not(.focused):hover { color: ${this.styles.listHoverForeground} !important; }`),this.styles.listHoverBackground&&e.push(`.monaco-select-box-dropdown-container > .select-box-dropdown-list-container .monaco-list .monaco-list-row:not(.option-disabled):not(.focused):hover { background-color: ${this.styles.listHoverBackground} !important; }`),this.styles.listFocusOutline&&e.push(`.monaco-select-box-dropdown-container > .select-box-dropdown-list-container .monaco-list .monaco-list-row.focused { outline: 1px solid ${this.styles.listFocusOutline} !important; outline-offset: -1px !important; }`),this.styles.listHoverOutline&&e.push(`.monaco-select-box-dropdown-container > .select-box-dropdown-list-container .monaco-list .monaco-list-row:not(.option-disabled):not(.focused):hover { outline: 1px solid ${this.styles.listHoverOutline} !important; outline-offset: -1px !important; }`),e.push(".monaco-select-box-dropdown-container > .select-box-dropdown-list-container .monaco-list .monaco-list-row.option-disabled.focused { background-color: transparent !important; color: inherit !important; outline: none !important; }"),e.push(".monaco-select-box-dropdown-container > .select-box-dropdown-list-container .monaco-list .monaco-list-row.option-disabled:hover { background-color: transparent !important; color: inherit !important; outline: none !important; }"),this.styleElement.textContent=e.join(`
|
||
`)}styleSelectElement(){const e=this.styles.selectBackground??"",t=this.styles.selectForeground??"",i=this.styles.selectBorder??"";this.selectElement.style.backgroundColor=e,this.selectElement.style.color=t,this.selectElement.style.borderColor=i}styleList(){const e=this.styles.selectBackground??"",t=Eo(this.styles.selectListBackground,e);this.selectDropDownContainer.style.backgroundColor=t,this.selectDropDownListContainer.style.backgroundColor=t,this.selectionDetailsPane.style.backgroundColor=t,this.selectList.style(this.styles)}createOption(e,t,i){const n=document.createElement("option");return n.value=e,n.text=e,n.disabled=!!i,n}showSelectDropDown(){this.selectionDetailsPane.textContent="",!(!this.contextViewProvider||this._isVisible)&&(this.createSelectList(this.selectDropDownContainer),this.setOptionsList(),this.contextViewProvider.showContextView({getAnchor:()=>this.selectElement,render:e=>this.renderSelectDropDown(e,!0),layout:()=>{this.layoutSelectDropDown()},onHide:()=>{this.selectDropDownContainer.classList.remove("visible")},anchorPosition:this._dropDownPosition},this.selectBoxOptions.optionsAsChildren?this.container:void 0),this._isVisible=!0,this.hideSelectDropDown(!1),this.contextViewProvider.showContextView({getAnchor:()=>this.selectElement,render:e=>this.renderSelectDropDown(e),layout:()=>this.layoutSelectDropDown(),onHide:()=>{this.selectDropDownContainer.classList.remove("visible")},anchorPosition:this._dropDownPosition},this.selectBoxOptions.optionsAsChildren?this.container:void 0),this._currentSelection=this.selected,this._isVisible=!0,this.selectElement.setAttribute("aria-expanded","true"))}hideSelectDropDown(e){!this.contextViewProvider||!this._isVisible||(this._isVisible=!1,this.selectElement.setAttribute("aria-expanded","false"),e&&this.selectElement.focus(),this.contextViewProvider.hideContextView())}renderSelectDropDown(e,t){e.appendChild(this.selectDropDownContainer);const i=j(this.selectElement).getComputedStyle(this.selectElement).fontSize;return i&&(this.selectDropDownContainer.style.fontSize=i),this.layoutSelectDropDown(t),{dispose:()=>{this.selectDropDownContainer.remove()}}}measureMaxDetailsHeight(){let e=0;return this.options.forEach((t,i)=>{this.updateDetail(i),this.selectionDetailsPane.offsetHeight>e&&(e=this.selectionDetailsPane.offsetHeight)}),e}layoutSelectDropDown(e){if(this._skipLayout)return!1;if(this.selectList){this.selectDropDownContainer.classList.add("visible");const t=j(this.selectElement),i=Qi(this.selectElement),n=t.innerHeight-i.top-i.height-(this.selectBoxOptions.minBottomMargin||0),s=i.top-Js.DEFAULT_DROPDOWN_MINIMUM_TOP_MARGIN,r=this.selectElement.offsetWidth,a=this.setWidthControlElement(this.widthControlElement),c=`${Math.max(a,Math.round(r))}px`;this.selectDropDownContainer.style.width=c,this.selectList.getHTMLElement().style.height="",this.selectList.layout();let h=this.selectList.contentHeight;this._hasDetails&&this._cachedMaxDetailsHeight===void 0&&(this._cachedMaxDetailsHeight=this.measureMaxDetailsHeight());const d=this._hasDetails?this._cachedMaxDetailsHeight:0,u=h+d,f=Math.floor((n-d)/this.getHeight()),g=Math.floor((s-d)/this.getHeight());if(e)return i.top+i.height>t.innerHeight-22||i.top<Js.DEFAULT_DROPDOWN_MINIMUM_TOP_MARGIN||f<1&&g<1?!1:(f<Js.DEFAULT_MINIMUM_VISIBLE_OPTIONS&&g>f&&this.options.length>f?(this._dropDownPosition=1,this.selectDropDownListContainer.remove(),this.selectionDetailsPane.remove(),this.selectDropDownContainer.appendChild(this.selectionDetailsPane),this.selectDropDownContainer.appendChild(this.selectDropDownListContainer),this.selectionDetailsPane.classList.remove("border-top"),this.selectionDetailsPane.classList.add("border-bottom")):(this._dropDownPosition=0,this.selectDropDownListContainer.remove(),this.selectionDetailsPane.remove(),this.selectDropDownContainer.appendChild(this.selectDropDownListContainer),this.selectDropDownContainer.appendChild(this.selectionDetailsPane),this.selectionDetailsPane.classList.remove("border-bottom"),this.selectionDetailsPane.classList.add("border-top")),!0);if(i.top+i.height>t.innerHeight-22||i.top<Js.DEFAULT_DROPDOWN_MINIMUM_TOP_MARGIN||this._dropDownPosition===0&&f<1||this._dropDownPosition===1&&g<1)return this.hideSelectDropDown(!0),!1;if(this._dropDownPosition===0){if(this._isVisible&&f+g<1)return this.hideSelectDropDown(!0),!1;u>n&&(h=f*this.getHeight())}else u>s&&(h=g*this.getHeight());return this.selectList.layout(h),this.selectList.domFocus(),this.selectList.length>0&&(this.selectList.setFocus([this.selected||0]),this.selectList.reveal(this.selectList.getFocus()[0]||0)),this._hasDetails?(this.selectList.getHTMLElement().style.height=`${h}px`,this.selectDropDownContainer.style.height=""):this.selectDropDownContainer.style.height=`${h}px`,this.updateDetail(this.selected),this.selectDropDownContainer.style.width=c,this.selectDropDownListContainer.setAttribute("tabindex","0"),!0}else return!1}setWidthControlElement(e){let t=0;if(e){let i=0,n=0;this.options.forEach((s,r)=>{const a=s.detail?s.detail.length:0,c=s.decoratorRight?s.decoratorRight.length:0,h=s.text.length+a+c;h>n&&(i=r,n=h)}),e.textContent=this.options[i].text+(this.options[i].decoratorRight?`${this.options[i].decoratorRight} `:""),t=jf(e)}return t}createSelectList(e){if(this.selectList)return;this.selectDropDownListContainer=K(e,Ha(".select-box-dropdown-list-container")),this.listRenderer=new nq,this.selectList=this._register(new zn("SelectBoxCustom",this.selectDropDownListContainer,this,[this.listRenderer],{useShadows:!1,verticalScrollMode:3,keyboardSupport:!1,mouseSupport:!1,accessibilityProvider:{getAriaLabel:n=>{if(n.isSeparator)return l.localize(17,"separator");let s=n.text;return n.detail&&(s+=`. ${n.detail}`),n.decoratorRight&&(s+=`. ${n.decoratorRight}`),n.description&&(s+=`. ${n.description}`),s},getWidgetAriaLabel:()=>l.localize(18,"Select Box"),getRole:()=>l.isMacintosh?"":"option",getWidgetRole:()=>"listbox"}})),this.selectBoxOptions.ariaLabel&&(this.selectList.ariaLabel=this.selectBoxOptions.ariaLabel);const t=this._register(new Te(this.selectDropDownListContainer,"keydown")),i=l.Event.chain(t.event,n=>n.filter(()=>this.selectList.length>0).map(s=>new Be(s)));this._register(l.Event.chain(i,n=>n.filter(s=>s.keyCode===3))(this.onEnter,this)),this._register(l.Event.chain(i,n=>n.filter(s=>s.keyCode===2))(this.onEnter,this)),this._register(l.Event.chain(i,n=>n.filter(s=>s.keyCode===9))(this.onEscape,this)),this._register(l.Event.chain(i,n=>n.filter(s=>s.keyCode===16))(this.onUpArrow,this)),this._register(l.Event.chain(i,n=>n.filter(s=>s.keyCode===18))(this.onDownArrow,this)),this._register(l.Event.chain(i,n=>n.filter(s=>s.keyCode===12))(this.onPageDown,this)),this._register(l.Event.chain(i,n=>n.filter(s=>s.keyCode===11))(this.onPageUp,this)),this._register(l.Event.chain(i,n=>n.filter(s=>s.keyCode===14))(this.onHome,this)),this._register(l.Event.chain(i,n=>n.filter(s=>s.keyCode===13))(this.onEnd,this)),this._register(l.Event.chain(i,n=>n.filter(s=>s.keyCode>=21&&s.keyCode<=56||s.keyCode>=85&&s.keyCode<=113))(this.onCharacter,this)),this._register(R(this.selectList.getHTMLElement(),F.POINTER_UP,n=>this.onPointerUp(n))),this._register(this.selectList.onMouseOver(n=>typeof n.index<"u"&&!this.options[n.index]?.isDisabled&&this.selectList.setFocus([n.index]))),this._register(this.selectList.onDidChangeFocus(n=>this.onListFocus(n))),this._register(R(this.selectDropDownContainer,F.FOCUS_OUT,n=>{!this._isVisible||ut(n.relatedTarget,this.selectDropDownContainer)||this.onListBlur()})),this.selectList.getHTMLElement().setAttribute("aria-label",this.selectBoxOptions.ariaLabel||""),this.selectList.getHTMLElement().setAttribute("aria-expanded","true"),this.styleList()}onPointerUp(e){if(!this.selectList.length)return;ve.stop(e);const t=e.target;if(!t||t.classList.contains("slider"))return;const i=t.closest(".monaco-list-row");if(!i)return;const n=Number(i.getAttribute("data-index")),s=i.classList.contains("option-disabled");n>=0&&n<this.options.length&&!s&&(this.selected=n,this.select(this.selected),this.selectList.setFocus([this.selected]),this.selectList.reveal(this.selectList.getFocus()[0]),this.selected!==this._currentSelection&&(this._currentSelection=this.selected,this._onDidSelect.fire({index:this.selectElement.selectedIndex,selected:this.options[this.selected].text}),this.options[this.selected]&&this.options[this.selected].text&&this.setTitle(this.options[this.selected].text)),this.hideSelectDropDown(!0))}onListBlur(){this._sticky||(this.selected!==this._currentSelection&&this.select(this._currentSelection),this.hideSelectDropDown(!1))}renderDescriptionMarkdown(e,t){const i=s=>{for(let r=0;r<s.childNodes.length;r++){const a=s.childNodes.item(r);(a.tagName&&a.tagName.toLowerCase())==="img"?a.remove():i(a)}},n=dp({value:e,supportThemeIcons:!0},{actionHandler:t});return n.element.classList.add("select-box-description-markdown"),i(n.element),n}onListFocus(e){!this._isVisible||!this._hasDetails||this.updateDetail(e.indexes[0])}updateDetail(e){this._selectionDetailsDisposables.clear(),this.selectionDetailsPane.textContent="";const t=this.options[e],i=t?.description??"",n=t?.descriptionIsMarkdown??!1;if(i){if(n){const s=t.descriptionMarkdownActionHandler,r=this._selectionDetailsDisposables.add(this.renderDescriptionMarkdown(i,s));this.selectionDetailsPane.appendChild(r.element)}else this.selectionDetailsPane.textContent=i;this.selectionDetailsPane.style.display="block"}else this.selectionDetailsPane.style.display="none";this._skipLayout=!0,this.contextViewProvider.layout(),this._skipLayout=!1}onEscape(e){ve.stop(e),this.select(this._currentSelection),this.hideSelectDropDown(!0)}onEnter(e){if(ve.stop(e),this.options[this.selected]?.isDisabled){this.hideSelectDropDown(!0);return}this.selected!==this._currentSelection&&(this._currentSelection=this.selected,this._onDidSelect.fire({index:this.selectElement.selectedIndex,selected:this.options[this.selected].text}),this.options[this.selected]&&this.options[this.selected].text&&this.setTitle(this.options[this.selected].text)),this.hideSelectDropDown(!0)}onDownArrow(e){if(this.selected<this.options.length-1){ve.stop(e,!0);let t=this.selected+1;for(;t<this.options.length&&this.options[t].isDisabled;)t++;if(t>=this.options.length)return;this.selected=t,this.select(this.selected),this.selectList.setFocus([this.selected]),this.selectList.reveal(this.selectList.getFocus()[0])}}onUpArrow(e){if(this.selected>0){ve.stop(e,!0);let t=this.selected-1;for(;t>=0&&this.options[t].isDisabled;)t--;if(t<0)return;this.selected=t,this.select(this.selected),this.selectList.setFocus([this.selected]),this.selectList.reveal(this.selectList.getFocus()[0])}}onPageUp(e){ve.stop(e),this.selectList.focusPreviousPage(),setTimeout(()=>{let t=this.selectList.getFocus()[0];for(;t>0&&this.options[t].isDisabled;)t--;this.options[t].isDisabled||(this.selected=t,this.selectList.setFocus([this.selected]),this.selectList.reveal(this.selected),this.select(this.selected))},1)}onPageDown(e){ve.stop(e),this.selectList.focusNextPage(),setTimeout(()=>{let t=this.selectList.getFocus()[0];for(;t<this.options.length-1&&this.options[t].isDisabled;)t++;this.options[t].isDisabled||(this.selected=t,this.selectList.setFocus([this.selected]),this.selectList.reveal(this.selected),this.select(this.selected))},1)}onHome(e){if(ve.stop(e),this.options.length<2)return;let t=0;for(;t<this.options.length-1&&this.options[t].isDisabled;)t++;this.options[t].isDisabled||(this.selected=t,this.selectList.setFocus([this.selected]),this.selectList.reveal(this.selected),this.select(this.selected))}onEnd(e){if(ve.stop(e),this.options.length<2)return;let t=this.options.length-1;for(;t>0&&this.options[t].isDisabled;)t--;this.options[t].isDisabled||(this.selected=t,this.selectList.setFocus([this.selected]),this.selectList.reveal(this.selected),this.select(this.selected))}onCharacter(e){const t=l.KeyCodeUtils.toString(e.keyCode);let i=-1;for(let n=0;n<this.options.length-1;n++)if(i=(n+this.selected+1)%this.options.length,this.options[i].text.charAt(0).toUpperCase()===t&&!this.options[i].isDisabled){this.select(i),this.selectList.setFocus([i]),this.selectList.reveal(this.selectList.getFocus()[0]),ve.stop(e);break}}dispose(){this.hideSelectDropDown(!1),super.dispose()}};Js.DEFAULT_DROPDOWN_MINIMUM_BOTTOM_MARGIN=32,Js.DEFAULT_DROPDOWN_MINIMUM_TOP_MARGIN=2,Js.DEFAULT_MINIMUM_VISIBLE_OPTIONS=3;let Py=Js;class sq extends l.Disposable{constructor(e,t,i,n){super(),this.selected=0,this.selectBoxOptions=n||Object.create(null),this.options=[],this.selectElement=document.createElement("select"),this.selectElement.className="monaco-select-box",typeof this.selectBoxOptions.ariaLabel=="string"&&this.selectElement.setAttribute("aria-label",this.selectBoxOptions.ariaLabel),typeof this.selectBoxOptions.ariaDescription=="string"&&this.selectElement.setAttribute("aria-description",this.selectBoxOptions.ariaDescription),this._onDidSelect=this._register(new l.Emitter),this.styles=i,this.registerListeners(),this.setOptions(e,t)}registerListeners(){this._register(li.addTarget(this.selectElement)),[_.EventType$1.Tap].forEach(e=>{this._register(R(this.selectElement,e,t=>{this.selectElement.focus()}))}),this._register(At(this.selectElement,"click",e=>{ve.stop(e,!0)})),this._register(At(this.selectElement,"change",e=>{this.selectElement.title=e.target.value,this._onDidSelect.fire({index:e.target.selectedIndex,selected:e.target.value})})),this._register(At(this.selectElement,"keydown",e=>{let t=!1;l.isMacintosh?(e.keyCode===18||e.keyCode===16||e.keyCode===10)&&(t=!0):(e.keyCode===18&&e.altKey||e.keyCode===10||e.keyCode===3)&&(t=!0),t&&e.stopPropagation()}))}get onDidSelect(){return this._onDidSelect.event}setOptions(e,t){(!this.options||!l.equals(this.options,e))&&(this.options=e,this.selectElement.options.length=0,this.options.forEach((i,n)=>{this.selectElement.add(this.createOption(i.text,n,i.isDisabled,i.isSeparator))})),t!==void 0&&this.select(t)}select(e){this.options.length===0?this.selected=0:e>=0&&e<this.options.length?this.selected=e:e>this.options.length-1?this.select(this.options.length-1):this.selected<0&&(this.selected=0),this.selectElement.selectedIndex=this.selected,this.selected<this.options.length&&typeof this.options[this.selected].text=="string"?this.selectElement.title=this.options[this.selected].text:this.selectElement.title=""}focus(){this.selectElement&&(this.selectElement.tabIndex=0,this.selectElement.focus())}blur(){this.selectElement&&(this.selectElement.tabIndex=-1,this.selectElement.blur())}setFocusable(e){this.selectElement.tabIndex=e?0:-1}render(e){e.classList.add("select-container"),e.appendChild(this.selectElement),this.setOptions(this.options,this.selected),this.applyStyles()}applyStyles(){this.selectElement&&(this.selectElement.style.backgroundColor=this.styles.selectBackground??"",this.selectElement.style.color=this.styles.selectForeground??"",this.selectElement.style.borderColor=this.styles.selectBorder??"")}createOption(e,t,i,n){const s=document.createElement("option");return s.value=e,s.text=e,s.disabled=!!i||!!n,n&&s.setAttribute("role","separator"),s}}const oq=Object.freeze({text:"─────────",isDisabled:!0,isSeparator:!0});class rq extends Wn{constructor(e,t,i,n,s){super(),l.isMacintosh&&!s?.useCustomDrawn?this.selectBoxDelegate=new sq(e,t,n,s):this.selectBoxDelegate=new Py(e,t,i,n,s),this._register(this.selectBoxDelegate)}get onDidSelect(){return this.selectBoxDelegate.onDidSelect}setOptions(e,t){this.selectBoxDelegate.setOptions(e,t)}select(e){this.selectBoxDelegate.select(e)}focus(){this.selectBoxDelegate.focus()}blur(){this.selectBoxDelegate.blur()}setFocusable(e){this.selectBoxDelegate.setFocusable(e)}render(e){this.selectBoxDelegate.render(e)}}class Vn extends l.Disposable{get action(){return this._action}constructor(e,t,i={}){super(),this.options=i,this._context=e||this,this._action=t,t instanceof oo&&this._register(t.onDidChange(n=>{this.element&&this.handleActionChangeEvent(n)}))}handleActionChangeEvent(e){e.enabled!==void 0&&this.updateEnabled(),e.checked!==void 0&&this.updateChecked(),e.class!==void 0&&this.updateClass(),e.label!==void 0&&(this.updateLabel(),this.updateTooltip()),e.tooltip!==void 0&&this.updateTooltip()}get actionRunner(){return this._actionRunner||(this._actionRunner=this._register(new Jr)),this._actionRunner}set actionRunner(e){this._actionRunner=e}isEnabled(){return this._action.enabled}setActionContext(e){this._context=e}render(e){const t=this.element=e;this._register(li.addTarget(e));const i=this.options&&this.options.draggable;i&&(e.draggable=!0,di&&this._register(R(e,F.DRAG_START,n=>n.dataTransfer?.setData(pc.TEXT,this._action.label)))),this._register(R(t,_.EventType$1.Tap,n=>this.onClick(n,!0))),this._register(R(t,F.MOUSE_DOWN,n=>{i||ve.stop(n,!0),this._action.enabled&&n.button===0&&t.classList.add("active")})),l.isMacintosh&&this._register(R(t,F.CONTEXT_MENU,n=>{n.button===0&&n.ctrlKey===!0&&this.onClick(n)})),this._register(R(t,F.CLICK,n=>{ve.stop(n,!0),this.options&&this.options.isMenu||this.onClick(n)})),this._register(R(t,F.DBLCLICK,n=>{ve.stop(n,!0)})),[F.MOUSE_UP,F.MOUSE_OUT].forEach(n=>{this._register(R(t,n,s=>{ve.stop(s),t.classList.remove("active")}))})}onClick(e,t=!1){ve.stop(e,!0);const i=l.isUndefinedOrNull(this._context)?this.options?.useEventAsContext?e:{preserveFocus:t}:this._context;this.actionRunner.run(this._action,i)}focus(){this.element&&(this.element.tabIndex=0,this.element.focus(),this.element.classList.add("focused"))}blur(){this.element&&(this.element.blur(),this.element.tabIndex=-1,this.element.classList.remove("focused"))}setFocusable(e){this.element&&(this.element.tabIndex=e?0:-1)}get trapsArrowNavigation(){return!1}updateEnabled(){}updateLabel(){}getClass(){return this.action.class}getTooltip(){return this.action.tooltip}getHoverContents(){return this.getTooltip()}updateTooltip(){if(!this.element)return;const e=this.getHoverContents()??"";if(this.updateAriaLabel(),!this.customHover&&e!==""){const t=this.options.hoverDelegate??Io("element");this.customHover=this._store.add(En().setupManagedHover(t,this.element,e))}else this.customHover&&this.customHover.update(e)}updateAriaLabel(){if(this.element){const e=this.getTooltip()??"";this.element.setAttribute("aria-label",e)}}updateClass(){}updateChecked(){}dispose(){this.element&&(this.element.remove(),this.element=void 0),this._context=void 0,super.dispose()}}class Fp extends Vn{constructor(e,t,i){i={...i,icon:i.icon!==void 0?i.icon:!1,label:i.label!==void 0?i.label:!0},super(e,t,i),this.options=i,this.cssClass=""}render(e){super.render(e),l.assertType(this.element);const t=document.createElement("a");if(t.classList.add("action-label"),t.setAttribute("role",this.getDefaultAriaRole()),this.label=t,this.element.appendChild(t),this.options.label&&this.options.keybinding&&!this.options.keybindingNotRenderedWithLabel){const i=document.createElement("span");i.classList.add("keybinding"),i.textContent=this.options.keybinding,this.element.appendChild(i)}this.updateClass(),this.updateLabel(),this.updateTooltip(),this.updateEnabled(),this.updateChecked()}getDefaultAriaRole(){return this._action.id===ft.ID?"presentation":this.options.isMenu?"menuitem":this.options.isTabList?"tab":"button"}focus(){this.label&&(this.label.tabIndex=0,this.label.focus())}blur(){this.label&&(this.label.tabIndex=-1)}setFocusable(e){this.label&&(this.label.tabIndex=e?0:-1)}updateLabel(){this.options.label&&this.label&&(this.label.textContent=this.action.label)}getTooltip(){let e=null;return this.action.tooltip?e=this.action.tooltip:this.action.label&&(e=this.action.label,this.options.keybinding&&(e=l.localize(0,"{0} ({1})",e,this.options.keybinding))),e??void 0}updateClass(){this.cssClass&&this.label&&this.label.classList.remove(...this.cssClass.split(" ")),this.action.id===ft.ID&&this.action.class?this.label?.classList.add(this.action.class):this.options.icon?(this.cssClass=this.getClass(),this.label&&(this.label.classList.add("codicon"),this.cssClass&&this.label.classList.add(...this.cssClass.split(" "))),this.updateEnabled()):this.label?.classList.remove("codicon")}updateEnabled(){this.action.enabled?(this.label&&(this.label.removeAttribute("aria-disabled"),this.label.classList.remove("disabled")),this.element?.classList.remove("disabled")):(this.label&&(this.label.setAttribute("aria-disabled","true"),this.label.classList.add("disabled")),this.element?.classList.add("disabled"))}updateAriaLabel(){if(this.label){const e=this.getTooltip()??"";this.label.setAttribute("aria-label",e)}}updateChecked(){this.label&&(this.action.checked!==void 0?(this.label.classList.toggle("checked",this.action.checked),this.options.isTabList?this.label.setAttribute("aria-selected",this.action.checked?"true":"false"):(this.label.setAttribute("aria-pressed",this.action.checked?"true":"false"),this.label.setAttribute("role","button"))):(this.label.classList.remove("checked"),this.label.removeAttribute(this.options.isTabList?"aria-selected":"aria-pressed"),this.label.setAttribute("role",this.getDefaultAriaRole())))}}class aq extends Vn{constructor(e,t,i,n,s,r,a){super(e,t),this.selectBox=new rq(i,n,s,r,a),this.selectBox.setFocusable(!1),this._register(this.selectBox),this.registerListeners()}select(e){this.selectBox.select(e)}registerListeners(){this._register(this.selectBox.onDidSelect(e=>this.runAction(e.selected,e.index)))}runAction(e,t){this.actionRunner.run(this._action,this.getActionContext(e,t))}getActionContext(e,t){return e}setFocusable(e){this.selectBox.setFocusable(e)}focus(){this.selectBox?.focus()}blur(){this.selectBox?.blur()}render(e){this.selectBox.render(e)}}class lq extends Jr{constructor(e,t){super(),this._onDidChangeVisibility=this._register(new l.Emitter),this.onDidChangeVisibility=this._onDidChangeVisibility.event,this._element=K(e,Q(".monaco-dropdown")),this._label=K(this._element,Q(".dropdown-label"));let i=t.labelRenderer;i||(i=s=>(s.textContent=t.label||"",null));for(const s of[F.CLICK,F.MOUSE_DOWN,_.EventType$1.Tap])this._register(R(this.element,s,r=>ve.stop(r,!0)));for(const s of[F.MOUSE_DOWN,_.EventType$1.Tap])this._register(R(this._label,s,r=>{Qf(r)&&r.button!==0||(this.visible?this.hide():this.show())}));this._register(R(this._label,F.KEY_DOWN,s=>{const r=new Be(s);(r.equals(3)||r.equals(10))&&(ve.stop(s,!0),this.visible?this.hide():this.show())}));const n=i(this._label);n&&this._register(n),this._register(li.addTarget(this._label))}get element(){return this._element}show(){this.visible||(this.visible=!0,this._onDidChangeVisibility.fire(!0))}hide(){this.visible&&(this.visible=!1,this._onDidChangeVisibility.fire(!1))}dispose(){super.dispose(),this.hide(),this.boxContainer&&(this.boxContainer.remove(),this.boxContainer=void 0),this.contents&&(this.contents.remove(),this.contents=void 0),this._label&&(this._label.remove(),this._label=void 0)}}class cq extends lq{constructor(e,t){super(e,t),this._options=t,this._actions=[],this.actions=t.actions||[]}set menuOptions(e){this._menuOptions=e}get menuOptions(){return this._menuOptions}get actions(){return this._options.actionProvider?this._options.actionProvider.getActions():this._actions}set actions(e){this._actions=e}show(){super.show(),this.element.classList.add("active"),this._options.contextMenuProvider.showContextMenu({getAnchor:()=>this.element,getActions:()=>this.actions,getActionsContext:()=>this.menuOptions?this.menuOptions.context:null,getActionViewItem:(e,t)=>this.menuOptions&&this.menuOptions.actionViewItemProvider?this.menuOptions.actionViewItemProvider(e,t):void 0,getKeyBinding:e=>this.menuOptions&&this.menuOptions.getKeyBinding?this.menuOptions.getKeyBinding(e):void 0,getMenuClassName:()=>this._options.menuClassName||"",onHide:()=>this.onHide(),actionRunner:this.menuOptions?this.menuOptions.actionRunner:void 0,anchorAlignment:this.menuOptions?this.menuOptions.anchorAlignment:0,domForShadowRoot:this._options.menuAsChild?this.element:void 0,skipTelemetry:this._options.skipTelemetry})}hide(){super.hide()}onHide(){this.hide(),this.element.classList.remove("active")}}class Bp extends Vn{get onDidChangeVisibility(){return this._onDidChangeVisibility.event}constructor(e,t,i,n=Object.create(null)){super(null,e,n),this.actionItem=null,this._onDidChangeVisibility=this._register(new l.Emitter),this.menuActionsOrProvider=t,this.contextMenuProvider=i,this.options=n,this.options.actionRunner&&(this.actionRunner=this.options.actionRunner)}render(e){this.actionItem=e;const t=s=>(this.element=K(s,Q("a.action-label")),this.setAriaLabelAttributes(this.element),this.renderLabel(this.element)),i=Array.isArray(this.menuActionsOrProvider),n={contextMenuProvider:this.contextMenuProvider,labelRenderer:t,menuAsChild:this.options.menuAsChild,actions:i?this.menuActionsOrProvider:void 0,actionProvider:i?void 0:this.menuActionsOrProvider,skipTelemetry:this.options.skipTelemetry};if(this.dropdownMenu=this._register(new cq(e,n)),this._register(this.dropdownMenu.onDidChangeVisibility(s=>{this.element?.setAttribute("aria-expanded",`${s}`),this._onDidChangeVisibility.fire(s)})),this.dropdownMenu.menuOptions={actionViewItemProvider:this.options.actionViewItemProvider,actionRunner:this.actionRunner,getKeyBinding:this.options.keybindingProvider,context:this._context},this.options.anchorAlignmentProvider){const s=this;this.dropdownMenu.menuOptions={...this.dropdownMenu.menuOptions,get anchorAlignment(){return s.options.anchorAlignmentProvider()}}}this.updateTooltip(),this.updateEnabled()}renderLabel(e){let t=[];return typeof this.options.classNames=="string"?t=this.options.classNames.split(/\s+/g).filter(i=>!!i):this.options.classNames&&(t=this.options.classNames),t.find(i=>i==="icon")||t.push("codicon"),e.classList.add(...t),this._action.label&&this._register(En().setupManagedHover(this.options.hoverDelegate??Io("mouse"),e,this._action.label)),null}setAriaLabelAttributes(e){e.setAttribute("role","button"),e.setAttribute("aria-haspopup","true"),e.setAttribute("aria-expanded","false"),e.ariaLabel=this._action.label||""}getTooltip(){let e=null;return this.action.tooltip?e=this.action.tooltip:this.action.label&&(e=this.action.label),e??void 0}setActionContext(e){super.setActionContext(e),this.dropdownMenu&&(this.dropdownMenu.menuOptions?this.dropdownMenu.menuOptions.context=e:this.dropdownMenu.menuOptions={context:e})}show(){this.dropdownMenu?.show()}updateEnabled(){const e=!this.action.enabled;this.actionItem?.classList.toggle("disabled",e),this.element?.classList.toggle("disabled",e)}}class zp{constructor(e,t,i=t){this.modifierLabels=[null],this.modifierLabels[2]=e,this.modifierLabels[1]=t,this.modifierLabels[3]=i}toLabel(e,t,i){if(t.length===0)return null;const n=[];for(let s=0,r=t.length;s<r;s++){const a=t[s],c=i(a);if(c===null)return null;n[s]=fq(a,c,this.modifierLabels[e])}return n.join(" ")}}const ky=new zp({ctrlKey:"⌃",shiftKey:"⇧",altKey:"⌥",metaKey:"⌘",separator:""},{ctrlKey:l.localize(39,"Ctrl"),shiftKey:l.localize(40,"Shift"),altKey:l.localize(41,"Alt"),metaKey:l.localize(42,"Windows"),separator:"+"},{ctrlKey:l.localize(43,"Ctrl"),shiftKey:l.localize(44,"Shift"),altKey:l.localize(45,"Alt"),metaKey:l.localize(46,"Super"),separator:"+"}),hq=new zp({ctrlKey:l.localize(47,"Control"),shiftKey:l.localize(48,"Shift"),altKey:l.localize(49,"Option"),metaKey:l.localize(50,"Command"),separator:"+"},{ctrlKey:l.localize(51,"Control"),shiftKey:l.localize(52,"Shift"),altKey:l.localize(53,"Alt"),metaKey:l.localize(54,"Windows"),separator:"+"},{ctrlKey:l.localize(55,"Control"),shiftKey:l.localize(56,"Shift"),altKey:l.localize(57,"Alt"),metaKey:l.localize(58,"Super"),separator:"+"}),dq=new zp({ctrlKey:"Ctrl",shiftKey:"Shift",altKey:"Alt",metaKey:"Cmd",separator:"+"},{ctrlKey:"Ctrl",shiftKey:"Shift",altKey:"Alt",metaKey:"Super",separator:"+"}),uq=new zp({ctrlKey:"ctrl",shiftKey:"shift",altKey:"alt",metaKey:"cmd",separator:"+"},{ctrlKey:"ctrl",shiftKey:"shift",altKey:"alt",metaKey:"win",separator:"+"},{ctrlKey:"ctrl",shiftKey:"shift",altKey:"alt",metaKey:"meta",separator:"+"});function fq(o,e,t){if(e===null)return"";const i=[];return o.ctrlKey&&i.push(t.ctrlKey),o.shiftKey&&i.push(t.shiftKey),o.altKey&&i.push(t.altKey),o.metaKey&&i.push(t.metaKey),e!==""&&i.push(e),i.join(t.separator)}function gq(o){return!!o&&typeof o=="object"&&typeof o.original=="string"&&typeof o.value=="string"}function mq(o){return o?o.condition!==void 0:!1}function pq(o,e){const t={...e};for(const i in o){const n=o[i];t[i]=n!==void 0?z(n):void 0}return t}const mM={keybindingLabelBackground:z(G2),keybindingLabelForeground:z(j2),keybindingLabelBorder:z(q2),keybindingLabelBottomBorder:z(Y2),keybindingLabelShadow:z(oc)},_q={buttonForeground:z(hv),buttonSeparator:z(I2),buttonBackground:z(lc),buttonHoverBackground:z(T2),buttonSecondaryForeground:z(R2),buttonSecondaryBackground:z(M2),buttonSecondaryHoverBackground:z(O2),buttonSecondaryBorder:z(A2),buttonBorder:z(N2)},bq={progressBarBackground:z(vV)},Fy={inputActiveOptionBorder:z(ov),inputActiveOptionForeground:z(av),inputActiveOptionBackground:z(rv)};z(Rd),z(P2),z(k2),z(F2),z(B2),z(z2),z(V2);const By={checkboxBackground:z(dv),checkboxBorder:z(U2),checkboxForeground:z(uv),checkboxDisabledBackground:z($2),checkboxDisabledForeground:z(K2)};z(wn),z(sc),z(oc),z(HC),z(KV),z(GV),z(jV),z(bV);const zy={inputBackground:z(JE),inputForeground:z(WE),inputBorder:z(HE),inputValidationInfoBorder:z(v2),inputValidationInfoBackground:z(b2),inputValidationInfoForeground:z(C2),inputValidationWarningBorder:z(y2),inputValidationWarningBackground:z(w2),inputValidationWarningForeground:z(S2),inputValidationErrorBorder:z(x2),inputValidationErrorBackground:z(L2),inputValidationErrorForeground:z(D2)},Cq={listFilterWidgetBackground:z(c2),listFilterWidgetOutline:z(h2),listFilterWidgetNoMatchesOutline:z(d2),listFilterWidgetShadow:z(u2),inputBoxStyles:zy,toggleStyles:Fy},pM={badgeBackground:z(Bg),badgeForeground:z(CV),badgeBorder:z(pe)};z(zV),z(BV),z(UE),z(UE),z(VV);const Hc={listBackground:void 0,listInactiveFocusForeground:void 0,listFocusBackground:z(WV),listFocusForeground:z(HV),listFocusOutline:z(e2),listActiveSelectionBackground:z(fa),listActiveSelectionForeground:z(Td),listActiveSelectionIconForeground:z(ZE),listFocusAndSelectionOutline:z(t2),listFocusAndSelectionBackground:z(fa),listFocusAndSelectionForeground:z(Td),listInactiveSelectionBackground:z(i2),listInactiveSelectionIconForeground:z(s2),listInactiveSelectionForeground:z(n2),listInactiveFocusBackground:z(o2),listInactiveFocusOutline:z(r2),listHoverBackground:z(ga),listHoverForeground:z(sv),listDropOverBackground:z(a2),listDropBetweenBackground:z(l2),listSelectionOutline:z(ot),listHoverOutline:z(ot),treeIndentGuidesStroke:z(XE),treeInactiveIndentGuidesStroke:z(f2),treeStickyScrollBackground:void 0,treeStickyScrollBorder:void 0,treeStickyScrollShadow:z(zg),tableColumnsBorder:z(g2),tableOddRowsBackgroundColor:z(m2)};function eh(o){return pq(o,Hc)}const vq={selectBackground:z(Kg),selectListBackground:z(E2),selectForeground:z(lv),decoratorRightForeground:z(eI),selectBorder:z(cv),focusBorder:z(bs),listFocusBackground:z(Ad),listInactiveSelectionIconForeground:z(gv),listFocusForeground:z(Md),listFocusOutline:EE(ot,l.Color.transparent.toString()),listHoverBackground:z(ga),listHoverForeground:z(sv),listHoverOutline:z(ot),selectListBorder:z(Vg),listBackground:void 0,listActiveSelectionBackground:void 0,listActiveSelectionForeground:void 0,listActiveSelectionIconForeground:void 0,listFocusAndSelectionBackground:void 0,listDropOverBackground:void 0,listDropBetweenBackground:void 0,listInactiveSelectionBackground:void 0,listInactiveSelectionForeground:void 0,listInactiveFocusBackground:void 0,listInactiveFocusOutline:void 0,listSelectionOutline:void 0,listFocusAndSelectionForeground:void 0,listFocusAndSelectionOutline:void 0,listInactiveFocusForeground:void 0,tableColumnsBorder:void 0,tableOddRowsBackgroundColor:void 0,treeIndentGuidesStroke:void 0,treeInactiveIndentGuidesStroke:void 0,treeStickyScrollBackground:void 0,treeStickyScrollBorder:void 0,treeStickyScrollShadow:void 0},wq={shadowColor:z(oc),borderColor:EE(Z2,Vg),foregroundColor:z(Q2),backgroundColor:z(X2),selectionForegroundColor:z(sv),selectionBackgroundColor:z(ga),selectionBorderColor:z(J2),separatorColor:z(W2),scrollbarShadow:z(zg),scrollbarSliderBackground:z(AE),scrollbarSliderHoverBackground:z(OE),scrollbarSliderActiveBackground:z(PE)},_M=["#007acc","#005a9e","#0098ff","#4fc3f7","#64b5f6","#42a5f5"];let Yu;function Vp(o){if(Yu)return;const e=o.getBoundingClientRect(),t=j(o).document,i=Q(".animation-overlay");return i.style.position="fixed",i.style.left=`${e.left}px`,i.style.top=`${e.top}px`,i.style.width=`${e.width}px`,i.style.height=`${e.height}px`,i.style.pointerEvents="none",i.style.overflow="visible",i.style.zIndex="10000",t.body.appendChild(i),Yu=i,{overlay:i,cx:e.width/2,cy:e.height/2}}function Up(o){setTimeout(()=>{Yu&&(Yu.remove(),Yu=void 0)},o)}function $p(o,e){const t=[],i=Math.max(e.scale?.length??0,e.rotate?.length??0,e.translateY?.length??0);if(i!==0){for(let n=0;n<i;n++){const s={offset:i===1?1:n/(i-1)};let r="";const a=e.scale?.[n];a!==void 0&&(r+=`scale(${a})`);const c=e.rotate?.[n];c!==void 0&&(r+=` rotate(${c}deg)`);const h=e.translateY?.[n];h!==void 0&&(r+=` translateY(${h}px)`),r&&(s.transform=r.trim()),t.push(s)}o.animate(t,{duration:e.duration??350,easing:"cubic-bezier(0.4, 0, 0.2, 1)",fill:"forwards"})}}function Sq(o){const e=Vp(o);if(!e)return;const{overlay:t,cx:i,cy:n}=e,s=o.getBoundingClientRect();$p(o,{scale:[1,1.3,1],rotate:[0,-10,10,0],duration:350});const r=10;for(let c=0;c<r;c++){const h=3+c%3*1.5,d=c*36*Math.PI/180,u=35,f=.6+c%4*.1,g=Q(".animation-particle");g.style.position="absolute",g.style.width=`${h}px`,g.style.height=`${h}px`,g.style.borderRadius="50%",g.style.backgroundColor=_M[c%_M.length],g.style.left=`${i-h/2}px`,g.style.top=`${n-h/2}px`,t.appendChild(g);const m=Math.cos(d)*u,p=Math.sin(d)*u;g.animate([{opacity:0,transform:"scale(0) translate(0, 0)"},{opacity:f,transform:`scale(1) translate(${m*.5}px, ${p*.5}px)`,offset:.3},{opacity:f,transform:`scale(1) translate(${m}px, ${p}px)`,offset:.7},{opacity:0,transform:`scale(0) translate(${m}px, ${p}px)`}],{duration:1100,easing:"cubic-bezier(0.4, 0, 0.2, 1)",fill:"forwards"})}const a=Q(".animation-particle");a.style.position="absolute",a.style.left="0",a.style.top="0",a.style.width=`${s.width}px`,a.style.height=`${s.height}px`,a.style.borderRadius="50%",a.style.border="2px solid var(--vscode-focusBorder, #007acc)",a.style.boxSizing="border-box",t.appendChild(a),a.animate([{transform:"scale(1)",opacity:1},{transform:"scale(2)",opacity:0}],{duration:800,easing:"cubic-bezier(0.4, 0, 0.2, 1)",fill:"forwards"}),Up(2e3)}function yq(o,e){const t=Vp(o);if(!t)return;const{overlay:i,cx:n,cy:s}=t,r=o.getBoundingClientRect();$p(o,{translateY:[0,-6,0],duration:350});const a=6;for(let h=0;h<a;h++){const d=12+h%3*2,u=Q(".animation-particle");u.style.position="absolute",u.style.left=`${n}px`,u.style.top=`${s}px`,u.style.fontSize=`${d}px`,u.style.lineHeight="1",u.style.color="var(--vscode-focusBorder, #007acc)",u.classList.add(..._.ThemeIcon.asClassNameArray(e)),i.appendChild(u);const f=(Math.random()-.5)*50,g=-50-h%3*10,m=(Math.random()-.5)*20,p=(Math.random()-.5)*40;u.animate([{opacity:0,transform:`translate(-50%, -50%) scale(0) rotate(${m}deg)`},{opacity:1,transform:`translate(calc(-50% + ${f*.3}px), calc(-50% + ${g*.3}px)) scale(1) rotate(${(m+p)*.3}deg)`,offset:.3},{opacity:1,transform:`translate(calc(-50% + ${f*.7}px), calc(-50% + ${g*.7}px)) scale(1) rotate(${(m+p)*.7}deg)`,offset:.7},{opacity:0,transform:`translate(calc(-50% + ${f}px), calc(-50% + ${g}px)) scale(0.8) rotate(${p}deg)`}],{duration:800+h%3*200,delay:h*80,easing:"cubic-bezier(0.4, 0, 0.2, 1)",fill:"forwards"})}const c=Q(".animation-particle");c.style.position="absolute",c.style.left="0",c.style.top="0",c.style.width=`${r.width}px`,c.style.height=`${r.height}px`,c.style.borderRadius="50%",c.style.border="2px solid var(--vscode-focusBorder, #007acc)",c.style.boxSizing="border-box",i.appendChild(c),c.animate([{transform:"scale(1)",opacity:1},{transform:"scale(2)",opacity:0}],{duration:500,easing:"cubic-bezier(0.4, 0, 0.2, 1)",fill:"forwards"}),Up(2e3)}function Lq(o){const e=Vp(o);if(!e)return;const{overlay:t,cx:i,cy:n}=e,s=o.getBoundingClientRect();$p(o,{scale:[1,1.1,1],rotate:[0,-12,0],duration:400});for(let a=0;a<2;a++){const c=Q(".animation-particle");c.style.position="absolute",c.style.left="0",c.style.top="0",c.style.width=`${s.width}px`,c.style.height=`${s.height}px`,c.style.borderRadius="50%",c.style.border="2px solid var(--vscode-focusBorder, #007acc)",c.style.boxSizing="border-box",t.appendChild(c),c.animate([{transform:"scale(0.8)",opacity:0},{transform:"scale(0.8)",opacity:.6,offset:.01},{transform:"scale(2.5)",opacity:0}],{duration:800,delay:a*150,easing:"cubic-bezier(0.4, 0, 0.2, 1)",fill:"forwards"})}for(let a=0;a<6;a++){const c=a*60*Math.PI/180,h=30+a%2*10,d=3.5,u=Q(".animation-particle");u.style.position="absolute",u.style.width=`${d}px`,u.style.height=`${d}px`,u.style.borderRadius="50%",u.style.backgroundColor="#0098ff",u.style.left=`${i-d/2}px`,u.style.top=`${n-d/2}px`,t.appendChild(u);const f=Math.cos(c)*h,g=Math.sin(c)*h;u.animate([{opacity:0,transform:"scale(0) translate(0, 0)"},{opacity:1,transform:`scale(1) translate(${f}px, ${g}px)`,offset:.5},{opacity:0,transform:`scale(0) translate(${f}px, ${g}px)`}],{duration:600,delay:100+a*50,easing:"cubic-bezier(0.4, 0, 0.2, 1)",fill:"forwards"})}const r=Q(".animation-particle");r.style.position="absolute",r.style.left="0",r.style.top="0",r.style.width=`${s.width}px`,r.style.height=`${s.height}px`,r.style.borderRadius="50%",r.style.backgroundColor="var(--vscode-focusBorder, #007acc)",t.appendChild(r),r.animate([{transform:"scale(0.9)",opacity:0},{transform:"scale(0.9)",opacity:.5,offset:.01},{transform:"scale(1.5)",opacity:0}],{duration:500,easing:"cubic-bezier(0.4, 0, 0.2, 1)",fill:"forwards"}),Up(2e3)}function Dq(o){const e=Vp(o);if(!e)return;const{overlay:t,cx:i,cy:n}=e;$p(o,{scale:[1,1.15,1],duration:350});for(let s=0;s<8;s++){const c=(s*45+22.5)*Math.PI/180,h=14,d=30,u=Q(".animation-particle");u.style.position="absolute",u.style.width="3px",u.style.height="3px",u.style.borderRadius="50%",u.style.backgroundColor="var(--vscode-editor-foreground, #ffffff)",u.style.left=`${i-3/2}px`,u.style.top=`${n-3/2}px`,t.appendChild(u);const f=Math.cos(c)*h,g=Math.sin(c)*h,m=Math.cos(c)*d,p=Math.sin(c)*d;u.animate([{opacity:0,transform:`scale(0) translate(${f}px, ${g}px)`},{opacity:.7,transform:`scale(1.2) translate(${(f+m)/2}px, ${(g+p)/2}px)`,offset:.25},{opacity:.7,transform:`scale(1) translate(${m*.8}px, ${p*.8}px)`,offset:.5},{opacity:.7*.5,transform:`scale(1) translate(${m}px, ${p}px)`,offset:.75},{opacity:0,transform:`scale(0.5) translate(${m}px, ${p}px)`}],{duration:1100,easing:"cubic-bezier(0.4, 0, 0.2, 1)",fill:"forwards"})}for(let s=0;s<8;s++){const r=s*45,a=Q(".animation-particle");a.style.position="absolute",a.style.left=`${i}px`,a.style.top=`${n}px`,a.style.width="0",a.style.height="0",a.style.transform=`rotate(${r}deg)`,t.appendChild(a);const c=Q(".animation-particle");c.style.position="absolute",c.style.width="2px",c.style.height="10px",c.style.backgroundColor="var(--vscode-focusBorder, #007acc)",c.style.left="-1px",c.style.top="-22px",c.style.transformOrigin="bottom center",a.appendChild(c),c.animate([{transform:"scale(1, 0)",opacity:.6},{transform:"scale(1, 1)",opacity:.6,offset:.2},{transform:"scale(1, 1)",opacity:.6,offset:.6},{transform:"scale(1, 1)",opacity:.6,offset:.8},{transform:"scale(0, 0.3)",opacity:0}],{duration:1200,delay:150,easing:"cubic-bezier(0.4, 0, 0.2, 1)",fill:"forwards"})}Up(2e3)}function xq(o,e,t){switch(e){case 1:Sq(o);break;case 2:t&&yq(o,t);break;case 3:Lq(o);break;case 4:Dq(o);break}}function Eq(o,e){if(l.isWeb)return!1;const t=Iq(o,e),i=o.getValue("window");return i?.menuStyle==="native"?!(!l.isMacintosh&&!t):i?.menuStyle==="custom"?!1:t}function Iq(o,e){return e||(e=bM(o)),e==="native"}function bM(o){if(l.isWeb)return"custom";const e=o.getValue("window");if(e){if(l.isMacintosh&&e.nativeTabs===!0||l.isMacintosh&&e.nativeFullScreen===!1)return"native";const n=e.titleBarStyle;if(n==="native"||n==="custom")return n}return"custom"}function Tq(o){if(l.isWeb||l.isMacintosh||bM(o)==="native")return"native";const t=o.getValue("window")?.controlsStyle;return t==="custom"||t==="hidden"?t:"native"}var Kp=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},Si=function(o,e){return function(t,i){e(t,i,o)}};function Nq(o,e){const t=[];return Rq(o,t),t}function Rq(o,e,t){const i=hs.getInstance(),n=i.keyStatus.altKey||(l.isWindows||l.isLinux)&&i.keyStatus.shiftKey;wM(o,e,n,s=>s==="navigation")}function CM(o,e,t,i){const n={primary:[],secondary:[]};return vM(o,n,e,t,i),n}function Mq(o,e,t,i){const n=[];return vM(o,n,e,t,i),n}function vM(o,e,t,i,n){wM(o,e,!1,typeof t=="string"?r=>r===t:t,i,n)}function wM(o,e,t,i=r=>r==="navigation",n=()=>!1,s=!1){let r,a;Array.isArray(e)?(r=e,a=e):(r=e.primary,a=e.secondary);const c=new Set;for(const[h,d]of o){let u;i(h)?(u=r,u.length>0&&s&&u.push(new ft)):(u=a,u.length>0&&u.push(new ft));for(let f of d){t&&(f=f instanceof _.MenuItemAction&&f.alt?f.alt:f);const g=u.push(f);f instanceof cd&&c.add({group:h,action:f,index:g-1})}}for(const{group:h,action:d,index:u}of c){const f=i(h)?r:a,g=d.actions;n(d,h,f.length)&&f.splice(u,1,...g)}}_.MenuEntryActionViewItem=class extends Fp{constructor(e,t,i,n,s,r,a,c){super(void 0,e,{icon:!!(e.class||e.item.icon),label:!e.class&&!e.item.icon,draggable:t?.draggable,keybinding:t?.keybinding,hoverDelegate:t?.hoverDelegate,keybindingNotRenderedWithLabel:t?.keybindingNotRenderedWithLabel}),this._options=t,this._keybindingService=i,this._notificationService=n,this._contextKeyService=s,this._themeService=r,this._contextMenuService=a,this._accessibilityService=c,this._wantsAltCommand=!1,this._itemClassDispose=this._register(new l.MutableDisposable),this._altKey=hs.getInstance()}get _menuItemAction(){return this._action}get _commandAction(){return this._wantsAltCommand&&this._menuItemAction.alt||this._menuItemAction}async onClick(e){if(e.preventDefault(),e.stopPropagation(),this._options?.onClickAnimation&&this.element&&!this._accessibilityService.isMotionReduced()){const t=this._menuItemAction.item.icon;xq(this.element,this._options.onClickAnimation,_.ThemeIcon.isThemeIcon(t)?t:void 0)}try{await this.actionRunner.run(this._commandAction,this._context)}catch(t){this._notificationService.error(t)}}render(e){if(super.render(e),e.classList.add("menu-entry"),this.options.icon&&this._updateItemClass(this._menuItemAction.item),this._menuItemAction.alt){let t=!1;const i=()=>{const n=!!this._menuItemAction.alt?.enabled&&(!this._accessibilityService.isMotionReduced()||t)&&(this._altKey.keyStatus.altKey||this._altKey.keyStatus.shiftKey&&t);n!==this._wantsAltCommand&&(this._wantsAltCommand=n,this.updateLabel(),this.updateTooltip(),this.updateClass())};this._register(this._altKey.event(i)),this._register(R(e,"mouseleave",n=>{t=!1,i()})),this._register(R(e,"mouseenter",n=>{t=!0,i()})),i()}}updateLabel(){this.options.label&&this.label&&(this.label.textContent=this._commandAction.label)}getTooltip(){const e=this._commandAction.tooltip||this._commandAction.label;let t=this._keybindingService.appendKeybinding(e,this._commandAction.id,this._contextKeyService);if(!this._wantsAltCommand&&this._menuItemAction.alt?.enabled){const i=this._menuItemAction.alt.tooltip||this._menuItemAction.alt.label,n=this._keybindingService.appendKeybinding(i,this._menuItemAction.alt.id,this._contextKeyService);t=l.localize(1698,`{0}
|
||
[{1}] {2}`,t,ky.modifierLabels[l.OS].altKey,n)}return t}updateClass(){this.options.icon&&(this._commandAction!==this._menuItemAction?this._menuItemAction.alt&&this._updateItemClass(this._menuItemAction.alt.item):this._updateItemClass(this._menuItemAction.item))}_updateItemClass(e){this._itemClassDispose.value=void 0;const{element:t,label:i}=this;if(!t||!i)return;const n=this._commandAction.checked&&mq(e.toggled)&&e.toggled.icon?e.toggled.icon:e.icon;if(n)if(_.ThemeIcon.isThemeIcon(n)){const s=_.ThemeIcon.asClassNameArray(n);i.classList.add(...s),this._itemClassDispose.value=l.toDisposable(()=>{i.classList.remove(...s)})}else i.style.backgroundImage=rr(this._themeService.getColorTheme().type)?Bs(n.dark):Bs(n.light),i.classList.add("icon"),this._itemClassDispose.value=l.combinedDisposable(l.toDisposable(()=>{i.style.backgroundImage="",i.classList.remove("icon")}),this._themeService.onDidColorThemeChange(()=>{this.updateClass()}))}},_.MenuEntryActionViewItem=Kp([Si(2,xt),Si(3,yn),Si(4,be),Si(5,_i),Si(6,nn),Si(7,Ui)],_.MenuEntryActionViewItem);class Vy extends _.MenuEntryActionViewItem{render(e){this.options.label=!0,this.options.icon=!1,super.render(e),e.classList.add("text-only"),e.classList.toggle("use-comma",this._options?.useComma??!1)}updateLabel(){const e=this._keybindingService.lookupKeybinding(this._action.id,this._contextKeyService);if(!e)return super.updateLabel();if(this.label){const t=Vy._symbolPrintEnter(e);this._options?.conversational?this.label.textContent=l.localize(1699,"{1} to {0}",this._action.label,t):this.label.textContent=l.localize(1700,"{0} ({1})",this._action.label,t)}}static _symbolPrintEnter(e){return e.getLabel()?.replace(/\benter\b/gi,"⏎").replace(/\bEscape\b/gi,"Esc")}}let Uy=class extends Bp{constructor(e,t,i,n,s){const r={...t,menuAsChild:t?.menuAsChild??!1,classNames:t?.classNames??(_.ThemeIcon.isThemeIcon(e.item.icon)?_.ThemeIcon.asClassName(e.item.icon):void 0),keybindingProvider:t?.keybindingProvider??(a=>i.lookupKeybinding(a.id))};super(e,{getActions:()=>e.actions},n,r),this._keybindingService=i,this._contextMenuService=n,this._themeService=s}render(e){super.render(e),l.assertType(this.element),e.classList.add("menu-entry");const t=this._action,{icon:i}=t.item;if(i&&!_.ThemeIcon.isThemeIcon(i)){this.element.classList.add("icon");const n=()=>{this.element&&(this.element.style.backgroundImage=rr(this._themeService.getColorTheme().type)?Bs(i.dark):Bs(i.light))};n(),this._register(this._themeService.onDidColorThemeChange(()=>{n()}))}}};Uy=Kp([Si(2,xt),Si(3,nn),Si(4,_i)],Uy);let $y=class extends Vn{constructor(e,t,i,n,s,r,a,c){super(null,e),this._keybindingService=i,this._notificationService=n,this._contextMenuService=s,this._menuService=r,this._instaService=a,this._storageService=c,this._defaultActionDisposables=this._register(new l.DisposableStore),this._container=null,this._primaryActionListener=this._register(new l.MutableDisposable),this._options=t,this._storageKey=`${e.item.submenu.id}_lastActionId`;let h;const d=t?.togglePrimaryAction?c.get(this._storageKey,1):void 0;d&&(h=e.actions.find(f=>d===f.id)),h||(h=e.actions[0]),this._defaultAction=this._defaultActionDisposables.add(this._instaService.createInstance(_.MenuEntryActionViewItem,h,{keybinding:this._getDefaultActionKeybindingLabel(h),hoverDelegate:t?.hoverDelegate}));const u={keybindingProvider:f=>this._keybindingService.lookupKeybinding(f.id),...t,menuAsChild:t?.menuAsChild??!0,classNames:t?.classNames??["codicon","codicon-chevron-down"],actionRunner:t?.actionRunner??this._register(new Jr)};this._dropdown=this._register(new Bp(e,e.actions,this._contextMenuService,u)),t?.togglePrimaryAction&&this.registerTogglePrimaryActionListener()}registerTogglePrimaryActionListener(){this._primaryActionListener.value=this._dropdown.actionRunner.onDidRun(e=>{e.action instanceof _.MenuItemAction&&this.update(e.action)})}update(e){this._options?.togglePrimaryAction&&this._storageService.store(this._storageKey,e.id,1,1),this._defaultActionDisposables.clear(),this._defaultAction=this._defaultActionDisposables.add(this._instaService.createInstance(_.MenuEntryActionViewItem,e,{keybinding:this._getDefaultActionKeybindingLabel(e),hoverDelegate:this._options?.hoverDelegate})),this._defaultAction.actionRunner=this._defaultActionDisposables.add(new class extends Jr{async runAction(t,i){await t.run(void 0)}}),this._container&&this._defaultAction.render(Xf(this._container,Q(".action-container")))}_getDefaultActionKeybindingLabel(e){let t;if(this._options?.renderKeybindingWithDefaultActionLabel){const i=this._keybindingService.lookupKeybinding(e.id);i&&(t=`(${i.getLabel()})`)}return t}setActionContext(e){super.setActionContext(e),this._defaultAction.setActionContext(e),this._dropdown.setActionContext(e)}set actionRunner(e){super.actionRunner=e,this._defaultAction.actionRunner=e,this._options?.togglePrimaryAction||(this._dropdown.actionRunner=e),this._primaryActionListener.value&&this.registerTogglePrimaryActionListener()}get actionRunner(){return super.actionRunner}render(e){this._container=e,super.render(this._container),this._container.classList.add("monaco-dropdown-with-default");const t=Q(".action-container");this._defaultAction.render(K(this._container,t)),this._register(R(t,F.KEY_DOWN,n=>{const s=new Be(n);s.equals(17)&&(this._defaultAction.element.tabIndex=-1,this._dropdown.focus(),s.stopPropagation())}));const i=Q(".dropdown-action-container");this._dropdown.render(K(this._container,i)),this._register(R(i,F.KEY_DOWN,n=>{const s=new Be(n);s.equals(15)&&(this._defaultAction.element.tabIndex=0,this._dropdown.setFocusable(!1),this._defaultAction.element?.focus(),s.stopPropagation())}))}focus(e){e?this._dropdown.focus():(this._defaultAction.element.tabIndex=0,this._defaultAction.element.focus())}blur(){this._defaultAction.element.tabIndex=-1,this._dropdown.blur(),this._container.blur()}setFocusable(e){e?this._defaultAction.element.tabIndex=0:(this._defaultAction.element.tabIndex=-1,this._dropdown.setFocusable(!1))}};$y=Kp([Si(2,xt),Si(3,yn),Si(4,nn),Si(5,Zo),Si(6,me),Si(7,Qa)],$y);let Ky=class extends aq{constructor(e,t,i){super(null,e,e.actions.map(n=>n.id===ft.ID?oq:{text:n.label,isDisabled:!n.enabled}),0,t,vq,{ariaLabel:e.tooltip||e.label,optionsAsChildren:!0,useCustomDrawn:!Eq(i)}),this.select(Math.max(0,e.actions.findIndex(n=>n.checked)))}render(e){super.render(e),e.style.borderColor=z(cv)}runAction(e,t){const i=this.action.actions[t];i&&this.actionRunner.run(i)}};Ky=Kp([Si(1,Fc),Si(2,Ge)],Ky);function Gy(o,e,t){return e instanceof _.MenuItemAction?o.createInstance(_.MenuEntryActionViewItem,e,t):e instanceof sa?e.item.isSelection?o.createInstance(Ky,e):e.item.isSplitButton?o.createInstance($y,e,{...t,togglePrimaryAction:typeof e.item.isSplitButton!="boolean"?e.item.isSplitButton.togglePrimaryAction:!1}):o.createInstance(Uy,e,t):void 0}class el extends l.Disposable{get viewItems(){return this._viewItems}get onDidBlur(){return this._onDidBlur.event}get onDidCancel(){return this._onDidCancel.event}get onDidRun(){return this._onDidRun.event}get onWillRun(){return this._onWillRun.event}constructor(e,t={}){super(),this._actionRunnerDisposables=this._register(new l.DisposableStore),this.viewItemDisposables=this._register(new l.DisposableMap),this.triggerKeyDown=!1,this.focusable=!0,this._onDidBlur=this._register(new l.Emitter),this._onDidCancel=this._register(new l.Emitter({onWillAddFirstListener:()=>this.cancelHasListener=!0})),this.cancelHasListener=!1,this._onDidRun=this._register(new l.Emitter),this._onWillRun=this._register(new l.Emitter),this.options=t,this._context=t.context??null,this._orientation=this.options.orientation??0,this._triggerKeys={keyDown:this.options.triggerKeys?.keyDown??!1,keys:this.options.triggerKeys?.keys??[3,10]},this._hoverDelegate=t.hoverDelegate??this._register(sM()),this.options.actionRunner?this._actionRunner=this.options.actionRunner:(this._actionRunner=new Jr,this._actionRunnerDisposables.add(this._actionRunner)),this._actionRunnerDisposables.add(this._actionRunner.onDidRun(s=>this._onDidRun.fire(s))),this._actionRunnerDisposables.add(this._actionRunner.onWillRun(s=>this._onWillRun.fire(s))),this._viewItems=[],this.focusedItem=void 0,this.domNode=document.createElement("div"),this.domNode.className="monaco-action-bar";let i,n;switch(this._orientation){case 0:i=[15],n=[17];break;case 1:i=[16],n=[18],this.domNode.className+=" vertical";break}this._register(R(this.domNode,F.KEY_DOWN,s=>{const r=new Be(s);let a=!0;const c=typeof this.focusedItem=="number"?this.viewItems[this.focusedItem]:void 0;i&&(r.equals(i[0])||r.equals(i[1]))?a=this.focusPrevious():n&&(r.equals(n[0])||r.equals(n[1]))?a=this.focusNext():r.equals(9)&&this.cancelHasListener?this._onDidCancel.fire():r.equals(14)?a=this.focusFirst():r.equals(13)?a=this.focusLast():r.equals(2)&&c instanceof Vn&&c.trapsArrowNavigation?a=this.focusNext(void 0,!0):this.isTriggerKeyEvent(r)?this._triggerKeys.keyDown?this.doTrigger(r):this.triggerKeyDown=!0:a=!1,a&&(r.preventDefault(),r.stopPropagation())})),this._register(R(this.domNode,F.KEY_UP,s=>{const r=new Be(s);this.isTriggerKeyEvent(r)?(!this._triggerKeys.keyDown&&this.triggerKeyDown&&(this.triggerKeyDown=!1,this.doTrigger(r)),r.preventDefault(),r.stopPropagation()):(r.equals(2)||r.equals(1026)||r.equals(16)||r.equals(18)||r.equals(15)||r.equals(17))&&this.updateFocusedItem()})),this.focusTracker=this._register(Xr(this.domNode)),this._register(this.focusTracker.onDidBlur(()=>{(wt()===this.domNode||!ut(wt(),this.domNode))&&(this._onDidBlur.fire(),this.previouslyFocusedItem=this.focusedItem,this.focusedItem=void 0,this.triggerKeyDown=!1)})),this._register(this.focusTracker.onDidFocus(()=>this.updateFocusedItem())),this.actionsList=document.createElement("ul"),this.actionsList.className="actions-container",this.options.highlightToggledItems&&this.actionsList.classList.add("highlight-toggled"),this.actionsList.setAttribute("role",this.options.ariaRole||"toolbar"),this.options.ariaLabel&&this.actionsList.setAttribute("aria-label",this.options.ariaLabel),this.domNode.appendChild(this.actionsList),e.appendChild(this.domNode)}refreshRole(){this.length()>=1?this.actionsList.setAttribute("role",this.options.ariaRole||"toolbar"):this.actionsList.setAttribute("role","presentation")}setFocusable(e){if(this.focusable=e,this.focusable){const t=this.viewItems.find(i=>i instanceof Vn&&i.isEnabled());t instanceof Vn&&t.setFocusable(!0)}else this.viewItems.forEach(t=>{t instanceof Vn&&t.setFocusable(!1)})}isTriggerKeyEvent(e){let t=!1;return this._triggerKeys.keys.forEach(i=>{t=t||e.equals(i)}),t}updateFocusedItem(){for(let e=0;e<this.actionsList.children.length;e++){const t=this.actionsList.children[e];if(ut(wt(),t)){this.focusedItem=e,this.viewItems[this.focusedItem]?.showHover?.();break}}}get context(){return this._context}set context(e){this._context=e,this.viewItems.forEach(t=>t.setActionContext(e))}get actionRunner(){return this._actionRunner}set actionRunner(e){this._actionRunner=e,this._actionRunnerDisposables.clear(),this._actionRunnerDisposables.add(this._actionRunner.onDidRun(t=>this._onDidRun.fire(t))),this._actionRunnerDisposables.add(this._actionRunner.onWillRun(t=>this._onWillRun.fire(t))),this.viewItems.forEach(t=>t.actionRunner=e)}getContainer(){return this.domNode}hasAction(e){return this.viewItems.findIndex(t=>t.action.id===e.id)!==-1}getAction(e){if(typeof e=="number")return this.viewItems[e]?.action;if(Ve(e)){for(;e.parentElement!==this.actionsList;){if(!e.parentElement)return;e=e.parentElement}for(let t=0;t<this.actionsList.childNodes.length;t++)if(this.actionsList.childNodes[t]===e)return this.viewItems[t].action}}push(e,t={}){const i=Array.isArray(e)?e:[e];let n=l.isNumber(t.index)?t.index:null;if(i.forEach(s=>{const r=document.createElement("li");r.className="action-item",r.setAttribute("role","presentation");let a;const c={hoverDelegate:this._hoverDelegate,...t,isTabList:this.options.ariaRole==="tablist"};this.options.actionViewItemProvider&&(a=this.options.actionViewItemProvider(s,c)),a||(a=new Fp(this.context,s,c)),this.options.allowContextMenu||this.viewItemDisposables.set(a,R(r,F.CONTEXT_MENU,h=>{ve.stop(h,!0)})),a.actionRunner=this._actionRunner,a.setActionContext(this.context),a.render(r),n===null||n<0||n>=this.actionsList.children.length?(this.actionsList.appendChild(r),this._viewItems.push(a)):(this.actionsList.insertBefore(r,this.actionsList.children[n]),this._viewItems.splice(n,0,a),n++)}),this.focusable){let s=!1;for(const r of this.viewItems){if(!(r instanceof Vn))continue;let a;s||r.action.id===ft.ID||!r.isEnabled()&&this.options.focusOnlyEnabledItems?a=!1:a=!0,a?(r.setFocusable(!0),s=!0):r.setFocusable(!1)}}typeof this.focusedItem=="number"&&this.focus(this.focusedItem),this.refreshRole()}getWidth(e){return this.actionsList.children.item(e)?.clientWidth??0}pull(e){e>=0&&e<this.viewItems.length&&(this.actionsList.childNodes[e].remove(),this.viewItemDisposables.deleteAndDispose(this.viewItems[e]),l.dispose(this._viewItems.splice(e,1)),this.refreshRole())}clear(){this.isEmpty()||(this._viewItems=l.dispose(this._viewItems),this.viewItemDisposables.clearAndDisposeAll(),On(this.actionsList),this.refreshRole())}length(){return this.viewItems.length}isEmpty(){return this.viewItems.length===0}focus(e){let t=!1,i;if(e===void 0?t=!0:typeof e=="number"?i=e:typeof e=="boolean"&&(t=e),t&&typeof this.focusedItem>"u"){const n=this.viewItems.findIndex(s=>s.isEnabled());this.focusedItem=n===-1?void 0:n,this.updateFocus(void 0,void 0,!0)}else i!==void 0&&(this.focusedItem=i),this.updateFocus(void 0,void 0,!0)}focusFirst(){return this.focusedItem=this.length()-1,this.focusNext(!0)}focusLast(){return this.focusedItem=0,this.focusPrevious(!0)}focusNext(e,t){if(typeof this.focusedItem>"u")this.focusedItem=this.viewItems.length-1;else if(this.viewItems.length<=1)return!1;const i=this.focusedItem;let n;do{if(!e&&this.options.preventLoopNavigation&&this.focusedItem+1>=this.viewItems.length)return this.focusedItem=i,!1;this.focusedItem=(this.focusedItem+1)%this.viewItems.length,n=this.viewItems[this.focusedItem]}while(this.focusedItem!==i&&(this.options.focusOnlyEnabledItems&&!n.isEnabled()||n.action.id===ft.ID));return this.updateFocus(void 0,void 0,t),!0}focusPrevious(e){if(typeof this.focusedItem>"u")this.focusedItem=0;else if(this.viewItems.length<=1)return!1;const t=this.focusedItem;let i;do{if(this.focusedItem=this.focusedItem-1,this.focusedItem<0){if(!e&&this.options.preventLoopNavigation)return this.focusedItem=t,!1;this.focusedItem=this.viewItems.length-1}i=this.viewItems[this.focusedItem]}while(this.focusedItem!==t&&(this.options.focusOnlyEnabledItems&&!i.isEnabled()||i.action.id===ft.ID));return this.updateFocus(!0),!0}updateFocus(e,t,i=!1){typeof this.focusedItem>"u"&&this.actionsList.focus({preventScroll:t}),this.previouslyFocusedItem!==void 0&&this.previouslyFocusedItem!==this.focusedItem&&this.viewItems[this.previouslyFocusedItem]?.blur();const n=this.focusedItem!==void 0?this.viewItems[this.focusedItem]:void 0;if(n){let s=!0;l.isFunction(n.focus)||(s=!1),this.options.focusOnlyEnabledItems&&l.isFunction(n.isEnabled)&&!n.isEnabled()&&(s=!1),n.action.id===ft.ID&&(s=!1),s?(i||this.previouslyFocusedItem!==this.focusedItem)&&(n.focus(e),this.previouslyFocusedItem=this.focusedItem):(this.actionsList.focus({preventScroll:t}),this.previouslyFocusedItem=void 0),s&&n.showHover?.()}}doTrigger(e){if(typeof this.focusedItem>"u")return;const t=this.viewItems[this.focusedItem];if(t instanceof Vn){const i=t._context===null||t._context===void 0?e:t._context;this.run(t._action,i)}}async run(e,t){await this._actionRunner.run(e,t)}dispose(){this._context=void 0,this._viewItems=l.dispose(this._viewItems),this.getContainer().remove(),super.dispose()}}const jy=/\(&([^\s&])\)|(^|[^&])&([^\s&])/,qy=/(&)?(&)([^\s&])/g;var Gp;(function(o){o[o.Right=0]="Right",o[o.Left=1]="Left"})(Gp||(Gp={}));var Yy;(function(o){o[o.Above=0]="Above",o[o.Below=1]="Below"})(Yy||(Yy={}));class th extends el{constructor(e,t,i,n){e.classList.add("monaco-menu-container"),e.setAttribute("role","presentation");const s=document.createElement("div");s.classList.add("monaco-menu"),s.setAttribute("role","presentation"),super(s,{orientation:1,actionViewItemProvider:h=>this.doGetActionViewItem(h,i,r),context:i.context,actionRunner:i.actionRunner,ariaLabel:i.ariaLabel,ariaRole:"menu",focusOnlyEnabledItems:!0,triggerKeys:{keys:[3,...l.isMacintosh||l.isLinux?[10]:[]],keyDown:!0}}),this.menuStyles=n,this.menuElement=s,this.actionsList.tabIndex=0,this.initializeOrUpdateStyleSheet(e,n),this._register(li.addTarget(s)),this._register(R(s,F.KEY_DOWN,h=>{new Be(h).equals(2)&&h.preventDefault()})),i.enableMnemonics&&this._register(R(s,F.KEY_DOWN,h=>{const d=h.key.toLocaleLowerCase(),u=this.mnemonics.get(d);if(u!==void 0&&(ve.stop(h,!0),u.length===1&&(u[0]instanceof yM&&u[0].container&&this.focusItemByElement(u[0].container),u[0].onClick(h)),u.length>1)){const f=u.shift();f&&f.container&&(this.focusItemByElement(f.container),u.push(f)),this.mnemonics.set(d,u)}})),l.isLinux&&this._register(R(s,F.KEY_DOWN,h=>{const d=new Be(h);d.equals(14)||d.equals(11)?(this.focusedItem=this.viewItems.length-1,this.focusNext(),ve.stop(h,!0)):(d.equals(13)||d.equals(12))&&(this.focusedItem=0,this.focusPrevious(),ve.stop(h,!0))})),this._register(R(this.domNode,F.MOUSE_OUT,h=>{const d=h.relatedTarget;ut(d,this.domNode)||(this.focusedItem=void 0,this.updateFocus(),h.stopPropagation())})),this._register(R(this.actionsList,F.MOUSE_OVER,h=>{let d=h.target;if(!(!d||!ut(d,this.actionsList)||d===this.actionsList)){for(;d.parentElement!==this.actionsList&&d.parentElement!==null;)d=d.parentElement;if(d.classList.contains("action-item")){const u=this.focusedItem;this.setFocusedItem(d),u!==this.focusedItem&&this.updateFocus()}}})),this._register(li.addTarget(this.actionsList)),this._register(R(this.actionsList,_.EventType$1.Tap,h=>{let d=h.initialTarget;if(!(!d||!ut(d,this.actionsList)||d===this.actionsList)){for(;d.parentElement!==this.actionsList&&d.parentElement!==null;)d=d.parentElement;if(d.classList.contains("action-item")){const u=this.focusedItem;this.setFocusedItem(d),u!==this.focusedItem&&this.updateFocus()}}}));const r={parent:this};this.mnemonics=new Map,this.scrollableElement=this._register(new Jg(s,{alwaysConsumeMouseWheel:!0,horizontal:2,vertical:3,verticalScrollbarSize:7,handleMouseWheel:!0,useShadows:!0}));const a=this.scrollableElement.getDomNode();a.style.position="",this.styleScrollElement(a,n),this._register(R(s,_.EventType$1.Change,h=>{ve.stop(h,!0);const d=this.scrollableElement.getScrollPosition().scrollTop;this.scrollableElement.setScrollPosition({scrollTop:d-h.translationY})})),this._register(R(a,F.MOUSE_UP,h=>{h.preventDefault()}));const c=j(e);s.style.maxHeight=`${Math.max(10,c.innerHeight-e.getBoundingClientRect().top-35)}px`,t=t.filter((h,d)=>i.submenuIds?.has(h.id)?(console.warn(`Found submenu cycle: ${h.id}`),!1):!(h instanceof ft&&(d===t.length-1||d===0||t[d-1]instanceof ft))),this.push(t,{icon:!0,label:!0,isMenu:!0}),e.appendChild(this.scrollableElement.getDomNode()),this.scrollableElement.scanDomNode(),this.viewItems.filter(h=>!(h instanceof LM)).forEach((h,d,u)=>{h.updatePositionInSet(d+1,u.length)})}initializeOrUpdateStyleSheet(e,t){this.styleSheet||(Yf(e)?this.styleSheet=bn(e):(th.globalStyleSheet||(th.globalStyleSheet=bn()),this.styleSheet=th.globalStyleSheet)),this.styleSheet.textContent=Oq(t,Yf(e))}styleScrollElement(e,t){const i=t.foregroundColor??"",n=t.backgroundColor??"",s=t.borderColor?`1px solid ${t.borderColor}`:"",r="var(--vscode-cornerRadius-large)";e.style.outline=s,e.style.borderRadius=r,e.style.color=i,e.style.backgroundColor=n}getContainer(){return this.scrollableElement.getDomNode()}get onScroll(){return this.scrollableElement.onScroll}focusItemByElement(e){const t=this.focusedItem;this.setFocusedItem(e),t!==this.focusedItem&&this.updateFocus()}setFocusedItem(e){for(let t=0;t<this.actionsList.children.length;t++){const i=this.actionsList.children[t];if(e===i){this.focusedItem=t;break}}}updateFocus(e){super.updateFocus(e,!0,!0),typeof this.focusedItem<"u"&&this.scrollableElement.setScrollPosition({scrollTop:Math.round(this.menuElement.scrollTop)})}doGetActionViewItem(e,t,i){if(e instanceof ft)return new LM(t.context,e,{icon:!0},this.menuStyles);if(e instanceof cd){const n=new yM(e,e.actions,i,{...t,submenuIds:new Set([...t.submenuIds||[],e.id])},this.menuStyles);if(t.enableMnemonics){const s=n.getMnemonic();if(s&&n.isEnabled()){const r=this.mnemonics.get(s);r!==void 0?r.push(n):this.mnemonics.set(s,[n])}}return n}else{const n=t.getKeyBinding?.(e)?.getLabel(),s={enableMnemonics:t.enableMnemonics,useEventAsContext:t.useEventAsContext,keybinding:n},r=new SM(t.context,e,s,this.menuStyles);if(t.enableMnemonics){const a=r.getMnemonic();if(a&&r.isEnabled()){const c=this.mnemonics.get(a);c!==void 0?c.push(r):this.mnemonics.set(a,[r])}}return r}}}class SM extends Vn{constructor(e,t,i,n){if(i={...i,isMenu:!0,icon:i.icon!==void 0?i.icon:!1,label:i.label!==void 0?i.label:!0},super(t,t,i),this.menuStyle=n,this.options=i,this.cssClass="",this.options.label&&i.enableMnemonics){const s=this.action.label;if(s){const r=jy.exec(s);r&&(this.mnemonic=(r[1]?r[1]:r[3]).toLocaleLowerCase())}}this.runOnceToEnableMouseUp=new l.RunOnceScheduler(()=>{this.element&&(this._register(R(this.element,F.MOUSE_UP,s=>{if(ve.stop(s,!0),di){if(new Bi(j(this.element),s).rightButton)return;this.onClick(s)}else setTimeout(()=>{this.onClick(s)},0)})),this._register(R(this.element,F.CONTEXT_MENU,s=>{ve.stop(s,!0)})))},100),this._register(this.runOnceToEnableMouseUp)}render(e){super.render(e),this.element&&(this.container=e,this.item=K(this.element,Q("a.action-menu-item")),this._action.id===ft.ID?this.item.setAttribute("role","presentation"):(this.item.setAttribute("role","menuitem"),this.mnemonic&&this.item.setAttribute("aria-keyshortcuts",`${this.mnemonic}`)),this.check=K(this.item,Q("span.menu-item-check"+_.ThemeIcon.asCSSSelector(l.Codicon.menuSelection))),this.check.setAttribute("role","none"),this.label=K(this.item,Q("span.action-label")),this.options.label&&this.options.keybinding&&(K(this.item,Q("span.keybinding")).textContent=this.options.keybinding),this.runOnceToEnableMouseUp.schedule(),this.updateClass(),this.updateLabel(),this.updateTooltip(),this.updateEnabled(),this.updateChecked(),this.applyStyle())}blur(){super.blur(),this.applyStyle()}focus(){super.focus(),this.item?.focus(),this.applyStyle()}updatePositionInSet(e,t){this.item&&(this.item.setAttribute("aria-posinset",`${e}`),this.item.setAttribute("aria-setsize",`${t}`))}updateLabel(){if(this.label&&this.options.label){On(this.label);let e=sp(this.action.label);if(e){const t=Aq(e);this.options.enableMnemonics||(e=t),this.label.setAttribute("aria-label",t.replace(/&&/g,"&"));const i=jy.exec(e);if(i){e=l.escape(e),qy.lastIndex=0;let n=qy.exec(e);for(;n&&n[1];)n=qy.exec(e);const s=r=>r.replace(/&&/g,"&");n?this.label.append(l.ltrim(s(e.substr(0,n.index))," "),Q("u",{"aria-hidden":"true"},n[3]),l.rtrim(s(e.substr(n.index+n[0].length))," ")):this.label.textContent=s(e).trim(),this.item?.setAttribute("aria-keyshortcuts",(i[1]?i[1]:i[3]).toLocaleLowerCase())}else this.label.textContent=e.replace(/&&/g,"&").trim()}}}updateTooltip(){}updateClass(){this.cssClass&&this.item&&this.item.classList.remove(...this.cssClass.split(" ")),this.options.icon&&this.label?(this.cssClass=this.action.class||"",this.label.classList.add("icon"),this.cssClass&&this.label.classList.add(...this.cssClass.split(" ")),this.updateEnabled()):this.label&&this.label.classList.remove("icon")}updateEnabled(){this.action.enabled?(this.element&&(this.element.classList.remove("disabled"),this.element.removeAttribute("aria-disabled")),this.item&&(this.item.classList.remove("disabled"),this.item.removeAttribute("aria-disabled"),this.item.tabIndex=0)):(this.element&&(this.element.classList.add("disabled"),this.element.setAttribute("aria-disabled","true")),this.item&&(this.item.classList.add("disabled"),this.item.setAttribute("aria-disabled","true")))}updateChecked(){if(!this.item)return;const e=this.action.checked;this.item.classList.toggle("checked",!!e),e!==void 0?(this.item.setAttribute("role","menuitemcheckbox"),this.item.setAttribute("aria-checked",e?"true":"false")):(this.item.setAttribute("role","menuitem"),this.item.setAttribute("aria-checked",""))}getMnemonic(){return this.mnemonic}applyStyle(){const e=this.element&&this.element.classList.contains("focused"),t=e&&this.menuStyle.selectionForegroundColor?this.menuStyle.selectionForegroundColor:this.menuStyle.foregroundColor,i=e&&this.menuStyle.selectionBackgroundColor?this.menuStyle.selectionBackgroundColor:void 0,n=e&&this.menuStyle.selectionBorderColor?`1px solid ${this.menuStyle.selectionBorderColor}`:"",s=e&&this.menuStyle.selectionBorderColor?"-1px":"";this.item&&(this.item.style.color=t??"",this.item.style.backgroundColor=i??"",this.item.style.outline=n,this.item.style.outlineOffset=s),this.check&&(this.check.style.color=t??"")}}class yM extends SM{constructor(e,t,i,n,s){super(e,e,n,s),this.submenuActions=t,this.parentData=i,this.submenuOptions=n,this.mysubmenu=null,this.submenuDisposables=this._register(new l.DisposableStore),this.mouseOver=!1,this.expandDirection=n&&n.expandDirection!==void 0?n.expandDirection:{horizontal:Gp.Right,vertical:Yy.Below},this.showScheduler=new l.RunOnceScheduler(()=>{this.mouseOver&&(this.cleanupExistingSubmenu(!1),this.createSubmenu(!1))},250),this.hideScheduler=new l.RunOnceScheduler(()=>{this.element&&!ut(wt(),this.element)&&this.parentData.submenu===this.mysubmenu&&(this.parentData.parent.focus(!1),this.cleanupExistingSubmenu(!0))},750)}render(e){super.render(e),this.element&&(this.item&&(this.item.classList.add("monaco-submenu-item"),this.item.tabIndex=0,this.item.setAttribute("aria-haspopup","true"),this.updateAriaExpanded("false"),this.submenuIndicator=K(this.item,Q("span.submenu-indicator"+_.ThemeIcon.asCSSSelector(l.Codicon.menuSubmenu))),this.submenuIndicator.setAttribute("aria-hidden","true")),this._register(R(this.element,F.KEY_UP,t=>{const i=new Be(t);(i.equals(17)||i.equals(3))&&(ve.stop(t,!0),this.createSubmenu(!0))})),this._register(R(this.element,F.KEY_DOWN,t=>{const i=new Be(t);wt()===this.item&&(i.equals(17)||i.equals(3))&&ve.stop(t,!0)})),this._register(R(this.element,F.MOUSE_OVER,t=>{this.mouseOver||(this.mouseOver=!0,this.showScheduler.schedule())})),this._register(R(this.element,F.MOUSE_LEAVE,t=>{this.mouseOver=!1})),this._register(R(this.element,F.FOCUS_OUT,t=>{this.element&&!ut(wt(),this.element)&&this.hideScheduler.schedule()})),this._register(this.parentData.parent.onScroll(()=>{this.parentData.submenu===this.mysubmenu&&(this.parentData.parent.focus(!1),this.cleanupExistingSubmenu(!0))})))}updateEnabled(){}onClick(e){ve.stop(e,!0),this.cleanupExistingSubmenu(!1),this.createSubmenu(!0)}cleanupExistingSubmenu(e){if(this.parentData.submenu&&(e||this.parentData.submenu!==this.mysubmenu)){try{this.parentData.submenu.dispose()}catch{}this.parentData.submenu=void 0,this.updateAriaExpanded("false"),this.submenuContainer&&(this.submenuDisposables.clear(),this.submenuContainer=void 0)}}calculateSubmenuMenuLayout(e,t,i,n){const s={top:0,left:0};return s.left=jc(e.width,t.width,{position:n.horizontal===Gp.Right?0:1,offset:i.left,size:i.width}).position,s.left>=i.left&&s.left<i.left+i.width&&(i.left+10+t.width<=e.width&&(s.left=i.left+10),i.top+=10,i.height=0),s.top=jc(e.height,t.height,{position:0,offset:i.top,size:0}).position,s.top+t.height===i.top&&s.top+i.height+t.height<=e.height&&(s.top+=i.height),s}createSubmenu(e=!0){if(this.element)if(this.parentData.submenu)this.parentData.submenu.focus(!1);else{this.updateAriaExpanded("true"),this.submenuContainer=K(this.element,Q("div.monaco-submenu")),this.submenuContainer.classList.add("menubar-menu-items-holder","context-view");const t=j(this.parentData.parent.domNode).getComputedStyle(this.parentData.parent.domNode),i=parseFloat(t.paddingTop||"0")||0;this.submenuContainer.style.position="fixed",this.submenuContainer.style.top="0",this.submenuContainer.style.left="0",this.submenuContainer.style.zIndex="1",this.parentData.submenu=new th(this.submenuContainer,this.submenuActions.length?this.submenuActions:[new dC],this.submenuOptions,this.menuStyle);const n=this.element.getBoundingClientRect(),s={top:n.top-i,left:n.left,height:n.height+2*i,width:n.width},r=this.submenuContainer.getBoundingClientRect(),a=j(this.element),{top:c,left:h}=this.calculateSubmenuMenuLayout(new cs(a.innerWidth,a.innerHeight),cs.lift(r),s,this.expandDirection);this.submenuContainer.style.left=`${h-r.left}px`,this.submenuContainer.style.top=`${c-r.top}px`,this.submenuDisposables.add(R(this.submenuContainer,F.KEY_UP,d=>{new Be(d).equals(15)&&(ve.stop(d,!0),this.parentData.parent.focus(),this.cleanupExistingSubmenu(!0))})),this.submenuDisposables.add(R(this.submenuContainer,F.KEY_DOWN,d=>{new Be(d).equals(15)&&ve.stop(d,!0)})),this.submenuDisposables.add(this.parentData.submenu.onDidCancel(()=>{this.parentData.parent.focus(),this.cleanupExistingSubmenu(!0)})),this.parentData.submenu.focus(e),this.mysubmenu=this.parentData.submenu}}updateAriaExpanded(e){this.item&&this.item?.setAttribute("aria-expanded",e)}applyStyle(){super.applyStyle();const t=this.element&&this.element.classList.contains("focused")&&this.menuStyle.selectionForegroundColor?this.menuStyle.selectionForegroundColor:this.menuStyle.foregroundColor;this.submenuIndicator&&(this.submenuIndicator.style.color=t??"")}dispose(){super.dispose(),this.hideScheduler.dispose(),this.mysubmenu&&(this.mysubmenu.dispose(),this.mysubmenu=null),this.submenuContainer&&(this.submenuContainer=void 0)}}class LM extends Fp{constructor(e,t,i,n){super(e,t,i),this.menuStyles=n}render(e){super.render(e),this.label&&(this.label.style.borderBottomColor=this.menuStyles.separatorColor?`${this.menuStyles.separatorColor}`:"")}}function Aq(o){const e=jy,t=e.exec(o);if(!t)return o;const i=!t[1];return o.replace(e,i?"$2$3":"").trim()}function DM(o){const e=l.getCodiconFontCharacters()[o.id];return`.codicon-${o.id}:before { content: '\\${e.toString(16)}'; }`}function Oq(o,e){let i=`
|
||
.monaco-menu {
|
||
font-size: 13px;
|
||
border-radius: var(--vscode-cornerRadius-large);
|
||
border: 1px solid ${o.borderColor??"var(--vscode-menu-border)"};
|
||
min-width: 160px;
|
||
}
|
||
|
||
${DM(l.Codicon.menuSelection)}
|
||
${DM(l.Codicon.menuSubmenu)}
|
||
|
||
.monaco-menu .monaco-action-bar {
|
||
text-align: right;
|
||
overflow: hidden;
|
||
white-space: nowrap;
|
||
}
|
||
|
||
.monaco-menu .monaco-action-bar .actions-container {
|
||
display: flex;
|
||
margin: 0 auto;
|
||
padding: 0;
|
||
width: 100%;
|
||
justify-content: flex-end;
|
||
}
|
||
|
||
.monaco-menu .monaco-action-bar.vertical .actions-container {
|
||
display: inline-block;
|
||
}
|
||
|
||
.monaco-menu .monaco-action-bar.reverse .actions-container {
|
||
flex-direction: row-reverse;
|
||
}
|
||
|
||
.monaco-menu .monaco-action-bar .action-item {
|
||
cursor: pointer;
|
||
display: inline-block;
|
||
transition: transform 50ms ease;
|
||
position: relative; /* DO NOT REMOVE - this is the key to preventing the ghosting icon bug in Chrome 42 */
|
||
}
|
||
|
||
.monaco-menu .monaco-action-bar .action-item.disabled {
|
||
cursor: default;
|
||
}
|
||
|
||
.monaco-menu .monaco-action-bar .action-item .icon,
|
||
.monaco-menu .monaco-action-bar .action-item .codicon {
|
||
display: inline-block;
|
||
}
|
||
|
||
.monaco-menu .monaco-action-bar .action-item .codicon {
|
||
display: flex;
|
||
align-items: center;
|
||
}
|
||
|
||
.monaco-menu .monaco-action-bar .action-label {
|
||
font-size: 11px;
|
||
margin-right: 4px;
|
||
}
|
||
|
||
.monaco-menu .monaco-action-bar .action-item.disabled .action-label,
|
||
.monaco-menu .monaco-action-bar .action-item.disabled .action-label:hover {
|
||
color: var(--vscode-disabledForeground);
|
||
}
|
||
|
||
/* Vertical actions */
|
||
|
||
.monaco-menu .monaco-action-bar.vertical {
|
||
text-align: left;
|
||
}
|
||
|
||
.monaco-menu .monaco-action-bar.vertical .action-item {
|
||
display: block;
|
||
}
|
||
|
||
.monaco-menu .monaco-action-bar.vertical .action-label.separator {
|
||
display: block;
|
||
border-bottom: 1px solid var(--vscode-menu-separatorBackground);
|
||
padding-top: 1px;
|
||
padding: 30px;
|
||
}
|
||
|
||
.monaco-menu .secondary-actions .monaco-action-bar .action-label {
|
||
margin-left: 6px;
|
||
}
|
||
|
||
/* Action Items */
|
||
.monaco-menu .monaco-action-bar .action-item.select-container {
|
||
overflow: hidden; /* somehow the dropdown overflows its container, we prevent it here to not push */
|
||
flex: 1;
|
||
max-width: 170px;
|
||
min-width: 60px;
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: center;
|
||
margin-right: 10px;
|
||
}
|
||
|
||
.monaco-menu .monaco-action-bar.vertical {
|
||
margin-left: 0;
|
||
overflow: visible;
|
||
}
|
||
|
||
.monaco-menu .monaco-action-bar.vertical .actions-container {
|
||
display: block;
|
||
}
|
||
|
||
.monaco-menu .monaco-action-bar.vertical .action-item {
|
||
padding: 0;
|
||
transform: none;
|
||
display: flex;
|
||
}
|
||
|
||
.monaco-menu .monaco-action-bar.vertical .action-item.active {
|
||
transform: none;
|
||
}
|
||
|
||
.monaco-menu .monaco-action-bar.vertical .action-menu-item {
|
||
flex: 1 1 auto;
|
||
display: flex;
|
||
height: 24px;
|
||
align-items: center;
|
||
position: relative;
|
||
margin: 0 4px;
|
||
border-radius: var(--vscode-cornerRadius-medium);
|
||
}
|
||
|
||
.monaco-menu .monaco-action-bar.vertical .action-menu-item:hover .keybinding,
|
||
.monaco-menu .monaco-action-bar.vertical .action-menu-item:focus .keybinding {
|
||
opacity: unset;
|
||
}
|
||
|
||
.monaco-menu .monaco-action-bar.vertical .action-label {
|
||
flex: 1 1 auto;
|
||
text-decoration: none;
|
||
padding: 0 1em;
|
||
background: none;
|
||
font-size: 12px;
|
||
line-height: 1;
|
||
}
|
||
|
||
.monaco-menu .monaco-action-bar.vertical .keybinding,
|
||
.monaco-menu .monaco-action-bar.vertical .submenu-indicator {
|
||
display: inline-block;
|
||
flex: 2 1 auto;
|
||
padding: 0 1em;
|
||
text-align: right;
|
||
font-size: 12px;
|
||
line-height: 1;
|
||
opacity: 0.7;
|
||
}
|
||
|
||
.monaco-menu .monaco-action-bar.vertical .submenu-indicator {
|
||
height: 100%;
|
||
}
|
||
|
||
.monaco-menu .monaco-action-bar.vertical .submenu-indicator.codicon {
|
||
font-size: 16px !important;
|
||
display: flex;
|
||
align-items: center;
|
||
}
|
||
|
||
.monaco-menu .monaco-action-bar.vertical .submenu-indicator.codicon::before {
|
||
margin-left: auto;
|
||
margin-right: -20px;
|
||
}
|
||
|
||
.monaco-menu .monaco-action-bar.vertical .action-item.disabled .keybinding,
|
||
.monaco-menu .monaco-action-bar.vertical .action-item.disabled .submenu-indicator {
|
||
opacity: 0.4;
|
||
}
|
||
|
||
.monaco-menu .monaco-action-bar.vertical .action-label:not(.separator) {
|
||
display: inline-block;
|
||
box-sizing: border-box;
|
||
margin: 0;
|
||
}
|
||
|
||
.monaco-menu .monaco-action-bar.vertical .action-item {
|
||
position: static;
|
||
overflow: visible;
|
||
}
|
||
|
||
.monaco-menu .monaco-action-bar.vertical .action-item .monaco-submenu {
|
||
position: absolute;
|
||
}
|
||
|
||
.monaco-menu .monaco-action-bar.vertical .action-label.separator {
|
||
width: 100%;
|
||
height: 0px !important;
|
||
opacity: 1;
|
||
}
|
||
|
||
.monaco-menu .monaco-action-bar.vertical .action-label.separator.text {
|
||
padding: 0.7em 1em 0.1em 1em;
|
||
font-weight: bold;
|
||
opacity: 1;
|
||
}
|
||
|
||
.monaco-menu .monaco-action-bar.vertical .action-label:hover {
|
||
color: inherit;
|
||
}
|
||
|
||
.monaco-menu .monaco-action-bar.vertical .menu-item-check {
|
||
position: absolute;
|
||
visibility: hidden;
|
||
width: 1em;
|
||
height: 100%;
|
||
}
|
||
|
||
.monaco-menu .monaco-action-bar.vertical .action-menu-item.checked .menu-item-check {
|
||
visibility: visible;
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: center;
|
||
}
|
||
|
||
/* Context Menu */
|
||
|
||
.context-view.monaco-menu-container {
|
||
outline: 0;
|
||
border: none;
|
||
animation: fadeIn 0.083s linear;
|
||
-webkit-app-region: no-drag;
|
||
box-shadow: var(--vscode-shadow-lg${o.shadowColor?`, 0 0 12px ${o.shadowColor}`:""});
|
||
border-radius: var(--vscode-cornerRadius-large);
|
||
overflow: hidden;
|
||
}
|
||
|
||
.context-view.monaco-menu-container :focus,
|
||
.context-view.monaco-menu-container .monaco-action-bar.vertical:focus,
|
||
.context-view.monaco-menu-container .monaco-action-bar.vertical :focus {
|
||
outline: 0;
|
||
}
|
||
|
||
.hc-black .context-view.monaco-menu-container,
|
||
.hc-light .context-view.monaco-menu-container,
|
||
:host-context(.hc-black) .context-view.monaco-menu-container,
|
||
:host-context(.hc-light) .context-view.monaco-menu-container {
|
||
box-shadow: none;
|
||
}
|
||
|
||
.hc-black .monaco-menu .monaco-action-bar.vertical .action-item.focused,
|
||
.hc-light .monaco-menu .monaco-action-bar.vertical .action-item.focused,
|
||
:host-context(.hc-black) .monaco-menu .monaco-action-bar.vertical .action-item.focused,
|
||
:host-context(.hc-light) .monaco-menu .monaco-action-bar.vertical .action-item.focused {
|
||
background: none;
|
||
}
|
||
|
||
/* Show the menu item selection border only for keyboard navigation. Pointer-driven focus typically does not set :focus-visible, so suppress the border in that case. */
|
||
.monaco-menu .monaco-action-bar.vertical .action-menu-item:focus:not(:focus-visible) {
|
||
outline: none !important;
|
||
outline-offset: 0 !important;
|
||
}
|
||
|
||
/* High contrast themes always show the selection border to indicate the focused item, regardless of input modality. The duplicated .monaco-menu raises specificity above the keyboard-only suppression rule above so this wins independent of declaration order. */
|
||
.hc-black .monaco-menu.monaco-menu .monaco-action-bar.vertical .action-item.focused .action-menu-item,
|
||
.hc-light .monaco-menu.monaco-menu .monaco-action-bar.vertical .action-item.focused .action-menu-item,
|
||
:host-context(.hc-black) .monaco-menu.monaco-menu .monaco-action-bar.vertical .action-item.focused .action-menu-item,
|
||
:host-context(.hc-light) .monaco-menu.monaco-menu .monaco-action-bar.vertical .action-item.focused .action-menu-item {
|
||
outline: 1px solid var(--vscode-menu-selectionBorder) !important;
|
||
outline-offset: -1px !important;
|
||
}
|
||
|
||
/* Vertical Action Bar Styles */
|
||
|
||
.monaco-menu .monaco-action-bar.vertical {
|
||
padding: 4px 0;
|
||
}
|
||
|
||
.monaco-menu .monaco-action-bar.vertical .action-menu-item {
|
||
height: 24px;
|
||
}
|
||
|
||
.monaco-menu .monaco-action-bar.vertical .action-label:not(.separator),
|
||
.monaco-menu .monaco-action-bar.vertical .keybinding {
|
||
font-size: inherit;
|
||
padding: 0 2em;
|
||
max-height: 100%;
|
||
}
|
||
|
||
.monaco-menu .monaco-action-bar.vertical .menu-item-check {
|
||
font-size: inherit;
|
||
width: 2em;
|
||
}
|
||
|
||
.monaco-menu .monaco-action-bar.vertical .action-label.separator {
|
||
font-size: inherit;
|
||
margin: 5px 0 !important;
|
||
padding: 0;
|
||
border-radius: 0;
|
||
}
|
||
|
||
.linux .monaco-menu .monaco-action-bar.vertical .action-label.separator,
|
||
:host-context(.linux) .monaco-menu .monaco-action-bar.vertical .action-label.separator {
|
||
margin-left: 0;
|
||
margin-right: 0;
|
||
}
|
||
|
||
.monaco-menu .monaco-action-bar.vertical .submenu-indicator {
|
||
font-size: 60%;
|
||
padding: 0 1.8em;
|
||
}
|
||
|
||
.linux .monaco-menu .monaco-action-bar.vertical .submenu-indicator,
|
||
:host-context(.linux) .monaco-menu .monaco-action-bar.vertical .submenu-indicator {
|
||
height: 100%;
|
||
mask-size: 10px 10px;
|
||
-webkit-mask-size: 10px 10px;
|
||
}
|
||
|
||
.monaco-menu .action-item {
|
||
cursor: default;
|
||
}`;if(e){i+=`
|
||
/* Arrows */
|
||
.monaco-scrollable-element > .scrollbar > .scra {
|
||
cursor: pointer;
|
||
font-size: 11px !important;
|
||
}
|
||
|
||
.monaco-scrollable-element > .visible {
|
||
opacity: 1;
|
||
|
||
/* Background rule added for IE9 - to allow clicks on dom node */
|
||
background:rgba(0,0,0,0);
|
||
|
||
transition: opacity 100ms linear;
|
||
}
|
||
.monaco-scrollable-element > .invisible {
|
||
opacity: 0;
|
||
pointer-events: none;
|
||
}
|
||
.monaco-scrollable-element > .invisible.fade {
|
||
transition: opacity 800ms linear;
|
||
}
|
||
|
||
/* Scrollable Content Inset Shadow */
|
||
.monaco-scrollable-element > .shadow {
|
||
position: absolute;
|
||
display: none;
|
||
}
|
||
.monaco-scrollable-element > .shadow.top {
|
||
display: block;
|
||
top: 0;
|
||
left: 3px;
|
||
height: 3px;
|
||
width: 100%;
|
||
}
|
||
.monaco-scrollable-element > .shadow.left {
|
||
display: block;
|
||
top: 3px;
|
||
left: 0;
|
||
height: 100%;
|
||
width: 3px;
|
||
}
|
||
.monaco-scrollable-element > .shadow.top-left-corner {
|
||
display: block;
|
||
top: 0;
|
||
left: 0;
|
||
height: 3px;
|
||
width: 3px;
|
||
}
|
||
/* Fix for https://github.com/microsoft/vscode/issues/103170 */
|
||
.monaco-menu .action-item .monaco-submenu {
|
||
z-index: 1;
|
||
}
|
||
`;const n=o.scrollbarShadow;n&&(i+=`
|
||
.monaco-scrollable-element > .shadow.top {
|
||
box-shadow: ${n} 0 6px 6px -6px inset;
|
||
}
|
||
|
||
.monaco-scrollable-element > .shadow.left {
|
||
box-shadow: ${n} 6px 0 6px -6px inset;
|
||
}
|
||
|
||
.monaco-scrollable-element > .shadow.top.left {
|
||
box-shadow: ${n} 6px 6px 6px -6px inset;
|
||
}
|
||
`);const s=o.scrollbarSliderBackground;s&&(i+=`
|
||
.monaco-scrollable-element > .scrollbar > .slider {
|
||
background: ${s};
|
||
}
|
||
`);const r=o.scrollbarSliderHoverBackground;r&&(i+=`
|
||
.monaco-scrollable-element > .scrollbar > .slider:hover {
|
||
background: ${r};
|
||
}
|
||
`);const a=o.scrollbarSliderActiveBackground;a&&(i+=`
|
||
.monaco-scrollable-element > .scrollbar > .slider.active {
|
||
background: ${a};
|
||
}
|
||
`)}return i}class Pq{constructor(e,t,i,n){this.contextViewService=e,this.telemetryService=t,this.notificationService=i,this.keybindingService=n,this.focusToReturn=null,this.lastContainer=null,this.block=null,this.blockDisposable=null,this.options={blockMouse:!0}}configure(e){this.options=e}showContextMenu(e){const t=e.getActions();if(!t.length)return;this.focusToReturn=wt();let i;const n=Ve(e.domForShadowRoot)?e.domForShadowRoot:void 0;this.contextViewService.showContextView({getAnchor:()=>e.getAnchor(),canRelayout:!1,anchorAlignment:e.anchorAlignment,anchorAxisAlignment:e.anchorAxisAlignment,layer:e.layer,render:s=>{this.lastContainer=s;const r=e.getMenuClassName?e.getMenuClassName():"";r&&(s.className+=" "+r),this.options.blockMouse&&(this.block=s.appendChild(Q(".context-view-block")),this.block.style.position="fixed",this.block.style.cursor="initial",this.block.style.left="0",this.block.style.top="0",this.block.style.width="100%",this.block.style.height="100%",this.block.style.zIndex="-1",this.blockDisposable?.dispose(),this.blockDisposable=R(this.block,F.MOUSE_DOWN,d=>d.stopPropagation()));const a=new l.DisposableStore,c=e.actionRunner||a.add(new Jr);c.onWillRun(d=>this.onActionRun(d,!e.skipTelemetry),this,a),c.onDidRun(this.onDidActionRun,this,a),i=new th(s,t,{actionViewItemProvider:e.getActionViewItem,context:e.getActionsContext?e.getActionsContext():null,actionRunner:c,getKeyBinding:e.getKeyBinding?e.getKeyBinding:d=>this.keybindingService.lookupKeybinding(d.id)},wq),i.onDidCancel(()=>this.contextViewService.hideContextView(!0),null,a),i.onDidBlur(()=>this.contextViewService.hideContextView(!0),null,a);const h=j(s);return a.add(R(h,F.BLUR,()=>this.contextViewService.hideContextView(!0))),a.add(R(h,F.MOUSE_DOWN,d=>{if(d.defaultPrevented)return;const u=new Bi(h,d);let f=u.target;if(!u.rightButton){for(;f;){if(f===s)return;f=f.parentElement}this.contextViewService.hideContextView(!0)}})),l.combinedDisposable(a,i)},focus:()=>{i?.focus(!!e.autoSelectFirstItem)},onHide:s=>{e.onHide?.(!!s),this.block&&(this.block.remove(),this.block=null),this.blockDisposable?.dispose(),this.blockDisposable=null,this.lastContainer&&(wt()===this.lastContainer||ut(wt(),this.lastContainer))&&this.focusToReturn?.focus(),this.lastContainer=null}},n,!!n)}onActionRun(e,t){t&&this.telemetryService.publicLog2("workbenchActionExecuted",{id:e.action.id,from:"contextMenu"}),this.contextViewService.hideContextView(!1)}onDidActionRun(e){e.error&&!l.isCancellationError(e.error)&&this.notificationService.error(e.error)}}var kq=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},ih=function(o,e){return function(t,i){e(t,i,o)}};let Zy=class extends l.Disposable{get contextMenuHandler(){return this._contextMenuHandler||(this._contextMenuHandler=new Pq(this.contextViewService,this.telemetryService,this.notificationService,this.keybindingService)),this._contextMenuHandler}constructor(e,t,i,n,s,r){super(),this.telemetryService=e,this.notificationService=t,this.contextViewService=i,this.keybindingService=n,this.menuService=s,this.contextKeyService=r,this._contextMenuHandler=void 0,this._onDidShowContextMenu=this._store.add(new l.Emitter),this.onDidShowContextMenu=this._onDidShowContextMenu.event,this._onDidHideContextMenu=this._store.add(new l.Emitter),this.onDidHideContextMenu=this._onDidHideContextMenu.event}configure(e){this.contextMenuHandler.configure(e)}showContextMenu(e){e=Qy.transform(e,this.menuService,this.contextKeyService),this.contextMenuHandler.showContextMenu({...e,onHide:t=>{e.onHide?.(t),this._onDidHideContextMenu.fire()}}),hs.getInstance().resetKeyStatus(),this._onDidShowContextMenu.fire()}};Zy=kq([ih(0,Xn),ih(1,yn),ih(2,Fc),ih(3,xt),ih(4,Zo),ih(5,be)],Zy);var Qy;(function(o){function e(i){return i&&i.menuId instanceof ct}function t(i,n,s){if(!e(i))return i;const{menuId:r,menuActionOptions:a,contextKeyService:c}=i;return{...i,getActions:()=>{let h=[];if(r){const d=n.getMenuActions(r,c??s,a);h=Nq(d)}return i.getActions?ft.join(i.getActions(),h):h}}}o.transform=t})(Qy||(Qy={}));var Fq=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},Bq=function(o,e){return function(t,i){e(t,i,o)}};let Xy=class extends l.Disposable{constructor(e){super(),this.layoutService=e,this.contextView=this._register(new fp(this.layoutService.mainContainer,1)),this.layout(),this._register(e.onDidLayoutContainer(()=>this.layout()))}showContextView(e,t,i){let n;t?t===this.layoutService.getContainer(j(t))?n=1:i?n=3:n=2:n=1,this.contextView.setContainer(t??this.layoutService.activeContainer,n),this.contextView.show(e);const s={close:()=>{this.openContextView===s&&this.hideContextView()}};return this.openContextView=s,s}layout(){this.contextView.layout()}hideContextView(e){this.contextView.hide(e),this.openContextView=void 0}};Xy=Fq([Bq(0,Os)],Xy);class zq extends Xy{getContextViewElement(){return this.contextView.getViewElement()}}const xM=le("dataChannelService");class Vq{getDataChannel(e){return{sendData:()=>{}}}}const EM=le("defaultAccountService");let Uq=class{constructor(e,t){this.key=e,this.data=t,this.incoming=new Map,this.outgoing=new Map}};class IM{constructor(e){this._hashFn=e,this._nodes=new Map}roots(){const e=[];for(const t of this._nodes.values())t.outgoing.size===0&&e.push(t);return e}insertEdge(e,t){const i=this.lookupOrInsertNode(e),n=this.lookupOrInsertNode(t);i.outgoing.set(n.key,n),n.incoming.set(i.key,i)}removeNode(e){const t=this._hashFn(e);this._nodes.delete(t);for(const i of this._nodes.values())i.outgoing.delete(t),i.incoming.delete(t)}lookupOrInsertNode(e){const t=this._hashFn(e);let i=this._nodes.get(t);return i||(i=new Uq(t,e),this._nodes.set(t,i)),i}isEmpty(){return this._nodes.size===0}toString(){const e=[];for(const[t,i]of this._nodes)e.push(`${t}
|
||
(-> incoming)[${[...i.incoming.keys()].join(", ")}]
|
||
(outgoing ->)[${[...i.outgoing.keys()].join(",")}]
|
||
`);return e.join(`
|
||
`)}findCycleSlow(){for(const[e,t]of this._nodes){const i=new Set([e]),n=this._findCycle(t,i);if(n)return n}}_findCycle(e,t){for(const[i,n]of e.outgoing){if(t.has(i))return[...t,i].join(" -> ");t.add(i);const s=this._findCycle(n,t);if(s)return s;t.delete(i)}}}const $q=!1;class TM extends Error{constructor(e){super("cyclic dependency between services"),this.message=e.findCycleSlow()??`UNABLE to detect cycle, dumping graph:
|
||
${e.toString()}`}}class jp{constructor(e=new Oc,t=!1,i,n=$q){this._services=e,this._strict=t,this._parent=i,this._enableTracing=n,this._isDisposed=!1,this._servicesToMaybeDispose=new Set,this._children=new Set,this._activeInstantiations=new Set,this._services.set(me,this),this._globalGraph=n?i?._globalGraph??new IM(s=>s):void 0}dispose(){if(!this._isDisposed){this._isDisposed=!0,l.dispose(this._children),this._children.clear();for(const e of this._servicesToMaybeDispose)l.isDisposable(e)&&e.dispose();this._servicesToMaybeDispose.clear()}}_throwIfDisposed(){if(this._isDisposed)throw new Error("InstantiationService has been disposed")}createChild(e,t){this._throwIfDisposed();const i=this,n=new class extends jp{dispose(){i._children.delete(n),super.dispose()}}(e,this._strict,this,this._enableTracing);return this._children.add(n),t?.add(n),n}invokeFunction(e,...t){this._throwIfDisposed();const i=Zu.traceInvocation(this._enableTracing,e);let n=!1;try{return e({get:r=>{if(n)throw l.illegalState("service accessor is only valid during the invocation of its target method");const a=this._getOrCreateServiceInstance(r,i);return a||this._throwIfStrict(`[invokeFunction] unknown service '${r}'`,!1),a}},...t)}finally{n=!0,i.stop()}}createInstance(e,...t){this._throwIfDisposed();let i,n;return e instanceof gs?(i=Zu.traceCreation(this._enableTracing,e.ctor),n=this._createInstance(e.ctor,e.staticArguments.concat(t),i)):(i=Zu.traceCreation(this._enableTracing,e),n=this._createInstance(e,t,i)),i.stop(),n}_createInstance(e,t=[],i){const n=Yn.getServiceDependencies(e).sort((a,c)=>a.index-c.index),s=[];for(const a of n){const c=this._getOrCreateServiceInstance(a.id,i);c||this._throwIfStrict(`[createInstance] ${e.name} depends on UNKNOWN service ${a.id}.`,!1),s.push(c)}const r=n.length>0?n[0].index:t.length;if(t.length!==r){console.trace(`[createInstance] First service dependency of ${e.name} at position ${r+1} conflicts with ${t.length} static arguments`);const a=r-t.length;a>0?t=t.concat(new Array(a)):t=t.slice(0,r)}return Reflect.construct(e,t.concat(s))}_setCreatedServiceInstance(e,t){if(this._services.get(e)instanceof gs)this._services.set(e,t);else if(this._parent)this._parent._setCreatedServiceInstance(e,t);else throw new Error("illegalState - setting UNKNOWN service instance")}_getServiceInstanceOrDescriptor(e){const t=this._services.get(e);return!t&&this._parent?this._parent._getServiceInstanceOrDescriptor(e):t}_getOrCreateServiceInstance(e,t){this._globalGraph&&this._globalGraphImplicitDependency&&this._globalGraph.insertEdge(this._globalGraphImplicitDependency,String(e));const i=this._getServiceInstanceOrDescriptor(e);return i instanceof gs?this._safeCreateAndCacheServiceInstance(e,i,t.branch(e,!0)):(t.branch(e,!1),i)}_safeCreateAndCacheServiceInstance(e,t,i){if(this._activeInstantiations.has(e))throw new Error(`illegal state - RECURSIVELY instantiating service '${e}'`);this._activeInstantiations.add(e);try{return this._createAndCacheServiceInstance(e,t,i)}finally{this._activeInstantiations.delete(e)}}_createAndCacheServiceInstance(e,t,i){const n=new IM(c=>c.id.toString());let s=0;const r=[{id:e,desc:t,_trace:i}],a=new Set;for(;r.length;){const c=r.pop();if(!a.has(String(c.id))){if(a.add(String(c.id)),n.lookupOrInsertNode(c),s++>1e3)throw new TM(n);for(const h of Yn.getServiceDependencies(c.desc.ctor)){const d=this._getServiceInstanceOrDescriptor(h.id);if(d||this._throwIfStrict(`[createInstance] ${e} depends on ${h.id} which is NOT registered.`,!0),this._globalGraph?.insertEdge(String(c.id),String(h.id)),d instanceof gs){const u={id:h.id,desc:d,_trace:c._trace.branch(h.id,!0)};n.insertEdge(c,u),r.push(u)}}}}for(;;){const c=n.roots();if(c.length===0){if(!n.isEmpty())throw new TM(n);break}for(const{data:h}of c){if(this._getServiceInstanceOrDescriptor(h.id)instanceof gs){const u=this._createServiceInstanceWithOwner(h.id,h.desc.ctor,h.desc.staticArguments,h.desc.supportsDelayedInstantiation,h._trace);this._setCreatedServiceInstance(h.id,u)}n.removeNode(h)}}return this._getServiceInstanceOrDescriptor(e)}_createServiceInstanceWithOwner(e,t,i=[],n,s){if(this._services.get(e)instanceof gs)return this._createServiceInstance(e,t,i,n,s,this._servicesToMaybeDispose);if(this._parent)return this._parent._createServiceInstanceWithOwner(e,t,i,n,s);throw new Error(`illegalState - creating UNKNOWN service instance ${t.name}`)}_createServiceInstance(e,t,i=[],n,s,r){if(n){const a=new jp(void 0,this._strict,this,this._enableTracing);a._globalGraphImplicitDependency=String(e);const c=new Map,h=new l.GlobalIdleValue(()=>{const d=a._createInstance(t,i,s);for(const[u,f]of c){const g=d[u];if(typeof g=="function")for(const m of f)m.disposable=g.apply(d,m.listener)}return c.clear(),r.add(d),d});return new Proxy(Object.create(null),{get(d,u){if(!h.isInitialized&&typeof u=="string"&&(u.startsWith("onDid")||u.startsWith("onWill"))){let m=c.get(u);return m||(m=new l.LinkedList,c.set(u,m)),(b,v,C)=>{if(h.isInitialized)return h.value[u](b,v,C);{const w={listener:[b,v,C],disposable:void 0},S=m.push(w);return l.toDisposable(()=>{S(),w.disposable?.dispose()})}}}if(u in d)return d[u];const f=h.value;let g=f[u];return typeof g!="function"||(g=g.bind(f),d[u]=g),g},set(d,u,f){return h.value[u]=f,!0},getPrototypeOf(d){return t.prototype}})}else{const a=this._createInstance(t,i,s);return r.add(a),a}}_throwIfStrict(e,t){if(t&&console.warn(e),this._strict)throw new Error(e)}}const dn=class dn{static traceInvocation(e,t){return e?new dn(2,t.name||new Error().stack.split(`
|
||
`).slice(3,4).join(`
|
||
`)):dn._None}static traceCreation(e,t){return e?new dn(1,t.name):dn._None}constructor(e,t){this.type=e,this.name=t,this._start=Date.now(),this._dep=[]}branch(e,t){const i=new dn(3,e.toString());return this._dep.push([e,t,i]),i}stop(){const e=Date.now()-this._start;dn._totals+=e;let t=!1;function i(s,r){const a=[],c=new Array(s+1).join(" ");for(const[h,d,u]of r._dep)if(d&&u){t=!0,a.push(`${c}CREATES -> ${h}`);const f=i(s+1,u);f&&a.push(f)}else a.push(`${c}uses -> ${h}`);return a.join(`
|
||
`)}const n=[`${this.type===1?"CREATE":"CALL"} ${this.name}`,`${i(1,this)}`,`DONE, took ${e.toFixed(2)}ms (grand total ${dn._totals.toFixed(2)}ms)`];(e>2||t)&&dn.all.add(n.join(`
|
||
`))}};dn.all=new Set,dn._None=new class extends dn{constructor(){super(0,null)}stop(){}branch(){return this}},dn._totals=0;let Zu=dn;const qp={kind:0},Kq={kind:1};function Gq(o,e,t){return{kind:2,commandId:o,commandArgs:e,isBubble:t}}class nh{constructor(e,t,i){this._log=i,this._defaultKeybindings=e,this._defaultBoundCommands=new Map;for(const n of e){const s=n.command;s&&s.charAt(0)!=="-"&&this._defaultBoundCommands.set(s,!0)}this._map=new Map,this._lookupMap=new Map,this._keybindings=nh.handleRemovals([].concat(e).concat(t));for(let n=0,s=this._keybindings.length;n<s;n++){const r=this._keybindings[n];if(r.chords.length===0)continue;const a=r.when?.substituteConstants();a&&a.type===0||this._addKeyPress(r.chords[0],r)}}static _isTargetedForRemoval(e,t,i){if(t){for(let n=0;n<t.length;n++)if(t[n]!==e.chords[n])return!1}if(i&&i.type!==1){if(!e.when)return!1;const n=e.when.substituteConstants(),s=i.substituteConstants();if(!nh.whenIsEntirelyIncluded(n,s))return!1}return!0}static handleRemovals(e){const t=new Map;for(let n=0,s=e.length;n<s;n++){const r=e[n];if(r.command&&r.command.charAt(0)==="-"){const a=r.command.substring(1);t.has(a)?t.get(a).push(r):t.set(a,[r])}}if(t.size===0)return e;const i=[];for(let n=0,s=e.length;n<s;n++){const r=e[n];if(!r.command||r.command.length===0){i.push(r);continue}if(r.command.charAt(0)==="-")continue;const a=t.get(r.command);if(!a||!r.isDefault){i.push(r);continue}let c=!1;for(const h of a){const d=h.when;if(this._isTargetedForRemoval(r,h.chords,d)){c=!0;break}}if(!c){i.push(r);continue}}return i}_addKeyPress(e,t){const i=this._map.get(e);if(typeof i>"u"){this._map.set(e,[t]),this._addToLookupMap(t);return}for(let n=i.length-1;n>=0;n--){const s=i[n];if(s.command===t.command)continue;let r=!0;for(let a=1;a<s.chords.length&&a<t.chords.length;a++)if(s.chords[a]!==t.chords[a]){r=!1;break}r&&nh.whenIsEntirelyIncluded(s.when,t.when)&&this._removeFromLookupMap(s)}i.push(t),this._addToLookupMap(t)}_addToLookupMap(e){if(!e.command)return;let t=this._lookupMap.get(e.command);typeof t>"u"?(t=[e],this._lookupMap.set(e.command,t)):t.push(e)}_removeFromLookupMap(e){if(!e.command)return;const t=this._lookupMap.get(e.command);if(!(typeof t>"u")){for(let i=0,n=t.length;i<n;i++)if(t[i]===e){t.splice(i,1);return}}}static whenIsEntirelyIncluded(e,t){return!t||t.type===1?!0:!e||e.type===1?!1:mC(e,t)}getKeybindings(){return this._keybindings}lookupPrimaryKeybinding(e,t,i=!1){const n=this._lookupMap.get(e);if(typeof n>"u"||n.length===0)return null;if(n.length===1&&!i)return n[0];for(let s=n.length-1;s>=0;s--){const r=n[s];if(t.contextMatchesRules(r.when))return r}return i?null:n[n.length-1]}resolve(e,t,i){const n=[...t,i];this._log(`| Resolving ${n}`);const s=this._map.get(n[0]);if(s===void 0)return this._log("\\ No keybinding entries."),qp;let r=null;if(n.length<2)r=s;else{r=[];for(let c=0,h=s.length;c<h;c++){const d=s[c];if(n.length>d.chords.length)continue;let u=!0;for(let f=1;f<n.length;f++)if(d.chords[f]!==n[f]){u=!1;break}u&&r.push(d)}}const a=this._findCommand(e,r);return a?n.length<a.chords.length?(this._log(`\\ From ${r.length} keybinding entries, awaiting ${a.chords.length-n.length} more chord(s), when: ${NM(a.when)}, source: ${RM(a)}.`),Kq):(this._log(`\\ From ${r.length} keybinding entries, matched ${a.command}, when: ${NM(a.when)}, source: ${RM(a)}.`),Gq(a.command,a.commandArgs,a.bubble)):(this._log(`\\ From ${r.length} keybinding entries, no when clauses matched the context.`),qp)}_findCommand(e,t){for(let i=t.length-1;i>=0;i--){const n=t[i];if(nh._contextMatchesRules(e,n.when))return n}return null}static _contextMatchesRules(e,t){return t?t.evaluate(e):!0}}function NM(o){return o?`${o.serialize()}`:"no when condition"}function RM(o){return o.extensionId?o.isBuiltinExtension?`built-in extension ${o.extensionId}`:`user extension ${o.extensionId}`:o.isDefault?"built-in":"user"}const jq=/^(cursor|delete|undo|redo|tab|editor\.action\.clipboard)/;class qq extends l.Disposable{get onDidUpdateKeybindings(){return this._onDidUpdateKeybindings?this._onDidUpdateKeybindings.event:l.Event.None}get inChordMode(){return this._currentChords.length>0}constructor(e,t,i,n,s){super(),this._contextKeyService=e,this._commandService=t,this._telemetryService=i,this._notificationService=n,this._logService=s,this._onDidUpdateKeybindings=this._register(new l.Emitter),this._currentChords=[],this._currentChordChecker=new l.IntervalTimer,this._currentChordStatusMessage=null,this._ignoreSingleModifiers=sh.EMPTY,this._currentSingleModifier=null,this._currentSingleModifierClearTimeout=new l.TimeoutTimer,this._currentlyDispatchingCommandId=null,this._logging=!1}_log(e){this._logging&&this._logService.info(`[KeybindingService]: ${e}`)}getKeybindings(){return this._getResolver().getKeybindings()}lookupKeybinding(e,t,i=!1){const n=this._getResolver().lookupPrimaryKeybinding(e,t||this._contextKeyService,i);if(n)return n.resolvedKeybinding}dispatchEvent(e,t){return this._dispatch(e,t)}softDispatch(e,t){this._log("/ Soft dispatching keyboard event");const i=this.resolveKeyboardEvent(e);if(i.hasMultipleChords())return console.warn("keyboard event should not be mapped to multiple chords"),qp;const[n]=i.getDispatchChords();if(n===null)return this._log("\\ Keyboard event cannot be dispatched"),qp;const s=this._contextKeyService.getContext(t),r=this._currentChords.map((({keypress:a})=>a));return this._getResolver().resolve(s,r,n)}_scheduleLeaveChordMode(){const e=Date.now();this._currentChordChecker.cancelAndSet(()=>{if(!this._documentHasFocus()){this._leaveChordMode();return}Date.now()-e>5e3&&this._leaveChordMode()},500)}_expectAnotherChord(e,t){switch(this._currentChords.push({keypress:e,label:t}),this._currentChords.length){case 0:throw l.illegalState("impossible");case 1:this._currentChordStatusMessage=this._notificationService.status(l.localize(1763,"({0}) was pressed. Waiting for second key of chord...",t));break;default:{const i=this._currentChords.map(({label:n})=>n).join(", ");this._currentChordStatusMessage=this._notificationService.status(l.localize(1764,"({0}) was pressed. Waiting for next key of chord...",i))}}this._scheduleLeaveChordMode(),Ss.enabled&&Ss.disable()}_leaveChordMode(){this._currentChordStatusMessage&&(this._currentChordStatusMessage.close(),this._currentChordStatusMessage=null),this._currentChordChecker.cancel(),this._currentChords=[],Ss.enable()}_dispatch(e,t){return this._doDispatch(this.resolveKeyboardEvent(e),t,!1)}_singleModifierDispatch(e,t){const i=this.resolveKeyboardEvent(e),[n]=i.getSingleModifierDispatchChords();if(n)return this._ignoreSingleModifiers.has(n)?(this._log(`+ Ignoring single modifier ${n} due to it being pressed together with other keys.`),this._ignoreSingleModifiers=sh.EMPTY,this._currentSingleModifierClearTimeout.cancel(),this._currentSingleModifier=null,!1):(this._ignoreSingleModifiers=sh.EMPTY,this._currentSingleModifier===null?(this._log(`+ Storing single modifier for possible chord ${n}.`),this._currentSingleModifier=n,this._currentSingleModifierClearTimeout.cancelAndSet(()=>{this._log("+ Clearing single modifier due to 300ms elapsed."),this._currentSingleModifier=null},300),!1):n===this._currentSingleModifier?(this._log(`/ Dispatching single modifier chord ${n} ${n}`),this._currentSingleModifierClearTimeout.cancel(),this._currentSingleModifier=null,this._doDispatch(i,t,!0)):(this._log(`+ Clearing single modifier due to modifier mismatch: ${this._currentSingleModifier} ${n}`),this._currentSingleModifierClearTimeout.cancel(),this._currentSingleModifier=null,!1));const[s]=i.getChords();return this._ignoreSingleModifiers=new sh(s),this._currentSingleModifier!==null&&this._log("+ Clearing single modifier due to other key up."),this._currentSingleModifierClearTimeout.cancel(),this._currentSingleModifier=null,!1}_doDispatch(e,t,i=!1){let n=!1;if(e.hasMultipleChords())return console.warn("Unexpected keyboard event mapped to multiple chords"),!1;let s=null,r=null;if(i){const[d]=e.getSingleModifierDispatchChords();s=d,r=d?[d]:[]}else[s]=e.getDispatchChords(),r=this._currentChords.map(({keypress:d})=>d);if(s===null)return this._log("\\ Keyboard event cannot be dispatched in keydown phase."),n;const a=this._contextKeyService.getContext(t),c=e.getLabel(),h=this._getResolver().resolve(a,r,s);switch(h.kind){case 0:{if(this._logService.trace("KeybindingService#dispatch",c,"[ No matching keybinding ]"),this.inChordMode){const d=this._currentChords.map(({label:u})=>u).join(", ");this._log(`+ Leaving multi-chord mode: Nothing bound to "${d}, ${c}".`),this._notificationService.status(l.localize(1765,"The key combination ({0}, {1}) is not a command.",d,c),{hideAfter:10*1e3}),this._leaveChordMode(),n=!0}return n}case 1:return this._logService.trace("KeybindingService#dispatch",c,"[ Several keybindings match - more chords needed ]"),n=!0,this._expectAnotherChord(s,c),this._log(this._currentChords.length===1?"+ Entering multi-chord mode...":"+ Continuing multi-chord mode..."),n;case 2:{if(this._logService.trace("KeybindingService#dispatch",c,`[ Will dispatch command ${h.commandId} ]`),h.commandId===null||h.commandId===""){if(this.inChordMode){const d=this._currentChords.map(({label:u})=>u).join(", ");this._log(`+ Leaving chord mode: Nothing bound to "${d}, ${c}".`),this._notificationService.status(l.localize(1766,"The key combination ({0}, {1}) is not a command.",d,c),{hideAfter:10*1e3}),this._leaveChordMode(),n=!0}}else{this.inChordMode&&this._leaveChordMode(),h.isBubble||(n=!0),this._log(`+ Invoking command ${h.commandId}.`),this._currentlyDispatchingCommandId=h.commandId;try{typeof h.commandArgs>"u"?this._commandService.executeCommand(h.commandId).then(void 0,d=>this._notificationService.warn(d)):this._commandService.executeCommand(h.commandId,h.commandArgs).then(void 0,d=>this._notificationService.warn(d))}finally{this._currentlyDispatchingCommandId=null}jq.test(h.commandId)||this._telemetryService.publicLog2("workbenchActionExecuted",{id:h.commandId,from:"keybinding",detail:e.getUserSettingsLabel()??void 0})}return n}}}mightProducePrintableCharacter(e){return e.ctrlKey||e.metaKey?!1:e.keyCode>=31&&e.keyCode<=56||e.keyCode>=21&&e.keyCode<=30}appendKeybinding(e,t,i,n){if(t){const s=this.lookupKeybinding(t,i,n)?.getLabel();if(s)return l.localize(1767,"{0} ({1})",e,s)}return e}}const mb=class mb{constructor(e){this._ctrlKey=e?e.ctrlKey:!1,this._shiftKey=e?e.shiftKey:!1,this._altKey=e?e.altKey:!1,this._metaKey=e?e.metaKey:!1}has(e){switch(e){case"ctrl":return this._ctrlKey;case"shift":return this._shiftKey;case"alt":return this._altKey;case"meta":return this._metaKey}}};mb.EMPTY=new mb(null);let sh=mb;class MM{constructor(e,t,i,n,s,r,a){this._resolvedKeybindingItemBrand=void 0,this.resolvedKeybinding=e,this.chords=e?Jy(e.getDispatchChords()):[],e&&this.chords.length===0&&(this.chords=Jy(e.getSingleModifierDispatchChords())),this.bubble=t?t.charCodeAt(0)===94:!1,this.command=this.bubble?t.substr(1):t,this.commandArgs=i,this.when=n,this.isDefault=s,this.extensionId=r,this.isBuiltinExtension=a}}function Jy(o){const e=[];for(let t=0,i=o.length;t<i;t++){const n=o[t];if(!n)return[];e.push(n)}return e}class Yq extends bk{constructor(e,t){if(super(),t.length===0)throw l.illegalArgument("chords");this._os=e,this._chords=t}getLabel(){return ky.toLabel(this._os,this._chords,e=>this._getLabel(e))}getAriaLabel(){return hq.toLabel(this._os,this._chords,e=>this._getAriaLabel(e))}getElectronAccelerator(){return this._chords.length>1||this._chords[0].isDuplicateModifierCase()?null:dq.toLabel(this._os,this._chords,e=>this._getElectronAccelerator(e))}getUserSettingsLabel(){return uq.toLabel(this._os,this._chords,e=>this._getUserSettingsLabel(e))}hasMultipleChords(){return this._chords.length>1}getChords(){return this._chords.map(e=>this._getChord(e))}_getChord(e){return new _k(e.ctrlKey,e.shiftKey,e.altKey,e.metaKey,this._getLabel(e),this._getAriaLabel(e))}getDispatchChords(){return this._chords.map(e=>this._getChordDispatch(e))}getSingleModifierDispatchChords(){return this._chords.map(e=>this._getSingleModifierChordDispatch(e))}}class Qu extends Yq{constructor(e,t){super(t,e)}_keyCodeToUILabel(e){if(this._os===2)switch(e){case 15:return"←";case 16:return"↑";case 17:return"→";case 18:return"↓"}return l.KeyCodeUtils.toString(e)}_getLabel(e){return e.isDuplicateModifierCase()?"":this._keyCodeToUILabel(e.keyCode)}_getAriaLabel(e){return e.isDuplicateModifierCase()?"":l.KeyCodeUtils.toString(e.keyCode)}_getElectronAccelerator(e){return l.KeyCodeUtils.toElectronAccelerator(e.keyCode)}_getUserSettingsLabel(e){if(e.isDuplicateModifierCase())return"";const t=l.KeyCodeUtils.toUserSettingsUS(e.keyCode);return t&&t.toLowerCase()}_getChordDispatch(e){return Qu.getDispatchStr(e)}static getDispatchStr(e){if(e.isModifierKey())return null;let t="";return e.ctrlKey&&(t+="ctrl+"),e.shiftKey&&(t+="shift+"),e.altKey&&(t+="alt+"),e.metaKey&&(t+="meta+"),t+=l.KeyCodeUtils.toString(e.keyCode),t}_getSingleModifierChordDispatch(e){return e.keyCode===5&&!e.shiftKey&&!e.altKey&&!e.metaKey?"ctrl":e.keyCode===4&&!e.ctrlKey&&!e.altKey&&!e.metaKey?"shift":e.keyCode===6&&!e.ctrlKey&&!e.shiftKey&&!e.metaKey?"alt":e.keyCode===57&&!e.ctrlKey&&!e.shiftKey&&!e.altKey?"meta":null}static _scanCodeToKeyCode(e){const t=l.IMMUTABLE_CODE_TO_KEY_CODE[e];if(t!==-1)return t;switch(e){case 10:return 31;case 11:return 32;case 12:return 33;case 13:return 34;case 14:return 35;case 15:return 36;case 16:return 37;case 17:return 38;case 18:return 39;case 19:return 40;case 20:return 41;case 21:return 42;case 22:return 43;case 23:return 44;case 24:return 45;case 25:return 46;case 26:return 47;case 27:return 48;case 28:return 49;case 29:return 50;case 30:return 51;case 31:return 52;case 32:return 53;case 33:return 54;case 34:return 55;case 35:return 56;case 36:return 22;case 37:return 23;case 38:return 24;case 39:return 25;case 40:return 26;case 41:return 27;case 42:return 28;case 43:return 29;case 44:return 30;case 45:return 21;case 51:return 88;case 52:return 86;case 53:return 92;case 54:return 94;case 55:return 93;case 56:return 0;case 57:return 85;case 58:return 95;case 59:return 91;case 60:return 87;case 61:return 89;case 62:return 90;case 106:return 97}return 0}static _toKeyCodeChord(e){if(!e)return null;if(e instanceof Yh)return e;const t=this._scanCodeToKeyCode(e.scanCode);return t===0?null:new Yh(e.ctrlKey,e.shiftKey,e.altKey,e.metaKey,t)}static resolveKeybinding(e,t){const i=Jy(e.chords.map(n=>this._toKeyCodeChord(n)));return i.length>0?[new Qu(i,t)]:[]}}const AM=le("labelService");class Zq{get templateId(){return this.renderer.templateId}constructor(e,t){this.renderer=e,this.modelProvider=t}renderTemplate(e){return{data:this.renderer.renderTemplate(e),disposable:l.Disposable.None}}renderElement(e,t,i,n){if(i.disposable?.dispose(),!i.data)return;const s=this.modelProvider();if(s.isResolved(e))return this.renderer.renderElement(s.get(e),e,i.data,n);const r=new l.CancellationTokenSource,a=s.resolve(e,r.token);i.disposable={dispose:()=>r.cancel()},this.renderer.renderPlaceholder(e,i.data),a.then(c=>this.renderer.renderElement(c,e,i.data,n))}disposeTemplate(e){e.disposable&&(e.disposable.dispose(),e.disposable=void 0),e.data&&(this.renderer.disposeTemplate(e.data),e.data=void 0)}}class Qq{constructor(e,t){this.modelProvider=e,this.accessibilityProvider=t}getWidgetAriaLabel(){return this.accessibilityProvider.getWidgetAriaLabel()}getAriaLabel(e){const t=this.modelProvider();return t.isResolved(e)?this.accessibilityProvider.getAriaLabel(t.get(e)):null}}function Xq(o,e){return{...e,accessibilityProvider:e.accessibilityProvider&&new Qq(o,e.accessibilityProvider)}}class Jq{constructor(e,t,i,n,s={}){this.modelDisposables=new l.DisposableStore;const r=()=>this.model,a=n.map(c=>new Zq(c,r));this.list=new zn(e,t,i,a,Xq(r,s))}updateOptions(e){this.list.updateOptions(e)}getHTMLElement(){return this.list.getHTMLElement()}get onDidFocus(){return this.list.onDidFocus}get widget(){return this.list}get onDidDispose(){return this.list.onDidDispose}get onMouseDblClick(){return l.Event.map(this.list.onMouseDblClick,({element:e,index:t,browserEvent:i})=>({element:e===void 0?void 0:this._model.get(e),index:t,browserEvent:i}))}get onPointer(){return l.Event.map(this.list.onPointer,({element:e,index:t,browserEvent:i})=>({element:e===void 0?void 0:this._model.get(e),index:t,browserEvent:i}))}get onDidChangeSelection(){return l.Event.map(this.list.onDidChangeSelection,({elements:e,indexes:t,browserEvent:i})=>({elements:e.map(n=>this._model.get(n)),indexes:t,browserEvent:i}))}get model(){return this._model}set model(e){this.modelDisposables.clear(),this._model=e,this.list.splice(0,this.list.length,l.range(e.length)),this.modelDisposables.add(e.onDidIncrementLength(t=>this.list.splice(this.list.length,0,l.range(this.list.length,t))))}getFocus(){return this.list.getFocus()}getSelection(){return this.list.getSelection()}getSelectedElements(){return this.getSelection().map(e=>this.model.get(e))}style(e){this.list.style(e)}dispose(){this.list.dispose(),this.modelDisposables.dispose()}}var oh=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s};const Wq=!1;_.OrthogonalEdge=void 0,(function(o){o.North="north",o.South="south",o.East="east",o.West="west"})(_.OrthogonalEdge||(_.OrthogonalEdge={}));let Hq=4;const eY=new l.Emitter;let tY=300;const iY=new l.Emitter;class Wy{constructor(e){this.el=e,this.disposables=new l.DisposableStore}get onPointerMove(){return this.disposables.add(new Te(j(this.el),"mousemove")).event}get onPointerUp(){return this.disposables.add(new Te(j(this.el),"mouseup")).event}dispose(){this.disposables.dispose()}}oh([et],Wy.prototype,"onPointerMove",null),oh([et],Wy.prototype,"onPointerUp",null);class Hy{get onPointerMove(){return this.disposables.add(new Te(this.el,_.EventType$1.Change)).event}get onPointerUp(){return this.disposables.add(new Te(this.el,_.EventType$1.End)).event}constructor(e){this.el=e,this.disposables=new l.DisposableStore}dispose(){this.disposables.dispose()}}oh([et],Hy.prototype,"onPointerMove",null),oh([et],Hy.prototype,"onPointerUp",null);class Yp{get onPointerMove(){return this.factory.onPointerMove}get onPointerUp(){return this.factory.onPointerUp}constructor(e){this.factory=e}dispose(){}}oh([et],Yp.prototype,"onPointerMove",null),oh([et],Yp.prototype,"onPointerUp",null);const OM="pointer-events-disabled";class on extends l.Disposable{get state(){return this._state}get orthogonalStartSash(){return this._orthogonalStartSash}get orthogonalEndSash(){return this._orthogonalEndSash}set state(e){this._state!==e&&(this.el.classList.toggle("disabled",e===0),this.el.classList.toggle("minimum",e===1),this.el.classList.toggle("maximum",e===2),this._state=e,this.onDidEnablementChange.fire(e))}get onDidStart(){return this._onDidStart.event}get onDidChange(){return this._onDidChange.event}get onDidReset(){return this._onDidReset.event}get onDidEnd(){return this._onDidEnd.event}set orthogonalStartSash(e){if(this._orthogonalStartSash!==e){if(this.orthogonalStartDragHandleDisposables.clear(),this.orthogonalStartSashDisposables.clear(),e){const t=i=>{this.orthogonalStartDragHandleDisposables.clear(),i!==0&&(this._orthogonalStartDragHandle=K(this.el,Q(".orthogonal-drag-handle.start")),this.orthogonalStartDragHandleDisposables.add(l.toDisposable(()=>this._orthogonalStartDragHandle.remove())),this.orthogonalStartDragHandleDisposables.add(R(this._orthogonalStartDragHandle,"mouseenter",()=>on.onMouseEnter(e))),this.orthogonalStartDragHandleDisposables.add(R(this._orthogonalStartDragHandle,"mouseleave",()=>on.onMouseLeave(e))))};this.orthogonalStartSashDisposables.add(e.onDidEnablementChange.event(t,this)),t(e.state)}this._orthogonalStartSash=e}}set orthogonalEndSash(e){if(this._orthogonalEndSash!==e){if(this.orthogonalEndDragHandleDisposables.clear(),this.orthogonalEndSashDisposables.clear(),e){const t=i=>{this.orthogonalEndDragHandleDisposables.clear(),i!==0&&(this._orthogonalEndDragHandle=K(this.el,Q(".orthogonal-drag-handle.end")),this.orthogonalEndDragHandleDisposables.add(l.toDisposable(()=>this._orthogonalEndDragHandle.remove())),this.orthogonalEndDragHandleDisposables.add(R(this._orthogonalEndDragHandle,"mouseenter",()=>on.onMouseEnter(e))),this.orthogonalEndDragHandleDisposables.add(R(this._orthogonalEndDragHandle,"mouseleave",()=>on.onMouseLeave(e))))};this.orthogonalEndSashDisposables.add(e.onDidEnablementChange.event(t,this)),t(e.state)}this._orthogonalEndSash=e}}constructor(e,t,i){super(),this.hoverDelay=tY,this.hoverDelayer=this._register(new l.Delayer(this.hoverDelay)),this._state=3,this.onDidEnablementChange=this._register(new l.Emitter),this._onDidStart=this._register(new l.Emitter),this._onDidChange=this._register(new l.Emitter),this._onDidReset=this._register(new l.Emitter),this._onDidEnd=this._register(new l.Emitter),this.orthogonalStartSashDisposables=this._register(new l.DisposableStore),this.orthogonalStartDragHandleDisposables=this._register(new l.DisposableStore),this.orthogonalEndSashDisposables=this._register(new l.DisposableStore),this.orthogonalEndDragHandleDisposables=this._register(new l.DisposableStore),this.linkedSash=void 0,this.el=K(e,Q(".monaco-sash")),i.orthogonalEdge&&this.el.classList.add(`orthogonal-edge-${i.orthogonalEdge}`),l.isMacintosh&&this.el.classList.add("mac"),this._register(R(this.el,"mousedown",s=>this.onPointerStart(s,new Wy(e)))),this._register(R(this.el,"dblclick",s=>this.onPointerDoublePress(s))),this._register(R(this.el,"mouseenter",()=>on.onMouseEnter(this))),this._register(R(this.el,"mouseleave",()=>on.onMouseLeave(this))),this._register(li.addTarget(this.el)),this._register(R(this.el,_.EventType$1.Start,s=>this.onPointerStart(s,new Hy(this.el))));let n;this._register(R(this.el,_.EventType$1.Tap,s=>{if(n){clearTimeout(n),n=void 0,this.onPointerDoublePress(s);return}clearTimeout(n),n=setTimeout(()=>n=void 0,250)})),typeof i.size=="number"?(this.size=i.size,i.orientation===0?this.el.style.width=`${this.size}px`:this.el.style.height=`${this.size}px`):(this.size=Hq,this._register(eY.event(s=>{this.size=s,this.layout()}))),this._register(iY.event(s=>this.hoverDelay=s)),this.layoutProvider=t,this.orthogonalStartSash=i.orthogonalStartSash,this.orthogonalEndSash=i.orthogonalEndSash,this.orientation=i.orientation||0,this.orientation===1?(this.el.classList.add("horizontal"),this.el.classList.remove("vertical")):(this.el.classList.remove("horizontal"),this.el.classList.add("vertical")),this.el.classList.toggle("debug",Wq),this.layout()}onPointerStart(e,t){ve.stop(e);let i=!1;if(!e.__orthogonalSashEvent){const m=this.getOrthogonalSash(e);m&&(i=!0,e.__orthogonalSashEvent=!0,m.onPointerStart(e,new Yp(t)))}if(this.linkedSash&&!e.__linkedSashEvent&&(e.__linkedSashEvent=!0,this.linkedSash.onPointerStart(e,new Yp(t))),!this.state)return;const n=this.el.ownerDocument.getElementsByTagName("iframe");for(const m of n)m.classList.add(OM);const s=e.pageX,r=e.pageY,a=e.altKey,c={startX:s,currentX:s,startY:r,currentY:r,altKey:a};this.el.classList.add("active"),this._onDidStart.fire(c);const h=bn(this.el),d=()=>{let m="";i?m="all-scroll":this.orientation===1?this.state===1?m="s-resize":this.state===2?m="n-resize":m=l.isMacintosh?"row-resize":"ns-resize":this.state===1?m="e-resize":this.state===2?m="w-resize":m=l.isMacintosh?"col-resize":"ew-resize",h.textContent=`* { cursor: ${m} !important; }`},u=new l.DisposableStore;d(),i||this.onDidEnablementChange.event(d,null,u);const f=m=>{ve.stop(m,!1);const p={startX:s,currentX:m.pageX,startY:r,currentY:m.pageY,altKey:a};this._onDidChange.fire(p)},g=m=>{ve.stop(m,!1),h.remove(),this.el.classList.remove("active"),this._onDidEnd.fire(),u.dispose();for(const p of n)p.classList.remove(OM)};t.onPointerMove(f,null,u),t.onPointerUp(g,null,u),u.add(t)}onPointerDoublePress(e){const t=this.getOrthogonalSash(e);t&&t._onDidReset.fire(),this.linkedSash&&this.linkedSash._onDidReset.fire(),this._onDidReset.fire()}static onMouseEnter(e,t=!1){e.el.classList.contains("active")?(e.hoverDelayer.cancel(),e.el.classList.add("hover")):e.hoverDelayer.trigger(()=>e.el.classList.add("hover"),e.hoverDelay).then(void 0,()=>{}),!t&&e.linkedSash&&on.onMouseEnter(e.linkedSash,!0)}static onMouseLeave(e,t=!1){e.hoverDelayer.cancel(),e.el.classList.remove("hover"),!t&&e.linkedSash&&on.onMouseLeave(e.linkedSash,!0)}clearSashHoverState(){on.onMouseLeave(this)}layout(){if(this.orientation===0){const e=this.layoutProvider;this.el.style.left=e.getVerticalSashLeft(this)-this.size/2+"px",e.getVerticalSashTop&&(this.el.style.top=e.getVerticalSashTop(this)+"px"),e.getVerticalSashHeight&&(this.el.style.height=e.getVerticalSashHeight(this)+"px")}else{const e=this.layoutProvider;this.el.style.top=e.getHorizontalSashTop(this)-this.size/2+"px",e.getHorizontalSashLeft&&(this.el.style.left=e.getHorizontalSashLeft(this)+"px"),e.getHorizontalSashWidth&&(this.el.style.width=e.getHorizontalSashWidth(this)+"px")}}getOrthogonalSash(e){const t=e.initialTarget??e.target;if(!(!t||!Ve(t))&&t.classList.contains("orthogonal-drag-handle"))return t.classList.contains("start")?this.orthogonalStartSash:this.orthogonalEndSash}dispose(){super.dispose(),this.el.remove()}}const nY={separatorBorder:l.Color.transparent};class PM{set size(e){this._size=e}get size(){return this._size}get visible(){return typeof this._cachedVisibleSize>"u"}setVisible(e,t){if(e!==this.visible){e?(this.size=wi(this._cachedVisibleSize,this.viewMinimumSize,this.viewMaximumSize),this._cachedVisibleSize=void 0):(this._cachedVisibleSize=typeof t=="number"?t:this.size,this.size=0),this.container.classList.toggle("visible",e);try{this.view.setVisible?.(e)}catch(i){console.error("Splitview: Failed to set visible view"),console.error(i)}}}get minimumSize(){return this.visible?this.view.minimumSize:0}get viewMinimumSize(){return this.view.minimumSize}get maximumSize(){return this.visible?this.view.maximumSize:0}get viewMaximumSize(){return this.view.maximumSize}get priority(){return this.view.priority}get proportionalLayout(){return this.view.proportionalLayout??!0}get snap(){return!!this.view.snap}set enabled(e){this.container.style.pointerEvents=e?"":"none"}constructor(e,t,i,n){this.container=e,this.view=t,this.disposable=n,this._cachedVisibleSize=void 0,typeof i=="number"?(this._size=i,this._cachedVisibleSize=void 0,e.classList.add("visible")):(this._size=0,this._cachedVisibleSize=i.cachedVisibleSize)}layout(e,t){this.layoutContainer(e);try{this.view.layout(this.size,e,t)}catch(i){console.error("Splitview: Failed to layout view"),console.error(i)}}dispose(){this.disposable.dispose()}}class sY extends PM{layoutContainer(e){this.container.style.top=`${e}px`,this.container.style.height=`${this.size}px`}}class oY extends PM{layoutContainer(e){this.container.style.left=`${e}px`,this.container.style.width=`${this.size}px`}}var No;(function(o){o[o.Idle=0]="Idle",o[o.Busy=1]="Busy"})(No||(No={})),_.Sizing=void 0,(function(o){o.Distribute={type:"distribute"};function e(n){return{type:"split",index:n}}o.Split=e;function t(n){return{type:"auto",index:n}}o.Auto=t;function i(n){return{type:"invisible",cachedVisibleSize:n}}o.Invisible=i})(_.Sizing||(_.Sizing={}));class kM extends l.Disposable{get orthogonalStartSash(){return this._orthogonalStartSash}get orthogonalEndSash(){return this._orthogonalEndSash}get startSnappingEnabled(){return this._startSnappingEnabled}get endSnappingEnabled(){return this._endSnappingEnabled}set orthogonalStartSash(e){for(const t of this.sashItems)t.sash.orthogonalStartSash=e;this._orthogonalStartSash=e}set orthogonalEndSash(e){for(const t of this.sashItems)t.sash.orthogonalEndSash=e;this._orthogonalEndSash=e}set startSnappingEnabled(e){this._startSnappingEnabled!==e&&(this._startSnappingEnabled=e,this.updateSashEnablement())}set endSnappingEnabled(e){this._endSnappingEnabled!==e&&(this._endSnappingEnabled=e,this.updateSashEnablement())}constructor(e,t={}){super(),this.size=0,this._contentSize=0,this.proportions=void 0,this.viewItems=[],this.sashItems=[],this.state=No.Idle,this._onDidSashChange=this._register(new l.Emitter),this._onDidSashReset=this._register(new l.Emitter),this._startSnappingEnabled=!0,this._endSnappingEnabled=!0,this.onDidSashChange=this._onDidSashChange.event,this.onDidSashReset=this._onDidSashReset.event,this.orientation=t.orientation??0,this.inverseAltBehavior=t.inverseAltBehavior??!1,this.proportionalLayout=t.proportionalLayout??!0,this.getSashOrthogonalSize=t.getSashOrthogonalSize,this.el=document.createElement("div"),this.el.classList.add("monaco-split-view2"),this.el.classList.add(this.orientation===0?"vertical":"horizontal"),e.appendChild(this.el),this.sashContainer=K(this.el,Q(".sash-container")),this.viewContainer=Q(".split-view-container"),this.scrollable=this._register(new mc({forceIntegerValues:!0,smoothScrollDuration:125,scheduleAtNextAnimationFrame:n=>Ti(j(this.el),n)})),this.scrollableElement=this._register(new Xg(this.viewContainer,{vertical:this.orientation===0?t.scrollbarVisibility??1:2,horizontal:this.orientation===1?t.scrollbarVisibility??1:2},this.scrollable));const i=this._register(new Te(this.viewContainer,"scroll")).event;this._register(i(n=>{const s=this.scrollableElement.getScrollPosition(),r=Math.abs(this.viewContainer.scrollLeft-s.scrollLeft)<=1?void 0:this.viewContainer.scrollLeft,a=Math.abs(this.viewContainer.scrollTop-s.scrollTop)<=1?void 0:this.viewContainer.scrollTop;(r!==void 0||a!==void 0)&&this.scrollableElement.setScrollPosition({scrollLeft:r,scrollTop:a})})),this.onDidScroll=this.scrollableElement.onScroll,this._register(this.onDidScroll(n=>{n.scrollTopChanged&&(this.viewContainer.scrollTop=n.scrollTop),n.scrollLeftChanged&&(this.viewContainer.scrollLeft=n.scrollLeft)})),K(this.el,this.scrollableElement.getDomNode()),this.style(t.styles||nY),t.descriptor&&(this.size=t.descriptor.size,t.descriptor.views.forEach((n,s)=>{const r=l.isUndefined(n.visible)||n.visible?n.size:{type:"invisible",cachedVisibleSize:n.size},a=n.view;this.doAddView(a,r,s,!0)}),this._contentSize=this.viewItems.reduce((n,s)=>n+s.size,0),this.saveProportions())}style(e){e.separatorBorder.isTransparent()?(this.el.classList.remove("separator-border"),this.el.style.removeProperty("--separator-border")):(this.el.classList.add("separator-border"),this.el.style.setProperty("--separator-border",e.separatorBorder.toString()))}addView(e,t,i=this.viewItems.length,n){this.doAddView(e,t,i,n)}layout(e,t){const i=Math.max(this.size,this._contentSize);if(this.size=e,this.layoutContext=t,this.proportions){let n=0;for(let s=0;s<this.viewItems.length;s++){const r=this.viewItems[s],a=this.proportions[s];typeof a=="number"?n+=a:e-=r.size}for(let s=0;s<this.viewItems.length;s++){const r=this.viewItems[s],a=this.proportions[s];typeof a=="number"&&n>0&&(r.size=wi(Math.round(a*e/n),r.minimumSize,r.maximumSize))}}else{const n=l.range(this.viewItems.length),s=n.filter(a=>this.viewItems[a].priority===1),r=n.filter(a=>this.viewItems[a].priority===2);this.resize(this.viewItems.length-1,e-i,void 0,s,r)}this.distributeEmptySpace(),this.layoutViews()}saveProportions(){this.proportionalLayout&&this._contentSize>0&&(this.proportions=this.viewItems.map(e=>e.proportionalLayout&&e.visible?e.size/this._contentSize:void 0))}onSashStart({sash:e,start:t,alt:i}){for(const a of this.viewItems)a.enabled=!1;const n=this.sashItems.findIndex(a=>a.sash===e),s=l.combinedDisposable(R(this.el.ownerDocument.body,"keydown",a=>r(this.sashDragState.current,a.altKey)),R(this.el.ownerDocument.body,"keyup",()=>r(this.sashDragState.current,!1))),r=(a,c)=>{const h=this.viewItems.map(m=>m.size);let d=Number.NEGATIVE_INFINITY,u=Number.POSITIVE_INFINITY;if(this.inverseAltBehavior&&(c=!c),c)if(n===this.sashItems.length-1){const p=this.viewItems[n];d=(p.minimumSize-p.size)/2,u=(p.maximumSize-p.size)/2}else{const p=this.viewItems[n+1];d=(p.size-p.maximumSize)/2,u=(p.size-p.minimumSize)/2}let f,g;if(!c){const m=l.range(n,-1),p=l.range(n+1,this.viewItems.length),b=m.reduce((I,T)=>I+(this.viewItems[T].minimumSize-h[T]),0),v=m.reduce((I,T)=>I+(this.viewItems[T].viewMaximumSize-h[T]),0),C=p.length===0?Number.POSITIVE_INFINITY:p.reduce((I,T)=>I+(h[T]-this.viewItems[T].minimumSize),0),w=p.length===0?Number.NEGATIVE_INFINITY:p.reduce((I,T)=>I+(h[T]-this.viewItems[T].viewMaximumSize),0),S=Math.max(b,w),L=Math.min(C,v),D=this.findFirstSnapIndex(m),x=this.findFirstSnapIndex(p);if(typeof D=="number"){const I=this.viewItems[D],T=Math.floor(I.viewMinimumSize/2);f={index:D,limitDelta:I.visible?S-T:S+T,size:I.size}}if(typeof x=="number"){const I=this.viewItems[x],T=Math.floor(I.viewMinimumSize/2);g={index:x,limitDelta:I.visible?L+T:L-T,size:I.size}}}this.sashDragState={start:a,current:a,index:n,sizes:h,minDelta:d,maxDelta:u,alt:c,snapBefore:f,snapAfter:g,disposable:s}};r(t,i)}onSashChange({current:e}){const{index:t,start:i,sizes:n,alt:s,minDelta:r,maxDelta:a,snapBefore:c,snapAfter:h}=this.sashDragState;this.sashDragState.current=e;const d=e-i,u=this.resize(t,d,n,void 0,void 0,r,a,c,h);if(s){const f=t===this.sashItems.length-1,g=this.viewItems.map(w=>w.size),m=f?t:t+1,p=this.viewItems[m],b=p.size-p.maximumSize,v=p.size-p.minimumSize,C=f?t-1:t+1;this.resize(C,-u,g,void 0,void 0,b,v)}this.distributeEmptySpace(),this.layoutViews()}onSashEnd(e){this._onDidSashChange.fire(e),this.sashDragState.disposable.dispose(),this.saveProportions();for(const t of this.viewItems)t.enabled=!0}onViewChange(e,t){const i=this.viewItems.indexOf(e);i<0||i>=this.viewItems.length||(t=typeof t=="number"?t:e.size,t=wi(t,e.minimumSize,e.maximumSize),this.inverseAltBehavior&&i>0?(this.resize(i-1,Math.floor((e.size-t)/2)),this.distributeEmptySpace(),this.layoutViews()):(e.size=t,this.relayout([i],void 0)))}resizeView(e,t){if(!(e<0||e>=this.viewItems.length)){if(this.state!==No.Idle)throw new Error("Cant modify splitview");this.state=No.Busy;try{const i=l.range(this.viewItems.length).filter(a=>a!==e),n=[...i.filter(a=>this.viewItems[a].priority===1),e],s=i.filter(a=>this.viewItems[a].priority===2),r=this.viewItems[e];t=Math.round(t),t=wi(t,r.minimumSize,Math.min(r.maximumSize,this.size)),r.size=t,this.relayout(n,s)}finally{this.state=No.Idle}}}distributeViewSizes(){const e=[];let t=0;for(const a of this.viewItems)a.maximumSize-a.minimumSize>0&&(e.push(a),t+=a.size);const i=Math.floor(t/e.length);for(const a of e)a.size=wi(i,a.minimumSize,a.maximumSize);const n=l.range(this.viewItems.length),s=n.filter(a=>this.viewItems[a].priority===1),r=n.filter(a=>this.viewItems[a].priority===2);this.relayout(s,r)}getViewSize(e){return e<0||e>=this.viewItems.length?-1:this.viewItems[e].size}doAddView(e,t,i=this.viewItems.length,n){if(this.state!==No.Idle)throw new Error("Cant modify splitview");this.state=No.Busy;try{const s=Q(".split-view-view");i===this.viewItems.length?this.viewContainer.appendChild(s):this.viewContainer.insertBefore(s,this.viewContainer.children.item(i));const r=e.onDidChange(f=>this.onViewChange(d,f)),a=l.toDisposable(()=>s.remove()),c=l.combinedDisposable(r,a);let h;typeof t=="number"?h=t:(t.type==="auto"&&(this.areViewsDistributed()?t={type:"distribute"}:t={type:"split",index:t.index}),t.type==="split"?h=this.getViewSize(t.index)/2:t.type==="invisible"?h={cachedVisibleSize:t.cachedVisibleSize}:h=e.minimumSize);const d=this.orientation===0?new sY(s,e,h,c):new oY(s,e,h,c);if(this.viewItems.splice(i,0,d),this.viewItems.length>1){const f={orthogonalStartSash:this.orthogonalStartSash,orthogonalEndSash:this.orthogonalEndSash},g=this.orientation===0?new on(this.sashContainer,{getHorizontalSashTop:I=>this.getSashPosition(I),getHorizontalSashWidth:this.getSashOrthogonalSize},{...f,orientation:1}):new on(this.sashContainer,{getVerticalSashLeft:I=>this.getSashPosition(I),getVerticalSashHeight:this.getSashOrthogonalSize},{...f,orientation:0}),m=this.orientation===0?I=>({sash:g,start:I.startY,current:I.currentY,alt:I.altKey}):I=>({sash:g,start:I.startX,current:I.currentX,alt:I.altKey}),b=l.Event.map(g.onDidStart,m)(this.onSashStart,this),C=l.Event.map(g.onDidChange,m)(this.onSashChange,this),S=l.Event.map(g.onDidEnd,()=>this.sashItems.findIndex(I=>I.sash===g))(this.onSashEnd,this),L=g.onDidReset(()=>{const I=this.sashItems.findIndex(k=>k.sash===g),T=l.range(I,-1),M=l.range(I+1,this.viewItems.length),O=this.findFirstSnapIndex(T),P=this.findFirstSnapIndex(M);typeof O=="number"&&!this.viewItems[O].visible||typeof P=="number"&&!this.viewItems[P].visible||this._onDidSashReset.fire(I)}),D=l.combinedDisposable(b,C,S,L,g),x={sash:g,disposable:D};this.sashItems.splice(i-1,0,x)}s.appendChild(e.element);let u;typeof t!="number"&&t.type==="split"&&(u=[t.index]),n||this.relayout([i],u),!n&&typeof t!="number"&&t.type==="distribute"&&this.distributeViewSizes()}finally{this.state=No.Idle}}relayout(e,t){const i=this.viewItems.reduce((n,s)=>n+s.size,0);this.resize(this.viewItems.length-1,this.size-i,void 0,e,t),this.distributeEmptySpace(),this.layoutViews(),this.saveProportions()}resize(e,t,i=this.viewItems.map(d=>d.size),n,s,r=Number.NEGATIVE_INFINITY,a=Number.POSITIVE_INFINITY,c,h){if(e<0||e>=this.viewItems.length)return 0;const d=l.range(e,-1),u=l.range(e+1,this.viewItems.length);if(s)for(const x of s)l.pushToStart(d,x),l.pushToStart(u,x);if(n)for(const x of n)l.pushToEnd(d,x),l.pushToEnd(u,x);const f=d.map(x=>this.viewItems[x]),g=d.map(x=>i[x]),m=u.map(x=>this.viewItems[x]),p=u.map(x=>i[x]),b=d.reduce((x,I)=>x+(this.viewItems[I].minimumSize-i[I]),0),v=d.reduce((x,I)=>x+(this.viewItems[I].maximumSize-i[I]),0),C=u.length===0?Number.POSITIVE_INFINITY:u.reduce((x,I)=>x+(i[I]-this.viewItems[I].minimumSize),0),w=u.length===0?Number.NEGATIVE_INFINITY:u.reduce((x,I)=>x+(i[I]-this.viewItems[I].maximumSize),0),S=Math.max(b,w,r),L=Math.min(C,v,a);let D=!1;if(c){const x=this.viewItems[c.index],I=t>=c.limitDelta;D=I!==x.visible,x.setVisible(I,c.size)}if(!D&&h){const x=this.viewItems[h.index],I=t<h.limitDelta;D=I!==x.visible,x.setVisible(I,h.size)}if(D)return this.resize(e,t,i,n,s,r,a);t=wi(t,S,L);for(let x=0,I=t;x<f.length;x++){const T=f[x],M=wi(g[x]+I,T.minimumSize,T.maximumSize),O=M-g[x];I-=O,T.size=M}for(let x=0,I=t;x<m.length;x++){const T=m[x],M=wi(p[x]-I,T.minimumSize,T.maximumSize),O=M-p[x];I+=O,T.size=M}return t}distributeEmptySpace(e){const t=this.viewItems.reduce((a,c)=>a+c.size,0);let i=this.size-t;const n=l.range(this.viewItems.length-1,-1),s=n.filter(a=>this.viewItems[a].priority===1),r=n.filter(a=>this.viewItems[a].priority===2);for(const a of r)l.pushToStart(n,a);for(const a of s)l.pushToEnd(n,a);typeof e=="number"&&l.pushToEnd(n,e);for(let a=0;i!==0&&a<n.length;a++){const c=this.viewItems[n[a]],h=wi(c.size+i,c.minimumSize,c.maximumSize),d=h-c.size;i-=d,c.size=h}}layoutViews(){this._contentSize=this.viewItems.reduce((t,i)=>t+i.size,0);let e=0;for(const t of this.viewItems)t.layout(e,this.layoutContext),e+=t.size;this.sashItems.forEach(t=>t.sash.layout()),this.updateSashEnablement(),this.updateScrollableElement()}updateScrollableElement(){this.orientation===0?this.scrollableElement.setScrollDimensions({height:this.size,scrollHeight:this._contentSize}):this.scrollableElement.setScrollDimensions({width:this.size,scrollWidth:this._contentSize})}updateSashEnablement(){let e=!1;const t=this.viewItems.map(c=>e=c.size-c.minimumSize>0||e);e=!1;const i=this.viewItems.map(c=>e=c.maximumSize-c.size>0||e),n=[...this.viewItems].reverse();e=!1;const s=n.map(c=>e=c.size-c.minimumSize>0||e).reverse();e=!1;const r=n.map(c=>e=c.maximumSize-c.size>0||e).reverse();let a=0;for(let c=0;c<this.sashItems.length;c++){const{sash:h}=this.sashItems[c],d=this.viewItems[c];a+=d.size;const u=!(t[c]&&r[c+1]),f=!(i[c]&&s[c+1]);if(u&&f){const g=l.range(c,-1),m=l.range(c+1,this.viewItems.length),p=this.findFirstSnapIndex(g),b=this.findFirstSnapIndex(m),v=typeof p=="number"&&!this.viewItems[p].visible,C=typeof b=="number"&&!this.viewItems[b].visible;v&&s[c]&&(a>0||this.startSnappingEnabled)?h.state=1:C&&t[c]&&(a<this._contentSize||this.endSnappingEnabled)?h.state=2:h.state=0}else u&&!f?h.state=1:!u&&f?h.state=2:h.state=3}}getSashPosition(e){let t=0;for(let i=0;i<this.sashItems.length;i++)if(t+=this.viewItems[i].size,this.sashItems[i].sash===e)return t;return 0}findFirstSnapIndex(e){for(const t of e){const i=this.viewItems[t];if(i.visible&&i.snap)return t}for(const t of e){const i=this.viewItems[t];if(i.visible&&i.maximumSize-i.minimumSize>0)return;if(!i.visible&&i.snap)return t}}areViewsDistributed(){let e,t;for(const i of this.viewItems)if(e=e===void 0?i.size:Math.min(e,i.size),t=t===void 0?i.size:Math.max(t,i.size),t-e>2)return!1;return!0}dispose(){this.sashDragState?.disposable.dispose(),l.dispose(this.viewItems),this.viewItems=[],this.sashItems.forEach(e=>e.disposable.dispose()),this.sashItems=[],super.dispose()}}const pb=class pb{constructor(e,t,i){this.columns=e,this.getColumnSize=i,this.templateId=pb.TemplateId,this.renderedTemplates=new Set;const n=new Map(t.map(s=>[s.templateId,s]));this.renderers=[];for(const s of e){const r=n.get(s.templateId);if(!r)throw new Error(`Table cell renderer for template id ${s.templateId} not found.`);this.renderers.push(r)}}renderTemplate(e){const t=K(e,Q(".monaco-table-tr")),i=[],n=[];for(let r=0;r<this.columns.length;r++){const a=this.renderers[r],c=K(t,Q(".monaco-table-td",{"data-col-index":r}));c.style.width=`${this.getColumnSize(r)}px`,i.push(c),n.push(a.renderTemplate(c))}const s={container:e,cellContainers:i,cellTemplateData:n};return this.renderedTemplates.add(s),s}renderElement(e,t,i,n){for(let s=0;s<this.columns.length;s++){const a=this.columns[s].project(e);this.renderers[s].renderElement(a,t,i.cellTemplateData[s],n)}}disposeElement(e,t,i,n){for(let s=0;s<this.columns.length;s++){const r=this.renderers[s];if(r.disposeElement){const c=this.columns[s].project(e);r.disposeElement(c,t,i.cellTemplateData[s],n)}}}disposeTemplate(e){for(let t=0;t<this.columns.length;t++)this.renderers[t].disposeTemplate(e.cellTemplateData[t]);On(e.container),this.renderedTemplates.delete(e)}layoutColumn(e,t){for(const{cellContainers:i}of this.renderedTemplates)i[e].style.width=`${t}px`}};pb.TemplateId="row";let Zp=pb;function rY(o){return{getHeight(e){return o.getHeight(e)},getTemplateId(){return Zp.TemplateId}}}class aY extends l.Disposable{get minimumSize(){return this.column.minimumWidth??120}get maximumSize(){return this.column.maximumWidth??Number.POSITIVE_INFINITY}get onDidChange(){return this.column.onDidChangeWidthConstraints??l.Event.None}constructor(e,t){super(),this.column=e,this.index=t,this._onDidLayout=this._register(new l.Emitter),this.onDidLayout=this._onDidLayout.event,this.element=Q(".monaco-table-th",{"data-col-index":t},e.label),e.tooltip&&this._register(En().setupManagedHover(Io("mouse"),this.element,e.tooltip))}layout(e){this._onDidLayout.fire([this.index,e])}}const _b=class _b{get onDidChangeFocus(){return this.list.onDidChangeFocus}get onDidChangeSelection(){return this.list.onDidChangeSelection}get onDidScroll(){return this.list.onDidScroll}get onMouseDblClick(){return this.list.onMouseDblClick}get onPointer(){return this.list.onPointer}get onDidFocus(){return this.list.onDidFocus}get scrollTop(){return this.list.scrollTop}set scrollTop(e){this.list.scrollTop=e}get scrollHeight(){return this.list.scrollHeight}get renderHeight(){return this.list.renderHeight}get onDidDispose(){return this.list.onDidDispose}constructor(e,t,i,n,s,r){this.virtualDelegate=i,this.columns=n,this.domId=`table_id_${++_b.InstanceCount}`,this.disposables=new l.DisposableStore,this.cachedWidth=0,this.cachedHeight=0,this.domNode=K(t,Q(`.monaco-table.${this.domId}`));const a=n.map((d,u)=>this.disposables.add(new aY(d,u))),c={size:a.reduce((d,u)=>d+u.column.weight,0),views:a.map(d=>({size:d.column.weight,view:d}))};this.splitview=this.disposables.add(new kM(this.domNode,{orientation:1,scrollbarVisibility:2,getSashOrthogonalSize:()=>this.cachedHeight,descriptor:c})),this.splitview.el.style.height=`${i.headerRowHeight}px`,this.splitview.el.style.lineHeight=`${i.headerRowHeight}px`;const h=new Zp(n,s,d=>this.splitview.getViewSize(d));this.list=this.disposables.add(new zn(e,this.domNode,rY(i),[h],r)),l.Event.any(...a.map(d=>d.onDidLayout))(([d,u])=>h.layoutColumn(d,u),null,this.disposables),this.splitview.onDidSashReset(d=>{const u=n.reduce((g,m)=>g+m.weight,0),f=n[d].weight/u*this.cachedWidth;this.splitview.resizeView(d,f)},null,this.disposables),this.styleElement=bn(this.domNode),this.style(X9)}updateOptions(e){this.list.updateOptions(e)}splice(e,t,i=[]){this.list.splice(e,t,i)}getHTMLElement(){return this.domNode}style(e){const t=[];t.push(`.monaco-table.${this.domId} > .monaco-split-view2 .monaco-sash.vertical::before {
|
||
top: ${this.virtualDelegate.headerRowHeight+1}px;
|
||
height: calc(100% - ${this.virtualDelegate.headerRowHeight}px);
|
||
}`),this.styleElement.textContent=t.join(`
|
||
`),this.list.style(e)}getSelectedElements(){return this.list.getSelectedElements()}getSelection(){return this.list.getSelection()}getFocus(){return this.list.getFocus()}dispose(){this.disposables.dispose()}};_b.InstanceCount=0;let eL=_b;const FM={inputActiveOptionBorder:"#007ACC00",inputActiveOptionForeground:"#FFFFFF",inputActiveOptionBackground:"#0E639C50"};class lY extends Vn{constructor(e,t,i){super(e,t,i);const n=this.options.keybinding?`${this._action.label} (${this.options.keybinding})`:this._action.label;this.toggle=this._register(new tl({actionClassName:this._action.class,isChecked:!!this._action.checked,title:n,notFocusable:!0,inputActiveOptionBackground:i.toggleStyles?.inputActiveOptionBackground,inputActiveOptionBorder:i.toggleStyles?.inputActiveOptionBorder,inputActiveOptionForeground:i.toggleStyles?.inputActiveOptionForeground})),this._register(this.toggle.onChange(()=>{this._action.checked=!!this.toggle&&this.toggle.checked}))}render(e){this.element=e,this.element.appendChild(this.toggle.domNode),this.updateChecked(),this.updateEnabled()}updateEnabled(){this.toggle&&(this.isEnabled()?(this.toggle.enable(),this.element?.classList.remove("disabled")):(this.toggle.disable(),this.element?.classList.add("disabled")))}updateChecked(){this.toggle.checked=!!this._action.checked}updateLabel(){const e=this.options.keybinding?`${this._action.label} (${this.options.keybinding})`:this._action.label;this.toggle.setTitle(e)}focus(){this.toggle.domNode.tabIndex=0,this.toggle.focus()}blur(){this.toggle.domNode.tabIndex=-1,this.toggle.domNode.blur()}setFocusable(e){this.toggle.domNode.tabIndex=e?0:-1}}class tl extends Wn{get onChange(){return this._onChange.event}get onKeyDown(){return this._onKeyDown.event}constructor(e){super(),this._onChange=this._register(new l.Emitter),this._onKeyDown=this._register(new l.Emitter),this._opts=e,this._title=this._opts.title,this._checked=this._opts.isChecked;const t=["monaco-custom-toggle"];this._opts.icon&&(this._icon=this._opts.icon,t.push(..._.ThemeIcon.asClassNameArray(this._icon))),this._opts.actionClassName&&t.push(...this._opts.actionClassName.split(" ")),this._checked&&t.push("checked"),this.domNode=document.createElement("div"),this._register(En().setupDelayedHover(this.domNode,()=>({content:!Do(this._title)&&!Ve(this._title)?sp(this._title):this._title,style:1}),this._opts.hoverLifecycleOptions)),this.domNode.classList.add(...t),this._opts.notFocusable||(this.domNode.tabIndex=0),this.domNode.setAttribute("role","checkbox"),this.domNode.setAttribute("aria-checked",String(this._checked)),this.setTitle(this._opts.title),this.applyStyles(),this.onclick(this.domNode,i=>{this.enabled&&(this.checked=!this._checked,this._onChange.fire(!1),i.preventDefault(),i.stopPropagation())}),this._register(this.ignoreGesture(this.domNode)),this.onkeydown(this.domNode,i=>{if(this.enabled){if(i.keyCode===10||i.keyCode===3){this.checked=!this._checked,this._onChange.fire(!0),i.preventDefault(),i.stopPropagation();return}this._onKeyDown.fire(i)}})}get enabled(){return this.domNode.getAttribute("aria-disabled")!=="true"}focus(){this.domNode.focus()}get checked(){return this._checked}set checked(e){this._checked=e,this.domNode.setAttribute("aria-checked",String(this._checked)),this.domNode.classList.toggle("checked",this._checked),this.applyStyles()}setIcon(e){this._icon&&this.domNode.classList.remove(..._.ThemeIcon.asClassNameArray(this._icon)),this._icon=e,this._icon&&this.domNode.classList.add(..._.ThemeIcon.asClassNameArray(this._icon))}width(){return 22}applyStyles(){this.domNode&&(this.domNode.style.borderColor=this._checked&&this._opts.inputActiveOptionBorder||"",this.domNode.style.color=this._checked&&this._opts.inputActiveOptionForeground||"inherit",this.domNode.style.backgroundColor=this._checked&&this._opts.inputActiveOptionBackground||"")}enable(){this.domNode.setAttribute("aria-disabled",String(!1)),this.domNode.classList.remove("disabled"),this._opts.notFocusable||(this.domNode.tabIndex=0)}disable(){this.domNode.setAttribute("aria-disabled",String(!0)),this.domNode.classList.add("disabled"),this._opts.notFocusable||(this.domNode.tabIndex=-1)}setTitle(e){this._title=e;const t=typeof e=="string"?e:Do(e)?e.value:e.textContent;this.domNode.setAttribute("aria-label",yS(t))}}const uD=class uD extends Wn{constructor(e,t,i){super(),this.checkbox=e,this.domNode=t,this.styles=i,this._onChange=this._register(new l.Emitter),this.onChange=this._onChange.event,this.applyStyles()}get enabled(){return this.checkbox.enabled}enable(){this.checkbox.enable(),this.applyStyles(!0)}disable(){this.checkbox.disable(),this.applyStyles(!1)}setTitle(e){this.checkbox.setTitle(e)}applyStyles(e=this.enabled){this.domNode.style.color=(e?this.styles.checkboxForeground:this.styles.checkboxDisabledForeground)||"",this.domNode.style.backgroundColor=(e?this.styles.checkboxBackground:this.styles.checkboxDisabledBackground)||"",this.domNode.style.borderColor=(e?this.styles.checkboxBorder:this.styles.checkboxDisabledBackground)||"";const t=this.styles.size||18;this.domNode.style.width=this.domNode.style.height=this.domNode.style.fontSize=`${t}px`,this.domNode.style.fontSize=`${t-2}px`}};uD.CLASS_NAME="monaco-checkbox";let Xu=uD;class tL extends Xu{constructor(e,t,i){const n=new tl({title:e,isChecked:t,icon:l.Codicon.check,actionClassName:Xu.CLASS_NAME,hoverLifecycleOptions:i.hoverLifecycleOptions,...FM});super(n,n.domNode,i),this._register(n),this._register(this.checkbox.onChange(s=>{this.applyStyles(),this._onChange.fire(s)}))}get checked(){return this.checkbox.checked}set checked(e){this.checkbox.checked=e,this.applyStyles()}applyStyles(e){this.checkbox.checked?this.checkbox.setIcon(l.Codicon.check):this.checkbox.setIcon(void 0),super.applyStyles(e)}}class BM extends Xu{constructor(e,t,i){let n;switch(t){case!0:n=l.Codicon.check;break;case"mixed":n=l.Codicon.dash;break;case!1:n=void 0;break}const s=new tl({title:e,isChecked:t===!0,icon:n,actionClassName:tL.CLASS_NAME,hoverLifecycleOptions:i.hoverLifecycleOptions,...FM});super(s,s.domNode,i),this._state=t,this._register(s),this._register(this.checkbox.onChange(r=>{this._state=this.checkbox.checked,this.applyStyles(),this._onChange.fire(r)}))}get checked(){return this._state}set checked(e){this._state!==e&&(this._state=e,this.checkbox.checked=e===!0,this.applyStyles())}applyStyles(e){switch(this._state){case!0:this.checkbox.setIcon(l.Codicon.check);break;case"mixed":this.checkbox.setIcon(l.Codicon.dash);break;case!1:this.checkbox.setIcon(void 0);break}super.applyStyles(e)}}function rh(o){return(e,t)=>{if(e.checked!==void 0)return new lY(null,e,{...t,toggleStyles:o})}}const cY=l.localize(2,"Match Case"),hY=l.localize(3,"Match Whole Word"),dY=l.localize(4,"Use Regular Expression");class zM extends tl{constructor(e){super({icon:l.Codicon.caseSensitive,title:cY+e.appendTitle,isChecked:e.isChecked,hoverLifecycleOptions:e.hoverLifecycleOptions,inputActiveOptionBorder:e.inputActiveOptionBorder,inputActiveOptionForeground:e.inputActiveOptionForeground,inputActiveOptionBackground:e.inputActiveOptionBackground})}}class VM extends tl{constructor(e){super({icon:l.Codicon.wholeWord,title:hY+e.appendTitle,isChecked:e.isChecked,hoverLifecycleOptions:e.hoverLifecycleOptions,inputActiveOptionBorder:e.inputActiveOptionBorder,inputActiveOptionForeground:e.inputActiveOptionForeground,inputActiveOptionBackground:e.inputActiveOptionBackground})}}class UM extends tl{constructor(e){super({icon:l.Codicon.regex,title:dY+e.appendTitle,isChecked:e.isChecked,hoverLifecycleOptions:e.hoverLifecycleOptions,inputActiveOptionBorder:e.inputActiveOptionBorder,inputActiveOptionForeground:e.inputActiveOptionForeground,inputActiveOptionBackground:e.inputActiveOptionBackground})}}function uY(o,e,t){const i=t??document.createElement("div");return i.textContent=o,i}function fY(o,e,t){const i=t??document.createElement("div");return i.textContent="",$M(i,mY(o),e?.actionHandler,e?.renderCodeSegments),i}class gY{constructor(e){this.source=e,this.index=0}eos(){return this.index>=this.source.length}next(){const e=this.peek();return this.advance(),e}peek(){return this.source[this.index]}advance(){this.index++}}function $M(o,e,t,i){let n;if(e.type===2)n=document.createTextNode(e.content||"");else if(e.type===3)n=document.createElement("b");else if(e.type===4)n=document.createElement("i");else if(e.type===7&&i)n=document.createElement("code");else if(e.type===5&&t){const s=document.createElement("a");t.disposables.add(At(s,"click",r=>{t.callback(String(e.index),r)})),n=s}else e.type===8?n=document.createElement("br"):e.type===1&&(n=o);n&&o!==n&&o.appendChild(n),n&&Array.isArray(e.children)&&e.children.forEach(s=>{$M(n,s,t,i)})}function mY(o,e){const t={type:1,children:[]};let i=0,n=t;const s=[],r=new gY(o);for(;!r.eos();){let a=r.next();const c=a==="\\"&&iL(r.peek())!==0;if(c&&(a=r.next()),!c&&pY(a)&&a===r.peek()){r.advance(),n.type===2&&(n=s.pop());const h=iL(a);if(n.type===h||n.type===5&&h===6)n=s.pop();else{const d={type:h,children:[]};h===5&&(d.index=i,i++),n.children.push(d),s.push(n),n=d}}else if(a===`
|
||
`)n.type===2&&(n=s.pop()),n.children.push({type:8});else if(n.type!==2){const h={type:2,content:a};n.children.push(h),s.push(n),n=h}else n.content+=a}return n.type===2&&(n=s.pop()),t}function pY(o,e){return iL(o)!==0}function iL(o,e){switch(o){case"*":return 3;case"_":return 4;case"[":return 5;case"]":return 6;case"`":return 0;default:return 0}}class _Y{constructor(e,t=0,i=e.length,n=t-1){this.items=e,this.start=t,this.end=i,this.index=n}current(){return this.index===this.start-1||this.index===this.end?null:this.items[this.index]}next(){return this.index=Math.min(this.index+1,this.end),this.current()}previous(){return this.index=Math.max(this.index-1,this.start-1),this.current()}first(){return this.index=this.start,this.current()}last(){return this.index=this.end-1,this.current()}}class bY{constructor(e=new Set,t=10){this._history=e,this._limit=t,this._onChange(),this._history.onDidChange&&(this._disposable=this._history.onDidChange(()=>this._onChange()))}getHistory(){return this._elements}add(e){this._history.delete(e),this._history.add(e),this._onChange()}next(){return this._navigator.next()}previous(){return this._currentPosition()!==0?this._navigator.previous():null}current(){return this._navigator.current()}first(){return this._navigator.first()}last(){return this._navigator.last()}isLast(){return this._currentPosition()>=this._elements.length-1}isNowhere(){return this._navigator.current()===null}has(e){return this._history.has(e)}_onChange(){this._reduceToLimit();const e=this._elements;this._navigator=new _Y(e,0,e.length,e.length)}_reduceToLimit(){const e=this._elements;if(e.length>this._limit){const t=e.slice(e.length-this._limit);this._history.replace?this._history.replace(t):this._history=new Set(t)}}_currentPosition(){const e=this._navigator.current();return e?this._elements.indexOf(e):-1}get _elements(){const e=[];return this._history.forEach(t=>e.push(t)),e}dispose(){this._disposable&&(this._disposable.dispose(),this._disposable=void 0)}}const ah=Q;let CY=class extends Wn{get onDidChange(){return this._onDidChange.event}get onDidHeightChange(){return this._onDidHeightChange.event}constructor(e,t,i){super(),this.state="idle",this.maxHeight=Number.POSITIVE_INFINITY,this.hover=this._register(new l.MutableDisposable),this._onDidChange=this._register(new l.Emitter),this._onDidHeightChange=this._register(new l.Emitter),this.contextViewProvider=t,this.options=i,this.message=null,this.placeholder=this.options.placeholder||"",this.tooltip=this.options.tooltip??(this.placeholder||""),this.ariaLabel=this.options.ariaLabel||"",this.options.validationOptions&&(this.validation=this.options.validationOptions.validation),this.element=K(e,ah(".monaco-inputbox.idle"));const n=this.options.flexibleHeight?"textarea":"input",s=K(this.element,ah(".ibwrapper"));if(this.input=K(s,ah(n+".input.empty")),this.input.setAttribute("autocorrect","off"),this.input.setAttribute("autocapitalize","off"),this.input.setAttribute("spellcheck","false"),this.onfocus(this.input,()=>this.element.classList.add("synthetic-focus")),this.onblur(this.input,()=>this.element.classList.remove("synthetic-focus")),this.options.flexibleHeight){this.maxHeight=typeof this.options.flexibleMaxHeight=="number"?this.options.flexibleMaxHeight:Number.POSITIVE_INFINITY,this.mirror=K(s,ah("div.mirror")),this.mirror.innerText=" ",this.scrollableElement=new uI(this.element,{vertical:1}),this.options.flexibleWidth&&(this.input.setAttribute("wrap","off"),this.mirror.style.whiteSpace="pre",this.mirror.style.wordWrap="initial"),K(e,this.scrollableElement.getDomNode()),this._register(this.scrollableElement),this._register(this.scrollableElement.onScroll(c=>this.input.scrollTop=c.scrollTop));const r=this._register(new Te(e.ownerDocument,"selectionchange")),a=l.Event.filter(r.event,()=>e.ownerDocument.getSelection()?.anchorNode===s);this._register(a(this.updateScrollDimensions,this)),this._register(this.onDidHeightChange(this.updateScrollDimensions,this))}else this.input.type=this.options.type||"text",this.input.setAttribute("wrap","off");this.ariaLabel&&this.input.setAttribute("aria-label",this.ariaLabel),this.placeholder&&!this.options.showPlaceholderOnFocus&&this.setPlaceHolder(this.placeholder),this.tooltip&&this.setTooltip(this.tooltip),this.oninput(this.input,()=>this.onValueChange()),this.onblur(this.input,()=>this.onBlur()),this.onfocus(this.input,()=>this.onFocus()),this._register(this.ignoreGesture(this.input)),setTimeout(()=>this.updateMirror(),0),this.options.actions&&(this.actionbar=this._register(new el(this.element,{actionViewItemProvider:this.options.actionViewItemProvider})),this.actionbar.push(this.options.actions,{icon:!0,label:!1})),this.applyStyles()}setActions(e,t){this.actionbar?(this.actionbar.clear(),e&&this.actionbar.push(e,{icon:!0,label:!1})):e&&(this.actionbar=this._register(new el(this.element,{actionViewItemProvider:t??this.options.actionViewItemProvider})),this.actionbar.push(e,{icon:!0,label:!1}))}get actionsWidth(){return this.actionbar?.getContainer().offsetWidth??0}onBlur(){this._hideMessage(),this.options.showPlaceholderOnFocus&&this.input.setAttribute("placeholder","")}onFocus(){this._showMessage(),this.options.showPlaceholderOnFocus&&this.input.setAttribute("placeholder",this.placeholder||"")}setPlaceHolder(e){this.placeholder=e,this.input.setAttribute("placeholder",e)}setTooltip(e){this.tooltip=e,this.hover.value||(this.hover.value=this._register(En().setupDelayedHoverAtMouse(this.input,()=>({content:this.tooltip,appearance:{compact:!0}}))))}setAriaLabel(e){this.ariaLabel=e,e?this.input.setAttribute("aria-label",this.ariaLabel):this.input.removeAttribute("aria-label")}get inputElement(){return this.input}get value(){return this.input.value}set value(e){this.input.value!==e&&(this.input.value=e,this.onValueChange())}get height(){return typeof this.cachedHeight=="number"?this.cachedHeight:qf(this.element)}focus(){this.input.focus()}blur(){this.input.blur()}hasFocus(){return sd(this.input)}select(e=null){this.input.select(),e&&(this.input.setSelectionRange(e.start,e.end),e.end===this.input.value.length&&(this.input.scrollLeft=this.input.scrollWidth))}isSelectionAtEnd(){return this.input.selectionEnd===this.input.value.length&&this.input.selectionStart===this.input.selectionEnd}getSelection(){const e=this.input.selectionStart;if(e===null)return null;const t=this.input.selectionEnd??e;return{start:e,end:t}}enable(){this.input.removeAttribute("disabled")}disable(){this.blur(),this.input.disabled=!0,this._hideMessage()}set paddingRight(e){this.input.style.width=`calc(100% - ${e}px)`,this.mirror&&(this.mirror.style.paddingRight=e+"px")}updateScrollDimensions(){if(typeof this.cachedContentHeight!="number"||typeof this.cachedHeight!="number"||!this.scrollableElement)return;const e=this.cachedContentHeight,t=this.cachedHeight,i=this.input.scrollTop;this.scrollableElement.setScrollDimensions({scrollHeight:e,height:t}),this.scrollableElement.setScrollPosition({scrollTop:i})}showMessage(e,t){if(this.state==="open"&&l.equals$1(this.message,e))return;this.message=e,this.element.classList.remove("idle"),this.element.classList.remove("info"),this.element.classList.remove("warning"),this.element.classList.remove("error"),this.element.classList.add(this.classForType(e.type));const i=this.stylesForType(this.message.type);this.element.style.border=`1px solid ${Eo(i.border,"transparent")}`,this.message.content&&(this.hasFocus()||t)&&this._showMessage()}hideMessage(){this.message=null,this.element.classList.remove("info"),this.element.classList.remove("warning"),this.element.classList.remove("error"),this.element.classList.add("idle"),this._hideMessage(),this.applyStyles()}validate(){let e=null;return this.validation&&(e=this.validation(this.value),e?(this.inputElement.setAttribute("aria-invalid","true"),this.showMessage(e)):this.inputElement.hasAttribute("aria-invalid")&&(this.inputElement.removeAttribute("aria-invalid"),this.hideMessage())),e?.type}stylesForType(e){const t=this.options.inputBoxStyles;switch(e){case 1:return{border:t.inputValidationInfoBorder,background:t.inputValidationInfoBackground,foreground:t.inputValidationInfoForeground};case 2:return{border:t.inputValidationWarningBorder,background:t.inputValidationWarningBackground,foreground:t.inputValidationWarningForeground};default:return{border:t.inputValidationErrorBorder,background:t.inputValidationErrorBackground,foreground:t.inputValidationErrorForeground}}}classForType(e){switch(e){case 1:return"info";case 2:return"warning";default:return"error"}}_showMessage(){if(!this.contextViewProvider||!this.message)return;let e;const t=()=>e.style.width=jf(this.element)+"px";this.contextViewProvider.showContextView({getAnchor:()=>this.element,anchorAlignment:1,render:n=>{if(!this.message)return null;e=K(n,ah(".monaco-inputbox-container")),t();const s=ah("span.monaco-inputbox-message");this.message.formatContent?fY(this.message.content,void 0,s):uY(this.message.content,void 0,s),s.classList.add(this.classForType(this.message.type));const r=this.stylesForType(this.message.type);return s.style.backgroundColor=r.background??"",s.style.color=r.foreground??"",s.style.border=r.border?`1px solid ${r.border}`:"",K(e,s),null},onHide:()=>{this.state="closed"},layout:t});let i;this.message.type===3?i=l.localize(9,"Error: {0}",this.message.content):this.message.type===2?i=l.localize(10,"Warning: {0}",this.message.content):i=l.localize(11,"Info: {0}",this.message.content),ha(i),this.state="open"}_hideMessage(){this.contextViewProvider&&(this.state==="open"&&this.contextViewProvider.hideContextView(),this.state="idle")}layoutMessage(){this.state==="open"&&this.contextViewProvider&&this.contextViewProvider.layout()}onValueChange(){this._onDidChange.fire(this.value),this.validate(),this.updateMirror(),this.input.classList.toggle("empty",!this.value),this.state==="open"&&this.contextViewProvider&&this.contextViewProvider.layout(),this.options.hideHoverOnValueChange&&En().hideHover()}updateMirror(){if(!this.mirror)return;const e=this.value,i=e.charCodeAt(e.length-1)===10?" ":"";(e+i).replace(/\u000c/g,"")?this.mirror.textContent=e+i:this.mirror.innerText=" ",this.layout()}applyStyles(){const e=this.options.inputBoxStyles,t=e.inputBackground??"",i=e.inputForeground??"",n=e.inputBorder??"";this.element.style.backgroundColor=t,this.element.style.color=i,this.input.style.backgroundColor="inherit",this.input.style.color=i,this.element.style.border=`1px solid ${Eo(n,"transparent")}`}layout(){if(!this.mirror){this.layoutMessage();return}const e=this.cachedContentHeight;this.cachedContentHeight=qf(this.mirror),e!==this.cachedContentHeight&&(this.cachedHeight=Math.min(this.cachedContentHeight,this.maxHeight),this.input.style.height=this.cachedHeight+"px",this._onDidHeightChange.fire(this.cachedContentHeight)),this.layoutMessage()}insertAtCursor(e){const t=this.inputElement,i=t.selectionStart,n=t.selectionEnd,s=t.value;i!==null&&n!==null&&(this.value=s.substr(0,i)+e+s.substr(n),t.setSelectionRange(i+1,i+1),this.layout())}dispose(){this._hideMessage(),this.message=null,this.actionbar?.dispose(),super.dispose()}};class KM extends CY{constructor(e,t,i){const n=l.localize(12," or {0} for history","⇅"),s=l.localize(13," ({0} for history)","⇅");super(e,t,i),this._onDidFocus=this._register(new l.Emitter),this.onDidFocus=this._onDidFocus.event,this._onDidBlur=this._register(new l.Emitter),this.onDidBlur=this._onDidBlur.event,this.history=this._register(new bY(i.history,100));const r=()=>{if(i.showHistoryHint&&i.showHistoryHint()&&!this.placeholder.endsWith(n)&&!this.placeholder.endsWith(s)&&this.history.getHistory().length){const a=this.placeholder.endsWith(")")?n:s,c=this.placeholder+a;i.showPlaceholderOnFocus&&!sd(this.input)?this.placeholder=c:this.setPlaceHolder(c)}};this.observer=new MutationObserver((a,c)=>{a.forEach(h=>{h.target.textContent||r()})}),this.observer.observe(this.input,{attributeFilter:["class"]}),this.onfocus(this.input,()=>r()),this.onblur(this.input,()=>{const a=c=>{if(this.placeholder.endsWith(c)){const h=this.placeholder.slice(0,this.placeholder.length-c.length);return i.showPlaceholderOnFocus?this.placeholder=h:this.setPlaceHolder(h),!0}else return!1};a(s)||a(n)})}dispose(){super.dispose(),this.observer&&(this.observer.disconnect(),this.observer=void 0)}addToHistory(e){this.value&&(e||this.value!==this.getCurrentValue())&&this.history.add(this.value)}isAtLastInHistory(){return this.history.isLast()}isNowhereInHistory(){return this.history.isNowhere()}showNextValue(){this.history.has(this.value)||this.addToHistory();let e=this.getNextValue();e&&(e=e===this.value?this.getNextValue():e),this.value=e??"",yd(this.value?this.value:l.localize(14,"Cleared Input"))}showPreviousValue(){this.history.has(this.value)||this.addToHistory();let e=this.getPreviousValue();e&&(e=e===this.value?this.getPreviousValue():e),e&&(this.value=e,yd(this.value))}setPlaceHolder(e){super.setPlaceHolder(e),this.setTooltip(e)}onBlur(){super.onBlur(),this._onDidBlur.fire()}onFocus(){super.onFocus(),this._onDidFocus.fire()}getCurrentValue(){let e=this.history.current();return e||(e=this.history.last(),this.history.next()),e}getPreviousValue(){return this.history.previous()||this.history.first()}getNextValue(){return this.history.next()}}const vY=l.localize(1,"input");class GM extends Wn{get onDidOptionChange(){return this._onDidOptionChange.event}get onKeyDown(){return this._onKeyDown.event}get onMouseDown(){return this._onMouseDown.event}get onCaseSensitiveKeyDown(){return this._onCaseSensitiveKeyDown.event}get onRegexKeyDown(){return this._onRegexKeyDown.event}constructor(e,t,i){super(),this.fixFocusOnOptionClickEnabled=!0,this.imeSessionInProgress=!1,this.additionalTogglesDisposables=this._register(new l.MutableDisposable),this.additionalToggles=[],this._onDidOptionChange=this._register(new l.Emitter),this._onKeyDown=this._register(new l.Emitter),this._onMouseDown=this._register(new l.Emitter),this._onInput=this._register(new l.Emitter),this._onKeyUp=this._register(new l.Emitter),this._onCaseSensitiveKeyDown=this._register(new l.Emitter),this._onRegexKeyDown=this._register(new l.Emitter),this._lastHighlightFindOptions=0,this.placeholder=i.placeholder||"",this.validation=i.validation,this.label=i.label||vY,this.showCommonFindToggles=!!i.showCommonFindToggles;const n=i.appendCaseSensitiveLabel||"",s=i.appendWholeWordsLabel||"",r=i.appendRegexLabel||"",a=!!i.flexibleHeight,c=!!i.flexibleWidth,h=i.flexibleMaxHeight;if(this.domNode=document.createElement("div"),this.domNode.classList.add("monaco-findInput"),this.inputBox=this._register(new KM(this.domNode,t,{placeholder:this.placeholder||"",ariaLabel:this.label||"",validationOptions:{validation:this.validation},showHistoryHint:i.showHistoryHint,flexibleHeight:a,flexibleWidth:c,flexibleMaxHeight:h,inputBoxStyles:i.inputBoxStyles,history:i.history,actions:i.actions,actionViewItemProvider:i.actionViewItemProvider,hideHoverOnValueChange:i.hideHoverOnValueChange})),this.showCommonFindToggles){const d=i?.hoverLifecycleOptions||{groupId:"find-input"};this.regex=this._register(new UM({appendTitle:r,isChecked:!1,hoverLifecycleOptions:d,...i.toggleStyles})),this._register(this.regex.onChange(u=>{this._onDidOptionChange.fire(u),!u&&this.fixFocusOnOptionClickEnabled&&this.inputBox.focus(),this.validate()})),this._register(this.regex.onKeyDown(u=>{this._onRegexKeyDown.fire(u)})),this.wholeWords=this._register(new VM({appendTitle:s,isChecked:!1,hoverLifecycleOptions:d,...i.toggleStyles})),this._register(this.wholeWords.onChange(u=>{this._onDidOptionChange.fire(u),!u&&this.fixFocusOnOptionClickEnabled&&this.inputBox.focus(),this.validate()})),this.caseSensitive=this._register(new zM({appendTitle:n,isChecked:!1,hoverLifecycleOptions:d,...i.toggleStyles})),this._register(this.caseSensitive.onChange(u=>{this._onDidOptionChange.fire(u),!u&&this.fixFocusOnOptionClickEnabled&&this.inputBox.focus(),this.validate()})),this._register(this.caseSensitive.onKeyDown(u=>{this._onCaseSensitiveKeyDown.fire(u)})),this.onkeydown(this.domNode,u=>{if(u.equals(15)||u.equals(17)||u.equals(9)){const f=this.getToggleDomNodes(),g=f.indexOf(this.domNode.ownerDocument.activeElement);if(g>=0){let m=-1;u.equals(17)?m=(g+1)%f.length:u.equals(15)&&(g===0?m=f.length-1:m=g-1),u.equals(9)?(f[g].blur(),this.inputBox.focus()):m>=0&&f[m].focus(),ve.stop(u,!0)}}})}this.controls=document.createElement("div"),this.controls.className="controls",this.controls.style.display=this.showCommonFindToggles?"":"none",this.caseSensitive&&this.controls.append(this.caseSensitive.domNode),this.wholeWords&&this.controls.appendChild(this.wholeWords.domNode),this.regex&&this.controls.appendChild(this.regex.domNode),this.setAdditionalToggles(i?.additionalToggles),this.controls&&this.domNode.appendChild(this.controls),e?.appendChild(this.domNode),this._register(R(this.inputBox.inputElement,"compositionstart",d=>{this.imeSessionInProgress=!0})),this._register(R(this.inputBox.inputElement,"compositionend",d=>{this.imeSessionInProgress=!1,this._onInput.fire()})),this.onkeydown(this.inputBox.inputElement,d=>this._onKeyDown.fire(d)),this.onkeyup(this.inputBox.inputElement,d=>this._onKeyUp.fire(d)),this.oninput(this.inputBox.inputElement,d=>this._onInput.fire()),this.onmousedown(this.inputBox.inputElement,d=>this._onMouseDown.fire(d))}get onDidChange(){return this.inputBox.onDidChange}layout(e){this.inputBox.layout(),this.updateInputBoxPadding(e.collapsedFindWidget)}enable(){this.domNode.classList.remove("disabled"),this.inputBox.enable(),this.regex?.enable(),this.wholeWords?.enable(),this.caseSensitive?.enable();for(const e of this.additionalToggles)e.enable()}disable(){this.domNode.classList.add("disabled"),this.inputBox.disable(),this.regex?.disable(),this.wholeWords?.disable(),this.caseSensitive?.disable();for(const e of this.additionalToggles)e.disable()}setFocusInputOnOptionClick(e){this.fixFocusOnOptionClickEnabled=e}setEnabled(e){e?this.enable():this.disable()}setAdditionalToggles(e){for(const t of this.additionalToggles)t.domNode.remove();this.additionalToggles=[],this.additionalTogglesDisposables.value=new l.DisposableStore;for(const t of e??[])this.additionalTogglesDisposables.value.add(t),this.controls.appendChild(t.domNode),this.additionalTogglesDisposables.value.add(t.onChange(i=>{this._onDidOptionChange.fire(i),!i&&this.fixFocusOnOptionClickEnabled&&this.inputBox.focus()})),this.additionalToggles.push(t);this.additionalToggles.length>0&&(this.controls.style.display=""),this.updateInputBoxPadding()}getToggleDomNodes(){const e=[];this.caseSensitive&&e.push(this.caseSensitive.domNode),this.wholeWords&&e.push(this.wholeWords.domNode),this.regex&&e.push(this.regex.domNode);for(const t of this.additionalToggles)e.push(t.domNode);return e}setActions(e,t){this.inputBox.setActions(e,t),this.updateInputBoxPadding()}updateInputBoxPadding(e=!1){const t=e?0:(this.caseSensitive?.width()??0)+(this.wholeWords?.width()??0)+(this.regex?.width()??0)+this.additionalToggles.reduce((i,n)=>i+n.width(),0);this.inputBox.paddingRight=t+this.inputBox.actionsWidth}getValue(){return this.inputBox.value}setValue(e){this.inputBox.value!==e&&(this.inputBox.value=e)}select(){this.inputBox.select()}focus(){this.inputBox.focus()}getCaseSensitive(){return this.caseSensitive?.checked??!1}setCaseSensitive(e){this.caseSensitive&&(this.caseSensitive.checked=e)}getWholeWords(){return this.wholeWords?.checked??!1}setWholeWords(e){this.wholeWords&&(this.wholeWords.checked=e)}getRegex(){return this.regex?.checked??!1}setRegex(e){this.regex&&(this.regex.checked=e,this.validate())}focusOnCaseSensitive(){this.caseSensitive?.focus()}highlightFindOptions(){this.domNode.classList.remove("highlight-"+this._lastHighlightFindOptions),this._lastHighlightFindOptions=1-this._lastHighlightFindOptions,this.domNode.classList.add("highlight-"+this._lastHighlightFindOptions)}validate(){this.inputBox.validate()}showMessage(e){this.inputBox.showMessage(e)}clearMessage(){this.inputBox.hideMessage()}}var ki;(function(o){o[o.Expanded=0]="Expanded",o[o.Collapsed=1]="Collapsed",o[o.PreserveOrExpanded=2]="PreserveOrExpanded",o[o.PreserveOrCollapsed=3]="PreserveOrCollapsed"})(ki||(ki={}));var il;(function(o){o[o.Unknown=0]="Unknown",o[o.Twistie=1]="Twistie",o[o.Element=2]="Element",o[o.Filter=3]="Filter"})(il||(il={}));class rn extends Error{constructor(e,t){super(`TreeError [${e}] ${t}`)}}class nL{constructor(e){this.fn=e,this._map=new WeakMap}map(e){let t=this._map.get(e);return t||(t=this.fn(e),this._map.set(e,t)),t}}function Ju(o){return!!o&&o.visibility!==void 0}function nl(o){switch(o){case!0:return 1;case!1:return 0;default:return o}}function sL(o){return"collapsible"in o}class wY{constructor(e,t,i={}){this.user=e,this.rootRef=[],this.eventBufferer=new l.EventBufferer,this._onDidSpliceModel=new l.Emitter,this.onDidSpliceModel=this._onDidSpliceModel.event,this._onDidSpliceRenderedNodes=new l.Emitter,this.onDidSpliceRenderedNodes=this._onDidSpliceRenderedNodes.event,this._onDidChangeCollapseState=new l.Emitter,this.onDidChangeCollapseState=this.eventBufferer.wrapEvent(this._onDidChangeCollapseState.event),this._onDidChangeRenderNodeCount=new l.Emitter,this.onDidChangeRenderNodeCount=this.eventBufferer.wrapEvent(this._onDidChangeRenderNodeCount.event),this.refilterDelayer=new l.Delayer(l.MicrotaskDelay),this.collapseByDefault=typeof i.collapseByDefault>"u"?!1:i.collapseByDefault,this.allowNonCollapsibleParents=i.allowNonCollapsibleParents??!1,this.filter=i.filter,this.autoExpandSingleChildren=typeof i.autoExpandSingleChildren>"u"?!1:i.autoExpandSingleChildren,this.root={parent:void 0,element:t,children:[],depth:0,visibleChildrenCount:0,visibleChildIndex:-1,collapsible:!1,collapsed:!1,renderNodeCount:0,visibility:1,visible:!0,filterData:void 0}}splice(e,t,i=l.Iterable.empty(),n={}){if(e.length===0)throw new rn(this.user,"Invalid tree location");n.diffIdentityProvider?this.spliceSmart(n.diffIdentityProvider,e,t,i,n):this.spliceSimple(e,t,i,n)}spliceSmart(e,t,i,n=l.Iterable.empty(),s,r=s.diffDepth??0){const{parentNode:a}=this.getParentNodeWithListIndex(t);if(!a.lastDiffIds)return this.spliceSimple(t,i,n,s);const c=[...n],h=t[t.length-1],d=new l.LcsDiff({getElements:()=>a.lastDiffIds},{getElements:()=>[...a.children.slice(0,h),...c,...a.children.slice(h+i)].map(p=>e.getId(p.element).toString())}).ComputeDiff(!1);if(d.quitEarly)return a.lastDiffIds=void 0,this.spliceSimple(t,i,c,s);const u=t.slice(0,-1),f=(p,b,v)=>{if(r>0)for(let C=0;C<v;C++)p--,b--,this.spliceSmart(e,[...u,p,0],Number.MAX_SAFE_INTEGER,c[b].children,s,r-1)};let g=Math.min(a.children.length,h+i),m=c.length;for(const p of d.changes.sort((b,v)=>v.originalStart-b.originalStart))f(g,m,g-(p.originalStart+p.originalLength)),g=p.originalStart,m=p.modifiedStart-h,this.spliceSimple([...u,g],p.originalLength,l.Iterable.slice(c,m,m+p.modifiedLength),s);f(g,m,g)}spliceSimple(e,t,i=l.Iterable.empty(),{onDidCreateNode:n,onDidDeleteNode:s,diffIdentityProvider:r}){const{parentNode:a,listIndex:c,revealed:h,visible:d}=this.getParentNodeWithListIndex(e),u=[],f=l.Iterable.map(i,L=>this.createTreeNode(L,a,a.visible?1:0,h,u,n)),g=e[e.length-1];let m=0;for(let L=g;L>=0&&L<a.children.length;L--){const D=a.children[L];if(D.visible){m=D.visibleChildIndex;break}}const p=[];let b=0,v=0;for(const L of f)p.push(L),v+=L.renderNodeCount,L.visible&&(L.visibleChildIndex=m+b++);const C=l.splice(a.children,g,t,p);r?a.lastDiffIds?l.splice(a.lastDiffIds,g,t,p.map(L=>r.getId(L.element).toString())):a.lastDiffIds=a.children.map(L=>r.getId(L.element).toString()):a.lastDiffIds=void 0;let w=0;for(const L of C)L.visible&&w++;if(w!==0)for(let L=g+p.length;L<a.children.length;L++){const D=a.children[L];D.visible&&(D.visibleChildIndex-=w)}if(a.visibleChildrenCount+=b-w,C.length>0&&s){const L=D=>{s(D),D.children.forEach(L)};C.forEach(L)}if(h&&d){const L=C.reduce((D,x)=>D+(x.visible?x.renderNodeCount:0),0);this._updateAncestorsRenderNodeCount(a,v-L),this._onDidSpliceRenderedNodes.fire({start:c,deleteCount:L,elements:u})}this._onDidSpliceModel.fire({insertedNodes:p,deletedNodes:C});let S=a;for(;S;){if(S.visibility===2){this.refilterDelayer.trigger(()=>this.refilter());break}S=S.parent}}rerender(e){if(e.length===0)throw new rn(this.user,"Invalid tree location");const{node:t,listIndex:i,revealed:n}=this.getTreeNodeWithListIndex(e);t.visible&&n&&this._onDidSpliceRenderedNodes.fire({start:i,deleteCount:1,elements:[t]})}has(e){return this.hasTreeNode(e)}getListIndex(e){const{listIndex:t,visible:i,revealed:n}=this.getTreeNodeWithListIndex(e);return i&&n?t:-1}getListRenderCount(e){return this.getTreeNode(e).renderNodeCount}isCollapsible(e){return this.getTreeNode(e).collapsible}setCollapsible(e,t){const i=this.getTreeNode(e);typeof t>"u"&&(t=!i.collapsible);const n={collapsible:t};return this.eventBufferer.bufferEvents(()=>this._setCollapseState(e,n))}isCollapsed(e){return this.getTreeNode(e).collapsed}setCollapsed(e,t,i){const n=this.getTreeNode(e);typeof t>"u"&&(t=!n.collapsed);const s={collapsed:t,recursive:i||!1};return this.eventBufferer.bufferEvents(()=>this._setCollapseState(e,s))}_setCollapseState(e,t){const{node:i,listIndex:n,revealed:s}=this.getTreeNodeWithListIndex(e),r=this._setListNodeCollapseState(i,n,s,t);if(i!==this.root&&this.autoExpandSingleChildren&&r&&!sL(t)&&i.collapsible&&!i.collapsed&&!t.recursive){let a=-1;for(let c=0;c<i.children.length;c++)if(i.children[c].visible)if(a>-1){a=-1;break}else a=c;a>-1&&this._setCollapseState([...e,a],t)}return r}_setListNodeCollapseState(e,t,i,n){const s=this._setNodeCollapseState(e,n,!1);if(!i||!e.visible||!s)return s;const r=e.renderNodeCount,a=this.updateNodeAfterCollapseChange(e),c=r-(t===-1?0:1);return this._onDidSpliceRenderedNodes.fire({start:t+1,deleteCount:c,elements:a.slice(1)}),s}_setNodeCollapseState(e,t,i){let n;if(e===this.root?n=!1:(sL(t)?(n=e.collapsible!==t.collapsible,e.collapsible=t.collapsible):e.collapsible?(n=e.collapsed!==t.collapsed,e.collapsed=t.collapsed):n=!1,n&&this._onDidChangeCollapseState.fire({node:e,deep:i})),!sL(t)&&t.recursive)for(const s of e.children)n=this._setNodeCollapseState(s,t,!0)||n;return n}expandTo(e){this.eventBufferer.bufferEvents(()=>{let t=this.getTreeNode(e);for(;t.parent;)t=t.parent,e=e.slice(0,e.length-1),t.collapsed&&this._setCollapseState(e,{collapsed:!1,recursive:!1})})}refilter(){const e=this.root.renderNodeCount,t=this.updateNodeAfterFilterChange(this.root);this._onDidSpliceRenderedNodes.fire({start:0,deleteCount:e,elements:t}),this.refilterDelayer.cancel()}createTreeNode(e,t,i,n,s,r){const a={parent:t,element:e.element,children:[],depth:t.depth+1,visibleChildrenCount:0,visibleChildIndex:-1,collapsible:typeof e.collapsible=="boolean"?e.collapsible:typeof e.collapsed<"u",collapsed:typeof e.collapsed>"u"?this.collapseByDefault:e.collapsed,renderNodeCount:1,visibility:1,visible:!0,filterData:void 0},c=this._filterNode(a,i);a.visibility=c,n&&s.push(a);const h=e.children||l.Iterable.empty(),d=n&&c!==0&&!a.collapsed;let u=0,f=1;for(const g of h){const m=this.createTreeNode(g,a,c,d,s,r);a.children.push(m),f+=m.renderNodeCount,m.visible&&(m.visibleChildIndex=u++)}return this.allowNonCollapsibleParents||(a.collapsible=a.collapsible||a.children.length>0),a.visibleChildrenCount=u,a.visible=c===2?u>0:c===1,a.visible?a.collapsed||(a.renderNodeCount=f):(a.renderNodeCount=0,n&&s.pop()),r?.(a),a}updateNodeAfterCollapseChange(e){const t=e.renderNodeCount,i=[];return this._updateNodeAfterCollapseChange(e,i),this._updateAncestorsRenderNodeCount(e.parent,i.length-t),i}_updateNodeAfterCollapseChange(e,t){if(e.visible===!1)return 0;if(t.push(e),e.renderNodeCount=1,!e.collapsed)for(const i of e.children)e.renderNodeCount+=this._updateNodeAfterCollapseChange(i,t);return this._onDidChangeRenderNodeCount.fire(e),e.renderNodeCount}updateNodeAfterFilterChange(e){const t=e.renderNodeCount,i=[];return this._updateNodeAfterFilterChange(e,e.visible?1:0,i),this._updateAncestorsRenderNodeCount(e.parent,i.length-t),i}_updateNodeAfterFilterChange(e,t,i,n=!0){let s;if(e!==this.root){if(s=this._filterNode(e,t),s===0)return e.visible=!1,e.renderNodeCount=0,!1;n&&i.push(e)}const r=i.length;e.renderNodeCount=e===this.root?0:1;let a=!1;if(!e.collapsed||s!==0){let c=0;for(const h of e.children)a=this._updateNodeAfterFilterChange(h,s,i,n&&!e.collapsed)||a,h.visible&&(h.visibleChildIndex=c++);e.visibleChildrenCount=c}else e.visibleChildrenCount=0;return e!==this.root&&(e.visible=s===2?a:s===1,e.visibility=s),e.visible?e.collapsed||(e.renderNodeCount+=i.length-r):(e.renderNodeCount=0,n&&i.pop()),this._onDidChangeRenderNodeCount.fire(e),e.visible}_updateAncestorsRenderNodeCount(e,t){if(t!==0)for(;e;)e.renderNodeCount+=t,this._onDidChangeRenderNodeCount.fire(e),e=e.parent}_filterNode(e,t){const i=this.filter?this.filter.filter(e.element,t):1;return typeof i=="boolean"?(e.filterData=void 0,i?1:0):Ju(i)?(e.filterData=i.data,nl(i.visibility)):(e.filterData=void 0,nl(i))}hasTreeNode(e,t=this.root){if(!e||e.length===0)return!0;const[i,...n]=e;return i<0||i>t.children.length?!1:this.hasTreeNode(n,t.children[i])}getTreeNode(e,t=this.root){if(!e||e.length===0)return t;const[i,...n]=e;if(i<0||i>t.children.length)throw new rn(this.user,"Invalid tree location");return this.getTreeNode(n,t.children[i])}getTreeNodeWithListIndex(e){if(e.length===0)return{node:this.root,listIndex:-1,revealed:!0,visible:!1};const{parentNode:t,listIndex:i,revealed:n,visible:s}=this.getParentNodeWithListIndex(e),r=e[e.length-1];if(r<0||r>t.children.length)throw new rn(this.user,"Invalid tree location");const a=t.children[r];return{node:a,listIndex:i,revealed:n,visible:s&&a.visible}}getParentNodeWithListIndex(e,t=this.root,i=0,n=!0,s=!0){const[r,...a]=e;if(r<0||r>t.children.length)throw new rn(this.user,"Invalid tree location");for(let c=0;c<r;c++)i+=t.children[c].renderNodeCount;return n=n&&!t.collapsed,s=s&&t.visible,a.length===0?{parentNode:t,listIndex:i,revealed:n,visible:s}:this.getParentNodeWithListIndex(a,t.children[r],i+1,n,s)}getNode(e=[]){return this.getTreeNode(e)}getNodeLocation(e){const t=[];let i=e;for(;i.parent;)t.push(i.parent.children.indexOf(i)),i=i.parent;return t.reverse()}getParentNodeLocation(e){if(e.length!==0)return e.length===1?[]:l.tail(e)[0]}getFirstElementChild(e){const t=this.getTreeNode(e);if(t.children.length!==0)return t.children[0].element}}class SY extends $u{constructor(e){super(e.elements.map(t=>t.element)),this.data=e}}function oL(o){return o instanceof $u?new SY(o):o}class yY{constructor(e,t){this.modelProvider=e,this.dnd=t,this.autoExpandDisposable=l.Disposable.None,this.disposables=new l.DisposableStore}getDragURI(e){return this.dnd.getDragURI(e.element)}getDragLabel(e,t){if(this.dnd.getDragLabel)return this.dnd.getDragLabel(e.map(i=>i.element),t)}onDragStart(e,t){this.dnd.onDragStart?.(oL(e),t)}onDragOver(e,t,i,n,s,r=!0){const a=this.dnd.onDragOver(oL(e),t&&t.element,i,n,s),c=this.autoExpandNode!==t;if(c&&(this.autoExpandDisposable.dispose(),this.autoExpandNode=t),typeof t>"u")return a;if(c&&typeof a!="boolean"&&a.autoExpand&&(this.autoExpandDisposable=l.disposableTimeout(()=>{const g=this.modelProvider(),m=g.getNodeLocation(t);g.isCollapsed(m)&&g.setCollapsed(m,!1),this.autoExpandNode=void 0},500,this.disposables)),typeof a=="boolean"||!a.accept||typeof a.bubble>"u"||a.feedback){if(!r){const g=typeof a=="boolean"?a:a.accept,m=typeof a=="boolean"?void 0:a.effect;return{accept:g,effect:m,feedback:[i]}}return a}if(a.bubble===1){const g=this.modelProvider(),m=g.getNodeLocation(t),p=g.getParentNodeLocation(m),b=g.getNode(p),v=p&&g.getListIndex(p);return this.onDragOver(e,b,v,n,s,!1)}const h=this.modelProvider(),d=h.getNodeLocation(t),u=h.getListIndex(d),f=h.getListRenderCount(d);return{...a,feedback:l.range(u,u+f)}}drop(e,t,i,n,s){this.autoExpandDisposable.dispose(),this.autoExpandNode=void 0,this.dnd.drop(oL(e),t&&t.element,i,n,s)}onDragEnd(e){this.dnd.onDragEnd?.(e)}dispose(){this.disposables.dispose(),this.dnd.dispose()}}function LY(o,e,t){return t&&{...t,identityProvider:t.identityProvider&&{getId(i){return t.identityProvider.getId(i.element)},getGroupId:t.identityProvider.getGroupId?i=>t.identityProvider.getGroupId(i.element):void 0},dnd:t.dnd&&e.add(new yY(o,t.dnd)),multipleSelectionController:t.multipleSelectionController&&{isSelectionSingleChangeEvent(i){return t.multipleSelectionController.isSelectionSingleChangeEvent({...i,element:i.element})},isSelectionRangeChangeEvent(i){return t.multipleSelectionController.isSelectionRangeChangeEvent({...i,element:i.element})}},accessibilityProvider:t.accessibilityProvider&&{...t.accessibilityProvider,getSetSize(i){const n=o(),s=n.getNodeLocation(i),r=n.getParentNodeLocation(s);return n.getNode(r).visibleChildrenCount},getPosInSet(i){return i.visibleChildIndex+1},isChecked:t.accessibilityProvider&&t.accessibilityProvider.isChecked?i=>t.accessibilityProvider.isChecked(i.element):void 0,getRole:t.accessibilityProvider&&t.accessibilityProvider.getRole?i=>t.accessibilityProvider.getRole(i.element):()=>"treeitem",getAriaLabel(i){return t.accessibilityProvider.getAriaLabel(i.element)},getWidgetAriaLabel(){return t.accessibilityProvider.getWidgetAriaLabel()},getWidgetRole:t.accessibilityProvider&&t.accessibilityProvider.getWidgetRole?()=>t.accessibilityProvider.getWidgetRole():()=>"tree",getAriaLevel:t.accessibilityProvider&&t.accessibilityProvider.getAriaLevel?i=>t.accessibilityProvider.getAriaLevel(i.element):i=>i.depth,getActiveDescendantId:t.accessibilityProvider.getActiveDescendantId&&(i=>t.accessibilityProvider.getActiveDescendantId(i.element))},keyboardNavigationLabelProvider:t.keyboardNavigationLabelProvider&&{...t.keyboardNavigationLabelProvider,getKeyboardNavigationLabel(i){return t.keyboardNavigationLabelProvider.getKeyboardNavigationLabel(i.element)}}}}class rL{constructor(e){this.delegate=e}getHeight(e){return this.delegate.getHeight(e.element)}getTemplateId(e){return this.delegate.getTemplateId(e.element)}hasDynamicHeight(e){return!!this.delegate.hasDynamicHeight&&this.delegate.hasDynamicHeight(e.element)}setDynamicHeight(e,t){this.delegate.setDynamicHeight?.(e.element,t)}}var sl;(function(o){o.None="none",o.OnHover="onHover",o.Always="always"})(sl||(sl={}));class DY{get elements(){return this._elements}constructor(e,t=[]){this._elements=t,this.disposables=new l.DisposableStore,this.onDidChange=l.Event.forEach(e,i=>this._elements=i,this.disposables)}dispose(){this.disposables.dispose()}}const Sf=class Sf{constructor(e,t,i,n,s,r={}){this.renderer=e,this.model=t,this.activeNodes=n,this.renderedIndentGuides=s,this.renderedElements=new Map,this.renderedNodes=new Map,this.indent=Sf.DefaultIndent,this.defaultIndent=Sf.DefaultIndent,this.hideTwistiesOfChildlessElements=!1,this.shouldRenderIndentGuides=!1,this.activeIndentNodes=new Set,this.indentGuidesDisposable=l.Disposable.None,this.disposables=new l.DisposableStore,this.templateId=e.templateId,this.updateOptions(r),l.Event.map(i,a=>a.node)(this.onDidChangeNodeTwistieState,this,this.disposables),e.onDidChangeTwistieState?.(this.onDidChangeTwistieState,this,this.disposables)}updateOptions(e={}){if(typeof e.defaultIndent<"u"&&(this.defaultIndent=e.defaultIndent),typeof e.indent<"u"||typeof e.defaultIndent<"u"){const t=typeof e.indent<"u"?wi(e.indent,0,40):this.indent;if(t!==this.indent||typeof e.defaultIndent<"u"){this.indent=t;for(const[n,s]of this.renderedNodes)s.indentSize=this.defaultIndent+(n.depth-1)*this.indent,this.renderTreeElement(n,s)}}if(typeof e.renderIndentGuides<"u"){const t=e.renderIndentGuides!==sl.None;if(t!==this.shouldRenderIndentGuides){this.shouldRenderIndentGuides=t;for(const[i,n]of this.renderedNodes)this._renderIndentGuides(i,n);if(this.indentGuidesDisposable.dispose(),t){const i=new l.DisposableStore;this.activeNodes.onDidChange(this._onDidChangeActiveNodes,this,i),this.indentGuidesDisposable=i,this._onDidChangeActiveNodes(this.activeNodes.elements)}}}typeof e.hideTwistiesOfChildlessElements<"u"&&(this.hideTwistiesOfChildlessElements=e.hideTwistiesOfChildlessElements),typeof e.twistieAdditionalCssClass<"u"&&(this.twistieAdditionalCssClass=e.twistieAdditionalCssClass)}renderTemplate(e){const t=K(e,Q(".monaco-tl-row")),i=K(t,Q(".monaco-tl-indent")),n=K(t,Q(".monaco-tl-twistie")),s=K(t,Q(".monaco-tl-contents")),r=this.renderer.renderTemplate(s);return{container:e,indent:i,twistie:n,indentGuidesDisposable:l.Disposable.None,indentSize:0,templateData:r}}renderElement(e,t,i,n){i.indentSize=this.defaultIndent+(e.depth-1)*this.indent,this.renderedNodes.set(e,i),this.renderedElements.set(e.element,e),this.renderTreeElement(e,i),this.renderer.renderElement(e,t,i.templateData,{...n,indent:i.indentSize})}disposeElement(e,t,i,n){i.indentGuidesDisposable.dispose(),this.renderer.disposeElement?.(e,t,i.templateData,{...n,indent:i.indentSize}),typeof n?.height=="number"&&(this.renderedNodes.delete(e),this.renderedElements.delete(e.element))}disposeTemplate(e){this.renderer.disposeTemplate(e.templateData)}onDidChangeTwistieState(e){const t=this.renderedElements.get(e);t&&this.onDidChangeNodeTwistieState(t)}onDidChangeNodeTwistieState(e){const t=this.renderedNodes.get(e);t&&(this._onDidChangeActiveNodes(this.activeNodes.elements),this.renderTreeElement(e,t))}renderTreeElement(e,t){t.twistie.className=t.twistie.classList.item(0),t.twistie.style.paddingLeft=`${t.indentSize}px`,t.indent.style.width=`${t.indentSize+this.indent-16}px`,e.collapsible?t.container.setAttribute("aria-expanded",String(!e.collapsed)):t.container.removeAttribute("aria-expanded"),t.twistie.classList.remove(..._.ThemeIcon.asClassNameArray(l.Codicon.treeItemExpanded));let i=!1;if(this.renderer.renderTwistie&&(i=this.renderer.renderTwistie(e.element,t.twistie)),e.collapsible&&(!this.hideTwistiesOfChildlessElements||e.visibleChildrenCount>0)?(i||t.twistie.classList.add(..._.ThemeIcon.asClassNameArray(l.Codicon.treeItemExpanded)),t.twistie.classList.add("collapsible"),t.twistie.classList.toggle("collapsed",e.collapsed)):t.twistie.classList.remove("collapsible","collapsed"),this.twistieAdditionalCssClass){const n=this.twistieAdditionalCssClass(e.element);n&&t.twistie.classList.add(n)}this._renderIndentGuides(e,t)}_renderIndentGuides(e,t){if(On(t.indent),t.indentGuidesDisposable.dispose(),!this.shouldRenderIndentGuides)return;const i=new l.DisposableStore;for(;;){const n=this.model.getNodeLocation(e),s=this.model.getParentNodeLocation(n);if(!s)break;const r=this.model.getNode(s),a=Q(".indent-guide",{style:`width: ${this.indent}px`});this.activeIndentNodes.has(r)&&a.classList.add("active"),t.indent.childElementCount===0?t.indent.appendChild(a):t.indent.insertBefore(a,t.indent.firstElementChild),this.renderedIndentGuides.add(r,a),i.add(l.toDisposable(()=>this.renderedIndentGuides.delete(r,a))),e=r}t.indentGuidesDisposable=i}_onDidChangeActiveNodes(e){if(!this.shouldRenderIndentGuides)return;const t=new Set;e.forEach(i=>{const n=this.model.getNodeLocation(i);try{const s=this.model.getParentNodeLocation(n);i.collapsible&&i.children.length>0&&!i.collapsed?t.add(i):s&&t.add(this.model.getNode(s))}catch{}}),this.activeIndentNodes.forEach(i=>{t.has(i)||this.renderedIndentGuides.forEach(i,n=>n.classList.remove("active"))}),t.forEach(i=>{this.activeIndentNodes.has(i)||this.renderedIndentGuides.forEach(i,n=>n.classList.add("active"))}),this.activeIndentNodes=t}dispose(){this.renderedNodes.clear(),this.renderedElements.clear(),this.indentGuidesDisposable.dispose(),l.dispose(this.disposables)}};Sf.DefaultIndent=8;let aL=Sf;function xY(o,e){const t=e.toLowerCase().indexOf(o);let i;if(t>-1){i=[Number.MAX_SAFE_INTEGER,0];for(let n=o.length;n>0;n--)i.push(t+n-1)}return i}class jM{get totalCount(){return this._totalCount}get matchCount(){return this._matchCount}set findMatchType(e){this._findMatchType=e}get findMatchType(){return this._findMatchType}set findMode(e){this._findMode=e}get findMode(){return this._findMode}constructor(e,t,i){this._keyboardNavigationLabelProvider=e,this._filter=t,this._defaultFindVisibility=i,this._totalCount=0,this._matchCount=0,this._findMatchType=es.Fuzzy,this._findMode=an.Highlight,this._pattern="",this._lowercasePattern="",this.disposables=new l.DisposableStore}filter(e,t){let i=1;if(this._filter){const r=this._filter.filter(e,t);if(typeof r=="boolean"?i=r?1:0:Ju(r)?i=nl(r.visibility):i=r,i===0)return!1}if(this._totalCount++,!this._pattern)return this._matchCount++,{data:_.FuzzyScore.Default,visibility:i};const n=this._keyboardNavigationLabelProvider.getKeyboardNavigationLabel(e),s=Array.isArray(n)?n:[n];for(const r of s){const a=r&&r.toString();if(typeof a>"u")return{data:_.FuzzyScore.Default,visibility:i};let c;if(this._findMatchType===es.Contiguous?c=xY(this._lowercasePattern,a.toLowerCase()):c=Bc(this._pattern,this._lowercasePattern,0,a,a.toLowerCase(),0,{firstMatchCanBeWeak:!0,boostFullMatch:!0}),c)return this._matchCount++,s.length===1?{data:c,visibility:i}:{data:{label:a,score:c},visibility:i}}return this._findMode===an.Filter?typeof this._defaultFindVisibility=="number"?this._defaultFindVisibility:this._defaultFindVisibility?this._defaultFindVisibility(e):2:{data:_.FuzzyScore.Default,visibility:i}}reset(){this._totalCount=0,this._matchCount=0}dispose(){l.dispose(this.disposables)}}class EY{constructor(e){this.stateMap=new Map(e.map(t=>[t.id,{...t}]))}get(e){const t=this.stateMap.get(e);if(t===void 0)throw new Error(`No state found for toggle id ${e}`);return t.isChecked}set(e,t){const i=this.stateMap.get(e);if(i===void 0)throw new Error(`No state found for toggle id ${e}`);return i.isChecked===t?!1:(i.isChecked=t,!0)}}var an;(function(o){o[o.Highlight=0]="Highlight",o[o.Filter=1]="Filter"})(an||(an={}));var es;(function(o){o[o.Fuzzy=0]="Fuzzy",o[o.Contiguous=1]="Contiguous"})(es||(es={}));var Dr;(function(o){o.Mode="mode",o.MatchType="matchType"})(Dr||(Dr={}));class IY{get pattern(){return this._pattern}get placeholder(){return this._placeholder}set placeholder(e){this._placeholder=e,this.widget?.setPlaceHolder(e)}constructor(e,t,i,n={}){this.tree=e,this.filter=t,this.contextViewProvider=i,this.options=n,this._pattern="",this._onDidChangePattern=new l.Emitter,this._onDidChangeOpenState=new l.Emitter,this.onDidChangeOpenState=this._onDidChangeOpenState.event,this.enabledDisposables=new l.DisposableStore,this.disposables=new l.DisposableStore,this.toggles=new EY(n.toggles??[]),this._placeholder=n.placeholder??l.localize(22,"Type to search")}isOpened(){return!!this.widget}updateToggleState(e,t){this.toggles.set(e,t),this.widget?.setToggleState(e,t)}renderMessage(e,t){e?this.tree.options.showNotFoundMessage??!0?this.widget?.showMessage({type:2,content:t??l.localize(23,"No results found.")}):this.widget?.showMessage({type:2}):this.widget?.clearMessage()}alertResults(e){ha(e?l.localize(25,"{0} results",e):l.localize(24,"No results"))}dispose(){this._history=void 0,this._onDidChangePattern.dispose(),this.enabledDisposables.dispose(),this.disposables.dispose()}}class qM extends IY{get mode(){return this.toggles.get(Dr.Mode)?an.Filter:an.Highlight}set mode(e){if(e===this.mode)return;const t=e===an.Filter;this.updateToggleState(Dr.Mode,t),this.placeholder=t?l.localize(26,"Type to filter"):l.localize(27,"Type to search"),this.filter.findMode=e,this.tree.refilter(),this.render(),this._onDidChangeMode.fire(e)}get matchType(){return this.toggles.get(Dr.MatchType)?es.Fuzzy:es.Contiguous}set matchType(e){e!==this.matchType&&(this.updateToggleState(Dr.MatchType,e===es.Fuzzy),this.filter.findMatchType=e,this.tree.refilter(),this.render(),this._onDidChangeMatchType.fire(e))}constructor(e,t,i,n={}){const s=n.defaultFindMode??an.Highlight,r=n.defaultFindMatchType??es.Fuzzy,a=[{id:Dr.Mode,icon:l.Codicon.listFilter,title:l.localize(28,"Filter"),isChecked:s===an.Filter},{id:Dr.MatchType,icon:l.Codicon.searchFuzzy,title:l.localize(29,"Fuzzy Match"),isChecked:r===es.Fuzzy}];t.findMatchType=r,t.findMode=s,super(e,t,i,{...n,toggles:a}),this.filter=t,this._onDidChangeMode=new l.Emitter,this.onDidChangeMode=this._onDidChangeMode.event,this._onDidChangeMatchType=new l.Emitter,this.onDidChangeMatchType=this._onDidChangeMatchType.event,this.disposables.add(this.tree.onDidChangeModel(()=>{this.isOpened()&&(this.pattern.length!==0&&this.tree.refilter(),this.render())})),this.disposables.add(this.tree.onWillRefilter(()=>this.filter.reset()))}updateOptions(e={}){e.defaultFindMode!==void 0&&(this.mode=e.defaultFindMode),e.defaultFindMatchType!==void 0&&(this.matchType=e.defaultFindMatchType)}shouldAllowFocus(e){return!this.isOpened()||!this.pattern||this.filter.totalCount>0&&this.filter.matchCount<=1?!0:!_.FuzzyScore.isDefault(e.filterData)}render(){const t=this.filter.matchCount===0&&this.filter.totalCount>0&&this.pattern.length>0;this.renderMessage(t),this.pattern.length&&this.alertResults(this.filter.matchCount)}}function TY(o,e){return o.position===e.position&&YM(o,e)}function YM(o,e){return o.node.element===e.node.element&&o.startIndex===e.startIndex&&o.height===e.height&&o.endIndex===e.endIndex}class NY{constructor(e=[]){this.stickyNodes=e}get count(){return this.stickyNodes.length}equal(e){return l.equals(this.stickyNodes,e.stickyNodes,TY)}contains(e){return this.stickyNodes.some(t=>t.node.element===e.element)}lastNodePartiallyVisible(){if(this.count===0)return!1;const e=this.stickyNodes[this.count-1];if(this.count===1)return e.position!==0;const t=this.stickyNodes[this.count-2];return t.position+t.height!==e.position}animationStateChanged(e){if(!l.equals(this.stickyNodes,e.stickyNodes,YM)||this.count===0)return!1;const t=this.stickyNodes[this.count-1],i=e.stickyNodes[e.count-1];return t.position!==i.position}}class RY{constrainStickyScrollNodes(e,t,i){for(let n=0;n<e.length;n++){const s=e[n];if(s.position+s.height>i||n>=t)return e.slice(0,n)}return e}}class ZM extends l.Disposable{constructor(e,t,i,n,s,r={}){super(),this.tree=e,this.model=t,this.view=i,this.treeDelegate=s,this.maxWidgetViewRatio=.4;const a=this.validateStickySettings(r);this.stickyScrollMaxItemCount=a.stickyScrollMaxItemCount,this.stickyScrollDelegate=r.stickyScrollDelegate??new RY,this.paddingTop=r.paddingTop??0,this._widget=this._register(new MY(i.getScrollableElement(),i,e,n,s,r.accessibilityProvider)),this.onDidChangeHasFocus=this._widget.onDidChangeHasFocus,this.onContextMenu=this._widget.onContextMenu,this._register(i.onDidScroll(()=>this.update())),this._register(i.onDidChangeContentHeight(()=>this.update())),this._register(e.onDidChangeCollapseState(()=>this.update())),this._register(t.onDidSpliceRenderedNodes(c=>{const h=this._widget.state;if(!h)return;if(c.deleteCount>0&&h.stickyNodes.some(f=>!this.model.has(this.model.getNodeLocation(f.node)))){this.update();return}h.stickyNodes.some(f=>{const g=this.model.getListIndex(this.model.getNodeLocation(f.node));return g>=c.start&&g<c.start+c.deleteCount&&h.contains(f.node)})&&this._widget.rerender()})),this.update()}get height(){return this._widget.height}getNodeAtHeight(e){let t;if(e===0?t=this.view.firstVisibleIndex:t=this.view.indexAt(e+this.view.scrollTop),!(t<0||t>=this.view.length))return this.view.element(t)}update(){const e=this.getNodeAtHeight(this.paddingTop);if(!e||this.tree.scrollTop<=this.paddingTop||this.view.renderHeight===0){this._widget.setState(void 0);return}const t=this.findStickyState(e);this._widget.setState(t)}findStickyState(e){const t=[];let i=e,n=0,s=this.getNextStickyNode(i,void 0,n);for(;s&&(t.push(s),n+=s.height,!(t.length<=this.stickyScrollMaxItemCount&&(i=this.getNextVisibleNode(s),!i)));)s=this.getNextStickyNode(i,s.node,n);const r=this.constrainStickyNodes(t);return r.length?new NY(r):void 0}getNextVisibleNode(e){return this.getNodeAtHeight(e.position+e.height)}getNextStickyNode(e,t,i){const n=this.getAncestorUnderPrevious(e,t);if(n&&!(n===e&&(!this.nodeIsUncollapsedParent(e)||this.nodeTopAlignsWithStickyNodesBottom(e,i))))return this.createStickyScrollNode(n,i)}nodeTopAlignsWithStickyNodesBottom(e,t){const i=this.getNodeIndex(e),n=this.view.getElementTop(i),s=t;return this.view.scrollTop===n-s}createStickyScrollNode(e,t){const i=this.treeDelegate.getHeight(e),{startIndex:n,endIndex:s}=this.getNodeRange(e),r=this.calculateStickyNodePosition(s,t,i);return{node:e,position:r,height:i,startIndex:n,endIndex:s}}getAncestorUnderPrevious(e,t=void 0){let i=e,n=this.getParentNode(i);for(;n;){if(n===t)return i;i=n,n=this.getParentNode(i)}if(t===void 0)return i}calculateStickyNodePosition(e,t,i){let n=this.view.getRelativeTop(e);if(n===null&&this.view.firstVisibleIndex===e&&e+1<this.view.length){const h=this.treeDelegate.getHeight(this.view.element(e)),d=this.view.getRelativeTop(e+1);n=d?d-h/this.view.renderHeight:null}if(n===null)return t;const s=this.view.element(e),r=this.treeDelegate.getHeight(s),c=n*this.view.renderHeight+r;return t+i>c&&t<=c?c-i:t}constrainStickyNodes(e){if(e.length===0)return[];const t=this.view.renderHeight*this.maxWidgetViewRatio,i=e[e.length-1];if(e.length<=this.stickyScrollMaxItemCount&&i.position+i.height<=t)return e;const n=this.stickyScrollDelegate.constrainStickyScrollNodes(e,this.stickyScrollMaxItemCount,t);if(!n.length)return[];const s=n[n.length-1];if(n.length>this.stickyScrollMaxItemCount||s.position+s.height>t)throw new Error("stickyScrollDelegate violates constraints");return n}getParentNode(e){const t=this.model.getNodeLocation(e),i=this.model.getParentNodeLocation(t);return i?this.model.getNode(i):void 0}nodeIsUncollapsedParent(e){const t=this.model.getNodeLocation(e);return this.model.getListRenderCount(t)>1}getNodeIndex(e){const t=this.model.getNodeLocation(e);return this.model.getListIndex(t)}getNodeRange(e){const t=this.model.getNodeLocation(e),i=this.model.getListIndex(t);if(i<0)throw new Error("Node not found in tree");const n=this.model.getListRenderCount(t),s=i+n-1;return{startIndex:i,endIndex:s}}nodePositionTopBelowWidget(e){const t=[];let i=this.getParentNode(e);for(;i;)t.push(i),i=this.getParentNode(i);let n=0;for(let s=0;s<t.length&&s<this.stickyScrollMaxItemCount;s++)n+=this.treeDelegate.getHeight(t[s]);return n}domFocus(){this._widget.domFocus()}focusedLast(){return this._widget.focusedLast()}updateOptions(e={}){if(e.paddingTop!==void 0&&(this.paddingTop=e.paddingTop),e.stickyScrollMaxItemCount!==void 0){const t=this.validateStickySettings(e);this.stickyScrollMaxItemCount!==t.stickyScrollMaxItemCount&&(this.stickyScrollMaxItemCount=t.stickyScrollMaxItemCount,this.update())}}validateStickySettings(e){let t=7;return typeof e.stickyScrollMaxItemCount=="number"&&(t=Math.max(e.stickyScrollMaxItemCount,1)),{stickyScrollMaxItemCount:t}}}class MY{get state(){return this._previousState}constructor(e,t,i,n,s,r){this.view=t,this.tree=i,this.treeRenderers=n,this.treeDelegate=s,this.accessibilityProvider=r,this._previousElements=[],this._previousStateDisposables=new l.DisposableStore,this._rootDomNode=Q(".monaco-tree-sticky-container.empty"),e.appendChild(this._rootDomNode);const a=Q(".monaco-tree-sticky-container-shadow");this._rootDomNode.appendChild(a),this.stickyScrollFocus=new AY(this._rootDomNode,t),this.onDidChangeHasFocus=this.stickyScrollFocus.onDidChangeHasFocus,this.onContextMenu=this.stickyScrollFocus.onContextMenu}get height(){if(!this._previousState)return 0;const e=this._previousState.stickyNodes[this._previousState.count-1];return e.position+e.height}setState(e){const t=!!this._previousState&&this._previousState.count>0,i=!!e&&e.count>0;if(!t&&!i||t&&i&&this._previousState.equal(e))return;if(t!==i&&this.setVisible(i),!i){this._previousState=void 0,this._previousElements=[],this._previousStateDisposables.clear();return}const n=e.stickyNodes[e.count-1];this._previousState&&e.animationStateChanged(this._previousState)?this._previousElements[this._previousState.count-1].style.top=`${n.position}px`:this.renderState(e),this._previousState=e,this._rootDomNode.style.height=`${n.position+n.height}px`}renderState(e){this._previousStateDisposables.clear();const t=Array(e.count);for(let i=e.count-1;i>=0;i--){const n=e.stickyNodes[i],{element:s,disposable:r}=this.createElement(n,i,e.count);t[i]=s,this._rootDomNode.appendChild(s),this._previousStateDisposables.add(r)}this.stickyScrollFocus.updateElements(t,e),this._previousElements=t}rerender(){this._previousState&&this.renderState(this._previousState)}createElement(e,t,i){const n=e.startIndex,s=document.createElement("div");s.style.top=`${e.position}px`,this.tree.options.setRowHeight!==!1&&(s.style.height=`${e.height}px`),this.tree.options.setRowLineHeight!==!1&&(s.style.lineHeight=`${e.height}px`),s.classList.add("monaco-tree-sticky-row"),s.classList.add("monaco-list-row"),s.setAttribute("data-index",`${n}`),s.setAttribute("data-parity",n%2===0?"even":"odd"),s.setAttribute("id",this.view.getElementID(n));const r=this.setAccessibilityAttributes(s,e.node.element,t,i),a=this.treeDelegate.getTemplateId(e.node),c=this.treeRenderers.find(f=>f.templateId===a);if(!c)throw new Error(`No renderer found for template id ${a}`);let h=e.node;h===this.tree.getNode(this.tree.getNodeLocation(e.node))&&(h=new Proxy(e.node,{}));const d=c.renderTemplate(s);c.renderElement(h,e.startIndex,d,{height:e.height});const u=l.toDisposable(()=>{r.dispose(),c.disposeElement(h,e.startIndex,d,{height:e.height}),c.disposeTemplate(d),s.remove()});return{element:s,disposable:u}}setAccessibilityAttributes(e,t,i,n){if(!this.accessibilityProvider)return l.Disposable.None;this.accessibilityProvider.getSetSize&&e.setAttribute("aria-setsize",String(this.accessibilityProvider.getSetSize(t,i,n))),this.accessibilityProvider.getPosInSet&&e.setAttribute("aria-posinset",String(this.accessibilityProvider.getPosInSet(t,i))),this.accessibilityProvider.getRole&&e.setAttribute("role",this.accessibilityProvider.getRole(t)??"treeitem");const s=this.accessibilityProvider.getAriaLabel(t),r=s&&typeof s!="string"?s:Zr(s),a=he(h=>{const d=h.readObservable(r);d?e.setAttribute("aria-label",d):e.removeAttribute("aria-label")});typeof s=="string"||s&&e.setAttribute("aria-label",s.get());const c=this.accessibilityProvider.getAriaLevel&&this.accessibilityProvider.getAriaLevel(t);return typeof c=="number"&&e.setAttribute("aria-level",`${c}`),e.setAttribute("aria-selected",String(!1)),a}setVisible(e){this._rootDomNode.classList.toggle("empty",!e),e||this.stickyScrollFocus.updateElements([],void 0)}domFocus(){this.stickyScrollFocus.domFocus()}focusedLast(){return this.stickyScrollFocus.focusedLast()}dispose(){this.stickyScrollFocus.dispose(),this._previousStateDisposables.dispose(),this._rootDomNode.remove()}}class AY extends l.Disposable{get domHasFocus(){return this._domHasFocus}set domHasFocus(e){e!==this._domHasFocus&&(this._onDidChangeHasFocus.fire(e),this._domHasFocus=e)}constructor(e,t){super(),this.container=e,this.view=t,this.focusedIndex=-1,this.elements=[],this._onDidChangeHasFocus=this._register(new l.Emitter),this.onDidChangeHasFocus=this._onDidChangeHasFocus.event,this._onContextMenu=this._register(new l.Emitter),this.onContextMenu=this._onContextMenu.event,this._domHasFocus=!1,this._register(R(this.container,"focus",()=>this.onFocus())),this._register(R(this.container,"blur",()=>this.onBlur())),this._register(this.view.onDidFocus(()=>this.toggleStickyScrollFocused(!1))),this._register(this.view.onKeyDown(i=>this.onKeyDown(i))),this._register(this.view.onMouseDown(i=>this.onMouseDown(i))),this._register(this.view.onContextMenu(i=>this.handleContextMenu(i)))}handleContextMenu(e){const t=e.browserEvent.target;if(!qu(t)&&!ju(t)){this.focusedLast()&&this.view.domFocus();return}if(!so(e.browserEvent)){if(!this.state)throw new Error("Context menu should not be triggered when state is undefined");const r=this.state.stickyNodes.findIndex(a=>a.node.element===e.element?.element);if(r===-1)throw new Error("Context menu should not be triggered when element is not in sticky scroll widget");this.container.focus(),this.setFocus(r);return}if(!this.state||this.focusedIndex<0)throw new Error("Context menu key should not be triggered when focus is not in sticky scroll widget");const n=this.state.stickyNodes[this.focusedIndex].node.element,s=this.elements[this.focusedIndex];this._onContextMenu.fire({element:n,anchor:s,browserEvent:e.browserEvent,isStickyScroll:!0})}onKeyDown(e){if(this.domHasFocus&&this.state){if(e.key==="ArrowUp")this.setFocusedElement(Math.max(0,this.focusedIndex-1)),e.preventDefault(),e.stopPropagation();else if(e.key==="ArrowDown"||e.key==="ArrowRight"){if(this.focusedIndex>=this.state.count-1){const t=this.state.stickyNodes[this.state.count-1].startIndex+1;this.view.domFocus(),this.view.setFocus([t]),this.scrollNodeUnderWidget(t,this.state)}else this.setFocusedElement(this.focusedIndex+1);e.preventDefault(),e.stopPropagation()}}}onMouseDown(e){const t=e.browserEvent.target;!qu(t)&&!ju(t)||(e.browserEvent.preventDefault(),e.browserEvent.stopPropagation())}updateElements(e,t){if(t&&t.count===0)throw new Error("Sticky scroll state must be undefined when there are no sticky nodes");if(t&&t.count!==e.length)throw new Error("Sticky scroll focus received illigel state");const i=this.focusedIndex;if(this.removeFocus(),this.elements=e,this.state=t,t){const n=wi(i,0,t.count-1);this.setFocus(n)}else this.domHasFocus&&this.view.domFocus();this.container.tabIndex=t?0:-1}setFocusedElement(e){const t=this.state;if(!t)throw new Error("Cannot set focus when state is undefined");if(this.setFocus(e),!(e<t.count-1)&&t.lastNodePartiallyVisible()){const i=t.stickyNodes[e];this.scrollNodeUnderWidget(i.endIndex+1,t)}}scrollNodeUnderWidget(e,t){const i=t.stickyNodes[t.count-1],n=t.count>1?t.stickyNodes[t.count-2]:void 0,s=this.view.getElementTop(e),r=n?n.position+n.height+i.height:i.height;this.view.scrollTop=s-r}domFocus(){if(!this.state)throw new Error("Cannot focus when state is undefined");this.container.focus()}focusedLast(){return this.state?this.view.getHTMLElement().classList.contains("sticky-scroll-focused"):!1}removeFocus(){this.focusedIndex!==-1&&(this.toggleElementFocus(this.elements[this.focusedIndex],!1),this.focusedIndex=-1)}setFocus(e){if(0>e)throw new Error("addFocus() can not remove focus");if(!this.state&&e>=0)throw new Error("Cannot set focus index when state is undefined");if(this.state&&e>=this.state.count)throw new Error("Cannot set focus index to an index that does not exist");const t=this.focusedIndex;t>=0&&this.toggleElementFocus(this.elements[t],!1),e>=0&&this.toggleElementFocus(this.elements[e],!0),this.focusedIndex=e}toggleElementFocus(e,t){this.toggleElementActiveFocus(e,t&&this.domHasFocus),this.toggleElementPassiveFocus(e,t)}toggleCurrentElementActiveFocus(e){this.focusedIndex!==-1&&this.toggleElementActiveFocus(this.elements[this.focusedIndex],e)}toggleElementActiveFocus(e,t){e.classList.toggle("focused",t)}toggleElementPassiveFocus(e,t){e.classList.toggle("passive-focused",t)}toggleStickyScrollFocused(e){this.view.getHTMLElement().classList.toggle("sticky-scroll-focused",e)}onFocus(){if(!this.state||this.elements.length===0)throw new Error("Cannot focus when state is undefined or elements are empty");this.domHasFocus=!0,this.toggleStickyScrollFocused(!0),this.toggleCurrentElementActiveFocus(!0),this.focusedIndex===-1&&this.setFocus(0)}onBlur(){this.domHasFocus=!1,this.toggleCurrentElementActiveFocus(!1)}dispose(){this.toggleStickyScrollFocused(!1),this._onDidChangeHasFocus.fire(!1),super.dispose()}}function Qp(o){let e=il.Unknown;return aC(o.browserEvent.target,"monaco-tl-twistie","monaco-tl-row")?e=il.Twistie:aC(o.browserEvent.target,"monaco-tl-contents","monaco-tl-row")?e=il.Element:aC(o.browserEvent.target,"monaco-tree-type-filter","monaco-list")&&(e=il.Filter),{browserEvent:o.browserEvent,element:o.element?o.element.element:null,target:e}}function OY(o){const e=qu(o.browserEvent.target);return{element:o.element?o.element.element:null,browserEvent:o.browserEvent,anchor:o.anchor,isStickyScroll:e}}function Xp(o,e){e(o),o.children.forEach(t=>Xp(t,e))}class lL{get nodeSet(){return this._nodeSet||(this._nodeSet=this.createNodeSet()),this._nodeSet}constructor(e,t){this.getFirstViewElementWithTrait=e,this.identityProvider=t,this.nodes=[],this._onDidChange=new l.Emitter,this.onDidChange=this._onDidChange.event}set(e,t){!t?.__forceEvent&&l.equals(this.nodes,e)||this._set(e,!1,t)}_set(e,t,i){if(this.nodes=[...e],this.elements=void 0,this._nodeSet=void 0,!t){const n=this;this._onDidChange.fire({get elements(){return n.get()},browserEvent:i})}}get(){return this.elements||(this.elements=this.nodes.map(e=>e.element)),[...this.elements]}getNodes(){return this.nodes}has(e){return this.nodeSet.has(e)}onDidModelSplice({insertedNodes:e,deletedNodes:t}){if(!this.identityProvider){const c=this.createNodeSet(),h=d=>c.delete(d);t.forEach(d=>Xp(d,h)),this.set([...c.values()]);return}const i=new Set,n=c=>i.add(this.identityProvider.getId(c.element).toString());t.forEach(c=>Xp(c,n));const s=new Map,r=c=>s.set(this.identityProvider.getId(c.element).toString(),c);e.forEach(c=>Xp(c,r));const a=[];for(const c of this.nodes){const h=this.identityProvider.getId(c.element).toString();if(!i.has(h))a.push(c);else{const u=s.get(h);u&&u.visible&&a.push(u)}}if(this.nodes.length>0&&a.length===0){const c=this.getFirstViewElementWithTrait();c&&a.push(c)}this._set(a,!0)}createNodeSet(){const e=new Set;for(const t of this.nodes)e.add(t);return e}}class PY extends uM{constructor(e,t,i){super(e),this.tree=t,this.stickyScrollProvider=i}onViewPointer(e){if(aM(e.browserEvent.target)||jn(e.browserEvent.target)||Gu(e.browserEvent.target)||e.browserEvent.isHandledByList)return;const t=e.element;if(!t)return super.onViewPointer(e);if(this.isSelectionRangeChangeEvent(e)||this.isSelectionSingleChangeEvent(e))return super.onViewPointer(e);const i=e.browserEvent.target,n=i.classList.contains("monaco-tl-twistie")||i.classList.contains("monaco-icon-label")&&i.classList.contains("folder-icon")&&e.browserEvent.offsetX<16,s=ju(e.browserEvent.target);let r=!1;if(s?r=!0:typeof this.tree.expandOnlyOnTwistieClick=="function"?r=this.tree.expandOnlyOnTwistieClick(t.element):r=!!this.tree.expandOnlyOnTwistieClick,s)this.handleStickyScrollMouseEvent(e,t);else{if(r&&!n&&e.browserEvent.detail!==2)return super.onViewPointer(e);if(!this.tree.expandOnDoubleClick&&e.browserEvent.detail===2)return super.onViewPointer(e)}if(t.collapsible&&(!s||n)){const a=this.tree.getNodeLocation(t),c=e.browserEvent.altKey;if(this.tree.setFocus([a]),this.tree.toggleCollapsed(a,c),n){e.browserEvent.isHandledByList=!0;return}}s||super.onViewPointer(e)}handleStickyScrollMouseEvent(e,t){if(K9(e.browserEvent.target)||G9(e.browserEvent.target))return;const i=this.stickyScrollProvider();if(!i)throw new Error("Sticky scroll controller not found");const n=this.list.indexOf(t),s=this.list.getElementTop(n),r=i.nodePositionTopBelowWidget(t);this.tree.scrollTop=s-r,this.list.domFocus(),this.list.setFocus([n]),this.list.setSelection([n])}onDoubleClick(e){e.browserEvent.target.classList.contains("monaco-tl-twistie")||!this.tree.expandOnDoubleClick||e.browserEvent.isHandledByList||super.onDoubleClick(e)}onMouseDown(e){const t=e.browserEvent.target;if(!qu(t)&&!ju(t)){super.onMouseDown(e);return}}onContextMenu(e){const t=e.browserEvent.target;if(!qu(t)&&!ju(t)){super.onContextMenu(e);return}}}class kY extends zn{constructor(e,t,i,n,s,r,a,c){super(e,t,i,n,c),this.focusTrait=s,this.selectionTrait=r,this.anchorTrait=a}createMouseController(e){return new PY(this,e.tree,e.stickyScrollProvider)}splice(e,t,i=[]){if(super.splice(e,t,i),i.length===0)return;const n=[],s=[];let r;i.forEach((a,c)=>{this.focusTrait.has(a)&&n.push(e+c),this.selectionTrait.has(a)&&s.push(e+c),this.anchorTrait.has(a)&&(r=e+c)}),n.length>0&&super.setFocus(l.distinct([...super.getFocus(),...n])),s.length>0&&super.setSelection(l.distinct([...super.getSelection(),...s])),typeof r=="number"&&super.setAnchor(r)}setFocus(e,t,i=!1){super.setFocus(e,t),i||this.focusTrait.set(e.map(n=>this.element(n)),t)}setSelection(e,t,i=!1){super.setSelection(e,t),i||this.selectionTrait.set(e.map(n=>this.element(n)),t)}setAnchor(e,t=!1){super.setAnchor(e),t||(typeof e>"u"?this.anchorTrait.set([]):this.anchorTrait.set([this.element(e)]))}}class QM{get onDidScroll(){return this.view.onDidScroll}get onDidChangeFocus(){return this.eventBufferer.wrapEvent(this.focus.onDidChange)}get onDidChangeSelection(){return this.eventBufferer.wrapEvent(this.selection.onDidChange)}get onMouseDblClick(){return l.Event.filter(l.Event.map(this.view.onMouseDblClick,Qp),e=>e.target!==il.Filter)}get onMouseOver(){return l.Event.map(this.view.onMouseOver,Qp)}get onMouseOut(){return l.Event.map(this.view.onMouseOut,Qp)}get onContextMenu(){return l.Event.any(l.Event.filter(l.Event.map(this.view.onContextMenu,OY),e=>!e.isStickyScroll),this.stickyScrollController?.onContextMenu??l.Event.None)}get onPointer(){return l.Event.map(this.view.onPointer,Qp)}get onDidFocus(){return this.view.onDidFocus}get onDidChangeModel(){return l.Event.any(this.onDidChangeModelRelay.event,this.onDidSwapModel.event)}get onDidChangeCollapseState(){return this.onDidChangeCollapseStateRelay.event}get expandOnDoubleClick(){return typeof this._options.expandOnDoubleClick>"u"?!0:this._options.expandOnDoubleClick}get expandOnlyOnTwistieClick(){return typeof this._options.expandOnlyOnTwistieClick>"u"?!0:this._options.expandOnlyOnTwistieClick}get onDidDispose(){return this.view.onDidDispose}constructor(e,t,i,n,s={}){this._user=e,this._options=s,this.eventBufferer=new l.EventBufferer,this.onDidChangeFindOpenState=l.Event.None,this.onDidChangeStickyScrollFocused=l.Event.None,this.disposables=new l.DisposableStore,this.onDidSwapModel=this.disposables.add(new l.Emitter),this.onDidChangeModelRelay=this.disposables.add(new l.Relay),this.onDidSpliceModelRelay=this.disposables.add(new l.Relay),this.onDidChangeCollapseStateRelay=this.disposables.add(new l.Relay),this.onDidChangeRenderNodeCountRelay=this.disposables.add(new l.Relay),this.onDidChangeActiveNodesRelay=this.disposables.add(new l.Relay),this._onWillRefilter=new l.Emitter,this.onWillRefilter=this._onWillRefilter.event,this._onDidUpdateOptions=new l.Emitter,this.modelDisposables=new l.DisposableStore,s.keyboardNavigationLabelProvider&&(s.findWidgetEnabled??!0)&&(this.findFilter=new jM(s.keyboardNavigationLabelProvider,s.filter,s.defaultFindVisibility),s={...s,filter:this.findFilter},this.disposables.add(this.findFilter)),this.model=this.createModel(e,s),this.treeDelegate=new rL(i);const r=this.disposables.add(new DY(this.onDidChangeActiveNodesRelay.event)),a=new l.SetMap;this.renderers=n.map(c=>new aL(c,this.model,this.onDidChangeCollapseStateRelay.event,r,a,s));for(const c of this.renderers)this.disposables.add(c);if(this.focus=new lL(()=>this.view.getFocusedElements()[0],s.identityProvider),this.selection=new lL(()=>this.view.getSelectedElements()[0],s.identityProvider),this.anchor=new lL(()=>this.view.getAnchorElement(),s.identityProvider),this.view=new kY(e,t,this.treeDelegate,this.renderers,this.focus,this.selection,this.anchor,{...LY(()=>this.model,this.disposables,s),tree:this,stickyScrollProvider:()=>this.stickyScrollController}),this.setupModel(this.model),s.keyboardSupport!==!1){const c=l.Event.chain(this.view.onKeyDown,h=>h.filter(d=>!jn(d.target)).map(d=>new Be(d)));l.Event.chain(c,h=>h.filter(d=>d.keyCode===15))(this.onLeftArrow,this,this.disposables),l.Event.chain(c,h=>h.filter(d=>d.keyCode===17))(this.onRightArrow,this,this.disposables),l.Event.chain(c,h=>h.filter(d=>d.keyCode===10))(this.onSpace,this,this.disposables)}if((s.findWidgetEnabled??!0)&&s.keyboardNavigationLabelProvider&&s.contextViewProvider){const c={styles:s.findWidgetStyles,defaultFindMode:s.defaultFindMode,defaultFindMatchType:s.defaultFindMatchType,showNotFoundMessage:s.showNotFoundMessage,findWidgetContainer:s.findWidgetContainer};this.findController=this.disposables.add(new qM(this,this.findFilter,s.contextViewProvider,c)),this.focusNavigationFilter=h=>this.findController.shouldAllowFocus(h),this.onDidChangeFindOpenState=this.findController.onDidChangeOpenState,this.onDidChangeFindMode=this.findController.onDidChangeMode,this.onDidChangeFindMatchType=this.findController.onDidChangeMatchType}else this.onDidChangeFindMode=l.Event.None,this.onDidChangeFindMatchType=l.Event.None;s.enableStickyScroll&&(this.stickyScrollController=new ZM(this,this.model,this.view,this.renderers,this.treeDelegate,s),this.onDidChangeStickyScrollFocused=this.stickyScrollController.onDidChangeHasFocus),this.styleElement=bn(this.view.getHTMLElement()),this.getHTMLElement().classList.toggle("always",this._options.renderIndentGuides===sl.Always)}updateOptions(e={}){this._options={...this._options,...e};for(const t of this.renderers)t.updateOptions(e);this.view.updateOptions(e),this.findController?.updateOptions(e),this.updateStickyScroll(e),this._onDidUpdateOptions.fire(this._options),this.getHTMLElement().classList.toggle("always",this._options.renderIndentGuides===sl.Always)}get options(){return this._options}updateStickyScroll(e){!this.stickyScrollController&&this._options.enableStickyScroll?(this.stickyScrollController=new ZM(this,this.model,this.view,this.renderers,this.treeDelegate,this._options),this.onDidChangeStickyScrollFocused=this.stickyScrollController.onDidChangeHasFocus):this.stickyScrollController&&!this._options.enableStickyScroll&&(this.onDidChangeStickyScrollFocused=l.Event.None,this.stickyScrollController.dispose(),this.stickyScrollController=void 0),this.stickyScrollController?.updateOptions(e)}getHTMLElement(){return this.view.getHTMLElement()}get onDidChangeContentHeight(){return this.view.onDidChangeContentHeight}get scrollTop(){return this.view.scrollTop}set scrollTop(e){this.view.scrollTop=e}get scrollHeight(){return this.view.scrollHeight}get renderHeight(){return this.view.renderHeight}get ariaLabel(){return this.view.ariaLabel}set ariaLabel(e){this.view.ariaLabel=e}domFocus(){this.stickyScrollController?.focusedLast()?this.stickyScrollController.domFocus():this.view.domFocus()}isDOMFocused(){return sd(this.getHTMLElement())}layout(e,t){this.view.layout(e,t)}style(e){const t=`.${this.view.domId}`,i=[];e.treeIndentGuidesStroke&&(i.push(`.monaco-list${t}:hover .monaco-tl-indent > .indent-guide, .monaco-list${t}.always .monaco-tl-indent > .indent-guide { opacity: 1; border-color: ${e.treeInactiveIndentGuidesStroke}; }`),i.push(`.monaco-list${t} .monaco-tl-indent > .indent-guide.active { opacity: 1; border-color: ${e.treeIndentGuidesStroke}; }`));const n=e.treeStickyScrollBackground??e.listBackground;n&&(i.push(`.monaco-list${t} .monaco-scrollable-element .monaco-tree-sticky-container { background-color: ${n}; }`),i.push(`.monaco-list${t} .monaco-scrollable-element .monaco-tree-sticky-container .monaco-tree-sticky-row { background-color: ${n}; }`)),e.treeStickyScrollBorder&&i.push(`.monaco-list${t} .monaco-scrollable-element .monaco-tree-sticky-container { border-bottom: 1px solid ${e.treeStickyScrollBorder}; }`),e.treeStickyScrollShadow&&i.push(`.monaco-list${t} .monaco-scrollable-element .monaco-tree-sticky-container .monaco-tree-sticky-container-shadow { box-shadow: ${e.treeStickyScrollShadow} 0 6px 6px -6px inset; height: 3px; }`),e.listFocusForeground&&(i.push(`.monaco-list${t}.sticky-scroll-focused .monaco-scrollable-element .monaco-tree-sticky-container:focus .monaco-list-row.focused { color: ${e.listFocusForeground}; }`),i.push(`.monaco-list${t}:not(.sticky-scroll-focused) .monaco-scrollable-element .monaco-tree-sticky-container .monaco-list-row.focused { color: inherit; }`));const s=Eo(e.listFocusAndSelectionOutline,Eo(e.listSelectionOutline,e.listFocusOutline??""));s&&(i.push(`.monaco-list${t}.sticky-scroll-focused .monaco-scrollable-element .monaco-tree-sticky-container:focus .monaco-list-row.focused.selected { outline: 1px solid ${s}; outline-offset: -1px;}`),i.push(`.monaco-list${t}:not(.sticky-scroll-focused) .monaco-scrollable-element .monaco-tree-sticky-container .monaco-list-row.focused.selected { outline: inherit;}`)),e.listFocusOutline&&(i.push(`.monaco-list${t}.sticky-scroll-focused .monaco-scrollable-element .monaco-tree-sticky-container:focus .monaco-list-row.focused { outline: 1px solid ${e.listFocusOutline}; outline-offset: -1px; }`),i.push(`.monaco-list${t}:not(.sticky-scroll-focused) .monaco-scrollable-element .monaco-tree-sticky-container .monaco-list-row.focused { outline: inherit; }`),i.push(`.context-menu-visible .monaco-list${t}.last-focused.sticky-scroll-focused .monaco-scrollable-element .monaco-tree-sticky-container .monaco-list-row.passive-focused { outline: 1px solid ${e.listFocusOutline}; outline-offset: -1px; }`),i.push(`.context-menu-visible .monaco-list${t}.last-focused.sticky-scroll-focused .monaco-list-rows .monaco-list-row.focused { outline: inherit; }`),i.push(`.context-menu-visible .monaco-list${t}.last-focused:not(.sticky-scroll-focused) .monaco-tree-sticky-container .monaco-list-rows .monaco-list-row.focused { outline: inherit; }`)),this.styleElement.textContent=i.join(`
|
||
`),this.view.style(e)}getParentElement(e){const t=this.model.getParentNodeLocation(e);return this.model.getNode(t).element}getFirstElementChild(e){return this.model.getFirstElementChild(e)}getNode(e){return this.model.getNode(e)}getNodeLocation(e){return this.model.getNodeLocation(e)}collapse(e,t=!1){return this.model.setCollapsed(e,!0,t)}expand(e,t=!1){return this.model.setCollapsed(e,!1,t)}toggleCollapsed(e,t=!1){return this.model.setCollapsed(e,void 0,t)}isCollapsible(e){return this.model.isCollapsible(e)}setCollapsible(e,t){return this.model.setCollapsible(e,t)}isCollapsed(e){return this.model.isCollapsed(e)}refilter(){this._onWillRefilter.fire(void 0),this.model.refilter()}setSelection(e,t){this.eventBufferer.bufferEvents(()=>{const i=e.map(s=>this.model.getNode(s));this.selection.set(i,t);const n=e.map(s=>this.model.getListIndex(s)).filter(s=>s>-1);this.view.setSelection(n,t,!0)})}getSelection(){return this.selection.get()}setFocus(e,t){this.eventBufferer.bufferEvents(()=>{const i=e.map(s=>this.model.getNode(s));this.focus.set(i,t);const n=e.map(s=>this.model.getListIndex(s)).filter(s=>s>-1);this.view.setFocus(n,t,!0)})}focusNext(e=1,t=!1,i,n=so(i)&&i.altKey?void 0:this.focusNavigationFilter){this.view.focusNext(e,t,i,n)}focusPrevious(e=1,t=!1,i,n=so(i)&&i.altKey?void 0:this.focusNavigationFilter){this.view.focusPrevious(e,t,i,n)}focusNextPage(e,t=so(e)&&e.altKey?void 0:this.focusNavigationFilter){return this.view.focusNextPage(e,t)}focusPreviousPage(e,t=so(e)&&e.altKey?void 0:this.focusNavigationFilter){return this.view.focusPreviousPage(e,t,()=>this.stickyScrollController?.height??0)}focusLast(e,t=so(e)&&e.altKey?void 0:this.focusNavigationFilter){this.view.focusLast(e,t)}focusFirst(e,t=so(e)&&e.altKey?void 0:this.focusNavigationFilter){this.view.focusFirst(e,t)}getFocus(){return this.focus.get()}reveal(e,t){this.model.expandTo(e);const i=this.model.getListIndex(e);if(i!==-1)if(!this.stickyScrollController)this.view.reveal(i,t);else{const n=this.stickyScrollController.nodePositionTopBelowWidget(this.getNode(e));this.view.reveal(i,t,n)}}onLeftArrow(e){e.preventDefault(),e.stopPropagation();const t=this.view.getFocusedElements();if(t.length===0)return;const i=t[0],n=this.model.getNodeLocation(i);if(!this.model.setCollapsed(n,!0)){const r=this.model.getParentNodeLocation(n);if(!r)return;const a=this.model.getListIndex(r);this.view.reveal(a),this.view.setFocus([a])}}onRightArrow(e){e.preventDefault(),e.stopPropagation();const t=this.view.getFocusedElements();if(t.length===0)return;const i=t[0],n=this.model.getNodeLocation(i);if(!this.model.setCollapsed(n,!1)){if(!i.children.some(c=>c.visible))return;const[r]=this.view.getFocus(),a=r+1;this.view.reveal(a),this.view.setFocus([a])}}onSpace(e){e.preventDefault(),e.stopPropagation();const t=this.view.getFocusedElements();if(t.length===0)return;const i=t[0],n=this.model.getNodeLocation(i),s=e.browserEvent.altKey;this.model.setCollapsed(n,void 0,s)}setupModel(e){this.modelDisposables.clear(),this.modelDisposables.add(e.onDidSpliceRenderedNodes(({start:s,deleteCount:r,elements:a})=>this.view.splice(s,r,a)));const t=l.Event.forEach(e.onDidSpliceModel,s=>{this.eventBufferer.bufferEvents(()=>{this.focus.onDidModelSplice(s),this.selection.onDidModelSplice(s)})},this.modelDisposables);t(()=>null,null,this.modelDisposables);const i=this.modelDisposables.add(new l.Emitter),n=this.modelDisposables.add(new l.Delayer(0));this.modelDisposables.add(l.Event.any(t,this.focus.onDidChange,this.selection.onDidChange)(()=>{n.trigger(()=>{const s=new Set;for(const r of this.focus.getNodes())s.add(r);for(const r of this.selection.getNodes())s.add(r);i.fire([...s.values()])})})),this.onDidChangeActiveNodesRelay.input=i.event,this.onDidChangeModelRelay.input=l.Event.signal(e.onDidSpliceModel),this.onDidChangeCollapseStateRelay.input=e.onDidChangeCollapseState,this.onDidChangeRenderNodeCountRelay.input=e.onDidChangeRenderNodeCount,this.onDidSpliceModelRelay.input=e.onDidSpliceModel,l.isMacintosh&&this.modelDisposables.add(e.onDidChangeCollapseState(s=>{const{node:r,deep:a}=s;r.collapsible&&!a&&this.isDOMFocused()&&ha(r.collapsed?l.localize(30,"collapsed"):l.localize(31,"expanded"))}))}dispose(){l.dispose(this.disposables),this.stickyScrollController?.dispose(),this.view.dispose(),this.modelDisposables.dispose()}}class cL{constructor(e,t={}){this.user=e,this.rootRef=null,this.nodes=new Map,this.nodesByIdentity=new Map,this.model=new wY(e,null,t),this.onDidSpliceModel=this.model.onDidSpliceModel,this.onDidSpliceRenderedNodes=this.model.onDidSpliceRenderedNodes,this.onDidChangeCollapseState=this.model.onDidChangeCollapseState,this.onDidChangeRenderNodeCount=this.model.onDidChangeRenderNodeCount,t.sorter&&(this.sorter={compare(i,n){return t.sorter.compare(i.element,n.element)}}),this.identityProvider=t.identityProvider}setChildren(e,t=l.Iterable.empty(),i={}){const n=this.getElementLocation(e);this._setChildren(n,this.preserveCollapseState(t),i)}_setChildren(e,t=l.Iterable.empty(),i){const n=new Set,s=new Set,r=c=>{if(c.element===null)return;const h=c;if(n.add(h.element),this.nodes.set(h.element,h),this.identityProvider){const d=this.identityProvider.getId(h.element).toString();s.add(d),this.nodesByIdentity.set(d,h)}i.onDidCreateNode?.(h)},a=c=>{if(c.element===null)return;const h=c;if(n.has(h.element)||this.nodes.delete(h.element),this.identityProvider){const d=this.identityProvider.getId(h.element).toString();s.has(d)||this.nodesByIdentity.delete(d)}i.onDidDeleteNode?.(h)};this.model.splice([...e,0],Number.MAX_VALUE,t,{...i,onDidCreateNode:r,onDidDeleteNode:a})}preserveCollapseState(e=l.Iterable.empty()){return this.sorter&&(e=[...e].sort(this.sorter.compare.bind(this.sorter))),l.Iterable.map(e,t=>{let i=this.nodes.get(t.element);if(!i&&this.identityProvider){const r=this.identityProvider.getId(t.element).toString();i=this.nodesByIdentity.get(r)}if(!i){let r;return typeof t.collapsed>"u"?r=void 0:t.collapsed===ki.Collapsed||t.collapsed===ki.PreserveOrCollapsed?r=!0:t.collapsed===ki.Expanded||t.collapsed===ki.PreserveOrExpanded?r=!1:r=!!t.collapsed,{...t,children:this.preserveCollapseState(t.children),collapsed:r}}const n=typeof t.collapsible=="boolean"?t.collapsible:i.collapsible;let s;return typeof t.collapsed>"u"||t.collapsed===ki.PreserveOrCollapsed||t.collapsed===ki.PreserveOrExpanded?s=i.collapsed:t.collapsed===ki.Collapsed?s=!0:t.collapsed===ki.Expanded?s=!1:s=!!t.collapsed,{...t,collapsible:n,collapsed:s,children:this.preserveCollapseState(t.children)}})}rerender(e){const t=this.getElementLocation(e);this.model.rerender(t)}resort(e=null,t=!0){if(!this.sorter)return;const i=this.getElementLocation(e),n=this.model.getNode(i);this._setChildren(i,this.resortChildren(n,t),{})}resortChildren(e,t,i=!0){let n=[...e.children];return(t||i)&&(n=n.sort(this.sorter.compare.bind(this.sorter))),l.Iterable.map(n,s=>({element:s.element,collapsible:s.collapsible,collapsed:s.collapsed,children:this.resortChildren(s,t,!1)}))}getFirstElementChild(e=null){const t=this.getElementLocation(e);return this.model.getFirstElementChild(t)}has(e){return this.nodes.has(e)}getListIndex(e){const t=this.getElementLocation(e);return this.model.getListIndex(t)}getListRenderCount(e){const t=this.getElementLocation(e);return this.model.getListRenderCount(t)}isCollapsible(e){const t=this.getElementLocation(e);return this.model.isCollapsible(t)}setCollapsible(e,t){const i=this.getElementLocation(e);return this.model.setCollapsible(i,t)}isCollapsed(e){const t=this.getElementLocation(e);return this.model.isCollapsed(t)}setCollapsed(e,t,i){const n=this.getElementLocation(e);return this.model.setCollapsed(n,t,i)}expandTo(e){const t=this.getElementLocation(e);this.model.expandTo(t)}refilter(){this.model.refilter()}getNode(e=null){if(e===null)return this.model.getNode(this.model.rootRef);const t=this.nodes.get(e);if(!t)throw new rn(this.user,`Tree element not found: ${e}`);return t}getNodeLocation(e){return e.element}getParentNodeLocation(e){if(e===null)throw new rn(this.user,"Invalid getParentNodeLocation call");const t=this.nodes.get(e);if(!t)throw new rn(this.user,`Tree element not found: ${e}`);const i=this.model.getNodeLocation(t),n=this.model.getParentNodeLocation(i);return this.model.getNode(n).element}getElementLocation(e){if(e===null)return[];const t=this.nodes.get(e);if(!t)throw new rn(this.user,`Tree element not found: ${e}`);return this.model.getNodeLocation(t)}}function Jp(o){const e=[o.element],t=o.incompressible||!1;return{element:{elements:e,incompressible:t},children:l.Iterable.map(l.Iterable.from(o.children),Jp),collapsible:o.collapsible,collapsed:o.collapsed}}function Wp(o){const e=[o.element],t=o.incompressible||!1;let i,n;for(;[n,i]=l.Iterable.consume(l.Iterable.from(o.children),2),!(n.length!==1||n[0].incompressible);)o=n[0],e.push(o.element);return{element:{elements:e,incompressible:t},children:l.Iterable.map(l.Iterable.concat(n,i),Wp),collapsible:o.collapsible,collapsed:o.collapsed}}function hL(o,e=0){let t;return e<o.element.elements.length-1?t=[hL(o,e+1)]:t=l.Iterable.map(l.Iterable.from(o.children),i=>hL(i,0)),e===0&&o.element.incompressible?{element:o.element.elements[e],children:t,incompressible:!0,collapsible:o.collapsible,collapsed:o.collapsed}:{element:o.element.elements[e],children:t,collapsible:o.collapsible,collapsed:o.collapsed}}function XM(o){return hL(o,0)}function JM(o,e,t){return o.element===e?{...o,children:t}:{...o,children:l.Iterable.map(l.Iterable.from(o.children),i=>JM(i,e,t))}}const FY=o=>({getId(e){return e.elements.map(t=>o.getId(t).toString()).join("\0")},getGroupId:o.getGroupId?e=>o.getGroupId(e.elements[e.elements.length-1]):void 0});class BY{get onDidSpliceRenderedNodes(){return this.model.onDidSpliceRenderedNodes}get onDidSpliceModel(){return this.model.onDidSpliceModel}get onDidChangeCollapseState(){return this.model.onDidChangeCollapseState}get onDidChangeRenderNodeCount(){return this.model.onDidChangeRenderNodeCount}constructor(e,t={}){this.user=e,this.rootRef=null,this.nodes=new Map,this.model=new cL(e,t),this.enabled=typeof t.compressionEnabled>"u"?!0:t.compressionEnabled,this.identityProvider=t.identityProvider}setChildren(e,t=l.Iterable.empty(),i){const n=i.diffIdentityProvider&&FY(i.diffIdentityProvider);if(e===null){const m=l.Iterable.map(t,this.enabled?Wp:Jp);this._setChildren(null,m,{diffIdentityProvider:n,diffDepth:1/0});return}const s=this.nodes.get(e);if(!s)throw new rn(this.user,"Unknown compressed tree node");const r=this.model.getNode(s),a=this.model.getParentNodeLocation(s),c=this.model.getNode(a),h=XM(r),d=JM(h,e,t),u=(this.enabled?Wp:Jp)(d),f=i.diffIdentityProvider?((m,p)=>i.diffIdentityProvider.getId(m)===i.diffIdentityProvider.getId(p)):void 0;if(l.equals(u.element.elements,r.element.elements,f)){this._setChildren(s,u.children||l.Iterable.empty(),{diffIdentityProvider:n,diffDepth:1});return}const g=c.children.map(m=>m===r?u:m);this._setChildren(c.element,g,{diffIdentityProvider:n,diffDepth:r.depth-c.depth})}isCompressionEnabled(){return this.enabled}setCompressionEnabled(e){if(e===this.enabled)return;this.enabled=e;const i=this.model.getNode().children,n=l.Iterable.map(i,XM),s=l.Iterable.map(n,e?Wp:Jp);this._setChildren(null,s,{diffIdentityProvider:this.identityProvider,diffDepth:1/0})}_setChildren(e,t,i){const n=new Set,s=a=>{for(const c of a.element.elements)n.add(c),this.nodes.set(c,a.element)},r=a=>{for(const c of a.element.elements)n.has(c)||this.nodes.delete(c)};this.model.setChildren(e,t,{...i,onDidCreateNode:s,onDidDeleteNode:r})}has(e){return this.nodes.has(e)}getListIndex(e){const t=this.getCompressedNode(e);return this.model.getListIndex(t)}getListRenderCount(e){const t=this.getCompressedNode(e);return this.model.getListRenderCount(t)}getNode(e){if(typeof e>"u")return this.model.getNode();const t=this.getCompressedNode(e);return this.model.getNode(t)}getNodeLocation(e){const t=this.model.getNodeLocation(e);return t===null?null:t.elements[t.elements.length-1]}getParentNodeLocation(e){const t=this.getCompressedNode(e),i=this.model.getParentNodeLocation(t);return i===null?null:i.elements[i.elements.length-1]}getFirstElementChild(e){const t=this.getCompressedNode(e);return this.model.getFirstElementChild(t)}isCollapsible(e){const t=this.getCompressedNode(e);return this.model.isCollapsible(t)}setCollapsible(e,t){const i=this.getCompressedNode(e);return this.model.setCollapsible(i,t)}isCollapsed(e){const t=this.getCompressedNode(e);return this.model.isCollapsed(t)}setCollapsed(e,t,i){const n=this.getCompressedNode(e);return this.model.setCollapsed(n,t,i)}expandTo(e){const t=this.getCompressedNode(e);this.model.expandTo(t)}rerender(e){const t=this.getCompressedNode(e);this.model.rerender(t)}refilter(){this.model.refilter()}resort(e=null,t=!0){const i=this.getCompressedNode(e);this.model.resort(i,t)}getCompressedNode(e){if(e===null)return null;const t=this.nodes.get(e);if(!t)throw new rn(this.user,`Tree element not found: ${e}`);return t}}const zY=o=>o[o.length-1];class dL{get element(){return this.node.element===null?null:this.unwrapper(this.node.element)}get children(){return this.node.children.map(e=>new dL(this.unwrapper,e))}get depth(){return this.node.depth}get visibleChildrenCount(){return this.node.visibleChildrenCount}get visibleChildIndex(){return this.node.visibleChildIndex}get collapsible(){return this.node.collapsible}get collapsed(){return this.node.collapsed}get visible(){return this.node.visible}get filterData(){return this.node.filterData}constructor(e,t){this.unwrapper=e,this.node=t}}function VY(o,e){return{...e,identityProvider:e.identityProvider&&{getId(t){return e.identityProvider.getId(o(t))},getGroupId:e.identityProvider.getGroupId?t=>e.identityProvider.getGroupId(o(t)):void 0},sorter:e.sorter&&{compare(t,i){return e.sorter.compare(t.elements[0],i.elements[0])}},filter:e.filter&&{filter(t,i){const n=t.elements;for(let s=0;s<n.length-1;s++){const r=e.filter.filter(n[s],i);i=nl(Ju(r)?r.visibility:r)}return e.filter.filter(n[n.length-1],i)}}}}class UY{get onDidSpliceModel(){return l.Event.map(this.model.onDidSpliceModel,({insertedNodes:e,deletedNodes:t})=>({insertedNodes:e.map(i=>this.nodeMapper.map(i)),deletedNodes:t.map(i=>this.nodeMapper.map(i))}))}get onDidSpliceRenderedNodes(){return l.Event.map(this.model.onDidSpliceRenderedNodes,({start:e,deleteCount:t,elements:i})=>({start:e,deleteCount:t,elements:i.map(n=>this.nodeMapper.map(n))}))}get onDidChangeCollapseState(){return l.Event.map(this.model.onDidChangeCollapseState,({node:e,deep:t})=>({node:this.nodeMapper.map(e),deep:t}))}get onDidChangeRenderNodeCount(){return l.Event.map(this.model.onDidChangeRenderNodeCount,e=>this.nodeMapper.map(e))}constructor(e,t={}){this.rootRef=null,this.elementMapper=t.elementMapper||zY;const i=n=>this.elementMapper(n.elements);this.nodeMapper=new nL(n=>new dL(i,n)),this.model=new BY(e,VY(i,t))}setChildren(e,t=l.Iterable.empty(),i={}){this.model.setChildren(e,t,i)}isCompressionEnabled(){return this.model.isCompressionEnabled()}setCompressionEnabled(e){this.model.setCompressionEnabled(e)}has(e){return this.model.has(e)}getListIndex(e){return this.model.getListIndex(e)}getListRenderCount(e){return this.model.getListRenderCount(e)}getNode(e){return this.nodeMapper.map(this.model.getNode(e))}getNodeLocation(e){return e.element}getParentNodeLocation(e){return this.model.getParentNodeLocation(e)}getFirstElementChild(e){const t=this.model.getFirstElementChild(e);return t===null||typeof t>"u"?t:this.elementMapper(t.elements)}isCollapsible(e){return this.model.isCollapsible(e)}setCollapsible(e,t){return this.model.setCollapsible(e,t)}isCollapsed(e){return this.model.isCollapsed(e)}setCollapsed(e,t,i){return this.model.setCollapsed(e,t,i)}expandTo(e){return this.model.expandTo(e)}rerender(e){return this.model.rerender(e)}refilter(){return this.model.refilter()}resort(e=null,t=!0){return this.model.resort(e,t)}getCompressedTreeNode(e=null){return this.model.getNode(e)}}var $Y=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s};class uL extends QM{get onDidChangeCollapseState(){return this.model.onDidChangeCollapseState}constructor(e,t,i,n,s={}){super(e,t,i,n,s),this.user=e}setChildren(e,t=l.Iterable.empty(),i){this.model.setChildren(e,t,i)}rerender(e){if(e===void 0){this.view.rerender();return}this.model.rerender(e)}resort(e,t=!0){this.model.resort(e,t)}hasElement(e){return this.model.has(e)}createModel(e,t){return new cL(e,t)}}class WM{get compressedTreeNodeProvider(){return this._compressedTreeNodeProvider()}constructor(e,t,i){this._compressedTreeNodeProvider=e,this.stickyScrollDelegate=t,this.renderer=i,this.templateId=i.templateId,i.onDidChangeTwistieState&&(this.onDidChangeTwistieState=i.onDidChangeTwistieState)}renderTemplate(e){return{compressedTreeNode:void 0,data:this.renderer.renderTemplate(e)}}renderElement(e,t,i,n){let s=this.stickyScrollDelegate.getCompressedNode(e);s||(s=this.compressedTreeNodeProvider.getCompressedTreeNode(e.element)),s.element.elements.length===1?(i.compressedTreeNode=void 0,this.renderer.renderElement(e,t,i.data,n)):(i.compressedTreeNode=s,this.renderer.renderCompressedElements(s,t,i.data,n))}disposeElement(e,t,i,n){i.compressedTreeNode?this.renderer.disposeCompressedElements?.(i.compressedTreeNode,t,i.data,n):this.renderer.disposeElement?.(e,t,i.data,n)}disposeTemplate(e){this.renderer.disposeTemplate(e.data)}renderTwistie(e,t){return this.renderer.renderTwistie?.(e,t)??!1}}$Y([et],WM.prototype,"compressedTreeNodeProvider",null);class KY{constructor(e){this.modelProvider=e,this.compressedStickyNodes=new Map}getCompressedNode(e){return this.compressedStickyNodes.get(e)}constrainStickyScrollNodes(e,t,i){if(this.compressedStickyNodes.clear(),e.length===0)return[];for(let n=0;n<e.length;n++){const s=e[n],r=s.position+s.height;if(n+1<e.length&&r+e[n+1].height>i||n>=t-1&&t<e.length){const c=e.slice(0,n),h=e.slice(n),d=this.compressStickyNodes(h);return[...c,d]}}return e}compressStickyNodes(e){if(e.length===0)throw new Error("Can't compress empty sticky nodes");const t=this.modelProvider();if(!t.isCompressionEnabled())return e[0];const i=[];for(let h=0;h<e.length;h++){const d=e[h],u=t.getCompressedTreeNode(d.node.element);if(u.element){if(h!==0&&u.element.incompressible)break;i.push(...u.element.elements)}}if(i.length<2)return e[0];const n=e[e.length-1],s={elements:i,incompressible:!1},r={...n.node,children:[],element:s},a=new Proxy(e[0].node,{}),c={node:a,startIndex:e[0].startIndex,endIndex:n.endIndex,position:e[0].position,height:e[0].height};return this.compressedStickyNodes.set(a,r),c}}function GY(o,e){return e&&{...e,keyboardNavigationLabelProvider:e.keyboardNavigationLabelProvider&&{getKeyboardNavigationLabel(t){let i;try{i=o().getCompressedTreeNode(t)}catch{return e.keyboardNavigationLabelProvider.getKeyboardNavigationLabel(t)}return i.element.elements.length===1?e.keyboardNavigationLabelProvider.getKeyboardNavigationLabel(t):e.keyboardNavigationLabelProvider.getCompressedNodeKeyboardNavigationLabel(i.element.elements)}}}}class HM extends uL{constructor(e,t,i,n,s={}){const r=()=>this,a=new KY(()=>this.model),c=n.map(h=>new WM(r,a,h));super(e,t,i,c,{...GY(r,s),stickyScrollDelegate:a})}setChildren(e,t=l.Iterable.empty(),i){this.model.setChildren(e,t,i)}createModel(e,t){return new UY(e,t)}updateOptions(e={}){super.updateOptions(e),typeof e.compressionEnabled<"u"&&this.model.setCompressionEnabled(e.compressionEnabled)}getCompressedTreeNode(e=null){return this.model.getCompressedTreeNode(e)}}function fL(o){return{...o,children:[],refreshPromise:void 0,stale:!0,slow:!1,forceExpanded:!1}}function gL(o,e){return e.parent?e.parent===o?!0:gL(o,e.parent):!1}function jY(o,e){return o===e||gL(o,e)||gL(e,o)}class mL{get element(){return this.node.element.element}get children(){return this.node.children.map(e=>new mL(e))}get depth(){return this.node.depth}get visibleChildrenCount(){return this.node.visibleChildrenCount}get visibleChildIndex(){return this.node.visibleChildIndex}get collapsible(){return this.node.collapsible}get collapsed(){return this.node.collapsed}get visible(){return this.node.visible}get filterData(){return this.node.filterData}constructor(e){this.node=e}}class qY{constructor(e,t,i){this.renderer=e,this.nodeMapper=t,this.onDidChangeTwistieState=i,this.renderedNodes=new Map,this.templateId=e.templateId}renderTemplate(e){return{templateData:this.renderer.renderTemplate(e)}}renderElement(e,t,i,n){this.renderer.renderElement(this.nodeMapper.map(e),t,i.templateData,n)}renderTwistie(e,t){return e.slow?(t.classList.add(..._.ThemeIcon.asClassNameArray(l.Codicon.treeItemLoading)),!0):(t.classList.remove(..._.ThemeIcon.asClassNameArray(l.Codicon.treeItemLoading)),!1)}disposeElement(e,t,i,n){this.renderer.disposeElement?.(this.nodeMapper.map(e),t,i.templateData,n)}disposeTemplate(e){this.renderer.disposeTemplate(e.templateData)}dispose(){this.renderedNodes.clear()}}function eA(o){return{browserEvent:o.browserEvent,elements:o.elements.map(e=>e.element)}}function tA(o){return{browserEvent:o.browserEvent,element:o.element&&o.element.element,target:o.target}}class YY extends $u{constructor(e){super(e.elements.map(t=>t.element)),this.data=e}}function pL(o){return o instanceof $u?new YY(o):o}class ZY{constructor(e){this.dnd=e}getDragURI(e){return this.dnd.getDragURI(e.element)}getDragLabel(e,t){if(this.dnd.getDragLabel)return this.dnd.getDragLabel(e.map(i=>i.element),t)}onDragStart(e,t){this.dnd.onDragStart?.(pL(e),t)}onDragOver(e,t,i,n,s,r=!0){return this.dnd.onDragOver(pL(e),t&&t.element,i,n,s)}drop(e,t,i,n,s){this.dnd.drop(pL(e),t&&t.element,i,n,s)}onDragEnd(e){this.dnd.onDragEnd?.(e)}dispose(){this.dnd.dispose()}}class QY extends jM{constructor(e,t,i){super(t,i),this.findProvider=e,this.isFindSessionActive=!1}filter(e,t){const i=super.filter(e,t);if(!this.isFindSessionActive||this.findMode===an.Highlight||!this.findProvider.isVisible)return i;const n=Ju(i)?i.visibility:i;return nl(n)===0?0:this.findProvider.isVisible(e)?i:0}}class XY extends qM{constructor(e,t,i,n,s){super(e,i,n,s),this.findProvider=t,this.filter=i,this.activeSession=!1,this.asyncWorkInProgress=!1,this.disposables.add(l.toDisposable(async()=>{this.activeSession&&await this.findProvider.endSession?.()}))}render(){if(this.asyncWorkInProgress||!this.activeFindMetadata)return;const e=this.activeFindMetadata.matchCount===0&&this.pattern.length>0;this.renderMessage(e),this.pattern.length&&this.alertResults(this.activeFindMetadata.matchCount)}shouldAllowFocus(e){return this.shouldFocusWhenNavigating(e)}shouldFocusWhenNavigating(e){if(!this.activeSession||!this.activeFindMetadata)return!0;const t=e.element?.element;return t&&this.activeFindMetadata.isMatch(t)?!0:!_.FuzzyScore.isDefault(e.filterData)}}function iA(o){return o&&{...o,collapseByDefault:!0,identityProvider:o.identityProvider&&{getId(e){return o.identityProvider.getId(e.element)},getGroupId:o.identityProvider.getGroupId?e=>o.identityProvider.getGroupId(e.element):void 0},dnd:o.dnd&&new ZY(o.dnd),multipleSelectionController:o.multipleSelectionController&&{isSelectionSingleChangeEvent(e){return o.multipleSelectionController.isSelectionSingleChangeEvent({...e,element:e.element})},isSelectionRangeChangeEvent(e){return o.multipleSelectionController.isSelectionRangeChangeEvent({...e,element:e.element})}},accessibilityProvider:o.accessibilityProvider&&{...o.accessibilityProvider,getPosInSet:void 0,getSetSize:void 0,getRole:o.accessibilityProvider.getRole?e=>o.accessibilityProvider.getRole(e.element):()=>"treeitem",isChecked:o.accessibilityProvider.isChecked?e=>!!o.accessibilityProvider?.isChecked(e.element):void 0,getAriaLabel(e){return o.accessibilityProvider.getAriaLabel(e.element)},getWidgetAriaLabel(){return o.accessibilityProvider.getWidgetAriaLabel()},getWidgetRole:o.accessibilityProvider.getWidgetRole?()=>o.accessibilityProvider.getWidgetRole():()=>"tree",getAriaLevel:o.accessibilityProvider.getAriaLevel&&(e=>o.accessibilityProvider.getAriaLevel(e.element)),getActiveDescendantId:o.accessibilityProvider.getActiveDescendantId&&(e=>o.accessibilityProvider.getActiveDescendantId(e.element))},filter:o.filter&&{filter(e,t){return o.filter.filter(e.element,t)}},keyboardNavigationLabelProvider:o.keyboardNavigationLabelProvider&&{...o.keyboardNavigationLabelProvider,getKeyboardNavigationLabel(e){return o.keyboardNavigationLabelProvider.getKeyboardNavigationLabel(e.element)}},sorter:void 0,expandOnlyOnTwistieClick:typeof o.expandOnlyOnTwistieClick>"u"?void 0:typeof o.expandOnlyOnTwistieClick!="function"?o.expandOnlyOnTwistieClick:(e=>o.expandOnlyOnTwistieClick(e.element)),twistieAdditionalCssClass:typeof o.twistieAdditionalCssClass>"u"?void 0:(e=>o.twistieAdditionalCssClass(e.element)),defaultFindVisibility:e=>e.hasChildren&&e.stale?1:typeof o.defaultFindVisibility=="number"?o.defaultFindVisibility:typeof o.defaultFindVisibility>"u"?2:o.defaultFindVisibility(e.element),stickyScrollDelegate:o.stickyScrollDelegate}}function _L(o,e){e(o),o.children.forEach(t=>_L(t,e))}class nA{get onDidScroll(){return this.tree.onDidScroll}get onDidChangeFocus(){return l.Event.map(this.tree.onDidChangeFocus,eA)}get onDidChangeSelection(){return l.Event.map(this.tree.onDidChangeSelection,eA)}get onMouseDblClick(){return l.Event.map(this.tree.onMouseDblClick,tA)}get onPointer(){return l.Event.map(this.tree.onPointer,tA)}get onDidFocus(){return this.tree.onDidFocus}get onDidChangeModel(){return this.tree.onDidChangeModel}get onDidChangeCollapseState(){return this.tree.onDidChangeCollapseState}get onDidChangeStickyScrollFocused(){return this.tree.onDidChangeStickyScrollFocused}get onDidDispose(){return this.tree.onDidDispose}constructor(e,t,i,n,s,r={}){this.user=e,this.dataSource=s,this.nodes=new Map,this.subTreeRefreshPromises=new Map,this.refreshPromises=new Map,this._onDidRender=new l.Emitter,this._onDidChangeNodeSlowState=new l.Emitter,this.nodeMapper=new nL(h=>new mL(h)),this.disposables=new l.DisposableStore,this.identityProvider=r.identityProvider,this.autoExpandSingleChildren=typeof r.autoExpandSingleChildren>"u"?!1:r.autoExpandSingleChildren,this.sorter=r.sorter,this.getDefaultCollapseState=h=>r.collapseByDefault?r.collapseByDefault(h)?ki.PreserveOrCollapsed:ki.PreserveOrExpanded:void 0;let a=!1,c;if(r.findProvider&&(r.findWidgetEnabled??!0)&&r.keyboardNavigationLabelProvider&&r.contextViewProvider&&(a=!0,c=new QY(r.findProvider,r.keyboardNavigationLabelProvider,r.filter)),this.tree=this.createTree(e,t,i,n,{...r,findWidgetEnabled:!a,filter:c??r.filter}),this.root=fL({element:void 0,parent:null,hasChildren:!0,defaultCollapseState:void 0}),this.identityProvider&&(this.root={...this.root,id:null}),this.nodes.set(null,this.root),this.tree.onDidChangeCollapseState(this._onDidChangeCollapseState,this,this.disposables),a){const h={styles:r.findWidgetStyles,showNotFoundMessage:r.showNotFoundMessage,defaultFindMatchType:r.defaultFindMatchType,defaultFindMode:r.defaultFindMode};this.findController=this.disposables.add(new XY(this.tree,r.findProvider,c,this.tree.options.contextViewProvider,h)),this.focusNavigationFilter=d=>this.findController.shouldFocusWhenNavigating(d),this.onDidChangeFindOpenState=this.findController.onDidChangeOpenState,this.onDidChangeFindMode=this.findController.onDidChangeMode,this.onDidChangeFindMatchType=this.findController.onDidChangeMatchType}else this.onDidChangeFindOpenState=this.tree.onDidChangeFindOpenState,this.onDidChangeFindMode=this.tree.onDidChangeFindMode,this.onDidChangeFindMatchType=this.tree.onDidChangeFindMatchType}createTree(e,t,i,n,s){const r=new rL(i),a=n.map(h=>new qY(h,this.nodeMapper,this._onDidChangeNodeSlowState.event)),c=iA(s)||{};return new uL(e,t,r,a,c)}updateOptions(e={}){this.findController&&(e.defaultFindMode!==void 0&&(this.findController.mode=e.defaultFindMode),e.defaultFindMatchType!==void 0&&(this.findController.matchType=e.defaultFindMatchType)),this.tree.updateOptions(e)}getHTMLElement(){return this.tree.getHTMLElement()}get scrollTop(){return this.tree.scrollTop}set scrollTop(e){this.tree.scrollTop=e}get scrollHeight(){return this.tree.scrollHeight}get renderHeight(){return this.tree.renderHeight}domFocus(){this.tree.domFocus()}layout(e,t){this.tree.layout(e,t)}style(e){this.tree.style(e)}getInput(){return this.root.element}async setInput(e,t){this.cancelAllRefreshPromises(),this.root.element=e;const i=t&&{viewState:t,focus:[],selection:[]};await this._updateChildren(e,!0,!1,i),i&&(this.tree.setFocus(i.focus),this.tree.setSelection(i.selection)),t&&typeof t.scrollTop=="number"&&(this.scrollTop=t.scrollTop)}cancelAllRefreshPromises(e=!1){this.refreshPromises.forEach(t=>t.cancel()),this.refreshPromises.clear(),e&&(this.subTreeRefreshPromises.forEach(t=>t.cancel()),this.subTreeRefreshPromises.clear())}async _updateChildren(e=this.root.element,t=!0,i=!1,n,s){if(typeof this.root.element>"u")throw new rn(this.user,"Tree input not set");this.root.refreshPromise&&(await this.root.refreshPromise,await l.Event.toPromise(this._onDidRender.event));const r=this.getDataNode(e);if(await this.refreshAndRenderNode(r,t,n,s),i)try{this.tree.rerender(r)}catch{}}rerender(e){if(e===void 0||e===this.root.element){this.tree.rerender();return}const t=this.getDataNode(e);this.tree.rerender(t)}getNode(e=this.root.element){const t=this.getDataNode(e),i=this.tree.getNode(t===this.root?null:t);return this.nodeMapper.map(i)}collapse(e,t=!1){const i=this.getDataNode(e);return this.tree.collapse(i===this.root?null:i,t)}async expand(e,t=!1){if(typeof this.root.element>"u")throw new rn(this.user,"Tree input not set");this.root.refreshPromise&&(await this.root.refreshPromise,await l.Event.toPromise(this._onDidRender.event));const i=this.getDataNode(e);if(this.tree.hasElement(i)&&!this.tree.isCollapsible(i)||(i.refreshPromise&&(await i.refreshPromise,await l.Event.toPromise(this._onDidRender.event)),i!==this.root&&!i.refreshPromise&&!this.tree.isCollapsed(i)))return!1;const n=this.tree.expand(i===this.root?null:i,t);return i.refreshPromise&&(await i.refreshPromise,await l.Event.toPromise(this._onDidRender.event)),n}setSelection(e,t){const i=e.map(n=>this.getDataNode(n));this.tree.setSelection(i,t)}getSelection(){return this.tree.getSelection().map(t=>t.element)}setFocus(e,t){const i=e.map(n=>this.getDataNode(n));this.tree.setFocus(i,t)}getFocus(){return this.tree.getFocus().map(t=>t.element)}reveal(e,t){this.tree.reveal(this.getDataNode(e),t)}getParentElement(e){const t=this.tree.getParentElement(this.getDataNode(e));return t&&t.element}getFirstElementChild(e=this.root.element){const t=this.getDataNode(e),i=this.tree.getFirstElementChild(t===this.root?null:t);return i&&i.element}getDataNode(e){const t=this.nodes.get(e===this.root.element?null:e);if(!t){const i=this.identityProvider?.getId(e).toString();throw new rn(this.user,`Data tree node not found${i?`: ${i}`:""}`)}return t}async refreshAndRenderNode(e,t,i,n){this.disposables.isDisposed||(await this.refreshNode(e,t,i),!this.disposables.isDisposed&&this.render(e,i,n))}async refreshNode(e,t,i){let n;if(this.subTreeRefreshPromises.forEach((s,r)=>{!n&&jY(r,e)&&(n=s.then(()=>this.refreshNode(e,t,i)))}),n)return n;if(e!==this.root&&this.tree.getNode(e).collapsed){e.hasChildren=!!this.dataSource.hasChildren(e.element),e.stale=!0,this.setChildren(e,[],t,i);return}return this.doRefreshSubTree(e,t,i)}async doRefreshSubTree(e,t,i){const n=l.createCancelablePromise(async()=>{const s=await this.doRefreshNode(e,t,i);e.stale=!1,await l.Promises.settled(s.map(r=>this.doRefreshSubTree(r,t,i)))});return e.refreshPromise=n,this.subTreeRefreshPromises.set(e,n),n.finally(()=>{e.refreshPromise=void 0,this.subTreeRefreshPromises.delete(e)}),n}async doRefreshNode(e,t,i){e.hasChildren=!!this.dataSource.hasChildren(e.element);let n;if(!e.hasChildren)n=Promise.resolve(l.Iterable.empty());else{const s=this.doGetChildren(e);if(l.isIterable(s))n=Promise.resolve(s);else{const r=l.timeout(800);r.then(()=>{e.slow=!0,this._onDidChangeNodeSlowState.fire(e)},a=>null),n=s.finally(()=>r.cancel())}}try{const s=await n;return this.setChildren(e,s,t,i)}catch(s){if(e!==this.root&&this.tree.hasElement(e)&&this.tree.collapse(e),l.isCancellationError(s))return[];throw s}finally{e.slow&&(e.slow=!1,this._onDidChangeNodeSlowState.fire(e))}}doGetChildren(e){let t=this.refreshPromises.get(e);if(t)return t;const i=this.dataSource.getChildren(e.element);return l.isIterable(i)?this.processChildren(i):(t=l.createCancelablePromise(async()=>this.processChildren(await i)),this.refreshPromises.set(e,t),t.finally(()=>{this.refreshPromises.delete(e)}))}_onDidChangeCollapseState({node:e,deep:t}){e.element!==null&&!e.collapsed&&e.element.stale&&(t?this.collapse(e.element.element):this.refreshAndRenderNode(e.element,!1).catch(l.onUnexpectedError))}setChildren(e,t,i,n){const s=[...t];if(e.children.length===0&&s.length===0)return[];const r=new Map,a=new Map;for(const d of e.children)r.set(d.element,d),this.identityProvider&&a.set(d.id,{node:d,collapsed:this.tree.hasElement(d)&&this.tree.isCollapsed(d)});const c=[],h=s.map(d=>{const u=!!this.dataSource.hasChildren(d);if(!this.identityProvider){const p=fL({element:d,parent:e,hasChildren:u,defaultCollapseState:this.getDefaultCollapseState(d)});return u&&p.defaultCollapseState===ki.PreserveOrExpanded&&c.push(p),p}const f=this.identityProvider.getId(d).toString(),g=a.get(f);if(g){const p=g.node;return r.delete(p.element),this.nodes.delete(p.element),this.nodes.set(d,p),p.element=d,p.hasChildren=u,i?g.collapsed?(p.children.forEach(b=>_L(b,v=>this.nodes.delete(v.element))),p.children.splice(0,p.children.length),p.stale=!0):c.push(p):u&&!g.collapsed&&c.push(p),p}const m=fL({element:d,parent:e,id:f,hasChildren:u,defaultCollapseState:this.getDefaultCollapseState(d)});return n&&n.viewState.focus&&n.viewState.focus.indexOf(f)>-1&&n.focus.push(m),n&&n.viewState.selection&&n.viewState.selection.indexOf(f)>-1&&n.selection.push(m),(n&&n.viewState.expanded&&n.viewState.expanded.indexOf(f)>-1||u&&m.defaultCollapseState===ki.PreserveOrExpanded)&&c.push(m),m});for(const d of r.values())_L(d,u=>this.nodes.delete(u.element));for(const d of h)this.nodes.set(d.element,d);return l.splice(e.children,0,e.children.length,h),e!==this.root&&this.autoExpandSingleChildren&&h.length===1&&c.length===0&&(h[0].forceExpanded=!0,c.push(h[0])),c}render(e,t,i){const n=e.children.map(r=>this.asTreeElement(r,t)),s=i&&{...i,diffIdentityProvider:i.diffIdentityProvider&&{getId(r){return i.diffIdentityProvider.getId(r.element)},getGroupId:i.diffIdentityProvider.getGroupId?r=>i.diffIdentityProvider.getGroupId(r.element):void 0}};this.tree.setChildren(e===this.root?null:e,n,s),e!==this.root&&this.tree.setCollapsible(e,e.hasChildren),this._onDidRender.fire()}asTreeElement(e,t){if(e.stale)return{element:e,collapsible:e.hasChildren,collapsed:!0};let i;return t&&t.viewState.expanded&&e.id&&t.viewState.expanded.indexOf(e.id)>-1?i=!1:e.forceExpanded?(i=!1,e.forceExpanded=!1):i=e.defaultCollapseState,{element:e,children:e.hasChildren?l.Iterable.map(e.children,n=>this.asTreeElement(n,t)):[],collapsible:e.hasChildren,collapsed:i}}processChildren(e){return this.sorter&&(e=[...e].sort(this.sorter.compare.bind(this.sorter))),e}dispose(){this._onDidRender.dispose(),this._onDidChangeNodeSlowState.dispose(),this.disposables.dispose(),this.tree.dispose()}}class bL{get element(){return{elements:this.node.element.elements.map(e=>e.element),incompressible:this.node.element.incompressible}}get children(){return this.node.children.map(e=>new bL(e))}get depth(){return this.node.depth}get visibleChildrenCount(){return this.node.visibleChildrenCount}get visibleChildIndex(){return this.node.visibleChildIndex}get collapsible(){return this.node.collapsible}get collapsed(){return this.node.collapsed}get visible(){return this.node.visible}get filterData(){return this.node.filterData}constructor(e){this.node=e}}class JY{constructor(e,t,i,n){this.renderer=e,this.nodeMapper=t,this.compressibleNodeMapperProvider=i,this.onDidChangeTwistieState=n,this.renderedNodes=new Map,this.disposables=[],this.templateId=e.templateId}renderTemplate(e){return{templateData:this.renderer.renderTemplate(e)}}renderElement(e,t,i,n){this.renderer.renderElement(this.nodeMapper.map(e),t,i.templateData,n)}renderCompressedElements(e,t,i,n){this.renderer.renderCompressedElements(this.compressibleNodeMapperProvider().map(e),t,i.templateData,n)}renderTwistie(e,t){return e.slow?(t.classList.add(..._.ThemeIcon.asClassNameArray(l.Codicon.treeItemLoading)),!0):(t.classList.remove(..._.ThemeIcon.asClassNameArray(l.Codicon.treeItemLoading)),!1)}disposeElement(e,t,i,n){this.renderer.disposeElement?.(this.nodeMapper.map(e),t,i.templateData,n)}disposeCompressedElements(e,t,i,n){this.renderer.disposeCompressedElements?.(this.compressibleNodeMapperProvider().map(e),t,i.templateData,n)}disposeTemplate(e){this.renderer.disposeTemplate(e.templateData)}dispose(){this.renderedNodes.clear(),this.disposables=l.dispose(this.disposables)}}function WY(o){const e=o&&iA(o);return e&&{...e,keyboardNavigationLabelProvider:e.keyboardNavigationLabelProvider&&{...e.keyboardNavigationLabelProvider,getCompressedNodeKeyboardNavigationLabel(t){return o.keyboardNavigationLabelProvider.getCompressedNodeKeyboardNavigationLabel(t.map(i=>i.element))}},stickyScrollDelegate:e.stickyScrollDelegate}}class HY extends nA{constructor(e,t,i,n,s,r,a={}){super(e,t,i,s,r,a),this.compressionDelegate=n,this.compressibleNodeMapper=new nL(c=>new bL(c)),this.filter=a.filter}createTree(e,t,i,n,s){const r=new rL(i),a=n.map(h=>new JY(h,this.nodeMapper,()=>this.compressibleNodeMapper,this._onDidChangeNodeSlowState.event)),c=WY(s)||{};return new HM(e,t,r,a,c)}asTreeElement(e,t){return{incompressible:this.compressionDelegate.isIncompressible(e.element),...super.asTreeElement(e,t)}}render(e,t,i){if(!this.identityProvider)return super.render(e,t);const n=g=>this.identityProvider.getId(g).toString(),s=g=>{const m=new Set;for(const p of g){const b=this.tree.getCompressedTreeNode(p===this.root?null:p);if(b.element)for(const v of b.element.elements)m.add(n(v.element))}return m},r=s(this.tree.getSelection()),a=s(this.tree.getFocus());super.render(e,t,i);const c=this.getSelection();let h=!1;const d=this.getFocus();let u=!1;const f=g=>{const m=g.element;if(m)for(let p=0;p<m.elements.length;p++){const b=n(m.elements[p].element),v=m.elements[m.elements.length-1].element;r.has(b)&&c.indexOf(v)===-1&&(c.push(v),h=!0),a.has(b)&&d.indexOf(v)===-1&&(d.push(v),u=!0)}g.children.forEach(f)};f(this.tree.getCompressedTreeNode(e===this.root?null:e)),h&&this.setSelection(c),u&&this.setFocus(d)}processChildren(e){return this.filter&&(e=l.Iterable.filter(e,t=>{const i=this.filter.filter(t,1),n=eZ(i);if(n===2)throw new Error("Recursive tree visibility not supported in async data compressed trees");return n===1})),super.processChildren(e)}}function eZ(o){return typeof o=="boolean"?o?1:0:Ju(o)?nl(o.visibility):nl(o)}class tZ extends QM{constructor(e,t,i,n,s,r={}){super(e,t,i,n,r),this.user=e,this.dataSource=s,this.identityProvider=r.identityProvider}createModel(e,t){return new cL(e,t)}}var Ro=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},$e=function(o,e){return function(t,i){e(t,i,o)}};const ts=le("listService");class iZ{get lastFocusedList(){return this._lastFocusedWidget}constructor(){this.disposables=new l.DisposableStore,this.lists=[],this._lastFocusedWidget=void 0}setLastFocusedList(e){e!==this._lastFocusedWidget&&(this._lastFocusedWidget?.getHTMLElement().classList.remove("last-focused"),this._lastFocusedWidget=e,this._lastFocusedWidget?.getHTMLElement().classList.add("last-focused"))}register(e,t){if(this.lists.some(n=>n.widget===e))throw new Error("Cannot register the same widget multiple times");const i={widget:e,extraContextKeys:t};return this.lists.push(i),sd(e.getHTMLElement())&&this.setLastFocusedList(e),l.combinedDisposable(e.onDidFocus(()=>this.setLastFocusedList(e)),l.toDisposable(()=>this.lists.splice(this.lists.indexOf(i),1)),e.onDidDispose(()=>{this.lists=this.lists.filter(n=>n!==i),this._lastFocusedWidget===e&&this.setLastFocusedList(void 0)}))}dispose(){this.disposables.dispose()}}const Wu=new q("listScrollAtBoundary","none");de.or(Wu.isEqualTo("top"),Wu.isEqualTo("both")),de.or(Wu.isEqualTo("bottom"),Wu.isEqualTo("both"));const sA=new q("listFocus",!0),oA=new q("treestickyScrollFocused",!1),Hp=new q("listSupportsMultiselect",!0),nZ=de.and(sA,de.not(HR),oA.negate()),CL=new q("listHasSelectionOrFocus",!1),vL=new q("listDoubleSelection",!1),wL=new q("listMultiSelection",!1),e_=new q("listSelectionNavigation",!1),sZ=new q("listSupportsFind",!0),rA=new q("treeElementCanCollapse",!1),oZ=new q("treeElementHasParent",!1),aA=new q("treeElementCanExpand",!1),rZ=new q("treeElementHasChild",!1),aZ=new q("treeFindOpen",!1),lA="listTypeNavigationMode",cA="listAutomaticKeyboardNavigation";function t_(o,e){const t=o.createScoped(e.getHTMLElement());return sA.bindTo(t),t}function i_(o,e){const t=Wu.bindTo(o),i=()=>{const n=e.scrollTop===0,s=e.scrollHeight-e.renderHeight-e.scrollTop<1;n&&s?t.set("both"):n?t.set("top"):s?t.set("bottom"):t.set("none")};return i(),e.onDidScroll(i)}const ol="workbench.list.multiSelectModifier",n_="workbench.list.openMode",In="workbench.list.horizontalScrolling",SL="workbench.list.defaultFindMode",yL="workbench.list.typeNavigationMode",s_="workbench.list.keyboardNavigation",is="workbench.list.scrollByPage",LL="workbench.list.defaultFindMatchType",Hu="workbench.tree.indent",o_="workbench.tree.renderIndentGuides",ns="workbench.list.smoothScrolling",Us="workbench.list.mouseWheelScrollSensitivity",$s="workbench.list.fastScrollSensitivity",r_="workbench.tree.expandMode",a_="workbench.tree.enableStickyScroll",l_="workbench.tree.stickyScrollMaxItemCount";function Ks(o){return o.getValue(ol)==="alt"}class lZ extends l.Disposable{constructor(e){super(),this.configurationService=e,this.useAltAsMultipleSelectionModifier=Ks(e),this.registerListeners()}registerListeners(){this._register(this.configurationService.onDidChangeConfiguration(e=>{e.affectsConfiguration(ol)&&(this.useAltAsMultipleSelectionModifier=Ks(this.configurationService))}))}isSelectionSingleChangeEvent(e){return this.useAltAsMultipleSelectionModifier?e.browserEvent.altKey:cM(e)}isSelectionRangeChangeEvent(e){return hM(e)}}function c_(o,e){const t=o.get(Ge),i=o.get(xt),n=new l.DisposableStore;return[{...e,keyboardNavigationDelegate:{mightProducePrintableCharacter(r){return i.mightProducePrintableCharacter(r)}},smoothScrolling:!!t.getValue(ns),mouseWheelScrollSensitivity:t.getValue(Us),fastScrollSensitivity:t.getValue($s),multipleSelectionController:e.multipleSelectionController??n.add(new lZ(t)),keyboardNavigationEventFilter:dZ(i),scrollByPage:!!t.getValue(is)},n]}let hA=class extends zn{constructor(e,t,i,n,s,r,a,c,h){const d=typeof s.horizontalScrolling<"u"?s.horizontalScrolling:!!c.getValue(In),[u,f]=h.invokeFunction(c_,s);super(e,t,i,n,{keyboardSupport:!1,...u,horizontalScrolling:d}),this.disposables.add(f),this.contextKeyService=t_(r,this),this.disposables.add(i_(this.contextKeyService,this)),this.listSupportsMultiSelect=Hp.bindTo(this.contextKeyService),this.listSupportsMultiSelect.set(s.multipleSelectionSupport!==!1),e_.bindTo(this.contextKeyService).set(!!s.selectionNavigation),this.listHasSelectionOrFocus=CL.bindTo(this.contextKeyService),this.listDoubleSelection=vL.bindTo(this.contextKeyService),this.listMultiSelection=wL.bindTo(this.contextKeyService),this.horizontalScrolling=s.horizontalScrolling,this._useAltAsMultipleSelectionModifier=Ks(c),this.disposables.add(this.contextKeyService),this.disposables.add(a.register(this)),this.updateStyles(s.overrideStyles),this.disposables.add(this.onDidChangeSelection(()=>{const m=this.getSelection(),p=this.getFocus();this.contextKeyService.bufferChangeEvents(()=>{this.listHasSelectionOrFocus.set(m.length>0||p.length>0),this.listMultiSelection.set(m.length>1),this.listDoubleSelection.set(m.length===2)})})),this.disposables.add(this.onDidChangeFocus(()=>{const m=this.getSelection(),p=this.getFocus();this.listHasSelectionOrFocus.set(m.length>0||p.length>0)})),this.disposables.add(c.onDidChangeConfiguration(m=>{m.affectsConfiguration(ol)&&(this._useAltAsMultipleSelectionModifier=Ks(c));let p={};if(m.affectsConfiguration(In)&&this.horizontalScrolling===void 0){const b=!!c.getValue(In);p={...p,horizontalScrolling:b}}if(m.affectsConfiguration(is)){const b=!!c.getValue(is);p={...p,scrollByPage:b}}if(m.affectsConfiguration(ns)){const b=!!c.getValue(ns);p={...p,smoothScrolling:b}}if(m.affectsConfiguration(Us)){const b=c.getValue(Us);p={...p,mouseWheelScrollSensitivity:b}}if(m.affectsConfiguration($s)){const b=c.getValue($s);p={...p,fastScrollSensitivity:b}}Object.keys(p).length>0&&this.updateOptions(p)})),this.navigator=new fA(this,{configurationService:c,...s}),this.disposables.add(this.navigator)}updateOptions(e){super.updateOptions(e),e.overrideStyles!==void 0&&this.updateStyles(e.overrideStyles),e.multipleSelectionSupport!==void 0&&this.listSupportsMultiSelect.set(!!e.multipleSelectionSupport)}updateStyles(e){this.style(e?eh(e):Hc)}};hA=Ro([$e(5,be),$e(6,ts),$e(7,Ge),$e(8,me)],hA);let dA=class extends Jq{constructor(e,t,i,n,s,r,a,c,h){const d=typeof s.horizontalScrolling<"u"?s.horizontalScrolling:!!c.getValue(In),[u,f]=h.invokeFunction(c_,s);super(e,t,i,n,{keyboardSupport:!1,...u,horizontalScrolling:d}),this.disposables=new l.DisposableStore,this.disposables.add(f),this.contextKeyService=t_(r,this),this.disposables.add(i_(this.contextKeyService,this.widget)),this.horizontalScrolling=s.horizontalScrolling,this.listSupportsMultiSelect=Hp.bindTo(this.contextKeyService),this.listSupportsMultiSelect.set(s.multipleSelectionSupport!==!1),e_.bindTo(this.contextKeyService).set(!!s.selectionNavigation),this._useAltAsMultipleSelectionModifier=Ks(c),this.disposables.add(this.contextKeyService),this.disposables.add(a.register(this)),this.updateStyles(s.overrideStyles),this.disposables.add(c.onDidChangeConfiguration(m=>{m.affectsConfiguration(ol)&&(this._useAltAsMultipleSelectionModifier=Ks(c));let p={};if(m.affectsConfiguration(In)&&this.horizontalScrolling===void 0){const b=!!c.getValue(In);p={...p,horizontalScrolling:b}}if(m.affectsConfiguration(is)){const b=!!c.getValue(is);p={...p,scrollByPage:b}}if(m.affectsConfiguration(ns)){const b=!!c.getValue(ns);p={...p,smoothScrolling:b}}if(m.affectsConfiguration(Us)){const b=c.getValue(Us);p={...p,mouseWheelScrollSensitivity:b}}if(m.affectsConfiguration($s)){const b=c.getValue($s);p={...p,fastScrollSensitivity:b}}Object.keys(p).length>0&&this.updateOptions(p)})),this.navigator=new fA(this,{configurationService:c,...s}),this.disposables.add(this.navigator)}updateOptions(e){super.updateOptions(e),e.overrideStyles!==void 0&&this.updateStyles(e.overrideStyles),e.multipleSelectionSupport!==void 0&&this.listSupportsMultiSelect.set(!!e.multipleSelectionSupport)}updateStyles(e){this.style(e?eh(e):Hc)}dispose(){this.disposables.dispose(),super.dispose()}};dA=Ro([$e(5,be),$e(6,ts),$e(7,Ge),$e(8,me)],dA);let uA=class extends eL{constructor(e,t,i,n,s,r,a,c,h,d){const u=typeof r.horizontalScrolling<"u"?r.horizontalScrolling:!!h.getValue(In),[f,g]=d.invokeFunction(c_,r);super(e,t,i,n,s,{keyboardSupport:!1,...f,horizontalScrolling:u}),this.disposables.add(g),this.contextKeyService=t_(a,this),this.disposables.add(i_(this.contextKeyService,this)),this.listSupportsMultiSelect=Hp.bindTo(this.contextKeyService),this.listSupportsMultiSelect.set(r.multipleSelectionSupport!==!1),e_.bindTo(this.contextKeyService).set(!!r.selectionNavigation),this.listHasSelectionOrFocus=CL.bindTo(this.contextKeyService),this.listDoubleSelection=vL.bindTo(this.contextKeyService),this.listMultiSelection=wL.bindTo(this.contextKeyService),this.horizontalScrolling=r.horizontalScrolling,this._useAltAsMultipleSelectionModifier=Ks(h),this.disposables.add(this.contextKeyService),this.disposables.add(c.register(this)),this.updateStyles(r.overrideStyles),this.disposables.add(this.onDidChangeSelection(()=>{const p=this.getSelection(),b=this.getFocus();this.contextKeyService.bufferChangeEvents(()=>{this.listHasSelectionOrFocus.set(p.length>0||b.length>0),this.listMultiSelection.set(p.length>1),this.listDoubleSelection.set(p.length===2)})})),this.disposables.add(this.onDidChangeFocus(()=>{const p=this.getSelection(),b=this.getFocus();this.listHasSelectionOrFocus.set(p.length>0||b.length>0)})),this.disposables.add(h.onDidChangeConfiguration(p=>{p.affectsConfiguration(ol)&&(this._useAltAsMultipleSelectionModifier=Ks(h));let b={};if(p.affectsConfiguration(In)&&this.horizontalScrolling===void 0){const v=!!h.getValue(In);b={...b,horizontalScrolling:v}}if(p.affectsConfiguration(is)){const v=!!h.getValue(is);b={...b,scrollByPage:v}}if(p.affectsConfiguration(ns)){const v=!!h.getValue(ns);b={...b,smoothScrolling:v}}if(p.affectsConfiguration(Us)){const v=h.getValue(Us);b={...b,mouseWheelScrollSensitivity:v}}if(p.affectsConfiguration($s)){const v=h.getValue($s);b={...b,fastScrollSensitivity:v}}Object.keys(b).length>0&&this.updateOptions(b)})),this.navigator=new cZ(this,{configurationService:h,...r}),this.disposables.add(this.navigator)}updateOptions(e){super.updateOptions(e),e.overrideStyles!==void 0&&this.updateStyles(e.overrideStyles),e.multipleSelectionSupport!==void 0&&this.listSupportsMultiSelect.set(!!e.multipleSelectionSupport)}updateStyles(e){this.style(e?eh(e):Hc)}dispose(){this.disposables.dispose(),super.dispose()}};uA=Ro([$e(6,be),$e(7,ts),$e(8,Ge),$e(9,me)],uA);class DL extends l.Disposable{constructor(e,t){super(),this.widget=e,this._onDidOpen=this._register(new l.Emitter),this.onDidOpen=this._onDidOpen.event,this._register(l.Event.filter(this.widget.onDidChangeSelection,i=>so(i.browserEvent))(i=>this.onSelectionFromKeyboard(i))),this._register(this.widget.onPointer(i=>this.onPointer(i.element,i.browserEvent))),this._register(this.widget.onMouseDblClick(i=>this.onMouseDblClick(i.element,i.browserEvent))),typeof t?.openOnSingleClick!="boolean"&&t?.configurationService?(this.openOnSingleClick=t?.configurationService.getValue(n_)!=="doubleClick",this._register(t?.configurationService.onDidChangeConfiguration(i=>{i.affectsConfiguration(n_)&&(this.openOnSingleClick=t?.configurationService.getValue(n_)!=="doubleClick")}))):this.openOnSingleClick=t?.openOnSingleClick??!0}onSelectionFromKeyboard(e){if(e.elements.length!==1)return;const t=e.browserEvent,i=typeof t.preserveFocus=="boolean"?t.preserveFocus:!0,n=typeof t.pinned=="boolean"?t.pinned:!i;this._open(this.getSelectedElement(),i,n,!1,e.browserEvent)}onPointer(e,t){if(!this.openOnSingleClick||t.detail===2)return;const n=t.button===1,s=!0,r=n,a=t.ctrlKey||t.metaKey||t.altKey;this._open(e,s,r,a,t)}onMouseDblClick(e,t){if(!t)return;const i=t.target;if(i.classList.contains("monaco-tl-twistie")||i.classList.contains("monaco-icon-label")&&i.classList.contains("folder-icon")&&t.offsetX<16)return;const s=!1,r=!0,a=t.ctrlKey||t.metaKey||t.altKey;this._open(e,s,r,a,t)}_open(e,t,i,n,s){e&&this._onDidOpen.fire({editorOptions:{preserveFocus:t,pinned:i,revealIfVisible:!0},sideBySide:n,element:e,browserEvent:s})}}class fA extends DL{constructor(e,t){super(e,t),this.widget=e}getSelectedElement(){return this.widget.getSelectedElements()[0]}}class cZ extends DL{constructor(e,t){super(e,t)}getSelectedElement(){return this.widget.getSelectedElements()[0]}}class hZ extends DL{constructor(e,t){super(e,t)}getSelectedElement(){return this.widget.getSelection()[0]??void 0}}function dZ(o){let e=!1;return t=>{if(t.toKeyCodeChord().isModifierKey())return!1;if(e)return e=!1,!1;const i=o.softDispatch(t,t.target);return i.kind===1?(e=!0,!1):(e=!1,i.kind===0)}}let h_=class extends uL{get onDidOpen(){return this.internals.onDidOpen}constructor(e,t,i,n,s,r,a,c,h){const{options:d,getTypeNavigationMode:u,disposable:f}=r.invokeFunction(ef,s);super(e,t,i,n,d),this.disposables.add(f),this.internals=new rl(this,s,u,s.overrideStyles,a,c,h),this.disposables.add(this.internals)}updateOptions(e={}){super.updateOptions(e),e.overrideStyles&&this.internals.updateStyleOverrides(e.overrideStyles),this.internals.updateOptions(e)}};h_=Ro([$e(5,me),$e(6,be),$e(7,ts),$e(8,Ge)],h_);let gA=class extends HM{constructor(e,t,i,n,s,r,a,c,h){const{options:d,getTypeNavigationMode:u,disposable:f}=r.invokeFunction(ef,s);super(e,t,i,n,d),this.disposables.add(f),this.internals=new rl(this,s,u,s.overrideStyles,a,c,h),this.disposables.add(this.internals)}updateOptions(e={}){super.updateOptions(e),e.overrideStyles&&this.internals.updateStyleOverrides(e.overrideStyles),this.internals.updateOptions(e)}};gA=Ro([$e(5,me),$e(6,be),$e(7,ts),$e(8,Ge)],gA);let mA=class extends tZ{constructor(e,t,i,n,s,r,a,c,h,d){const{options:u,getTypeNavigationMode:f,disposable:g}=a.invokeFunction(ef,r);super(e,t,i,n,s,u),this.disposables.add(g),this.internals=new rl(this,r,f,r.overrideStyles,c,h,d),this.disposables.add(this.internals)}updateOptions(e={}){super.updateOptions(e),e.overrideStyles!==void 0&&this.internals.updateStyleOverrides(e.overrideStyles),this.internals.updateOptions(e)}};mA=Ro([$e(6,me),$e(7,be),$e(8,ts),$e(9,Ge)],mA),_.WorkbenchAsyncDataTree=class extends nA{get onDidOpen(){return this.internals.onDidOpen}constructor(e,t,i,n,s,r,a,c,h,d){const{options:u,getTypeNavigationMode:f,disposable:g}=a.invokeFunction(ef,r);super(e,t,i,n,s,u),this.disposables.add(g),this.internals=new rl(this,r,f,r.overrideStyles,c,h,d),this.disposables.add(this.internals)}updateOptions(e={}){super.updateOptions(e),e.overrideStyles&&this.internals.updateStyleOverrides(e.overrideStyles),this.internals.updateOptions(e)}},_.WorkbenchAsyncDataTree=Ro([$e(6,me),$e(7,be),$e(8,ts),$e(9,Ge)],_.WorkbenchAsyncDataTree);let pA=class extends HY{constructor(e,t,i,n,s,r,a,c,h,d,u){const{options:f,getTypeNavigationMode:g,disposable:m}=c.invokeFunction(ef,a);super(e,t,i,n,s,r,f),this.disposables.add(m),this.internals=new rl(this,a,g,a.overrideStyles,h,d,u),this.disposables.add(this.internals)}updateOptions(e){super.updateOptions(e),this.internals.updateOptions(e)}};pA=Ro([$e(7,me),$e(8,be),$e(9,ts),$e(10,Ge)],pA);function _A(o){const e=o.getValue(SL);if(e==="highlight")return an.Highlight;if(e==="filter")return an.Filter;const t=o.getValue(s_);if(t==="simple"||t==="highlight")return an.Highlight;if(t==="filter")return an.Filter}function bA(o){const e=o.getValue(LL);if(e==="fuzzy")return es.Fuzzy;if(e==="contiguous")return es.Contiguous}function ef(o,e){const t=o.get(Ge),i=o.get(Fc),n=o.get(be),s=o.get(me),r=()=>{const f=n.getContextKeyValue(lA);if(f==="automatic")return Vs.Automatic;if(f==="trigger"||n.getContextKeyValue(cA)===!1)return Vs.Trigger;const m=t.getValue(yL);if(m==="automatic")return Vs.Automatic;if(m==="trigger")return Vs.Trigger},a=e.horizontalScrolling!==void 0?e.horizontalScrolling:!!t.getValue(In),[c,h]=s.invokeFunction(c_,e),d=e.paddingBottom,u=e.renderIndentGuides!==void 0?e.renderIndentGuides:t.getValue(o_);return{getTypeNavigationMode:r,disposable:h,options:{keyboardSupport:!1,...c,indent:typeof t.getValue(Hu)=="number"?t.getValue(Hu):void 0,renderIndentGuides:u,smoothScrolling:!!t.getValue(ns),defaultFindMode:e.defaultFindMode??_A(t),defaultFindMatchType:e.defaultFindMatchType??bA(t),horizontalScrolling:a,scrollByPage:!!t.getValue(is),paddingBottom:d,hideTwistiesOfChildlessElements:e.hideTwistiesOfChildlessElements,expandOnlyOnTwistieClick:e.expandOnlyOnTwistieClick??t.getValue(r_)==="doubleClick",contextViewProvider:i,findWidgetStyles:Cq,enableStickyScroll:!!t.getValue(a_),stickyScrollMaxItemCount:Number(t.getValue(l_))}}}let rl=class{get onDidOpen(){return this.navigator.onDidOpen}constructor(e,t,i,n,s,r,a){this.tree=e,this.disposables=[],this.contextKeyService=t_(s,e),this.disposables.push(i_(this.contextKeyService,e)),this.listSupportsMultiSelect=Hp.bindTo(this.contextKeyService),this.listSupportsMultiSelect.set(t.multipleSelectionSupport!==!1),e_.bindTo(this.contextKeyService).set(!!t.selectionNavigation),this.listSupportFindWidget=sZ.bindTo(this.contextKeyService),this.listSupportFindWidget.set(t.findWidgetEnabled??!0),this.hasSelectionOrFocus=CL.bindTo(this.contextKeyService),this.hasDoubleSelection=vL.bindTo(this.contextKeyService),this.hasMultiSelection=wL.bindTo(this.contextKeyService),this.treeElementCanCollapse=rA.bindTo(this.contextKeyService),this.treeElementHasParent=oZ.bindTo(this.contextKeyService),this.treeElementCanExpand=aA.bindTo(this.contextKeyService),this.treeElementHasChild=rZ.bindTo(this.contextKeyService),this.treeFindOpen=aZ.bindTo(this.contextKeyService),this.treeStickyScrollFocused=oA.bindTo(this.contextKeyService),this._useAltAsMultipleSelectionModifier=Ks(a),this.updateStyleOverrides(n);const h=()=>{const u=e.getFocus()[0];if(!u)return;const f=e.getNode(u);this.treeElementCanCollapse.set(f.collapsible&&!f.collapsed),this.treeElementHasParent.set(!!e.getParentElement(u)),this.treeElementCanExpand.set(f.collapsible&&f.collapsed),this.treeElementHasChild.set(!!e.getFirstElementChild(u))},d=new Set;d.add(lA),d.add(cA),this.disposables.push(this.contextKeyService,r.register(e),e.onDidChangeSelection(()=>{const u=e.getSelection(),f=e.getFocus();this.contextKeyService.bufferChangeEvents(()=>{this.hasSelectionOrFocus.set(u.length>0||f.length>0),this.hasMultiSelection.set(u.length>1),this.hasDoubleSelection.set(u.length===2)})}),e.onDidChangeFocus(()=>{const u=e.getSelection(),f=e.getFocus();this.hasSelectionOrFocus.set(u.length>0||f.length>0),h()}),e.onDidChangeCollapseState(h),e.onDidChangeModel(h),e.onDidChangeFindOpenState(u=>this.treeFindOpen.set(u)),e.onDidChangeStickyScrollFocused(u=>this.treeStickyScrollFocused.set(u)),a.onDidChangeConfiguration(u=>{let f={};if(u.affectsConfiguration(ol)&&(this._useAltAsMultipleSelectionModifier=Ks(a)),u.affectsConfiguration(Hu)){const g=a.getValue(Hu);f={...f,indent:g}}if(u.affectsConfiguration(o_)&&t.renderIndentGuides===void 0){const g=a.getValue(o_);f={...f,renderIndentGuides:g}}if(u.affectsConfiguration(ns)){const g=!!a.getValue(ns);f={...f,smoothScrolling:g}}if(u.affectsConfiguration(SL)||u.affectsConfiguration(s_)){const g=_A(a);f={...f,defaultFindMode:g}}if(u.affectsConfiguration(yL)||u.affectsConfiguration(s_)){const g=i();f={...f,typeNavigationMode:g}}if(u.affectsConfiguration(LL)){const g=bA(a);f={...f,defaultFindMatchType:g}}if(u.affectsConfiguration(In)&&t.horizontalScrolling===void 0){const g=!!a.getValue(In);f={...f,horizontalScrolling:g}}if(u.affectsConfiguration(is)){const g=!!a.getValue(is);f={...f,scrollByPage:g}}if(u.affectsConfiguration(r_)&&t.expandOnlyOnTwistieClick===void 0&&(f={...f,expandOnlyOnTwistieClick:a.getValue(r_)==="doubleClick"}),u.affectsConfiguration(a_)){const g=a.getValue(a_);f={...f,enableStickyScroll:g}}if(u.affectsConfiguration(l_)){const g=Math.max(1,a.getValue(l_));f={...f,stickyScrollMaxItemCount:g}}if(u.affectsConfiguration(Us)){const g=a.getValue(Us);f={...f,mouseWheelScrollSensitivity:g}}if(u.affectsConfiguration($s)){const g=a.getValue($s);f={...f,fastScrollSensitivity:g}}Object.keys(f).length>0&&e.updateOptions(f)}),this.contextKeyService.onDidChangeContext(u=>{u.affectsSome(d)&&e.updateOptions({typeNavigationMode:i()})})),this.navigator=new hZ(e,{configurationService:a,...t}),this.disposables.push(this.navigator)}updateOptions(e){e.multipleSelectionSupport!==void 0&&this.listSupportsMultiSelect.set(!!e.multipleSelectionSupport)}updateStyleOverrides(e){this.tree.style(e?eh(e):Hc)}dispose(){this.disposables=l.dispose(this.disposables)}};rl=Ro([$e(4,be),$e(5,ts),$e(6,Ge)],rl),St.as(Xo.Configuration).registerConfiguration({id:"workbench",order:7,title:l.localize(1768,"Workbench"),type:"object",properties:{[ol]:{type:"string",enum:["ctrlCmd","alt"],markdownEnumDescriptions:[l.localize(1769,"Maps to `Control` on Windows and Linux and to `Command` on macOS."),l.localize(1770,"Maps to `Alt` on Windows and Linux and to `Option` on macOS.")],default:"ctrlCmd",description:l.localize(1771,"The modifier to be used to add an item in trees and lists to a multi-selection with the mouse (for example in the explorer, open editors and scm view). The 'Open to Side' mouse gestures - if supported - will adapt such that they do not conflict with the multiselect modifier.")},[n_]:{type:"string",enum:["singleClick","doubleClick"],default:"singleClick",description:l.localize(1772,"Controls how to open items in trees and lists using the mouse (if supported). Note that some trees and lists might choose to ignore this setting if it is not applicable.")},[In]:{type:"boolean",default:!1,description:l.localize(1773,"Controls whether lists and trees support horizontal scrolling in the workbench. Warning: turning on this setting has a performance implication.")},[is]:{type:"boolean",default:!1,description:l.localize(1774,"Controls whether clicks in the scrollbar scroll page by page.")},[Hu]:{type:"number",default:8,minimum:4,maximum:40,description:l.localize(1775,"Controls tree indentation in pixels.")},[o_]:{type:"string",enum:["none","onHover","always"],default:"onHover",description:l.localize(1776,"Controls whether the tree should render indent guides.")},[ns]:{type:"boolean",default:!1,description:l.localize(1777,"Controls whether lists and trees have smooth scrolling.")},[Us]:{type:"number",default:1,markdownDescription:l.localize(1778,"A multiplier to be used on the `deltaX` and `deltaY` of mouse wheel scroll events.")},[$s]:{type:"number",default:5,markdownDescription:l.localize(1779,"Scrolling speed multiplier when pressing `Alt`.")},[SL]:{type:"string",enum:["highlight","filter"],enumDescriptions:[l.localize(1780,"Highlight elements when searching. Further up and down navigation will traverse only the highlighted elements."),l.localize(1781,"Filter elements when searching.")],default:"highlight",description:l.localize(1782,"Controls the default find mode for lists and trees in the workbench.")},[s_]:{type:"string",enum:["simple","highlight","filter"],enumDescriptions:[l.localize(1783,"Simple keyboard navigation focuses elements which match the keyboard input. Matching is done only on prefixes."),l.localize(1784,"Highlight keyboard navigation highlights elements which match the keyboard input. Further up and down navigation will traverse only the highlighted elements."),l.localize(1785,"Filter keyboard navigation will filter out and hide all the elements which do not match the keyboard input.")],default:"highlight",description:l.localize(1786,"Controls the keyboard navigation style for lists and trees in the workbench. Can be simple, highlight and filter."),deprecated:!0,deprecationMessage:l.localize(1787,"Please use 'workbench.list.defaultFindMode' and 'workbench.list.typeNavigationMode' instead.")},[LL]:{type:"string",enum:["fuzzy","contiguous"],enumDescriptions:[l.localize(1788,"Use fuzzy matching when searching."),l.localize(1789,"Use contiguous matching when searching.")],default:"fuzzy",description:l.localize(1790,"Controls the type of matching used when searching lists and trees in the workbench.")},[r_]:{type:"string",enum:["singleClick","doubleClick"],default:"singleClick",description:l.localize(1791,"Controls how tree folders are expanded when clicking the folder names. Note that some trees and lists might choose to ignore this setting if it is not applicable.")},[a_]:{type:"boolean",default:!0,description:l.localize(1792,"Controls whether sticky scrolling is enabled in trees.")},[l_]:{type:"number",minimum:1,default:7,markdownDescription:l.localize(1793,"Controls the number of sticky elements displayed in the tree when {0} is enabled.","`#workbench.tree.enableStickyScroll#`")},[yL]:{type:"string",enum:["automatic","trigger"],default:"automatic",markdownDescription:l.localize(1794,"Controls how type navigation works in lists and trees in the workbench. When set to `trigger`, type navigation begins once the `list.triggerTypeNavigation` command is run.")}}});class uZ extends l.Disposable{constructor(e,t=[]){super(),this.logger=new bB([e,...t]),this._register(e.onDidChangeLogLevel(i=>this.setLevel(i)))}get onDidChangeLogLevel(){return this.logger.onDidChangeLogLevel}setLevel(e){this.logger.setLevel(e)}getLevel(){return this.logger.getLevel()}trace(e,...t){this.logger.trace(e,...t)}debug(e,...t){this.logger.debug(e,...t)}info(e,...t){this.logger.info(e,...t)}warn(e,...t){this.logger.warn(e,...t)}error(e,...t){this.logger.error(e,...t)}}_.MarkerSeverity$1=void 0,(function(o){o[o.Hint=1]="Hint",o[o.Info=2]="Info",o[o.Warning=4]="Warning",o[o.Error=8]="Error"})(_.MarkerSeverity$1||(_.MarkerSeverity$1={})),(function(o){function e(c,h){return h-c}o.compare=e;const t=Object.create(null);t[o.Error]=l.localize(1795,"Error"),t[o.Warning]=l.localize(1796,"Warning"),t[o.Info]=l.localize(1797,"Info");function i(c){return t[c]||""}o.toString=i;const n=Object.create(null);n[o.Error]=l.localize(1798,"Errors"),n[o.Warning]=l.localize(1799,"Warnings"),n[o.Info]=l.localize(1800,"Infos");function s(c){return n[c]||""}o.toStringPlural=s;function r(c){switch(c){case rt.Error:return o.Error;case rt.Warning:return o.Warning;case rt.Info:return o.Info;case rt.Ignore:return o.Hint}}o.fromSeverity=r;function a(c){switch(c){case o.Error:return rt.Error;case o.Warning:return rt.Warning;case o.Info:return rt.Info;case o.Hint:return rt.Ignore}}o.toSeverity=a})(_.MarkerSeverity$1||(_.MarkerSeverity$1={})),_.IMarkerData=void 0,(function(o){function t(n){return i(n,!0)}o.makeKey=t;function i(n,s){const r=[""];return n.source?r.push(n.source.replace("¦","\\¦")):r.push(""),n.code?typeof n.code=="string"?r.push(n.code.replace("¦","\\¦")):r.push(n.code.value.replace("¦","\\¦")):r.push(""),n.severity!==void 0&&n.severity!==null?r.push(_.MarkerSeverity$1.toString(n.severity)):r.push(""),n.message&&s?r.push(n.message.replace("¦","\\¦")):r.push(""),n.startLineNumber!==void 0&&n.startLineNumber!==null?r.push(n.startLineNumber.toString()):r.push(""),n.startColumn!==void 0&&n.startColumn!==null?r.push(n.startColumn.toString()):r.push(""),n.endLineNumber!==void 0&&n.endLineNumber!==null?r.push(n.endLineNumber.toString()):r.push(""),n.endColumn!==void 0&&n.endColumn!==null?r.push(n.endColumn.toString()):r.push(""),r.push(""),r.join("¦")}o.makeKeyOptionalMessage=i})(_.IMarkerData||(_.IMarkerData={}));const xr=le("markerService"),fZ=new Set([l.Schemas.inMemory,l.Schemas.vscodeSourceControl,l.Schemas.walkThrough,l.Schemas.walkThroughSnippet,l.Schemas.vscodeChatCodeBlock,l.Schemas.vscodeTerminal]);class gZ{constructor(){this._byResource=new l.ResourceMap,this._byOwner=new Map}set(e,t,i){let n=this._byResource.get(e);n||(n=new Map,this._byResource.set(e,n)),n.set(t,i);let s=this._byOwner.get(t);s||(s=new l.ResourceMap,this._byOwner.set(t,s)),s.set(e,i)}get(e,t){return this._byResource.get(e)?.get(t)}delete(e,t){let i=!1,n=!1;const s=this._byResource.get(e);s&&(i=s.delete(t));const r=this._byOwner.get(t);if(r&&(n=r.delete(e)),i!==n)throw new Error("illegal state");return i&&n}values(e){return typeof e=="string"?this._byOwner.get(e)?.values()??l.Iterable.empty():l.URI.isUri(e)?this._byResource.get(e)?.values()??l.Iterable.empty():l.Iterable.map(l.Iterable.concat(...this._byOwner.values()),t=>t[1])}}class mZ{constructor(e){this.errors=0,this.infos=0,this.warnings=0,this.unknowns=0,this._data=new l.ResourceMap,this._service=e,this._subscription=e.onMarkerChanged(this._update,this)}dispose(){this._subscription.dispose()}_update(e){for(const t of e){const i=this._data.get(t);i&&this._substract(i);const n=this._resourceStats(t);this._add(n),this._data.set(t,n)}}_resourceStats(e){const t={errors:0,warnings:0,infos:0,unknowns:0};if(fZ.has(e.scheme))return t;for(const{severity:i}of this._service.read({resource:e}))i===_.MarkerSeverity$1.Error?t.errors+=1:i===_.MarkerSeverity$1.Warning?t.warnings+=1:i===_.MarkerSeverity$1.Info?t.infos+=1:t.unknowns+=1;return t}_substract(e){this.errors-=e.errors,this.warnings-=e.warnings,this.infos-=e.infos,this.unknowns-=e.unknowns}_add(e){this.errors+=e.errors,this.warnings+=e.warnings,this.infos+=e.infos,this.unknowns+=e.unknowns}}class al{constructor(){this._onMarkerChanged=new l.MicrotaskEmitter({merge:al._merge}),this.onMarkerChanged=this._onMarkerChanged.event,this._data=new gZ,this._stats=new mZ(this),this._filteredResources=new l.ResourceMap}dispose(){this._stats.dispose(),this._onMarkerChanged.dispose()}remove(e,t){for(const i of t||[])this.changeOne(e,i,[])}changeOne(e,t,i){if(l.isFalsyOrEmpty(i))this._data.delete(t,e)&&this._onMarkerChanged.fire([t]);else{const n=[];for(const s of i){const r=al._toMarker(e,t,s);r&&n.push(r)}this._data.set(t,e,n),this._onMarkerChanged.fire([t])}}static _toMarker(e,t,i){let{code:n,severity:s,message:r,source:a,startLineNumber:c,startColumn:h,endLineNumber:d,endColumn:u,relatedInformation:f,modelVersionId:g,tags:m,origin:p}=i;if(r)return c=c>0?c:1,h=h>0?h:1,d=d>=c?d:c,u=u>0?u:h,{resource:t,owner:e,code:n,severity:s,message:r,source:a,startLineNumber:c,startColumn:h,endLineNumber:d,endColumn:u,relatedInformation:f,modelVersionId:g,tags:m,origin:p}}changeAll(e,t){const i=[],n=this._data.values(e);if(n)for(const s of n){const r=l.Iterable.first(s);r&&(i.push(r.resource),this._data.delete(r.resource,e))}if(l.isNonEmptyArray(t)){const s=new l.ResourceMap;for(const{resource:r,marker:a}of t){const c=al._toMarker(e,r,a);if(!c)continue;const h=s.get(r);h?h.push(c):(s.set(r,[c]),i.push(r))}for(const[r,a]of s)this._data.set(r,e,a)}i.length>0&&this._onMarkerChanged.fire(i)}_createFilteredMarker(e,t){const i=t.length===1?l.localize(1801,'Problems are paused because: "{0}"',t[0]):l.localize(1802,'Problems are paused because: "{0}" and {1} more',t[0],t.length-1);return{owner:"markersFilter",resource:e,severity:_.MarkerSeverity$1.Info,message:i,startLineNumber:1,startColumn:1,endLineNumber:1,endColumn:1}}read(e=Object.create(null)){let{owner:t,resource:i,severities:n,take:s}=e;if((!s||s<0)&&(s=-1),t&&i){const r=e.ignoreResourceFilters?void 0:this._filteredResources.get(i);if(r?.length)return[this._createFilteredMarker(i,r)];const a=this._data.get(i,t);if(!a)return[];const c=[];for(const h of a){if(s>0&&c.length===s)break;const d=e.ignoreResourceFilters?void 0:this._filteredResources.get(i);d?.length?c.push(this._createFilteredMarker(i,d)):al._accept(h,n)&&c.push(h)}return c}else{const r=!t&&!i?this._data.values():this._data.values(i??t),a=[],c=new l.ResourceSet;for(const h of r)for(const d of h){if(c.has(d.resource))continue;if(s>0&&a.length===s)break;const u=e.ignoreResourceFilters?void 0:this._filteredResources.get(d.resource);u?.length?(a.push(this._createFilteredMarker(d.resource,u)),c.add(d.resource)):al._accept(d,n)&&a.push(d)}return a}}static _accept(e,t){return t===void 0||(t&e.severity)===e.severity}static _merge(e){const t=new l.ResourceMap;for(const i of e)for(const n of i)t.set(n,!0);return Array.from(t.keys())}}const CA=le("progressService"),fD=class fD{constructor(e){this.callback=e}report(e){this._value=e,this.callback(this._value)}};fD.None=Object.freeze({report(){}});let xL=fD;const d_=le("editorProgressService");class vA{constructor(){this._modifierObservables=new WeakMap}readModifierKeyStatus(e,t){const i=e instanceof Window?e:j(e);let n=this._modifierObservables.get(i);if(!n){const s=hs.getInstance();n=mt(this,s.event,()=>({ctrlKey:s.keyStatus.ctrlKey,shiftKey:s.keyStatus.shiftKey,altKey:s.keyStatus.altKey,metaKey:s.keyStatus.metaKey})),this._modifierObservables.set(i,n)}return n.read(t)}createFocusTracker(e,t){const i=t.add(Xr(e)),s=W("isFocused",(r=>{if(r instanceof Window)return r.document.hasFocus();const a=r.getRootNode()instanceof ShadowRoot?r.getRootNode():null,c=a?a.activeElement:r.ownerDocument.activeElement;return r.contains(c)})(e));return t.add(i.onDidFocus(()=>s.set(!0,void 0))),t.add(i.onDidBlur(()=>s.set(!1,void 0))),s}createHoverTracker(e,t){const i=W("isHovered",!1),n=()=>i.set(!0,void 0),s=()=>i.set(!1,void 0);return e.addEventListener("mouseenter",n),e.addEventListener("mouseleave",s),t.add({dispose:()=>{e.removeEventListener("mouseenter",n),e.removeEventListener("mouseleave",s)}}),i}createDomFocusTracker(e){return Xr(e)}}fe(Na,vA,1);const wA=le("contextService");function SA(o){const e=o;return typeof e?.id=="string"&&l.URI.isUri(e.uri)}function pZ(o){return typeof o?.id=="string"&&!SA(o)&&!CZ(o)}const _Z={id:"empty-window"};function bZ(o,e){if(typeof o=="string"||typeof o>"u")return typeof o=="string"?{id:l.basename(o)}:_Z;const t=o;return t.configuration?{id:t.id,configPath:t.configuration}:t.folders.length===1?{id:t.id,uri:t.folders[0].uri}:{id:t.id}}function CZ(o){const e=o;return typeof e?.id=="string"&&l.URI.isUri(e.configPath)}class vZ{constructor(e,t){this.raw=t,this.uri=e.uri,this.index=e.index,this.name=e.name}toJSON(){return{uri:this.uri,name:this.name,index:this.index}}}const yA="code-workspace";l.localize(2119,"Code Workspace");const LA="4064f6ec-cb38-4ad0-af64-ee6467e63c82";function wZ(o){return o.id===LA}const DA=le("workspaceTrustManagementService"),xA=le("IWorkspaceEditService");class EL{constructor(e){this.metadata=e}static convert(e){return e.edits.map(t=>{if(Er.is(t))return Er.lift(t);if(lh.is(t))return lh.lift(t);throw new Error("Unsupported edit")})}}class Er extends EL{static is(e){return e instanceof Er?!0:l.isObject(e)&&l.URI.isUri(e.resource)&&l.isObject(e.textEdit)}static lift(e){return e instanceof Er?e:new Er(e.resource,e.textEdit,e.versionId,e.metadata)}constructor(e,t,i=void 0,n){super(n),this.resource=e,this.textEdit=t,this.versionId=i}}class lh extends EL{static is(e){return e instanceof lh?!0:l.isObject(e)&&(!!e.newResource||!!e.oldResource)}static lift(e){return e instanceof lh?e:new lh(e.oldResource,e.newResource,e.options,e.metadata)}constructor(e,t,i={},n){super(n),this.oldResource=e,this.newResource=t,this.options=i}}var u_;(function(o){o[o.API=0]="API",o[o.USER=1]="USER"})(u_||(u_={}));var IL=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},f_=function(o,e){return function(t,i){e(t,i,o)}};let TL=class{constructor(e){this._commandService=e}async open(e,t){if(!l.matchesScheme(e,l.Schemas.command))return!1;if(!t?.allowCommands||(typeof e=="string"&&(e=l.URI.parse(e)),Array.isArray(t.allowCommands)&&!t.allowCommands.includes(e.path)))return!0;let i=[];try{i=FS(decodeURIComponent(e.query))}catch{try{i=FS(e.query)}catch{}}return Array.isArray(i)||(i=[i]),await this._commandService.executeCommand(e.path,...i),!0}};TL=IL([f_(0,zi)],TL);let NL=class{constructor(e){this._editorService=e}async open(e,t){typeof e=="string"&&(e=l.URI.parse(e));const{selection:i,uri:n}=a7(e);return e=n,e.scheme===l.Schemas.file&&(e=gB(e)),await this._editorService.openCodeEditor({resource:e,options:{selection:i,source:t?.fromUserGesture?u_.USER:u_.API,...t?.editorOptions}},this._editorService.getFocusedCodeEditor(),t?.openToSide),!0}};NL=IL([f_(0,pt)],NL);let RL=class{constructor(e,t){this._openers=new l.LinkedList,this._validators=new l.LinkedList,this._resolvers=new l.LinkedList,this._resolvedUriTargets=new l.ResourceMap(i=>i.with({path:null,fragment:null,query:null}).toString()),this._externalOpeners=new l.LinkedList,this._defaultExternalOpener={openExternal:async i=>(l.matchesSomeScheme(i,l.Schemas.http,l.Schemas.https)?fx(i):Ae.location.href=i,!0)},this._openers.push({open:async(i,n)=>n?.openExternal||l.matchesSomeScheme(i,l.Schemas.mailto,l.Schemas.http,l.Schemas.https,l.Schemas.vsls)?(await this._doOpenExternal(i,n),!0):!1}),this._openers.push(new TL(t)),this._openers.push(new NL(e))}registerOpener(e){return{dispose:this._openers.unshift(e)}}async open(e,t){const i=typeof e=="string"?l.URI.parse(e):e;if(i.scheme===l.Schemas.internal)return!1;if(!t?.skipValidation){const n=this._resolvedUriTargets.get(i)??e;for(const s of this._validators)if(!await s.shouldOpen(n,t))return!1}for(const n of this._openers)if(await n.open(e,t))return!0;return!1}async resolveExternalUri(e,t){for(const i of this._resolvers)try{const n=await i.resolveExternalUri(e,t);if(n)return this._resolvedUriTargets.has(n.resolved)||this._resolvedUriTargets.set(n.resolved,e),n}catch{}throw new Error("Could not resolve external URI: "+e.toString())}async _doOpenExternal(e,t){const i=typeof e=="string"?l.URI.parse(e):e;let n;try{n=(await this.resolveExternalUri(i,t)).resolved}catch{n=i}let s;if(typeof e=="string"&&i.toString()===n.toString()?s=e:s=encodeURI(n.toString(!0)),t?.allowContributedOpeners){const r=typeof t?.allowContributedOpeners=="string"?t?.allowContributedOpeners:void 0;for(const a of this._externalOpeners)if(await a.openExternal(s,{sourceUri:i,preferredOpenerId:r},l.CancellationToken.None))return!0}return this._defaultExternalOpener.openExternal(s,{sourceUri:i},l.CancellationToken.None)}dispose(){this._validators.clear()}};RL=IL([f_(0,pt),f_(1,zi)],RL);const EA=le("renameSymbolTrackerService");class SZ{constructor(){this._trackedWord=W(this,void 0),this.trackedWord=this._trackedWord,this._trackedWord.set(void 0,void 0)}}const Yt={enableSplitViewResizing:!0,renderSideBySide:!0,renderMarginRevertIcon:!0,renderGutterMenu:!0,maxComputationTime:5e3,maxFileSize:50,ignoreTrimWhitespace:!0,renderIndicators:!0,originalEditable:!1,diffCodeLens:!1,renderOverviewRuler:!0,diffWordWrap:"inherit",diffAlgorithm:"advanced",accessibilityVerbose:!1,experimental:{showMoves:!1,showEmptyDecorations:!0,useTrueInlineView:!1},hideUnchangedRegions:{enabled:!1,contextLineCount:3,minimumLineCount:3,revealLineCount:20},isInEmbeddedEditor:!1,onlyShowAccessibleDiffViewer:!1,renderSideBySideInlineBreakpoint:900,useInlineViewWhenSpaceIsLimited:!0,compactMode:!1},IA=Object.freeze({id:"editor",order:5,type:"object",title:l.localize(163,"Editor"),scope:6}),g_={...IA,properties:{"editor.tabSize":{type:"number",default:zt.tabSize,minimum:1,maximum:100,markdownDescription:l.localize(164,"The number of spaces a tab is equal to. This setting is overridden based on the file contents when {0} is on.","`#editor.detectIndentation#`")},"editor.indentSize":{anyOf:[{type:"string",enum:["tabSize"]},{type:"number",minimum:1}],default:"tabSize",markdownDescription:l.localize(165,'The number of spaces used for indentation or `"tabSize"` to use the value from `#editor.tabSize#`. This setting is overridden based on the file contents when `#editor.detectIndentation#` is on.')},"editor.insertSpaces":{type:"boolean",default:zt.insertSpaces,markdownDescription:l.localize(166,"Insert spaces when pressing `Tab`. This setting is overridden based on the file contents when {0} is on.","`#editor.detectIndentation#`")},"editor.detectIndentation":{type:"boolean",default:zt.detectIndentation,markdownDescription:l.localize(167,"Controls whether {0} and {1} will be automatically detected when a file is opened based on the file contents.","`#editor.tabSize#`","`#editor.insertSpaces#`")},"editor.trimAutoWhitespace":{type:"boolean",default:zt.trimAutoWhitespace,description:l.localize(168,"Remove trailing auto inserted whitespace.")},"editor.largeFileOptimizations":{type:"boolean",default:zt.largeFileOptimizations,description:l.localize(169,"Special handling for large files to disable certain memory intensive features.")},"editor.wordBasedSuggestions":{enum:["off","offWithInlineSuggestions","currentDocument","matchingDocuments","allDocuments"],default:"offWithInlineSuggestions",enumDescriptions:[l.localize(170,"Turn off Word Based Suggestions."),l.localize(171,"Turn off Word Based Suggestions when Inline Suggestions are present."),l.localize(172,"Only suggest words from the active document."),l.localize(173,"Suggest words from all open documents of the same language."),l.localize(174,"Suggest words from all open documents.")],description:l.localize(175,"Controls whether completions should be computed based on words in the document and from which documents they are computed."),experiment:{mode:"auto"}},"editor.semanticHighlighting.enabled":{enum:[!0,!1,"configuredByTheme"],enumDescriptions:[l.localize(176,"Semantic highlighting enabled for all color themes."),l.localize(177,"Semantic highlighting disabled for all color themes."),l.localize(178,"Semantic highlighting is configured by the current color theme's `semanticHighlighting` setting.")],default:"configuredByTheme",description:l.localize(179,"Controls whether the semanticHighlighting is shown for the languages that support it.")},"editor.stablePeek":{type:"boolean",default:!1,markdownDescription:l.localize(180,"Keep peek editors open even when double-clicking their content or when hitting `Escape`.")},"editor.maxTokenizationLineLength":{type:"integer",default:2e4,description:l.localize(181,"Lines above this length will not be tokenized for performance reasons")},"editor.experimental.asyncTokenization":{type:"boolean",default:!0,description:l.localize(182,"Controls whether the tokenization should happen asynchronously on a web worker."),tags:["experimental"]},"editor.experimental.asyncTokenizationLogging":{type:"boolean",default:!1,description:l.localize(183,"Controls whether async tokenization should be logged. For debugging only.")},"editor.experimental.asyncTokenizationVerification":{type:"boolean",default:!1,description:l.localize(184,"Controls whether async tokenization should be verified against legacy background tokenization. Might slow down tokenization. For debugging only."),tags:["experimental"]},"editor.experimental.treeSitterTelemetry":{type:"boolean",default:!1,markdownDescription:l.localize(185,"Controls whether tree sitter parsing should be turned on and telemetry collected. Setting `#editor.experimental.preferTreeSitter#` for specific languages will take precedence."),tags:["experimental"],experiment:{mode:"auto"}},"editor.experimental.preferTreeSitter.css":{type:"boolean",default:!1,markdownDescription:l.localize(186,"Controls whether tree sitter parsing should be turned on for css. This will take precedence over `#editor.experimental.treeSitterTelemetry#` for css."),tags:["experimental"],experiment:{mode:"auto"}},"editor.experimental.preferTreeSitter.typescript":{type:"boolean",default:!1,markdownDescription:l.localize(187,"Controls whether tree sitter parsing should be turned on for typescript. This will take precedence over `#editor.experimental.treeSitterTelemetry#` for typescript."),tags:["experimental"],experiment:{mode:"auto"}},"editor.experimental.preferTreeSitter.ini":{type:"boolean",default:!1,markdownDescription:l.localize(188,"Controls whether tree sitter parsing should be turned on for ini. This will take precedence over `#editor.experimental.treeSitterTelemetry#` for ini."),tags:["experimental"],experiment:{mode:"auto"}},"editor.experimental.preferTreeSitter.regex":{type:"boolean",default:!1,markdownDescription:l.localize(189,"Controls whether tree sitter parsing should be turned on for regex. This will take precedence over `#editor.experimental.treeSitterTelemetry#` for regex."),tags:["experimental"],experiment:{mode:"auto"}},"editor.language.brackets":{type:["array","null"],default:null,description:l.localize(190,"Defines the bracket symbols that increase or decrease the indentation."),items:{type:"array",items:[{type:"string",description:l.localize(191,"The opening bracket character or string sequence.")},{type:"string",description:l.localize(192,"The closing bracket character or string sequence.")}]}},"editor.language.colorizedBracketPairs":{type:["array","null"],default:null,description:l.localize(193,"Defines the bracket pairs that are colorized by their nesting level if bracket pair colorization is enabled."),items:{type:"array",items:[{type:"string",description:l.localize(194,"The opening bracket character or string sequence.")},{type:"string",description:l.localize(195,"The closing bracket character or string sequence.")}]}},"diffEditor.maxComputationTime":{type:"number",default:Yt.maxComputationTime,description:l.localize(196,"Timeout in milliseconds after which diff computation is cancelled. Use 0 for no timeout.")},"diffEditor.maxFileSize":{type:"number",default:Yt.maxFileSize,description:l.localize(197,"Maximum file size in MB for which to compute diffs. Use 0 for no limit.")},"diffEditor.renderSideBySide":{type:"boolean",default:Yt.renderSideBySide,description:l.localize(198,"Controls whether the diff editor shows the diff side by side or inline."),agentsWindow:{default:!0}},"diffEditor.renderSideBySideInlineBreakpoint":{type:"number",default:Yt.renderSideBySideInlineBreakpoint,description:l.localize(199,"If the diff editor width is smaller than this value, the inline view is used.")},"diffEditor.useInlineViewWhenSpaceIsLimited":{type:"boolean",default:Yt.useInlineViewWhenSpaceIsLimited,description:l.localize(200,"If enabled and the editor width is too small, the inline view is used."),agentsWindow:{default:!0}},"diffEditor.renderMarginRevertIcon":{type:"boolean",default:Yt.renderMarginRevertIcon,description:l.localize(201,"When enabled, the diff editor shows arrows in its glyph margin to revert changes."),agentsWindow:{default:!1}},"diffEditor.renderGutterMenu":{type:"boolean",default:Yt.renderGutterMenu,description:l.localize(202,"When enabled, the diff editor shows a special gutter for revert and stage actions."),agentsWindow:{default:!1}},"diffEditor.ignoreTrimWhitespace":{type:"boolean",default:Yt.ignoreTrimWhitespace,description:l.localize(203,"When enabled, the diff editor ignores changes in leading or trailing whitespace.")},"diffEditor.renderIndicators":{type:"boolean",default:Yt.renderIndicators,description:l.localize(204,"Controls whether the diff editor shows +/- indicators for added/removed changes."),agentsWindow:{default:!1}},"diffEditor.codeLens":{type:"boolean",default:Yt.diffCodeLens,description:l.localize(205,"Controls whether the editor shows CodeLens.")},"diffEditor.wordWrap":{type:"string",enum:["off","on","inherit"],default:Yt.diffWordWrap,markdownEnumDescriptions:[l.localize(206,"Lines will never wrap."),l.localize(207,"Lines will wrap at the viewport width."),l.localize(208,"Lines will wrap according to the {0} setting.","`#editor.wordWrap#`")]},"diffEditor.diffAlgorithm":{type:"string",enum:["legacy","advanced","advanced-external","advanced-wasm"],default:Yt.diffAlgorithm,markdownEnumDescriptions:[l.localize(209,"Uses the legacy diffing algorithm."),l.localize(210,"Uses the advanced diffing algorithm."),l.localize(211,"Uses the advanced diffing algorithm from the external `@vscode/diff` package (pure JavaScript)."),l.localize(212,"Uses the advanced diffing algorithm from the external `@vscode/diff` package (WebAssembly).")]},"diffEditor.hideUnchangedRegions.enabled":{type:"boolean",default:Yt.hideUnchangedRegions.enabled,markdownDescription:l.localize(213,"Controls whether the diff editor shows unchanged regions."),agentsWindow:{default:!0}},"diffEditor.hideUnchangedRegions.revealLineCount":{type:"integer",default:Yt.hideUnchangedRegions.revealLineCount,markdownDescription:l.localize(214,"Controls how many lines are used for unchanged regions."),minimum:1},"diffEditor.hideUnchangedRegions.minimumLineCount":{type:"integer",default:Yt.hideUnchangedRegions.minimumLineCount,markdownDescription:l.localize(215,"Controls how many lines are used as a minimum for unchanged regions."),minimum:1},"diffEditor.hideUnchangedRegions.contextLineCount":{type:"integer",default:Yt.hideUnchangedRegions.contextLineCount,markdownDescription:l.localize(216,"Controls how many lines are used as context when comparing unchanged regions."),minimum:1},"diffEditor.experimental.showMoves":{type:"boolean",default:Yt.experimental.showMoves,markdownDescription:l.localize(217,"Controls whether the diff editor should show detected code moves.")},"diffEditor.experimental.showEmptyDecorations":{type:"boolean",default:Yt.experimental.showEmptyDecorations,description:l.localize(218,"Controls whether the diff editor shows empty decorations to see where characters got inserted or deleted.")},"diffEditor.experimental.useTrueInlineView":{type:"boolean",default:Yt.experimental.useTrueInlineView,description:l.localize(219,"If enabled and the editor uses the inline view, word changes are rendered inline.")}}};function yZ(o){return typeof o.type<"u"||typeof o.anyOf<"u"}for(const o of Vl){const e=o.schema;if(typeof e<"u")if(yZ(e))g_.properties[`editor.${o.name}`]=e;else for(const t in e)Object.hasOwnProperty.call(e,t)&&(g_.properties[t]=e[t])}let m_=null;function TA(){return m_===null&&(m_=Object.create(null),Object.keys(g_.properties).forEach(o=>{m_[o]=!0})),m_}function LZ(o){return TA()[`editor.${o}`]||!1}function DZ(o){return TA()[`diffEditor.${o}`]||!1}St.as(Xo.Configuration).registerConfiguration(g_);class p_{static insert(e,t){return{range:new l.Range(e.lineNumber,e.column,e.lineNumber,e.column),text:t,forceMoveMarkers:!0}}static delete(e){return{range:e,text:null}}static replace(e,t){return{range:e,text:t}}static replaceMove(e,t){return{range:e,text:t,forceMoveMarkers:!0}}}const NA=[];function xZ(o){NA.push(o)}function EZ(){return NA.slice(0)}let ch=[],ML=[],RA=[];function __(o,e=!1){IZ(o,!1,e)}function IZ(o,e,t){const i=TZ(o,e);ch.push(i),i.userConfigured?RA.push(i):ML.push(i),t&&!i.userConfigured&&ch.forEach(n=>{n.mime===i.mime||n.userConfigured||(i.extension&&n.extension===i.extension&&console.warn(`Overwriting extension <<${i.extension}>> to now point to mime <<${i.mime}>>`),i.filename&&n.filename===i.filename&&console.warn(`Overwriting filename <<${i.filename}>> to now point to mime <<${i.mime}>>`),i.filepattern&&n.filepattern===i.filepattern&&console.warn(`Overwriting filepattern <<${i.filepattern}>> to now point to mime <<${i.mime}>>`),i.firstline&&n.firstline===i.firstline&&console.warn(`Overwriting firstline <<${i.firstline}>> to now point to mime <<${i.mime}>>`))})}function TZ(o,e){return{id:o.id,mime:o.mime,filename:o.filename,extension:o.extension,filepattern:o.filepattern,firstline:o.firstline,userConfigured:e,filepatternParsed:o.filepattern?UR(o.filepattern,{ignoreCase:!0}):void 0,filepatternOnPath:o.filepattern?o.filepattern.indexOf(l.posix.sep)>=0:!1}}function NZ(){ch=ch.filter(o=>o.userConfigured),ML=[]}function RZ(o,e){return MZ(o,e).map(t=>t.id)}function MZ(o,e){let t;if(o)switch(o.scheme){case l.Schemas.file:t=o.fsPath;break;case l.Schemas.data:{t=_.DataUri.parseMetaData(o).get(_.DataUri.META_DATA_LABEL);break}case l.Schemas.vscodeNotebookCell:t=void 0;break;default:t=o.path}if(!t)return[{id:"unknown",mime:mn.unknown}];t=t.toLowerCase();const i=l.basename(t),n=MA(t,i,RA);if(n)return[n,{id:pn,mime:mn.text}];const s=MA(t,i,ML);if(s)return[s,{id:pn,mime:mn.text}];if(e){const r=AZ(e);if(r)return[r,{id:pn,mime:mn.text}]}return[{id:"unknown",mime:mn.unknown}]}function MA(o,e,t){let i,n,s;for(let r=t.length-1;r>=0;r--){const a=t[r];if(l.equals$2(e,a.filename)){i=a;break}if(a.filepattern&&(!n||a.filepattern.length>n.filepattern.length)){const c=a.filepatternOnPath?o:e;a.filepatternParsed?.(c)&&(n=a)}a.extension&&(!s||a.extension.length>s.extension.length)&&l.endsWithIgnoreCase(e,a.extension)&&(s=a)}if(i)return i;if(n)return n;if(s)return s}function AZ(o){if(l.startsWithUTF8BOM(o)&&(o=o.substring(1)),o.length>0)for(let e=ch.length-1;e>=0;e--){const t=ch[e];if(!t.firstline)continue;const i=o.match(t.firstline);if(i&&i.length>0)return t}}const b_=Object.prototype.hasOwnProperty,AA="vs.editor.nullLanguage";class OZ{constructor(){this._languageIdToLanguage=[],this._languageToLanguageId=new Map,this._register(AA,0),this._register(pn,1),this._nextLanguageId=2}_register(e,t){this._languageIdToLanguage[t]=e,this._languageToLanguageId.set(e,t)}register(e){if(this._languageToLanguageId.has(e))return;const t=this._nextLanguageId++;this._register(e,t)}encodeLanguageId(e){return this._languageToLanguageId.get(e)||0}decodeLanguageId(e){return this._languageIdToLanguage[e]||AA}}const yf=class yf extends l.Disposable{constructor(e=!0,t=!1){super(),this._onDidChange=this._register(new l.Emitter),this.onDidChange=this._onDidChange.event,yf.instanceCount++,this._warnOnOverwrite=t,this.languageIdCodec=new OZ,this._dynamicLanguages=[],this._languages={},this._mimeTypesMap={},this._nameMap={},this._lowercaseNameMap={},e&&(this._initializeFromRegistry(),this._register(Jl.onDidChangeLanguages(i=>{this._initializeFromRegistry()})))}dispose(){yf.instanceCount--,super.dispose()}_initializeFromRegistry(){this._languages={},this._mimeTypesMap={},this._nameMap={},this._lowercaseNameMap={},NZ();const e=[].concat(Jl.getLanguages()).concat(this._dynamicLanguages);this._registerLanguages(e)}_registerLanguages(e){for(const t of e)this._registerLanguage(t);this._mimeTypesMap={},this._nameMap={},this._lowercaseNameMap={},Object.keys(this._languages).forEach(t=>{const i=this._languages[t];i.name&&(this._nameMap[i.name]=i.identifier),i.aliases.forEach(n=>{this._lowercaseNameMap[n.toLowerCase()]=i.identifier}),i.mimetypes.forEach(n=>{this._mimeTypesMap[n]=i.identifier})}),St.as(Xo.Configuration).registerOverrideIdentifiers(this.getRegisteredLanguageIds()),this._onDidChange.fire()}_registerLanguage(e){const t=e.id;let i;b_.call(this._languages,t)?i=this._languages[t]:(this.languageIdCodec.register(t),i={identifier:t,name:null,mimetypes:[],aliases:[],extensions:[],filenames:[],configurationFiles:[],icons:[]},this._languages[t]=i),this._mergeLanguage(i,e)}_mergeLanguage(e,t){const i=t.id;let n=null;if(Array.isArray(t.mimetypes)&&t.mimetypes.length>0&&(e.mimetypes.push(...t.mimetypes),n=t.mimetypes[0]),n||(n=`text/x-${i}`,e.mimetypes.push(n)),Array.isArray(t.extensions)){t.configuration?e.extensions=t.extensions.concat(e.extensions):e.extensions=e.extensions.concat(t.extensions);for(const a of t.extensions)__({id:i,mime:n,extension:a},this._warnOnOverwrite)}if(Array.isArray(t.filenames))for(const a of t.filenames)__({id:i,mime:n,filename:a},this._warnOnOverwrite),e.filenames.push(a);if(Array.isArray(t.filenamePatterns))for(const a of t.filenamePatterns)__({id:i,mime:n,filepattern:a},this._warnOnOverwrite);if(typeof t.firstLine=="string"&&t.firstLine.length>0){let a=t.firstLine;a.charAt(0)!=="^"&&(a="^"+a);try{const c=new RegExp(a);l.regExpLeadsToEndlessLoop(c)||__({id:i,mime:n,firstline:c},this._warnOnOverwrite)}catch(c){console.warn(`[${t.id}]: Invalid regular expression \`${a}\`: `,c)}}e.aliases.push(i);let s=null;if(typeof t.aliases<"u"&&Array.isArray(t.aliases)&&(t.aliases.length===0?s=[null]:s=t.aliases),s!==null)for(const a of s)!a||a.length===0||e.aliases.push(a);const r=s!==null&&s.length>0;if(!(r&&s[0]===null)){const a=(r?s[0]:null)||i;(r||!e.name)&&(e.name=a)}t.configuration&&e.configurationFiles.push(t.configuration),t.icon&&e.icons.push(t.icon)}isRegisteredLanguageId(e){return e?b_.call(this._languages,e):!1}getRegisteredLanguageIds(){return Object.keys(this._languages)}getLanguageIdByLanguageName(e){const t=e.toLowerCase();return b_.call(this._lowercaseNameMap,t)?this._lowercaseNameMap[t]:null}getLanguageIdByMimeType(e){return e&&b_.call(this._mimeTypesMap,e)?this._mimeTypesMap[e]:null}guessLanguageIdByFilepathOrFirstLine(e,t){return!e&&!t?[]:RZ(e,t)}};yf.instanceCount=0;let AL=yf;const Lf=class Lf extends l.Disposable{constructor(e=!1){super(),this._onDidRequestBasicLanguageFeatures=this._register(new l.Emitter),this.onDidRequestBasicLanguageFeatures=this._onDidRequestBasicLanguageFeatures.event,this._onDidRequestRichLanguageFeatures=this._register(new l.Emitter),this.onDidRequestRichLanguageFeatures=this._onDidRequestRichLanguageFeatures.event,this._onDidChange=this._register(new l.Emitter({leakWarningThreshold:200,leakWarningName:"LanguageService._onDidChange"})),this.onDidChange=this._onDidChange.event,this._requestedBasicLanguages=new Set,this._requestedRichLanguages=new Set,Lf.instanceCount++,this._registry=this._register(new AL(!0,e)),this.languageIdCodec=this._registry.languageIdCodec,this._register(this._registry.onDidChange(()=>this._onDidChange.fire()))}dispose(){Lf.instanceCount--,super.dispose()}isRegisteredLanguageId(e){return this._registry.isRegisteredLanguageId(e)}getLanguageIdByLanguageName(e){return this._registry.getLanguageIdByLanguageName(e)}getLanguageIdByMimeType(e){return this._registry.getLanguageIdByMimeType(e)}guessLanguageIdByFilepathOrFirstLine(e,t){return this._registry.guessLanguageIdByFilepathOrFirstLine(e,t).at(0)??null}createById(e){return new OA(this.onDidChange,()=>this._createAndGetLanguageIdentifier(e))}createByFilepathOrFirstLine(e,t){return new OA(this.onDidChange,()=>{const i=this.guessLanguageIdByFilepathOrFirstLine(e,t);return this._createAndGetLanguageIdentifier(i)})}_createAndGetLanguageIdentifier(e){return(!e||!this.isRegisteredLanguageId(e))&&(e=pn),e}requestBasicLanguageFeatures(e){this._requestedBasicLanguages.has(e)||(this._requestedBasicLanguages.add(e),this._onDidRequestBasicLanguageFeatures.fire(e))}requestRichLanguageFeatures(e){this._requestedRichLanguages.has(e)||(this._requestedRichLanguages.add(e),this.requestBasicLanguageFeatures(e),l.TokenizationRegistry.getOrCreate(e),this._onDidRequestRichLanguageFeatures.fire(e))}};Lf.instanceCount=0;let OL=Lf;class OA{constructor(e,t){this._value=mt(this,e,()=>t()),this.onDidChange=l.Event.fromObservable(this._value)}get languageId(){return this._value.get()}}var PZ=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},PA=function(o,e){return function(t,i){e(t,i,o)}};let PL=class extends l.Disposable{constructor(e,t){super(),this._markerService=t,this._onDidChangeMarker=this._register(new l.Emitter),this._suppressedRanges=new l.ResourceMap,this._markerDecorations=new l.ResourceMap,e.getModels().forEach(i=>this._onModelAdded(i)),this._register(e.onModelAdded(this._onModelAdded,this)),this._register(e.onModelRemoved(this._onModelRemoved,this)),this._register(this._markerService.onMarkerChanged(this._handleMarkerChange,this))}dispose(){super.dispose(),this._markerDecorations.forEach(e=>e.dispose()),this._markerDecorations.clear()}getMarker(e,t){const i=this._markerDecorations.get(e);return i&&i.getMarker(t)||null}_handleMarkerChange(e){e.forEach(t=>{const i=this._markerDecorations.get(t);i&&this._updateDecorations(i)})}_onModelAdded(e){const t=new kZ(e);this._markerDecorations.set(e.uri,t),this._updateDecorations(t)}_onModelRemoved(e){const t=this._markerDecorations.get(e.uri);t&&(t.dispose(),this._markerDecorations.delete(e.uri)),(e.uri.scheme===l.Schemas.inMemory||e.uri.scheme===l.Schemas.internal||e.uri.scheme===l.Schemas.vscode)&&this._markerService?.read({resource:e.uri}).map(i=>i.owner).forEach(i=>this._markerService.remove(i,[e.uri]))}_updateDecorations(e){let t=this._markerService.read({resource:e.model.uri,take:500});const i=this._suppressedRanges.get(e.model.uri);i&&(t=t.filter(n=>!l.Iterable.some(i,s=>l.Range.areIntersectingOrTouching(s,n)))),e.update(t)&&this._onDidChangeMarker.fire(e.model)}};PL=PZ([PA(0,ri),PA(1,xr)],PL);class kZ extends l.Disposable{constructor(e){super(),this.model=e,this._map=new l.BidirectionalMap,this._register(l.toDisposable(()=>{this.model.deltaDecorations([...this._map.values()],[]),this._map.clear()}))}update(e){const{added:t,removed:i}=y5(new Set(this._map.keys()),new Set(e));if(t.length===0&&i.length===0)return!1;const n=i.map(a=>this._map.get(a)),s=t.map(a=>({range:this._createDecorationRange(this.model,a),options:this._createDecorationOption(a)})),r=this.model.deltaDecorations(n,s);for(const a of i)this._map.delete(a);for(let a=0;a<r.length;a++)this._map.set(t[a],r[a]);return!0}getMarker(e){return this._map.getKey(e.id)}_createDecorationRange(e,t){let i=l.Range.lift(t);if(t.severity===_.MarkerSeverity$1.Hint&&!this._hasMarkerTag(t,1)&&!this._hasMarkerTag(t,2)&&(i=i.setEndPosition(i.startLineNumber,i.startColumn+2)),i=e.validateRange(i),i.isEmpty()){const n=e.getLineLastNonWhitespaceColumn(i.startLineNumber)||e.getLineMaxColumn(i.startLineNumber);if(n===1||i.endColumn>=n)return i;const s=e.getWordAtPosition(i.getStartPosition());s&&(i=new l.Range(i.startLineNumber,s.startColumn,i.endLineNumber,s.endColumn))}else if(t.endColumn===Number.MAX_VALUE&&t.startColumn===1&&i.startLineNumber===i.endLineNumber){const n=e.getLineFirstNonWhitespaceColumn(t.startLineNumber);n<i.endColumn&&(i=new l.Range(i.startLineNumber,n,i.endLineNumber,i.endColumn),t.startColumn=n)}return i}_createDecorationOption(e){let t,i,n,s,r;switch(e.severity){case _.MarkerSeverity$1.Hint:this._hasMarkerTag(e,2)?t=void 0:this._hasMarkerTag(e,1)?t="squiggly-unnecessary":t="squiggly-hint",n=0;break;case _.MarkerSeverity$1.Info:t="squiggly-info",i=La(g$),n=10,r={color:La(YV),position:1};break;case _.MarkerSeverity$1.Warning:t="squiggly-warning",i=La(f$),n=20,r={color:La(ZV),position:1};break;case _.MarkerSeverity$1.Error:default:t="squiggly-error",i=La(u$),n=30,r={color:La(QV),position:1};break}return e.tags&&(e.tags.indexOf(1)!==-1&&(s="squiggly-inline-unnecessary"),e.tags.indexOf(2)!==-1&&(s="squiggly-inline-deprecated")),{description:"marker-decoration",stickiness:1,className:t,showIfCollapsed:!0,overviewRuler:{color:i,position:l.OverviewRulerLane.Right},minimap:r,zIndex:n,inlineClassName:s}}_hasMarkerTag(e,t){return e.tags?e.tags.indexOf(t)>=0:!1}}var FZ=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},C_=function(o,e){return function(t,i){e(t,i,o)}},hh;function ll(o){return o.toString()}class BZ{constructor(e,t,i){this.model=e,this._modelEventListeners=new l.DisposableStore,this.model=e,this._modelEventListeners.add(e.onWillDispose(()=>t(e))),this._modelEventListeners.add(e.onDidChangeLanguage(n=>i(e,n)))}dispose(){this._modelEventListeners.dispose()}}const zZ=l.isLinux||l.isMacintosh?1:2;class VZ{constructor(e,t,i,n,s,r,a,c){this.uri=e,this.initialUndoRedoSnapshot=t,this.time=i,this.sharesUndoRedoStack=n,this.heapSize=s,this.sha1=r,this.versionId=a,this.alternativeVersionId=c}}let kL=(Il=class extends l.Disposable{constructor(e,t,i,n){super(),this._configurationService=e,this._resourcePropertiesService=t,this._undoRedoService=i,this._instantiationService=n,this._onModelAdded=this._register(new l.Emitter),this.onModelAdded=this._onModelAdded.event,this._onModelRemoved=this._register(new l.Emitter),this.onModelRemoved=this._onModelRemoved.event,this._onModelModeChanged=this._register(new l.Emitter),this.onModelLanguageChanged=this._onModelModeChanged.event,this._modelCreationOptionsByLanguageAndResource=Object.create(null),this._models={},this._disposedModels=new Map,this._disposedModelsHeapSize=0,this._register(this._configurationService.onDidChangeConfiguration(s=>this._updateModelOptions(s))),this._updateModelOptions(void 0)}static _readModelOptions(e,t){let i=zt.tabSize;e.editor&&typeof e.editor.tabSize<"u"&&(i=to(e.editor.tabSize,zt.tabSize,1,100));let n="tabSize";e.editor&&typeof e.editor.indentSize<"u"&&e.editor.indentSize!=="tabSize"&&(n=to(e.editor.indentSize,"tabSize",1,100));let s=zt.insertSpaces;e.editor&&typeof e.editor.insertSpaces<"u"&&(s=e.editor.insertSpaces==="false"?!1:!!e.editor.insertSpaces);let r=zZ;const a=e.eol;a===`\r
|
||
`?r=2:a===`
|
||
`&&(r=1);let c=zt.trimAutoWhitespace;e.editor&&typeof e.editor.trimAutoWhitespace<"u"&&(c=e.editor.trimAutoWhitespace==="false"?!1:!!e.editor.trimAutoWhitespace);let h=zt.detectIndentation;e.editor&&typeof e.editor.detectIndentation<"u"&&(h=e.editor.detectIndentation==="false"?!1:!!e.editor.detectIndentation);let d=zt.largeFileOptimizations;e.editor&&typeof e.editor.largeFileOptimizations<"u"&&(d=e.editor.largeFileOptimizations==="false"?!1:!!e.editor.largeFileOptimizations);let u=zt.bracketPairColorizationOptions;if(e.editor?.bracketPairColorization&&typeof e.editor.bracketPairColorization=="object"){const f=e.editor.bracketPairColorization;u={enabled:!!f.enabled,independentColorPoolPerBracketType:!!f.independentColorPoolPerBracketType}}return{isForSimpleWidget:t,tabSize:i,indentSize:n,insertSpaces:s,detectIndentation:h,defaultEOL:r,trimAutoWhitespace:c,largeFileOptimizations:d,bracketPairColorizationOptions:u}}_getEOL(e,t){if(e)return this._resourcePropertiesService.getEOL(e,t);const i=this._configurationService.getValue("files.eol",{overrideIdentifier:t});return i&&typeof i=="string"&&i!=="auto"?i:l.OS===3||l.OS===2?`
|
||
`:`\r
|
||
`}_shouldRestoreUndoStack(){const e=this._configurationService.getValue("files.restoreUndoStack");return typeof e=="boolean"?e:!0}getCreationOptions(e,t,i){const n=typeof e=="string"?e:e.languageId;let s=this._modelCreationOptionsByLanguageAndResource[n+t];if(!s){const r=this._configurationService.getValue("editor",{overrideIdentifier:n,resource:t}),a=this._getEOL(t,n);s=hh._readModelOptions({editor:r,eol:a},i),this._modelCreationOptionsByLanguageAndResource[n+t]=s}return s}_updateModelOptions(e){const t=this._modelCreationOptionsByLanguageAndResource;this._modelCreationOptionsByLanguageAndResource=Object.create(null);const i=Object.keys(this._models);for(let n=0,s=i.length;n<s;n++){const r=i[n],a=this._models[r],c=a.model.getLanguageId(),h=a.model.uri;if(e&&!e.affectsConfiguration("editor",{overrideIdentifier:c,resource:h})&&!e.affectsConfiguration("files.eol",{overrideIdentifier:c,resource:h}))continue;const d=t[c+h],u=this.getCreationOptions(c,h,a.model.isForSimpleWidget);hh._setModelOptionsForModel(a.model,u,d)}}static _setModelOptionsForModel(e,t,i){i&&i.defaultEOL!==t.defaultEOL&&e.getLineCount()===1&&e.setEOL(t.defaultEOL===1?0:1),!(i&&i.detectIndentation===t.detectIndentation&&i.insertSpaces===t.insertSpaces&&i.tabSize===t.tabSize&&i.indentSize===t.indentSize&&i.trimAutoWhitespace===t.trimAutoWhitespace&&l.equals$1(i.bracketPairColorizationOptions,t.bracketPairColorizationOptions))&&(t.detectIndentation?(e.detectIndentation(t.insertSpaces,t.tabSize),e.updateOptions({trimAutoWhitespace:t.trimAutoWhitespace,bracketColorizationOptions:t.bracketPairColorizationOptions})):e.updateOptions({insertSpaces:t.insertSpaces,tabSize:t.tabSize,indentSize:t.indentSize,trimAutoWhitespace:t.trimAutoWhitespace,bracketColorizationOptions:t.bracketPairColorizationOptions}))}_insertDisposedModel(e){this._disposedModels.set(ll(e.uri),e),this._disposedModelsHeapSize+=e.heapSize}_removeDisposedModel(e){const t=this._disposedModels.get(ll(e));return t&&(this._disposedModelsHeapSize-=t.heapSize),this._disposedModels.delete(ll(e)),t}_ensureDisposedModelsHeapSize(e){if(this._disposedModelsHeapSize>e){const t=[];for(this._disposedModels.forEach(i=>{i.sharesUndoRedoStack||t.push(i)}),t.sort((i,n)=>i.time-n.time);t.length>0&&this._disposedModelsHeapSize>e;){const i=t.shift();this._removeDisposedModel(i.uri),i.initialUndoRedoSnapshot!==null&&this._undoRedoService.restoreSnapshot(i.initialUndoRedoSnapshot)}}}_createModelData(e,t,i,n){const s=this.getCreationOptions(t,i,n),r=this._instantiationService.createInstance(_.TextModel,e,t,s,i);if(i&&this._disposedModels.has(ll(i))){const h=this._removeDisposedModel(i),d=this._undoRedoService.getElements(i),u=this._getSHA1Computer(),f=u.canComputeSHA1(r)?u.computeSHA1(r)===h.sha1:!1;if(f||h.sharesUndoRedoStack){for(const g of d.past)bo(g)&&g.matchesResource(i)&&g.setModel(r);for(const g of d.future)bo(g)&&g.matchesResource(i)&&g.setModel(r);this._undoRedoService.setElementsValidFlag(i,!0,g=>bo(g)&&g.matchesResource(i)),f&&(r._overwriteVersionId(h.versionId),r._overwriteAlternativeVersionId(h.alternativeVersionId),r._overwriteInitialUndoRedoSnapshot(h.initialUndoRedoSnapshot))}else h.initialUndoRedoSnapshot!==null&&this._undoRedoService.restoreSnapshot(h.initialUndoRedoSnapshot)}const a=ll(r.uri);if(this._models[a])throw new Error("ModelService: Cannot add model because it already exists!");const c=new BZ(r,h=>this._onWillDispose(h),(h,d)=>this._onDidChangeLanguage(h,d));return this._models[a]=c,c}createModel(e,t,i,n=!1){let s;return t?s=this._createModelData(e,t,i,n):s=this._createModelData(e,pn,i,n),this._onModelAdded.fire(s.model),s.model}getModels(){const e=[],t=Object.keys(this._models);for(let i=0,n=t.length;i<n;i++){const s=t[i];e.push(this._models[s].model)}return e}getModel(e){const t=ll(e),i=this._models[t];return i?i.model:null}_schemaShouldMaintainUndoRedoElements(e){return e.scheme===l.Schemas.file||e.scheme===l.Schemas.vscodeRemote||e.scheme===l.Schemas.vscodeUserData||e.scheme===l.Schemas.vscodeNotebookCell||e.scheme==="fake-fs"}_onWillDispose(e){const t=ll(e.uri),i=this._models[t],n=this._undoRedoService.getUriComparisonKey(e.uri)!==e.uri.toString();let s=!1,r=0;if(n||this._shouldRestoreUndoStack()&&this._schemaShouldMaintainUndoRedoElements(e.uri)){const h=this._undoRedoService.getElements(e.uri);if(h.past.length>0||h.future.length>0){for(const d of h.past)bo(d)&&d.matchesResource(e.uri)&&(s=!0,r+=d.heapSize(e.uri),d.setModel(e.uri));for(const d of h.future)bo(d)&&d.matchesResource(e.uri)&&(s=!0,r+=d.heapSize(e.uri),d.setModel(e.uri))}}const a=hh.MAX_MEMORY_FOR_CLOSED_FILES_UNDO_STACK,c=this._getSHA1Computer();if(s)if(!n&&(r>a||!c.canComputeSHA1(e))){const h=i.model.getInitialUndoRedoSnapshot();h!==null&&this._undoRedoService.restoreSnapshot(h)}else this._ensureDisposedModelsHeapSize(a-r),this._undoRedoService.setElementsValidFlag(e.uri,!1,h=>bo(h)&&h.matchesResource(e.uri)),this._insertDisposedModel(new VZ(e.uri,i.model.getInitialUndoRedoSnapshot(),Date.now(),n,r,c.computeSHA1(e),e.getVersionId(),e.getAlternativeVersionId()));else if(!n){const h=i.model.getInitialUndoRedoSnapshot();h!==null&&this._undoRedoService.restoreSnapshot(h)}delete this._models[t],i.dispose(),delete this._modelCreationOptionsByLanguageAndResource[e.getLanguageId()+e.uri],this._onModelRemoved.fire(e)}_onDidChangeLanguage(e,t){const i=t.oldLanguage,n=e.getLanguageId(),s=this.getCreationOptions(i,e.uri,e.isForSimpleWidget),r=this.getCreationOptions(n,e.uri,e.isForSimpleWidget);hh._setModelOptionsForModel(e,r,s),this._onModelModeChanged.fire({model:e,oldLanguageId:i})}_getSHA1Computer(){return new FL}},hh=Il,Il.MAX_MEMORY_FOR_CLOSED_FILES_UNDO_STACK=20*1024*1024,Il);kL=hh=FZ([C_(0,Ge),C_(1,cE),C_(2,bw),C_(3,me)],kL);const bb=class bb{canComputeSHA1(e){return e.getValueLength()<=bb.MAX_MODEL_SIZE}computeSHA1(e){const t=new l.StringSHA1,i=e.createSnapshot();let n;for(;n=i.read();)t.update(n);return t.digest()}};bb.MAX_MODEL_SIZE=10*1024*1024;let FL=bb;_.InspectTokensNLS=void 0,(function(o){o.inspectTokensAction=l.localize(821,"Developer: Inspect Tokens")})(_.InspectTokensNLS||(_.InspectTokensNLS={})),_.GoToLineNLS=void 0,(function(o){o.gotoLineActionLabel=l.localize(822,"Go to Line/Column..."),o.gotoOffsetActionLabel=l.localize(823,"Go to Offset...")})(_.GoToLineNLS||(_.GoToLineNLS={})),_.QuickHelpNLS=void 0,(function(o){o.helpQuickAccessActionLabel=l.localize(824,"Show all Quick Access Providers")})(_.QuickHelpNLS||(_.QuickHelpNLS={})),_.QuickCommandNLS=void 0,(function(o){o.quickCommandActionLabel=l.localize(825,"Command Palette"),o.quickCommandHelp=l.localize(826,"Show And Run Commands")})(_.QuickCommandNLS||(_.QuickCommandNLS={})),_.QuickOutlineNLS=void 0,(function(o){o.quickOutlineActionLabel=l.localize(827,"Go to Symbol..."),o.quickOutlineByCategoryActionLabel=l.localize(828,"Go to Symbol by Category...")})(_.QuickOutlineNLS||(_.QuickOutlineNLS={}));var BL;(function(o){o.editorViewAccessibleLabel=l.localize(829,"Editor content")})(BL||(BL={})),_.ToggleHighContrastNLS=void 0,(function(o){o.toggleHighContrast=l.localize(830,"Toggle High Contrast Theme")})(_.ToggleHighContrastNLS||(_.ToggleHighContrastNLS={}));var zL;(function(o){o.bulkEditServiceSummary=l.localize(831,"Made {0} edits in {1} files")})(zL||(zL={}));const Tn=le("themeService");var VL;(function(o){o[o.PRESERVE=0]="PRESERVE",o[o.LAST=1]="LAST"})(VL||(VL={}));const UL={Quickaccess:"workbench.contributions.quickaccess"};class UZ{constructor(){this.providers=[],this.defaultProvider=void 0}registerQuickAccessProvider(e){return e.prefix.length===0?this.defaultProvider=e:this.providers.push(e),this.providers.sort((t,i)=>i.prefix.length-t.prefix.length),l.toDisposable(()=>{this.providers.splice(this.providers.indexOf(e),1),this.defaultProvider===e&&(this.defaultProvider=void 0)})}getQuickAccessProviders(e){return l.coalesce([this.defaultProvider,...this.providers]).filter(t=>!t.when||e.contextMatchesRules(t.when))}getQuickAccessProvider(e,t){return(e?this.providers.find(n=>e.startsWith(n.prefix)&&(!n.when||t.contextMatchesRules(n.when))):void 0)||this.defaultProvider}}St.add(UL.Quickaccess,new UZ);var $Z=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},$L=function(o,e){return function(t,i){e(t,i,o)}};let KL=class extends l.Disposable{constructor(e,t,i){super(),this.quickInputService=e,this.instantiationService=t,this.contextKeyService=i,this.registry=St.as(UL.Quickaccess),this.mapProviderToDescriptor=new Map,this.lastAcceptedPickerValues=new Map,this.visibleQuickAccess=void 0,this._register(l.toDisposable(()=>{for(const n of this.mapProviderToDescriptor.values())l.isDisposable(n)&&n.dispose();this.visibleQuickAccess?.picker.dispose()}))}show(e="",t){this.doShowOrPick(e,!1,t)}doShowOrPick(e,t,i){const[n,s]=this.getOrInstantiateProvider(e,i?.enabledProviderPrefixes),r=this.visibleQuickAccess,a=r?.descriptor;if(r&&s&&a===s){e!==s.prefix&&!i?.preserveValue&&(r.picker.value=e),this.adjustValueSelection(r.picker,s,i);return}if(s&&!i?.preserveValue){let m;if(r&&a&&a!==s){const p=r.value.substr(a.prefix.length);p&&(m=`${s.prefix}${p}`)}if(!m){const p=n?.defaultFilterValue;p===VL.LAST?m=this.lastAcceptedPickerValues.get(s):typeof p=="string"&&(m=`${s.prefix}${p}`)}typeof m=="string"&&(e=m)}const c=r?.picker?.valueSelection,h=r?.picker?.value,d=new l.DisposableStore,u=d.add(this.quickInputService.createQuickPick({useSeparators:!0}));u.value=e,this.adjustValueSelection(u,s,i),u.placeholder=i?.placeholder??s?.placeholder,u.quickNavigate=i?.quickNavigateConfiguration,u.hideInput=!!u.quickNavigate&&!r,(typeof i?.itemActivation=="number"||i?.quickNavigateConfiguration)&&(u.itemActivation=i?.itemActivation??_.ItemActivation.SECOND),u.contextKey=s?.contextKey,u.filterValue=m=>m.substring(s?s.prefix.length:0);let f;t&&(f=new l.DeferredPromise,d.add(l.Event.once(u.onWillAccept)(m=>{m.veto(),u.hide()}))),d.add(this.registerPickerListeners(u,n,s,e,i));const g=d.add(new l.CancellationTokenSource);if(n&&d.add(n.provide(u,g.token,i?.providerOptions)),l.Event.once(u.onDidHide)(()=>{u.selectedItems.length===0&&g.cancel(),d.dispose(),f?.complete(u.selectedItems.slice(0))}),u.show(),c&&h===e&&(u.valueSelection=c),t)return f?.p}adjustValueSelection(e,t,i){let n;i?.preserveValue?n=[e.value.length,e.value.length]:n=[t?.prefix.length??0,e.value.length],e.valueSelection=n}registerPickerListeners(e,t,i,n,s){const r=new l.DisposableStore,a=this.visibleQuickAccess={picker:e,descriptor:i,value:n};return r.add(l.toDisposable(()=>{a===this.visibleQuickAccess&&(this.visibleQuickAccess=void 0)})),r.add(e.onDidChangeValue(c=>{const[h]=this.getOrInstantiateProvider(c,s?.enabledProviderPrefixes);h!==t?this.show(c,{enabledProviderPrefixes:s?.enabledProviderPrefixes,preserveValue:!0,providerOptions:s?.providerOptions}):a.value=c})),i&&r.add(e.onDidAccept(()=>{this.lastAcceptedPickerValues.set(i,e.value)})),r}getOrInstantiateProvider(e,t){const i=this.registry.getQuickAccessProvider(e,this.contextKeyService);if(!i||t&&!t?.includes(i.prefix))return[void 0,void 0];let n=this.mapProviderToDescriptor.get(i);return n||(n=this.instantiationService.createInstance(i.ctor),this.mapProviderToDescriptor.set(i,n)),[n,i]}};KL=$Z([$L(0,Ps),$L(1,me),$L(2,be)],KL);var KZ=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s};class kA{constructor(e){this.nodes=e}toString(){return this.nodes.map(e=>typeof e=="string"?e:e.label).join("")}}KZ([et],kA.prototype,"toString",null);const GZ=/\[([^\]]+)\]\(((?:https?:\/\/|command:|file:)[^\)\s]+)(?: (["'])(.+?)(\3))?\)/gi;function jZ(o){const e=[];let t=0,i;for(;i=GZ.exec(o);){i.index-t>0&&e.push(o.substring(t,i.index));const[,n,s,,r]=i;r?e.push({label:n,href:s,title:r}):e.push({label:n,href:s}),t=i.index+i[0].length}return t<o.length&&e.push(o.substring(t)),new kA(e)}const GL={},qZ=new ES("quick-input-button-icon-");function YZ(o){if(!o)return;let e;const t=o.dark.toString();return GL[t]?e=GL[t]:(e=qZ.nextId(),Pg(`.${e}, .hc-light .${e}`,`background-image: ${Bs(o.light||o.dark)}`),Pg(`.vs-dark .${e}, .hc-black .${e}`,`background-image: ${Bs(o.dark)}`),GL[t]=e),e}class ZZ{constructor(e,t,i,n,s,r,a){this.id=e,this.label=t,this.tooltip=i,this.enabled=s,this._checked=r,this._run=a,this.class=n}get checked(){return this._checked}set checked(e){this._checked=e,this._run()}run(){return this._checked=!this._checked,this._run()}}function FA(o,e,t){let i=o.iconClass||YZ(o.iconPath);o.alwaysVisible&&(i=i?`${i} always-visible`:"always-visible");const n=()=>(o.toggle&&(o.toggle.checked=!o.toggle.checked),t());return o.toggle?new ZZ(e,o.tooltip||"","",i,!0,o.toggle.checked,n):{id:e,label:"",tooltip:o.tooltip||"",class:i,enabled:!0,run:n}}function dh(o,e,t){const i=[],n=[];return o.forEach((s,r)=>{const a=FA(s,`${e}-${r}`,async()=>t(s));s.label&&(a.label=s.label),s.secondary?n.push(a):i.push(a)}),{primary:i,secondary:n}}function QZ(o,e,t){oi(e);const i=jZ(o);let n=0;for(const s of i.nodes)if(typeof s=="string")e.append(...vr(s));else{let r=s.title;!r&&s.href.startsWith("command:")?r=l.localize(1835,"Click to execute command '{0}'",s.href.substring(8)):r||(r=s.href);const a=Q("a",{href:s.href,title:r,tabIndex:n++},s.label);a.style.textDecoration="underline";const c=g=>{LF(g)&&ve.stop(g,!0),t.callback(s.href)},h=t.disposables.add(new Te(a,F.CLICK)).event,d=t.disposables.add(new Te(a,F.KEY_DOWN)).event,u=l.Event.chain(d,g=>g.filter(m=>{const p=new Be(m);return p.equals(10)||p.equals(3)}));t.disposables.add(li.addTarget(a));const f=t.disposables.add(new Te(a,_.EventType$1.Tap)).event;l.Event.any(h,f,u)(c,null,t.disposables),e.appendChild(a)}}var XZ=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},BA=function(o,e){return function(t,i){e(t,i,o)}};const zA="inQuickInput",JZ=new q(zA,!1,l.localize(1812,"Whether keyboard focus is inside the quick input control")),tf=de.has(zA),WZ="quickInputAlignment",HZ=new q(WZ,"top",l.localize(1813,"The alignment of the quick input")),cl="quickInputType",eQ=new q(cl,void 0,l.localize(1814,"The type of the currently visible quick input")),VA="cursorAtEndOfQuickInputBox",tQ=new q(VA,!1,l.localize(1815,"Whether the cursor in the quick input is at the end of the input box")),iQ=de.has(VA),UA={iconClass:_.ThemeIcon.asClassName(l.Codicon.quickInputBack),tooltip:l.localize(1816,"Back")},Cb=class Cb extends l.Disposable{constructor(e){super(),this.ui=e,this._visible=W("visible",!1),this._enabled=!0,this._busy=!1,this._ignoreFocusOut=!1,this._leftButtons=[],this._rightButtons=[],this._inlineButtons=[],this._inputButtons=[],this.buttonsUpdated=!1,this.noValidationMessage=Cb.noPromptMessage,this._severity=rt.Ignore,this.onDidTriggerButtonEmitter=this._register(new l.Emitter),this.onDidHideEmitter=this._register(new l.Emitter),this.onWillHideEmitter=this._register(new l.Emitter),this.onDisposeEmitter=this._register(new l.Emitter),this.visibleDisposables=this._register(new l.DisposableStore),this.onDidTriggerButton=this.onDidTriggerButtonEmitter.event,this.onDidHide=this.onDidHideEmitter.event}get visible(){return this._visible.get()}get title(){return this._title}set title(e){this._title=e,this.update()}get description(){return this._description}set description(e){this._description=e,this.update()}get step(){return this._steps}set step(e){this._steps=e,this.update()}get totalSteps(){return this._totalSteps}set totalSteps(e){this._totalSteps=e,this.update()}get enabled(){return this._enabled}set enabled(e){this._enabled=e,this.update()}get contextKey(){return this._contextKey}set contextKey(e){this._contextKey=e,this.update()}get busy(){return this._busy}set busy(e){this._busy=e,this.update()}get ignoreFocusOut(){return this._ignoreFocusOut}set ignoreFocusOut(e){const t=this._ignoreFocusOut!==e&&!l.isIOS;this._ignoreFocusOut=e&&!l.isIOS,t&&this.update()}get titleButtons(){return this._leftButtons.length?[...this._leftButtons,this._rightButtons]:this._rightButtons}get buttons(){return[...this._leftButtons,...this._rightButtons,...this._inlineButtons,...this._inputButtons]}set buttons(e){const t=[],i=[],n=[],s=[];for(const r of e)if(r===UA)t.push(r);else switch(r.location){case _.QuickInputButtonLocation.Inline:n.push(r);break;case _.QuickInputButtonLocation.Input:s.push(r);break;default:i.push(r);break}this._leftButtons=t,this._rightButtons=i,this._inlineButtons=n,this._inputButtons=s,this.buttonsUpdated=!0,this.update()}get validationMessage(){return this._validationMessage}set validationMessage(e){this._validationMessage=e,this.update()}get severity(){return this._severity}set severity(e){this._severity=e,this.update()}show(){this.visible||(this.visibleDisposables.add(this.ui.onDidTriggerButton(e=>{this.buttons.indexOf(e)!==-1&&this.onDidTriggerButtonEmitter.fire(e)})),this.ui.show(this),this._visible.set(!0,void 0),this._lastValidationMessage=void 0,this._lastSeverity=void 0,this.buttons.length&&(this.buttonsUpdated=!0),this.update())}hide(){this.visible&&this.ui.hide()}didHide(e=ku.Other){this._visible.set(!1,void 0),this.visibleDisposables.clear(),this.onDidHideEmitter.fire({reason:e})}willHide(e=ku.Other){this.onWillHideEmitter.fire({reason:e})}update(){if(!this.visible)return;const e=this.getTitle();e&&this.ui.title.textContent!==e?this.ui.title.textContent=e:!e&&this.ui.title.innerHTML!==" "&&(this.ui.title.innerText=" ");const t=this.getDescription();if(this.ui.description1.textContent!==t&&(this.ui.description1.textContent=t),this.ui.description2.textContent!==t&&(this.ui.description2.textContent=t),this.busy&&!this.busyDelay&&(this.busyDelay=new l.TimeoutTimer,this.busyDelay.setIfNotSet(()=>{this.visible&&(this.ui.progressBar.infinite(),this.ui.progressBar.getContainer().removeAttribute("aria-hidden"))},800)),!this.busy&&this.busyDelay&&(this.ui.progressBar.stop(),this.ui.progressBar.getContainer().setAttribute("aria-hidden","true"),this.busyDelay.cancel(),this.busyDelay=void 0),this.buttonsUpdated){this.buttonsUpdated=!1;const n=dh(this._leftButtons,"left-button",c=>this.onDidTriggerButtonEmitter.fire(c));this.ui.leftActionBar.setActions(n.primary,n.secondary);const s=dh(this._rightButtons,"right-button",c=>this.onDidTriggerButtonEmitter.fire(c));this.ui.rightActionBar.setActions(s.primary,s.secondary);const r=dh(this._inlineButtons,"inline-button",c=>this.onDidTriggerButtonEmitter.fire(c));this.ui.inlineActionBar.setActions(r.primary,r.secondary);const a=this._inputButtons.length*22;this.ui.countContainer.style.right=a>0?`${4+a}px`:"4px",this.ui.inputBox.actions=this._inputButtons.map((c,h)=>FA(c,`id-${h}`,async()=>this.onDidTriggerButtonEmitter.fire(c)))}this.ui.ignoreFocusOut=this.ignoreFocusOut,this.ui.setEnabled(this.enabled),this.ui.setContextKey(this.contextKey);const i=this.validationMessage||this.noValidationMessage;this._lastValidationMessage!==i&&(this._lastValidationMessage=i,oi(this.ui.message),i&&QZ(i,this.ui.message,{callback:n=>{this.ui.linkOpenerDelegate(n)},disposables:this.visibleDisposables})),this._lastSeverity!==this.severity&&(this._lastSeverity=this.severity,this.showMessageDecoration(this.severity))}getTitle(){return this.title&&this.step?`${this.title} (${this.getSteps()})`:this.title?this.title:this.step?this.getSteps():""}getDescription(){return this.description||""}getSteps(){return this.step&&this.totalSteps?l.localize(1818,"{0}/{1}",this.step,this.totalSteps):this.step?String(this.step):""}showMessageDecoration(e){if(this.ui.inputBox.showDecoration(e),e!==rt.Ignore){const t=this.ui.inputBox.stylesForType(e);this.ui.message.style.color=t.foreground?`${t.foreground}`:"",this.ui.message.style.backgroundColor=t.background?`${t.background}`:"",this.ui.message.style.border=t.border?`1px solid ${t.border}`:"",this.ui.message.style.marginBottom="-2px"}else this.ui.message.style.color="",this.ui.message.style.backgroundColor="",this.ui.message.style.border="",this.ui.message.style.marginBottom=""}dispose(){this.hide(),this.onDisposeEmitter.fire(),super.dispose()}};Cb.noPromptMessage=l.localize(1817,"Press 'Enter' to confirm your input or 'Escape' to cancel");let uh=Cb;const vb=class vb extends uh{constructor(e){super(e),this._value="",this.onDidChangeValueEmitter=this._register(new l.Emitter),this.onWillAcceptEmitter=this._register(new l.Emitter),this.onDidAcceptEmitter=this._register(new l.Emitter),this.onDidCustomEmitter=this._register(new l.Emitter),this._items=[],this.itemsUpdated=!1,this._canSelectMany=!1,this._canAcceptInBackground=!1,this._matchOnDescription=!1,this._matchOnDetail=!1,this._matchOnLabel=!0,this._matchOnLabelMode="fuzzy",this._sortByLabel=!0,this._keepScrollPosition=!1,this._itemActivation=_.ItemActivation.FIRST,this._activeItems=[],this.activeItemsUpdated=!1,this.activeItemsToConfirm=[],this.onDidChangeActiveEmitter=this._register(new l.Emitter),this._selectedItems=[],this.selectedItemsUpdated=!1,this.selectedItemsToConfirm=[],this.onDidChangeSelectionEmitter=this._register(new l.Emitter),this.onDidTriggerItemButtonEmitter=this._register(new l.Emitter),this.onDidTriggerSeparatorButtonEmitter=this._register(new l.Emitter),this.valueSelectionUpdated=!0,this._ok="default",this._customButton=!1,this._customButtonSecondary=!1,this._focusEventBufferer=new l.EventBufferer,this.type="quickPick",this.filterValue=t=>t,this.onDidChangeValue=this.onDidChangeValueEmitter.event,this.onWillAccept=this.onWillAcceptEmitter.event,this.onDidAccept=this.onDidAcceptEmitter.event,this.onDidChangeActive=this.onDidChangeActiveEmitter.event,this.onDidChangeSelection=this.onDidChangeSelectionEmitter.event,this.onDidTriggerItemButton=this.onDidTriggerItemButtonEmitter.event,this.onDidTriggerSeparatorButton=this.onDidTriggerSeparatorButtonEmitter.event,this.noValidationMessage=void 0}get quickNavigate(){return this._quickNavigate}set quickNavigate(e){this._quickNavigate=e,this.update()}get value(){return this._value}set value(e){this.doSetValue(e)}doSetValue(e,t){this._value!==e&&(this._value=e,t||this.update(),this.visible&&this.ui.list.filter(this.filterValue(this._value))&&this.trySelectFirst(),this.onDidChangeValueEmitter.fire(this._value))}set ariaLabel(e){this._ariaLabel=e,this.update()}get ariaLabel(){return this._ariaLabel}get placeholder(){return this._placeholder}set placeholder(e){this._placeholder=e,this.update()}get prompt(){return this.noValidationMessage}set prompt(e){this.noValidationMessage=e,this.update()}get items(){return this._items}get scrollTop(){return this.ui.list.scrollTop}set scrollTop(e){this.ui.list.scrollTop=e}set items(e){this._items=e,this.itemsUpdated=!0,this.update()}get canSelectMany(){return this._canSelectMany}set canSelectMany(e){this._canSelectMany=e,this.update()}get canAcceptInBackground(){return this._canAcceptInBackground}set canAcceptInBackground(e){this._canAcceptInBackground=e}get matchOnDescription(){return this._matchOnDescription}set matchOnDescription(e){this._matchOnDescription=e,this.update()}get matchOnDetail(){return this._matchOnDetail}set matchOnDetail(e){this._matchOnDetail=e,this.update()}get matchOnLabel(){return this._matchOnLabel}set matchOnLabel(e){this._matchOnLabel=e,this.update()}get matchOnLabelMode(){return this._matchOnLabelMode}set matchOnLabelMode(e){this._matchOnLabelMode=e,this.update()}get sortByLabel(){return this._sortByLabel}set sortByLabel(e){this._sortByLabel=e,this.update()}get keepScrollPosition(){return this._keepScrollPosition}set keepScrollPosition(e){this._keepScrollPosition=e}get itemActivation(){return this._itemActivation}set itemActivation(e){this._itemActivation=e}get activeItems(){return this._activeItems}set activeItems(e){this._activeItems=e,this.activeItemsUpdated=!0,this.update()}get selectedItems(){return this._selectedItems}set selectedItems(e){this._selectedItems=e,this.selectedItemsUpdated=!0,this.update()}get keyMods(){return this._quickNavigate?L7:this.ui.keyMods}get valueSelection(){const e=this.ui.inputBox.getSelection();if(e)return[e.start,e.end]}set valueSelection(e){this._valueSelection=e,this.valueSelectionUpdated=!0,this.update()}get customButton(){return this._customButton}set customButton(e){this._customButton=e,this.update()}get customLabel(){return this._customButtonLabel}set customLabel(e){this._customButtonLabel=e,this.update()}get customHover(){return this._customButtonHover}set customHover(e){this._customButtonHover=e,this.update()}get customButtonSecondary(){return this._customButtonSecondary}set customButtonSecondary(e){this._customButtonSecondary=e??!1,this.update()}get ok(){return this._ok}set ok(e){this._ok=e,this.update()}get okLabel(){return this._okLabel??l.localize(1820,"OK")}set okLabel(e){this._okLabel=e,this.update()}get hideInput(){return!!this._hideInput}set hideInput(e){this._hideInput=e,this.update()}trySelectFirst(){this.canSelectMany||this.ui.list.focus(xe.First)}show(){this.visible||(this.visibleDisposables.add(this.ui.inputBox.onDidChange(e=>{this.doSetValue(e,!0)})),this.visibleDisposables.add(this.ui.onDidAccept(()=>{this.canSelectMany?this.ui.list.getCheckedElements().length||(this._selectedItems=[],this.onDidChangeSelectionEmitter.fire(this.selectedItems)):this.activeItems[0]&&(this._selectedItems=[this.activeItems[0]],this.onDidChangeSelectionEmitter.fire(this.selectedItems)),this.handleAccept(!1)})),this.visibleDisposables.add(this.ui.onDidCustom(()=>{this.onDidCustomEmitter.fire()})),this.visibleDisposables.add(this._focusEventBufferer.wrapEvent(this.ui.list.onDidChangeFocus,(e,t)=>t)(e=>{this.activeItemsUpdated||this.activeItemsToConfirm!==this._activeItems&&l.equals(e,this._activeItems,(t,i)=>t===i)||(this._activeItems=e,this.onDidChangeActiveEmitter.fire(e))})),this.visibleDisposables.add(this.ui.list.onDidChangeSelection(({items:e,event:t})=>{if(this.canSelectMany&&!e.some(i=>i.pickable===!1)){e.length&&this.ui.list.setSelectedElements([]);return}this.selectedItemsToConfirm!==this._selectedItems&&l.equals(e,this._selectedItems,(i,n)=>i===n)||(this._selectedItems=e,this.onDidChangeSelectionEmitter.fire(e),e.length&&this.handleAccept(Qf(t)&&t.button===1))})),this.visibleDisposables.add(this.ui.list.onChangedCheckedElements(e=>{!this.canSelectMany||!this.visible||this.selectedItemsToConfirm!==this._selectedItems&&l.equals(e,this._selectedItems,(t,i)=>t===i)||(this._selectedItems=e,this.onDidChangeSelectionEmitter.fire(e))})),this.visibleDisposables.add(this.ui.list.onButtonTriggered(e=>this.onDidTriggerItemButtonEmitter.fire(e))),this.visibleDisposables.add(this.ui.list.onSeparatorButtonTriggered(e=>this.onDidTriggerSeparatorButtonEmitter.fire(e))),this.visibleDisposables.add(this.registerQuickNavigation()),this.valueSelectionUpdated=!0),super.show()}handleAccept(e){let t=!1;this.onWillAcceptEmitter.fire({veto:()=>t=!0}),t||this.onDidAcceptEmitter.fire({inBackground:e})}registerQuickNavigation(){return R(this.ui.container,F.KEY_UP,e=>{if(this.canSelectMany||!this._quickNavigate)return;const t=new Be(e),i=t.keyCode;this._quickNavigate.keybindings.some(r=>{const a=r.getChords();return a.length>1?!1:a[0].shiftKey&&i===4?!(t.ctrlKey||t.altKey||t.metaKey):!!(a[0].altKey&&i===6||a[0].ctrlKey&&i===5||a[0].metaKey&&i===57)})&&(this.activeItems[0]&&(this._selectedItems=[this.activeItems[0]],this.onDidChangeSelectionEmitter.fire(this.selectedItems),this.handleAccept(!1)),this._quickNavigate=void 0)})}update(){if(!this.visible)return;const e=this.keepScrollPosition?this.scrollTop:0,t=!!this.description,i={title:!!this.title||!!this.step||!!this.titleButtons.length,description:t,checkAll:this.canSelectMany&&!this._hideCheckAll,checkBox:this.canSelectMany,inputBox:!this._hideInput,progressBar:!this._hideInput||t,visibleCount:!0,count:this.canSelectMany&&!this._hideCountBadge,ok:this.ok==="default"?this.canSelectMany:this.ok,list:!0,message:!!this.validationMessage||!!this.prompt,customButton:this.customButton};this.ui.setVisibilities(i),super.update(),this.ui.inputBox.value!==this.value&&(this.ui.inputBox.value=this.value),this.valueSelectionUpdated&&(this.valueSelectionUpdated=!1,this.ui.inputBox.select(this._valueSelection&&{start:this._valueSelection[0],end:this._valueSelection[1]})),this.ui.inputBox.placeholder!==(this.placeholder||"")&&(this.ui.inputBox.placeholder=this.placeholder||"");let n=this.ariaLabel;!n&&i.inputBox&&(n=this.placeholder,this.title&&(n=n?`${n} - ${this.title}`:this.title),n||(n=vb.DEFAULT_ARIA_LABEL)),this.ui.list.ariaLabel!==n&&(this.ui.list.ariaLabel=n??null),this.ui.inputBox.ariaLabel!==n&&(this.ui.inputBox.ariaLabel=n??"input"),this.ui.list.matchOnDescription=this.matchOnDescription,this.ui.list.matchOnDetail=this.matchOnDetail,this.ui.list.matchOnLabel=this.matchOnLabel,this.ui.list.matchOnLabelMode=this.matchOnLabelMode,this.ui.list.sortByLabel=this.sortByLabel,this.itemsUpdated&&(this.itemsUpdated=!1,this._focusEventBufferer.bufferEvents(()=>{switch(this.ui.list.setElements(this.items),this.ui.list.shouldLoop=!this.canSelectMany,this.ui.list.filter(this.filterValue(this.ui.inputBox.value)),this._itemActivation){case _.ItemActivation.NONE:this._itemActivation=_.ItemActivation.FIRST;break;case _.ItemActivation.SECOND:this.ui.list.focus(xe.Second),this._itemActivation=_.ItemActivation.FIRST;break;case _.ItemActivation.LAST:this.ui.list.focus(xe.Last),this._itemActivation=_.ItemActivation.FIRST;break;default:this.trySelectFirst();break}})),this.ui.container.classList.contains("show-checkboxes")!==!!this.canSelectMany&&(this.canSelectMany?this.ui.list.clearFocus():this.trySelectFirst()),this.activeItemsUpdated&&(this.activeItemsUpdated=!1,this.activeItemsToConfirm=this._activeItems,this.ui.list.setFocusedElements(this.activeItems),this.activeItemsToConfirm===this._activeItems&&(this.activeItemsToConfirm=null)),this.selectedItemsUpdated&&(this.selectedItemsUpdated=!1,this.selectedItemsToConfirm=this._selectedItems,this.canSelectMany?this.ui.list.setCheckedElements(this.selectedItems):this.ui.list.setSelectedElements(this.selectedItems),this.selectedItemsToConfirm===this._selectedItems&&(this.selectedItemsToConfirm=null)),this.ui.ok.label=this.okLabel||"",this.ui.customButton.label=this.customLabel||"",this.ui.customButton.element.title=this.customHover||"",this.ui.customButton.secondary=this.customButtonSecondary||!1,i.inputBox||(this.ui.list.domFocus(),this.canSelectMany&&this.ui.list.focus(xe.First)),this.keepScrollPosition&&(this.scrollTop=e)}focus(e){this.ui.list.focus(e),this.canSelectMany&&this.ui.list.domFocus()}accept(e){e&&!this._canAcceptInBackground||(this.activeItems[0]&&!this._canSelectMany&&(this._selectedItems=[this.activeItems[0]],this.onDidChangeSelectionEmitter.fire(this.selectedItems)),this.handleAccept(e??!1))}};vb.DEFAULT_ARIA_LABEL=l.localize(1819,"Type to narrow down results.");let fh=vb;class nQ extends uh{constructor(){super(...arguments),this._value="",this.valueSelectionUpdated=!0,this._password=!1,this.onDidValueChangeEmitter=this._register(new l.Emitter),this.onDidAcceptEmitter=this._register(new l.Emitter),this.type="inputBox",this.onDidChangeValue=this.onDidValueChangeEmitter.event,this.onDidAccept=this.onDidAcceptEmitter.event}get value(){return this._value}set value(e){this._value=e||"",this.update()}get valueSelection(){const e=this.ui.inputBox.getSelection();if(e)return[e.start,e.end]}set valueSelection(e){this._valueSelection=e,this.valueSelectionUpdated=!0,this.update()}get placeholder(){return this._placeholder}set placeholder(e){this._placeholder=e,this.update()}get ariaLabel(){return this._ariaLabel}set ariaLabel(e){this._ariaLabel=e,this.update()}get password(){return this._password}set password(e){this._password=e,this.update()}get prompt(){return this._prompt}set prompt(e){this._prompt=e,this.noValidationMessage=e?l.localize(1821,"{0} (Press 'Enter' to confirm or 'Escape' to cancel)",e):uh.noPromptMessage,this.update()}show(){this.visible||(this.visibleDisposables.add(this.ui.inputBox.onDidChange(e=>{e!==this.value&&(this._value=e,this.onDidValueChangeEmitter.fire(e))})),this.visibleDisposables.add(this.ui.onDidAccept(()=>this.onDidAcceptEmitter.fire())),this.valueSelectionUpdated=!0),super.show()}accept(){this.onDidAcceptEmitter.fire()}update(){if(!this.visible)return;this.ui.container.classList.remove("hidden-input");const e={title:!!this.title||!!this.step||!!this.titleButtons.length,description:!!this.description||!!this.step,inputBox:!0,message:!0,progressBar:!0};this.ui.setVisibilities(e),super.update(),this.ui.inputBox.value!==this.value&&(this.ui.inputBox.value=this.value),this.valueSelectionUpdated&&(this.valueSelectionUpdated=!1,this.ui.inputBox.select(this._valueSelection&&{start:this._valueSelection[0],end:this._valueSelection[1]})),this.ui.inputBox.placeholder!==(this.placeholder||"")&&(this.ui.inputBox.placeholder=this.placeholder||""),this.ui.inputBox.password!==this.password&&(this.ui.inputBox.password=this.password);let t=this.ariaLabel;!t&&e.inputBox&&(t=this.placeholder?this.title?`${this.placeholder} - ${this.title}`:this.placeholder:this.title?this.title:"input"),this.ui.inputBox.ariaLabel!==t&&(this.ui.inputBox.ariaLabel=t||"input")}}let jL=class extends _.WorkbenchHoverDelegate{constructor(e,t){super("mouse",void 0,i=>this.getOverrideOptions(i),e,t)}getOverrideOptions(e){const t=(Ve(e.content)?e.content.textContent??"":typeof e.content=="string"?e.content:e.content.value).includes(`
|
||
`);return{persistence:{hideOnKeyDown:!1},appearance:{showHoverHint:t,skipFadeInAnimation:!0}}}};jL=XZ([BA(0,Ge),BA(1,kc)],jL);const gh=20,mh=4,qL="--vscode-toolbar-action-min-width";class ph extends l.Disposable{get onDidChangeDropdownVisibility(){return this._onDidChangeDropdownVisibility.event}constructor(e,t,i={orientation:0}){if(super(),this.container=e,this.submenuActionViewItems=[],this.hasSecondaryActions=!1,this._onDidChangeDropdownVisibility=this._register(new l.EventMultiplexer),this.originalPrimaryActions=[],this.originalSecondaryActions=[],this.hiddenActions=[],this.disposables=this._register(new l.DisposableStore),i.hoverDelegate=i.hoverDelegate??this._register(sM()),this.options=i,this.toggleMenuAction=this._register(new _h(()=>this.toggleMenuActionViewItem?.show(),i.toggleMenuTitle)),this.element=document.createElement("div"),this.element.className="monaco-toolbar",e.appendChild(this.element),this.actionBar=this._register(new el(this.element,{orientation:i.orientation,ariaLabel:i.ariaLabel,actionRunner:i.actionRunner,allowContextMenu:i.allowContextMenu,highlightToggledItems:i.highlightToggledItems,hoverDelegate:i.hoverDelegate,actionViewItemProvider:(n,s)=>{if(n.id===_h.ID)return this.toggleMenuActionViewItem=new Bp(n,{getActions:()=>this.toggleMenuAction.menuActions},t,{actionViewItemProvider:this.options.actionViewItemProvider,actionRunner:this.actionRunner,keybindingProvider:this.options.getKeyBinding,classNames:_.ThemeIcon.asClassNameArray(i.moreIcon??l.Codicon.toolBarMore),anchorAlignmentProvider:this.options.anchorAlignmentProvider,menuAsChild:!!this.options.renderDropdownAsChildElement,skipTelemetry:this.options.skipTelemetry,isMenu:!0,hoverDelegate:this.options.hoverDelegate}),this.toggleMenuActionViewItem.setActionContext(this.actionBar.context),this.disposables.add(this._onDidChangeDropdownVisibility.add(this.toggleMenuActionViewItem.onDidChangeVisibility)),this.toggleMenuActionViewItem;if(i.actionViewItemProvider){const r=i.actionViewItemProvider(n,s);if(r)return r}if(n instanceof cd){const r=new Bp(n,n.actions,t,{actionViewItemProvider:this.options.actionViewItemProvider,actionRunner:this.actionRunner,keybindingProvider:this.options.getKeyBinding,classNames:n.class,anchorAlignmentProvider:this.options.anchorAlignmentProvider,menuAsChild:!!this.options.renderDropdownAsChildElement,skipTelemetry:this.options.skipTelemetry,hoverDelegate:this.options.hoverDelegate});return r.setActionContext(this.actionBar.context),this.submenuActionViewItems.push(r),this.disposables.add(this._onDidChangeDropdownVisibility.add(r.onDidChangeVisibility)),r}}})),this.options.responsiveBehavior?.enabled){this.element.classList.toggle("responsive",!0),this.element.classList.toggle("responsive-all",this.options.responsiveBehavior.kind==="all"),this.element.classList.toggle("responsive-last",this.options.responsiveBehavior.kind==="last"),this.element.style.setProperty(qL,`${this.getConfiguredActionMinWidth()}px`);const n=new ResizeObserver(()=>{this.updateActions(this.getAvailableWidth())});n.observe(this.options.responsiveBehavior?.observedElement??this.element),this._store.add(l.toDisposable(()=>n.disconnect()))}}set actionRunner(e){this.actionBar.actionRunner=e}get actionRunner(){return this.actionBar.actionRunner}set context(e){this.actionBar.context=e,this.toggleMenuActionViewItem?.setActionContext(e);for(const t of this.submenuActionViewItems)t.setActionContext(e)}getElement(){return this.element}getItemAction(e){return this.actionBar.getAction(e)}getItemWidth(e){return this.actionBar.getWidth(e)}getItemsLength(){return this.actionBar.length()}setActions(e,t){this.clear(),this.originalPrimaryActions=e?e.slice(0):[],this.originalSecondaryActions=t?t.slice(0):[];const i=e?e.slice(0):[];if(this.hasSecondaryActions=!!(t&&t.length>0),this.hasSecondaryActions&&t&&(this.toggleMenuAction.menuActions=t.slice(0),i.push(this.toggleMenuAction)),i.length>0&&this.options.trailingSeparator&&i.push(new ft),i.forEach(n=>{this.actionBar.push(n,{icon:this.options.icon??!0,label:this.options.label??!1,keybinding:this.getKeybindingLabel(n)})}),this.updateOverflowClassName(),this.applyResponsiveActionMinWidths(),this.options.responsiveBehavior?.enabled){if(this.hiddenActions.length=0,this.options.responsiveBehavior?.minItems!==void 0){const n=this.options.responsiveBehavior.minItems,s=this.originalPrimaryActions.slice(0,n).reduce((a,c)=>a+this.getActionMinWidth(c),0);let r=0;(this.originalSecondaryActions.length>0||n<this.originalPrimaryActions.length)&&(r=gh+mh),this.container.style.minWidth=`${s+r}px`,this.element.style.minWidth=`${s+r}px`}else{const n=this.originalPrimaryActions.length>0?this.getActionMinWidth(this.originalPrimaryActions[0]):gh+mh;this.container.style.minWidth=`${n}px`,this.element.style.minWidth=`${n}px`}this.updateActions(this.getAvailableWidth())}}getKeybindingLabel(e){return this.options.getKeyBinding?.(e)?.getLabel()??void 0}getConfiguredActionMinWidth(e){return e?.id===_h.ID?gh:this.options.responsiveBehavior?.getActionMinWidth?.(e??this.toggleMenuAction)??this.options.responsiveBehavior?.actionMinWidth??gh}getActionMinWidth(e){return this.getConfiguredActionMinWidth(e)+mh}getAvailableWidth(){return this.options.responsiveBehavior?.getAvailableWidth?this.options.responsiveBehavior.getAvailableWidth():this.element.getBoundingClientRect().width}applyResponsiveActionMinWidths(){if(!this.options.responsiveBehavior?.enabled)return;if(this.options.responsiveBehavior.kind==="last"){const i=this.actionBar.hasAction(this.toggleMenuAction)?this.actionBar.length()-2:this.actionBar.length()-1,n=i>=0?this.actionBar.getAction(i):void 0,s=`${this.getConfiguredActionMinWidth(n)}px`;this.element.style.getPropertyValue(qL)!==s&&this.element.style.setProperty(qL,s);return}const e=this.actionBar.getContainer().firstElementChild;if(Ve(e))for(let t=0;t<e.children.length;t++){const i=e.children.item(t);if(!Ve(i))continue;const n=this.actionBar.getAction(t),s=`${this.getConfiguredActionMinWidth(n)}px`;i.style.minWidth!==s&&(i.style.minWidth=s)}}updateActions(e){if(this.actionBar.isEmpty())return;this.applyResponsiveActionMinWidths();const t=parseInt(this.element.style.minWidth);e=Math.max(e,Number.isNaN(t)?0:t);const i=r=>{if(this.options.responsiveBehavior?.kind==="last"){const a=this.actionBar.hasAction(this.toggleMenuAction),c=a?this.actionBar.length()-1:this.actionBar.length();if(c===0)return a?gh+mh:0;let h=0;for(let u=0;u<c-1;u++)h+=this.actionBar.getWidth(u)+mh;const d=this.actionBar.getAction(c-1);return h+=r?this.actionBar.getWidth(c-1):this.getActionMinWidth(d),h+=a?gh+mh:0,h}else{let a=0;for(let c=0;c<this.actionBar.length();c++)a+=r?this.actionBar.getWidth(c):this.getActionMinWidth(this.actionBar.getAction(c));return a}},n=i(!1);if(n<=e&&this.hiddenActions.length===0)return;if(n>e){if(this.options.responsiveBehavior?.minItems!==void 0&&(this.actionBar.hasAction(this.toggleMenuAction)?this.actionBar.length()-1:this.actionBar.length())<=this.options.responsiveBehavior.minItems)return;for(;i(!1)>e&&this.actionBar.length()>0;){const r=this.originalPrimaryActions.length-this.hiddenActions.length-1;if(r<0)break;const a=this.originalPrimaryActions[r],c=Math.min(this.getActionMinWidth(a),this.getItemWidth(r));this.hiddenActions.unshift({action:a,size:c}),this.actionBar.pull(r),this.originalSecondaryActions.length===0&&this.hiddenActions.length===1&&(this.actionBar.push(this.toggleMenuAction,{icon:this.options.icon??!0,label:this.options.label??!1,keybinding:this.getKeybindingLabel(this.toggleMenuAction)}),this.updateOverflowClassName()),this.applyResponsiveActionMinWidths()}}else for(;this.hiddenActions.length>0;){const r=this.hiddenActions.shift();if(i(!0)+r.size>e){this.hiddenActions.unshift(r);break}this.actionBar.push(r.action,{icon:this.options.icon??!0,label:this.options.label??!1,keybinding:this.getKeybindingLabel(r.action),index:this.originalPrimaryActions.length-this.hiddenActions.length-1}),this.originalSecondaryActions.length===0&&this.hiddenActions.length===0&&(this.toggleMenuAction.menuActions=[],this.actionBar.pull(this.actionBar.length()-1),this.updateOverflowClassName()),this.applyResponsiveActionMinWidths()}const s=this.hiddenActions.map(r=>r.action);if(this.originalSecondaryActions.length>0||s.length>0){const r=this.originalSecondaryActions.slice(0);this.toggleMenuAction.menuActions=ft.join(s,r)}this.updateOverflowClassName(),this.applyResponsiveActionMinWidths()}updateOverflowClassName(){this.actionBar.domNode.classList.toggle("has-overflow",this.actionBar.hasAction(this.toggleMenuAction))}clear(){this.submenuActionViewItems=[],this.disposables.clear(),this.actionBar.clear()}dispose(){this.clear(),this.disposables.dispose(),this.element.remove(),super.dispose()}}const wb=class wb extends oo{constructor(e,t){t=t||l.localize(19,"More Actions..."),super(wb.ID,t,void 0,!0),this._menuActions=[],this.toggleDropdownMenu=e}async run(){this.toggleDropdownMenu()}get menuActions(){return this._menuActions}set menuActions(e){this._menuActions=e}};wb.ID="toolbar.toggle.more";let _h=wb;l.Color.white.toString(),l.Color.white.toString();const sQ=Object.freeze({allowedTags:{override:["b","i","u","code","span"]},allowedAttributes:{override:["class"]}}),oQ=Object.freeze({sanitizerConfig:{allowedAttributes:{override:["class"]}}});class v_ extends l.Disposable{get onDidClick(){return this._onDidClick.event}constructor(e,t){super(),this._label="",this._onDidClick=this._register(new l.Emitter),this._onDidEscape=this._register(new l.Emitter),this.options=t,this._element=document.createElement("a"),this._element.classList.add("monaco-button"),this._element.tabIndex=0,this._element.setAttribute("role","button"),this._element.classList.toggle("secondary",!!t.secondary),this._element.classList.toggle("small",!!t.small);const i=t.secondary?t.buttonSecondaryBackground:t.buttonBackground,n=t.secondary?t.buttonSecondaryForeground:t.buttonForeground,s=t.secondary?t.buttonSecondaryBorder:t.buttonBorder;this._element.style.color=n||"",this._element.style.backgroundColor=i||"",s&&(this._element.style.border=`1px solid ${s}`),t.supportShortLabel&&(this._labelShortElement=document.createElement("div"),this._labelShortElement.classList.add("monaco-button-label-short"),this._element.appendChild(this._labelShortElement),this._labelElement=document.createElement("div"),this._labelElement.classList.add("monaco-button-label"),this._element.appendChild(this._labelElement),this._element.classList.add("monaco-text-button-with-short-label")),typeof t.title=="string"&&this.setTitle(t.title),typeof t.ariaLabel=="string"&&this._element.setAttribute("aria-label",t.ariaLabel),e.appendChild(this._element),this.enabled=!t.disabled,this._register(li.addTarget(this._element)),[F.CLICK,_.EventType$1.Tap].forEach(r=>{this._register(R(this._element,r,a=>{if(!this.enabled){ve.stop(a);return}this._onDidClick.fire(a)}))}),this._register(R(this._element,F.KEY_DOWN,r=>{const a=new Be(r);let c=!1;this.enabled&&(a.equals(3)||a.equals(10))?(this._onDidClick.fire(r),c=!0):a.equals(9)&&(this._onDidEscape.fire(r),this._element.blur(),c=!0),c&&ve.stop(a,!0)})),this._register(R(this._element,F.MOUSE_OVER,r=>{this._element.classList.contains("disabled")||this.updateStyles(!0)})),this._register(R(this._element,F.MOUSE_OUT,r=>{this.updateStyles(!1)})),this.focusTracker=this._register(Xr(this._element)),this._register(this.focusTracker.onDidFocus(()=>{this.enabled&&this.updateStyles(!0)})),this._register(this.focusTracker.onDidBlur(()=>{this.enabled&&this.updateStyles(!1)}))}dispose(){super.dispose(),this._element.remove()}getContentElements(e){const t=[];for(let i of vr(e))if(typeof i=="string"){if(i=i.trim(),i==="")continue;const n=document.createElement("span");n.textContent=i,t.push(n)}else t.push(i);return t}updateStyles(e){let t,i,n;this.options.secondary?(t=e?this.options.buttonSecondaryHoverBackground:this.options.buttonSecondaryBackground,i=this.options.buttonSecondaryForeground,n=this.options.buttonSecondaryBorder):(t=e?this.options.buttonHoverBackground:this.options.buttonBackground,i=this.options.buttonForeground,n=this.options.buttonBorder),this._element.style.backgroundColor=t||"",this._element.style.color=i||"",this._element.style.border=n?`1px solid ${n}`:""}get element(){return this._element}set label(e){if(this._label===e||Do(this._label)&&Do(e)&&dG(this._label,e))return;this._element.classList.add("monaco-text-button");const t=this.options.supportShortLabel?this._labelElement:this._element;if(Do(e)){const n=dp(e,oQ,document.createElement("span"));n.dispose();const s=n.element.querySelector("p")?.innerHTML;s?cR(t,s,sQ):oi(t)}else this.options.supportIcons?oi(t,...this.getContentElements(e)):t.textContent=e;let i="";typeof this.options.title=="string"?i=this.options.title:this.options.title&&(i=Uj(e)),this.setTitle(i),this._setAriaLabel(),this._label=e}get label(){return this._label}_setAriaLabel(){typeof this.options.ariaLabel=="string"?this._element.setAttribute("aria-label",this.options.ariaLabel):typeof this.options.title=="string"&&this._element.setAttribute("aria-label",this.options.title)}set icon(e){this._setAriaLabel();const t=Array.from(this._element.classList).filter(i=>i.startsWith("codicon-"));this._element.classList.remove(...t),this._element.classList.add(..._.ThemeIcon.asClassNameArray(e))}set enabled(e){e?(this._element.classList.remove("disabled"),this._element.setAttribute("aria-disabled",String(!1)),this._element.tabIndex=0):(this._element.classList.add("disabled"),this._element.setAttribute("aria-disabled",String(!0)))}get enabled(){return!this._element.classList.contains("disabled")}set secondary(e){this._element.classList.toggle("secondary",e),this.options.secondary=e,this.updateStyles(!1)}setTitle(e){!this._hover&&e!==""?this._hover=this._register(En().setupManagedHover(this.options.hoverDelegate??Io("element"),this._element,e)):this._hover&&this._hover.update(e)}}class YL extends l.Disposable{constructor(e,t,i){super(),this.options=t,this.styles=i,this.count=0,this.hover=this._register(new l.MutableDisposable),this.element=K(e,Q(".monaco-count-badge")),this._register(l.toDisposable(()=>e.removeChild(this.element))),this.countFormat=this.options.countFormat||"{0}",this.titleFormat=this.options.titleFormat||"",this.setCount(this.options.count||0),this.updateHover()}setCount(e){this.count=e,this.render()}setTitleFormat(e){this.titleFormat=e,this.updateHover(),this.render()}updateHover(){this.titleFormat!==""&&!this.hover.value?this.hover.value=En().setupDelayedHoverAtMouse(this.element,()=>({content:l.format(this.titleFormat,this.count),appearance:{compact:!0}})):this.titleFormat===""&&this.hover.value&&(this.hover.value=void 0)}render(){this.element.textContent=l.format(this.countFormat,this.count),this.element.style.backgroundColor=this.styles.badgeBackground??"",this.element.style.color=this.styles.badgeForeground??"",this.styles.badgeBorder&&(this.element.style.border=`1px solid ${this.styles.badgeBorder}`)}}const $A="done",KA="active",ZL="infinite",QL="infinite-long-running",GA="discrete",rQ=l.localize(16,"Progress"),Sb=class Sb extends l.Disposable{constructor(e,t){super(),this.progressSignal=this._register(new l.MutableDisposable),this.workedVal=0,this.showDelayedScheduler=this._register(new l.RunOnceScheduler(()=>Jf(this.element),0)),this.longRunningScheduler=this._register(new l.RunOnceScheduler(()=>this.infiniteLongRunning(),Sb.LONG_RUNNING_INFINITE_THRESHOLD)),this.create(e,t)}create(e,t){this.element=document.createElement("div"),this.element.classList.add("monaco-progress-container"),this.element.setAttribute("role","progressbar"),this.element.setAttribute("aria-valuemin","0"),this.element.setAttribute("aria-label",t?.ariaLabel&&t.ariaLabel.trim()?t.ariaLabel:rQ),e.appendChild(this.element),this.bit=document.createElement("div"),this.bit.classList.add("progress-bit"),this.bit.style.backgroundColor=t?.progressBarBackground||"#0E70C0",this.element.appendChild(this.bit)}off(){this.bit.style.width="inherit",this.bit.style.opacity="1",this.element.classList.remove(KA,ZL,QL,GA),this.workedVal=0,this.totalWork=void 0,this.longRunningScheduler.cancel(),this.progressSignal.clear()}stop(){return this.doDone(!1)}doDone(e){return this.element.classList.add($A),this.element.classList.contains(ZL)?(this.bit.style.opacity="0",e?setTimeout(()=>this.off(),200):this.off()):(this.bit.style.width="inherit",e?setTimeout(()=>this.off(),200):this.off()),this}infinite(){return this.bit.style.width="2%",this.bit.style.opacity="1",this.element.classList.remove(GA,$A,QL),this.element.classList.add(KA,ZL),this.longRunningScheduler.schedule(),this}infiniteLongRunning(){this.element.classList.add(QL)}getContainer(){return this.element}};Sb.LONG_RUNNING_INFINITE_THRESHOLD=1e4;let XL=Sb;const aQ=Q;class lQ extends l.Disposable{constructor(e,t,i){super(),this.parent=e,this._listFocusMode=!1,this.onDidChange=n=>this.findInput.onDidChange(n),this.container=K(this.parent,aQ(".quick-input-box")),this.findInput=this._register(new GM(this.container,void 0,{label:"",inputBoxStyles:t,toggleStyles:i,actionViewItemProvider:rh(i),hideHoverOnValueChange:!0}))}get onKeyDown(){return this.findInput.onKeyDown}get value(){return this.findInput.getValue()}set value(e){this.findInput.setValue(e)}select(e=null){this.findInput.inputBox.select(e)}getSelection(){return this.findInput.inputBox.getSelection()}isSelectionAtEnd(){return this.findInput.inputBox.isSelectionAtEnd()}get placeholder(){return this.findInput.inputBox.inputElement.getAttribute("placeholder")||""}set placeholder(e){this.findInput.inputBox.setPlaceHolder(e)}get password(){return this.findInput.inputBox.inputElement.type==="password"}set password(e){this.findInput.inputBox.inputElement.type=e?"password":"text"}set enabled(e){this.findInput.inputBox.inputElement.toggleAttribute("readonly",!e)}set toggles(e){this.findInput.setAdditionalToggles(e)}set actions(e){this.setActions(e)}setActions(e,t){this.findInput.setActions(e,t)}get ariaLabel(){return this.findInput.inputBox.inputElement.getAttribute("aria-label")||""}set ariaLabel(e){this.findInput.inputBox.inputElement.setAttribute("aria-label",e)}hasFocus(){return this.findInput.inputBox.hasFocus()}setAttribute(e,t){this.findInput.inputBox.inputElement.setAttribute(e,t)}removeAttribute(e){this.findInput.inputBox.inputElement.removeAttribute(e)}setListFocusMode(e){if(this._listFocusMode===e)return;this._listFocusMode=e;const t=this.findInput.inputBox.inputElement;e?(t.setAttribute("aria-haspopup","listbox"),t.setAttribute("aria-autocomplete","list")):(t.removeAttribute("aria-haspopup"),t.removeAttribute("aria-autocomplete"))}showDecoration(e){e===rt.Ignore?this.findInput.clearMessage():this.findInput.showMessage({type:e===rt.Info?1:e===rt.Warning?2:3,content:""})}stylesForType(e){return this.findInput.inputBox.stylesForType(e===rt.Info?1:e===rt.Warning?2:3)}setFocus(){this.findInput.focus()}layout(){this.findInput.inputBox.layout()}}class Ir extends l.Disposable{constructor(e,t){super(),this.options=t,this.text="",this.title="",this.highlights=[],this.didEverRender=!1,this.domNode=K(e,Q("span.monaco-highlighted-label"))}get element(){return this.domNode}set(e,t=[],i="",n,s){e||(e=""),n&&(e=Ir.escapeNewLines(e,t)),!(this.didEverRender&&this.text===e&&this.title===i&&l.equals$1(this.highlights,t))&&(this.text=e,this.title=i,this.highlights=t,this.render(s))}render(e){const t=[];let i=0;for(const n of this.highlights){if(n.end===n.start)continue;if(i<n.start){const a=this.text.substring(i,n.start);e?t.push(...vr(a,!0)):t.push(a),i=n.start}const s=this.text.substring(i,n.end),r=Q("span.highlight",void 0,...e?vr(s,!0):[s]);n.extraClasses&&r.classList.add(...n.extraClasses),t.push(r),i=n.end}if(i<this.text.length){const n=this.text.substring(i);e?t.push(...vr(n,!0)):t.push(n)}if(oi(this.domNode,...t),!this.customHover&&this.title!==""){const n=this.options?.hoverDelegate??Io("mouse");this.customHover=this._register(En().setupManagedHover(n,this.domNode,this.title))}else this.customHover&&this.customHover.update(this.title);this.didEverRender=!0}static escapeNewLines(e,t){let i=0,n=0;return e.replace(/\r\n|\r|\n/g,(s,r)=>{n=s===`\r
|
||
`?-1:0,r+=i;for(const a of t)a.end<=r||(a.start>=r&&(a.start+=n),a.end>=r&&(a.end+=n));return i+=n,"⏎"})}}class nf{constructor(e){this._element=e}get element(){return this._element}set textContent(e){this.disposed||e===this._textContent||(this._textContent=e,this._element.textContent=e)}set classNames(e){this.disposed||l.equals$1(e,this._classNames)||(this._classNames=e,this._element.classList.value="",this._element.classList.add(...e))}set empty(e){this.disposed||e===this._empty||(this._empty=e,this._element.style.marginLeft=e?"0":"")}dispose(){this.disposed=!0}}class w_ extends l.Disposable{constructor(e,t){super(),this.customHovers=new Map,this.creationOptions=t,this.domNode=this._register(new nf(K(e,Q(".monaco-icon-label")))),this.labelContainer=K(this.domNode.element,Q(".monaco-icon-label-container")),this.nameContainer=K(this.labelContainer,Q("span.monaco-icon-name-container")),t?.supportHighlights||t?.supportIcons?this.nameNode=this._register(new dQ(this.nameContainer,!!t.supportIcons)):this.nameNode=new cQ(this.nameContainer),this.hoverDelegate=t?.hoverDelegate??Io("mouse")}get element(){return this.domNode.element}setLabel(e,t,i){const n=["monaco-icon-label"],s=["monaco-icon-label-container"];let r="";i&&(i.extraClasses&&n.push(...i.extraClasses),i.bold&&n.push("bold"),i.italic&&n.push("italic"),i.strikethrough&&n.push("strikethrough"),i.disabledCommand&&s.push("disabled"),i.title&&(typeof i.title=="string"?r+=i.title:r+=e));const a=this.domNode.element.querySelector(".monaco-icon-label-iconpath");if(i?.iconPath){let c;if(!a||!Ve(a)?(c=Q(".monaco-icon-label-iconpath"),this.domNode.element.prepend(c)):c=a,_.ThemeIcon.isThemeIcon(i.iconPath)){const h=_.ThemeIcon.asClassName(i.iconPath);c.className=`monaco-icon-label-iconpath ${h}`,c.style.backgroundImage=""}else c.style.backgroundImage=Bs(i?.iconPath);c.style.backgroundRepeat="no-repeat",c.style.backgroundPosition="center",c.style.backgroundSize="contain"}else a&&a.remove();if(this.domNode.classNames=n,this.domNode.element.setAttribute("aria-label",r),this.labelContainer.classList.value="",this.labelContainer.classList.add(...s),this.setupHover(i?.descriptionTitle?this.labelContainer:this.element,i?.title),this.nameNode.setLabel(e,i),t||this.descriptionNode){const c=this.getOrCreateDescriptionNode();if(c instanceof Ir){const h=i?.supportIcons??this.creationOptions?.supportIcons;c.set(t||"",i?i.descriptionMatches:void 0,void 0,i?.labelEscapeNewLines,h),this.setupHover(c.element,i?.descriptionTitle)}else c.textContent=t&&i?.labelEscapeNewLines?Ir.escapeNewLines(t,[]):t||"",this.setupHover(c.element,i?.descriptionTitle||""),c.empty=!t}if(i?.suffix||this.suffixNode){const c=this.getOrCreateSuffixNode();c.textContent=i?.suffix??""}}setupHover(e,t){const i=this.customHovers.get(e);if(i&&(i.dispose(),this.customHovers.delete(e)),!t){e.removeAttribute("title");return}let n=e;if(this.creationOptions?.hoverTargetOverride){if(!ut(e,this.creationOptions.hoverTargetOverride))throw new Error("hoverTargetOverrride must be an ancestor of the htmlElement");n=this.creationOptions.hoverTargetOverride}const s=En().setupManagedHover(this.hoverDelegate,n,t);s&&this.customHovers.set(e,s)}dispose(){super.dispose();for(const e of this.customHovers.values())e.dispose();this.customHovers.clear()}getOrCreateSuffixNode(){if(!this.suffixNode){const e=this._register(new nf(IF(this.nameContainer,Q("span.monaco-icon-suffix-container"))));this.suffixNode=this._register(new nf(K(e.element,Q("span.label-suffix"))))}return this.suffixNode}getOrCreateDescriptionNode(){if(!this.descriptionNode){const e=this._register(new nf(K(this.labelContainer,Q("span.monaco-icon-description-container"))));this.creationOptions?.supportDescriptionHighlights?this.descriptionNode=this._register(new Ir(K(e.element,Q("span.label-description")))):this.descriptionNode=this._register(new nf(K(e.element,Q("span.label-description"))))}return this.descriptionNode}}class cQ{constructor(e){this.container=e,this.label=void 0,this.singleLabel=void 0}setLabel(e,t){if(!(this.label===e&&l.equals$1(this.options,t)))if(this.label=e,this.options=t,typeof e=="string")this.singleLabel||(this.container.textContent="",this.container.classList.remove("multiple"),this.singleLabel=K(this.container,Q("a.label-name",{id:t?.domId}))),this.singleLabel.textContent=e;else{this.container.textContent="",this.container.classList.add("multiple"),this.singleLabel=void 0;for(let i=0;i<e.length;i++){const n=e[i],s=t?.domId&&`${t?.domId}_${i}`;K(this.container,Q("a.label-name",{id:s,"data-icon-label-count":e.length,"data-icon-label-index":i,role:"treeitem"},n)),i<e.length-1&&K(this.container,Q("span.label-separator",void 0,t?.separator||"/"))}}}}function hQ(o,e,t){if(!t)return;let i=0;return o.map(n=>{const s={start:i,end:i+n.length},r=t.map(a=>ii.intersect(s,a)).filter(a=>!ii.isEmpty(a)).map(({start:a,end:c})=>({start:a-i,end:c-i}));return i=s.end+e.length,r})}class dQ extends l.Disposable{constructor(e,t){super(),this.container=e,this.supportIcons=t,this.label=void 0,this.singleLabel=void 0,this._labelDisposables=this._register(new l.DisposableStore)}setLabel(e,t){if(this.label===e&&l.equals$1(this.options,t))return;this.label=e,this.options=t;const i=t?.supportIcons??this.supportIcons;if(typeof e=="string")this.singleLabel||(this._labelDisposables.clear(),this.container.textContent="",this.container.classList.remove("multiple"),this.singleLabel=this._labelDisposables.add(new Ir(K(this.container,Q("a.label-name",{id:t?.domId}))))),this.singleLabel.set(e,t?.matches,void 0,t?.labelEscapeNewLines,i);else{this._labelDisposables.clear(),this.container.textContent="",this.container.classList.add("multiple"),this.singleLabel=void 0;const n=t?.separator||"/",s=hQ(e,n,t?.matches);for(let r=0;r<e.length;r++){const a=e[r],c=s?s[r]:void 0,h=t?.domId&&`${t?.domId}_${r}`,d=Q("a.label-name",{id:h,"data-icon-label-count":e.length,"data-icon-label-index":r,role:"treeitem"});this._labelDisposables.add(new Ir(K(this.container,d))).set(a,c,void 0,t?.labelEscapeNewLines,i),r<e.length-1&&K(d,Q("span.label-separator",void 0,n))}}}}const S_=Q,uQ={keybindingLabelBackground:void 0,keybindingLabelForeground:void 0,keybindingLabelBorder:void 0,keybindingLabelBottomBorder:void 0,keybindingLabelShadow:void 0};class y_ extends l.Disposable{constructor(e,t,i){super(),this.os=t,this.keyElements=new Set,this.options=i||Object.create(null);const n=this.options.keybindingLabelForeground;this.domNode=K(e,S_(".monaco-keybinding")),n&&(this.domNode.style.color=n),this.hover=this._register(En().setupManagedHover(Io("mouse"),this.domNode,"")),this.didEverRender=!1,e.appendChild(this.domNode)}set(e,t){this.didEverRender&&this.keybinding===e&&y_.areSame(this.matches,t)||(this.keybinding=e,this.matches=t,this.render())}render(){if(this.clear(),this.keybinding){const e=this.keybinding.getChords();e[0]&&this.renderChord(this.domNode,e[0],this.matches?this.matches.firstPart:null);for(let i=1;i<e.length;i++)K(this.domNode,S_("span.monaco-keybinding-key-chord-separator",void 0," ")),this.renderChord(this.domNode,e[i],this.matches?this.matches.chordPart:null);const t=this.options.disableTitle??!1?void 0:this.keybinding.getAriaLabel()||void 0;this.hover.update(t),this.domNode.setAttribute("aria-label",t||"")}else this.options&&this.options.renderUnboundKeybindings&&this.renderUnbound(this.domNode);this.didEverRender=!0}clear(){On(this.domNode),this.keyElements.clear()}renderChord(e,t,i){const n=ky.modifierLabels[this.os];t.ctrlKey&&this.renderKey(e,n.ctrlKey,!!i?.ctrlKey,n.separator),t.shiftKey&&this.renderKey(e,n.shiftKey,!!i?.shiftKey,n.separator),t.altKey&&this.renderKey(e,n.altKey,!!i?.altKey,n.separator),t.metaKey&&this.renderKey(e,n.metaKey,!!i?.metaKey,n.separator);const s=t.keyLabel;s&&this.renderKey(e,s,!!i?.keyCode,"")}renderKey(e,t,i,n){K(e,this.createKeyElement(t,i?".highlight":"")),n&&K(e,S_("span.monaco-keybinding-key-separator",void 0,n))}renderUnbound(e){K(e,this.createKeyElement(l.localize(15,"Unbound")))}createKeyElement(e,t=""){const i=S_("span.monaco-keybinding-key"+t,void 0,e);return this.keyElements.add(i),this.options.keybindingLabelBackground&&(i.style.backgroundColor=this.options.keybindingLabelBackground),this.options.keybindingLabelBorder&&(i.style.borderColor=this.options.keybindingLabelBorder),this.options.keybindingLabelBottomBorder&&(i.style.borderBottomColor=this.options.keybindingLabelBottomBorder),this.options.keybindingLabelShadow&&(i.style.boxShadow=`inset 0 -1px 0 ${this.options.keybindingLabelShadow}`),i}static areSame(e,t){return e===t||!e&&!t?!0:!!e&&!!t&&l.equals$1(e.firstPart,t.firstPart)&&l.equals$1(e.chordPart,t.chordPart)}}const jA=new l.Lazy(()=>{const o=l.safeIntl.Collator(void 0,{numeric:!0,sensitivity:"base"}).value;return{collator:o,collatorIsNumeric:o.resolvedOptions().numeric}});new l.Lazy(()=>({collator:l.safeIntl.Collator(void 0,{numeric:!0}).value})),new l.Lazy(()=>({collator:l.safeIntl.Collator(void 0,{numeric:!0,sensitivity:"accent"}).value}));function fQ(o,e,t=!1){const i=o||"",n=e||"",s=jA.value.collator.compare(i,n);return jA.value.collatorIsNumeric&&s===0&&i!==n?i<n?-1:1:s}function gQ(o,e,t){const i=o.toLowerCase(),n=e.toLowerCase(),s=mQ(o,e,t);if(s)return s;const r=i.endsWith(t),a=n.endsWith(t);if(r!==a)return r?-1:1;const c=fQ(i,n);return c!==0?c:i.localeCompare(n)}function mQ(o,e,t){const i=o.toLowerCase(),n=e.toLowerCase(),s=i.startsWith(t),r=n.startsWith(t);if(s!==r)return s?-1:1;if(s&&r){if(i.length<n.length)return-1;if(i.length>n.length)return 1}return 0}var sf=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},of=function(o,e){return function(t,i){e(t,i,o)}},JL,WL;const Gs=Q;class qA{constructor(e,t,i){this.index=e,this.hasCheckbox=t,this._hidden=!1,this._init=new l.Lazy(()=>{const n=i.label??"",s=Ka(n).text.trim(),r=i.ariaLabel||[n,this.saneDescription,this.saneDetail].map(a=>yS(a)).filter(a=>!!a).join(", ");return{saneLabel:n,saneSortLabel:s,saneAriaLabel:r}}),this._saneDescription=i.description,this._saneTooltip=i.tooltip}get saneLabel(){return this._init.value.saneLabel}get saneSortLabel(){return this._init.value.saneSortLabel}get saneAriaLabel(){return this._init.value.saneAriaLabel}get element(){return this._element}set element(e){this._element=e}get hidden(){return this._hidden}set hidden(e){this._hidden=e}get saneDescription(){return this._saneDescription}set saneDescription(e){this._saneDescription=e}get saneDetail(){return this._saneDetail}set saneDetail(e){this._saneDetail=e}get saneTooltip(){return this._saneTooltip}set saneTooltip(e){this._saneTooltip=e}get labelHighlights(){return this._labelHighlights}set labelHighlights(e){this._labelHighlights=e}get descriptionHighlights(){return this._descriptionHighlights}set descriptionHighlights(e){this._descriptionHighlights=e}get detailHighlights(){return this._detailHighlights}set detailHighlights(e){this._detailHighlights=e}}class Zt extends qA{constructor(e,t,i,n,s,r,a){super(e,i,r),this.childIndex=t,this.fireButtonTriggered=n,this._onChecked=s,this.item=r,this._separator=a,this._checked=!1,this.onChecked=i?l.Event.map(l.Event.filter(this._onChecked.event,c=>c.element===this),c=>c.checked):l.Event.None,this._saneDetail=r.detail,this._labelHighlights=r.highlights?.label,this._descriptionHighlights=r.highlights?.description,this._detailHighlights=r.highlights?.detail}get separator(){return this._separator}set separator(e){this._separator=e}get checked(){return this._checked}set checked(e){e!==this._checked&&(this._checked=e,this._onChecked.fire({element:this,checked:e}))}get checkboxDisabled(){return!!this.item.disabled}}var js;(function(o){o[o.NONE=0]="NONE",o[o.MOUSE_HOVER=1]="MOUSE_HOVER",o[o.ACTIVE_ITEM=2]="ACTIVE_ITEM"})(js||(js={}));class hl extends qA{constructor(e,t,i){super(e,!1,i),this.fireSeparatorButtonTriggered=t,this.separator=i,this.children=new Array,this.focusInsideSeparator=js.NONE}}class pQ{getHeight(e){return e instanceof hl?30:e.saneDetail?44:22}getTemplateId(e){return e instanceof Zt?L_.ID:D_.ID}}class _Q{getWidgetAriaLabel(){return l.localize(1834,"Quick Input")}getAriaLabel(e){return e.separator?.label?`${e.saneAriaLabel}, ${e.separator.label}`:e.saneAriaLabel}getWidgetRole(){return"listbox"}getRole(e){return e.hasCheckbox?"checkbox":"option"}isChecked(e){if(!(!e.hasCheckbox||!(e instanceof Zt)))return{get value(){return e.checked},onDidChange:t=>e.onChecked(()=>t())}}}class YA extends l.Disposable{constructor(e,t,i){super(),this.hoverDelegate=e,this.toggleStyles=t,this.contextMenuService=i,this._onDidDisposeFocusedElement=this._register(new l.Emitter),this.onDidDisposeFocusedElement=this._onDidDisposeFocusedElement.event}renderTemplate(e){const t=Object.create(null);t.toDisposeElement=new l.DisposableStore,t.toDisposeTemplate=new l.DisposableStore,t.entry=K(e,Gs(".quick-input-list-entry"));const i=K(t.entry,Gs("label.quick-input-list-label"));t.outerLabel=i,t.checkbox=t.toDisposeTemplate.add(new l.MutableDisposable),t.toDisposeTemplate.add(At(i,F.CLICK,h=>{if(t.checkbox.value&&!h.defaultPrevented&&t.checkbox.value.enabled){const d=!t.checkbox.value.checked;t.checkbox.value.checked=d,t.element.checked=d}}));const n=K(i,Gs(".quick-input-list-rows")),s=K(n,Gs(".quick-input-list-row")),r=K(n,Gs(".quick-input-list-row"));t.label=new w_(s,{supportHighlights:!0,supportDescriptionHighlights:!0,supportIcons:!0,hoverDelegate:this.hoverDelegate}),t.toDisposeTemplate.add(t.label),t.icon=Xf(t.label.element,Gs(".quick-input-list-icon"));const a=K(s,Gs(".quick-input-list-entry-keybinding"));t.keybinding=new y_(a,l.OS),t.toDisposeTemplate.add(t.keybinding);const c=K(r,Gs(".quick-input-list-label-meta"));return t.detail=new w_(c,{supportHighlights:!0,supportIcons:!0,hoverDelegate:this.hoverDelegate}),t.toDisposeTemplate.add(t.detail),t.separator=K(t.entry,Gs(".quick-input-list-separator")),t.toolBar=new ph(t.entry,this.contextMenuService,{...this.hoverDelegate?{hoverDelegate:this.hoverDelegate}:void 0,actionViewItemProvider:rh(this.toggleStyles),icon:!0,label:!1}),t.toolBar.getElement().classList.add("quick-input-list-entry-action-bar"),t.toDisposeTemplate.add(t.toolBar),t}disposeTemplate(e){e.toDisposeElement.dispose(),e.toDisposeTemplate.dispose()}disposeElement(e,t,i){Zf(i.entry)&&this._onDidDisposeFocusedElement.fire(),i.toDisposeElement.clear(),i.toolBar.setActions([])}}let L_=(Tl=class extends YA{constructor(e,t,i,n){super(e,t,i),this.themeService=n,this._itemsWithSeparatorsFrequency=new Map}get templateId(){return JL.ID}ensureCheckbox(e,t){if(!e.hasCheckbox){t.checkbox.value?.domNode.remove(),t.checkbox.clear();return}let i=t.checkbox.value;i?i.setTitle(e.saneLabel):(i=new tL(e.saneLabel,e.checked,{...By,size:15}),t.checkbox.value=i,t.outerLabel.prepend(i.domNode),i.domNode.tabIndex=-1),e.checkboxDisabled?i.disable():i.enable(),i.checked=e.checked,t.toDisposeElement.add(e.onChecked(n=>i.checked=n)),t.toDisposeElement.add(i.onChange(()=>e.checked=i.checked))}renderElement(e,t,i){const n=e.element;i.element=n,n.element=i.entry??void 0;const s=n.item;n.element.classList.toggle("not-pickable",n.item.pickable===!1),this.ensureCheckbox(n,i);const{labelHighlights:r,descriptionHighlights:a,detailHighlights:c}=n;if(s.iconPath){const f=rr(this.themeService.getColorTheme().type)?s.iconPath.dark:s.iconPath.light??s.iconPath.dark,g=l.URI.revive(f);i.icon.className="quick-input-list-icon",i.icon.style.backgroundImage=Bs(g)}else i.icon.style.backgroundImage="",i.icon.className=s.iconClass?`quick-input-list-icon ${s.iconClass}`:"";let h;!n.saneTooltip&&n.saneDescription&&(h={markdown:{value:l.escape(n.saneDescription),supportThemeIcons:!0},markdownNotSupportedFallback:n.saneDescription});const d={matches:r||[],descriptionTitle:h,descriptionMatches:a||[],labelEscapeNewLines:!0};if(d.extraClasses=s.iconClasses,d.italic=s.italic,d.strikethrough=s.strikethrough,i.entry.classList.remove("quick-input-list-separator-as-item"),i.label.setLabel(n.saneLabel,n.saneDescription,d),i.keybinding.set(s.keybinding),n.saneDetail){let f;n.saneTooltip||(f={markdown:{value:l.escape(n.saneDetail),supportThemeIcons:!0},markdownNotSupportedFallback:n.saneDetail}),i.detail.element.style.display="",i.detail.setLabel(n.saneDetail,void 0,{matches:c,title:f,labelEscapeNewLines:!0})}else i.detail.element.style.display="none";n.separator?.label?(i.separator.textContent=n.separator.label,i.separator.style.display="",this.addItemWithSeparator(n)):i.separator.style.display="none",i.entry.classList.toggle("quick-input-list-separator-border",!!n.separator&&n.childIndex!==0);const u=s.buttons;if(u&&u.length){const{primary:f,secondary:g}=dh(u,"quick-input-item",m=>n.fireButtonTriggered({button:m,item:n.item}));i.toolBar.setActions(f,g),i.entry.classList.add("has-actions")}else i.toolBar.setActions([]),i.entry.classList.remove("has-actions")}disposeElement(e,t,i){this.removeItemWithSeparator(e.element),super.disposeElement(e,t,i)}isItemWithSeparatorVisible(e){return this._itemsWithSeparatorsFrequency.has(e)}addItemWithSeparator(e){this._itemsWithSeparatorsFrequency.set(e,(this._itemsWithSeparatorsFrequency.get(e)||0)+1)}removeItemWithSeparator(e){const t=this._itemsWithSeparatorsFrequency.get(e)||0;t>1?this._itemsWithSeparatorsFrequency.set(e,t-1):this._itemsWithSeparatorsFrequency.delete(e)}},JL=Tl,Tl.ID="quickpickitem",Tl);L_=JL=sf([of(2,nn),of(3,_i)],L_);let D_=(Nl=class extends YA{constructor(e,t,i){super(e,t,i),this._visibleSeparatorsFrequency=new Map}get templateId(){return WL.ID}get visibleSeparators(){return[...this._visibleSeparatorsFrequency.keys()]}isSeparatorVisible(e){return this._visibleSeparatorsFrequency.has(e)}renderElement(e,t,i){const n=e.element;i.element=n,n.element=i.entry??void 0,n.element.classList.toggle("focus-inside",!!n.focusInsideSeparator);const s=n.separator,{labelHighlights:r,descriptionHighlights:a}=n;i.icon.style.backgroundImage="",i.icon.className="";let c;!n.saneTooltip&&n.saneDescription&&(c={markdown:{value:l.escape(n.saneDescription),supportThemeIcons:!0},markdownNotSupportedFallback:n.saneDescription});const h={matches:r||[],descriptionTitle:c,descriptionMatches:a||[],labelEscapeNewLines:!0};i.entry.classList.add("quick-input-list-separator-as-item"),i.label.setLabel(n.saneLabel,n.saneDescription,h),i.separator.style.display="none",i.entry.classList.add("quick-input-list-separator-border");const d=s.buttons;if(d&&d.length){const{primary:u,secondary:f}=dh(d,"quick-input-separator",g=>n.fireSeparatorButtonTriggered({button:g,separator:n.separator}));i.toolBar.setActions(u,f),i.entry.classList.add("has-actions")}else i.toolBar.setActions([]),i.entry.classList.remove("has-actions");this.addSeparator(n)}disposeElement(e,t,i){this.removeSeparator(e.element),this.isSeparatorVisible(e.element)||e.element.element?.classList.remove("focus-inside"),super.disposeElement(e,t,i)}addSeparator(e){this._visibleSeparatorsFrequency.set(e,(this._visibleSeparatorsFrequency.get(e)||0)+1)}removeSeparator(e){const t=this._visibleSeparatorsFrequency.get(e)||0;t>1?this._visibleSeparatorsFrequency.set(e,t-1):this._visibleSeparatorsFrequency.delete(e)}},WL=Nl,Nl.ID="quickpickseparator",Nl);D_=WL=sf([of(2,nn)],D_);let rf=class extends l.Disposable{constructor(e,t,i,n,s,r,a){super(),this.parent=e,this.hoverDelegate=t,this.linkOpenerDelegate=i,this.styles=s,this.accessibilityService=a,this._onLeave=this._register(new l.Emitter),this.onLeave=this._onLeave.event,this._visibleCountObservable=W("VisibleCount",0),this.onChangedVisibleCount=l.Event.fromObservable(this._visibleCountObservable,this._store),this._allVisibleCheckedObservable=W("AllVisibleChecked",!1),this.onChangedAllVisibleChecked=l.Event.fromObservable(this._allVisibleCheckedObservable,this._store),this._checkedCountObservable=W("CheckedCount",0),this.onChangedCheckedCount=l.Event.fromObservable(this._checkedCountObservable,this._store),this._checkedElementsObservable=Wh({equalsFn:l.equals},new Array),this.onChangedCheckedElements=l.Event.fromObservable(this._checkedElementsObservable,this._store),this._onButtonTriggered=this._register(new l.Emitter),this.onButtonTriggered=this._onButtonTriggered.event,this._onSeparatorButtonTriggered=this._register(new l.Emitter),this.onSeparatorButtonTriggered=this._onSeparatorButtonTriggered.event,this._elementChecked=this._register(new l.Emitter),this._elementCheckedEventBufferer=new l.EventBufferer,this._hasCheckboxes=!1,this._inputElements=new Array,this._elementTree=new Array,this._itemElements=new Array,this._elementDisposable=this._register(new l.DisposableStore),this._matchOnDescription=!1,this._matchOnDetail=!1,this._matchOnLabel=!0,this._matchOnLabelMode="fuzzy",this._sortByLabel=!0,this._shouldLoop=!0,this._container=K(this.parent,Gs(".quick-input-list")),this._separatorRenderer=this._register(r.createInstance(D_,t,this.styles.toggle)),this._itemRenderer=this._register(r.createInstance(L_,t,this.styles.toggle)),this._tree=this._register(r.createInstance(h_,"QuickInput",this._container,new pQ,[this._itemRenderer,this._separatorRenderer],{filter:{filter(c){return c.hidden?0:c instanceof hl?2:1}},sorter:{compare:(c,h)=>{if(!this.sortByLabel||!this._lastQueryString)return 0;const d=this._lastQueryString.toLowerCase();return CQ(c,h,d)}},accessibilityProvider:new _Q,setRowLineHeight:!1,multipleSelectionSupport:!1,hideTwistiesOfChildlessElements:!0,renderIndentGuides:sl.None,findWidgetEnabled:!1,indent:0,horizontalScrolling:!1,allowNonCollapsibleParents:!0,alwaysConsumeMouseWheel:!0})),this._tree.getHTMLElement().id=n,this._register(this._itemRenderer.onDidDisposeFocusedElement(()=>this._tree.domFocus())),this._register(this._separatorRenderer.onDidDisposeFocusedElement(()=>this._tree.domFocus())),this._registerListeners()}get onDidChangeFocus(){return l.Event.map(this._tree.onDidChangeFocus,e=>e.elements.filter(t=>t instanceof Zt).map(t=>t.item),this._store)}get onDidChangeSelection(){return l.Event.map(this._tree.onDidChangeSelection,e=>({items:e.elements.filter(t=>t instanceof Zt).map(t=>t.item),event:e.browserEvent}),this._store)}get displayed(){return this._container.style.display!=="none"}set displayed(e){this._container.style.display=e?"":"none"}get scrollTop(){return this._tree.scrollTop}set scrollTop(e){this._tree.scrollTop=e}get ariaLabel(){return this._tree.ariaLabel}set ariaLabel(e){this._tree.ariaLabel=e??""}set enabled(e){this._tree.getHTMLElement().style.pointerEvents=e?"":"none"}get matchOnDescription(){return this._matchOnDescription}set matchOnDescription(e){this._matchOnDescription=e}get matchOnDetail(){return this._matchOnDetail}set matchOnDetail(e){this._matchOnDetail=e}get matchOnLabel(){return this._matchOnLabel}set matchOnLabel(e){this._matchOnLabel=e}get matchOnLabelMode(){return this._matchOnLabelMode}set matchOnLabelMode(e){this._matchOnLabelMode=e}get sortByLabel(){return this._sortByLabel}set sortByLabel(e){this._sortByLabel=e}get shouldLoop(){return this._shouldLoop}set shouldLoop(e){this._shouldLoop=e}_registerListeners(){this._registerOnContainerClick(),this._registerOnMouseMiddleClick(),this._registerOnTreeModelChanged(),this._registerOnElementChecked(),this._registerOnContextMenu(),this._registerHoverListeners(),this._registerSelectionChangeListener(),this._registerSeparatorActionShowingListeners()}_registerOnContainerClick(){this._register(R(this._container,F.CLICK,e=>{(e.x||e.y)&&this._onLeave.fire()}))}_registerOnMouseMiddleClick(){this._register(R(this._container,F.AUXCLICK,e=>{e.button===1&&this._onLeave.fire()}))}_registerOnTreeModelChanged(){this._register(this._tree.onDidChangeModel(()=>{const e=this._itemElements.filter(t=>!t.hidden).length;this._visibleCountObservable.set(e,void 0),this._hasCheckboxes&&this._updateCheckedObservables()}))}_registerOnElementChecked(){this._register(this._elementCheckedEventBufferer.wrapEvent(this._elementChecked.event,(e,t)=>t)(e=>this._updateCheckedObservables()))}_registerOnContextMenu(){this._register(this._tree.onContextMenu(e=>{e.element&&(e.browserEvent.preventDefault(),this._tree.setSelection([e.element]))}))}_registerHoverListeners(){const e=this._register(new l.ThrottledDelayer(typeof this.hoverDelegate.delay=="function"?this.hoverDelegate.delay():this.hoverDelegate.delay));this._register(this._tree.onMouseOver(async t=>{if(cx(t.browserEvent.target)){e.cancel();return}if(!(!cx(t.browserEvent.relatedTarget)&&ut(t.browserEvent.relatedTarget,t.element?.element)))try{await e.trigger(async()=>{t.element instanceof Zt&&this.showHover(t.element)})}catch(i){if(!l.isCancellationError(i))throw i}})),this._register(this._tree.onMouseOut(t=>{ut(t.browserEvent.relatedTarget,t.element?.element)||e.cancel()}))}_registerSeparatorActionShowingListeners(){this._register(this._tree.onDidChangeFocus(e=>{const t=e.elements[0]?this._tree.getParentElement(e.elements[0]):null;for(const i of this._separatorRenderer.visibleSeparators){const n=i===t;!!(i.focusInsideSeparator&js.ACTIVE_ITEM)!==n&&(n?i.focusInsideSeparator|=js.ACTIVE_ITEM:i.focusInsideSeparator&=~js.ACTIVE_ITEM,this._tree.rerender(i))}})),this._register(this._tree.onMouseOver(e=>{const t=e.element?this._tree.getParentElement(e.element):null;for(const i of this._separatorRenderer.visibleSeparators){if(i!==t)continue;i.focusInsideSeparator&js.MOUSE_HOVER||(i.focusInsideSeparator|=js.MOUSE_HOVER,this._tree.rerender(i))}})),this._register(this._tree.onMouseOut(e=>{const t=e.element?this._tree.getParentElement(e.element):null;for(const i of this._separatorRenderer.visibleSeparators){if(i!==t)continue;i.focusInsideSeparator&js.MOUSE_HOVER&&(i.focusInsideSeparator&=~js.MOUSE_HOVER,this._tree.rerender(i))}}))}_registerSelectionChangeListener(){this._register(this._tree.onDidChangeSelection(e=>{const t=e.elements.filter(i=>i instanceof Zt);t.length!==e.elements.length&&(e.elements.length===1&&e.elements[0]instanceof hl&&(this._tree.setFocus([e.elements[0].children[0]]),this._tree.reveal(e.elements[0],0)),this._tree.setSelection(t))}))}setAllVisibleChecked(e){this._elementCheckedEventBufferer.bufferEvents(()=>{this._itemElements.forEach(t=>{!t.hidden&&!t.checkboxDisabled&&t.item.pickable!==!1&&(t.checked=e)})})}setElements(e){this._elementDisposable.clear(),this._lastQueryString=void 0,this._inputElements=e,this._hasCheckboxes=this.parent.classList.contains("show-checkboxes");let t;this._itemElements=new Array,this._elementTree=e.reduce((i,n,s)=>{let r;if(n.type==="separator"){if(!n.buttons)return i;t=new hl(s,a=>this._onSeparatorButtonTriggered.fire(a),n),r=t}else{const a=s>0?e[s-1]:void 0;let c;a&&a.type==="separator"&&!a.buttons&&(c=a);const h=new Zt(s,t?.children?t.children.length:s,this._hasCheckboxes&&n.pickable!==!1,d=>this._onButtonTriggered.fire(d),this._elementChecked,n,c);if(this._itemElements.push(h),t)return t.children.push(h),i;r=h}return i.push(r),i},new Array),this._setElementsToTree(this._elementTree),this.accessibilityService.isScreenReaderOptimized()&&l.disposableTimeout(()=>{const i=this._tree.getHTMLElement().querySelector(".monaco-list-row.focused"),n=i?.parentNode;if(i&&n){const s=i.nextSibling;i.remove(),n.insertBefore(i,s)}},0,this._elementDisposable)}setFocusedElements(e){const t=e.map(i=>this._itemElements.find(n=>n.item===i)).filter(i=>!!i).filter(i=>!i.hidden);if(this._tree.setFocus(t),e.length>0){const i=this._tree.getFocus()[0];i&&this._tree.reveal(i)}}getActiveDescendant(){return this._tree.getHTMLElement().getAttribute("aria-activedescendant")}setSelectedElements(e){const t=e.map(i=>this._itemElements.find(n=>n.item===i)).filter(i=>!!i);this._tree.setSelection(t)}getCheckedElements(){return this._itemElements.filter(e=>e.checked).map(e=>e.item)}setCheckedElements(e){this._elementCheckedEventBufferer.bufferEvents(()=>{const t=new Set;for(const i of e)t.add(i);for(const i of this._itemElements)i.checked=t.has(i.item)})}focus(e){if(this._itemElements.length)switch(e===xe.Second&&this._itemElements.length<2&&(e=xe.First),e){case xe.First:this._tree.scrollTop=0,this._tree.focusFirst(void 0,t=>t.element instanceof Zt);break;case xe.Second:{this._tree.scrollTop=0;let t=!1;this._tree.focusFirst(void 0,i=>i.element instanceof Zt?t?!0:(t=!t,!1):!1);break}case xe.Last:this._tree.scrollTop=this._tree.scrollHeight,this._tree.focusLast(void 0,t=>t.element instanceof Zt);break;case xe.Next:{const t=this._tree.getFocus();this._tree.focusNext(void 0,this._shouldLoop,void 0,n=>n.element instanceof Zt?(this._tree.reveal(n.element),!0):!1);const i=this._tree.getFocus();t.length&&t[0]===i[0]&&this._onLeave.fire();break}case xe.Previous:{const t=this._tree.getFocus();this._tree.focusPrevious(void 0,this._shouldLoop,void 0,n=>{if(!(n.element instanceof Zt))return!1;const s=this._tree.getParentElement(n.element);return s===null||s.children[0]!==n.element?this._tree.reveal(n.element):this._tree.reveal(s),!0});const i=this._tree.getFocus();t.length&&t[0]===i[0]&&this._onLeave.fire();break}case xe.NextPage:this._tree.focusNextPage(void 0,t=>t.element instanceof Zt?(this._tree.reveal(t.element),!0):!1);break;case xe.PreviousPage:this._tree.focusPreviousPage(void 0,t=>{if(!(t.element instanceof Zt))return!1;const i=this._tree.getParentElement(t.element);return i===null||i.children[0]!==t.element?this._tree.reveal(t.element):this._tree.reveal(i),!0});break;case xe.NextSeparator:{let t=!1;const i=this._tree.getFocus()[0];this._tree.focusNext(void 0,!0,void 0,s=>{if(t)return!0;if(s.element instanceof hl)t=!0,this._separatorRenderer.isSeparatorVisible(s.element)?this._tree.reveal(s.element.children[0]):this._tree.reveal(s.element,0);else if(s.element instanceof Zt){if(s.element.separator)return this._itemRenderer.isItemWithSeparatorVisible(s.element)?this._tree.reveal(s.element):this._tree.reveal(s.element,0),!0;if(s.element===this._elementTree[0])return this._tree.reveal(s.element,0),!0}return!1});const n=this._tree.getFocus()[0];i===n&&(this._tree.scrollTop=this._tree.scrollHeight,this._tree.focusLast(void 0,s=>s.element instanceof Zt));break}case xe.PreviousSeparator:{let t,i=!!this._tree.getFocus()[0]?.separator;this._tree.focusPrevious(void 0,!0,void 0,n=>{if(n.element instanceof hl)i?t||(this._separatorRenderer.isSeparatorVisible(n.element)?this._tree.reveal(n.element):this._tree.reveal(n.element,0),t=n.element.children[0]):i=!0;else if(n.element instanceof Zt&&!t){if(n.element.separator)this._itemRenderer.isItemWithSeparatorVisible(n.element)?this._tree.reveal(n.element):this._tree.reveal(n.element,0),t=n.element;else if(n.element===this._elementTree[0])return this._tree.reveal(n.element,0),!0}return!1}),t&&this._tree.setFocus([t]);break}}}clearFocus(){this._tree.setFocus([])}domFocus(){this._tree.domFocus()}layout(e){this._tree.getHTMLElement().style.maxHeight=e?`${Math.floor(e/44)*44+6}px`:"",this._tree.layout()}filter(e){if(this._lastQueryString=e,!(this._sortByLabel||this._matchOnLabel||this._matchOnDescription||this._matchOnDetail))return this._tree.layout(),!1;const t=e;if(e=e.trim(),!e||!(this.matchOnLabel||this.matchOnDescription||this.matchOnDetail))this._itemElements.forEach(i=>{i.labelHighlights=void 0,i.descriptionHighlights=void 0,i.detailHighlights=void 0,i.hidden=!1;const n=i.index&&this._inputElements[i.index-1];i.item&&(i.separator=n&&n.type==="separator"&&!n.buttons?n:void 0)});else{let i;this._itemElements.forEach(n=>{let s;this.matchOnLabelMode==="fuzzy"?s=this.matchOnLabel?Su(e,Ka(n.saneLabel))??void 0:void 0:s=this.matchOnLabel?bQ(t,Ka(n.saneLabel))??void 0:void 0;const r=this.matchOnDescription?Su(e,Ka(n.saneDescription||""))??void 0:void 0,a=this.matchOnDetail?Su(e,Ka(n.saneDetail||""))??void 0:void 0;if(s||r||a?(n.labelHighlights=s,n.descriptionHighlights=r,n.detailHighlights=a,n.hidden=!1):(n.labelHighlights=void 0,n.descriptionHighlights=void 0,n.detailHighlights=void 0,n.hidden=n.item?!n.item.alwaysShow:!0),n.item?n.separator=void 0:n.separator&&(n.hidden=!0),!this.sortByLabel){const c=n.index&&this._inputElements[n.index-1]||void 0;c?.type==="separator"&&!c.buttons&&(i=c),i&&!n.hidden&&(n.separator=i,i=void 0)}})}return this._setElementsToTree(this._sortByLabel&&e?this._itemElements:this._elementTree),this._tree.layout(),!0}toggleCheckbox(){this._elementCheckedEventBufferer.bufferEvents(()=>{const e=this._tree.getFocus().filter(i=>i instanceof Zt),t=this._allVisibleChecked(e);for(const i of e)i.checkboxDisabled||(i.checked=!t)})}style(e){this._tree.style(e)}toggleHover(){const e=this._tree.getFocus()[0];if(!e?.saneTooltip||!(e instanceof Zt))return;if(this._lastHover&&!this._lastHover.isDisposed){this._lastHover.dispose();return}this.showHover(e);const t=new l.DisposableStore;t.add(this._tree.onDidChangeFocus(i=>{i.elements[0]instanceof Zt&&this.showHover(i.elements[0])})),this._lastHover&&t.add(this._lastHover),this._elementDisposable.add(t)}_setElementsToTree(e){const t=new Array;for(const i of e)i instanceof hl?t.push({element:i,collapsible:!1,collapsed:!1,children:i.children.map(n=>({element:n,collapsible:!1,collapsed:!1}))}):t.push({element:i,collapsible:!1,collapsed:!1});this._tree.setChildren(null,t)}_allVisibleChecked(e,t=!0){for(let i=0,n=e.length;i<n;i++){const s=e[i];if(!s.hidden&&s.item.pickable!==!1)if(s.checked)t=!0;else return!1}return t}_updateCheckedObservables(){nt(e=>{this._allVisibleCheckedObservable.set(this._allVisibleChecked(this._itemElements,!1),e);const t=this._itemElements.filter(i=>i.checked).length;this._checkedCountObservable.set(t,e),this._checkedElementsObservable.set(this.getCheckedElements(),e)})}showHover(e){this._lastHover&&!this._lastHover.isDisposed&&(this.hoverDelegate.onDidHideHover?.(),this._lastHover?.dispose()),!(!e.element||!e.saneTooltip)&&(this._lastHover=this.hoverDelegate.showHover({content:e.saneTooltip,target:e.element,linkHandler:t=>{this.linkOpenerDelegate(t)},appearance:{showPointer:!0},container:this._container,position:{hoverPosition:1}},!1))}};sf([et],rf.prototype,"onDidChangeFocus",null),sf([et],rf.prototype,"onDidChangeSelection",null),rf=sf([of(5,me),of(6,Ui)],rf);function bQ(o,e){const{text:t,iconOffsets:i}=e;if(!i||i.length===0)return ZA(o,t);const n=l.ltrim(t," "),s=t.length-n.length,r=ZA(o,n);if(r)for(const a of r){const c=i[a.start+s]+s;a.start+=c,a.end+=c}return r}function ZA(o,e){const t=e.toLowerCase().indexOf(o.toLowerCase());return t!==-1?[{start:t,end:t+o.length}]:null}function CQ(o,e,t){const i=o.labelHighlights||[],n=e.labelHighlights||[];return i.length&&!n.length?-1:!i.length&&n.length?1:i.length===0&&n.length===0?0:gQ(o.saneSortLabel,e.saneSortLabel,t)}function vQ(o,e={}){Zn.registerCommandAndKeybindingRule({weight:200,when:tf,metadata:{description:l.localize(1822,"Used while in the context of any kind of quick input. If you change one keybinding for this command, you should change all of the other keybindings (modifier variants) of this command as well.")},...o,secondary:HL(o.primary,o.secondary??[],e)})}function yi(o,e={}){Zn.registerCommandAndKeybindingRule({weight:200,when:de.and(de.or(de.equals(cl,"quickPick"),de.equals(cl,"quickTree")),tf),metadata:{description:l.localize(1823,"Used while in the context of the quick pick. If you change one keybinding for this command, you should change all of the other keybindings (modifier variants) of this command as well.")},...o,secondary:HL(o.primary,o.secondary??[],e)})}const dl=l.isMacintosh?256:2048;function HL(o,e,t={}){return t.withAltMod&&e.push(512+o),t.withCtrlMod&&(e.push(dl+o),t.withAltMod&&e.push(512+dl+o)),t.withShiftMod&&(e.push(1024+o),t.withAltMod&&e.push(1536+o),t.withCtrlMod&&(e.push(dl+1024+o),t.withAltMod&&e.push(512+dl+1024+o))),t.withCmdMod&&l.isMacintosh&&(e.push(2048+o),t.withCtrlMod&&e.push(2304+o),t.withAltMod&&(e.push(2560+o),t.withCtrlMod&&e.push(2816+o))),e}function ln(o,e){return t=>{const i=t.get(Ps).currentQuickInput;if(i)return e&&i.quickNavigate?i.focus(e):i.focus(o)}}yi({id:"quickInput.pageNext",primary:12,handler:ln(xe.NextPage)},{withAltMod:!0,withCtrlMod:!0,withCmdMod:!0}),yi({id:"quickInput.pagePrevious",primary:11,handler:ln(xe.PreviousPage)},{withAltMod:!0,withCtrlMod:!0,withCmdMod:!0}),yi({id:"quickInput.first",primary:dl+14,handler:ln(xe.First)},{withAltMod:!0,withCmdMod:!0}),yi({id:"quickInput.last",primary:dl+13,handler:ln(xe.Last)},{withAltMod:!0,withCmdMod:!0}),yi({id:"quickInput.next",primary:18,handler:ln(xe.Next)},{withCtrlMod:!0}),yi({id:"quickInput.previous",primary:16,handler:ln(xe.Previous)},{withCtrlMod:!0});const QA=l.localize(1824,"If we're in quick access mode, this will navigate to the next item. If we are not in quick access mode, this will navigate to the next separator."),XA=l.localize(1825,"If we're in quick access mode, this will navigate to the previous item. If we are not in quick access mode, this will navigate to the previous separator.");l.isMacintosh?(yi({id:"quickInput.nextSeparatorWithQuickAccessFallback",primary:2066,handler:ln(xe.NextSeparator,xe.Next),metadata:{description:QA}}),yi({id:"quickInput.nextSeparator",primary:2578,secondary:[2322],handler:ln(xe.NextSeparator)},{withCtrlMod:!0}),yi({id:"quickInput.previousSeparatorWithQuickAccessFallback",primary:2064,handler:ln(xe.PreviousSeparator,xe.Previous),metadata:{description:XA}}),yi({id:"quickInput.previousSeparator",primary:2576,secondary:[2320],handler:ln(xe.PreviousSeparator)},{withCtrlMod:!0})):(yi({id:"quickInput.nextSeparatorWithQuickAccessFallback",primary:530,handler:ln(xe.NextSeparator,xe.Next),metadata:{description:QA}}),yi({id:"quickInput.nextSeparator",primary:2578,handler:ln(xe.NextSeparator)}),yi({id:"quickInput.previousSeparatorWithQuickAccessFallback",primary:528,handler:ln(xe.PreviousSeparator,xe.Previous),metadata:{description:XA}}),yi({id:"quickInput.previousSeparator",primary:2576,handler:ln(xe.PreviousSeparator)})),Zn.registerCommandAndKeybindingRule({id:"quickInput.accept",primary:3,weight:200,when:de.and(de.notEquals(cl,"quickWidget"),tf,de.not("isComposing")),metadata:{description:l.localize(1826,"Used while in the context of some quick input. If you change one keybinding for this command, you should change all of the other keybindings (modifier variants) of this command as well.")},handler:o=>{o.get(Ps).currentQuickInput?.accept()},secondary:HL(3,[],{withAltMod:!0,withCtrlMod:!0,withCmdMod:!0,withShiftMod:!0})}),yi({id:"quickInput.acceptInBackground",when:de.and(tf,de.equals(cl,"quickPick"),de.or(Mp.negate(),iQ)),primary:17,weight:250,handler:o=>{o.get(Ps).currentQuickInput?.accept(!0)}},{withAltMod:!0,withCtrlMod:!0,withCmdMod:!0}),vQ({id:"quickInput.hide",primary:9,handler:o=>{o.get(Ps).currentQuickInput?.hide()}},{withAltMod:!0,withCtrlMod:!0,withCmdMod:!0}),yi({id:"quickInput.toggleCheckbox",when:de.and(tf,de.or(de.equals(cl,"quickPick"),de.equals(cl,"quickTree")),Mp.negate()),primary:10,handler:o=>{o.get(Ps).toggle()}}),yi({id:"quickInput.toggleHover",primary:dl|10,handler:o=>{o.get(Ps).toggleHover()}});var wQ=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},JA=function(o,e){return function(t,i){e(t,i,o)}},e0;const af=Q;class SQ extends l.Disposable{constructor(){super(...arguments),this._onDidChangeCheckboxState=this._register(new l.Emitter),this.onDidChangeCheckboxState=this._onDidChangeCheckboxState.event}setCheckboxState(e,t){this._onDidChangeCheckboxState.fire({item:e,checked:t})}}let x_=(Rl=class extends l.Disposable{constructor(e,t,i,n,s,r,a){super(),this._hoverDelegate=e,this._buttonTriggeredEmitter=t,this.onCheckedEvent=i,this._checkboxStateHandler=n,this._toggleStyles=s,this._contextMenuService=r,this._themeService=a,this.templateId=e0.ID,this._onDidDisposeFocusedElement=this._register(new l.Emitter),this.onDidDisposeFocusedElement=this._onDidDisposeFocusedElement.event}renderTemplate(e){const t=new l.DisposableStore,i=K(e,af(".quick-input-tree-entry")),n=t.add(new BM("",!1,{...By,size:15}));i.appendChild(n.domNode);const s=K(i,af("label.quick-input-tree-label")),r=K(s,af(".quick-input-tree-rows")),a=K(r,af(".quick-input-tree-row")),c=Xf(a,af(".quick-input-tree-icon")),h=t.add(new w_(a,{supportHighlights:!0,supportDescriptionHighlights:!0,supportIcons:!0,hoverDelegate:this._hoverDelegate})),d=t.add(new ph(i,this._contextMenuService,{actionViewItemProvider:rh(this._toggleStyles),hoverDelegate:this._hoverDelegate,icon:!0,label:!1}));return d.getElement().classList.add("quick-input-tree-entry-action-bar"),{toDisposeTemplate:t,entry:i,checkbox:n,icon:c,label:h,actionBar:d,toDisposeElement:new l.DisposableStore}}renderElement(e,t,i,n){const s=i.toDisposeElement,r=e.element;if(r.pickable===!1)i.checkbox.domNode.style.display="none";else{const u=i.checkbox;u.domNode.style.display="",u.checked=r.checked??!1,s.add(l.Event.filter(this.onCheckedEvent,f=>f.item===r)(f=>u.checked=f.checked)),r.disabled&&u.disable(),s.add(u.onChange(f=>this._checkboxStateHandler.setCheckboxState(r,u.checked)))}if(r.iconPath){const u=rr(this._themeService.getColorTheme().type)?r.iconPath.dark:r.iconPath.light??r.iconPath.dark,f=l.URI.revive(u);i.icon.className="quick-input-tree-icon",i.icon.style.backgroundImage=Bs(f)}else i.icon.style.backgroundImage="",i.icon.className=r.iconClass?`quick-input-tree-icon ${r.iconClass}`:"";const{labelHighlights:a,descriptionHighlights:c}=e.filterData||{};let h;r.description&&(h={markdown:{value:l.escape(r.description),supportThemeIcons:!0},markdownNotSupportedFallback:r.description}),i.label.setLabel(r.label,r.description,{matches:a,descriptionMatches:c,extraClasses:r.iconClasses,italic:r.italic,strikethrough:r.strikethrough,labelEscapeNewLines:!0,descriptionTitle:h});const d=r.buttons;if(d&&d.length){const{primary:u,secondary:f}=dh(d,"quick-input-tree",g=>this._buttonTriggeredEmitter.fire({item:r,button:g}));i.actionBar.setActions(u,f),i.entry.classList.add("has-actions")}else i.actionBar.setActions([]),i.entry.classList.remove("has-actions")}disposeElement(e,t,i,n){Zf(i.entry)&&this._onDidDisposeFocusedElement.fire(),i.toDisposeElement.clear(),i.actionBar.setActions([])}disposeTemplate(e){e.toDisposeElement.dispose(),e.toDisposeTemplate.dispose()}},e0=Rl,Rl.ID="quickInputTreeElement",Rl);x_=e0=wQ([JA(5,nn),JA(6,_i)],x_);class yQ{getHeight(e){return 22}getTemplateId(e){return x_.ID}}function E_(o){let e=!1,t=!1,i=!1;for(const s of o){switch(s.element?.checked){case"mixed":i=!0;break;case!0:e=!0;break;default:t=!0;break}if(e&&t&&i)break}return t?i||e?"mixed":!1:i?"mixed":e}class LQ{constructor(e){this.onCheckedEvent=e}getWidgetAriaLabel(){return l.localize(1836,"Quick Tree")}getAriaLabel(e){return e.ariaLabel||[e.label,e.description].map(t=>yS(t)).filter(t=>!!t).join(", ")}getWidgetRole(){return"tree"}getRole(e){return"checkbox"}isChecked(e){return{get value(){return e.checked==="mixed"?"mixed":!!e.checked},onDidChange:t=>l.Event.filter(this.onCheckedEvent,i=>i.item===e)(i=>t())}}}class DQ{constructor(){this.filterValue="",this.matchOnLabel=!0,this.matchOnDescription=!1}filter(e,t){if(!this.filterValue||!(this.matchOnLabel||this.matchOnDescription))return e.children?{visibility:2,data:{}}:{visibility:1,data:{}};const i=this.matchOnLabel?Su(this.filterValue,Ka(e.label))??void 0:void 0,n=this.matchOnDescription?Su(this.filterValue,Ka(e.description||""))??void 0:void 0;return{visibility:t===1||i||n?1:e.children?2:0,data:{labelHighlights:i,descriptionHighlights:n}}}}class xQ extends l.Disposable{constructor(){super(...arguments),this._sortByLabel=!0}get sortByLabel(){return this._sortByLabel}set sortByLabel(e){this._sortByLabel=e}compare(e,t){if(!this._sortByLabel)return 0;if(e.label<t.label)return-1;if(e.label>t.label)return 1;if(e.description&&t.description){if(e.description<t.description)return-1;if(e.description>t.description)return 1}else{if(e.description)return-1;if(t.description)return 1}return 0}}var EQ=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},IQ=function(o,e){return function(t,i){e(t,i,o)}};const TQ=Q,NQ="quick-input-tree-flat";class RQ{constructor(){this._elementIds=new WeakMap,this._counter=0}getId(e){let t=e.id;return t!==void 0||(t=this._elementIds.get(e),t!==void 0)||(t=`__generated_${this._counter++}`,this._elementIds.set(e,t)),t}}let t0=class extends l.Disposable{constructor(e,t,i,n){super(),this.instantiationService=n,this._onDidTriggerButton=this._register(new l.Emitter),this._onDidChangeCheckboxState=this._register(new l.Emitter),this.onDidChangeCheckboxState=this._onDidChangeCheckboxState.event,this._onDidCheckedLeafItemsChange=this._register(new l.Emitter),this.onDidChangeCheckedLeafItems=this._onDidCheckedLeafItemsChange.event,this._onLeave=this._register(new l.Emitter),this.onLeave=this._onLeave.event,this._onDidAccept=this._register(new l.Emitter),this.onDidAccept=this._onDidAccept.event,this._container=K(e,TQ(".quick-input-tree")),this._checkboxStateHandler=this._register(new SQ),this._renderer=this._register(this.instantiationService.createInstance(x_,t,this._onDidTriggerButton,this.onDidChangeCheckboxState,this._checkboxStateHandler,i.toggle)),this._filter=this.instantiationService.createInstance(DQ),this._sorter=this._register(new xQ),this._tree=this._register(this.instantiationService.createInstance(h_,"QuickInputTree",this._container,new yQ,[this._renderer],{accessibilityProvider:new LQ(this.onDidChangeCheckboxState),horizontalScrolling:!1,multipleSelectionSupport:!1,findWidgetEnabled:!1,alwaysConsumeMouseWheel:!0,hideTwistiesOfChildlessElements:!0,renderIndentGuides:sl.None,expandOnDoubleClick:!0,expandOnlyOnTwistieClick:!0,disableExpandOnSpacebar:!0,sorter:this._sorter,filter:this._filter,identityProvider:new RQ})),this._register(this._renderer.onDidDisposeFocusedElement(()=>{this._tree.domFocus()})),this.registerCheckboxStateListeners(),this.registerOnDidChangeFocus()}get tree(){return this._tree}get displayed(){return this._container.style.display!=="none"}set displayed(e){this._container.style.display=e?"":"none"}get sortByLabel(){return this._sorter.sortByLabel}set sortByLabel(e){this._sorter.sortByLabel=e,this._tree.resort(null,!0)}getActiveDescendant(){return this._tree.getHTMLElement().getAttribute("aria-activedescendant")}filter(e){this._filter.filterValue=e,this._tree.refilter()}updateFilterOptions(e){e.matchOnLabel!==void 0&&(this._filter.matchOnLabel=e.matchOnLabel),e.matchOnDescription!==void 0&&(this._filter.matchOnDescription=e.matchOnDescription),this._tree.refilter()}setTreeData(e){let t=!1;const i=s=>{let r;return s.children&&s.children.length>0&&(t=!0,r=s.children.map(a=>i(a)),s.checked=E_(r)),{element:s,children:r,collapsible:!!r,collapsed:s.collapsed?ki.PreserveOrCollapsed:ki.PreserveOrExpanded}},n=e.map(s=>i(s));this._tree.setChildren(null,n),this._container.classList.toggle(NQ,!t)}layout(e){this._tree.getHTMLElement().style.maxHeight=e?`${Math.floor(e/44)*44+6}px`:"",this._tree.layout()}focus(e){switch(e){case xe.First:this._tree.scrollTop=0,this._tree.focusFirst();break;case xe.Second:{this._tree.scrollTop=0;let t=!1;this._tree.focusFirst(void 0,i=>t?!0:(t=!t,!1));break}case xe.Last:this._tree.scrollTop=this._tree.scrollHeight,this._tree.focusLast();break;case xe.Next:{const t=this._tree.getFocus();this._tree.focusNext(void 0,!1,void 0,n=>(this._tree.reveal(n.element),!0));const i=this._tree.getFocus();t.length&&t[0]===i[0]&&this._onLeave.fire();break}case xe.Previous:{const t=this._tree.getFocus();this._tree.focusPrevious(void 0,!1,void 0,n=>(this._tree.reveal(n.element),!0));const i=this._tree.getFocus();t.length&&t[0]===i[0]&&this._onLeave.fire();break}case xe.NextPage:this._tree.focusNextPage(void 0,t=>(this._tree.reveal(t.element),!0));break;case xe.PreviousPage:this._tree.focusPreviousPage(void 0,t=>(this._tree.reveal(t.element),!0));break;case xe.NextSeparator:case xe.PreviousSeparator:return}}registerCheckboxStateListeners(){this._register(this._tree.onDidOpen(e=>{const t=e.element;if(!t||t.disabled)return;if(t.pickable===!1){this._tree.setFocus([t]),this._onDidAccept.fire();return}const i=e.browserEvent?.target;i&&i.classList.contains(tL.CLASS_NAME)||this.updateCheckboxState(t,t.checked===!0)})),this._register(this._checkboxStateHandler.onDidChangeCheckboxState(e=>{this.updateCheckboxState(e.item,e.checked===!0,!0),this._tree.setFocus([e.item]),this._tree.setSelection([e.item])}))}updateCheckboxState(e,t,i=!1){if((e.checked??!1)===t)return;e.checked=t,i||this._tree.rerender(e);const n=new Set,s=[...this._tree.getNode(e).children];for(;s.length;){const a=s.shift();a?.element&&!n.has(a.element)&&(n.add(a.element),(a.element.checked??!1)!==e.checked&&(a.element.checked=e.checked,this._tree.rerender(a.element)),s.push(...a.children))}let r=this._tree.getParentElement(e);for(;r;){const a=[...this._tree.getNode(r).children],c=E_(a);(r.checked??!1)!==c&&(r.checked=c,this._tree.rerender(r)),r=this._tree.getParentElement(r)}this._onDidChangeCheckboxState.fire({item:e,checked:e.checked??!1}),this._onDidCheckedLeafItemsChange.fire(this.getCheckedLeafItems())}registerOnDidChangeFocus(){this._register(this._tree.onDidChangeFocus(e=>{const t=this._tree.getFocus().findLast(i=>i!==null);this._tree.setSelection(t?[t]:[],e.browserEvent)}))}getCheckedLeafItems(){const e=new Set,t=[...this._tree.getNode().children],i=new Array;for(;t.length;){const n=t.shift();!n?.element||e.has(n.element)||n.element.checked&&(e.add(n.element),t.push(...n.children),n.element.children||i.push(n.element))}return i}getActiveItems(){return this._tree.getFocus().filter(e=>e!==null)}toggleCheckbox(){for(const e of this.getActiveItems())e.pickable!==!1&&!e.disabled&&this.updateCheckboxState(e,e.checked!==!0)}checkAll(e){const t=new Set,i=[...this._tree.getNode().children];let n=!1;for(;i.length;){const s=i.shift();!s?.element||t.has(s.element)||s.element.checked!==e&&(n=!0,s.element.checked=e,i.push(...s.children),t.add(s.element),this._tree.rerender(s.element),this._onDidChangeCheckboxState.fire({item:s.element,checked:s.element.checked}))}n&&this._onDidCheckedLeafItemsChange.fire(this.getCheckedLeafItems())}};t0=EQ([IQ(3,me)],t0);const yb=class yb extends uh{constructor(e){super(e),this.type="quickTree",this._value=W("value",""),this._ariaLabel=W("ariaLabel",void 0),this._placeholder=W("placeholder",void 0),this._matchOnDescription=W("matchOnDescription",!1),this._matchOnLabel=W("matchOnLabel",!0),this._sortByLabel=W("sortByLabel",!0),this._activeItems=W("activeItems",[]),this._itemTree=W("itemTree",[]),this._onDidChangeCheckedLeafItems=this._register(new l.Emitter),this._onDidChangeCheckboxState=this._register(new l.Emitter),this._onDidAcceptEmitter=this._register(new l.Emitter),this.onDidAccept=l.Event.any(e.onDidAccept,this._onDidAcceptEmitter.event),this._registerAutoruns(),this._register(e.tree.onDidChangeCheckedLeafItems(t=>this._onDidChangeCheckedLeafItems.fire(t))),this._register(e.tree.onDidChangeCheckboxState(t=>this._onDidChangeCheckboxState.fire(t.item))),this._register(e.tree.tree.onDidChangeFocus(t=>{this._activeItems.set(e.tree.getActiveItems(),void 0)}))}get placeholder(){return this._placeholder.get()}set placeholder(e){this._placeholder.set(e,void 0)}show(){if(!this.visible){const t={title:!!this.title||!!this.step||!!this.titleButtons.length,description:!!this.description,checkAll:!0,checkBox:!0,inputBox:!0,progressBar:!0,visibleCount:!0,count:!0,ok:!0,list:!1,tree:!0,message:!!this.validationMessage,customButton:!1};this.ui.setVisibilities(t),this.visibleDisposables.add(this.ui.inputBox.onDidChange(i=>{this._value.set(i,void 0)})),this.visibleDisposables.add(this.ui.tree.onDidChangeCheckboxState(i=>{const n=E_([...this.ui.tree.tree.getNode().children]);this.ui.checkAll.checked!==n&&(this.ui.checkAll.checked=n)})),this.visibleDisposables.add(this.ui.checkAll.onChange(i=>{const n=this.ui.checkAll.checked;this.ui.tree.checkAll(n)})),this.visibleDisposables.add(this.ui.tree.onDidChangeCheckedLeafItems(i=>{this.ui.count.setCount(i.length)}))}super.show(),l.setTimeout0(()=>this.ui.count.setCount(this.ui.tree.getCheckedLeafItems().length));const e=E_([...this.ui.tree.tree.getNode().children]);this.ui.checkAll.checked!==e&&(this.ui.checkAll.checked=e)}update(){if(!this.visible)return;const e={title:!!this.title||!!this.step||!!this.titleButtons.length,description:!!this.description,checkAll:!0,checkBox:!0,inputBox:!0,progressBar:!0,visibleCount:!0,count:!0,ok:!0,tree:!0,message:!!this.validationMessage};this.ui.setVisibilities(e),super.update()}_registerAutoruns(){this.registerVisibleAutorun(e=>{const t=this._value.read(e);this.ui.inputBox.value=t,this.ui.tree.filter(t)}),this.registerVisibleAutorun(e=>{let t=this._ariaLabel.read(e);t||(t=this.placeholder||yb.DEFAULT_ARIA_LABEL,this.title&&(t+=` - ${this.title}`)),this.ui.list.ariaLabel!==t&&(this.ui.list.ariaLabel=t??null),this.ui.inputBox.ariaLabel!==t&&(this.ui.inputBox.ariaLabel=t??"input")}),this.registerVisibleAutorun(e=>{const t=this._placeholder.read(e);this.ui.inputBox.placeholder!==t&&(this.ui.inputBox.placeholder=t??"")}),this.registerVisibleAutorun(e=>{const t=this._matchOnLabel.read(e),i=this._matchOnDescription.read(e);this.ui.tree.updateFilterOptions({matchOnLabel:t,matchOnDescription:i})}),this.registerVisibleAutorun(e=>{const t=this._sortByLabel.read(e);this.ui.tree.sortByLabel=t}),this.registerVisibleAutorun(e=>{const t=this._itemTree.read(e);this.ui.tree.setTreeData(t)})}registerVisibleAutorun(e){this._register(he(t=>{this._visible.read(t)&&e(t)}))}focus(e){this.ui.tree.focus(e),this.ui.tree.tree.domFocus()}accept(e){this._onDidAcceptEmitter.fire()}};yb.DEFAULT_ARIA_LABEL=l.localize(1837,"Type to narrow down results.");let i0=yb;var WA=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},Tr=function(o,e){return function(t,i){e(t,i,o)}},n0;const cn=Q,s0="workbench.quickInput.viewState";let o0=(Ml=class extends l.Disposable{get currentQuickInput(){return this.controller??void 0}get container(){return this._container}constructor(e,t,i,n,s,r){super(),this.options=e,this.layoutService=t,this.instantiationService=i,this.storageService=s,this.contextMenuService=r,this.enabled=!0,this.onDidAcceptEmitter=this._register(new l.Emitter),this.onDidCustomEmitter=this._register(new l.Emitter),this.onDidTriggerButtonEmitter=this._register(new l.Emitter),this.keyMods={ctrlCmd:!1,alt:!1,shift:!1},this.controller=null,this.onShowEmitter=this._register(new l.Emitter),this.onShow=this.onShowEmitter.event,this.onHideEmitter=this._register(new l.Emitter),this.onHide=this.onHideEmitter.event,this._alignment=W(this,"top"),this.alignment=this._alignment,this.inQuickInputContext=JZ.bindTo(n),this.quickInputTypeContext=eQ.bindTo(n),this.endOfQuickInputBoxContext=tQ.bindTo(n),this.idPrefix=e.idPrefix,this._container=e.container,this.styles=e.styles,this._register(l.Event.runAndSubscribe(id,({window:a,disposables:c})=>this.registerKeyModsListeners(a,c),{window:Ae,disposables:this._store})),this._register(dF(a=>{this.ui&&j(this.ui.container)===a&&(this.reparentUI(this.layoutService.mainContainer),this.layout(this.layoutService.mainContainerDimension,this.layoutService.mainContainerOffset.quickPickTop))})),this.viewState=this.loadViewState()}registerKeyModsListeners(e,t){const i=n=>{this.keyMods.ctrlCmd=n.ctrlKey||n.metaKey,this.keyMods.alt=n.altKey,this.keyMods.shift=n.shiftKey};for(const n of[F.KEY_DOWN,F.KEY_UP,F.MOUSE_DOWN])t.add(R(e,n,i,!0))}getUI(e){if(this.ui)return e&&j(this._container)!==j(this.layoutService.activeContainer)&&(this.reparentUI(this.layoutService.activeContainer),this.layout(this.layoutService.activeContainerDimension,this.layoutService.activeContainerOffset.quickPickTop)),this.ui;const t=K(this._container,cn(".quick-input-widget.show-file-icons"));t.tabIndex=-1,t.style.display="none";const i=bn(t),n=K(t,cn(".quick-input-titlebar")),s=this._register(new ph(n,this.contextMenuService,{hoverDelegate:this.options.hoverDelegate,actionViewItemProvider:rh(this.styles.toggle),icon:!0,label:!1}));s.getElement().classList.add("quick-input-left-action-bar");const r=K(n,cn(".quick-input-title")),a=this._register(new ph(n,this.contextMenuService,{hoverDelegate:this.options.hoverDelegate,actionViewItemProvider:rh(this.styles.toggle),icon:!0,label:!1}));a.getElement().classList.add("quick-input-right-action-bar");const c=K(t,cn(".quick-input-header")),h=this._register(new BM(l.localize(1827,"Toggle all checkboxes"),!1,{...By,size:15}));K(c,h.domNode),this._register(h.onChange(()=>{const B=h.checked;P.setAllVisibleChecked(B===!0)})),this._register(R(h.domNode,F.CLICK,B=>{(B.x||B.y)&&g.setFocus()}));const d=K(c,cn(".quick-input-description")),u=K(c,cn(".quick-input-and-message")),f=K(u,cn(".quick-input-filter")),g=this._register(new lQ(f,this.styles.inputBox,this.styles.toggle));g.setAttribute("aria-describedby",`${this.idPrefix}message`);const m=K(f,cn(".quick-input-visible-count"));m.setAttribute("aria-live","polite"),m.setAttribute("aria-atomic","true");const p=this._register(new YL(m,{countFormat:l.localize(1828,"{0} Results")},this.styles.countBadge)),b=K(f,cn(".quick-input-count"));b.setAttribute("aria-live","polite");const v=this._register(new YL(b,{countFormat:l.localize(1829,"{0} Selected")},this.styles.countBadge)),C=this._register(new ph(c,this.contextMenuService,{hoverDelegate:this.options.hoverDelegate,actionViewItemProvider:rh(this.styles.toggle),icon:!0,label:!1}));C.getElement().classList.add("quick-input-inline-action-bar");const w=K(c,cn(".quick-input-action")),S=this._register(new v_(w,this.styles.button));S.label=l.localize(1830,"OK"),this._register(S.onDidClick(B=>{this.onDidAcceptEmitter.fire()}));const L=K(c,cn(".quick-input-action")),D=this._register(new v_(L,{...this.styles.button,supportIcons:!0}));D.label=l.localize(1831,"Custom"),this._register(D.onDidClick(B=>{this.onDidCustomEmitter.fire()}));const x=K(u,cn(`#${this.idPrefix}message.quick-input-message`)),I=this._register(new XL(t,this.styles.progressBar));I.getContainer().classList.add("quick-input-progress");const T=K(t,cn(".quick-input-html-widget"));T.tabIndex=-1;const M=K(t,cn(".quick-input-description")),O=this.idPrefix+"list",P=this._register(this.instantiationService.createInstance(rf,t,this.options.hoverDelegate,this.options.linkOpenerDelegate,O,this.styles));g.setAttribute("aria-controls",O),this._register(P.onDidChangeFocus(()=>{if(g.hasFocus()){const B=P.getActiveDescendant();B?(g.setAttribute("aria-activedescendant",B),g.setListFocusMode(!0)):(g.removeAttribute("aria-activedescendant"),g.setListFocusMode(!1))}})),this._register(P.onChangedAllVisibleChecked(B=>{h.checked=B})),this._register(P.onChangedVisibleCount(B=>{p.setCount(B)})),this._register(P.onChangedCheckedCount(B=>{l.setTimeout0(()=>v.setCount(B))})),this._register(P.onLeave(()=>{setTimeout(()=>{this.controller&&(g.setFocus(),this.controller instanceof fh&&this.controller.canSelectMany&&P.clearFocus())},0)}));const k=this._register(this.instantiationService.createInstance(t0,t,this.options.hoverDelegate,this.styles));this._register(k.tree.onDidChangeFocus(()=>{if(g.hasFocus()){const B=k.getActiveDescendant();B?(g.setAttribute("aria-activedescendant",B),g.setListFocusMode(!0)):(g.removeAttribute("aria-activedescendant"),g.setListFocusMode(!1))}})),this._register(k.onLeave(()=>{setTimeout(()=>{this.controller&&(g.setFocus(),k.tree.setFocus([]))},0)})),this._register(k.onDidAccept(()=>{this.onDidAcceptEmitter.fire()})),this._register(k.tree.onDidChangeContentHeight(()=>this.updateLayout()));const U=Xr(t);return this._register(U),this._register(R(t,F.FOCUS,B=>{const G=this.getUI();if(ut(B.relatedTarget,G.inputContainer)){const X=G.inputBox.isSelectionAtEnd();this.endOfQuickInputBoxContext.get()!==X&&this.endOfQuickInputBoxContext.set(X)}ut(B.relatedTarget,G.container)||(this.inQuickInputContext.set(!0),this.previousFocusElement=Ve(B.relatedTarget)?B.relatedTarget:void 0)},!0)),this._register(U.onDidBlur(()=>{!this.getUI().ignoreFocusOut&&!this.options.ignoreFocusOut()&&this.hide(ku.Blur),this.inQuickInputContext.set(!1),this.endOfQuickInputBoxContext.set(!1),this.previousFocusElement=void 0})),this._register(g.onKeyDown(B=>{const G=this.getUI().inputBox.isSelectionAtEnd();this.endOfQuickInputBoxContext.get()!==G&&this.endOfQuickInputBoxContext.set(G),l.isModifierKey(B.keyCode)||(g.removeAttribute("aria-activedescendant"),g.setListFocusMode(!1))})),this._register(R(t,F.FOCUS,B=>{g.setFocus()})),this.dndController=this._register(this.instantiationService.createInstance(r0,this._container,t,[{node:n,includeChildren:!0,excludeNodes:[s.getElement(),a.getElement()]},{node:c,includeChildren:!1}],this.viewState)),this._register(he(B=>{const G=this.dndController?.dndViewState.read(B);G&&(G.top!==void 0&&G.left!==void 0?this.viewState={...this.viewState,top:G.top,left:G.left}:this.viewState=void 0,this.updateLayout(),G.done&&this.saveViewState(this.viewState))})),this._register(he(B=>{this._alignment.set(this.dndController.alignment.read(B),void 0)})),this.ui={container:t,styleSheet:i,leftActionBar:s,titleBar:n,title:r,description1:M,description2:d,widget:T,rightActionBar:a,inlineActionBar:C,checkAll:h,inputContainer:u,filterContainer:f,inputBox:g,visibleCountContainer:m,visibleCount:p,countContainer:b,count:v,okContainer:w,ok:S,message:x,customButtonContainer:L,customButton:D,list:P,tree:k,progressBar:I,onDidAccept:this.onDidAcceptEmitter.event,onDidCustom:this.onDidCustomEmitter.event,onDidTriggerButton:this.onDidTriggerButtonEmitter.event,ignoreFocusOut:!1,keyMods:this.keyMods,show:B=>this.show(B),hide:()=>this.hide(),setVisibilities:B=>this.setVisibilities(B),setEnabled:B=>this.setEnabled(B),setContextKey:B=>this.options.setContextKey(B),linkOpenerDelegate:B=>this.options.linkOpenerDelegate(B)},this.updateStyles(),this.ui}reparentUI(e){this.ui&&(this._container=e,K(this._container,this.ui.container),this.dndController?.reparentUI(this._container))}pick(e,t={},i=l.CancellationToken.None){return new Promise((n,s)=>{let r=d=>{r=n,t.onKeyMods?.(a.keyMods),n(d)};if(i.isCancellationRequested){r(void 0);return}const a=this.createQuickPick({useSeparators:!0});let c;const h=[a,a.onDidAccept(()=>{if(a.canSelectMany)r(a.selectedItems.slice()),a.hide();else{const d=a.activeItems[0];d&&(r(d),a.hide())}}),a.onDidChangeActive(d=>{const u=d[0];u&&t.onDidFocus&&t.onDidFocus(u)}),a.onDidChangeSelection(d=>{if(!a.canSelectMany){const u=d[0];u&&(r(u),a.hide())}}),a.onDidTriggerItemButton(d=>t.onDidTriggerItemButton&&t.onDidTriggerItemButton({...d,removeItem:()=>{const u=a.items.indexOf(d.item);if(u!==-1){const f=a.items.slice(),g=f.splice(u,1),m=a.activeItems.filter(b=>b!==g[0]),p=a.keepScrollPosition;a.keepScrollPosition=!0,a.items=f,m&&(a.activeItems=m),a.keepScrollPosition=p}}})),a.onDidTriggerSeparatorButton(d=>t.onDidTriggerSeparatorButton?.(d)),a.onDidChangeValue(d=>{c&&!d&&(a.activeItems.length!==1||a.activeItems[0]!==c)&&(a.activeItems=[c])}),i.onCancellationRequested(()=>{a.hide()}),a.onDidHide(()=>{l.dispose(h),r(void 0)})];a.title=t.title,t.value&&(a.value=t.value),a.canSelectMany=!!t.canPickMany,a.placeholder=t.placeHolder,a.prompt=t.prompt,a.ignoreFocusOut=!!t.ignoreFocusLost,a.matchOnDescription=!!t.matchOnDescription,a.matchOnDetail=!!t.matchOnDetail,t.sortByLabel!==void 0&&(a.sortByLabel=t.sortByLabel),a.matchOnLabel=t.matchOnLabel===void 0||t.matchOnLabel,a.quickNavigate=t.quickNavigate,a.hideInput=!!t.hideInput,a.contextKey=t.contextKey,a.anchor=t.anchor,a.anchorPosition=t.anchorPosition,a.busy=!0,Promise.all([e,t.activeItem]).then(([d,u])=>{c=u,a.busy=!1,a.items=d,a.canSelectMany&&(a.selectedItems=d.filter(f=>f.type!=="separator"&&f.picked)),c&&(a.activeItems=[c])}),a.show(),Promise.resolve(e).then(void 0,d=>{s(d),a.hide()})})}setValidationOnInput(e,t){t&&l.isString(t)?(e.severity=rt.Error,e.validationMessage=t):t&&!l.isString(t)?(e.severity=t.severity,e.validationMessage=t.content):(e.severity=rt.Ignore,e.validationMessage=void 0)}input(e={},t=l.CancellationToken.None){return new Promise(i=>{if(t.isCancellationRequested){i(void 0);return}const n=this.createInputBox(),s=e.validateInput||(()=>Promise.resolve(void 0)),r=l.Event.debounce(n.onDidChangeValue,(d,u)=>u,100);let a=e.value||"",c=Promise.resolve(s(a));const h=[n,r(d=>{d!==a&&(c=Promise.resolve(s(d)),a=d),c.then(u=>{d===a&&this.setValidationOnInput(n,u)})}),n.onDidAccept(()=>{const d=n.value;d!==a&&(c=Promise.resolve(s(d)),a=d),c.then(u=>{!u||!l.isString(u)&&u.severity!==rt.Error?(i(d),n.hide()):d===a&&this.setValidationOnInput(n,u)})}),t.onCancellationRequested(()=>{n.hide()}),n.onDidHide(()=>{l.dispose(h),i(void 0)})];n.title=e.title,n.value=e.value||"",n.valueSelection=e.valueSelection,n.prompt=e.prompt,n.placeholder=e.placeHolder,n.password=!!e.password,n.ignoreFocusOut=!!e.ignoreFocusLost,n.show()})}createQuickPick(e={useSeparators:!1}){const t=this.getUI(!0);return new fh(t)}createInputBox(){const e=this.getUI(!0);return new nQ(e)}show(e){const t=this.getUI(!0),i=this.controller;if(this.controller=e,i?.didHide(),Ve(e.anchor)){const s=j(e.anchor);j(this._container)!==s&&this.reparentUI(this.layoutService.getContainer(s))}this.setEnabled(!0),t.leftActionBar.setActions([]),t.title.textContent="",t.description1.textContent="",t.description2.textContent="",oi(t.widget),t.rightActionBar.setActions([]),t.inlineActionBar.setActions([]),t.checkAll.checked=!1,t.inputBox.placeholder="",t.inputBox.password=!1,t.inputBox.showDecoration(rt.Ignore),t.visibleCount.setCount(0),t.count.setCount(0),t.countContainer.style.right="4px",oi(t.message),t.progressBar.stop(),t.progressBar.getContainer().setAttribute("aria-hidden","true"),t.list.setElements([]),t.list.matchOnDescription=!1,t.list.matchOnDetail=!1,t.list.matchOnLabel=!0,t.list.sortByLabel=!0,t.tree.updateFilterOptions({matchOnDescription:!1,matchOnLabel:!0}),t.tree.sortByLabel=!0,t.ignoreFocusOut=!1,t.inputBox.toggles=void 0,t.inputBox.actions=void 0;const n=this.options.backKeybindingLabel();UA.tooltip=n?l.localize(1832,"Back ({0})",n):l.localize(1833,"Back"),t.container.style.display="",this.updateLayout(),this.dndController?.setEnabled(!e.anchor),this.dndController?.layoutContainer(),e.anchor?this._alignment.set("custom",void 0):this._alignment.set(this.dndController?.alignment.get()??"top",void 0),this.onShowEmitter.fire(),t.inputBox.setFocus(),this.quickInputTypeContext.set(e.type)}isVisible(){return!!this.ui&&this.ui.container.style.display!=="none"}setVisibilities(e){const t=this.getUI();t.title.style.display=e.title?"":"none",t.description1.style.display=e.description&&(e.inputBox||e.checkAll)?"":"none",t.description2.style.display=e.description&&!(e.inputBox||e.checkAll)?"":"none",t.checkAll.domNode.style.display=e.checkAll?"":"none",t.inputContainer.style.display=e.inputBox?"":"none",t.filterContainer.style.display=e.inputBox?"":"none",t.visibleCountContainer.style.display=e.visibleCount?"":"none",t.countContainer.style.display=e.count?"":"none",t.okContainer.style.display=e.ok?"":"none",t.customButtonContainer.style.display=e.customButton?"":"none",t.message.style.display=e.message?"":"none",t.progressBar.getContainer().style.display=e.progressBar?"":"none",t.list.displayed=!!e.list,t.tree.displayed=!!e.tree,t.container.classList.toggle("show-checkboxes",!!e.checkBox),t.container.classList.toggle("hidden-input",!e.inputBox&&!e.description),this.updateLayout()}setEnabled(e){if(e!==this.enabled){this.enabled=e;const t=this.getUI();for(let i=0;i<t.leftActionBar.getItemsLength();i++){const n=t.leftActionBar.getItemAction(i);n&&(n.enabled=e)}for(let i=0;i<t.rightActionBar.getItemsLength();i++){const n=t.rightActionBar.getItemAction(i);n&&(n.enabled=e)}e?t.checkAll.enable():t.checkAll.disable(),t.inputBox.enabled=e,t.ok.enabled=e,t.list.enabled=e}}hide(e){const t=this.controller;if(!t)return;t.willHide(e);const i=this.ui?.container,n=i&&!Zf(i);if(this.controller=null,this.onHideEmitter.fire(),i&&(i.style.display="none"),!n){let s=this.previousFocusElement;for(;s&&!s.offsetParent;)s=s.parentElement??void 0;s?.offsetParent?(s.focus(),this.previousFocusElement=void 0):this.options.returnFocus()}t.didHide(e)}toggle(){this.isVisible()&&(this.controller instanceof fh&&this.controller.canSelectMany?this.getUI().list.toggleCheckbox():this.controller instanceof i0&&this.getUI().tree.toggleCheckbox())}toggleHover(){this.isVisible()&&this.controller instanceof fh&&this.getUI().list.toggleHover()}layout(e,t){this.dimension=e,this.titleBarOffset=t,this.updateLayout()}updateLayout(){if(this.ui&&this.isVisible()){const e=this.ui.container.style;let t=Math.min(this.dimension.width*.62,n0.MAX_WIDTH);e.width=t+"px";let i=this.dimension&&this.dimension.height*.4;if(this.controller?.anchor){const n=this.controller.anchor,r=Ve(n)?j(n):Le(),a=this.layoutService.getContainer(r).getBoundingClientRect(),c=48;let h=JS(n),d=1,u=.2,f=200;this.controller.anchorPosition==="overlay"?(t=h.width+12,u=.4,h={top:h.top-7,left:h.left-7,width:h.width,height:0},f=Math.min(400,a.bottom-h.top-c),d=0):t=380,i=this.dimension?Math.min(this.dimension.height*u,f):f;const g=Math.floor(i)+c,{top:m,left:p,right:b,bottom:v,anchorAlignment:C,anchorPosition:w}=_R(a,{width:t,height:g},h,{anchorPosition:d});C===1?(e.right=`${b}px`,e.left="initial"):(e.left=`${p}px`,e.right="initial"),w===1?(e.bottom=`${v}px`,e.top="initial"):(e.top=`${m}px`,e.bottom="initial"),e.width=`${t}px`,e.height=""}else e.top=`${this.viewState?.top!==void 0?Math.round(this.dimension.height*this.viewState.top):this.titleBarOffset}px`,e.left=`${Math.round(this.dimension.width*(this.viewState?.left??.5)-t/2)}px`,e.right="",e.bottom="",e.height="";this.ui.inputBox.layout(),this.ui.list.layout(i),this.ui.tree.layout(i)}}applyStyles(e){this.styles=e,this.updateStyles()}updateStyles(){if(this.ui){const{quickInputTitleBackground:e,quickInputBackground:t,quickInputForeground:i,widgetBorder:n}=this.styles.widget;this.ui.titleBar.style.backgroundColor=e??"",this.ui.container.style.backgroundColor=t??"",this.ui.container.style.color=i??"",this.ui.container.style.border=n?`1px solid ${n}`:"",this.ui.list.style(this.styles.list),this.ui.tree.tree.style(this.styles.list);const s=[];this.styles.pickerGroup.pickerGroupBorder&&s.push(`.quick-input-list .quick-input-list-entry { border-top-color: ${this.styles.pickerGroup.pickerGroupBorder}; }`),this.styles.pickerGroup.pickerGroupForeground&&s.push(`.quick-input-list .quick-input-list-separator { color: ${this.styles.pickerGroup.pickerGroupForeground}; }`),this.styles.pickerGroup.pickerGroupForeground&&s.push(".quick-input-list .quick-input-list-separator-as-item { color: var(--vscode-descriptionForeground); }"),(this.styles.keybindingLabel.keybindingLabelBackground||this.styles.keybindingLabel.keybindingLabelBorder||this.styles.keybindingLabel.keybindingLabelBottomBorder||this.styles.keybindingLabel.keybindingLabelShadow||this.styles.keybindingLabel.keybindingLabelForeground)&&(s.push(".quick-input-list .monaco-keybinding > .monaco-keybinding-key {"),this.styles.keybindingLabel.keybindingLabelBackground&&s.push(`background-color: ${this.styles.keybindingLabel.keybindingLabelBackground};`),this.styles.keybindingLabel.keybindingLabelBorder&&s.push(`border-color: ${this.styles.keybindingLabel.keybindingLabelBorder};`),this.styles.keybindingLabel.keybindingLabelBottomBorder&&s.push(`border-bottom-color: ${this.styles.keybindingLabel.keybindingLabelBottomBorder};`),this.styles.keybindingLabel.keybindingLabelShadow&&s.push(`box-shadow: inset 0 -1px 0 ${this.styles.keybindingLabel.keybindingLabelShadow};`),this.styles.keybindingLabel.keybindingLabelForeground&&s.push(`color: ${this.styles.keybindingLabel.keybindingLabelForeground};`),s.push("}"));const r=s.join(`
|
||
`);r!==this.ui.styleSheet.textContent&&(this.ui.styleSheet.textContent=r)}}loadViewState(){try{const e=JSON.parse(this.storageService.get(s0,-1,"{}"));if(e.top!==void 0||e.left!==void 0)return e}catch{}}saveViewState(e){this.layoutService.activeContainer===this.layoutService.mainContainer&&(e!==void 0?this.storageService.store(s0,JSON.stringify(e),-1,1):this.storageService.remove(s0,-1))}},n0=Ml,Ml.MAX_WIDTH=600,Ml);o0=n0=WA([Tr(1,Os),Tr(2,me),Tr(3,be),Tr(4,Qa),Tr(5,nn)],o0);let r0=class extends l.Disposable{constructor(e,t,i,n,s,r,a){super(),this._container=e,this._quickInputContainer=t,this._quickInputDragAreas=i,this._layoutService=s,this.configurationService=a,this.dndViewState=W(this,void 0),this._enabled=!0,this._snapThreshold=20,this._snapLineHorizontalRatio=.25,this._alignment=W(this,"top"),this.alignment=this._alignment,this._quickInputAlignmentContext=HZ.bindTo(r);const c=Tq(this.configurationService)==="custom";this._controlsOnLeft=c&&l.platform===1,this._controlsOnRight=c&&(l.platform===3||l.platform===2),this._registerLayoutListener(),this.registerMouseListeners(),this.dndViewState.set({...n,done:!0},void 0),n?.top!==void 0&&n?.left!==void 0&&this._setAlignmentState(void 0)}reparentUI(e){this._container=e}layoutContainer(e=this._layoutService.activeContainerDimension){if(!this._enabled)return;const t=this.dndViewState.get(),i=this._quickInputContainer.getBoundingClientRect();if(t?.top!==void 0&&t?.left!==void 0){const n=Math.round(t.left*100)/100,s=e.width,r=i.width,a=n*s-r/2;this._layout(t.top*e.height,a)}}setEnabled(e){this._enabled=e,this._quickInputContainer.classList.toggle("no-drag",!e)}_setAlignmentState(e){this._quickInputAlignmentContext.set(e),this._alignment.set(e??"custom",void 0)}_registerLayoutListener(){this._register(l.Event.filter(this._layoutService.onDidLayoutContainer,e=>e.container===this._container)(e=>this.layoutContainer(e.dimension)))}registerMouseListeners(){const e=this._quickInputContainer;this._register(ox(e,t=>{if(!this._enabled)return;const i=new Bi(j(e),t);if(i.detail!==2)return;const n=this._quickInputDragAreas.find(({node:s,includeChildren:r})=>r?ut(i.target,s):i.target===s);!n||n.excludeNodes?.some(s=>ut(i.target,s))||(this.dndViewState.set({top:void 0,left:void 0,done:!0},void 0),this._setAlignmentState("top"))})),this._register(nC(e,t=>{if(!this._enabled)return;const i=j(this._layoutService.activeContainer),n=new Bi(i,t),s=this._quickInputDragAreas.find(({node:f,includeChildren:g})=>g?ut(n.target,f):n.target===f);if(!s||s.excludeNodes?.some(f=>ut(n.target,f)))return;const r=this._quickInputContainer.getBoundingClientRect(),a=n.browserEvent.clientX-r.left,c=n.browserEvent.clientY-r.top;let h=!1;const d=bF(i,f=>{new Bi(i,f).preventDefault(),h||(h=!0),this._layout(f.clientY-c,f.clientX-a)}),u=ox(i,f=>{if(h){const g=this.dndViewState.get();this.dndViewState.set({top:g?.top,left:g?.left,done:!0},void 0)}d.dispose(),u.dispose()})}))}_layout(e,t){const i=this._getTopSnapValue(),n=this._getCenterYSnapValue(),s=this._getCenterXSnapValue();e=Math.max(0,Math.min(e,this._container.clientHeight-this._quickInputContainer.clientHeight)),e<this._layoutService.activeContainerOffset.top&&(this._controlsOnLeft?t=Math.max(t,80/Kb(Le())):this._controlsOnRight&&(t=Math.min(t,this._container.clientWidth-this._quickInputContainer.clientWidth-140/Kb(Le()))));const r=Math.abs(e-i)<this._snapThreshold;e=r?i:e;const a=Math.abs(e-n)<this._snapThreshold;e=a?n:e;const c=e/this._container.clientHeight;t=Math.max(0,Math.min(t,this._container.clientWidth-this._quickInputContainer.clientWidth));const h=Math.abs(t-s)<this._snapThreshold;t=h?s:t;const d=this._container.clientWidth,u=this._quickInputContainer.clientWidth,g=(t+u/2)/d;if(this.dndViewState.set({top:c,left:g,done:!1},void 0),h){if(r){this._setAlignmentState("top");return}else if(a){this._setAlignmentState("center");return}}this._setAlignmentState(void 0)}_getTopSnapValue(){return this._layoutService.activeContainerOffset.quickPickTop}_getCenterYSnapValue(){return Math.round(this._container.clientHeight*this._snapLineHorizontalRatio)}_getCenterXSnapValue(){return Math.round(this._container.clientWidth/2)-Math.round(this._quickInputContainer.clientWidth/2)}};r0=WA([Tr(4,Os),Tr(5,be),Tr(6,Ge)],r0);var MQ=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},lf=function(o,e){return function(t,i){e(t,i,o)}};let a0=class extends zU{get controller(){return this._controller||(this._controller=this._register(this.createController())),this._controller}get hasController(){return!!this._controller}get currentQuickInput(){return this.controller.currentQuickInput}get quickAccess(){return this._quickAccess||(this._quickAccess=this._register(this.instantiationService.createInstance(KL))),this._quickAccess}constructor(e,t,i,n,s){super(i),this.instantiationService=e,this.contextKeyService=t,this.layoutService=n,this.configurationService=s,this._alignment=W(this,"top"),this._onShow=this._register(new l.Emitter),this._onHide=this._register(new l.Emitter),this.contexts=new Map}createController(e=this.layoutService,t){const i={idPrefix:"quickInput_",container:e.activeContainer,ignoreFocusOut:()=>!1,backKeybindingLabel:()=>{},setContextKey:s=>this.setContextKey(s),linkOpenerDelegate:s=>{this.instantiationService.invokeFunction(r=>{r.get(Ou).open(s,{allowCommands:!0,fromUserGesture:!0})})},returnFocus:()=>e.focus(),styles:this.computeStyles(),hoverDelegate:this._register(this.instantiationService.createInstance(jL))},n=this._register(this.instantiationService.createInstance(o0,{...i,...t}));return n.layout(e.activeContainerDimension,e.activeContainerOffset.quickPickTop),this._register(e.onDidLayoutActiveContainer(s=>{j(e.activeContainer)===j(n.container)&&n.layout(s,e.activeContainerOffset.quickPickTop)})),this._register(e.onDidChangeActiveContainer(()=>{n.isVisible()||n.layout(e.activeContainerDimension,e.activeContainerOffset.quickPickTop)})),this._register(n.onShow(()=>{this.resetContextKeys(),this._onShow.fire()})),this._register(n.onHide(()=>{this.resetContextKeys(),this._onHide.fire()})),this._register(he(s=>{this._alignment.set(n.alignment.read(s),void 0)})),n}setContextKey(e){let t;e&&(t=this.contexts.get(e),t||(t=new q(e,!1).bindTo(this.contextKeyService),this.contexts.set(e,t))),!(t&&t.get())&&(this.resetContextKeys(),t?.set(!0))}resetContextKeys(){this.contexts.forEach(e=>{e.get()&&e.reset()})}pick(e,t,i=l.CancellationToken.None){return this.controller.pick(e,t,i)}input(e={},t=l.CancellationToken.None){return this.controller.input(e,t)}createQuickPick(e={useSeparators:!1}){return this.controller.createQuickPick(e)}createInputBox(){return this.controller.createInputBox()}toggle(){this.controller.toggle()}toggleHover(){this.hasController&&this.controller.toggleHover()}updateStyles(){this.hasController&&this.controller.applyStyles(this.computeStyles())}computeStyles(){return{widget:{quickInputBackground:z(fv),quickInputForeground:z(H2),quickInputTitleBackground:z(e3),widgetBorder:z(HC),widgetShadow:z(oc)},inputBox:zy,toggle:Fy,countBadge:pM,button:_q,progressBar:bq,keybindingLabel:mM,list:eh({listBackground:fv,listFocusBackground:Ad,listFocusForeground:Md,listInactiveFocusForeground:Md,listInactiveSelectionIconForeground:gv,listInactiveFocusBackground:Ad,listInactiveSelectionBackground:Ad,listInactiveSelectionForeground:Md,listFocusOutline:ot,listInactiveFocusOutline:ot,treeStickyScrollBackground:fv}),pickerGroup:{pickerGroupBorder:z(t3),pickerGroupForeground:z(eI)}}}};a0=MQ([lf(0,me),lf(1,be),lf(2,_i),lf(3,Os),lf(4,Ge)],a0);var HA=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},ul=function(o,e){return function(t,i){e(t,i,o)}};let l0=class extends a0{constructor(e,t,i,n,s,r){super(t,i,n,new vy(e.getContainerDomNode(),s),r),this.host=void 0;const a=cf.get(e);if(a){const c=a.widget;this.host={_serviceBrand:void 0,get mainContainer(){return c.getDomNode()},getContainer(){return c.getDomNode()},whenContainerStylesLoaded(){},get containers(){return[c.getDomNode()]},get activeContainer(){return c.getDomNode()},get mainContainerDimension(){return e.getLayoutInfo()},get activeContainerDimension(){return e.getLayoutInfo()},get onDidLayoutMainContainer(){return e.onDidLayoutChange},get onDidLayoutActiveContainer(){return e.onDidLayoutChange},get onDidLayoutContainer(){return l.Event.map(e.onDidLayoutChange,h=>({container:c.getDomNode(),dimension:h}))},get onDidChangeActiveContainer(){return l.Event.None},get onDidAddContainer(){return l.Event.None},get mainContainerOffset(){return{top:0,quickPickTop:0}},get activeContainerOffset(){return{top:0,quickPickTop:0}},focus:()=>e.focus()}}else this.host=void 0}createController(){return super.createController(this.host)}};l0=HA([ul(1,me),ul(2,be),ul(3,_i),ul(4,pt),ul(5,Ge)],l0);let c0=class{get activeService(){const e=this.codeEditorService.getFocusedCodeEditor();if(!e)throw new Error("Quick input service needs a focused editor to work.");let t=this.mapEditorToService.get(e);if(!t){const i=t=this.instantiationService.createInstance(l0,e);this.mapEditorToService.set(e,t),l.createSingleCallFunction(e.onDidDispose)(()=>{i.dispose(),this.mapEditorToService.delete(e)})}return t}get currentQuickInput(){return this.activeService.currentQuickInput}get quickAccess(){return this.activeService.quickAccess}constructor(e,t){this.instantiationService=e,this.codeEditorService=t,this.mapEditorToService=new Map}pick(e,t,i=l.CancellationToken.None){return this.activeService.pick(e,t,i)}input(e,t){return this.activeService.input(e,t)}createQuickPick(e={useSeparators:!1}){return this.activeService.createQuickPick(e)}createInputBox(){return this.activeService.createInputBox()}toggle(){return this.activeService.toggle()}toggleHover(){return this.activeService.toggleHover()}};c0=HA([ul(0,me),ul(1,pt)],c0);const Lb=class Lb{static get(e){return e.getContribution(Lb.ID)}constructor(e){this.editor=e,this.widget=new h0(this.editor)}dispose(){this.widget.dispose()}};Lb.ID="editor.controller.quickInput";let cf=Lb;const Db=class Db{constructor(e){this.codeEditor=e,this.domNode=document.createElement("div"),this.codeEditor.addOverlayWidget(this)}getId(){return Db.ID}getDomNode(){return this.domNode}getPosition(){return{preference:{top:0,left:0}}}dispose(){this.codeEditor.removeOverlayWidget(this)}};Db.ID="editor.contrib.quickInputWidget";let h0=Db;_C(cf.ID,cf,4);const xb=class xb{createWorkerClient(e){let t;const i=++xb._workerIdPool;return e instanceof Worker||PQ(e)?t=Promise.resolve(e):t=this._createWorker(e),new l.WebWorkerClient(new kQ(t,i))}_createWorker(e){const t=this.getWorkerUrl(e),i=AQ(e.label,t,this._getWorkerLoadingFailedErrorMessage(e)),n=new Worker(eO?eO.createScriptURL(i):i,{name:e.label,type:"module"});return OQ(n)}_getWorkerLoadingFailedErrorMessage(e){}getWorkerUrl(e){if(!e.esmModuleLocation)throw new Error("Missing esmModuleLocation in WebWorkerDescriptor");return(typeof e.esmModuleLocation=="function"?e.esmModuleLocation():e.esmModuleLocation).toString(!0)}};xb._workerIdPool=0;let d0=xb;const eO=(()=>{const o=globalThis;return typeof self=="object"&&self.constructor&&self.constructor.name==="DedicatedWorkerGlobalScope"&&o.workerttPolicy!==void 0?o.workerttPolicy:lo("defaultWorkerFactory",{createScriptURL:e=>e})})();function AQ(o,e,t){if(!(/^((http:)|(https:)|(file:))/.test(e)&&e.substring(0,globalThis.origin.length)!==globalThis.origin)){const n=e.lastIndexOf("?"),s=e.lastIndexOf("#",n),r=n>0?new URLSearchParams(e.substring(n+1,~s?s:void 0)):new URLSearchParams;l.COI.addSearchParam(r,!0,!0),r.toString()?e=`${e}?${r.toString()}#${o}`:e=`${e}#${o}`}const i=new Blob([l.coalesce([`/*${o}*/`,`globalThis._VSCODE_NLS_MESSAGES = ${JSON.stringify(l.getNLSMessages())};`,`globalThis._VSCODE_NLS_LANGUAGE = ${JSON.stringify(l.getNLSLanguage())};`,`globalThis._VSCODE_FILE_ROOT = ${JSON.stringify(globalThis._VSCODE_FILE_ROOT)};`,"const ttPolicy = globalThis.trustedTypes?.createPolicy('defaultWorkerFactory', { createScriptURL: value => value });","globalThis.workerttPolicy = ttPolicy;",t?"try {":"",`await import(ttPolicy?.createScriptURL(${JSON.stringify(e)}) ?? ${JSON.stringify(e)});`,t?`} catch (err) { console.error(${JSON.stringify(t)}, err); throw err; }`:"","globalThis.postMessage({ type: 'vscode-worker-ready' });",`/*${o}*/`]).join("")],{type:"application/javascript"});return URL.createObjectURL(i)}function OQ(o){return new Promise((e,t)=>{o.onmessage=function(i){i.data.type==="vscode-worker-ready"&&(o.onmessage=null,e(o))},o.onerror=t})}function PQ(o){return!!o&&typeof o.then=="function"}class kQ extends l.Disposable{constructor(e,t){super(),this._onMessage=this._register(new l.Emitter),this.onMessage=this._onMessage.event,this._onError=this._register(new l.Emitter),this.onError=this._onError.event,this.id=t,this.worker=e,this.postMessage("-please-ignore-",[]);const i=n=>{this._onError.fire(n)};this.worker.then(n=>{n.onmessage=s=>{this._onMessage.fire(s.data)},n.onmessageerror=s=>{this._onError.fire(s)},typeof n.addEventListener=="function"&&n.addEventListener("error",i)}),this._register(l.toDisposable(()=>{this.worker?.then(n=>{n.onmessage=null,n.onmessageerror=null,n.removeEventListener("error",i),n.terminate()}),this.worker=null}))}getId(){return this.id}postMessage(e,t){this.worker?.then(i=>{try{i.postMessage(e,t)}catch(n){l.onUnexpectedError(n),l.onUnexpectedError(new Error("FAILED to post message to worker",{cause:n}))}})}}class FQ extends d0{_createWorker(e){const t=Bf();if(t&&typeof t.getWorker=="function"){const i=t.getWorker("workerMain.js",e.label);if(i!==void 0)return Promise.resolve(i)}return super._createWorker(e)}_getWorkerLoadingFailedErrorMessage(e){return`Failed to load worker script for label: ${e.label}.
|
||
Ensure your bundler properly bundles modules referenced by "new URL('...?esm', import.meta.url)".`}getWorkerUrl(e){const t=Bf();if(t&&typeof t.getWorkerUrl=="function"){const s=t.getWorkerUrl("workerMain.js",e.label);if(s!==void 0)return new URL(s,document.baseURI).toString()}if(!e.esmModuleLocationBundler)throw new Error(`You must define a function MonacoEnvironment.getWorkerUrl or MonacoEnvironment.getWorker for the worker label: ${e.label}`);return(typeof e.esmModuleLocationBundler=="function"?e.esmModuleLocationBundler():e.esmModuleLocationBundler).toString()}}const BQ={base:"vs",inherit:!1,rules:[{token:"",foreground:"000000",background:"fffffe"},{token:"invalid",foreground:"cd3131"},{token:"emphasis",fontStyle:"italic"},{token:"strong",fontStyle:"bold"},{token:"variable",foreground:"001188"},{token:"variable.predefined",foreground:"4864AA"},{token:"constant",foreground:"dd0000"},{token:"comment",foreground:"008000"},{token:"number",foreground:"098658"},{token:"number.hex",foreground:"3030c0"},{token:"regexp",foreground:"800000"},{token:"annotation",foreground:"808080"},{token:"type",foreground:"008080"},{token:"delimiter",foreground:"000000"},{token:"delimiter.html",foreground:"383838"},{token:"delimiter.xml",foreground:"0000FF"},{token:"tag",foreground:"800000"},{token:"tag.id.pug",foreground:"4F76AC"},{token:"tag.class.pug",foreground:"4F76AC"},{token:"meta.scss",foreground:"800000"},{token:"metatag",foreground:"e00000"},{token:"metatag.content.html",foreground:"FF0000"},{token:"metatag.html",foreground:"808080"},{token:"metatag.xml",foreground:"808080"},{token:"metatag.php",fontStyle:"bold"},{token:"key",foreground:"863B00"},{token:"string.key.json",foreground:"A31515"},{token:"string.value.json",foreground:"0451A5"},{token:"attribute.name",foreground:"FF0000"},{token:"attribute.value",foreground:"0451A5"},{token:"attribute.value.number",foreground:"098658"},{token:"attribute.value.unit",foreground:"098658"},{token:"attribute.value.html",foreground:"0000FF"},{token:"attribute.value.xml",foreground:"0000FF"},{token:"string",foreground:"A31515"},{token:"string.html",foreground:"0000FF"},{token:"string.sql",foreground:"FF0000"},{token:"string.yaml",foreground:"0451A5"},{token:"keyword",foreground:"0000FF"},{token:"keyword.json",foreground:"0451A5"},{token:"keyword.flow",foreground:"AF00DB"},{token:"keyword.flow.scss",foreground:"0000FF"},{token:"operator.scss",foreground:"666666"},{token:"operator.sql",foreground:"778899"},{token:"operator.swift",foreground:"666666"},{token:"predefined.sql",foreground:"C700C7"}],colors:{[vn]:"#FFFFFE",[nc]:"#000000",[kE]:"#E5EBF1",[Ud]:"#D3D3D3",[$d]:"#939393",[$g]:"#ADD6FF4D"}},zQ={base:"vs-dark",inherit:!1,rules:[{token:"",foreground:"D4D4D4",background:"1E1E1E"},{token:"invalid",foreground:"f44747"},{token:"emphasis",fontStyle:"italic"},{token:"strong",fontStyle:"bold"},{token:"variable",foreground:"74B0DF"},{token:"variable.predefined",foreground:"4864AA"},{token:"variable.parameter",foreground:"9CDCFE"},{token:"constant",foreground:"569CD6"},{token:"comment",foreground:"608B4E"},{token:"number",foreground:"B5CEA8"},{token:"number.hex",foreground:"5BB498"},{token:"regexp",foreground:"B46695"},{token:"annotation",foreground:"cc6666"},{token:"type",foreground:"3DC9B0"},{token:"delimiter",foreground:"DCDCDC"},{token:"delimiter.html",foreground:"808080"},{token:"delimiter.xml",foreground:"808080"},{token:"tag",foreground:"569CD6"},{token:"tag.id.pug",foreground:"4F76AC"},{token:"tag.class.pug",foreground:"4F76AC"},{token:"meta.scss",foreground:"A79873"},{token:"meta.tag",foreground:"CE9178"},{token:"metatag",foreground:"DD6A6F"},{token:"metatag.content.html",foreground:"9CDCFE"},{token:"metatag.html",foreground:"569CD6"},{token:"metatag.xml",foreground:"569CD6"},{token:"metatag.php",fontStyle:"bold"},{token:"key",foreground:"9CDCFE"},{token:"string.key.json",foreground:"9CDCFE"},{token:"string.value.json",foreground:"CE9178"},{token:"attribute.name",foreground:"9CDCFE"},{token:"attribute.value",foreground:"CE9178"},{token:"attribute.value.number.css",foreground:"B5CEA8"},{token:"attribute.value.unit.css",foreground:"B5CEA8"},{token:"attribute.value.hex.css",foreground:"D4D4D4"},{token:"string",foreground:"CE9178"},{token:"string.sql",foreground:"FF0000"},{token:"keyword",foreground:"569CD6"},{token:"keyword.flow",foreground:"C586C0"},{token:"keyword.json",foreground:"CE9178"},{token:"keyword.flow.scss",foreground:"569CD6"},{token:"operator.scss",foreground:"909090"},{token:"operator.sql",foreground:"778899"},{token:"operator.swift",foreground:"909090"},{token:"predefined.sql",foreground:"FF00FF"}],colors:{[vn]:"#1E1E1E",[nc]:"#D4D4D4",[kE]:"#3A3D41",[Ud]:"#404040",[$d]:"#707070",[$g]:"#ADD6FF26"}},VQ={base:"hc-black",inherit:!1,rules:[{token:"",foreground:"FFFFFF",background:"000000"},{token:"invalid",foreground:"f44747"},{token:"emphasis",fontStyle:"italic"},{token:"strong",fontStyle:"bold"},{token:"variable",foreground:"1AEBFF"},{token:"variable.parameter",foreground:"9CDCFE"},{token:"constant",foreground:"569CD6"},{token:"comment",foreground:"608B4E"},{token:"number",foreground:"FFFFFF"},{token:"regexp",foreground:"C0C0C0"},{token:"annotation",foreground:"569CD6"},{token:"type",foreground:"3DC9B0"},{token:"delimiter",foreground:"FFFF00"},{token:"delimiter.html",foreground:"FFFF00"},{token:"tag",foreground:"569CD6"},{token:"tag.id.pug",foreground:"4F76AC"},{token:"tag.class.pug",foreground:"4F76AC"},{token:"meta",foreground:"D4D4D4"},{token:"meta.tag",foreground:"CE9178"},{token:"metatag",foreground:"569CD6"},{token:"metatag.content.html",foreground:"1AEBFF"},{token:"metatag.html",foreground:"569CD6"},{token:"metatag.xml",foreground:"569CD6"},{token:"metatag.php",fontStyle:"bold"},{token:"key",foreground:"9CDCFE"},{token:"string.key",foreground:"9CDCFE"},{token:"string.value",foreground:"CE9178"},{token:"attribute.name",foreground:"569CD6"},{token:"attribute.value",foreground:"3FF23F"},{token:"string",foreground:"CE9178"},{token:"string.sql",foreground:"FF0000"},{token:"keyword",foreground:"569CD6"},{token:"keyword.flow",foreground:"C586C0"},{token:"operator.sql",foreground:"778899"},{token:"operator.swift",foreground:"909090"},{token:"predefined.sql",foreground:"FF00FF"}],colors:{[vn]:"#000000",[nc]:"#FFFFFF",[Ud]:"#FFFFFF",[$d]:"#FFFFFF"}},UQ={base:"hc-light",inherit:!1,rules:[{token:"",foreground:"292929",background:"FFFFFF"},{token:"invalid",foreground:"B5200D"},{token:"emphasis",fontStyle:"italic"},{token:"strong",fontStyle:"bold"},{token:"variable",foreground:"264F70"},{token:"variable.predefined",foreground:"4864AA"},{token:"constant",foreground:"dd0000"},{token:"comment",foreground:"008000"},{token:"number",foreground:"098658"},{token:"number.hex",foreground:"3030c0"},{token:"regexp",foreground:"800000"},{token:"annotation",foreground:"808080"},{token:"type",foreground:"008080"},{token:"delimiter",foreground:"000000"},{token:"delimiter.html",foreground:"383838"},{token:"tag",foreground:"800000"},{token:"tag.id.pug",foreground:"4F76AC"},{token:"tag.class.pug",foreground:"4F76AC"},{token:"meta.scss",foreground:"800000"},{token:"metatag",foreground:"e00000"},{token:"metatag.content.html",foreground:"B5200D"},{token:"metatag.html",foreground:"808080"},{token:"metatag.xml",foreground:"808080"},{token:"metatag.php",fontStyle:"bold"},{token:"key",foreground:"863B00"},{token:"string.key.json",foreground:"A31515"},{token:"string.value.json",foreground:"0451A5"},{token:"attribute.name",foreground:"264F78"},{token:"attribute.value",foreground:"0451A5"},{token:"string",foreground:"A31515"},{token:"string.sql",foreground:"B5200D"},{token:"keyword",foreground:"0000FF"},{token:"keyword.flow",foreground:"AF00DB"},{token:"operator.sql",foreground:"778899"},{token:"operator.swift",foreground:"666666"},{token:"predefined.sql",foreground:"C700C7"}],colors:{[vn]:"#FFFFFF",[nc]:"#292929",[Ud]:"#292929",[$d]:"#292929"}},$Q={IconContribution:"base.contributions.icons"};var tO;(function(o){function e(t,i){let n=t.defaults;for(;_.ThemeIcon.isThemeIcon(n);){const s=fl.getIcon(n.id);if(!s)return;n=s.defaults}return n}o.getDefinition=e})(tO||(tO={}));var iO;(function(o){function e(i){return{weight:i.weight,style:i.style,src:i.src.map(n=>({format:n.format,location:n.location.toString()}))}}o.toJSONObject=e;function t(i){const n=s=>l.isString(s)?s:void 0;if(i&&Array.isArray(i.src)&&i.src.every(s=>l.isString(s.format)&&l.isString(s.location)))return{weight:n(i.weight),style:n(i.style),src:i.src.map(s=>({format:s.format,location:l.URI.parse(s.location)}))}}o.fromJSONObject=t})(iO||(iO={}));const KQ=/^([\w_-]+)$/,GQ=l.localize(2093,"The font ID must only contain letters, numbers, underscores and dashes.");class jQ extends l.Disposable{constructor(){super(),this._onDidChange=this._register(new l.Emitter),this.onDidChange=this._onDidChange.event,this.iconSchema={definitions:{icons:{type:"object",properties:{fontId:{type:"string",description:l.localize(2094,"The id of the font to use. If not set, the font that is defined first is used."),pattern:KQ.source,patternErrorMessage:GQ},fontCharacter:{type:"string",description:l.localize(2095,"The font character associated with the icon definition.")}},additionalProperties:!1,defaultSnippets:[{body:{fontCharacter:"\\\\e030"}}]}},type:"object",properties:{}},this.iconReferenceSchema={type:"string",pattern:`^${_.ThemeIcon.iconNameExpression}$`,enum:[],enumDescriptions:[]},this.iconsById={},this.iconFontsById={}}registerIcon(e,t,i,n){const s=this.iconsById[e];if(s){if(i&&!s.description){s.description=i,this.iconSchema.properties[e].markdownDescription=`${i} $(${e})`;const c=this.iconReferenceSchema.enum.indexOf(e);c!==-1&&(this.iconReferenceSchema.enumDescriptions[c]=i),this._onDidChange.fire()}return s}const r={id:e,description:i,defaults:t,deprecationMessage:n};this.iconsById[e]=r;const a={$ref:"#/definitions/icons"};return n&&(a.deprecationMessage=n),i&&(a.markdownDescription=`${i}: $(${e})`),this.iconSchema.properties[e]=a,this.iconReferenceSchema.enum.push(e),this.iconReferenceSchema.enumDescriptions.push(i||""),this._onDidChange.fire(),{id:e}}getIcons(){return Object.keys(this.iconsById).map(e=>this.iconsById[e])}getIcon(e){return this.iconsById[e]}getIconSchema(){return this.iconSchema}toString(){const e=(s,r)=>s.id.localeCompare(r.id),t=s=>{for(;_.ThemeIcon.isThemeIcon(s.defaults);)s=this.iconsById[s.defaults.id];return`codicon codicon-${s?s.id:""}`},i=[];i.push("| preview | identifier | default codicon ID | description"),i.push("| ----------- | --------------------------------- | --------------------------------- | --------------------------------- |");const n=Object.keys(this.iconsById).map(s=>this.iconsById[s]);for(const s of n.filter(r=>!!r.description).sort(e))i.push(`|<i class="${t(s)}"></i>|${s.id}|${_.ThemeIcon.isThemeIcon(s.defaults)?s.defaults.id:s.id}|${s.description||""}|`);i.push("| preview | identifier "),i.push("| ----------- | --------------------------------- |");for(const s of n.filter(r=>!_.ThemeIcon.isThemeIcon(r.defaults)).sort(e))i.push(`|<i class="${t(s)}"></i>|${s.id}|`);return i.join(`
|
||
`)}}const fl=new jQ;St.add($Q.IconContribution,fl);function Mo(o,e,t,i){return fl.registerIcon(o,e,t,i)}function nO(){return fl}function qQ(){const o=l.getCodiconFontCharacters();for(const e in o){const t="\\"+o[e].toString(16);fl.registerIcon(e,{fontCharacter:t})}}qQ();const sO="vscode://schemas/icons",oO=St.as(Cg.JSONContribution);oO.registerSchema(sO,fl.getIconSchema());const rO=new l.RunOnceScheduler(()=>oO.notifySchemaChanged(sO),200);fl.onDidChange(()=>{rO.isScheduled()||rO.schedule()});const YQ=Mo("widget-close",l.Codicon.close,l.localize(2096,"Icon for the close action in widgets."));Mo("goto-previous-location",l.Codicon.arrowUp,l.localize(2097,"Icon for goto previous editor location.")),Mo("goto-next-location",l.Codicon.arrowDown,l.localize(2098,"Icon for goto next editor location.")),_.ThemeIcon.modify(l.Codicon.sync,"spin"),_.ThemeIcon.modify(l.Codicon.loading,"spin");function ZQ(o){const e=new l.DisposableStore,t=e.add(new l.Emitter),i=nO();return e.add(i.onDidChange(()=>t.fire())),o&&e.add(o.onDidProductIconThemeChange(()=>t.fire())),{dispose:()=>e.dispose(),onDidChange:t.event,getCSS(){const n=o?o.getProductIconTheme():new aO,s={},r=new Ry,a=new Ry;for(const c of i.getIcons()){const h=n.getIcon(c);if(!h)continue;const d=h.font,u=Yi`--vscode-icon-${Ap(c.id)}-font-family`,f=Yi`--vscode-icon-${Ap(c.id)}-content`;d?(s[d.id]=d.definition,a.push(Yi`${u}: ${yr(d.id)};`,Yi`${f}: ${yr(h.fontCharacter)};`),r.push(Yi`.codicon-${Ap(c.id)}:before { content: ${yr(h.fontCharacter)}; font-family: ${yr(d.id)}; }`)):(a.push(Yi`${f}: ${yr(h.fontCharacter)}; ${u}: 'codicon';`),r.push(Yi`.codicon-${Ap(c.id)}:before { content: ${yr(h.fontCharacter)}; }`))}for(const c in s){const h=s[c],d=h.weight?Yi`font-weight: ${nM(h.weight)};`:Yi``,u=h.style?Yi`font-style: ${nM(h.style)};`:Yi``,f=new Ry;for(const g of h.src)f.push(Yi`${Bs(g.location)} format(${yr(g.format)})`);r.push(Yi`@font-face { src: ${f.join(", ")}; font-family: ${yr(c)};${d}${u} font-display: block; }`)}return r.push(Yi`:root { ${a.join(" ")} }`),r.join(`
|
||
`)}}}class aO{getIcon(e){const t=nO();let i=e.defaults;for(;_.ThemeIcon.isThemeIcon(i);){const n=t.getIcon(i.id);if(!n)return;i=n.defaults}return i}}const Ao="vs",bh="vs-dark",gl="hc-black",ml="hc-light",lO=St.as(IE.ColorContribution),QQ=St.as(VI.ThemingContribution);class cO{constructor(e,t){this.semanticHighlighting=!1,this.themeData=t;const i=t.base;e.length>0?(I_(e)?this.id=e:this.id=i+" "+e,this.themeName=e):(this.id=i,this.themeName=i),this.colors=null,this.defaultColors=Object.create(null),this._tokenTheme=null}get base(){return this.themeData.base}notifyBaseUpdated(){this.themeData.inherit&&(this.colors=null,this._tokenTheme=null)}getColors(){if(!this.colors){const e=new Map;for(const t in this.themeData.colors)e.set(t,l.Color.fromHex(this.themeData.colors[t]));if(this.themeData.inherit){const t=u0(this.themeData.base);for(const i in t.colors)e.has(i)||e.set(i,l.Color.fromHex(t.colors[i]))}this.colors=e}return this.colors}getColor(e,t){const i=this.getColors().get(e);if(i)return i;if(t!==!1)return this.getDefault(e)}getDefault(e){let t=this.defaultColors[e];return t||(t=lO.resolveDefaultColor(e,this),this.defaultColors[e]=t,t)}defines(e){return this.getColors().has(e)}get type(){switch(this.base){case Ao:return Sn.LIGHT;case gl:return Sn.HIGH_CONTRAST_DARK;case ml:return Sn.HIGH_CONTRAST_LIGHT;default:return Sn.DARK}}get tokenTheme(){if(!this._tokenTheme){let e=[],t=[];if(this.themeData.inherit){const s=u0(this.themeData.base);e=s.rules,s.encodedTokensColors&&(t=s.encodedTokensColors)}const i=this.themeData.colors["editor.foreground"],n=this.themeData.colors["editor.background"];if(i||n){const s={token:""};i&&(s.foreground=i),n&&(s.background=n),e.push(s)}e=e.concat(this.themeData.rules),this.themeData.encodedTokensColors&&(t=this.themeData.encodedTokensColors),this._tokenTheme=L1.createFromRawTokenTheme(e,t)}return this._tokenTheme}getTokenStyleMetadata(e,t,i){const s=this.tokenTheme._match([e].concat(t).join(".")).metadata,r=Vi.getForeground(s),a=Vi.getFontStyle(s);return{foreground:r,italic:!!(a&1),bold:!!(a&2),underline:!!(a&4),strikethrough:!!(a&8)}}get tokenColorMap(){return[]}}function I_(o){return o===Ao||o===bh||o===gl||o===ml}function u0(o){switch(o){case Ao:return BQ;case bh:return zQ;case gl:return VQ;case ml:return UQ}}function T_(o){const e=u0(o);return new cO(o,e)}class XQ extends l.Disposable{constructor(){super(),this._onColorThemeChange=this._register(new l.Emitter),this.onDidColorThemeChange=this._onColorThemeChange.event,this._onProductIconThemeChange=this._register(new l.Emitter),this.onDidProductIconThemeChange=this._onProductIconThemeChange.event,this._environment=Object.create(null),this._builtInProductIconTheme=new aO,this._autoDetectHighContrast=!0,this._knownThemes=new Map,this._knownThemes.set(Ao,T_(Ao)),this._knownThemes.set(bh,T_(bh)),this._knownThemes.set(gl,T_(gl)),this._knownThemes.set(ml,T_(ml));const e=this._register(ZQ(this));this._codiconCSS=e.getCSS(),this._themeCSS="",this._allCSS=`${this._codiconCSS}
|
||
${this._themeCSS}`,this._globalStyleElement=null,this._styleElements=[],this._colorMapOverride=null,this.setTheme(Ao),this._onOSSchemeChanged(),this._register(e.onDidChange(()=>{this._codiconCSS=e.getCSS(),this._updateCSS()})),OD(Ae,"(forced-colors: active)",()=>{this._onOSSchemeChanged()})}registerEditorContainer(e){return Yf(e)?this._registerShadowDomContainer(e):this._registerRegularEditorContainer()}_registerRegularEditorContainer(){return this._globalStyleElement||(this._globalStyleElement=bn(void 0,e=>{e.className="monaco-colors",e.textContent=this._allCSS}),this._styleElements.push(this._globalStyleElement)),l.Disposable.None}_registerShadowDomContainer(e){const t=bn(e,i=>{i.className="monaco-colors",i.textContent=this._allCSS});return this._styleElements.push(t),{dispose:()=>{for(let i=0;i<this._styleElements.length;i++)if(this._styleElements[i]===t){this._styleElements.splice(i,1);return}}}}defineTheme(e,t){if(!/^[a-z0-9\-]+$/i.test(e))throw new Error("Illegal theme name!");if(!I_(t.base)&&!I_(e))throw new Error("Illegal theme base!");this._knownThemes.set(e,new cO(e,t)),I_(e)&&this._knownThemes.forEach(i=>{i.base===e&&i.notifyBaseUpdated()}),this._theme.themeName===e&&this.setTheme(e)}getColorTheme(){return this._theme}setColorMapOverride(e){this._colorMapOverride=e,this._updateThemeOrColorMap()}setTheme(e){let t;this._knownThemes.has(e)?t=this._knownThemes.get(e):t=this._knownThemes.get(Ao),this._updateActualTheme(t)}_updateActualTheme(e){!e||this._theme===e||(this._theme=e,this._updateThemeOrColorMap())}_onOSSchemeChanged(){if(this._autoDetectHighContrast){const e=Ae.matchMedia("(forced-colors: active)").matches;if(e!==pa(this._theme.type)){let t;rr(this._theme.type)?t=e?gl:bh:t=e?ml:Ao,this._updateActualTheme(this._knownThemes.get(t))}}}setAutoDetectHighContrast(e){this._autoDetectHighContrast=e,this._onOSSchemeChanged()}_updateThemeOrColorMap(){const e=[],t={},i={addRule:r=>{t[r]||(e.push(r),t[r]=!0)}};QQ.getThemingParticipants().forEach(r=>r(this._theme,i,this._environment));const n=[];for(const r of lO.getColors()){const a=this._theme.getColor(r.id,!0);a&&n.push(`${qC(r.id)}: ${a.toString()};`)}i.addRule(`.monaco-editor, .monaco-diff-editor, .monaco-component { ${n.join(`
|
||
`)} }`);const s=this._colorMapOverride||this._theme.tokenTheme.getColorMap();i.addRule(RK(s)),i.addRule(".monaco-editor, .monaco-diff-editor, .monaco-component { forced-color-adjust: none; }"),this._themeCSS=e.join(`
|
||
`),this._updateCSS(),l.TokenizationRegistry.setColorMap(s),this._onColorThemeChange.fire(this._theme)}_updateCSS(){this._allCSS=`${this._codiconCSS}
|
||
${this._themeCSS}`,this._styleElements.forEach(e=>e.textContent=this._allCSS)}getFileIconTheme(){return{hasFileIcons:!1,hasFolderIcons:!1,hidesExplorerArrows:!1}}getProductIconTheme(){return this._builtInProductIconTheme}}class JQ{getParserClass(){throw new Error("not implemented in StandaloneTreeSitterLibraryService")}supportsLanguage(e,t){return!1}getLanguage(e,t,i){}getInjectionQueries(e,t){return null}getHighlightingQueries(e,t){return null}}var Oo=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},Nt=function(o,e){return function(t,i){e(t,i,o)}};class WQ{constructor(e){this.disposed=!1,this.model=e,this._onWillDispose=new l.Emitter}get textEditorModel(){return this.model}dispose(){this.disposed=!0,this._onWillDispose.fire()}}let f0=class{constructor(e){this.modelService=e}createModelReference(e){const t=this.modelService.getModel(e);return t?Promise.resolve(new l.ImmortalReference(new WQ(t))):Promise.reject(new Error("Model not found"))}};f0=Oo([Nt(0,ri)],f0);const Eb=class Eb{show(){return Eb.NULL_PROGRESS_RUNNER}async showWhile(e,t){await e}};Eb.NULL_PROGRESS_RUNNER={done:()=>{},total:()=>{},worked:()=>{}};let g0=Eb;class HQ{withProgress(e,t,i){return t({report:()=>{}})}}class eX{constructor(){this.isExtensionDevelopment=!1,this.isBuilt=!1}}class tX{async confirm(e){return{confirmed:this.doConfirm(e.message,e.detail),checkboxChecked:!1}}doConfirm(e,t){let i=e;return t&&(i=i+`
|
||
|
||
`+t),Ae.confirm(i)}async prompt(e){let t;if(this.doConfirm(e.message,e.detail)){const n=[...e.buttons??[]];e.cancelButton&&typeof e.cancelButton!="string"&&typeof e.cancelButton!="boolean"&&n.push(e.cancelButton),t=await n[0]?.run({checkboxChecked:!1})}return{result:t}}async error(e,t){await this.prompt({type:rt.Error,message:e,detail:t})}}const Df=class Df{info(e){return this.notify({severity:rt.Info,message:e})}warn(e){return this.notify({severity:rt.Warning,message:e})}error(e){return this.notify({severity:rt.Error,message:e})}notify(e){switch(e.severity){case rt.Error:console.error(e.message);break;case rt.Warning:console.warn(e.message);break;default:console.log(e.message);break}return Df.NO_OP}prompt(e,t,i,n){return Df.NO_OP}status(e,t){return{close:()=>{}}}};Df.NO_OP=new D4;let m0=Df,p0=class{constructor(e){this._onWillExecuteCommand=new l.Emitter,this._onDidExecuteCommand=new l.Emitter,this.onDidExecuteCommand=this._onDidExecuteCommand.event,this._instantiationService=e}executeCommand(e,...t){const i=Ut.getCommand(e);if(!i)return Promise.reject(new Error(`command '${e}' not found`));try{this._onWillExecuteCommand.fire({commandId:e,args:t});const n=this._instantiationService.invokeFunction.apply(this._instantiationService,[i.handler,...t]);return this._onDidExecuteCommand.fire({commandId:e,args:t}),Promise.resolve(n)}catch(n){return Promise.reject(n)}}};p0=Oo([Nt(0,me)],p0);let Ch=class extends qq{constructor(e,t,i,n,s,r){super(e,t,i,n,s),this._cachedResolver=null,this._dynamicKeybindings=[],this._domNodeListeners=[];const a=g=>{const m=new l.DisposableStore;m.add(R(g,F.KEY_DOWN,p=>{const b=new Be(p);this._dispatch(b,b.target)&&(b.preventDefault(),b.stopPropagation())})),m.add(R(g,F.KEY_UP,p=>{const b=new Be(p);this._singleModifierDispatch(b,b.target)&&b.preventDefault()})),this._domNodeListeners.push(new iX(g,m))},c=g=>{for(let m=0;m<this._domNodeListeners.length;m++){const p=this._domNodeListeners[m];p.domNode===g&&(this._domNodeListeners.splice(m,1),p.dispose())}},h=g=>{g.getOption(70)||a(g.getContainerDomNode())},d=g=>{g.getOption(70)||c(g.getContainerDomNode())};this._register(r.onCodeEditorAdd(h)),this._register(r.onCodeEditorRemove(d)),r.listCodeEditors().forEach(h);const u=g=>{a(g.getContainerDomNode())},f=g=>{c(g.getContainerDomNode())};this._register(r.onDiffEditorAdd(u)),this._register(r.onDiffEditorRemove(f)),r.listDiffEditors().forEach(u)}addDynamicKeybinding(e,t,i,n){return l.combinedDisposable(Ut.registerCommand(e,i),this.addDynamicKeybindings([{keybinding:t,command:e,when:n}]))}addDynamicKeybindings(e){const t=e.map(i=>({keybinding:jb(i.keybinding,l.OS),command:i.command??null,commandArgs:i.commandArgs,when:i.when,weight1:1e3,weight2:0,extensionId:null,isBuiltinExtension:!1}));return this._dynamicKeybindings=this._dynamicKeybindings.concat(t),this.updateResolver(),l.toDisposable(()=>{for(let i=0;i<this._dynamicKeybindings.length;i++)if(this._dynamicKeybindings[i]===t[0]){this._dynamicKeybindings.splice(i,t.length),this.updateResolver();return}})}updateResolver(){this._cachedResolver=null,this._onDidUpdateKeybindings.fire()}_getResolver(){if(!this._cachedResolver){const e=this._toNormalizedKeybindingItems(Zn.getDefaultKeybindings(),!0),t=this._toNormalizedKeybindingItems(this._dynamicKeybindings,!1);this._cachedResolver=new nh(e,t,i=>this._log(i))}return this._cachedResolver}_documentHasFocus(){return Ae.document.hasFocus()}_toNormalizedKeybindingItems(e,t){const i=[];let n=0;for(const s of e){const r=s.when||void 0,a=s.keybinding;if(!a)i[n++]=new MM(void 0,s.command,s.commandArgs,r,t,null,!1);else{const c=Qu.resolveKeybinding(a,l.OS);for(const h of c)i[n++]=new MM(h,s.command,s.commandArgs,r,t,null,!1)}}return i}resolveKeyboardEvent(e){const t=new Yh(e.ctrlKey,e.shiftKey,e.altKey,e.metaKey,e.keyCode);return new Qu([t],l.OS)}};Ch=Oo([Nt(0,be),Nt(1,zi),Nt(2,Xn),Nt(3,yn),Nt(4,ei),Nt(5,pt)],Ch);class iX extends l.Disposable{constructor(e,t){super(),this.domNode=e,this._register(t)}}function hO(o){return!!o&&typeof o=="object"&&(!o.overrideIdentifier||typeof o.overrideIdentifier=="string")&&(!o.resource||o.resource instanceof l.URI)}let N_=class{constructor(e){this.logService=e,this._onDidChangeConfiguration=new l.Emitter,this.onDidChangeConfiguration=this._onDidChangeConfiguration.event;const t=new d9(e);this._configuration=new Np(t.reload(),Tt.createEmptyModel(e),Tt.createEmptyModel(e),Tt.createEmptyModel(e),Tt.createEmptyModel(e),Tt.createEmptyModel(e),new l.ResourceMap,Tt.createEmptyModel(e),new l.ResourceMap,e),t.dispose()}getValue(e,t){const i=typeof e=="string"?e:void 0,n=hO(e)?e:hO(t)?t:{};return this._configuration.getValue(i,n,void 0)}updateValues(e){const t={data:this._configuration.toData()},i=[];for(const n of e){const[s,r]=n;this.getValue(s)!==r&&(this._configuration.updateValue(s,r),i.push(s))}if(i.length>0){const n=new h9({keys:i,overrides:[]},t,this._configuration,void 0,this.logService);n.source=8,this._onDidChangeConfiguration.fire(n)}return Promise.resolve()}updateValue(e,t,i,n){return this.updateValues([[e,t]])}inspect(e,t={}){return this._configuration.inspect(e,t,void 0)}};N_=Oo([Nt(0,ei)],N_);let _0=class extends l.Disposable{constructor(e,t,i){super(),this.configurationService=e,this.modelService=t,this.languageService=i,this._onDidChangeConfiguration=this._register(new l.Emitter),this._register(this.configurationService.onDidChangeConfiguration(n=>{this._onDidChangeConfiguration.fire({affectedKeys:n.affectedKeys,affectsConfiguration:(s,r)=>n.affectsConfiguration(r)})}))}getValue(e,t,i){const n=l.Position.isIPosition(t)?t:null,s=n?typeof i=="string"?i:void 0:typeof t=="string"?t:void 0,r=e?this.getLanguage(e,n):void 0;return typeof s>"u"?this.configurationService.getValue({resource:e,overrideIdentifier:r}):this.configurationService.getValue(s,{resource:e,overrideIdentifier:r})}getLanguage(e,t){const i=this.modelService.getModel(e);return i?t?i.getLanguageIdAtPosition(t.lineNumber,t.column):i.getLanguageId():this.languageService.guessLanguageIdByFilepathOrFirstLine(e)}};_0=Oo([Nt(0,Ge),Nt(1,ri),Nt(2,yt)],_0);let b0=class{constructor(e){this.configurationService=e}getEOL(e,t){const i=this.configurationService.getValue("files.eol",{overrideIdentifier:t,resource:e});return i&&typeof i=="string"&&i!=="auto"?i:l.isLinux||l.isMacintosh?`
|
||
`:`\r
|
||
`}};b0=Oo([Nt(0,Ge)],b0);class nX{publicLog2(){}}const xf=class xf{constructor(){const e=l.URI.from({scheme:xf.SCHEME,authority:"model",path:"/"});this.workspace={id:LA,folders:[new vZ({uri:e,name:"",index:0})]}}getWorkspace(){return this.workspace}getWorkspaceFolder(e){return e&&e.scheme===xf.SCHEME?this.workspace.folders[0]:null}};xf.SCHEME="inmemory";let C0=xf;function R_(o,e,t){if(!e||!(o instanceof N_))return;const i=[];Object.keys(e).forEach(n=>{LZ(n)&&i.push([`editor.${n}`,e[n]]),t&&DZ(n)&&i.push([`diffEditor.${n}`,e[n]])}),i.length>0&&o.updateValues(i)}let v0=class{constructor(e){this._modelService=e}hasPreviewHandler(){return!1}async apply(e,t){const i=Array.isArray(e)?e:EL.convert(e),n=new Map;for(const a of i){if(!(a instanceof Er))throw new Error("bad edit - only text edits are supported");const c=this._modelService.getModel(a.resource);if(!c)throw new Error("bad edit - model not found");if(typeof a.versionId=="number"&&c.getVersionId()!==a.versionId)throw new Error("bad state - model changed in the meantime");let h=n.get(c);h||(h=[],n.set(c,h)),h.push(p_.replaceMove(l.Range.lift(a.textEdit.range),a.textEdit.text))}let s=0,r=0;for(const[a,c]of n)a.pushStackElement(),a.pushEditOperations([],c,()=>[]),a.pushStackElement(),r+=1,s+=c.length;return{ariaSummary:l.format(zL.bulkEditServiceSummary,s,r),isApplied:s>0}}};v0=Oo([Nt(0,ri)],v0);class sX{getUriLabel(e,t){return e.scheme==="file"?e.fsPath:e.path}getUriBasenameLabel(e){return dg(e)}}let w0=class extends zq{constructor(e,t){super(e),this._codeEditorService=t}showContextView(e,t,i){if(!t){const n=this._codeEditorService.getFocusedCodeEditor()||this._codeEditorService.getActiveCodeEditor();n&&(t=n.getContainerDomNode())}return super.showContextView(e,t,i)}};w0=Oo([Nt(0,Os),Nt(1,pt)],w0);class oX{constructor(){this._neverEmitter=new l.Emitter,this.onDidChangeTrust=this._neverEmitter.event}isWorkspaceTrusted(){return!0}}class rX extends OL{constructor(){super()}}class aX extends uZ{constructor(){super(new _B)}}let S0=class extends Zy{constructor(e,t,i,n,s,r){super(e,t,i,n,s,r),this.configure({blockMouse:!1})}};S0=Oo([Nt(0,Xn),Nt(1,yn),Nt(2,Fc),Nt(3,xt),Nt(4,Zo),Nt(5,be)],S0);class lX{async playSignal(e,t){}}class cX{constructor(){this.onDidChangeDefaultAccount=l.Event.None}async getDefaultAccount(){return null}}fe(fd,FQ,0),fe(ei,aX,0),fe(Ge,N_,0),fe(TC,_0,0),fe(cE,b0,0),fe(wA,C0,0),fe(AM,sX,0),fe(Xn,nX,0),fe(ey,tX,0),fe(ly,eX,0),fe(yn,m0,0),fe(xr,al,0),fe(yt,rX,0),fe(Tn,XQ,0),fe(ri,kL,0),fe($C,PL,0),fe(be,Ny,0),fe(CA,HQ,0),fe(d_,g0,0),fe(Qa,x7,0),fe(xA,v0,0),fe(DA,oX,0),fe(ql,f0,0),fe(Ui,Sy,0),fe(ts,iZ,0),fe(zi,p0,0),fe(xt,Ch,0),fe(Ps,c0,0),fe(Fc,w0,0),fe(Ou,RL,0),fe(Ip,Ey,0),fe(nn,S0,0),fe(Zo,yy,0),fe(Xa,lX,0),fe(Yw,JQ,0),fe(kx,wB,0),fe(xM,Vq,0),fe(EM,cX,0),fe(EA,SZ,0),fe(Na,vA,0);var J;(function(o){const e=new Oc;for(const[c,h]of Jx())e.set(c,h);const t=new jp(e,!0);e.set(me,t);function i(c){n||r({});const h=e.get(c);if(!h)throw new Error("Missing service "+c);return h instanceof gs?t.invokeFunction(d=>d.get(c)):h}o.get=i;let n=!1;const s=new l.Emitter;function r(c){if(n)return t;n=!0;for(const[d,u]of Jx())e.get(d)||e.set(d,u);for(const d in c)if(c.hasOwnProperty(d)){const u=le(d);e.get(u)instanceof gs&&e.set(u,c[d])}const h=EZ();for(const d of h)try{t.createInstance(d)}catch(u){l.onUnexpectedError(u)}return s.fire(),t}o.initialize=r;function a(c){if(n)return c();const h=new l.DisposableStore,d=h.add(s.event(()=>{d.dispose(),h.add(c())}));return h}o.withServices=a})(J||(J={}));function Po(o,e){return o}function hX(o){return Zr(o)}function dX(o,e,t,i=_.DebugLocation.ofCaller()){return An({debugName:()=>`Configuration Key "${o}"`},n=>t.onDidChangeConfiguration(s=>{s.affectsConfiguration(o)&&n(s)}),()=>t.getValue(o)??e,i)}function qs(o,e,t,i=_.DebugLocation.ofCaller()){const n=o.bindTo(e),s=new l.DisposableStore;return fn({debugName:()=>`Set Context Key "${o.key}"`},r=>{const a=t(r);return n.set(a),a},i).recomputeInitiallyAndOnChange(s),s}class vh{static capture(e){if(e.getScrollTop()===0||e.hasPendingScrollAnimation())return new vh(e.getScrollTop(),e.getContentHeight(),null,0,null);let t=null,i=0;const n=e.getVisibleRanges();if(n.length>0){t=n[0].getStartPosition();const s=e.getTopForPosition(t.lineNumber,t.column);i=e.getScrollTop()-s}return new vh(e.getScrollTop(),e.getContentHeight(),t,i,e.getPosition())}constructor(e,t,i,n,s){this._initialScrollTop=e,this._initialContentHeight=t,this._visiblePosition=i,this._visiblePositionScrollDelta=n,this._cursorPosition=s}restore(e){if(!(this._initialContentHeight===e.getContentHeight()&&this._initialScrollTop===e.getScrollTop())&&this._visiblePosition){const t=e.getTopForPosition(this._visiblePosition.lineNumber,this._visiblePosition.column);e.setScrollTop(t+this._visiblePositionScrollDelta)}}restoreRelativeVerticalPositionOfCursor(e){if(this._initialContentHeight===e.getContentHeight()&&this._initialScrollTop===e.getScrollTop())return;const t=e.getPosition();if(!this._cursorPosition||!t)return;const i=e.getTopForLineNumber(t.lineNumber)-e.getTopForLineNumber(this._cursorPosition.lineNumber);e.setScrollTop(e.getScrollTop()+i,1)}}function uX(o,e,t,i){if(o.length===0)return e;if(e.length===0)return o;const n=[];let s=0,r=0;for(;s<o.length&&r<e.length;){const a=o[s],c=e[r],h=t(a),d=t(c);h<d?(n.push(a),s++):h>d?(n.push(c),r++):(n.push(i(a,c)),s++,r++)}for(;s<o.length;)n.push(o[s]),s++;for(;r<e.length;)n.push(e[r]),r++;return n}function M_(o,e){const t=new l.DisposableStore,i=o.createDecorationsCollection();return t.add($f({debugName:()=>`Apply decorations from ${e.debugName}`},n=>{const s=e.read(n);i.set(s)})),t.add({dispose:()=>{i.clear()}}),t}function wh(o,e){return o.appendChild(e),l.toDisposable(()=>{e.remove()})}function fX(o,e){return o.prepend(e),l.toDisposable(()=>{e.remove()})}class dO extends l.Disposable{get width(){return this._width}get height(){return this._height}get automaticLayout(){return this._automaticLayout}constructor(e,t){super(),this._automaticLayout=!1,this.elementSizeObserver=this._register(new SE(e,t)),this._width=W(this,this.elementSizeObserver.getWidth()),this._height=W(this,this.elementSizeObserver.getHeight()),this._register(this.elementSizeObserver.onDidChange(i=>nt(n=>{this._width.set(this.elementSizeObserver.getWidth(),n),this._height.set(this.elementSizeObserver.getHeight(),n)})))}observe(e){this.elementSizeObserver.observe(e)}setAutomaticLayout(e){this._automaticLayout=e,e?this.elementSizeObserver.startObserving():this.elementSizeObserver.stopObserving()}}function uO(o,e,t){let i=e.get(),n=i,s=i;const r=W("animatedValue",i);let a=-1;const c=300;let h;t.add(Gl({changeTracker:{createChangeSummary:()=>({animate:!1}),handleChange:(u,f)=>(u.didChange(e)&&(f.animate=f.animate||u.change),!0)}},(u,f)=>{h!==void 0&&(o.cancelAnimationFrame(h),h=void 0),n=s,i=e.read(u),n===i?a=Date.now()-c:a=Date.now()-(f.animate?0:c),d()}));function d(){const u=Date.now()-a;s=Math.floor(gX(u,n,i-n,c)),u<c?h=o.requestAnimationFrame(d):s=i,r.set(s,void 0)}return r}function gX(o,e,t,i){return o===i?e+t:t*(-Math.pow(2,-10*o/i)+1)+e}class y0 extends l.Disposable{constructor(e,t,i){super(),this._register(new L0(e,i)),this._register(Nr(i,{height:t.actualHeight,top:t.actualTop}))}}class Sh{get afterLineNumber(){return this._afterLineNumber.get()}constructor(e,t){this._afterLineNumber=e,this.heightInPx=t,this.domNode=document.createElement("div"),this._actualTop=W(this,void 0),this._actualHeight=W(this,void 0),this.actualTop=this._actualTop,this.actualHeight=this._actualHeight,this.showInHiddenAreas=!0,this.onChange=this._afterLineNumber,this.onDomNodeTop=i=>{this._actualTop.set(i,void 0)},this.onComputedHeight=i=>{this._actualHeight.set(i,void 0)}}}const Ib=class Ib{constructor(e,t){this._editor=e,this._domElement=t,this._overlayWidgetId=`managedOverlayWidget-${Ib._counter++}`,this._overlayWidget={getId:()=>this._overlayWidgetId,getDomNode:()=>this._domElement,getPosition:()=>null},this._editor.addOverlayWidget(this._overlayWidget)}dispose(){this._editor.removeOverlayWidget(this._overlayWidget)}};Ib._counter=0;let L0=Ib;function Nr(o,e){return he(t=>{for(let[i,n]of Object.entries(e))n&&typeof n=="object"&&"read"in n&&(n=n.read(t)),typeof n=="number"&&(n=`${n}px`),i=i.replace(/[A-Z]/g,s=>"-"+s.toLowerCase()),o.style[i]=n})}function A_(o,e,t,i){const n=new l.DisposableStore,s=[];return n.add(Kn((r,a)=>{const c=e.read(r),h=new Map,d=new Map;t&&t(!0),o.changeViewZones(u=>{for(const f of s)u.removeZone(f),i?.delete(f);s.length=0;for(const f of c){const g=u.addZone(f);f.setZoneId&&f.setZoneId(g),s.push(g),i?.add(g),h.set(f,g)}}),t&&t(!1),a.add(Gl({changeTracker:{createChangeSummary(){return{zoneIds:[]}},handleChange(u,f){const g=d.get(u.changedObservable);return g!==void 0&&f.zoneIds.push(g),!0}}},(u,f)=>{for(const g of c)g.onChange&&(d.set(g.onChange,h.get(g)),g.onChange.read(u));t&&t(!0),o.changeViewZones(g=>{for(const m of f.zoneIds)g.layoutZone(m)}),t&&t(!1)}))})),n.add({dispose(){t&&t(!0),o.changeViewZones(r=>{for(const a of s)r.removeZone(a)}),i?.clear(),t&&t(!1)}}),n}class mX extends l.CancellationTokenSource{dispose(){super.dispose(!0)}}function fO(o,e){const t=l.findLast(e,n=>n.original.startLineNumber<=o.lineNumber);if(!t)return l.Range.fromPositions(o);if(t.original.endLineNumberExclusive<=o.lineNumber){const n=o.lineNumber-t.original.endLineNumberExclusive+t.modified.endLineNumberExclusive;return l.Range.fromPositions(new l.Position(n,o.column))}if(!t.innerChanges)return l.Range.fromPositions(new l.Position(t.modified.startLineNumber,1));const i=l.findLast(t.innerChanges,n=>n.originalRange.getStartPosition().isBeforeOrEqual(o));if(!i){const n=o.lineNumber-t.original.startLineNumber+t.modified.startLineNumber;return l.Range.fromPositions(new l.Position(n,o.column))}if(i.originalRange.containsPosition(o))return i.modifiedRange;{const n=pX(i.originalRange.getEndPosition(),o);return l.Range.fromPositions(n.addToPosition(i.modifiedRange.getEndPosition()))}}function pX(o,e){return o.lineNumber===e.lineNumber?new l.TextLength(0,e.column-o.column):new l.TextLength(e.lineNumber-o.lineNumber,e.column-1)}function _X(o,e){let t;return o.filter(i=>{const n=e(i,t);return t=i,n})}class O_{static create(e,t=void 0){return new gO(e,e,t)}static createWithDisposable(e,t,i=void 0){const n=new l.DisposableStore;return n.add(t),n.add(e),new gO(e,n,i)}}class gO extends O_{constructor(e,t,i){super(),this.object=e,this._disposable=t,this._debugOwner=i,this._refCount=1,this._isDisposed=!1,this._owners=[],i&&this._addOwner(i)}_addOwner(e){e&&this._owners.push(e)}createNewRef(e){return this._refCount++,e&&this._addOwner(e),new bX(this,e)}dispose(){this._isDisposed||(this._isDisposed=!0,this._decreaseRefCount(this._debugOwner))}_decreaseRefCount(e){if(this._refCount--,this._refCount===0&&this._disposable.dispose(),e){const t=this._owners.indexOf(e);t!==-1&&this._owners.splice(t,1)}}}class bX extends O_{constructor(e,t){super(),this._base=e,this._debugOwner=t,this._isDisposed=!1}get object(){return this._base.object}createNewRef(e){return this._base.createNewRef(e)}dispose(){this._isDisposed||(this._isDisposed=!0,this._base._decreaseRefCount(this._debugOwner))}}var D0=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},x0=function(o,e){return function(t,i){e(t,i,o)}};const CX=Mo("diff-review-insert",l.Codicon.add,l.localize(113,"Icon for 'Insert' in accessible diff viewer.")),vX=Mo("diff-review-remove",l.Codicon.remove,l.localize(114,"Icon for 'Remove' in accessible diff viewer.")),wX=Mo("diff-review-close",l.Codicon.close,l.localize(115,"Icon for 'Close' in accessible diff viewer."));let pl=(kh=class extends l.Disposable{constructor(e,t,i,n,s,r,a,c,h){super(),this._parentNode=e,this._visible=t,this._setVisible=i,this._canClose=n,this._width=s,this._height=r,this._diffs=a,this._models=c,this._instantiationService=h,this._state=Z(this,d=>{const u=this._visible.read(d);if(this._parentNode.style.visibility=u?"visible":"hidden",!u)return null;const f=d.store.add(this._instantiationService.createInstance(E0,this._diffs,this._models,this._setVisible,this._canClose)),g=d.store.add(this._instantiationService.createInstance(I0,this._parentNode,f,this._width,this._height,this._models));return{model:f,view:g}}).recomputeInitiallyAndOnChange(this._store)}next(){nt(e=>{const t=this._visible.get();this._setVisible(!0,e),t&&this._state.get().model.nextGroup(e)})}prev(){nt(e=>{this._setVisible(!0,e),this._state.get().model.previousGroup(e)})}close(){nt(e=>{this._setVisible(!1,e)})}},kh._ttPolicy=lo("diffReview",{createHTML:e=>e}),kh);pl=D0([x0(8,me)],pl);let E0=class extends l.Disposable{constructor(e,t,i,n,s){super(),this._diffs=e,this._models=t,this._setVisible=i,this.canClose=n,this._accessibilitySignalService=s,this._groups=W(this,[]),this._currentGroupIdx=W(this,0),this._currentElementIdx=W(this,0),this.groups=this._groups,this.currentGroup=this._currentGroupIdx.map((r,a)=>this._groups.read(a)[r]),this.currentGroupIndex=this._currentGroupIdx,this.currentElement=this._currentElementIdx.map((r,a)=>this.currentGroup.read(a)?.lines[r]),this._register(he(r=>{const a=this._diffs.read(r);if(!a){this._groups.set([],void 0);return}const c=SX(a,this._models.getOriginalModel().getLineCount(),this._models.getModifiedModel().getLineCount());nt(h=>{const d=this._models.getModifiedPosition();if(d){const u=c.findIndex(f=>d?.lineNumber<f.range.modified.endLineNumberExclusive);u!==-1&&this._currentGroupIdx.set(u,h)}this._groups.set(c,h)})})),this._register(he(r=>{const a=this.currentElement.read(r);a?.type===Li.Deleted?this._accessibilitySignalService.playSignal(xn.diffLineDeleted,{source:"accessibleDiffViewer.currentElementChanged"}):a?.type===Li.Added&&this._accessibilitySignalService.playSignal(xn.diffLineInserted,{source:"accessibleDiffViewer.currentElementChanged"})})),this._register(he(r=>{const a=this.currentElement.read(r);if(a&&a.type!==Li.Header){const c=a.modifiedLineNumber??a.diff.modified.startLineNumber;this._models.modifiedSetSelection(l.Range.fromPositions(new l.Position(c,1)))}}))}_goToGroupDelta(e,t){const i=this.groups.get();!i||i.length<=1||Uf(t,n=>{this._currentGroupIdx.set(l.OffsetRange.ofLength(i.length).clipCyclic(this._currentGroupIdx.get()+e),n),this._currentElementIdx.set(0,n)})}nextGroup(e){this._goToGroupDelta(1,e)}previousGroup(e){this._goToGroupDelta(-1,e)}_goToLineDelta(e){const t=this.currentGroup.get();!t||t.lines.length<=1||nt(i=>{this._currentElementIdx.set(l.OffsetRange.ofLength(t.lines.length).clip(this._currentElementIdx.get()+e),i)})}goToNextLine(){this._goToLineDelta(1)}goToPreviousLine(){this._goToLineDelta(-1)}goToLine(e){const t=this.currentGroup.get();if(!t)return;const i=t.lines.indexOf(e);i!==-1&&nt(n=>{this._currentElementIdx.set(i,n)})}revealCurrentElementInEditor(){if(!this.canClose.get())return;this._setVisible(!1,void 0);const e=this.currentElement.get();e&&(e.type===Li.Deleted?this._models.originalReveal(l.Range.fromPositions(new l.Position(e.originalLineNumber,1))):this._models.modifiedReveal(e.type!==Li.Header?l.Range.fromPositions(new l.Position(e.modifiedLineNumber,1)):void 0))}close(){this.canClose.get()&&(this._setVisible(!1,void 0),this._models.modifiedFocus())}};E0=D0([x0(4,Xa)],E0);const hf=3;function SX(o,e,t){const i=[];for(const n of l.groupAdjacentBy(o,(s,r)=>r.modified.startLineNumber-s.modified.endLineNumberExclusive<2*hf)){const s=[];s.push(new LX);const r=new l.LineRange(Math.max(1,n[0].original.startLineNumber-hf),Math.min(n[n.length-1].original.endLineNumberExclusive+hf,e+1)),a=new l.LineRange(Math.max(1,n[0].modified.startLineNumber-hf),Math.min(n[n.length-1].modified.endLineNumberExclusive+hf,t+1));l.forEachAdjacent(n,(d,u)=>{const f=new l.LineRange(d?d.original.endLineNumberExclusive:r.startLineNumber,u?u.original.startLineNumber:r.endLineNumberExclusive),g=new l.LineRange(d?d.modified.endLineNumberExclusive:a.startLineNumber,u?u.modified.startLineNumber:a.endLineNumberExclusive);f.forEach(m=>{s.push(new EX(m,g.startLineNumber+(m-f.startLineNumber)))}),u&&(u.original.forEach(m=>{s.push(new DX(u,m))}),u.modified.forEach(m=>{s.push(new xX(u,m))}))});const c=n[0].modified.join(n[n.length-1].modified),h=n[0].original.join(n[n.length-1].original);i.push(new yX(new l.LineRangeMapping(c,h),s))}return i}var Li;(function(o){o[o.Header=0]="Header",o[o.Unchanged=1]="Unchanged",o[o.Deleted=2]="Deleted",o[o.Added=3]="Added"})(Li||(Li={}));class yX{constructor(e,t){this.range=e,this.lines=t}}class LX{constructor(){this.type=Li.Header}}class DX{constructor(e,t){this.diff=e,this.originalLineNumber=t,this.type=Li.Deleted,this.modifiedLineNumber=void 0}}class xX{constructor(e,t){this.diff=e,this.modifiedLineNumber=t,this.type=Li.Added,this.originalLineNumber=void 0}}class EX{constructor(e,t){this.originalLineNumber=e,this.modifiedLineNumber=t,this.type=Li.Unchanged}}let I0=class extends l.Disposable{constructor(e,t,i,n,s,r){super(),this._element=e,this._model=t,this._width=i,this._height=n,this._models=s,this._languageService=r,this.domNode=this._element,this.domNode.className="monaco-component diff-review monaco-editor-background";const a=document.createElement("div");a.className="diff-review-actions",this._actionBar=this._register(new el(a)),this._register(he(c=>{this._actionBar.clear(),this._model.canClose.read(c)&&this._actionBar.push(Yo({id:"diffreview.close",label:l.localize(116,"Close"),class:"close-diff-review "+_.ThemeIcon.asClassName(wX),enabled:!0,run:async()=>t.close()}),{label:!1,icon:!0})})),this._content=document.createElement("div"),this._content.className="diff-review-content",this._content.setAttribute("role","code"),this._scrollbar=this._register(new Jg(this._content,{})),oi(this.domNode,this._scrollbar.getDomNode(),a),this._register(he(c=>{this._height.read(c),this._width.read(c),this._scrollbar.scanDomNode()})),this._register(l.toDisposable(()=>{oi(this.domNode)})),this._register(Nr(this.domNode,{width:this._width,height:this._height})),this._register(Nr(this._content,{width:this._width,height:this._height})),this._register(Kn((c,h)=>{this._model.currentGroup.read(c),this._render(h)})),this._register(At(this.domNode,"keydown",c=>{(c.equals(18)||c.equals(2066)||c.equals(530))&&(c.preventDefault(),this._model.goToNextLine()),(c.equals(16)||c.equals(2064)||c.equals(528))&&(c.preventDefault(),this._model.goToPreviousLine()),(c.equals(9)||c.equals(2057)||c.equals(521)||c.equals(1033))&&(c.preventDefault(),this._model.close()),(c.equals(10)||c.equals(3))&&(c.preventDefault(),this._model.revealCurrentElementInEditor())}))}_render(e){const t=this._models.getOriginalOptions(),i=this._models.getModifiedOptions(),n=document.createElement("div");n.className="diff-review-table",n.setAttribute("role","list"),n.setAttribute("aria-label",l.localize(117,"Accessible Diff Viewer. Use arrow up and down to navigate.")),Ot(n,i.get(59)),oi(this._content,n);const s=this._models.getOriginalModel(),r=this._models.getModifiedModel();if(!s||!r)return;const a=s.getOptions(),c=r.getOptions(),h=i.get(75),d=this._model.currentGroup.get();for(const u of d?.lines||[]){if(!d)break;let f;if(u.type===Li.Header){const m=document.createElement("div");m.className="diff-review-row",m.setAttribute("role","listitem");const p=d.range,b=this._model.currentGroupIndex.get(),v=this._model.groups.get().length,C=D=>D===0?l.localize(118,"no lines changed"):D===1?l.localize(119,"1 line changed"):l.localize(120,"{0} lines changed",D),w=C(p.original.length),S=C(p.modified.length);m.setAttribute("aria-label",l.localize(121,"Difference {0} of {1}: original line {2}, {3}, modified line {4}, {5}",b+1,v,p.original.startLineNumber,w,p.modified.startLineNumber,S));const L=document.createElement("div");L.className="diff-review-cell diff-review-summary",L.appendChild(document.createTextNode(`${b+1}/${v}: @@ -${p.original.startLineNumber},${p.original.length} +${p.modified.startLineNumber},${p.modified.length} @@`)),m.appendChild(L),f=m}else f=this._createRow(u,h,this._width.get(),t,s,a,i,r,c);n.appendChild(f);const g=Z(m=>this._model.currentElement.read(m)===u);e.add(he(m=>{const p=g.read(m);f.tabIndex=p?0:-1,p&&f.focus()})),e.add(R(f,"focus",()=>{this._model.goToLine(u)}))}this._scrollbar.scanDomNode()}_createRow(e,t,i,n,s,r,a,c,h){const d=n.get(165),u=d.glyphMarginWidth+d.lineNumbersWidth,f=a.get(165),g=10+f.glyphMarginWidth+f.lineNumbersWidth;let m="diff-review-row",p="";const b="diff-review-spacer";let v=null;switch(e.type){case Li.Added:m="diff-review-row line-insert",p=" char-insert",v=CX;break;case Li.Deleted:m="diff-review-row line-delete",p=" char-delete",v=vX;break}const C=document.createElement("div");C.style.minWidth=i+"px",C.className=m,C.setAttribute("role","listitem"),C.ariaLevel="";const w=document.createElement("div");w.className="diff-review-cell",w.style.height=`${t}px`,C.appendChild(w);const S=document.createElement("span");S.style.width=u+"px",S.style.minWidth=u+"px",S.className="diff-review-line-number"+p,e.originalLineNumber!==void 0?S.appendChild(document.createTextNode(String(e.originalLineNumber))):S.innerText=" ",w.appendChild(S);const L=document.createElement("span");L.style.width=g+"px",L.style.minWidth=g+"px",L.style.paddingRight="10px",L.className="diff-review-line-number"+p,e.modifiedLineNumber!==void 0?L.appendChild(document.createTextNode(String(e.modifiedLineNumber))):L.innerText=" ",w.appendChild(L);const D=document.createElement("span");if(D.className=b,v){const T=document.createElement("span");T.className=_.ThemeIcon.asClassName(v),T.innerText=" ",D.appendChild(T)}else D.innerText=" ";w.appendChild(D);let x;if(e.modifiedLineNumber!==void 0){let T=this._getLineHtml(c,a,h.tabSize,e.modifiedLineNumber,this._languageService.languageIdCodec);pl._ttPolicy&&(T=pl._ttPolicy.createHTML(T)),w.insertAdjacentHTML("beforeend",T),x=c.getLineContent(e.modifiedLineNumber)}else{let T=this._getLineHtml(s,n,r.tabSize,e.originalLineNumber,this._languageService.languageIdCodec);pl._ttPolicy&&(T=pl._ttPolicy.createHTML(T)),w.insertAdjacentHTML("beforeend",T),x=s.getLineContent(e.originalLineNumber)}x.length===0&&(x=l.localize(122,"blank"));let I="";switch(e.type){case Li.Unchanged:e.originalLineNumber===e.modifiedLineNumber?I=l.localize(123,"{0} unchanged line {1}",x,e.originalLineNumber):I=l.localize(124,"{0} original line {1} modified line {2}",x,e.originalLineNumber,e.modifiedLineNumber);break;case Li.Added:I=l.localize(125,"+ {0} modified line {1}",x,e.modifiedLineNumber);break;case Li.Deleted:I=l.localize(126,"- {0} original line {1}",x,e.originalLineNumber);break}return C.setAttribute("aria-label",I),C}_getLineHtml(e,t,i,n,s){const r=e.getLineContent(n),a=t.get(59),c=t.get(117).verticalScrollbarSize,h=_t.createEmpty(r,s),d=Wi.isBasicASCII(r,e.mightContainNonBasicASCII()),u=Wi.containsRTL(r,d,e.mightContainRTL());return Eg(new Wo(a.isMonospace&&!t.get(40),a.canUseHalfwidthRightwardsArrow,r,!1,d,u,0,h,[],i,0,a.spaceWidth,a.middotWidth,a.wsmiddotWidth,t.get(133),t.get(113),t.get(108),t.get(60)!==io.OFF,null,null,c)).html}};I0=D0([x0(5,yt)],I0);class IX{constructor(e){this.editors=e}getOriginalModel(){return this.editors.original.getModel()}getOriginalOptions(){return this.editors.original.getOptions()}originalReveal(e){this.editors.original.revealRange(e),this.editors.original.setSelection(e),this.editors.original.focus()}getModifiedModel(){return this.editors.modified.getModel()}getModifiedOptions(){return this.editors.modified.getOptions()}modifiedReveal(e){e&&(this.editors.modified.revealRange(e),this.editors.modified.setSelection(e)),this.editors.modified.focus()}modifiedSetSelection(e){this.editors.modified.setSelection(e)}modifiedFocus(){this.editors.modified.focus()}getModifiedPosition(){return this.editors.modified.getPosition()??void 0}}E("diffEditor.move.border","#8b8b8b9c",l.localize(153,"The border color for text that got moved in the diff editor.")),E("diffEditor.moveActive.border","#FFA500",l.localize(154,"The active border color for text that got moved in the diff editor.")),E("diffEditor.unchangedRegionShadow",{dark:"#000000",light:"#737373BF",hcDark:"#000000",hcLight:"#737373BF"},l.localize(155,"The color of the shadow around unchanged region widgets."));const TX=Mo("diff-insert",l.Codicon.add,l.localize(156,"Line decoration for inserts in the diff editor.")),mO=Mo("diff-remove",l.Codicon.remove,l.localize(157,"Line decoration for removals in the diff editor.")),pO=Ct.register({className:"line-insert",description:"line-insert",isWholeLine:!0,linesDecorationsClassName:"insert-sign "+_.ThemeIcon.asClassName(TX),marginClassName:"gutter-insert"}),_O=Ct.register({className:"line-delete",description:"line-delete",isWholeLine:!0,linesDecorationsClassName:"delete-sign "+_.ThemeIcon.asClassName(mO),marginClassName:"gutter-delete"}),bO=Ct.register({className:"line-insert",description:"line-insert",isWholeLine:!0,marginClassName:"gutter-insert"}),CO=Ct.register({className:"line-delete",description:"line-delete",isWholeLine:!0,marginClassName:"gutter-delete"}),vO=Ct.register({className:"char-insert",description:"char-insert",shouldFillLineOnLineBreak:!0}),NX=Ct.register({className:"char-insert",description:"char-insert",isWholeLine:!0}),RX=Ct.register({className:"char-insert diff-range-empty",description:"char-insert diff-range-empty"}),T0=Ct.register({className:"char-delete",description:"char-delete",shouldFillLineOnLineBreak:!0}),MX=Ct.register({className:"char-delete",description:"char-delete",isWholeLine:!0}),AX=Ct.register({className:"char-delete diff-range-empty",description:"char-delete diff-range-empty"});var wO=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},N0=function(o,e){return function(t,i){e(t,i,o)}},_l;const SO=le("diffProviderFactoryService");let R0=class{constructor(e){this.instantiationService=e}createDiffProvider(e){return this.instantiationService.createInstance(M0,e)}};R0=wO([N0(0,me)],R0),fe(SO,R0,1);let M0=(Al=class{constructor(e,t,i){this.editorWorkerService=t,this.telemetryService=i,this.onDidChangeEventEmitter=new l.Emitter,this.onDidChange=this.onDidChangeEventEmitter.event,this.diffAlgorithm="advanced",this.diffAlgorithmOnDidChangeSubscription=void 0,this.setOptions(e)}dispose(){this.diffAlgorithmOnDidChangeSubscription?.dispose(),this.onDidChangeEventEmitter.dispose()}async computeDiff(e,t,i,n){if(typeof this.diffAlgorithm!="string")return this.diffAlgorithm.computeDiff(e,t,i,n);if(e.isDisposed()||t.isDisposed())return{changes:[],identical:!0,quitEarly:!1,moves:[]};if(e.getLineCount()===1&&e.getLineMaxColumn(1)===1)return t.getLineCount()===1&&t.getLineMaxColumn(1)===1?{changes:[],identical:!0,quitEarly:!1,moves:[]}:{changes:[new l.DetailedLineRangeMapping(new l.LineRange(1,2),new l.LineRange(1,t.getLineCount()+1),[new l.RangeMapping(e.getFullModelRange(),t.getFullModelRange())])],identical:!1,quitEarly:!1,moves:[]};const s=JSON.stringify([e.uri.toString(),t.uri.toString()]),r=JSON.stringify([e.id,t.id,e.getAlternativeVersionId(),t.getAlternativeVersionId(),JSON.stringify(i)]),a=_l.diffCache.get(s);if(a&&a.context===r)return a.result;const c=l.StopWatch.create(),h=await this.editorWorkerService.computeDiff(e.uri,t.uri,i,this.diffAlgorithm),d=c.elapsed();if(this.telemetryService.publicLog2("diffEditor.computeDiff",{timeMs:d,timedOut:h?.quitEarly??!0,detectedMoves:i.computeMoves?h?.moves.length??0:-1}),n.isCancellationRequested)return{changes:[],identical:!1,quitEarly:!0,moves:[]};if(!h)throw new Error("no diff result available");return _l.diffCache.size>10&&_l.diffCache.delete(_l.diffCache.keys().next().value),_l.diffCache.set(s,{result:h,context:r}),h}setOptions(e){let t=!1;e.diffAlgorithm&&this.diffAlgorithm!==e.diffAlgorithm&&(this.diffAlgorithmOnDidChangeSubscription?.dispose(),this.diffAlgorithmOnDidChangeSubscription=void 0,this.diffAlgorithm=e.diffAlgorithm,typeof e.diffAlgorithm!="string"&&(this.diffAlgorithmOnDidChangeSubscription=e.diffAlgorithm.onDidChange(()=>this.onDidChangeEventEmitter.fire())),t=!0),t&&this.onDidChangeEventEmitter.fire()}},_l=Al,Al.diffCache=new Map,Al);M0=_l=wO([N0(1,tr),N0(2,Xn)],M0);var OX=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},PX=function(o,e){return function(t,i){e(t,i,o)}};let A0=class extends l.Disposable{setActiveMovedText(e){this._activeMovedText.set(e,void 0)}constructor(e,t,i){super(),this.model=e,this._options=t,this._diffProviderFactoryService=i,this._isDiffUpToDate=W(this,!1),this.isDiffUpToDate=this._isDiffUpToDate,this._diff=W(this,void 0),this.diff=this._diff,this._unchangedRegions=W(this,void 0),this.unchangedRegions=Z(this,a=>this._options.hideUnchangedRegions.read(a)?this._unchangedRegions.read(a)?.regions??[]:(nt(c=>{for(const h of this._unchangedRegions.read(void 0)?.regions||[])h.collapseAll(c)}),[])),this.movedTextToCompare=W(this,void 0),this._activeMovedText=W(this,void 0),this._hoveredMovedText=W(this,void 0),this.activeMovedText=Z(this,a=>this.movedTextToCompare.read(a)??this._hoveredMovedText.read(a)??this._activeMovedText.read(a)),this._cancellationTokenSource=new l.CancellationTokenSource,this._diffProvider=Z(this,a=>{const c=this._diffProviderFactoryService.createDiffProvider({diffAlgorithm:this._options.diffAlgorithm.read(a)}),h=Ii("onDidChange",c.onDidChange);return{diffProvider:c,onChangeSignal:h}}),this._register(l.toDisposable(()=>this._cancellationTokenSource.cancel()));const n=qr("contentChangedSignal"),s=this._register(new l.RunOnceScheduler(()=>n.trigger(void 0),200));this._register(he(a=>{const c=this._unchangedRegions.read(a);if(!c||c.regions.some(m=>m.isDragged.read(a)))return;const h=c.originalDecorationIds.map(m=>e.original.getDecorationRange(m)).map(m=>m?l.LineRange.fromRangeInclusive(m):void 0),d=c.modifiedDecorationIds.map(m=>e.modified.getDecorationRange(m)).map(m=>m?l.LineRange.fromRangeInclusive(m):void 0),u=c.regions.map((m,p)=>!h[p]||!d[p]?void 0:new Rr(h[p].startLineNumber,d[p].startLineNumber,h[p].length,m.visibleLineCountTop.read(a),m.visibleLineCountBottom.read(a))).filter(l.isDefined),f=[];let g=!1;for(const m of l.groupAdjacentBy(u,(p,b)=>p.getHiddenModifiedRange(a).endLineNumberExclusive===b.getHiddenModifiedRange(a).startLineNumber))if(m.length>1){g=!0;const p=m.reduce((v,C)=>v+C.lineCount,0),b=new Rr(m[0].originalLineNumber,m[0].modifiedLineNumber,p,m[0].visibleLineCountTop.read(void 0),m[m.length-1].visibleLineCountBottom.read(void 0));f.push(b)}else f.push(m[0]);if(g){const m=e.original.deltaDecorations(c.originalDecorationIds,f.map(b=>({range:b.originalUnchangedRange.toInclusiveRange(),options:{description:"unchanged"}}))),p=e.modified.deltaDecorations(c.modifiedDecorationIds,f.map(b=>({range:b.modifiedUnchangedRange.toInclusiveRange(),options:{description:"unchanged"}})));nt(b=>{this._unchangedRegions.set({regions:f,originalDecorationIds:m,modifiedDecorationIds:p},b)})}}));const r=(a,c,h)=>{const d=Rr.fromDiffs(a.changes,e.original.getLineCount(),e.modified.getLineCount(),this._options.hideUnchangedRegionsMinimumLineCount.read(h),this._options.hideUnchangedRegionsContextLineCount.read(h));let u;const f=this._unchangedRegions.get();if(f){const b=f.originalDecorationIds.map(S=>e.original.getDecorationRange(S)).map(S=>S?l.LineRange.fromRangeInclusive(S):void 0),v=f.modifiedDecorationIds.map(S=>e.modified.getDecorationRange(S)).map(S=>S?l.LineRange.fromRangeInclusive(S):void 0);let w=_X(f.regions.map((S,L)=>{if(!b[L]||!v[L])return;const D=b[L].length;return new Rr(b[L].startLineNumber,v[L].startLineNumber,D,Math.min(S.visibleLineCountTop.get(),D),Math.min(S.visibleLineCountBottom.get(),D-S.visibleLineCountTop.get()))}).filter(l.isDefined),(S,L)=>!L||S.modifiedLineNumber>=L.modifiedLineNumber+L.lineCount&&S.originalLineNumber>=L.originalLineNumber+L.lineCount).map(S=>new l.LineRangeMapping(S.getHiddenOriginalRange(h),S.getHiddenModifiedRange(h)));w=l.LineRangeMapping.clip(w,l.LineRange.ofLength(1,e.original.getLineCount()),l.LineRange.ofLength(1,e.modified.getLineCount())),u=l.LineRangeMapping.inverse(w,e.original.getLineCount(),e.modified.getLineCount())}const g=[];if(u)for(const b of d){const v=u.filter(C=>C.original.intersectsStrict(b.originalUnchangedRange)&&C.modified.intersectsStrict(b.modifiedUnchangedRange));g.push(...b.setVisibleRanges(v,c))}else g.push(...d);const m=e.original.deltaDecorations(f?.originalDecorationIds||[],g.map(b=>({range:b.originalUnchangedRange.toInclusiveRange(),options:{description:"unchanged"}}))),p=e.modified.deltaDecorations(f?.modifiedDecorationIds||[],g.map(b=>({range:b.modifiedUnchangedRange.toInclusiveRange(),options:{description:"unchanged"}})));this._unchangedRegions.set({regions:g,originalDecorationIds:m,modifiedDecorationIds:p},c)};this._register(e.modified.onDidChangeContent(a=>{if(this._diff.get()){const h=po.fromModelContentChanges(a.changes);this._lastDiff,e.original,e.modified}this._isDiffUpToDate.set(!1,void 0),s.schedule()})),this._register(e.original.onDidChangeContent(a=>{if(this._diff.get()){const h=po.fromModelContentChanges(a.changes);this._lastDiff,e.original,e.modified}this._isDiffUpToDate.set(!1,void 0),s.schedule()})),this._register(he(async a=>{const c=a.store;this._options.hideUnchangedRegionsMinimumLineCount.read(a),this._options.hideUnchangedRegionsContextLineCount.read(a),s.cancel(),n.read(a);const h=this._diffProvider.read(a);h.onChangeSignal.read(a),this._isDiffUpToDate.set(!1,void 0);let d=[];c.add(e.original.onDidChangeContent(g=>{const m=po.fromModelContentChanges(g.changes);d=Nm(d,m)}));let u=[];c.add(e.modified.onDidChangeContent(g=>{const m=po.fromModelContentChanges(g.changes);u=Nm(u,m)}));let f=await h.diffProvider.computeDiff(e.original,e.modified,{ignoreTrimWhitespace:this._options.ignoreTrimWhitespace.read(a),maxComputationTimeMs:this._options.maxComputationTimeMs.read(a),computeMoves:this._options.showMoves.read(a)},this._cancellationTokenSource.token).catch(l.rejectIfNotCanceled);!f||this._cancellationTokenSource.token.isCancellationRequested||e.original.isDisposed()||e.modified.isDisposed()||(f=kX(f,e.original,e.modified),f=(e.original,e.modified,void 0)??f,f=(e.original,e.modified,void 0)??f,nt(g=>{r(f,g),this._lastDiff=f;const m=O0.fromDiffResult(f);this._diff.set(m,g),this._isDiffUpToDate.set(!0,g);const p=this.movedTextToCompare.read(void 0);this.movedTextToCompare.set(p?this._lastDiff.moves.find(b=>b.lineRangeMapping.modified.intersect(p.lineRangeMapping.modified)):void 0,g)}))}))}ensureModifiedLineIsVisible(e,t,i){if(this.diff.get()?.mappings.length===0)return;const n=this._unchangedRegions.get()?.regions||[];for(const s of n)if(s.getHiddenModifiedRange(void 0).contains(e)){s.showModifiedLine(e,t,i);return}}ensureOriginalLineIsVisible(e,t,i){if(this.diff.get()?.mappings.length===0)return;const n=this._unchangedRegions.get()?.regions||[];for(const s of n)if(s.getHiddenOriginalRange(void 0).contains(e)){s.showOriginalLine(e,t,i);return}}async waitForDiff(){await QD(this.isDiffUpToDate,e=>e,void 0,this._cancellationTokenSource.token).catch(l.rejectIfNotCanceled)}serializeState(){return{collapsedRegions:this._unchangedRegions.get()?.regions.map(t=>({range:t.getHiddenModifiedRange(void 0).serialize()}))}}restoreSerializedState(e){const t=e.collapsedRegions?.map(n=>l.LineRange.deserialize(n.range)),i=this._unchangedRegions.get();!i||!t||nt(n=>{for(const s of i.regions)for(const r of t)if(s.modifiedUnchangedRange.intersect(r)){s.setHiddenModifiedRange(r,n);break}})}};A0=OX([PX(2,SO)],A0);function kX(o,e,t){return{changes:o.changes.map(i=>new l.DetailedLineRangeMapping(i.original,i.modified,i.innerChanges?i.innerChanges.map(n=>FX(n,e,t)):void 0)),moves:o.moves,identical:o.identical,quitEarly:o.quitEarly}}function FX(o,e,t){let i=o.originalRange,n=o.modifiedRange;return i.startColumn===1&&n.startColumn===1&&(i.endColumn!==1||n.endColumn!==1)&&i.endColumn===e.getLineMaxColumn(i.endLineNumber)&&n.endColumn===t.getLineMaxColumn(n.endLineNumber)&&i.endLineNumber<e.getLineCount()&&n.endLineNumber<t.getLineCount()&&(i=i.setEndPosition(i.endLineNumber+1,1),n=n.setEndPosition(n.endLineNumber+1,1)),new l.RangeMapping(i,n)}class O0{static fromDiffResult(e){return new O0(e.changes.map(t=>new yO(t)),e.moves||[],e.identical,e.quitEarly)}constructor(e,t,i,n){this.mappings=e,this.movedTexts=t,this.identical=i,this.quitEarly=n}}class yO{constructor(e){this.lineRangeMapping=e}}class Rr{static fromDiffs(e,t,i,n,s){const r=l.DetailedLineRangeMapping.inverse(e,t,i),a=[];for(const c of r){let h=c.original.startLineNumber,d=c.modified.startLineNumber,u=c.original.length;const f=h===1&&d===1,g=h+u===t+1&&d+u===i+1;(f||g)&&u>=s+n?(f&&!g&&(u-=s),g&&!f&&(h+=s,d+=s,u-=s),a.push(new Rr(h,d,u,0,0))):u>=s*2+n&&(h+=s,d+=s,u-=s*2,a.push(new Rr(h,d,u,0,0)))}return a}get originalUnchangedRange(){return l.LineRange.ofLength(this.originalLineNumber,this.lineCount)}get modifiedUnchangedRange(){return l.LineRange.ofLength(this.modifiedLineNumber,this.lineCount)}constructor(e,t,i,n,s){this.originalLineNumber=e,this.modifiedLineNumber=t,this.lineCount=i,this._visibleLineCountTop=W(this,0),this.visibleLineCountTop=this._visibleLineCountTop,this._visibleLineCountBottom=W(this,0),this.visibleLineCountBottom=this._visibleLineCountBottom,this._shouldHideControls=Z(this,c=>this.visibleLineCountTop.read(c)+this.visibleLineCountBottom.read(c)===this.lineCount&&!this.isDragged.read(c)),this.isDragged=W(this,void 0);const r=Math.max(Math.min(n,this.lineCount),0),a=Math.max(Math.min(s,this.lineCount-n),0);l.softAssert(n===r),l.softAssert(s===a),this._visibleLineCountTop.set(r,void 0),this._visibleLineCountBottom.set(a,void 0)}setVisibleRanges(e,t){const i=[],n=new l.LineRangeSet(e.map(c=>c.modified)).subtractFrom(this.modifiedUnchangedRange);let s=this.originalLineNumber,r=this.modifiedLineNumber;const a=this.modifiedLineNumber+this.lineCount;if(n.ranges.length===0)this.showAll(t),i.push(this);else{let c=0;for(const h of n.ranges){const d=c===n.ranges.length-1;c++;const u=(d?a:h.endLineNumberExclusive)-r,f=new Rr(s,r,u,0,0);f.setHiddenModifiedRange(h,t),i.push(f),s=f.originalUnchangedRange.endLineNumberExclusive,r=f.modifiedUnchangedRange.endLineNumberExclusive}}return i}shouldHideControls(e){return this._shouldHideControls.read(e)}getHiddenOriginalRange(e){return l.LineRange.ofLength(this.originalLineNumber+this._visibleLineCountTop.read(e),this.lineCount-this._visibleLineCountTop.read(e)-this._visibleLineCountBottom.read(e))}getHiddenModifiedRange(e){return l.LineRange.ofLength(this.modifiedLineNumber+this._visibleLineCountTop.read(e),this.lineCount-this._visibleLineCountTop.read(e)-this._visibleLineCountBottom.read(e))}setHiddenModifiedRange(e,t){const i=e.startLineNumber-this.modifiedLineNumber,n=this.modifiedLineNumber+this.lineCount-e.endLineNumberExclusive;this.setState(i,n,t)}getMaxVisibleLineCountTop(){return this.lineCount-this._visibleLineCountBottom.get()}getMaxVisibleLineCountBottom(){return this.lineCount-this._visibleLineCountTop.get()}showMoreAbove(e=10,t){const i=this.getMaxVisibleLineCountTop();this._visibleLineCountTop.set(Math.min(this._visibleLineCountTop.get()+e,i),t)}showMoreBelow(e=10,t){const i=this.lineCount-this._visibleLineCountTop.get();this._visibleLineCountBottom.set(Math.min(this._visibleLineCountBottom.get()+e,i),t)}showAll(e){this._visibleLineCountBottom.set(this.lineCount-this._visibleLineCountTop.get(),e)}showModifiedLine(e,t,i){const n=e+1-(this.modifiedLineNumber+this._visibleLineCountTop.get()),s=this.modifiedLineNumber-this._visibleLineCountBottom.get()+this.lineCount-e;t===0&&n<s||t===1?this._visibleLineCountTop.set(this._visibleLineCountTop.get()+n,i):this._visibleLineCountBottom.set(this._visibleLineCountBottom.get()+s,i)}showOriginalLine(e,t,i){const n=e-this.originalLineNumber,s=this.originalLineNumber+this.lineCount-e;t===0&&n<s||t===1?this._visibleLineCountTop.set(Math.min(this._visibleLineCountTop.get()+s-n,this.getMaxVisibleLineCountTop()),i):this._visibleLineCountBottom.set(Math.min(this._visibleLineCountBottom.get()+n-s,this.getMaxVisibleLineCountBottom()),i)}collapseAll(e){this._visibleLineCountTop.set(0,e),this._visibleLineCountBottom.set(0,e)}setState(e,t,i){e=Math.max(Math.min(e,this.lineCount),0),t=Math.max(Math.min(t,this.lineCount-e),0),this._visibleLineCountTop.set(e,i),this._visibleLineCountBottom.set(t,i)}}function NH(o,e,t,i){}function RH(o,e,t,i){}function BX(o){const{domNode:e,renderLinesResult:t,diffEntry:i,originalModel:n,clipboardService:s}=o,r=new l.DisposableStore;return r.add(R(e,"copy",a=>{a.preventDefault();const c=e.ownerDocument.getSelection();if(!c||c.rangeCount===0)return;const h=c.getRangeAt(0);if(!h||h.collapsed)return;const d=h.startContainer.nodeType===Node.TEXT_NODE?h.startContainer.parentElement:h.startContainer,u=h.endContainer.nodeType===Node.TEXT_NODE?h.endContainer.parentElement:h.endContainer;if(!d||!u)return;const f=t.getModelPositionAt(d,h.startOffset),g=t.getModelPositionAt(u,h.endOffset);if(!f||!g)return;const m=f.delta(i.original.startLineNumber-1),p=g.delta(i.original.startLineNumber-1),b=p.isBefore(m)?l.Range.fromPositions(p,m):l.Range.fromPositions(m,p),v=n.getValueInRange(b);s.writeText(v)})),r}class zX extends l.Disposable{get visibility(){return this._visibility}set visibility(e){this._visibility!==e&&(this._visibility=e,this._diffActions.style.visibility=e?"visible":"hidden")}constructor(e,t,i,n,s,r,a,c,h,d){super(),this._getViewZoneId=e,this._marginDomNode=t,this._deletedCodeDomNode=i,this._modifiedEditor=n,this._diff=s,this._editor=r,this._renderLinesResult=a,this._originalTextModel=c,this._contextMenuService=h,this._clipboardService=d,this._visibility=!1,this._marginDomNode.style.zIndex="10",this._diffActions=document.createElement("div"),this._diffActions.className=_.ThemeIcon.asClassName(l.Codicon.lightBulb)+" lightbulb-glyph",this._diffActions.style.position="absolute";const u=this._modifiedEditor.getOption(75);this._diffActions.style.right="0px",this._diffActions.style.visibility="hidden",this._diffActions.style.height=`${u}px`,this._diffActions.style.lineHeight=`${u}px`,this._marginDomNode.appendChild(this._diffActions);let f=0;const g=n.getOption(144)&&!l.isIOS,m=(p,b,v)=>{this._contextMenuService.showContextMenu({domForShadowRoot:g?n.getDomNode()??void 0:void 0,getAnchor:()=>p,onHide:v,getActions:()=>{const C=[],w=s.modified.isEmpty;return C.push(new oo("diff.clipboard.copyDeletedContent",w?s.original.length>1?l.localize(128,"Copy deleted lines"):l.localize(129,"Copy deleted line"):s.original.length>1?l.localize(130,"Copy changed lines"):l.localize(131,"Copy changed line"),void 0,!0,async()=>{const L=this._originalTextModel.getValueInRange(s.original.toExclusiveRange());await this._clipboardService.writeText(L)})),s.original.length>1&&C.push(new oo("diff.clipboard.copyDeletedLineContent",w?l.localize(132,"Copy deleted line ({0})",s.original.startLineNumber+f):l.localize(133,"Copy changed line ({0})",s.original.startLineNumber+f),void 0,!0,async()=>{let L=this._originalTextModel.getLineContent(s.original.startLineNumber+f);L===""&&(L=this._originalTextModel.getEndOfLineSequence()===0?`
|
||
`:`\r
|
||
`),await this._clipboardService.writeText(L)})),n.getOption(104)||C.push(new oo("diff.inline.revertChange",l.localize(134,"Revert this change"),void 0,!0,async()=>{this._editor.revert(this._diff)})),C},autoSelectFirstItem:!0})};this._register(At(this._diffActions,"mousedown",p=>{if(!p.leftButton)return;const{top:b,height:v}=Qi(this._diffActions),C=Math.floor(u/3);p.preventDefault(),m({x:p.posx,y:b+v+C})})),this._register(n.onMouseMove(p=>{(p.target.type===8||p.target.type===5)&&p.target.detail.viewZoneId===this._getViewZoneId()?(f=this._updateLightBulbPosition(this._marginDomNode,p.event.browserEvent.y,u),this.visibility=!0):this.visibility=!1})),this._register(BX({domNode:this._deletedCodeDomNode,diffEntry:s,originalModel:this._originalTextModel,renderLinesResult:this._renderLinesResult,clipboardService:d}))}_updateLightBulbPosition(e,t,i){const{top:n}=Qi(e),s=t-n,r=Math.floor(s/i),a=r*i;if(this._diffActions.style.top=`${a}px`,this._renderLinesResult.viewLineCounts){let c=0;for(let h=0;h<this._renderLinesResult.viewLineCounts.length;h++)if(c+=this._renderLinesResult.viewLineCounts[h],r<c)return h}return r}}const LO=lo("diffEditorWidget",{createHTML:o=>o});function DO(o,e,t,i,n=!1){Ot(i,e.fontInfo);const s=t.length>0,r=new ra(1e4);let a=0,c=0;const h=[],d=[];for(let m=0;m<o.lineTokens.length;m++){const p=m+1,b=o.lineTokens[m],v=o.lineBreakData[m],C=Ji.filter(t,p,1,Number.MAX_SAFE_INTEGER);if(v){let w=0;for(const S of v.breakOffsets){const L=b.sliceAndInflate(w,S,0),D=IO(c,L,Ji.extractWrapped(C,w,S),s,o.mightContainNonBasicASCII,o.mightContainRTL,e,r,n);a=Math.max(a,D.maxCharWidth),d.push(new EO(D.output.characterMapping,D.output.containsForeignElements,w)),c++,w=S}h.push(v.breakOffsets.length)}else{h.push(1);const w=IO(c,b,C,s,o.mightContainNonBasicASCII,o.mightContainRTL,e,r,n);a=Math.max(a,w.maxCharWidth),d.push(new EO(w.output.characterMapping,w.output.containsForeignElements,0)),c++}}a+=e.scrollBeyondLastColumn;const u=r.build(),f=LO?LO.createHTML(u):u;i.innerHTML=f;const g=a*e.typicalHalfwidthCharacterWidth;return new VX(c,g,h,d,o)}class xO{constructor(e,t=e.map(s=>null),i=!0,n=!0){this.lineTokens=e,this.lineBreakData=t,this.mightContainNonBasicASCII=i,this.mightContainRTL=n}}class yh{static fromEditor(e){const t=e.getOptions(),i=t.get(59),n=t.get(165);return new yh(e.getModel()?.getOptions().tabSize||0,i,t.get(40),i.typicalHalfwidthCharacterWidth,t.get(118),t.get(75),n.decorationsWidth,t.get(133),t.get(113),t.get(108),t.get(60),t.get(117).verticalScrollbarSize)}constructor(e,t,i,n,s,r,a,c,h,d,u,f,g=!0){this.tabSize=e,this.fontInfo=t,this.disableMonospaceOptimizations=i,this.typicalHalfwidthCharacterWidth=n,this.scrollBeyondLastColumn=s,this.lineHeight=r,this.lineDecorationsWidth=a,this.stopRenderingLineAfter=c,this.renderWhitespace=h,this.renderControlCharacters=d,this.fontLigatures=u,this.verticalScrollbarSize=f,this.setWidth=g}withSetWidth(e){return new yh(this.tabSize,this.fontInfo,this.disableMonospaceOptimizations,this.typicalHalfwidthCharacterWidth,this.scrollBeyondLastColumn,this.lineHeight,this.lineDecorationsWidth,this.stopRenderingLineAfter,this.renderWhitespace,this.renderControlCharacters,this.fontLigatures,this.verticalScrollbarSize,e)}withScrollBeyondLastColumn(e){return new yh(this.tabSize,this.fontInfo,this.disableMonospaceOptimizations,this.typicalHalfwidthCharacterWidth,e,this.lineHeight,this.lineDecorationsWidth,this.stopRenderingLineAfter,this.renderWhitespace,this.renderControlCharacters,this.fontLigatures,this.verticalScrollbarSize,this.setWidth)}}class VX{constructor(e,t,i,n,s){this.heightInLines=e,this.minWidthInPx=t,this.viewLineCounts=i,this._renderOutputs=n,this._source=s}getModelPositionAt(e,t){let i=e;for(;i&&!i.classList.contains("view-line");)i=i.parentElement;if(!i)return;const n=i.parentElement;if(!n)return;const s=n.querySelectorAll(".view-line");let r=-1;for(let u=0;u<s.length;u++)if(s[u]===i){r=u;break}if(r===-1||r>=this._renderOutputs.length)return;let a=1,c=r;for(let u=0;u<this.viewLineCounts.length;u++){if(c<this.viewLineCounts[u]){a=u+1;break}c-=this.viewLineCounts[u]}if(a>this._source.lineTokens.length)return;const h=this._renderOutputs[r];if(!h)return;const d=dc(h.characterMapping,e,t)+h.offset;return new l.Position(a,d)}}class EO extends xg{constructor(e,t,i){super(e,t),this.offset=i}}function IO(o,e,t,i,n,s,r,a,c){a.appendString('<div class="view-line'),!c&&!i&&a.appendString(" char-delete"),a.appendString('" style="top:'),a.appendString(String(o*r.lineHeight)),r.setWidth?a.appendString('px;width:1000000px;">'):a.appendString('px;">');const h=e.getLineContent(),d=Wi.isBasicASCII(h,n),u=Wi.containsRTL(h,d,s),f=bd(new Wo(r.fontInfo.isMonospace&&!r.disableMonospaceOptimizations,r.fontInfo.canUseHalfwidthRightwardsArrow,h,!1,d,u,0,e,t,r.tabSize,0,r.fontInfo.spaceWidth,r.fontInfo.middotWidth,r.fontInfo.wsmiddotWidth,r.stopRenderingLineAfter,r.renderWhitespace,r.renderControlCharacters,r.fontLigatures!==io.OFF,null,null,r.verticalScrollbarSize),a);a.appendString("</div>");const g=f.characterMapping.getHorizontalOffset(f.characterMapping.length);return{output:f,maxCharWidth:g}}var UX=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},TO=function(o,e){return function(t,i){e(t,i,o)}};let P0=class extends l.Disposable{constructor(e,t,i,n,s,r,a,c,h,d){super(),this._targetWindow=e,this._editors=t,this._diffModel=i,this._options=n,this._diffEditorWidget=s,this._canIgnoreViewZoneUpdateEvent=r,this._origViewZonesToIgnore=a,this._modViewZonesToIgnore=c,this._clipboardService=h,this._contextMenuService=d,this._originalTopPadding=W(this,0),this._originalScrollOffset=W(this,0),this._originalScrollOffsetAnimated=uO(this._targetWindow,this._originalScrollOffset,this._store),this._modifiedTopPadding=W(this,0),this._modifiedScrollOffset=W(this,0),this._modifiedScrollOffsetAnimated=uO(this._targetWindow,this._modifiedScrollOffset,this._store);const u=W("invalidateAlignmentsState",0),f=this._register(new l.RunOnceScheduler(()=>{u.set(u.get()+1,void 0)},0));this._register(this._editors.original.onDidChangeViewZones(w=>{this._canIgnoreViewZoneUpdateEvent()||f.schedule()})),this._register(this._editors.modified.onDidChangeViewZones(w=>{this._canIgnoreViewZoneUpdateEvent()||f.schedule()})),this._register(this._editors.original.onDidChangeConfiguration(w=>{(w.hasChanged(166)||w.hasChanged(75))&&f.schedule()})),this._register(this._editors.modified.onDidChangeConfiguration(w=>{(w.hasChanged(166)||w.hasChanged(75))&&f.schedule()}));const g=this._diffModel.map(w=>w?mt(this,w.model.original.onDidChangeTokens,()=>w.model.original.tokenization.backgroundTokenizationState===2):void 0).map((w,S)=>w?.read(S)),m=Z(w=>{const S=this._diffModel.read(w),L=S?.diff.read(w);if(!S||!L)return null;u.read(w);const x=this._options.renderSideBySide.read(w);return NO(this._editors.original,this._editors.modified,L.mappings,this._origViewZonesToIgnore,this._modViewZonesToIgnore,x)}),p=Z(w=>{const S=this._diffModel.read(w)?.movedTextToCompare.read(w);if(!S)return null;u.read(w);const L=S.changes.map(D=>new yO(D));return NO(this._editors.original,this._editors.modified,L,this._origViewZonesToIgnore,this._modViewZonesToIgnore,!0)});function b(){const w=document.createElement("div");return w.className="diagonal-fill",w}const v=this._register(new l.DisposableStore);this.viewZones=Z(this,w=>{v.clear();const S=m.read(w)||[],L=[],D=[],x=this._modifiedTopPadding.read(w);x>0&&D.push({afterLineNumber:0,domNode:document.createElement("div"),heightInPx:x,showInHiddenAreas:!0,suppressMouseDown:!0});const I=this._originalTopPadding.read(w);I>0&&L.push({afterLineNumber:0,domNode:document.createElement("div"),heightInPx:I,showInHiddenAreas:!0,suppressMouseDown:!0});const T=this._options.renderSideBySide.read(w),M={getLineContent:Y=>this._editors.original.getModel().getLineContent(Y),getLineInjectedText:Y=>null},O=T?void 0:this._editors.modified._getViewModel()?.createLineBreaksComputer(M);if(O){const Y=this._editors.original.getModel();for(const ee of S)if(ee.diff)for(let Ee=ee.originalRange.startLineNumber;Ee<ee.originalRange.endLineNumberExclusive;Ee++){if(Ee>Y.getLineCount())return{orig:L,mod:D};O?.addRequest(Ee,null)}}const P=O?.finalize()??[];let k=0;const U=this._editors.modified.getOption(75),B=this._diffModel.read(w)?.movedTextToCompare.read(w),G=this._editors.original.getModel()?.mightContainNonBasicASCII()??!1,X=this._editors.original.getModel()?.mightContainRTL()??!1,re=yh.fromEditor(this._editors.modified);for(const Y of S)if(Y.diff&&!T&&(!this._options.useTrueInlineDiffRendering.read(w)||!k0(Y.diff))){if(!Y.originalRange.isEmpty){g.read(w);const Ee=document.createElement("div");Ee.classList.add("view-lines","line-delete","line-delete-selectable","monaco-mouse-cursor-text");const Rt=this._editors.original.getModel();if(Y.originalRange.endLineNumberExclusive-1>Rt.getLineCount())return{orig:L,mod:D};const We=new xO(Y.originalRange.mapToLineArray(Me=>Rt.tokenization.getLineTokens(Me)),Y.originalRange.mapToLineArray(Me=>P[k++]),G,X),Ke=[];for(const Me of Y.diff.innerChanges||[])Ke.push(new Ac(Me.originalRange.delta(-(Y.diff.original.startLineNumber-1)),T0.className,0));const Mt=DO(We,re,Ke,Ee),Ce=document.createElement("div");if(Ce.className="inline-deleted-margin-view-zone",Ot(Ce,re.fontInfo),this._options.renderIndicators.read(w))for(let Me=0;Me<Mt.heightInLines;Me++){const Rn=document.createElement("div");Rn.className=`delete-sign ${_.ThemeIcon.asClassName(mO)}`,Rn.setAttribute("style",`position:absolute;top:${Me*U}px;width:${re.lineDecorationsWidth}px;height:${U}px;right:0;`),Ce.appendChild(Rn)}let Jt;v.add(new zX(()=>l.assertReturnsDefined(Jt),Ce,Ee,this._editors.modified,Y.diff,this._diffEditorWidget,Mt,this._editors.original.getModel(),this._contextMenuService,this._clipboardService));for(let Me=0;Me<Mt.viewLineCounts.length;Me++){const Rn=Mt.viewLineCounts[Me];Rn>1&&L.push({afterLineNumber:Y.originalRange.startLineNumber+Me,domNode:b(),heightInPx:(Rn-1)*U,showInHiddenAreas:!0,suppressMouseDown:!0})}D.push({afterLineNumber:Y.modifiedRange.startLineNumber-1,domNode:Ee,heightInPx:Mt.heightInLines*U,minWidthInPx:Mt.minWidthInPx,marginDomNode:Ce,setZoneId(Me){Jt=Me},showInHiddenAreas:!0,suppressMouseDown:!1})}const ee=document.createElement("div");ee.className="gutter-delete",L.push({afterLineNumber:Y.originalRange.endLineNumberExclusive-1,domNode:b(),heightInPx:Y.modifiedHeightInPx,marginDomNode:ee,showInHiddenAreas:!0,suppressMouseDown:!0})}else{const ee=Y.modifiedHeightInPx-Y.originalHeightInPx;if(ee>0){if(B?.lineRangeMapping.original.delta(-1).deltaLength(2).contains(Y.originalRange.endLineNumberExclusive-1))continue;L.push({afterLineNumber:Y.originalRange.endLineNumberExclusive-1,domNode:b(),heightInPx:ee,showInHiddenAreas:!0,suppressMouseDown:!0})}else{let Ee=function(){const We=document.createElement("div");return We.className="arrow-revert-change "+_.ThemeIcon.asClassName(l.Codicon.arrowRight),w.store.add(R(We,"mousedown",Ke=>Ke.stopPropagation())),w.store.add(R(We,"click",Ke=>{Ke.stopPropagation(),s.revert(Y.diff)})),Q("div",{},We)};if(B?.lineRangeMapping.modified.delta(-1).deltaLength(2).contains(Y.modifiedRange.endLineNumberExclusive-1))continue;let Rt;Y.diff&&Y.diff.modified.isEmpty&&this._options.shouldRenderOldRevertArrows.read(w)&&(Rt=Ee()),D.push({afterLineNumber:Y.modifiedRange.endLineNumberExclusive-1,domNode:b(),heightInPx:-ee,marginDomNode:Rt,showInHiddenAreas:!0,suppressMouseDown:!0})}}for(const Y of p.read(w)??[]){if(!B?.lineRangeMapping.original.intersect(Y.originalRange)||!B?.lineRangeMapping.modified.intersect(Y.modifiedRange))continue;const ee=Y.modifiedHeightInPx-Y.originalHeightInPx;ee>0?L.push({afterLineNumber:Y.originalRange.endLineNumberExclusive-1,domNode:b(),heightInPx:ee,showInHiddenAreas:!0,suppressMouseDown:!0}):D.push({afterLineNumber:Y.modifiedRange.endLineNumberExclusive-1,domNode:b(),heightInPx:-ee,showInHiddenAreas:!0,suppressMouseDown:!0})}return{orig:L,mod:D}});let C=!1;this._register(this._editors.original.onDidScrollChange(w=>{w.scrollLeftChanged&&!C&&(C=!0,this._editors.modified.setScrollLeft(w.scrollLeft),C=!1)})),this._register(this._editors.modified.onDidScrollChange(w=>{w.scrollLeftChanged&&!C&&(C=!0,this._editors.original.setScrollLeft(w.scrollLeft),C=!1)})),this._originalScrollTop=mt(this._editors.original.onDidScrollChange,()=>this._editors.original.getScrollTop()),this._modifiedScrollTop=mt(this._editors.modified.onDidScrollChange,()=>this._editors.modified.getScrollTop()),this._register(he(w=>{const S=this._originalScrollTop.read(w)-(this._originalScrollOffsetAnimated.read(void 0)-this._modifiedScrollOffsetAnimated.read(w))-(this._originalTopPadding.read(void 0)-this._modifiedTopPadding.read(w));S!==this._editors.modified.getScrollTop()&&this._editors.modified.setScrollTop(S,1)})),this._register(he(w=>{const S=this._modifiedScrollTop.read(w)-(this._modifiedScrollOffsetAnimated.read(void 0)-this._originalScrollOffsetAnimated.read(w))-(this._modifiedTopPadding.read(void 0)-this._originalTopPadding.read(w));S!==this._editors.original.getScrollTop()&&this._editors.original.setScrollTop(S,1)})),this._register(he(w=>{const S=this._diffModel.read(w)?.movedTextToCompare.read(w);let L=0;if(S){const D=this._editors.original.getTopForLineNumber(S.lineRangeMapping.original.startLineNumber,!0)-this._originalTopPadding.read(void 0);L=this._editors.modified.getTopForLineNumber(S.lineRangeMapping.modified.startLineNumber,!0)-this._modifiedTopPadding.read(void 0)-D}L>0?(this._modifiedTopPadding.set(0,void 0),this._originalTopPadding.set(L,void 0)):L<0?(this._modifiedTopPadding.set(-L,void 0),this._originalTopPadding.set(0,void 0)):setTimeout(()=>{this._modifiedTopPadding.set(0,void 0),this._originalTopPadding.set(0,void 0)},400),this._editors.modified.hasTextFocus()?this._originalScrollOffset.set(this._modifiedScrollOffset.read(void 0)-L,void 0,!0):this._modifiedScrollOffset.set(this._originalScrollOffset.read(void 0)+L,void 0,!0)}))}};P0=UX([TO(8,Ip),TO(9,nn)],P0);function NO(o,e,t,i,n,s){const r=new l.ArrayQueue(RO(o,i)),a=new l.ArrayQueue(RO(e,n)),c=o.getOption(75),h=e.getOption(75),d=[];let u=0,f=0;function g(m,p){for(;;){let b=r.peek(),v=a.peek();if(b&&b.lineNumber>=m&&(b=void 0),v&&v.lineNumber>=p&&(v=void 0),!b&&!v)break;const C=b?b.lineNumber-u:Number.MAX_VALUE,w=v?v.lineNumber-f:Number.MAX_VALUE;C<w?(r.dequeue(),v={lineNumber:b.lineNumber-u+f,heightInPx:0}):C>w?(a.dequeue(),b={lineNumber:v.lineNumber-f+u,heightInPx:0}):(r.dequeue(),a.dequeue()),d.push({originalRange:l.LineRange.ofLength(b.lineNumber,1),modifiedRange:l.LineRange.ofLength(v.lineNumber,1),originalHeightInPx:c+b.heightInPx,modifiedHeightInPx:h+v.heightInPx,diff:void 0})}}for(const m of t){let w=function(S,L,D=!1){if(S<C||L<v)return;if(b)b=!1;else if(!D&&(S===C||L===v))return;const x=new l.LineRange(C,S),I=new l.LineRange(v,L);if(x.isEmpty&&I.isEmpty)return;const T=r.takeWhile(O=>O.lineNumber<S)?.reduce((O,P)=>O+P.heightInPx,0)??0,M=a.takeWhile(O=>O.lineNumber<L)?.reduce((O,P)=>O+P.heightInPx,0)??0;d.push({originalRange:x,modifiedRange:I,originalHeightInPx:x.length*c+T,modifiedHeightInPx:I.length*h+M,diff:m.lineRangeMapping}),C=S,v=L};const p=m.lineRangeMapping;g(p.original.startLineNumber,p.modified.startLineNumber);let b=!0,v=p.modified.startLineNumber,C=p.original.startLineNumber;if(s)for(const S of p.innerChanges||[]){S.originalRange.startColumn>1&&S.modifiedRange.startColumn>1&&w(S.originalRange.startLineNumber,S.modifiedRange.startLineNumber);const L=o.getModel(),D=S.originalRange.endLineNumber<=L.getLineCount()?L.getLineMaxColumn(S.originalRange.endLineNumber):Number.MAX_SAFE_INTEGER;S.originalRange.endColumn<D&&w(S.originalRange.endLineNumber,S.modifiedRange.endLineNumber)}w(p.original.endLineNumberExclusive,p.modified.endLineNumberExclusive,!0),u=p.original.endLineNumberExclusive,f=p.modified.endLineNumberExclusive}return g(Number.MAX_VALUE,Number.MAX_VALUE),d}function RO(o,e){const t=[],i=[],n=o.getOption(166).wrappingColumn!==-1,s=o._getViewModel().coordinatesConverter,r=o.getOption(75);if(n)for(let c=1;c<=o.getModel().getLineCount();c++){const h=s.getModelLineViewLineCount(c);h>1&&i.push({lineNumber:c,heightInPx:r*(h-1)})}for(const c of o.getWhitespaces()){if(e.has(c.id))continue;const h=c.afterLineNumber===0?0:s.convertViewPositionToModelPosition(new l.Position(c.afterLineNumber,1)).lineNumber;t.push({lineNumber:h,heightInPx:c.height})}return uX(t,i,c=>c.lineNumber,(c,h)=>({lineNumber:c.lineNumber,heightInPx:c.heightInPx+h.heightInPx}))}function k0(o){return o.innerChanges?o.innerChanges.every(e=>F0(e.modifiedRange)&&F0(e.originalRange)||e.originalRange.equalsRange(new l.Range(1,1,1,1))):!1}function F0(o){return o.startLineNumber===o.endLineNumber}const Ef=class Ef extends l.Disposable{constructor(e,t,i,n,s){super(),this._rootElement=e,this._diffModel=t,this._originalEditorLayoutInfo=i,this._modifiedEditorLayoutInfo=n,this._editors=s,this._originalScrollTop=mt(this,this._editors.original.onDidScrollChange,()=>this._editors.original.getScrollTop()),this._modifiedScrollTop=mt(this,this._editors.modified.onDidScrollChange,()=>this._editors.modified.getScrollTop()),this._viewZonesChanged=Ii("onDidChangeViewZones",this._editors.modified.onDidChangeViewZones),this.width=W(this,0),this._modifiedViewZonesChangedSignal=Ii("modified.onDidChangeViewZones",this._editors.modified.onDidChangeViewZones),this._originalViewZonesChangedSignal=Ii("original.onDidChangeViewZones",this._editors.original.onDidChangeViewZones),this._state=Z(this,d=>{this._element.replaceChildren();const u=this._diffModel.read(d),f=u?.diff.read(d)?.movedTexts;if(!f||f.length===0){this.width.set(0,void 0);return}this._viewZonesChanged.read(d);const g=this._originalEditorLayoutInfo.read(d),m=this._modifiedEditorLayoutInfo.read(d);if(!g||!m){this.width.set(0,void 0);return}this._modifiedViewZonesChangedSignal.read(d),this._originalViewZonesChangedSignal.read(d);const p=f.map(D=>{function x(G,X){const re=X.getTopForLineNumber(G.startLineNumber,!0),Y=X.getTopForLineNumber(G.endLineNumberExclusive,!0);return(re+Y)/2}const I=x(D.lineRangeMapping.original,this._editors.original),T=this._originalScrollTop.read(d),M=x(D.lineRangeMapping.modified,this._editors.modified),O=this._modifiedScrollTop.read(d),P=I-T,k=M-O,U=Math.min(I,M),B=Math.max(I,M);return{range:new l.OffsetRange(U,B),from:P,to:k,fromWithoutScroll:I,toWithoutScroll:M,move:D}});p.sort(l.tieBreakComparators(l.compareBy(D=>D.fromWithoutScroll>D.toWithoutScroll,l.booleanComparator),l.compareBy(D=>D.fromWithoutScroll>D.toWithoutScroll?D.fromWithoutScroll:-D.toWithoutScroll,l.numberComparator)));const b=B0.compute(p.map(D=>D.range)),v=10,C=g.verticalScrollbarWidth,w=(b.getTrackCount()-1)*10+v*2,S=C+w+(m.contentLeft-Ef.movedCodeBlockPadding);let L=0;for(const D of p){const x=b.getTrack(L),I=C+v+x*10,T=15,M=15,O=S,P=m.glyphMarginWidth+m.lineNumbersWidth,k=18,U=document.createElementNS("http://www.w3.org/2000/svg","rect");U.classList.add("arrow-rectangle"),U.setAttribute("x",`${O-P}`),U.setAttribute("y",`${D.to-k/2}`),U.setAttribute("width",`${P}`),U.setAttribute("height",`${k}`),this._element.appendChild(U);const B=document.createElementNS("http://www.w3.org/2000/svg","g"),G=document.createElementNS("http://www.w3.org/2000/svg","path");G.setAttribute("d",`M 0 ${D.from} L ${I} ${D.from} L ${I} ${D.to} L ${O-M} ${D.to}`),G.setAttribute("fill","none"),B.appendChild(G);const X=document.createElementNS("http://www.w3.org/2000/svg","polygon");X.classList.add("arrow"),d.store.add(he(re=>{G.classList.toggle("currentMove",D.move===u.activeMovedText.read(re)),X.classList.toggle("currentMove",D.move===u.activeMovedText.read(re))})),X.setAttribute("points",`${O-M},${D.to-T/2} ${O},${D.to} ${O-M},${D.to+T/2}`),B.appendChild(X),this._element.appendChild(B),L++}this.width.set(w,void 0)}),this._element=document.createElementNS("http://www.w3.org/2000/svg","svg"),this._element.setAttribute("class","moved-blocks-lines"),this._rootElement.appendChild(this._element),this._register(l.toDisposable(()=>this._element.remove())),this._register(he(d=>{const u=this._originalEditorLayoutInfo.read(d),f=this._modifiedEditorLayoutInfo.read(d);!u||!f||(this._element.style.left=`${u.width-u.verticalScrollbarWidth}px`,this._element.style.height=`${u.height}px`,this._element.style.width=`${u.verticalScrollbarWidth+u.contentLeft-Ef.movedCodeBlockPadding+this.width.read(d)}px`)})),this._register(ed(this._state));const r=Z(d=>{const f=this._diffModel.read(d)?.diff.read(d);return f?f.movedTexts.map(g=>({move:g,original:new Sh(Zr(g.lineRangeMapping.original.startLineNumber-1),18),modified:new Sh(Zr(g.lineRangeMapping.modified.startLineNumber-1),18)})):[]});this._register(A_(this._editors.original,r.map(d=>d.map(u=>u.original)))),this._register(A_(this._editors.modified,r.map(d=>d.map(u=>u.modified)))),this._register(Kn((d,u)=>{const f=r.read(d);for(const g of f)u.add(new MO(this._editors.original,g.original,g.move,"original",this._diffModel.get())),u.add(new MO(this._editors.modified,g.modified,g.move,"modified",this._diffModel.get()))}));const a=Ii("original.onDidFocusEditorWidget",d=>this._editors.original.onDidFocusEditorWidget(()=>setTimeout(()=>d(void 0),0))),c=Ii("modified.onDidFocusEditorWidget",d=>this._editors.modified.onDidFocusEditorWidget(()=>setTimeout(()=>d(void 0),0)));let h="modified";this._register(Gl({changeTracker:{createChangeSummary:()=>{},handleChange:(d,u)=>(d.didChange(a)&&(h="original"),d.didChange(c)&&(h="modified"),!0)}},d=>{a.read(d),c.read(d);const u=this._diffModel.read(d);if(!u)return;const f=u.diff.read(d);let g;if(f&&h==="original"){const m=this._editors.originalCursor.read(d);m&&(g=f.movedTexts.find(p=>p.lineRangeMapping.original.contains(m.lineNumber)))}if(f&&h==="modified"){const m=this._editors.modifiedCursor.read(d);m&&(g=f.movedTexts.find(p=>p.lineRangeMapping.modified.contains(m.lineNumber)))}g!==u.movedTextToCompare.read(void 0)&&u.movedTextToCompare.set(void 0,void 0),u.setActiveMovedText(g)}))}};Ef.movedCodeBlockPadding=4;let Lh=Ef;class B0{static compute(e){const t=[],i=[];for(const n of e){let s=t.findIndex(r=>!r.intersectsStrict(n));s===-1&&(t.length>=6?s=l.findMaxIdx(t,l.compareBy(a=>a.intersectWithRangeLength(n),l.numberComparator)):(s=t.length,t.push(new l.OffsetRangeSet))),t[s].addRange(n),i.push(s)}return new B0(t.length,i)}constructor(e,t){this._trackCount=e,this.trackPerLineIdx=t}getTrack(e){return this.trackPerLineIdx[e]}getTrackCount(){return this._trackCount}}class MO extends y0{constructor(e,t,i,n,s){const r=_e("div.diff-hidden-lines-widget");super(e,t,r.root),this._editor=e,this._move=i,this._kind=n,this._diffModel=s,this._nodes=_e("div.diff-moved-code-block",{style:{marginRight:"4px"}},[_e("div.text-content@textContent"),_e("div.action-bar@actionBar")]),r.root.appendChild(this._nodes.root);const a=mt(this._editor.onDidLayoutChange,()=>this._editor.getLayoutInfo());this._register(Nr(this._nodes.root,{paddingRight:a.map(f=>f.verticalScrollbarWidth)}));let c;i.changes.length>0?c=this._kind==="original"?l.localize(147,"Code moved with changes to line {0}-{1}",this._move.lineRangeMapping.modified.startLineNumber,this._move.lineRangeMapping.modified.endLineNumberExclusive-1):l.localize(148,"Code moved with changes from line {0}-{1}",this._move.lineRangeMapping.original.startLineNumber,this._move.lineRangeMapping.original.endLineNumberExclusive-1):c=this._kind==="original"?l.localize(149,"Code moved to line {0}-{1}",this._move.lineRangeMapping.modified.startLineNumber,this._move.lineRangeMapping.modified.endLineNumberExclusive-1):l.localize(150,"Code moved from line {0}-{1}",this._move.lineRangeMapping.original.startLineNumber,this._move.lineRangeMapping.original.endLineNumberExclusive-1);const h=this._register(new el(this._nodes.actionBar,{highlightToggledItems:!0})),d=new oo("",c,"",!1);h.push(d,{icon:!1,label:!0});const u=new oo("","Compare",_.ThemeIcon.asClassName(l.Codicon.compareChanges),!0,()=>{this._editor.focus(),this._diffModel.movedTextToCompare.set(this._diffModel.movedTextToCompare.get()===i?void 0:this._move,void 0)});this._register(he(f=>{const g=this._diffModel.movedTextToCompare.read(f)===i;u.checked=g})),h.push(u,{icon:!1,label:!0})}}class $X extends l.Disposable{constructor(e,t,i,n){super(),this._editors=e,this._diffModel=t,this._options=i,this._decorations=Z(this,s=>{const r=this._diffModel.read(s),a=r?.diff.read(s);if(!a)return null;const c=this._diffModel.read(s).movedTextToCompare.read(s),h=this._options.renderIndicators.read(s),d=this._options.showEmptyDecorations.read(s),u=[],f=[];if(!c)for(const m of a.mappings)if(m.lineRangeMapping.original.isEmpty||u.push({range:m.lineRangeMapping.original.toInclusiveRange(),options:h?_O:CO}),m.lineRangeMapping.modified.isEmpty||f.push({range:m.lineRangeMapping.modified.toInclusiveRange(),options:h?pO:bO}),m.lineRangeMapping.modified.isEmpty||m.lineRangeMapping.original.isEmpty)m.lineRangeMapping.original.isEmpty||u.push({range:m.lineRangeMapping.original.toInclusiveRange(),options:MX}),m.lineRangeMapping.modified.isEmpty||f.push({range:m.lineRangeMapping.modified.toInclusiveRange(),options:NX});else{const p=this._options.useTrueInlineDiffRendering.read(s)&&k0(m.lineRangeMapping);for(const b of m.lineRangeMapping.innerChanges||[])if(m.lineRangeMapping.original.contains(b.originalRange.startLineNumber)&&u.push({range:b.originalRange,options:b.originalRange.isEmpty()&&d?AX:T0}),m.lineRangeMapping.modified.contains(b.modifiedRange.startLineNumber)&&f.push({range:b.modifiedRange,options:b.modifiedRange.isEmpty()&&d&&!p?RX:vO}),p){const v=r.model.original.getValueInRange(b.originalRange);f.push({range:b.modifiedRange,options:{description:"deleted-text",before:{content:v,inlineClassName:"inline-deleted-text"},zIndex:1e5,showIfCollapsed:!0}})}}if(c)for(const m of c.changes){const p=m.original.toInclusiveRange();p&&u.push({range:p,options:h?_O:CO});const b=m.modified.toInclusiveRange();b&&f.push({range:b,options:h?pO:bO});for(const v of m.innerChanges||[])u.push({range:v.originalRange,options:T0}),f.push({range:v.modifiedRange,options:vO})}const g=this._diffModel.read(s).activeMovedText.read(s);for(const m of a.movedTexts)u.push({range:m.lineRangeMapping.original.toInclusiveRange(),options:{description:"moved",blockClassName:"movedOriginal"+(m===g?" currentMove":""),blockPadding:[Lh.movedCodeBlockPadding,0,Lh.movedCodeBlockPadding,Lh.movedCodeBlockPadding]}}),f.push({range:m.lineRangeMapping.modified.toInclusiveRange(),options:{description:"moved",blockClassName:"movedModified"+(m===g?" currentMove":""),blockPadding:[4,0,4,4]}});return{originalDecorations:u,modifiedDecorations:f}}),this._register(M_(this._editors.original,this._decorations.map(s=>s?.originalDecorations||[]))),this._register(M_(this._editors.modified,this._decorations.map(s=>s?.modifiedDecorations||[])))}}class Un{static equals(e,t){return e.x===t.x&&e.y===t.y}constructor(e,t){this.x=e,this.y=t}add(e){return new Un(this.x+e.x,this.y+e.y)}deltaX(e){return new Un(this.x+e,this.y)}deltaY(e){return new Un(this.x,this.y+e)}toString(){return`(${this.x},${this.y})`}subtract(e){return new Un(this.x-e.x,this.y-e.y)}scale(e){return new Un(this.x*e,this.y*e)}mapComponents(e){return new Un(e(this.x),e(this.y))}isZero(){return this.x===0&&this.y===0}withThreshold(e){return this.mapComponents(t=>t>e?t-e:t<-e?t+e:0)}}function Mr(o){return z0.get(o)}const Fr=class Fr extends l.Disposable{static get(e){let t=Fr._map.get(e);if(!t){t=new Fr(e),Fr._map.set(e,t);const i=e.onDidDispose(()=>{const n=Fr._map.get(e);n&&(Fr._map.delete(e),n.dispose(),i.dispose())})}return t}_beginUpdate(){this._updateCounter++,this._updateCounter===1&&(this._currentTransaction=new $l(()=>{}))}_endUpdate(){if(this._updateCounter--,this._updateCounter===0){const e=this._currentTransaction;this._currentTransaction=void 0,e.finish()}}constructor(e){super(),this.editor=e,this._sawZeroLineWidth=!1,this._onDidContainerResize=An({owner:this,getTransaction:()=>this._currentTransaction},t=>{const i=this.editor.getContainerDomNode(),n=new ResizeObserver(()=>{this._sawZeroLineWidth&&(this._sawZeroLineWidth=!1,this.editor.resetLineWidthCaches()),t(void 0)});return n.observe(i),{dispose:()=>n.disconnect()}},()=>({})),this._updateCounter=0,this._currentTransaction=void 0,this._model=W(this,this.editor.getModel()),this.model=this._model,this.isReadonly=An({owner:this,getTransaction:()=>this._currentTransaction},this.editor.onDidChangeConfiguration,()=>this.editor.getOption(104)),this._versionId=Wh({owner:this,lazy:!0},this.editor.getModel()?.getVersionId()??null),this.versionId=this._versionId,this._selections=Wh({owner:this,equalsFn:Gr(Zh(l.Selection.selectionsEqual)),lazy:!0},this.editor.getSelections()??null),this.selections=this._selections,this.positions=fn({owner:this,equalsFn:Gr(Zh(l.Position.equals))},t=>this.selections.read(t)?.map(i=>i.getStartPosition())??null),this.isFocused=An({owner:this,getTransaction:()=>this._currentTransaction},t=>{const i=this.editor.onDidFocusEditorWidget(t),n=this.editor.onDidBlurEditorWidget(t);return{dispose(){i.dispose(),n.dispose()}}},()=>this.editor.hasWidgetFocus()),this.isTextFocused=An({owner:this,getTransaction:()=>this._currentTransaction},t=>{const i=this.editor.onDidFocusEditorText(t),n=this.editor.onDidBlurEditorText(t);return{dispose(){i.dispose(),n.dispose()}}},()=>this.editor.hasTextFocus()),this.inComposition=An({owner:this,getTransaction:()=>this._currentTransaction},t=>{const i=this.editor.onDidCompositionStart(()=>{t(void 0)}),n=this.editor.onDidCompositionEnd(()=>{t(void 0)});return{dispose(){i.dispose(),n.dispose()}}},()=>this.editor.inComposition),this.value=Hb(this,t=>(this.versionId.read(t),this.model.read(t)?.getValue()??""),(t,i)=>{const n=this.model.get();n!==null&&t!==n.getValue()&&n.setValue(t)}),this.valueIsEmpty=Z(this,t=>(this.versionId.read(t),this.editor.getModel()?.getValueLength()===0)),this.cursorSelection=fn({owner:this,equalsFn:Gr(l.Selection.selectionsEqual)},t=>this.selections.read(t)?.[0]??null),this.cursorPosition=fn({owner:this,equalsFn:l.Position.equals},t=>this.selections.read(t)?.[0]?.getPosition()??null),this.cursorLineNumber=Z(this,t=>this.cursorPosition.read(t)?.lineNumber??null),this.onDidType=qr(this),this.onDidPaste=qr(this),this.scrollTop=An({owner:this,getTransaction:()=>this._currentTransaction},this.editor.onDidScrollChange,()=>this.editor.getScrollTop()),this.scrollLeft=An({owner:this,getTransaction:()=>this._currentTransaction},this.editor.onDidScrollChange,()=>this.editor.getScrollLeft()),this.layoutInfo=An({owner:this,getTransaction:()=>this._currentTransaction},this.editor.onDidLayoutChange,()=>this.editor.getLayoutInfo()),this.layoutInfoContentLeft=this.layoutInfo.map(t=>t.contentLeft),this.layoutInfoDecorationsLeft=this.layoutInfo.map(t=>t.decorationsLeft),this.layoutInfoWidth=this.layoutInfo.map(t=>t.width),this.layoutInfoHeight=this.layoutInfo.map(t=>t.height),this.layoutInfoMinimap=this.layoutInfo.map(t=>t.minimap),this.layoutInfoVerticalScrollbarWidth=this.layoutInfo.map(t=>t.verticalScrollbarWidth),this.contentWidth=An({owner:this,getTransaction:()=>this._currentTransaction},this.editor.onDidContentSizeChange,()=>this.editor.getContentWidth()),this.contentHeight=An({owner:this,getTransaction:()=>this._currentTransaction},this.editor.onDidContentSizeChange,()=>this.editor.getContentHeight()),this._onDidChangeViewZones=Ii(this,this.editor.onDidChangeViewZones),this._onDidHiddenAreasChanged=Ii(this,this.editor.onDidChangeHiddenAreas),this._onDidLineHeightChanged=Ii(this,this.editor.onDidChangeLineHeight),this._widgetCounter=0,this.openedPeekWidgets=W(this,0),this._register(this.editor.onBeginUpdate(()=>this._beginUpdate())),this._register(this.editor.onEndUpdate(()=>this._endUpdate())),this._register(this.editor.onDidChangeModel(()=>{this._beginUpdate();try{this._model.set(this.editor.getModel(),this._currentTransaction),this._forceUpdate()}finally{this._endUpdate()}})),this._register(this.editor.onDidType(t=>{this._beginUpdate();try{this._forceUpdate(),this.onDidType.trigger(this._currentTransaction,t)}finally{this._endUpdate()}})),this._register(this.editor.onDidPaste(t=>{this._beginUpdate();try{this._forceUpdate(),this.onDidPaste.trigger(this._currentTransaction,t)}finally{this._endUpdate()}})),this._register(this.editor.onDidChangeModelContent(t=>{this._beginUpdate();try{this._versionId.set(this.editor.getModel()?.getVersionId()??null,this._currentTransaction,t),this._forceUpdate()}finally{this._endUpdate()}})),this._register(this.editor.onDidChangeCursorSelection(t=>{this._beginUpdate();try{this._selections.set(this.editor.getSelections(),this._currentTransaction,t),this._forceUpdate()}finally{this._endUpdate()}})),this.domNode=Z(t=>(this.model.read(t),this.editor.getDomNode()))}transaction(e){this._beginUpdate();try{return e(this._currentTransaction)}finally{this._endUpdate()}}forceUpdate(e){this._beginUpdate();try{return this._forceUpdate(),e?e(this._currentTransaction):void 0}finally{this._endUpdate()}}_forceUpdate(){this._beginUpdate();try{this._model.set(this.editor.getModel(),this._currentTransaction),this._versionId.set(this.editor.getModel()?.getVersionId()??null,this._currentTransaction,void 0),this._selections.set(this.editor.getSelections(),this._currentTransaction,void 0)}finally{this._endUpdate()}}getOption(e,t=_.DebugLocation.ofCaller()){return mt(this,i=>this.editor.onDidChangeConfiguration(n=>{n.hasChanged(e)&&i(void 0)}),()=>this.editor.getOption(e),t)}setDecorations(e){const t=new l.DisposableStore,i=this.editor.createDecorationsCollection();return t.add($f({owner:this,debugName:()=>`Apply decorations from ${e.debugName}`},n=>{const s=e.read(n);i.set(s)})),t.add({dispose:()=>{i.clear()}}),t}createOverlayWidget(e){const t="observableOverlayWidget"+this._widgetCounter++,i={getDomNode:()=>e.domNode,getPosition:()=>e.position.get(),getId:()=>t,allowEditorOverflow:e.allowEditorOverflow,getMinContentWidthInPx:()=>e.minContentWidthInPx.get()};this.editor.addOverlayWidget(i);const n=he(s=>{e.position.read(s),e.minContentWidthInPx.read(s),this.editor.layoutOverlayWidget(i)});return l.toDisposable(()=>{n.dispose(),this.editor.removeOverlayWidget(i)})}createContentWidget(e){const t="observableContentWidget"+this._widgetCounter++,i={getDomNode:()=>e.domNode,getPosition:()=>e.position.get(),getId:()=>t,allowEditorOverflow:e.allowEditorOverflow};this.editor.addContentWidget(i);const n=he(s=>{e.position.read(s),this.editor.layoutContentWidget(i)});return l.toDisposable(()=>{n.dispose(),this.editor.removeContentWidget(i)})}observeLineOffsetRange(e,t){const i=this.observePosition(e.map(s=>new l.Position(s.startLineNumber,1)),t),n=this.observePosition(e.map(s=>new l.Position(s.endLineNumberExclusive+1,1)),t);return Z(s=>{i.read(s),n.read(s);const r=e.read(s),a=this.model.read(s)?.getLineCount(),c=(typeof a<"u"&&r.startLineNumber>a?this.editor.getBottomForLineNumber(a):this.editor.getTopForLineNumber(r.startLineNumber))-this.scrollTop.read(s),h=r.isEmpty?c:this.editor.getBottomForLineNumber(r.endLineNumberExclusive-1)-this.scrollTop.read(s);return new l.OffsetRange(c,h)})}getLeftOfPosition(e,t){this.layoutInfo.read(t),this.value.read(t);let i=this.editor.getOffsetForColumn(e.lineNumber,e.column);if(i===-1){const n=this.editor.getOption(59).typicalHalfwidthCharacterWidth;i=e.column*n}return i}observePosition(e,t){let i=e.get();const n=Wh({owner:this,debugName:()=>`topLeftOfPosition${i?.toString()}`,equalsFn:Gr(Un.equals)},new Un(0,0)),s="observablePositionWidget"+this._widgetCounter++,r=document.createElement("div"),a={getDomNode:()=>r,getPosition:()=>i?{preference:[0],position:e.get()}:null,getId:()=>s,allowEditorOverflow:!1,useDisplayNone:!0,afterRender:(c,h)=>{const d=this._model.get();d&&i&&i.lineNumber>d.getLineCount()?n.set(new Un(0,this.editor.getBottomForLineNumber(d.getLineCount())-this.scrollTop.get()),void 0):n.set(h?new Un(h.left,h.top):null,void 0)}};return this.editor.addContentWidget(a),t.add(he(c=>{i=e.read(c),this.editor.layoutContentWidget(a)})),t.add(l.toDisposable(()=>{this.editor.removeContentWidget(a)})),n}isTargetHovered(e,t){const i=W("isInjectedTextHovered",!1);return t.add(this.editor.onMouseMove(n=>{const s=e(n);i.set(s,void 0)})),t.add(this.editor.onMouseLeave(n=>{i.set(!1,void 0)})),i}observeLineHeightForPosition(e){return Z(t=>{const i=e instanceof l.Position?e:e.read(t);return i===null?null:(this.getOption(75).read(t),this.editor.getLineHeightForPosition(i))})}observeLineHeightForLine(e){return typeof e=="number"?this.observeLineHeightForPosition(new l.Position(e,1)):Z(t=>{const i=e.read(t);return i===null?null:this.observeLineHeightForPosition(new l.Position(i,1)).read(t)})}observeLineHeightsForLineRange(e){return Z(t=>{const i=e instanceof l.LineRange?e:e.read(t),n=[];for(let s=i.startLineNumber;s<i.endLineNumberExclusive;s++)n.push(this.observeLineHeightForLine(s).read(t));return n})}getWidthOfLine(e,t){this.layoutInfo.read(t),this.value.read(t),this.scrollTop.read(t);const i=this.editor.getWidthOfLine(e);return this._onDidContainerResize.read(t),i===0&&(this._sawZeroLineWidth=!0),i}observeTopForLineNumber(e){return Z(t=>(this.layoutInfo.read(t),this._onDidChangeViewZones.read(t),this._onDidHiddenAreasChanged.read(t),this._onDidLineHeightChanged.read(t),this._versionId.read(t),this.editor.getTopForLineNumber(e)))}};Fr._map=new Map;let z0=Fr;var KX=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},GX=function(o,e){return function(t,i){e(t,i,o)}},ss;let df=($o=class extends l.Disposable{constructor(e,t,i,n,s,r,a){super(),this._editors=e,this._rootElement=t,this._diffModel=i,this._rootWidth=n,this._rootHeight=s,this._modifiedEditorLayoutInfo=r,this._themeService=a,this.width=ss.ENTIRE_DIFF_OVERVIEW_WIDTH;const c=mt(this._themeService.onDidColorThemeChange,()=>this._themeService.getColorTheme()),h=Z(f=>{const g=c.read(f),m=g.getColor(kV)||(g.getColor(BE)||JC).transparent(2),p=g.getColor(FV)||(g.getColor(zE)||WC).transparent(2);return{insertColor:m,removeColor:p}}),d=we(document.createElement("div"));d.setClassName("diffViewport"),d.setPosition("absolute");const u=_e("div.diffOverview",{style:{position:"absolute",top:"0px",width:ss.ENTIRE_DIFF_OVERVIEW_WIDTH+"px"}}).root;this._register(wh(u,d.domNode)),this._register(At(u,F.POINTER_DOWN,f=>{this._editors.modified.delegateVerticalScrollbarPointerDown(f)})),this._register(R(u,F.MOUSE_WHEEL,f=>{this._editors.modified.delegateScrollFromMouseWheelEvent(f)},{passive:!1})),this._register(wh(this._rootElement,u)),this._register(Kn((f,g)=>{const m=this._diffModel.read(f),p=this._editors.original.createOverviewRuler("original diffOverviewRuler");p&&(g.add(p),g.add(wh(u,p.getDomNode())));const b=this._editors.modified.createOverviewRuler("modified diffOverviewRuler");if(b&&(g.add(b),g.add(wh(u,b.getDomNode()))),!p||!b)return;const v=Ii("viewZoneChanged",this._editors.original.onDidChangeViewZones),C=Ii("viewZoneChanged",this._editors.modified.onDidChangeViewZones),w=Ii("hiddenRangesChanged",this._editors.original.onDidChangeHiddenAreas),S=Ii("hiddenRangesChanged",this._editors.modified.onDidChangeHiddenAreas);g.add(he(L=>{v.read(L),C.read(L),w.read(L),S.read(L);const D=h.read(L),x=m?.diff.read(L)?.mappings;function I(O,P,k){const U=k._getViewModel();return U?O.filter(B=>B.length>0).map(B=>{const G=U.coordinatesConverter.convertModelPositionToViewPosition(new l.Position(B.startLineNumber,1)),X=U.coordinatesConverter.convertModelPositionToViewPosition(new l.Position(B.endLineNumberExclusive,1)),re=X.lineNumber-G.lineNumber;return new fT(G.lineNumber,X.lineNumber,re,P.toString())}):[]}const T=I((x||[]).map(O=>O.lineRangeMapping.original),D.removeColor,this._editors.original),M=I((x||[]).map(O=>O.lineRangeMapping.modified),D.insertColor,this._editors.modified);p?.setZones(T),b?.setZones(M)})),g.add(he(L=>{const D=this._rootHeight.read(L),x=this._rootWidth.read(L),I=this._modifiedEditorLayoutInfo.read(L);if(I){const T=ss.ENTIRE_DIFF_OVERVIEW_WIDTH-2*ss.ONE_OVERVIEW_WIDTH;p.setLayout({top:0,height:D,right:T+ss.ONE_OVERVIEW_WIDTH,width:ss.ONE_OVERVIEW_WIDTH}),b.setLayout({top:0,height:D,right:0,width:ss.ONE_OVERVIEW_WIDTH});const M=this._editors.modifiedScrollTop.read(L),O=this._editors.modifiedScrollHeight.read(L),P=this._editors.modified.getOption(117),k=new gc(P.verticalHasArrows?P.arrowSize:0,P.verticalScrollbarSize,0,I.height,O,M);d.setTop(k.getSliderPosition()),d.setHeight(k.getSliderSize())}else d.setTop(0),d.setHeight(0);u.style.height=D+"px",u.style.left=x-ss.ENTIRE_DIFF_OVERVIEW_WIDTH+"px",d.setWidth(ss.ENTIRE_DIFF_OVERVIEW_WIDTH)}))}))}},ss=$o,$o.ONE_OVERVIEW_WIDTH=15,$o.ENTIRE_DIFF_OVERVIEW_WIDTH=$o.ONE_OVERVIEW_WIDTH*2,$o);df=ss=KX([GX(6,_i)],df);var jX=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},V0=function(o,e){return function(t,i){e(t,i,o)}};let U0=class extends l.Disposable{get onDidContentSizeChange(){return this._onDidContentSizeChange.event}constructor(e,t,i,n,s,r,a,c){super(),this.originalEditorElement=e,this.modifiedEditorElement=t,this._options=i,this._argCodeEditorWidgetOptions=n,this._createInnerEditor=s,this._contextKeyService=r,this._instantiationService=a,this._keybindingService=c,this.original=this._register(this._createLeftHandSideEditor(this._options.editorOptions.get(),this._argCodeEditorWidgetOptions.originalEditor||{})),this.modified=this._register(this._createRightHandSideEditor(this._options.editorOptions.get(),this._argCodeEditorWidgetOptions.modifiedEditor||{})),this._onDidContentSizeChange=this._register(new l.Emitter),this.modifiedScrollTop=mt(this,this.modified.onDidScrollChange,()=>this.modified.getScrollTop()),this.modifiedScrollHeight=mt(this,this.modified.onDidScrollChange,()=>this.modified.getScrollHeight()),this.modifiedObs=Mr(this.modified),this.originalObs=Mr(this.original),this.modifiedModel=this.modifiedObs.model,this.modifiedSelections=mt(this,this.modified.onDidChangeCursorSelection,()=>this.modified.getSelections()??[]),this.modifiedCursor=fn({owner:this,equalsFn:l.Position.equals},h=>this.modifiedSelections.read(h)[0]?.getPosition()??new l.Position(1,1)),this.originalCursor=mt(this,this.original.onDidChangeCursorPosition,()=>this.original.getPosition()??new l.Position(1,1)),this.isOriginalFocused=Mr(this.original).isFocused,this.isModifiedFocused=Mr(this.modified).isFocused,this.isFocused=Z(this,h=>this.isOriginalFocused.read(h)||this.isModifiedFocused.read(h)),this._argCodeEditorWidgetOptions=null,this._register(Gl({changeTracker:{createChangeSummary:()=>({}),handleChange:(h,d)=>(h.didChange(i.editorOptions)&&Object.assign(d,h.change.changedOptions),!0)}},(h,d)=>{i.editorOptions.read(h),this._options.renderSideBySide.read(h),this.modified.updateOptions(this._adjustOptionsForRightHandSide(h,d)),this.original.updateOptions(this._adjustOptionsForLeftHandSide(h,d))}))}_createLeftHandSideEditor(e,t){const i=this._adjustOptionsForLeftHandSide(void 0,e),n=this._constructInnerEditor(this._instantiationService,this.originalEditorElement,i,t),s=this._contextKeyService.createKey("isInDiffLeftEditor",n.hasWidgetFocus());return this._register(n.onDidFocusEditorWidget(()=>s.set(!0))),this._register(n.onDidBlurEditorWidget(()=>s.set(!1))),n}_createRightHandSideEditor(e,t){const i=this._adjustOptionsForRightHandSide(void 0,e),n=this._constructInnerEditor(this._instantiationService,this.modifiedEditorElement,i,t),s=this._contextKeyService.createKey("isInDiffRightEditor",n.hasWidgetFocus());return this._register(n.onDidFocusEditorWidget(()=>s.set(!0))),this._register(n.onDidBlurEditorWidget(()=>s.set(!1))),n}_constructInnerEditor(e,t,i,n){const s=this._createInnerEditor(e,t,i,n);return this._register(s.onDidContentSizeChange(r=>{const a=this.original.getContentWidth()+this.modified.getContentWidth()+df.ENTIRE_DIFF_OVERVIEW_WIDTH,c=Math.max(this.modified.getContentHeight(),this.original.getContentHeight());this._onDidContentSizeChange.fire({contentHeight:c,contentWidth:a,contentHeightChanged:r.contentHeightChanged,contentWidthChanged:r.contentWidthChanged})})),s}_adjustOptionsForLeftHandSide(e,t){const i=this._adjustOptionsForSubEditor(t);return this._options.renderSideBySide.get()?(i.unicodeHighlight=this._options.editorOptions.get().unicodeHighlight||{},i.wordWrapOverride1=this._options.diffWordWrap.get()):(i.wordWrapOverride1="off",i.wordWrapOverride2="off",i.stickyScroll={enabled:!1},i.unicodeHighlight={nonBasicASCII:!1,ambiguousCharacters:!1,invisibleCharacters:!1}),i.glyphMargin=this._options.renderSideBySide.get(),t.originalAriaLabel&&(i.ariaLabel=t.originalAriaLabel),i.ariaLabel=this._updateAriaLabel(i.ariaLabel),i.readOnly=!this._options.originalEditable.get(),i.dropIntoEditor={enabled:!i.readOnly},i.extraEditorClassName="original-in-monaco-diff-editor",i}_adjustOptionsForRightHandSide(e,t){const i=this._adjustOptionsForSubEditor(t);return t.modifiedAriaLabel&&(i.ariaLabel=t.modifiedAriaLabel),i.ariaLabel=this._updateAriaLabel(i.ariaLabel),i.wordWrapOverride1=this._options.diffWordWrap.get(),i.revealHorizontalRightPadding=Fi.revealHorizontalRightPadding.defaultValue+df.ENTIRE_DIFF_OVERVIEW_WIDTH,i.scrollbar.verticalHasArrows=!1,i.extraEditorClassName="modified-in-monaco-diff-editor",i}_adjustOptionsForSubEditor(e){const t={...e,dimension:{height:0,width:0}};return t.inDiffEditor=!0,t.automaticLayout=!1,t.allowVariableLineHeights=!1,t.allowVariableFonts=!1,t.allowVariableFontsInAccessibilityMode=!1,t.scrollbar={...t.scrollbar||{}},t.folding=!1,t.codeLens=this._options.diffCodeLens.get(),t.fixedOverflowWidgets=!0,t.minimap={...t.minimap||{}},t.minimap.enabled=!1,this._options.hideUnchangedRegions.get()?t.stickyScroll={enabled:!1}:t.stickyScroll=this._options.editorOptions.get().stickyScroll,t}_updateAriaLabel(e){e||(e="");const t=l.localize(127," use {0} to open the accessibility help.",this._keybindingService.lookupKeybinding("editor.action.accessibilityHelp")?.getAriaLabel());return this._options.accessibilityVerbose.get()?e+t:e?e.replaceAll(t,""):""}};U0=jX([V0(5,be),V0(6,me),V0(7,xt)],U0);class qX{resetSash(){this._sashRatio.set(void 0,void 0)}constructor(e,t){this._options=e,this.dimensions=t,this.sashLeft=Hb(this,i=>{const n=this._sashRatio.read(i)??this._options.splitViewDefaultRatio.read(i);return this._computeSashLeft(n,i)},(i,n)=>{const s=this.dimensions.width.get();this._sashRatio.set(i/s,n)}),this._sashRatio=W(this,void 0)}_computeSashLeft(e,t){const i=this.dimensions.width.read(t),n=Math.floor(this._options.splitViewDefaultRatio.read(t)*i),s=this._options.enableSplitViewResizing.read(t)?Math.floor(e*i):n,r=100;return i<=r*2?n:s<r?r:s>i-r?i-r:s}}class AO extends l.Disposable{constructor(e,t,i,n,s,r){super(),this._domNode=e,this._dimensions=t,this._enabled=i,this._boundarySashes=n,this.sashLeft=s,this._resetSash=r,this._sash=this._register(new on(this._domNode,{getVerticalSashTop:a=>0,getVerticalSashLeft:a=>this.sashLeft.get(),getVerticalSashHeight:a=>this._dimensions.height.get()},{orientation:0})),this._startSashPosition=void 0,this._register(this._sash.onDidStart(()=>{this._startSashPosition=this.sashLeft.get()})),this._register(this._sash.onDidChange(a=>{this.sashLeft.set(this._startSashPosition+(a.currentX-a.startX),void 0)})),this._register(this._sash.onDidEnd(()=>this._sash.layout())),this._register(this._sash.onDidReset(()=>this._resetSash())),this._register(he(a=>{const c=this._boundarySashes.read(a);c&&(this._sash.orthogonalEndSash=c.bottom)})),this._register(he(a=>{const c=this._enabled.read(a);this._sash.state=c?3:0,this.sashLeft.read(a),this._dimensions.height.read(a),this._sash.layout()}))}}const Tb=class Tb extends l.Disposable{constructor(){super(...arguments),this._id=++Tb.idCounter,this._onDidDispose=this._register(new l.Emitter),this.onDidDispose=this._onDidDispose.event}getId(){return this.getEditorType()+":v2:"+this._id}getVisibleColumnFromPosition(e){return this._targetEditor.getVisibleColumnFromPosition(e)}getPosition(){return this._targetEditor.getPosition()}setPosition(e,t="api"){this._targetEditor.setPosition(e,t)}revealLine(e,t=0){this._targetEditor.revealLine(e,t)}revealLineInCenter(e,t=0){this._targetEditor.revealLineInCenter(e,t)}revealLineInCenterIfOutsideViewport(e,t=0){this._targetEditor.revealLineInCenterIfOutsideViewport(e,t)}revealLineNearTop(e,t=0){this._targetEditor.revealLineNearTop(e,t)}revealPosition(e,t=0){this._targetEditor.revealPosition(e,t)}revealPositionInCenter(e,t=0){this._targetEditor.revealPositionInCenter(e,t)}revealPositionInCenterIfOutsideViewport(e,t=0){this._targetEditor.revealPositionInCenterIfOutsideViewport(e,t)}revealPositionNearTop(e,t=0){this._targetEditor.revealPositionNearTop(e,t)}getSelection(){return this._targetEditor.getSelection()}getSelections(){return this._targetEditor.getSelections()}setSelection(e,t="api"){this._targetEditor.setSelection(e,t)}setSelections(e,t="api"){this._targetEditor.setSelections(e,t)}revealLines(e,t,i=0){this._targetEditor.revealLines(e,t,i)}revealLinesInCenter(e,t,i=0){this._targetEditor.revealLinesInCenter(e,t,i)}revealLinesInCenterIfOutsideViewport(e,t,i=0){this._targetEditor.revealLinesInCenterIfOutsideViewport(e,t,i)}revealLinesNearTop(e,t,i=0){this._targetEditor.revealLinesNearTop(e,t,i)}revealRange(e,t=0,i=!1,n=!0){this._targetEditor.revealRange(e,t,i,n)}revealRangeInCenter(e,t=0){this._targetEditor.revealRangeInCenter(e,t)}revealRangeInCenterIfOutsideViewport(e,t=0){this._targetEditor.revealRangeInCenterIfOutsideViewport(e,t)}revealRangeNearTop(e,t=0){this._targetEditor.revealRangeNearTop(e,t)}revealRangeNearTopIfOutsideViewport(e,t=0){this._targetEditor.revealRangeNearTopIfOutsideViewport(e,t)}revealRangeAtTop(e,t=0){this._targetEditor.revealRangeAtTop(e,t)}getSupportedActions(){return this._targetEditor.getSupportedActions()}focus(){this._targetEditor.focus()}trigger(e,t,i){this._targetEditor.trigger(e,t,i)}createDecorationsCollection(e){return this._targetEditor.createDecorationsCollection(e)}changeDecorations(e){return this._targetEditor.changeDecorations(e)}};Tb.idCounter=0;let $0=Tb;var YX=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},ZX=function(o,e){return function(t,i){e(t,i,o)}};let K0=class{get editorOptions(){return this._options}constructor(e,t){this._accessibilityService=t,this._diffEditorWidth=W(this,0),this._screenReaderMode=mt(this,this._accessibilityService.onDidChangeScreenReaderOptimized,()=>this._accessibilityService.isScreenReaderOptimized()),this.couldShowInlineViewBecauseOfSize=Z(this,n=>this._options.read(n).renderSideBySide&&this._diffEditorWidth.read(n)<=this._options.read(n).renderSideBySideInlineBreakpoint),this.renderOverviewRuler=Z(this,n=>this._options.read(n).renderOverviewRuler),this.renderSideBySide=Z(this,n=>this.compactMode.read(n)&&this.shouldRenderInlineViewInSmartMode.read(n)?!1:this._options.read(n).renderSideBySide&&!(this._options.read(n).useInlineViewWhenSpaceIsLimited&&this.couldShowInlineViewBecauseOfSize.read(n)&&!this._screenReaderMode.read(n))),this.readOnly=Z(this,n=>this._options.read(n).readOnly),this.shouldRenderOldRevertArrows=Z(this,n=>!(!this._options.read(n).renderMarginRevertIcon||!this.renderSideBySide.read(n)||this.readOnly.read(n)||this.shouldRenderGutterMenu.read(n))),this.shouldRenderGutterMenu=Z(this,n=>this._options.read(n).renderGutterMenu),this.renderIndicators=Z(this,n=>this._options.read(n).renderIndicators),this.enableSplitViewResizing=Z(this,n=>this._options.read(n).enableSplitViewResizing),this.splitViewDefaultRatio=Z(this,n=>this._options.read(n).splitViewDefaultRatio),this.ignoreTrimWhitespace=Z(this,n=>this._options.read(n).ignoreTrimWhitespace),this.maxComputationTimeMs=Z(this,n=>this._options.read(n).maxComputationTime),this.showMoves=Z(this,n=>this._options.read(n).experimental.showMoves&&this.renderSideBySide.read(n)),this.isInEmbeddedEditor=Z(this,n=>this._options.read(n).isInEmbeddedEditor),this.diffWordWrap=Z(this,n=>this._options.read(n).diffWordWrap),this.originalEditable=Z(this,n=>this._options.read(n).originalEditable),this.diffCodeLens=Z(this,n=>this._options.read(n).diffCodeLens),this.accessibilityVerbose=Z(this,n=>this._options.read(n).accessibilityVerbose),this.diffAlgorithm=Z(this,n=>this._options.read(n).diffAlgorithm),this.showEmptyDecorations=Z(this,n=>this._options.read(n).experimental.showEmptyDecorations),this.onlyShowAccessibleDiffViewer=Z(this,n=>this._options.read(n).onlyShowAccessibleDiffViewer),this.compactMode=Z(this,n=>this._options.read(n).compactMode),this.trueInlineDiffRenderingEnabled=Z(this,n=>this._options.read(n).experimental.useTrueInlineView),this.useTrueInlineDiffRendering=Z(this,n=>!this.renderSideBySide.read(n)&&this.trueInlineDiffRenderingEnabled.read(n)),this.hideUnchangedRegions=Z(this,n=>this._options.read(n).hideUnchangedRegions.enabled),this.hideUnchangedRegionsRevealLineCount=Z(this,n=>this._options.read(n).hideUnchangedRegions.revealLineCount),this.hideUnchangedRegionsContextLineCount=Z(this,n=>this._options.read(n).hideUnchangedRegions.contextLineCount),this.hideUnchangedRegionsMinimumLineCount=Z(this,n=>this._options.read(n).hideUnchangedRegions.minimumLineCount),this._model=W(this,void 0),this.shouldRenderInlineViewInSmartMode=this._model.map(this,n=>nF(this,s=>{const r=n?.diff.read(s);return r?QX(r,this.trueInlineDiffRenderingEnabled.read(s)):void 0})).flatten().map(this,n=>!!n),this.inlineViewHideOriginalLineNumbers=this.compactMode;const i={...e,...OO(e,Yt)};this._options=W(this,i)}updateOptions(e){const t=OO(e,this._options.get()),i={...this._options.get(),...e,...t};this._options.set(i,void 0,{changedOptions:e})}setWidth(e){this._diffEditorWidth.set(e,void 0)}setModel(e){this._model.set(e,void 0)}};K0=YX([ZX(1,Ui)],K0);function QX(o,e){return o.mappings.every(t=>XX(t.lineRangeMapping)||JX(t.lineRangeMapping)||e&&k0(t.lineRangeMapping))}function XX(o){return o.original.length===0}function JX(o){return o.modified.length===0}function OO(o,e){return{enableSplitViewResizing:$(o.enableSplitViewResizing,e.enableSplitViewResizing),splitViewDefaultRatio:EP(o.splitViewDefaultRatio,.5,.1,.9),renderSideBySide:$(o.renderSideBySide,e.renderSideBySide),renderMarginRevertIcon:$(o.renderMarginRevertIcon,e.renderMarginRevertIcon),maxComputationTime:to(o.maxComputationTime,e.maxComputationTime,0,1073741824),maxFileSize:to(o.maxFileSize,e.maxFileSize,0,1073741824),ignoreTrimWhitespace:$(o.ignoreTrimWhitespace,e.ignoreTrimWhitespace),renderIndicators:$(o.renderIndicators,e.renderIndicators),originalEditable:$(o.originalEditable,e.originalEditable),diffCodeLens:$(o.diffCodeLens,e.diffCodeLens),renderOverviewRuler:$(o.renderOverviewRuler,e.renderOverviewRuler),diffWordWrap:Fe(o.diffWordWrap,e.diffWordWrap,["off","on","inherit"]),diffAlgorithm:Fe(o.diffAlgorithm,e.diffAlgorithm,["legacy","advanced","advanced-external","advanced-wasm"],{smart:"legacy",experimental:"advanced"}),accessibilityVerbose:$(o.accessibilityVerbose,e.accessibilityVerbose),experimental:{showMoves:$(o.experimental?.showMoves,e.experimental.showMoves),showEmptyDecorations:$(o.experimental?.showEmptyDecorations,e.experimental.showEmptyDecorations),useTrueInlineView:$(o.experimental?.useTrueInlineView,e.experimental.useTrueInlineView)},hideUnchangedRegions:{enabled:$(o.hideUnchangedRegions?.enabled??o.experimental?.collapseUnchangedRegions,e.hideUnchangedRegions.enabled),contextLineCount:to(o.hideUnchangedRegions?.contextLineCount,e.hideUnchangedRegions.contextLineCount,0,1073741824),minimumLineCount:to(o.hideUnchangedRegions?.minimumLineCount,e.hideUnchangedRegions.minimumLineCount,0,1073741824),revealLineCount:to(o.hideUnchangedRegions?.revealLineCount,e.hideUnchangedRegions.revealLineCount,0,1073741824)},isInEmbeddedEditor:$(o.isInEmbeddedEditor,e.isInEmbeddedEditor),onlyShowAccessibleDiffViewer:$(o.onlyShowAccessibleDiffViewer,e.onlyShowAccessibleDiffViewer),renderSideBySideInlineBreakpoint:to(o.renderSideBySideInlineBreakpoint,e.renderSideBySideInlineBreakpoint,0,1073741824),useInlineViewWhenSpaceIsLimited:$(o.useInlineViewWhenSpaceIsLimited,e.useInlineViewWhenSpaceIsLimited),renderGutterMenu:$(o.renderGutterMenu,e.renderGutterMenu),compactMode:$(o.compactMode,e.compactMode)}}const PO=le("IActionViewItemService");class WX{constructor(){this._providers=new Map,this._onDidChange=new l.Emitter,this.onDidChange=this._onDidChange.event}dispose(){this._onDidChange.dispose()}lookUp(e,t){return this._providers.get(this._makeKey(e,t))}_makeKey(e,t){return`${e.id}/${t instanceof ct?t.id:t}`}}fe(PO,WX,1);var kO=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},hn=function(o,e){return function(t,i){e(t,i,o)}};_.WorkbenchToolBar=class extends ph{constructor(e,t,i,n,s,r,a,c){super(e,s,{getKeyBinding:d=>r.lookupKeybinding(d.id)??void 0,...t,allowContextMenu:!0,skipTelemetry:typeof t?.telemetrySource=="string"}),this._options=t,this._menuService=i,this._contextKeyService=n,this._contextMenuService=s,this._keybindingService=r,this._commandService=a,this._sessionDisposables=this._store.add(new l.DisposableStore);const h=t?.telemetrySource;h&&this._store.add(this.actionBar.onDidRun(d=>c.publicLog2("workbenchActionExecuted",{id:d.action.id,from:h})))}setActions(e,t=[],i){this._sessionDisposables.clear();const n=e.slice(),s=t.slice(),r=[];let a=0;const c=[];let h=!1;if(this._options?.hiddenItemStrategy!==-1)for(let d=0;d<n.length;d++){const u=n[d];if(u instanceof ft){c[d]=u;continue}!(u instanceof _.MenuItemAction)&&!(u instanceof sa)||u.hideActions&&(r.push(u.hideActions.toggle),u.hideActions.toggle.checked&&a++,u.hideActions.isHidden&&(h=!0,n[d]=void 0,this._options?.hiddenItemStrategy!==0&&(c[d]=u)))}if(this._options?.overflowBehavior!==void 0){const d=UT(new Set(this._options.overflowBehavior.exempted),l.Iterable.map(n,g=>g?.id)),u=this._options.overflowBehavior.maxItems-d.size;let f=0;for(let g=0;g<n.length;g++){const m=n[g];m&&(f++,!d.has(m.id)&&f>=u&&(n[g]=void 0,c[g]=m))}}l.coalesceInPlace(n),l.coalesceInPlace(c),super.setActions(ft.clean(n),ft.join(ft.clean(c),s)),(r.length>0||n.length>0)&&this._sessionDisposables.add(R(this.getElement(),"contextmenu",d=>{const u=new Bi(j(this.getElement()),d),f=this.getItemAction(u.target);if(!f)return;u.preventDefault(),u.stopPropagation();const g=[];if(f instanceof _.MenuItemAction&&f.menuKeybinding)g.push(f.menuKeybinding);else if(!(f instanceof sa||f instanceof _h)){const p=!!this._keybindingService.lookupKeybinding(f.id);g.push(XR(this._commandService,this._keybindingService,f.id,void 0,p))}if(r.length>0){let p=!1;if(a===1&&this._options?.hiddenItemStrategy===0){p=!0;for(let b=0;b<r.length;b++)if(r[b].checked){r[b]=Yo({id:f.id,label:f.label,checked:!0,enabled:!1,run(){}});break}}if(!p&&(f instanceof _.MenuItemAction||f instanceof sa)){if(!f.hideActions)return;g.push(f.hideActions.hide)}else g.push(Yo({id:"label",label:l.localize(1701,"Hide"),enabled:!1,run(){}}))}const m=ft.join(g,r);this._options?.resetMenu&&!i&&(i=[this._options.resetMenu]),h&&i&&(m.push(new ft),m.push(Yo({id:"resetThisMenu",label:l.localize(1702,"Reset Menu"),run:()=>this._menuService.resetHiddenStates(i)}))),m.length!==0&&this._contextMenuService.showContextMenu({getAnchor:()=>u,getActions:()=>m,menuId:this._options?.contextMenu,menuActionOptions:{renderShortTitle:!0,...this._options?.menuOptions},skipTelemetry:typeof this._options?.telemetrySource=="string",contextKeyService:this._contextKeyService})}))}},_.WorkbenchToolBar=kO([hn(2,Zo),hn(3,be),hn(4,nn),hn(5,xt),hn(6,zi),hn(7,Xn)],_.WorkbenchToolBar),_.MenuWorkbenchToolBar=class extends _.WorkbenchToolBar{get onDidChangeMenuItems(){return this._onDidChangeMenuItems.event}constructor(e,t,i,n,s,r,a,c,h,d,u){super(e,{resetMenu:t,...i,actionViewItemProvider:(f,g)=>{let m=d.lookUp(t,f instanceof sa?f.item.submenu.id:f.id);m||(m=i?.actionViewItemProvider);const p=m?.(f,g,u,j(e).vscodeWindowId);return p||Gy(u,f,g)}},n,s,r,a,c,h),this._onDidChangeMenuItems=this._store.add(new l.Emitter),this._container=e,this._menuOptions=i?.menuOptions,this._toolbarOptions=i?.toolbarOptions,this._menu=this._store.add(n.createMenu(t,s,{emitEventsForSubmenuChanges:!0,eventDebounceDelay:i?.eventDebounceDelay})),this._store.add(this._menu.onDidChange(()=>{this._updateToolbar(),this._onDidChangeMenuItems.fire(this)})),this._store.add(d.onDidChange(f=>{f===t&&this._updateToolbar()})),this._updateToolbar()}_updateToolbar(){const{primary:e,secondary:t}=CM(this._menu.getActions(this._menuOptions),this._toolbarOptions?.primaryGroup,this._toolbarOptions?.shouldInlineSubmenu,this._toolbarOptions?.useSeparatorsInPrimaryActions);this._container.classList.toggle("has-no-actions",e.length===0&&t.length===0),super.setActions(e,t)}setActions(){throw new l.BugIndicatingError("This toolbar is populated from a menu.")}},_.MenuWorkbenchToolBar=kO([hn(3,Zo),hn(4,be),hn(5,nn),hn(6,xt),hn(7,zi),hn(8,Xn),hn(9,PO),hn(10,me)],_.MenuWorkbenchToolBar);class G0 extends l.AbstractText{constructor(e){super(),this._textModel=e}getValueOfRange(e){return this._textModel.getValueInRange(e)}getLineLength(e){return this._textModel.getLineLength(e)}get length(){const e=this._textModel.getLineCount(),t=this._textModel.getLineLength(e);return new l.TextLength(e-1,t)}}class FO extends Jr{constructor(e){super(),this._getContext=e}runAction(e,t){const i=this._getContext();return super.runAction(e,i)}}class HX extends l.Disposable{constructor(e,t,i){super(),this._editor=e,this._domNode=t,this.itemProvider=i,this.scrollTop=mt(this,this._editor.onDidScrollChange,r=>this._editor.getScrollTop()),this.isScrollTopZero=this.scrollTop.map(r=>r===0),this.modelAttached=mt(this,this._editor.onDidChangeModel,r=>this._editor.hasModel()),this.editorOnDidChangeViewZones=Ii("onDidChangeViewZones",this._editor.onDidChangeViewZones),this.editorOnDidContentSizeChange=Ii("onDidContentSizeChange",this._editor.onDidContentSizeChange),this.domNodeSizeChanged=qr("domNodeSizeChanged"),this.views=this._register(new l.DisposableMap),this._domNode.className="gutter monaco-editor";const n=this._domNode.appendChild(_e("div.scroll-decoration",{role:"presentation",ariaHidden:"true",style:{width:"100%"}}).root),s=new ResizeObserver(()=>{nt(r=>{this.domNodeSizeChanged.trigger(r)})});s.observe(this._domNode),this._register(l.toDisposable(()=>s.disconnect())),this._register(he(r=>{n.className=this.isScrollTopZero.read(r)?"":"scroll-decoration"})),this._register(he(r=>this.render(r)))}dispose(){super.dispose(),oi(this._domNode)}render(e){if(!this.modelAttached.read(e))return;this.domNodeSizeChanged.read(e),this.editorOnDidChangeViewZones.read(e),this.editorOnDidContentSizeChange.read(e);const t=this.scrollTop.read(e),i=this._editor.getVisibleRanges(),n=new Set(this.views.keys()),s=l.OffsetRange.ofStartAndLength(0,this._domNode.clientHeight);if(!s.isEmpty)for(const r of i){const a=new l.LineRange(r.startLineNumber,r.endLineNumber+1),c=this.itemProvider.getIntersectingGutterItems(a,e);nt(h=>{for(const d of c){if(!d.range.intersect(a))continue;n.delete(d.id);let u=this.views.get(d.id);if(u)u.item.set(d,h);else{const p=document.createElement("div");this._domNode.appendChild(p);const b=W("item",d),v=this.itemProvider.createView(b,p);u=new eJ(b,v,p),this.views.set(d.id,u)}const f=d.range.startLineNumber<=this._editor.getModel().getLineCount()?this._editor.getTopForLineNumber(d.range.startLineNumber,!0)-t:d.range.startLineNumber>1?this._editor.getBottomForLineNumber(d.range.startLineNumber-1,!1)-t:0,m=(d.range.endLineNumberExclusive===1?Math.max(f,this._editor.getTopForLineNumber(d.range.startLineNumber,!1)-t):Math.max(f,this._editor.getBottomForLineNumber(d.range.endLineNumberExclusive-1,!0)-t))-f;u.domNode.style.top=`${f}px`,u.domNode.style.height=`${m}px`,u.gutterItemView.layout(l.OffsetRange.ofStartAndLength(f,m),s)}})}for(const r of n)this.views.deleteAndDispose(r)}}class eJ{constructor(e,t,i){this.item=e,this.gutterItemView=t,this.domNode=i}dispose(){this.gutterItemView.dispose(),this.domNode.remove()}}var BO=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},P_=function(o,e){return function(t,i){e(t,i,o)}};const j0=[],k_=35;let q0=class extends l.Disposable{constructor(e,t,i,n,s,r,a,c,h){super(),this._diffModel=t,this._editors=i,this._options=n,this._sashLayout=s,this._boundarySashes=r,this._instantiationService=a,this._contextKeyService=c,this._menuService=h,this._menu=this._register(this._menuService.createMenu(ct.DiffEditorHunkToolbar,this._contextKeyService)),this._actions=mt(this,this._menu.onDidChange,()=>this._menu.getActions()),this._hasActions=this._actions.map(u=>u.length>0),this._showSash=Z(this,u=>this._options.renderSideBySide.read(u)&&this._hasActions.read(u)),this.width=Z(this,u=>this._hasActions.read(u)?k_:0),this.elements=_e("div.gutter@gutter",{style:{position:"absolute",height:"100%",width:k_+"px"}},[]),this._currentDiff=Z(this,u=>{const f=this._diffModel.read(u);if(!f)return;const g=f.diff.read(u)?.mappings,m=this._editors.modifiedCursor.read(u);if(m)return g?.find(p=>p.lineRangeMapping.modified.contains(m.lineNumber))}),this._selectedDiffs=Z(this,u=>{const g=this._diffModel.read(u)?.diff.read(u);if(!g)return j0;const m=this._editors.modifiedSelections.read(u);if(m.every(C=>C.isEmpty()))return j0;const p=new l.LineRangeSet(m.map(C=>l.LineRange.fromRangeInclusive(C))),v=g.mappings.filter(C=>C.lineRangeMapping.innerChanges&&p.intersects(C.lineRangeMapping.modified)).map(C=>({mapping:C,rangeMappings:C.lineRangeMapping.innerChanges.filter(w=>m.some(S=>l.Range.areIntersecting(w.modifiedRange,S)))}));return v.length===0||v.every(C=>C.rangeMappings.length===0)?j0:v}),this._register(fX(e,this.elements.root)),this._register(R(this.elements.root,"click",()=>{this._editors.modified.focus()})),this._register(Nr(this.elements.root,{display:this._hasActions.map(u=>u?"block":"none")})),Gn(this,u=>this._showSash.read(u)?new AO(e,this._sashLayout.dimensions,this._options.enableSplitViewResizing,this._boundarySashes,Hb(this,g=>this._sashLayout.sashLeft.read(g)-k_,(g,m)=>this._sashLayout.sashLeft.set(g+k_,m)),()=>this._sashLayout.resetSash()):void 0).recomputeInitiallyAndOnChange(this._store);const d=Z(this,u=>{const f=this._diffModel.read(u);if(!f)return[];const g=f.diff.read(u);if(!g)return[];const m=this._selectedDiffs.read(u);if(m.length>0){const b=l.DetailedLineRangeMapping.fromRangeMappings(m.flatMap(v=>v.rangeMappings));return[new zO(b,!0,ct.DiffEditorSelectionToolbar,void 0,f.model.original.uri,f.model.modified.uri)]}const p=this._currentDiff.read(u);return g.mappings.map(b=>new zO(b.lineRangeMapping.withInnerChangesFromLineRanges(),b.lineRangeMapping===p?.lineRangeMapping,ct.DiffEditorHunkToolbar,void 0,f.model.original.uri,f.model.modified.uri))});this._register(new HX(this._editors.modified,this.elements.root,{getIntersectingGutterItems:(u,f)=>d.read(f),createView:(u,f)=>this._instantiationService.createInstance(Y0,u,f,this)})),this._register(R(this.elements.gutter,F.MOUSE_WHEEL,u=>{this._editors.modified.getOption(117).handleMouseWheel&&this._editors.modified.delegateScrollFromMouseWheelEvent(u)},{passive:!1}))}computeStagedValue(e){const t=e.innerChanges??[],i=new G0(this._editors.modifiedModel.get()),n=new G0(this._editors.original.getModel());return new l.TextEdit(t.map(a=>a.toTextEdit(i))).apply(n)}layout(e){this.elements.gutter.style.left=e+"px"}};q0=BO([P_(6,me),P_(7,be),P_(8,Zo)],q0);class zO{constructor(e,t,i,n,s,r){this.mapping=e,this.showAlways=t,this.menuId=i,this.rangeOverride=n,this.originalUri=s,this.modifiedUri=r}get id(){return this.mapping.modified.toString()}get range(){return this.rangeOverride??this.mapping.modified}}let Y0=class extends l.Disposable{constructor(e,t,i,n){super(),this._item=e,this._elements=_e("div.gutterItem",{style:{height:"20px",width:"34px"}},[_e("div.background@background",{},[]),_e("div.buttons@buttons",{},[])]),this._showAlways=this._item.map(this,r=>r.showAlways),this._menuId=this._item.map(this,r=>r.menuId),this._isSmall=W(this,!1),this._lastItemRange=void 0,this._lastViewRange=void 0;const s=this._register(n.createInstance(_.WorkbenchHoverDelegate,"element",{instantHover:!0},{position:{hoverPosition:1}}));this._register(wh(t,this._elements.root)),this._register(he(r=>{const a=this._showAlways.read(r);this._elements.root.classList.toggle("noTransition",!0),this._elements.root.classList.toggle("showAlways",a),setTimeout(()=>{this._elements.root.classList.toggle("noTransition",!1)},0)})),this._register(Kn((r,a)=>{this._elements.buttons.replaceChildren();const c=a.add(n.createInstance(_.MenuWorkbenchToolBar,this._elements.buttons,this._menuId.read(r),{orientation:1,hoverDelegate:s,toolbarOptions:{primaryGroup:h=>h.startsWith("primary")},overflowBehavior:{maxItems:this._isSmall.read(r)?1:3},hiddenItemStrategy:0,actionRunner:a.add(new FO(()=>{const h=this._item.read(void 0),d=h.mapping;return{mapping:d,originalWithModifiedChanges:i.computeStagedValue(d),originalUri:h.originalUri,modifiedUri:h.modifiedUri}})),menuOptions:{shouldForwardArgs:!0}}));a.add(c.onDidChangeMenuItems(()=>{this._lastItemRange&&this.layout(this._lastItemRange,this._lastViewRange)}))}))}layout(e,t){this._lastItemRange=e,this._lastViewRange=t;let i=this._elements.buttons.clientHeight;this._isSmall.set(this._item.get().mapping.original.startLineNumber===1&&e.length<30,void 0),i=this._elements.buttons.clientHeight;const n=e.length/2-i/2,s=i;let r=e.start+n;const a=l.OffsetRange.tryCreate(s,t.endExclusive-s-i),c=l.OffsetRange.tryCreate(e.start+s,e.endExclusive-i-s);c&&a&&c.start<c.endExclusive&&(r=a.clip(r),r=c.clip(r)),this._elements.buttons.style.top=`${r-e.start}px`}};Y0=BO([P_(3,me)],Y0);var tJ=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},iJ=function(o,e){return function(t,i){e(t,i,o)}},Z0;_.HideUnchangedRegionsFeature=(Br=class extends l.Disposable{static setBreadcrumbsSourceFactory(e){this._breadcrumbsSourceFactory.set(e,void 0)}get isUpdatingHiddenAreas(){return this._isUpdatingHiddenAreas}constructor(e,t,i,n){super(),this._editors=e,this._diffModel=t,this._options=i,this._instantiationService=n,this._modifiedOutlineSource=Gn(this,c=>{const h=this._editors.modifiedModel.read(c),d=Z0._breadcrumbsSourceFactory.read(c);return!h||!d?void 0:d(h,this._instantiationService)}),this._isUpdatingHiddenAreas=!1,this._register(this._editors.original.onDidChangeCursorPosition(c=>{if(c.reason===1)return;const h=this._diffModel.get();nt(d=>{for(const u of this._editors.original.getSelections()||[])h?.ensureOriginalLineIsVisible(u.getStartPosition().lineNumber,0,d),h?.ensureOriginalLineIsVisible(u.getEndPosition().lineNumber,0,d)})})),this._register(this._editors.modified.onDidChangeCursorPosition(c=>{if(c.reason===1)return;const h=this._diffModel.get();nt(d=>{for(const u of this._editors.modified.getSelections()||[])h?.ensureModifiedLineIsVisible(u.getStartPosition().lineNumber,0,d),h?.ensureModifiedLineIsVisible(u.getEndPosition().lineNumber,0,d)})}));const s=this._diffModel.map((c,h)=>{const d=c?.unchangedRegions.read(h)??[];return d.length===1&&d[0].modifiedLineNumber===1&&d[0].lineCount===this._editors.modifiedModel.read(h)?.getLineCount()?[]:d});this.viewZones=Z(this,c=>{const h=this._modifiedOutlineSource.read(c);if(!h)return{origViewZones:[],modViewZones:[]};const d=[],u=[],f=this._options.renderSideBySide.read(c),g=this._options.compactMode.read(c),m=s.read(c);for(let p=0;p<m.length;p++){const b=m[p];if(!b.shouldHideControls(c)&&!(g&&(p===0||p===m.length-1)))if(g){{const v=Z(this,w=>b.getHiddenOriginalRange(w).startLineNumber-1),C=new Sh(v,12);d.push(C),c.store.add(new VO(this._editors.original,C,b,!f))}{const v=Z(this,w=>b.getHiddenModifiedRange(w).startLineNumber-1),C=new Sh(v,12);u.push(C),c.store.add(new VO(this._editors.modified,C,b))}}else{{const v=Z(this,w=>b.getHiddenOriginalRange(w).startLineNumber-1),C=new Sh(v,24);d.push(C),c.store.add(new UO(this._editors.original,C,b,b.originalUnchangedRange,!f,h,w=>this._diffModel.get().ensureModifiedLineIsVisible(w,2,void 0),this._options))}{const v=Z(this,w=>b.getHiddenModifiedRange(w).startLineNumber-1),C=new Sh(v,24);u.push(C),c.store.add(new UO(this._editors.modified,C,b,b.modifiedUnchangedRange,!1,h,w=>this._diffModel.get().ensureModifiedLineIsVisible(w,2,void 0),this._options))}}}return{origViewZones:d,modViewZones:u}});const r={description:"unchanged lines",className:"diff-unchanged-lines",isWholeLine:!0},a={description:"Fold Unchanged",glyphMarginHoverMessage:new DS(void 0,{isTrusted:!0,supportThemeIcons:!0}).appendMarkdown(l.localize(140,"Fold Unchanged Region")),glyphMarginClassName:"fold-unchanged "+_.ThemeIcon.asClassName(l.Codicon.fold),zIndex:10001};this._register(M_(this._editors.original,Z(this,c=>{const h=s.read(c),d=h.map(u=>({range:u.originalUnchangedRange.toInclusiveRange(),options:r}));for(const u of h)u.shouldHideControls(c)&&d.push({range:l.Range.fromPositions(new l.Position(u.originalLineNumber,1)),options:a});return d}))),this._register(M_(this._editors.modified,Z(this,c=>{const h=s.read(c),d=h.map(u=>({range:u.modifiedUnchangedRange.toInclusiveRange(),options:r}));for(const u of h)u.shouldHideControls(c)&&d.push({range:l.LineRange.ofLength(u.modifiedLineNumber,1).toInclusiveRange(),options:a});return d}))),this._register(he(c=>{const h=s.read(c);this._isUpdatingHiddenAreas=!0;try{this._editors.original.setHiddenAreas(h.map(d=>d.getHiddenOriginalRange(c).toInclusiveRange()).filter(l.isDefined)),this._editors.modified.setHiddenAreas(h.map(d=>d.getHiddenModifiedRange(c).toInclusiveRange()).filter(l.isDefined))}finally{this._isUpdatingHiddenAreas=!1}})),this._register(this._editors.modified.onMouseUp(c=>{if(!c.event.rightButton&&c.target.position&&c.target.element?.className.includes("fold-unchanged")){const h=c.target.position.lineNumber,d=this._diffModel.get();if(!d)return;const u=d.unchangedRegions.get().find(f=>f.modifiedUnchangedRange.contains(h));if(!u)return;u.collapseAll(void 0),c.event.stopPropagation(),c.event.preventDefault()}})),this._register(this._editors.original.onMouseUp(c=>{if(!c.event.rightButton&&c.target.position&&c.target.element?.className.includes("fold-unchanged")){const h=c.target.position.lineNumber,d=this._diffModel.get();if(!d)return;const u=d.unchangedRegions.get().find(f=>f.originalUnchangedRange.contains(h));if(!u)return;u.collapseAll(void 0),c.event.stopPropagation(),c.event.preventDefault()}}))}},Z0=Br,Br._breadcrumbsSourceFactory=W(Br,()=>({dispose(){},getBreadcrumbItems(e,t){return[]},getAt:()=>[]})),Br),_.HideUnchangedRegionsFeature=Z0=tJ([iJ(3,me)],_.HideUnchangedRegionsFeature);class VO extends y0{constructor(e,t,i,n=!1){const s=_e("div.diff-hidden-lines-widget");super(e,t,s.root),this._unchangedRegion=i,this._hide=n,this._nodes=_e("div.diff-hidden-lines-compact",[_e("div.line-left",[]),_e("div.text@text",[]),_e("div.line-right",[])]),s.root.appendChild(this._nodes.root),this._hide&&this._nodes.root.replaceChildren(),this._register(he(r=>{if(!this._hide){const a=this._unchangedRegion.getHiddenModifiedRange(r).length,c=l.localize(141,"{0} hidden lines",a);this._nodes.text.innerText=c}}))}}class UO extends y0{constructor(e,t,i,n,s,r,a,c){const h=_e("div.diff-hidden-lines-widget");super(e,t,h.root),this._editor=e,this._unchangedRegion=i,this._unchangedRegionRange=n,this._hide=s,this._modifiedOutlineSource=r,this._revealModifiedHiddenLine=a,this._options=c,this._nodes=_e("div.diff-hidden-lines",[_e("div.top@top",{title:l.localize(142,"Click or drag to show more above")}),_e("div.center@content",{style:{display:"flex"}},[_e("div@first",{style:{display:"flex",justifyContent:"center",alignItems:"center",flexShrink:"0"}},[Q("a",{title:l.localize(143,"Show Unchanged Region"),role:"button",onclick:()=>{this._unchangedRegion.showAll(void 0)}},...vr("$(unfold)"))]),_e("div@others",{style:{display:"flex",justifyContent:"center",alignItems:"center"}})]),_e("div.bottom@bottom",{title:l.localize(144,"Click or drag to show more below"),role:"button"})]),h.root.appendChild(this._nodes.root),this._hide?oi(this._nodes.first):this._register(Nr(this._nodes.first,{width:Mr(this._editor).layoutInfoContentLeft})),this._register(he(u=>{const f=this._unchangedRegion.visibleLineCountTop.read(u)+this._unchangedRegion.visibleLineCountBottom.read(u)===this._unchangedRegion.lineCount;this._nodes.bottom.classList.toggle("canMoveTop",!f),this._nodes.bottom.classList.toggle("canMoveBottom",this._unchangedRegion.visibleLineCountBottom.read(u)>0),this._nodes.top.classList.toggle("canMoveTop",this._unchangedRegion.visibleLineCountTop.read(u)>0),this._nodes.top.classList.toggle("canMoveBottom",!f);const g=this._unchangedRegion.isDragged.read(u),m=this._editor.getDomNode();m&&(m.classList.toggle("draggingUnchangedRegion",!!g),g==="top"?(m.classList.toggle("canMoveTop",this._unchangedRegion.visibleLineCountTop.read(u)>0),m.classList.toggle("canMoveBottom",!f)):g==="bottom"?(m.classList.toggle("canMoveTop",!f),m.classList.toggle("canMoveBottom",this._unchangedRegion.visibleLineCountBottom.read(u)>0)):(m.classList.toggle("canMoveTop",!1),m.classList.toggle("canMoveBottom",!1)))}));const d=this._editor;this._register(R(this._nodes.top,"mousedown",u=>{if(u.button!==0)return;this._nodes.top.classList.toggle("dragging",!0),this._nodes.root.classList.toggle("dragging",!0),u.preventDefault();const f=u.clientY;let g=!1;const m=this._unchangedRegion.visibleLineCountTop.get();this._unchangedRegion.isDragged.set("top",void 0);const p=j(this._nodes.top),b=R(p,"mousemove",C=>{const S=C.clientY-f;g=g||Math.abs(S)>2;const L=Math.round(S/d.getOption(75)),D=Math.max(0,Math.min(m+L,this._unchangedRegion.getMaxVisibleLineCountTop()));this._unchangedRegion.visibleLineCountTop.set(D,void 0)}),v=R(p,"mouseup",C=>{g||this._unchangedRegion.showMoreAbove(this._options.hideUnchangedRegionsRevealLineCount.get(),void 0),this._nodes.top.classList.toggle("dragging",!1),this._nodes.root.classList.toggle("dragging",!1),this._unchangedRegion.isDragged.set(void 0,void 0),b.dispose(),v.dispose()})})),this._register(R(this._nodes.bottom,"mousedown",u=>{if(u.button!==0)return;this._nodes.bottom.classList.toggle("dragging",!0),this._nodes.root.classList.toggle("dragging",!0),u.preventDefault();const f=u.clientY;let g=!1;const m=this._unchangedRegion.visibleLineCountBottom.get();this._unchangedRegion.isDragged.set("bottom",void 0);const p=j(this._nodes.bottom),b=R(p,"mousemove",C=>{const S=C.clientY-f;g=g||Math.abs(S)>2;const L=Math.round(S/d.getOption(75)),D=Math.max(0,Math.min(m-L,this._unchangedRegion.getMaxVisibleLineCountBottom())),x=this._unchangedRegionRange.endLineNumberExclusive>d.getModel().getLineCount()?d.getContentHeight():d.getTopForLineNumber(this._unchangedRegionRange.endLineNumberExclusive);this._unchangedRegion.visibleLineCountBottom.set(D,void 0);const I=this._unchangedRegionRange.endLineNumberExclusive>d.getModel().getLineCount()?d.getContentHeight():d.getTopForLineNumber(this._unchangedRegionRange.endLineNumberExclusive);d.setScrollTop(d.getScrollTop()+(I-x))}),v=R(p,"mouseup",C=>{if(this._unchangedRegion.isDragged.set(void 0,void 0),!g){const w=d.getTopForLineNumber(this._unchangedRegionRange.endLineNumberExclusive);this._unchangedRegion.showMoreBelow(this._options.hideUnchangedRegionsRevealLineCount.get(),void 0);const S=d.getTopForLineNumber(this._unchangedRegionRange.endLineNumberExclusive);d.setScrollTop(d.getScrollTop()+(S-w))}this._nodes.bottom.classList.toggle("dragging",!1),this._nodes.root.classList.toggle("dragging",!1),b.dispose(),v.dispose()})})),this._register(he(u=>{const f=[];if(!this._hide){const g=i.getHiddenModifiedRange(u).length,m=l.localize(145,"{0} hidden lines",g),p=Q("span",{title:l.localize(146,"Double click to unfold")},m);p.addEventListener("dblclick",C=>{C.button===0&&(C.preventDefault(),this._unchangedRegion.showAll(void 0))}),f.push(p);const b=this._unchangedRegion.getHiddenModifiedRange(u),v=this._modifiedOutlineSource.getBreadcrumbItems(b,u);if(v.length>0){f.push(Q("span",void 0," | "));for(let C=0;C<v.length;C++){const w=v[C],S=l.SymbolKinds.toIcon(w.kind),L=_e("div.breadcrumb-item",{style:{display:"flex",alignItems:"center"}},[Gc(S)," ",w.name,...C===v.length-1?[]:[Gc(l.Codicon.chevronRight)]]).root;f.push(L),L.onclick=()=>{this._revealModifiedHiddenLine(w.startLineNumber)}}}}oi(this._nodes.others,...f)}))}}const Q0=[];class nJ extends l.Disposable{constructor(e,t,i,n){super(),this._editors=e,this._diffModel=t,this._options=i,this._widget=n,this._selectedDiffs=Z(this,s=>{const a=this._diffModel.read(s)?.diff.read(s);if(!a)return Q0;const c=this._editors.modifiedSelections.read(s);if(c.every(f=>f.isEmpty()))return Q0;const h=new l.LineRangeSet(c.map(f=>l.LineRange.fromRangeInclusive(f))),u=a.mappings.filter(f=>f.lineRangeMapping.innerChanges&&h.intersects(f.lineRangeMapping.modified)).map(f=>({mapping:f,rangeMappings:f.lineRangeMapping.innerChanges.filter(g=>c.some(m=>l.Range.areIntersecting(g.modifiedRange,m)))}));return u.length===0||u.every(f=>f.rangeMappings.length===0)?Q0:u}),this._register(Kn((s,r)=>{if(!this._options.shouldRenderOldRevertArrows.read(s))return;const a=this._diffModel.read(s),c=a?.diff.read(s);if(!a||!c||a.movedTextToCompare.read(s))return;const h=[],d=this._selectedDiffs.read(s),u=new Set(d.map(f=>f.mapping));if(d.length>0){const f=this._editors.modifiedSelections.read(s),g=r.add(new F_(f[f.length-1].positionLineNumber,this._widget,d.flatMap(m=>m.rangeMappings),!0));this._editors.modified.addGlyphMarginWidget(g),h.push(g)}for(const f of c.mappings)if(!u.has(f)&&!f.lineRangeMapping.modified.isEmpty&&f.lineRangeMapping.innerChanges){const g=r.add(new F_(f.lineRangeMapping.modified.startLineNumber,this._widget,f.lineRangeMapping,!1));this._editors.modified.addGlyphMarginWidget(g),h.push(g)}r.add(l.toDisposable(()=>{for(const f of h)this._editors.modified.removeGlyphMarginWidget(f)}))}))}}const Nb=class Nb extends l.Disposable{getId(){return this._id}constructor(e,t,i,n){super(),this._lineNumber=e,this._widget=t,this._diffs=i,this._revertSelection=n,this._id=`revertButton${Nb.counter++}`,this._domNode=_e("div.revertButton",{title:this._revertSelection?l.localize(151,"Revert Selected Changes"):l.localize(152,"Revert Change")},[Gc(l.Codicon.arrowRight)]).root,this._register(R(this._domNode,F.MOUSE_DOWN,s=>{s.button!==2&&(s.stopPropagation(),s.preventDefault())})),this._register(R(this._domNode,F.MOUSE_UP,s=>{s.stopPropagation(),s.preventDefault()})),this._register(R(this._domNode,F.CLICK,s=>{this._diffs instanceof l.LineRangeMapping?this._widget.revert(this._diffs):this._widget.revertRangeMappings(this._diffs),s.stopPropagation(),s.preventDefault()}))}getDomNode(){return this._domNode}getPosition(){return{lane:l.GlyphMarginLane.Right,range:{startColumn:1,startLineNumber:this._lineNumber,endColumn:1,endLineNumber:this._lineNumber},zIndex:10001}}};Nb.counter=0;let F_=Nb;var sJ=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},uf=function(o,e){return function(t,i){e(t,i,o)}};_.DiffEditorWidget=class extends $0{get onDidContentSizeChange(){return this._editors.onDidContentSizeChange}constructor(e,t,i,n,s,r,a,c){super(),this._domElement=e,this._parentContextKeyService=n,this._parentInstantiationService=s,this._codeEditorService=r,this._accessibilitySignalService=a,this._editorProgressService=c,this.elements=_e("div.monaco-diff-editor.side-by-side",{style:{position:"relative",height:"100%"}},[_e("div.editor.original@original",{style:{position:"absolute",height:"100%"}}),_e("div.editor.modified@modified",{style:{position:"absolute",height:"100%"}}),_e("div.accessibleDiffViewer@accessibleDiffViewer",{style:{position:"absolute",height:"100%"}})]),this._diffModelSrc=this._register(Wb(this,void 0)),this._diffModel=Z(this,S=>this._diffModelSrc.read(S)?.object),this.onDidChangeModel=l.Event.fromObservableLight(this._diffModel),this._contextKeyService=this._register(this._parentContextKeyService.createScoped(this._domElement)),this._instantiationService=this._register(this._parentInstantiationService.createChild(new Oc([be,this._contextKeyService]))),this._boundarySashes=W(this,void 0),this._accessibleDiffViewerShouldBeVisible=W(this,!1),this._accessibleDiffViewerVisible=Z(this,S=>this._options.onlyShowAccessibleDiffViewer.read(S)?!0:this._accessibleDiffViewerShouldBeVisible.read(S)),this._movedBlocksLinesPart=W(this,void 0),this._layoutInfo=Z(this,S=>{const L=this._rootSizeObserver.width.read(S),D=this._rootSizeObserver.height.read(S);this._rootSizeObserver.automaticLayout?this.elements.root.style.height="100%":this.elements.root.style.height=D+"px";const x=this._sash.read(S),I=this._gutter.read(S),T=I?.width.read(S)??0,M=this._overviewRulerPart.read(S)?.width??0;let O,P,k,U,B;if(!!x){const X=x.sashLeft.read(S),re=this._movedBlocksLinesPart.read(S)?.width.read(S)??0;O=0,P=X-T-re,B=X-T,k=X,U=L-k-M}else{B=0;const X=this._options.inlineViewHideOriginalLineNumbers.read(S);O=T,X?P=0:P=Math.max(5,this._editors.originalObs.layoutInfoDecorationsLeft.read(S)),k=T+P,U=L-k-M}return this.elements.original.style.left=O+"px",this.elements.original.style.width=P+"px",this._editors.original.layout({width:P,height:D},!0),I?.layout(B),this.elements.modified.style.left=k+"px",this.elements.modified.style.width=U+"px",this._editors.modified.layout({width:U,height:D},!0),{modifiedEditor:this._editors.modified.getLayoutInfo(),originalEditor:this._editors.original.getLayoutInfo()}}),this._diffValue=this._diffModel.map((S,L)=>S?.diff.read(L)),this.onDidUpdateDiff=l.Event.fromObservableLight(this._diffValue),this._codeEditorService.willCreateDiffEditor(),this._contextKeyService.createKey("isInDiffEditor",!0),this._domElement.appendChild(this.elements.root),this._register(l.toDisposable(()=>this.elements.root.remove())),this._rootSizeObserver=this._register(new dO(this.elements.root,t.dimension)),this._rootSizeObserver.setAutomaticLayout(t.automaticLayout??!1),this._options=this._instantiationService.createInstance(K0,t),this._register(he(S=>{this._options.setWidth(this._rootSizeObserver.width.read(S))})),this._contextKeyService.createKey(_.EditorContextKeys.isEmbeddedDiffEditor.key,!1),this._register(qs(_.EditorContextKeys.isEmbeddedDiffEditor,this._contextKeyService,S=>this._options.isInEmbeddedEditor.read(S))),this._register(qs(_.EditorContextKeys.comparingMovedCode,this._contextKeyService,S=>!!this._diffModel.read(S)?.movedTextToCompare.read(S))),this._register(qs(_.EditorContextKeys.diffEditorRenderSideBySideInlineBreakpointReached,this._contextKeyService,S=>this._options.couldShowInlineViewBecauseOfSize.read(S))),this._register(qs(_.EditorContextKeys.diffEditorInlineMode,this._contextKeyService,S=>!this._options.renderSideBySide.read(S))),this._register(qs(_.EditorContextKeys.hasChanges,this._contextKeyService,S=>(this._diffModel.read(S)?.diff.read(S)?.mappings.length??0)>0)),this._editors=this._register(this._instantiationService.createInstance(U0,this.elements.original,this.elements.modified,this._options,i,(S,L,D,x)=>this._createInnerEditor(S,L,D,x))),this._register(qs(_.EditorContextKeys.diffEditorOriginalWritable,this._contextKeyService,S=>this._options.originalEditable.read(S))),this._register(qs(_.EditorContextKeys.diffEditorModifiedWritable,this._contextKeyService,S=>!this._options.readOnly.read(S))),this._register(qs(_.EditorContextKeys.diffEditorOriginalUri,this._contextKeyService,S=>this._diffModel.read(S)?.model.original.uri.toString()??"")),this._register(qs(_.EditorContextKeys.diffEditorModifiedUri,this._contextKeyService,S=>this._diffModel.read(S)?.model.modified.uri.toString()??"")),this._overviewRulerPart=Gn(this,S=>this._options.renderOverviewRuler.read(S)?this._instantiationService.createInstance(Po(df),this._editors,this.elements.root,this._diffModel,this._rootSizeObserver.width,this._rootSizeObserver.height,this._layoutInfo.map(L=>L.modifiedEditor)):void 0).recomputeInitiallyAndOnChange(this._store);const h={height:this._rootSizeObserver.height,width:this._rootSizeObserver.width.map((S,L)=>S-(this._overviewRulerPart.read(L)?.width??0))};this._sashLayout=new qX(this._options,h),this._sash=Gn(this,S=>{const L=this._options.renderSideBySide.read(S);return this.elements.root.classList.toggle("side-by-side",L),L?new AO(this.elements.root,h,this._options.enableSplitViewResizing,this._boundarySashes,this._sashLayout.sashLeft,()=>this._sashLayout.resetSash()):void 0}).recomputeInitiallyAndOnChange(this._store);const d=Gn(this,S=>this._instantiationService.createInstance(Po(_.HideUnchangedRegionsFeature),this._editors,this._diffModel,this._options)).recomputeInitiallyAndOnChange(this._store);Gn(this,S=>this._instantiationService.createInstance(Po($X),this._editors,this._diffModel,this._options,this)).recomputeInitiallyAndOnChange(this._store);const u=new Set,f=new Set;let g=!1;const m=Gn(this,S=>this._instantiationService.createInstance(Po(P0),j(this._domElement),this._editors,this._diffModel,this._options,this,()=>g||d.read(void 0).isUpdatingHiddenAreas,u,f)).recomputeInitiallyAndOnChange(this._store),p=Z(this,S=>{const L=m.read(S).viewZones.read(S).orig,D=d.read(S).viewZones.read(S).origViewZones;return L.concat(D)}),b=Z(this,S=>{const L=m.read(S).viewZones.read(S).mod,D=d.read(S).viewZones.read(S).modViewZones;return L.concat(D)});this._register(A_(this._editors.original,p,S=>{g=S},u));let v;this._register(A_(this._editors.modified,b,S=>{g=S,g?v=vh.capture(this._editors.modified):(v?.restore(this._editors.modified),v=void 0)},f)),this._accessibleDiffViewer=Gn(this,S=>this._instantiationService.createInstance(Po(pl),this.elements.accessibleDiffViewer,this._accessibleDiffViewerVisible,(L,D)=>this._accessibleDiffViewerShouldBeVisible.set(L,D),this._options.onlyShowAccessibleDiffViewer.map(L=>!L),this._rootSizeObserver.width,this._rootSizeObserver.height,this._diffModel.map((L,D)=>L?.diff.read(D)?.mappings.map(x=>x.lineRangeMapping)),new IX(this._editors))).recomputeInitiallyAndOnChange(this._store);const C=this._accessibleDiffViewerVisible.map(S=>S?"hidden":"visible");this._register(Nr(this.elements.modified,{visibility:C})),this._register(Nr(this.elements.original,{visibility:C})),this._createDiffEditorContributions(),this._codeEditorService.addDiffEditor(this),this._register(l.toDisposable(()=>{this._codeEditorService.removeDiffEditor(this)})),this._gutter=Gn(this,S=>this._options.shouldRenderGutterMenu.read(S)?this._instantiationService.createInstance(Po(q0),this.elements.root,this._diffModel,this._editors,this._options,this._sashLayout,this._boundarySashes):void 0),this._register(ed(this._layoutInfo)),Gn(this,S=>new(Po(Lh))(this.elements.root,this._diffModel,this._layoutInfo.map(L=>L.originalEditor),this._layoutInfo.map(L=>L.modifiedEditor),this._editors)).recomputeInitiallyAndOnChange(this._store,S=>{this._movedBlocksLinesPart.set(S,void 0)}),this._register(l.Event.runAndSubscribe(this._editors.modified.onDidChangeCursorPosition,S=>this._handleCursorPositionChange(S,!0))),this._register(l.Event.runAndSubscribe(this._editors.original.onDidChangeCursorPosition,S=>this._handleCursorPositionChange(S,!1)));const w=this._diffModel.map(this,(S,L)=>{if(S)return S.diff.read(L)===void 0&&!S.isDiffUpToDate.read(L)});this._register(Kn((S,L)=>{if(w.read(S)===!0){const D=this._editorProgressService.show(!0,1e3);L.add(l.toDisposable(()=>D.done()))}})),this._register(Kn((S,L)=>{L.add(new(Po(nJ))(this._editors,this._diffModel,this._options,this))})),this._register(Kn((S,L)=>{const D=this._diffModel.read(S);if(D)for(const x of[D.model.original,D.model.modified])L.add(x.onWillDispose(I=>{l.onUnexpectedError(new l.BugIndicatingError("TextModel got disposed before DiffEditorWidget model got reset")),this.setModel(null)}))})),this._register(he(S=>{this._options.setModel(this._diffModel.read(S))}))}_createInnerEditor(e,t,i,n){return e.createInstance(_.CodeEditorWidget,t,i,n)}_createDiffEditorContributions(){const e=Ql.getDiffEditorContributions();for(const t of e)try{this._register(this._instantiationService.createInstance(t.ctor,this))}catch(i){l.onUnexpectedError(i)}}get _targetEditor(){return this._editors.modified}getEditorType(){return _d.IDiffEditor}layout(e){this._rootSizeObserver.observe(e)}hasTextFocus(){return this._editors.original.hasTextFocus()||this._editors.modified.hasTextFocus()}saveViewState(){const e=this._editors.original.saveViewState(),t=this._editors.modified.saveViewState();return{original:e,modified:t,modelState:this._diffModel.get()?.serializeState()}}restoreViewState(e){if(e&&e.original&&e.modified){const t=e;this._editors.original.restoreViewState(t.original),this._editors.modified.restoreViewState(t.modified),t.modelState&&this._diffModel.get()?.restoreSerializedState(t.modelState)}}handleInitialized(){this._editors.original.handleInitialized(),this._editors.modified.handleInitialized()}createViewModel(e){return this._instantiationService.createInstance(A0,e,this._options)}getModel(){return this._diffModel.get()?.model??null}setModel(e){const t=e?"model"in e?O_.create(e).createNewRef(this):O_.create(this.createViewModel(e),this):null;this.setDiffModel(t)}setDiffModel(e,t){const i=this._diffModel.get();!e&&i&&this._accessibleDiffViewer.get().close(),this._diffModel.get()!==e?.object&&Uf(t,n=>{const s=e?.object;mt.batchEventsGlobally(n,()=>{this._editors.original.setModel(s?s.model.original:null),this._editors.modified.setModel(s?s.model.modified:null)});const r=this._diffModelSrc.get()?.createNewRef(this);this._diffModelSrc.set(e?.createNewRef(this),n),setTimeout(()=>{r?.dispose()},0)})}updateOptions(e){this._options.updateOptions(e)}getContainerDomNode(){return this._domElement}getOriginalEditor(){return this._editors.original}getModifiedEditor(){return this._editors.modified}getLineChanges(){const e=this._diffModel.get()?.diff.get();return e?oJ(e):null}getDiffComputationResult(){const e=this._diffModel.get()?.diff.get();return e?{changes:this.getLineChanges(),changes2:e.mappings.map(t=>t.lineRangeMapping),identical:e.identical,quitEarly:e.quitEarly}:null}revert(e){const t=this._diffModel.get();!t||!t.isDiffUpToDate.get()||(this._editors.modified.pushUndoStop(),this._editors.modified.executeEdits("diffEditor",[{range:e.modified.toExclusiveRange(),text:t.model.original.getValueInRange(e.original.toExclusiveRange())}]),this._editors.modified.pushUndoStop())}revertRangeMappings(e){const t=this._diffModel.get();if(!t||!t.isDiffUpToDate.get())return;const i=e.map(n=>({range:n.modifiedRange,text:t.model.original.getValueInRange(n.originalRange)}));this._editors.modified.pushUndoStop(),this._editors.modified.executeEdits("diffEditor",i),this._editors.modified.pushUndoStop()}revertFocusedRangeMappings(){const e=this._diffModel.get();if(!e||!e.isDiffUpToDate.get())return;const t=this._diffModel.get()?.diff.get()?.mappings;if(!t||t.length===0)return;const i=this._editors.modified;if(!i.hasTextFocus())return;const n=i.getPosition().lineNumber,s=i.getSelection(),r=l.LineRange.fromRange(s||new l.Range(n,0,n,0)),a=t.filter(c=>c.lineRangeMapping.modified.intersect(r));i.pushUndoStop(),i.executeEdits("diffEditor",a.map(c=>({range:c.lineRangeMapping.modified.toExclusiveRange(),text:e.model.original.getValueInRange(c.lineRangeMapping.original.toExclusiveRange())}))),i.pushUndoStop()}_goTo(e){this._editors.modified.setPosition(new l.Position(e.lineRangeMapping.modified.startLineNumber,1)),this._editors.modified.revealRangeInCenter(e.lineRangeMapping.modified.toExclusiveRange())}goToDiff(e){const t=this._diffModel.get()?.diff.get()?.mappings;if(!t||t.length===0)return;const i=this._editors.modified.getPosition().lineNumber;let n;e==="next"?this._editors.modified.getModel().getLineCount()===i?n=t[0]:n=t.find(r=>r.lineRangeMapping.modified.startLineNumber>i)??t[0]:n=l.findLast(t,s=>s.lineRangeMapping.modified.startLineNumber<i)??t[t.length-1],this._goTo(n),n.lineRangeMapping.modified.isEmpty?this._accessibilitySignalService.playSignal(xn.diffLineDeleted,{source:"diffEditor.goToDiff"}):n.lineRangeMapping.original.isEmpty?this._accessibilitySignalService.playSignal(xn.diffLineInserted,{source:"diffEditor.goToDiff"}):n&&this._accessibilitySignalService.playSignal(xn.diffLineModified,{source:"diffEditor.goToDiff"})}revealFirstDiff(){const e=this._diffModel.get();e&&this.waitForDiff().then(()=>{const t=e.diff.get()?.mappings;!t||t.length===0||this._goTo(t[0])})}accessibleDiffViewerNext(){this._accessibleDiffViewer.get().next()}accessibleDiffViewerPrev(){this._accessibleDiffViewer.get().prev()}async waitForDiff(){const e=this._diffModel.get();e&&await e.waitForDiff()}mapToOtherSide(){const e=this._editors.modified.hasWidgetFocus(),t=e?this._editors.modified:this._editors.original,i=e?this._editors.original:this._editors.modified;let n;const s=t.getSelection();if(s){const r=this._diffModel.get()?.diff.get()?.mappings.map(a=>e?a.lineRangeMapping.flip():a.lineRangeMapping);if(r){const a=fO(s.getStartPosition(),r),c=fO(s.getEndPosition(),r);n=l.Range.plusRange(a,c)}}return{destination:i,destinationSelection:n}}switchSide(){const{destination:e,destinationSelection:t}=this.mapToOtherSide();e.focus(),t&&e.setSelection(t)}exitCompareMove(){const e=this._diffModel.get();e&&e.movedTextToCompare.set(void 0,void 0)}collapseAllUnchangedRegions(){const e=this._diffModel.get()?.unchangedRegions.get();e&&nt(t=>{for(const i of e)i.collapseAll(t)})}showAllUnchangedRegions(){const e=this._diffModel.get()?.unchangedRegions.get();e&&nt(t=>{for(const i of e)i.showAll(t)})}_handleCursorPositionChange(e,t){if(e?.reason===3){const i=this._diffModel.get()?.diff.get()?.mappings.find(n=>t?n.lineRangeMapping.modified.contains(e.position.lineNumber):n.lineRangeMapping.original.contains(e.position.lineNumber));i?.lineRangeMapping.modified.isEmpty?this._accessibilitySignalService.playSignal(xn.diffLineDeleted,{source:"diffEditor.cursorPositionChanged"}):i?.lineRangeMapping.original.isEmpty?this._accessibilitySignalService.playSignal(xn.diffLineInserted,{source:"diffEditor.cursorPositionChanged"}):i&&this._accessibilitySignalService.playSignal(xn.diffLineModified,{source:"diffEditor.cursorPositionChanged"})}}},_.DiffEditorWidget=sJ([uf(3,be),uf(4,me),uf(5,pt),uf(6,Xa),uf(7,d_)],_.DiffEditorWidget);function oJ(o){return o.mappings.map(e=>{const t=e.lineRangeMapping;let i,n,s,r,a=t.innerChanges;return t.original.isEmpty?(i=t.original.startLineNumber-1,n=0,a=void 0):(i=t.original.startLineNumber,n=t.original.endLineNumberExclusive-1),t.modified.isEmpty?(s=t.modified.startLineNumber-1,r=0,a=void 0):(s=t.modified.startLineNumber,r=t.modified.endLineNumberExclusive-1),{originalStartLineNumber:i,originalEndLineNumber:n,modifiedStartLineNumber:s,modifiedEndLineNumber:r,charChanges:a?.map(c=>({originalStartLineNumber:c.originalRange.startLineNumber,originalStartColumn:c.originalRange.startColumn,originalEndLineNumber:c.originalRange.endLineNumber,originalEndColumn:c.originalRange.endColumn,modifiedStartLineNumber:c.modifiedRange.startLineNumber,modifiedStartColumn:c.modifiedRange.startColumn,modifiedEndLineNumber:c.modifiedRange.endLineNumber,modifiedEndColumn:c.modifiedRange.endColumn}))}})}function Ys(o){return o&&typeof o.getEditorType=="function"?o.getEditorType()===_d.ICodeEditor:!1}function $O(o){return o&&typeof o.getEditorType=="function"?o.getEditorType()===_d.IDiffEditor:!1}function rJ(o){return!!o&&typeof o=="object"&&typeof o.onDidChangeActiveEditor=="function"}function aJ(o){return Ys(o)?o:$O(o)?o.getModifiedEditor():rJ(o)&&Ys(o.activeCodeEditor)?o.activeCodeEditor:null}var lJ=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},KO=function(o,e){return function(t,i){e(t,i,o)}},B_;let X0=(Ol=class{constructor(e,t){this._configurationService=e,this._languageService=t}async renderCodeBlock(e,t,i){const n=Ys(i.context)?i.context:void 0;let s;e?s=this._languageService.getLanguageIdByLanguageName(e):n&&(s=n.getModel()?.getLanguageId()),s||(s=pn);const r=await W6(this._languageService,t,s),a=B_._ttpTokenizer?B_._ttpTokenizer.createHTML(r)??r:r,c=document.createElement("span");c.innerHTML=a;const h=c.querySelector(".monaco-tokenized-source");return Ve(h)?(Ot(h,this.getFontInfo(n)),c):document.createElement("span")}getFontInfo(e){return e?e.getOption(59):eV({fontFamily:this._configurationService.getValue("editor").fontFamily},1)}},B_=Ol,Ol._ttpTokenizer=lo("tokenizeToString",{createHTML(e){return e}}),Ol);X0=B_=lJ([KO(0,Ge),KO(1,yt)],X0);var J0=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},Pe=function(o,e){return function(t,i){e(t,i,o)}};let cJ=0,GO=!1;function hJ(o){if(!o){if(GO)return;GO=!0}Yz(o||Ae.document.body)}let z_=class extends _.CodeEditorWidget{constructor(e,t,i,n,s,r,a,c,h,d,u,f,g,m,p){const b={...t};b.ariaLabel=b.ariaLabel||BL.editorViewAccessibleLabel,super(e,b,{},i,n,s,r,h,d,u,f,g,p),c instanceof Ch?this._standaloneKeybindingService=c:this._standaloneKeybindingService=null,hJ(b.ariaContainerElement),T9((v,C)=>i.createInstance(_.WorkbenchHoverDelegate,v,{instantHover:C},{})),N9(a),m.setDefaultCodeBlockRenderer(i.createInstance(X0))}addCommand(e,t,i){if(!this._standaloneKeybindingService)return console.warn("Cannot add command because the editor is configured with an unrecognized KeybindingService"),null;const n="DYNAMIC_"+ ++cJ,s=de.deserialize(i);return this._standaloneKeybindingService.addDynamicKeybinding(n,e,t,s),n}createContextKey(e,t){return this._contextKeyService.createKey(e,t)}addAction(e){if(typeof e.id!="string"||typeof e.label!="string"||typeof e.run!="function")throw new Error("Invalid action descriptor, `id`, `label` and `run` are required properties!");if(!this._standaloneKeybindingService)return console.warn("Cannot add keybinding because the editor is configured with an unrecognized KeybindingService"),l.Disposable.None;const t=e.id,i=e.label,n=de.and(de.equals("editorId",this.getId()),de.deserialize(e.precondition)),s=e.keybindings,r=de.and(n,de.deserialize(e.keybindingContext)),a=e.contextMenuGroupId||null,c=e.contextMenuOrder||0,h=(g,...m)=>Promise.resolve(e.run(this,...m)),d=new l.DisposableStore,u=this.getId()+":"+t;if(d.add(Ut.registerCommand(u,h)),a){const g={command:{id:u,title:i},when:n,group:a,order:c};d.add(Qn.appendMenuItem(ct.EditorContext,g))}if(Array.isArray(s))for(const g of s)d.add(this._standaloneKeybindingService.addDynamicKeybinding(u,g,h,r));const f=new zT(u,i,i,void 0,n,(...g)=>Promise.resolve(e.run(this,...g)),this._contextKeyService);return this._actions.set(t,f),d.add(l.toDisposable(()=>{this._actions.delete(t)})),d}_triggerCommand(e,t){if(this._codeEditorService instanceof Lp)try{this._codeEditorService.setActiveCodeEditor(this),super._triggerCommand(e,t)}finally{this._codeEditorService.setActiveCodeEditor(null)}else super._triggerCommand(e,t)}};z_=J0([Pe(2,me),Pe(3,pt),Pe(4,zi),Pe(5,be),Pe(6,kc),Pe(7,xt),Pe(8,_i),Pe(9,yn),Pe(10,Ui),Pe(11,ms),Pe(12,ze),Pe(13,Pu),Pe(14,Na)],z_);let W0=class extends z_{constructor(e,t,i,n,s,r,a,c,h,d,u,f,g,m,p,b,v,C){const w={...t};R_(u,w,!1);const S=h.registerEditorContainer(e);typeof w.theme=="string"&&h.setTheme(w.theme),typeof w.autoDetectHighContrast<"u"&&h.setAutoDetectHighContrast(!!w.autoDetectHighContrast);const L=w.model;delete w.model,super(e,w,i,n,s,r,a,c,h,d,f,p,b,v,C),this._configurationService=u,this._standaloneThemeService=h,this._register(S);let D;if(typeof L>"u"){const x=m.getLanguageIdByMimeType(w.language)||w.language||pn;D=jO(g,m,w.value||"",x,void 0),this._ownsModel=!0}else D=L,this._ownsModel=!1;if(this._attachModel(D),D){const x={oldModelUrl:null,newModelUrl:D.uri};this._onDidChangeModel.fire(x)}}updateOptions(e){R_(this._configurationService,e,!1),typeof e.theme=="string"&&this._standaloneThemeService.setTheme(e.theme),typeof e.autoDetectHighContrast<"u"&&this._standaloneThemeService.setAutoDetectHighContrast(!!e.autoDetectHighContrast),super.updateOptions(e)}_postDetachModelCleanup(e){super._postDetachModelCleanup(e),e&&this._ownsModel&&(e.dispose(),this._ownsModel=!1)}};W0=J0([Pe(2,me),Pe(3,pt),Pe(4,zi),Pe(5,be),Pe(6,kc),Pe(7,xt),Pe(8,Tn),Pe(9,yn),Pe(10,Ge),Pe(11,Ui),Pe(12,ri),Pe(13,yt),Pe(14,ms),Pe(15,ze),Pe(16,Pu),Pe(17,Na)],W0);let H0=class extends _.DiffEditorWidget{constructor(e,t,i,n,s,r,a,c,h,d,u,f){const g={...t};R_(c,g,!0);const m=r.registerEditorContainer(e);typeof g.theme=="string"&&r.setTheme(g.theme),typeof g.autoDetectHighContrast<"u"&&r.setAutoDetectHighContrast(!!g.autoDetectHighContrast),super(e,g,{},n,i,s,f,d),this._configurationService=c,this._standaloneThemeService=r,this._register(m)}updateOptions(e){R_(this._configurationService,e,!0),typeof e.theme=="string"&&this._standaloneThemeService.setTheme(e.theme),typeof e.autoDetectHighContrast<"u"&&this._standaloneThemeService.setAutoDetectHighContrast(!!e.autoDetectHighContrast),super.updateOptions(e)}_createInnerEditor(e,t,i){return e.createInstance(z_,t,i)}getOriginalEditor(){return super.getOriginalEditor()}getModifiedEditor(){return super.getModifiedEditor()}addCommand(e,t,i){return this.getModifiedEditor().addCommand(e,t,i)}createContextKey(e,t){return this.getModifiedEditor().createContextKey(e,t)}addAction(e){return this.getModifiedEditor().addAction(e)}};H0=J0([Pe(2,me),Pe(3,be),Pe(4,pt),Pe(5,Tn),Pe(6,yn),Pe(7,Ge),Pe(8,nn),Pe(9,d_),Pe(10,Ip),Pe(11,Xa)],H0);function jO(o,e,t,i,n){if(t=t||"",!i){const s=t.indexOf(`
|
||
`);let r=t;return s!==-1&&(r=t.substring(0,s)),qO(o,t,e.createByFilepathOrFirstLine(n||null,r),n)}return qO(o,t,e.createById(i),n)}function qO(o,e,t,i){return o.createModel(e,t,i)}E("multiDiffEditor.headerBackground",{dark:"#262626",light:"tab.inactiveBackground",hcDark:"tab.inactiveBackground",hcLight:"tab.inactiveBackground"},l.localize(158,"The background color of the diff editor's header")),E("multiDiffEditor.background",vn,l.localize(159,"The background color of the multi file diff editor")),E("multiDiffEditor.border",{dark:"sideBarSectionHeader.border",light:"#cccccc",hcDark:"sideBarSectionHeader.border",hcLight:"#cccccc"},l.localize(160,"The border color of the multi file diff editor"));var dJ=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},YO=function(o,e){return function(t,i){e(t,i,o)}};class uJ{constructor(e,t){this.viewModel=e,this.deltaScrollVertical=t}getId(){return this.viewModel}}let eD=class extends l.Disposable{constructor(e,t,i,n,s){super(),this._container=e,this._overflowWidgetsDomNode=t,this._workbenchUIElementFactory=i,this._instantiationService=n,this._viewModel=W(this,void 0),this._collapsed=Z(this,c=>this._viewModel.read(c)?.collapsed.read(c)),this._editorContentHeight=W(this,500),this.contentHeight=Z(this,c=>(this._collapsed.read(c)?0:this._editorContentHeight.read(c))+this._outerEditorHeight),this._modifiedContentWidth=W(this,0),this._modifiedWidth=W(this,0),this._originalContentWidth=W(this,0),this._originalWidth=W(this,0),this.maxScroll=Z(this,c=>{const h=this._modifiedContentWidth.read(c)-this._modifiedWidth.read(c),d=this._originalContentWidth.read(c)-this._originalWidth.read(c);return h>d?{maxScroll:h,width:this._modifiedWidth.read(c)}:{maxScroll:d,width:this._originalWidth.read(c)}}),this._elements=_e("div.multiDiffEntry",[_e("div.header@header",[_e("div.header-content",[_e("div.collapse-button@collapseButton"),_e("div.file-path",[_e("div.title.modified.show-file-icons@primaryPath",[]),_e("div.status.deleted@status",["R"]),_e("div.title.original.show-file-icons@secondaryPath",[])]),_e("div.actions@actions")])]),_e("div.editorParent",[_e("div.editorContainer@editor")])]),this.editor=this._register(this._instantiationService.createInstance(_.DiffEditorWidget,this._elements.editor,{overflowWidgetsDomNode:this._overflowWidgetsDomNode,fixedOverflowWidgets:!0},{})),this.isModifedFocused=Mr(this.editor.getModifiedEditor()).isFocused,this.isOriginalFocused=Mr(this.editor.getOriginalEditor()).isFocused,this.isFocused=Z(this,c=>this.isModifedFocused.read(c)||this.isOriginalFocused.read(c)),this._resourceLabel=this._workbenchUIElementFactory.createResourceLabel?this._register(this._workbenchUIElementFactory.createResourceLabel(this._elements.primaryPath)):void 0,this._resourceLabel2=this._workbenchUIElementFactory.createResourceLabel?this._register(this._workbenchUIElementFactory.createResourceLabel(this._elements.secondaryPath)):void 0,this._dataStore=this._register(new l.DisposableStore),this._headerHeight=40,this._lastScrollTop=-1,this._isSettingScrollTop=!1;const r=this._register(new v_(this._elements.collapseButton,{}));this._register(he(c=>{r.element.className="",r.icon=this._collapsed.read(c)?l.Codicon.chevronRight:l.Codicon.chevronDown})),this._register(r.onDidClick(()=>{this._viewModel.get()?.collapsed.set(!this._collapsed.get(),void 0)})),this._workbenchUIElementFactory.headerClickToCollapse&&(this._elements.header.tabIndex=0,this._elements.header.setAttribute("role","button"),this._register(R(this._elements.header,F.CLICK,c=>{const h=c.target;h instanceof Element&&(h.closest(".actions")||h.closest(".collapse-button")||this._viewModel.get()?.collapsed.set(!this._collapsed.get(),void 0))})),this._register(R(this._elements.header,F.KEY_DOWN,c=>{if(c.key==="Enter"||c.key===" "){const h=c.target;if(h instanceof Element&&(h.closest(".actions")||h.closest(".collapse-button")))return;c.preventDefault(),this._viewModel.get()?.collapsed.set(!this._collapsed.get(),void 0)}}))),this._register(he(c=>{const h=this._collapsed.read(c);this._elements.editor.style.display=h?"none":"block",this._workbenchUIElementFactory.headerClickToCollapse&&this._elements.header.setAttribute("aria-expanded",String(!h))})),this._register(this.editor.getModifiedEditor().onDidLayoutChange(c=>{const h=this.editor.getModifiedEditor().getLayoutInfo().contentWidth;this._modifiedWidth.set(h,void 0)})),this._register(this.editor.getOriginalEditor().onDidLayoutChange(c=>{const h=this.editor.getOriginalEditor().getLayoutInfo().contentWidth;this._originalWidth.set(h,void 0)})),this._register(this.editor.onDidContentSizeChange(c=>{Xh(h=>{this._editorContentHeight.set(c.contentHeight,h),this._modifiedContentWidth.set(this.editor.getModifiedEditor().getContentWidth(),h),this._originalContentWidth.set(this.editor.getOriginalEditor().getContentWidth(),h)})})),this._register(this.editor.getOriginalEditor().onDidScrollChange(c=>{if(this._isSettingScrollTop||!c.scrollTopChanged||!this._data)return;const h=c.scrollTop-this._lastScrollTop;this._data.deltaScrollVertical(h)})),this._register(he(c=>{const h=this._viewModel.read(c)?.isActive.read(c);this._elements.root.classList.toggle("active",h)})),this._container.appendChild(this._elements.root),this._outerEditorHeight=this._headerHeight,this._contextKeyService=this._register(s.createScoped(this._elements.actions));const a=this._register(this._instantiationService.createChild(new Oc([be,this._contextKeyService])));this._register(a.createInstance(_.MenuWorkbenchToolBar,this._elements.actions,ct.MultiDiffEditorFileToolbar,{actionRunner:this._register(new FO(()=>this._viewModel.get()?.modifiedUri??this._viewModel.get()?.originalUri)),menuOptions:{shouldForwardArgs:!0},toolbarOptions:{primaryGroup:c=>c.startsWith("navigation")},actionViewItemProvider:(c,h)=>Gy(a,c,h)}))}setScrollLeft(e){this._modifiedContentWidth.get()-this._modifiedWidth.get()>this._originalContentWidth.get()-this._originalWidth.get()?this.editor.getModifiedEditor().setScrollLeft(e):this.editor.getOriginalEditor().setScrollLeft(e)}setData(e){this._data=e;function t(n){return{...n,scrollBeyondLastLine:!1,hideUnchangedRegions:{enabled:!0},scrollbar:{vertical:"hidden",horizontal:"hidden",handleMouseWheel:!1,useShadows:!1},renderOverviewRuler:!1,fixedOverflowWidgets:!0,overviewRulerBorder:!1}}if(!e){Xh(n=>{this._viewModel.set(void 0,n),this.editor.setDiffModel(null,n),this._dataStore.clear()});return}const i=e.viewModel.documentDiffItem;if(Xh(n=>{this._resourceLabel?.setUri(e.viewModel.modifiedUri??e.viewModel.originalUri,{strikethrough:e.viewModel.modifiedUri===void 0});let s=!1,r=!1,a=!1,c="";e.viewModel.modifiedUri&&e.viewModel.originalUri&&e.viewModel.modifiedUri.path!==e.viewModel.originalUri.path?(c="R",s=!0):e.viewModel.modifiedUri?e.viewModel.originalUri||(c="A",a=!0):(c="D",r=!0),this._elements.status.classList.toggle("renamed",s),this._elements.status.classList.toggle("deleted",r),this._elements.status.classList.toggle("added",a),this._elements.status.innerText=c,this._resourceLabel2?.setUri(s?e.viewModel.originalUri:void 0,{strikethrough:!0}),this._dataStore.clear(),this._viewModel.set(e.viewModel,n),this.editor.setDiffModel(e.viewModel.diffEditorViewModelRef,n),this.editor.updateOptions(t(i.options??{}))}),i.onOptionsDidChange&&this._dataStore.add(i.onOptionsDidChange(()=>{this.editor.updateOptions(t(i.options??{}))})),e.viewModel.isAlive.recomputeInitiallyAndOnChange(this._dataStore,n=>{n||this.setData(void 0)}),e.viewModel.documentDiffItem.contextKeys)for(const[n,s]of Object.entries(e.viewModel.documentDiffItem.contextKeys))this._contextKeyService.createKey(n,s)}render(e,t,i,n){this._elements.root.style.visibility="visible",this._elements.root.style.top=`${e.start}px`,this._elements.root.style.height=`${e.length}px`,this._elements.root.style.width=`${t}px`,this._elements.root.style.position="absolute";const s=e.length-this._headerHeight,r=Math.max(0,Math.min(n.start-e.start,s));this._elements.header.style.transform=`translateY(${r}px)`,Xh(a=>{this.editor.layout({width:t-16-2,height:e.length-this._outerEditorHeight})});try{this._isSettingScrollTop=!0,this._lastScrollTop=i,this.editor.getOriginalEditor().setScrollTop(i)}finally{this._isSettingScrollTop=!1}this._elements.header.classList.toggle("shadow",r>0||i>0),this._elements.header.classList.toggle("collapsed",r===s)}hide(){this._elements.root.style.top="-100000px",this._elements.root.style.visibility="hidden"}};eD=dJ([YO(3,me),YO(4,be)],eD);class fJ{constructor(e){this._create=e,this._unused=new Set,this._used=new Set,this._itemData=new Map}getUnusedObj(e){let t;if(this._unused.size===0)t=this._create(e),this._itemData.set(t,e);else{const i=[...this._unused.values()];t=i.find(n=>this._itemData.get(n).getId()===e.getId())??i[0],this._unused.delete(t),this._itemData.set(t,e),t.setData(e)}return this._used.add(t),{object:t,dispose:()=>{this._used.delete(t),this._unused.size>5?t.dispose():this._unused.add(t)}}}dispose(){for(const e of this._used)e.dispose();for(const e of this._unused)e.dispose();this._used.clear(),this._unused.clear()}}var gJ=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},ZO=function(o,e){return function(t,i){e(t,i,o)}};let tD=class extends l.Disposable{constructor(e,t,i,n,s,r){super(),this._element=e,this._dimension=t,this._viewModel=i,this._workbenchUIElementFactory=n,this._parentContextKeyService=s,this._parentInstantiationService=r,this._scrollableElements=_e("div.scrollContent",[_e("div@content",{style:{overflow:"hidden"}}),_e("div.monaco-editor@overflowWidgetsDomNode",{})]),this._scrollable=this._register(new mc({forceIntegerValues:!1,scheduleAtNextAnimationFrame:h=>Ti(j(this._element),h),smoothScrollDuration:100})),this._scrollableElement=this._register(new Xg(this._scrollableElements.root,{vertical:1,horizontal:1,useShadows:!1},this._scrollable)),this._elements=_e("div.monaco-component.multiDiffEditor",{},[_e("div",{},[this._scrollableElement.getDomNode()]),_e("div.placeholder@placeholder",{},[_e("div")])]),this._sizeObserver=this._register(new dO(this._element,void 0)),this._objectPool=this._register(new fJ(h=>{const d=this._instantiationService.createInstance(eD,this._scrollableElements.content,this._scrollableElements.overflowWidgetsDomNode,this._workbenchUIElementFactory);return d.setData(h),d})),this.scrollTop=mt(this,this._scrollableElement.onScroll,()=>this._scrollableElement.getScrollPosition().scrollTop),this.scrollLeft=mt(this,this._scrollableElement.onScroll,()=>this._scrollableElement.getScrollPosition().scrollLeft),this._viewItemsInfo=Z(this,h=>{const d=this._viewModel.read(h);if(!d)return{items:[],getItem:m=>{throw new l.BugIndicatingError}};const u=d.items.read(h),f=new Map;return{items:u.map(m=>{const p=h.store.add(new pJ(m,this._objectPool,this.scrollLeft,v=>{this._scrollableElement.setScrollPosition({scrollTop:this._scrollableElement.getScrollPosition().scrollTop+v})})),b=this._lastDocStates?.[p.getKey()];return b&&nt(v=>{p.setViewState(b,v)}),f.set(m,p),p}),getItem:m=>f.get(m)}}),this._viewItems=this._viewItemsInfo.map(this,h=>h.items),this._spaceBetweenPx=0,this._totalHeight=this._viewItems.map(this,(h,d)=>h.reduce((u,f)=>u+f.contentHeight.read(d)+this._spaceBetweenPx,0)),this.activeControl=Z(this,h=>{const d=this._viewModel.read(h)?.activeDiffItem.read(h);return d?this._viewItemsInfo.read(h).getItem(d).template.read(h)?.editor:void 0}),this._contextKeyService=this._register(this._parentContextKeyService.createScoped(this._element)),this._instantiationService=this._register(this._parentInstantiationService.createChild(new Oc([be,this._contextKeyService]))),this._contextKeyService.createKey(_.EditorContextKeys.inMultiDiffEditor.key,!0),this._lastDocStates={},this._register(Kn((h,d)=>{const u=this._viewModel.read(h);if(u&&u.contextKeys)for(const[f,g]of Object.entries(u.contextKeys)){const m=this._contextKeyService.createKey(f,void 0);m.set(g),d.add(l.toDisposable(()=>m.reset()))}}));const a=this._parentContextKeyService.createKey(_.EditorContextKeys.multiDiffEditorAllCollapsed.key,!1);this._register(he(h=>{const d=this._viewModel.read(h);if(d){const u=d.items.read(h).every(f=>f.collapsed.read(h));a.set(u)}})),this._register(he(h=>{const d=this._dimension.read(h);this._sizeObserver.observe(d)}));const c=Z(h=>{if(this._viewItems.read(h).length>0)return;const u=this._viewModel.read(h);return!u||u.isLoading.read(h)?l.localize(161,"Loading..."):l.localize(162,"No Changed Files")});this._register(he(h=>{const d=c.read(h);this._elements.placeholder.innerText=d??"",this._elements.placeholder.classList.toggle("visible",!!d)})),this._scrollableElements.content.style.position="relative",this._register(he(h=>{const d=this._sizeObserver.height.read(h);this._scrollableElements.root.style.height=`${d}px`;const u=this._totalHeight.read(h);this._scrollableElements.content.style.height=`${u}px`;const f=this._sizeObserver.width.read(h);let g=f;const m=this._viewItems.read(h),p=l.findFirstMax(m,l.compareBy(b=>b.maxScroll.read(h).maxScroll,l.numberComparator));if(p){const b=p.maxScroll.read(h);g=f+b.maxScroll}this._scrollableElement.setScrollDimensions({width:f,height:d,scrollHeight:u,scrollWidth:g})})),e.replaceChildren(this._elements.root),this._register(l.toDisposable(()=>{e.replaceChildren()})),this._register(he(h=>{const d=this._viewModel.read(h);if(d&&!d.isLoading.read(h)){if(d.items.read(h).length===0||d.activeDiffItem.read(h))return;this.goToNextChange()}})),this._register(this._register(he(h=>{Xh(d=>{this.render(h)})})))}reveal(e,t){const i=this._viewItems.get(),n=i.findIndex(h=>h.viewModel.originalUri?.toString()===e.original?.toString()&&h.viewModel.modifiedUri?.toString()===e.modified?.toString());if(n===-1)throw new l.BugIndicatingError("Resource not found in diff editor");const s=i[n];this._viewModel.get().activeDiffItem.setCache(s.viewModel,void 0);let r=0;for(let h=0;h<n;h++)r+=i[h].contentHeight.get()+this._spaceBetweenPx;this._scrollableElement.setScrollPosition({scrollTop:r});const a=s.template.get()?.editor,c="original"in e?a?.getOriginalEditor():a?.getModifiedEditor();c&&t?.range&&(c.revealRangeInCenter(t.range),mJ(c,t.range))}goToNextChange(){this._navigateToChange("next")}_navigateToChange(e){const t=this._viewItems.get();if(t.length===0)return;const i=this._viewModel.get()?.activeDiffItem.get(),n=i?t.findIndex(c=>c.viewModel===i):-1;if(n===-1){this._goToFile(0,"first");return}const s=t[n];s.viewModel.collapsed.get()&&s.viewModel.collapsed.set(!1,void 0);const r=s.template.get()?.editor;if(r?.getDiffComputationResult()?.changes2?.length){const c=r.getModifiedEditor().getPosition()?.lineNumber||1,h=r.getDiffComputationResult().changes2;if(e==="next"?h.some(u=>u.modified.startLineNumber>c):h.some(u=>u.modified.endLineNumberExclusive<=c)){r.goToDiff(e);return}}const a=(n+(e==="next"?1:-1)+t.length)%t.length;this._goToFile(a,e==="next"?"first":"last")}_goToFile(e,t){const i=this._viewItems.get()[e];i.viewModel.collapsed.get()&&i.viewModel.collapsed.set(!1,void 0),this.reveal({original:i.viewModel.originalUri,modified:i.viewModel.modifiedUri});const n=i.template.get()?.editor;if(n?.getDiffComputationResult()?.changes2?.length)if(t==="first")n.revealFirstDiff();else{const s=n.getDiffComputationResult().changes2.at(-1),r=n.getModifiedEditor();r.setPosition({lineNumber:s.modified.startLineNumber,column:1}),r.revealLineInCenter(s.modified.startLineNumber)}n?.focus()}render(e){const t=this.scrollTop.read(e);let i=0,n=0,s=0;const r=this._sizeObserver.height.read(e),a=l.OffsetRange.ofStartAndLength(t,r),c=this._sizeObserver.width.read(e);for(const h of this._viewItems.read(e)){const d=h.contentHeight.read(e),u=Math.min(d,r),f=l.OffsetRange.ofStartAndLength(n,u),g=l.OffsetRange.ofStartAndLength(s,d);if(g.isBefore(a))i-=d-u,h.hide();else if(g.isAfter(a))h.hide();else{const m=Math.max(0,Math.min(a.start-g.start,d-u));i-=m;const p=l.OffsetRange.ofStartAndLength(t+i,r);h.render(f,m,c,p)}n+=u+this._spaceBetweenPx,s+=d+this._spaceBetweenPx}this._scrollableElements.content.style.transform=`translateY(${-(t+i)}px)`}};tD=gJ([ZO(4,be),ZO(5,me)],tD);function mJ(o,e){const t=o.getModel(),i=o.createDecorationsCollection([{range:e,options:{description:"symbol-navigate-action-highlight",className:"symbolHighlight"}}]);setTimeout(()=>{o.getModel()===t&&i.clear()},350)}class pJ extends l.Disposable{constructor(e,t,i,n){super(),this.viewModel=e,this._objectPool=t,this._scrollLeft=i,this._deltaScrollVertical=n,this._templateRef=this._register(Wb(this,void 0)),this.contentHeight=Z(this,s=>this._templateRef.read(s)?.object.contentHeight?.read(s)??this.viewModel.lastTemplateData.read(s).contentHeight),this.maxScroll=Z(this,s=>this._templateRef.read(s)?.object.maxScroll.read(s)??{maxScroll:0,scrollWidth:0}),this.template=Z(this,s=>this._templateRef.read(s)?.object),this._isHidden=W(this,!1),this._isFocused=Z(this,s=>this.template.read(s)?.isFocused.read(s)??!1),this.viewModel.setIsFocused(this._isFocused,void 0),this._register(he(s=>{const r=this._scrollLeft.read(s);this._templateRef.read(s)?.object.setScrollLeft(r)})),this._register(he(s=>{const r=this._templateRef.read(s);!r||!this._isHidden.read(s)||r.object.isFocused.read(s)||this._clear()}))}dispose(){this._clear(),super.dispose()}toString(){return`VirtualViewItem(${this.viewModel.documentDiffItem.modified?.uri.toString()})`}getKey(){return this.viewModel.getKey()}setViewState(e,t){this.viewModel.collapsed.set(e.collapsed,t),this._updateTemplateData(t);const i=this.viewModel.lastTemplateData.get(),n=e.selections?.map(l.Selection.liftSelection);this.viewModel.lastTemplateData.set({...i,selections:n},t);const s=this._templateRef.get();s&&n&&s.object.editor.setSelections(n)}_updateTemplateData(e){const t=this._templateRef.get();t&&this.viewModel.lastTemplateData.set({contentHeight:t.object.contentHeight.get(),selections:t.object.editor.getSelections()??void 0},e)}_clear(){const e=this._templateRef.get();e&&nt(t=>{this._updateTemplateData(t),e.object.hide(),this._templateRef.set(void 0,t)})}hide(){this._isHidden.set(!0,void 0)}render(e,t,i,n){this._isHidden.set(!1,void 0);let s=this._templateRef.get();if(!s){s=this._objectPool.getUnusedObj(new uJ(this.viewModel,this._deltaScrollVertical)),this._templateRef.set(s,void 0);const r=this.viewModel.lastTemplateData.get().selections;r&&s.object.editor.setSelections(r)}s.object.render(e,i,t,n)}}var _J=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},bJ=function(o,e){return function(t,i){e(t,i,o)}};let iD=class extends l.Disposable{constructor(e,t,i){super(),this._element=e,this._workbenchUIElementFactory=t,this._instantiationService=i,this._dimension=W(this,void 0),this._viewModel=W(this,void 0),this._widgetImpl=Z(this,n=>n.store.add(this._instantiationService.createInstance(Po(tD),this._element,this._dimension,this._viewModel,this._workbenchUIElementFactory))),this._register(ed(this._widgetImpl))}};iD=_J([bJ(2,me)],iD);function CJ(o,e,t){return J.initialize(t||{}).createInstance(W0,o,e)}function vJ(o){return J.get(pt).onCodeEditorAdd(t=>{o(t)})}function wJ(o){return J.get(pt).onDiffEditorAdd(t=>{o(t)})}function SJ(){return J.get(pt).listCodeEditors()}function yJ(){return J.get(pt).listDiffEditors()}function LJ(o,e,t){return J.initialize(t||{}).createInstance(H0,o,e)}function DJ(o,e){const t=J.initialize(e||{});return new iD(o,{},t)}function xJ(o){if(typeof o.id!="string"||typeof o.run!="function")throw new Error("Invalid command descriptor, `id` and `run` are required properties!");return Ut.registerCommand(o.id,o.run)}function EJ(o){if(typeof o.id!="string"||typeof o.label!="string"||typeof o.run!="function")throw new Error("Invalid action descriptor, `id`, `label` and `run` are required properties!");const e=de.deserialize(o.precondition),t=(n,...s)=>ao.runEditorCommand(n,s,e,(r,a,c)=>Promise.resolve(o.run(a,...c))),i=new l.DisposableStore;if(i.add(Ut.registerCommand(o.id,t)),o.contextMenuGroupId){const n={command:{id:o.id,title:o.label},when:e,group:o.contextMenuGroupId,order:o.contextMenuOrder||0};i.add(Qn.appendMenuItem(ct.EditorContext,n))}if(Array.isArray(o.keybindings)){const n=J.get(xt);if(!(n instanceof Ch))console.warn("Cannot add keybinding because the editor is configured with an unrecognized KeybindingService");else{const s=de.and(e,de.deserialize(o.keybindingContext));i.add(n.addDynamicKeybindings(o.keybindings.map(r=>({keybinding:r,command:o.id,when:s}))))}}return i}function IJ(o){return QO([o])}function QO(o){const e=J.get(xt);return e instanceof Ch?e.addDynamicKeybindings(o.map(t=>({keybinding:t.keybinding,command:t.command,commandArgs:t.commandArgs,when:de.deserialize(t.when)}))):(console.warn("Cannot add keybinding because the editor is configured with an unrecognized KeybindingService"),l.Disposable.None)}function TJ(o,e,t){const i=J.get(yt),n=i.getLanguageIdByMimeType(e)||e;return jO(J.get(ri),i,o,n,t)}function NJ(o,e){const t=J.get(yt),i=t.getLanguageIdByMimeType(e)||e||pn;o.setLanguage(t.createById(i))}function RJ(o,e,t){o&&J.get(xr).changeOne(e,o.uri,t)}function MJ(o){J.get(xr).changeAll(o,[])}function AJ(o){return J.get(xr).read(o)}function OJ(o){return J.get(xr).onMarkerChanged(o)}function PJ(o){return J.get(ri).getModel(o)}function kJ(){return J.get(ri).getModels()}function FJ(o){return J.get(ri).onModelAdded(o)}function BJ(o){return J.get(ri).onModelRemoved(o)}function zJ(o){return J.get(ri).onModelLanguageChanged(t=>{o({model:t.model,oldLanguage:t.oldLanguageId})})}function VJ(o){return _z(J.get(ri),J.get(fd),o)}function UJ(o,e){const t=J.get(yt),i=J.get(Tn);return zC.colorizeElement(i,t,o,e).then(()=>{i.registerEditorContainer(o)})}function $J(o,e,t){const i=J.get(yt);return J.get(Tn).registerEditorContainer(Ae.document.body),zC.colorize(i,o,e,t)}function KJ(o,e,t=4){return J.get(Tn).registerEditorContainer(Ae.document.body),zC.colorizeModelLine(o,e,t)}function GJ(o){const e=l.TokenizationRegistry.get(o);return e||{getInitialState:()=>Hl,tokenize:(t,i,n)=>OC(o,n)}}function jJ(o,e){l.TokenizationRegistry.getOrCreate(e);const t=GJ(e),i=l.splitLines(o),n=[];let s=t.getInitialState();for(let r=0,a=i.length;r<a;r++){const c=i[r],h=t.tokenize(c,!0,s);n[r]=h.tokens,s=h.endState}return n}function qJ(o,e){J.get(Tn).defineTheme(o,e)}function YJ(o){J.get(Tn).setTheme(o)}function ZJ(){hC.clearAllFontInfos()}function QJ(o,e){return Ut.registerCommand({id:o,handler:e})}function XJ(o){return J.get(Ou).registerOpener({async open(t){return typeof t=="string"&&(t=l.URI.parse(t)),o.open(t)}})}function JJ(o){return J.get(pt).registerCodeEditorOpenHandler(async(t,i,n)=>{if(!i)return null;const s=t.options?.selection;let r;return s&&typeof s.endLineNumber=="number"&&typeof s.endColumn=="number"?r=s:s&&(r={lineNumber:s.startLineNumber,column:s.startColumn}),await o.openCodeEditor(i,t.resource,r)?i:null})}function WJ(){return{create:CJ,getEditors:SJ,getDiffEditors:yJ,onDidCreateEditor:vJ,onDidCreateDiffEditor:wJ,createDiffEditor:LJ,addCommand:xJ,addEditorAction:EJ,addKeybindingRule:IJ,addKeybindingRules:QO,createModel:TJ,setModelLanguage:NJ,setModelMarkers:RJ,getModelMarkers:AJ,removeAllMarkers:MJ,onDidChangeMarkers:OJ,getModels:kJ,getModel:PJ,onDidCreateModel:FJ,onWillDisposeModel:BJ,onDidChangeModelLanguage:zJ,createWebWorker:VJ,colorizeElement:UJ,colorize:$J,colorizeModelLine:KJ,tokenize:jJ,defineTheme:qJ,setTheme:YJ,remeasureFonts:ZJ,registerCommand:QJ,registerLinkOpener:XJ,registerEditorOpener:JJ,AccessibilitySupport:l.AccessibilitySupport,ContentWidgetPositionPreference:l.ContentWidgetPositionPreference,CursorChangeReason:l.CursorChangeReason,DefaultEndOfLine:l.DefaultEndOfLine,EditorAutoIndentStrategy:l.EditorAutoIndentStrategy,EditorOption:l.EditorOption,EndOfLinePreference:l.EndOfLinePreference,EndOfLineSequence:l.EndOfLineSequence,MinimapPosition:l.MinimapPosition,MinimapSectionHeaderStyle:l.MinimapSectionHeaderStyle,MouseTargetType:l.MouseTargetType,OverlayWidgetPositionPreference:l.OverlayWidgetPositionPreference,OverviewRulerLane:l.OverviewRulerLane$1,GlyphMarginLane:l.GlyphMarginLane$1,RenderLineNumbersType:l.RenderLineNumbersType,RenderMinimap:l.RenderMinimap,ScrollbarVisibility:l.ScrollbarVisibility,ScrollType:l.ScrollType,TextEditorCursorBlinkingStyle:l.TextEditorCursorBlinkingStyle,TextEditorCursorStyle:l.TextEditorCursorStyle,TrackedRangeStickiness:l.TrackedRangeStickiness,WrappingIndent:l.WrappingIndent,InjectedTextCursorStops:l.InjectedTextCursorStops$1,PositionAffinity:l.PositionAffinity,ShowLightbulbIconMode:l.ShowLightbulbIconMode,TextDirection:l.TextDirection$1,ConfigurationChangedEvent:ND,BareFontInfo:Ur,FontInfo:Af,TextModelResolvedOptions:l.TextModelResolvedOptions,FindMatch:l.FindMatch,ApplyUpdateResult:Kh,EditorZoom:eo,createMultiFileDiffEditor:DJ,EditorType:_d,EditorOptions:Fi}}function HJ(o,e){if(!e||!Array.isArray(e))return!1;for(const t of e)if(!o(t))return!1;return!0}function V_(o,e){return typeof o=="boolean"?o:e}function XO(o,e){return typeof o=="string"?o:e}function eW(o){const e={};for(const t of o)e[t]=!0;return e}function JO(o,e=!1){e&&(o=o.map(function(i){return i.toLowerCase()}));const t=eW(o);return e?function(i){return t[i.toLowerCase()]!==void 0&&t.hasOwnProperty(i.toLowerCase())}:function(i){return t[i]!==void 0&&t.hasOwnProperty(i)}}function nD(o,e,t){e=e.replace(/@@/g,"");let i=0,n;do n=!1,e=e.replace(/@(\w+)/g,function(r,a){n=!0;let c="";if(typeof o[a]=="string")c=o[a];else if(o[a]&&o[a]instanceof RegExp)c=o[a].source;else throw o[a]===void 0?je(o,"language definition does not contain attribute '"+a+"', used at: "+e):je(o,"attribute reference '"+a+"' must be a string, used at: "+e);return la(c)?"":"(?:"+c+")"}),i++;while(n&&i<5);e=e.replace(/\x01/g,"@");const s=(o.ignoreCase?"i":"")+(o.unicode?"u":"");if(t&&e.match(/\$[sS](\d\d?)/g)){let a=null,c=null;return h=>(c&&a===h||(a=h,c=new RegExp(Bz(o,e,h),s)),c)}return new RegExp(e,s)}function tW(o,e,t,i){if(i<0)return o;if(i<e.length)return e[i];if(i>=100){i=i-100;const n=t.split(".");if(n.unshift(t),i<n.length)return n[i]}return null}function iW(o,e,t,i){let n=-1,s=t,r=t.match(/^\$(([sS]?)(\d\d?)|#)(.*)$/);r&&(r[3]&&(n=parseInt(r[3]),r[2]&&(n=n+100)),s=r[4]);let a="~",c=s;!s||s.length===0?(a="!=",c=""):/^\w*$/.test(c)?a="==":(r=s.match(/^(@|!@|~|!~|==|!=)(.*)$/),r&&(a=r[1],c=r[2]));let h;if((a==="~"||a==="!~")&&/^(\w|\|)*$/.test(c)){const d=JO(c.split("|"),o.ignoreCase);h=function(u){return a==="~"?d(u):!d(u)}}else if(a==="@"||a==="!@"){const d=o[c];if(!d)throw je(o,"the @ match target '"+c+"' is not defined, in rule: "+e);if(!HJ(function(f){return typeof f=="string"},d))throw je(o,"the @ match target '"+c+"' must be an array of strings, in rule: "+e);const u=JO(d,o.ignoreCase);h=function(f){return a==="@"?u(f):!u(f)}}else if(a==="~"||a==="!~")if(c.indexOf("$")<0){const d=nD(o,"^"+c+"$",!1);h=function(u){return a==="~"?d.test(u):!d.test(u)}}else h=function(d,u,f,g){return nD(o,"^"+Ho(o,c,u,f,g)+"$",!1).test(d)};else if(c.indexOf("$")<0){const d=co(o,c);h=function(u){return a==="=="?u===d:u!==d}}else{const d=co(o,c);h=function(u,f,g,m,p){const b=Ho(o,d,f,g,m);return a==="=="?u===b:u!==b}}return n===-1?{name:t,value:i,test:function(d,u,f,g){return h(d,d,u,f,g)}}:{name:t,value:i,test:function(d,u,f,g){const m=tW(d,u,f,n);return h(m||"",d,u,f,g)}}}function sD(o,e,t){if(t){if(typeof t=="string")return t;if(t.token||t.token===""){if(typeof t.token!="string")throw je(o,"a 'token' attribute must be of type string, in rule: "+e);{const i={token:t.token};if(t.token.indexOf("$")>=0&&(i.tokenSubst=!0),typeof t.bracket=="string")if(t.bracket==="@open")i.bracket=1;else if(t.bracket==="@close")i.bracket=-1;else throw je(o,"a 'bracket' attribute must be either '@open' or '@close', in rule: "+e);if(t.next){if(typeof t.next!="string")throw je(o,"the next state must be a string value in rule: "+e);{let n=t.next;if(!/^(@pop|@push|@popall)$/.test(n)&&(n[0]==="@"&&(n=n.substr(1)),n.indexOf("$")<0&&!zz(o,Ho(o,n,"",[],""))))throw je(o,"the next state '"+t.next+"' is not defined in rule: "+e);i.next=n}}return typeof t.goBack=="number"&&(i.goBack=t.goBack),typeof t.switchTo=="string"&&(i.switchTo=t.switchTo),typeof t.log=="string"&&(i.log=t.log),typeof t.nextEmbedded=="string"&&(i.nextEmbedded=t.nextEmbedded,o.usesEmbedded=!0),i}}else if(Array.isArray(t)){const i=[];for(let n=0,s=t.length;n<s;n++)i[n]=sD(o,e,t[n]);return{group:i}}else if(t.cases){const i=[];let n=!1;for(const r in t.cases)if(t.cases.hasOwnProperty(r)){const a=sD(o,e,t.cases[r]);r==="@default"||r==="@"||r===""?i.push({test:void 0,value:a,name:r}):r==="@eos"?i.push({test:function(c,h,d,u){return u},value:a,name:r}):i.push(iW(o,e,r,a)),n||(n=!l.isString(a)&&(a.hasEmbeddedEndInCases||["@pop","@popall"].includes(a.nextEmbedded||"")))}const s=o.defaultToken;return{hasEmbeddedEndInCases:n,test:function(r,a,c,h){for(const d of i)if(!d.test||d.test(r,a,c,h))return d.value;return s}}}else throw je(o,"an action must be a string, an object with a 'token' or 'cases' attribute, or an array of actions; in rule: "+e)}else return{token:""}}class nW{constructor(e){this.regex=new RegExp(""),this.action={token:""},this.matchOnlyAtLineStart=!1,this.name="",this.name=e}setRegex(e,t){let i;if(typeof t=="string")i=t;else if(t instanceof RegExp)i=t.source;else throw je(e,"rules must start with a match string or regular expression: "+this.name);this.matchOnlyAtLineStart=i.length>0&&i[0]==="^",this.name=this.name+": "+i,this.regex=nD(e,"^(?:"+(this.matchOnlyAtLineStart?i.substr(1):i)+")",!0)}setAction(e,t){this.action=sD(e,this.name,t)}resolveRegex(e){return this.regex instanceof RegExp?this.regex:this.regex(e)}}function WO(o,e){if(!e||typeof e!="object")throw new Error("Monarch: expecting a language definition object");const t={languageId:o,includeLF:V_(e.includeLF,!1),noThrow:!1,maxStack:100,start:typeof e.start=="string"?e.start:null,ignoreCase:V_(e.ignoreCase,!1),unicode:V_(e.unicode,!1),tokenPostfix:XO(e.tokenPostfix,"."+o),defaultToken:XO(e.defaultToken,"source"),usesEmbedded:!1,stateNames:{},tokenizer:{},brackets:[]},i=e;i.languageId=o,i.includeLF=t.includeLF,i.ignoreCase=t.ignoreCase,i.unicode=t.unicode,i.noThrow=t.noThrow,i.usesEmbedded=t.usesEmbedded,i.stateNames=e.tokenizer,i.defaultToken=t.defaultToken;function n(r,a,c){for(const h of c){let d=h.include;if(d){if(typeof d!="string")throw je(t,"an 'include' attribute must be a string at: "+r);if(d[0]==="@"&&(d=d.substr(1)),!e.tokenizer[d])throw je(t,"include target '"+d+"' is not defined at: "+r);n(r+"."+d,a,e.tokenizer[d])}else{const u=new nW(r);if(Array.isArray(h)&&h.length>=1&&h.length<=3)if(u.setRegex(i,h[0]),h.length>=3)if(typeof h[1]=="string")u.setAction(i,{token:h[1],next:h[2]});else if(typeof h[1]=="object"){const f=h[1];f.next=h[2],u.setAction(i,f)}else throw je(t,"a next state as the last element of a rule can only be given if the action is either an object or a string, at: "+r);else u.setAction(i,h[1]);else{if(!h.regex)throw je(t,"a rule must either be an array, or an object with a 'regex' or 'include' field at: "+r);h.name&&typeof h.name=="string"&&(u.name=h.name),h.matchOnlyAtStart&&(u.matchOnlyAtLineStart=V_(h.matchOnlyAtLineStart,!1)),u.setRegex(i,h.regex),u.setAction(i,h.action)}a.push(u)}}}if(!e.tokenizer||typeof e.tokenizer!="object")throw je(t,"a language definition must define the 'tokenizer' attribute as an object");t.tokenizer=[];for(const r in e.tokenizer)if(e.tokenizer.hasOwnProperty(r)){t.start||(t.start=r);const a=e.tokenizer[r];t.tokenizer[r]=new Array,n("tokenizer."+r,t.tokenizer[r],a)}if(t.usesEmbedded=i.usesEmbedded,e.brackets){if(!Array.isArray(e.brackets))throw je(t,"the 'brackets' attribute must be defined as an array")}else e.brackets=[{open:"{",close:"}",token:"delimiter.curly"},{open:"[",close:"]",token:"delimiter.square"},{open:"(",close:")",token:"delimiter.parenthesis"},{open:"<",close:">",token:"delimiter.angle"}];const s=[];for(const r of e.brackets){let a=r;if(a&&Array.isArray(a)&&a.length===3&&(a={token:a[2],open:a[0],close:a[1]}),a.open===a.close)throw je(t,"open and close brackets in a 'brackets' attribute must be different: "+a.open+`
|
||
hint: use the 'bracket' attribute if matching on equal brackets is required.`);if(typeof a.open=="string"&&typeof a.token=="string"&&typeof a.close=="string")s.push({token:a.token+t.tokenPostfix,open:co(t,a.open),close:co(t,a.close)});else throw je(t,"every element in the 'brackets' array must be a '{open,close,token}' object or array")}return t.brackets=s,t.noThrow=!0,t}function sW(o){Jl.registerLanguage(o)}function oW(){let o=[];return o=o.concat(Jl.getLanguages()),o}function rW(o){return J.get(yt).languageIdCodec.encodeLanguageId(o)}function aW(o,e){return J.withServices(()=>{const i=J.get(yt).onDidRequestRichLanguageFeatures(n=>{n===o&&(i.dispose(),e())});return i})}function lW(o,e){return J.withServices(()=>{const i=J.get(yt).onDidRequestBasicLanguageFeatures(n=>{n===o&&(i.dispose(),e())});return i})}function cW(o,e){if(!J.get(yt).isRegisteredLanguageId(o))throw new Error(`Cannot set configuration for unknown language ${o}`);return J.get(ms).register(o,e,100)}class hW{constructor(e,t){this._languageId=e,this._actual=t}dispose(){}getInitialState(){return this._actual.getInitialState()}tokenize(e,t,i){if(typeof this._actual.tokenize=="function")return ff.adaptTokenize(this._languageId,this._actual,e,i);throw new Error("Not supported!")}tokenizeEncoded(e,t,i){const n=this._actual.tokenizeEncoded(e,i);return new l.EncodedTokenizationResult(n.tokens,[],n.endState)}}class ff{constructor(e,t,i,n){this._languageId=e,this._actual=t,this._languageService=i,this._standaloneThemeService=n}dispose(){}getInitialState(){return this._actual.getInitialState()}static _toClassicTokens(e,t){const i=[];let n=0;for(let s=0,r=e.length;s<r;s++){const a=e[s];let c=a.startIndex;s===0?c=0:c<n&&(c=n),i[s]=new l.Token(c,a.scopes,t),n=c}return i}static adaptTokenize(e,t,i,n){const s=t.tokenize(i,n),r=ff._toClassicTokens(s.tokens,e);let a;return s.endState.equals(n)?a=n:a=s.endState,new l.TokenizationResult(r,a)}tokenize(e,t,i){return ff.adaptTokenize(this._languageId,this._actual,e,i)}_toBinaryTokens(e,t){const i=e.encodeLanguageId(this._languageId),n=this._standaloneThemeService.getColorTheme().tokenTheme,s=[];let r=0,a=0;for(let h=0,d=t.length;h<d;h++){const u=t[h],f=n.match(i,u.scopes)|1024;if(r>0&&s[r-1]===f)continue;let g=u.startIndex;h===0?g=0:g<a&&(g=a),s[r++]=g,s[r++]=f,a=g}const c=new Uint32Array(r);for(let h=0;h<r;h++)c[h]=s[h];return c}tokenizeEncoded(e,t,i){const n=this._actual.tokenize(e,i),s=this._toBinaryTokens(this._languageService.languageIdCodec,n.tokens);let r;return n.endState.equals(i)?r=i:r=n.endState,new l.EncodedTokenizationResult(s,[],r)}}function dW(o){return typeof o.getInitialState=="function"}function uW(o){return"tokenizeEncoded"in o}function HO(o){return o&&typeof o.then=="function"}function fW(o){const e=J.get(Tn);if(o){const t=[null];for(let i=1,n=o.length;i<n;i++)t[i]=l.Color.fromHex(o[i]);e.setColorMapOverride(t)}else e.setColorMapOverride(null)}function eP(o,e){return uW(e)?new hW(o,e):new ff(o,e,J.get(yt),J.get(Tn))}function oD(o,e){const t=new l.LazyTokenizationSupport(async()=>{const i=await Promise.resolve(e.create());return i?dW(i)?eP(o,i):new Sd(J.get(yt),J.get(Tn),o,WO(o,i),J.get(Ge)):null});return l.TokenizationRegistry.registerFactory(o,t)}function gW(o,e){if(!J.get(yt).isRegisteredLanguageId(o))throw new Error(`Cannot set tokens provider for unknown language ${o}`);return HO(e)?oD(o,{create:()=>e}):l.TokenizationRegistry.register(o,eP(o,e))}function mW(o,e){const t=i=>new Sd(J.get(yt),J.get(Tn),o,WO(o,i),J.get(Ge));return HO(e)?oD(o,{create:()=>e}):l.TokenizationRegistry.register(o,t(e))}function pW(o,e){return J.get(ze).referenceProvider.register(o,e)}function _W(o,e){return J.get(ze).renameProvider.register(o,e)}function bW(o,e){return J.get(ze).newSymbolNamesProvider.register(o,e)}function CW(o,e){return J.get(ze).signatureHelpProvider.register(o,e)}function vW(o,e){return J.get(ze).hoverProvider.register(o,{provideHover:async(i,n,s,r)=>{const a=i.getWordAtPosition(n);return Promise.resolve(e.provideHover(i,n,s,r)).then(c=>{if(c)return!c.range&&a&&(c.range=new l.Range(n.lineNumber,a.startColumn,n.lineNumber,a.endColumn)),c.range||(c.range=new l.Range(n.lineNumber,n.column,n.lineNumber,n.column)),c})}})}function wW(o,e){return J.get(ze).documentSymbolProvider.register(o,e)}function SW(o,e){return J.get(ze).documentHighlightProvider.register(o,e)}function yW(o,e){return J.get(ze).linkedEditingRangeProvider.register(o,e)}function LW(o,e){return J.get(ze).definitionProvider.register(o,e)}function DW(o,e){return J.get(ze).implementationProvider.register(o,e)}function xW(o,e){return J.get(ze).typeDefinitionProvider.register(o,e)}function EW(o,e){return J.get(ze).codeLensProvider.register(o,e)}function IW(o,e,t){return J.get(ze).codeActionProvider.register(o,{providedCodeActionKinds:t?.providedCodeActionKinds,documentation:t?.documentation,provideCodeActions:(n,s,r,a)=>{const h=J.get(xr).read({resource:n.uri}).filter(d=>l.Range.areIntersectingOrTouching(d,s));return e.provideCodeActions(n,s,{markers:h,only:r.only,trigger:r.trigger},a)},resolveCodeAction:e.resolveCodeAction})}function TW(o,e){return J.get(ze).documentFormattingEditProvider.register(o,e)}function NW(o,e){return J.get(ze).documentRangeFormattingEditProvider.register(o,e)}function RW(o,e){return J.get(ze).onTypeFormattingEditProvider.register(o,e)}function MW(o,e){return J.get(ze).linkProvider.register(o,e)}function AW(o,e){return J.get(ze).completionProvider.register(o,e)}function OW(o,e){return J.get(ze).colorProvider.register(o,e)}function PW(o,e){return J.get(ze).foldingRangeProvider.register(o,e)}function kW(o,e){return J.get(ze).declarationProvider.register(o,e)}function FW(o,e){return J.get(ze).selectionRangeProvider.register(o,e)}function BW(o,e){return J.get(ze).documentSemanticTokensProvider.register(o,e)}function zW(o,e){return J.get(ze).documentRangeSemanticTokensProvider.register(o,e)}function VW(o,e){return J.get(ze).inlineCompletionsProvider.register(o,e)}function UW(o,e){return J.get(ze).inlayHintsProvider.register(o,e)}function $W(){return{register:sW,getLanguages:oW,onLanguage:aW,onLanguageEncountered:lW,getEncodedLanguageId:rW,setLanguageConfiguration:cW,setColorMap:fW,registerTokensProviderFactory:oD,setTokensProvider:gW,setMonarchTokensProvider:mW,registerReferenceProvider:pW,registerRenameProvider:_W,registerNewSymbolNameProvider:bW,registerCompletionItemProvider:AW,registerSignatureHelpProvider:CW,registerHoverProvider:vW,registerDocumentSymbolProvider:wW,registerDocumentHighlightProvider:SW,registerLinkedEditingRangeProvider:yW,registerDefinitionProvider:LW,registerImplementationProvider:DW,registerTypeDefinitionProvider:xW,registerCodeLensProvider:EW,registerCodeActionProvider:IW,registerDocumentFormattingEditProvider:TW,registerDocumentRangeFormattingEditProvider:NW,registerOnTypeFormattingEditProvider:RW,registerLinkProvider:MW,registerColorProvider:OW,registerFoldingRangeProvider:PW,registerDeclarationProvider:kW,registerSelectionRangeProvider:FW,registerDocumentSemanticTokensProvider:BW,registerDocumentRangeSemanticTokensProvider:zW,registerInlineCompletionsProvider:VW,registerInlayHintsProvider:UW,DocumentHighlightKind:l.DocumentHighlightKind$1,CompletionItemKind:l.CompletionItemKind,CompletionItemTag:l.CompletionItemTag,CompletionItemInsertTextRule:l.CompletionItemInsertTextRule,SymbolKind:l.SymbolKind,SymbolTag:l.SymbolTag,IndentAction:l.IndentAction,CompletionTriggerKind:l.CompletionTriggerKind,SignatureHelpTriggerKind:l.SignatureHelpTriggerKind$1,InlayHintKind:l.InlayHintKind$1,InlineCompletionTriggerKind:l.InlineCompletionTriggerKind$1,CodeActionTriggerType:l.CodeActionTriggerType,NewSymbolNameTag:l.NewSymbolNameTag$1,NewSymbolNameTriggerKind:l.NewSymbolNameTriggerKind$1,PartialAcceptTriggerKind:l.PartialAcceptTriggerKind,HoverVerbosityAction:l.HoverVerbosityAction$1,InlineCompletionEndOfLifeReasonKind:l.InlineCompletionEndOfLifeReasonKind$1,InlineCompletionHintStyle:l.InlineCompletionHintStyle$1,FoldingRangeKind:l.FoldingRangeKind,SelectedSuggestionInfo:l.SelectedSuggestionInfo,EditDeltaInfo:tu}}const rD=le("IEditorCancelService"),tP=new q("cancellableOperation",!1,l.localize(978,"Whether the editor runs a cancellable operation, e.g. like 'Peek References'"));fe(rD,class{constructor(){this._tokens=new WeakMap}add(o,e){let t=this._tokens.get(o);t||(t=o.invokeWithinContext(n=>{const s=tP.bindTo(n.get(be)),r=new l.LinkedList;return{key:s,tokens:r}}),this._tokens.set(o,t));let i;return t.key.set(!0),i=t.tokens.push(e),()=>{i&&(i(),t.key.set(!t.tokens.isEmpty()),i=void 0)}}cancel(o){const e=this._tokens.get(o);if(!e)return;const t=e.tokens.pop();t&&(t.cancel(),e.key.set(!e.tokens.isEmpty()))}},1);class KW extends l.CancellationTokenSource{constructor(e,t){super(t),this.editor=e,this._unregister=e.invokeWithinContext(i=>i.get(rD).add(e,this))}dispose(){this._unregister(),super.dispose()}}oe(new class extends ao{constructor(){super({id:"editor.cancelOperation",kbOpts:{weight:100,primary:9},precondition:tP})}runEditorCommand(o,e){o.get(rD).cancel(e)}});class U_{constructor(e,t){if(this.flags=t,(this.flags&1)!==0){const i=e.getModel();this.modelVersionId=i?l.format("{0}#{1}",i.uri.toString(),i.getVersionId()):null}else this.modelVersionId=null;(this.flags&4)!==0?this.position=e.getPosition():this.position=null,(this.flags&2)!==0?this.selection=e.getSelection():this.selection=null,(this.flags&8)!==0?(this.scrollLeft=e.getScrollLeft(),this.scrollTop=e.getScrollTop()):(this.scrollLeft=-1,this.scrollTop=-1)}_equals(e){if(!(e instanceof U_))return!1;const t=e;return!(this.modelVersionId!==t.modelVersionId||this.scrollLeft!==t.scrollLeft||this.scrollTop!==t.scrollTop||!this.position&&t.position||this.position&&!t.position||this.position&&t.position&&!this.position.equals(t.position)||!this.selection&&t.selection||this.selection&&!t.selection||this.selection&&t.selection&&!this.selection.equalsRange(t.selection))}validate(e){return this._equals(new U_(e,this.flags))}}class aD extends KW{constructor(e,t,i,n){super(e,n),this._listener=new l.DisposableStore,t&4&&this._listener.add(e.onDidChangeCursorPosition(s=>{(!i||!l.Range.containsPosition(i,s.position))&&this.cancel()})),t&2&&this._listener.add(e.onDidChangeCursorSelection(s=>{(!i||!l.Range.containsRange(i,s.selection))&&this.cancel()})),t&8&&this._listener.add(e.onDidScrollChange(s=>this.cancel())),t&1&&(this._listener.add(e.onDidChangeModel(s=>this.cancel())),this._listener.add(e.onDidChangeModelContent(s=>this.cancel())))}dispose(){this._listener.dispose(),super.dispose()}}class lD extends l.CancellationTokenSource{constructor(e,t){super(t),this._listener=e.onDidChangeContent(()=>this.cancel())}dispose(){this._listener.dispose(),super.dispose()}}class Dh{static _handleEolEdits(e,t){let i;const n=[];for(const s of t)typeof s.eol=="number"&&(i=s.eol),s.range&&typeof s.text=="string"&&n.push(s);return typeof i=="number"&&e.hasModel()&&e.getModel().pushEOL(i),n}static _isFullModelReplaceEdit(e,t){if(!e.hasModel())return!1;const i=e.getModel(),n=i.validateRange(t.range);return i.getFullModelRange().equalsRange(n)}static execute(e,t,i){i&&e.pushUndoStop();const n=vh.capture(e),s=Dh._handleEolEdits(e,t);s.length===1&&Dh._isFullModelReplaceEdit(e,s[0])?e.executeEdits("formatEditsCommand",s.map(r=>p_.replace(l.Range.lift(r.range),r.text))):e.executeEdits("formatEditsCommand",s.map(r=>p_.replaceMove(l.Range.lift(r.range),r.text))),i&&e.pushUndoStop(),n.restoreRelativeVerticalPositionOfCursor(e)}}class iP{constructor(e){this.value=e,this._lower=e.toLowerCase()}static toKey(e){return typeof e=="string"?e.toLowerCase():e._lower}}class GW{constructor(e){if(this._set=new Set,e)for(const t of e)this.add(t)}add(e){this._set.add(iP.toKey(e))}has(e){return this._set.has(iP.toKey(e))}}function nP(o,e,t){const i=[],n=new GW,s=o.ordered(t);for(const a of s)i.push(a),a.extensionId&&n.add(a.extensionId);const r=e.ordered(t);for(const a of r){if(a.extensionId){if(n.has(a.extensionId))continue;n.add(a.extensionId)}i.push({displayName:a.displayName,extensionId:a.extensionId,provideDocumentFormattingEdits(c,h,d){return a.provideDocumentRangeFormattingEdits(c,c.getFullModelRange(),h,d)}})}return i}const If=class If{static setFormatterSelector(e){return{dispose:If._selectors.unshift(e)}}static async select(e,t,i,n){if(e.length===0)return;const s=l.Iterable.first(If._selectors);if(s)return await s(e,t,i,n)}};If._selectors=new l.LinkedList;let gf=If;async function jW(o,e,t,i,n,s,r){const a=o.get(me),{documentRangeFormattingEditProvider:c}=o.get(ze),h=Ys(e)?e.getModel():e,d=c.ordered(h),u=await gf.select(d,h,i,2);u&&(n.report(u),await a.invokeFunction(qW,u,e,t,s,r))}async function qW(o,e,t,i,n,s){const r=o.get(tr),a=o.get(ei),c=o.get(Xa);let h,d;Ys(t)?(h=t.getModel(),d=new aD(t,5,void 0,n)):(h=t,d=new lD(t,n));const u=[];let f=0;for(const v of l.asArray(i).sort(l.Range.compareRangesUsingStarts))f>0&&l.Range.areIntersectingOrTouching(u[f-1],v)?u[f-1]=l.Range.fromPositions(u[f-1].getStartPosition(),v.getEndPosition()):f=u.push(v);const g=async v=>{a.trace("[format][provideDocumentRangeFormattingEdits] (request)",e.extensionId?.value,v);const C=await e.provideDocumentRangeFormattingEdits(h,v,h.getFormattingOptions(),d.token)||[];return a.trace("[format][provideDocumentRangeFormattingEdits] (response)",e.extensionId?.value,C),C},m=(v,C)=>{if(!v.length||!C.length)return!1;const w=v.reduce((S,L)=>l.Range.plusRange(S,L.range),v[0].range);if(!C.some(S=>l.Range.intersectRanges(w,S.range)))return!1;for(const S of v)for(const L of C)if(l.Range.intersectRanges(S.range,L.range))return!0;return!1},p=[],b=[];try{if(typeof e.provideDocumentRangesFormattingEdits=="function"){a.trace("[format][provideDocumentRangeFormattingEdits] (request)",e.extensionId?.value,u);const v=await e.provideDocumentRangesFormattingEdits(h,u,h.getFormattingOptions(),d.token)||[];a.trace("[format][provideDocumentRangeFormattingEdits] (response)",e.extensionId?.value,v),b.push(v)}else{for(const v of u){if(d.token.isCancellationRequested)return!0;b.push(await g(v))}for(let v=0;v<u.length;++v)for(let C=v+1;C<u.length;++C){if(d.token.isCancellationRequested)return!0;if(m(b[v],b[C])){const w=l.Range.plusRange(u[v],u[C]),S=await g(w);u.splice(C,1),u.splice(v,1),u.push(w),b.splice(C,1),b.splice(v,1),b.push(S),v=0,C=0}}}for(const v of b){if(d.token.isCancellationRequested)return!0;const C=await r.computeMoreMinimalEdits(h.uri,v);C&&p.push(...C)}if(d.token.isCancellationRequested)return!0}finally{d.dispose()}if(p.length===0)return!1;if(Ys(t))Dh.execute(t,p,!0),t.revealPositionInCenterIfOutsideViewport(t.getPosition(),1);else{const[{range:v}]=p,C=new l.Selection(v.startLineNumber,v.startColumn,v.endLineNumber,v.endColumn);h.pushEditOperations([C],p.map(w=>({text:w.text,range:l.Range.lift(w.range),forceMoveMarkers:!0})),w=>{for(const{range:S}of w)if(l.Range.areIntersectingOrTouching(S,C))return[new l.Selection(S.startLineNumber,S.startColumn,S.endLineNumber,S.endColumn)];return null})}return c.playSignal(xn.format,{userGesture:s}),!0}async function YW(o,e,t,i,n,s){const r=o.get(me),a=o.get(ze),c=Ys(e)?e.getModel():e,h=nP(a.documentFormattingEditProvider,a.documentRangeFormattingEditProvider,c),d=await gf.select(h,c,t,1);d&&(i.report(d),await r.invokeFunction(ZW,d,e,t,n,s))}async function ZW(o,e,t,i,n,s){const r=o.get(tr),a=o.get(Xa);let c,h;Ys(t)?(c=t.getModel(),h=new aD(t,5,void 0,n)):(c=t,h=new lD(t,n));let d;try{const u=await e.provideDocumentFormattingEdits(c,c.getFormattingOptions(),h.token);if(d=await r.computeMoreMinimalEdits(c.uri,u),h.token.isCancellationRequested)return!0}finally{h.dispose()}if(!d||d.length===0)return!1;if(Ys(t))Dh.execute(t,d,i!==2),i!==2&&t.revealPositionInCenterIfOutsideViewport(t.getPosition(),1);else{const[{range:u}]=d,f=new l.Selection(u.startLineNumber,u.startColumn,u.endLineNumber,u.endColumn);c.pushEditOperations([f],d.map(g=>({text:g.text,range:l.Range.lift(g.range),forceMoveMarkers:!0})),g=>{for(const{range:m}of g)if(l.Range.areIntersectingOrTouching(m,f))return[new l.Selection(m.startLineNumber,m.startColumn,m.endLineNumber,m.endColumn)];return null})}return a.playSignal(xn.format,{userGesture:s}),!0}async function QW(o,e,t,i,n,s){const r=e.documentRangeFormattingEditProvider.ordered(t);for(const a of r){const c=await Promise.resolve(a.provideDocumentRangeFormattingEdits(t,i,n,s)).catch(l.onUnexpectedExternalError);if(l.isNonEmptyArray(c))return await o.computeMoreMinimalEdits(t.uri,c)}}async function XW(o,e,t,i,n){const s=nP(e.documentFormattingEditProvider,e.documentRangeFormattingEditProvider,t);for(const r of s){const a=await Promise.resolve(r.provideDocumentFormattingEdits(t,i,n)).catch(l.onUnexpectedExternalError);if(l.isNonEmptyArray(a))return await o.computeMoreMinimalEdits(t.uri,a)}}function sP(o,e,t,i,n,s,r){const a=e.onTypeFormattingEditProvider.ordered(t);return a.length===0||a[0].autoFormatTriggerCharacters.indexOf(n)<0?Promise.resolve(void 0):Promise.resolve(a[0].provideOnTypeFormattingEdits(t,i,n,s,r)).catch(l.onUnexpectedExternalError).then(c=>o.computeMoreMinimalEdits(t.uri,c))}function JW(o){const e=o;return!!e&&typeof e=="object"&&typeof e.tabSize=="number"&&typeof e.insertSpaces=="boolean"}Ut.registerCommand("_executeFormatRangeProvider",async function(o,...e){const[t,i,n]=e;l.assertType(l.URI.isUri(t)),l.assertType(l.Range.isIRange(i));const s=o.get(ql),r=o.get(tr),a=o.get(ze),c=await s.createModelReference(t);try{return QW(r,a,c.object.textEditorModel,l.Range.lift(i),cD(n,c),l.CancellationToken.None)}finally{c.dispose()}}),Ut.registerCommand("_executeFormatDocumentProvider",async function(o,...e){const[t,i]=e;l.assertType(l.URI.isUri(t));const n=o.get(ql),s=o.get(tr),r=o.get(ze),a=await n.createModelReference(t);try{return XW(s,r,a.object.textEditorModel,cD(i,a),l.CancellationToken.None)}finally{a.dispose()}}),Ut.registerCommand("_executeFormatOnTypeProvider",async function(o,...e){const[t,i,n,s]=e;l.assertType(l.URI.isUri(t)),l.assertType(l.Position.isIPosition(i)),l.assertType(typeof n=="string");const r=o.get(ql),a=o.get(tr),c=o.get(ze),h=await r.createModelReference(t);try{return sP(a,c,h.object.textEditorModel,l.Position.lift(i),n,cD(s,h),l.CancellationToken.None)}finally{h.dispose()}});function cD(o,e){let t;if(JW(o))t=o;else{const i=e.object.textEditorModel.getOptions();t={tabSize:i.tabSize,insertSpaces:i.insertSpaces}}return t}Fi.wrappingIndent.defaultValue=0,Fi.glyphMargin.defaultValue=!1,Fi.autoIndent.defaultValue=3,Fi.overviewRulerLanes.defaultValue=2,gf.setFormatterSelector((o,e,t)=>Promise.resolve(o[0]));const Di=l.createMonacoBaseAPI();Di.editor=WJ(),Di.languages=$W();const WW=Di.CancellationTokenSource,HW=Di.Emitter,eH=Di.KeyCode,tH=Di.KeyMod,iH=Di.Position,nH=Di.Range,sH=Di.Selection,oH=Di.SelectionDirection,rH=Di.MarkerSeverity,aH=Di.MarkerTag,lH=Di.Uri,cH=Di.Token,hH=Di.editor,dH=Di.languages,uH=Bf(),xh=globalThis;(uH?.globalAPI||typeof xh.define=="function"&&xh.define.amd)&&(xh.monaco=Di),typeof xh.require<"u"&&typeof xh.require.config=="function"&&xh.require.config({ignoreDuplicateModules:["vscode-languageserver-types","vscode-languageserver-types/main","vscode-languageserver-textdocument","vscode-languageserver-textdocument/main","vscode-nls","vscode-nls/vscode-nls","jsonc-parser","jsonc-parser/main","vscode-uri","vscode-uri/index","vs/basic-languages/typescript/typescript"]}),_.$=Q,_.AccessibilitySignal=xn,_.Action=oo,_.Action2=hg,_.ActionBar=el,_.ActionViewItem=Fp,_.Button=v_,_.CONTEXT_ACCESSIBILITY_MODE_ENABLED=yE,_.CancelSnoozeInlineCompletion=ay,_.CancellationTokenSource=WW,_.CaseSensitiveToggle=zM,_.ClickAction=rN,_.CommandsRegistry=Ut,_.ContextKeyEqualsExpr=Yl,_.ContextKeyExpr=de,_.CopyOptions=em,_.CountBadge=YL,_.CursorColumns=Xe,_.CursorMoveCommands=Dt,_.CursorState=ge,_.DataTransfers=pc,_.DebugNameData=Vt,_.DenseKeyProvider=XT,_.DerivedWithSetter=YD,_.Dimension=cs,_.DisposableCancellationTokenSource=mX,_.DomEmitter=Te,_.DomScrollableElement=Jg,_.DynamicCssRules=mv,_.EDITOR_FONT_DEFAULTS=Zi,_.EditDeltaInfo=tu,_.EditOperation=p_,_.EditSources=$i,_.EditorAction=mg,_.EditorAction2=LB,_.EditorCommand=ao,_.EditorFontLigatures=io,_.EditorMouseEvent=uo,_.EditorOptions=Fi,_.EditorState=U_,_.EditorStateCancellationTokenSource=aD,_.EditorZoom=eo,_.Emitter=HW,_.EnterOperation=Ov,_.EventHelper=ve,_.EventType=F,_.Extensions=Xo,_.Extensions$1=UL,_.FindInput=GM,_.FormattingEdit=Dh,_.FuzzyScoreOptions=np,_.Gesture=li,_.GlobalPointerMoveMonitor=xd,_.GlyphRasterizer=Zd,_.HC_BLACK_THEME_NAME=gl,_.HC_LIGHT_THEME_NAME=ml,_.HighlightedLabel=Ir,_.HistoryInputBox=KM,_.HoverAction=Qm,_.HoverWidget=sN,_.IAccessibilityService=Ui,_.IAccessibilitySignalService=Xa,_.IBulkEditService=xA,_.IClipboardService=Ip,_.ICodeEditorService=pt,_.ICommandService=zi,_.IConfigurationService=Ge,_.IContextKeyService=be,_.IContextMenuService=nn,_.IContextViewService=Fc,_.IDataChannelService=xM,_.IDefaultAccountService=EM,_.IDialogService=ey,_.IEditorProgressService=d_,_.IEditorWorkerService=tr,_.IEnvironmentService=ly,_.IHoverService=kc,_.IInlineCompletionsService=Cp,_.IInstantiationService=me,_.IKeybindingService=xt,_.ILabelService=AM,_.ILanguageConfigurationService=ms,_.ILanguageFeatureDebounceService=MR,_.ILanguageFeaturesService=ze,_.ILanguageService=yt,_.ILayoutService=Os,_.IListService=ts,_.ILogService=ei,_.ILoggerService=kx,_.IMarkdownRendererService=Pu,_.IMarkerDecorationsService=$C,_.IMarkerService=xr,_.IMenuService=Zo,_.IModelService=ri,_.INotificationService=yn,_.IOpenerService=Ou,_.IProgressService=CA,_.IQuickInputService=Ps,_.IRenameSymbolTrackerService=EA,_.ISemanticTokensStylingService=qR,_.IStandaloneThemeService=Tn,_.IStorageService=Qa,_.ITelemetryService=Xn,_.ITextModelService=ql,_.ITextResourceConfigurationService=TC,_.IThemeService=_i,_.IUserInteractionService=Na,_.IWorkspaceContextService=wA,_.IWorkspaceTrustManagementService=DA,_.IconLabel=w_,_.IdGenerator=ES,_.InMemoryClipboardMetadataManager=_c,_.InlineDecoration=Ac,_.InputFocusedContext=Mp,_.IsWebContext=_9,_.IsWindowsContext=p9,_.KeyCode=eH,_.KeyDownAction=aN,_.KeyMod=tH,_.KeybindingLabel=y_,_.KeybindingsRegistry=Zn,_.LanguageAgnosticBracketTokens=WT,_.LineDecoration=Ji,_.LineSource=xO,_.LineTokens=_t,_.List=zn,_.LocalSelectionTransfer=Lv,_.MarkdownString=DS,_.MarkerSeverity=rH,_.MarkerTag=aH,_.MenuId=ct,_.MenuRegistry=Qn,_.Mimes=mn,_.ModelDecorationInjectedTextOptions=Mc,_.ModelDecorationOptions=Ct,_.ModifierKeyEmitter=hs,_.MoveOperations=ye,_.MultiCommand=gg,_.MultiEditorAction=yB,_.NativeEditContextRegistry=NT,_.NullState=Hl,_.PLAINTEXT_LANGUAGE_ID=pn,_.PixelRatio=ld,_.Point=Un,_.Position=iH,_.ProcessedIndentRulesSupport=Tv,_.Progress=xL,_.Range=nH,_.RawContextKey=q,_.RegexToggle=UM,_.Registry=St,_.RenderLineInput=Wo,_.RenderOptions=yh,_.ReplaceCommand=Ri,_.ReplaceCommandThatPreservesSelection=xI,_.ReplaceCommandThatSelectsText=oU,_.ResourceTextEdit=Er,_.Sash=on,_.ScrollableElement=uI,_.Selection=sH,_.SelectionDirection=oH,_.Separator=ft,_.Severity=Hv,_.Severity$1=rt,_.SnoozeInlineCompletion=ry,_.SplitView=kM,_.StableEditorScrollState=vh,_.StandardKeyboardEvent=Be,_.StandardMouseEvent=Bi,_.StringBuilder=ra,_.SubmenuAction=cd,_.SubmenuItemAction=sa,_.TabFocus=Dd,_.TernarySearchTree=Xc,_.TextBufferTokenizer=JT,_.TextModelCancellationTokenSource=lD,_.TextModelText=G0,_.TextOnlyMenuEntryActionViewItem=Vy,_.Toggle=tl,_.Token=cH,_.TokenArray=ec,_.TokenMetadata=Vi,_.TriggerInlineEditCommandsRegistry=ug,_.TypeOperations=cr,_.Uri=lH,_.UriList=yv,_.VSDataTransfer=pI,_.VS_DARK_THEME_NAME=bh,_.VS_LIGHT_THEME_NAME=Ao,_.WORKSPACE_EXTENSION=yA,_.WholeWordsToggle=VM,_.Widget=Wn,_.WindowIdleValue=CF,_.WordOperations=Ne,_.WordPartOperations=aU,_.WorkbenchListFocusContextKey=nZ,_.WorkbenchTreeElementCanCollapse=rA,_.WorkbenchTreeElementCanExpand=aA,_.activeContrastBorder=ot,_.addDisposableGenericMouseDownListener=nC,_.addDisposableListener=R,_.addStandardDisposableGenericMouseDownListener=_F,_.addStandardDisposableListener=At,_.alert=ha,_.anyScore=W8,_.append=K,_.appendRemoveOnDispose=wh,_.applyFontInfo=Ot,_.arrayEqualsC=Zh,_.asCssVariable=z,_.asyncTransaction=kk,_.autorun=he,_.autorunDelta=Gk,_.autorunWithStore=Kn,_.basename=dg,_.basenameOrAuthority=uB,_.bindContextKey=qs,_.buttonBackground=lc,_.buttonForeground=hv,_.canLog=Bx,_.clamp=wi,_.clearNode=On,_.computeIndentLevel=eT,_.constObservable=Zr,_.contrastBorder=pe,_.countEOL=fr,_.createActionViewItem=Gy,_.createCSSRule=Pg,_.createCommandUri=mG,_.createDecorator=le,_.createHotClass=hX,_.createMatches=wN,_.createStringDataTransferItem=Sv,_.createStyleSheetFromObservable=dV,_.createTrustedTypesPolicy=lo,_.darken=da,_.debouncedObservable=Zk,_.debouncedObservable2=Qk,_.defaultCountBadgeStyles=pM,_.defaultGenerator=IS,_.defaultInputBoxStyles=zy,_.defaultKeybindingLabelStyles=mM,_.defaultListStyles=Hc,_.defaultToggleStyles=Fy,_.derived=Z,_.derivedDisposable=Gn,_.derivedHandleChanges=qk,_.derivedObservableWithCache=JD,_.derivedOpts=fn,_.descriptionForeground=_V,_.diffInserted=BE,_.diffInsertedLine=PV,_.diffRemoved=zE,_.dirname=Rx,_.disposableObservableValue=Wb,_.editor=hH,_.editorActionListForeground=p2,_.editorActiveLinkForeground=LV,_.editorBackground=vn,_.editorBracketMatchForeground=o$,_.editorConfigurationBaseNode=IA,_.editorErrorBorder=wV,_.editorErrorForeground=Ug,_.editorFindMatchForeground=xV,_.editorFindMatchHighlight=Cs,_.editorFindMatchHighlightBorder=ua,_.editorFindMatchHighlightForeground=EV,_.editorFindRangeHighlightBorder=IV,_.editorForeground=nc,_.editorHoverBackground=ZC,_.editorHoverBorder=FE,_.editorHoverForeground=TV,_.editorInfoBorder=Id,_.editorInfoForeground=nr,_.editorInlayHintBackground=XC,_.editorInlayHintForeground=QC,_.editorInlayHintParameterBackground=AV,_.editorInlayHintParameterForeground=MV,_.editorInlayHintTypeBackground=RV,_.editorInlayHintTypeForeground=NV,_.editorSelectionBackground=sr,_.editorSelectionHighlight=$g,_.editorWarningBorder=Ed,_.editorWarningForeground=ho,_.editorWidgetBackground=wn,_.editorWidgetBorder=Vg,_.ensureNonNullable=Ia,_.equalsIfDefined=$D,_.equalsIfDefinedC=Gr,_.extUri=Qe,_.extname=fB,_.foreground=De,_.formatDocumentRangesWithSelectedProvider=jW,_.formatDocumentWithSelectedProvider=YW,_.fuzzyScore=Bc,_.fuzzyScoreGracefulAggressive=iG,_.generateDataToCopyAndStoreInMemory=G3,_.generateUuid=Wg,_.getActionBarActions=CM,_.getActiveDocument=od,_.getActiveElement=wt,_.getActiveWindow=Le,_.getAnchorRect=JS,_.getBaseLayerHoverDelegate=En,_.getClientArea=Gf,_.getCodeEditor=aJ,_.getColumnOfNodeOffset=dc,_.getComputedStyle=Kf,_.getDefaultHoverDelegate=Io,_.getDomNodePagePosition=Qi,_.getEnterAction=am,_.getFlatActionBarActions=Mq,_.getGoodIndentForLine=fU,_.getHoverAccessibleViewHint=oN,_.getIndentMetadata=pU,_.getListStyles=eh,_.getOnTypeFormattingEdits=sP,_.getShadowRoot=qo,_.getStandardTokenTypeAtPosition=Cz,_.getTopLeftOffset=rx,_.getTotalHeight=qf,_.getTotalWidth=jf,_.getWindow=j,_.ghostTextForeground=c$,_.groupByMap=S5,_.h=_e,_.hasDriveLetter=hB,_.hide=Wf,_.iconForeground=Fg,_.inUntrustedWorkspace=Mn,_.indentOfLine=k1,_.inputActiveOptionBackground=rv,_.inputActiveOptionBorder=ov,_.inputActiveOptionForeground=av,_.inputBackground=JE,_.inputBorder=HE,_.inputForeground=WE,_.isActiveElement=sd,_.isAncestor=ut,_.isCodeEditor=Ys,_.isCompletionsEnabledFromObject=hE,_.isDark=rr,_.isDiffEditor=$O,_.isEmptyMarkdownString=DN,_.isEmptyWorkspaceIdentifier=pZ,_.isEqual=Nx,_.isFirefox=di,_.isHTMLElement=Ve,_.isHighContrast=pa,_.isIMenuItem=Zl,_.isKeyModified=y7,_.isLocalizedString=gq,_.isMarkdownString=Do,_.isModelDecorationInComment=aT,_.isModelDecorationInString=lT,_.isModelDecorationVisible=rT,_.isMouseEvent=Qf,_.isSingleFolderWorkspaceIdentifier=SA,_.isStandaloneEditorWorkspace=wZ,_.joinPath=Mx,_.languages=dH,_.lengthAdd=gt,_.lengthGetColumnCountIfZeroLineCount=T5,_.lengthZero=bi,_.listFocusHighlightForeground=QE,_.listHighlightForeground=Nd,_.mainWindow=Ae,_.mapObservableArrayCached=Jk,_.matchesBaseContiguousSubString=$8,_.matchesMimeType=B3,_.matchesSubString=cN,_.matchesWords=Y8,_.minimapFindMatch=qE,_.minimapSelectionOccurrenceHighlight=qV,_.nativeHoverDelegate=A8,_.normalizeIndentation=xv,_.nullTokenize=OC,_.nullTokenizeEncoded=Lg,_.observableCodeEditor=Mr,_.observableConfigValue=dX,_.observableFromEvent=mt,_.observableFromEventOpts=An,_.observableFromPromise=Yk,_.observableSignal=qr,_.observableSignalFromEvent=Ii,_.observableValue=W,_.offsetEditFromContentChanges=x1,_.oneOf=YC,_.openLinkFromMarkdown=mR,_.or=uS,_.originalFSPath=ds,_.overviewRulerFindMatchForeground=UV,_.overviewRulerRangeHighlight=d$,_.overviewRulerSelectionHighlightForeground=$V,_.parseDocument=xw,_.prefixedUuid=mI,_.product=pd,_.quickInputListFocusBackground=Ad,_.quickInputListFocusForeground=Md,_.quickInputListFocusIconForeground=gv,_.rangeIsSingleLine=F0,_.recomputeInitiallyAndOnChange=ed,_.recordChangesLazy=Hk,_.registerAction2=lB,_.registerColor=E,_.registerEditorAction=xB,_.registerEditorCommand=oe,_.registerEditorContribution=_C,_.registerEditorFeature=xZ,_.registerIcon=Mo,_.registerInstantiatedEditorAction=IB,_.registerModelAndPositionCommand=DB,_.registerMultiEditorAction=EB,_.registerSingleton=fe,_.registerThemingParticipant=vs,_.relativePath=mB,_.removeCSSRulesContainingSelector=xE,_.renderIcon=Gc,_.renderLabelWithIcons=vr,_.renderLines=DO,_.renderMarkdown=dp,_.renderViewLine=bd,_.reset=oi,_.runOnChange=Qr,_.runOnChangeWithCancellationToken=iF,_.runOnChangeWithStore=HD,_.runWhenWindowIdle=nd,_.score=uy,_.scrollbarShadow=zg,_.setVisibility=NF,_.show=Jf,_.size=vF,_.status=yd,_.strictEquals=Ei,_.stripIcons=sp,_.structuralEquals=Qh,_.subtransaction=Uf,_.themeColorFromId=La,_.thisEqualsC=Qb,_.toAction=Yo,_.toExternalVSDataTransfer=vI,_.toMultilineTokens2=W7,_.toWorkspaceIdentifier=bZ,_.trackFocus=Xr,_.transaction=nt,_.transparent=ce,_.unicodeHighlightConfigKeys=jo,_.unthemedKeybindingLabelOptions=uQ,_.waitForState=QD,_.widgetBorder=HC,_.widgetClose=YQ,_.widgetShadow=oc,_.withSelection=r7}));
|