diff --git a/docs/404.html b/docs/404.html new file mode 100644 index 0000000..8dec187 --- /dev/null +++ b/docs/404.html @@ -0,0 +1,98 @@ +404 Page

404 Page

You might be lost, wanna go back home?

\ No newline at end of file diff --git a/docs/_headers b/docs/_headers new file mode 100644 index 0000000..b11f159 --- /dev/null +++ b/docs/_headers @@ -0,0 +1,54 @@ +/* + X-Frame-Options: SAMEORIGIN + X-Content-Type-Options: nosniff + X-XSS-Protection: 1; mode=block + Referrer-Policy: strict-origin-when-cross-origin + Strict-Transport-Security: max-age=63072000; includeSubDomains; preload + Cache-Control: max-age=60, stale-while-revalidate=120, public + Accept-CH: DPR, Viewport-Width, Width + X-UA-Compatible: IE=edge + Content-Security-Policy: default-src 'self'; font-src 'self' https://fonts.gstatic.com; style-src 'self' 'unsafe-inline'; img-src 'self' https://res.cloudinary.com https://api.producthunt.com data:; script-src 'self' https://cdn.polyfill.io 'unsafe-eval'; connect-src 'self' https:; block-all-mixed-content; upgrade-insecure-requests; base-uri 'self'; object-src 'none'; worker-src 'self'; manifest-src 'self'; media-src 'self' https://res.cloudinary.com/; form-action 'self'; frame-ancestors 'self' https:; + Permissions-Policy: geolocation=(), microphone=(), usb=(), sync-xhr=(self), camera=(), interest-cohort=() + Link: ; rel=preload; as=style + Link: ; rel=preload; as=font; type=font/woff2; crossorigin=anonymous + Link: ; rel=preload; as=font; type=font/woff2; crossorigin=anonymous + Link: ; rel=modulepreload + Link: ; rel=modulepreload + Link: ; rel=preconnect; crossorigin + +/ + Link: ; rel=preload; as=font; type=font/ttf; crossorigin + Link: ; rel=preload; as=style + Link: ; rel=preconnect; crossorigin + Link: ; rel=prefetch + Link: ; rel=modulepreload + +/**/*.css + Cache-Control: public, max-age=604800, stale-while-revalidate=31536000 + Content-Type: text/css + +/js/*.ttf + Cache-Control: public, max-age=31536000, immutable + Content-Type: font/ttf + +/js/*.css + Cache-Control: public, max-age=31536000, immutable + Content-Type: text/css + +/js/*.js + Cache-Control: public, max-age=604800, stale-while-revalidate=31536000 + Content-Type: text/javascript + +/js/theme.min.js + Cache-Control: public, max-age=31536000, immutable + +/manifest.json + Cache-Control: public, max-age=604800, stale-while-revalidate=31536000 + Content-Type: application/manifest+json + +/favicon/* + Cache-Control: public, max-age=31536000, immutable + +/favicon/*.svg + Cache-Control: public, max-age=31536000, immutable + Content-Type: image/svg+xml diff --git a/docs/about.html b/docs/about.html new file mode 100644 index 0000000..04f22e0 --- /dev/null +++ b/docs/about.html @@ -0,0 +1,98 @@ +bundle - a quick npm package size checker

about

A link to bundle.js.org's Product Hunt page; a small public display of what bundle.js.org is all about

bundle is a quick and easy way to bundle your projects and see the minified and gzip size, it's similar to bundlephobia but does all the work locally on you computer and can treeshake multiple packages (both commonjs and esm) into a bundle, it also supports Typescript.

I used monaco-editor for the code-editor, esbuild and rollup as bundler and treeshaker respectively, pako as a js port of the zlib and gzip libraries, pretty-bytes to convert the gzip size to human readable values, and countapi-js to keep track of the number of page visits, in a private and secure way.

This project was greatly influenced by @hardfists neo-tools and @mizchi's uniroll project.

The project isn't perfect, I am still working on an autocomplete, hover intellisence, better mobile support and the high memory usage of esbuild and monaco as well as some edge case packages, e.g. monaco-editor.

If there is something I missed, a mistake, or a feature you would like added please create an issue or a pull request and I'll try to get to it. You can contribute to this project at okikio/bundle.

bundle uses Conventional Commits as the style of commit, and the Commitizen CLI to make commits easier.

You can join the discussion on github discussions.


\ No newline at end of file diff --git a/docs/bundle.svg b/docs/bundle.svg new file mode 100644 index 0000000..f20c115 --- /dev/null +++ b/docs/bundle.svg @@ -0,0 +1,4 @@ + + + + diff --git a/docs/css/app.min.css b/docs/css/app.min.css new file mode 100644 index 0000000..5c13994 --- /dev/null +++ b/docs/css/app.min.css @@ -0,0 +1,25 @@ +/*! tailwindcss v2.2.15 | MIT License | https://tailwindcss.com */ +/*! modern-normalize v1.1.0 | MIT License | https://github.com/sindresorhus/modern-normalize */ +@-webkit-keyframes spin{to{transform:rotate(360deg)}} +@keyframes spin{to{transform:rotate(360deg)}}@-webkit-keyframes fade-in{50%{opacity:1}to{opacity:0}}@keyframes fade-in{50%{opacity:1}to{opacity:0}}@-webkit-keyframes fade-out{50%{opacity:0}to{opacity:1}}@keyframes fade-out{50%{opacity:0}to{opacity:1}}html{-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:100%;font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,"Noto Sans",sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";line-height:1.5}body{margin:0;font-family:system-ui,-apple-system,'Segoe UI',Roboto,Helvetica,Arial,sans-serif,'Apple Color Emoji','Segoe UI Emoji';font-family:inherit;line-height:inherit}hr{height:0;color:inherit}abbr[title]{-webkit-text-decoration:underline dotted;text-decoration:underline dotted}b,strong{font-weight:bolder}kbd,pre,samp{font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-size:100%;margin:0}button,select{text-transform:none}[type=button],[type=reset],[type=submit],button{-webkit-appearance:button}::-moz-focus-inner{border-style:none;padding:0}:-moz-ui-invalid{box-shadow:none}legend{padding:0}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dd,dl,figure,h1,h2,h3,h4,h5,h6,hr,p,pre{margin:0}button{background-color:transparent;background-image:none}fieldset,ol,ul{margin:0;padding:0}ol,ul{list-style:none}*,::after,::before{box-sizing:border-box;border-width:0;border-style:solid;border-color:currentColor;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-transform:translateX(var(--tw-translate-x)) translateY(var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));--tw-border-opacity:1;border-color:rgba(229,231,235,var(--tw-border-opacity));--tw-ring-inset:var(--tw-empty,/*!*/ /*!*/);--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(59, 130, 246, 0.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-backdrop-blur:var(--tw-empty,/*!*/ /*!*/);--tw-backdrop-brightness:var(--tw-empty,/*!*/ /*!*/);--tw-backdrop-contrast:var(--tw-empty,/*!*/ /*!*/);--tw-backdrop-grayscale:var(--tw-empty,/*!*/ /*!*/);--tw-backdrop-hue-rotate:var(--tw-empty,/*!*/ /*!*/);--tw-backdrop-invert:var(--tw-empty,/*!*/ /*!*/);--tw-backdrop-opacity:var(--tw-empty,/*!*/ /*!*/);--tw-backdrop-saturate:var(--tw-empty,/*!*/ /*!*/);--tw-backdrop-sepia:var(--tw-empty,/*!*/ /*!*/);--tw-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}hr{border-top-width:1px}img{border-style:solid}textarea{resize:vertical}input::-moz-placeholder, textarea::-moz-placeholder{opacity:1;color:#9ca3af}input:-ms-input-placeholder, textarea:-ms-input-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}[role=button],button{cursor:pointer}:-moz-focusring{outline:auto}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}button,input,optgroup,select,textarea{padding:0;line-height:inherit;color:inherit}kbd,pre,samp{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace}audio,canvas,embed,iframe,img,object,svg,video{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]{display:none}.container{width:100%;margin-right:auto;margin-left:auto}@media (min-width:640px){.container{max-width:640px}}@media (min-width:768px){.container{max-width:768px}}@media (min-width:1024px){.container{max-width:1024px}}@media (min-width:1280px){.container{max-width:1280px}}@media (min-width:1536px){.container{max-width:1536px}}.relative{position:relative}.my-5{margin-top:1.25rem;margin-bottom:1.25rem}.my-6{margin-top:1.5rem;margin-bottom:1.5rem}.mb-2{margin-bottom:.5rem}.block{display:block}.inline-block{display:inline-block}.flex{display:flex}.max-w-screen-lg{max-width:1024px}.flex-1{flex:1 1 0%}.place-content-center{place-content:center}.space-x-2>:not([hidden])~:not([hidden]){--tw-space-x-reverse:0;margin-right:calc(.5rem*var(--tw-space-x-reverse));margin-left:calc(.5rem*calc(1 - var(--tw-space-x-reverse)))}.rounded-md{border-radius:.375rem}.bg-gray-200{--tw-bg-opacity:1;background-color:rgba(229,231,235,var(--tw-bg-opacity))}.px-5{padding-left:1.25rem;padding-right:1.25rem}.py-2{padding-top:.5rem;padding-bottom:.5rem}.px-12{padding-left:3rem;padding-right:3rem}.py-24{padding-top:6rem;padding-bottom:6rem}.px-4{padding-left:1rem;padding-right:1rem}.text-center{text-align:center}.text-5xl{font-size:3rem;line-height:1}.text-lg{font-size:1.125rem;line-height:1.75rem}.font-light{font-weight:300}@font-face{font-family:"Manrope";font-style:normal;font-weight:500;font-display:swap;src:url(https://fonts.gstatic.com/s/manrope/v4/xn7gYHE41ni1AdIRggOxSuXd.woff2) format("woff2");unicode-range:U+0400-045F,U+0490-0491,U+04B0-04B1,U+2116}@font-face{font-family:"Manrope";font-style:normal;font-weight:500;font-display:swap;src:url(https://fonts.gstatic.com/s/manrope/v4/xn7gYHE41ni1AdIRggSxSuXd.woff2) format("woff2");unicode-range:U+0370-03FF}@font-face{font-family:"Manrope";font-style:normal;font-weight:500;font-display:swap;src:url(https://fonts.gstatic.com/s/manrope/v4/xn7gYHE41ni1AdIRggmxSuXd.woff2) format("woff2");unicode-range:U+0100-024F,U+0259,U+1E00-1EFF,U+2020,U+20A0-20AB,U+20AD-20CF,U+2113,U+2C60-2C7F,U+A720-A7FF}@font-face{font-family:"Manrope";font-style:normal;font-weight:500;font-display:swap;src:url(https://fonts.gstatic.com/s/manrope/v4/xn7gYHE41ni1AdIRggexSg.woff2) format("woff2");unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+2000-206F,U+2074,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD}@font-face{font-family:"Manrope";font-style:normal;font-weight:600;font-display:swap;src:url(https://fonts.gstatic.com/s/manrope/v4/xn7gYHE41ni1AdIRggOxSuXd.woff2) format("woff2");unicode-range:U+0400-045F,U+0490-0491,U+04B0-04B1,U+2116}@font-face{font-family:"Manrope";font-style:normal;font-weight:600;font-display:swap;src:url(https://fonts.gstatic.com/s/manrope/v4/xn7gYHE41ni1AdIRggSxSuXd.woff2) format("woff2");unicode-range:U+0370-03FF}@font-face{font-family:"Manrope";font-style:normal;font-weight:600;font-display:swap;src:url(https://fonts.gstatic.com/s/manrope/v4/xn7gYHE41ni1AdIRggmxSuXd.woff2) format("woff2");unicode-range:U+0100-024F,U+0259,U+1E00-1EFF,U+2020,U+20A0-20AB,U+20AD-20CF,U+2113,U+2C60-2C7F,U+A720-A7FF}@font-face{font-family:"Manrope";font-style:normal;font-weight:600;font-display:swap;src:url(https://fonts.gstatic.com/s/manrope/v4/xn7gYHE41ni1AdIRggexSg.woff2) format("woff2");unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+2000-206F,U+2074,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD}@font-face{font-family:"Manrope";font-style:normal;font-weight:700;font-display:swap;src:url(https://fonts.gstatic.com/s/manrope/v4/xn7gYHE41ni1AdIRggOxSuXd.woff2) format("woff2");unicode-range:U+0400-045F,U+0490-0491,U+04B0-04B1,U+2116}@font-face{font-family:"Manrope";font-style:normal;font-weight:700;font-display:swap;src:url(https://fonts.gstatic.com/s/manrope/v4/xn7gYHE41ni1AdIRggSxSuXd.woff2) format("woff2");unicode-range:U+0370-03FF}@font-face{font-family:"Manrope";font-style:normal;font-weight:700;font-display:swap;src:url(https://fonts.gstatic.com/s/manrope/v4/xn7gYHE41ni1AdIRggmxSuXd.woff2) format("woff2");unicode-range:U+0100-024F,U+0259,U+1E00-1EFF,U+2020,U+20A0-20AB,U+20AD-20CF,U+2113,U+2C60-2C7F,U+A720-A7FF}@font-face{font-family:"Manrope";font-style:normal;font-weight:700;font-display:swap;src:url(https://fonts.gstatic.com/s/manrope/v4/xn7gYHE41ni1AdIRggexSg.woff2) format("woff2");unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+2000-206F,U+2074,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD}@font-face{font-family:"Manrope";font-style:normal;font-weight:800;font-display:swap;src:url(https://fonts.gstatic.com/s/manrope/v4/xn7gYHE41ni1AdIRggOxSuXd.woff2) format("woff2");unicode-range:U+0400-045F,U+0490-0491,U+04B0-04B1,U+2116}@font-face{font-family:"Manrope";font-style:normal;font-weight:800;font-display:swap;src:url(https://fonts.gstatic.com/s/manrope/v4/xn7gYHE41ni1AdIRggSxSuXd.woff2) format("woff2");unicode-range:U+0370-03FF}@font-face{font-family:"Manrope";font-style:normal;font-weight:800;font-display:swap;src:url(https://fonts.gstatic.com/s/manrope/v4/xn7gYHE41ni1AdIRggmxSuXd.woff2) format("woff2");unicode-range:U+0100-024F,U+0259,U+1E00-1EFF,U+2020,U+20A0-20AB,U+20AD-20CF,U+2113,U+2C60-2C7F,U+A720-A7FF}@font-face{font-family:"Manrope";font-style:normal;font-weight:800;font-display:swap;src:url(https://fonts.gstatic.com/s/manrope/v4/xn7gYHE41ni1AdIRggexSg.woff2) format("woff2");unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+2000-206F,U+2074,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD}@font-face{font-family:"Material Icons";font-style:normal;font-weight:400;font-display:block;src:url(https://fonts.gstatic.com/s/materialicons/v90/flUhRq6tzZclQEJ-Vdg-IuiaDsNc.woff2) format("woff2")}@font-face{font-family:"Material Icons Round";font-style:normal;font-weight:400;font-display:block;src:url(https://fonts.gstatic.com/s/materialiconsround/v62/LDItaoyNOAY6Uewc665JcIzCKsKc_M9flwmP.woff2) format("woff2")}.material-icons,.material-icons-round{font-family:"Material Icons";font-weight:400;font-style:normal;font-size:24px;line-height:1;letter-spacing:normal;text-transform:none;display:inline-block;white-space:nowrap;word-wrap:normal;direction:ltr;-webkit-font-smoothing:antialiased}.material-icons-round{font-family:"Material Icons Round"}.navbar{position:fixed;top:0;left:0;z-index:50;width:100%}@supports ((-webkit-backdrop-filter: blur(5px)) or (backdrop-filter: blur(5px))){.dark .navbar,.navbar{backdrop-filter:var(--tw-backdrop-filter)}.navbar{--tw-backdrop-blur:blur(8px)}.dark .navbar{-webkit-backdrop-filter:var(--tw-backdrop-filter);--tw-backdrop-blur:blur(16px)}}.navbar .container{position:relative;height:100%;padding-left:1.25rem;padding-right:1.25rem}@media (min-width:640px){.navbar .container{max-width:1280px}}.navbar .navbar-bg{position:absolute;top:0;left:0;height:100%;width:100%;padding-left:1.25rem;padding-right:1.25rem;--tw-bg-opacity:1;background-color:rgba(255,255,255,var(--tw-bg-opacity))}.dark .navbar .navbar-bg{--tw-bg-opacity:1;background-color:rgba(0,0,0,var(--tw-bg-opacity))}.dark .navbar.shadow .navbar-bg{--tw-bg-opacity:1;background-color:rgba(28,28,30,var(--tw-bg-opacity))}@supports ((-webkit-backdrop-filter: blur(5px)) or (backdrop-filter: blur(5px))){.dark .navbar .navbar-bg,.dark .navbar.shadow .navbar-bg{--tw-bg-opacity:0.6}}.navbar .navbar-frame{position:relative;display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;width:100%;padding-top:.5rem;padding-bottom:.5rem}.navbar .navbar-border,.navbar .navbar-shadow{position:absolute;top:0;left:0;height:100%;width:100%}.navbar .navbar-shadow{transition:opacity ease .25s;box-shadow:0 4px 15px rgba(0,0,50,.08);opacity:0}.navbar.shadow .navbar-shadow{opacity:1}.navbar .navbar-border{border-bottom-width:1px;--tw-border-opacity:1;border-color:rgba(229,231,235,var(--tw-border-opacity))}.dark .navbar .navbar-border{--tw-border-opacity:1;border-color:rgba(28,28,30,var(--tw-border-opacity))}.navbar.shadow .navbar-border{--tw-border-opacity:1;border-color:rgba(209,213,219,var(--tw-border-opacity))}.dark .navbar.shadow .navbar-border{--tw-border-opacity:1;border-color:rgba(85,85,85,var(--tw-border-opacity))}.navbar-offset{margin-top:4rem}.navbar-collapse{align-items:center}@media (max-width:768px){.navbar-collapse{--height:100vh;transition:height ease-out .35s;flex-grow:1;flex-basis:100%;overflow-y:hidden}.navbar-collapse.show{height:100%;height:var(--height, 100vh)}.navbar-collapse.collapse{height:0}}.navbar-list{display:flex;flex-wrap:nowrap;padding-left:.25rem;padding-right:.25rem}@media (max-width:640px){.navbar-list{flex-direction:column}}.dark .navbar-logo:hover{--tw-text-opacity:1;color:rgba(59,130,246,var(--tw-text-opacity))}.navbar-logo{margin-left:.25rem;font-size:1.25rem;line-height:1.75rem;font-weight:700;border-radius:.375rem;padding:.5rem .75rem;text-decoration:none}@media (min-width:640px){.navbar-list a{margin-left:.25rem;margin-right:.25rem}}@media (max-width:640px){.navbar-list a{margin-top:.25rem;margin-bottom:.25rem;width:100%}}.navbar-list a{font-weight:500;border-radius:.375rem;padding:.5rem .75rem;text-decoration:none}.navbar-list a:hover,.navbar-logo:hover{--tw-bg-opacity:1;background-color:rgba(229,231,235,var(--tw-bg-opacity))}.dark .navbar-list a,.dark .navbar-logo{--tw-text-opacity:1;color:rgba(96,165,250,var(--tw-text-opacity))}.dark .navbar-list a:hover,.dark .navbar-logo:hover{--tw-bg-opacity:1;background-color:rgba(51,51,51,var(--tw-bg-opacity))}.navbar-list a.active,.navbar-logo.active{--tw-bg-opacity:1;background-color:rgba(37,99,235,var(--tw-bg-opacity));--tw-text-opacity:1;color:rgba(255,255,255,var(--tw-text-opacity))}.navbar-list a.active:hover,.navbar-logo.active:hover{--tw-bg-opacity:1;background-color:rgba(29,78,216,var(--tw-bg-opacity))}.dark .navbar-list a.active,.dark .navbar-logo.active{--tw-bg-opacity:1;background-color:rgba(96,165,250,var(--tw-bg-opacity));--tw-text-opacity:1;color:rgba(0,0,0,var(--tw-text-opacity))}.dark .navbar-list a.active:hover,.dark .navbar-logo.active:hover{--tw-bg-opacity:1;background-color:rgba(59,130,246,var(--tw-bg-opacity))}.navbar-list a:hover,.navbar-logo:hover{--tw-bg-opacity:0.6}.navbar-list a,.navbar-logo,.navbar-toggle,.theme-toggle{transition:border-color .2s ease-out,box-shadow .2s ease-out}@media (min-width:768px){.navbar-list a,.navbar-logo,.navbar-toggle,.theme-toggle{transition:background-color .15s ease-out,color .15s ease-out,border-color .2s ease-out,box-shadow .2s ease-out}}.btn-icon,.navbar-toggle{border-radius:.375rem;height:2.5rem;width:2.5rem;--tw-text-opacity:1;color:rgba(59,130,246,var(--tw-text-opacity))}.navbar-toggle{--tw-bg-opacity:1;background-color:rgba(243,244,246,var(--tw-bg-opacity))}.btn-icon{margin-right:.25rem}.navbar-toggle:hover{--tw-bg-opacity:1;background-color:rgba(229,231,235,var(--tw-bg-opacity))}.navbar-toggle:active,.theme-toggle:active{--tw-bg-opacity:1;background-color:rgba(191,219,254,var(--tw-bg-opacity))}.dark .navbar-toggle{--tw-bg-opacity:1;background-color:rgba(51,51,51,var(--tw-bg-opacity));--tw-text-opacity:1;color:rgba(96,165,250,var(--tw-text-opacity))}.dark .navbar-toggle:hover{--tw-bg-opacity:1;background-color:rgba(31,41,55,var(--tw-bg-opacity))}.dark .navbar-toggle:active{--tw-bg-opacity:1;background-color:rgba(55,65,81,var(--tw-bg-opacity))}.navbar-toggle:focus{border-radius:.375rem}.navbar-toggle:focus-visible{--tw-border-opacity:1;border-color:rgba(37,99,235,var(--tw-border-opacity));--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(4px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.btn-icon,.btn-icon:hover{--tw-bg-opacity:1;background-color:rgba(255,255,255,var(--tw-bg-opacity))}.btn-icon:hover{background-color:rgba(243,244,246,var(--tw-bg-opacity))}.btn-icon:active,.dark .btn-icon{--tw-bg-opacity:1;background-color:rgba(191,219,254,var(--tw-bg-opacity))}.dark .btn-icon{background-color:rgba(85,85,85,var(--tw-bg-opacity));--tw-text-opacity:1;color:rgba(96,165,250,var(--tw-text-opacity))}.dark .btn-icon:hover{--tw-bg-opacity:1;background-color:rgba(31,41,55,var(--tw-bg-opacity))}.dark .btn-icon:active{--tw-bg-opacity:1;background-color:rgba(55,65,81,var(--tw-bg-opacity))}.btn-icon:focus{border-radius:.375rem}.btn-icon:focus-visible{--tw-border-opacity:1;border-color:rgba(37,99,235,var(--tw-border-opacity));--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(4px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.btn-highlight{margin-right:.25rem;display:inline-block;border-radius:.375rem;--tw-bg-opacity:1;background-color:rgba(243,244,246,var(--tw-bg-opacity));--tw-text-opacity:1;color:rgba(59,130,246,var(--tw-text-opacity))}.btn-highlight:hover{--tw-bg-opacity:1;background-color:rgba(229,231,235,var(--tw-bg-opacity))}.btn-highlight:active{--tw-bg-opacity:1;background-color:rgba(191,219,254,var(--tw-bg-opacity))}.dark .btn-highlight{--tw-bg-opacity:1;background-color:rgba(51,51,51,var(--tw-bg-opacity));--tw-text-opacity:1;color:rgba(96,165,250,var(--tw-text-opacity))}.dark .btn-highlight:hover{--tw-bg-opacity:1;background-color:rgba(31,41,55,var(--tw-bg-opacity))}.dark .btn-highlight:active{--tw-bg-opacity:1;background-color:rgba(55,65,81,var(--tw-bg-opacity))}.btn-highlight:focus{border-radius:.375rem}.btn-highlight:focus-visible{--tw-border-opacity:1;border-color:rgba(37,99,235,var(--tw-border-opacity));--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(4px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.btn{transition:opacity ease .25s;border-radius:.375rem;padding:.5rem .75rem;text-decoration:none;color:rgba(37,99,235,var(--tw-text-opacity))}.btn:hover{--tw-bg-opacity:1;background-color:rgba(229,231,235,var(--tw-bg-opacity))}.btn,.dark .btn{--tw-text-opacity:1}.dark .btn{color:rgba(96,165,250,var(--tw-text-opacity))}.btn.active,.dark .btn:hover{--tw-bg-opacity:1;background-color:rgba(51,51,51,var(--tw-bg-opacity))}.btn.active{background-color:rgba(29,78,216,var(--tw-bg-opacity));--tw-text-opacity:1;color:rgba(255,255,255,var(--tw-text-opacity))}.btn.active:hover,.dark .btn.active:hover{--tw-bg-opacity:1;background-color:rgba(59,130,246,var(--tw-bg-opacity))}.btn-share,.dark .btn.active{--tw-bg-opacity:1;background-color:rgba(96,165,250,var(--tw-bg-opacity));--tw-text-opacity:1;color:rgba(0,0,0,var(--tw-text-opacity))}.btn:hover{--tw-bg-opacity:0.6}.btn-share{margin-left:.5rem;border-radius:.375rem;background-color:rgba(243,244,246,var(--tw-bg-opacity));color:rgba(59,130,246,var(--tw-text-opacity))}.btn-share:hover,.dark .btn-share{--tw-bg-opacity:1;background-color:rgba(229,231,235,var(--tw-bg-opacity))}.dark .btn-share{background-color:rgba(51,51,51,var(--tw-bg-opacity));--tw-text-opacity:1;color:rgba(96,165,250,var(--tw-text-opacity))}.dark .btn-share:hover{--tw-bg-opacity:1;background-color:rgba(31,41,55,var(--tw-bg-opacity))}.dark .btn-share:active{--tw-bg-opacity:1;background-color:rgba(55,65,81,var(--tw-bg-opacity))}.btn-share:focus{border-radius:.375rem}.btn-share:focus-visible{--tw-border-opacity:1;border-color:rgba(37,99,235,var(--tw-border-opacity));--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(4px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}#btn-share-input{position:absolute;top:-50px;left:-50px}.btn,.navbar-toggle,.theme-toggle{margin-right:.25rem}.theme-toggle{border-radius:.375rem;height:2.5rem;width:2.5rem;background-color:rgba(243,244,246,var(--tw-bg-opacity));color:rgba(59,130,246,var(--tw-text-opacity))}.theme-toggle:hover{--tw-bg-opacity:1;background-color:rgba(229,231,235,var(--tw-bg-opacity))}.dark .theme-toggle,.theme-toggle{--tw-bg-opacity:1;--tw-text-opacity:1}.dark .theme-toggle{background-color:rgba(51,51,51,var(--tw-bg-opacity));color:rgba(96,165,250,var(--tw-text-opacity))}.dark .theme-toggle:hover{--tw-bg-opacity:1;background-color:rgba(31,41,55,var(--tw-bg-opacity))}.dark .theme-toggle:active{--tw-bg-opacity:1;background-color:rgba(55,65,81,var(--tw-bg-opacity))}.theme-toggle:focus{border-radius:.375rem}.theme-toggle:focus-visible{--tw-border-opacity:1;border-color:rgba(37,99,235,var(--tw-border-opacity));--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(4px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.navbar.shadow .to-top{opacity:1}#app{border-width:1px;--tw-border-opacity:1;border-color:rgba(229,231,235,var(--tw-border-opacity));border-radius:.5rem;--tw-shadow:0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow);position:relative;margin-bottom:2rem;display:block;--tw-bg-opacity:1;background-color:rgba(255,255,255,var(--tw-bg-opacity));padding-top:15px;padding-bottom:15px;height:344px;resize:vertical;overflow:hidden}.dark #app{border-color:transparent;background-color:#24292e}@media (max-width:768px){#app{height:294px}}.push-to-side{display:flex;justify-content:flex-end;padding-top:.5rem;padding-bottom:.5rem;vertical-align:middle}.dark .file-size,.file-size{--tw-bg-opacity:1;--tw-text-opacity:1}.file-size{margin-left:.5rem;margin-right:.5rem;display:inline-block;border-radius:.375rem;padding:.5rem 1rem;display:flex;align-items:center;justify-content:center;text-align:center;background-color:rgba(229,231,235,var(--tw-bg-opacity));color:rgba(107,114,128,var(--tw-text-opacity));min-width:12rem;min-height:3rem}.dark .file-size{background-color:rgba(51,51,51,var(--tw-bg-opacity));color:rgba(187,187,187,var(--tw-text-opacity))}#editor{height:100%}.loading{margin-left:auto;margin-right:auto;display:block;height:2rem;width:2rem;border-radius:9999px;border-width:.25rem;border-color:#3b82f6 #d1d5db #d1d5db;-webkit-animation:spin 1s linear infinite;animation:spin 1s linear infinite}.dark .center-container{background-color:#121212}@supports ((-webkit-backdrop-filter: blur(8px)) or (backdrop-filter: blur(8px))){.dark .center-container{--tw-bg-opacity:1;background-color:rgba(18,18,18,var(--tw-bg-opacity));--tw-bg-opacity:0.2}}.dark .loading{border-color:#60a5fa #555 #555}.center-container{position:absolute;top:0;left:0;height:100%;width:100%;display:grid;align-content:center;justify-content:center;z-index:10;background-color:#f8f8f8}@supports ((-webkit-backdrop-filter: blur(8px)) or (backdrop-filter: blur(8px))){.center-container{--tw-bg-opacity:1;background-color:rgba(255,255,255,var(--tw-bg-opacity));--tw-bg-opacity:0.2;--tw-backdrop-blur:blur(8px);backdrop-filter:var(--tw-backdrop-filter)}}.center-container p{margin-top:.5rem}#bundle-time{display:flex;align-items:center}#editor{width:100%}.current-line{width:calc(100% - 20px);border-radius:4px}.search:focus-within{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(4px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000);--tw-ring-opacity:1;--tw-ring-color:rgba(59, 130, 246, var(--tw-ring-opacity));--tw-ring-opacity:0.5}.search{border-radius:.5rem;--tw-bg-opacity:1;background-color:rgba(229,231,235,var(--tw-bg-opacity));display:flex;align-items:center;padding-left:1rem}.dark .card section.add .btn,.dark .search{--tw-bg-opacity:1;background-color:rgba(51,51,51,var(--tw-bg-opacity))}.search input#search-input{margin-left:.5rem;width:100%;background-color:transparent;padding:.5rem;vertical-align:middle}.search input#search-input:focus{outline:2px solid transparent;outline-offset:2px}.search .clear{transition-property:background-color,opacity,box-shadow,transform,filter,-webkit-backdrop-filter;transition-property:background-color,opacity,box-shadow,transform,filter,backdrop-filter;transition-property:background-color,opacity,box-shadow,transform,filter,backdrop-filter,-webkit-backdrop-filter;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:150ms;--tw-scale-x:0.85;--tw-scale-y:0.85;transform:var(--tw-transform);margin:0;--tw-text-opacity:1;color:rgba(0,0,0,var(--tw-text-opacity))}.search .clear:active{--tw-scale-x:.75;--tw-scale-y:.75;transform:var(--tw-transform);--tw-bg-opacity:1;background-color:rgba(75,85,99,var(--tw-bg-opacity))}.search .clear:hover{--tw-bg-opacity:1;background-color:rgba(255,255,255,var(--tw-bg-opacity))}.dark .search .clear:hover{--tw-bg-opacity:1;background-color:rgba(85,85,85,var(--tw-bg-opacity))}.dark .search .clear{--tw-text-opacity:1;color:rgba(255,255,255,var(--tw-text-opacity))}.search-container{margin-bottom:1.25rem}.search-container,.search-results-container{transform-origin:center top}.search-container:focus-within .search-results,.search-results-container:focus-within .search-results{pointer-events:auto;--tw-scale-x:1;--tw-scale-y:1;transform:var(--tw-transform);opacity:1}.search-results-container{position:relative;display:block;width:100%;border-radius:.5rem;padding-top:.5rem}.dark .search-results,.search-results{--tw-border-opacity:1;--tw-bg-opacity:1}.search-results{pointer-events:none;--tw-scale-x:.9;--tw-scale-y:.9;transform:var(--tw-transform);opacity:0;transition-property:transform,opacity;transition-duration:200ms;transition-timing-function:cubic-bezier(0,0,.2,1);height:-webkit-fit-content;height:-moz-fit-content;height:fit-content;max-height:410px;border-width:1px;border-color:rgba(229,231,235,var(--tw-border-opacity));display:flex;flex-direction:column;width:100%;overflow:auto;position:absolute;z-index:20;background-color:rgba(255,255,255,var(--tw-bg-opacity));border-radius:.5rem;--tw-shadow:0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.dark .search-results{border-color:rgba(51,51,51,var(--tw-border-opacity));background-color:rgba(0,0,0,var(--tw-bg-opacity))}.search-results>:not([hidden])~:not([hidden]){--tw-divide-y-reverse:0;border-top-width:calc(1px*calc(1 - var(--tw-divide-y-reverse)));border-bottom-width:calc(1px*var(--tw-divide-y-reverse));--tw-divide-opacity:1;border-color:rgba(229,231,235,var(--tw-divide-opacity))}.dark .search-results>:not([hidden])~:not([hidden]){--tw-divide-opacity:1;border-color:rgba(51,51,51,var(--tw-divide-opacity))}.dark .search-results.empty,.dark code,.search-results.empty{border-color:transparent}.card{display:grid;gap:1.5rem}@media (min-width:640px){.card{grid-template-columns:repeat(12,minmax(0,1fr))}}.card{padding:1.25rem}.card section{grid-column:span 12/span 12}@media (min-width:640px){.card section.content{grid-column:span 9/span 9}}.card section h3,.card section p{line-height:1.5}.card section h3{font-size:1rem;margin-bottom:.25rem}.card section p{font-size:.9rem}.card section .updated-time{margin-top:.25rem;--tw-text-opacity:1;color:rgba(107,114,128,var(--tw-text-opacity));font-size:.8rem}.card section.add,.card section.add .btn{transition-property:background-color,border-color,color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter,-webkit-backdrop-filter;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:150ms}.card section.add{--tw-scale-x:1;--tw-scale-y:1;transform:var(--tw-transform);display:flex}.card section.add:active{--tw-scale-x:.9;--tw-scale-y:.9;transform:var(--tw-transform)}@media (min-width:640px){.card section.add{grid-column:span 3/span 3;text-align:center}}.card section.add{justify-content:end;align-items:center}.card section.add .btn{position:relative;margin:0;display:block;width:100%;--tw-bg-opacity:1;transition-property:background-color,border-color,color,fill,stroke,opacity,box-shadow,transform,filter,-webkit-backdrop-filter;transition-property:background-color,border-color,color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-property:background-color,border-color,color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter,-webkit-backdrop-filter;background-color:rgba(229,231,235,var(--tw-bg-opacity))}.card section.add .btn:hover{--tw-bg-opacity:1;background-color:rgba(191,219,254,var(--tw-bg-opacity))}.dark .card section.add .btn:hover{--tw-bg-opacity:1;background-color:rgba(75,85,99,var(--tw-bg-opacity))}.card section.add .btn:active{--tw-bg-opacity:1;background-color:rgba(219,234,254,var(--tw-bg-opacity))}.dark .card section.add .btn:active{--tw-bg-opacity:1;background-color:rgba(31,41,55,var(--tw-bg-opacity))}.card section.add .btn .btn-text{white-space:nowrap;opacity:1}code{border-width:1px;--tw-border-opacity:1;border-color:rgba(229,231,235,var(--tw-border-opacity));color:#24292e;background:#fff;border-radius:.3rem;padding:.125rem .25rem;font-family:Consolas,"Courier New",monospace;font-weight:400;font-size:14px;font-feature-settings:"liga" 0,"calt" 0;line-height:19px}.dark code{color:#adbac7;background:#22272e}pre{padding-top:15px}pre code.hljs{display:block;overflow-x:auto;padding:15px} +/*! + Theme: GitHub + Description: Light theme as seen on github.com + Author: github.com + Maintainer: @Hirse + Updated: 2021-05-15 + + Outdated base version: https://github.com/primer/github-syntax-light + Current colors taken from GitHub's CSS +*/ +.hljs{color:#24292e;background:#fff}.hljs-doctag,.hljs-keyword,.hljs-meta .hljs-keyword,.hljs-template-tag,.hljs-template-variable,.hljs-type,.hljs-variable.language_{color:#d73a49}.hljs-title,.hljs-title.class_,.hljs-title.class_.inherited__,.hljs-title.function_{color:#6f42c1}.hljs-attr,.hljs-attribute,.hljs-literal,.hljs-meta,.hljs-number,.hljs-operator,.hljs-selector-attr,.hljs-selector-class,.hljs-selector-id,.hljs-variable{color:#005cc5}.hljs-meta .hljs-string,.hljs-regexp,.hljs-string{color:#032f62}.hljs-built_in,.hljs-symbol{color:#e36209}.hljs-code,.hljs-comment,.hljs-formula{color:#6a737d}.hljs-name,.hljs-quote,.hljs-selector-pseudo,.hljs-selector-tag{color:#22863a}.hljs-subst{color:#24292e}.hljs-section{color:#005cc5;font-weight:700}.hljs-bullet{color:#735c0f}.hljs-emphasis{color:#24292e;font-style:italic}.hljs-strong{color:#24292e;font-weight:700}.hljs-addition{color:#22863a;background-color:#f0fff4}.hljs-deletion{color:#b31d28;background-color:#ffeef0} +/*! + Theme: GitHub Dark Dimmed + Description: Dark dimmed theme as seen on github.com + Author: github.com + Maintainer: @Hirse + Updated: 2021-05-15 + + Colors taken from GitHub's CSS +*/ +.dark .hljs{color:#adbac7;background:#22272e}.dark .hljs-doctag,.dark .hljs-keyword,.dark .hljs-meta .hljs-keyword,.dark .hljs-template-tag,.dark .hljs-template-variable,.dark .hljs-type,.dark .hljs-variable.language_{color:#f47067}.dark .hljs-title,.dark .hljs-title.class_,.dark .hljs-title.class_.inherited__,.dark .hljs-title.function_{color:#dcbdfb}.dark .hljs-attr,.dark .hljs-attribute,.dark .hljs-literal,.dark .hljs-meta,.dark .hljs-number,.dark .hljs-operator,.dark .hljs-selector-attr,.dark .hljs-selector-class,.dark .hljs-selector-id,.dark .hljs-variable{color:#6cb6ff}.dark .hljs-meta .hljs-string,.dark .hljs-regexp,.dark .hljs-string{color:#96d0ff}.dark .hljs-built_in,.dark .hljs-symbol{color:#f69d50}.dark .hljs-code,.dark .hljs-comment,.dark .hljs-formula{color:#768390}.dark .hljs-name,.dark .hljs-quote,.dark .hljs-selector-pseudo,.dark .hljs-selector-tag{color:#8ddb8c}.dark .hljs-subst{color:#adbac7}.dark .hljs-section{color:#316dca;font-weight:700}.dark .hljs-bullet{color:#eac55f}.dark .hljs-emphasis{color:#adbac7;font-style:italic}.dark .hljs-strong{color:#adbac7;font-weight:700}.dark .hljs-addition{color:#b4f1b4;background-color:#1b4721}.dark .hljs-deletion{color:#ffd8d3;background-color:#78191b}body,html{scroll-behavior:smooth}html{accent-color:#3b82f6}html.dark{color-scheme:dark light;accent-color:#60a5fa}.dark body,body{--tw-bg-opacity:1}body{background-color:rgba(255,255,255,var(--tw-bg-opacity));color:rgba(0,0,0,var(--tw-text-opacity));font-family:Manrope,Century Gothic,sans-serif;font-size:1rem;line-height:1.5}.dark body{background-color:rgba(0,0,0,var(--tw-bg-opacity));color:rgba(221,221,221,var(--tw-text-opacity))}.no-overflow-x{overflow-x:hidden}.icon{font-feature-settings:"liga","dlig";-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;text-rendering:optimizeLegibility;font-family:"Material Icons Round","Material Icons";vertical-align:middle;letter-spacing:normal;display:inline-block;text-transform:none;white-space:nowrap;font-weight:400;position:relative;font-style:normal;word-wrap:normal;font-size:24px;line-height:1;direction:ltr;height:1em;width:1em}.dark body,a,a:hover,body{--tw-text-opacity:1}.icon,a{text-decoration:none}a{color:rgba(59,130,246,var(--tw-text-opacity))}a:hover{color:rgba(29,78,216,var(--tw-text-opacity))}.dark a,.dark a:hover{--tw-text-opacity:1;color:rgba(96,165,250,var(--tw-text-opacity))}.dark a:hover{color:rgba(191,219,254,var(--tw-text-opacity))}a,button,input{-webkit-tap-highlight-color:transparent}a,button{transition:box-shadow .2s ease-out;border-radius:.375rem}a:focus-visible,button:focus-visible{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(4px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000);--tw-ring-opacity:1;--tw-ring-color:rgba(59, 130, 246, var(--tw-ring-opacity));--tw-ring-opacity:0.5}a:focus,button:focus{outline:2px solid transparent;outline-offset:2px}@media (min-width:640px){.desktop{display:block}.mobile{display:none}}@media (max-width:640px){.mobile{display:block}.desktop{display:none}}main .container{padding:.5rem 1.25rem}@media (min-width:640px){main .container{max-width:768px}}main strong{font-weight:800}.dark main strong{font-weight:500;text-decoration:underline}main header{padding:1.5rem;text-align:center}main h4,main header h1{margin-bottom:.5rem;font-weight:700}main h2,main header h1{font-size:3rem;line-height:1}main header p{font-weight:500}main #about,main #faq{padding-left:1.25rem;padding-right:1.25rem;padding-top:6rem}main #about p,main #faq p,main header p{font-size:1.125rem;line-height:1.75rem}main #about img,main #faq img{display:inline-block}main h2{margin-bottom:2rem;font-weight:700}main h4{font-size:1.5rem;line-height:2rem}#product-hunt{margin-bottom:1.5rem;display:flex}#product-hunt figure{position:relative;width:250px;height:54px;overflow:hidden}#product-hunt img{width:100%;height:100%}html.dark #product-hunt img.dark,html:not(.dark) #product-hunt img:not(.dark){display:block}html.dark #product-hunt img:not(.dark),html:not(.dark) #product-hunt img.dark{display:none}html.dark hr{border-top-color:#333}footer.footer{text-align:right;--tw-text-opacity:1;color:rgba(75,85,99,var(--tw-text-opacity))}.dark footer.footer{--tw-text-opacity:1;color:rgba(187,187,187,var(--tw-text-opacity))}footer.footer .container{padding:1.25rem;vertical-align:middle}@media (min-width:640px){footer.footer .container{max-width:768px}}.dark .dark\:bg-quaternary{--tw-bg-opacity:1;background-color:rgba(51,51,51,var(--tw-bg-opacity))}@media (min-width:640px){.sm\:max-w-screen-lg{max-width:1024px}} \ No newline at end of file diff --git a/docs/faq.html b/docs/faq.html new file mode 100644 index 0000000..e77e794 --- /dev/null +++ b/docs/faq.html @@ -0,0 +1,116 @@ +bundle - a quick npm package size checker

Frequently Asked Questions

I often get asked what was the point in building bundle, this is a short, quick, and simple summary of my reasons for building bundle.



What is the advantage over bundlephobia?

There are a couple reasons for this but the main one is that bundlephobia wasn't reliable enough.

+


What do you mean wasn't reliable enough?

It can treeshake bundles accurately. Right now `bundlephobia`, is a bit hit or miss when it comes to treeshaking.

For example, try treeshaking the Event class from @okikio/emitter using bundlephobia and try pasting this,

+
export { Event } from "@okikio/emitter";
+
+

into bundle.js.org. You will notice a major package size disparity. This is only one example and I am sure others exist, I hope the above example illustrates my point.

+

Another problem with bundlephobia is the lack of good error reporting if (for whatever reason) bundlephobia isn't able to bundle your package, it logs this to the console,

+
{
+    "code": "BuildError",
+    "message": "Failed to build this package.",
+    "details": {
+        "name": "BuildError"
+    }
+}
+
+

this just isn't very useful for debugging. bundle.js.org run locally.

+

On the other hand, since, bundle.js.org runs locally right on your computer, when an error occurs it logs the exact error you would see when using esbuild or other bundlers in your build process, making it much easier to know what is wrong with your js bundle.

+


Wait, locally as in no external servers?

Yes, locally right on your browser, I used esbuild-wasm for the main bundler and rollup for more accurate treeshaking, and it enables you to download the bundled code right from the browser console (note: the bundled code is available in the console).

+


Can it bundle multiple packages and treeshake them?

Yes. bundle.js.org can treeshake all packages, and it can do so accurately.

+

\ No newline at end of file diff --git a/docs/favicon/android-chrome-192x192.png b/docs/favicon/android-chrome-192x192.png new file mode 100644 index 0000000000000000000000000000000000000000..eaebb33f815f62e24d2c01a993054e0a8d782b74 GIT binary patch literal 4448 zcme7R@N?(olHy`uVBq!ia0y~yU^oE69Bd2>3_*8t*cliYSkfJR9T^xl_H+M9WMyDr zP)PO&@?~JCQe$9fXklRZ#lXPO@PdJ%)PRBERRRNp)eHs(@q#(K0&N%=7}%1$-CY>| zgW!U_%O^81FmM)lL>4nJl*xcF{uysusVZRz)^X_>nk*`!%qS{b7R(oOO{y7V3pe4b)roM>@u=EVmp zTJyx5eO%5Ks-+cnCP}#Z`xtqK2=yy3yyrXb$H-(V|RERgw? z=>=N>*MoM68+Hx3X{-K4o}GNJtCuix#V_8d=M8-A@j_krQ@4!19xT~v;2?A44o z8S-}SEcHLSeIzi~aYsYkib6_&oDMjl*3hX?sZ%3;Ffhx28#YJAXe~{X&%4AUX3z;<*h%4ellW zEh;Cu6Rw^~ckYjU=~(-Y>1>Qt%#nj}f_GUJnU8&V@k@1{eEh%g>4u+YUif3Y{!d}~ zL=H)o5{A#$?cY}Ze-s}h)Nq-7&nvMDdHkOGj;`VB_y0KXqbdAH^#5*a|N2|b()OO# zaqC{J)>^&u@t^uV3JkGxA0B^sS#HugiytjIrZop0KkkfOV0{0>JLcNm-j|{^mMu;y z-nv}Q;=OEx@jr`<$LcT7Cx>tN@rIwrV*7@-8X62Pe70S_(t)2__Pa7N#0HBunAIuq zZ(p|ZbA$122blNN{EZW6ulbFWKW9cx4K zfx`ku7M3qs#Fb3B7$!=wHhAcb#{|wug*9e`;d7; z!caCcwfKSdOs7T$;Y`&0o0po&SYuXHD6-?vjOn56r(<_u#xmSC++} zqbDTG*}2qo8|q(_F52zSEz(eTAvw{cb{~_v`JSGF--4H)^|DD_*zwfVB(IY9-l2~g zvvvuzP8M%i$#>EJjj;Uf*!Lm>R*v>fjX9|L_1izhievr=F_?SHqG+Z`})C zEIzvEv_Kz|!p3KFwJ%m?^u91^S@iURTO!w-na&T-$@1O<_zRh9ca^PCYC;v&UM)qd%zNR%3H!s*_^yr`Oj<*U- zU!yN>``&M{^?mfc_VkITY4%aVwv8#Q7)#Lmx z&x@Z%LjbDp7Sf$>-lUz9*sga-;Y!Iw(tR-;;H#Cd`RZq9Jkf{`SJp_uKD= zPqDRmIq5%xQGH<+jpZH^rYFpegmHJ0DF<<-l zx1XJxTVa3EfjKHGT+*)pY5>D8#r!|E%gyVAQ>KM2{3IV|RY59q9S{{*~QM=7Yzgf~$plnI zy_B8*+8Uvu+<<)T>ii?xr66K!YpGEGoOzgF<1=l7}?MiVSQv87BqYgW=1{M%mS z?y^h`22QORCH6BGb?GrP1Q^}Dv3Xa@u4MwO3XVU8kG%aIuT%ZyY?~Z+$^0KOQ6?I@ ze1iiRgdUvIY__gn^TOy~o8c4x9oIKJ+3pn#1R_rJ`#UpKh<3~6|hT;B%lZ(7}tT}T@>+mr?)3-u*=V@v% z6t3{Izq50(%k;v?e~H(n&9==f-zV6~B+#zC`^pDXi@#6hvtk&wcrff;7`!OjWRB_o zbloFUZG%cUYm1)untj>b>2cifqOMdQlR&$2a>omyUq?dNW&R}{KK7n>TUXx20+9xb zkmd0uoZ(N-NG0C5u~F_8>!f*C{YA__$ts9tiQk>~5ab5F?ETCVk^z$M)EyW*oJ*sA z%Q|e_%_|*!U1`y6V;NQjzM~I?V-HPzy}6o4I=XFkW&p#Z2UR{LoP}IhdZceJx?jH} z=vTRg!>*&#S+m*h{qdXlplYE=gT)pPhZ4^4CGOQc(zn-i7j?QYb{u}iXz)o*Jk0)| zr)U2n?hRI}=SzydTxFhpZP(R~5~=NP6eQKn{~fvTakKmX<`-hV&Ws)c*Q+jWc)5Jh zX@}p9{ue4UdJ`WTySkPg&0TccgqKx;vo|{4-QZG_?z;f2A~|HQw(jx#CYJNnKo z@9EuT-_?Xz6(Z+6K7IeMw$j{Vy3YF|zIUE4d|-axmFzF1yx+wsaiEAGa}$L@Nqs62lA z#^=?$eIk2jMV2Y=aV^rRw~%K|U{IR-^~Y=d{9_mW=lQ*KlghJix|?4w%3ilypz6$= z?qJ^8Uw3GJj_CC*VQiMYzG%hzN=Dz?_njVYNGbnu< z81_>prEg9uxa{+ocrQWw)&Eb*SJv0c&HGb$LT5H_{YjA>MW-H~(rbP7W&ZA-g<_lv zV(%RCH;5i=o68|{ziHiK=?lfL8h*AKw+WhucGvxCS;(+N>N$t$d&d=({CedbXGCT% zU1t_<@RIRITb%YTp2Qat2U5ar{m6Z%Gv(f&HK3}5!6WC%+S7^OpLOdwYj8CzDLQ_) zv&r*&x1O^FS3}F3$is%O*3IwKJ1nHZFexxcuV?P>K9TTRZx&VuHJ^hk*8i2+H!0gC zJV{c7p|fYtQ_Cm*JN!!|r#UfBIMT6y{jmuz?~BE@J-r~F__EKiXV262Eg!!(GEF!p zGMjtxyDHY7!q2<)j&9Om$UOB>|Im%f)eq#$_Pz+x>Fr~DBw_ZOv*Oe7PCaGKn~U?0 zEpeTl`PiR-6oNt0Tzncc@zoiJn{V|Wu43IkwXV~7kp=^2z?-}& zcfT>I>BaP)xukXRX-t>llivN}*KIa29}O1wDh}NqvLLxZrJ{S?u^;UJTekg`U%W5P zlIgfvryl3c2S=!>N(vQpdk^#%X_$FTSMj^AJ7 zd`c@Onm@D?@&7w*%JYxQgl2CvNqMu?Ol3jq?hCtqGjDnOTVQVcb*JvKIMA!qsvB~C*Y=iJ@zs$Tx7 z-=)AHZ+}S1C;2-AN5{IU6GXVP0-nEJmnOcZZr_udhSIC+tQhXIEa+Z0V}i&<%fseo zx`prd{t%yTtC;rp^1SbskNLaT&6*IBz|)@>@#yE*r*+q#OD0NBtEfNb*WPfC^F+c? z$;0K>bU*I7bDjCoJ>T48moC&Y)Nvlr-X-lc>B3pbe=FCA|Jy9IYwm+B>B^6DV(R;w z{RQrdDi#`Ec{R(bJbA0}yP*FqeqHys9ND>j`32Kf!#~z9M7)w>6_5QimYn(SweZa! zjV$*W&zWzvGP$xY!I1r*WJ7ex@fHS-!oKS}x}H9-KRLCd?tb9TSL}^7y35X`A7Em* z-dV@iQDX7<#wzWImlu-W&x^f1dCinNK{c;7y>ki;&SN=lax8-Nz-fjjkH0h;-+kN5 z<07)We0MZMnZ$$N2R3#Vzun9W*wuf}8u|YH_db*B^y=G!rwj}XswJ)wB`Jv|saDBF zsfi`23`PblpinR(g8$%zH2dih1^v)|cBF)%QMSA|5B1SOU$6cpvBW#*(R zlvEa^Dr6RvBr`Bn%z6BYhodk|L*tbH=`)^BgBX~Vx%HB{g_VW9CyOu(E4Vb698O_Y v-W;NE`o@(LN6s9PIl_Lr!DE4!9>Xhf!IDo-rc)Uh7#KWV{an^LB{Ts5X!!r< literal 0 HcmV?d00001 diff --git a/docs/favicon/android-chrome-512x512.png b/docs/favicon/android-chrome-512x512.png new file mode 100644 index 0000000000000000000000000000000000000000..aeb3d12131a72cb7a64e81881835cddf2175e43e GIT binary patch literal 12301 zcme7R@N?(olHy`uVBq!ia0y~yU}6Aa4mJh`hA$OYelajGu%tWsIx;Y9?C1WI$jZRL zppfhlFJ?h}#P(ISAqY(XVfi2i{Mq#IEajRZMhkpNE8XGgq zul(w6s|mlp1c&-tiq2M(KO1;`ipI2AFQ2GYulJm!b|QPnoa_lT%}YMj{ttAAe$l2vl`>rNhB+x%;>0^5O`zWWwgPup>%a&P!0)kha>85H)H zoO;u=sxK>bAn&+^^)g7@@0PVlTGgIVrOVjE-b3Pd?|m5-`|wP z;IrM=Y}?EHc(Z!KMu{B629^Mk$L zf8E#?dNO%UaHZm#}%wG-Wp2JesksNQ?ocha)x?F`40}jjuZ8{}>o# z=1rgdaM2Cp;`~>CDz>fH&URN3)gM;#E9*`iX-!RGm{VGuRCMY$>!Wk>3=KKAW_j)2 z**#m!oab8;+h3yt#{ZY@HGKN_Fho{bxcg7?^4itOPZIPq0+79YQFm3{n`_3aGj@;-^$dEM83_lJ?; zg!om%rSEN5o(%u`y!)3aLsjxed2g$Gzos!UH2kfwUv1;{@BP0T&-wC9u!M5&ml+d7 zLv!)D_+MAPUgiJxviSEWPj%CutGYBcI$ctEEzQorz?T_Zn)>vN`~Fu}{a-q3t2h=Y zdBy01?JF0ydi-(y*Qdh$6)Xw&H~*XNCH3JX8v}#Gxsubao5f?|KVEuh_p-yCp=Qdz z&K;lG85RUgIk~*9Vu`=i8-^L>$$$1vI=6A3Dg(m;`#Y7N^LpazcAU3(!cg&kubtZS z{4M)985kD)-&1V9`lS4)x_=Y)Z_Ew-6s2!|_!k=kLqp?-o2JPkuPC5(|c5ZVo6V_1p|Wwk9qMs-H+V-->li~nI@F|&zQ@@ zz+iMh{*T>X-FDVzcdiu1EXi0|s?Wf1V#<{@pagT{zjD4Mlfcgx!q;XpFentyNs_O9 zef*p8^WXc7UU}q9G`V6W#=wx`Q+#*AsY3qxi=})2HJZyZc5GGG69nZCk=YNcqaVM& z^`ALkioxzu^;&L528U;s&+nD^HJHmWS^U3WQ<|={(K%>qsR{$bi5=fce4n0hy}q+$ z%YDIyb18r3f>U8qsPxw3=j;B8=kqX3@4IKZpqrV2f%Tx}_hYqxrI`;{pJ!lTSkO`V z@+|X%HM4~$tNL!^V`gB8G<~~e*$<1%`wSjSOWR5X85mCNoAhGq??1Ktj6W=|IWjOP z{GMYHURBFrF*iq+g@IwydGF;OK}*!+J!hqY_(e(6_LS$v1sBcgzoZ{|oq?g@PKTwr z>ZgrYN?r>vFif!C`|`^fk9)ow`4|}(b_%=B67igsAg?0I0S|QGoZ7Sf$RLc ztM!+Dwf{e9rL3M-U$oC_we(tJ28G8G3@^5al($b>`+BW$(V^wlYlRsUv@1AR9HgtT_ue z-3q*RUyPyo00YCP4*%sM_czAm&KA?&SKKOeHe2NW&LG>lXD#_YzIu6Q>AZ8XUGHNm zFZgS&ToIo7xFpo{Tt%)(&y1C`Hma}Ovg+Wk+Z+q{B^VkM=f4Vk-uLv@=Tncf?r#am zoh`Q7{9@MJtLl4C?#;UYXUi>f`@hTj!+GYe*~M8LV*Qcls_%@&s|1bL1T)I8Ff*Lk zxXyO=l})euZ|(inpLKgngx%HLxl;m9Ui<2`ZQb>As^2{(oyu}wo%bk)*YcGN@9esb zpkyx0*ulu~#AQ?I-m>*|9=h7^!f!u2I_dj0Ps_`9_xYYZ{XY2fr{7E1m9F;K#X0xy z^yobvyY$q<;}Opp4<<1%L|(eQ)7v`!M{AkQ|6mEg~ zlB!%Im9{7PaC+=fXI6(kLxu*QPnmBc&Eu`-?Tyx5Ew8id@b8&o_cuCyl-1r+`EUQK zv@@Mjm7k7ZvH1O7M0@o%KjtnuW`+|DA)9<}|N9pFw&Gi!YV`H!=ORn`*6Oc#+;~3w zaq|6u#~-g}T{$WLcm=}*S0080fvU&5x0ZhF-;(>W|LW{J*>i(Ms)VaSysfz(`$NqW z`;MLYJ4tF;yq0D9Ts9F=HUIN*zrDQ>DKS{PV4P{+Vr=DQI~gX5#K4GsG~WWKF=_`K@fwVSs#J-EN~v-zYOTcfhy{az9G__R`Y?`N64pAI~~DxAOZ93vMOGlNCXw9xt~HMgvo z+aF)P_3zEys(<&>GhZ)~Ke@bmZFfV{0S1Nuk*dknTmL;=pLH_#^Oc>oD@*w%e3xKg z=<<60Z7IltTVIZBe{xy#wTwc(Ap?Vm?EF_3pQ-O#np(a$xO3X{wZ#p4jxaC;fD-6p z@%oxw+w^`3>PxclfsDR#$+mE9{g2gAUstcTj5XdM&&JT8@FwoBy6(>0d5^5aqn0yN zHZn3ONSwU8KI5fq`s&o9@7D%16!S1JIC_?rXMEi&f8p5ib!L^r>fq{MEyUy&V^)V~^ za`mH@GejO_U}$jmP`$n7)ARRXN!PPpi-4*Th5`xOxo4yPZT7ypHGOd@*MvYG1_q0! zciVKMes*h5d6l)1DoPq;p?;R*SUa-5~eTQAfc7Xx4UnB`JsDF(qX>=1A_u{TV!1!xQ-zH~8eszD%^I(J58fFHWIM1sFp?vd~b^YShk~eZp z-MTn5$TUQC>fw+e%MiV)xAu=$Y;k%yZ;8rE^NU)ZUZq=C@2;I)WmUFnb#8Z+)i&*m ze>P33HuJK}t-aiJ>sR}~K)5PMc9n7!1n@8% zh&X!Tq?Fm?AYSWdN>_bt9{0|Fu~{=LY%QpmPkZAz>0jI=P(4$9{d_nmMytOzdzEgD zuFvMWH?7tF%8JW&YcH*0doA)nSAwCTF`{y9n|$?Bw>@v0SIss!Zsk5HB+S~Yck}wd z$8WNyyz|WXKCAueo-c7**ZnnKpDVv0Bz*QZo1d}1yB@@^4Q|+;z`$S`5@qbP*zae{ zu{r-Dr-txtJ!iRO#g?GM{d=82*mmyjEpKO9Z+ZK2{tEMbx2@Jb$f^ES)@%2-SZlp} z`dp?xoa>nwiWV%%nxPi^VZGJQT~}v)=v)8%>)ij1UaO@|AIipGKY4xawJF{ER$rPW zc+Hbl_3rE|&wl<-n#;I{m6_p$nt0}ym-DZB#>Xw(SiFD9iY143WgJLKHC=yqn!fJU z8b-4m_wiI17#M3dn0_|=c?zb?r-J~wIZBvVmm_3UTt|AT|q z|5%xndi9!R<@(B_f4#Qs$(hTzr;(8%B_JedU1s>*wJXE#tz5C?l$E-=+nf(|vj11A zhuZ$Ccs=FMv&*-3eF%Ha^?;X$LBZKet3B&kyIjEIH`!}~i`H!_+?7_Jw9jqM55?D0 z_H6sy8oz3Ha(gM8LMJ0bic92KkF)=N#E00w^m#2}9O$`oSzO(0wfG!pZ$#e-SbMu_6=`m-k$pE-Ij9< z5)20tj-1Li{oGt1@bp9Sn&3~TCM-UGbq&A$nn|k?uW42;H{Ta+J^%mAQnmvO3~Z;4 zdYS&6RUKmc%Hs8uJt4;LQqKPR;Hu9lm0d{jYopX2~!Ek`Vci)3}(l}m~`O13v-iEc?$`dJz%y2=`ETO>E~t8> zdrguC~#~C#@E5uw1@!`u&5a)xLMW zk675Jdp15oKezz`pcquax^~;VOYSgHm7)R(o>s{`jd~%|9gIw8zCeZPsh?kolVAv#7AYfuHVKF*hbMFti5-S%&l;k58T(ctve)dGH7R^(Aj_ zt~e)qdX2Gw1RFzv#A3gnEXy~X-E?V|pj7#@Qn3C{1`I{rj0`eO-BYu^ten5)9LJ#- zm+hB>3J#v&-Ia0-MLmoRGER>R!&k4#>nU{;NJ_mbW&6DNn&dL8a-Hz&_rlj23ka|= z6mZylw%>ki&cB-v?weJ-Z~MQ^&%r^0;eg|m>;1uZTP&|hI(AOIo_Xb@{PuGOSGWE1 ze9gkr!pI=w^7zgE$6sHvxy}96x!}H0#d|h3hNAZU4;z{#>h4^<#_6cFUVgoz`~2*= ziE2Bm=kEHJx9yyRf&{|>MlI>(tE;XQUXwg1RqAzP{hkLJ3`MPs3^EHo?)V<1&XW7$ z%IDB9>swZbdCoICtTSL}VCI=y)mZ9uAx7l#hsWzSoijKr$nb=Vnc;@N=T(ENJ(dTp zlq-4}?b(%gR?mf`G6rUb8|NozzJGA@f8~O-H=e6e#@ejo^Ou1#oupa?2gA+-3=H2^%GS>+W%~Ab(Tp~^+I^*Moi3lHmR3)`CaF=x z!;mn4)ijX2G7iJ*V1zHk>nv8V^z+KRS~XpOWF7q)m@r-jZ+QO zEfo%UBEitG|kcdz|d*T@NDNRhw~Q?d}f&7%frC3e#xRZ)v3;FjSD2E_8yN=pW(4BZ-bwMU^0V3 zh0VYD|FzovxB3}eyu0tJ6{BkpW5a`~#Xs!dhnmTx&P`aPzV9|n^m_khzXO6HJacu# zr$(ediOJt{6ebmB8lnDxBW8`xiG|lDKj2{4)DAKxgm=52gZz}MecSv_?7ZjK$DmLx z!N3uhdDY-G%NNJUyArQk=DhYaV3=SFa%D?91D8{WJ44V(v!5Z`OWC?am>CXguYJPd zpvY0k;1T4%2;{ylkij1W92_-Pa(zzm)nsGX)WX>Cpiu0$j}Q@vrM1cXs5AKB57`d(%eTJ44ax68y2{3 z40_G-C2-B2V^#-Q_!$+VB^Wqnbx(~{U(oOLck?4fh7@jQ2FGruy}_C;3+2{&7RxcD za56JEa(`WZ%IV1>1NMgJmJBC^*ch6QF=)v2DKj{@88Qf%9M@*x@>ozGW|tcacGZO+ zFIN@(D4F5k_E?8FH>Hio9_ z!ucEh9OS=j$=~j05Ex{7#){Du6y#rzlt-&C;NQh8!?1Cal&h-fHA#&ikP*|B8CVzY zPM%%rbZ%;hX@vTM4nqckJ#zDy0|cCGm;z2ctWObSW;pozsbWLZg}d9XS}8uaU~0%o zVo<2K`}U!1l%C1Tb!J~n-fcQ}V&^3gHOkFa}3^&@_89(`# z-wrE%doyKj;-a)KAFpvjN~FHE`k)f2+T12{Zo(l~!_eM2nR6SJjx#WP%e?<-PAL=L zhUZWJZ}Kw;G<=icx-=A4l7X7QdAF11HeRn>Z@d1_(OrjJzP`8#Eh5j)EA@|1Pnh5L z*89rceRr)6yL?^oc#W_C0~^DJ`L_D)KZVonZf$;c{u*c6D)&MbhMOSkHb0+wT=o50 zV}+HKPwS)9XCyKxh)XaWsH?InUs=rloO#2voY?i}a=q6W`+#bs$hR7=c~}}i)kW#s z#n(6wX2<=re$8V1b@KhZxeX4W+G2~&{`*#n6^i@~yF5Ry5f3o%hlJ~S3I@U zZG+Wzeco>$_N!d=w>xdc*qFe;zZ-T$Rb>Si!&`rojV*Lbf>3oid%w)fYQ{gLT2 zq|N3Y|39%B)F?8usoHyKujlKYMVsIG|6dTY>8#b^kTq-Ez6Mt?D}V-mUo@|?mEM~B z(SMC`m)Ga6-&Z$%;=d;OOe$@kd!T1)DI3!f28LfRuKxcQKSx}_88k-o&;NhM+==3D zbAB+sW?|`KWcUKAjLgpe7k}Mz==tTS;{V65+}(J1*O8c`7d%(ZKXUVbLNg=7m&4!E z>sIxJ&)<4ZBV)bY&)BW&er_&xi<2lk^jr1$8e;(sHiirQc6UKTC?e|YQVaIJ{=dq% z|9;NgiSjW=9@fuDVqo|ya(}CrwEXY3Qn!PiChIT0y1yshZtf<(liXh?pAY&up%c<- zm1tPoU3X+R>o;fr^vz-aK6!mTRvx|lN$*7Ux(il}jmZoQ%v;{|$A^Jh43d@lSFbLc zx_^()$-C<#mOts8v??)c#!tD|JS=^T3_Jm=b~|g=m30c~>PIhsvNmLsuXf$PywaS? zdseFJd+fdjcX_Q|V=Q37#$dn!8Z7vFTKfv9a8rH%MeSS0&+~d=zn`VA3I60260|OG zdEF%|<^%?Y=BXK#k*D8T>Hjd_ax=dCc9`yed+`;?r;9;-gTimWL&A(93TIBpiCw?6 zeBS9|CY92h>Ok*z7T$AjPmf&wME<$SvmX73a8R$r;aJJ`+>4v6@2{LT^?&Bvq-CjB znWO5iSK6o)aX9ze`G+c}LAoyvZcBGrZ~bNd{<=1QP29_QJ4*e|EvXiY`hFpN%dhM2 zgIDdoY^9#xJNI|$YnBJRs@E7DE`E%=J%4X>?(F&3u4vb-0yU1rQ$vqm6W{V|U%%GH zKa)zm;#NymPkOa{PA;gcrp(|l?MV5W3zKd?%Y6IZE^f+ur5m$vEH34*b@hHO z*5KnEwbv{Ud@Yz5QYQOnKc7^+rTVS1l=XLclV4l>wZp=4V@-F=p7QG2xBYjQ`ug8l zbkAjVsh{JD`6bKRWWM^n=6T>N!QjC6Qgv^pX4yQfT{XXETa3tN zKkFrZx%yexyT4}~|7;(=YV}#G&VL>X0yNFJ5E) z%NH`mSJhpzaa}s~T4mS!sHM}U)?Zk+^t;x^?5(AK4~zQd|C_j7f}vsKyKirAefyFN z!d+h4q2>>HuKHQTZhh<*`gTWfNRXw<>g(?>YpRy-U$f1(du#dK_^suCYf880Z~wPV zq_s`*ec;&{!fTBinv)n9Dpl@IzA!KR-y+-ff1dXCPrcd~l=_$_)YLDy@-NHO>;1uz ze=Vkl@rQdJ4VW5o<@8Z6{@R82R-0d3_3oVPtGwIG-u1nGm3Mp9k#(kB?<3azSa;Ry zyV~0Ps*9aoS|%_5M6WS!a0c13Zg=hOUAMPqzu%?K_tP>kbLpZtKlem_m7zIM@ukNE}+ zUjo;xal3r~d-l|jE78jtnvXFsH0&$z3)bHs8>*ZZHJw2cG_+_pqvYTAD+OWS3S9uZ9*Yvl(8l8c+8T;`uls0|1Q)p zWMFup0P4vkulu(%CM0PtQwl3+R5QT*BaiIwh4va+Yd85ZZfeWqX865we$BMBJ^$^F zp2}Ji+^{Bzf#HCi^YXpkm)GwEm*-p)N_iLGtr9=*r+pSNN)ILN>t zFlW=Pi?a&f?p-BWJ*ku{p^cG2LF4M;{_8#2^{YSqD!iuIpvlJ2kkDiC@UPXYyY^2~ z>l!SC6_~>9QWm+*|K<6bCna*t9>2@$_IL-c|Djp_?|>bsv8$zdeTw(L*vt37OM?f& z9L28m*m|nhq%rz`V+IXTtC*hI5u#p`w(ynu+|0R6K7|vH&HWmB_TP`kt0c;%l=4m} zmtZ(x_taS}>zcb9XuRw6>;ob@KK&}3_4T2B=A)hFMQQdA1SA*^{EJy~ad~~1dfmHB zP%C2>+utXPgg`~$+#jvaL+yXQy=LhU_c)Z{fMW=cwby35PaS3Zzf6ex`FJ{b=$g|# zz&x?9Z`YTw&|aHsR;(HvJPZ#E+GL9-zEV4Pb=mR!Yv1<&4Y9kLJhz2;N(k@eC7<^% zov2>tQFP9VT|>f#g+a#A({=B%m@lz&fBbxY#o)8iYneBXlTxKhU#XW|5}%&+Ml{QFt@mePl7vm(E;gT}H~zu2+Dh1dB0;*alt%wLr?Cvh&b2rnChfydUz{#Om_ zzk8Ryy}4p-cl{dK^Z$KTrpzu4JE*-{a^*zzT9?IsKWChJbu8*RgKIk@LyE`G37xb4 ztb3pFXs0>IC7H)JmuH{frLOXR?PV@6(2&ljC;gd6IIkDot5fK{b7%IWKW|&=Uf$Xr z`F8!kvsTK=NvT_j>x^e`(X(v z?7yv>z5d6#t49qv<^+d6=DF%`7hF2|T*%)em0D{h6JuEumeRbnk)2;Zw zv#qw-EI;@5^p&mY&iD2o*-&$WCDha}{OXCwRkHP~Ua6f6%?xcW6>D%#U|?WXxH~yu z&rj8(hwX1UE@FzcfFo~PeyRz=&+J^Sk2ot5*x$-a7dXXQPY)j@Y< zy-G_pu3lYs@5w!LH>dpY+tU1oM^0rwjd`>6e{WLPsVtGBUZPXORxU~EIQ7bH^_H|H zpxMYZWg_~gnY%cc88iy?!j^5?WvI1UTDf=II>rEvio3iF44|<#1_4mHJoK1dDofWW zGcY*#EmiWodrg#qL1FnWCH3Q=MTk1F6Q}z}gflQS%<*!Wl)Z5s0|SHQlPfYOt3gW_ z6+dQmKG|}57c&FHlMC7I3|mfunG>!bJK=gO<1QluL(y@|{feJHy#_DLcvq2GJH_v4 zSX4V`9mq$$C_&wzpH`l-*FZI-`YrLgy-C4K)TU3{a%dN*N}T^WO6~cd*YDYWn7>wF zV3<&Q@1sui!Pxf49%Dm4op`3e7GXsOex1CesHQq`y_?w32P5RPRD#E~U zV%1gdS*x~tt(Rw<@MNidbT}hJ!pWARJ#x*PS$3@SBO za`neSXOxh^x7lYznLc=g{J z*U7K%{ZGEwIDd-Y^13WpE(Qi8^=HZD@;^3i=V@s5-FjNpHc^(Ffx+nD|Lc=|pK9~} z$tbzt|Mg$>wVezM2_NQI|ES$%{UW{k{j<9=@eiM-MYJ>iw{eBUB?JfgDg20~rKNHITU0TT2u!MErqj0~xnWfeY3=#~_r|Ely-z#5n-|h)R zz+~_0=d;)RW@I?vuw?%_wdr*<%G*A!p!TbC?cYCk{0yF2zTq{Fe)>`OJs221{I}Sdx^LMh z?Y}=~)$um`^wpCLF4?-I?6ovE1A~gE?8=gouZv#CECQ`|V^rAtZ54xl?WJGWm>3vN zo~}&`4F37*UtR2e_68N*Jqur5FZ!nkS|#Uj<4!Jj{)#_O9rhJDFgr||q`b;bd8hlD zd@BZq#83aXs>d2W2!Fv_!C>=U^ZI0;@EFa^iC?!fFf>fCSfB27IduB^jH0{DdwUr9 z89b}jojmG&dGGsaSKc3&V_-=$hdhB4_g#~>Kd)~cVwkmw-mDWkyqUzH@i8Ojq$(ubscYbW; zqWN{N+D=t(s#J}XXP9KNUeofd`^#!o+4=X^O+V$(?vQJZQ?pwCThNWP^ z@>yEfrYzI;FTb>Q=MFmt2Cm-nU#>>6g;{#<{w$S|WxR2J&unY`kN56sWfrYlFU`EPYQdUVP&Isne{C42_jGbNg!Z0)uzntbRFzui^UH-G+5L%ipD)l+V7)#Ne>a zVrS~TrTaHN`1OkYP4p+%$^FlE9=Tune81w(nb#~C7*cwQPe1*8miyAw?<-F(U0b}Q zMvCG0%yRFfIIFk&pDpSByj75)!7k##p8w~9%|mQ8p6@9=^Y7EIbEWUjo=mQ>`YZVS zi=e0Snra4y7tLY%-)~1)eO;_RJ8N3haT%{T{)X$Z6|42{-c0bGp~6t$9og z5B`75om73GvOa(H`d^>B)UM~omZ-2AGJG=!Ei26GpRc=<`)NtzlFVzq3=Il*v{V){>|dzz#f*k=`c*W^sO7NdUl>m|)eX`RX}3=KV>awkPU+&iyx3G2Pz zte~!C8<`)MX8A;sSHL2Muxfu7P^LpAw~vP#^zRrmf8jeRt5$?cJBO(q9Hdw zB{QuOw}#FqjE)Qp43Z!lg7ec#$`gxH8OqDc^)mCai<1)zQuXqS(r3T3kz!zA2(Jo> zC<#g|S12gTPs_|nRVb+}NL9!zC`o2usF?Hk6AwpWn1;qF|I=qYp9V27D|725a|47O+4j2IXgSkfJR9T^xl_H+M9WMyDr zP)PO&@?~JCQe$9fXklRZ#lXPO@PdJ%)PRBERRRNp)eHs(@q#(K0&N%=7}%1$-CY>| zgW!U_%O^81FmM)lL>4nJsDd_+S0LC(X?`YR%c%DyO+UrcFO`j4>yYm7Qtjtyw}nu|d1PdfuAn zbbZMeky|I^Zb$n0YgqbDp3KBLN0{SCp5?Mui72zjt_eEA(QzurBQ{OYIXOwSH_dHx z#=F|ziZ|S)vgcPm-~0L3&)Ulw&t^W~`D^~gxx0;2nu^2rD(^URVT-lo4_yXr_5iK| z^8=fNSNVz@XJ-&&xxjTy+A{sP<(cx=S$CHokeHtrYBpDV?YB1Z%rifvByRI8aQU`K z(JPbn2luj-_VLe4=goiBy!9Sf0_XdY&r41GzPV23 z`l1^*?`4XjzQjMVhS+aQp0pVqv7FaaaQ$4BzVw_ICxzLnwwebm%zh@vx6kKW%9FNh z8HesfY(IP1;NIk8yd_uHCGc9@WE#<_(B57{4+;xF|l3F|GVH?VcCyn4KkdqyrPdlxE_rY<@m=I!m2%$t0+$8N%?sZ$ zte$dLQ*rX4pFz3?Kh{3vkBxr1;+vb6@7W)s8P>+0`hfQW3DvwoHa%<%km>0s|#h6RnqY!CQT z%UwK_ByOY?oQv3MzTwW5EyA0ml~e*}t<=A`W8K=xcR3VKCS)BGH$C^$>t?UOB%Yp+ zQ*Wg&_Z6J<&nIjhqsG*`?20E3NIuJC*py=KTSt8kc z$Y+XEqng)32jQgw3p#@|F1TolWGoWlG702jou$#rcIZTET(~Uo zaqGhEA4`AC;!jxcm7|Smy6~#!S{m-(_FO%ox%ybo?02oY#{S8D)oGkd~Q(uRBXz+)vb4fRjMyWNUgqQIb+ZNxszCK^*=rm zoIN=zc=PTAzSfj}v!=5%nG2lb78^d33vNa0~TD4 z`Telo_3>%`gFUUO+mkp&GFZQu?Q7d?e?Q~o*MA|49kdty{}XNT`;uCLves_Vl^Peg zUfTZ`JNLfYrA#^~aDiy?&m-qA*1hn&nd{-)7xmf6{C z)Bc{kePaC{{gtJq?qXtB{&460I%S+t)pkMB%I=5ZnFyB`)e(%WRZO$acAnDx{b1hC zkQ>z^weMC(d~#p!mlsGF{`N-u0b zXT3`IQsnv~@odes?aGI2i#55X*=j5)+wfZCP_6EzG~r$*TP}A$!y@szz%2ga>vhgI zUiGd2X}fZBr%R)p>%mRzt$DdKc)p)mdO~xxSkUe3H36@3lmZvHPYjP!-p$J3@bHtb z(<{Ch8>MQKM2!oDUwF#BwpshT-Fx)aX`hVSFMTDkSJQ3h35dL~m}jZo`o3+RPIcP8 z4Zalz&rRNRT)2rz_IPNB;_g<#P2SfzR$AY)M? zTyDl9dz7km6g4g!&M;fPAz4G{;Tc`usY zXkX78%T4Z};8MR+?O4XG%%WGTvt(Vd+sro?TNXGR=PWZjk(b!wP`!7;u5*%~Q~T9e zSgrgXTq?Y&+w&mbT5CyO+QhAXDIQ{6B{KE54Nu3EUF&gukX>j0vsJRW`kK+r$Dr^` z=HoqdKT3T!FGIuoL)8XK|CU@YJvW2@?nK>c8%2!^i(lkc#g=h1G-#)P<6Jr0cD>iP zj6(qn+%MJ^@$ZnFe9KwqO8YxDLvfAsGxeW!`Gh$%${h{ZAYJ?X-jrL;&)v^=SZZ_{ zKGBO%FEyK}aUpp}$oKq9_pHTU9bdXjo^$2fnVXp;Zx$~-s|HHV`<{J&m_4yL@bICmM?g?Q=ijXfb+-Mi>0jI@&aM^wKOhFPH_2Sv3EDyT=~E5 zm$HA);(zeO__e`}(x?|aoAax07)|FC>twR^Ow(!d|Mz@-;j5qe$`|JSVDt&BS3mc@ zT4H(Gbp@pdJyRaOdB=2S-`Dd&TURXEbgy*1&bjMx&8RmTR%m>&wn*G_T&kwC+#q zhUzrO&6W#p#&op)7U2GxsBxn?;rM!kil03jbS07t&&}wMG(WN2*rCy{t012HP_6EU zdpA1{{F$Y`;O3l7w>>1I+QTCLJ^Fe=`+x4u+$AEcQGsRUjAH-p@uz}Id{M(T*Zu!R z-po_FITutPII5Q0lpS817310%<`Y-R>vjF_h* zgJ(PrSn&9X{!V#qxt{_*yRVh;jaBZI4o0N#YHO%ZaHPx)$?ZOii#Jh zU*apob$|b7Jh(1+Q?%2!J*FDFzgM5o`q%U(OsAL0w(kz>>kmKO?OfjP{F`C@gXPa! z`6YYW=ltB?`skJW#N99QZgwl{Y6!mQSu;~(-M`&OUiXwSiXEE}9@o6*lN5`!bivQZ z^B4YpqHiGbM$F=T4#;7f!)jx1p1#+0XjK_s(M{ha(s@!GF;;#5KIb1Se`w2M<)>1z zTW%|83=l5^DSy-(kE!=mkmpr)ca>uV*0$<~uN)|Au>F_8^ z?bxOnaQ=hC=G_V9;!4WZd@?(i7Kn!)nz^6DC-~9)r6pTLCN~;dd=}HF7o1+=@c()T zt|lXT+m6>EEB~`ghs82BhXZfDI43r;n=o9qpD zsG@0dZ%N^Xs++X}lT^M+wf|iAMvud@O(N&LLBY9IWvx*RQ%>b|OkgpQUstMo<$whH zbNy5A+9tFV{9}@MEX6P*rk>9sD}RBz$EPC_*UOpbzx}oDv(?k($siMFhY41eZiO7~r{`d_|Ay{DS%+QO*w(h0Y;4CYL+ z<=lDkqwyV+Ydzv=2|~|Bu~GokK#B8Bh0N%Q*7 zvig>&9=rK=#v3dS(`_{aqj(OSK69l^_LJ3l-*2v$cb&XDEB0aQgJWTA+aw)kzB$<$ zH0$6`?w;4X*S|YAudC(#t%$9c_p@BMZg?!b=$sbA6e9zE_VW|>rgW4V8pyNrGi0Rp zm@}!C8<`)MX8A;sSHL2Muxfu z7P^LpAw~vP#^zRrhS~-ORt5&A!@kc#(U6;;l9^VCTf;7He>DaM21$?&!TD(=<%vb9 z4CUqJdYO6I#mR{Use1WE>9gP2NHH)lgja<`lmsP~D-;yvr)B1(DwI?fq$*?3oE!Zm>f=FR^A+ + + + + + #3b82f6 + + + diff --git a/docs/favicon/favicon-16x16.png b/docs/favicon/favicon-16x16.png new file mode 100644 index 0000000000000000000000000000000000000000..b6452c6537915564814694ede06f05a82a2275d8 GIT binary patch literal 681 zcme7R@N?(olHy`uVBq!ia0y~yU=RRd4rT@h1`S>QUNSs54@ z6p}rHd>I(3)EF2VS{N99F)%PRykKA`HDF+PmB7GYHG_dcykO3*KpO@IhTZ_55Lc_l zuhvc9Y?{7VH-i|~V6L=H5euh)Zt@;Ui%bRv2A#z15~j(*n!cjCVVcovSvUn5nV6Nl zdgNW3_0tbCv9L3-2gy2A@<Fdh=l!IGDmG^<8 z_i_dXhAdAP#}J9jspn4$H3jgvTvT`FW}D#n%+b|B@W=oAi@SI^?>voMV&xTk;8Mv_ z#}o~jTMx2s3gtbKIr#P6J_atQE(;q0^~_@m>|C29r#QHpHnW|-zB~29%POgFi|^n6 zG5=XAyCGnIzs%7)Vi2BpnbV={h*Kv61A}UbYeY#(Vo9o1a#3nxNh*VpfsvuEfrYN2 zVTh4|m9e>%p|Q4sft7(l%*kh)Q8eV{r(~v8;?|%$C61qgfk6^vLvVgtNqJ&XDnogB zxn5>oc5!lIL8@MUQTpt6Hc|`>4B=HF5hX#19-8 zf8yaN4Aam!<$wB&=hGktW@T=@WNu+)VeiQz%)$yT4JLo$ZQbQ-lF=YR?K=y^K>C~ zPZ6CE!`!p~|Noy5vwuGW0|Q@4kY6x^#)ePp)!(oE_+jN6nRQx0c6ag4 zq!`VKQNFtC?+`ns||<=_@k<*W3Nl4W3ExaH~M7-DgH z@8#n{O$GuD4?|rxx|)1z+WY-p_4mK>Cs=LMn$^EE{O7sPGdYFnL4j6}#L=Zp7I%D% z@lrpyD9!Y`tT6c~`*}%~AAb8Bnv+)Mba64R zGClT+w?~aJDs4-5gskC;}+JtQ7y?}YgU`7c=P#R;t}445i|cs zBq3KOZ5r zLjnUtoB;$>Km>ODf08Hrw`Qx{Z;jT+zcpEZ{?=sue~@92n~r^Jvd;P6pv{Kti*F6) zGT)l4FAOsG;ts!N>+|1QETuty0Ehcfayu+tG+Uns#lyEItGpo-?l89_=$vnjHYbOy z`v-4c#hvyMVgLVYll8|T8}>;481=)Tt1E~~f7s&fS*7{^RZ*J%YnO$e`|vF|Bv-nWSfi4E^@_ORR#YuFfgFtGdYI;h$E{LZb7j zeVyfi`U9K$x!IU;x*ORKAhxkI&;L6mrUT{&Z0-lSixjLP%=!O8nc0B&fg0`y`PErj z;Q!Y~`saOo?$;9I`rqN9_wdJt6e{HlTLHD1_HNqPHewxAr^-|Lh*xY|H--w_aKxGXpGb4r{ z^d-3o>ZP^&@0Sr*ABpo|<^d%kjsbT+vGplG2Mb2{tBY_BxciT18W42D>l%yyjEt!5 zCQx3skmDt&m)7ZLMxZJ|H*AR2!U%hi`{NA72 zgoQIK+(GNK6c`v79FW&(31GMHN3*s1wrVq^|Mw=F4+CZQP_g%AwZ;D>;p%V0jHZw{`XWD`X8br^1s|( z=KtATLs*jup~#2AQCeGLY>{m5>?#&%H=`2U59bNATn7vf_1 zpJXEOzr;d_|&7@uPV&>AKRKb(7H2FJ&DgOa^%qMuX2$64_ZqJT7v~D=Vu40 z{@<6PN7Xt9*`3(zN0z5Gd!*ZctPo$ZpU$1!!0T zG*-dL03sO}7+5eJ^0nF8>syn}V=~gpqpywDo@DBU)#H!IuotEmD-BvZ16sFK=^*>x zNSfzAXze*@9VoGVr%Ve;aGM9TP6#w-1?m%l+5&|{uAhMEhpi6-tUrpivVY;IKiCHTPGY6)Bdm`bm zg6Tn~LF;4$I9dJ^6IOsB>m#2{R^Ef9{YPILt-QZASwA7&ew)Xjyx+ixStbxG0@4cr D!mjs| literal 0 HcmV?d00001 diff --git a/docs/favicon/favicon.svg b/docs/favicon/favicon.svg new file mode 100644 index 0000000..f20c115 --- /dev/null +++ b/docs/favicon/favicon.svg @@ -0,0 +1,4 @@ + + + + diff --git a/docs/favicon/maskable_icon.png b/docs/favicon/maskable_icon.png new file mode 100644 index 0000000000000000000000000000000000000000..718ef494420bca60519c538c428a9ae5e0ee31a4 GIT binary patch literal 34936 zcme7R@N?(olHy`uVBq!ia0y~yU||4Z4mJh`hI(1;W(EcZ#^NA%Cx&(BWL`2bC@^@s zIEGZjy}8T2BQ|uV{R92I-=!x_@DiFd!Hq+pX`%PVg&JMWix)LSZ0Iw3^dbC6VcMLH z){FbjJ-Bh~pqbIOjo}GPJlK~ut9%ivnmFTsao!Pu%kTD;zu$b_?zQdt$IP#8W!K*S zt;_qp{JrJ&`>Vd&?6KR!A)w&Uz`)4F0%0`viM>!~c=6(ARv$tTBwNDG!4Sg&Qw9+x^dJDaaTySX7Oe&dtGKRe#J%WkYD=*Nt|+a(~YKeFdV3 zk!dSO$^U`|p9Nyo?PdEK7#4g^U*pVFuXZ8-@ba%e1?$b5;T>OxFeavkHOJQ8v|*iB zGkLE0?WdOYvBIFPbt9j^i+`OA_F@+pCtq3x~jsrUr%sTNN&7GVS~Dev0QSsNFACI()bP zUokt`f9D!y1%?844wKjgU(@f&N7er@-7EMN>;`CnFKu90;1ydfoYCHJVYlq5b0Ft2 zGO+}Sf7t21(%++&lY@gnNTNxILqzPwzeV@M|Fzz=fx1sX!9gLJk4b}+jz>-FSAA}iZ@ zaHMD|Fq|lQGs`djfV|Jk^B%1bMGncVe-?)&yD$H+kCTJp*R$uDOi#IgFt4l$wuU;1 zWt+wW`8_c`dstW)D$ho5hvpojXaF^YwSVe1C#DF`1mx^a~3ufD9#Y?c(( zb!S}zL&9zsF{F_okTVNTRsWlNc`w6);sBuZAM0iu*cVQARYsI znuX(umIA|x(oetgnj7-}ZfCqH2z3KU(U$-Rh6~Obr#VE#KO`C+J!|6#_j7|oC=*k| zs+70h2qBPbg@gncR7`l5mUK19|3ymm3L8QjudQc`x&Q0Aoj%i9K>-Gn^e`<|s3V{r z*()Z%@MYGyW|nOV4`%;g#|m--RH~DUgF#5PXA>yAp*ChTHSpKv9h!1whob|-12q8+ z=L6;cP6upZhiY3;$h7ZI{+$z>^dcB0eEne>Kd<5cYyI<={E&PYqNu>I!s+TfB%u_Q z3%}9=UO(N=lw$J5ZJQQD#*-T&zEC@%(bUDs!O&G1i7eWk`;Z*ldJr^(H?f*w|D}CcBeMMcih?!oW!AgZ~6c-rbCA zxfrAjR8*HKJ@~&bcxHdG32_K0Oqkceps;u5iVj2wH1-L9uw;-mzr<#y!jSRc!W6W4>f+*H=<15}2S*yn zQ4I`@hnVV^78uNAC)yH_Z>Q)fFlfxZ(uPO^;M%2}afg^GHwQzOT*KpF@fYHPYyU6* zrUcJY7s44i9pYJS@0&9+I^6$bbN3_DKmT2i-PbrGd^VGVgTY90iy3NMIxTONOz(IkLQQmOs0fA4tjtmptzbV}p%lQ8PeZ7gSNDeh|b6~hI zBTy5mECU()CC-82LbbI&a=a{<&`{1G@@UhJ6h=melMA*fBWwZ%p(YmxL(rVAS(5}N zoKrJobA`Fg%IAQ6YS|43>8pJV3j!Ypp_Xp~FXlEdEGW;LcgoShV)o%FUp+u(fgPwI z&B*9rw)k2`V&m7>%D=V-p_a`i@eT|Z{z$%BVAS|kP?2Fp&-G(qZ4muiLLC?`gyprP zmE2Vf3$$t;q0V?%d_jV!woih2iBHCsh^>fsEM= z3=1T-GAx)e{VJq9ahS!#)L`;_kropRM~IdJgT^s!290N_rl68TKw-kN1_p(*J6Ciu zFfvUA)hHjiklG$gG!+;;iuG10IW#ydWnyYb+QZb46c+~VL}YStFkG6`y^2FXAz&rQ z+V!K>jt25*lA>+~+Gwa30b2_&nukYAtkLp$v^HX78m)Ur8#sfxIaij&@Zm@E_T!Jg zukSqme!r^R?t0%p{|;Iw{oQr^G5>41{;&R9{{6Zk|NmFTn)vTG=KuQ)8g1v7kon8T z^Y3!}Z{C_u@7Z(zoM+?dJGfZw_=Aa)&Ht2Mc_Lv_RP^Pw{el||Yt$h9cP~K!hAD?K zgqc`4OuQW!0&?Pfc^RVOAJ`W?&wu>Tx?Z~fUh!eI_&3}4eTe_xUV2o)E6O(G$Ps&1 z=H`DAJUp*wi7Tt=c0HUd=DPo1vzOILGf1oXKrkx{!#ie1CKe+R0R|E2s#lB$lC$ft z|8@O0IsT1((eu!||NnKmztg>zp|sk(jj?+-bEBZOPS--=XDUH+jld0ahhkP1hO=|$ zp5hcxxRA}r=wP^O3R6RAzpVuSy{bT)g3mh(|NA~a@^`Z1<=gQaeCP6CgiIMgyRHT-%r*QbG@@fHgU!_gP7c^Kq&{+?A) zaMtx>!0YaRSD%;HUwpsSG2zD%R_Q|xnbpTmtlWM4gRIyhMM!vUQ&eCmumue{Eo@*| zaO1*lS%xk9F6{q4Oa92M?79noUH6BdXKCxZuj%G@SJ}-sUNAXbUgU83jiu@QQIOGI zBS8U%6r+q>Aq9sAD?y!t?+axa8}xs5pIxH9+WmZlWOACkNb++TiN)#bUY%6F1|CUi z>=P4UDEU%h>fXT6s0*6ix!bdfse%1^jKKGpzqR*Y>YMe&t(CiGy5E{Z!ut0C3FGGn zBn&E2)_?mb0Pd+|Y-(UwaPo4nH6s&Cm8JrN23vRzaNPWpC?%!UzxUM?>G0O zTpM?ZG+tY;D6{=@qG94iLBqO#o4sycRs+ZC0!}8T1~nhgUKS1kjYtQE0G=&93<+<) z+Q0p`=>I$If9iGrFUTI{+OW&0QE>9~GImB`F}aI>7dAm=li&mKf(i}^+8~dIFW%00 z;4%Llsq(mAQ{U)J=3QcPf`8d~{B}oN1rOph#&K{kR5d;m1SQm1 zP(p2TWp218{%?EihnYM6Hl25Q{eJH(RfCd0Z{E%4co9{T(sQS9dz$F_C~$Xv11}?E z!)wO|hDIJ%7KWp3_bxLW5dU{HX7+}vPjbhPEwSwrW-&>O$O4U@HNNHIVA$rJ!pO+P zV&xCAYT0dWhMI@*XEt}PW@Yr9Giw$oH9a^FO5!Z=B>w9fQ-iwPPW8N>SJnTns5d<4 zwqA_Iq^hP%-J!wZ8xvE*oAnF~Oe{s9{4o31G^PgA^m>y#>-WJQU+gs(yM5+WpMU^M z$q@-tkSpJ?urS>0jXBK1AO3uUqLc3`*=`S}VjD5g~u7+wfoo-ekQse!TC{n*$0wb?cwcE^iW z-+0w0E@76KSI%LO*`I8^FPs-N*yperl;!5le+9~Npcx6nZR=F^yLRjS&f3_%=A2)` zojr$>Uai`GWX9ZYr`MJ9f_kzJ#w;uhXJ<^-;uKH_Sk=I=AjEIB;0>3A<5Sg-U8%h% z)9miA3YnXl1e$&@@4crBgzjLnlRFYGfc1VG9Z z0=gR*7KoL#3n@4(h+|}Q*!$1#e0ai@FQRwtc@5H*|NZQG!4j02uBa(6tmwUWkcC5F z1t@*Y-#eMpWq;jW#RFSv@3TQ>5|M_{6nGgK9i)l_T<X44B6AUn7CJ1|_Z%T^aua8QtBWOOiE z9Kg|-*BIHp&wSat&*3JJ5)(AY;8mIH*TB$d!pg#sdCoPolKahuH>!rOCI3q_xA~ut zcKQwq;((bA3=52+q=gk66k-_}9d>OFjJ(IBTz*G4&GvDvVcNBQmCi5bfyPO-1O*sE z4rK*1v2ZNWRbcR_wp(>Ndcpq#ig)cf4N{MC!qg#+nJ>{-VDPAS(^9$c%ctR5I&*~} zXlABy6AKGNs^_hC21X`cApr)Hj0mr@Q3;nmB`3WToPXw)!)LI=<~1-Zu<^DQRB%{e z$i&oetjB91OVXdF=STGPe{ykx=Xy%187c^)3jFW?5mbtO$b6ta~WA`>b`62(j zcR@8s*^A8$3=7V;m?=0kID7^r(b+S*I6)QG>H8Ii93T~tT4nu98;=IWq{DMvgNz?7 z5rv=5Rw_e6pb9igXgZf2lqX^s86Aq#mlrYVHio{hlmO*^4gn1v1qKbDXP{_;4NEKJ zH!3DCJ1UpI*D9aoE;yScGBP?O8u5b?|4$~ShG*vk*je0s<0ZZ0zX}V0yza2zI1^KY zTyP}FIp+ig7)s9Rlup|2aQ%_^u|JFL=9@RY1C=}2R5^ijo8S2=dx*z2#4<7-DC^V# z`TaR32ZL4qGOJV339sz(J0siw#oprpF9<*{=q^+mUlnZ3{Jq~c&F*gq#7zmSnV1-+ zgHop?7YBop%&uvh1!k1Ks7`)mS3lKt{VZ^S`G|?B;ZfQ=kZq4ySr~fd7qW5WgeDxk z7~jXaTgDHRk6Ac!)D##BG@&)8!r_J4meQawI(}&ST*<@bH&kcOGxY+E-rEWbFnl?4 z64X~OnbN?pVDYh)l1#HXd*&7=lyh8I|6joh99R$hK@MwVU}S9OBI9}w&%bEX0tl$0prBi*~1QcaRzQ31vF&g6 z98e}OnYDyaP@9f2^Oe;X|bYs6(+)mRz`8gvOgOni z!+~imX>v7DKDXbiSb%Lp+C)*W_duQD4kr`KJP`?lk`f);cgGEDE-7h%)LnSU#MHni zzu_B)fWihvv+_eZK?0$eXPBuvrdVbf$4| zFw8Pk4+YgsA&iU;E9ZFTn61f<#lpgHb;m7G%y@EhFiev3 z@9)a4-Cp))PIJ=r;s4w;TCH1Q<#l1Z;I_U}${H$-%Hq zeag9d`^1Nz7iE9smj3@RCwu+x%sZt&ukZT5_1#AHON?PB#aPAUfB%&*&W;Bc6BiOe z(JZ~9j6*=-f-obaga4FQ(Z--gqW+KQ_#gc<_AJ@wq-F7Qvz@WCrM z;gH_>URL+{6VnPogZB)LaoijXRld(1L9Nel2ZjmH-W)qyeN2A;2YaJm{4%rBCaQ*& zp3mR^ce%lV=d4pWqA!Kj=_Yti*rw>v;NZl>)X>tlP=twvV+*KlruTB*T;rNck7n$8 z<-76lru}bjGRtmzHPL!~m$m-?s5SqN+8_N@y8r!#ce8Gv1NC4oh5y~MlXnHAAQBc} z*dYSS2%r+?*adbTIZ5kvRl(oI|F7MD{_ocVuRiZ~Zm6#NJ@=00q?h&IHrojVhwamw zSta5GDqCwoW$W4Vmq9ZfOBxs!{M)#7-|hRq4(1ZYo7J{%Y~oy@5%Sy-_PcI zmdW|}+be&w8QFVhL=>y`f!2^U8i6Wtja#5Hl~-7R;fnbNQ2+8xdc8%|{CDrSmNvS- z-@Ebma>l&>U(*e*>KHtJx%}9dzxU&cMX~EQ-Vk^>{Meks_O}Y>zlmS^>~8ox$<_7$ z{69WeD;{3ivv<3qLCK*x5#MgbA8k0OYyoOXI2>kWVc?Zt@Cj5QgJy~Iul)LU=Eze0 zzDoT+{rhq!y}bNdu3jVT|D(Tm?FAo%_8)ljyvAbLnu=1}cF5eXm#_fC6t_%eP;9z8 zFkHA7dA9c6@#IVI*5|xmC|eQr`Z`(P_h$rnCwzO~+P*nijmWt(?9H@Lswx$m&G@A|#h{5Nc= zn{>1rRJhO5R$$0@_a+3?MuViP@D~U7`o+mIxA*IR={b5^{Kwzs@*`9KSEktPcy|4E ze2!}-Q}S~;neMoMXD@x*EC?zqw}589>x$JuE{QRlWx_ihi={(yIpg`w_WnbMdw@336f@6_U7xW8GqmKZ-1!b4r=K;++<>E z*yQ>a)cIxO;9xiu(Vc)}7uj7hd}`)iy3a@jVM$|16=?_bUQ< zB#d^IOILth?Z?iG|~ex&nj7^|})`BscyLz2Cd=ar*S#8}D*)-}zMkU&#E= z`*`uXbIeCs_FP>G86)#>bzqoqO63Zu`v7VPoI3jL_r=p+-@MK02vB z8dvWx%ehneQgZ2=)XBQsZ@&HFPWr*e{SoZrW)>C(Ua4t8piUKN5u?n>z{}ryT-X1| z7+X5NLhT>qlMZ?bP4xe)xRp+swtjtZ6b|*3GCpa54g1H90adHL&q|uLO11 zL1R08DX(k)C#T5=oJ%XyjD4_itNBsU`So!&Mc1z`eV=={Loj&S(M{LqH8+9Msg#NW zL&k*-Q@k1&z%BRM>2o$+&rbTb+5XD+-Zud&5BxQsD;r+-k#*y{jqF;s>etW0657sf z>+?Z5%g=$~!j6fWGZ+||YQ+T@zML(1aKUinmzMY=8`jPJy=~(1+e!t;UFY{_@B27w z+nlMl6(@hQFnebAJ-#SAdOxUyTGPO=VB_LoQ2(b&UxDGp-q_bCUxHevHh-_|%YF26 z8&}NNsnd_fPOsm)HvL(_jRg;5H~#URe(XSEa&bm@KgftZ4GarDDqjJ42(l*D_UDla z8;z5$3)cxYyS=;c+t=o1Sz~+NZXG@AzX|!QD;(3 zRzIlQA|SxTJnf$)Z+df-=eQ>f`M!I+p?}Fgt ztM!>!tb808E+jHvF>S&|Crmq>(G$LiT_ z!?JUZbFWN_1J!gBnV1^-WL7T&HEuv_-abkjmHc@V@oiUe@_`3}N9Dh{1TmS{ynnLe z>70Jm(BRA6Gq=5uPJX6XfBTEs75@f?#y)WYhLS%Wrl79KSP~^1GZ6w+4pBQ=oCZjOlX!Crg+n zr*3Rt;}`ef8@Ijq^?5&UJ$aqu)wq_QF{f5yfjFofU81eP;8AX-rR>n)kP2GeeA(~D z)14b1yfCi%*D$qL@Wg2{5|S<|8D-43N1c$^ql>x&lk7;Xw{s) z!VJ`x&{beKQT1n*x`RSEBcsE4HT#q|Un2gsbua$EAknt^z^Y@MHlTr0d)5vA`29`R zeG}oHx9L-<;qOR!kBug#;HuDtgCT|)WR`{k!;702Y7H+NFJHEP*R%co{nmQ_f-c|o zSoCjV@bu&B*4t@!MuA2^7@1~sb1>Wit*r%hW?tO9Ain?6Zo{;1jJDA^p~`dbz$v*cO-zyEkw{@#tsRV#OQ zp49g1usr|M<8G=2cpc+51qFrzU1)bP;kWaBXa#pWKEu_WV@>s&e>+~pf9pB^Zud^* zUn@6v3QnGWWYhJz(dnG$z=iKx4i1JGUTDzV_;%s=Ia>>{y?AvdLy~>(W=G-BEJ-Fi zo(()ld8>6Se)Y`QaJu;P?F-;ltLPPL?)mJ8-und~Ka;(-X5p%BB8~C&C7w1_-%FRi znfh5RIDD^Wn(Q}zOW_xD85o&7xi}am$#gFQEe2WJz>x5I-(PmV-o5uWTK(deihC>Y zX5Ny9?Tk~5rx{wmmG6%Kx&LWSnmA|>L&MjBAwX(rFDTo~FftyvmTsDMt#0Fw8}Cii zXK3k$9=OeL>Y-NU;;<{Yd3zwWxGCQmJHwK6a=rE+mFoVv0Fls~1E6c}!NTCnH;ens&eys1^v4)-S>KWnQZw(n2< zuYD6`v3h0R)hnU-eUa^dYm3=dUOL6Hhj+pIEzNE|J)-%0yQ%|WYXSDJd@p?yGDlGeSFiff+5W!s^F4d(YwN4`tWw@|qkQ`G8q;I?6=h<3vp{VDUjYFI zlSD7jShK@PCZ>k7j_iE$^3`+q>`KYJZ5sLDQoXf-+>W1j)V2pyzrDFf2+*A~9sIX~qRJFEkK-R{kU zKyX3{c3=otwrnrR#R80s2c9+0+V}r<^0CYQxhGhr-sEev*87zd^SM{}R$<8Td7#<^ zG`vxsQ!fQ79WS%6F!;`%Q3Yy`G&L|J6d#F=`!rQz{{u_a7q=D#v&ilIeQU>u#opFS z=SKYk4PWZiKUUp3=WPJU>Kic*3=hIUn;x7&7CYbnyySJ#hZUNV_tMJo<>bA~@ z+s1K1py`X*{%_Yj4%_p$+%Ur>Jl%AuG^hy@;=pj>!a+^Y=7U;60fwAa=0&gGZG64D z{-$`)`LY!Ubf4Ggdp`~7=U|NYM8(6RV++AwkYVM%bg%*4dhz|yt=6j58E z9T+yO{PE?le;=s)+kO1Oo;Hp-#kX!m?0@&MEo64w%+2$^HqO}esr04jG9_q%1sY>g zb7*K_NVsgh;qzyES?f37g2bB-h_U{8zcgPw`PC}(<7*E8+m}DPViu@zgEEbGK-^^Z zx$KjL_FWf^=U-c+xN2K2Q+WN`8#_KdQ-`gJPe*Q)s;wLO19 zgKP`fL8F!mkxrl;EW!c|Idd}pJ04DcUw-durt&raPNwbuUI`ceEx#Z3sIM~DwB(N8 z#^2HFPOQ!Z?fy^*WMp($)Ep?r$i%WrM1UdZimYK~p^o*(Jz6{8-Ysa{z23&SuKJj_ z)IHbQr`$JRZ7w%rWMcUTN>6^U^mJ@t|LpPzotl^CMtfMJ-mN^qy!w2%w|%XH|MckX ztc_Eb-;rZ(>q!F7LBLjIgOYK314F{%Uwo(k8I{!?+<(=OE#1uJ!N%X$j&@%=CM+T)z0{Cwg?4{yDKv?I=CIaro{*vQ4(Ot*~4vZ_qKQAW#fC#iv(`$I`Hdj z;kT8_9A6z1P8QntTr>{q}$VrnoFc?;@6v~hAUnDOO+CNj4C^~<`!GWB*| zT>lDu9eB(Hhg}z{-gNf?2Fu1%jA1Ou>+bUT;}HoYE`{xZeU1IzIW$&t&Q5- zf2Zs+s!Z4$z3sNpk`<$HwVL| zdHt_IwNfX@>erJV*NH4nw_7WeKD(^%z}Neg-gm0rEw@^}(5&1j^LzM_JI`wuon3AP z?j@r~lYaeSSHqk~e|Yj6r*(7O`Lp@^(f4(q<|*|@{1#~}{5)Th`~RocKHx$1yAsZRt9;51(^} zE&+|qfLb&sir?*0b5JN|WIWKueWCuqgB!oEY@K@1cD=Ha4;~Ng3*&NieRqyLx8#C)yXX9a%O;gXVd4_c^qElxBSk+ z$7#pj<^S}xVqFQUyk~+&^1)kOPJqg$#DC7m&w@H1srRNkezz5>_%N;e(WLs=tBbda z*KcHwk9!jdGNahg2Ks1Z|8e0 zSC|UQtHF$n4$GRan=vv~a&s`4ovA;vw=6LMhATD<$3a66e2k0-*uFyBw5$6BEjA}I`P&rv&-u-NSt_j5 z>ghLm6Ps^!&tqSTED-{grYPg!2iku2&)Zn8WBKoRWjx#6?;a2M{cWWFf1mf!HY)q# zGp4`4_dPtC2`5fO zRGyN>Z_pj?M{$F=oZtd2L;>O0q$BxInkLbk_zzc<+9eJ0(YYilT z_t(ETXYpP>-3*+BZHj{4{Jd_CD+$}DocVI&@!IgGwUQIUm6b|I~w;sV)8@Y3q^sA?(g=Q>HT?eX;FXVfA_|R!s18r@^?%C z?>NJfN7?#2rv86_4iuGboHjMj^B*m$zqc2ha63+VC*6E~&KF0*-5>wo@#B{A`_sRt zUa0M7k=yn5(vBa(+SOaGEjr8U=6Bb&toEz^Mer~Ve1j?r#}!2dh8rvXZ3%wgUB}D@ zu5LUY95fX_raJ%Da!1kSp|4g*YA3(^Xz#gN<0>e>I5RRjv^ie~Rd_56((ezcq=Cdh7E;1pZk9~mFU`SQhv6o^A$_j|3}P)m;3L9-er{C_xX(TJ>kpWYNOlB zSK5N6mtoV!4h;@3nV1@SmlV(YJP|afcd0k`MkLeq+RtALZ?n#Sxn|j|8)wg*{~z*Z z!|l_zDi$pU`8vTHG(QDOPoVigGrrnmj_-S3vhPto9KGPF5>t51yAKi7cl*0-lHLZh zh=IpMH=hpxPe=xAZ(vyPjuYJPGzHa>i~J*h-kR}u4gWO*R(CVc2iN6eh5GN+#!mL~ zTXijU{onl(hN;(=WCigsLe_IUu_(0_R+zB2fg$0s=!_jtR?PUm=zLneIzvwMgE{5> zeP8P90ZN(@%z67HP%2q#l?3va26;3oUQj( zcj!g{g z|6I*aI&ouW4=5EYFfuYaFgXV>F*32-(p6x%5whq1g2avAt>5Q?Jj>8HyY9!ih`*=# z%@$lL@s26I)GB9n`Lj#28~NzaA9P05MI74jfsWhOP~Y82FnM~^6%y1HOH+zADr{vFBD$? zR&?%_pxf0mx4ple^i1)6=I@<+Dxj1AS_5~72UNdnC@|cpdGVKxr)&A#s`$3;j;EuA zcYI|3uYYaMS4D?fff?Tq{qN}Xj=$3`YXe?jfH}Z0ZST7~5{8wY&dXMuS;e~U$DiWl zw_EL3{hHBtul}dBURR><^YW7ZSs*`82K9qyO^X6`ASN|1B%Gd5JpX&=j4iw6f9k!Q zWm-4;^S{jHKmImvH{aL4OX|aG)7O*AL9^%EKzn|zL9w(Dq|15!p67*z&p*_k`{0)G z^E~Ujz2DjkpFW?@zKox#j@d!}1IVe3U7!hsgSVzJFfwU!b1-bPnR~7O|Mq)q4_qI# z{r~%V$J77+SY6~n()fZSNr5{G(6j z?N)a#RS(_Ff7K^TrVEtIwl^>wa0M-GXk%h(Sj)fn>(P2`mJg@G9~_gPBb0saSHV68 z)slPb|2I_J+AXhcpGLAd-mv0u{ zeA#ZY^iIm_IeU&58b04yx7ckHbC3ih(@ic8hE1}2k8ui|h;(4s@b=|-ix+bZ|2C9A zsd3%(_U|(Jz1Cs>AI;zNcK@1V&*eUzoU!H4j7{4%^Mi&zr+|u4&P$-t!VFL%xP4h_ z^X0mYKc?Q#zT|N=YSIDK|GTv0_B>rQsqA$5?5FvAEZR!Xo)&iit#0!GwGCe+Oab{= zi6)Cs?sdg;P)G8B z84C-;I#7!Sw5&F#{>A3`Uk}dM^l2+-RP;Ed$IhSTAJ*ydoy;O zkG~q(v>8;SCTKI&F&(%Hi{g2_cW*OPJ-foWI`9A2`XgKa7bmH2399Drj{7(lv;_6m z>i|&Oodack&4P62?`942EK3iqI&EJZai@Io{pk2(I^U~~>lzl^xM8$y6UcKMQ$Q=K zB(Ic#BDtx7VL^KECy*}F+N*oR>+RS5dGvYqJvX7Ru%^7{l||rnPblL|4(Hq7`P1!=F<)4>ZC6nq&O9cDp}lh6_sVE8iU`fY})ysJm1 z^4~3sjQP{KcUDBzB-8hQ{`eo~+r8K1VNh; z=a0Cl(I{PC;I+o`_2J%CmQRzW?|*p-w9fLB>Z)D_My5z^4u(x~`=4wKGV^(6P5PxbQs(*M3M0Z(*n=KFbj#;*6#vxC-If%GnI zU{E-{F?$w6;~kLR`~!!k*C`)6YrW=2^E{8Bgu9RVkESk{m*Kx#BbeQ>uuHD zd?K$MxpWn@U^)l1B(*0Bl<{t8C@^T$N$(QdtMF|9kM5)LUtA_J?f?BTv+(oz|Ar@T z&5D?E{#3@JD_49P9Qv4;8f2EQOJ`!)1eyeV$F-$yf931%bE-|F!Hw9{|NcIR*k2dB zS=w{Oub1p|WQ_T$!kt7l!K19(R1_Er^r5BZf^z5iTYhUNz58r;ad*4z)Sd(R|314G zo)5k6xon=FMhZ0VmpW-zfzqfu=qQ@1J)lziz%*7ChQ0eG_g#3oH*&aL>+=U?so<_pjKNzH_eKY(bDJD1XCNhk=UFeY|_W z#y!6l&A4Zla>4tn_q(RK})CBc! z_X-Ozd^z`ar9bcMTb9%2efTV4QId1te6#aXrt7t@eG6~@{2%sG(lYN}{euZN-hSQR zxA1ZL^Beo-f!1JnFfuwQA77RMs>yvF7%rIaSD!zx?t!M^;{(B`Zl2Mb%CY9((ch1k z$e1=4LFv#PV*> zll_lgt(OnKRcCf9Bw_mE{W6csEoHbtWwD8e1H**{iJGA5DwUIi;nbv_jJ=`>7Y*9^SwD6b{>Fs@gSobyutzuCOHYGR2>=|AVYQL z??4lEpv4c{4L;A_0cx`?0Ie}<Z`T?f>+{Bn9;zXu(44C zv@G_mfB-|t;yo{(-tXC1%)c(Jc=tDtgs=Mc0_J}|#M(w>2fk<7CAMGTnf%wI_iW#2 zf*RH>pw1)xMsS37W123zKy^0epJT%lRv*CWaELR z#pgRXciU`#6r2M-`XZErgJD&`R!|ixBrd=ZV!mLawO&7~`~T_utZVuzx~=b5fBpXW zl)l~mv&)~A-+?yKPOdMM1x1}R3k!p+kw-45U((UQu%ILCUt^RR% zo`z1r_o?Z}^3PXzK74Ky5R(9##s1L@S})4bsKUa+;MwB{I@u;;eFMXSs`nd<`FdF0 z>s8r!z7JF=r^Q~s{thyY{b^l3lb@PHgTsAR7KU2$Euft$QtAo} z8TU^_$xkzTePMt1Lg8my-e2JH%c{Lp|62I}-doBSeyyv2z5D;#`Ai>_Ky6UiIVGTw zxX#4X5O?|OtAmP<)5_WzV!PumtbT60W#xg=`!%(9$_}P)*b=zl>%RZje*Xu}z&I=b zwb9bf`+o&>=QXIgv?%D?>D0+r?f)Nt zr~mK&ha-!3ZkgjVf9>{-Tk2M~f~M9uU@MhD)mSSl3q$KkuiAtUCp-;7E4G&0jSqaa zZ|;tpx3cT6{B8aJ*L?2X&bOwEmbdEvt?HTm{fyg{RUV+^cVk-v!vS7U^AA*HnY7*e z71|gaw$JX^`R_-s&i8-P>HhBRzeE40728caw!vuaq4NL6;DN^%5sZuu$NR!Sy^kBa z8WD?xL-B7y=8A{VpH->Un|eyp#0{ta0c9y!~sw(V+Vr)tgrD81Y9!yeSX zoDh*(IqfoZS<~~Id)9FZC|m%o;N+8CvkkOZLKn0a{(JI;j&(COeE4~B>x-X;Y2O%M zibVyb_S+Xk->E%n{%D={zuUk6cpK?v&pvv*&i>e$Tie&XeFGjIg&+APpl~6NknM-a<=eVqx+kni%-AQ zFqVK;hw+IDFqFJV*a~VX=7N^Fm)f)ONPay&pUXnY?fe~eHXg~FYuNrpyiLxo|Gr%R zm;8>Od)&TF@V@BX|KGD`)<&c0WnVoT7#h(k?u>W25(X(HJ+t;Hx%uALKK5oy{3ZKE ze}A*T?_j?cBfx*RD$}Oqw(7-S>;CULE}x}Wr#96;s?O((?W4&vOIG_bv2Z+5RbV)g zeQy`2xC9NI6ze%@3rN@|r}oUOP3W1oQ>(4?tqgN}-^!&2*~8)m_}AE(%f%EY+LYX0 z`tift@GC*>&cD?*yk332Yhv(Ux2}DfRiHVnOtj+=g6`cimp3VDm$+uC-{yN`r?tR~ zf7e?o@7BLP`?}Npe|`0LspRXScNuHWAATJE=fvSoS#^sWo*NDru3y5b(i)^NHHcHx zgE90AYiG!h0FA8G-<%hE{Jh}x)Vn#P@k%?((p3Tb6}GZ2?bxy+Gjp{Qr_z*=Or|51 z6D`a(30wCq-*sJXvWU!io%@^5$9?~^PNY|T-|sbB>tB1!`@R49Jj;N2wZBe&O#j;d zcmI0#`VRq;vFGYD?$=Lyd|s|s=H9F}mTmVxEG)X&yWRB4#4u1LkuZsgslhYL3N+C* ziGzb-63?n;v-IcT(`W8%Eqe6&m67%SfVAgf(`Wv?np&2Z_~+}7i_Yh(7siW;TfaD> z7%d#JJ+*x2t7-bver|of?b@t5u$iEhrJRmdpkXK@P7VemU+?uSuQ*~pZu6hU9slv2 z)zJ_|P&pOH!osk3gEnX-R~;)0!{1-4{T7%uUR*!x&fj(Cw_KYBG3*c%Qv+wSl?-S@ z69)%_k&kCT%PWo^JE2YAr|C~C-nM_2pJOP<+6AB^i}Js4fr>qQMn;GFZ(70`z7H;4 z|L<3MQQH1aRP-;fwS1t;VS$wjXzjST0K*nL#lM0plsDA9zW1^B|1+^`*ELsgfokwC zS_%v=rp6b7N-|{yh8M?ULz&ic#{B$TAGj^%Yu~k7m%yE_63|{Ij%$gaEW4?JVZqav zFM1th8@c0uc0cXfUbo245aK#c(6~bK1<=-vS6mznuc}tNEii2~eg0Oby6)@e)UV6D zqq2SNS-F>g9Iy?6zs2*q0;^1J=QUH&4U1MQkSnKOz z&+>|6&FxLqH820KD%M*Q8~`y6RB~UjFmY~RXtZKtYOp%DN+84cf$IA|B|9Ia=4V6Z zXB!+;85tc^Gg3kBoYcUuU}@%yRtMR}-0OSSzuEILxwLB~cy+HY=-e!sZt&>J+6ION z(edu;7iJy!wYK{B^nd5q-@Ox+4T+g9CZ>k28(yH%9#KX{2kprh*c;!mJ`2m&(Xah} ze@d_Qy7&8LaDkeZ7q&DoEO_}b12ms^mxF_0S7B)glP*`x&u{kH(Q*IQiA7%)2E}2B zm;gfvTR2FWE(Zrg)Ql!MjuQP1k9+sW>s9{EFOTjy zRaR1sVyt?*e%U_#w7q7}(Q98^KoycLCkI1SQ#fegqn3+<;n$V$*$&^CX6x5q{!#qj zc=PIA`pZBgWE@Kb1sIk{PIcoHP%yA$WIXUhN4C=;n<-m=N70{0^=B)0gQFT0Y@n%} z=ZqSlwQY7REDW_PR(md}ZoK)^^s)H=*=73{{!Y>Yk4IR6Du9WZphb)6`U(sd)z0n; z7Zx25&HtOS^TX8lc^ge_!4v$9GYf}6#LfnWgr{j?0vUk`hnHTTws(8oO1NoU z91K!2UDH6`-rB&hAUpB6`h~p*UY)f*bya@Xa;Vb|T;bqgSe7=$43w0ga&s_D%YQnP zB}!z*%xI1Ee@{%--L^~}6lEC^4h$DQ6l?*lty{;!!Vr7XO0V%9YufYh>DOy2>c6*! zfL8~v6c%9cx$BV&>hz?G2{6pLdBT`ui-y7eZ+D8`zPG!PlwAdGGqEr+HLy5eQetFc zQPWjmn6YKWW5E}335k!t6`jq$ce_?m6ja0{WU;a^1Y1W*D?2nC0D1cyAJa~jYxC+W zE3dNen+I7t(BM!E+DGNKNRf$!qXe`-^j-uj(`2ED{iXSpM}Pk>4Qelz0eL}ULjyy? zfy3KNnONGi6&NJmy?JXh{Xm=ddfn>$zd`Gkm3o8H+*wfWk?lPO3bwfo3=6EI-PH^< z8@a#j*}Lb7?EG0*9?F38Hirmf!(@;KW)T4fo`M(K=6F3gYW_EH=Z{_Am%obK49+&7 z<4ylczMR0o$RsQ-z~D3I3L~eFPr~{2e`0TL`Mg}M%!VBl9E?n$S&QeOw9KZVz##G9 zLhjDW#;woaYwfOoxHL-Q?oOL6dZX;_?^EYy+g*b!=wWDl zDJa0;b6)3d3j-t5X;6$UxK(oV^{K|+|1)pq&GSf@#ALj=IQ97KeC^xo{~u7{e;onx znZtuEOiT>wpivr-i+?0CY$!aQeX9KbM}GDSu^UD6nV#p=m+pLX?DnZ;;`{fVH@gB} zjn~M@!N6u#a9h=(;edw&!-vBR3FoWr;=kRmcCUQUcVD|*?%yuq7Ki6d(d+B-Zx%kz zO|3h->|C}cINh_%(^g<8u!H&MIXlDR_w#IvHrRaNm)GR4eJadsqnxv|?Z6Ax|1Vnq zYcPBOrAS7mS`H3|UjgBh85o&txj7i>Oc)}hPA13ye_be0@Z{wCFE*-AmwP6Zto;9C z(*KJ~|I2~Bw*YkFWBjLApq2IRjEo0fGB;ejZ?pIRzfW`Z>$db9V&G>=*EZO7^8Smo z`o**VRe}l)hDJM3FXGi|-v)-pc`Pgp`Z5eUy-yde|Ks`d-Q4e%TF(^+r`ea{PK6RZ2wnY z?lrdmKLzXmNe^F}yCZllsMuy`lou6XumH_K8#pjB9!OzsSQ`A|#lhOg0uL^(|Cd_% z>SHx~MVjyXY2o>G7gvh^`XwHshS(F2V!PUoGLF>}~R4_6+m@^)j^zCE% zJgZXI1N{5GzxO+QglVz(Kk>bRTiD+9zSIAve4XXZ>K@M2bGV_}F5E4g zqvDEiMDf3MMejt-rxmaNG4o?MKe#+H0Il2;Se64?lCN-K&w)$sEZ^#Xzds#(|GPBH zE{Pf9e`8lzse#%NDMA7aDYK@+N26W?hu|naPJi9Y=?T1ClH(41S;^2?P`-L_An|{NHYw zsweM?UOc>5e_x|re&=o(%MW{xSXVu~c74wF)obqWTE1p?#`zyd{~ePxpAyLN0D5Ha zoJa?Tf;8pxkaBA!OP}r5{W4Wgq@RAU5ZSR?rtVGj(-#NXPfu*-pSEeoj3oWf*=EyA zqrXr2Dn9qe`y=z$Yc2Nv13HreR33nalb)rCf&x>(L$lxuJO5N=b~zb#CUvLA+U18D zh5zTrTh_ht*j_z*rY^ViwyCYXw@n)ci+ zUi{RXJFkS}pNG%=Q@8NU+M6|xTK~1JWrGyy9A6X^7+x^OdV<0p;%`ui6cFve5D*;$ zS`Gj%S;3YnTxf1!SioMQ3Q85=>;!5fG&tlkGCJfIeg$(tDFV!J;0G;7yf76K!yq%k z7H$O{6>#*bGMEDwwdLSosB#Dgrzfy(uraU(9hd`m#;Aj#Q8gOEu=F~bB&ePw^d}xj z(o9tg+#dy=vV@us>jNwoj)>7obz^wI0vcg}6b=pvRxB(Gmkr%_zi>+Ua;v^XumRLM zg=gnw4h{?ktj=3NT{U=S7EmZqV`Mxqv*pj<1lAY^gBurbgSMH0G%avuv`;PTczq#V zK!Cx*6(ocxa}F@DurM%7Y|;hI)!UR^ECC~JZ`9k}ySzwbO4)=+3U@)i*cAulgD1T|z zs=`~K0V9xs3&I)m^}e23Um?g~!3h$8s25NOa6a(*ztpL$Jq-;E2VO#JDOljKDJU>V z9GH*`S|E&M3kSm-P|pjX;veO2<*8*Y56LA5CC-WD|!b}Bq zyY@6_Gt82|$RH)cz>{!dn+MD}kV2b<;T$8=X`vaKOM8N%Aq@+N1jiH5feCYFLn>ux ztT;3r05z<&AAL%JCL*xJnves}|A%Wm`w1V-K=Q(zKN2rrJYFKl@(VOoY0oUXL~z2L zWsva&uvKR{c1#a3UVOm=9AG-2)w4NT{_v_sg8K*OrOpemAsVoSaQ`8VUxCen*z4fU z#MCft*+TGM9(dR(T$tFvus}JY9XS&)Ff!?Kaxg^AY6I=@gPAddkFos!>^@7sn|dq^ z!Da!sS1LXT-+3h<475cXWXFVP2c`+tb(e4MWk|4ko)sR;t)n;1$e4@C1`!zo3KN_i z7$zk9?SlIS;+Aw(1qKUkyKdx~_d^V$ym+bI7SKlKax*KmDpeRX5YTg}5y^0gZ4KrB z+im}UE7xbpsCTnMvO}S@!TSGliOUVMMHqN0er$uZmSK7i3kopsq+croFWUk6#i7AL zoymK@TvZ8c1AAi`D+|Nhb8hJ?S!(WSU)^B>?#6?a!TY_|0v`(3^99JlYWNHL8n!py znm>`RUPFPQzziNap!JqI3QQcABO^eEOU;crxKgY@^*~7f^=B~0uyCY^2{5G0n+NW- zA(G|+BT%2M<&z21Y4HNd1E1E~fO?!DXG{o5NLx0=wfwKY)!u{KbQvVxyvPNO1cBrr z(buM;z#wsH%iFD+8l(?F$Iqa$jpCr<$Cjf+?ZIM(xfiVr;8~rKNn1>SVa<#)Ovnja zKw*Nv1H**;G^=xJ51blugfHvEbu_LN5n%9n8j%a$3Jvj4<4Mj6_w=G^eOHz@Ff8z| z-HH^&8PN%UZrwjS_qN=mchj^L7$Vk9d5%`x9ARQ=ICA)Ml~ZG2)gFtkiO}XJ#L9qh z2Zn&_(WXpGMdm9OOCg1FK)eG(!2K9kCMAaF$l2p6D+|NblcFjGK?hnH{9r}3Lp9U8 z@7M47l$aPYG9EahA=`1_6l)5Dw)tkzI!{Ym1B*=0ed&?1D`^m0e|2W%byinjr7mY zlVW5%aHZ#x8zgMOp@*C}to`&$tTY}_3f9+W6daB>Kmo8$vN zNQaS$MM^Y6XK7E}yiW=SIgE@4HayS&zLMq7;i*|Mv!G?cErAbqUed)ET!lfWu^n3g zTD1!cVKrTY;Ivaol6yNJIf4gT9@r>M2uzrh(!JTZ&+j}m#2A@aehCRMd{JGm*XYT4 zf>BNNCHU+VhX#kV#+fsN#P;5vU)fUi9&`)9-i=%=yF?{e8IIq*zAQS$9W>?u_MXCo zcn5|F^=)Mi4_X?kS*(O1K5Jaa*;D_o(DKQJV|n{wL!P-@989<7bgzRb0crmN+CEpw za7y?^%z@_*t<=My`DumbgS&mRZe{sSZ(vB+^(@nzrLO0|rPM;b{^BaACp}q@t^c|A zgTIw+t~qFrdWJ-lVt{+XvMGgP5A=4H?g>RS4KB1bFf8b`e9`2f&(xi|@l4NU23Wn} zAkDP=-trI1Uee4LkA`q^Ff7ZOW9F=&_MmCkjM<@(fI6VU@<+vp)AhK*2GGvRqA51* z2QIMOu_(w8-X0H50s)>6p4fKYnYCilb|aQ~`U(sMZUPD$j2b`M-}rYmPI4A_(KJ%tpfulu5~{Uq;i;XxbS~JJ4#J%r+WL@=#ibt2P4z2a~6ZV+e_D zMw+;1)D5F;A83Pkw4Q-<6Gy{gG#ntkve9rD4F|v!U^AQ;V>p!5#|Qp1USG0oY1xtm S9~c-I7(8A5T-G@yGywqD8u!%z literal 0 HcmV?d00001 diff --git a/docs/favicon/mstile-144x144.png b/docs/favicon/mstile-144x144.png new file mode 100644 index 0000000000000000000000000000000000000000..4af0c1e1a3bd0eaae86816d7fd09a9372a48739e GIT binary patch literal 2301 zcme7R@N?(olHy`uVBq!ia0y~yV3+{H9Lx+13>Rhybuln7u%tWsIx;Y9?C1WI$jZRL zppfhlOn`-$7E1->jOxJ2d>aYWxb~g0y^f zX!vj4^wqlQt6TSf+t#nv&EFgvzF0SXGj8~A)%4Y-8N{|}`fk(s&887#xJ|};}nn8BiG=j8PH+>6T_207bi*@r?%fA0sP2bF0zgRbd6j(QXGp~BC>^H@< z?YK>*W%spWH>mheRd8#Su`ic2&ycdrmUXC7^yp9tn64SM+9>aWRsBb^ z@<&SEeL@;OYSj`Wi6;H(U zqpTV}^D8+BYX#^eZf9oWv8;Qim%87$@G3jMtYzJMW#35}5zAOO_}O?Rc%%$D1Qkq* zuCwuoo0i!K~sj6DyZ#={Ruwc zp^VIIy2-l@vQBV{YUn2KVdWB5aBt_8HRBXkG0Hp7CuhkeswriatCzA*FZF~i=W|P5l(@h(*W+f? z$)o?2ax#{jef{&tt260}M`9yyFuTv;yd@sJ^n1g#3&L)>SkbIY4db(45_&F_RjZc5qBB351oq=d>xXGN-1=yg>7g~I}nj1 zKIIA1q8kjNs!c0aY*bZ}+9-Tfs5;zag`ry6o4sn^W*wmSwZEL2e|?n~So_ByEn&Ok#)Jho*6-h#Xm#=av4ahd*puhp5Ncy+XiIVv zYUdT_tMYg2*&@Mlyl0aH$77Y?hU!Jv>de0ZpTV_fv`q$*pDH*j_KJx;HGyAN{3o&QoqRez>sk2O3ygBQCBwM>ImHs`HlvRmdx-g9g!D`Ma1F0sJsulc&fU^#r8s1Ebq_ zg_kEw?8dr)kNpS;WQnz|YI`Rs z?Npr3l6yFElj#eYyPM{UvmIJlt*>D%&iyTOik{@B9oAgCS1A~6-cev__p~eQ@rlrd z3hqVS>tgp$T>Aa3Z?fDw<)52->|Q_NIkh|W!eQx@2h&11UTmAVdIrOVUS>VLSb>ZW zsgLF6EwC>3sjz5z=eA=r4yPnZ$?#Hqe-Kr%F3=FCzt`Q|Ei6yC4$wjG& zC8-QX21bUu1{S)8h9O1tO5hNjvE237_J_L7%7Q8eV{r(~v8;@05jl5NVszz|*) z5>XPASgue|l%JNFld4csS&*ubSx}P9z)&&g@h2XR!Y~buQ~syVcs>ncU{>bVOXe0< z7WSSj!Yr)d(qM8pg;{xXh{EX`S56!`b42C{`{@Rc1zvg#ufzpQJ~^3AWnf@n@O1Ta JS?83{1OTumw`BkT literal 0 HcmV?d00001 diff --git a/docs/favicon/mstile-150x150.png b/docs/favicon/mstile-150x150.png new file mode 100644 index 0000000000000000000000000000000000000000..979cfb2bc788d2dfa1088595aecf92d3a86ca5d8 GIT binary patch literal 2274 zcme7R@N?(olHy`uVBq!ia0y~yVB`Z~4rT@h2LF7{=?n}EEa{HEjtmSN`?>!lvNA9* zC?tCX`7$t6sWC7#v@kIIVqjosc)`F>YQVtoDuIE)Y6b&?c)^@qfi?^bOw$8=LR=Xb z7|a{K*))B%ZvJM|^xeAYn|0GSo2GA8&0j5BzFD<=w}uP0d^d0X0#eZY&8p$EZ3BpH z15*6ey7?!z4z?mA6D-5zuS~Yw!D|?{i)g!3t%E~Rm#KOTNV{EZjLfW(<{4(?51H9{tsB1zse74MK4s^ZHOxNE!YQDiag>!y z*dXf!8;`hY={@Oe}^uXE}vcBrUR3183+Y?bMFjq!KVq!ZcY>&7D`q zR3~ve10$nq&@3iaE?!x41^0GVZc!2KAicDMOst$@hH<7PcPy%2@GIDAL@Z}uWHK$e zt(&|@+&Ga>&XS#9M!~JcxbUi0%sQ+3j~qhET%wwydJ*DA3Bp>&pamUP{}SJCuNz#C8i~AoFJ&?A?H*hsOrWpATOd5Y*F)y zLr_7aEWVM*1cn9u!&CK@N#i+ zbh36>vf|6ChNh;j8=~55+)2!itkwV1TMB)?)qby?ymv~q-tRhl`+Ii9#^=lP^ztXo zy}3q*0TXnrRP&u}dOq)==?bx%XN#k@O}b~&bZuuPZ}cKBrR}|6wwY$!){E8scX?m) zmt$97-q74@YV&?h@zU~b*6;t6T>r4=T+MbubQro*T zaMpg;)lWR~^DafLYI|Nf{oY-La6Nbamv;|GsXi%sl6vpwmX$HQ=U;2?t@SWIDYJLU zcK(;TGnM13eowHQWVvbSc7DM>YG3zoFWt^Ram~ZZOSdOC%REtFw>;t4cjlB~%8Eq? zKFVDG)%E&>BVW-3m=uJ0g5`;VJM$BbJ^$Jg&Bb`-4U4X1TrcjCw0^g2RroRS`!%Oo z%8TzC}l6CaDdzOg#1Z>QfAk9}#<)v;$kwh3GQDV?^`>8<%K^SdWL zPD_2YAWB*C?KzE?Z(q-OoO}9;k?C>kiCHH9Wd7|wwovrdgs;vbyJg->w%@y6G~kbD%tSAR_~^}*)F zzYaVX%s!&rUjL)}l=TJmoSUM%VuXIa3wrtXwfga!pN~&>W#9kn*NsM_!&^K4PwWZq z%kr`H>uXS*n7w1dT^1Z*%Z`^A*?VR1jqTXXO9-mm!F#p`1fRCT`7fSrD zmz`YI<2Li~lPCH6=f{1n@9M38b2ohV_D=7<&HwJyWSx(H%3A+F`1kgX;J#l9du=UY zDb_<>&STMoLQ^iev?V7dp1Bxa^?Sm!NtVAn^W`tiKmJ6MMShWmLsfaRS(2%cxaa%4 zOL1Dqk6xNBUAn_%*|7uOOU=!tOJ=(C`qWkwhlNc)$7HHE{obv2U5zi-6+R8UWF5Xd zx{7~!=W63G)r*6^%Vk>ktFom$@sIHRKX30R_UEQKoqG=cto;pGtnyw>%z^<^WJ2aY z){~JpWDI$QO&J&%R7+eVN>UO_QmvAUQWHy38H@~!40R1GbPWwdj0~)d&8-a0v<(cb z3=H@_o)kgRkei>9nO2EgL;ae<6$}gv;Z-3KB|(Yh3I#>^X_+~x3MG{VsS23|CCLm7 z6>}bc;^8O^)6h8OfBKB)(;xZee9%@5v&}!U`@8CWlj)l{bedoW618#E~;c iWR9?(Ztz&(rN{6}T(IPmlj&5D7d>75T-G@yGywpWB*v5g literal 0 HcmV?d00001 diff --git a/docs/favicon/mstile-310x150.png b/docs/favicon/mstile-310x150.png new file mode 100644 index 0000000000000000000000000000000000000000..7a5b07c66e40c4456a751aa5f97e3c99bf997339 GIT binary patch literal 2598 zcme7R@N?(olHy`uVBq!ia0y~yVA5k?VC3UqW?*2Lc_GJ*fq{V~-O<;Pfnj4m_n$;o z1_lO&WRD*ICx}CB+b&a6Si76e$kHK z%*e#d#w#ghm1kUVMbWcMK-r0rnN`v}!>s%vGdr(!<5wYdFZ0T$?EJEZ*{4}J1@tqH zvT_LMRbBK zYF=>&Dk%9(&`H=PZBwM=-Onka#x1U+pMFG0!<%2pK`nT$Rs9Dpac#@Gcg$?uGWO-d z+JOeyr`UKUOiS;og)U&>;1|;Hk+Cfi)sIy6o1*B^A!Ao+T6SMVH`Jo$wMo%+9%&;k zF---xR^8;?oWiPVA@dbII@QCMsQ6Fgm9tQAZ&UW2ETR)4tmSW6_g*7nnNj{l^U7!c z|Nm!jt9!!0z+h1l|&yUYs zzU$S>f7e3t&%ZgNwVDApxNvIK>b3ihEivsj-1=;Zsha=HSyjPdx1uh$9oshLY1{I( zbE~4mPFcxIt`GZ{e)nrozEAb#>+<)bx{{iCgWvl^OV^g{$=2+WlwN*sR+*V+!0AnK z%a-4pZFcRZiL0*b#(!xm&6l?p?mHEmSM=&^XS8;xuIt9iS9dvQPt%(|b7i@D)~kYD zF>QD5znyjU($yf5=q2~&Ew~!|Y*Xs1x16`MQuQ_m<@;Z_rdd35N>z1}P~1zgqh>3& zt81j{x=yUBZhGR>5W_Kno3TjIL67A`E5l9!gI}6=pHCLu{M4wix6bRkuC|@(bWR_r zq=GmTrVb>*wZ$_x-~Y!hWAS}KvwiJ}g+((BqMjDrNay?i=97EhjPfVX`zD=kxu7(C zG5`GdYqFnz>Yqqu;&@*4rZCn2`22!JF`LBCExqZ;T4>6}M?^m0i!)rJF6VJ|+Y@Q;^ z&##M4hMtZ&XZ2h9`5de2i#zYztUf;Z{v_{pQBOa;{d}*!?4YIXJ&_2N={{Req^9J3 zP5b{-{EE8X6z^qGPl^I-lfE7OIC<0}P6nDxUv}O;);8$uQ?{K?G-jOsct2licj1)T#ziL`4W`eQI$jrW z_GubeO1C$8dsy*KUp-5%XGPVIZ^&Mad3I9O{a{Sp4U4jL)9JgPOj?|vS1f(}U0(5H z)vw=JSc@YsS(N#kPH!zb8E7zF-n8%PJ+>X;VEyrrZ!F5v`+gdvUoJz&ddDp9difRJ zdu<&L#>nN!{4O+|KK}$rvhJ3}w*b@Wo1cOVSLQeG1-UgHY~ZI^Z7VIemM^K-n=a#8 z{L}UDmBm-1+>H@2ctA5OI>pP^l9O(QF?VjdXZeugY34Jv`%!Mx9+UX<#^qqm$NGL zo^Jjs&sg#9=dB}uYM)G6F1B;Z^8Epl6(5)WI&ix7n$q-jnUlSLe#yW0pS59e-j3YX z<5G`W7@J>$PcKC>pL_b`y7JZ&OS9Q#pO$~# zk~Pu$I!ke7^1t@0MQ<-%*DV?}4?H*Gwzw0O}@5&wTbx6IoZQ*bQ% zAt)Rc&%Y$z_q$=gPIbb|`1_HH(|-Rii?9*fS>iW)a*W9O|9|E4b z?Iu>G-@2VslmCwI{mWfTZ=21x%=`Yjt^9*{$@kp-N2hK6CM9({sO{UVt#8Y!m){d% zAQ=Gmp!pwj*NGc4N|J#w3=9maC9V-ADTyViR>?)Fi6yBFMg~TPx&{`yhK3b-ZoOn~VP#?O$s)|c3N8&Mhf|o9H-{*k pzH#NmkuyhRj| zgW!U_%O^81FtC?+`ns||<=_@k75w5L{(^x)da|dBV@SoVw|6Ty%q^Y!{NwxLcXj#S zrs@cII4L+fbSS83Xl(Jiy<#!*qrB~ln%{PrdQ5F#oSszWw*2_osmEAdT>?*MZY@0G zCgSA4v08zJ$z_vz%Fdm?_dd7z%&sXFDO_~^@7>RHuCMO$5^eciGjI8W56>*4Sr|qE zMhFCiM80C&u)Xhp(7kD;-(};w{;cqtr+Y#vUO@1-`;i$PFK+zR7Pu%Xcz1VwtxkVV zsOIVLP^I0?vHE+w^6;+T)&A#|&UJN6R$4TrN?0UBRcT$njo#dy z8{Vpi&!0Fon7`?{QjA2YSiNz6*4-Q5-<|mMSt+URm2H6krw(@SiLsZg_kR7YZ9ju| z**#`|^%#lJX*KJ`Id z7W~-v;k;^(SmnHF zpFZEt_p@c$b7SI?X)#x7!{l!IDn=!k%od*dPfMwDsrc6#%}qaCUdbM~cUoy*$>Y|y^L_R<|9aBL zt(^Dr=w9(Iu@$kEM=ZVVZvTFH#d?MRyB!9LKo(wmx4gaK)-?BdbGQC6&b{wt+ww~( zM#9ir@131m_nTuMW{GKZ9n?6gz4vy<#3w72+>Usj-sXQ|Ud8Fn8I6xJy1f1*d{n)C zY`L7%Ujeunr&p9$$j{SS^lDn%o!?y@f4)DQZ?3V*=F^)e zPv>X;j(w#lGT&M+L#NQKd9Nz{UAAd_?XUjNZC9){%pN*jU9)@t_b)n+ z9$c|*5Hzm;`*&}?r)^V`uwIC-SYg;J-UA+||5p2lRvuIdE&TJmDs8IPMm427W^KQM zGBu7i)?4iVyYY&%hFW>dimo=VZ|ekf1Nyz5+MM&TZF(f67veha`SNA=7*r-5e;wq% zV24fUkqy?Fk@u`3Ufq=wT)T2RgXfpfV_STq3jMCluHrcQxR3krI{VkrQj1t$MP_G) z-!EM09^iARHSv1DsrXq{%o8G}$`62>1@+ zJ)C~@%oX8=CuvLN91JYpcX%znF8x$X`p`&^OUx08eB+a0hI)-!0b z`oBpjEcWj`LHl=t>3{W(ZQF12^(FHgV}DUb22M{GcKw(2qR;x~uFq%9UX=d1_Tu)x7d!SC>DcdIm>RRi zH&#IQGGF&b_B}SoWH+eXTBhSsd&_}WK+nO&h39KdcP{@QExG@n^^=ajdcDZ#M)20; zslTlkXTQz8xb@q%8zsM=3JPAlVrY8oysf61zKyP$+@Dz)8Isd~O=4I)p`g)fT6kO1 z?^W@~kKNuUYc03S?30(}&1nbU>2CZwZ*}r(+i>@57i5H=&6Bv?R~7CP_oMBE)U4om zt%NB8dI9aH{?6U_a9aMcHv2kbHmmE)=Y8g>tW?-$Uy++r|KV1~s~JKdU2n?IL|(M| zc;L$Ah9fQ9S0)zKr?1)lQhVdWXX}p!yzjeG{Ov@-_iGX5kN@|5HLq1&CRdnt#_r>t zjM+B!Uv(4&A2NMaIG_Ak_I|(V^*9OU*x5nrD+`wgNOqkqj}wf3_b<`M_R*Oc#iv{^ z+T^9Ziafv}tQWv8x8s-X#r>Z*UNLTSjnh2-%(`Bn|Ni&-v$3Tg8va##@_}t=((-RVJZ@Lwv!quX(Ye-($*(*6jS&bmBDg%I6HB zYB3G7riZsBz2%MX*{yHAb3*y_hW{!t4ToMtZ8v)NXZqvh3ibY-*d zyWjt2Cmq(k?_tZjg6ScXh+mv!S9^V_AIQur!3~LOF%5^Jst=1Nf7Q3M%8BRWT%sP+ z;B>pu>bBke=qw7ooDzKko=1AfX4LHi$-~6Tm0t9=LSD> z|2*SmU{+3d+qIAW|E8UCDChZ>)7yBC_u}^4(vtjr=BH}suAKgUqx(8bb6Dc6;`+eU z!u^4#H&;0M(!%9OTYj$Z<1CJs^_30&_AC8MUaY9K{7>hc_^+>T{JW5^tk1v1ZtZiE z4cWw`1qA8!41zJn(8^2^v)Dx|35wd zi1+z@n#<(>&a3U4wmds$wt#Wp?*N&<8>^GH|nz39Iy8_aL7{B@=M;bYPI-Hq#fSEe(Zci!Q! z_mr36^C_u?FQV%Oc-JcbUUcQywT~Mge0hKDk9nQ#rnY5Q!XJ4~UAXT?!RP%;<}upv zKV&L>wcvWJ(B}BcJeO&zw+(7PRwrNFU1#^`;g=e-dsUfJewQzu$7sX;kf}7|oaX7I zXCLMLY?YOi)Xvm~%6#1SzvEfq<{zxJeGwJS}ODLVFDS$paK zDQ)-Gu1>ms%YNBBMjP&jOrXBhmSa>Y35^BoAEX5MLq8zV93NO7%Az zE0_PBuVK1X{cga!`=Zui|Mk8uWtiu-!$DTU{(Gol**C+L>2Ee(>tsLrPkrw6Dz}{9 zpY?rq1r6x0>7aPF2bx)* zFY??-4(6-(e#NOD<$U_ajD0`ePtLoc8Iuqqs27m%_Oh7k?<=h<)89;f*?oWZmmhPp z^SbsJP5EWSu$xm{W5dM{l^VZS<(_KFm_JQ#->JX57p0&6yHcNd!|Z}arr8GXudY<* z=|0(gZ_1Y+cctHX)p9o6ZQ&LP3Crp!ES|P(o}rGKevR{`$L0BZ)W51SlnLtv1mp(u zceXw21C@lwdz2SfzNtIecYp84cUPt}-0M7+hO6M2XAD?w)Is?Z; zrq-)Q9}ip+Zo4`o(%n5Ja?|7Qx%DPrRT-RiI4GtrZOice!`gay?UgHXXOowyTi5+R zR|++6<;vu&6yCEd(|LAJ<1C&eTfO4@$1BVETM8PTva;q+s&We5qOzykPu zV-`%1vhI@9TdVng$Cn+CnHDz|G%{u7%$`x@6lzlH<6HJ-;Xc`w{_-FfUAbVR_O)e| zhUr#S>$21p_E7zsf|6fxh6ZNk`Io)fV>98`mqr1-0FR}|9_?MMp|ohBX6%lT7VaLd zL#$jH+NMkA1&A(PRuV5Yvw9VW8|yYftvgH5K_>>Ku^W!Yy(k z;QhBN!mAb;U6}gjhU?!PnH8poSh+GbERgrVe}AXl&5g5fsV|3EaVfxYzrcq2# zTlOX>xEd6+Q01|&-+S05&N%=4Tgvgg*(T;nr-R~|Kw%K}z0F$blg-zjhZDn-uHU*n zNp@fD{=>oXj0xrsnOIG)>{hPYc4vOou?;Vx%By+G@;%G`@I7Q&+*Z)YbbI5kT~~zL zjz0eW-{|E>>ol2}zl0!pLUwii?5aZ>ZhSki{*tWC>7+AthgjXXA2P9S`#e#4(VP$6 zobAr{x3w=$zr6Qk-+jB%M3Zg)UbT|ooDq?_L4BKQ-K^C3+&y16EjcbwY*;R!7f@gw7C-$<^wjT1m)+hk@4WZ+ zWLbM{(<48c{d{05DpNJC-T(9Tit)F)@=Aqk>wjcj;(g2)@#w3r!6^>$70k24>cDkd z`kSd=wf9NY-VRg0Yw+^Ies7Qgf_ee$pypHFPy6NbHXdiQx_&hIdi{w-S2-aw%xIy(ZTP(j}_x7O#CfowTR{GUVvG1`TpMiXlyrTSghiv(VYHyn#m%krpwy#Q`!oDjw zzD<3rf3(D8{@U7Ck_SF#_}DUd=&V2TOEkXsYSl^%8O*6)ug&inIp*ZE^prvJG=sD zyR#Q}mxg}H z*=24ezgxA;?$d9HH@D{e+7fqRPOx6riA`6G8^jf28lH!|d*74GA0vEQZpX9r|7x5+ z&(JX4=Hh&M$NxWjnRh3xD6f7pwdmE&>fBF<%#XBGsxP0%_=fQz)0?fI9Kxrt?{Yi) zeBGPwpx|hkl2`vh?KtPSR<fK9puj#r}B{LN^4MXwNB0Ns~4>@<6dbV zuoKX8c$muTTlivT_^}<#eg3wrH{1`gYHV4v(2~#c@243RAF_k|8QU8B|FCndzH&o| z+wXszPuz>>`3p5#xC1L{Z z2B-LffMaq6F*-J%S7m@oNRb6xdo0AcGT!_e6-J`?%TSgX#SKH481j$}H#tRmZ`{uSER#Hvh<- z{lA}QWXMjh@+(b=^s)Z*w(v@O_^~6b>wWjKNiZH_?b11&bZn!1$Mo7i`(_m0X;;!V zT@q)Kb4%@f|KWRo^9w&j>vb>d(_HzSLD^-8gKS35e39b+-|CMF%KvconNeQ!%JTP; z$~$Xjl;4{Ecm@CZH9w0Pzs)Nbb(EDf{=CBCjqU!9bzjSmfKqq#``?u=ah|r>{U-gh zMK}BZaPg_XY45Ufqv=-}P#3E-@249z&!-x0$aa1ed45W& z;lBlw!7lY|-)FaJQoGKI^2k?=BIhr4SAV)9?Y4T4jlk2!d8_1?U%4T)blEoB`=Of0 z`>tL;I&Js5p11t})Y_`HFW=*H(eUw!8AUf{C!g}Z_vZGT>>HoBZ~rxKOMG4*pTLsJ zd-mcDvtRet&7LZi^ypx{urU9>*(bE0zKAN1&Z&Q~edFVW_uam??OtSbCH(4R^ZvW~ z$7FwWN!UMcnPKq%Nyc0g^RKFmZkncNHWVLU8u95=0H~L6SNdJoyWVp5_mBCHIz0cS z{_n-DEywNEwM|`uk6+1z`mF5uD7?iUfg)!dr|2l$Cdt*wF-{6W)&P~t%!?U zX?Sb7Zr8WW?xa@}^M9}2KW#dD(t_;ZCr=wCUcK&FF(rA$eq$visady_vvWFwg0oGw z`E@Mo%WSQ(Hk;5^z!(Qgvr)(1&#z(&aIfj(W(Y8Dp(b&4!g4tVmFI;Gs|55yobz8X zIuzYq$qpJm%DOSNiebW>}uBrIatZ$FO8->dm<;%|YfSUXRJ!tEu!W z=sm-vm)hl9?oFy?-zv*vORcCgD-*J@z&~64nd3 zdWt`-S+KCo<;lwJ455?V#pL(aMVd{i;y9`vvtrj%@oje}*nj+%v0%cd)A@TAy!~}W zdj6z+uY8}_QDO0wFX6`8ciHd$SG*Fu!vFA4M+9gvH}KSbDZ#%hw=*1GX5am1 zt@ioZTa3R7ylO8lJ{P^ir0&h4UI-Rx5jJ#)cD)@6oIiEkj65=< zLqgjB50^`c>ydRfi?q8dbd;h+Bll@_zv(+x^!h9)1qbnu&eLGb($H7{um&|KTVz{nC}Q!>*kacj7FyGn+Efg!vqB%&lJv0R~`C_gPTCsm=OvLICRr~FT!@q8M@z^u%zm&`4!EbKj5gjra@rNQKI3bXR&5QWn>uADe>=7`J@ f_R|d>3%v9gUWp5qd~!0K3JNe!S3j3^P6HG{ZTP2cRAf7mpAhe+8peYa}*YTfwNy79YJ<5%mZZayk=4T zQYUeTf_uA!X^NQ%)0R_zk;o4$!!)cA+4D8j7-dG!E+gzSeRHi46;seil|xCykg}R zS2Um0LvKrBTtdOD$v`x1>HZ2cKo_Thp@pBD$fe`ly`wo-ilY&OfPjmmzX9KE2peOrIL3a z6AQah{w4j4quTLXlzb+bS3cEA*rpONT_bYE|NsAsY~CMdU|`TJ3GxeOP%GPa=iA;@ z|2C^eegBcv+!UYsQ)SJ{@{-+mZ-2d2TC{qFa$Is_qWq%3hySlKFfcGCdAqx8G)bNZ zO0euDp1!W^PdT_nRQdV*wYnJ?nEraYIEGZ*dVA}6u&|>9+XrT57lW>@SsXWRH|ZVK z;Oac)q$3d+pcusBt*|X(5r;;C#|+&ovq7uVU?~JbH;&e!-l-I+aw&e z=T7HZvGVRh+bzLT3E{D|24w~1sm{rVltet4OiYjWzt2o$Pc33tTRrpOzQ1oYEfkmq zvb<+(X_q|cDB0jV>tZ5XfeX`v3>V{1#@!bxc;pIV%&ia3X`1|j;ct0eaR}?2CiXek z_-C4CFtD@m{A(&*(O~?b!LK=SF4qet_7Z8H^Q#&dEEZfysOa0tt5pA=$FM=JIZ>aP z!-=_P-6p$d*BNR!53wEotfk=dPtfo_bMCK)tmovJ4I8?DC9dTvILxf~GVSjf(+Wws z0#|eC1cva3j2E+K1y1-GUiO#Grs3X|9tN9AFLw~N#P3;)io4e3Xs4ty5B#?%%! z>+4}Ar}aL+k22H*9{zXT=KQ4=hI@Nzm#?q?uXy63K8J&rU77l|`d1mxSN^v@@LXS6 za^ICd@!VCb+-~iT+F$#8wfLVG+jjhF|Neaaq<<>+jCReJRc2tE#4zo>@}@?nPiGmY zy;q&h$TcIAui>u$iOoxk#1s_wqW7%TY}e-{nOgdVuiJ3<>rcJ(Nna%(2~_B_^p?YSc|Y3UoWj7s zpjzS@QIe8al4_M)l$uzQ%3x$*WTCkWnf@0dASosLvDUb zW?Cg~4Sp`!rVI=W;Z-3KB|(Yh3I#>^X_+~x3MG{VsS23|CCLm76>}bc;^8O^)6h8O zfBKB)(;xZee9%@5v&}!U`@8CWlj)l{bedoW618#E~;cWR9?(Ztz&(rN{6} XT(IPmlj&3j1_lOCS3j3^P6NN literal 0 HcmV?d00001 diff --git a/docs/favicon/safari-pinned-tab.svg b/docs/favicon/safari-pinned-tab.svg new file mode 100644 index 0000000..fb87cf7 --- /dev/null +++ b/docs/favicon/safari-pinned-tab.svg @@ -0,0 +1,32 @@ + + + + +Created by potrace 1.14, written by Peter Selinger 2001-2017 + + + + + + diff --git a/docs/index.html b/docs/index.html new file mode 100644 index 0000000..3cc7e17 --- /dev/null +++ b/docs/index.html @@ -0,0 +1,108 @@ +bundle - a quick npm package size checker

bundle

a quick npm package size checker

Wait...
A link to bundle.js.org's Product Hunt page; a small public display of what bundle.js.org is all about

* Check the console for error messages and bundled code.

* Every 10 results the console will be cleared.


* Note: Treeshaking is available, but since esbuild and rollup doesn't have access to each packages package.json, it assumes that there are sideEffects.


You can use custom protocols to specify which CDN the module should come from.


* esm.run:react -> https://esm.run/react
* esm.sh:react -> https://cdn.esm.sh/react
* esm:react -> https://cdn.esm.sh/react
* skypack:react -> https://cdn.skypack.dev/react
* unpkg:react -> https://unpkg.com/react
* jsdelivr:react -> https://cdn.jsdelivr.net/npm/react


e.g.

import { toStr } from "skypack:@okikio/animate";
+// or
+export * from "esm:@okikio/animate"; 
+// or 
+export { animate } from "https://cdn.skypack.dev/@okikio/animate";
+
+

* If an error occurs try using a different CDN, by default bundle uses cdn.skypack.dev but you can use the others.




You can now use search queries in bundle, all you need to do is add this to the url
+?q={packages}&treeshake={methods to treeshake}

+e.g.
+You want react, react-dom, vue, and @okikio/animate, but only want the Animate and toStr methods exported from @okikio/animate. +

You would add this to the url ?q=react,react-dom,vue,@okikio/animate&treeshake=[*],[*],[*],[Animate,toStr]

If you only want a couple packages and don't care to treeshake, then all you need is something like this,?q=react,react-dom,vue,@okikio/animate

\ No newline at end of file diff --git a/docs/js/chunk-3J66WWEF.js b/docs/js/chunk-3J66WWEF.js new file mode 100644 index 0000000..68dade6 --- /dev/null +++ b/docs/js/chunk-3J66WWEF.js @@ -0,0 +1,2 @@ +import{Rg as c,Xg as p}from"./chunk-KT5CD4BK.js";var x="4.3.2";var f;(function(e){e[e.None=0]="None",e[e.CommonJS=1]="CommonJS",e[e.AMD=2]="AMD",e[e.UMD=3]="UMD",e[e.System=4]="System",e[e.ES2015=5]="ES2015",e[e.ESNext=99]="ESNext"})(f||(f={}));var h;(function(e){e[e.None=0]="None",e[e.Preserve=1]="Preserve",e[e.React=2]="React",e[e.ReactNative=3]="ReactNative",e[e.ReactJSX=4]="ReactJSX",e[e.ReactJSXDev=5]="ReactJSXDev"})(h||(h={}));var l;(function(e){e[e.CarriageReturnLineFeed=0]="CarriageReturnLineFeed",e[e.LineFeed=1]="LineFeed"})(l||(l={}));var s;(function(e){e[e.ES3=0]="ES3",e[e.ES5=1]="ES5",e[e.ES2015=2]="ES2015",e[e.ES2016=3]="ES2016",e[e.ES2017=4]="ES2017",e[e.ES2018=5]="ES2018",e[e.ES2019=6]="ES2019",e[e.ES2020=7]="ES2020",e[e.ESNext=99]="ESNext",e[e.JSON=100]="JSON",e[e.Latest=99]="Latest"})(s||(s={}));var v;(function(e){e[e.Classic=1]="Classic",e[e.NodeJs=2]="NodeJs"})(v||(v={}));var L=function(){function e(t,r,i){this._onDidChange=new c,this._onDidExtraLibsChange=new c,this._extraLibs=Object.create(null),this._removedExtraLibs=Object.create(null),this._eagerModelSync=!1,this.setCompilerOptions(t),this.setDiagnosticsOptions(r),this.setWorkerOptions(i),this._onDidExtraLibsChangeTimeout=-1}return Object.defineProperty(e.prototype,"onDidChange",{get:function(){return this._onDidChange.event},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onDidExtraLibsChange",{get:function(){return this._onDidExtraLibsChange.event},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"workerOptions",{get:function(){return this._workerOptions},enumerable:!1,configurable:!0}),e.prototype.getExtraLibs=function(){return this._extraLibs},e.prototype.addExtraLib=function(t,r){var i=this,n;if(typeof r=="undefined"?n="ts:extralib-"+Math.random().toString(36).substring(2,15):n=r,this._extraLibs[n]&&this._extraLibs[n].content===t)return{dispose:function(){}};var o=1;return this._removedExtraLibs[n]&&(o=this._removedExtraLibs[n]+1),this._extraLibs[n]&&(o=this._extraLibs[n].version+1),this._extraLibs[n]={content:t,version:o},this._fireOnDidExtraLibsChangeSoon(),{dispose:function(){var a=i._extraLibs[n];!a||a.version===o&&(delete i._extraLibs[n],i._removedExtraLibs[n]=o,i._fireOnDidExtraLibsChangeSoon())}}},e.prototype.setExtraLibs=function(t){for(var r in this._extraLibs)this._removedExtraLibs[r]=this._extraLibs[r].version;if(this._extraLibs=Object.create(null),t&&t.length>0)for(var i=0,n=t;i 0) {\r\n for (var _i = 0, libs_1 = libs; _i < libs_1.length; _i++) {\r\n var lib = libs_1[_i];\r\n var filePath = lib.filePath || \"ts:extralib-\" + Math.random().toString(36).substring(2, 15);\r\n var content = lib.content;\r\n var myVersion = 1;\r\n if (this._removedExtraLibs[filePath]) {\r\n myVersion = this._removedExtraLibs[filePath] + 1;\r\n }\r\n this._extraLibs[filePath] = {\r\n content: content,\r\n version: myVersion\r\n };\r\n }\r\n }\r\n this._fireOnDidExtraLibsChangeSoon();\r\n };\r\n LanguageServiceDefaultsImpl.prototype._fireOnDidExtraLibsChangeSoon = function () {\r\n var _this = this;\r\n if (this._onDidExtraLibsChangeTimeout !== -1) {\r\n // already scheduled\r\n return;\r\n }\r\n this._onDidExtraLibsChangeTimeout = setTimeout(function () {\r\n _this._onDidExtraLibsChangeTimeout = -1;\r\n _this._onDidExtraLibsChange.fire(undefined);\r\n }, 0);\r\n };\r\n LanguageServiceDefaultsImpl.prototype.getCompilerOptions = function () {\r\n return this._compilerOptions;\r\n };\r\n LanguageServiceDefaultsImpl.prototype.setCompilerOptions = function (options) {\r\n this._compilerOptions = options || Object.create(null);\r\n this._onDidChange.fire(undefined);\r\n };\r\n LanguageServiceDefaultsImpl.prototype.getDiagnosticsOptions = function () {\r\n return this._diagnosticsOptions;\r\n };\r\n LanguageServiceDefaultsImpl.prototype.setDiagnosticsOptions = function (options) {\r\n this._diagnosticsOptions = options || Object.create(null);\r\n this._onDidChange.fire(undefined);\r\n };\r\n LanguageServiceDefaultsImpl.prototype.setWorkerOptions = function (options) {\r\n this._workerOptions = options || Object.create(null);\r\n this._onDidChange.fire(undefined);\r\n };\r\n LanguageServiceDefaultsImpl.prototype.setMaximumWorkerIdleTime = function (value) { };\r\n LanguageServiceDefaultsImpl.prototype.setEagerModelSync = function (value) {\r\n // doesn't fire an event since no\r\n // worker restart is required here\r\n this._eagerModelSync = value;\r\n };\r\n LanguageServiceDefaultsImpl.prototype.getEagerModelSync = function () {\r\n return this._eagerModelSync;\r\n };\r\n return LanguageServiceDefaultsImpl;\r\n}());\r\nexport var typescriptVersion = tsversion;\r\nexport var typescriptDefaults = new LanguageServiceDefaultsImpl({ allowNonTsExtensions: true, target: ScriptTarget.Latest }, { noSemanticValidation: false, noSyntaxValidation: false, onlyVisible: false }, {});\r\nexport var javascriptDefaults = new LanguageServiceDefaultsImpl({ allowNonTsExtensions: true, allowJs: true, target: ScriptTarget.Latest }, { noSemanticValidation: true, noSyntaxValidation: false, onlyVisible: false }, {});\r\nexport var getTypeScriptWorker = function () {\r\n return getMode().then(function (mode) { return mode.getTypeScriptWorker(); });\r\n};\r\nexport var getJavaScriptWorker = function () {\r\n return getMode().then(function (mode) { return mode.getJavaScriptWorker(); });\r\n};\r\n// export to the global based API\r\nlanguages.typescript = {\r\n ModuleKind: ModuleKind,\r\n JsxEmit: JsxEmit,\r\n NewLineKind: NewLineKind,\r\n ScriptTarget: ScriptTarget,\r\n ModuleResolutionKind: ModuleResolutionKind,\r\n typescriptVersion: typescriptVersion,\r\n typescriptDefaults: typescriptDefaults,\r\n javascriptDefaults: javascriptDefaults,\r\n getTypeScriptWorker: getTypeScriptWorker,\r\n getJavaScriptWorker: getJavaScriptWorker\r\n};\r\n// --- Registration to monaco editor ---\r\nfunction getMode() {\r\n return import('./tsMode.js');\r\n}\r\nlanguages.onLanguage('typescript', function () {\r\n return getMode().then(function (mode) { return mode.setupTypeScript(typescriptDefaults); });\r\n});\r\nlanguages.onLanguage('javascript', function () {\r\n return getMode().then(function (mode) { return mode.setupJavaScript(javascriptDefaults); });\r\n});\r\n"], + "mappings": "iDAGO,GAAI,GAAoB,QCMxB,GAAI,GACX,AAAC,UAAU,EAAY,CACnB,EAAW,EAAW,KAAU,GAAK,OACrC,EAAW,EAAW,SAAc,GAAK,WACzC,EAAW,EAAW,IAAS,GAAK,MACpC,EAAW,EAAW,IAAS,GAAK,MACpC,EAAW,EAAW,OAAY,GAAK,SACvC,EAAW,EAAW,OAAY,GAAK,SACvC,EAAW,EAAW,OAAY,IAAM,WACzC,GAAe,GAAa,KACxB,GAAI,GACX,AAAC,UAAU,EAAS,CAChB,EAAQ,EAAQ,KAAU,GAAK,OAC/B,EAAQ,EAAQ,SAAc,GAAK,WACnC,EAAQ,EAAQ,MAAW,GAAK,QAChC,EAAQ,EAAQ,YAAiB,GAAK,cACtC,EAAQ,EAAQ,SAAc,GAAK,WACnC,EAAQ,EAAQ,YAAiB,GAAK,gBACvC,GAAY,GAAU,KAClB,GAAI,GACX,AAAC,UAAU,EAAa,CACpB,EAAY,EAAY,uBAA4B,GAAK,yBACzD,EAAY,EAAY,SAAc,GAAK,aAC5C,GAAgB,GAAc,KAC1B,GAAI,GACX,AAAC,UAAU,EAAc,CACrB,EAAa,EAAa,IAAS,GAAK,MACxC,EAAa,EAAa,IAAS,GAAK,MACxC,EAAa,EAAa,OAAY,GAAK,SAC3C,EAAa,EAAa,OAAY,GAAK,SAC3C,EAAa,EAAa,OAAY,GAAK,SAC3C,EAAa,EAAa,OAAY,GAAK,SAC3C,EAAa,EAAa,OAAY,GAAK,SAC3C,EAAa,EAAa,OAAY,GAAK,SAC3C,EAAa,EAAa,OAAY,IAAM,SAC5C,EAAa,EAAa,KAAU,KAAO,OAC3C,EAAa,EAAa,OAAY,IAAM,WAC7C,GAAiB,GAAe,KAC5B,GAAI,GACX,AAAC,UAAU,EAAsB,CAC7B,EAAqB,EAAqB,QAAa,GAAK,UAC5D,EAAqB,EAAqB,OAAY,GAAK,WAC5D,GAAyB,GAAuB,KAEnD,GAAI,GAA6C,UAAY,CACzD,WAAqC,EAAiB,EAAoB,EAAe,CACrF,KAAK,aAAe,GAAI,GACxB,KAAK,sBAAwB,GAAI,GACjC,KAAK,WAAa,OAAO,OAAO,MAChC,KAAK,kBAAoB,OAAO,OAAO,MACvC,KAAK,gBAAkB,GACvB,KAAK,mBAAmB,GACxB,KAAK,sBAAsB,GAC3B,KAAK,iBAAiB,GACtB,KAAK,6BAA+B,GAExC,cAAO,eAAe,EAA4B,UAAW,cAAe,CACxE,IAAK,UAAY,CACb,MAAO,MAAK,aAAa,OAE7B,WAAY,GACZ,aAAc,KAElB,OAAO,eAAe,EAA4B,UAAW,uBAAwB,CACjF,IAAK,UAAY,CACb,MAAO,MAAK,sBAAsB,OAEtC,WAAY,GACZ,aAAc,KAElB,OAAO,eAAe,EAA4B,UAAW,gBAAiB,CAC1E,IAAK,UAAY,CACb,MAAO,MAAK,gBAEhB,WAAY,GACZ,aAAc,KAElB,EAA4B,UAAU,aAAe,UAAY,CAC7D,MAAO,MAAK,YAEhB,EAA4B,UAAU,YAAc,SAAU,EAAS,EAAW,CAC9E,GAAI,GAAQ,KACR,EAOJ,GANA,AAAI,MAAO,IAAc,YACrB,EAAW,eAAiB,KAAK,SAAS,SAAS,IAAI,UAAU,EAAG,IAGpE,EAAW,EAEX,KAAK,WAAW,IAAa,KAAK,WAAW,GAAU,UAAY,EAEnE,MAAO,CACH,QAAS,UAAY,IAG7B,GAAI,GAAY,EAChB,MAAI,MAAK,kBAAkB,IACvB,GAAY,KAAK,kBAAkB,GAAY,GAE/C,KAAK,WAAW,IAChB,GAAY,KAAK,WAAW,GAAU,QAAU,GAEpD,KAAK,WAAW,GAAY,CACxB,QAAS,EACT,QAAS,GAEb,KAAK,gCACE,CACH,QAAS,UAAY,CACjB,GAAI,GAAW,EAAM,WAAW,GAChC,AAAI,CAAC,GAGD,EAAS,UAAY,GAGzB,OAAO,GAAM,WAAW,GACxB,EAAM,kBAAkB,GAAY,EACpC,EAAM,oCAIlB,EAA4B,UAAU,aAAe,SAAU,EAAM,CACjE,OAAS,KAAY,MAAK,WACtB,KAAK,kBAAkB,GAAY,KAAK,WAAW,GAAU,QAIjE,GADA,KAAK,WAAa,OAAO,OAAO,MAC5B,GAAQ,EAAK,OAAS,EACtB,OAAS,GAAK,EAAG,EAAS,EAAM,EAAK,EAAO,OAAQ,IAAM,CACtD,GAAI,GAAM,EAAO,GACb,EAAW,EAAI,UAAY,eAAiB,KAAK,SAAS,SAAS,IAAI,UAAU,EAAG,IACpF,EAAU,EAAI,QACd,EAAY,EAChB,AAAI,KAAK,kBAAkB,IACvB,GAAY,KAAK,kBAAkB,GAAY,GAEnD,KAAK,WAAW,GAAY,CACxB,QAAS,EACT,QAAS,GAIrB,KAAK,iCAET,EAA4B,UAAU,8BAAgC,UAAY,CAC9E,GAAI,GAAQ,KACZ,AAAI,KAAK,+BAAiC,IAI1C,MAAK,6BAA+B,WAAW,UAAY,CACvD,EAAM,6BAA+B,GACrC,EAAM,sBAAsB,KAAK,SAClC,KAEP,EAA4B,UAAU,mBAAqB,UAAY,CACnE,MAAO,MAAK,kBAEhB,EAA4B,UAAU,mBAAqB,SAAU,EAAS,CAC1E,KAAK,iBAAmB,GAAW,OAAO,OAAO,MACjD,KAAK,aAAa,KAAK,SAE3B,EAA4B,UAAU,sBAAwB,UAAY,CACtE,MAAO,MAAK,qBAEhB,EAA4B,UAAU,sBAAwB,SAAU,EAAS,CAC7E,KAAK,oBAAsB,GAAW,OAAO,OAAO,MACpD,KAAK,aAAa,KAAK,SAE3B,EAA4B,UAAU,iBAAmB,SAAU,EAAS,CACxE,KAAK,eAAiB,GAAW,OAAO,OAAO,MAC/C,KAAK,aAAa,KAAK,SAE3B,EAA4B,UAAU,yBAA2B,SAAU,EAAO,GAClF,EAA4B,UAAU,kBAAoB,SAAU,EAAO,CAGvE,KAAK,gBAAkB,GAE3B,EAA4B,UAAU,kBAAoB,UAAY,CAClE,MAAO,MAAK,iBAET,KAEA,EAAoB,EACpB,EAAqB,GAAI,GAA4B,CAAE,qBAAsB,GAAM,OAAQ,EAAa,QAAU,CAAE,qBAAsB,GAAO,mBAAoB,GAAO,YAAa,IAAS,IAClM,EAAqB,GAAI,GAA4B,CAAE,qBAAsB,GAAM,QAAS,GAAM,OAAQ,EAAa,QAAU,CAAE,qBAAsB,GAAM,mBAAoB,GAAO,YAAa,IAAS,IAChN,EAAsB,UAAY,CACzC,MAAO,KAAU,KAAK,SAAU,EAAM,CAAE,MAAO,GAAK,yBAE7C,EAAsB,UAAY,CACzC,MAAO,KAAU,KAAK,SAAU,EAAM,CAAE,MAAO,GAAK,yBAGxD,EAAU,WAAa,CACnB,WAAY,EACZ,QAAS,EACT,YAAa,EACb,aAAc,EACd,qBAAsB,EACtB,kBAAmB,EACnB,mBAAoB,EACpB,mBAAoB,EACpB,oBAAqB,EACrB,oBAAqB,GAGzB,YAAmB,CACf,MAAO,QAAO,wBAElB,EAAU,WAAW,aAAc,UAAY,CAC3C,MAAO,KAAU,KAAK,SAAU,EAAM,CAAE,MAAO,GAAK,gBAAgB,OAExE,EAAU,WAAW,aAAc,UAAY,CAC3C,MAAO,KAAU,KAAK,SAAU,EAAM,CAAE,MAAO,GAAK,gBAAgB", + "names": [] +} diff --git a/docs/js/chunk-HNNS32X4.js b/docs/js/chunk-HNNS32X4.js new file mode 100644 index 0000000..32efbc6 --- /dev/null +++ b/docs/js/chunk-HNNS32X4.js @@ -0,0 +1,2 @@ +var f=Object.create;var d=Object.defineProperty;var g=Object.getOwnPropertyDescriptor;var h=Object.getOwnPropertyNames;var i=Object.getPrototypeOf,j=Object.prototype.hasOwnProperty;var k=a=>d(a,"__esModule",{value:!0});var m=typeof require!="undefined"?require:a=>{throw new Error('Dynamic require of "'+a+'" is not supported')};var n=(a,b)=>()=>(b||a((b={exports:{}}).exports,b),b.exports);var l=(a,b,e)=>{if(b&&typeof b=="object"||typeof b=="function")for(let c of h(b))!j.call(a,c)&&c!=="default"&&d(a,c,{get:()=>b[c],enumerable:!(e=g(b,c))||e.enumerable});return a},o=a=>l(k(d(a!=null?f(i(a)):{},"default",a&&a.__esModule&&"default"in a?{get:()=>a.default,enumerable:!0}:{value:a,enumerable:!0})),a);export{m as a,n as b,o as c}; +//# sourceMappingURL=chunk-HNNS32X4.js.map diff --git a/docs/js/chunk-HNNS32X4.js.map b/docs/js/chunk-HNNS32X4.js.map new file mode 100644 index 0000000..9865211 --- /dev/null +++ b/docs/js/chunk-HNNS32X4.js.map @@ -0,0 +1,7 @@ +{ + "version": 3, + "sources": [], + "sourcesContent": [], + "mappings": "", + "names": [] +} diff --git a/docs/js/chunk-HQ7D2GSM.js b/docs/js/chunk-HQ7D2GSM.js new file mode 100644 index 0000000..3990355 --- /dev/null +++ b/docs/js/chunk-HQ7D2GSM.js @@ -0,0 +1,2 @@ +var m="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+-$",g={};function v(l,p){if(!g[l]){g[l]={};for(let s=0;sm.charAt(p))}function y(l){return l==null?"":l==""?null:(l=l.replaceAll(" ","+"),b(l.length,32,p=>v(m,l.charAt(p))))}function M(l,p,s){if(l==null)return"";let c=[],C={},f={},n,w,r,A="",h="",d="",i=2,u=3,a=2,o=0,t=0;for(w=0;w>1}else{for(r=1,n=0;n>1}i--,i==0&&(i=Math.pow(2,a),a++),delete f[h]}else for(r=C[h],n=0;n>1;i--,i==0&&(i=Math.pow(2,a),a++),C[d]=u++,h=String(A)}if(h!==""){if(Object.prototype.hasOwnProperty.call(f,h)){if(h.charCodeAt(0)<256){for(n=0;n>1}else{for(r=1,n=0;n>1}i--,i==0&&(i=Math.pow(2,a),a++),delete f[h]}else for(r=C[h],n=0;n>1;i--,i==0&&(i=Math.pow(2,a),a++)}for(r=2,n=0;n>1;for(;;)if(o=o<<1,t==p-1){c.push(s(o));break}else t++;return c.join("")}function b(l,p,s){let c=[],C,f=4,n=4,w=3,r="",A=[],h,d,i,u,a,o,t,e={val:s(0),position:p,index:1};for(h=0;h<3;h+=1)c[h]=h;for(i=0,a=Math.pow(2,2),o=1;o!=a;)u=e.val&e.position,e.position>>=1,e.position==0&&(e.position=p,e.val=s(e.index++)),i|=(u>0?1:0)*o,o<<=1;switch(C=i){case 0:for(i=0,a=Math.pow(2,8),o=1;o!=a;)u=e.val&e.position,e.position>>=1,e.position==0&&(e.position=p,e.val=s(e.index++)),i|=(u>0?1:0)*o,o<<=1;t=String.fromCharCode(i);break;case 1:for(i=0,a=Math.pow(2,16),o=1;o!=a;)u=e.val&e.position,e.position>>=1,e.position==0&&(e.position=p,e.val=s(e.index++)),i|=(u>0?1:0)*o,o<<=1;t=String.fromCharCode(i);break;case 2:return""}for(c[3]=t,d=t,A.push(t);;){if(e.index>l)return"";for(i=0,a=Math.pow(2,w),o=1;o!=a;)u=e.val&e.position,e.position>>=1,e.position==0&&(e.position=p,e.val=s(e.index++)),i|=(u>0?1:0)*o,o<<=1;switch(t=i){case 0:for(i=0,a=Math.pow(2,8),o=1;o!=a;)u=e.val&e.position,e.position>>=1,e.position==0&&(e.position=p,e.val=s(e.index++)),i|=(u>0?1:0)*o,o<<=1;c[n++]=String.fromCharCode(i),t=n-1,f--;break;case 1:for(i=0,a=Math.pow(2,16),o=1;o!=a;)u=e.val&e.position,e.position>>=1,e.position==0&&(e.position=p,e.val=s(e.index++)),i|=(u>0?1:0)*o,o<<=1;c[n++]=String.fromCharCode(i),t=n-1,f--;break;case 2:return A.join("")}if(f==0&&(f=Math.pow(2,w),w++),c[t])r=c[t];else if(t===n&&typeof d=="string")r=d+d.charAt(0);else return null;A.push(r),c[n++]=d+r.charAt(0),f--,d=r,f==0&&(f=Math.pow(2,w),w++)}}export{x as a,y as b}; +//# sourceMappingURL=chunk-HQ7D2GSM.js.map diff --git a/docs/js/chunk-HQ7D2GSM.js.map b/docs/js/chunk-HQ7D2GSM.js.map new file mode 100644 index 0000000..5763c6d --- /dev/null +++ b/docs/js/chunk-HQ7D2GSM.js.map @@ -0,0 +1,7 @@ +{ + "version": 3, + "sources": ["node_modules/.pnpm/@amoutonbrady+lz-string@0.0.1/node_modules/@amoutonbrady/lz-string/dist/esm/index.js"], + "sourcesContent": ["var v=\"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\",y=\"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+-$\",x={};function M(r,s){if(!x[r]){x[r]={};for(let f=0;fv.charAt(f));switch(s.length%4){default:case 0:return s;case 1:return s+\"===\";case 2:return s+\"==\";case 3:return s+\"=\"}}function O(r){return r==null?\"\":r==\"\"?null:A(r.length,32,s=>M(v,r.charAt(s)))}function j(r){return r==null?\"\":b(r,6,s=>y.charAt(s))}function k(r){return r==null?\"\":r==\"\"?null:(r=r.replaceAll(\" \",\"+\"),A(r.length,32,s=>M(y,r.charAt(s))))}function D(r){return b(r,16,String.fromCharCode)}function R(r){return r==null?\"\":r==\"\"?null:A(r.length,32768,s=>r.charCodeAt(s))}function b(r,s,f){if(r==null)return\"\";let p=[],m={},h={},i,w,o,g=\"\",u=\"\",d=\"\",l=2,a=3,c=2,e=0,t=0;for(w=0;w>1}else{for(o=1,i=0;i>1}l--,l==0&&(l=Math.pow(2,c),c++),delete h[u]}else for(o=m[u],i=0;i>1;l--,l==0&&(l=Math.pow(2,c),c++),m[d]=a++,u=String(g)}if(u!==\"\"){if(Object.prototype.hasOwnProperty.call(h,u)){if(u.charCodeAt(0)<256){for(i=0;i>1}else{for(o=1,i=0;i>1}l--,l==0&&(l=Math.pow(2,c),c++),delete h[u]}else for(o=m[u],i=0;i>1;l--,l==0&&(l=Math.pow(2,c),c++)}for(o=2,i=0;i>1;for(;;)if(e=e<<1,t==s-1){p.push(f(e));break}else t++;return p.join(\"\")}function A(r,s,f){let p=[],m,h=4,i=4,w=3,o=\"\",g=[],u,d,l,a,c,e,t,n={val:f(0),position:s,index:1};for(u=0;u<3;u+=1)p[u]=u;for(l=0,c=Math.pow(2,2),e=1;e!=c;)a=n.val&n.position,n.position>>=1,n.position==0&&(n.position=s,n.val=f(n.index++)),l|=(a>0?1:0)*e,e<<=1;switch(m=l){case 0:for(l=0,c=Math.pow(2,8),e=1;e!=c;)a=n.val&n.position,n.position>>=1,n.position==0&&(n.position=s,n.val=f(n.index++)),l|=(a>0?1:0)*e,e<<=1;t=String.fromCharCode(l);break;case 1:for(l=0,c=Math.pow(2,16),e=1;e!=c;)a=n.val&n.position,n.position>>=1,n.position==0&&(n.position=s,n.val=f(n.index++)),l|=(a>0?1:0)*e,e<<=1;t=String.fromCharCode(l);break;case 2:return\"\"}for(p[3]=t,d=t,g.push(t);;){if(n.index>r)return\"\";for(l=0,c=Math.pow(2,w),e=1;e!=c;)a=n.val&n.position,n.position>>=1,n.position==0&&(n.position=s,n.val=f(n.index++)),l|=(a>0?1:0)*e,e<<=1;switch(t=l){case 0:for(l=0,c=Math.pow(2,8),e=1;e!=c;)a=n.val&n.position,n.position>>=1,n.position==0&&(n.position=s,n.val=f(n.index++)),l|=(a>0?1:0)*e,e<<=1;p[i++]=String.fromCharCode(l),t=i-1,h--;break;case 1:for(l=0,c=Math.pow(2,16),e=1;e!=c;)a=n.val&n.position,n.position>>=1,n.position==0&&(n.position=s,n.val=f(n.index++)),l|=(a>0?1:0)*e,e<<=1;p[i++]=String.fromCharCode(l),t=i-1,h--;break;case 2:return g.join(\"\")}if(h==0&&(h=Math.pow(2,w),w++),p[t])o=p[t];else if(t===i&&typeof d==\"string\")o=d+d.charAt(0);else return null;g.push(o),p[i++]=d+o.charAt(0),h--,d=o,h==0&&(h=Math.pow(2,w),w++)}}export{D as compress,S as compressToBase64,j as compressToURL,R as decompress,O as decompressFromBase64,k as decompressFromURL};\n"], + "mappings": "AAAA,GAA0E,GAAE,oEAAoE,EAAE,GAAG,WAAW,EAAE,EAAE,CAAC,GAAG,CAAC,EAAE,GAAG,CAAC,EAAE,GAAG,GAAG,OAAQ,GAAE,EAAE,EAAE,EAAE,OAAO,IAAI,EAAE,GAAG,EAAE,OAAO,IAAI,EAAE,MAAO,GAAE,GAAG,GAA0P,WAAW,EAAE,CAAC,MAAO,IAAG,KAAK,GAAG,EAAE,EAAE,EAAE,GAAG,EAAE,OAAO,IAAI,WAAW,EAAE,CAAC,MAAO,IAAG,KAAK,GAAG,GAAG,GAAG,KAAM,GAAE,EAAE,WAAW,IAAI,KAAK,EAAE,EAAE,OAAO,GAAG,GAAG,EAAE,EAAE,EAAE,OAAO,MAAuI,WAAW,EAAE,EAAE,EAAE,CAAC,GAAG,GAAG,KAAK,MAAM,GAAG,GAAI,GAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,EAAE,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE,EAAE,OAAO,GAAG,EAAE,GAAG,EAAE,EAAE,OAAO,GAAG,OAAO,UAAU,eAAe,KAAK,EAAE,IAAK,GAAE,GAAG,IAAI,EAAE,GAAG,IAAI,EAAE,EAAE,EAAE,OAAO,UAAU,eAAe,KAAK,EAAE,GAAG,EAAE,MAAM,CAAC,GAAG,OAAO,UAAU,eAAe,KAAK,EAAE,GAAG,CAAC,GAAG,EAAE,WAAW,GAAG,IAAI,CAAC,IAAI,EAAE,EAAE,EAAE,EAAE,IAAI,EAAE,GAAG,EAAE,GAAG,EAAE,EAAG,GAAE,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,IAAI,IAAI,EAAE,EAAE,WAAW,GAAG,EAAE,EAAE,EAAE,EAAE,IAAI,EAAE,GAAG,EAAE,EAAE,EAAE,GAAG,EAAE,EAAG,GAAE,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,IAAI,EAAE,GAAG,MAAM,CAAC,IAAI,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,IAAI,EAAE,GAAG,EAAE,EAAE,GAAG,EAAE,EAAG,GAAE,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,IAAI,EAAE,EAAE,IAAI,EAAE,EAAE,WAAW,GAAG,EAAE,EAAE,EAAE,GAAG,IAAI,EAAE,GAAG,EAAE,EAAE,EAAE,GAAG,EAAE,EAAG,GAAE,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,IAAI,EAAE,GAAG,EAAE,IAAI,GAAG,GAAI,GAAE,KAAK,IAAI,EAAE,GAAG,KAAK,MAAO,GAAE,OAAQ,KAAI,EAAE,EAAE,GAAG,EAAE,EAAE,EAAE,EAAE,IAAI,EAAE,GAAG,EAAE,EAAE,EAAE,GAAG,EAAE,EAAG,GAAE,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,IAAI,EAAE,GAAG,EAAE,IAAI,GAAG,GAAI,GAAE,KAAK,IAAI,EAAE,GAAG,KAAK,EAAE,GAAG,IAAI,EAAE,OAAO,GAAG,GAAG,IAAI,GAAG,CAAC,GAAG,OAAO,UAAU,eAAe,KAAK,EAAE,GAAG,CAAC,GAAG,EAAE,WAAW,GAAG,IAAI,CAAC,IAAI,EAAE,EAAE,EAAE,EAAE,IAAI,EAAE,GAAG,EAAE,GAAG,EAAE,EAAG,GAAE,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,IAAI,IAAI,EAAE,EAAE,WAAW,GAAG,EAAE,EAAE,EAAE,EAAE,IAAI,EAAE,GAAG,EAAE,EAAE,EAAE,GAAG,EAAE,EAAG,GAAE,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,IAAI,EAAE,GAAG,MAAM,CAAC,IAAI,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,IAAI,EAAE,GAAG,EAAE,EAAE,GAAG,EAAE,EAAG,GAAE,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,IAAI,EAAE,EAAE,IAAI,EAAE,EAAE,WAAW,GAAG,EAAE,EAAE,EAAE,GAAG,IAAI,EAAE,GAAG,EAAE,EAAE,EAAE,GAAG,EAAE,EAAG,GAAE,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,IAAI,EAAE,GAAG,EAAE,IAAI,GAAG,GAAI,GAAE,KAAK,IAAI,EAAE,GAAG,KAAK,MAAO,GAAE,OAAQ,KAAI,EAAE,EAAE,GAAG,EAAE,EAAE,EAAE,EAAE,IAAI,EAAE,GAAG,EAAE,EAAE,EAAE,GAAG,EAAE,EAAG,GAAE,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,IAAI,EAAE,GAAG,EAAE,IAAI,GAAG,GAAI,GAAE,KAAK,IAAI,EAAE,GAAG,KAAK,IAAI,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,IAAI,EAAE,GAAG,EAAE,EAAE,EAAE,GAAG,EAAE,EAAG,GAAE,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,IAAI,EAAE,GAAG,EAAE,OAAO,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,EAAE,CAAC,EAAE,KAAK,EAAE,IAAI,UAAW,KAAI,MAAO,GAAE,KAAK,IAAI,WAAW,EAAE,EAAE,EAAE,CAAC,GAAI,GAAE,GAAG,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,IAAI,EAAE,GAAG,SAAS,EAAE,MAAM,GAAG,IAAI,EAAE,EAAE,EAAE,EAAE,GAAG,EAAE,EAAE,GAAG,EAAE,IAAI,EAAE,EAAE,EAAE,KAAK,IAAI,EAAE,GAAG,EAAE,EAAE,GAAG,GAAG,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,WAAW,EAAE,EAAE,UAAU,GAAI,GAAE,SAAS,EAAE,EAAE,IAAI,EAAE,EAAE,UAAU,GAAI,GAAE,EAAE,EAAE,GAAG,EAAE,IAAI,EAAE,OAAO,EAAE,OAAQ,GAAE,IAAI,EAAE,EAAE,EAAE,KAAK,IAAI,EAAE,GAAG,EAAE,EAAE,GAAG,GAAG,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,WAAW,EAAE,EAAE,UAAU,GAAI,GAAE,SAAS,EAAE,EAAE,IAAI,EAAE,EAAE,UAAU,GAAI,GAAE,EAAE,EAAE,GAAG,EAAE,IAAI,EAAE,EAAE,OAAO,aAAa,GAAG,UAAW,GAAE,IAAI,EAAE,EAAE,EAAE,KAAK,IAAI,EAAE,IAAI,EAAE,EAAE,GAAG,GAAG,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,WAAW,EAAE,EAAE,UAAU,GAAI,GAAE,SAAS,EAAE,EAAE,IAAI,EAAE,EAAE,UAAU,GAAI,GAAE,EAAE,EAAE,GAAG,EAAE,IAAI,EAAE,EAAE,OAAO,aAAa,GAAG,UAAW,GAAE,MAAM,GAAG,IAAI,EAAE,GAAG,EAAE,EAAE,EAAE,EAAE,KAAK,KAAK,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI,EAAE,EAAE,EAAE,KAAK,IAAI,EAAE,GAAG,EAAE,EAAE,GAAG,GAAG,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,WAAW,EAAE,EAAE,UAAU,GAAI,GAAE,SAAS,EAAE,EAAE,IAAI,EAAE,EAAE,UAAU,GAAI,GAAE,EAAE,EAAE,GAAG,EAAE,IAAI,EAAE,OAAO,EAAE,OAAQ,GAAE,IAAI,EAAE,EAAE,EAAE,KAAK,IAAI,EAAE,GAAG,EAAE,EAAE,GAAG,GAAG,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,WAAW,EAAE,EAAE,UAAU,GAAI,GAAE,SAAS,EAAE,EAAE,IAAI,EAAE,EAAE,UAAU,GAAI,GAAE,EAAE,EAAE,GAAG,EAAE,IAAI,EAAE,EAAE,KAAK,OAAO,aAAa,GAAG,EAAE,EAAE,EAAE,IAAI,UAAW,GAAE,IAAI,EAAE,EAAE,EAAE,KAAK,IAAI,EAAE,IAAI,EAAE,EAAE,GAAG,GAAG,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,WAAW,EAAE,EAAE,UAAU,GAAI,GAAE,SAAS,EAAE,EAAE,IAAI,EAAE,EAAE,UAAU,GAAI,GAAE,EAAE,EAAE,GAAG,EAAE,IAAI,EAAE,EAAE,KAAK,OAAO,aAAa,GAAG,EAAE,EAAE,EAAE,IAAI,UAAW,GAAE,MAAO,GAAE,KAAK,IAAI,GAAG,GAAG,GAAI,GAAE,KAAK,IAAI,EAAE,GAAG,KAAK,EAAE,GAAG,EAAE,EAAE,WAAW,IAAI,GAAG,MAAO,IAAG,SAAS,EAAE,EAAE,EAAE,OAAO,OAAQ,OAAO,MAAK,EAAE,KAAK,GAAG,EAAE,KAAK,EAAE,EAAE,OAAO,GAAG,IAAI,EAAE,EAAE,GAAG,GAAI,GAAE,KAAK,IAAI,EAAE,GAAG", + "names": [] +} diff --git a/docs/js/chunk-JF6ZTFSE.js b/docs/js/chunk-JF6ZTFSE.js new file mode 100644 index 0000000..7e1c7af --- /dev/null +++ b/docs/js/chunk-JF6ZTFSE.js @@ -0,0 +1,2 @@ +var a=new Event("theme-change",{bubbles:!0,cancelable:!0,composed:!1}),n=()=>{let e=window.localStorage.getItem("theme");return typeof e=="string"?e:null},o=e=>{typeof e=="string"&&window.localStorage.setItem("theme",e)},h=()=>{let e=window.matchMedia("(prefers-color-scheme: dark)");return typeof e.matches=="boolean"?e.matches?"dark":"light":null},r=document.querySelector("html"),s=()=>{let e=r.getAttribute("data-theme");return typeof e=="string"&&e.length?e:n()},l=e=>{r.setAttribute("data-theme",e),r.classList.toggle("dark",e=="dark"),o(e),document.dispatchEvent(a)},i=()=>{try{let e=n();e===null&&(e=h()),e&&l(e),window.matchMedia("(prefers-color-scheme: dark)").addEventListener("change",t=>{l(t.matches?"dark":"light")}),window.matchMedia("(prefers-color-scheme: light)").addEventListener("change",t=>{l(t.matches?"light":"dark")})}catch(e){console.warn("Theming isn't available on this browser.",e)}};i();export{a,n as b,o as c,h as d,s as e,l as f,i as g}; +//# sourceMappingURL=chunk-JF6ZTFSE.js.map diff --git a/docs/js/chunk-JF6ZTFSE.js.map b/docs/js/chunk-JF6ZTFSE.js.map new file mode 100644 index 0000000..7996269 --- /dev/null +++ b/docs/js/chunk-JF6ZTFSE.js.map @@ -0,0 +1,7 @@ +{ + "version": 3, + "sources": ["src/ts/scripts/theme.ts"], + "sourcesContent": ["export const ThemeChange = new Event('theme-change', {\n bubbles: true,\n cancelable: true,\n composed: false\n});\n\n// Based on [joshwcomeau.com/gatsby/dark-mode/]\nexport let getTheme = (): string | null => {\n let theme = window.localStorage.getItem(\"theme\");\n // If the user has explicitly chosen light or dark,\n // let's use it. Otherwise, this value will be null.\n if (typeof theme === \"string\") return theme;\n\n // If they are using a browser/OS that doesn't support\n // color themes, let's default to 'light'.\n return null;\n};\n\nexport let setTheme = (theme: string): void => {\n // If the user has explicitly chosen light or dark, store the default theme\n if (typeof theme === \"string\") window.localStorage.setItem(\"theme\", theme);\n};\n\nexport let mediaTheme = (): string | null => {\n // If they haven't been explicitly set, let's check the media query\n let mql = window.matchMedia(\"(prefers-color-scheme: dark)\");\n let hasMediaQueryPreference = typeof mql.matches === \"boolean\";\n if (hasMediaQueryPreference) return mql.matches ? \"dark\" : \"light\";\n return null;\n};\n\nlet html = document.querySelector(\"html\");\n// Get theme from html tag, if it has a theme or get it from localStorage\nexport let themeGet = () => {\n let themeAttr = html.getAttribute(\"data-theme\");\n if (typeof themeAttr === \"string\" && themeAttr.length) {\n return themeAttr;\n }\n\n return getTheme();\n};\n\n// Set theme in localStorage, as well as in the html tag\nexport let themeSet = (theme: string) => {\n html.setAttribute(\"data-theme\", theme);\n html.classList.toggle(\"dark\", theme == \"dark\");\n setTheme(theme);\n document.dispatchEvent(ThemeChange);\n};\n\nexport let runTheme = () => {\n try {\n let theme = getTheme();\n if (theme === null) theme = mediaTheme();\n theme && themeSet(theme);\n\n window.matchMedia(\"(prefers-color-scheme: dark)\").addEventListener(\"change\", (e) => {\n themeSet(e.matches ? \"dark\" : \"light\");\n });\n\n window.matchMedia(\"(prefers-color-scheme: light)\").addEventListener(\"change\", (e) => {\n themeSet(e.matches ? \"light\" : \"dark\");\n });\n\n } catch (e) {\n console.warn(\"Theming isn't available on this browser.\", e);\n }\n};\n\nrunTheme();"], + "mappings": "AAAO,GAAM,GAAc,GAAI,OAAM,eAAgB,CACjD,QAAS,GACT,WAAY,GACZ,SAAU,KAIH,EAAW,IAAqB,CACvC,GAAI,GAAQ,OAAO,aAAa,QAAQ,SAGxC,MAAI,OAAO,IAAU,SAAiB,EAI/B,MAGA,EAAW,AAAC,GAAwB,CAE3C,AAAI,MAAO,IAAU,UAAU,OAAO,aAAa,QAAQ,QAAS,IAG7D,EAAa,IAAqB,CAEzC,GAAI,GAAM,OAAO,WAAW,gCAE5B,MAD8B,OAAO,GAAI,SAAY,UACjB,EAAI,QAAU,OAAS,QACpD,MAGP,EAAO,SAAS,cAAc,QAEvB,EAAW,IAAM,CACxB,GAAI,GAAY,EAAK,aAAa,cAClC,MAAI,OAAO,IAAc,UAAY,EAAU,OACpC,EAGJ,KAIA,EAAW,AAAC,GAAkB,CACrC,EAAK,aAAa,aAAc,GAChC,EAAK,UAAU,OAAO,OAAQ,GAAS,QACvC,EAAS,GACT,SAAS,cAAc,IAGhB,EAAW,IAAM,CACxB,GAAI,CACA,GAAI,GAAQ,IACZ,AAAI,IAAU,MAAM,GAAQ,KAC5B,GAAS,EAAS,GAElB,OAAO,WAAW,gCAAgC,iBAAiB,SAAU,AAAC,GAAM,CAChF,EAAS,EAAE,QAAU,OAAS,WAGlC,OAAO,WAAW,iCAAiC,iBAAiB,SAAU,AAAC,GAAM,CACjF,EAAS,EAAE,QAAU,QAAU,gBAG9B,EAAP,CACE,QAAQ,KAAK,2CAA4C,KAIjE", + "names": [] +} diff --git a/docs/js/chunk-KT5CD4BK.js b/docs/js/chunk-KT5CD4BK.js new file mode 100644 index 0000000..5972a1c --- /dev/null +++ b/docs/js/chunk-KT5CD4BK.js @@ -0,0 +1,590 @@ +function O2(s,e){let t;return e.length===0?t=s:t=s.replace(/\{(\d+)\}/g,function(i,n){let r=n[0];return typeof e[r]!="undefined"?e[r]:i}),t}function p(s,e,...t){return O2(e,t)}var P1=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?new Error(e.message+` + +`+e.stack):e},0)}}emit(e){this.listeners.forEach(t=>{t(e)})}onUnexpectedError(e){this.unexpectedErrorHandler(e),this.emit(e)}onUnexpectedExternalError(e){this.unexpectedErrorHandler(e)}},F1=new P1;function de(s){Ir(s)||F1.onUnexpectedError(s)}function Yo(s){Ir(s)||F1.onUnexpectedExternalError(s)}function G_(s){if(s instanceof Error){let{name:e,message:t}=s,i=s.stacktrace||s.stack;return{$isError:!0,name:e,message:t,stack:i}}return s}var Y_="Canceled";function Ir(s){return s instanceof Error&&s.name===Y_&&s.message===Y_}function Ll(){let s=new Error(Y_);return s.name=s.message,s}function Nr(s){return s?new Error(`Illegal argument: ${s}`):new Error("Illegal argument")}function B1(s){return s?new Error(`Illegal state: ${s}`):new Error("Illegal state")}function pn(s){let e=this,t=!1,i;return function(){return t||(t=!0,i=s.apply(e,arguments)),i}}var re;(function(s){function e(_){return _&&typeof _=="object"&&typeof _[Symbol.iterator]=="function"}s.is=e;let t=Object.freeze([]);function i(){return t}s.empty=i;function*n(_){yield _}s.single=n;function r(_){return _||t}s.from=r;function o(_){return!_||_[Symbol.iterator]().next().done===!0}s.isEmpty=o;function a(_){return _[Symbol.iterator]().next().value}s.first=a;function l(_,v){for(let C of _)if(v(C))return!0;return!1}s.some=l;function c(_,v){for(let C of _)if(v(C))return C}s.find=c;function*h(_,v){for(let C of _)v(C)&&(yield C)}s.filter=h;function*d(_,v){let C=0;for(let y of _)yield v(y,C++)}s.map=d;function*u(..._){for(let v of _)for(let C of v)yield C}s.concat=u;function*f(_){for(let v of _)for(let C of v)yield C}s.concatNested=f;function m(_,v,C){let y=C;for(let x of _)y=v(y,x);return y}s.reduce=m;function*g(_,v,C=_.length){for(v<0&&(v+=_.length),C<0?C+=_.length:C>_.length&&(C=_.length);vy===x){let y=_[Symbol.iterator](),x=v[Symbol.iterator]();for(;;){let S=y.next(),L=x.next();if(S.done!==L.done)return!1;if(S.done)return!0;if(!C(S.value,L.value))return!1}}s.equals=w})(re||(re={}));var P2=!1,ki=null;function F2(s){ki=s}if(P2){let s="__is_disposable_tracked__";F2(new class{trackDisposable(e){let t=new Error("Potentially leaked disposable").stack;setTimeout(()=>{e[s]||console.log(t)},3e3)}setParent(e,t){if(e&&e!==M.None)try{e[s]=!0}catch(i){}}markAsDisposed(e){if(e&&e!==M.None)try{e[s]=!0}catch(t){}}markAsSingleton(e){}})}function bf(s){return ki==null||ki.trackDisposable(s),s}function wf(s){ki==null||ki.markAsDisposed(s)}function vf(s,e){ki==null||ki.setParent(s,e)}function B2(s,e){if(!!ki)for(let t of s)ki.setParent(t,e)}function W1(s){return ki==null||ki.markAsSingleton(s),s}var V1=class extends Error{constructor(e){super(`Encountered errors while disposing of store. Errors: [${e.join(", ")}]`);this.errors=e}};function j1(s){return typeof s.dispose=="function"&&s.dispose.length===0}function me(s){if(re.is(s)){let e=[];for(let t of s)if(t)try{t.dispose()}catch(i){e.push(i)}if(e.length===1)throw e[0];if(e.length>1)throw new V1(e);return Array.isArray(s)?[]:s}else if(s)return s.dispose(),s}function Jn(...s){let e=oe(()=>me(s));return B2(s,e),e}function oe(s){let e=bf({dispose:pn(()=>{wf(e),s()})});return e}var U=class{constructor(){this._toDispose=new Set,this._isDisposed=!1,bf(this)}dispose(){this._isDisposed||(wf(this),this._isDisposed=!0,this.clear())}clear(){try{me(this._toDispose.values())}finally{this._toDispose.clear()}}add(e){if(!e)return e;if(e===this)throw new Error("Cannot register a disposable on itself!");return vf(e,this),this._isDisposed?U.DISABLE_DISPOSED_WARNING||console.warn(new Error("Trying to add a disposable to a DisposableStore that has already been disposed of. The added object will be leaked!").stack):this._toDispose.add(e),e}};U.DISABLE_DISPOSED_WARNING=!1;var M=class{constructor(){this._store=new U,bf(this),vf(this._store,this)}dispose(){wf(this),this._store.dispose()}_register(e){if(e===this)throw new Error("Cannot register a disposable on itself!");return this._store.add(e)}};M.None=Object.freeze({dispose(){}});var Z_=class{constructor(){this._isDisposed=!1,bf(this)}get value(){return this._isDisposed?void 0:this._value}set value(e){var t;this._isDisposed||e===this._value||((t=this._value)===null||t===void 0||t.dispose(),e&&vf(e,this),this._value=e)}clear(){this.value=void 0}dispose(){var e;this._isDisposed=!0,wf(this),(e=this._value)===null||e===void 0||e.dispose(),this._value=void 0}clearAndLeak(){let e=this._value;return this._value=void 0,e&&vf(e,null),e}},X_=class{constructor(e){this.object=e}dispose(){}};var Ue=class{constructor(e){this.element=e,this.next=Ue.Undefined,this.prev=Ue.Undefined}};Ue.Undefined=new Ue(void 0);var Ht=class{constructor(){this._first=Ue.Undefined,this._last=Ue.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===Ue.Undefined}clear(){let e=this._first;for(;e!==Ue.Undefined;){let t=e.next;e.prev=Ue.Undefined,e.next=Ue.Undefined,e=t}this._first=Ue.Undefined,this._last=Ue.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,t){let i=new Ue(e);if(this._first===Ue.Undefined)this._first=i,this._last=i;else if(t){let r=this._last;this._last=i,i.prev=r,r.next=i}else{let r=this._first;this._first=i,i.next=r,r.prev=i}this._size+=1;let n=!1;return()=>{n||(n=!0,this._remove(i))}}shift(){if(this._first!==Ue.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==Ue.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==Ue.Undefined&&e.next!==Ue.Undefined){let t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===Ue.Undefined&&e.next===Ue.Undefined?(this._first=Ue.Undefined,this._last=Ue.Undefined):e.next===Ue.Undefined?(this._last=this._last.prev,this._last.next=Ue.Undefined):e.prev===Ue.Undefined&&(this._first=this._first.next,this._first.prev=Ue.Undefined);this._size-=1}*[Symbol.iterator](){let e=this._first;for(;e!==Ue.Undefined;)yield e.element,e=e.next}};var Q_,Cf="en",bh=!1,wh=!1,vh=!1,W2=!1,z1=!1,H1=!1,J_=!1,Sf,eb=Cf,V2,Tr,Be=typeof self=="object"?self:typeof global=="object"?global:{},pt;typeof Be.vscode!="undefined"&&typeof Be.vscode.process!="undefined"?pt=Be.vscode.process:typeof process!="undefined"&&(pt=process);var U1=typeof((Q_=pt==null?void 0:pt.versions)===null||Q_===void 0?void 0:Q_.electron)=="string"&&pt.type==="renderer",j2=U1&&(pt==null?void 0:pt.sandboxed),z2=(()=>{if(j2)return"bypassHeatCheck";let s=pt==null?void 0:pt.env.VSCODE_BROWSER_CODE_LOADING;if(typeof s=="string")return s==="none"||s==="code"||s==="bypassHeatCheck"||s==="bypassHeatCheckAndEagerCompile"?s:"bypassHeatCheck"})(),$1=typeof z2=="string";if(typeof navigator=="object"&&!U1)Tr=navigator.userAgent,bh=Tr.indexOf("Windows")>=0,wh=Tr.indexOf("Macintosh")>=0,J_=(Tr.indexOf("Macintosh")>=0||Tr.indexOf("iPad")>=0||Tr.indexOf("iPhone")>=0)&&!!navigator.maxTouchPoints&&navigator.maxTouchPoints>0,vh=Tr.indexOf("Linux")>=0,H1=!0,Sf=navigator.language,eb=Sf;else if(typeof pt=="object"){bh=pt.platform==="win32",wh=pt.platform==="darwin",vh=pt.platform==="linux",W2=vh&&!!pt.env.SNAP&&!!pt.env.SNAP_REVISION,Sf=Cf,eb=Cf;let s=pt.env.VSCODE_NLS_CONFIG;if(s)try{let e=JSON.parse(s),t=e.availableLanguages["*"];Sf=e.locale,eb=t||Cf,V2=e._translationsConfigFile}catch(e){}z1=!0}else console.error("Unable to resolve platform.");var tb=0;wh?tb=1:bh?tb=3:vh&&(tb=2);var ot=bh,ee=wh,_t=vh,Mr=z1,Zo=H1,en=J_,K1=Tr,Xo=function(){if(Be.setImmediate)return Be.setImmediate.bind(Be);if(typeof Be.postMessage=="function"&&!Be.importScripts){let t=[];Be.addEventListener("message",n=>{if(n.data&&n.data.vscodeSetImmediateId)for(let r=0,o=t.length;r{let r=++i;t.push({id:r,callback:n}),Be.postMessage({vscodeSetImmediateId:r},"*")}}if(typeof(pt==null?void 0:pt.nextTick)=="function")return pt.nextTick.bind(pt);let e=Promise.resolve();return t=>e.then(t)}(),Ii=wh||J_?2:bh?1:3,q1=!0,G1=!1;function yf(){if(!G1){G1=!0;let s=new Uint8Array(2);s[0]=1,s[1]=2,q1=new Uint16Array(s.buffer)[0]===(2<<8)+1}return q1}var H2=Be.performance&&typeof Be.performance.now=="function",Nn=class{constructor(e){this._highResolution=H2&&e,this._startTime=this._now(),this._stopTime=-1}static create(e=!0){return new Nn(e)}stop(){this._stopTime=this._now()}elapsed(){return this._stopTime!==-1?this._stopTime-this._startTime:this._now()-this._startTime}_now(){return this._highResolution?Be.performance.now():Date.now()}};var j;(function(s){s.None=()=>M.None;function e(_){return(v,C=null,y)=>{let x=!1,S;return S=_(L=>{if(!x)return S?S.dispose():x=!0,v.call(C,L)},null,y),x&&S.dispose(),S}}s.once=e;function t(_,v){return l((C,y=null,x)=>_(S=>C.call(y,v(S)),null,x))}s.map=t;function i(_,v){return l((C,y=null,x)=>_(S=>{v(S),C.call(y,S)},null,x))}s.forEach=i;function n(_,v){return l((C,y=null,x)=>_(S=>v(S)&&C.call(y,S),null,x))}s.filter=n;function r(_){return _}s.signal=r;function o(..._){return(v,C=null,y)=>Jn(..._.map(x=>x(S=>v.call(C,S),null,y)))}s.any=o;function a(_,v,C){let y=C;return t(_,x=>(y=v(y,x),y))}s.reduce=a;function l(_){let v,C=new k({onFirstListenerAdd(){v=_(C.fire,C)},onLastListenerRemove(){v.dispose()}});return C.event}function c(_,v,C=100,y=!1,x){let S,L,E,T=0,I=new k({leakWarningThreshold:x,onFirstListenerAdd(){S=_(P=>{T++,L=v(L,P),y&&!E&&(I.fire(L),L=void 0),clearTimeout(E),E=setTimeout(()=>{let B=L;L=void 0,E=void 0,(!y||T>1)&&I.fire(B),T=0},C)})},onLastListenerRemove(){S.dispose()}});return I.event}s.debounce=c;function h(_,v=(C,y)=>C===y){let C=!0,y;return n(_,x=>{let S=C||!v(x,y);return C=!1,y=x,S})}s.latch=h;function d(_,v){return[s.filter(_,v),s.filter(_,C=>!v(C))]}s.split=d;function u(_,v=!1,C=[]){let y=C.slice(),x=_(E=>{y?y.push(E):L.fire(E)}),S=()=>{y&&y.forEach(E=>L.fire(E)),y=null},L=new k({onFirstListenerAdd(){x||(x=_(E=>L.fire(E)))},onFirstListenerDidAdd(){y&&(v?setTimeout(S):S())},onLastListenerRemove(){x&&x.dispose(),x=null}});return L.event}s.buffer=u;class f{constructor(v){this.event=v}map(v){return new f(t(this.event,v))}forEach(v){return new f(i(this.event,v))}filter(v){return new f(n(this.event,v))}reduce(v,C){return new f(a(this.event,v,C))}latch(){return new f(h(this.event))}debounce(v,C=100,y=!1,x){return new f(c(this.event,v,C,y,x))}on(v,C,y){return this.event(v,C,y)}once(v,C,y){return e(this.event)(v,C,y)}}function m(_){return new f(_)}s.chain=m;function g(_,v,C=y=>y){let y=(...E)=>L.fire(C(...E)),x=()=>_.on(v,y),S=()=>_.removeListener(v,y),L=new k({onFirstListenerAdd:x,onLastListenerRemove:S});return L.event}s.fromNodeEventEmitter=g;function b(_,v,C=y=>y){let y=(...E)=>L.fire(C(...E)),x=()=>_.addEventListener(v,y),S=()=>_.removeEventListener(v,y),L=new k({onFirstListenerAdd:x,onLastListenerRemove:S});return L.event}s.fromDOMEventEmitter=b;function w(_){return new Promise(v=>e(_)(v))}s.toPromise=w})(j||(j={}));var Ch=class{constructor(e){this._listenerCount=0,this._invocationCount=0,this._elapsedOverall=0,this._name=`${e}_${Ch._idPool++}`}start(e){this._stopWatch=new Nn(!0),this._listenerCount=e}stop(){if(this._stopWatch){let e=this._stopWatch.elapsed();this._elapsedOverall+=e,this._invocationCount+=1,console.info(`did FIRE ${this._name}: elapsed_ms: ${e.toFixed(5)}, listener: ${this._listenerCount} (elapsed_overall: ${this._elapsedOverall.toFixed(2)}, invocations: ${this._invocationCount})`),this._stopWatch=void 0}}};Ch._idPool=0;var Y1=-1,Z1=class{constructor(e,t=Math.random().toString(18).slice(2,5)){this.customThreshold=e,this.name=t,this._warnCountdown=0}dispose(){this._stacks&&this._stacks.clear()}check(e){let t=Y1;if(typeof this.customThreshold=="number"&&(t=this.customThreshold),t<=0||e{let r=this._stacks.get(i)||0;this._stacks.set(i,r-1)}}},k=class{constructor(e){var t;this._disposed=!1,this._options=e,this._leakageMon=Y1>0?new Z1(this._options&&this._options.leakWarningThreshold):void 0,this._perfMon=((t=this._options)===null||t===void 0?void 0:t._profName)?new Ch(this._options._profName):void 0}get event(){return this._event||(this._event=(e,t,i)=>{var n;this._listeners||(this._listeners=new Ht);let r=this._listeners.isEmpty();r&&this._options&&this._options.onFirstListenerAdd&&this._options.onFirstListenerAdd(this);let o=this._listeners.push(t?[e,t]:e);r&&this._options&&this._options.onFirstListenerDidAdd&&this._options.onFirstListenerDidAdd(this),this._options&&this._options.onListenerDidAdd&&this._options.onListenerDidAdd(this,e,t);let a=(n=this._leakageMon)===null||n===void 0?void 0:n.check(this._listeners.size),l=oe(()=>{a&&a(),this._disposed||(o(),this._options&&this._options.onLastListenerRemove&&(this._listeners&&!this._listeners.isEmpty()||this._options.onLastListenerRemove(this)))});return i instanceof U?i.add(l):Array.isArray(i)&&i.push(l),l}),this._event}fire(e){var t,i;if(this._listeners){this._deliveryQueue||(this._deliveryQueue=new Ht);for(let n of this._listeners)this._deliveryQueue.push([n,e]);for((t=this._perfMon)===null||t===void 0||t.start(this._deliveryQueue.size);this._deliveryQueue.size>0;){let[n,r]=this._deliveryQueue.shift();try{typeof n=="function"?n.call(void 0,r):n[0].call(n[1],r)}catch(o){de(o)}}(i=this._perfMon)===null||i===void 0||i.stop()}}dispose(){var e,t,i,n,r;this._disposed||(this._disposed=!0,(e=this._listeners)===null||e===void 0||e.clear(),(t=this._deliveryQueue)===null||t===void 0||t.clear(),(n=(i=this._options)===null||i===void 0?void 0:i.onLastListenerRemove)===null||n===void 0||n.call(i),(r=this._leakageMon)===null||r===void 0||r.dispose())}},Qo=class extends k{constructor(e){super(e);this._isPaused=0,this._eventQueue=new Ht,this._mergeFn=e==null?void 0:e.merge}pause(){this._isPaused++}resume(){if(this._isPaused!==0&&--this._isPaused==0)if(this._mergeFn){let e=Array.from(this._eventQueue);this._eventQueue.clear(),super.fire(this._mergeFn(e))}else for(;!this._isPaused&&this._eventQueue.size!==0;)super.fire(this._eventQueue.shift())}fire(e){this._listeners&&(this._isPaused!==0?this._eventQueue.push(e):super.fire(e))}},ib=class extends Qo{constructor(e){var t;super(e);this._delay=(t=e.delay)!==null&&t!==void 0?t:100}fire(e){this._handle||(this.pause(),this._handle=setTimeout(()=>{this._handle=void 0,this.resume()},this._delay)),super.fire(e)}},Jo=class{constructor(){this.buffers=[]}wrapEvent(e){return(t,i,n)=>e(r=>{let o=this.buffers[this.buffers.length-1];o?o.push(()=>t.call(i,r)):t.call(i,r)},void 0,n)}bufferEvents(e){let t=[];this.buffers.push(t);let i=e();return this.buffers.pop(),t.forEach(n=>n()),i}},Lf=class{constructor(){this.listening=!1,this.inputEvent=j.None,this.inputEventListener=M.None,this.emitter=new k({onFirstListenerDidAdd:()=>{this.listening=!0,this.inputEventListener=this.inputEvent(this.emitter.fire,this.emitter)},onLastListenerRemove:()=>{this.listening=!1,this.inputEventListener.dispose()}}),this.event=this.emitter.event}set input(e){this.inputEvent=e,this.listening&&(this.inputEventListener.dispose(),this.inputEventListener=e(this.emitter.fire,this.emitter))}dispose(){this.inputEventListener.dispose(),this.emitter.dispose()}};var Rr=class{constructor(){this._zoomLevel=0,this._lastZoomLevelChangeTime=0,this._onDidChangeZoomLevel=new k,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this._zoomFactor=1}getZoomLevel(){return this._zoomLevel}getTimeSinceLastZoomLevelChanged(){return Date.now()-this._lastZoomLevelChangeTime}getZoomFactor(){return this._zoomFactor}getPixelRatio(){let e=document.createElement("canvas").getContext("2d"),t=window.devicePixelRatio||1,i=e.webkitBackingStorePixelRatio||e.mozBackingStorePixelRatio||e.msBackingStorePixelRatio||e.oBackingStorePixelRatio||e.backingStorePixelRatio||1;return t/i}};Rr.INSTANCE=new Rr;function xf(){return Rr.INSTANCE.getZoomLevel()}function X1(){return Rr.INSTANCE.getTimeSinceLastZoomLevelChanged()}function Q1(s){return Rr.INSTANCE.onDidChangeZoomLevel(s)}function J1(){return Rr.INSTANCE.getZoomFactor()}function xl(){return Rr.INSTANCE.getPixelRatio()}var Sh=navigator.userAgent,at=Sh.indexOf("Firefox")>=0,Tn=Sh.indexOf("AppleWebKit")>=0,yh=Sh.indexOf("Chrome")>=0,_n=!yh&&Sh.indexOf("Safari")>=0,ey=!yh&&!_n&&Tn,ea=Sh.indexOf("Android")>=0,ty=window.matchMedia&&window.matchMedia("(display-mode: standalone)").matches;function iy(s){return Array.isArray(s)}function Ni(s){return typeof s=="string"}function Ft(s){return typeof s=="object"&&s!==null&&!Array.isArray(s)&&!(s instanceof RegExp)&&!(s instanceof Date)}function Ws(s){return typeof s=="number"&&!isNaN(s)}function Df(s){return s===!0||s===!1}function li(s){return typeof s=="undefined"}function Jt(s){return li(s)||s===null}function ci(s,e){if(!s)throw new Error(e?`Unexpected type, expected '${e}'`:"Unexpected type")}function u3(s){if(Jt(s))throw new Error("Assertion Failed: argument is undefined or null");return s}function ta(s){return typeof s=="function"}function ny(s,e){let t=Math.min(s.length,e.length);for(let i=0;ifunction(){let r=Array.prototype.slice.call(arguments,0);return e(n,r)},i={};for(let n of s)i[n]=t(n);return i}function Vs(s){return s===null?void 0:s}function sy(s,e="Unreachable"){throw new Error(e)}var kf=class{constructor(){this._keyCodeToStr=[],this._strToKeyCode=Object.create(null)}define(e,t){this._keyCodeToStr[e]=t,this._strToKeyCode[t.toLowerCase()]=e}keyCodeToStr(e){return this._keyCodeToStr[e]}strToKeyCode(e){return this._strToKeyCode[e.toLowerCase()]||0}},nb=new kf,sb=new kf,rb=new kf;(function(){function s(e,t,i=t,n=i){nb.define(e,t),sb.define(e,i),rb.define(e,n)}s(0,"unknown"),s(1,"Backspace"),s(2,"Tab"),s(3,"Enter"),s(4,"Shift"),s(5,"Ctrl"),s(6,"Alt"),s(7,"PauseBreak"),s(8,"CapsLock"),s(9,"Escape"),s(10,"Space"),s(11,"PageUp"),s(12,"PageDown"),s(13,"End"),s(14,"Home"),s(15,"LeftArrow","Left"),s(16,"UpArrow","Up"),s(17,"RightArrow","Right"),s(18,"DownArrow","Down"),s(19,"Insert"),s(20,"Delete"),s(21,"0"),s(22,"1"),s(23,"2"),s(24,"3"),s(25,"4"),s(26,"5"),s(27,"6"),s(28,"7"),s(29,"8"),s(30,"9"),s(31,"A"),s(32,"B"),s(33,"C"),s(34,"D"),s(35,"E"),s(36,"F"),s(37,"G"),s(38,"H"),s(39,"I"),s(40,"J"),s(41,"K"),s(42,"L"),s(43,"M"),s(44,"N"),s(45,"O"),s(46,"P"),s(47,"Q"),s(48,"R"),s(49,"S"),s(50,"T"),s(51,"U"),s(52,"V"),s(53,"W"),s(54,"X"),s(55,"Y"),s(56,"Z"),s(57,"Meta"),s(58,"ContextMenu"),s(59,"F1"),s(60,"F2"),s(61,"F3"),s(62,"F4"),s(63,"F5"),s(64,"F6"),s(65,"F7"),s(66,"F8"),s(67,"F9"),s(68,"F10"),s(69,"F11"),s(70,"F12"),s(71,"F13"),s(72,"F14"),s(73,"F15"),s(74,"F16"),s(75,"F17"),s(76,"F18"),s(77,"F19"),s(78,"NumLock"),s(79,"ScrollLock"),s(80,";",";","OEM_1"),s(81,"=","=","OEM_PLUS"),s(82,",",",","OEM_COMMA"),s(83,"-","-","OEM_MINUS"),s(84,".",".","OEM_PERIOD"),s(85,"/","/","OEM_2"),s(86,"`","`","OEM_3"),s(110,"ABNT_C1"),s(111,"ABNT_C2"),s(87,"[","[","OEM_4"),s(88,"\\","\\","OEM_5"),s(89,"]","]","OEM_6"),s(90,"'","'","OEM_7"),s(91,"OEM_8"),s(92,"OEM_102"),s(93,"NumPad0"),s(94,"NumPad1"),s(95,"NumPad2"),s(96,"NumPad3"),s(97,"NumPad4"),s(98,"NumPad5"),s(99,"NumPad6"),s(100,"NumPad7"),s(101,"NumPad8"),s(102,"NumPad9"),s(103,"NumPad_Multiply"),s(104,"NumPad_Add"),s(105,"NumPad_Separator"),s(106,"NumPad_Subtract"),s(107,"NumPad_Decimal"),s(108,"NumPad_Divide")})();var Ar;(function(s){function e(o){return nb.keyCodeToStr(o)}s.toString=e;function t(o){return nb.strToKeyCode(o)}s.fromString=t;function i(o){return sb.keyCodeToStr(o)}s.toUserSettingsUS=i;function n(o){return rb.keyCodeToStr(o)}s.toUserSettingsGeneral=n;function r(o){return sb.strToKeyCode(o)||rb.strToKeyCode(o)}s.fromUserSettings=r})(Ar||(Ar={}));function ry(s,e){let t=(e&65535)<<16>>>0;return(s|t)>>>0}function Lh(s,e){if(s===0)return null;let t=(s&65535)>>>0,i=(s&4294901760)>>>16;return i!==0?new If([ob(t,e),ob(i,e)]):new If([ob(t,e)])}function ob(s,e){let t=!!(s&2048),i=!!(s&256),n=e===2?i:t,r=!!(s&1024),o=!!(s&512),a=e===2?t:i,l=s&255;return new El(n,r,o,a,l)}var El=class{constructor(e,t,i,n,r){this.ctrlKey=e,this.shiftKey=t,this.altKey=i,this.metaKey=n,this.keyCode=r}equals(e){return this.ctrlKey===e.ctrlKey&&this.shiftKey===e.shiftKey&&this.altKey===e.altKey&&this.metaKey===e.metaKey&&this.keyCode===e.keyCode}isModifierKey(){return this.keyCode===0||this.keyCode===5||this.keyCode===57||this.keyCode===6||this.keyCode===4}toChord(){return new If([this])}isDuplicateModifierCase(){return this.ctrlKey&&this.keyCode===5||this.shiftKey&&this.keyCode===4||this.altKey&&this.keyCode===6||this.metaKey&&this.keyCode===57}},If=class{constructor(e){if(e.length===0)throw Nr("parts");this.parts=e}},ab=class{constructor(e,t,i,n,r,o){this.ctrlKey=e,this.shiftKey=t,this.altKey=i,this.metaKey=n,this.keyLabel=r,this.keyAriaLabel=o}},lb=class{};var oy=new Array(230),cb=new Array(112);(function(){for(let e=0;e{let o=e.token.onCancellationRequested(()=>{o.dispose(),e.dispose(),r(Ll())});Promise.resolve(t).then(a=>{o.dispose(),e.dispose(),n(a)},a=>{o.dispose(),e.dispose(),r(a)})});return new class{cancel(){e.cancel()}then(n,r){return i.then(n,r)}catch(n){return this.then(void 0,n)}finally(n){return i.finally(n)}}}function M3(s,e,t){return Promise.race([s,new Promise(i=>e.onCancellationRequested(()=>i(t)))])}var cy=class{constructor(){this.activePromise=null,this.queuedPromise=null,this.queuedPromiseFactory=null}queue(e){if(this.activePromise){if(this.queuedPromiseFactory=e,!this.queuedPromise){let t=()=>{this.queuedPromise=null;let i=this.queue(this.queuedPromiseFactory);return this.queuedPromiseFactory=null,i};this.queuedPromise=new Promise(i=>{this.activePromise.then(t,t).then(i)})}return new Promise((t,i)=>{this.queuedPromise.then(t,i)})}return this.activePromise=e(),new Promise((t,i)=>{this.activePromise.then(n=>{this.activePromise=null,t(n)},n=>{this.activePromise=null,i(n)})})}},Nl=class{constructor(e){this.defaultDelay=e,this.timeout=null,this.completionPromise=null,this.doResolve=null,this.doReject=null,this.task=null}trigger(e,t=this.defaultDelay){return this.task=e,this.cancelTimeout(),this.completionPromise||(this.completionPromise=new Promise((i,n)=>{this.doResolve=i,this.doReject=n}).then(()=>{if(this.completionPromise=null,this.doResolve=null,this.task){let i=this.task;return this.task=null,i()}})),this.timeout=setTimeout(()=>{this.timeout=null,this.doResolve&&this.doResolve(null)},t),this.completionPromise}isTriggered(){return this.timeout!==null}cancel(){this.cancelTimeout(),this.completionPromise&&(this.doReject&&this.doReject(Ll()),this.completionPromise=null)}cancelTimeout(){this.timeout!==null&&(clearTimeout(this.timeout),this.timeout=null)}dispose(){this.cancel()}},ub=class{constructor(e){this.delayer=new Nl(e),this.throttler=new cy}trigger(e,t){return this.delayer.trigger(()=>this.throttler.queue(e),t)}dispose(){this.delayer.dispose()}};function Or(s,e){return e?new Promise((t,i)=>{let n=setTimeout(()=>{r.dispose(),t()},s),r=e.onCancellationRequested(()=>{clearTimeout(n),r.dispose(),i(Ll())})}):db(t=>Or(s,t))}function Dh(s,e=0){let t=setTimeout(s,e);return oe(()=>clearTimeout(t))}function R3(s,e=i=>!!i,t=null){let i=0,n=s.length,r=()=>{if(i>=n)return Promise.resolve(t);let o=s[i++];return Promise.resolve(o()).then(l=>e(l)?Promise.resolve(l):r())};return r()}var Ut=class{constructor(e,t){this._token=-1,typeof e=="function"&&typeof t=="number"&&this.setIfNotSet(e,t)}dispose(){this.cancel()}cancel(){this._token!==-1&&(clearTimeout(this._token),this._token=-1)}cancelAndSet(e,t){this.cancel(),this._token=setTimeout(()=>{this._token=-1,e()},t)}setIfNotSet(e,t){this._token===-1&&(this._token=setTimeout(()=>{this._token=-1,e()},t))}},es=class{constructor(){this._token=-1}dispose(){this.cancel()}cancel(){this._token!==-1&&(clearInterval(this._token),this._token=-1)}cancelAndSet(e,t){this.cancel(),this._token=setInterval(()=>{e()},t)}},$e=class{constructor(e,t){this.timeoutToken=-1,this.runner=e,this.timeout=t,this.timeoutHandler=this.onTimeout.bind(this)}dispose(){this.cancel(),this.runner=null}cancel(){this.isScheduled()&&(clearTimeout(this.timeoutToken),this.timeoutToken=-1)}schedule(e=this.timeout){this.cancel(),this.timeoutToken=setTimeout(this.timeoutHandler,e)}get delay(){return this.timeout}set delay(e){this.timeout=e}isScheduled(){return this.timeoutToken!==-1}onTimeout(){this.timeoutToken=-1,this.runner&&this.doRun()}doRun(){this.runner&&this.runner()}},fb;(function(){if(typeof requestIdleCallback!="function"||typeof cancelIdleCallback!="function"){let s=Object.freeze({didTimeout:!0,timeRemaining(){return 15}});fb=e=>{let t=setTimeout(()=>e(s)),i=!1;return{dispose(){i||(i=!0,clearTimeout(t))}}}}else fb=(s,e)=>{let t=requestIdleCallback(s,typeof e=="number"?{timeout:e}:void 0),i=!1;return{dispose(){i||(i=!0,cancelIdleCallback(t))}}}})();var Eh=class{constructor(e){this._didRun=!1,this._executor=()=>{try{this._value=e()}catch(t){this._error=t}finally{this._didRun=!0}},this._handle=fb(()=>this._executor())}dispose(){this._handle.dispose()}get value(){if(this._didRun||(this._handle.dispose(),this._executor()),this._error)throw this._error;return this._value}},Nf;(function(s){function e(t){return Q2(this,void 0,void 0,function*(){let i,n=yield Promise.all(t.map(r=>r.then(o=>o,o=>{i||(i=o)})));if(typeof i!="undefined")throw i;return n})}s.settled=e})(Nf||(Nf={}));var Tl;if(typeof Be.vscode!="undefined"&&typeof Be.vscode.process!="undefined"){let s=Be.vscode.process;Tl={get platform(){return s.platform},get env(){return s.env},cwd(){return s.cwd()},nextTick(e){return Xo(e)}}}else typeof process!="undefined"?Tl={get platform(){return process.platform},get env(){return process.env},cwd(){return process.env.VSCODE_CWD||process.cwd()},nextTick(s){return process.nextTick(s)}}:Tl={get platform(){return ot?"win32":ee?"darwin":"linux"},nextTick(s){return Xo(s)},get env(){return{}},cwd(){return"/"}};var Tf=Tl.cwd,hy=Tl.env,Pr=Tl.platform;var J2=65,eR=97,tR=90,iR=122,Fr=46,ei=47,Vi=92,Br=58,nR=63,mb=class extends Error{constructor(e,t,i){let n;typeof t=="string"&&t.indexOf("not ")===0?(n="must not be",t=t.replace(/^not /,"")):n="must be";let r=e.indexOf(".")!==-1?"property":"argument",o=`The "${e}" ${r} ${n} of type ${t}`;o+=`. Received type ${typeof i}`;super(o);this.code="ERR_INVALID_ARG_TYPE"}};function Et(s,e){if(typeof s!="string")throw new mb(e,"string",s)}function ve(s){return s===ei||s===Vi}function gb(s){return s===ei}function Wr(s){return s>=J2&&s<=tR||s>=eR&&s<=iR}function Mf(s,e,t,i){let n="",r=0,o=-1,a=0,l=0;for(let c=0;c<=s.length;++c){if(c2){let h=n.lastIndexOf(t);h===-1?(n="",r=0):(n=n.slice(0,h),r=n.length-1-n.lastIndexOf(t)),o=c,a=0;continue}else if(n.length!==0){n="",r=0,o=c,a=0;continue}}e&&(n+=n.length>0?`${t}..`:"..",r=2)}else n.length>0?n+=`${t}${s.slice(o+1,c)}`:n=s.slice(o+1,c),r=c-o-1;o=c,a=0}else l===Fr&&a!==-1?++a:a=-1}return n}function dy(s,e){if(e===null||typeof e!="object")throw new mb("pathObject","Object",e);let t=e.dir||e.root,i=e.base||`${e.name||""}${e.ext||""}`;return t?t===e.root?`${t}${i}`:`${t}${s}${i}`:i}var pi={resolve(...s){let e="",t="",i=!1;for(let n=s.length-1;n>=-1;n--){let r;if(n>=0){if(r=s[n],Et(r,"path"),r.length===0)continue}else e.length===0?r=Tf():(r=hy[`=${e}`]||Tf(),(r===void 0||r.slice(0,2).toLowerCase()!==e.toLowerCase()&&r.charCodeAt(2)===Vi)&&(r=`${e}\\`));let o=r.length,a=0,l="",c=!1,h=r.charCodeAt(0);if(o===1)ve(h)&&(a=1,c=!0);else if(ve(h))if(c=!0,ve(r.charCodeAt(1))){let d=2,u=d;for(;d2&&ve(r.charCodeAt(2))&&(c=!0,a=3));if(l.length>0)if(e.length>0){if(l.toLowerCase()!==e.toLowerCase())continue}else e=l;if(i){if(e.length>0)break}else if(t=`${r.slice(a)}\\${t}`,i=c,c&&e.length>0)break}return t=Mf(t,!i,"\\",ve),i?`${e}\\${t}`:`${e}${t}`||"."},normalize(s){Et(s,"path");let e=s.length;if(e===0)return".";let t=0,i,n=!1,r=s.charCodeAt(0);if(e===1)return gb(r)?"\\":s;if(ve(r))if(n=!0,ve(s.charCodeAt(1))){let a=2,l=a;for(;a2&&ve(s.charCodeAt(2))&&(n=!0,t=3));let o=t0&&ve(s.charCodeAt(e-1))&&(o+="\\"),i===void 0?n?`\\${o}`:o:n?`${i}\\${o}`:`${i}${o}`},isAbsolute(s){Et(s,"path");let e=s.length;if(e===0)return!1;let t=s.charCodeAt(0);return ve(t)||e>2&&Wr(t)&&s.charCodeAt(1)===Br&&ve(s.charCodeAt(2))},join(...s){if(s.length===0)return".";let e,t;for(let r=0;r0&&(e===void 0?e=t=o:e+=`\\${o}`)}if(e===void 0)return".";let i=!0,n=0;if(typeof t=="string"&&ve(t.charCodeAt(0))){++n;let r=t.length;r>1&&ve(t.charCodeAt(1))&&(++n,r>2&&(ve(t.charCodeAt(2))?++n:i=!1))}if(i){for(;n=2&&(e=`\\${e.slice(n)}`)}return pi.normalize(e)},relative(s,e){if(Et(s,"from"),Et(e,"to"),s===e)return"";let t=pi.resolve(s),i=pi.resolve(e);if(t===i||(s=t.toLowerCase(),e=i.toLowerCase(),s===e))return"";let n=0;for(;nn&&s.charCodeAt(r-1)===Vi;)r--;let o=r-n,a=0;for(;aa&&e.charCodeAt(l-1)===Vi;)l--;let c=l-a,h=oh){if(e.charCodeAt(a+u)===Vi)return i.slice(a+u+1);if(u===2)return i.slice(a+u)}o>h&&(s.charCodeAt(n+u)===Vi?d=u:u===2&&(d=3)),d===-1&&(d=0)}let f="";for(u=n+d+1;u<=r;++u)(u===r||s.charCodeAt(u)===Vi)&&(f+=f.length===0?"..":"\\..");return a+=d,f.length>0?`${f}${i.slice(a,l)}`:(i.charCodeAt(a)===Vi&&++a,i.slice(a,l))},toNamespacedPath(s){if(typeof s!="string")return s;if(s.length===0)return"";let e=pi.resolve(s);if(e.length<=2)return s;if(e.charCodeAt(0)===Vi){if(e.charCodeAt(1)===Vi){let t=e.charCodeAt(2);if(t!==nR&&t!==Fr)return`\\\\?\\UNC\\${e.slice(2)}`}}else if(Wr(e.charCodeAt(0))&&e.charCodeAt(1)===Br&&e.charCodeAt(2)===Vi)return`\\\\?\\${e}`;return s},dirname(s){Et(s,"path");let e=s.length;if(e===0)return".";let t=-1,i=0,n=s.charCodeAt(0);if(e===1)return ve(n)?s:".";if(ve(n)){if(t=i=1,ve(s.charCodeAt(1))){let a=2,l=a;for(;a2&&ve(s.charCodeAt(2))?3:2,i=t);let r=-1,o=!0;for(let a=e-1;a>=i;--a)if(ve(s.charCodeAt(a))){if(!o){r=a;break}}else o=!1;if(r===-1){if(t===-1)return".";r=t}return s.slice(0,r)},basename(s,e){e!==void 0&&Et(e,"ext"),Et(s,"path");let t=0,i=-1,n=!0,r;if(s.length>=2&&Wr(s.charCodeAt(0))&&s.charCodeAt(1)===Br&&(t=2),e!==void 0&&e.length>0&&e.length<=s.length){if(e===s)return"";let o=e.length-1,a=-1;for(r=s.length-1;r>=t;--r){let l=s.charCodeAt(r);if(ve(l)){if(!n){t=r+1;break}}else a===-1&&(n=!1,a=r+1),o>=0&&(l===e.charCodeAt(o)?--o==-1&&(i=r):(o=-1,i=a))}return t===i?i=a:i===-1&&(i=s.length),s.slice(t,i)}for(r=s.length-1;r>=t;--r)if(ve(s.charCodeAt(r))){if(!n){t=r+1;break}}else i===-1&&(n=!1,i=r+1);return i===-1?"":s.slice(t,i)},extname(s){Et(s,"path");let e=0,t=-1,i=0,n=-1,r=!0,o=0;s.length>=2&&s.charCodeAt(1)===Br&&Wr(s.charCodeAt(0))&&(e=i=2);for(let a=s.length-1;a>=e;--a){let l=s.charCodeAt(a);if(ve(l)){if(!r){i=a+1;break}continue}n===-1&&(r=!1,n=a+1),l===Fr?t===-1?t=a:o!==1&&(o=1):t!==-1&&(o=-1)}return t===-1||n===-1||o===0||o===1&&t===n-1&&t===i+1?"":s.slice(t,n)},format:dy.bind(null,"\\"),parse(s){Et(s,"path");let e={root:"",dir:"",base:"",ext:"",name:""};if(s.length===0)return e;let t=s.length,i=0,n=s.charCodeAt(0);if(t===1)return ve(n)?(e.root=e.dir=s,e):(e.base=e.name=s,e);if(ve(n)){if(i=1,ve(s.charCodeAt(1))){let d=2,u=d;for(;d0&&(e.root=s.slice(0,i));let r=-1,o=i,a=-1,l=!0,c=s.length-1,h=0;for(;c>=i;--c){if(n=s.charCodeAt(c),ve(n)){if(!l){o=c+1;break}continue}a===-1&&(l=!1,a=c+1),n===Fr?r===-1?r=c:h!==1&&(h=1):r!==-1&&(h=-1)}return a!==-1&&(r===-1||h===0||h===1&&r===a-1&&r===o+1?e.base=e.name=s.slice(o,a):(e.name=s.slice(o,r),e.base=s.slice(o,a),e.ext=s.slice(r,a))),o>0&&o!==i?e.dir=s.slice(0,o-1):e.dir=e.root,e},sep:"\\",delimiter:";",win32:null,posix:null},Ze={resolve(...s){let e="",t=!1;for(let i=s.length-1;i>=-1&&!t;i--){let n=i>=0?s[i]:Tf();Et(n,"path"),n.length!==0&&(e=`${n}/${e}`,t=n.charCodeAt(0)===ei)}return e=Mf(e,!t,"/",gb),t?`/${e}`:e.length>0?e:"."},normalize(s){if(Et(s,"path"),s.length===0)return".";let e=s.charCodeAt(0)===ei,t=s.charCodeAt(s.length-1)===ei;return s=Mf(s,!e,"/",gb),s.length===0?e?"/":t?"./":".":(t&&(s+="/"),e?`/${s}`:s)},isAbsolute(s){return Et(s,"path"),s.length>0&&s.charCodeAt(0)===ei},join(...s){if(s.length===0)return".";let e;for(let t=0;t0&&(e===void 0?e=i:e+=`/${i}`)}return e===void 0?".":Ze.normalize(e)},relative(s,e){if(Et(s,"from"),Et(e,"to"),s===e||(s=Ze.resolve(s),e=Ze.resolve(e),s===e))return"";let t=1,i=s.length,n=i-t,r=1,o=e.length-r,a=na){if(e.charCodeAt(r+c)===ei)return e.slice(r+c+1);if(c===0)return e.slice(r+c)}else n>a&&(s.charCodeAt(t+c)===ei?l=c:c===0&&(l=0));let h="";for(c=t+l+1;c<=i;++c)(c===i||s.charCodeAt(c)===ei)&&(h+=h.length===0?"..":"/..");return`${h}${e.slice(r+l)}`},toNamespacedPath(s){return s},dirname(s){if(Et(s,"path"),s.length===0)return".";let e=s.charCodeAt(0)===ei,t=-1,i=!0;for(let n=s.length-1;n>=1;--n)if(s.charCodeAt(n)===ei){if(!i){t=n;break}}else i=!1;return t===-1?e?"/":".":e&&t===1?"//":s.slice(0,t)},basename(s,e){e!==void 0&&Et(e,"ext"),Et(s,"path");let t=0,i=-1,n=!0,r;if(e!==void 0&&e.length>0&&e.length<=s.length){if(e===s)return"";let o=e.length-1,a=-1;for(r=s.length-1;r>=0;--r){let l=s.charCodeAt(r);if(l===ei){if(!n){t=r+1;break}}else a===-1&&(n=!1,a=r+1),o>=0&&(l===e.charCodeAt(o)?--o==-1&&(i=r):(o=-1,i=a))}return t===i?i=a:i===-1&&(i=s.length),s.slice(t,i)}for(r=s.length-1;r>=0;--r)if(s.charCodeAt(r)===ei){if(!n){t=r+1;break}}else i===-1&&(n=!1,i=r+1);return i===-1?"":s.slice(t,i)},extname(s){Et(s,"path");let e=-1,t=0,i=-1,n=!0,r=0;for(let o=s.length-1;o>=0;--o){let a=s.charCodeAt(o);if(a===ei){if(!n){t=o+1;break}continue}i===-1&&(n=!1,i=o+1),a===Fr?e===-1?e=o:r!==1&&(r=1):e!==-1&&(r=-1)}return e===-1||i===-1||r===0||r===1&&e===i-1&&e===t+1?"":s.slice(e,i)},format:dy.bind(null,"/"),parse(s){Et(s,"path");let e={root:"",dir:"",base:"",ext:"",name:""};if(s.length===0)return e;let t=s.charCodeAt(0)===ei,i;t?(e.root="/",i=1):i=0;let n=-1,r=0,o=-1,a=!0,l=s.length-1,c=0;for(;l>=i;--l){let h=s.charCodeAt(l);if(h===ei){if(!a){r=l+1;break}continue}o===-1&&(a=!1,o=l+1),h===Fr?n===-1?n=l:c!==1&&(c=1):n!==-1&&(c=-1)}if(o!==-1){let h=r===0&&t?1:r;n===-1||c===0||c===1&&n===o-1&&n===r+1?e.base=e.name=s.slice(h,o):(e.name=s.slice(h,n),e.base=s.slice(h,o),e.ext=s.slice(n,o))}return r>0?e.dir=s.slice(0,r-1):t&&(e.dir="/"),e},sep:"/",delimiter:":",win32:null,posix:null};Ze.win32=pi.win32=pi;Ze.posix=pi.posix=Ze;var Ml=Pr==="win32"?pi.normalize:Ze.normalize,uy=Pr==="win32"?pi.resolve:Ze.resolve,fy=Pr==="win32"?pi.relative:Ze.relative,my=Pr==="win32"?pi.dirname:Ze.dirname,Rf=Pr==="win32"?pi.basename:Ze.basename,gy=Pr==="win32"?pi.extname:Ze.extname,Rl=Pr==="win32"?pi.sep:Ze.sep;var sR=/^\w[\w\d+.-]*$/,rR=/^\//,oR=/^\/\//;function py(s,e){if(!s.scheme&&e)throw new Error(`[UriError]: Scheme is missing: {scheme: "", authority: "${s.authority}", path: "${s.path}", query: "${s.query}", fragment: "${s.fragment}"}`);if(s.scheme&&!sR.test(s.scheme))throw new Error("[UriError]: Scheme contains illegal characters.");if(s.path){if(s.authority){if(!rR.test(s.path))throw new Error('[UriError]: If a URI contains an authority component, then the path component must either be empty or begin with a slash ("/") character')}else if(oR.test(s.path))throw new Error('[UriError]: If a URI does not contain an authority component, then the path cannot begin with two slash characters ("//")')}}function aR(s,e){return!s&&!e?"file":s}function lR(s,e){switch(s){case"https":case"http":case"file":e?e[0]!==Rn&&(e=Rn+e):e=Rn;break}return e}var Je="",Rn="/",cR=/^(([^:/?#]+?):)?(\/\/([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?/,K=class{constructor(e,t,i,n,r,o=!1){typeof e=="object"?(this.scheme=e.scheme||Je,this.authority=e.authority||Je,this.path=e.path||Je,this.query=e.query||Je,this.fragment=e.fragment||Je):(this.scheme=aR(e,o),this.authority=t||Je,this.path=lR(this.scheme,i||Je),this.query=n||Je,this.fragment=r||Je,py(this,o))}static isUri(e){return e instanceof K?!0:e?typeof e.authority=="string"&&typeof e.fragment=="string"&&typeof e.path=="string"&&typeof e.query=="string"&&typeof e.scheme=="string"&&typeof e.fsPath=="string"&&typeof e.with=="function"&&typeof e.toString=="function":!1}get fsPath(){return kh(this,!1)}with(e){if(!e)return this;let{scheme:t,authority:i,path:n,query:r,fragment:o}=e;return t===void 0?t=this.scheme:t===null&&(t=Je),i===void 0?i=this.authority:i===null&&(i=Je),n===void 0?n=this.path:n===null&&(n=Je),r===void 0?r=this.query:r===null&&(r=Je),o===void 0?o=this.fragment:o===null&&(o=Je),t===this.scheme&&i===this.authority&&n===this.path&&r===this.query&&o===this.fragment?this:new ia(t,i,n,r,o)}static parse(e,t=!1){let i=cR.exec(e);return i?new ia(i[2]||Je,Af(i[4]||Je),Af(i[5]||Je),Af(i[7]||Je),Af(i[9]||Je),t):new ia(Je,Je,Je,Je,Je)}static file(e){let t=Je;if(ot&&(e=e.replace(/\\/g,Rn)),e[0]===Rn&&e[1]===Rn){let i=e.indexOf(Rn,2);i===-1?(t=e.substring(2),e=Rn):(t=e.substring(2,i),e=e.substring(i)||Rn)}return new ia("file",t,e,Je,Je)}static from(e){let t=new ia(e.scheme,e.authority,e.path,e.query,e.fragment);return py(t,!0),t}static joinPath(e,...t){if(!e.path)throw new Error("[UriError]: cannot call joinPath on URI without path");let i;return ot&&e.scheme==="file"?i=K.file(pi.join(kh(e,!0),...t)).path:i=Ze.join(e.path,...t),e.with({path:i})}toString(e=!1){return pb(this,e)}toJSON(){return this}static revive(e){if(e){if(e instanceof K)return e;{let t=new ia(e);return t._formatted=e.external,t._fsPath=e._sep===_y?e.fsPath:null,t}}else return e}},_y=ot?1:void 0,ia=class extends K{constructor(){super(...arguments);this._formatted=null,this._fsPath=null}get fsPath(){return this._fsPath||(this._fsPath=kh(this,!1)),this._fsPath}toString(e=!1){return e?pb(this,!0):(this._formatted||(this._formatted=pb(this,!1)),this._formatted)}toJSON(){let e={$mid:1};return this._fsPath&&(e.fsPath=this._fsPath,e._sep=_y),this._formatted&&(e.external=this._formatted),this.path&&(e.path=this.path),this.scheme&&(e.scheme=this.scheme),this.authority&&(e.authority=this.authority),this.query&&(e.query=this.query),this.fragment&&(e.fragment=this.fragment),e}},by={[58]:"%3A",[47]:"%2F",[63]:"%3F",[35]:"%23",[91]:"%5B",[93]:"%5D",[64]:"%40",[33]:"%21",[36]:"%24",[38]:"%26",[39]:"%27",[40]:"%28",[41]:"%29",[42]:"%2A",[43]:"%2B",[44]:"%2C",[59]:"%3B",[61]:"%3D",[32]:"%20"};function wy(s,e){let t,i=-1;for(let n=0;n=97&&r<=122||r>=65&&r<=90||r>=48&&r<=57||r===45||r===46||r===95||r===126||e&&r===47)i!==-1&&(t+=encodeURIComponent(s.substring(i,n)),i=-1),t!==void 0&&(t+=s.charAt(n));else{t===void 0&&(t=s.substr(0,n));let o=by[r];o!==void 0?(i!==-1&&(t+=encodeURIComponent(s.substring(i,n)),i=-1),t+=o):i===-1&&(i=n)}}return i!==-1&&(t+=encodeURIComponent(s.substring(i))),t!==void 0?t:s}function hR(s){let e;for(let t=0;t1&&s.scheme==="file"?t=`//${s.authority}${s.path}`:s.path.charCodeAt(0)===47&&(s.path.charCodeAt(1)>=65&&s.path.charCodeAt(1)<=90||s.path.charCodeAt(1)>=97&&s.path.charCodeAt(1)<=122)&&s.path.charCodeAt(2)===58?e?t=s.path.substr(1):t=s.path[1].toLowerCase()+s.path.substr(2):t=s.path,ot&&(t=t.replace(/\//g,"\\")),t}function pb(s,e){let t=e?hR:wy,i="",{scheme:n,authority:r,path:o,query:a,fragment:l}=s;if(n&&(i+=n,i+=":"),(r||n==="file")&&(i+=Rn,i+=Rn),r){let c=r.indexOf("@");if(c!==-1){let h=r.substr(0,c);r=r.substr(c+1),c=h.indexOf(":"),c===-1?i+=t(h,!1):(i+=t(h.substr(0,c),!1),i+=":",i+=t(h.substr(c+1),!1)),i+="@"}r=r.toLowerCase(),c=r.indexOf(":"),c===-1?i+=t(r,!1):(i+=t(r.substr(0,c),!1),i+=r.substr(c))}if(o){if(o.length>=3&&o.charCodeAt(0)===47&&o.charCodeAt(2)===58){let c=o.charCodeAt(1);c>=65&&c<=90&&(o=`/${String.fromCharCode(c+32)}:${o.substr(3)}`)}else if(o.length>=2&&o.charCodeAt(1)===58){let c=o.charCodeAt(0);c>=65&&c<=90&&(o=`${String.fromCharCode(c+32)}:${o.substr(2)}`)}i+=t(o,!0)}return a&&(i+="?",i+=t(a,!1)),l&&(i+="#",i+=e?l:wy(l,!1)),i}function vy(s){try{return decodeURIComponent(s)}catch(e){return s.length>3?s.substr(0,3)+vy(s.substr(3)):s}}var Cy=/(%[0-9A-Za-z][0-9A-Za-z])+/g;function Af(s){return s.match(Cy)?s.replace(Cy,e=>vy(e)):s}var Ce;(function(s){s.inMemory="inmemory",s.vscode="vscode",s.internal="private",s.walkThrough="walkThrough",s.walkThroughSnippet="walkThroughSnippet",s.http="http",s.https="https",s.file="file",s.mailto="mailto",s.untitled="untitled",s.data="data",s.command="command",s.vscodeRemote="vscode-remote",s.vscodeRemoteResource="vscode-remote-resource",s.userData="vscode-userdata",s.vscodeCustomEditor="vscode-custom-editor",s.vscodeNotebook="vscode-notebook",s.vscodeNotebookCell="vscode-notebook-cell",s.vscodeNotebookCellMetadata="vscode-notebook-cell-metadata",s.vscodeNotebookCellOutput="vscode-notebook-cell-output",s.vscodeInteractive="vscode-interactive",s.vscodeInteractiveInput="vscode-interactive-input",s.vscodeSettings="vscode-settings",s.vscodeWorkspaceTrust="vscode-workspace-trust",s.vscodeTerminal="vscode-terminal",s.webviewPanel="webview-panel",s.vscodeWebview="vscode-webview",s.extension="extension",s.vscodeFileResource="vscode-file",s.tmp="tmp"})(Ce||(Ce={}));var Sy=class{constructor(){this._hosts=Object.create(null),this._ports=Object.create(null),this._connectionTokens=Object.create(null),this._preferredWebSchema="http",this._delegate=null}setPreferredWebSchema(e){this._preferredWebSchema=e}rewrite(e){if(this._delegate)return this._delegate(e);let t=e.authority,i=this._hosts[t];i&&i.indexOf(":")!==-1&&(i=`[${i}]`);let n=this._ports[t],r=this._connectionTokens[t],o=`path=${encodeURIComponent(e.path)}`;return typeof r=="string"&&(o+=`&tkn=${encodeURIComponent(r)}`),K.from({scheme:Zo?this._preferredWebSchema:Ce.vscodeRemoteResource,authority:`${i}:${n}`,path:"/vscode-remote-resource",query:o})}},_b=new Sy,yy=class{constructor(){this.FALLBACK_AUTHORITY="vscode-app"}asBrowserUri(e,t,i){let n=this.toUri(e,t);if(n.scheme===Ce.vscodeRemote)return _b.rewrite(n);let r=!1;return Mr&&(i||$1)&&n.scheme===Ce.file&&(r=!0),n.scheme===Ce.file&&typeof Be.importScripts=="function"&&Be.origin==="vscode-file://vscode-app"&&(r=!0),r?n.with({scheme:Ce.vscodeFileResource,authority:n.authority||this.FALLBACK_AUTHORITY,query:null,fragment:null}):n}toUri(e,t){return K.isUri(e)?e:K.parse(t.toUrl(e))}},Ly=new yy;var na={clipboard:{writeText:Mr||document.queryCommandSupported&&document.queryCommandSupported("copy")||!!(navigator&&navigator.clipboard&&navigator.clipboard.writeText),readText:Mr||!!(navigator&&navigator.clipboard&&navigator.clipboard.readText)},keyboard:(()=>Mr||ty?0:navigator.keyboard||_n?1:2)(),touch:"ontouchstart"in window||navigator.maxTouchPoints>0,pointerEvents:window.PointerEvent&&("ontouchstart"in window||window.navigator.maxTouchPoints>0||navigator.maxTouchPoints>0)};function Mt(s){for(;s.firstChild;)s.firstChild.remove()}function Of(s){var e;return(e=s==null?void 0:s.isConnected)!==null&&e!==void 0?e:!1}var xy=class{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 O(s,e,t,i){return new xy(s,e,t,i)}function Dy(s){return function(e){return s(new Bt(e))}}function dR(s){return function(e){return s(new De(e))}}var lt=function(e,t,i,n){let r=i;return t==="click"||t==="mousedown"?r=Dy(i):(t==="keydown"||t==="keypress"||t==="keyup")&&(r=dR(i)),O(e,t,r,n)},sB=function(e,t,i){let n=Dy(t);return uR(e,n,i)};function uR(s,e,t){return O(s,en&&na.pointerEvents?z.POINTER_DOWN:z.MOUSE_DOWN,e,t)}function rB(s,e,t){return O(s,en&&na.pointerEvents?z.POINTER_UP:z.MOUSE_UP,e,t)}function Pf(s,e){return O(s,"mouseout",t=>{let i=t.relatedTarget;for(;i&&i!==s;)i=i.parentNode;i!==s&&e(t)})}function Ey(s,e){return O(s,"pointerout",t=>{let i=t.relatedTarget;for(;i&&i!==s;)i=i.parentNode;i!==s&&e(t)})}var bb=null;function fR(s){if(!bb){let e=t=>setTimeout(()=>t(new Date().getTime()),0);bb=self.requestAnimationFrame||self.msRequestAnimationFrame||self.webkitRequestAnimationFrame||self.mozRequestAnimationFrame||self.oRequestAnimationFrame||e}return bb.call(self,s)}var wb,Ti,Ff=class{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){de(e)}}static sort(e,t){return t.priority-e.priority}};(function(){let s=[],e=null,t=!1,i=!1,n=()=>{for(t=!1,e=s,s=[],i=!0;e.length>0;)e.sort(Ff.sort),e.shift().execute();i=!1};Ti=(r,o=0)=>{let a=new Ff(r,o);return s.push(a),t||(t=!0,fR(n)),a},wb=(r,o)=>{if(i){let a=new Ff(r,o);return e.push(a),a}else return Ti(r,o)}})();var mR=8,gR=function(s,e){return e},ky=class extends M{constructor(e,t,i,n=gR,r=mR){super();let o=null,a=0,l=this._register(new Ut),c=()=>{a=new Date().getTime(),i(o),o=null};this._register(O(e,t,h=>{o=n(o,h);let d=new Date().getTime()-a;d>=r?(l.cancel(),c()):l.setIfNotSet(c,r-d)}))}};function Ih(s,e,t,i,n){return new ky(s,e,t,i,n)}function Iy(s){return document.defaultView.getComputedStyle(s,null)}function Bf(s){if(s!==document.body)return new tn(s.clientWidth,s.clientHeight);if(en&&window.visualViewport)return new tn(window.visualViewport.width,window.visualViewport.height);if(window.innerWidth&&window.innerHeight)return new tn(window.innerWidth,window.innerHeight);if(document.body&&document.body.clientWidth&&document.body.clientHeight)return new tn(document.body.clientWidth,document.body.clientHeight);if(document.documentElement&&document.documentElement.clientWidth&&document.documentElement.clientHeight)return new tn(document.documentElement.clientWidth,document.documentElement.clientHeight);throw new Error("Unable to figure out browser width and height")}var Ke=class{static convertToPixels(e,t){return parseFloat(t)||0}static getDimension(e,t,i){let n=Iy(e),r="0";return n&&(n.getPropertyValue?r=n.getPropertyValue(t):r=n.getAttribute(i)),Ke.convertToPixels(e,r)}static getBorderLeftWidth(e){return Ke.getDimension(e,"border-left-width","borderLeftWidth")}static getBorderRightWidth(e){return Ke.getDimension(e,"border-right-width","borderRightWidth")}static getBorderTopWidth(e){return Ke.getDimension(e,"border-top-width","borderTopWidth")}static getBorderBottomWidth(e){return Ke.getDimension(e,"border-bottom-width","borderBottomWidth")}static getPaddingLeft(e){return Ke.getDimension(e,"padding-left","paddingLeft")}static getPaddingRight(e){return Ke.getDimension(e,"padding-right","paddingRight")}static getPaddingTop(e){return Ke.getDimension(e,"padding-top","paddingTop")}static getPaddingBottom(e){return Ke.getDimension(e,"padding-bottom","paddingBottom")}static getMarginLeft(e){return Ke.getDimension(e,"margin-left","marginLeft")}static getMarginTop(e){return Ke.getDimension(e,"margin-top","marginTop")}static getMarginRight(e){return Ke.getDimension(e,"margin-right","marginRight")}static getMarginBottom(e){return Ke.getDimension(e,"margin-bottom","marginBottom")}},tn=class{constructor(e,t){this.width=e,this.height=t}with(e=this.width,t=this.height){return e!==this.width||t!==this.height?new tn(e,t):this}static is(e){return typeof e=="object"&&typeof e.height=="number"&&typeof e.width=="number"}static lift(e){return e instanceof tn?e:new tn(e.width,e.height)}static equals(e,t){return e===t?!0:!e||!t?!1:e.width===t.width&&e.height===t.height}};function Ny(s){let e=s.offsetParent,t=s.offsetTop,i=s.offsetLeft;for(;(s=s.parentNode)!==null&&s!==document.body&&s!==document.documentElement;){t-=s.scrollTop;let n=My(s)?null:Iy(s);n&&(i-=n.direction!=="rtl"?s.scrollLeft:-s.scrollLeft),s===e&&(i+=Ke.getBorderLeftWidth(s),t+=Ke.getBorderTopWidth(s),t+=s.offsetTop,i+=s.offsetLeft,e=s.offsetParent)}return{left:i,top:t}}function oB(s,e,t){typeof e=="number"&&(s.style.width=`${e}px`),typeof t=="number"&&(s.style.height=`${t}px`)}function ti(s){let e=s.getBoundingClientRect();return{left:e.left+An.scrollX,top:e.top+An.scrollY,width:e.width,height:e.height}}var An=new class{get scrollX(){return typeof window.scrollX=="number"?window.scrollX:document.body.scrollLeft+document.documentElement.scrollLeft}get scrollY(){return typeof window.scrollY=="number"?window.scrollY:document.body.scrollTop+document.documentElement.scrollTop}};function Nh(s){let e=Ke.getMarginLeft(s)+Ke.getMarginRight(s);return s.offsetWidth+e}function Wf(s){let e=Ke.getBorderLeftWidth(s)+Ke.getBorderRightWidth(s),t=Ke.getPaddingLeft(s)+Ke.getPaddingRight(s);return s.offsetWidth-e-t}function Ty(s){let e=Ke.getBorderTopWidth(s)+Ke.getBorderBottomWidth(s),t=Ke.getPaddingTop(s)+Ke.getPaddingBottom(s);return s.offsetHeight-e-t}function Th(s){let e=Ke.getMarginTop(s)+Ke.getMarginBottom(s);return s.offsetHeight+e}function bn(s,e){for(;s;){if(s===e)return!0;s=s.parentNode}return!1}function vb(s,e,t){for(;s&&s.nodeType===s.ELEMENT_NODE;){if(s.classList.contains(e))return s;if(t){if(typeof t=="string"){if(s.classList.contains(t))return null}else if(s===t)return null}s=s.parentNode}return null}function Cb(s,e,t){return!!vb(s,e,t)}function My(s){return s&&!!s.host&&!!s.mode}function Al(s){return!!Vr(s)}function Vr(s){for(;s.parentNode;){if(s===document.body)return null;s=s.parentNode}return My(s)?s:null}function jr(){let s=document.activeElement;for(;s==null?void 0:s.shadowRoot;)s=s.shadowRoot.activeElement;return s}function kt(s=document.getElementsByTagName("head")[0]){let e=document.createElement("style");return e.type="text/css",e.media="screen",s.appendChild(e),e}var Sb=null;function Ry(){return Sb||(Sb=kt()),Sb}function pR(s){var e,t;return((e=s==null?void 0:s.sheet)===null||e===void 0?void 0:e.rules)?s.sheet.rules:((t=s==null?void 0:s.sheet)===null||t===void 0?void 0:t.cssRules)?s.sheet.cssRules:[]}function yb(s,e,t=Ry()){!t||!e||t.sheet.insertRule(s+"{"+e+"}",0)}function Lb(s,e=Ry()){if(!e)return;let t=pR(e),i=[];for(let n=0;n=0;n--)e.sheet.deleteRule(i[n])}function Vf(s){return typeof HTMLElement=="object"?s instanceof HTMLElement:s&&typeof s=="object"&&s.nodeType===1&&typeof s.nodeName=="string"}var z={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",CONTEXT_MENU:"contextmenu",WHEEL:"wheel",KEY_DOWN:"keydown",KEY_PRESS:"keypress",KEY_UP:"keyup",LOAD:"load",BEFORE_UNLOAD:"beforeunload",UNLOAD:"unload",ABORT:"abort",ERROR:"error",RESIZE:"resize",SCROLL:"scroll",FULLSCREEN_CHANGE:"fullscreenchange",WK_FULLSCREEN_CHANGE:"webkitfullscreenchange",SELECT:"select",CHANGE:"change",SUBMIT:"submit",RESET:"reset",FOCUS:"focus",FOCUS_IN:"focusin",FOCUS_OUT:"focusout",BLUR:"blur",INPUT:"input",STORAGE:"storage",DRAG_START:"dragstart",DRAG:"drag",DRAG_ENTER:"dragenter",DRAG_LEAVE:"dragleave",DRAG_OVER:"dragover",DROP:"drop",DRAG_END:"dragend",ANIMATION_START:Tn?"webkitAnimationStart":"animationstart",ANIMATION_END:Tn?"webkitAnimationEnd":"animationend",ANIMATION_ITERATION:Tn?"webkitAnimationIteration":"animationiteration"},ke={stop:function(s,e){s.preventDefault?s.preventDefault():s.returnValue=!1,e&&(s.stopPropagation?s.stopPropagation():s.cancelBubble=!0)}};function Ay(s){let e=[];for(let t=0;s&&s.nodeType===s.ELEMENT_NODE;t++)e[t]=s.scrollTop,s=s.parentNode;return e}function Oy(s,e){for(let t=0;s&&s.nodeType===s.ELEMENT_NODE;t++)s.scrollTop!==e[t]&&(s.scrollTop=e[t]),s=s.parentNode}var Py=class extends M{constructor(e){super();this._onDidFocus=this._register(new k),this.onDidFocus=this._onDidFocus.event,this._onDidBlur=this._register(new k),this.onDidBlur=this._onDidBlur.event;let t=bn(document.activeElement,e),i=!1,n=()=>{i=!1,t||(t=!0,this._onDidFocus.fire())},r=()=>{t&&(i=!0,window.setTimeout(()=>{i&&(i=!1,t=!1,this._onDidBlur.fire())},0))};this._refreshStateHandler=()=>{bn(document.activeElement,e)!==t&&(t?r():n())},this._register(O(e,z.FOCUS,n,!0)),this._register(O(e,z.BLUR,r,!0))}};function zr(s){return new Py(s)}function W(s,...e){if(s.append(...e),e.length===1&&typeof e[0]!="string")return e[0]}function aB(s,e){return s.insertBefore(e,s.firstChild),e}function sa(s,...e){s.innerText="",W(s,...e)}var _R=/([\w\-]+)?(#([\w\-]+))?((\.([\w\-]+))*)/,Mh;(function(s){s.HTML="http://www.w3.org/1999/xhtml",s.SVG="http://www.w3.org/2000/svg"})(Mh||(Mh={}));function Fy(s,e,t,...i){let n=_R.exec(e);if(!n)throw new Error("Bad use of emmet");t=Object.assign({},t||{});let r=n[1]||"div",o;return s!==Mh.HTML?o=document.createElementNS(s,r):o=document.createElement(r),n[3]&&(o.id=n[3]),n[4]&&(o.className=n[4].replace(/\./g," ").trim()),Object.keys(t).forEach(a=>{let l=t[a];typeof l!="undefined"&&(/^on\w+$/.test(a)?o[a]=l:a==="selected"?l&&o.setAttribute(a,"true"):o.setAttribute(a,l))}),o.append(...i),o}function H(s,e,...t){return Fy(Mh.HTML,s,e,...t)}H.SVG=function(s,e,...t){return Fy(Mh.SVG,s,e,...t)};function jf(...s){for(let e of s)e.style.display="",e.removeAttribute("aria-hidden")}function xb(...s){for(let e of s)e.style.display="none",e.setAttribute("aria-hidden","true")}function By(s){return Array.prototype.slice.call(document.getElementsByTagName(s),0)}function Db(s){let e=window.devicePixelRatio*s;return Math.max(1,Math.floor(e))/window.devicePixelRatio}function zf(s){window.open(s,"_blank","noopener")}function Wy(s){let e=()=>{s(),t=Ti(e)},t=Ti(e);return oe(()=>t.dispose())}_b.setPreferredWebSchema(/^https:/.test(window.location.href)?"https":"http");function Hr(s){return s?`url('${Ly.asBrowserUri(s).toString(!0).replace(/'/g,"%27")}')`:"url('')"}function Eb(s){return`'${s.replace(/'/g,"%27")}'`}var Ur=class extends k{constructor(){super();this._subscriptions=new U,this._keyStatus={altKey:!1,shiftKey:!1,ctrlKey:!1,metaKey:!1},this._subscriptions.add(O(window,"keydown",e=>{if(e.defaultPrevented)return;let t=new De(e);if(!(t.keyCode===6&&e.repeat)){if(e.altKey&&!this._keyStatus.altKey)this._keyStatus.lastKeyPressed="alt";else if(e.ctrlKey&&!this._keyStatus.ctrlKey)this._keyStatus.lastKeyPressed="ctrl";else if(e.metaKey&&!this._keyStatus.metaKey)this._keyStatus.lastKeyPressed="meta";else if(e.shiftKey&&!this._keyStatus.shiftKey)this._keyStatus.lastKeyPressed="shift";else if(t.keyCode!==6)this._keyStatus.lastKeyPressed=void 0;else return;this._keyStatus.altKey=e.altKey,this._keyStatus.ctrlKey=e.ctrlKey,this._keyStatus.metaKey=e.metaKey,this._keyStatus.shiftKey=e.shiftKey,this._keyStatus.lastKeyPressed&&(this._keyStatus.event=e,this.fire(this._keyStatus))}},!0)),this._subscriptions.add(O(window,"keyup",e=>{e.defaultPrevented||(!e.altKey&&this._keyStatus.altKey?this._keyStatus.lastKeyReleased="alt":!e.ctrlKey&&this._keyStatus.ctrlKey?this._keyStatus.lastKeyReleased="ctrl":!e.metaKey&&this._keyStatus.metaKey?this._keyStatus.lastKeyReleased="meta":!e.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=e.altKey,this._keyStatus.ctrlKey=e.ctrlKey,this._keyStatus.metaKey=e.metaKey,this._keyStatus.shiftKey=e.shiftKey,this._keyStatus.lastKeyReleased&&(this._keyStatus.event=e,this.fire(this._keyStatus)))},!0)),this._subscriptions.add(O(document.body,"mousedown",()=>{this._keyStatus.lastKeyPressed=void 0},!0)),this._subscriptions.add(O(document.body,"mouseup",()=>{this._keyStatus.lastKeyPressed=void 0},!0)),this._subscriptions.add(O(document.body,"mousemove",e=>{e.buttons&&(this._keyStatus.lastKeyPressed=void 0)},!0)),this._subscriptions.add(O(window,"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 Ur.instance||(Ur.instance=new Ur),Ur.instance}dispose(){super.dispose(),this._subscriptions.dispose()}};function Vy(s,e){let t=window.matchMedia(s);typeof t.addEventListener=="function"?t.addEventListener("change",e):t.addListener(e)}var jy=2e4,ra,Hf,kb,Uf,Ib;function zy(s){ra=document.createElement("div"),ra.className="monaco-aria-container";let e=()=>{let i=document.createElement("div");return i.className="monaco-alert",i.setAttribute("role","alert"),i.setAttribute("aria-atomic","true"),ra.appendChild(i),i};Hf=e(),kb=e();let t=()=>{let i=document.createElement("div");return i.className="monaco-status",i.setAttribute("role","complementary"),i.setAttribute("aria-live","polite"),i.setAttribute("aria-atomic","true"),ra.appendChild(i),i};Uf=t(),Ib=t(),s.appendChild(ra)}function ts(s){!ra||(Hf.textContent!==s?(Mt(kb),$f(Hf,s)):(Mt(Hf),$f(kb,s)))}function Rh(s){!ra||(ee?ts(s):Uf.textContent!==s?(Mt(Ib),$f(Uf,s)):(Mt(Uf),$f(Ib,s)))}function $f(s,e){Mt(s),e.length>jy&&(e=e.substr(0,jy)),s.textContent=e,s.style.visibility="hidden",s.style.visibility="visible"}var wn;(function(s){s.serviceIds=new Map,s.DI_TARGET="$di$target",s.DI_DEPENDENCIES="$di$dependencies";function e(t){return t[s.DI_DEPENDENCIES]||[]}s.getServiceDependencies=e})(wn||(wn={}));var ct=$("instantiationService");function Hy(s,e,t,i){e[wn.DI_TARGET]===e?e[wn.DI_DEPENDENCIES].push({id:s,index:t,optional:i}):(e[wn.DI_DEPENDENCIES]=[{id:s,index:t,optional:i}],e[wn.DI_TARGET]=e)}function $(s){if(wn.serviceIds.has(s))return wn.serviceIds.get(s);let e=function(t,i,n){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");Hy(e,t,n,!1)};return e.toString=()=>s,wn.serviceIds.set(s,e),e}function Uy(s){return function(e,t,i){if(arguments.length!==3)throw new Error("@optional-decorator can only be used to decorate a parameter");Hy(s,e,i,!0)}}var qe=$("codeEditorService");var N=class{constructor(e,t){this.lineNumber=e,this.column=t}with(e=this.lineNumber,t=this.column){return e===this.lineNumber&&t===this.column?this:new N(e,t)}delta(e=0,t=0){return this.with(this.lineNumber+e,this.column+t)}equals(e){return N.equals(this,e)}static equals(e,t){return!e&&!t?!0:!!e&&!!t&&e.lineNumber===t.lineNumber&&e.column===t.column}isBefore(e){return N.isBefore(this,e)}static isBefore(e,t){return e.lineNumber=e.length?t:e[n]})}function qf(s){return s.replace(/[<>&]/g,function(e){switch(e){case"<":return"<";case">":return">";case"&":return"&";default:return e}})}function js(s){return s.replace(/[\\\{\}\*\+\?\|\^\$\.\[\]\(\)]/g,"\\$&")}function Gf(s,e){if(!s||!e)return s;let t=e.length;if(t===0||s.length===0)return s;let i=0;for(;s.indexOf(e,i)===i;)i=i+t;return s.substring(i)}function qy(s,e){if(!s||!e)return s;let t=e.length,i=s.length;if(t===0||i===0)return s;let n=i,r=-1;for(;r=s.lastIndexOf(e,n-1),!(r===-1||r+t!==n);){if(r===0)return"";n=r}return s.substring(0,n)}function Gy(s){return s.replace(/[\-\\\{\}\+\?\|\^\$\.\,\[\]\(\)\#\s]/g,"\\$&").replace(/[\*]/g,".*")}function Yf(s,e,t={}){if(!s)throw new Error("Cannot create regex from empty string");e||(s=js(s)),t.wholeWord&&(/\B/.test(s.charAt(0))||(s="\\b"+s),/\B/.test(s.charAt(s.length-1))||(s=s+"\\b"));let i="";return t.global&&(i+="g"),t.matchCase||(i+="i"),t.multiline&&(i+="m"),t.unicode&&(i+="u"),new RegExp(s,i)}function Yy(s){return s.source==="^"||s.source==="^$"||s.source==="$"||s.source==="^\\s*$"?!1:!!(s.exec("")&&s.lastIndex===0)}function Zf(s){return(s.global?"g":"")+(s.ignoreCase?"i":"")+(s.multiline?"m":"")+(s.unicode?"u":"")}function is(s){return s.split(/\r\n|\r|\n/)}function vt(s){for(let e=0,t=s.length;e=0;t--){let i=s.charCodeAt(t);if(i!==32&&i!==9)return t}return-1}function Oh(s,e){return se?1:0}function Xf(s,e,t=0,i=s.length,n=0,r=e.length){for(;tc)return 1}let o=i-t,a=r-n;return oa?1:0}function Nb(s,e){return Qf(s,e,0,s.length,0,e.length)}function Qf(s,e,t=0,i=s.length,n=0,r=e.length){for(;ta?1:0}function $r(s){return s>=97&&s<=122}function ns(s){return s>=65&&s<=90}function Zy(s){return $r(s)||ns(s)}function aa(s,e){return s.length===e.length&&Xy(s,e)}function Xy(s,e,t=s.length){for(let i=0;is.length?!1:Xy(s,e,t)}function Tb(s,e){let t,i=Math.min(s.length,e.length);for(t=0;t1){let i=s.charCodeAt(e-2);if(Xe(i))return Jf(i,t)}return t}function ca(s,e){let t=ss.getInstance(),i=e,n=s.length,r=Pn(s,n,e);e+=r>=65536?2:1;let o=t.getGraphemeBreakType(r);for(;e=65536?2:1,o=l}return e-i}function Qy(s,e){let t=ss.getInstance(),i=e,n=Bl(s,e);e-=n>=65536?2:1;let r=t.getGraphemeBreakType(n);for(;e>0;){let o=Bl(s,e),a=t.getGraphemeBreakType(o);if(jl(a,r))break;e-=o>=65536?2:1,r=a}return i-e}function Jy(s){let e=s.byteLength,t=[],i=0;for(;i=240&&i+3>>0|(s[i++]&63)<<12>>>0|(s[i++]&63)<<6>>>0|(s[i++]&63)<<0>>>0:n>=224&&i+2>>0|(s[i++]&63)<<6>>>0|(s[i++]&63)<<0>>>0:n>=192&&i+1>>0|(s[i++]&63)<<0>>>0:r=s[i++],r>=0&&r<=55295||r>=57344&&r<=65535)t.push(String.fromCharCode(r));else if(r>=65536&&r<=1114111){let o=r-65536,a=55296+((o&1047552)>>>10),l=56320+((o&1023)>>>0);t.push(String.fromCharCode(a)),t.push(String.fromCharCode(l))}else t.push(String.fromCharCode(65533))}return t.join("")}var wR=/(?:[\u05BE\u05C0\u05C3\u05C6\u05D0-\u05F4\u0608\u060B\u060D\u061B-\u064A\u066D-\u066F\u0671-\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u0710\u0712-\u072F\u074D-\u07A5\u07B1-\u07EA\u07F4\u07F5\u07FA-\u0815\u081A\u0824\u0828\u0830-\u0858\u085E-\u08BD\u200F\uFB1D\uFB1F-\uFB28\uFB2A-\uFD3D\uFD50-\uFDFC\uFE70-\uFEFC]|\uD802[\uDC00-\uDD1B\uDD20-\uDE00\uDE10-\uDE33\uDE40-\uDEE4\uDEEB-\uDF35\uDF40-\uDFFF]|\uD803[\uDC00-\uDCFF]|\uD83A[\uDC00-\uDCCF\uDD00-\uDD43\uDD50-\uDFFF]|\uD83B[\uDC00-\uDEBB])/;function Wl(s){return wR.test(s)}var vR=/(?:[\u231A\u231B\u23F0\u23F3\u2600-\u27BF\u2B50\u2B55]|\uD83C[\uDDE6-\uDDFF\uDF00-\uDFFF]|\uD83D[\uDC00-\uDE4F\uDE80-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD00-\uDDFF\uDE70-\uDED6])/;function eL(s){return vR.test(s)}var CR=/^[\t\n\r\x20-\x7E]*$/;function em(s){return CR.test(s)}var Rb=/[\u2028\u2029]/;function tm(s){return Rb.test(s)}function tL(s){for(let e=0,t=s.length;e=11904&&s<=55215||s>=63744&&s<=64255||s>=65281&&s<=65374}function ha(s){return s>=127462&&s<=127487||s===8986||s===8987||s===9200||s===9203||s>=9728&&s<=10175||s===11088||s===11093||s>=127744&&s<=128591||s>=128640&&s<=128764||s>=128992&&s<=129003||s>=129280&&s<=129535||s>=129648&&s<=129750}var iL=String.fromCharCode(65279);function Vl(s){return!!(s&&s.length>0&&s.charCodeAt(0)===65279)}function xB(s,e=!1){return s?(e&&(s=s.replace(/\\./g,"")),s.toLowerCase()!==s):!1}function im(s){let e=90-65+1;return s=s%(2*e),st[3*n+1])n=2*n+1;else return t[3*n+2];return 0}};ss._INSTANCE=null;function SR(){return JSON.parse("[0,0,0,51592,51592,11,44424,44424,11,72251,72254,5,7150,7150,7,48008,48008,11,55176,55176,11,128420,128420,14,3276,3277,5,9979,9980,14,46216,46216,11,49800,49800,11,53384,53384,11,70726,70726,5,122915,122916,5,129320,129327,14,2558,2558,5,5906,5908,5,9762,9763,14,43360,43388,8,45320,45320,11,47112,47112,11,48904,48904,11,50696,50696,11,52488,52488,11,54280,54280,11,70082,70083,1,71350,71350,7,73111,73111,5,127892,127893,14,128726,128727,14,129473,129474,14,2027,2035,5,2901,2902,5,3784,3789,5,6754,6754,5,8418,8420,5,9877,9877,14,11088,11088,14,44008,44008,5,44872,44872,11,45768,45768,11,46664,46664,11,47560,47560,11,48456,48456,11,49352,49352,11,50248,50248,11,51144,51144,11,52040,52040,11,52936,52936,11,53832,53832,11,54728,54728,11,69811,69814,5,70459,70460,5,71096,71099,7,71998,71998,5,72874,72880,5,119149,119149,7,127374,127374,14,128335,128335,14,128482,128482,14,128765,128767,14,129399,129400,14,129680,129685,14,1476,1477,5,2377,2380,7,2759,2760,5,3137,3140,7,3458,3459,7,4153,4154,5,6432,6434,5,6978,6978,5,7675,7679,5,9723,9726,14,9823,9823,14,9919,9923,14,10035,10036,14,42736,42737,5,43596,43596,5,44200,44200,11,44648,44648,11,45096,45096,11,45544,45544,11,45992,45992,11,46440,46440,11,46888,46888,11,47336,47336,11,47784,47784,11,48232,48232,11,48680,48680,11,49128,49128,11,49576,49576,11,50024,50024,11,50472,50472,11,50920,50920,11,51368,51368,11,51816,51816,11,52264,52264,11,52712,52712,11,53160,53160,11,53608,53608,11,54056,54056,11,54504,54504,11,54952,54952,11,68108,68111,5,69933,69940,5,70197,70197,7,70498,70499,7,70845,70845,5,71229,71229,5,71727,71735,5,72154,72155,5,72344,72345,5,73023,73029,5,94095,94098,5,121403,121452,5,126981,127182,14,127538,127546,14,127990,127990,14,128391,128391,14,128445,128449,14,128500,128505,14,128752,128752,14,129160,129167,14,129356,129356,14,129432,129442,14,129648,129651,14,129751,131069,14,173,173,4,1757,1757,1,2274,2274,1,2494,2494,5,2641,2641,5,2876,2876,5,3014,3016,7,3262,3262,7,3393,3396,5,3570,3571,7,3968,3972,5,4228,4228,7,6086,6086,5,6679,6680,5,6912,6915,5,7080,7081,5,7380,7392,5,8252,8252,14,9096,9096,14,9748,9749,14,9784,9786,14,9833,9850,14,9890,9894,14,9938,9938,14,9999,9999,14,10085,10087,14,12349,12349,14,43136,43137,7,43454,43456,7,43755,43755,7,44088,44088,11,44312,44312,11,44536,44536,11,44760,44760,11,44984,44984,11,45208,45208,11,45432,45432,11,45656,45656,11,45880,45880,11,46104,46104,11,46328,46328,11,46552,46552,11,46776,46776,11,47000,47000,11,47224,47224,11,47448,47448,11,47672,47672,11,47896,47896,11,48120,48120,11,48344,48344,11,48568,48568,11,48792,48792,11,49016,49016,11,49240,49240,11,49464,49464,11,49688,49688,11,49912,49912,11,50136,50136,11,50360,50360,11,50584,50584,11,50808,50808,11,51032,51032,11,51256,51256,11,51480,51480,11,51704,51704,11,51928,51928,11,52152,52152,11,52376,52376,11,52600,52600,11,52824,52824,11,53048,53048,11,53272,53272,11,53496,53496,11,53720,53720,11,53944,53944,11,54168,54168,11,54392,54392,11,54616,54616,11,54840,54840,11,55064,55064,11,65438,65439,5,69633,69633,5,69837,69837,1,70018,70018,7,70188,70190,7,70368,70370,7,70465,70468,7,70712,70719,5,70835,70840,5,70850,70851,5,71132,71133,5,71340,71340,7,71458,71461,5,71985,71989,7,72002,72002,7,72193,72202,5,72281,72283,5,72766,72766,7,72885,72886,5,73104,73105,5,92912,92916,5,113824,113827,4,119173,119179,5,121505,121519,5,125136,125142,5,127279,127279,14,127489,127490,14,127570,127743,14,127900,127901,14,128254,128254,14,128369,128370,14,128400,128400,14,128425,128432,14,128468,128475,14,128489,128494,14,128715,128720,14,128745,128745,14,128759,128760,14,129004,129023,14,129296,129304,14,129340,129342,14,129388,129392,14,129404,129407,14,129454,129455,14,129485,129487,14,129659,129663,14,129719,129727,14,917536,917631,5,13,13,2,1160,1161,5,1564,1564,4,1807,1807,1,2085,2087,5,2363,2363,7,2402,2403,5,2507,2508,7,2622,2624,7,2691,2691,7,2786,2787,5,2881,2884,5,3006,3006,5,3072,3072,5,3170,3171,5,3267,3268,7,3330,3331,7,3406,3406,1,3538,3540,5,3655,3662,5,3897,3897,5,4038,4038,5,4184,4185,5,4352,4447,8,6068,6069,5,6155,6157,5,6448,6449,7,6742,6742,5,6783,6783,5,6966,6970,5,7042,7042,7,7143,7143,7,7212,7219,5,7412,7412,5,8206,8207,4,8294,8303,4,8596,8601,14,9410,9410,14,9742,9742,14,9757,9757,14,9770,9770,14,9794,9794,14,9828,9828,14,9855,9855,14,9882,9882,14,9900,9903,14,9929,9933,14,9963,9967,14,9987,9988,14,10006,10006,14,10062,10062,14,10175,10175,14,11744,11775,5,42607,42607,5,43043,43044,7,43263,43263,5,43444,43445,7,43569,43570,5,43698,43700,5,43766,43766,5,44032,44032,11,44144,44144,11,44256,44256,11,44368,44368,11,44480,44480,11,44592,44592,11,44704,44704,11,44816,44816,11,44928,44928,11,45040,45040,11,45152,45152,11,45264,45264,11,45376,45376,11,45488,45488,11,45600,45600,11,45712,45712,11,45824,45824,11,45936,45936,11,46048,46048,11,46160,46160,11,46272,46272,11,46384,46384,11,46496,46496,11,46608,46608,11,46720,46720,11,46832,46832,11,46944,46944,11,47056,47056,11,47168,47168,11,47280,47280,11,47392,47392,11,47504,47504,11,47616,47616,11,47728,47728,11,47840,47840,11,47952,47952,11,48064,48064,11,48176,48176,11,48288,48288,11,48400,48400,11,48512,48512,11,48624,48624,11,48736,48736,11,48848,48848,11,48960,48960,11,49072,49072,11,49184,49184,11,49296,49296,11,49408,49408,11,49520,49520,11,49632,49632,11,49744,49744,11,49856,49856,11,49968,49968,11,50080,50080,11,50192,50192,11,50304,50304,11,50416,50416,11,50528,50528,11,50640,50640,11,50752,50752,11,50864,50864,11,50976,50976,11,51088,51088,11,51200,51200,11,51312,51312,11,51424,51424,11,51536,51536,11,51648,51648,11,51760,51760,11,51872,51872,11,51984,51984,11,52096,52096,11,52208,52208,11,52320,52320,11,52432,52432,11,52544,52544,11,52656,52656,11,52768,52768,11,52880,52880,11,52992,52992,11,53104,53104,11,53216,53216,11,53328,53328,11,53440,53440,11,53552,53552,11,53664,53664,11,53776,53776,11,53888,53888,11,54000,54000,11,54112,54112,11,54224,54224,11,54336,54336,11,54448,54448,11,54560,54560,11,54672,54672,11,54784,54784,11,54896,54896,11,55008,55008,11,55120,55120,11,64286,64286,5,66272,66272,5,68900,68903,5,69762,69762,7,69817,69818,5,69927,69931,5,70003,70003,5,70070,70078,5,70094,70094,7,70194,70195,7,70206,70206,5,70400,70401,5,70463,70463,7,70475,70477,7,70512,70516,5,70722,70724,5,70832,70832,5,70842,70842,5,70847,70848,5,71088,71089,7,71102,71102,7,71219,71226,5,71231,71232,5,71342,71343,7,71453,71455,5,71463,71467,5,71737,71738,5,71995,71996,5,72000,72000,7,72145,72147,7,72160,72160,5,72249,72249,7,72273,72278,5,72330,72342,5,72752,72758,5,72850,72871,5,72882,72883,5,73018,73018,5,73031,73031,5,73109,73109,5,73461,73462,7,94031,94031,5,94192,94193,7,119142,119142,7,119155,119162,4,119362,119364,5,121476,121476,5,122888,122904,5,123184,123190,5,126976,126979,14,127184,127231,14,127344,127345,14,127405,127461,14,127514,127514,14,127561,127567,14,127778,127779,14,127896,127896,14,127985,127986,14,127995,127999,5,128326,128328,14,128360,128366,14,128378,128378,14,128394,128397,14,128405,128406,14,128422,128423,14,128435,128443,14,128453,128464,14,128479,128480,14,128484,128487,14,128496,128498,14,128640,128709,14,128723,128724,14,128736,128741,14,128747,128748,14,128755,128755,14,128762,128762,14,128981,128991,14,129096,129103,14,129292,129292,14,129311,129311,14,129329,129330,14,129344,129349,14,129360,129374,14,129394,129394,14,129402,129402,14,129413,129425,14,129445,129450,14,129466,129471,14,129483,129483,14,129511,129535,14,129653,129655,14,129667,129670,14,129705,129711,14,129731,129743,14,917505,917505,4,917760,917999,5,10,10,3,127,159,4,768,879,5,1471,1471,5,1536,1541,1,1648,1648,5,1767,1768,5,1840,1866,5,2070,2073,5,2137,2139,5,2307,2307,7,2366,2368,7,2382,2383,7,2434,2435,7,2497,2500,5,2519,2519,5,2563,2563,7,2631,2632,5,2677,2677,5,2750,2752,7,2763,2764,7,2817,2817,5,2879,2879,5,2891,2892,7,2914,2915,5,3008,3008,5,3021,3021,5,3076,3076,5,3146,3149,5,3202,3203,7,3264,3265,7,3271,3272,7,3298,3299,5,3390,3390,5,3402,3404,7,3426,3427,5,3535,3535,5,3544,3550,7,3635,3635,7,3763,3763,7,3893,3893,5,3953,3966,5,3981,3991,5,4145,4145,7,4157,4158,5,4209,4212,5,4237,4237,5,4520,4607,10,5970,5971,5,6071,6077,5,6089,6099,5,6277,6278,5,6439,6440,5,6451,6456,7,6683,6683,5,6744,6750,5,6765,6770,7,6846,6846,5,6964,6964,5,6972,6972,5,7019,7027,5,7074,7077,5,7083,7085,5,7146,7148,7,7154,7155,7,7222,7223,5,7394,7400,5,7416,7417,5,8204,8204,5,8233,8233,4,8288,8292,4,8413,8416,5,8482,8482,14,8986,8987,14,9193,9203,14,9654,9654,14,9733,9733,14,9745,9745,14,9752,9752,14,9760,9760,14,9766,9766,14,9774,9775,14,9792,9792,14,9800,9811,14,9825,9826,14,9831,9831,14,9852,9853,14,9872,9873,14,9880,9880,14,9885,9887,14,9896,9897,14,9906,9916,14,9926,9927,14,9936,9936,14,9941,9960,14,9974,9974,14,9982,9985,14,9992,9997,14,10002,10002,14,10017,10017,14,10055,10055,14,10071,10071,14,10145,10145,14,11013,11015,14,11503,11505,5,12334,12335,5,12951,12951,14,42612,42621,5,43014,43014,5,43047,43047,7,43204,43205,5,43335,43345,5,43395,43395,7,43450,43451,7,43561,43566,5,43573,43574,5,43644,43644,5,43710,43711,5,43758,43759,7,44005,44005,5,44012,44012,7,44060,44060,11,44116,44116,11,44172,44172,11,44228,44228,11,44284,44284,11,44340,44340,11,44396,44396,11,44452,44452,11,44508,44508,11,44564,44564,11,44620,44620,11,44676,44676,11,44732,44732,11,44788,44788,11,44844,44844,11,44900,44900,11,44956,44956,11,45012,45012,11,45068,45068,11,45124,45124,11,45180,45180,11,45236,45236,11,45292,45292,11,45348,45348,11,45404,45404,11,45460,45460,11,45516,45516,11,45572,45572,11,45628,45628,11,45684,45684,11,45740,45740,11,45796,45796,11,45852,45852,11,45908,45908,11,45964,45964,11,46020,46020,11,46076,46076,11,46132,46132,11,46188,46188,11,46244,46244,11,46300,46300,11,46356,46356,11,46412,46412,11,46468,46468,11,46524,46524,11,46580,46580,11,46636,46636,11,46692,46692,11,46748,46748,11,46804,46804,11,46860,46860,11,46916,46916,11,46972,46972,11,47028,47028,11,47084,47084,11,47140,47140,11,47196,47196,11,47252,47252,11,47308,47308,11,47364,47364,11,47420,47420,11,47476,47476,11,47532,47532,11,47588,47588,11,47644,47644,11,47700,47700,11,47756,47756,11,47812,47812,11,47868,47868,11,47924,47924,11,47980,47980,11,48036,48036,11,48092,48092,11,48148,48148,11,48204,48204,11,48260,48260,11,48316,48316,11,48372,48372,11,48428,48428,11,48484,48484,11,48540,48540,11,48596,48596,11,48652,48652,11,48708,48708,11,48764,48764,11,48820,48820,11,48876,48876,11,48932,48932,11,48988,48988,11,49044,49044,11,49100,49100,11,49156,49156,11,49212,49212,11,49268,49268,11,49324,49324,11,49380,49380,11,49436,49436,11,49492,49492,11,49548,49548,11,49604,49604,11,49660,49660,11,49716,49716,11,49772,49772,11,49828,49828,11,49884,49884,11,49940,49940,11,49996,49996,11,50052,50052,11,50108,50108,11,50164,50164,11,50220,50220,11,50276,50276,11,50332,50332,11,50388,50388,11,50444,50444,11,50500,50500,11,50556,50556,11,50612,50612,11,50668,50668,11,50724,50724,11,50780,50780,11,50836,50836,11,50892,50892,11,50948,50948,11,51004,51004,11,51060,51060,11,51116,51116,11,51172,51172,11,51228,51228,11,51284,51284,11,51340,51340,11,51396,51396,11,51452,51452,11,51508,51508,11,51564,51564,11,51620,51620,11,51676,51676,11,51732,51732,11,51788,51788,11,51844,51844,11,51900,51900,11,51956,51956,11,52012,52012,11,52068,52068,11,52124,52124,11,52180,52180,11,52236,52236,11,52292,52292,11,52348,52348,11,52404,52404,11,52460,52460,11,52516,52516,11,52572,52572,11,52628,52628,11,52684,52684,11,52740,52740,11,52796,52796,11,52852,52852,11,52908,52908,11,52964,52964,11,53020,53020,11,53076,53076,11,53132,53132,11,53188,53188,11,53244,53244,11,53300,53300,11,53356,53356,11,53412,53412,11,53468,53468,11,53524,53524,11,53580,53580,11,53636,53636,11,53692,53692,11,53748,53748,11,53804,53804,11,53860,53860,11,53916,53916,11,53972,53972,11,54028,54028,11,54084,54084,11,54140,54140,11,54196,54196,11,54252,54252,11,54308,54308,11,54364,54364,11,54420,54420,11,54476,54476,11,54532,54532,11,54588,54588,11,54644,54644,11,54700,54700,11,54756,54756,11,54812,54812,11,54868,54868,11,54924,54924,11,54980,54980,11,55036,55036,11,55092,55092,11,55148,55148,11,55216,55238,9,65056,65071,5,65529,65531,4,68097,68099,5,68159,68159,5,69446,69456,5,69688,69702,5,69808,69810,7,69815,69816,7,69821,69821,1,69888,69890,5,69932,69932,7,69957,69958,7,70016,70017,5,70067,70069,7,70079,70080,7,70089,70092,5,70095,70095,5,70191,70193,5,70196,70196,5,70198,70199,5,70367,70367,5,70371,70378,5,70402,70403,7,70462,70462,5,70464,70464,5,70471,70472,7,70487,70487,5,70502,70508,5,70709,70711,7,70720,70721,7,70725,70725,7,70750,70750,5,70833,70834,7,70841,70841,7,70843,70844,7,70846,70846,7,70849,70849,7,71087,71087,5,71090,71093,5,71100,71101,5,71103,71104,5,71216,71218,7,71227,71228,7,71230,71230,7,71339,71339,5,71341,71341,5,71344,71349,5,71351,71351,5,71456,71457,7,71462,71462,7,71724,71726,7,71736,71736,7,71984,71984,5,71991,71992,7,71997,71997,7,71999,71999,1,72001,72001,1,72003,72003,5,72148,72151,5,72156,72159,7,72164,72164,7,72243,72248,5,72250,72250,1,72263,72263,5,72279,72280,7,72324,72329,1,72343,72343,7,72751,72751,7,72760,72765,5,72767,72767,5,72873,72873,7,72881,72881,7,72884,72884,7,73009,73014,5,73020,73021,5,73030,73030,1,73098,73102,7,73107,73108,7,73110,73110,7,73459,73460,5,78896,78904,4,92976,92982,5,94033,94087,7,94180,94180,5,113821,113822,5,119141,119141,5,119143,119145,5,119150,119154,5,119163,119170,5,119210,119213,5,121344,121398,5,121461,121461,5,121499,121503,5,122880,122886,5,122907,122913,5,122918,122922,5,123628,123631,5,125252,125258,5,126980,126980,14,127183,127183,14,127245,127247,14,127340,127343,14,127358,127359,14,127377,127386,14,127462,127487,6,127491,127503,14,127535,127535,14,127548,127551,14,127568,127569,14,127744,127777,14,127780,127891,14,127894,127895,14,127897,127899,14,127902,127984,14,127987,127989,14,127991,127994,14,128000,128253,14,128255,128317,14,128329,128334,14,128336,128359,14,128367,128368,14,128371,128377,14,128379,128390,14,128392,128393,14,128398,128399,14,128401,128404,14,128407,128419,14,128421,128421,14,128424,128424,14,128433,128434,14,128444,128444,14,128450,128452,14,128465,128467,14,128476,128478,14,128481,128481,14,128483,128483,14,128488,128488,14,128495,128495,14,128499,128499,14,128506,128591,14,128710,128714,14,128721,128722,14,128725,128725,14,128728,128735,14,128742,128744,14,128746,128746,14,128749,128751,14,128753,128754,14,128756,128758,14,128761,128761,14,128763,128764,14,128884,128895,14,128992,129003,14,129036,129039,14,129114,129119,14,129198,129279,14,129293,129295,14,129305,129310,14,129312,129319,14,129328,129328,14,129331,129338,14,129343,129343,14,129351,129355,14,129357,129359,14,129375,129387,14,129393,129393,14,129395,129398,14,129401,129401,14,129403,129403,14,129408,129412,14,129426,129431,14,129443,129444,14,129451,129453,14,129456,129465,14,129472,129472,14,129475,129482,14,129484,129484,14,129488,129510,14,129536,129647,14,129652,129652,14,129656,129658,14,129664,129666,14,129671,129679,14,129686,129704,14,129712,129718,14,129728,129730,14,129744,129750,14,917504,917504,4,917506,917535,4,917632,917759,4,918000,921599,4,0,9,4,11,12,4,14,31,4,169,169,14,174,174,14,1155,1159,5,1425,1469,5,1473,1474,5,1479,1479,5,1552,1562,5,1611,1631,5,1750,1756,5,1759,1764,5,1770,1773,5,1809,1809,5,1958,1968,5,2045,2045,5,2075,2083,5,2089,2093,5,2259,2273,5,2275,2306,5,2362,2362,5,2364,2364,5,2369,2376,5,2381,2381,5,2385,2391,5,2433,2433,5,2492,2492,5,2495,2496,7,2503,2504,7,2509,2509,5,2530,2531,5,2561,2562,5,2620,2620,5,2625,2626,5,2635,2637,5,2672,2673,5,2689,2690,5,2748,2748,5,2753,2757,5,2761,2761,7,2765,2765,5,2810,2815,5,2818,2819,7,2878,2878,5,2880,2880,7,2887,2888,7,2893,2893,5,2903,2903,5,2946,2946,5,3007,3007,7,3009,3010,7,3018,3020,7,3031,3031,5,3073,3075,7,3134,3136,5,3142,3144,5,3157,3158,5,3201,3201,5,3260,3260,5,3263,3263,5,3266,3266,5,3270,3270,5,3274,3275,7,3285,3286,5,3328,3329,5,3387,3388,5,3391,3392,7,3398,3400,7,3405,3405,5,3415,3415,5,3457,3457,5,3530,3530,5,3536,3537,7,3542,3542,5,3551,3551,5,3633,3633,5,3636,3642,5,3761,3761,5,3764,3772,5,3864,3865,5,3895,3895,5,3902,3903,7,3967,3967,7,3974,3975,5,3993,4028,5,4141,4144,5,4146,4151,5,4155,4156,7,4182,4183,7,4190,4192,5,4226,4226,5,4229,4230,5,4253,4253,5,4448,4519,9,4957,4959,5,5938,5940,5,6002,6003,5,6070,6070,7,6078,6085,7,6087,6088,7,6109,6109,5,6158,6158,4,6313,6313,5,6435,6438,7,6441,6443,7,6450,6450,5,6457,6459,5,6681,6682,7,6741,6741,7,6743,6743,7,6752,6752,5,6757,6764,5,6771,6780,5,6832,6845,5,6847,6848,5,6916,6916,7,6965,6965,5,6971,6971,7,6973,6977,7,6979,6980,7,7040,7041,5,7073,7073,7,7078,7079,7,7082,7082,7,7142,7142,5,7144,7145,5,7149,7149,5,7151,7153,5,7204,7211,7,7220,7221,7,7376,7378,5,7393,7393,7,7405,7405,5,7415,7415,7,7616,7673,5,8203,8203,4,8205,8205,13,8232,8232,4,8234,8238,4,8265,8265,14,8293,8293,4,8400,8412,5,8417,8417,5,8421,8432,5,8505,8505,14,8617,8618,14,9000,9000,14,9167,9167,14,9208,9210,14,9642,9643,14,9664,9664,14,9728,9732,14,9735,9741,14,9743,9744,14,9746,9746,14,9750,9751,14,9753,9756,14,9758,9759,14,9761,9761,14,9764,9765,14,9767,9769,14,9771,9773,14,9776,9783,14,9787,9791,14,9793,9793,14,9795,9799,14,9812,9822,14,9824,9824,14,9827,9827,14,9829,9830,14,9832,9832,14,9851,9851,14,9854,9854,14,9856,9861,14,9874,9876,14,9878,9879,14,9881,9881,14,9883,9884,14,9888,9889,14,9895,9895,14,9898,9899,14,9904,9905,14,9917,9918,14,9924,9925,14,9928,9928,14,9934,9935,14,9937,9937,14,9939,9940,14,9961,9962,14,9968,9973,14,9975,9978,14,9981,9981,14,9986,9986,14,9989,9989,14,9998,9998,14,10000,10001,14,10004,10004,14,10013,10013,14,10024,10024,14,10052,10052,14,10060,10060,14,10067,10069,14,10083,10084,14,10133,10135,14,10160,10160,14,10548,10549,14,11035,11036,14,11093,11093,14,11647,11647,5,12330,12333,5,12336,12336,14,12441,12442,5,12953,12953,14,42608,42610,5,42654,42655,5,43010,43010,5,43019,43019,5,43045,43046,5,43052,43052,5,43188,43203,7,43232,43249,5,43302,43309,5,43346,43347,7,43392,43394,5,43443,43443,5,43446,43449,5,43452,43453,5,43493,43493,5,43567,43568,7,43571,43572,7,43587,43587,5,43597,43597,7,43696,43696,5,43703,43704,5,43713,43713,5,43756,43757,5,43765,43765,7,44003,44004,7,44006,44007,7,44009,44010,7,44013,44013,5,44033,44059,12,44061,44087,12,44089,44115,12,44117,44143,12,44145,44171,12,44173,44199,12,44201,44227,12,44229,44255,12,44257,44283,12,44285,44311,12,44313,44339,12,44341,44367,12,44369,44395,12,44397,44423,12,44425,44451,12,44453,44479,12,44481,44507,12,44509,44535,12,44537,44563,12,44565,44591,12,44593,44619,12,44621,44647,12,44649,44675,12,44677,44703,12,44705,44731,12,44733,44759,12,44761,44787,12,44789,44815,12,44817,44843,12,44845,44871,12,44873,44899,12,44901,44927,12,44929,44955,12,44957,44983,12,44985,45011,12,45013,45039,12,45041,45067,12,45069,45095,12,45097,45123,12,45125,45151,12,45153,45179,12,45181,45207,12,45209,45235,12,45237,45263,12,45265,45291,12,45293,45319,12,45321,45347,12,45349,45375,12,45377,45403,12,45405,45431,12,45433,45459,12,45461,45487,12,45489,45515,12,45517,45543,12,45545,45571,12,45573,45599,12,45601,45627,12,45629,45655,12,45657,45683,12,45685,45711,12,45713,45739,12,45741,45767,12,45769,45795,12,45797,45823,12,45825,45851,12,45853,45879,12,45881,45907,12,45909,45935,12,45937,45963,12,45965,45991,12,45993,46019,12,46021,46047,12,46049,46075,12,46077,46103,12,46105,46131,12,46133,46159,12,46161,46187,12,46189,46215,12,46217,46243,12,46245,46271,12,46273,46299,12,46301,46327,12,46329,46355,12,46357,46383,12,46385,46411,12,46413,46439,12,46441,46467,12,46469,46495,12,46497,46523,12,46525,46551,12,46553,46579,12,46581,46607,12,46609,46635,12,46637,46663,12,46665,46691,12,46693,46719,12,46721,46747,12,46749,46775,12,46777,46803,12,46805,46831,12,46833,46859,12,46861,46887,12,46889,46915,12,46917,46943,12,46945,46971,12,46973,46999,12,47001,47027,12,47029,47055,12,47057,47083,12,47085,47111,12,47113,47139,12,47141,47167,12,47169,47195,12,47197,47223,12,47225,47251,12,47253,47279,12,47281,47307,12,47309,47335,12,47337,47363,12,47365,47391,12,47393,47419,12,47421,47447,12,47449,47475,12,47477,47503,12,47505,47531,12,47533,47559,12,47561,47587,12,47589,47615,12,47617,47643,12,47645,47671,12,47673,47699,12,47701,47727,12,47729,47755,12,47757,47783,12,47785,47811,12,47813,47839,12,47841,47867,12,47869,47895,12,47897,47923,12,47925,47951,12,47953,47979,12,47981,48007,12,48009,48035,12,48037,48063,12,48065,48091,12,48093,48119,12,48121,48147,12,48149,48175,12,48177,48203,12,48205,48231,12,48233,48259,12,48261,48287,12,48289,48315,12,48317,48343,12,48345,48371,12,48373,48399,12,48401,48427,12,48429,48455,12,48457,48483,12,48485,48511,12,48513,48539,12,48541,48567,12,48569,48595,12,48597,48623,12,48625,48651,12,48653,48679,12,48681,48707,12,48709,48735,12,48737,48763,12,48765,48791,12,48793,48819,12,48821,48847,12,48849,48875,12,48877,48903,12,48905,48931,12,48933,48959,12,48961,48987,12,48989,49015,12,49017,49043,12,49045,49071,12,49073,49099,12,49101,49127,12,49129,49155,12,49157,49183,12,49185,49211,12,49213,49239,12,49241,49267,12,49269,49295,12,49297,49323,12,49325,49351,12,49353,49379,12,49381,49407,12,49409,49435,12,49437,49463,12,49465,49491,12,49493,49519,12,49521,49547,12,49549,49575,12,49577,49603,12,49605,49631,12,49633,49659,12,49661,49687,12,49689,49715,12,49717,49743,12,49745,49771,12,49773,49799,12,49801,49827,12,49829,49855,12,49857,49883,12,49885,49911,12,49913,49939,12,49941,49967,12,49969,49995,12,49997,50023,12,50025,50051,12,50053,50079,12,50081,50107,12,50109,50135,12,50137,50163,12,50165,50191,12,50193,50219,12,50221,50247,12,50249,50275,12,50277,50303,12,50305,50331,12,50333,50359,12,50361,50387,12,50389,50415,12,50417,50443,12,50445,50471,12,50473,50499,12,50501,50527,12,50529,50555,12,50557,50583,12,50585,50611,12,50613,50639,12,50641,50667,12,50669,50695,12,50697,50723,12,50725,50751,12,50753,50779,12,50781,50807,12,50809,50835,12,50837,50863,12,50865,50891,12,50893,50919,12,50921,50947,12,50949,50975,12,50977,51003,12,51005,51031,12,51033,51059,12,51061,51087,12,51089,51115,12,51117,51143,12,51145,51171,12,51173,51199,12,51201,51227,12,51229,51255,12,51257,51283,12,51285,51311,12,51313,51339,12,51341,51367,12,51369,51395,12,51397,51423,12,51425,51451,12,51453,51479,12,51481,51507,12,51509,51535,12,51537,51563,12,51565,51591,12,51593,51619,12,51621,51647,12,51649,51675,12,51677,51703,12,51705,51731,12,51733,51759,12,51761,51787,12,51789,51815,12,51817,51843,12,51845,51871,12,51873,51899,12,51901,51927,12,51929,51955,12,51957,51983,12,51985,52011,12,52013,52039,12,52041,52067,12,52069,52095,12,52097,52123,12,52125,52151,12,52153,52179,12,52181,52207,12,52209,52235,12,52237,52263,12,52265,52291,12,52293,52319,12,52321,52347,12,52349,52375,12,52377,52403,12,52405,52431,12,52433,52459,12,52461,52487,12,52489,52515,12,52517,52543,12,52545,52571,12,52573,52599,12,52601,52627,12,52629,52655,12,52657,52683,12,52685,52711,12,52713,52739,12,52741,52767,12,52769,52795,12,52797,52823,12,52825,52851,12,52853,52879,12,52881,52907,12,52909,52935,12,52937,52963,12,52965,52991,12,52993,53019,12,53021,53047,12,53049,53075,12,53077,53103,12,53105,53131,12,53133,53159,12,53161,53187,12,53189,53215,12,53217,53243,12,53245,53271,12,53273,53299,12,53301,53327,12,53329,53355,12,53357,53383,12,53385,53411,12,53413,53439,12,53441,53467,12,53469,53495,12,53497,53523,12,53525,53551,12,53553,53579,12,53581,53607,12,53609,53635,12,53637,53663,12,53665,53691,12,53693,53719,12,53721,53747,12,53749,53775,12,53777,53803,12,53805,53831,12,53833,53859,12,53861,53887,12,53889,53915,12,53917,53943,12,53945,53971,12,53973,53999,12,54001,54027,12,54029,54055,12,54057,54083,12,54085,54111,12,54113,54139,12,54141,54167,12,54169,54195,12,54197,54223,12,54225,54251,12,54253,54279,12,54281,54307,12,54309,54335,12,54337,54363,12,54365,54391,12,54393,54419,12,54421,54447,12,54449,54475,12,54477,54503,12,54505,54531,12,54533,54559,12,54561,54587,12,54589,54615,12,54617,54643,12,54645,54671,12,54673,54699,12,54701,54727,12,54729,54755,12,54757,54783,12,54785,54811,12,54813,54839,12,54841,54867,12,54869,54895,12,54897,54923,12,54925,54951,12,54953,54979,12,54981,55007,12,55009,55035,12,55037,55063,12,55065,55091,12,55093,55119,12,55121,55147,12,55149,55175,12,55177,55203,12,55243,55291,10,65024,65039,5,65279,65279,4,65520,65528,4,66045,66045,5,66422,66426,5,68101,68102,5,68152,68154,5,68325,68326,5,69291,69292,5,69632,69632,7,69634,69634,7,69759,69761,5]")}function nL(s,e){if(s===0)return 0;let t=yR(s,e);if(t!==void 0)return t;let i=Bl(e,s);return s-=nm(i),s}function yR(s,e){let t=Bl(e,s);for(s-=nm(t);LR(t)||t===65039||t===8419;){if(s===0)return;t=Bl(e,s),s-=nm(t)}if(!!ha(t)){if(s>=0){let i=Bl(e,s);i===8205&&(s-=nm(i))}return s}}function nm(s){return s>=65536?2:1}function LR(s){return 127995<=s&&s<=127999}var sm=K1||"",Mi=new Map;Mi.set("false",!1);Mi.set("true",!0);Mi.set("isMac",ee);Mi.set("isLinux",_t);Mi.set("isWindows",ot);Mi.set("isWeb",Zo);Mi.set("isMacNative",ee&&!Zo);Mi.set("isEdge",sm.indexOf("Edg/")>=0);Mi.set("isFirefox",sm.indexOf("Firefox")>=0);Mi.set("isChrome",sm.indexOf("Chrome")>=0);Mi.set("isSafari",sm.indexOf("Safari")>=0);var xR=Object.prototype.hasOwnProperty,dt=class{static has(e){return zs.create(e)}static equals(e,t){return zl.create(e,t)}static regex(e,t){return zh.create(e,t)}static not(e){return Kr.create(e)}static and(...e){return ua.create(e)}static or(...e){return qr.create(e)}static deserialize(e,t=!1){if(!!e)return this._deserializeOrExpression(e,t)}static _deserializeOrExpression(e,t){let i=e.split("||");return qr.create(i.map(n=>this._deserializeAndExpression(n,t)))}static _deserializeAndExpression(e,t){let i=e.split("&&");return ua.create(i.map(n=>this._deserializeOne(n,t)))}static _deserializeOne(e,t){if(e=e.trim(),e.indexOf("!=")>=0){let i=e.split("!=");return Fh.create(i[0].trim(),this._deserializeValue(i[1],t))}if(e.indexOf("==")>=0){let i=e.split("==");return zl.create(i[0].trim(),this._deserializeValue(i[1],t))}if(e.indexOf("=~")>=0){let i=e.split("=~");return zh.create(i[0].trim(),this._deserializeRegexValue(i[1],t))}if(e.indexOf(" in ")>=0){let i=e.split(" in ");return rm.create(i[0].trim(),i[1].trim())}if(/^[^<=>]+>=[^<=>]+$/.test(e)){let i=e.split(">=");return Wh.create(i[0].trim(),i[1].trim())}if(/^[^<=>]+>[^<=>]+$/.test(e)){let i=e.split(">");return Bh.create(i[0].trim(),i[1].trim())}if(/^[^<=>]+<=[^<=>]+$/.test(e)){let i=e.split("<=");return jh.create(i[0].trim(),i[1].trim())}if(/^[^<=>]+<[^<=>]+$/.test(e)){let i=e.split("<");return Vh.create(i[0].trim(),i[1].trim())}return/^\!\s*/.test(e)?Kr.create(e.substr(1).trim()):zs.create(e)}static _deserializeValue(e,t){if(e=e.trim(),e==="true")return!0;if(e==="false")return!1;let i=/^'([^']*)'$/.exec(e);return i?i[1].trim():e}static _deserializeRegexValue(e,t){if(Ky(e)){if(t)throw new Error("missing regexp-value for =~-expression");return console.warn("missing regexp-value for =~-expression"),null}let i=e.indexOf("/"),n=e.lastIndexOf("/");if(i===n||i<0){if(t)throw new Error(`bad regexp-value '${e}', missing /-enclosure`);return console.warn(`bad regexp-value '${e}', missing /-enclosure`),null}let r=e.slice(i+1,n),o=e[n+1]==="i"?"i":"";try{return new RegExp(r,o)}catch(a){if(t)throw new Error(`bad regexp-value '${e}', parse error: ${a}`);return console.warn(`bad regexp-value '${e}', parse error: ${a}`),null}}};function Ph(s,e){return s.cmp(e)}var rs=class{constructor(){this.type=0}cmp(e){return this.type-e.type}equals(e){return e.type===this.type}evaluate(e){return!1}serialize(){return"false"}keys(){return[]}negate(){return os.INSTANCE}};rs.INSTANCE=new rs;var os=class{constructor(){this.type=1}cmp(e){return this.type-e.type}equals(e){return e.type===this.type}evaluate(e){return!0}serialize(){return"true"}keys(){return[]}negate(){return rs.INSTANCE}};os.INSTANCE=new os;var zs=class{constructor(e){this.key=e,this.type=2}static create(e){let t=Mi.get(e);return typeof t=="boolean"?t?os.INSTANCE:rs.INSTANCE:new zs(e)}cmp(e){return e.type!==this.type?this.type-e.type:rL(this.key,e.key)}equals(e){return e.type===this.type?this.key===e.key:!1}evaluate(e){return!!e.getValue(this.key)}serialize(){return this.key}keys(){return[this.key]}negate(){return Kr.create(this.key)}},zl=class{constructor(e,t){this.key=e,this.value=t,this.type=4}static create(e,t){if(typeof t=="boolean")return t?zs.create(e):Kr.create(e);let i=Mi.get(e);return typeof i=="boolean"?t===(i?"true":"false")?os.INSTANCE:rs.INSTANCE:new zl(e,t)}cmp(e){return e.type!==this.type?this.type-e.type:fa(this.key,this.value,e.key,e.value)}equals(e){return e.type===this.type?this.key===e.key&&this.value===e.value:!1}evaluate(e){return e.getValue(this.key)==this.value}serialize(){return`${this.key} == '${this.value}'`}keys(){return[this.key]}negate(){return Fh.create(this.key,this.value)}},rm=class{constructor(e,t){this.key=e,this.valueKey=t,this.type=10}static create(e,t){return new rm(e,t)}cmp(e){return e.type!==this.type?this.type-e.type:fa(this.key,this.valueKey,e.key,e.valueKey)}equals(e){return e.type===this.type?this.key===e.key&&this.valueKey===e.valueKey:!1}evaluate(e){let t=e.getValue(this.valueKey),i=e.getValue(this.key);return Array.isArray(t)?t.indexOf(i)>=0:typeof i=="string"&&typeof t=="object"&&t!==null?xR.call(t,i):!1}serialize(){return`${this.key} in '${this.valueKey}'`}keys(){return[this.key,this.valueKey]}negate(){return om.create(this)}},om=class{constructor(e){this._actual=e,this.type=11}static create(e){return new om(e)}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}evaluate(e){return!this._actual.evaluate(e)}serialize(){throw new Error("Method not implemented.")}keys(){return this._actual.keys()}negate(){return this._actual}},Fh=class{constructor(e,t){this.key=e,this.value=t,this.type=5}static create(e,t){if(typeof t=="boolean")return t?Kr.create(e):zs.create(e);let i=Mi.get(e);return typeof i=="boolean"?t===(i?"true":"false")?rs.INSTANCE:os.INSTANCE:new Fh(e,t)}cmp(e){return e.type!==this.type?this.type-e.type:fa(this.key,this.value,e.key,e.value)}equals(e){return e.type===this.type?this.key===e.key&&this.value===e.value:!1}evaluate(e){return e.getValue(this.key)!=this.value}serialize(){return`${this.key} != '${this.value}'`}keys(){return[this.key]}negate(){return zl.create(this.key,this.value)}},Kr=class{constructor(e){this.key=e,this.type=3}static create(e){let t=Mi.get(e);return typeof t=="boolean"?t?rs.INSTANCE:os.INSTANCE:new Kr(e)}cmp(e){return e.type!==this.type?this.type-e.type:rL(this.key,e.key)}equals(e){return e.type===this.type?this.key===e.key:!1}evaluate(e){return!e.getValue(this.key)}serialize(){return`!${this.key}`}keys(){return[this.key]}negate(){return zs.create(this.key)}},Bh=class{constructor(e,t){this.key=e,this.value=t,this.type=12}static create(e,t){return new Bh(e,t)}cmp(e){return e.type!==this.type?this.type-e.type:fa(this.key,this.value,e.key,e.value)}equals(e){return e.type===this.type?this.key===e.key&&this.value===e.value:!1}evaluate(e){return parseFloat(e.getValue(this.key))>parseFloat(this.value)}serialize(){return`${this.key} > ${this.value}`}keys(){return[this.key]}negate(){return jh.create(this.key,this.value)}},Wh=class{constructor(e,t){this.key=e,this.value=t,this.type=13}static create(e,t){return new Wh(e,t)}cmp(e){return e.type!==this.type?this.type-e.type:fa(this.key,this.value,e.key,e.value)}equals(e){return e.type===this.type?this.key===e.key&&this.value===e.value:!1}evaluate(e){return parseFloat(e.getValue(this.key))>=parseFloat(this.value)}serialize(){return`${this.key} >= ${this.value}`}keys(){return[this.key]}negate(){return Vh.create(this.key,this.value)}},Vh=class{constructor(e,t){this.key=e,this.value=t,this.type=14}static create(e,t){return new Vh(e,t)}cmp(e){return e.type!==this.type?this.type-e.type:fa(this.key,this.value,e.key,e.value)}equals(e){return e.type===this.type?this.key===e.key&&this.value===e.value:!1}evaluate(e){return parseFloat(e.getValue(this.key))e.key)return 1;let t=this.regexp?this.regexp.source:"",i=e.regexp?e.regexp.source:"";return ti?1:0}equals(e){if(e.type===this.type){let t=this.regexp?this.regexp.source:"",i=e.regexp?e.regexp.source:"";return this.key===e.key&&t===i}return!1}evaluate(e){let t=e.getValue(this.key);return this.regexp?this.regexp.test(t):!1}serialize(){let e=this.regexp?`/${this.regexp.source}/${this.regexp.ignoreCase?"i":""}`:"/invalid/";return`${this.key} =~ ${e}`}keys(){return[this.key]}negate(){return am.create(this)}},am=class{constructor(e){this._actual=e,this.type=8}static create(e){return new am(e)}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}evaluate(e){return!this._actual.evaluate(e)}serialize(){throw new Error("Method not implemented.")}keys(){return this._actual.keys()}negate(){return this._actual}},ua=class{constructor(e){this.expr=e,this.type=6}static create(e){return ua._normalizeArr(e)}cmp(e){if(e.type!==this.type)return this.type-e.type;if(this.expr.lengthe.expr.length)return 1;for(let t=0,i=this.expr.length;t1;){let n=t[t.length-1];if(n.type!==9)break;t.pop();let r=t.pop(),o=qr.create(n.expr.map(a=>ua.create([a,r])));o&&(t.push(o),t.sort(Ph))}return t.length===1?t[0]:new ua(t)}}serialize(){return this.expr.map(e=>e.serialize()).join(" && ")}keys(){let e=[];for(let t of this.expr)e.push(...t.keys());return e}negate(){let e=[];for(let t of this.expr)e.push(t.negate());return qr.create(e)}},qr=class{constructor(e){this.expr=e,this.type=9}static create(e){let t=qr._normalizeArr(e);if(t.length!==0)return t.length===1?t[0]:new qr(t)}cmp(e){if(e.type!==this.type)return this.type-e.type;if(this.expr.lengthe.expr.length)return 1;for(let t=0,i=this.expr.length;te.serialize()).join(" || ")}keys(){let e=[];for(let t of this.expr)e.push(...t.keys());return e}negate(){let e=[];for(let i of this.expr)e.push(i.negate());let t=i=>i.type===9?i.expr:[i];for(;e.length>1;){let i=e.shift(),n=e.shift(),r=[];for(let o of t(i))for(let a of t(n))r.push(dt.and(o,a));e.unshift(dt.or(...r))}return e[0]}},te=class extends zs{constructor(e,t,i){super(e);this._defaultValue=t,typeof i=="object"?te._info.push(Object.assign(Object.assign({},i),{key:e})):i!==!0&&te._info.push({key:e,description:i,type:t!=null?typeof t:void 0})}static all(){return te._info.values()}bindTo(e){return e.createKey(this.key,this._defaultValue)}getValue(e){return e.getContextKeyValue(this.key)}toNegated(){return dt.not(this.key)}isEqualTo(e){return dt.equals(this.key,e)}};te._info=[];var fe=$("contextKeyService"),sL="setContext";function rL(s,e){return se?1:0}function fa(s,e,t,i){return st?1:ei?1:0}var It=$("commandService"),Qe=new class{constructor(){this._commands=new Map,this._onDidRegisterCommand=new k,this.onDidRegisterCommand=this._onDidRegisterCommand.event}registerCommand(s,e){if(!s)throw new Error("invalid command");if(typeof s=="string"){if(!e)throw new Error("invalid command");return this.registerCommand({id:s,handler:e})}if(s.description){let o=[];for(let l of s.description.args)o.push(l.constraint);let a=s.handler;s.handler=function(l,...c){return ny(c,o),a(l,...c)}}let{id:t}=s,i=this._commands.get(t);i||(i=new Ht,this._commands.set(t,i));let n=i.unshift(s),r=oe(()=>{n();let o=this._commands.get(t);(o==null?void 0:o.isEmpty())&&this._commands.delete(t)});return this._onDidRegisterCommand.fire(t),r}registerCommandAlias(s,e){return Qe.registerCommand(s,(t,...i)=>t.get(It).executeCommand(e,...i))}getCommand(s){let e=this._commands.get(s);if(!(!e||e.isEmpty()))return re.first(e)}getCommands(){let s=new Map;for(let e of this._commands.keys()){let t=this.getCommand(e);t&&s.set(e,t)}return s}};Qe.registerCommand("noop",()=>{});function Hl(s,e){if(!s)throw new Error(e?`Assertion failed (${e})`:"Assertion Failed")}var oL=class{constructor(){this.data=new Map}add(e,t){Hl(Ni(e)),Hl(Ft(t)),Hl(!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}},Te=new oL;var nn;(function(s){s.DARK="dark",s.LIGHT="light",s.HIGH_CONTRAST="hc"})(nn||(nn={}));var aL=class{constructor(){this._icons=new Map,this._onDidRegister=new k}add(e){let t=this._icons.get(e.id);t?e.description?t.description=e.description:console.error(`Duplicate registration of codicon ${e.id}`):(this._icons.set(e.id,e),this._onDidRegister.fire(e))}get(e){return this._icons.get(e)}get all(){return this._icons.values()}get onDidRegister(){return this._onDidRegister.event}},lL=new aL,Ul=lL;function di(s,e){return new Le(s,e)}function cL(s){return s?s.replace(/\$\((.*?)\)/g,(e,t)=>` ${t} `).trim():""}var Le=class{constructor(e,t,i){this.id=e,this.definition=t,this.description=i,lL.add(this)}get classNames(){return"codicon codicon-"+this.id}get classNamesArray(){return["codicon","codicon-"+this.id]}get cssSelector(){return".codicon.codicon-"+this.id}},Kt;(function(s){s.iconNameSegment="[A-Za-z0-9]+",s.iconNameExpression="[A-Za-z0-9\\-]+",s.iconModifierExpression="~[A-Za-z]+";let e=new RegExp(`^(${s.iconNameExpression})(${s.iconModifierExpression})?$`);function t(r){if(r instanceof Le)return["codicon","codicon-"+r.id];let o=e.exec(r.id);if(!o)return t(Le.error);let[,a,l]=o,c=["codicon","codicon-"+a];return l&&c.push("codicon-modifier-"+l.substr(1)),c}s.asClassNameArray=t;function i(r){return t(r).join(" ")}s.asClassName=i;function n(r){return"."+t(r).join(".")}s.asCSSSelector=n})(Kt||(Kt={}));(function(s){s.add=new s("add",{fontCharacter:"\\ea60"}),s.plus=new s("plus",{fontCharacter:"\\ea60"}),s.gistNew=new s("gist-new",{fontCharacter:"\\ea60"}),s.repoCreate=new s("repo-create",{fontCharacter:"\\ea60"}),s.lightbulb=new s("lightbulb",{fontCharacter:"\\ea61"}),s.lightBulb=new s("light-bulb",{fontCharacter:"\\ea61"}),s.repo=new s("repo",{fontCharacter:"\\ea62"}),s.repoDelete=new s("repo-delete",{fontCharacter:"\\ea62"}),s.gistFork=new s("gist-fork",{fontCharacter:"\\ea63"}),s.repoForked=new s("repo-forked",{fontCharacter:"\\ea63"}),s.gitPullRequest=new s("git-pull-request",{fontCharacter:"\\ea64"}),s.gitPullRequestAbandoned=new s("git-pull-request-abandoned",{fontCharacter:"\\ea64"}),s.recordKeys=new s("record-keys",{fontCharacter:"\\ea65"}),s.keyboard=new s("keyboard",{fontCharacter:"\\ea65"}),s.tag=new s("tag",{fontCharacter:"\\ea66"}),s.tagAdd=new s("tag-add",{fontCharacter:"\\ea66"}),s.tagRemove=new s("tag-remove",{fontCharacter:"\\ea66"}),s.person=new s("person",{fontCharacter:"\\ea67"}),s.personFollow=new s("person-follow",{fontCharacter:"\\ea67"}),s.personOutline=new s("person-outline",{fontCharacter:"\\ea67"}),s.personFilled=new s("person-filled",{fontCharacter:"\\ea67"}),s.gitBranch=new s("git-branch",{fontCharacter:"\\ea68"}),s.gitBranchCreate=new s("git-branch-create",{fontCharacter:"\\ea68"}),s.gitBranchDelete=new s("git-branch-delete",{fontCharacter:"\\ea68"}),s.sourceControl=new s("source-control",{fontCharacter:"\\ea68"}),s.mirror=new s("mirror",{fontCharacter:"\\ea69"}),s.mirrorPublic=new s("mirror-public",{fontCharacter:"\\ea69"}),s.star=new s("star",{fontCharacter:"\\ea6a"}),s.starAdd=new s("star-add",{fontCharacter:"\\ea6a"}),s.starDelete=new s("star-delete",{fontCharacter:"\\ea6a"}),s.starEmpty=new s("star-empty",{fontCharacter:"\\ea6a"}),s.comment=new s("comment",{fontCharacter:"\\ea6b"}),s.commentAdd=new s("comment-add",{fontCharacter:"\\ea6b"}),s.alert=new s("alert",{fontCharacter:"\\ea6c"}),s.warning=new s("warning",{fontCharacter:"\\ea6c"}),s.search=new s("search",{fontCharacter:"\\ea6d"}),s.searchSave=new s("search-save",{fontCharacter:"\\ea6d"}),s.logOut=new s("log-out",{fontCharacter:"\\ea6e"}),s.signOut=new s("sign-out",{fontCharacter:"\\ea6e"}),s.logIn=new s("log-in",{fontCharacter:"\\ea6f"}),s.signIn=new s("sign-in",{fontCharacter:"\\ea6f"}),s.eye=new s("eye",{fontCharacter:"\\ea70"}),s.eyeUnwatch=new s("eye-unwatch",{fontCharacter:"\\ea70"}),s.eyeWatch=new s("eye-watch",{fontCharacter:"\\ea70"}),s.circleFilled=new s("circle-filled",{fontCharacter:"\\ea71"}),s.primitiveDot=new s("primitive-dot",{fontCharacter:"\\ea71"}),s.closeDirty=new s("close-dirty",{fontCharacter:"\\ea71"}),s.debugBreakpoint=new s("debug-breakpoint",{fontCharacter:"\\ea71"}),s.debugBreakpointDisabled=new s("debug-breakpoint-disabled",{fontCharacter:"\\ea71"}),s.debugHint=new s("debug-hint",{fontCharacter:"\\ea71"}),s.primitiveSquare=new s("primitive-square",{fontCharacter:"\\ea72"}),s.edit=new s("edit",{fontCharacter:"\\ea73"}),s.pencil=new s("pencil",{fontCharacter:"\\ea73"}),s.info=new s("info",{fontCharacter:"\\ea74"}),s.issueOpened=new s("issue-opened",{fontCharacter:"\\ea74"}),s.gistPrivate=new s("gist-private",{fontCharacter:"\\ea75"}),s.gitForkPrivate=new s("git-fork-private",{fontCharacter:"\\ea75"}),s.lock=new s("lock",{fontCharacter:"\\ea75"}),s.mirrorPrivate=new s("mirror-private",{fontCharacter:"\\ea75"}),s.close=new s("close",{fontCharacter:"\\ea76"}),s.removeClose=new s("remove-close",{fontCharacter:"\\ea76"}),s.x=new s("x",{fontCharacter:"\\ea76"}),s.repoSync=new s("repo-sync",{fontCharacter:"\\ea77"}),s.sync=new s("sync",{fontCharacter:"\\ea77"}),s.clone=new s("clone",{fontCharacter:"\\ea78"}),s.desktopDownload=new s("desktop-download",{fontCharacter:"\\ea78"}),s.beaker=new s("beaker",{fontCharacter:"\\ea79"}),s.microscope=new s("microscope",{fontCharacter:"\\ea79"}),s.vm=new s("vm",{fontCharacter:"\\ea7a"}),s.deviceDesktop=new s("device-desktop",{fontCharacter:"\\ea7a"}),s.file=new s("file",{fontCharacter:"\\ea7b"}),s.fileText=new s("file-text",{fontCharacter:"\\ea7b"}),s.more=new s("more",{fontCharacter:"\\ea7c"}),s.ellipsis=new s("ellipsis",{fontCharacter:"\\ea7c"}),s.kebabHorizontal=new s("kebab-horizontal",{fontCharacter:"\\ea7c"}),s.mailReply=new s("mail-reply",{fontCharacter:"\\ea7d"}),s.reply=new s("reply",{fontCharacter:"\\ea7d"}),s.organization=new s("organization",{fontCharacter:"\\ea7e"}),s.organizationFilled=new s("organization-filled",{fontCharacter:"\\ea7e"}),s.organizationOutline=new s("organization-outline",{fontCharacter:"\\ea7e"}),s.newFile=new s("new-file",{fontCharacter:"\\ea7f"}),s.fileAdd=new s("file-add",{fontCharacter:"\\ea7f"}),s.newFolder=new s("new-folder",{fontCharacter:"\\ea80"}),s.fileDirectoryCreate=new s("file-directory-create",{fontCharacter:"\\ea80"}),s.trash=new s("trash",{fontCharacter:"\\ea81"}),s.trashcan=new s("trashcan",{fontCharacter:"\\ea81"}),s.history=new s("history",{fontCharacter:"\\ea82"}),s.clock=new s("clock",{fontCharacter:"\\ea82"}),s.folder=new s("folder",{fontCharacter:"\\ea83"}),s.fileDirectory=new s("file-directory",{fontCharacter:"\\ea83"}),s.symbolFolder=new s("symbol-folder",{fontCharacter:"\\ea83"}),s.logoGithub=new s("logo-github",{fontCharacter:"\\ea84"}),s.markGithub=new s("mark-github",{fontCharacter:"\\ea84"}),s.github=new s("github",{fontCharacter:"\\ea84"}),s.terminal=new s("terminal",{fontCharacter:"\\ea85"}),s.console=new s("console",{fontCharacter:"\\ea85"}),s.repl=new s("repl",{fontCharacter:"\\ea85"}),s.zap=new s("zap",{fontCharacter:"\\ea86"}),s.symbolEvent=new s("symbol-event",{fontCharacter:"\\ea86"}),s.error=new s("error",{fontCharacter:"\\ea87"}),s.stop=new s("stop",{fontCharacter:"\\ea87"}),s.variable=new s("variable",{fontCharacter:"\\ea88"}),s.symbolVariable=new s("symbol-variable",{fontCharacter:"\\ea88"}),s.array=new s("array",{fontCharacter:"\\ea8a"}),s.symbolArray=new s("symbol-array",{fontCharacter:"\\ea8a"}),s.symbolModule=new s("symbol-module",{fontCharacter:"\\ea8b"}),s.symbolPackage=new s("symbol-package",{fontCharacter:"\\ea8b"}),s.symbolNamespace=new s("symbol-namespace",{fontCharacter:"\\ea8b"}),s.symbolObject=new s("symbol-object",{fontCharacter:"\\ea8b"}),s.symbolMethod=new s("symbol-method",{fontCharacter:"\\ea8c"}),s.symbolFunction=new s("symbol-function",{fontCharacter:"\\ea8c"}),s.symbolConstructor=new s("symbol-constructor",{fontCharacter:"\\ea8c"}),s.symbolBoolean=new s("symbol-boolean",{fontCharacter:"\\ea8f"}),s.symbolNull=new s("symbol-null",{fontCharacter:"\\ea8f"}),s.symbolNumeric=new s("symbol-numeric",{fontCharacter:"\\ea90"}),s.symbolNumber=new s("symbol-number",{fontCharacter:"\\ea90"}),s.symbolStructure=new s("symbol-structure",{fontCharacter:"\\ea91"}),s.symbolStruct=new s("symbol-struct",{fontCharacter:"\\ea91"}),s.symbolParameter=new s("symbol-parameter",{fontCharacter:"\\ea92"}),s.symbolTypeParameter=new s("symbol-type-parameter",{fontCharacter:"\\ea92"}),s.symbolKey=new s("symbol-key",{fontCharacter:"\\ea93"}),s.symbolText=new s("symbol-text",{fontCharacter:"\\ea93"}),s.symbolReference=new s("symbol-reference",{fontCharacter:"\\ea94"}),s.goToFile=new s("go-to-file",{fontCharacter:"\\ea94"}),s.symbolEnum=new s("symbol-enum",{fontCharacter:"\\ea95"}),s.symbolValue=new s("symbol-value",{fontCharacter:"\\ea95"}),s.symbolRuler=new s("symbol-ruler",{fontCharacter:"\\ea96"}),s.symbolUnit=new s("symbol-unit",{fontCharacter:"\\ea96"}),s.activateBreakpoints=new s("activate-breakpoints",{fontCharacter:"\\ea97"}),s.archive=new s("archive",{fontCharacter:"\\ea98"}),s.arrowBoth=new s("arrow-both",{fontCharacter:"\\ea99"}),s.arrowDown=new s("arrow-down",{fontCharacter:"\\ea9a"}),s.arrowLeft=new s("arrow-left",{fontCharacter:"\\ea9b"}),s.arrowRight=new s("arrow-right",{fontCharacter:"\\ea9c"}),s.arrowSmallDown=new s("arrow-small-down",{fontCharacter:"\\ea9d"}),s.arrowSmallLeft=new s("arrow-small-left",{fontCharacter:"\\ea9e"}),s.arrowSmallRight=new s("arrow-small-right",{fontCharacter:"\\ea9f"}),s.arrowSmallUp=new s("arrow-small-up",{fontCharacter:"\\eaa0"}),s.arrowUp=new s("arrow-up",{fontCharacter:"\\eaa1"}),s.bell=new s("bell",{fontCharacter:"\\eaa2"}),s.bold=new s("bold",{fontCharacter:"\\eaa3"}),s.book=new s("book",{fontCharacter:"\\eaa4"}),s.bookmark=new s("bookmark",{fontCharacter:"\\eaa5"}),s.debugBreakpointConditionalUnverified=new s("debug-breakpoint-conditional-unverified",{fontCharacter:"\\eaa6"}),s.debugBreakpointConditional=new s("debug-breakpoint-conditional",{fontCharacter:"\\eaa7"}),s.debugBreakpointConditionalDisabled=new s("debug-breakpoint-conditional-disabled",{fontCharacter:"\\eaa7"}),s.debugBreakpointDataUnverified=new s("debug-breakpoint-data-unverified",{fontCharacter:"\\eaa8"}),s.debugBreakpointData=new s("debug-breakpoint-data",{fontCharacter:"\\eaa9"}),s.debugBreakpointDataDisabled=new s("debug-breakpoint-data-disabled",{fontCharacter:"\\eaa9"}),s.debugBreakpointLogUnverified=new s("debug-breakpoint-log-unverified",{fontCharacter:"\\eaaa"}),s.debugBreakpointLog=new s("debug-breakpoint-log",{fontCharacter:"\\eaab"}),s.debugBreakpointLogDisabled=new s("debug-breakpoint-log-disabled",{fontCharacter:"\\eaab"}),s.briefcase=new s("briefcase",{fontCharacter:"\\eaac"}),s.broadcast=new s("broadcast",{fontCharacter:"\\eaad"}),s.browser=new s("browser",{fontCharacter:"\\eaae"}),s.bug=new s("bug",{fontCharacter:"\\eaaf"}),s.calendar=new s("calendar",{fontCharacter:"\\eab0"}),s.caseSensitive=new s("case-sensitive",{fontCharacter:"\\eab1"}),s.check=new s("check",{fontCharacter:"\\eab2"}),s.checklist=new s("checklist",{fontCharacter:"\\eab3"}),s.chevronDown=new s("chevron-down",{fontCharacter:"\\eab4"}),s.chevronLeft=new s("chevron-left",{fontCharacter:"\\eab5"}),s.chevronRight=new s("chevron-right",{fontCharacter:"\\eab6"}),s.chevronUp=new s("chevron-up",{fontCharacter:"\\eab7"}),s.chromeClose=new s("chrome-close",{fontCharacter:"\\eab8"}),s.chromeMaximize=new s("chrome-maximize",{fontCharacter:"\\eab9"}),s.chromeMinimize=new s("chrome-minimize",{fontCharacter:"\\eaba"}),s.chromeRestore=new s("chrome-restore",{fontCharacter:"\\eabb"}),s.circleOutline=new s("circle-outline",{fontCharacter:"\\eabc"}),s.debugBreakpointUnverified=new s("debug-breakpoint-unverified",{fontCharacter:"\\eabc"}),s.circleSlash=new s("circle-slash",{fontCharacter:"\\eabd"}),s.circuitBoard=new s("circuit-board",{fontCharacter:"\\eabe"}),s.clearAll=new s("clear-all",{fontCharacter:"\\eabf"}),s.clippy=new s("clippy",{fontCharacter:"\\eac0"}),s.closeAll=new s("close-all",{fontCharacter:"\\eac1"}),s.cloudDownload=new s("cloud-download",{fontCharacter:"\\eac2"}),s.cloudUpload=new s("cloud-upload",{fontCharacter:"\\eac3"}),s.code=new s("code",{fontCharacter:"\\eac4"}),s.collapseAll=new s("collapse-all",{fontCharacter:"\\eac5"}),s.colorMode=new s("color-mode",{fontCharacter:"\\eac6"}),s.commentDiscussion=new s("comment-discussion",{fontCharacter:"\\eac7"}),s.compareChanges=new s("compare-changes",{fontCharacter:"\\eafd"}),s.creditCard=new s("credit-card",{fontCharacter:"\\eac9"}),s.dash=new s("dash",{fontCharacter:"\\eacc"}),s.dashboard=new s("dashboard",{fontCharacter:"\\eacd"}),s.database=new s("database",{fontCharacter:"\\eace"}),s.debugContinue=new s("debug-continue",{fontCharacter:"\\eacf"}),s.debugDisconnect=new s("debug-disconnect",{fontCharacter:"\\ead0"}),s.debugPause=new s("debug-pause",{fontCharacter:"\\ead1"}),s.debugRestart=new s("debug-restart",{fontCharacter:"\\ead2"}),s.debugStart=new s("debug-start",{fontCharacter:"\\ead3"}),s.debugStepInto=new s("debug-step-into",{fontCharacter:"\\ead4"}),s.debugStepOut=new s("debug-step-out",{fontCharacter:"\\ead5"}),s.debugStepOver=new s("debug-step-over",{fontCharacter:"\\ead6"}),s.debugStop=new s("debug-stop",{fontCharacter:"\\ead7"}),s.debug=new s("debug",{fontCharacter:"\\ead8"}),s.deviceCameraVideo=new s("device-camera-video",{fontCharacter:"\\ead9"}),s.deviceCamera=new s("device-camera",{fontCharacter:"\\eada"}),s.deviceMobile=new s("device-mobile",{fontCharacter:"\\eadb"}),s.diffAdded=new s("diff-added",{fontCharacter:"\\eadc"}),s.diffIgnored=new s("diff-ignored",{fontCharacter:"\\eadd"}),s.diffModified=new s("diff-modified",{fontCharacter:"\\eade"}),s.diffRemoved=new s("diff-removed",{fontCharacter:"\\eadf"}),s.diffRenamed=new s("diff-renamed",{fontCharacter:"\\eae0"}),s.diff=new s("diff",{fontCharacter:"\\eae1"}),s.discard=new s("discard",{fontCharacter:"\\eae2"}),s.editorLayout=new s("editor-layout",{fontCharacter:"\\eae3"}),s.emptyWindow=new s("empty-window",{fontCharacter:"\\eae4"}),s.exclude=new s("exclude",{fontCharacter:"\\eae5"}),s.extensions=new s("extensions",{fontCharacter:"\\eae6"}),s.eyeClosed=new s("eye-closed",{fontCharacter:"\\eae7"}),s.fileBinary=new s("file-binary",{fontCharacter:"\\eae8"}),s.fileCode=new s("file-code",{fontCharacter:"\\eae9"}),s.fileMedia=new s("file-media",{fontCharacter:"\\eaea"}),s.filePdf=new s("file-pdf",{fontCharacter:"\\eaeb"}),s.fileSubmodule=new s("file-submodule",{fontCharacter:"\\eaec"}),s.fileSymlinkDirectory=new s("file-symlink-directory",{fontCharacter:"\\eaed"}),s.fileSymlinkFile=new s("file-symlink-file",{fontCharacter:"\\eaee"}),s.fileZip=new s("file-zip",{fontCharacter:"\\eaef"}),s.files=new s("files",{fontCharacter:"\\eaf0"}),s.filter=new s("filter",{fontCharacter:"\\eaf1"}),s.flame=new s("flame",{fontCharacter:"\\eaf2"}),s.foldDown=new s("fold-down",{fontCharacter:"\\eaf3"}),s.foldUp=new s("fold-up",{fontCharacter:"\\eaf4"}),s.fold=new s("fold",{fontCharacter:"\\eaf5"}),s.folderActive=new s("folder-active",{fontCharacter:"\\eaf6"}),s.folderOpened=new s("folder-opened",{fontCharacter:"\\eaf7"}),s.gear=new s("gear",{fontCharacter:"\\eaf8"}),s.gift=new s("gift",{fontCharacter:"\\eaf9"}),s.gistSecret=new s("gist-secret",{fontCharacter:"\\eafa"}),s.gist=new s("gist",{fontCharacter:"\\eafb"}),s.gitCommit=new s("git-commit",{fontCharacter:"\\eafc"}),s.gitCompare=new s("git-compare",{fontCharacter:"\\eafd"}),s.gitMerge=new s("git-merge",{fontCharacter:"\\eafe"}),s.githubAction=new s("github-action",{fontCharacter:"\\eaff"}),s.githubAlt=new s("github-alt",{fontCharacter:"\\eb00"}),s.globe=new s("globe",{fontCharacter:"\\eb01"}),s.grabber=new s("grabber",{fontCharacter:"\\eb02"}),s.graph=new s("graph",{fontCharacter:"\\eb03"}),s.gripper=new s("gripper",{fontCharacter:"\\eb04"}),s.heart=new s("heart",{fontCharacter:"\\eb05"}),s.home=new s("home",{fontCharacter:"\\eb06"}),s.horizontalRule=new s("horizontal-rule",{fontCharacter:"\\eb07"}),s.hubot=new s("hubot",{fontCharacter:"\\eb08"}),s.inbox=new s("inbox",{fontCharacter:"\\eb09"}),s.issueClosed=new s("issue-closed",{fontCharacter:"\\eba4"}),s.issueReopened=new s("issue-reopened",{fontCharacter:"\\eb0b"}),s.issues=new s("issues",{fontCharacter:"\\eb0c"}),s.italic=new s("italic",{fontCharacter:"\\eb0d"}),s.jersey=new s("jersey",{fontCharacter:"\\eb0e"}),s.json=new s("json",{fontCharacter:"\\eb0f"}),s.kebabVertical=new s("kebab-vertical",{fontCharacter:"\\eb10"}),s.key=new s("key",{fontCharacter:"\\eb11"}),s.law=new s("law",{fontCharacter:"\\eb12"}),s.lightbulbAutofix=new s("lightbulb-autofix",{fontCharacter:"\\eb13"}),s.linkExternal=new s("link-external",{fontCharacter:"\\eb14"}),s.link=new s("link",{fontCharacter:"\\eb15"}),s.listOrdered=new s("list-ordered",{fontCharacter:"\\eb16"}),s.listUnordered=new s("list-unordered",{fontCharacter:"\\eb17"}),s.liveShare=new s("live-share",{fontCharacter:"\\eb18"}),s.loading=new s("loading",{fontCharacter:"\\eb19"}),s.location=new s("location",{fontCharacter:"\\eb1a"}),s.mailRead=new s("mail-read",{fontCharacter:"\\eb1b"}),s.mail=new s("mail",{fontCharacter:"\\eb1c"}),s.markdown=new s("markdown",{fontCharacter:"\\eb1d"}),s.megaphone=new s("megaphone",{fontCharacter:"\\eb1e"}),s.mention=new s("mention",{fontCharacter:"\\eb1f"}),s.milestone=new s("milestone",{fontCharacter:"\\eb20"}),s.mortarBoard=new s("mortar-board",{fontCharacter:"\\eb21"}),s.move=new s("move",{fontCharacter:"\\eb22"}),s.multipleWindows=new s("multiple-windows",{fontCharacter:"\\eb23"}),s.mute=new s("mute",{fontCharacter:"\\eb24"}),s.noNewline=new s("no-newline",{fontCharacter:"\\eb25"}),s.note=new s("note",{fontCharacter:"\\eb26"}),s.octoface=new s("octoface",{fontCharacter:"\\eb27"}),s.openPreview=new s("open-preview",{fontCharacter:"\\eb28"}),s.package_=new s("package",{fontCharacter:"\\eb29"}),s.paintcan=new s("paintcan",{fontCharacter:"\\eb2a"}),s.pin=new s("pin",{fontCharacter:"\\eb2b"}),s.play=new s("play",{fontCharacter:"\\eb2c"}),s.run=new s("run",{fontCharacter:"\\eb2c"}),s.plug=new s("plug",{fontCharacter:"\\eb2d"}),s.preserveCase=new s("preserve-case",{fontCharacter:"\\eb2e"}),s.preview=new s("preview",{fontCharacter:"\\eb2f"}),s.project=new s("project",{fontCharacter:"\\eb30"}),s.pulse=new s("pulse",{fontCharacter:"\\eb31"}),s.question=new s("question",{fontCharacter:"\\eb32"}),s.quote=new s("quote",{fontCharacter:"\\eb33"}),s.radioTower=new s("radio-tower",{fontCharacter:"\\eb34"}),s.reactions=new s("reactions",{fontCharacter:"\\eb35"}),s.references=new s("references",{fontCharacter:"\\eb36"}),s.refresh=new s("refresh",{fontCharacter:"\\eb37"}),s.regex=new s("regex",{fontCharacter:"\\eb38"}),s.remoteExplorer=new s("remote-explorer",{fontCharacter:"\\eb39"}),s.remote=new s("remote",{fontCharacter:"\\eb3a"}),s.remove=new s("remove",{fontCharacter:"\\eb3b"}),s.replaceAll=new s("replace-all",{fontCharacter:"\\eb3c"}),s.replace=new s("replace",{fontCharacter:"\\eb3d"}),s.repoClone=new s("repo-clone",{fontCharacter:"\\eb3e"}),s.repoForcePush=new s("repo-force-push",{fontCharacter:"\\eb3f"}),s.repoPull=new s("repo-pull",{fontCharacter:"\\eb40"}),s.repoPush=new s("repo-push",{fontCharacter:"\\eb41"}),s.report=new s("report",{fontCharacter:"\\eb42"}),s.requestChanges=new s("request-changes",{fontCharacter:"\\eb43"}),s.rocket=new s("rocket",{fontCharacter:"\\eb44"}),s.rootFolderOpened=new s("root-folder-opened",{fontCharacter:"\\eb45"}),s.rootFolder=new s("root-folder",{fontCharacter:"\\eb46"}),s.rss=new s("rss",{fontCharacter:"\\eb47"}),s.ruby=new s("ruby",{fontCharacter:"\\eb48"}),s.saveAll=new s("save-all",{fontCharacter:"\\eb49"}),s.saveAs=new s("save-as",{fontCharacter:"\\eb4a"}),s.save=new s("save",{fontCharacter:"\\eb4b"}),s.screenFull=new s("screen-full",{fontCharacter:"\\eb4c"}),s.screenNormal=new s("screen-normal",{fontCharacter:"\\eb4d"}),s.searchStop=new s("search-stop",{fontCharacter:"\\eb4e"}),s.server=new s("server",{fontCharacter:"\\eb50"}),s.settingsGear=new s("settings-gear",{fontCharacter:"\\eb51"}),s.settings=new s("settings",{fontCharacter:"\\eb52"}),s.shield=new s("shield",{fontCharacter:"\\eb53"}),s.smiley=new s("smiley",{fontCharacter:"\\eb54"}),s.sortPrecedence=new s("sort-precedence",{fontCharacter:"\\eb55"}),s.splitHorizontal=new s("split-horizontal",{fontCharacter:"\\eb56"}),s.splitVertical=new s("split-vertical",{fontCharacter:"\\eb57"}),s.squirrel=new s("squirrel",{fontCharacter:"\\eb58"}),s.starFull=new s("star-full",{fontCharacter:"\\eb59"}),s.starHalf=new s("star-half",{fontCharacter:"\\eb5a"}),s.symbolClass=new s("symbol-class",{fontCharacter:"\\eb5b"}),s.symbolColor=new s("symbol-color",{fontCharacter:"\\eb5c"}),s.symbolConstant=new s("symbol-constant",{fontCharacter:"\\eb5d"}),s.symbolEnumMember=new s("symbol-enum-member",{fontCharacter:"\\eb5e"}),s.symbolField=new s("symbol-field",{fontCharacter:"\\eb5f"}),s.symbolFile=new s("symbol-file",{fontCharacter:"\\eb60"}),s.symbolInterface=new s("symbol-interface",{fontCharacter:"\\eb61"}),s.symbolKeyword=new s("symbol-keyword",{fontCharacter:"\\eb62"}),s.symbolMisc=new s("symbol-misc",{fontCharacter:"\\eb63"}),s.symbolOperator=new s("symbol-operator",{fontCharacter:"\\eb64"}),s.symbolProperty=new s("symbol-property",{fontCharacter:"\\eb65"}),s.wrench=new s("wrench",{fontCharacter:"\\eb65"}),s.wrenchSubaction=new s("wrench-subaction",{fontCharacter:"\\eb65"}),s.symbolSnippet=new s("symbol-snippet",{fontCharacter:"\\eb66"}),s.tasklist=new s("tasklist",{fontCharacter:"\\eb67"}),s.telescope=new s("telescope",{fontCharacter:"\\eb68"}),s.textSize=new s("text-size",{fontCharacter:"\\eb69"}),s.threeBars=new s("three-bars",{fontCharacter:"\\eb6a"}),s.thumbsdown=new s("thumbsdown",{fontCharacter:"\\eb6b"}),s.thumbsup=new s("thumbsup",{fontCharacter:"\\eb6c"}),s.tools=new s("tools",{fontCharacter:"\\eb6d"}),s.triangleDown=new s("triangle-down",{fontCharacter:"\\eb6e"}),s.triangleLeft=new s("triangle-left",{fontCharacter:"\\eb6f"}),s.triangleRight=new s("triangle-right",{fontCharacter:"\\eb70"}),s.triangleUp=new s("triangle-up",{fontCharacter:"\\eb71"}),s.twitter=new s("twitter",{fontCharacter:"\\eb72"}),s.unfold=new s("unfold",{fontCharacter:"\\eb73"}),s.unlock=new s("unlock",{fontCharacter:"\\eb74"}),s.unmute=new s("unmute",{fontCharacter:"\\eb75"}),s.unverified=new s("unverified",{fontCharacter:"\\eb76"}),s.verified=new s("verified",{fontCharacter:"\\eb77"}),s.versions=new s("versions",{fontCharacter:"\\eb78"}),s.vmActive=new s("vm-active",{fontCharacter:"\\eb79"}),s.vmOutline=new s("vm-outline",{fontCharacter:"\\eb7a"}),s.vmRunning=new s("vm-running",{fontCharacter:"\\eb7b"}),s.watch=new s("watch",{fontCharacter:"\\eb7c"}),s.whitespace=new s("whitespace",{fontCharacter:"\\eb7d"}),s.wholeWord=new s("whole-word",{fontCharacter:"\\eb7e"}),s.window=new s("window",{fontCharacter:"\\eb7f"}),s.wordWrap=new s("word-wrap",{fontCharacter:"\\eb80"}),s.zoomIn=new s("zoom-in",{fontCharacter:"\\eb81"}),s.zoomOut=new s("zoom-out",{fontCharacter:"\\eb82"}),s.listFilter=new s("list-filter",{fontCharacter:"\\eb83"}),s.listFlat=new s("list-flat",{fontCharacter:"\\eb84"}),s.listSelection=new s("list-selection",{fontCharacter:"\\eb85"}),s.selection=new s("selection",{fontCharacter:"\\eb85"}),s.listTree=new s("list-tree",{fontCharacter:"\\eb86"}),s.debugBreakpointFunctionUnverified=new s("debug-breakpoint-function-unverified",{fontCharacter:"\\eb87"}),s.debugBreakpointFunction=new s("debug-breakpoint-function",{fontCharacter:"\\eb88"}),s.debugBreakpointFunctionDisabled=new s("debug-breakpoint-function-disabled",{fontCharacter:"\\eb88"}),s.debugStackframeActive=new s("debug-stackframe-active",{fontCharacter:"\\eb89"}),s.debugStackframeDot=new s("debug-stackframe-dot",{fontCharacter:"\\eb8a"}),s.debugStackframe=new s("debug-stackframe",{fontCharacter:"\\eb8b"}),s.debugStackframeFocused=new s("debug-stackframe-focused",{fontCharacter:"\\eb8b"}),s.debugBreakpointUnsupported=new s("debug-breakpoint-unsupported",{fontCharacter:"\\eb8c"}),s.symbolString=new s("symbol-string",{fontCharacter:"\\eb8d"}),s.debugReverseContinue=new s("debug-reverse-continue",{fontCharacter:"\\eb8e"}),s.debugStepBack=new s("debug-step-back",{fontCharacter:"\\eb8f"}),s.debugRestartFrame=new s("debug-restart-frame",{fontCharacter:"\\eb90"}),s.callIncoming=new s("call-incoming",{fontCharacter:"\\eb92"}),s.callOutgoing=new s("call-outgoing",{fontCharacter:"\\eb93"}),s.menu=new s("menu",{fontCharacter:"\\eb94"}),s.expandAll=new s("expand-all",{fontCharacter:"\\eb95"}),s.feedback=new s("feedback",{fontCharacter:"\\eb96"}),s.groupByRefType=new s("group-by-ref-type",{fontCharacter:"\\eb97"}),s.ungroupByRefType=new s("ungroup-by-ref-type",{fontCharacter:"\\eb98"}),s.account=new s("account",{fontCharacter:"\\eb99"}),s.bellDot=new s("bell-dot",{fontCharacter:"\\eb9a"}),s.debugConsole=new s("debug-console",{fontCharacter:"\\eb9b"}),s.library=new s("library",{fontCharacter:"\\eb9c"}),s.output=new s("output",{fontCharacter:"\\eb9d"}),s.runAll=new s("run-all",{fontCharacter:"\\eb9e"}),s.syncIgnored=new s("sync-ignored",{fontCharacter:"\\eb9f"}),s.pinned=new s("pinned",{fontCharacter:"\\eba0"}),s.githubInverted=new s("github-inverted",{fontCharacter:"\\eba1"}),s.debugAlt=new s("debug-alt",{fontCharacter:"\\eb91"}),s.serverProcess=new s("server-process",{fontCharacter:"\\eba2"}),s.serverEnvironment=new s("server-environment",{fontCharacter:"\\eba3"}),s.pass=new s("pass",{fontCharacter:"\\eba4"}),s.stopCircle=new s("stop-circle",{fontCharacter:"\\eba5"}),s.playCircle=new s("play-circle",{fontCharacter:"\\eba6"}),s.record=new s("record",{fontCharacter:"\\eba7"}),s.debugAltSmall=new s("debug-alt-small",{fontCharacter:"\\eba8"}),s.vmConnect=new s("vm-connect",{fontCharacter:"\\eba9"}),s.cloud=new s("cloud",{fontCharacter:"\\ebaa"}),s.merge=new s("merge",{fontCharacter:"\\ebab"}),s.exportIcon=new s("export",{fontCharacter:"\\ebac"}),s.graphLeft=new s("graph-left",{fontCharacter:"\\ebad"}),s.magnet=new s("magnet",{fontCharacter:"\\ebae"}),s.notebook=new s("notebook",{fontCharacter:"\\ebaf"}),s.redo=new s("redo",{fontCharacter:"\\ebb0"}),s.checkAll=new s("check-all",{fontCharacter:"\\ebb1"}),s.pinnedDirty=new s("pinned-dirty",{fontCharacter:"\\ebb2"}),s.passFilled=new s("pass-filled",{fontCharacter:"\\ebb3"}),s.circleLargeFilled=new s("circle-large-filled",{fontCharacter:"\\ebb4"}),s.circleLargeOutline=new s("circle-large-outline",{fontCharacter:"\\ebb5"}),s.combine=new s("combine",{fontCharacter:"\\ebb6"}),s.gather=new s("gather",{fontCharacter:"\\ebb6"}),s.table=new s("table",{fontCharacter:"\\ebb7"}),s.variableGroup=new s("variable-group",{fontCharacter:"\\ebb8"}),s.typeHierarchy=new s("type-hierarchy",{fontCharacter:"\\ebb9"}),s.typeHierarchySub=new s("type-hierarchy-sub",{fontCharacter:"\\ebba"}),s.typeHierarchySuper=new s("type-hierarchy-super",{fontCharacter:"\\ebbb"}),s.gitPullRequestCreate=new s("git-pull-request-create",{fontCharacter:"\\ebbc"}),s.runAbove=new s("run-above",{fontCharacter:"\\ebbd"}),s.runBelow=new s("run-below",{fontCharacter:"\\ebbe"}),s.notebookTemplate=new s("notebook-template",{fontCharacter:"\\ebbf"}),s.debugRerun=new s("debug-rerun",{fontCharacter:"\\ebc0"}),s.workspaceTrusted=new s("workspace-trusted",{fontCharacter:"\\ebc1"}),s.workspaceUntrusted=new s("workspace-untrusted",{fontCharacter:"\\ebc2"}),s.workspaceUnspecified=new s("workspace-unspecified",{fontCharacter:"\\ebc3"}),s.terminalCmd=new s("terminal-cmd",{fontCharacter:"\\ebc4"}),s.terminalDebian=new s("terminal-debian",{fontCharacter:"\\ebc5"}),s.terminalLinux=new s("terminal-linux",{fontCharacter:"\\ebc6"}),s.terminalPowershell=new s("terminal-powershell",{fontCharacter:"\\ebc7"}),s.terminalTmux=new s("terminal-tmux",{fontCharacter:"\\ebc8"}),s.terminalUbuntu=new s("terminal-ubuntu",{fontCharacter:"\\ebc9"}),s.terminalBash=new s("terminal-bash",{fontCharacter:"\\ebca"}),s.arrowSwap=new s("arrow-swap",{fontCharacter:"\\ebcb"}),s.copy=new s("copy",{fontCharacter:"\\ebcc"}),s.personAdd=new s("person-add",{fontCharacter:"\\ebcd"}),s.filterFilled=new s("filter-filled",{fontCharacter:"\\ebce"}),s.wand=new s("wand",{fontCharacter:"\\ebcf"}),s.debugLineByLine=new s("debug-line-by-line",{fontCharacter:"\\ebd0"}),s.inspect=new s("inspect",{fontCharacter:"\\ebd1"}),s.layers=new s("layers",{fontCharacter:"\\ebd2"}),s.layersDot=new s("layers-dot",{fontCharacter:"\\ebd3"}),s.layersActive=new s("layers-active",{fontCharacter:"\\ebd4"}),s.compass=new s("compass",{fontCharacter:"\\ebd5"}),s.compassDot=new s("compass-dot",{fontCharacter:"\\ebd6"}),s.compassActive=new s("compass-active",{fontCharacter:"\\ebd7"}),s.azure=new s("azure",{fontCharacter:"\\ebd8"}),s.issueDraft=new s("issue-draft",{fontCharacter:"\\ebd9"}),s.gitPullRequestClosed=new s("git-pull-request-closed",{fontCharacter:"\\ebda"}),s.gitPullRequestDraft=new s("git-pull-request-draft",{fontCharacter:"\\ebdb"}),s.debugAll=new s("debug-all",{fontCharacter:"\\ebdc"}),s.debugCoverage=new s("debug-coverage",{fontCharacter:"\\ebdd"}),s.dropDownButton=new s("drop-down-button",s.chevronDown.definition)})(Le||(Le={}));var We=$("themeService"),Ab;(function(s){function e(t){return t&&typeof t=="object"&&typeof t.id=="string"}s.isThemeColor=e})(Ab||(Ab={}));function ma(s){return{id:s}}var ui;(function(s){function e(a){return a&&typeof a=="object"&&typeof a.id=="string"&&(typeof a.color=="undefined"||Ab.isThemeColor(a.color))}s.isThemeIcon=e;let t=new RegExp(`^\\$\\((${Kt.iconNameExpression}(?:${Kt.iconModifierExpression})?)\\)$`);function i(a){let l=t.exec(a);if(!l)return;let[,c]=l;return{id:c}}s.fromString=i;function n(a,l){let c=a.id,h=c.lastIndexOf("~");return h!==-1&&(c=c.substring(0,h)),l&&(c=`${c}~${l}`),{id:c}}s.modify=n;function r(a,l){var c,h;return a.id===l.id&&((c=a.color)===null||c===void 0?void 0:c.id)===((h=l.color)===null||h===void 0?void 0:h.id)}s.isEqual=r;function o(a,l){return{id:a.id,color:l?ma(l):void 0}}s.asThemeIcon=o,s.asClassNameArray=Kt.asClassNameArray,s.asClassName=Kt.asClassName,s.asCSSSelector=Kt.asCSSSelector})(ui||(ui={}));function ga(s){switch(s){case nn.DARK:return"vs-dark";case nn.HIGH_CONTRAST:return"hc-black";default:return"vs"}}var Ob={ThemingContribution:"base.contributions.theming"},hL=class{constructor(){this.themingParticipants=[],this.themingParticipants=[],this.onThemingParticipantAddedEmitter=new k}onColorThemeChange(e){return this.themingParticipants.push(e),this.onThemingParticipantAddedEmitter.fire(e),oe(()=>{let t=this.themingParticipants.indexOf(e);this.themingParticipants.splice(t,1)})}getThemingParticipants(){return this.themingParticipants}},dL=new hL;Te.add(Ob.ThemingContribution,dL);function bt(s){return dL.onColorThemeChange(s)}var Pb=class extends M{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(){}};var DR=function(s,e,t,i){var n=arguments.length,r=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(s,e,t,i);else for(var a=s.length-1;a>=0;a--)(o=s[a])&&(r=(n<3?o(r):n>3?o(e,t,r):o(e,t))||r);return n>3&&r&&Object.defineProperty(e,t,r),r},uL=function(s,e){return function(t,i){e(t,i,s)}};function $l(s){return s.command!==void 0}var Ie=class{constructor(e){this.id=Ie._idPool++,this._debugName=e}};Ie._idPool=0;Ie.CommandPalette=new Ie("CommandPalette");Ie.EditorContext=new Ie("EditorContext");Ie.SimpleEditorContext=new Ie("SimpleEditorContext");Ie.EditorContextCopy=new Ie("EditorContextCopy");Ie.EditorContextPeek=new Ie("EditorContextPeek");Ie.MenubarEditMenu=new Ie("MenubarEditMenu");Ie.MenubarCopy=new Ie("MenubarCopy");Ie.MenubarGoMenu=new Ie("MenubarGoMenu");Ie.MenubarSelectionMenu=new Ie("MenubarSelectionMenu");Ie.InlineCompletionsActions=new Ie("InlineCompletionsActions");var lm=$("menuService"),Gr=new class{constructor(){this._commands=new Map,this._menuItems=new Map,this._onDidChangeMenu=new k,this.onDidChangeMenu=this._onDidChangeMenu.event,this._commandPaletteChangeEvent={has:s=>s===Ie.CommandPalette}}addCommand(s){return this.addCommands(re.single(s))}addCommands(s){for(let e of s)this._commands.set(e.id,e);return this._onDidChangeMenu.fire(this._commandPaletteChangeEvent),oe(()=>{let e=!1;for(let t of s)e=this._commands.delete(t.id)||e;e&&this._onDidChangeMenu.fire(this._commandPaletteChangeEvent)})}getCommand(s){return this._commands.get(s)}getCommands(){let s=new Map;return this._commands.forEach((e,t)=>s.set(t,e)),s}appendMenuItem(s,e){return this.appendMenuItems(re.single({id:s,item:e}))}appendMenuItems(s){let e=new Set,t=new Ht;for(let{id:i,item:n}of s){let r=this._menuItems.get(i);r||(r=new Ht,this._menuItems.set(i,r)),t.push(r.push(n)),e.add(i)}return this._onDidChangeMenu.fire(e),oe(()=>{if(t.size>0){for(let i of t)i();this._onDidChangeMenu.fire(e),t.clear()}})}getMenuItems(s){let e;return this._menuItems.has(s)?e=[...this._menuItems.get(s)]:e=[],s===Ie.CommandPalette&&this._appendImplicitItems(e),e}_appendImplicitItems(s){let e=new Set;for(let t of s)$l(t)&&(e.add(t.command.id),t.alt&&e.add(t.alt.id));this._commands.forEach((t,i)=>{e.has(i)||s.push({command:t})})}},Fb=class extends Ah{constructor(e,t,i,n){super(`submenuitem.${e.submenu.id}`,typeof e.title=="string"?e.title:e.title.value,[],"submenu");this.item=e,this._menuService=t,this._contextKeyService=i,this._options=n}get actions(){let e=[],t=this._menuService.createMenu(this.item.submenu,this._contextKeyService),i=t.getActions(this._options);t.dispose();for(let[,n]of i)n.length>0&&(e.push(...n),e.push(new On));return e.length&&e.pop(),e}},cm=class fL{constructor(e,t,i,n,r){var o;if(this._commandService=r,this.id=e.id,this.label=(i==null?void 0:i.renderShortTitle)&&e.shortTitle?typeof e.shortTitle=="string"?e.shortTitle:e.shortTitle.value:typeof e.title=="string"?e.title:e.title.value,this.tooltip=(o=e.tooltip)!==null&&o!==void 0?o:"",this.enabled=!e.precondition||n.contextMatchesRules(e.precondition),this.checked=!1,e.toggled){let a=e.toggled.condition?e.toggled:{condition:e.toggled};this.checked=n.contextMatchesRules(a.condition),this.checked&&a.tooltip&&(this.tooltip=typeof a.tooltip=="string"?a.tooltip:a.tooltip.value),a.title&&(this.label=typeof a.title=="string"?a.title:a.title.value)}this.item=e,this.alt=t?new fL(t,void 0,i,n,r):void 0,this._options=i,ui.isThemeIcon(e.icon)&&(this.class=Kt.asClassName(e.icon))}dispose(){}run(...e){var t,i;let n=[];return((t=this._options)===null||t===void 0?void 0:t.arg)&&(n=[...n,this._options.arg]),((i=this._options)===null||i===void 0?void 0:i.shouldForwardArgs)&&(n=[...n,...e]),this._commandService.executeCommand(this.id,...n)}};cm=DR([uL(3,fe),uL(4,It)],cm);var Hh=class{constructor(){this._coreKeybindings=[],this._extensionKeybindings=[],this._cachedMergedKeybindings=null}static bindToCurrentPlatform(e){if(Ii===1){if(e&&e.win)return e.win}else if(Ii===2){if(e&&e.mac)return e.mac}else if(e&&e.linux)return e.linux;return e}registerKeybindingRule(e){let t=Hh.bindToCurrentPlatform(e);if(t&&t.primary){let i=Lh(t.primary,Ii);i&&this._registerDefaultKeybinding(i,e.id,e.args,e.weight,0,e.when)}if(t&&Array.isArray(t.secondary))for(let i=0,n=t.secondary.length;i=21&&e<=30||e>=31&&e<=56?!0:e===80||e===81||e===82||e===83||e===84||e===85||e===86||e===110||e===111||e===87||e===88||e===89||e===90||e===91||e===92}_assertNoCtrlAlt(e,t){e.ctrlKey&&e.altKey&&!e.metaKey&&Hh._mightProduceChar(e.keyCode)&&console.warn("Ctrl+Alt+ keybindings should not be used by default under Windows. Offender: ",e," for ",t)}_registerDefaultKeybinding(e,t,i,n,r,o){Ii===1&&this._assertNoCtrlAlt(e.parts[0],t),this._coreKeybindings.push({keybinding:e,command:t,commandArgs:i,when:o,weight1:n,weight2:r,extensionId:null,isBuiltinExtension:!1}),this._cachedMergedKeybindings=null}getDefaultKeybindings(){return this._cachedMergedKeybindings||(this._cachedMergedKeybindings=[].concat(this._coreKeybindings).concat(this._extensionKeybindings),this._cachedMergedKeybindings.sort(kR)),this._cachedMergedKeybindings.slice(0)}},pa=new Hh,ER={EditorModes:"platform.keybindingsRegistry"};Te.add(ER.EditorModes,pa);function kR(s,e){return s.weight1!==e.weight1?s.weight1-e.weight1:s.commande.command?1:s.weight2-e.weight2}var _a=$("telemetryService");var Hs=$("logService"),Cn;(function(s){s[s.Trace=0]="Trace",s[s.Debug=1]="Debug",s[s.Info=2]="Info",s[s.Warning=3]="Warning",s[s.Error=4]="Error",s[s.Critical=5]="Critical",s[s.Off=6]="Off"})(Cn||(Cn={}));var mL=Cn.Info,gL=class extends M{constructor(){super(...arguments);this.level=mL,this._onDidChangeLogLevel=this._register(new k)}setLevel(e){this.level!==e&&(this.level=e,this._onDidChangeLogLevel.fire(this.level))}getLevel(){return this.level}},Bb=class extends gL{constructor(e=mL){super();this.setLevel(e)}trace(e,...t){this.getLevel()<=Cn.Trace&&console.log("%cTRACE","color: #888",e,...t)}debug(e,...t){this.getLevel()<=Cn.Debug&&console.log("%cDEBUG","background: #eee; color: #888",e,...t)}info(e,...t){this.getLevel()<=Cn.Info&&console.log("%c INFO","color: #33f",e,...t)}error(e,...t){this.getLevel()<=Cn.Error&&console.log("%c ERR","color: #f33",e,...t)}dispose(){}},Wb=class extends M{constructor(e){super();this.logger=e,this._register(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)}error(e,...t){this.logger.error(e,...t)}};var Kl=class{constructor(e){this.id=e.id,this.precondition=e.precondition,this._kbOpts=e.kbOpts,this._menuOpts=e.menuOpts,this._description=e.description}register(){if(Array.isArray(this._menuOpts)?this._menuOpts.forEach(this._registerMenuItem,this):this._menuOpts&&this._registerMenuItem(this._menuOpts),this._kbOpts){let e=Array.isArray(this._kbOpts)?this._kbOpts:[this._kbOpts];for(let t of e){let i=t.kbExpr;this.precondition&&(i?i=dt.and(i,this.precondition):i=this.precondition);let 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};pa.registerKeybindingRule(n)}}Qe.registerCommand({id:this.id,handler:(e,t)=>this.runCommand(e,t),description:this._description})}_registerMenuItem(e){Gr.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})}},hm=class extends Kl{constructor(){super(...arguments);this._implementations=[]}addImplementation(e,t,i){return this._implementations.push({priority:e,name:t,implementation:i}),this._implementations.sort((n,r)=>r.priority-n.priority),{dispose:()=>{for(let n=0;n{if(!!r.get(fe).contextMatchesRules(Vs(this.precondition)))return this.runEditorCommand(r,n,t)})}},ba=class extends Us{constructor(e){super(ba.convertOptions(e));this.label=e.label,this.alias=e.alias}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=Ie.EditorContext),n.title||(n.title=e.label),n.when=dt.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}runEditorCommand(e,t,i){return this.reportTelemetry(e,t),this.run(e,t,i||{})}reportTelemetry(e,t){e.get(_a).publicLog2("editorActionInvoked",{name:this.label,id:this.id})}},IR=class extends ba{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;inew Promise((l,c)=>{try{let h=e(a.object.textEditorModel,N.lift(r),i.slice(2));l(h)}catch(h){c(h)}}).finally(()=>{a.dispose()}))})}function PW(s,e){Qe.registerCommand(s,function(t,...i){let[n]=i;ci(K.isUri(n));let r=t.get(ht).getModel(n);return r?e(r,...i.slice(1)):t.get(Ol).createModelReference(n).then(o=>new Promise((a,l)=>{try{let c=e(o.object.textEditorModel,i.slice(1));a(c)}catch(c){l(c)}}).finally(()=>{o.dispose()}))})}function J(s){return zi.INSTANCE.registerEditorCommand(s),s}function jb(s){let e=new s;return zi.INSTANCE.registerEditorAction(e),e}function FW(s){return zi.INSTANCE.registerEditorAction(s),s}function BW(s){zi.INSTANCE.registerEditorAction(s)}function dm(s,e){zi.INSTANCE.registerEditorContribution(s,e)}var Yr;(function(s){function e(o){return zi.INSTANCE.getEditorCommand(o)}s.getEditorCommand=e;function t(){return zi.INSTANCE.getEditorActions()}s.getEditorActions=t;function i(){return zi.INSTANCE.getEditorContributions()}s.getEditorContributions=i;function n(o){return zi.INSTANCE.getEditorContributions().filter(a=>o.indexOf(a.id)>=0)}s.getSomeEditorContributions=n;function r(){return zi.INSTANCE.getDiffEditorContributions()}s.getDiffEditorContributions=r})(Yr||(Yr={}));var NR={EditorCommonContributions:"editor.contributions"},zi=class{constructor(){this.editorContributions=[],this.diffEditorContributions=[],this.editorActions=[],this.editorCommands=Object.create(null)}registerEditorContribution(e,t){this.editorContributions.push({id:e,ctor:t})}getEditorContributions(){return this.editorContributions.slice(0)}getDiffEditorContributions(){return this.diffEditorContributions.slice(0)}registerEditorAction(e){e.register(),this.editorActions.push(e)}getEditorActions(){return this.editorActions.slice(0)}registerEditorCommand(e){e.register(),this.editorCommands[e.id]=e}getEditorCommand(e){return this.editorCommands[e]||null}};zi.INSTANCE=new zi;Te.add(NR.EditorCommonContributions,zi.INSTANCE);function Uh(s){return s.register(),s}var zb=Uh(new hm({id:"undo",precondition:void 0,kbOpts:{weight:0,primary:2048|56},menuOpts:[{menuId:Ie.MenubarEditMenu,group:"1_do",title:p({key:"miUndo",comment:["&& denotes a mnemonic"]},"&&Undo"),order:1},{menuId:Ie.CommandPalette,group:"",title:p("undo","Undo"),order:1}]}));Uh(new Vb(zb,{id:"default:undo",precondition:void 0}));var Hb=Uh(new hm({id:"redo",precondition:void 0,kbOpts:{weight:0,primary:2048|55,secondary:[2048|1024|56],mac:{primary:2048|1024|56}},menuOpts:[{menuId:Ie.MenubarEditMenu,group:"1_do",title:p({key:"miRedo",comment:["&& denotes a mnemonic"]},"&&Redo"),order:2},{menuId:Ie.CommandPalette,group:"",title:p("redo","Redo"),order:1}]}));Uh(new Vb(Hb,{id:"default:redo",precondition:void 0}));var pL=Uh(new hm({id:"editor.action.selectAll",precondition:void 0,kbOpts:{weight:0,kbExpr:null,primary:2048|31},menuOpts:[{menuId:Ie.MenubarSelectionMenu,group:"1_basic",title:p({key:"miSelectAll",comment:["&& denotes a mnemonic"]},"&&Select All"),order:1},{menuId:Ie.CommandPalette,group:"",title:p("selectAll","Select All"),order:1}]}));var D=class{constructor(e,t,i,n){e>i||e===i&&t>n?(this.startLineNumber=i,this.startColumn=n,this.endLineNumber=e,this.endColumn=t):(this.startLineNumber=e,this.startColumn=t,this.endLineNumber=i,this.endColumn=n)}isEmpty(){return D.isEmpty(this)}static isEmpty(e){return e.startLineNumber===e.endLineNumber&&e.startColumn===e.endColumn}containsPosition(e){return D.containsPosition(this,e)}static containsPosition(e,t){return!(t.lineNumbere.endLineNumber||t.lineNumber===e.startLineNumber&&t.columne.endColumn)}containsRange(e){return D.containsRange(this,e)}static containsRange(e,t){return!(t.startLineNumbere.endLineNumber||t.endLineNumber>e.endLineNumber||t.startLineNumber===e.startLineNumber&&t.startColumne.endColumn)}strictContainsRange(e){return D.strictContainsRange(this,e)}static strictContainsRange(e,t){return!(t.startLineNumbere.endLineNumber||t.endLineNumber>e.endLineNumber||t.startLineNumber===e.startLineNumber&&t.startColumn<=e.startColumn||t.endLineNumber===e.endLineNumber&&t.endColumn>=e.endColumn)}plusRange(e){return D.plusRange(this,e)}static plusRange(e,t){let i,n,r,o;return t.startLineNumbere.endLineNumber?(r=t.endLineNumber,o=t.endColumn):t.endLineNumber===e.endLineNumber?(r=t.endLineNumber,o=Math.max(t.endColumn,e.endColumn)):(r=e.endLineNumber,o=e.endColumn),new D(i,n,r,o)}intersectRanges(e){return D.intersectRanges(this,e)}static intersectRanges(e,t){let i=e.startLineNumber,n=e.startColumn,r=e.endLineNumber,o=e.endColumn,a=t.startLineNumber,l=t.startColumn,c=t.endLineNumber,h=t.endColumn;return ic?(r=c,o=h):r===c&&(o=Math.min(o,h)),i>r||i===r&&n>o?null:new D(i,n,r,o)}equalsRange(e){return D.equalsRange(this,e)}static equalsRange(e,t){return!!e&&!!t&&e.startLineNumber===t.startLineNumber&&e.startColumn===t.startColumn&&e.endLineNumber===t.endLineNumber&&e.endColumn===t.endColumn}getEndPosition(){return D.getEndPosition(this)}static getEndPosition(e){return new N(e.endLineNumber,e.endColumn)}getStartPosition(){return D.getStartPosition(this)}static getStartPosition(e){return new N(e.startLineNumber,e.startColumn)}toString(){return"["+this.startLineNumber+","+this.startColumn+" -> "+this.endLineNumber+","+this.endColumn+"]"}setEndPosition(e,t){return new D(this.startLineNumber,this.startColumn,e,t)}setStartPosition(e,t){return new D(e,t,this.endLineNumber,this.endColumn)}collapseToStart(){return D.collapseToStart(this)}static collapseToStart(e){return new D(e.startLineNumber,e.startColumn,e.startLineNumber,e.startColumn)}static fromPositions(e,t=e){return new D(e.lineNumber,e.column,t.lineNumber,t.column)}static lift(e){return e?new D(e.startLineNumber,e.startColumn,e.endLineNumber,e.endColumn):null}static isIRange(e){return e&&typeof e.startLineNumber=="number"&&typeof e.startColumn=="number"&&typeof e.endLineNumber=="number"&&typeof e.endColumn=="number"}static areIntersectingOrTouching(e,t){return!(e.endLineNumbere.startLineNumber}};var Z=class extends D{constructor(e,t,i,n){super(e,t,i,n);this.selectionStartLineNumber=e,this.selectionStartColumn=t,this.positionLineNumber=i,this.positionColumn=n}toString(){return"["+this.selectionStartLineNumber+","+this.selectionStartColumn+" -> "+this.positionLineNumber+","+this.positionColumn+"]"}equalsSelection(e){return Z.selectionsEqual(this,e)}static selectionsEqual(e,t){return e.selectionStartLineNumber===t.selectionStartLineNumber&&e.selectionStartColumn===t.selectionStartColumn&&e.positionLineNumber===t.positionLineNumber&&e.positionColumn===t.positionColumn}getDirection(){return this.selectionStartLineNumber===this.startLineNumber&&this.selectionStartColumn===this.startColumn?0:1}setEndPosition(e,t){return this.getDirection()===0?new Z(this.startLineNumber,this.startColumn,e,t):new Z(e,t,this.startLineNumber,this.startColumn)}getPosition(){return new N(this.positionLineNumber,this.positionColumn)}setStartPosition(e,t){return this.getDirection()===0?new Z(e,t,this.endLineNumber,this.endColumn):new Z(this.endLineNumber,this.endColumn,e,t)}static fromPositions(e,t=e){return new Z(e.lineNumber,e.column,t.lineNumber,t.column)}static liftSelection(e){return new Z(e.selectionStartLineNumber,e.selectionStartColumn,e.positionLineNumber,e.positionColumn)}static selectionsArrEqual(e,t){if(e&&!t||!e&&t)return!1;if(!e&&!t)return!0;if(e.length!==t.length)return!1;for(let i=0,n=e.length;i/?";function TR(s=""){let e="(-?\\d*\\.\\d\\w*)|([^";for(let t of Ub)s.indexOf(t)>=0||(e+="\\"+t);return e+="\\s]+)",new RegExp(e,"g")}var $b=TR();function $h(s){let e=$b;if(s&&s instanceof RegExp)if(s.global)e=s;else{let t="g";s.ignoreCase&&(t+="i"),s.multiline&&(t+="m"),s.unicode&&(t+="u"),e=new RegExp(s.source,t)}return e.lastIndex=0,e}var MR={maxLen:1e3,windowSize:15,timeBudget:150};function ql(s,e,t,i,n=MR){if(t.length>n.maxLen){let c=s-n.maxLen/2;return c<0?c=0:i+=c,t=t.substring(c,s+n.maxLen/2),ql(s,e,t,i,n)}let r=Date.now(),o=s-1-i,a=-1,l=null;for(let c=1;!(Date.now()-r>=n.timeBudget);c++){let h=o-n.windowSize*c;e.lastIndex=Math.max(0,h);let d=RR(e,t,o,a);if(!d&&l||(l=d,h<=0))break;a=h}if(l){let c={word:l[0],startColumn:i+1+l.index,endColumn:i+1+l.index+l[0].length};return e.lastIndex=0,c}return null}function RR(s,e,t,i){let n;for(;n=s.exec(e);){let r=n.index||0;if(r<=t&&s.lastIndex>=t)return n;if(i>0&&r>i)return null}return null}var Gl=8,Kh=class{constructor(e){this._values=e}hasChanged(e){return this._values[e]}},Kb=class{constructor(){this._values=[]}_read(e){return this._values[e]}get(e){return this._values[e]}_write(e,t){this._values[e]=t}},um=class{constructor(){this.stableMinimapLayoutInput=null,this.stableFitMaxMinimapScale=0,this.stableFitRemainingWidth=0}},Rt=class{constructor(e,t,i,n){this.id=e,this.name=t,this.defaultValue=i,this.schema=n}compute(e,t,i){return i}},wa=class{constructor(e,t=null){this.schema=void 0,this.id=e,this.name="_never_",this.defaultValue=void 0,this.deps=t}validate(e){return this.defaultValue}},Zr=class{constructor(e,t,i,n){this.id=e,this.name=t,this.defaultValue=i,this.schema=n}validate(e){return typeof e=="undefined"?this.defaultValue:e}compute(e,t,i){return i}};function q(s,e){return typeof s=="undefined"?e:s==="false"?!1:Boolean(s)}var ae=class extends Zr{constructor(e,t,i,n=void 0){typeof n!="undefined"&&(n.type="boolean",n.default=i);super(e,t,i,n)}validate(e){return q(e,this.defaultValue)}},Oe=class extends Zr{constructor(e,t,i,n,r,o=void 0){typeof o!="undefined"&&(o.type="integer",o.default=i,o.minimum=n,o.maximum=r);super(e,t,i,o);this.minimum=n,this.maximum=r}static clampedInt(e,t,i,n){if(typeof e=="undefined")return t;let r=parseInt(e,10);return isNaN(r)?t:(r=Math.max(i,r),r=Math.min(n,r),r|0)}validate(e){return Oe.clampedInt(e,this.defaultValue,this.minimum,this.maximum)}},Fn=class extends Zr{constructor(e,t,i,n,r){typeof r!="undefined"&&(r.type="number",r.default=i);super(e,t,i,r);this.validationFn=n}static clamp(e,t,i){return ei?i:e}static float(e,t){if(typeof e=="number")return e;if(typeof e=="undefined")return t;let i=parseFloat(e);return isNaN(i)?t:i}validate(e){return this.validationFn(Fn.float(e,this.defaultValue))}},wi=class extends Zr{static string(e,t){return typeof e!="string"?t:e}constructor(e,t,i,n=void 0){typeof n!="undefined"&&(n.type="string",n.default=i);super(e,t,i,n)}validate(e){return wi.string(e,this.defaultValue)}};function fi(s,e,t){return typeof s!="string"||t.indexOf(s)===-1?e:s}var ut=class extends Zr{constructor(e,t,i,n,r=void 0){typeof r!="undefined"&&(r.type="string",r.enum=n,r.default=i);super(e,t,i,r);this._allowedValues=n}validate(e){return fi(e,this.defaultValue,this._allowedValues)}},Yl=class extends Rt{constructor(e,t,i,n,r,o,a=void 0){typeof a!="undefined"&&(a.type="string",a.enum=r,a.default=n);super(e,t,i,a);this._allowedValues=r,this._convert=o}validate(e){return typeof e!="string"?this.defaultValue:this._allowedValues.indexOf(e)===-1?this.defaultValue:this._convert(e)}};function AR(s){switch(s){case"none":return 0;case"keep":return 1;case"brackets":return 2;case"advanced":return 3;case"full":return 4}}var _L=class extends Rt{constructor(){super(2,"accessibilitySupport",0,{type:"string",enum:["auto","on","off"],enumDescriptions:[p("accessibilitySupport.auto","The editor will use platform APIs to detect when a Screen Reader is attached."),p("accessibilitySupport.on","The editor will be permanently optimized for usage with a Screen Reader. Word wrapping will be disabled."),p("accessibilitySupport.off","The editor will never be optimized for usage with a Screen Reader.")],default:"auto",description:p("accessibilitySupport","Controls whether the editor should run in a mode where it is optimized for screen readers. Setting to on will disable word wrapping.")})}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}},bL=class extends Rt{constructor(){let e={insertSpace:!0,ignoreEmptyLines:!0};super(17,"comments",e,{"editor.comments.insertSpace":{type:"boolean",default:e.insertSpace,description:p("comments.insertSpace","Controls whether a space character is inserted when commenting.")},"editor.comments.ignoreEmptyLines":{type:"boolean",default:e.ignoreEmptyLines,description:p("comments.ignoreEmptyLines","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;let t=e;return{insertSpace:q(t.insertSpace,this.defaultValue.insertSpace),ignoreEmptyLines:q(t.ignoreEmptyLines,this.defaultValue.ignoreEmptyLines)}}};function OR(s){switch(s){case"blink":return 1;case"smooth":return 2;case"phase":return 3;case"expand":return 4;case"solid":return 5}}var Ct;(function(s){s[s.Line=1]="Line",s[s.Block=2]="Block",s[s.Underline=3]="Underline",s[s.LineThin=4]="LineThin",s[s.BlockOutline=5]="BlockOutline",s[s.UnderlineThin=6]="UnderlineThin"})(Ct||(Ct={}));function PR(s){switch(s){case"line":return Ct.Line;case"block":return Ct.Block;case"underline":return Ct.Underline;case"line-thin":return Ct.LineThin;case"block-outline":return Ct.BlockOutline;case"underline-thin":return Ct.UnderlineThin}}var wL=class extends wa{constructor(){super(126,[64,31])}compute(e,t,i){let n=["monaco-editor"];return t.get(31)&&n.push(t.get(31)),e.extraEditorClassName&&n.push(e.extraEditorClassName),t.get(64)==="default"?n.push("mouse-default"):t.get(64)==="copy"&&n.push("mouse-copy"),t.get(99)&&n.push("showUnused"),t.get(124)&&n.push("showDeprecated"),n.join(" ")}},vL=class extends ae{constructor(){super(30,"emptySelectionClipboard",!0,{description:p("emptySelectionClipboard","Controls whether copying without a selection copies the current line.")})}compute(e,t,i){return i&&e.emptySelectionClipboard}},CL=class extends Rt{constructor(){let e={cursorMoveOnType:!0,seedSearchStringFromSelection:"always",autoFindInSelection:"never",globalFindClipboard:!1,addExtraSpaceOnTop:!0,loop:!0};super(33,"find",e,{"editor.find.cursorMoveOnType":{type:"boolean",default:e.cursorMoveOnType,description:p("find.cursorMoveOnType","Controls whether the cursor should jump to find matches while typing.")},"editor.find.seedSearchStringFromSelection":{type:"string",enum:["never","always","selection"],default:e.seedSearchStringFromSelection,enumDescriptions:[p("editor.find.seedSearchStringFromSelection.never","Never seed search string from the editor selection."),p("editor.find.seedSearchStringFromSelection.always","Always seed search string from the editor selection, including word at cursor position."),p("editor.find.seedSearchStringFromSelection.selection","Only seed search string from the editor selection.")],description:p("find.seedSearchStringFromSelection","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:[p("editor.find.autoFindInSelection.never","Never turn on Find in Selection automatically (default)."),p("editor.find.autoFindInSelection.always","Always turn on Find in Selection automatically."),p("editor.find.autoFindInSelection.multiline","Turn on Find in Selection automatically when multiple lines of content are selected.")],description:p("find.autoFindInSelection","Controls the condition for turning on Find in Selection automatically.")},"editor.find.globalFindClipboard":{type:"boolean",default:e.globalFindClipboard,description:p("find.globalFindClipboard","Controls whether the Find Widget should read or modify the shared find clipboard on macOS."),included:ee},"editor.find.addExtraSpaceOnTop":{type:"boolean",default:e.addExtraSpaceOnTop,description:p("find.addExtraSpaceOnTop","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:p("find.loop","Controls whether the search automatically restarts from the beginning (or the end) when no further matches can be found.")}})}validate(e){if(!e||typeof e!="object")return this.defaultValue;let t=e;return{cursorMoveOnType:q(t.cursorMoveOnType,this.defaultValue.cursorMoveOnType),seedSearchStringFromSelection:typeof e.seedSearchStringFromSelection=="boolean"?e.seedSearchStringFromSelection?"always":"never":fi(t.seedSearchStringFromSelection,this.defaultValue.seedSearchStringFromSelection,["never","always","selection"]),autoFindInSelection:typeof e.autoFindInSelection=="boolean"?e.autoFindInSelection?"always":"never":fi(t.autoFindInSelection,this.defaultValue.autoFindInSelection,["never","always","multiline"]),globalFindClipboard:q(t.globalFindClipboard,this.defaultValue.globalFindClipboard),addExtraSpaceOnTop:q(t.addExtraSpaceOnTop,this.defaultValue.addExtraSpaceOnTop),loop:q(t.loop,this.defaultValue.loop)}}},ii=class extends Rt{constructor(){super(42,"fontLigatures",ii.OFF,{anyOf:[{type:"boolean",description:p("fontLigatures","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:p("fontFeatureSettings","Explicit 'font-feature-settings' CSS property. A boolean can be passed instead if one only needs to turn on/off ligatures.")}],description:p("fontLigaturesGeneral","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=="undefined"?this.defaultValue:typeof e=="string"?e==="false"?ii.OFF:e==="true"?ii.ON:e:Boolean(e)?ii.ON:ii.OFF}};ii.OFF='"liga" off, "calt" off';ii.ON='"liga" on, "calt" on';var SL=class extends wa{constructor(){super(41)}compute(e,t,i){return e.fontInfo}},yL=class extends Zr{constructor(){super(43,"fontSize",sn.fontSize,{type:"number",minimum:6,maximum:100,default:sn.fontSize,description:p("fontSize","Controls the font size in pixels.")})}validate(e){let t=Fn.float(e,this.defaultValue);return t===0?sn.fontSize:Fn.clamp(t,6,100)}compute(e,t,i){return e.fontInfo.fontSize}},Bn=class extends Rt{constructor(){super(44,"fontWeight",sn.fontWeight,{anyOf:[{type:"number",minimum:Bn.MINIMUM_VALUE,maximum:Bn.MAXIMUM_VALUE,errorMessage:p("fontWeightErrorMessage",'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:Bn.SUGGESTION_VALUES}],default:sn.fontWeight,description:p("fontWeight",'Controls the font weight. Accepts "normal" and "bold" keywords or numbers between 1 and 1000.')})}validate(e){return e==="normal"||e==="bold"?e:String(Oe.clampedInt(e,sn.fontWeight,Bn.MINIMUM_VALUE,Bn.MAXIMUM_VALUE))}};Bn.SUGGESTION_VALUES=["normal","bold","100","200","300","400","500","600","700","800","900"];Bn.MINIMUM_VALUE=1;Bn.MAXIMUM_VALUE=1e3;var LL=class extends Rt{constructor(){let e={multiple:"peek",multipleDefinitions:"peek",multipleTypeDefinitions:"peek",multipleDeclarations:"peek",multipleImplementations:"peek",multipleReferences:"peek",alternativeDefinitionCommand:"editor.action.goToReferences",alternativeTypeDefinitionCommand:"editor.action.goToReferences",alternativeDeclarationCommand:"editor.action.goToReferences",alternativeImplementationCommand:"",alternativeReferenceCommand:""},t={type:"string",enum:["peek","gotoAndPeek","goto"],default:e.multiple,enumDescriptions:[p("editor.gotoLocation.multiple.peek","Show peek view of the results (default)"),p("editor.gotoLocation.multiple.gotoAndPeek","Go to the primary result and show a peek view"),p("editor.gotoLocation.multiple.goto","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(48,"gotoLocation",e,{"editor.gotoLocation.multiple":{deprecationMessage:p("editor.gotoLocation.multiple.deprecated","This setting is deprecated, please use separate settings like 'editor.editor.gotoLocation.multipleDefinitions' or 'editor.editor.gotoLocation.multipleImplementations' instead.")},"editor.gotoLocation.multipleDefinitions":Object.assign({description:p("editor.editor.gotoLocation.multipleDefinitions","Controls the behavior the 'Go to Definition'-command when multiple target locations exist.")},t),"editor.gotoLocation.multipleTypeDefinitions":Object.assign({description:p("editor.editor.gotoLocation.multipleTypeDefinitions","Controls the behavior the 'Go to Type Definition'-command when multiple target locations exist.")},t),"editor.gotoLocation.multipleDeclarations":Object.assign({description:p("editor.editor.gotoLocation.multipleDeclarations","Controls the behavior the 'Go to Declaration'-command when multiple target locations exist.")},t),"editor.gotoLocation.multipleImplementations":Object.assign({description:p("editor.editor.gotoLocation.multipleImplemenattions","Controls the behavior the 'Go to Implementations'-command when multiple target locations exist.")},t),"editor.gotoLocation.multipleReferences":Object.assign({description:p("editor.editor.gotoLocation.multipleReferences","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:p("alternativeDefinitionCommand","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:p("alternativeTypeDefinitionCommand","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:p("alternativeDeclarationCommand","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:p("alternativeImplementationCommand","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:p("alternativeReferenceCommand","Alternative command id that is being executed when the result of 'Go to Reference' is the current location.")}})}validate(e){var t,i,n,r,o;if(!e||typeof e!="object")return this.defaultValue;let a=e;return{multiple:fi(a.multiple,this.defaultValue.multiple,["peek","gotoAndPeek","goto"]),multipleDefinitions:(t=a.multipleDefinitions)!==null&&t!==void 0?t:fi(a.multipleDefinitions,"peek",["peek","gotoAndPeek","goto"]),multipleTypeDefinitions:(i=a.multipleTypeDefinitions)!==null&&i!==void 0?i:fi(a.multipleTypeDefinitions,"peek",["peek","gotoAndPeek","goto"]),multipleDeclarations:(n=a.multipleDeclarations)!==null&&n!==void 0?n:fi(a.multipleDeclarations,"peek",["peek","gotoAndPeek","goto"]),multipleImplementations:(r=a.multipleImplementations)!==null&&r!==void 0?r:fi(a.multipleImplementations,"peek",["peek","gotoAndPeek","goto"]),multipleReferences:(o=a.multipleReferences)!==null&&o!==void 0?o:fi(a.multipleReferences,"peek",["peek","gotoAndPeek","goto"]),alternativeDefinitionCommand:wi.string(a.alternativeDefinitionCommand,this.defaultValue.alternativeDefinitionCommand),alternativeTypeDefinitionCommand:wi.string(a.alternativeTypeDefinitionCommand,this.defaultValue.alternativeTypeDefinitionCommand),alternativeDeclarationCommand:wi.string(a.alternativeDeclarationCommand,this.defaultValue.alternativeDeclarationCommand),alternativeImplementationCommand:wi.string(a.alternativeImplementationCommand,this.defaultValue.alternativeImplementationCommand),alternativeReferenceCommand:wi.string(a.alternativeReferenceCommand,this.defaultValue.alternativeReferenceCommand)}}},xL=class extends Rt{constructor(){let e={enabled:!0,delay:300,sticky:!0};super(51,"hover",e,{"editor.hover.enabled":{type:"boolean",default:e.enabled,description:p("hover.enabled","Controls whether the hover is shown.")},"editor.hover.delay":{type:"number",default:e.delay,description:p("hover.delay","Controls the delay in milliseconds after which the hover is shown.")},"editor.hover.sticky":{type:"boolean",default:e.sticky,description:p("hover.sticky","Controls whether the hover should remain visible when mouse is moved over it.")}})}validate(e){if(!e||typeof e!="object")return this.defaultValue;let t=e;return{enabled:q(t.enabled,this.defaultValue.enabled),delay:Oe.clampedInt(t.delay,this.defaultValue.delay,0,1e4),sticky:q(t.sticky,this.defaultValue.sticky)}}},Xr=class extends wa{constructor(){super(129,[47,56,35,63,91,58,59,93,116,119,120,121,2])}compute(e,t,i){return Xr.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})}static computeContainedMinimapLineCount(e){let t=e.height/e.lineHeight,i=e.scrollBeyondLastLine?t-1:0,n=(e.viewLineCount+i)/(e.pixelRatio*e.height),r=Math.floor(e.viewLineCount/n);return{typicalViewportLineCount:t,extraLinesBeyondLastLine:i,desiredRatio:n,minimapLineCount:r}}static _computeMinimapLayout(e,t){let i=e.outerWidth,n=e.outerHeight,r=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(r*n),minimapCanvasOuterWidth:0,minimapCanvasOuterHeight:n};let o=t.stableMinimapLayoutInput,a=o&&e.outerHeight===o.outerHeight&&e.lineHeight===o.lineHeight&&e.typicalHalfwidthCharacterWidth===o.typicalHalfwidthCharacterWidth&&e.pixelRatio===o.pixelRatio&&e.scrollBeyondLastLine===o.scrollBeyondLastLine&&e.minimap.enabled===o.minimap.enabled&&e.minimap.side===o.minimap.side&&e.minimap.size===o.minimap.size&&e.minimap.showSlider===o.minimap.showSlider&&e.minimap.renderCharacters===o.minimap.renderCharacters&&e.minimap.maxColumn===o.minimap.maxColumn&&e.minimap.scale===o.minimap.scale&&e.verticalScrollbarWidth===o.verticalScrollbarWidth&&e.isViewportWrapping===o.isViewportWrapping,l=e.lineHeight,c=e.typicalHalfwidthCharacterWidth,h=e.scrollBeyondLastLine,d=e.minimap.renderCharacters,u=r>=2?Math.round(e.minimap.scale*2):e.minimap.scale,f=e.minimap.maxColumn,m=e.minimap.size,g=e.minimap.side,b=e.verticalScrollbarWidth,w=e.viewLineCount,_=e.remainingWidth,v=e.isViewportWrapping,C=d?2:3,y=Math.floor(r*n),x=y/r,S=!1,L=!1,E=C*u,T=u/r,I=1;if(m==="fill"||m==="fit"){let{typicalViewportLineCount:ce,extraLinesBeyondLastLine:ye,desiredRatio:Ve,minimapLineCount:Ji}=Xr.computeContainedMinimapLineCount({viewLineCount:w,scrollBeyondLastLine:h,height:n,lineHeight:l,pixelRatio:r});if(w/Ji>1)S=!0,L=!0,u=1,E=1,T=u/r;else{let gn=!1,ai=u+1;if(m==="fit"){let Bs=Math.ceil((w+ye)*E);v&&a&&_<=t.stableFitRemainingWidth?(gn=!0,ai=t.stableFitMaxMinimapScale):gn=Bs>y}if(m==="fill"||gn){S=!0;let Bs=u;E=Math.min(l*r,Math.max(1,Math.floor(1/Ve))),v&&a&&_<=t.stableFitRemainingWidth&&(ai=t.stableFitMaxMinimapScale),u=Math.min(ai,Math.max(1,Math.floor(E/C))),u>Bs&&(I=Math.min(2,u/Bs)),T=u/r/I,y=Math.ceil(Math.max(ce,w+ye)*E),v?(t.stableMinimapLayoutInput=e,t.stableFitRemainingWidth=_,t.stableFitMaxMinimapScale=u):(t.stableMinimapLayoutInput=null,t.stableFitRemainingWidth=0)}}}let P=Math.floor(f*T),B=Math.min(P,Math.max(0,Math.floor((_-b-2)*T/(c+T)))+Gl),Q=Math.floor(r*B),Y=Q/r;Q=Math.floor(Q*I);let se=d?1:2,he=g==="left"?0:i-B-b;return{renderMinimap:se,minimapLeft:he,minimapWidth:B,minimapHeightIsEditorHeight:S,minimapIsSampling:L,minimapScale:u,minimapLineHeight:E,minimapCanvasInnerWidth:Q,minimapCanvasInnerHeight:y,minimapCanvasOuterWidth:Y,minimapCanvasOuterHeight:x}}static computeLayout(e,t){let i=t.outerWidth|0,n=t.outerHeight|0,r=t.lineHeight|0,o=t.lineNumbersDigitCount|0,a=t.typicalHalfwidthCharacterWidth,l=t.maxDigitWidth,c=t.pixelRatio,h=t.viewLineCount,d=e.get(121),u=d==="inherit"?e.get(120):d,f=u==="inherit"?e.get(116):u,m=e.get(119),g=e.get(2),b=t.isDominatedByLongLines,w=e.get(47),_=e.get(58).renderType!==0,v=e.get(59),C=e.get(93),y=e.get(63),x=e.get(91),S=x.verticalScrollbarSize,L=x.verticalHasArrows,E=x.arrowSize,T=x.horizontalScrollbarSize,I=e.get(56),P=e.get(35),B;if(typeof I=="string"&&/^\d+(\.\d+)?ch$/.test(I)){let q_=parseFloat(I.substr(0,I.length-2));B=Oe.clampedInt(q_*a,0,0,1e3)}else B=Oe.clampedInt(I,0,0,1e3);P&&(B+=16);let Q=0;if(_){let q_=Math.max(o,v);Q=Math.round(q_*l)}let Y=0;w&&(Y=r);let se=0,he=se+Y,ce=he+Q,ye=ce+B,Ve=i-Y-Q-B,Ji=!1,In=!1,gn=-1;g!==2&&(u==="inherit"&&b?(Ji=!0,In=!0):f==="on"||f==="bounded"?In=!0:f==="wordWrapColumn"&&(gn=m));let ai=Xr._computeMinimapLayout({outerWidth:i,outerHeight:n,lineHeight:r,typicalHalfwidthCharacterWidth:a,pixelRatio:c,scrollBeyondLastLine:C,minimap:y,verticalScrollbarWidth:S,viewLineCount:h,remainingWidth:Ve,isViewportWrapping:In},t.memory||new um);ai.renderMinimap!==0&&ai.minimapLeft===0&&(se+=ai.minimapWidth,he+=ai.minimapWidth,ce+=ai.minimapWidth,ye+=ai.minimapWidth);let Bs=Ve-ai.minimapWidth,_f=Math.max(1,Math.floor((Bs-S-2)/a)),O1=L?E:0;return In&&(gn=Math.max(1,_f),f==="bounded"&&(gn=Math.min(gn,m))),{width:i,height:n,glyphMarginLeft:se,glyphMarginWidth:Y,lineNumbersLeft:he,lineNumbersWidth:Q,decorationsLeft:ce,decorationsWidth:B,contentLeft:ye,contentWidth:Bs,minimap:ai,viewportColumn:_f,isWordWrapMinified:Ji,isViewportWrapping:In,wrappingColumn:gn,verticalScrollbarWidth:S,horizontalScrollbarHeight:T,overviewRuler:{top:O1,width:S,height:n-2*O1,right:0}}}},DL=class extends Rt{constructor(){let e={enabled:!0};super(55,"lightbulb",e,{"editor.lightbulb.enabled":{type:"boolean",default:e.enabled,description:p("codeActions","Enables the code action lightbulb in the editor.")}})}validate(e){return!e||typeof e!="object"?this.defaultValue:{enabled:q(e.enabled,this.defaultValue.enabled)}}},EL=class extends Rt{constructor(){let e={enabled:!0,fontSize:0,fontFamily:""};super(125,"inlayHints",e,{"editor.inlayHints.enabled":{type:"boolean",default:e.enabled,description:p("inlayHints.enable","Enables the inlay hints in the editor.")},"editor.inlayHints.fontSize":{type:"number",default:e.fontSize,markdownDescription:p("inlayHints.fontSize","Controls font size of inlay hints in the editor. When set to `0`, the 90% of `#editor.fontSize#` is used.")},"editor.inlayHints.fontFamily":{type:"string",default:e.fontFamily,description:p("inlayHints.fontFamily","Controls font family of inlay hints in the editor. When set to empty, the `#editor.fontFamily#` is used.")}})}validate(e){if(!e||typeof e!="object")return this.defaultValue;let t=e;return{enabled:q(t.enabled,this.defaultValue.enabled),fontSize:Oe.clampedInt(t.fontSize,this.defaultValue.fontSize,0,100),fontFamily:wi.string(t.fontFamily,this.defaultValue.fontFamily)}}},kL=class extends Fn{constructor(){super(57,"lineHeight",sn.lineHeight,e=>Fn.clamp(e,0,150),{markdownDescription:p("lineHeight",`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.`)})}compute(e,t,i){return e.fontInfo.lineHeight}},IL=class extends Rt{constructor(){let e={enabled:!0,size:"proportional",side:"right",showSlider:"mouseover",renderCharacters:!0,maxColumn:120,scale:1};super(63,"minimap",e,{"editor.minimap.enabled":{type:"boolean",default:e.enabled,description:p("minimap.enabled","Controls whether the minimap is shown.")},"editor.minimap.size":{type:"string",enum:["proportional","fill","fit"],enumDescriptions:[p("minimap.size.proportional","The minimap has the same size as the editor contents (and might scroll)."),p("minimap.size.fill","The minimap will stretch or shrink as necessary to fill the height of the editor (no scrolling)."),p("minimap.size.fit","The minimap will shrink as necessary to never be larger than the editor (no scrolling).")],default:e.size,description:p("minimap.size","Controls the size of the minimap.")},"editor.minimap.side":{type:"string",enum:["left","right"],default:e.side,description:p("minimap.side","Controls the side where to render the minimap.")},"editor.minimap.showSlider":{type:"string",enum:["always","mouseover"],default:e.showSlider,description:p("minimap.showSlider","Controls when the minimap slider is shown.")},"editor.minimap.scale":{type:"number",default:e.scale,minimum:1,maximum:3,enum:[1,2,3],description:p("minimap.scale","Scale of content drawn in the minimap: 1, 2 or 3.")},"editor.minimap.renderCharacters":{type:"boolean",default:e.renderCharacters,description:p("minimap.renderCharacters","Render the actual characters on a line as opposed to color blocks.")},"editor.minimap.maxColumn":{type:"number",default:e.maxColumn,description:p("minimap.maxColumn","Limit the width of the minimap to render at most a certain number of columns.")}})}validate(e){if(!e||typeof e!="object")return this.defaultValue;let t=e;return{enabled:q(t.enabled,this.defaultValue.enabled),size:fi(t.size,this.defaultValue.size,["proportional","fill","fit"]),side:fi(t.side,this.defaultValue.side,["right","left"]),showSlider:fi(t.showSlider,this.defaultValue.showSlider,["always","mouseover"]),renderCharacters:q(t.renderCharacters,this.defaultValue.renderCharacters),scale:Oe.clampedInt(t.scale,1,1,3),maxColumn:Oe.clampedInt(t.maxColumn,this.defaultValue.maxColumn,1,1e4)}}};function FR(s){return s==="ctrlCmd"?ee?"metaKey":"ctrlKey":"altKey"}var NL=class extends Rt{constructor(){super(73,"padding",{top:0,bottom:0},{"editor.padding.top":{type:"number",default:0,minimum:0,maximum:1e3,description:p("padding.top","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:p("padding.bottom","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;let t=e;return{top:Oe.clampedInt(t.top,0,0,1e3),bottom:Oe.clampedInt(t.bottom,0,0,1e3)}}},TL=class extends Rt{constructor(){let e={enabled:!0,cycle:!1};super(74,"parameterHints",e,{"editor.parameterHints.enabled":{type:"boolean",default:e.enabled,description:p("parameterHints.enabled","Enables a pop-up that shows parameter documentation and type information as you type.")},"editor.parameterHints.cycle":{type:"boolean",default:e.cycle,description:p("parameterHints.cycle","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;let t=e;return{enabled:q(t.enabled,this.defaultValue.enabled),cycle:q(t.cycle,this.defaultValue.cycle)}}},ML=class extends wa{constructor(){super(127)}compute(e,t,i){return e.pixelRatio}},RL=class extends Rt{constructor(){let e={other:!0,comments:!1,strings:!1};super(77,"quickSuggestions",e,{anyOf:[{type:"boolean"},{type:"object",properties:{strings:{type:"boolean",default:e.strings,description:p("quickSuggestions.strings","Enable quick suggestions inside strings.")},comments:{type:"boolean",default:e.comments,description:p("quickSuggestions.comments","Enable quick suggestions inside comments.")},other:{type:"boolean",default:e.other,description:p("quickSuggestions.other","Enable quick suggestions outside of strings and comments.")}}}],default:e,description:p("quickSuggestions","Controls whether suggestions should automatically show up while typing.")});this.defaultValue=e}validate(e){if(typeof e=="boolean")return e;if(e&&typeof e=="object"){let t=e,i={other:q(t.other,this.defaultValue.other),comments:q(t.comments,this.defaultValue.comments),strings:q(t.strings,this.defaultValue.strings)};return i.other&&i.comments&&i.strings?!0:!i.other&&!i.comments&&!i.strings?!1:i}return this.defaultValue}},AL=class extends Rt{constructor(){super(58,"lineNumbers",{renderType:1,renderFn:null},{type:"string",enum:["off","on","relative","interval"],enumDescriptions:[p("lineNumbers.off","Line numbers are not rendered."),p("lineNumbers.on","Line numbers are rendered as absolute number."),p("lineNumbers.relative","Line numbers are rendered as distance in lines to cursor position."),p("lineNumbers.interval","Line numbers are rendered every 10 lines.")],default:"on",description:p("lineNumbers","Controls the display of line numbers.")})}validate(e){let t=this.defaultValue.renderType,i=this.defaultValue.renderFn;return typeof e!="undefined"&&(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 Zl(s){let e=s.get(86);return e==="editable"?s.get(79):e!=="on"}var OL=class extends Rt{constructor(){let e=[],t={type:"number",description:p("rulers.size","Number of monospace characters at which this editor ruler will render.")};super(90,"rulers",e,{type:"array",items:{anyOf:[t,{type:["object"],properties:{column:t,color:{type:"string",description:p("rulers.color","Color of this editor ruler."),format:"color-hex"}}}]},default:e,description:p("rulers","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)){let t=[];for(let i of e)if(typeof i=="number")t.push({column:Oe.clampedInt(i,0,0,1e4),color:null});else if(i&&typeof i=="object"){let n=i;t.push({column:Oe.clampedInt(n.column,0,0,1e4),color:n.color})}return t.sort((i,n)=>i.column-n.column),t}return this.defaultValue}};function PL(s,e){if(typeof s!="string")return e;switch(s){case"hidden":return 2;case"visible":return 3;default:return 1}}var FL=class extends Rt{constructor(){let 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};super(91,"scrollbar",e,{"editor.scrollbar.vertical":{type:"string",enum:["auto","visible","hidden"],enumDescriptions:[p("scrollbar.vertical.auto","The vertical scrollbar will be visible only when necessary."),p("scrollbar.vertical.visible","The vertical scrollbar will always be visible."),p("scrollbar.vertical.fit","The vertical scrollbar will always be hidden.")],default:"auto",description:p("scrollbar.vertical","Controls the visibility of the vertical scrollbar.")},"editor.scrollbar.horizontal":{type:"string",enum:["auto","visible","hidden"],enumDescriptions:[p("scrollbar.horizontal.auto","The horizontal scrollbar will be visible only when necessary."),p("scrollbar.horizontal.visible","The horizontal scrollbar will always be visible."),p("scrollbar.horizontal.fit","The horizontal scrollbar will always be hidden.")],default:"auto",description:p("scrollbar.horizontal","Controls the visibility of the horizontal scrollbar.")},"editor.scrollbar.verticalScrollbarSize":{type:"number",default:e.verticalScrollbarSize,description:p("scrollbar.verticalScrollbarSize","The width of the vertical scrollbar.")},"editor.scrollbar.horizontalScrollbarSize":{type:"number",default:e.horizontalScrollbarSize,description:p("scrollbar.horizontalScrollbarSize","The height of the horizontal scrollbar.")},"editor.scrollbar.scrollByPage":{type:"boolean",default:e.scrollByPage,description:p("scrollbar.scrollByPage","Controls whether clicks scroll by page or jump to click position.")}})}validate(e){if(!e||typeof e!="object")return this.defaultValue;let t=e,i=Oe.clampedInt(t.horizontalScrollbarSize,this.defaultValue.horizontalScrollbarSize,0,1e3),n=Oe.clampedInt(t.verticalScrollbarSize,this.defaultValue.verticalScrollbarSize,0,1e3);return{arrowSize:Oe.clampedInt(t.arrowSize,this.defaultValue.arrowSize,0,1e3),vertical:PL(t.vertical,this.defaultValue.vertical),horizontal:PL(t.horizontal,this.defaultValue.horizontal),useShadows:q(t.useShadows,this.defaultValue.useShadows),verticalHasArrows:q(t.verticalHasArrows,this.defaultValue.verticalHasArrows),horizontalHasArrows:q(t.horizontalHasArrows,this.defaultValue.horizontalHasArrows),handleMouseWheel:q(t.handleMouseWheel,this.defaultValue.handleMouseWheel),alwaysConsumeMouseWheel:q(t.alwaysConsumeMouseWheel,this.defaultValue.alwaysConsumeMouseWheel),horizontalScrollbarSize:i,horizontalSliderSize:Oe.clampedInt(t.horizontalSliderSize,i,0,1e3),verticalScrollbarSize:n,verticalSliderSize:Oe.clampedInt(t.verticalSliderSize,n,0,1e3),scrollByPage:q(t.scrollByPage,this.defaultValue.scrollByPage)}}},BL=class extends Rt{constructor(){let e={enabled:!1,mode:"subwordSmart"};super(53,"inlineSuggest",e,{"editor.inlineSuggest.enabled":{type:"boolean",default:e.enabled,description:p("inlineSuggest.enabled","Controls whether to automatically show inline suggestions in the editor.")},"editor.inlineSuggest.mode":{type:"string",enum:["prefix","subword","subwordSmart"],enumDescriptions:[p("inlineSuggest.mode.prefix","Only render an inline suggestion if the replace text is a prefix of the insert text."),p("inlineSuggest.mode.subword","Only render an inline suggestion if the replace text is a subword of the insert text."),p("inlineSuggest.mode.subwordSmart","Only render an inline suggestion if the replace text is a subword of the insert text, but the subword must start after the cursor.")],default:e.mode,description:p("inlineSuggest.mode","Controls which mode to use for rendering inline suggestions.")}})}validate(e){if(!e||typeof e!="object")return this.defaultValue;let t=e;return{enabled:q(t.enabled,this.defaultValue.enabled),mode:fi(t.mode,this.defaultValue.mode,["prefix","subword","subwordSmart"])}}},WL=class extends Rt{constructor(){let e={insertMode:"insert",filterGraceful:!0,snippetsPreventQuickSuggestions:!0,localityBonus:!1,shareSuggestSelections:!1,showIcons:!0,showStatusBar:!1,preview:!1,previewMode:"subwordSmart",showInlineDetails:!0,showMethods:!0,showFunctions:!0,showConstructors:!0,showDeprecated:!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(105,"suggest",e,{"editor.suggest.insertMode":{type:"string",enum:["insert","replace"],enumDescriptions:[p("suggest.insertMode.insert","Insert suggestion without overwriting text right of the cursor."),p("suggest.insertMode.replace","Insert suggestion and overwrite text right of the cursor.")],default:e.insertMode,description:p("suggest.insertMode","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:p("suggest.filterGraceful","Controls whether filtering and sorting suggestions accounts for small typos.")},"editor.suggest.localityBonus":{type:"boolean",default:e.localityBonus,description:p("suggest.localityBonus","Controls whether sorting favors words that appear close to the cursor.")},"editor.suggest.shareSuggestSelections":{type:"boolean",default:e.shareSuggestSelections,markdownDescription:p("suggest.shareSuggestSelections","Controls whether remembered suggestion selections are shared between multiple workspaces and windows (needs `#editor.suggestSelection#`).")},"editor.suggest.snippetsPreventQuickSuggestions":{type:"boolean",default:e.snippetsPreventQuickSuggestions,description:p("suggest.snippetsPreventQuickSuggestions","Controls whether an active snippet prevents quick suggestions.")},"editor.suggest.showIcons":{type:"boolean",default:e.showIcons,description:p("suggest.showIcons","Controls whether to show or hide icons in suggestions.")},"editor.suggest.showStatusBar":{type:"boolean",default:e.showStatusBar,description:p("suggest.showStatusBar","Controls the visibility of the status bar at the bottom of the suggest widget.")},"editor.suggest.preview":{type:"boolean",default:e.preview,description:p("suggest.preview","Controls whether to preview the suggestion outcome in the editor.")},"editor.suggest.previewMode":{type:"string",enum:["prefix","subword","subwordSmart"],enumDescriptions:[p("suggest.previewMode.prefix","Only render a preview if the replace text is a prefix of the insert text."),p("suggest.previewMode.subword","Only render a preview if the replace text is a subword of the insert text."),p("suggest.previewMode.subwordSmart","Render a preview if the replace text is a subword of the insert text, or if it is a prefix of the insert text.")],default:e.previewMode,description:p("suggest.previewMode","Controls which mode to use for rendering the suggest preview.")},"editor.suggest.showInlineDetails":{type:"boolean",default:e.showInlineDetails,description:p("suggest.showInlineDetails","Controls whether suggest details show inline with the label or only in the details widget")},"editor.suggest.maxVisibleSuggestions":{type:"number",deprecationMessage:p("suggest.maxVisibleSuggestions.dep","This setting is deprecated. The suggest widget can now be resized.")},"editor.suggest.filteredTypes":{type:"object",deprecationMessage:p("deprecated","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:p("editor.suggest.showMethods","When enabled IntelliSense shows `method`-suggestions.")},"editor.suggest.showFunctions":{type:"boolean",default:!0,markdownDescription:p("editor.suggest.showFunctions","When enabled IntelliSense shows `function`-suggestions.")},"editor.suggest.showConstructors":{type:"boolean",default:!0,markdownDescription:p("editor.suggest.showConstructors","When enabled IntelliSense shows `constructor`-suggestions.")},"editor.suggest.showDeprecated":{type:"boolean",default:!0,markdownDescription:p("editor.suggest.showDeprecated","When enabled IntelliSense shows `deprecated`-suggestions.")},"editor.suggest.showFields":{type:"boolean",default:!0,markdownDescription:p("editor.suggest.showFields","When enabled IntelliSense shows `field`-suggestions.")},"editor.suggest.showVariables":{type:"boolean",default:!0,markdownDescription:p("editor.suggest.showVariables","When enabled IntelliSense shows `variable`-suggestions.")},"editor.suggest.showClasses":{type:"boolean",default:!0,markdownDescription:p("editor.suggest.showClasss","When enabled IntelliSense shows `class`-suggestions.")},"editor.suggest.showStructs":{type:"boolean",default:!0,markdownDescription:p("editor.suggest.showStructs","When enabled IntelliSense shows `struct`-suggestions.")},"editor.suggest.showInterfaces":{type:"boolean",default:!0,markdownDescription:p("editor.suggest.showInterfaces","When enabled IntelliSense shows `interface`-suggestions.")},"editor.suggest.showModules":{type:"boolean",default:!0,markdownDescription:p("editor.suggest.showModules","When enabled IntelliSense shows `module`-suggestions.")},"editor.suggest.showProperties":{type:"boolean",default:!0,markdownDescription:p("editor.suggest.showPropertys","When enabled IntelliSense shows `property`-suggestions.")},"editor.suggest.showEvents":{type:"boolean",default:!0,markdownDescription:p("editor.suggest.showEvents","When enabled IntelliSense shows `event`-suggestions.")},"editor.suggest.showOperators":{type:"boolean",default:!0,markdownDescription:p("editor.suggest.showOperators","When enabled IntelliSense shows `operator`-suggestions.")},"editor.suggest.showUnits":{type:"boolean",default:!0,markdownDescription:p("editor.suggest.showUnits","When enabled IntelliSense shows `unit`-suggestions.")},"editor.suggest.showValues":{type:"boolean",default:!0,markdownDescription:p("editor.suggest.showValues","When enabled IntelliSense shows `value`-suggestions.")},"editor.suggest.showConstants":{type:"boolean",default:!0,markdownDescription:p("editor.suggest.showConstants","When enabled IntelliSense shows `constant`-suggestions.")},"editor.suggest.showEnums":{type:"boolean",default:!0,markdownDescription:p("editor.suggest.showEnums","When enabled IntelliSense shows `enum`-suggestions.")},"editor.suggest.showEnumMembers":{type:"boolean",default:!0,markdownDescription:p("editor.suggest.showEnumMembers","When enabled IntelliSense shows `enumMember`-suggestions.")},"editor.suggest.showKeywords":{type:"boolean",default:!0,markdownDescription:p("editor.suggest.showKeywords","When enabled IntelliSense shows `keyword`-suggestions.")},"editor.suggest.showWords":{type:"boolean",default:!0,markdownDescription:p("editor.suggest.showTexts","When enabled IntelliSense shows `text`-suggestions.")},"editor.suggest.showColors":{type:"boolean",default:!0,markdownDescription:p("editor.suggest.showColors","When enabled IntelliSense shows `color`-suggestions.")},"editor.suggest.showFiles":{type:"boolean",default:!0,markdownDescription:p("editor.suggest.showFiles","When enabled IntelliSense shows `file`-suggestions.")},"editor.suggest.showReferences":{type:"boolean",default:!0,markdownDescription:p("editor.suggest.showReferences","When enabled IntelliSense shows `reference`-suggestions.")},"editor.suggest.showCustomcolors":{type:"boolean",default:!0,markdownDescription:p("editor.suggest.showCustomcolors","When enabled IntelliSense shows `customcolor`-suggestions.")},"editor.suggest.showFolders":{type:"boolean",default:!0,markdownDescription:p("editor.suggest.showFolders","When enabled IntelliSense shows `folder`-suggestions.")},"editor.suggest.showTypeParameters":{type:"boolean",default:!0,markdownDescription:p("editor.suggest.showTypeParameters","When enabled IntelliSense shows `typeParameter`-suggestions.")},"editor.suggest.showSnippets":{type:"boolean",default:!0,markdownDescription:p("editor.suggest.showSnippets","When enabled IntelliSense shows `snippet`-suggestions.")},"editor.suggest.showUsers":{type:"boolean",default:!0,markdownDescription:p("editor.suggest.showUsers","When enabled IntelliSense shows `user`-suggestions.")},"editor.suggest.showIssues":{type:"boolean",default:!0,markdownDescription:p("editor.suggest.showIssues","When enabled IntelliSense shows `issues`-suggestions.")}})}validate(e){if(!e||typeof e!="object")return this.defaultValue;let t=e;return{insertMode:fi(t.insertMode,this.defaultValue.insertMode,["insert","replace"]),filterGraceful:q(t.filterGraceful,this.defaultValue.filterGraceful),snippetsPreventQuickSuggestions:q(t.snippetsPreventQuickSuggestions,this.defaultValue.filterGraceful),localityBonus:q(t.localityBonus,this.defaultValue.localityBonus),shareSuggestSelections:q(t.shareSuggestSelections,this.defaultValue.shareSuggestSelections),showIcons:q(t.showIcons,this.defaultValue.showIcons),showStatusBar:q(t.showStatusBar,this.defaultValue.showStatusBar),preview:q(t.preview,this.defaultValue.preview),previewMode:fi(t.previewMode,this.defaultValue.previewMode,["prefix","subword","subwordSmart"]),showInlineDetails:q(t.showInlineDetails,this.defaultValue.showInlineDetails),showMethods:q(t.showMethods,this.defaultValue.showMethods),showFunctions:q(t.showFunctions,this.defaultValue.showFunctions),showConstructors:q(t.showConstructors,this.defaultValue.showConstructors),showDeprecated:q(t.showDeprecated,this.defaultValue.showDeprecated),showFields:q(t.showFields,this.defaultValue.showFields),showVariables:q(t.showVariables,this.defaultValue.showVariables),showClasses:q(t.showClasses,this.defaultValue.showClasses),showStructs:q(t.showStructs,this.defaultValue.showStructs),showInterfaces:q(t.showInterfaces,this.defaultValue.showInterfaces),showModules:q(t.showModules,this.defaultValue.showModules),showProperties:q(t.showProperties,this.defaultValue.showProperties),showEvents:q(t.showEvents,this.defaultValue.showEvents),showOperators:q(t.showOperators,this.defaultValue.showOperators),showUnits:q(t.showUnits,this.defaultValue.showUnits),showValues:q(t.showValues,this.defaultValue.showValues),showConstants:q(t.showConstants,this.defaultValue.showConstants),showEnums:q(t.showEnums,this.defaultValue.showEnums),showEnumMembers:q(t.showEnumMembers,this.defaultValue.showEnumMembers),showKeywords:q(t.showKeywords,this.defaultValue.showKeywords),showWords:q(t.showWords,this.defaultValue.showWords),showColors:q(t.showColors,this.defaultValue.showColors),showFiles:q(t.showFiles,this.defaultValue.showFiles),showReferences:q(t.showReferences,this.defaultValue.showReferences),showFolders:q(t.showFolders,this.defaultValue.showFolders),showTypeParameters:q(t.showTypeParameters,this.defaultValue.showTypeParameters),showSnippets:q(t.showSnippets,this.defaultValue.showSnippets),showUsers:q(t.showUsers,this.defaultValue.showUsers),showIssues:q(t.showIssues,this.defaultValue.showIssues)}}},VL=class extends Rt{constructor(){super(101,"smartSelect",{selectLeadingAndTrailingWhitespace:!0},{"editor.smartSelect.selectLeadingAndTrailingWhitespace":{description:p("selectLeadingAndTrailingWhitespace","Whether leading and trailing whitespace should always be selected."),default:!0,type:"boolean"}})}validate(e){return!e||typeof e!="object"?this.defaultValue:{selectLeadingAndTrailingWhitespace:q(e.selectLeadingAndTrailingWhitespace,this.defaultValue.selectLeadingAndTrailingWhitespace)}}},jL=class extends wa{constructor(){super(128,[79])}compute(e,t,i){return t.get(79)?!0:e.tabFocusMode}};function BR(s){switch(s){case"none":return 0;case"same":return 1;case"indent":return 2;case"deepIndent":return 3}}var zL=class extends wa{constructor(){super(130,[129])}compute(e,t,i){let n=t.get(129);return{isDominatedByLongLines:e.isDominatedByLongLines,isWordWrapMinified:n.isWordWrapMinified,isViewportWrapping:n.isViewportWrapping,wrappingColumn:n.wrappingColumn}}},WR="Consolas, 'Courier New', monospace",VR="Menlo, Monaco, 'Courier New', monospace",jR="'Droid Sans Mono', 'monospace', monospace, 'Droid Sans Fallback'",sn={fontFamily:ee?VR:_t?jR:WR,fontWeight:"normal",fontSize:ee?12:14,lineHeight:0,letterSpacing:0},ni={tabSize:4,indentSize:4,insertSpaces:!0,detectIndentation:!0,trimAutoWhitespace:!0,largeFileOptimizations:!0},va=[];function F(s){return va[s.id]=s,s}var Wn={acceptSuggestionOnCommitCharacter:F(new ae(0,"acceptSuggestionOnCommitCharacter",!0,{markdownDescription:p("acceptSuggestionOnCommitCharacter","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:F(new ut(1,"acceptSuggestionOnEnter","on",["on","smart","off"],{markdownEnumDescriptions:["",p("acceptSuggestionOnEnterSmart","Only accept a suggestion with `Enter` when it makes a textual change."),""],markdownDescription:p("acceptSuggestionOnEnter","Controls whether suggestions should be accepted on `Enter`, in addition to `Tab`. Helps to avoid ambiguity between inserting new lines or accepting suggestions.")})),accessibilitySupport:F(new _L),accessibilityPageSize:F(new Oe(3,"accessibilityPageSize",10,1,1073741824,{description:p("accessibilityPageSize","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.")})),ariaLabel:F(new wi(4,"ariaLabel",p("editorViewAccessibleLabel","Editor content"))),autoClosingBrackets:F(new ut(5,"autoClosingBrackets","languageDefined",["always","languageDefined","beforeWhitespace","never"],{enumDescriptions:["",p("editor.autoClosingBrackets.languageDefined","Use language configurations to determine when to autoclose brackets."),p("editor.autoClosingBrackets.beforeWhitespace","Autoclose brackets only when the cursor is to the left of whitespace."),""],description:p("autoClosingBrackets","Controls whether the editor should automatically close brackets after the user adds an opening bracket.")})),autoClosingDelete:F(new ut(6,"autoClosingDelete","auto",["always","auto","never"],{enumDescriptions:["",p("editor.autoClosingDelete.auto","Remove adjacent closing quotes or brackets only if they were automatically inserted."),""],description:p("autoClosingDelete","Controls whether the editor should remove adjacent closing quotes or brackets when deleting.")})),autoClosingOvertype:F(new ut(7,"autoClosingOvertype","auto",["always","auto","never"],{enumDescriptions:["",p("editor.autoClosingOvertype.auto","Type over closing quotes or brackets only if they were automatically inserted."),""],description:p("autoClosingOvertype","Controls whether the editor should type over closing quotes or brackets.")})),autoClosingQuotes:F(new ut(8,"autoClosingQuotes","languageDefined",["always","languageDefined","beforeWhitespace","never"],{enumDescriptions:["",p("editor.autoClosingQuotes.languageDefined","Use language configurations to determine when to autoclose quotes."),p("editor.autoClosingQuotes.beforeWhitespace","Autoclose quotes only when the cursor is to the left of whitespace."),""],description:p("autoClosingQuotes","Controls whether the editor should automatically close quotes after the user adds an opening quote.")})),autoIndent:F(new Yl(9,"autoIndent",4,"full",["none","keep","brackets","advanced","full"],AR,{enumDescriptions:[p("editor.autoIndent.none","The editor will not insert indentation automatically."),p("editor.autoIndent.keep","The editor will keep the current line's indentation."),p("editor.autoIndent.brackets","The editor will keep the current line's indentation and honor language defined brackets."),p("editor.autoIndent.advanced","The editor will keep the current line's indentation, honor language defined brackets and invoke special onEnterRules defined by languages."),p("editor.autoIndent.full","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:p("autoIndent","Controls whether the editor should automatically adjust the indentation when users type, paste, move or indent lines.")})),automaticLayout:F(new ae(10,"automaticLayout",!1)),autoSurround:F(new ut(11,"autoSurround","languageDefined",["languageDefined","quotes","brackets","never"],{enumDescriptions:[p("editor.autoSurround.languageDefined","Use language configurations to determine when to automatically surround selections."),p("editor.autoSurround.quotes","Surround with quotes but not brackets."),p("editor.autoSurround.brackets","Surround with brackets but not quotes."),""],description:p("autoSurround","Controls whether the editor should automatically surround selections when typing quotes or brackets.")})),stickyTabStops:F(new ae(103,"stickyTabStops",!1,{description:p("stickyTabStops","Emulate selection behavior of tab characters when using spaces for indentation. Selection will stick to tab stops.")})),codeLens:F(new ae(12,"codeLens",!0,{description:p("codeLens","Controls whether the editor shows CodeLens.")})),codeLensFontFamily:F(new wi(13,"codeLensFontFamily","",{description:p("codeLensFontFamily","Controls the font family for CodeLens.")})),codeLensFontSize:F(new Oe(14,"codeLensFontSize",0,0,100,{type:"number",default:0,minimum:0,maximum:100,markdownDescription:p("codeLensFontSize","Controls the font size in pixels for CodeLens. When set to `0`, the 90% of `#editor.fontSize#` is used.")})),colorDecorators:F(new ae(15,"colorDecorators",!0,{description:p("colorDecorators","Controls whether the editor should render the inline color decorators and color picker.")})),columnSelection:F(new ae(16,"columnSelection",!1,{description:p("columnSelection","Enable that the selection with the mouse and keys is doing column selection.")})),comments:F(new bL),contextmenu:F(new ae(18,"contextmenu",!0)),copyWithSyntaxHighlighting:F(new ae(19,"copyWithSyntaxHighlighting",!0,{description:p("copyWithSyntaxHighlighting","Controls whether syntax highlighting should be copied into the clipboard.")})),cursorBlinking:F(new Yl(20,"cursorBlinking",1,"blink",["blink","smooth","phase","expand","solid"],OR,{description:p("cursorBlinking","Control the cursor animation style.")})),cursorSmoothCaretAnimation:F(new ae(21,"cursorSmoothCaretAnimation",!1,{description:p("cursorSmoothCaretAnimation","Controls whether the smooth caret animation should be enabled.")})),cursorStyle:F(new Yl(22,"cursorStyle",Ct.Line,"line",["line","block","underline","line-thin","block-outline","underline-thin"],PR,{description:p("cursorStyle","Controls the cursor style.")})),cursorSurroundingLines:F(new Oe(23,"cursorSurroundingLines",0,0,1073741824,{description:p("cursorSurroundingLines","Controls the minimal number of visible leading and trailing lines surrounding the cursor. Known as 'scrollOff' or 'scrollOffset' in some other editors.")})),cursorSurroundingLinesStyle:F(new ut(24,"cursorSurroundingLinesStyle","default",["default","all"],{enumDescriptions:[p("cursorSurroundingLinesStyle.default","`cursorSurroundingLines` is enforced only when triggered via the keyboard or API."),p("cursorSurroundingLinesStyle.all","`cursorSurroundingLines` is enforced always.")],description:p("cursorSurroundingLinesStyle","Controls when `cursorSurroundingLines` should be enforced.")})),cursorWidth:F(new Oe(25,"cursorWidth",0,0,1073741824,{markdownDescription:p("cursorWidth","Controls the width of the cursor when `#editor.cursorStyle#` is set to `line`.")})),disableLayerHinting:F(new ae(26,"disableLayerHinting",!1)),disableMonospaceOptimizations:F(new ae(27,"disableMonospaceOptimizations",!1)),domReadOnly:F(new ae(28,"domReadOnly",!1)),dragAndDrop:F(new ae(29,"dragAndDrop",!0,{description:p("dragAndDrop","Controls whether the editor should allow moving selections via drag and drop.")})),emptySelectionClipboard:F(new vL),extraEditorClassName:F(new wi(31,"extraEditorClassName","")),fastScrollSensitivity:F(new Fn(32,"fastScrollSensitivity",5,s=>s<=0?5:s,{markdownDescription:p("fastScrollSensitivity","Scrolling speed multiplier when pressing `Alt`.")})),find:F(new CL),fixedOverflowWidgets:F(new ae(34,"fixedOverflowWidgets",!1)),folding:F(new ae(35,"folding",!0,{description:p("folding","Controls whether the editor has code folding enabled.")})),foldingStrategy:F(new ut(36,"foldingStrategy","auto",["auto","indentation"],{enumDescriptions:[p("foldingStrategy.auto","Use a language-specific folding strategy if available, else the indentation-based one."),p("foldingStrategy.indentation","Use the indentation-based folding strategy.")],description:p("foldingStrategy","Controls the strategy for computing folding ranges.")})),foldingHighlight:F(new ae(37,"foldingHighlight",!0,{description:p("foldingHighlight","Controls whether the editor should highlight folded ranges.")})),foldingImportsByDefault:F(new ae(38,"foldingImportsByDefault",!1,{description:p("foldingImportsByDefault","Controls whether the editor automatically collapses import ranges.")})),unfoldOnClickAfterEndOfLine:F(new ae(39,"unfoldOnClickAfterEndOfLine",!1,{description:p("unfoldOnClickAfterEndOfLine","Controls whether clicking on the empty content after a folded line will unfold the line.")})),fontFamily:F(new wi(40,"fontFamily",sn.fontFamily,{description:p("fontFamily","Controls the font family.")})),fontInfo:F(new SL),fontLigatures2:F(new ii),fontSize:F(new yL),fontWeight:F(new Bn),formatOnPaste:F(new ae(45,"formatOnPaste",!1,{description:p("formatOnPaste","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:F(new ae(46,"formatOnType",!1,{description:p("formatOnType","Controls whether the editor should automatically format the line after typing.")})),glyphMargin:F(new ae(47,"glyphMargin",!0,{description:p("glyphMargin","Controls whether the editor should render the vertical glyph margin. Glyph margin is mostly used for debugging.")})),gotoLocation:F(new LL),hideCursorInOverviewRuler:F(new ae(49,"hideCursorInOverviewRuler",!1,{description:p("hideCursorInOverviewRuler","Controls whether the cursor should be hidden in the overview ruler.")})),highlightActiveIndentGuide:F(new ae(50,"highlightActiveIndentGuide",!0,{description:p("highlightActiveIndentGuide","Controls whether the editor should highlight the active indent guide.")})),hover:F(new xL),inDiffEditor:F(new ae(52,"inDiffEditor",!1)),letterSpacing:F(new Fn(54,"letterSpacing",sn.letterSpacing,s=>Fn.clamp(s,-5,20),{description:p("letterSpacing","Controls the letter spacing in pixels.")})),lightbulb:F(new DL),lineDecorationsWidth:F(new Zr(56,"lineDecorationsWidth",10)),lineHeight:F(new kL),lineNumbers:F(new AL),lineNumbersMinChars:F(new Oe(59,"lineNumbersMinChars",5,1,300)),linkedEditing:F(new ae(60,"linkedEditing",!1,{description:p("linkedEditing","Controls whether the editor has linked editing enabled. Depending on the language, related symbols, e.g. HTML tags, are updated while editing.")})),links:F(new ae(61,"links",!0,{description:p("links","Controls whether the editor should detect links and make them clickable.")})),matchBrackets:F(new ut(62,"matchBrackets","always",["always","near","never"],{description:p("matchBrackets","Highlight matching brackets.")})),minimap:F(new IL),mouseStyle:F(new ut(64,"mouseStyle","text",["text","default","copy"])),mouseWheelScrollSensitivity:F(new Fn(65,"mouseWheelScrollSensitivity",1,s=>s===0?1:s,{markdownDescription:p("mouseWheelScrollSensitivity","A multiplier to be used on the `deltaX` and `deltaY` of mouse wheel scroll events.")})),mouseWheelZoom:F(new ae(66,"mouseWheelZoom",!1,{markdownDescription:p("mouseWheelZoom","Zoom the font of the editor when using mouse wheel and holding `Ctrl`.")})),multiCursorMergeOverlapping:F(new ae(67,"multiCursorMergeOverlapping",!0,{description:p("multiCursorMergeOverlapping","Merge multiple cursors when they are overlapping.")})),multiCursorModifier:F(new Yl(68,"multiCursorModifier","altKey","alt",["ctrlCmd","alt"],FR,{markdownEnumDescriptions:[p("multiCursorModifier.ctrlCmd","Maps to `Control` on Windows and Linux and to `Command` on macOS."),p("multiCursorModifier.alt","Maps to `Alt` on Windows and Linux and to `Option` on macOS.")],markdownDescription:p({key:"multiCursorModifier",comment:["- `ctrlCmd` refers to a value the setting can take and should not be localized.","- `Control` and `Command` refer to the modifier keys Ctrl or Cmd on the keyboard and can be localized."]},"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. [Read more](https://code.visualstudio.com/docs/editor/codebasics#_multicursor-modifier).")})),multiCursorPaste:F(new ut(69,"multiCursorPaste","spread",["spread","full"],{markdownEnumDescriptions:[p("multiCursorPaste.spread","Each cursor pastes a single line of the text."),p("multiCursorPaste.full","Each cursor pastes the full text.")],markdownDescription:p("multiCursorPaste","Controls pasting when the line count of the pasted text matches the cursor count.")})),occurrencesHighlight:F(new ae(70,"occurrencesHighlight",!0,{description:p("occurrencesHighlight","Controls whether the editor should highlight semantic symbol occurrences.")})),overviewRulerBorder:F(new ae(71,"overviewRulerBorder",!0,{description:p("overviewRulerBorder","Controls whether a border should be drawn around the overview ruler.")})),overviewRulerLanes:F(new Oe(72,"overviewRulerLanes",3,0,3)),padding:F(new NL),parameterHints:F(new TL),peekWidgetDefaultFocus:F(new ut(75,"peekWidgetDefaultFocus","tree",["tree","editor"],{enumDescriptions:[p("peekWidgetDefaultFocus.tree","Focus the tree when opening peek"),p("peekWidgetDefaultFocus.editor","Focus the editor when opening peek")],description:p("peekWidgetDefaultFocus","Controls whether to focus the inline editor or the tree in the peek widget.")})),definitionLinkOpensInPeek:F(new ae(76,"definitionLinkOpensInPeek",!1,{description:p("definitionLinkOpensInPeek","Controls whether the Go to Definition mouse gesture always opens the peek widget.")})),quickSuggestions:F(new RL),quickSuggestionsDelay:F(new Oe(78,"quickSuggestionsDelay",10,0,1073741824,{description:p("quickSuggestionsDelay","Controls the delay in milliseconds after which quick suggestions will show up.")})),readOnly:F(new ae(79,"readOnly",!1)),renameOnType:F(new ae(80,"renameOnType",!1,{description:p("renameOnType","Controls whether the editor auto renames on type."),markdownDeprecationMessage:p("renameOnTypeDeprecate","Deprecated, use `editor.linkedEditing` instead.")})),renderControlCharacters:F(new ae(81,"renderControlCharacters",!1,{description:p("renderControlCharacters","Controls whether the editor should render control characters.")})),renderIndentGuides:F(new ae(82,"renderIndentGuides",!0,{description:p("renderIndentGuides","Controls whether the editor should render indent guides.")})),renderFinalNewline:F(new ae(83,"renderFinalNewline",!0,{description:p("renderFinalNewline","Render last line number when the file ends with a newline.")})),renderLineHighlight:F(new ut(84,"renderLineHighlight","line",["none","gutter","line","all"],{enumDescriptions:["","","",p("renderLineHighlight.all","Highlights both the gutter and the current line.")],description:p("renderLineHighlight","Controls how the editor should render the current line highlight.")})),renderLineHighlightOnlyWhenFocus:F(new ae(85,"renderLineHighlightOnlyWhenFocus",!1,{description:p("renderLineHighlightOnlyWhenFocus","Controls if the editor should render the current line highlight only when the editor is focused.")})),renderValidationDecorations:F(new ut(86,"renderValidationDecorations","editable",["editable","on","off"])),renderWhitespace:F(new ut(87,"renderWhitespace","selection",["none","boundary","selection","trailing","all"],{enumDescriptions:["",p("renderWhitespace.boundary","Render whitespace characters except for single spaces between words."),p("renderWhitespace.selection","Render whitespace characters only on selected text."),p("renderWhitespace.trailing","Render only trailing whitespace characters."),""],description:p("renderWhitespace","Controls how the editor should render whitespace characters.")})),revealHorizontalRightPadding:F(new Oe(88,"revealHorizontalRightPadding",30,0,1e3)),roundedSelection:F(new ae(89,"roundedSelection",!0,{description:p("roundedSelection","Controls whether selections should have rounded corners.")})),rulers:F(new OL),scrollbar:F(new FL),scrollBeyondLastColumn:F(new Oe(92,"scrollBeyondLastColumn",5,0,1073741824,{description:p("scrollBeyondLastColumn","Controls the number of extra characters beyond which the editor will scroll horizontally.")})),scrollBeyondLastLine:F(new ae(93,"scrollBeyondLastLine",!0,{description:p("scrollBeyondLastLine","Controls whether the editor will scroll beyond the last line.")})),scrollPredominantAxis:F(new ae(94,"scrollPredominantAxis",!0,{description:p("scrollPredominantAxis","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:F(new ae(95,"selectionClipboard",!0,{description:p("selectionClipboard","Controls whether the Linux primary clipboard should be supported."),included:_t})),selectionHighlight:F(new ae(96,"selectionHighlight",!0,{description:p("selectionHighlight","Controls whether the editor should highlight matches similar to the selection.")})),selectOnLineNumbers:F(new ae(97,"selectOnLineNumbers",!0)),showFoldingControls:F(new ut(98,"showFoldingControls","mouseover",["always","mouseover"],{enumDescriptions:[p("showFoldingControls.always","Always show the folding controls."),p("showFoldingControls.mouseover","Only show the folding controls when the mouse is over the gutter.")],description:p("showFoldingControls","Controls when the folding controls on the gutter are shown.")})),showUnused:F(new ae(99,"showUnused",!0,{description:p("showUnused","Controls fading out of unused code.")})),showDeprecated:F(new ae(124,"showDeprecated",!0,{description:p("showDeprecated","Controls strikethrough deprecated variables.")})),inlayHints:F(new EL),snippetSuggestions:F(new ut(100,"snippetSuggestions","inline",["top","bottom","inline","none"],{enumDescriptions:[p("snippetSuggestions.top","Show snippet suggestions on top of other suggestions."),p("snippetSuggestions.bottom","Show snippet suggestions below other suggestions."),p("snippetSuggestions.inline","Show snippets suggestions with other suggestions."),p("snippetSuggestions.none","Do not show snippet suggestions.")],description:p("snippetSuggestions","Controls whether snippets are shown with other suggestions and how they are sorted.")})),smartSelect:F(new VL),smoothScrolling:F(new ae(102,"smoothScrolling",!1,{description:p("smoothScrolling","Controls whether the editor will scroll using an animation.")})),stopRenderingLineAfter:F(new Oe(104,"stopRenderingLineAfter",1e4,-1,1073741824)),suggest:F(new WL),inlineSuggest:F(new BL),suggestFontSize:F(new Oe(106,"suggestFontSize",0,0,1e3,{markdownDescription:p("suggestFontSize","Font size for the suggest widget. When set to `0`, the value of `#editor.fontSize#` is used.")})),suggestLineHeight:F(new Oe(107,"suggestLineHeight",0,0,1e3,{markdownDescription:p("suggestLineHeight","Line height for the suggest widget. When set to `0`, the value of `#editor.lineHeight#` is used. The minimum value is 8.")})),suggestOnTriggerCharacters:F(new ae(108,"suggestOnTriggerCharacters",!0,{description:p("suggestOnTriggerCharacters","Controls whether suggestions should automatically show up when typing trigger characters.")})),suggestSelection:F(new ut(109,"suggestSelection","recentlyUsed",["first","recentlyUsed","recentlyUsedByPrefix"],{markdownEnumDescriptions:[p("suggestSelection.first","Always select the first suggestion."),p("suggestSelection.recentlyUsed","Select recent suggestions unless further typing selects one, e.g. `console.| -> console.log` because `log` has been completed recently."),p("suggestSelection.recentlyUsedByPrefix","Select suggestions based on previous prefixes that have completed those suggestions, e.g. `co -> console` and `con -> const`.")],description:p("suggestSelection","Controls how suggestions are pre-selected when showing the suggest list.")})),tabCompletion:F(new ut(110,"tabCompletion","off",["on","off","onlySnippets"],{enumDescriptions:[p("tabCompletion.on","Tab complete will insert the best matching suggestion when pressing tab."),p("tabCompletion.off","Disable tab completions."),p("tabCompletion.onlySnippets","Tab complete snippets when their prefix match. Works best when 'quickSuggestions' aren't enabled.")],description:p("tabCompletion","Enables tab completions.")})),tabIndex:F(new Oe(111,"tabIndex",0,-1,1073741824)),unusualLineTerminators:F(new ut(112,"unusualLineTerminators","prompt",["auto","off","prompt"],{enumDescriptions:[p("unusualLineTerminators.auto","Unusual line terminators are automatically removed."),p("unusualLineTerminators.off","Unusual line terminators are ignored."),p("unusualLineTerminators.prompt","Unusual line terminators prompt to be removed.")],description:p("unusualLineTerminators","Remove unusual line terminators that might cause problems.")})),useShadowDOM:F(new ae(113,"useShadowDOM",!0)),useTabStops:F(new ae(114,"useTabStops",!0,{description:p("useTabStops","Inserting and deleting whitespace follows tab stops.")})),wordSeparators:F(new wi(115,"wordSeparators",Ub,{description:p("wordSeparators","Characters that will be used as word separators when doing word related navigations or operations.")})),wordWrap:F(new ut(116,"wordWrap","off",["off","on","wordWrapColumn","bounded"],{markdownEnumDescriptions:[p("wordWrap.off","Lines will never wrap."),p("wordWrap.on","Lines will wrap at the viewport width."),p({key:"wordWrap.wordWrapColumn",comment:["- `editor.wordWrapColumn` refers to a different setting and should not be localized."]},"Lines will wrap at `#editor.wordWrapColumn#`."),p({key:"wordWrap.bounded",comment:["- viewport means the edge of the visible window size.","- `editor.wordWrapColumn` refers to a different setting and should not be localized."]},"Lines will wrap at the minimum of viewport and `#editor.wordWrapColumn#`.")],description:p({key:"wordWrap",comment:["- 'off', 'on', 'wordWrapColumn' and 'bounded' refer to values the setting can take and should not be localized.","- `editor.wordWrapColumn` refers to a different setting and should not be localized."]},"Controls how lines should wrap.")})),wordWrapBreakAfterCharacters:F(new wi(117,"wordWrapBreakAfterCharacters"," })]?|/&.,;\xA2\xB0\u2032\u2033\u2030\u2103\u3001\u3002\uFF61\uFF64\uFFE0\uFF0C\uFF0E\uFF1A\uFF1B\uFF1F\uFF01\uFF05\u30FB\uFF65\u309D\u309E\u30FD\u30FE\u30FC\u30A1\u30A3\u30A5\u30A7\u30A9\u30C3\u30E3\u30E5\u30E7\u30EE\u30F5\u30F6\u3041\u3043\u3045\u3047\u3049\u3063\u3083\u3085\u3087\u308E\u3095\u3096\u31F0\u31F1\u31F2\u31F3\u31F4\u31F5\u31F6\u31F7\u31F8\u31F9\u31FA\u31FB\u31FC\u31FD\u31FE\u31FF\u3005\u303B\uFF67\uFF68\uFF69\uFF6A\uFF6B\uFF6C\uFF6D\uFF6E\uFF6F\uFF70\u201D\u3009\u300B\u300D\u300F\u3011\u3015\uFF09\uFF3D\uFF5D\uFF63")),wordWrapBreakBeforeCharacters:F(new wi(118,"wordWrapBreakBeforeCharacters","([{\u2018\u201C\u3008\u300A\u300C\u300E\u3010\u3014\uFF08\uFF3B\uFF5B\uFF62\xA3\xA5\uFF04\uFFE1\uFFE5+\uFF0B")),wordWrapColumn:F(new Oe(119,"wordWrapColumn",80,1,1073741824,{markdownDescription:p({key:"wordWrapColumn",comment:["- `editor.wordWrap` refers to a different setting and should not be localized.","- 'wordWrapColumn' and 'bounded' refer to values the different setting can take and should not be localized."]},"Controls the wrapping column of the editor when `#editor.wordWrap#` is `wordWrapColumn` or `bounded`.")})),wordWrapOverride1:F(new ut(120,"wordWrapOverride1","inherit",["off","on","inherit"])),wordWrapOverride2:F(new ut(121,"wordWrapOverride2","inherit",["off","on","inherit"])),wrappingIndent:F(new Yl(122,"wrappingIndent",1,"same",["none","same","indent","deepIndent"],BR,{enumDescriptions:[p("wrappingIndent.none","No indentation. Wrapped lines begin at column 1."),p("wrappingIndent.same","Wrapped lines get the same indentation as the parent."),p("wrappingIndent.indent","Wrapped lines get +1 indentation toward the parent."),p("wrappingIndent.deepIndent","Wrapped lines get +2 indentation toward the parent.")],description:p("wrappingIndent","Controls the indentation of wrapped lines.")})),wrappingStrategy:F(new ut(123,"wrappingStrategy","simple",["simple","advanced"],{enumDescriptions:[p("wrappingStrategy.simple","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."),p("wrappingStrategy.advanced","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.")],description:p("wrappingStrategy","Controls the algorithm that computes wrapping points.")})),editorClassName:F(new wL),pixelRatio:F(new ML),tabFocusMode:F(new jL),layoutInfo:F(new Xr),wrappingInfo:F(new zL)};var Qr;(function(s){s[s.Left=1]="Left",s[s.Center=2]="Center",s[s.Right=4]="Right",s[s.Full=7]="Full"})(Qr||(Qr={}));var Jr;(function(s){s[s.Inline=1]="Inline",s[s.Gutter=2]="Gutter"})(Jr||(Jr={}));var Ca=class{constructor(e){this._textModelResolvedOptionsBrand=void 0,this.tabSize=Math.max(1,e.tabSize|0),this.indentSize=e.tabSize|0,this.insertSpaces=Boolean(e.insertSpaces),this.defaultEOL=e.defaultEOL|0,this.trimAutoWhitespace=Boolean(e.trimAutoWhitespace)}equals(e){return this.tabSize===e.tabSize&&this.indentSize===e.indentSize&&this.insertSpaces===e.insertSpaces&&this.defaultEOL===e.defaultEOL&&this.trimAutoWhitespace===e.trimAutoWhitespace}createChangeEvent(e){return{tabSize:this.tabSize!==e.tabSize,indentSize:this.indentSize!==e.indentSize,insertSpaces:this.insertSpaces!==e.insertSpaces,trimAutoWhitespace:this.trimAutoWhitespace!==e.trimAutoWhitespace}}},$s=class{constructor(e,t){this._findMatchBrand=void 0,this.range=e,this.matches=t}},qh=class{constructor(e,t,i,n,r,o){this.identifier=e,this.range=t,this.text=i,this.forceMoveMarkers=n,this.isAutoWhitespaceEdit=r,this._isTracked=o}},qb=class{constructor(e,t,i){this.reverseEdits=e,this.changes=t,this.trimAutoWhitespaceLineNumbers=i}};var HL=typeof Buffer!="undefined",zR=typeof TextDecoder!="undefined",Gb,Sa=class{constructor(e){this.buffer=e,this.byteLength=this.buffer.byteLength}static wrap(e){return HL&&!Buffer.isBuffer(e)&&(e=Buffer.from(e.buffer,e.byteOffset,e.byteLength)),new Sa(e)}toString(){return HL?this.buffer.toString():zR?(Gb||(Gb=new TextDecoder),Gb.decode(this.buffer)):Jy(this.buffer)}};function UL(s,e){return s[e+0]<<0>>>0|s[e+1]<<8>>>0}function $L(s,e,t){s[t+0]=e&255,e=e>>>8,s[t+1]=e&255}function rn(s,e){return s[e]*Math.pow(2,24)+s[e+1]*Math.pow(2,16)+s[e+2]*Math.pow(2,8)+s[e+3]}function on(s,e,t){s[t+3]=e,e=e>>>8,s[t+2]=e,e=e>>>8,s[t+1]=e,e=e>>>8,s[t]=e}function Yb(s,e){return s[e]}function Zb(s,e,t){s[t]=e}var Xb;function KL(){return Xb||(Xb=new TextDecoder("UTF-16LE")),Xb}var Qb;function HR(){return Qb||(Qb=new TextDecoder("UTF-16BE")),Qb}var Jb;function ew(){return Jb||(Jb=yf()?KL():HR()),Jb}var tw=typeof TextDecoder!="undefined",as,fm;tw?(as=s=>new GL(s),fm=UR):(as=s=>new YL,fm=qL);function UR(s,e,t){let i=new Uint16Array(s.buffer,e,t);return t>0&&(i[0]===65279||i[0]===65534)?qL(s,e,t):KL().decode(i)}function qL(s,e,t){let i=[],n=0;for(let r=0;r=this._capacity){this._flushBuffer(),this._completedStrings[this._completedStrings.length]=e;return}for(let i=0;is.length)return!1;if(t){if(!Fl(s,e))return!1;if(e.length===s.length)return!0;let r=e.length;return e.charAt(e.length-1)===i&&r--,s.charAt(r)===i}return e.charAt(e.length-1)!==i&&(e+=i),s.indexOf(e)===0}function KR(s){return s>=65&&s<=90||s>=97&&s<=122}function c7(s){let e=Ml(s);return ot?s.length>3?!1:qR(e)&&(s.length===2||e.charCodeAt(2)===92):e===Ze.sep}function qR(s){return ot?KR(s.charCodeAt(0))&&s.charCodeAt(1)===58:!1}function iw(s){return kh(s,!0)}var JL=class{constructor(e){this._ignorePathCasing=e}compare(e,t,i=!1){return e===t?0:Oh(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()}joinPath(e,...t){return K.joinPath(e,...t)}basenameOrAuthority(e){return nw(e)||e.authority}basename(e){return Ze.basename(e.path)}dirname(e){if(e.path.length===0)return e;let t;return e.scheme===Ce.file?t=K.file(my(iw(e))).path:(t=Ze.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===Ce.file?t=K.file(Ml(iw(e))).path:t=Ze.normalize(e.path),e.with({path:t})}resolvePath(e,t){if(e.scheme===Ce.file){let i=K.file(uy(iw(e),t));return e.with({authority:i.authority,path:i.path})}return t=XL(t),e.with({path:Ze.resolve(e.path,t)})}},Hi=new JL(()=>!1),p7=Hi.isEqual.bind(Hi),_7=Hi.basenameOrAuthority.bind(Hi),nw=Hi.basename.bind(Hi),b7=Hi.dirname.bind(Hi),w7=Hi.joinPath.bind(Hi),ex=Hi.normalizePath.bind(Hi),v7=Hi.resolvePath.bind(Hi),Gh;(function(s){s.META_DATA_LABEL="label",s.META_DATA_DESCRIPTION="description",s.META_DATA_SIZE="size",s.META_DATA_MIME="mime";function e(t){let i=new Map;t.path.substring(t.path.indexOf(";")+1,t.path.lastIndexOf(";")).split(";").forEach(o=>{let[a,l]=o.split(":");a&&l&&i.set(a,l)});let r=t.path.substring(0,t.path.indexOf(";"));return r&&i.set(s.META_DATA_MIME,r),i}s.parseMetaData=e})(Gh||(Gh={}));function Xl(s){return s.toString()}var yt=class{constructor(e,t,i,n,r,o,a){this.beforeVersionId=e,this.afterVersionId=t,this.beforeEOL=i,this.afterEOL=n,this.beforeCursorState=r,this.afterCursorState=o,this.changes=a}static create(e,t){let i=e.getAlternativeVersionId(),n=rw(e);return new yt(i,i,n,n,t,t,[])}append(e,t,i,n,r){t.length>0&&(this.changes=ZL(this.changes,t)),this.afterEOL=i,this.afterVersionId=n,this.afterCursorState=r}static _writeSelectionsSize(e){return 4+4*4*(e?e.length:0)}static _writeSelections(e,t,i){if(on(e,t?t.length:0,i),i+=4,t)for(let n of t)on(e,n.selectionStartLineNumber,i),i+=4,on(e,n.selectionStartColumn,i),i+=4,on(e,n.positionLineNumber,i),i+=4,on(e,n.positionColumn,i),i+=4;return i}static _readSelections(e,t,i){let n=rn(e,t);t+=4;for(let r=0;rt.toString()).join(", ")}matchesResource(e){return(K.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 yt}append(e,t,i,n,r){this._data instanceof yt&&this._data.append(e,t,i,n,r)}close(){this._data instanceof yt&&(this._data=this._data.serialize())}open(){this._data instanceof yt||(this._data=yt.deserialize(this._data))}undo(){if(K.isUri(this.model))throw new Error("Invalid SingleModelEditStackElement");this._data instanceof yt&&(this._data=this._data.serialize());let e=yt.deserialize(this._data);this.model._applyUndo(e.changes,e.beforeEOL,e.beforeVersionId,e.beforeCursorState)}redo(){if(K.isUri(this.model))throw new Error("Invalid SingleModelEditStackElement");this._data instanceof yt&&(this._data=this._data.serialize());let e=yt.deserialize(this._data);this.model._applyRedo(e.changes,e.afterEOL,e.afterVersionId,e.afterCursorState)}heapSize(){return this._data instanceof yt&&(this._data=this._data.serialize()),this._data.byteLength+168}},tx=class{constructor(e,t){this.type=1,this.label=e,this._isOpen=!0,this._editStackElementsArr=t.slice(0),this._editStackElementsMap=new Map;for(let i of this._editStackElementsArr){let n=Xl(i.resource);this._editStackElementsMap.set(n,i)}this._delegate=null}get resources(){return this._editStackElementsArr.map(e=>e.resource)}prepareUndoRedo(){if(this._delegate)return this._delegate.prepareUndoRedo(this)}matchesResource(e){let t=Xl(e);return this._editStackElementsMap.has(t)}setModel(e){let t=Xl(K.isUri(e)?e:e.uri);this._editStackElementsMap.has(t)&&this._editStackElementsMap.get(t).setModel(e)}canAppend(e){if(!this._isOpen)return!1;let t=Xl(e.uri);return this._editStackElementsMap.has(t)?this._editStackElementsMap.get(t).canAppend(e):!1}append(e,t,i,n,r){let o=Xl(e.uri);this._editStackElementsMap.get(o).append(e,t,i,n,r)}close(){this._isOpen=!1}open(){}undo(){this._isOpen=!1;for(let e of this._editStackElementsArr)e.undo()}redo(){for(let e of this._editStackElementsArr)e.redo()}heapSize(e){let t=Xl(e);return this._editStackElementsMap.has(t)?this._editStackElementsMap.get(t).heapSize():0}split(){return this._editStackElementsArr}toString(){let e=[];for(let t of this._editStackElementsArr)e.push(`${nw(t.resource)}: ${t}`);return`{${e.join(", ")}}`}};function rw(s){return s.getEOL()===` +`?0:1}function ls(s){return s?s instanceof sw||s instanceof tx:!1}var Yh=class{constructor(e,t){this._model=e,this._undoRedoService=t}pushStackElement(){let e=this._undoRedoService.getLastElement(this._model.uri);ls(e)&&e.close()}popStackElement(){let e=this._undoRedoService.getLastElement(this._model.uri);ls(e)&&e.open()}clear(){this._undoRedoService.removeElements(this._model.uri)}_getOrCreateEditStackElement(e){let t=this._undoRedoService.getLastElement(this._model.uri);if(ls(t)&&t.canAppend(this._model))return t;let i=new sw(this._model,e);return this._undoRedoService.pushElement(i),i}pushEOL(e){let t=this._getOrCreateEditStackElement(null);this._model.setEOL(e),t.append(this._model,[],rw(this._model),this._model.getAlternativeVersionId(),null)}pushEditOperation(e,t,i){let n=this._getOrCreateEditStackElement(e),r=this._model.applyEdits(t,!0),o=Yh._computeCursorState(i,r),a=r.map((l,c)=>({index:c,textChange:l.textChange}));return a.sort((l,c)=>l.textChange.oldPosition===c.textChange.oldPosition?l.index-c.index:l.textChange.oldPosition-c.textChange.oldPosition),n.append(this._model,a.map(l=>l.textChange),rw(this._model),this._model.getAlternativeVersionId(),o),o}static _computeCursorState(e,t){try{return e?e(t):null}catch(i){return de(i),null}}};var ix=class{constructor(){this.spacesDiff=0,this.looksLikeAlignment=!1}};function GR(s,e,t,i,n){n.spacesDiff=0,n.looksLikeAlignment=!1;let r;for(r=0;r0&&a>0||l>0&&c>0)return;let h=Math.abs(a-c),d=Math.abs(o-l);if(h===0){n.spacesDiff=d,d>0&&0<=l-1&&l-10?n++:C>1&&r++,GR(o,a,b,v,d),d.looksLikeAlignment&&!(t&&e===d.spacesDiff)))continue;let x=d.spacesDiff;x<=c&&h[x]++,o=b,a=v}let u=t;n!==r&&(u=n{let b=h[g];b>m&&(m=b,f=g)}),f===4&&h[4]>0&&h[2]>0&&h[2]>=h[4]/2&&(f=2)}return{insertSpaces:u,tabSize:f}}function vi(s){return(s.metadata&1)>>>0}function Ae(s,e){s.metadata=s.metadata&254|e<<0}function Vt(s){return(s.metadata&2)>>>1==1}function Me(s,e){s.metadata=s.metadata&253|(e?1:0)<<1}function nx(s){return(s.metadata&4)>>>2==1}function sx(s,e){s.metadata=s.metadata&251|(e?1:0)<<2}function YR(s){return(s.metadata&24)>>>3}function rx(s,e){s.metadata=s.metadata&231|e<<3}function ZR(s){return(s.metadata&32)>>>5==1}function ox(s,e){s.metadata=s.metadata&223|(e?1:0)<<5}var gm=class{constructor(e,t,i){this.metadata=0,this.parent=this,this.left=this,this.right=this,Ae(this,1),this.start=t,this.end=i,this.delta=0,this.maxEnd=i,this.id=e,this.ownerId=0,this.options=null,sx(this,!1),rx(this,1),ox(this,!1),this.cachedVersionId=0,this.cachedAbsoluteStart=t,this.cachedAbsoluteEnd=i,this.range=null,Me(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;let t=this.options.className;sx(this,t==="squiggly-error"||t==="squiggly-warning"||t==="squiggly-info"),rx(this,this.options.stickiness),ox(this,this.options.collapseOnReplaceEdit)}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}},ie=new gm(null,0,0);ie.parent=ie;ie.left=ie;ie.right=ie;Ae(ie,0);var Zh=class{constructor(){this.root=ie,this.requestNormalizeDelta=!1}intervalSearch(e,t,i,n,r){return this.root===ie?[]:sA(this,e,t,i,n,r)}search(e,t,i){return this.root===ie?[]:nA(this,e,t,i)}collectNodesFromOwner(e){return tA(this,e)}collectNodesPostOrder(){return iA(this)}insert(e){ax(this,e),this._normalizeDeltaIfNecessary()}delete(e){lx(this,e),this._normalizeDeltaIfNecessary()}resolveNode(e,t){let i=e,n=0;for(;e!==this.root;)e===e.parent.right&&(n+=e.parent.delta),e=e.parent;let r=i.start+n,o=i.end+n;i.setCachedOffsets(r,o,t)}acceptReplace(e,t,i,n){let r=JR(this,e,e+t);for(let o=0,a=r.length;ot||i===1?!1:i===2?!0:e}function QR(s,e,t,i,n){let r=YR(s),o=r===0||r===2,a=r===1||r===2,l=t-e,c=i,h=Math.min(l,c),d=s.start,u=!1,f=s.end,m=!1;e<=d&&f<=t&&ZR(s)&&(s.start=e,u=!0,s.end=e,m=!0);{let b=n?1:l>0?2:0;!u&&Ql(d,o,e,b)&&(u=!0),!m&&Ql(f,a,e,b)&&(m=!0)}if(h>0&&!n){let b=l>c?2:0;!u&&Ql(d,o,e+h,b)&&(u=!0),!m&&Ql(f,a,e+h,b)&&(m=!0)}{let b=n?1:0;!u&&Ql(d,o,t,b)&&(s.start=e+c,u=!0),!m&&Ql(f,a,t,b)&&(s.end=e+c,m=!0)}let g=c-l;u||(s.start=Math.max(0,d+g)),m||(s.end=Math.max(0,f+g)),s.start>s.end&&(s.end=s.start)}function JR(s,e,t){let i=s.root,n=0,r=0,o=0,a=0,l=[],c=0;for(;i!==ie;){if(Vt(i)){Me(i.left,!1),Me(i.right,!1),i===i.parent.right&&(n-=i.parent.delta),i=i.parent;continue}if(!Vt(i.left)){if(r=n+i.maxEnd,rt){Me(i,!0);continue}if(a=n+i.end,a>=e&&(i.setCachedOffsets(o,a,0),l[c++]=i),Me(i,!0),i.right!==ie&&!Vt(i.right)){n+=i.delta,i=i.right;continue}}return Me(s.root,!1),l}function eA(s,e,t,i){let n=s.root,r=0,o=0,a=0,l=i-(t-e);for(;n!==ie;){if(Vt(n)){Me(n.left,!1),Me(n.right,!1),n===n.parent.right&&(r-=n.parent.delta),Ks(n),n=n.parent;continue}if(!Vt(n.left)){if(o=r+n.maxEnd,ot){n.start+=l,n.end+=l,n.delta+=l,(n.delta<-1073741824||n.delta>1073741824)&&(s.requestNormalizeDelta=!0),Me(n,!0);continue}if(Me(n,!0),n.right!==ie&&!Vt(n.right)){r+=n.delta,n=n.right;continue}}Me(s.root,!1)}function tA(s,e){let t=s.root,i=[],n=0;for(;t!==ie;){if(Vt(t)){Me(t.left,!1),Me(t.right,!1),t=t.parent;continue}if(t.left!==ie&&!Vt(t.left)){t=t.left;continue}if(t.ownerId===e&&(i[n++]=t),Me(t,!0),t.right!==ie&&!Vt(t.right)){t=t.right;continue}}return Me(s.root,!1),i}function iA(s){let e=s.root,t=[],i=0;for(;e!==ie;){if(Vt(e)){Me(e.left,!1),Me(e.right,!1),e=e.parent;continue}if(e.left!==ie&&!Vt(e.left)){e=e.left;continue}if(e.right!==ie&&!Vt(e.right)){e=e.right;continue}t[i++]=e,Me(e,!0)}return Me(s.root,!1),t}function nA(s,e,t,i){let n=s.root,r=0,o=0,a=0,l=[],c=0;for(;n!==ie;){if(Vt(n)){Me(n.left,!1),Me(n.right,!1),n===n.parent.right&&(r-=n.parent.delta),n=n.parent;continue}if(n.left!==ie&&!Vt(n.left)){n=n.left;continue}o=r+n.start,a=r+n.end,n.setCachedOffsets(o,a,i);let h=!0;if(e&&n.ownerId&&n.ownerId!==e&&(h=!1),t&&nx(n)&&(h=!1),h&&(l[c++]=n),Me(n,!0),n.right!==ie&&!Vt(n.right)){r+=n.delta,n=n.right;continue}}return Me(s.root,!1),l}function sA(s,e,t,i,n,r){let o=s.root,a=0,l=0,c=0,h=0,d=[],u=0;for(;o!==ie;){if(Vt(o)){Me(o.left,!1),Me(o.right,!1),o===o.parent.right&&(a-=o.parent.delta),o=o.parent;continue}if(!Vt(o.left)){if(l=a+o.maxEnd,lt){Me(o,!0);continue}if(h=a+o.end,h>=e){o.setCachedOffsets(c,h,r);let f=!0;i&&o.ownerId&&o.ownerId!==i&&(f=!1),n&&nx(o)&&(f=!1),f&&(d[u++]=o)}if(Me(o,!0),o.right!==ie&&!Vt(o.right)){a+=o.delta,o=o.right;continue}}return Me(s.root,!1),d}function ax(s,e){if(s.root===ie)return e.parent=ie,e.left=ie,e.right=ie,Ae(e,0),s.root=e,s.root;rA(s,e),eo(e.parent);let t=e;for(;t!==s.root&&vi(t.parent)===1;)if(t.parent===t.parent.parent.left){let i=t.parent.parent.right;vi(i)===1?(Ae(t.parent,0),Ae(i,0),Ae(t.parent.parent,1),t=t.parent.parent):(t===t.parent.right&&(t=t.parent,Xh(s,t)),Ae(t.parent,0),Ae(t.parent.parent,1),Qh(s,t.parent.parent))}else{let i=t.parent.parent.left;vi(i)===1?(Ae(t.parent,0),Ae(i,0),Ae(t.parent.parent,1),t=t.parent.parent):(t===t.parent.left&&(t=t.parent,Qh(s,t)),Ae(t.parent,0),Ae(t.parent.parent,1),Xh(s,t.parent.parent))}return Ae(s.root,0),e}function rA(s,e){let t=0,i=s.root,n=e.start,r=e.end;for(;;)if(aA(n,r,i.start+t,i.end+t)<0)if(i.left===ie){e.start-=t,e.end-=t,e.maxEnd-=t,i.left=e;break}else i=i.left;else if(i.right===ie){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=ie,e.right=ie,Ae(e,1)}function lx(s,e){let t,i;if(e.left===ie?(t=e.right,i=e,t.delta+=e.delta,(t.delta<-1073741824||t.delta>1073741824)&&(s.requestNormalizeDelta=!0),t.start+=e.delta,t.end+=e.delta):e.right===ie?(t=e.left,i=e):(i=oA(e.right),t=i.right,t.start+=i.delta,t.end+=i.delta,t.delta+=i.delta,(t.delta<-1073741824||t.delta>1073741824)&&(s.requestNormalizeDelta=!0),i.start+=e.delta,i.end+=e.delta,i.delta=e.delta,(i.delta<-1073741824||i.delta>1073741824)&&(s.requestNormalizeDelta=!0)),i===s.root){s.root=t,Ae(t,0),e.detach(),aw(),Ks(t),s.root.parent=ie;return}let n=vi(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,Ae(i,vi(e)),e===s.root?s.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)),e.detach(),n){eo(t.parent),i!==e&&(eo(i),eo(i.parent)),aw();return}eo(t),eo(t.parent),i!==e&&(eo(i),eo(i.parent));let r;for(;t!==s.root&&vi(t)===0;)t===t.parent.left?(r=t.parent.right,vi(r)===1&&(Ae(r,0),Ae(t.parent,1),Xh(s,t.parent),r=t.parent.right),vi(r.left)===0&&vi(r.right)===0?(Ae(r,1),t=t.parent):(vi(r.right)===0&&(Ae(r.left,0),Ae(r,1),Qh(s,r),r=t.parent.right),Ae(r,vi(t.parent)),Ae(t.parent,0),Ae(r.right,0),Xh(s,t.parent),t=s.root)):(r=t.parent.left,vi(r)===1&&(Ae(r,0),Ae(t.parent,1),Qh(s,t.parent),r=t.parent.left),vi(r.left)===0&&vi(r.right)===0?(Ae(r,1),t=t.parent):(vi(r.left)===0&&(Ae(r.right,0),Ae(r,1),Xh(s,r),r=t.parent.left),Ae(r,vi(t.parent)),Ae(t.parent,0),Ae(r.left,0),Qh(s,t.parent),t=s.root));Ae(t,0),aw()}function oA(s){for(;s.left!==ie;)s=s.left;return s}function aw(){ie.parent=ie,ie.delta=0,ie.start=0,ie.end=0}function Xh(s,e){let t=e.right;t.delta+=e.delta,(t.delta<-1073741824||t.delta>1073741824)&&(s.requestNormalizeDelta=!0),t.start+=e.delta,t.end+=e.delta,e.right=t.left,t.left!==ie&&(t.left.parent=e),t.parent=e.parent,e.parent===ie?s.root=t:e===e.parent.left?e.parent.left=t:e.parent.right=t,t.left=e,e.parent=t,Ks(e),Ks(t)}function Qh(s,e){let t=e.left;e.delta-=t.delta,(e.delta<-1073741824||e.delta>1073741824)&&(s.requestNormalizeDelta=!0),e.start-=t.delta,e.end-=t.delta,e.left=t.right,t.right!==ie&&(t.right.parent=e),t.parent=e.parent,e.parent===ie?s.root=t:e===e.parent.right?e.parent.right=t:e.parent.left=t,t.right=e,e.parent=t,Ks(e),Ks(t)}function cx(s){let e=s.end;if(s.left!==ie){let t=s.left.maxEnd;t>e&&(e=t)}if(s.right!==ie){let t=s.right.maxEnd+s.delta;t>e&&(e=t)}return e}function Ks(s){s.maxEnd=cx(s)}function eo(s){for(;s!==ie;){let e=cx(s);if(s.maxEnd===e)return;s.maxEnd=e,s=s.parent}}function aA(s,e,t,i){return s===t?e-i:s-t}var Jh=class{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!==G)return pm(this.right);let e=this;for(;e.parent!==G&&e.parent.left!==e;)e=e.parent;return e.parent===G?G:e.parent}prev(){if(this.left!==G)return lw(this.left);let e=this;for(;e.parent!==G&&e.parent.right!==e;)e=e.parent;return e.parent===G?G:e.parent}detach(){this.parent=null,this.left=null,this.right=null}},G=new Jh(null,0);G.parent=G;G.left=G;G.right=G;G.color=0;function pm(s){for(;s.left!==G;)s=s.left;return s}function lw(s){for(;s.right!==G;)s=s.right;return s}function cw(s){return s===G?0:s.size_left+s.piece.length+cw(s.right)}function hw(s){return s===G?0:s.lf_left+s.piece.lineFeedCnt+hw(s.right)}function dw(){G.parent=G}function ed(s,e){let 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!==G&&(t.left.parent=e),t.parent=e.parent,e.parent===G?s.root=t:e.parent.left===e?e.parent.left=t:e.parent.right=t,t.left=e,e.parent=t}function td(s,e){let t=e.left;e.left=t.right,t.right!==G&&(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===G?s.root=t:e===e.parent.right?e.parent.right=t:e.parent.left=t,t.right=e,e.parent=t}function id(s,e){let t,i;if(e.left===G?(i=e,t=i.right):e.right===G?(i=e,t=i.left):(i=pm(e.right),t=i.right),i===s.root){s.root=t,t.color=0,e.detach(),dw(),s.root.parent=G;return}let n=i.color===1;if(i===i.parent.left?i.parent.left=t:i.parent.right=t,i===e?(t.parent=i.parent,nd(s,t)):(i.parent===e?t.parent=i:t.parent=i.parent,nd(s,t),i.left=e.left,i.right=e.right,i.parent=e.parent,i.color=e.color,e===s.root?s.root=i:e===e.parent.left?e.parent.left=i:e.parent.right=i,i.left!==G&&(i.left.parent=i),i.right!==G&&(i.right.parent=i),i.size_left=e.size_left,i.lf_left=e.lf_left,nd(s,i)),e.detach(),t.parent.left===t){let o=cw(t),a=hw(t);if(o!==t.parent.size_left||a!==t.parent.lf_left){let l=o-t.parent.size_left,c=a-t.parent.lf_left;t.parent.size_left=o,t.parent.lf_left=a,cs(s,t.parent,l,c)}}if(nd(s,t.parent),n){dw();return}let r;for(;t!==s.root&&t.color===0;)t===t.parent.left?(r=t.parent.right,r.color===1&&(r.color=0,t.parent.color=1,ed(s,t.parent),r=t.parent.right),r.left.color===0&&r.right.color===0?(r.color=1,t=t.parent):(r.right.color===0&&(r.left.color=0,r.color=1,td(s,r),r=t.parent.right),r.color=t.parent.color,t.parent.color=0,r.right.color=0,ed(s,t.parent),t=s.root)):(r=t.parent.left,r.color===1&&(r.color=0,t.parent.color=1,td(s,t.parent),r=t.parent.left),r.left.color===0&&r.right.color===0?(r.color=1,t=t.parent):(r.left.color===0&&(r.right.color=0,r.color=1,ed(s,r),r=t.parent.left),r.color=t.parent.color,t.parent.color=0,r.left.color=0,td(s,t.parent),t=s.root));t.color=0,dw()}function uw(s,e){for(nd(s,e);e!==s.root&&e.parent.color===1;)if(e.parent===e.parent.parent.left){let 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,ed(s,e)),e.parent.color=0,e.parent.parent.color=1,td(s,e.parent.parent))}else{let 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,td(s,e)),e.parent.color=0,e.parent.parent.color=1,ed(s,e.parent.parent))}s.root.color=0}function cs(s,e,t,i){for(;e!==s.root&&e!==G;)e.parent.left===e&&(e.parent.size_left+=t,e.parent.lf_left+=i),e=e.parent}function nd(s,e){let t=0,i=0;if(e!==s.root){if(t===0){for(;e!==s.root&&e===e.parent.right;)e=e.parent;if(e===s.root)return;e=e.parent,t=cw(e.left)-e.size_left,i=hw(e.left)-e.lf_left,e.size_left+=t,e.lf_left+=i}for(;e!==s.root&&(t!==0||i!==0);)e.parent.left===e&&(e.parent.size_left+=t,e.parent.lf_left+=i),e=e.parent}}function ya(s){return s<0?0:s>255?255:s|0}function La(s){return s<0?0:s>4294967295?4294967295:s|0}var hs=class{constructor(e){let t=ya(e);this._defaultValue=t,this._asciiMap=hs._createAsciiMap(t),this._map=new Map}static _createAsciiMap(e){let t=new Uint8Array(256);for(let i=0;i<256;i++)t[i]=e;return t}set(e,t){let i=ya(t);e>=0&&e<256?this._asciiMap[e]=i:this._map.set(e,i)}get(e){return e>=0&&e<256?this._asciiMap[e]:this._map.get(e)||this._defaultValue}},lA=class{constructor(){this._actual=new hs(0)}add(e){this._actual.set(e,1)}has(e){return this._actual.get(e)===1}};var hx=class extends hs{constructor(e){super(0);for(let t=0,i=e.length;t(e.hasOwnProperty(t)||(e[t]=s(t)),e[t])}var ds=cA(s=>new hx(s));var hA=999,to=class{constructor(e,t,i,n){this.searchString=e,this.isRegex=t,this.matchCase=i,this.wordSeparators=n}parseSearchRequest(){if(this.searchString==="")return null;let e;this.isRegex?e=dA(this.searchString):e=this.searchString.indexOf(` +`)>=0;let t=null;try{t=Yf(this.searchString,this.isRegex,{matchCase:this.matchCase,wholeWord:!1,multiline:e,global:!0,unicode:!0})}catch(n){return null}if(!t)return null;let i=!this.isRegex&&!e;return i&&this.searchString.toLowerCase()!==this.searchString.toUpperCase()&&(i=this.matchCase),new dx(t,this.wordSeparators?ds(this.wordSeparators):null,i?this.searchString:null)}};function dA(s){if(!s||s.length===0)return!1;for(let e=0,t=s.length;e=t)break;let n=s.charCodeAt(e);if(n===110||n===114||n===87||n===119)return!0}return!1}var dx=class{constructor(e,t,i){this.regex=e,this.wordSeparators=t,this.simpleSearch=i}};function io(s,e,t){if(!t)return new $s(s,null);let i=[];for(let n=0,r=e.length;n>0);t[r]>=e?n=r-1:t[r+1]>=e?(i=r,n=r):i=r+1}return i+1}},Jl=class{static findMatches(e,t,i,n,r){let o=t.parseSearchRequest();return o?o.regex.multiline?this._doFindMatchesMultiline(e,i,new xa(o.wordSeparators,o.regex),n,r):this._doFindMatchesLineByLine(e,i,o,n,r):[]}static _getMultilineMatchRange(e,t,i,n,r,o){let a,l=0;n?(l=n.findLineFeedCountBeforeOffset(r),a=t+r+l):a=t+r;let c;if(n){let f=n.findLineFeedCountBeforeOffset(r+o.length)-l;c=a+o.length+f}else c=a+o.length;let h=e.getPositionAt(a),d=e.getPositionAt(c);return new D(h.lineNumber,h.column,d.lineNumber,d.column)}static _doFindMatchesMultiline(e,t,i,n,r){let o=e.getOffsetAt(t.getStartPosition()),a=e.getValueInRange(t,1),l=e.getEOL()===`\r +`?new fw(a):null,c=[],h=0,d;for(i.reset(0);d=i.next(a);)if(c[h++]=io(this._getMultilineMatchRange(e,o,a,l,d.index,d[0]),d,n),h>=r)return c;return c}static _doFindMatchesLineByLine(e,t,i,n,r){let o=[],a=0;if(t.startLineNumber===t.endLineNumber){let c=e.getLineContent(t.startLineNumber).substring(t.startColumn-1,t.endColumn-1);return a=this._findMatchesInLine(i,c,t.startLineNumber,t.startColumn-1,a,o,n,r),o}let l=e.getLineContent(t.startLineNumber).substring(t.startColumn-1);a=this._findMatchesInLine(i,l,t.startLineNumber,t.startColumn-1,a,o,n,r);for(let c=t.startLineNumber+1;c=l))return r;return r}let h=new xa(e.wordSeparators,e.regex),d;h.reset(0);do if(d=h.next(t),d&&(o[r++]=io(new D(i,d.index+1+n,i,d.index+1+d[0].length+n),d,a),r>=l))return r;while(d);return r}static findNextMatch(e,t,i,n){let r=t.parseSearchRequest();if(!r)return null;let o=new xa(r.wordSeparators,r.regex);return r.regex.multiline?this._doFindNextMatchMultiline(e,i,o,n):this._doFindNextMatchLineByLine(e,i,o,n)}static _doFindNextMatchMultiline(e,t,i,n){let r=new N(t.lineNumber,1),o=e.getOffsetAt(r),a=e.getLineCount(),l=e.getValueInRange(new D(r.lineNumber,r.column,a,e.getLineMaxColumn(a)),1),c=e.getEOL()===`\r +`?new fw(l):null;i.reset(t.column-1);let h=i.next(l);return h?io(this._getMultilineMatchRange(e,o,l,c,h.index,h[0]),h,n):t.lineNumber!==1||t.column!==1?this._doFindNextMatchMultiline(e,new N(1,1),i,n):null}static _doFindNextMatchLineByLine(e,t,i,n){let r=e.getLineCount(),o=t.lineNumber,a=e.getLineContent(o),l=this._findFirstMatchInLine(i,a,o,t.column,n);if(l)return l;for(let c=1;c<=r;c++){let h=(o+c-1)%r,d=e.getLineContent(h+1),u=this._findFirstMatchInLine(i,d,h+1,1,n);if(u)return u}return null}static _findFirstMatchInLine(e,t,i,n,r){e.reset(n-1);let o=e.next(t);return o?io(new D(i,o.index+1,i,o.index+1+o[0].length),o,r):null}static findPreviousMatch(e,t,i,n){let r=t.parseSearchRequest();if(!r)return null;let o=new xa(r.wordSeparators,r.regex);return r.regex.multiline?this._doFindPreviousMatchMultiline(e,i,o,n):this._doFindPreviousMatchLineByLine(e,i,o,n)}static _doFindPreviousMatchMultiline(e,t,i,n){let r=this._doFindMatchesMultiline(e,new D(1,1,t.lineNumber,t.column),i,n,10*hA);if(r.length>0)return r[r.length-1];let o=e.getLineCount();return t.lineNumber!==o||t.column!==e.getLineMaxColumn(o)?this._doFindPreviousMatchMultiline(e,new N(o,e.getLineMaxColumn(o)),i,n):null}static _doFindPreviousMatchLineByLine(e,t,i,n){let r=e.getLineCount(),o=t.lineNumber,a=e.getLineContent(o).substring(0,t.column-1),l=this._findLastMatchInLine(i,a,o,n);if(l)return l;for(let c=1;c<=r;c++){let h=(r+o-c-1)%r,d=e.getLineContent(h+1),u=this._findLastMatchInLine(i,d,h+1,n);if(u)return u}return null}static _findLastMatchInLine(e,t,i,n){let r=null,o;for(e.reset(0);o=e.next(t);)r=io(new D(i,o.index+1,i,o.index+1+o[0].length),o,n);return r}};function uA(s,e,t,i,n){if(i===0)return!0;let r=e.charCodeAt(i-1);if(s.get(r)!==0||r===13||r===10)return!0;if(n>0){let o=e.charCodeAt(i);if(s.get(o)!==0)return!0}return!1}function fA(s,e,t,i,n){if(i+n===t)return!0;let r=e.charCodeAt(i+n);if(s.get(r)!==0||r===13||r===10)return!0;if(n>0){let o=e.charCodeAt(i+n-1);if(s.get(o)!==0)return!0}return!1}function _m(s,e,t,i,n){return uA(s,e,t,i,n)&&fA(s,e,t,i,n)}var xa=class{constructor(e,t){this._wordSeparators=e,this._searchRegex=t,this._prevMatchStartIndex=-1,this._prevMatchLength=0}reset(e){this._searchRegex.lastIndex=e,this._prevMatchStartIndex=-1,this._prevMatchLength=0}next(e){let t=e.length,i;do{if(this._prevMatchStartIndex+this._prevMatchLength===t||(i=this._searchRegex.exec(e),!i))return null;let n=i.index,r=i[0].length;if(n===this._prevMatchStartIndex&&r===this._prevMatchLength){if(r===0){Pn(e,t,this._searchRegex.lastIndex)>65535?this._searchRegex.lastIndex+=2:this._searchRegex.lastIndex+=1;continue}return null}if(this._prevMatchStartIndex=n,this._prevMatchLength=r,!this._wordSeparators||_m(this._wordSeparators,e,t,n,r))return i}while(i);return null}};var qs=65535;function ux(s){let e;return s[s.length-1]<65536?e=new Uint16Array(s.length):e=new Uint32Array(s.length),e.set(s,0),e}var fx=class{constructor(e,t,i,n,r){this.lineStarts=e,this.cr=t,this.lf=i,this.crlf=n,this.isBasicASCII=r}};function us(s,e=!0){let t=[0],i=1;for(let n=0,r=s.length;n126)&&(o=!1)}let a=new fx(ux(s),i,n,r,o);return s.length=0,a}var Ci=class{constructor(e,t,i,n,r){this.bufferIndex=e,this.start=t,this.end=i,this.lineFeedCnt=n,this.length=r}},Gs=class{constructor(e,t){this.buffer=e,this.lineStarts=t}},gx=class{constructor(e,t){this._pieces=[],this._tree=e,this._BOM=t,this._index=0,e.root!==G&&e.iterate(e.root,i=>(i!==G&&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++])}},px=class{constructor(e){this._limit=e,this._cache=[]}get(e){for(let t=this._cache.length-1;t>=0;t--){let 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--){let i=this._cache[t];if(i.nodeStartLineNumber&&i.nodeStartLineNumber=e)return i}return null}set(e){this._cache.length>=this._limit&&this._cache.shift(),this._cache.push(e)}validate(e){let t=!1,i=this._cache;for(let n=0;n=e){i[n]=null,t=!0;continue}}if(t){let n=[];for(let r of i)r!==null&&n.push(r);this._cache=n}}},mw=class{constructor(e,t,i){this.create(e,t,i)}create(e,t,i){this._buffers=[new Gs("",[0])],this._lastChangeBufferPos={line:0,column:0},this.root=G,this._lineCnt=1,this._length=0,this._EOL=t,this._EOLLength=t.length,this._EOLNormalized=i;let n=null;for(let r=0,o=e.length;r0){e[r].lineStarts||(e[r].lineStarts=us(e[r].buffer));let a=new Ci(r+1,{line:0,column:0},{line:e[r].lineStarts.length-1,column:e[r].buffer.length-e[r].lineStarts[e[r].lineStarts.length-1]},e[r].lineStarts.length-1,e[r].buffer.length);this._buffers.push(e[r]),n=this.rbInsertRight(n,a)}this._searchCache=new px(1),this._lastVisitedLine={lineNumber:0,value:""},this.computeBufferMetadata()}normalizeEOL(e){let t=qs,i=t-Math.floor(t/3),n=i*2,r="",o=0,a=[];if(this.iterate(this.root,l=>{let c=this.getNodeContent(l),h=c.length;if(o<=i||o+h0){let l=r.replace(/\r\n|\r|\n/g,e);a.push(new Gs(l,us(l)))}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 gx(this,e)}getOffsetAt(e,t){let i=0,n=this.root;for(;n!==G;)if(n.left!==G&&n.lf_left+1>=e)n=n.left;else{if(n.lf_left+n.piece.lineFeedCnt+1>=e)return i+=n.size_left,i+=this.getAccumulatedValue(n,e-n.lf_left-2)+t-1;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,n=e;for(;t!==G;)if(t.size_left!==0&&t.size_left>=e)t=t.left;else if(t.size_left+t.piece.length>=e){let r=this.getIndexOf(t,e-t.size_left);if(i+=t.lf_left+r.index,r.index===0){let o=this.getOffsetAt(i+1,1),a=n-o;return new N(i+1,a+1)}return new N(i+1,r.remainder+1)}else if(e-=t.size_left+t.piece.length,i+=t.lf_left+t.piece.lineFeedCnt,t.right===G){let r=this.getOffsetAt(i+1,1),o=n-e-r;return new N(i+1,o+1)}else t=t.right;return new N(1,1)}getValueInRange(e,t){if(e.startLineNumber===e.endLineNumber&&e.startColumn===e.endColumn)return"";let i=this.nodeAt2(e.startLineNumber,e.startColumn),n=this.nodeAt2(e.endLineNumber,e.endColumn),r=this.getValueInRange2(i,n);return t?t!==this._EOL||!this._EOLNormalized?r.replace(/\r\n|\r|\n/g,t):t===this.getEOL()&&this._EOLNormalized?r:r.replace(/\r\n|\r|\n/g,t):r}getValueInRange2(e,t){if(e.node===t.node){let a=e.node,l=this._buffers[a.piece.bufferIndex].buffer,c=this.offsetInBuffer(a.piece.bufferIndex,a.piece.start);return l.substring(c+e.remainder,c+t.remainder)}let i=e.node,n=this._buffers[i.piece.bufferIndex].buffer,r=this.offsetInBuffer(i.piece.bufferIndex,i.piece.start),o=n.substring(r+e.remainder,r+i.piece.length);for(i=i.next();i!==G;){let a=this._buffers[i.piece.bufferIndex].buffer,l=this.offsetInBuffer(i.piece.bufferIndex,i.piece.start);if(i===t.node){o+=a.substring(l,l+t.remainder);break}else o+=a.substr(l,i.piece.length);i=i.next()}return o}getLinesContent(){let e=[],t=0,i="",n=!1;return this.iterate(this.root,r=>{if(r===G)return!0;let o=r.piece,a=o.length;if(a===0)return!0;let l=this._buffers[o.bufferIndex].buffer,c=this._buffers[o.bufferIndex].lineStarts,h=o.start.line,d=o.end.line,u=c[h]+o.start.column;if(n&&(l.charCodeAt(u)===10&&(u++,a--),e[t++]=i,i="",n=!1,a===0))return!0;if(h===d)return!this._EOLNormalized&&l.charCodeAt(u+a-1)===13?(n=!0,i+=l.substr(u,a-1)):i+=l.substr(u,a),!0;i+=this._EOLNormalized?l.substring(u,Math.max(u,c[h+1]-this._EOLLength)):l.substring(u,c[h+1]).replace(/(\r\n|\r|\n)$/,""),e[t++]=i;for(let f=h+1;fC+m,t.reset(0)):(_=u.buffer,v=C=>C,t.reset(m));do if(b=t.next(_),b){if(v(b.index)>=g)return h;this.positionInBuffer(e,v(b.index)-f,w);let C=this.getLineFeedCnt(e.piece.bufferIndex,r,w),y=w.line===r.line?w.column-r.column+n:w.column+1,x=y+b[0].length;if(d[h++]=io(new D(i+C,y,i+C,x),b,l),v(b.index)+b[0].length>=g||h>=c)return h}while(b);return h}findMatchesLineByLine(e,t,i,n){let r=[],o=0,a=new xa(t.wordSeparators,t.regex),l=this.nodeAt2(e.startLineNumber,e.startColumn);if(l===null)return[];let c=this.nodeAt2(e.endLineNumber,e.endColumn);if(c===null)return[];let h=this.positionInBuffer(l.node,l.remainder),d=this.positionInBuffer(c.node,c.remainder);if(l.node===c.node)return this.findMatchesInNode(l.node,a,e.startLineNumber,e.startColumn,h,d,t,i,n,o,r),r;let u=e.startLineNumber,f=l.node;for(;f!==c.node;){let g=this.getLineFeedCnt(f.piece.bufferIndex,h,f.piece.end);if(g>=1){let w=this._buffers[f.piece.bufferIndex].lineStarts,_=this.offsetInBuffer(f.piece.bufferIndex,f.piece.start),v=w[h.line+g],C=u===e.startLineNumber?e.startColumn:1;if(o=this.findMatchesInNode(f,a,u,C,h,this.positionInBuffer(f,v-_),t,i,n,o,r),o>=n)return r;u+=g}let b=u===e.startLineNumber?e.startColumn-1:0;if(u===e.endLineNumber){let w=this.getLineContent(u).substring(b,e.endColumn-1);return o=this._findMatchesInLine(t,a,w,e.endLineNumber,b,o,r,i,n),r}if(o=this._findMatchesInLine(t,a,this.getLineContent(u).substr(b),u,b,o,r,i,n),o>=n)return r;u++,l=this.nodeAt2(u,1),f=l.node,h=this.positionInBuffer(l.node,l.remainder)}if(u===e.endLineNumber){let g=u===e.startLineNumber?e.startColumn-1:0,b=this.getLineContent(u).substring(g,e.endColumn-1);return o=this._findMatchesInLine(t,a,b,e.endLineNumber,g,o,r,i,n),r}let m=u===e.startLineNumber?e.startColumn:1;return o=this.findMatchesInNode(c.node,a,u,m,h,d,t,i,n,o,r),r}_findMatchesInLine(e,t,i,n,r,o,a,l,c){let h=e.wordSeparators;if(!l&&e.simpleSearch){let u=e.simpleSearch,f=u.length,m=i.length,g=-f;for(;(g=i.indexOf(u,g+f))!==-1;)if((!h||_m(h,i,m,g,f))&&(a[o++]=new $s(new D(n,g+1+r,n,g+1+f+r),null),o>=c))return o;return o}let d;t.reset(0);do if(d=t.next(i),d&&(a[o++]=io(new D(n,d.index+1+r,n,d.index+1+d[0].length+r),d,l),o>=c))return o;while(d);return o}insert(e,t,i=!1){if(this._EOLNormalized=this._EOLNormalized&&i,this._lastVisitedLine.lineNumber=0,this._lastVisitedLine.value="",this.root!==G){let{node:n,remainder:r,nodeStartOffset:o}=this.nodeAt(e),a=n.piece,l=a.bufferIndex,c=this.positionInBuffer(n,r);if(n.piece.bufferIndex===0&&a.end.line===this._lastChangeBufferPos.line&&a.end.column===this._lastChangeBufferPos.column&&o+a.length===e&&t.lengthe){let h=[],d=new Ci(a.bufferIndex,c,a.end,this.getLineFeedCnt(a.bufferIndex,c,a.end),this.offsetInBuffer(l,a.end)-this.offsetInBuffer(l,c));if(this.shouldCheckCRLF()&&this.endWithCR(t)&&this.nodeCharCodeAt(n,r)===10){let g={line:d.start.line+1,column:0};d=new Ci(d.bufferIndex,g,d.end,this.getLineFeedCnt(d.bufferIndex,g,d.end),d.length-1),t+=` +`}if(this.shouldCheckCRLF()&&this.startWithLF(t))if(this.nodeCharCodeAt(n,r-1)===13){let g=this.positionInBuffer(n,r-1);this.deleteNodeTail(n,g),t="\r"+t,n.piece.length===0&&h.push(n)}else this.deleteNodeTail(n,c);else this.deleteNodeTail(n,c);let u=this.createNewPieces(t);d.length>0&&this.rbInsertRight(n,d);let f=n;for(let m=0;m=0;o--)r=this.rbInsertLeft(r,n[o]);this.validateCRLFWithPrevNode(r),this.deleteNodes(i)}insertContentToNodeRight(e,t){this.adjustCarriageReturnFromNext(e,t)&&(e+=` +`);let i=this.createNewPieces(e),n=this.rbInsertRight(t,i[0]),r=n;for(let o=1;o=u)c=d+1;else break;return i?(i.line=d,i.column=l-f,null):{line:d,column:l-f}}getLineFeedCnt(e,t,i){if(i.column===0)return i.line-t.line;let n=this._buffers[e].lineStarts;if(i.line===n.length-1)return i.line-t.line;let r=n[i.line+1],o=n[i.line]+i.column;if(r>o+1)return i.line-t.line;let a=o-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;tqs){let h=[];for(;e.length>qs;){let u=e.charCodeAt(qs-1),f;u===13||u>=55296&&u<=56319?(f=e.substring(0,qs-1),e=e.substring(qs-1)):(f=e.substring(0,qs),e=e.substring(qs));let m=us(f);h.push(new Ci(this._buffers.length,{line:0,column:0},{line:m.length-1,column:f.length-m[m.length-1]},m.length-1,f.length)),this._buffers.push(new Gs(f,m))}let d=us(e);return h.push(new Ci(this._buffers.length,{line:0,column:0},{line:d.length-1,column:e.length-d[d.length-1]},d.length-1,e.length)),this._buffers.push(new Gs(e,d)),h}let t=this._buffers[0].buffer.length,i=us(e,!1),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 h=0;h=e-1)i=i.left;else if(i.lf_left+i.piece.lineFeedCnt>e-1){let l=this.getAccumulatedValue(i,e-i.lf_left-2),c=this.getAccumulatedValue(i,e-i.lf_left-1),h=this._buffers[i.piece.bufferIndex].buffer,d=this.offsetInBuffer(i.piece.bufferIndex,i.piece.start);return o+=i.size_left,this._searchCache.set({node:i,nodeStartOffset:o,nodeStartLineNumber:a-(e-1-i.lf_left)}),h.substring(d+l,d+c-t)}else if(i.lf_left+i.piece.lineFeedCnt===e-1){let l=this.getAccumulatedValue(i,e-i.lf_left-2),c=this._buffers[i.piece.bufferIndex].buffer,h=this.offsetInBuffer(i.piece.bufferIndex,i.piece.start);n=c.substring(h+l,h+i.piece.length);break}else e-=i.lf_left+i.piece.lineFeedCnt,o+=i.size_left+i.piece.length,i=i.right}for(i=i.next();i!==G;){let o=this._buffers[i.piece.bufferIndex].buffer;if(i.piece.lineFeedCnt>0){let a=this.getAccumulatedValue(i,0),l=this.offsetInBuffer(i.piece.bufferIndex,i.piece.start);return n+=o.substring(l,l+a-t),n}else{let a=this.offsetInBuffer(i.piece.bufferIndex,i.piece.start);n+=o.substr(a,i.piece.length)}i=i.next()}return n}computeBufferMetadata(){let e=this.root,t=1,i=0;for(;e!==G;)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){let i=e.piece,n=this.positionInBuffer(e,t),r=n.line-i.start.line;if(this.offsetInBuffer(i.bufferIndex,i.end)-this.offsetInBuffer(i.bufferIndex,i.start)===t){let o=this.getLineFeedCnt(e.piece.bufferIndex,i.start,n);if(o!==r)return{index:o,remainder:0}}return{index:r,remainder:n.column}}getAccumulatedValue(e,t){if(t<0)return 0;let i=e.piece,n=this._buffers[i.bufferIndex].lineStarts,r=i.start.line+t+1;return r>i.end.line?n[i.end.line]+i.end.column-n[i.start.line]-i.start.column:n[r]-n[i.start.line]-i.start.column}deleteNodeTail(e,t){let i=e.piece,n=i.lineFeedCnt,r=this.offsetInBuffer(i.bufferIndex,i.end),o=t,a=this.offsetInBuffer(i.bufferIndex,o),l=this.getLineFeedCnt(i.bufferIndex,i.start,o),c=l-n,h=a-r,d=i.length+h;e.piece=new Ci(i.bufferIndex,i.start,o,l,d),cs(this,e,h,c)}deleteNodeHead(e,t){let i=e.piece,n=i.lineFeedCnt,r=this.offsetInBuffer(i.bufferIndex,i.start),o=t,a=this.getLineFeedCnt(i.bufferIndex,o,i.end),l=this.offsetInBuffer(i.bufferIndex,o),c=a-n,h=r-l,d=i.length+h;e.piece=new Ci(i.bufferIndex,o,i.end,a,d),cs(this,e,h,c)}shrinkNode(e,t,i){let n=e.piece,r=n.start,o=n.end,a=n.length,l=n.lineFeedCnt,c=t,h=this.getLineFeedCnt(n.bufferIndex,n.start,c),d=this.offsetInBuffer(n.bufferIndex,t)-this.offsetInBuffer(n.bufferIndex,r);e.piece=new Ci(n.bufferIndex,n.start,c,h,d),cs(this,e,d-a,h-l);let u=new Ci(n.bufferIndex,i,o,this.getLineFeedCnt(n.bufferIndex,i,o),this.offsetInBuffer(n.bufferIndex,o)-this.offsetInBuffer(n.bufferIndex,i)),f=this.rbInsertRight(e,u);this.validateCRLFWithPrevNode(f)}appendToNode(e,t){this.adjustCarriageReturnFromNext(t,e)&&(t+=` +`);let i=this.shouldCheckCRLF()&&this.startWithLF(t)&&this.endWithCR(e),n=this._buffers[0].buffer.length;this._buffers[0].buffer+=t;let r=us(t,!1);for(let f=0;fe)t=t.left;else if(t.size_left+t.piece.length>=e){n+=t.size_left;let r={node:t,remainder:e-t.size_left,nodeStartOffset:n};return this._searchCache.set(r),r}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!==G;)if(i.left!==G&&i.lf_left>=e-1)i=i.left;else if(i.lf_left+i.piece.lineFeedCnt>e-1){let r=this.getAccumulatedValue(i,e-i.lf_left-2),o=this.getAccumulatedValue(i,e-i.lf_left-1);return n+=i.size_left,{node:i,remainder:Math.min(r+t-1,o),nodeStartOffset:n}}else if(i.lf_left+i.piece.lineFeedCnt===e-1){let r=this.getAccumulatedValue(i,e-i.lf_left-2);if(r+t-1<=i.piece.length)return{node:i,remainder:r+t-1,nodeStartOffset:n};t-=i.piece.length-r;break}else e-=i.lf_left+i.piece.lineFeedCnt,n+=i.size_left+i.piece.length,i=i.right;for(i=i.next();i!==G;){if(i.piece.lineFeedCnt>0){let r=this.getAccumulatedValue(i,0),o=this.offsetOfNode(i);return{node:i,remainder:Math.min(t-1,r),nodeStartOffset:o}}else if(i.piece.length>=t-1){let r=this.offsetOfNode(i);return{node:i,remainder:t-1,nodeStartOffset:r}}else t-=i.piece.length;i=i.next()}return null}nodeCharCodeAt(e,t){if(e.piece.lineFeedCnt<1)return-1;let 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===G||e.piece.lineFeedCnt===0)return!1;let t=e.piece,i=this._buffers[t.bufferIndex].lineStarts,n=t.start.line,r=i[n]+t.start.column;return n===i.length-1||i[n+1]>r+1?!1:this._buffers[t.bufferIndex].buffer.charCodeAt(r)===10}endWithCR(e){return typeof e=="string"?e.charCodeAt(e.length-1)===13:e===G||e.piece.lineFeedCnt===0?!1:this.nodeCharCodeAt(e,e.piece.length-1)===13}validateCRLFWithPrevNode(e){if(this.shouldCheckCRLF()&&this.startWithLF(e)){let t=e.prev();this.endWithCR(t)&&this.fixCRLF(t,e)}}validateCRLFWithNextNode(e){if(this.shouldCheckCRLF()&&this.endWithCR(e)){let t=e.next();this.startWithLF(t)&&this.fixCRLF(e,t)}}fixCRLF(e,t){let i=[],n=this._buffers[e.piece.bufferIndex].lineStarts,r;e.piece.end.column===0?r={line:e.piece.end.line-1,column:n[e.piece.end.line]-n[e.piece.end.line-1]-1}:r={line:e.piece.end.line,column:e.piece.end.column-1};let o=e.piece.length-1,a=e.piece.lineFeedCnt-1;e.piece=new Ci(e.piece.bufferIndex,e.piece.start,r,a,o),cs(this,e,-1,-1),e.piece.length===0&&i.push(e);let l={line:t.piece.start.line+1,column:0},c=t.piece.length-1,h=this.getLineFeedCnt(t.piece.bufferIndex,l,t.piece.end);t.piece=new Ci(t.piece.bufferIndex,l,t.piece.end,h,c),cs(this,t,-1,-1),t.piece.length===0&&i.push(t);let d=this.createNewPieces(`\r +`);this.rbInsertRight(e,d[0]);for(let u=0;ui===n){if(s===e)return!0;if(!s||!e||s.length!==e.length)return!1;for(let i=0,n=s.length;i0)n=r-1;else return r}return-(i+1)}function Z7(s,e){let t=0,i=s.length;if(i===0)return 0;for(;t=e.length)throw new TypeError("invalid index");let i=e[Math.floor(e.length*Math.random())],n=[],r=[],o=[];for(let a of e){let l=t(a,i);l<0?n.push(a):l>0?r.push(a):o.push(a)}return s!!e)}function Cx(s){return!Array.isArray(s)||s.length===0}function sd(s){return Array.isArray(s)&&s.length>0}function bm(s,e){if(!e)return s.filter((i,n)=>s.indexOf(i)===n);let t=Object.create(null);return s.filter(i=>{let n=e(i);return t[n]?!1:(t[n]=!0,!0)})}function gw(s){let e=new Set;return s.filter(t=>e.has(t)?!1:(e.add(t),!0))}function rd(s,e){return s.length>0?s[0]:e}function Q7(s){return[].concat(...s)}function Nt(s,e){let t=typeof e=="number"?s:0;typeof e=="number"?t=s:(t=0,e=s);let i=[];if(t<=e)for(let n=t;ne;n--)i.push(n);return i}function no(s,e,t){let i=s.slice(0,e),n=s.slice(e);return i.concat(t,n)}function wm(s,e){let t=s.indexOf(e);t>-1&&(s.splice(t,1),s.unshift(e))}function od(s,e){let t=s.indexOf(e);t>-1&&(s.splice(t,1),s.push(e))}function Sx(s){return Array.isArray(s)?s:[s]}function mA(s,e,t){let i=Lx(s,e),n=s.length,r=t.length;s.length=n+r;for(let o=n-1;o>=i;o--)s[o+r]=s[o];for(let o=0;o=0&&e(this.items[t]);)t--;let i=t===this.lastIdx?null:this.items.slice(t+1,this.lastIdx+1);return this.lastIdx=t,i}};function xx(s){return pw(s,0)}function pw(s,e){switch(typeof s){case"object":return s===null?Ys(349,e):Array.isArray(s)?pA(s,e):_A(s,e);case"string":return Cm(s,e);case"boolean":return gA(s,e);case"number":return Ys(s,e);case"undefined":return Ys(937,e);default:return Ys(617,e)}}function Ys(s,e){return(e<<5)-e+s|0}function gA(s,e){return Ys(s?433:863,e)}function Cm(s,e){e=Ys(149417,e);for(let t=0,i=s.length;tpw(i,t),e)}function _A(s,e){return e=Ys(181387,e),Object.keys(s).sort().reduce((t,i)=>(t=Cm(i,t),pw(s[i],t)),e)}function _w(s,e,t=32){let i=t-e,n=~((1<>>i)>>>0}function Dx(s,e=0,t=s.byteLength,i=0){for(let n=0;nt.toString(16).padStart(2,"0")).join(""):bA((s>>>0).toString(16),e/4)}var ec=class{constructor(){this._h0=1732584193,this._h1=4023233417,this._h2=2562383102,this._h3=271733878,this._h4=3285377520,this._buff=new Uint8Array(64+3),this._buffDV=new DataView(this._buff.buffer),this._buffLen=0,this._totalLen=0,this._leftoverHighSurrogate=0,this._finished=!1}update(e){let t=e.length;if(t===0)return;let i=this._buff,n=this._buffLen,r=this._leftoverHighSurrogate,o,a;for(r!==0?(o=r,a=-1,r=0):(o=e.charCodeAt(0),a=0);;){let l=o;if(Xe(o))if(a+1>>6,e[t++]=128|(i&63)>>>0):i<65536?(e[t++]=224|(i&61440)>>>12,e[t++]=128|(i&4032)>>>6,e[t++]=128|(i&63)>>>0):(e[t++]=240|(i&1835008)>>>18,e[t++]=128|(i&258048)>>>12,e[t++]=128|(i&4032)>>>6,e[t++]=128|(i&63)>>>0),t>=64&&(this._step(),t-=64,this._totalLen+=64,e[0]=e[64+0],e[1]=e[64+1],e[2]=e[64+2]),t}digest(){return this._finished||(this._finished=!0,this._leftoverHighSurrogate&&(this._leftoverHighSurrogate=0,this._buffLen=this._push(this._buff,this._buffLen,65533)),this._totalLen+=this._buffLen,this._wrapUp()),ad(this._h0)+ad(this._h1)+ad(this._h2)+ad(this._h3)+ad(this._h4)}_wrapUp(){this._buff[this._buffLen++]=128,Dx(this._buff,this._buffLen),this._buffLen>56&&(this._step(),Dx(this._buff));let e=8*this._totalLen;this._buffDV.setUint32(56,Math.floor(e/4294967296),!1),this._buffDV.setUint32(60,e%4294967296,!1),this._step()}_step(){let e=ec._bigBlock32,t=this._buffDV;for(let d=0;d<64;d+=4)e.setUint32(d,t.getUint32(d,!1),!1);for(let d=64;d<320;d+=4)e.setUint32(d,_w(e.getUint32(d-12,!1)^e.getUint32(d-32,!1)^e.getUint32(d-56,!1)^e.getUint32(d-64,!1),1),!1);let i=this._h0,n=this._h1,r=this._h2,o=this._h3,a=this._h4,l,c,h;for(let d=0;d<80;d++)d<20?(l=n&r|~n&o,c=1518500249):d<40?(l=n^r^o,c=1859775393):d<60?(l=n&r|n&o|r&o,c=2400959708):(l=n^r^o,c=3395469782),h=_w(i,5)+l+a+c+e.getUint32(d*4,!1)&4294967295,a=o,o=r,r=_w(n,30),n=i,i=h;this._h0=this._h0+i&4294967295,this._h1=this._h1+n&4294967295,this._h2=this._h2+r&4294967295,this._h3=this._h3+o&4294967295,this._h4=this._h4+a&4294967295}};ec._bigBlock32=new DataView(new ArrayBuffer(320));var Ex,kx,Ix=class{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!1){return new so(new Mx(e))}static forStrings(){return new so(new Ix)}static forConfigKeys(){return new so(new Nx)}clear(){this._root=void 0}set(e,t){let i=this._iter.reset(e),n;for(this._root||(this._root=new ld,this._root.segment=i.value()),n=this._root;;){let o=i.cmp(n.segment);if(o>0)n.left||(n.left=new ld,n.left.segment=i.value()),n=n.left;else if(o<0)n.right||(n.right=new ld,n.right.segment=i.value()),n=n.right;else if(i.hasNext())i.next(),n.mid||(n.mid=new ld,n.mid.segment=i.value()),n=n.mid;else break}let r=n.value;return n.value=t,n.key=e,r}get(e){var t;return(t=this._getNode(e))===null||t===void 0?void 0:t.value}_getNode(e){let t=this._iter.reset(e),i=this._root;for(;i;){let 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){let t=this._getNode(e);return!((t==null?void 0:t.value)===void 0&&(t==null?void 0:t.mid)===void 0)}delete(e){return this._delete(e,!1)}deleteSuperstr(e){return this._delete(e,!0)}_delete(e,t){let i=this._iter.reset(e),n=[],r=this._root;for(;r;){let o=i.cmp(r.segment);if(o>0)n.push([1,r]),r=r.left;else if(o<0)n.push([-1,r]),r=r.right;else if(i.hasNext())i.next(),n.push([0,r]),r=r.mid;else{for(t?(r.left=void 0,r.mid=void 0,r.right=void 0):r.value=void 0;n.length>0&&r.isEmpty();){let[a,l]=n.pop();switch(a){case 1:l.left=void 0;break;case 0:l.mid=void 0;break;case-1:l.right=void 0;break}r=l}break}}}findSubstr(e){let t=this._iter.reset(e),i=this._root,n;for(;i;){let r=t.cmp(i.segment);if(r>0)i=i.left;else if(r<0)i=i.right;else if(t.hasNext())t.next(),n=i.value||n,i=i.mid;else break}return i&&i.value||n}findSuperstr(e){let t=this._iter.reset(e),i=this._root;for(;i;){let 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 return i.mid?this._entries(i.mid):void 0}}forEach(e){for(let[t,i]of this)e(i,t)}*[Symbol.iterator](){yield*this._entries(this._root)}*_entries(e){if(!e)return;let t=[e];for(;t.length>0;){let i=t.pop();i&&(i.value&&(yield[i.key,i.value]),i.left&&t.push(i.left),i.mid&&t.push(i.mid),i.right&&t.push(i.right))}}},At=class{constructor(e,t){this[Ex]="ResourceMap",e instanceof At?(this.map=new Map(e.map),this.toKey=t!=null?t:At.defaultToKey):(this.map=new Map,this.toKey=e!=null?e:At.defaultToKey)}set(e,t){return this.map.set(this.toKey(e),t),this}get(e){return this.map.get(this.toKey(e))}has(e){return this.map.has(this.toKey(e))}get size(){return this.map.size}clear(){this.map.clear()}delete(e){return this.map.delete(this.toKey(e))}forEach(e,t){typeof t!="undefined"&&(e=e.bind(t));for(let[i,n]of this.map)e(n,K.parse(i),this)}values(){return this.map.values()}*keys(){for(let e of this.map.keys())yield K.parse(e)}*entries(){for(let e of this.map.entries())yield[K.parse(e[0]),e[1]]}*[(Ex=Symbol.toStringTag,Symbol.iterator)](){for(let e of this.map)yield[K.parse(e[0]),e[1]]}};At.defaultToKey=s=>s.toString();var Rx=class{constructor(){this[kx]="LinkedMap",this._map=new Map,this._head=void 0,this._tail=void 0,this._size=0,this._state=0}clear(){this._map.clear(),this._head=void 0,this._tail=void 0,this._size=0,this._state++}isEmpty(){return!this._head&&!this._tail}get size(){return this._size}get first(){var e;return(e=this._head)===null||e===void 0?void 0:e.value}get last(){var e;return(e=this._tail)===null||e===void 0?void 0:e.value}has(e){return this._map.has(e)}get(e,t=0){let i=this._map.get(e);if(!!i)return t!==0&&this.touch(i,t),i.value}set(e,t,i=0){let n=this._map.get(e);if(n)n.value=t,i!==0&&this.touch(n,i);else{switch(n={key:e,value:t,next:void 0,previous:void 0},i){case 0:this.addItemLast(n);break;case 1:this.addItemFirst(n);break;case 2:this.addItemLast(n);break;default:this.addItemLast(n);break}this._map.set(e,n),this._size++}return this}delete(e){return!!this.remove(e)}remove(e){let t=this._map.get(e);if(!!t)return this._map.delete(e),this.removeItem(t),this._size--,t.value}shift(){if(!this._head&&!this._tail)return;if(!this._head||!this._tail)throw new Error("Invalid list");let e=this._head;return this._map.delete(e.key),this.removeItem(e),this._size--,e.value}forEach(e,t){let i=this._state,n=this._head;for(;n;){if(t?e.bind(t)(n.value,n.key,this):e(n.value,n.key,this),this._state!==i)throw new Error("LinkedMap got modified during iteration.");n=n.next}}keys(){let e=this,t=this._state,i=this._head,n={[Symbol.iterator](){return n},next(){if(e._state!==t)throw new Error("LinkedMap got modified during iteration.");if(i){let r={value:i.key,done:!1};return i=i.next,r}else return{value:void 0,done:!0}}};return n}values(){let e=this,t=this._state,i=this._head,n={[Symbol.iterator](){return n},next(){if(e._state!==t)throw new Error("LinkedMap got modified during iteration.");if(i){let r={value:i.value,done:!1};return i=i.next,r}else return{value:void 0,done:!0}}};return n}entries(){let e=this,t=this._state,i=this._head,n={[Symbol.iterator](){return n},next(){if(e._state!==t)throw new Error("LinkedMap got modified during iteration.");if(i){let r={value:[i.key,i.value],done:!1};return i=i.next,r}else return{value:void 0,done:!0}}};return n}[(kx=Symbol.toStringTag,Symbol.iterator)](){return this.entries()}trimOld(e){if(e>=this.size)return;if(e===0){this.clear();return}let t=this._head,i=this.size;for(;t&&i>e;)this._map.delete(t.key),t=t.next,i--;this._head=t,this._size=i,t&&(t.previous=void 0),this._state++}addItemFirst(e){if(!this._head&&!this._tail)this._tail=e;else if(this._head)e.next=this._head,this._head.previous=e;else throw new Error("Invalid list");this._head=e,this._state++}addItemLast(e){if(!this._head&&!this._tail)this._head=e;else if(this._tail)e.previous=this._tail,this._tail.next=e;else throw new Error("Invalid list");this._tail=e,this._state++}removeItem(e){if(e===this._head&&e===this._tail)this._head=void 0,this._tail=void 0;else if(e===this._head){if(!e.next)throw new Error("Invalid list");e.next.previous=void 0,this._head=e.next}else if(e===this._tail){if(!e.previous)throw new Error("Invalid list");e.previous.next=void 0,this._tail=e.previous}else{let t=e.next,i=e.previous;if(!t||!i)throw new Error("Invalid list");t.previous=i,i.next=t}e.next=void 0,e.previous=void 0,this._state++}touch(e,t){if(!this._head||!this._tail)throw new Error("Invalid list");if(!(t!==1&&t!==2)){if(t===1){if(e===this._head)return;let i=e.next,n=e.previous;e===this._tail?(n.next=void 0,this._tail=n):(i.previous=n,n.next=i),e.previous=void 0,e.next=this._head,this._head.previous=e,this._head=e,this._state++}else if(t===2){if(e===this._tail)return;let i=e.next,n=e.previous;e===this._head?(i.previous=void 0,this._head=i):(i.previous=n,n.next=i),e.next=void 0,e.previous=this._tail,this._tail.next=e,this._tail=e,this._state++}}}toJSON(){let e=[];return this.forEach((t,i)=>{e.push([i,t])}),e}fromJSON(e){this.clear();for(let[t,i]of e)this.set(t,i)}},Da=class extends Rx{constructor(e,t=1){super();this._limit=e,this._ratio=Math.min(Math.max(0,t),1)}get limit(){return this._limit}set limit(e){this._limit=e,this.checkTrim()}get(e,t=2){return super.get(e,t)}peek(e){return super.get(e,0)}set(e,t){return super.set(e,t,2),this.checkTrim(),this}checkTrim(){this.size>this._limit&&this.trimOld(Math.round(this._limit*this._ratio))}};function $i(s,e,t){return Math.min(Math.max(s,e),t)}var bw=class{constructor(){this._n=1,this._val=0}update(e){return this._val=this._val+(e-this._val)/this._n,this._n+=1,this}get value(){return this._val}};var ww="**",Ax="/",Sm="[/\\\\]",ym="[^/\\\\]",wA=/\//g;function Ox(s){switch(s){case 0:return"";case 1:return`${ym}*?`;default:return`(?:${Sm}|${ym}+${Sm}|${Sm}${ym}+)*?`}}function Px(s,e){if(!s)return[];let t=[],i=!1,n=!1,r="";for(let o of s){switch(o){case e:if(!i&&!n){t.push(r),r="";continue}break;case"{":i=!0;break;case"}":i=!1;break;case"[":n=!0;break;case"]":n=!1;break}r+=o}return r&&t.push(r),t}function Fx(s){if(!s)return"";let e="",t=Px(s,Ax);if(t.every(i=>i===ww))e=".*";else{let i=!1;t.forEach((n,r)=>{if(n===ww){i||(e+=Ox(2),i=!0);return}let o=!1,a="",l=!1,c="";for(let h of n){if(h!=="}"&&o){a+=h;continue}if(l&&(h!=="]"||!c)){let d;h==="-"?d=h:(h==="^"||h==="!")&&!c?d="^":h===Ax?d="":d=js(h),c+=d;continue}switch(h){case"{":o=!0;continue;case"[":l=!0;continue;case"}":e+=`(?:${Px(a,",").map(f=>Fx(f)).join("|")})`,o=!1,a="";break;case"]":e+="["+c+"]",l=!1,c="";break;case"?":e+=ym;continue;case"*":e+=Ox(1);continue;default:e+=js(h)}}rvw(a,e)).filter(a=>a!==fs),s),i=t.length;if(!i)return fs;if(i===1)return t[0];let n=function(a,l){for(let c=0,h=t.length;c!!a.allBasenames);r&&(n.allBasenames=r.allBasenames);let o=t.reduce((a,l)=>l.allPaths?a.concat(l.allPaths):a,[]);return o.length&&(n.allPaths=o),n}function jx(s,e,t){let i=Rl===Ze.sep,n=i?s:s.replace(wA,Rl),r=Rl+n,o=Ze.sep+s,a=t?function(l,c){return typeof l=="string"&&(l===n||l.endsWith(r)||!i&&(l===s||l.endsWith(o)))?e:null}:function(l,c){return typeof l=="string"&&(l===n||!i&&l===s)?e:null};return a.allPaths=[(t?"*/":"./")+s],a}function kA(s){try{let e=new RegExp(`^${Fx(s)}$`);return function(t){return e.lastIndex=0,typeof t=="string"&&e.test(t)?s:null}}catch(e){return fs}}function Lm(s,e,t){return!s||typeof e!="string"?!1:IA(s)(e,void 0,t)}function IA(s,e={}){if(!s)return Wx;if(typeof s=="string"||NA(s)){let t=vw(s,e);if(t===fs)return Wx;let i=function(n,r){return!!t(n,r)};return t.allBasenames&&(i.allBasenames=t.allBasenames),t.allPaths&&(i.allPaths=t.allPaths),i}return TA(s,e)}function NA(s){let e=s;return e&&typeof e.base=="string"&&typeof e.pattern=="string"}function TA(s,e){let t=zx(Object.getOwnPropertyNames(s).map(a=>MA(a,s[a],e)).filter(a=>a!==fs)),i=t.length;if(!i)return fs;if(!t.some(a=>!!a.requiresSiblings)){if(i===1)return t[0];let a=function(h,d){for(let u=0,f=t.length;u!!h.allBasenames);l&&(a.allBasenames=l.allBasenames);let c=t.reduce((h,d)=>d.allPaths?h.concat(d.allPaths):h,[]);return c.length&&(a.allPaths=c),a}let n=function(a,l,c){let h;for(let d=0,u=t.length;d!!a.allBasenames);r&&(n.allBasenames=r.allBasenames);let o=t.reduce((a,l)=>l.allPaths?a.concat(l.allPaths):a,[]);return o.length&&(n.allPaths=o),n}function MA(s,e,t){if(e===!1)return fs;let i=vw(s,t);if(i===fs)return fs;if(typeof e=="boolean")return i;if(e){let n=e.when;if(typeof n=="string"){let r=(o,a,l,c)=>{if(!c||!i(o,a))return null;let h=n.replace("$(basename)",l),d=c(h);return ly(d)?d.then(u=>u?s:null):d?s:null};return r.requiresSiblings=!0,r}}return i}function zx(s,e){let t=s.filter(a=>!!a.basenames);if(t.length<2)return s;let i=t.reduce((a,l)=>{let c=l.basenames;return c?a.concat(c):a},[]),n;if(e){n=[];for(let a=0,l=i.length;a{let c=l.patterns;return c?a.concat(c):a},[]);let r=function(a,l){if(typeof a!="string")return null;if(!l){let h;for(h=a.length;h>0;h--){let d=a.charCodeAt(h-1);if(d===47||d===92)break}l=a.substr(h)}let c=i.indexOf(l);return c!==-1?n[c]:null};r.basenames=i,r.patterns=n,r.allBasenames=i;let o=s.filter(a=>!a.basenames);return o.push(r),o}function Sw(s,e,t,i){if(Array.isArray(s)){let n=0;for(let r of s){let o=Sw(r,e,t,i);if(o===10)return o;o>n&&(n=o)}return n}else{if(typeof s=="string")return i?s==="*"?5:s===t?10:0:0;if(s){let{language:n,pattern:r,scheme:o,hasAccessToAllModels:a}=s;if(!i&&!a)return 0;let l=0;if(o)if(o===e.scheme)l=10;else if(o==="*")l=5;else return 0;if(n)if(n===t)l=10;else if(n==="*")l=Math.max(l,5);else return 0;if(r){let c;if(typeof r=="string"?c=r:c=Object.assign(Object.assign({},r),{base:Ml(r.base)}),c===e.fsPath||Lm(c,e.fsPath))l=10;else return 0}return l}else return 0}}function Hx(s){return typeof s=="string"?!1:Array.isArray(s)?s.every(Hx):!!s.exclusive}var Ge=class{constructor(){this._clock=0,this._entries=[],this._onDidChange=new k}get onDidChange(){return this._onDidChange.event}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),oe(()=>{if(i){let 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);let t=[];for(let i of this._entries)i._score>0&&t.push(i.provider);return t}ordered(e){let t=[];return this._orderedForEach(e,i=>t.push(i.provider)),t}orderedGroups(e){let t=[],i,n;return this._orderedForEach(e,r=>{i&&n===r._score?i.push(r.provider):(n=r._score,i=[r.provider],t.push(i))}),t}_orderedForEach(e,t){if(!!e){this._updateScores(e);for(let i of this._entries)i._score>0&&t(i)}}_updateScores(e){let t={uri:e.uri.toString(),language:e.getLanguageIdentifier().language};if(!(this._lastCandidate&&this._lastCandidate.language===t.language&&this._lastCandidate.uri===t.uri)){this._lastCandidate=t;for(let i of this._entries)if(i._score=Sw(i.selector,e.uri,e.getLanguageIdentifier().language,$y(e)),Hx(i.selector)&&i._score>0){for(let n of this._entries)n._score=0;i._score=1e3;break}this._entries.sort(Ge._compareByScoreAndTime)}}static _compareByScoreAndTime(e,t){return e._scoret._score?-1:e._timet._time?-1:0}},RA=class{constructor(e,t,i=Number.MAX_SAFE_INTEGER){this._registry=e,this.min=t,this.max=i,this._cache=new Da(50,.7)}_key(e){return e.id+xx(this._registry.all(e))}_clamp(e){return e===void 0?this.min:Math.min(this.max,Math.max(this.min,Math.floor(e*1.3)))}get(e){let t=this._key(e),i=this._cache.get(t);return this._clamp(i==null?void 0:i.value)}update(e,t){let i=this._key(e),n=this._cache.get(i);return n||(n=new bw,this._cache.set(i,n)),n.update(t),this.get(e)}};var yw=class{constructor(){this._map=new Map,this._promises=new Map,this._onDidChange=new k,this.onDidChange=this._onDidChange.event,this._colorMap=null}fire(e){this._onDidChange.fire({changedLanguages:e,changedColorMap:!1})}register(e,t){return this._map.set(e,t),this.fire([e]),oe(()=>{this._map.get(e)===t&&(this._map.delete(e),this.fire([e]))})}registerPromise(e,t){let i=null,n=!1;return this._promises.set(e,t.then(r=>{this._promises.delete(e),!(n||!r)&&(i=this.register(e,r))})),oe(()=>{n=!0,i&&i.dispose()})}getPromise(e){let t=this.get(e);if(t)return Promise.resolve(t);let i=this._promises.get(e);return i?i.then(n=>this.get(e)):null}get(e){return this._map.get(e)||null}setColorMap(e){this._colorMap=e,this._onDidChange.fire({changedLanguages:Array.from(this._map.keys()),changedColorMap:!0})}getColorMap(){return this._colorMap}getDefaultBackground(){return this._colorMap&&this._colorMap.length>2?this._colorMap[2]:null}};var Ea=class{constructor(e,t){this.language=e,this.id=t}},mi=class{static getLanguageId(e){return(e&255)>>>0}static getTokenType(e){return(e&1792)>>>8}static getFontStyle(e){return(e&14336)>>>11}static getForeground(e){return(e&8372224)>>>14}static getBackground(e){return(e&4286578688)>>>23}static getClassNameFromMetadata(e){let t=this.getForeground(e),i="mtk"+t,n=this.getFontStyle(e);return n&1&&(i+=" mtki"),n&2&&(i+=" mtkb"),n&4&&(i+=" mtku"),i}static getInlineStyleFromMetadata(e,t){let i=this.getForeground(e),n=this.getFontStyle(e),r=`color: ${t[i]};`;return n&1&&(r+="font-style: italic;"),n&2&&(r+="font-weight: bold;"),n&4&&(r+="text-decoration: underline;"),r}},TV=function(){let s=Object.create(null);return s[0]="symbol-method",s[1]="symbol-function",s[2]="symbol-constructor",s[3]="symbol-field",s[4]="symbol-variable",s[5]="symbol-class",s[6]="symbol-struct",s[7]="symbol-interface",s[8]="symbol-module",s[9]="symbol-property",s[10]="symbol-event",s[11]="symbol-operator",s[12]="symbol-unit",s[13]="symbol-value",s[14]="symbol-constant",s[15]="symbol-enum",s[16]="symbol-enum-member",s[17]="symbol-keyword",s[27]="symbol-snippet",s[18]="symbol-text",s[19]="symbol-color",s[20]="symbol-file",s[21]="symbol-reference",s[22]="symbol-customcolor",s[23]="symbol-folder",s[24]="symbol-type-parameter",s[25]="account",s[26]="issues",function(e){let t=s[e],i=t&&Ul.get(t);return i||(console.info("No codicon found for CompletionItemKind "+e),i=Le.symbolProperty),i.classNames}}(),MV=function(){let s=Object.create(null);return s.method=0,s.function=1,s.constructor=2,s.field=3,s.variable=4,s.class=5,s.struct=6,s.interface=7,s.module=8,s.property=9,s.event=10,s.operator=11,s.unit=12,s.value=13,s.constant=14,s.enum=15,s["enum-member"]=16,s.enumMember=16,s.keyword=17,s.snippet=27,s.text=18,s.color=19,s.file=20,s.reference=21,s.customcolor=22,s.folder=23,s["type-parameter"]=24,s.typeParameter=24,s.account=25,s.issue=26,function(e,t){let i=s[e];return typeof i=="undefined"&&!t&&(i=9),i}}(),Ux;(function(s){s[s.Automatic=0]="Automatic",s[s.Explicit=1]="Explicit"})(Ux||(Ux={}));var $x;(function(s){s[s.Invoke=1]="Invoke",s[s.TriggerCharacter=2]="TriggerCharacter",s[s.ContentChange=3]="ContentChange"})($x||($x={}));var Kx;(function(s){s[s.Text=0]="Text",s[s.Read=1]="Read",s[s.Write=2]="Write"})(Kx||(Kx={}));function RV(s){return s&&K.isUri(s.uri)&&D.isIRange(s.range)&&(D.isIRange(s.originSelectionRange)||D.isIRange(s.targetSelectionRange))}var qx;(function(s){let e=new Map;e.set("file",0),e.set("module",1),e.set("namespace",2),e.set("package",3),e.set("class",4),e.set("method",5),e.set("property",6),e.set("field",7),e.set("constructor",8),e.set("enum",9),e.set("interface",10),e.set("function",11),e.set("variable",12),e.set("constant",13),e.set("string",14),e.set("number",15),e.set("boolean",16),e.set("array",17),e.set("object",18),e.set("key",19),e.set("null",20),e.set("enum-member",21),e.set("struct",22),e.set("event",23),e.set("operator",24),e.set("type-parameter",25);let t=new Map;t.set(0,"file"),t.set(1,"module"),t.set(2,"namespace"),t.set(3,"package"),t.set(4,"class"),t.set(5,"method"),t.set(6,"property"),t.set(7,"field"),t.set(8,"constructor"),t.set(9,"enum"),t.set(10,"interface"),t.set(11,"function"),t.set(12,"variable"),t.set(13,"constant"),t.set(14,"string"),t.set(15,"number"),t.set(16,"boolean"),t.set(17,"array"),t.set(18,"object"),t.set(19,"key"),t.set(20,"null"),t.set(21,"enum-member"),t.set(22,"struct"),t.set(23,"event"),t.set(24,"operator"),t.set(25,"type-parameter");function i(o){return e.get(o)}s.fromString=i;function n(o){return t.get(o)}s.toString=n;function r(o,a){let l=t.get(o),c=l&&Ul.get("symbol-"+l);return c||(console.info("No codicon found for SymbolKind "+o),c=Le.symbolProperty),`${a?"inline":"block"} ${c.classNames}`}s.toCssClassName=r})(qx||(qx={}));var Zs=class{constructor(e){this.value=e}};Zs.Comment=new Zs("comment");Zs.Imports=new Zs("imports");Zs.Region=new Zs("region");var Gx;(function(s){s[s.Other=0]="Other",s[s.Type=1]="Type",s[s.Parameter=2]="Parameter"})(Gx||(Gx={}));var cd=new Ge,hd=new Ge,ka=new Ge,Yx=new Ge,dd=new Ge,ud=new Ge,fd=new Ge,md=new Ge,Zx=new Ge,gd=new Ge,pd=new Ge,_d=new Ge,bd=new Ge,wd=new Ge,vd=new Ge,Cd=new Ge,ro=new Ge,Sn=new Ge,xm=new Ge,Dm=new Ge,Xx=new Ge,Qx=new Ge,Jx=new Ge,Ia=new Ge,Em=new Ge,Pe=new yw;var et=class{constructor(e,t){this._lineTokensBrand=void 0,this._tokens=e,this._tokensCount=this._tokens.length>>>1,this._text=t}static createEmpty(e){let t=et.defaultTokenMetadata,i=new Uint32Array(2);return i[0]=e.length,i[1]=t,new et(i,e)}equals(e){return e instanceof et?this.slicedEquals(e,0,this._tokensCount):!1}slicedEquals(e,t,i){if(this._text!==e._text||this._tokensCount!==e._tokensCount)return!1;let n=t<<1,r=n+(i<<1);for(let o=n;o0?this._tokens[e-1<<1]:0}getMetadata(e){return this._tokens[(e<<1)+1]}getLanguageId(e){let t=this._tokens[(e<<1)+1];return mi.getLanguageId(t)}getStandardTokenType(e){let t=this._tokens[(e<<1)+1];return mi.getTokenType(t)}getForeground(e){let t=this._tokens[(e<<1)+1];return mi.getForeground(t)}getClassName(e){let t=this._tokens[(e<<1)+1];return mi.getClassNameFromMetadata(t)}getInlineStyle(e,t){let i=this._tokens[(e<<1)+1];return mi.getInlineStyleFromMetadata(i,t)}getEndOffset(e){return this._tokens[e<<1]}findTokenIndexAtOffset(e){return et.findIndexInTokensArray(this._tokens,e)}inflate(){return this}sliceAndInflate(e,t,i){return new km(this,e,t,i)}static convertToEndOffset(e,t){let n=(e.length>>>1)-1;for(let r=0;r>>1)-1;for(;it&&(n=r)}return i}withInserted(e){if(e.length===0)return this;let t=0,i=0,n="",r=new Array,o=0;for(;;){let a=to){n+=this._text.substring(o,l.offset);let c=this._tokens[(t<<1)+1];r.push(n.length,c),o=l.offset}n+=l.text,r.push(n.length,l.tokenMetadata),i++}else break}return new et(new Uint32Array(r),n)}};et.defaultTokenMetadata=(0<<11|1<<14|2<<23)>>>0;var km=class{constructor(e,t,i,n){this._source=e,this._startOffset=t,this._endOffset=i,this._deltaOffset=n,this._firstTokenIndex=e.findTokenIndexAtOffset(t),this._tokensCount=0;for(let r=this._firstTokenIndex,o=e.getCount();r=i);r++)this._tokensCount++}equals(e){return e instanceof km?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}getForeground(e){return this._source.getForeground(this._firstTokenIndex+e)}getEndOffset(e){let 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)}findTokenIndexAtOffset(e){return this._source.findTokenIndexAtOffset(e+this._startOffset-this._deltaOffset)-this._firstTokenIndex}};function Xs(s){let e=0,t=0,i=0,n=0;for(let r=0,o=s.length;r>>0}var Qs=new Uint32Array(0).buffer,Sd=class{constructor(){this.tokens=[]}add(e,t){if(this.tokens.length>0){let i=this.tokens[this.tokens.length-1];if(i.startLineNumber+i.tokens.length-1+1===e){i.tokens.push(t);return}}this.tokens.push(new tD(e,[t]))}},tc=class{constructor(e){this._tokens=e,this._tokenCount=e.length/4}toString(e){let t=[];for(let i=0;ie)i=n-1;else{let o=n;for(;o>t&&this._getDeltaLine(o-1)===e;)o--;let a=n;for(;ae||u===e&&m>=t)&&(ue||m===e&&b>=t){if(mr?g-=r-i:g=i;else if(f===t&&m===i)if(f===n&&g>r)g-=r-i;else{h=!0;continue}else if(fr)f===t?(m=i,g=m+(g-r)):(m=0,g=m+(g-r));else{h=!0;continue}else if(f>n){if(l===0&&!h){c=a;break}f-=l}else if(f===n&&m>=r)e&&f===0&&(m+=e,g+=e),f-=l,m-=r-i,g-=r-i;else throw new Error("Not possible!");let w=4*c;o[w]=f,o[w+1]=m,o[w+2]=g,o[w+3]=b,c++}this._tokenCount=c}acceptInsertText(e,t,i,n,r,o){let a=i===0&&n===1&&(o>=48&&o<=57||o>=65&&o<=90||o>=97&&o<=122),l=this._tokens,c=this._tokenCount;for(let h=0;h0?t.charCodeAt(0):0)}acceptEdit(e,t,i,n,r){this._acceptDeleteRange(e),this._acceptInsertText(new N(e.startLineNumber,e.startColumn),t,i,n,r),this._updateEndLineNumber()}_acceptDeleteRange(e){if(e.startLineNumber===e.endLineNumber&&e.startColumn===e.endColumn)return;let t=e.startLineNumber-this.startLineNumber,i=e.endLineNumber-this.startLineNumber;if(i<0){let r=i-t;this.startLineNumber-=r;return}let n=this.tokens.getMaxDeltaLine();if(!(t>=n+1)){if(t<0&&i>=n+1){this.startLineNumber=0,this.tokens.clear();return}if(t<0){let r=-t;this.startLineNumber-=r,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,r){if(t===0&&i===0)return;let o=e.lineNumber-this.startLineNumber;if(o<0){this.startLineNumber+=t;return}let a=this.tokens.getMaxDeltaLine();o>=a+1||this.tokens.acceptInsertText(o,e.column-1,t,i,n,r)}},tD=class{constructor(e,t){this.startLineNumber=e,this.tokens=t}};function Js(s){return s instanceof Uint32Array?s:new Uint32Array(s)}var yd=class{constructor(){this._pieces=[],this._isComplete=!1}flush(){this._pieces=[],this._isComplete=!1}isEmpty(){return this._pieces.length===0}set(e,t){this._pieces=e||[],this._isComplete=t}setPartial(e,t){let i=e;if(t.length>0){let r=t[0].getRange(),o=t[t.length-1].getRange();if(!r||!o)return e;i=e.plusRange(r).plusRange(o)}let n=null;for(let r=0,o=this._pieces.length;ri.endLineNumber){n=n||{index:r};break}if(a.removeTokens(i),a.isEmpty()){this._pieces.splice(r,1),r--,o--;continue}if(a.endLineNumberi.endLineNumber){n=n||{index:r};continue}let[l,c]=a.split(i);if(l.isEmpty()){n=n||{index:r};continue}c.isEmpty()||(this._pieces.splice(r,1,l,c),r++,o++,n=n||{index:r})}return n=n||{index:this._pieces.length},t.length>0&&(this._pieces=no(this._pieces,n.index,t)),i}isComplete(){return this._isComplete}addSemanticTokens(e,t){let i=this._pieces;if(i.length===0)return t;let n=yd._findFirstPieceWithLine(i,e),r=i[n].getLineTokens(e);if(!r)return t;let o=t.getCount(),a=r.getCount(),l=0,c=[],h=0,d=0,u=(f,m)=>{f!==d&&(d=f,c[h++]=f,c[h++]=m)};for(let f=0;f>>0,_=~w>>>0;for(;lt)n=r-1;else{for(;r>i&&e[r-1].startLineNumber<=t&&t<=e[r-1].endLineNumber;)r--;return r}}return i}acceptEdit(e,t,i,n,r){for(let o of this._pieces)o.acceptEdit(e,t,i,n,r)}},Ai=class{constructor(){this._lineTokens=[],this._len=0}flush(){this._lineTokens=[],this._len=0}getTokens(e,t,i){let n=null;if(t1&&(r=mi.getLanguageId(n[1])!==e),!r)return Qs}if(!n||n.length===0){let r=new Uint32Array(2);return r[0]=t,r[1]=eD(e),r.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;let i=[];for(let n=0;n=this._len)return;if(e.startLineNumber===e.endLineNumber){if(e.startColumn===e.endColumn)return;this._lineTokens[t]=Ai._delete(this._lineTokens[t],e.startColumn-1,e.endColumn-1);return}this._lineTokens[t]=Ai._deleteEnding(this._lineTokens[t],e.startColumn-1);let i=e.endLineNumber-1,n=null;i=this._len)){if(t===0){this._lineTokens[n]=Ai._insert(this._lineTokens[n],e.column-1,i);return}this._lineTokens[n]=Ai._deleteEnding(this._lineTokens[n],e.column-1),this._lineTokens[n]=Ai._insert(this._lineTokens[n],e.column-1,i),this._insertLines(e.lineNumber,t)}}static _deleteBeginning(e,t){return e===null||e===Qs?e:Ai._delete(e,0,t)}static _deleteEnding(e,t){if(e===null||e===Qs)return e;let i=Js(e),n=i[i.length-2];return Ai._delete(e,t,n)}static _delete(e,t,i){if(e===null||e===Qs||t===i)return e;let n=Js(e),r=n.length>>>1;if(t===0&&n[n.length-2]===i)return Qs;let o=et.findIndexInTokensArray(n,t),a=o>0?n[o-1<<1]:0,l=n[o<<1];if(ih&&(n[c++]=m,n[c++]=n[(f<<1)+1],h=m)}if(c===n.length)return e;let u=new Uint32Array(c);return u.set(n.subarray(0,c),0),u.buffer}static _append(e,t){if(t===Qs)return e;if(e===Qs)return t;if(e===null)return e;if(t===null)return null;let i=Js(e),n=Js(t),r=n.length>>>1,o=new Uint32Array(i.length+n.length);o.set(i,0);let a=i.length,l=i[i.length-2];for(let c=0;c>>1,o=et.findIndexInTokensArray(n,t);o>0&&n[o-1<<1]===t&&o--;for(let a=o;ab.sortIndex-w.sortIndex)}this._mightContainRTL=n,this._mightContainUnusualLineTerminators=r,this._mightContainNonBasicASCII=o;let f=this._doApplyEdits(l),m=null;if(t&&d.length>0){d.sort((g,b)=>b.lineNumber-g.lineNumber),m=[];for(let g=0,b=d.length;g0&&d[g-1].lineNumber===w)continue;let _=d[g].oldContent,v=this.getLineContent(w);v.length===0||v===_||vt(v)!==-1||m.push(w)}}return this._onDidChangeContent.fire(),new qb(u,f,m)}_reduceOperations(e){return e.length<1e3?e:[this._toSingleEditOperation(e)]}_toSingleEditOperation(e){let t=!1,i=e[0].range,n=e[e.length-1].range,r=new D(i.startLineNumber,i.startColumn,n.endLineNumber,n.endColumn),o=i.startLineNumber,a=i.startColumn,l=[];for(let f=0,m=e.length;f0&&l.push(g.text),o=b.endLineNumber,a=b.endColumn}let c=l.join(""),[h,d,u]=Xs(c);return{sortIndex:0,identifier:e[0].identifier,range:r,rangeOffset:this.getOffsetAt(r.startLineNumber,r.startColumn),rangeLength:this.getValueLengthInRange(r,0),text:c,eolCount:h,firstLineLength:d,lastLineLength:u,forceMoveMarkers:t,isAutoWhitespaceEdit:!1}}_doApplyEdits(e){e.sort(er._sortOpsDescending);let t=[];for(let i=0;i0){let u=l.eolCount+1;u===1?d=new D(c,h,c,h+l.firstLineLength):d=new D(c,h,c+u-1,l.lastLineLength+1)}else d=new D(c,h,c,h);i=d.endLineNumber,n=d.endColumn,t.push(d),r=l}return t}static _sortOpsAscending(e,t){let i=D.compareRangesUsingEnds(e.range,t.range);return i===0?e.sortIndex-t.sortIndex:i}static _sortOpsDescending(e,t){let i=D.compareRangesUsingEnds(e.range,t.range);return i===0?t.sortIndex-e.sortIndex:-i}};var iD=class{constructor(e,t,i,n,r,o,a,l,c){this._chunks=e,this._bom=t,this._cr=i,this._lf=n,this._crlf=r,this._containsRTL=o,this._containsUnusualLineTerminators=a,this._isBasicASCII=l,this._normalizeEOL=c}_getEOL(e){let t=this._cr+this._lf+this._crlf,i=this._cr+this._crlf;return t===0?e===1?` +`:`\r +`:i>t/2?`\r +`:` +`}create(e){let 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 r=0,o=i.length;r=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){let t=mx(this._tmpLineStarts,e);this.chunks.push(new Gs(e,t.lineStarts)),this.cr+=t.cr,this.lf+=t.lf,this.crlf+=t.crlf,this.isBasicASCII&&(this.isBasicASCII=t.isBasicASCII),!this.isBasicASCII&&!this.containsRTL&&(this.containsRTL=Wl(e)),!this.isBasicASCII&&!this.containsUnusualLineTerminators&&(this.containsUnusualLineTerminators=tm(e))}finish(e=!0){return this._finish(),new iD(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;let e=this.chunks[this.chunks.length-1];e.buffer+=String.fromCharCode(this._previousChar);let t=us(e.buffer);e.lineStarts=t,this._previousChar===13&&this.cr++}}};var Dw=class{constructor(){this.changeType=1}},Si=class{constructor(e,t,i,n,r){this.ownerId=e,this.lineNumber=t,this.column=i,this.options=n,this.order=r}static applyInjectedText(e,t){if(!t||t.length===0)return e;let i="",n=0;for(let r of t)i+=e.substring(n,r.column-1),n=r.column-1,i+=r.options.content;return i+=e.substring(n),i}static fromDecorations(e){let t=[];for(let i of e)i.options.before&&i.options.before.content.length>0&&t.push(new Si(i.ownerId,i.range.startLineNumber,i.range.startColumn,i.options.before,0)),i.options.after&&i.options.after.content.length>0&&t.push(new Si(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}},Im=class{constructor(e,t,i){this.changeType=2,this.lineNumber=e,this.detail=t,this.injectedText=i}},Ew=class{constructor(e,t){this.changeType=3,this.fromLineNumber=e,this.toLineNumber=t}},kw=class{constructor(e,t,i,n){this.changeType=4,this.injectedTexts=n,this.fromLineNumber=e,this.toLineNumber=t,this.detail=i}},Iw=class{constructor(){this.changeType=5}},ms=class{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>>0,new oo(n,t===null?Ta:t)}var rD=class{constructor(){this._beginState=[],this._valid=[],this._len=0,this._invalidLineStartIndex=0}_reset(e){this._beginState=[],this._valid=[],this._len=0,this._invalidLineStartIndex=0,e&&this._setBeginState(0,e)}flush(e){this._reset(e)}get invalidLineStartIndex(){return this._invalidLineStartIndex}_invalidateLine(e){e=this._len;)this._beginState[this._len]=null,this._valid[this._len]=!1,this._len++}_deleteLines(e,t){t!==0&&(e+t>this._len&&(t=this._len-e),this._beginState.splice(e,t),this._valid.splice(e,t),this._len-=t)}_insertLines(e,t){if(t===0)return;let i=[],n=[];for(let r=0;r=0;o--)this._invalidateLine(e.startLineNumber+o-1);this._acceptDeleteRange(e),this._acceptInsertText(new N(e.startLineNumber,e.startColumn),t)}_acceptDeleteRange(e){e.startLineNumber-1>=this._len||this._deleteLines(e.startLineNumber,e.endLineNumber-e.startLineNumber)}_acceptInsertText(e,t){e.lineNumber-1>=this._len||this._insertLines(e.lineNumber,t)}},Nw=class extends M{constructor(e){super();this._isDisposed=!1,this._textModel=e,this._tokenizationStateStore=new rD,this._tokenizationSupport=null,this._register(Pe.onDidChange(t=>{let i=this._textModel.getLanguageIdentifier();t.changedLanguages.indexOf(i.language)!==-1&&(this._resetTokenizationState(),this._textModel.clearTokens())})),this._register(this._textModel.onDidChangeContentFast(t=>{if(t.isFlush){this._resetTokenizationState();return}for(let i=0,n=t.changes.length;i{this._beginBackgroundTokenization()})),this._register(this._textModel.onDidChangeLanguage(()=>{this._resetTokenizationState(),this._textModel.clearTokens()})),this._resetTokenizationState()}dispose(){this._isDisposed=!0,super.dispose()}_resetTokenizationState(){let[e,t]=AA(this._textModel);this._tokenizationSupport=e,this._tokenizationStateStore.flush(t),this._beginBackgroundTokenization()}_beginBackgroundTokenization(){this._textModel.isAttachedToEditor()&&this._hasLinesToTokenize()&&Xo(()=>{this._isDisposed||this._revalidateTokensNow()})}_revalidateTokensNow(e=this._textModel.getLineCount()){let t=1,i=new Sd,n=Nn.create(!1);for(;this._hasLinesToTokenize()&&!(n.elapsed()>t||this._tokenizeOneInvalidLine(i)>=e););this._beginBackgroundTokenization(),this._textModel.setTokens(i.tokens)}tokenizeViewport(e,t){let i=new Sd;this._tokenizeViewport(i,e,t),this._textModel.setTokens(i.tokens)}reset(){this._resetTokenizationState(),this._textModel.clearTokens()}forceTokenization(e){let t=new Sd;this._updateTokensUntilLine(t,e),this._textModel.setTokens(t.tokens)}isCheapToTokenize(e){if(!this._tokenizationSupport)return!0;let t=this._tokenizationStateStore.invalidLineStartIndex+1;return e>t?!1:e0&&c>=1;c--){let h=this._textModel.getLineFirstNonWhitespaceColumn(c);if(h!==0&&h=0;c--)l=Tw(a,this._tokenizationSupport,r[c],!1,l).endState;for(let c=t;c<=i;c++){let h=this._textModel.getLineContent(c),d=Tw(a,this._tokenizationSupport,h,!0,l);e.add(c,d.tokens),this._tokenizationStateStore.setFakeTokens(c-1),l=d.endState}}};function AA(s){let e=s.getLanguageIdentifier(),t=s.isTooLargeForTokenization()?null:Pe.get(e.language),i=null;if(t)try{i=t.getInitialState()}catch(n){de(n),t=null}return[t,i]}function Tw(s,e,t,i,n){let r=null;if(e)try{r=e.tokenize2(t,i,n.clone(),0)}catch(o){de(o)}return r||(r=Nm(s.id,t,n,0)),et.convertToEndOffset(r.tokens,t.length),r}var ft;(function(s){s[s.None=0]="None",s[s.Indent=1]="Indent",s[s.IndentOutdent=2]="IndentOutdent",s[s.Outdent=3]="Outdent"})(ft||(ft={}));var Dd=class{constructor(e){if(this._standardAutoClosingPairConditionalBrand=void 0,this.open=e.open,this.close=e.close,this._standardTokenMask=0,Array.isArray(e.notIn))for(let t=0,i=e.notIn.length;t0&&s.getLanguageId(o-1)===n;)o--;return new oD(s,n,o,r+1,s.getStartOffset(o),s.getEndOffset(r))}var oD=class{constructor(e,t,i,n,r,o){this._scopedLineTokensBrand=void 0,this._actual=e,this.languageId=t,this._firstTokenIndex=i,this._lastTokenIndex=n,this.firstCharOffset=r,this._lastCharOffset=o}getLineContent(){return this._actual.getLineContent().substring(this.firstCharOffset,this._lastCharOffset)}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)}};function yn(s){return(s&7)!=0}var ao=class{constructor(e){if(e.autoClosingPairs?this._autoClosingPairs=e.autoClosingPairs.map(t=>new Dd(t)):e.brackets?this._autoClosingPairs=e.brackets.map(t=>new Dd({open:t[0],close:t[1]})):this._autoClosingPairs=[],e.__electricCharacterSupport&&e.__electricCharacterSupport.docComment){let t=e.__electricCharacterSupport.docComment;this._autoClosingPairs.push(new Dd({open:t.open,close:t.close||""}))}this._autoCloseBefore=typeof e.autoCloseBefore=="string"?e.autoCloseBefore:ao.DEFAULT_AUTOCLOSE_BEFORE_LANGUAGE_DEFINED,this._surroundingPairs=e.surroundingPairs||this._autoClosingPairs}getAutoClosingPairs(){return this._autoClosingPairs}getAutoCloseBeforeSet(){return this._autoCloseBefore}static shouldAutoClosePair(e,t,i){if(t.getTokenCount()===0)return!0;let n=t.findTokenIndexAtOffset(i-2),r=t.getStandardTokenType(n);return e.isOK(r)}getSurroundingPairs(){return this._surroundingPairs}};ao.DEFAULT_AUTOCLOSE_BEFORE_LANGUAGE_DEFINED=`;:.,=}])> + `;var Id=class{constructor(e,t,i,n,r,o){this._richEditBracketBrand=void 0,this.languageIdentifier=e,this.index=t,this.open=i,this.close=n,this.forwardRegex=r,this.reversedRegex=o,this._openSet=Id._toSet(this.open),this._closeSet=Id._toSet(this.close)}isOpen(e){return this._openSet.has(e)}isClose(e){return this._closeSet.has(e)}static _toSet(e){let t=new Set;for(let i of e)t.add(i);return t}};function OA(s){let e=s.length;s=s.map(o=>[o[0].toLowerCase(),o[1].toLowerCase()]);let t=[];for(let o=0;o{let[l,c]=o,[h,d]=a;return l===h||l===d||c===h||c===d},n=(o,a)=>{let l=Math.min(o,a),c=Math.max(o,a);for(let h=0;h0&&r.push({open:a,close:l})}return r}var Rw=class{constructor(e,t){this._richEditBracketsBrand=void 0;let i=OA(t);this.brackets=i.map((n,r)=>new Id(e,r,n.open,n.close,PA(n.open,n.close,i,r),FA(n.open,n.close,i,r))),this.forwardRegex=BA(this.brackets),this.reversedRegex=WA(this.brackets),this.textIsBracket={},this.textIsOpenBracket={},this.maxBracketLength=0;for(let n of this.brackets){for(let r of n.open)this.textIsBracket[r]=n,this.textIsOpenBracket[r]=!0,this.maxBracketLength=Math.max(this.maxBracketLength,r.length);for(let r of n.close)this.textIsBracket[r]=n,this.textIsOpenBracket[r]=!1,this.maxBracketLength=Math.max(this.maxBracketLength,r.length)}}};function aD(s,e,t,i){for(let n=0,r=e.length;n=0&&i.push(a);for(let a of o.close)a.indexOf(s)>=0&&i.push(a)}}function lD(s,e){return s.length-e.length}function Tm(s){if(s.length<=1)return s;let e=[],t=new Set;for(let i of s)t.has(i)||(e.push(i),t.add(i));return e}function PA(s,e,t,i){let n=[];n=n.concat(s),n=n.concat(e);for(let r=0,o=n.length;r=0;o--)n[r++]=i.charCodeAt(o);return ew().decode(n)}else{let n=[],r=0;for(let o=i.length-1;o>=0;o--)n[r++]=i.charAt(o);return n.join("")}}let e=null,t=null;return function(n){return e!==n&&(e=n,t=s(e)),t}}(),Oi=class{static _findPrevBracketInText(e,t,i,n){let r=i.match(e);if(!r)return null;let o=i.length-(r.index||0),a=r[0].length,l=n+o;return new D(t,l-a+1,t,l+1)}static findPrevBracketInRange(e,t,i,n,r){let a=Aw(i).substring(i.length-r,i.length-n);return this._findPrevBracketInText(e,t,a,n)}static findNextBracketInText(e,t,i,n){let r=i.match(e);if(!r)return null;let o=r.index||0,a=r[0].length;if(a===0)return null;let l=n+o;return new D(t,l+1,t,l+1+a)}static findNextBracketInRange(e,t,i,n,r){let o=i.substring(n,r);return this.findNextBracketInText(e,t,o,n)}};var Ow=class{constructor(e){this._richEditBrackets=e}getElectricCharacters(){let e=[];if(this._richEditBrackets)for(let t of this._richEditBrackets.brackets)for(let i of t.close){let n=i.charAt(i.length-1);e.push(n)}return e=e.filter((t,i,n)=>n.indexOf(t)===i),e}onElectricCharacter(e,t,i){if(!this._richEditBrackets||this._richEditBrackets.brackets.length===0)return null;let n=t.findTokenIndexAtOffset(i-1);if(yn(t.getStandardTokenType(n)))return null;let r=this._richEditBrackets.reversedRegex,o=t.getLineContent().substring(0,i-1)+e,a=Oi.findPrevBracketInRange(r,1,o,0,o.length);if(!a)return null;let l=o.substring(a.startColumn-1,a.endColumn-1).toLowerCase();if(this._richEditBrackets.textIsOpenBracket[l])return null;let h=t.getActualLineContentBefore(a.startColumn-1);return/^\s*$/.test(h)?{matchOpenBracket:l}:null}};function Rm(s){return s.global&&(s.lastIndex=0),!0}var Pw=class{constructor(e){this._indentationRules=e}shouldIncrease(e){return!!(this._indentationRules&&this._indentationRules.increaseIndentPattern&&Rm(this._indentationRules.increaseIndentPattern)&&this._indentationRules.increaseIndentPattern.test(e))}shouldDecrease(e){return!!(this._indentationRules&&this._indentationRules.decreaseIndentPattern&&Rm(this._indentationRules.decreaseIndentPattern)&&this._indentationRules.decreaseIndentPattern.test(e))}shouldIndentNextLine(e){return!!(this._indentationRules&&this._indentationRules.indentNextLinePattern&&Rm(this._indentationRules.indentNextLinePattern)&&this._indentationRules.indentNextLinePattern.test(e))}shouldIgnore(e){return!!(this._indentationRules&&this._indentationRules.unIndentedLinePattern&&Rm(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}};var lo=class{constructor(e){e=e||{},e.brackets=e.brackets||[["(",")"],["{","}"],["[","]"]],this._brackets=[],e.brackets.forEach(t=>{let i=lo._createOpenBracketRegExp(t[0]),n=lo._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 r=0,o=this._regExpRules.length;rc.reg?(c.reg.lastIndex=0,c.reg.test(c.text)):!0))return a.action}if(e>=2&&i.length>0&&n.length>0)for(let r=0,o=this._brackets.length;r=2&&i.length>0){for(let r=0,o=this._brackets.length;r{for(let n=0;n{r.dispose(),this._onDidChange.fire(new Fw(e))})}_getRichEditSupport(e){let t=this._entries2.get(e);return t?t.getRichEditSupport():null}getIndentationRules(e){let t=this._getRichEditSupport(e);return t&&t.indentationRules||null}_getElectricCharacterSupport(e){let t=this._getRichEditSupport(e);return t&&t.electricCharacter||null}getElectricCharacters(e){let t=this._getElectricCharacterSupport(e);return t?t.getElectricCharacters():[]}onElectricCharacter(e,t,i){let n=kd(t,i-1),r=this._getElectricCharacterSupport(n.languageId);return r?r.onElectricCharacter(e,n,i-n.firstCharOffset):null}getComments(e){let t=this._getRichEditSupport(e);return t&&t.comments||null}_getCharacterPairSupport(e){let t=this._getRichEditSupport(e);return t&&t.characterPair||null}getAutoClosingPairs(e){let t=this._getCharacterPairSupport(e);return new Mw(t?t.getAutoClosingPairs():[])}getAutoCloseBeforeSet(e){let t=this._getCharacterPairSupport(e);return t?t.getAutoCloseBeforeSet():ao.DEFAULT_AUTOCLOSE_BEFORE_LANGUAGE_DEFINED}getSurroundingPairs(e){let t=this._getCharacterPairSupport(e);return t?t.getSurroundingPairs():[]}shouldAutoClosePair(e,t,i){let n=kd(t,i-1);return ao.shouldAutoClosePair(e,n,i-n.firstCharOffset)}getWordDefinition(e){let t=this._getRichEditSupport(e);return t?$h(t.wordDefinition||null):$h(null)}getFoldingRules(e){let t=this._getRichEditSupport(e);return t?t.foldingRules:{}}getIndentRulesSupport(e){let t=this._getRichEditSupport(e);return t&&t.indentRulesSupport||null}getPrecedingValidLine(e,t,i){let n=e.getLanguageIdAtPosition(t,0);if(t>1){let r,o=-1;for(r=t-1;r>=1;r--){if(e.getLanguageIdAtPosition(r,0)!==n)return o;let a=e.getLineContent(r);if(i.shouldIgnore(a)||/^\s+$/.test(a)||a===""){o=r;continue}return r}}return-1}getInheritIndentForLine(e,t,i,n=!0){if(e<4)return null;let r=this.getIndentRulesSupport(t.getLanguageIdentifier().id);if(!r)return null;if(i<=1)return{indentation:"",action:null};let o=this.getPrecedingValidLine(t,i,r);if(o<0)return null;if(o<1)return{indentation:"",action:null};let a=t.getLineContent(o);if(r.shouldIncrease(a)||r.shouldIndentNextLine(a))return{indentation:$t(a),action:ft.Indent,line:o};if(r.shouldDecrease(a))return{indentation:$t(a),action:null,line:o};{if(o===1)return{indentation:$t(t.getLineContent(o)),action:null,line:o};let l=o-1,c=r.getIndentMetadata(t.getLineContent(l));if(!(c&(1|2))&&c&4){let h=0;for(let d=l-1;d>0;d--)if(!r.shouldIndentNextLine(t.getLineContent(d))){h=d;break}return{indentation:$t(t.getLineContent(h+1)),action:null,line:h+1}}if(n)return{indentation:$t(t.getLineContent(o)),action:null,line:o};for(let h=o;h>0;h--){let d=t.getLineContent(h);if(r.shouldIncrease(d))return{indentation:$t(d),action:ft.Indent,line:h};if(r.shouldIndentNextLine(d)){let u=0;for(let f=h-1;f>0;f--)if(!r.shouldIndentNextLine(t.getLineContent(h))){u=f;break}return{indentation:$t(t.getLineContent(u+1)),action:null,line:u+1}}else if(r.shouldDecrease(d))return{indentation:$t(d),action:null,line:h}}return{indentation:$t(t.getLineContent(1)),action:null,line:1}}}getGoodIndentForLine(e,t,i,n,r){if(e<4)return null;let o=this._getRichEditSupport(i);if(!o)return null;let a=this.getIndentRulesSupport(i);if(!a)return null;let l=this.getInheritIndentForLine(e,t,n),c=t.getLineContent(n);if(l){let h=l.line;if(h!==void 0){let d=o.onEnter(e,"",t.getLineContent(h),"");if(d){let u=$t(t.getLineContent(h));return d.removeText&&(u=u.substring(0,u.length-d.removeText)),d.indentAction===ft.Indent||d.indentAction===ft.IndentOutdent?u=r.shiftIndent(u):d.indentAction===ft.Outdent&&(u=r.unshiftIndent(u)),a.shouldDecrease(c)&&(u=r.unshiftIndent(u)),d.appendText&&(u+=d.appendText),$t(u)}}return a.shouldDecrease(c)?l.action===ft.Indent?l.indentation:r.unshiftIndent(l.indentation):l.action===ft.Indent?r.shiftIndent(l.indentation):l.indentation}return null}getIndentForEnter(e,t,i,n){if(e<4)return null;t.forceTokenization(i.startLineNumber);let r=t.getLineTokens(i.startLineNumber),o=kd(r,i.startColumn-1),a=o.getLineContent(),l=!1,c;o.firstCharOffset>0&&r.getLanguageId(0)!==o.languageId?(l=!0,c=a.substr(0,i.startColumn-1-o.firstCharOffset)):c=r.getLineContent().substring(0,i.startColumn-1);let h;i.isEmpty()?h=a.substr(i.startColumn-1-o.firstCharOffset):h=this.getScopedLineTokens(t,i.endLineNumber,i.endColumn).getLineContent().substr(i.endColumn-1-o.firstCharOffset);let d=this.getIndentRulesSupport(o.languageId);if(!d)return null;let u=c,f=$t(c),m={getLineTokens:_=>t.getLineTokens(_),getLanguageIdentifier:()=>t.getLanguageIdentifier(),getLanguageIdAtPosition:(_,v)=>t.getLanguageIdAtPosition(_,v),getLineContent:_=>_===i.startLineNumber?u:t.getLineContent(_)},g=$t(r.getLineContent()),b=this.getInheritIndentForLine(e,m,i.startLineNumber+1);if(!b){let _=l?g:f;return{beforeEnter:_,afterEnter:_}}let w=l?g:b.indentation;return b.action===ft.Indent&&(w=n.shiftIndent(w)),d.shouldDecrease(h)&&(w=n.unshiftIndent(w)),{beforeEnter:l?g:f,afterEnter:w}}getIndentActionForType(e,t,i,n,r){if(e<4)return null;let o=this.getScopedLineTokens(t,i.startLineNumber,i.startColumn);if(o.firstCharOffset)return null;let a=this.getIndentRulesSupport(o.languageId);if(!a)return null;let l=o.getLineContent(),c=l.substr(0,i.startColumn-1-o.firstCharOffset),h;if(i.isEmpty()?h=l.substr(i.startColumn-1-o.firstCharOffset):h=this.getScopedLineTokens(t,i.endLineNumber,i.endColumn).getLineContent().substr(i.endColumn-1-o.firstCharOffset),!a.shouldDecrease(c+h)&&a.shouldDecrease(c+n+h)){let d=this.getInheritIndentForLine(e,t,i.startLineNumber,!1);if(!d)return null;let u=d.indentation;return d.action!==ft.Indent&&(u=r.unshiftIndent(u)),u}return null}getIndentMetadata(e,t){let i=this.getIndentRulesSupport(e.getLanguageIdentifier().id);return!i||t<1||t>e.getLineCount()?null:i.getIndentMetadata(e.getLineContent(t))}getEnterAction(e,t,i){let n=this.getScopedLineTokens(t,i.startLineNumber,i.startColumn),r=this._getRichEditSupport(n.languageId);if(!r)return null;let o=n.getLineContent(),a=o.substr(0,i.startColumn-1-n.firstCharOffset),l;i.isEmpty()?l=o.substr(i.startColumn-1-n.firstCharOffset):l=this.getScopedLineTokens(t,i.endLineNumber,i.endColumn).getLineContent().substr(i.endColumn-1-n.firstCharOffset);let c="";if(i.startLineNumber>1&&n.firstCharOffset===0){let g=this.getScopedLineTokens(t,i.startLineNumber-1);g.languageId===n.languageId&&(c=g.getLineContent())}let h=r.onEnter(e,c,a,l);if(!h)return null;let d=h.indentAction,u=h.appendText,f=h.removeText||0;u?d===ft.Indent&&(u=" "+u):d===ft.Indent||d===ft.IndentOutdent?u=" ":u="";let m=this.getIndentationAtPosition(t,i.startLineNumber,i.startColumn);return f&&(m=m.substring(0,m.length-f)),{indentAction:d,appendText:u,removeText:f,indentation:m}}getIndentationAtPosition(e,t,i){let n=e.getLineContent(t),r=$t(n);return r.length>i-1&&(r=r.substring(0,i-1)),r}getScopedLineTokens(e,t,i){e.forceTokenization(t);let n=e.getLineTokens(t),r=typeof i=="undefined"?e.getLineMaxColumn(t)-1:i-1;return kd(n,r)}getBracketsSupport(e){let t=this._getRichEditSupport(e);return t&&t.brackets||null}},xe=new hD;function co(s,e){let t=Math.pow(10,e);return Math.round(s*t)/t}var ge=class{constructor(e,t,i,n=1){this._rgbaBrand=void 0,this.r=Math.min(255,Math.max(0,e))|0,this.g=Math.min(255,Math.max(0,t))|0,this.b=Math.min(255,Math.max(0,i))|0,this.a=co(Math.max(Math.min(1,n),0),3)}static equals(e,t){return e.r===t.r&&e.g===t.g&&e.b===t.b&&e.a===t.a}},Ln=class{constructor(e,t,i,n){this._hslaBrand=void 0,this.h=Math.max(Math.min(360,e),0)|0,this.s=co(Math.max(Math.min(1,t),0),3),this.l=co(Math.max(Math.min(1,i),0),3),this.a=co(Math.max(Math.min(1,n),0),3)}static equals(e,t){return e.h===t.h&&e.s===t.s&&e.l===t.l&&e.a===t.a}static fromRGBA(e){let t=e.r/255,i=e.g/255,n=e.b/255,r=e.a,o=Math.max(t,i,n),a=Math.min(t,i,n),l=0,c=0,h=(a+o)/2,d=o-a;if(d>0){switch(c=Math.min(h<=.5?d/(2*h):d/(2-2*h),1),o){case t:l=(i-n)/d+(i1&&(i-=1),i<1/6?e+(t-e)*6*i:i<1/2?t:i<2/3?e+(t-e)*(2/3-i)*6:e}static toRGBA(e){let t=e.h/360,{s:i,l:n,a:r}=e,o,a,l;if(i===0)o=a=l=n;else{let c=n<.5?n*(1+i):n+i-n*i,h=2*n-c;o=Ln._hue2rgb(h,c,t+1/3),a=Ln._hue2rgb(h,c,t),l=Ln._hue2rgb(h,c,t-1/3)}return new ge(Math.round(o*255),Math.round(a*255),Math.round(l*255),r)}},Ra=class{constructor(e,t,i,n){this._hsvaBrand=void 0,this.h=Math.max(Math.min(360,e),0)|0,this.s=co(Math.max(Math.min(1,t),0),3),this.v=co(Math.max(Math.min(1,i),0),3),this.a=co(Math.max(Math.min(1,n),0),3)}static equals(e,t){return e.h===t.h&&e.s===t.s&&e.v===t.v&&e.a===t.a}static fromRGBA(e){let t=e.r/255,i=e.g/255,n=e.b/255,r=Math.max(t,i,n),o=Math.min(t,i,n),a=r-o,l=r===0?0:a/r,c;return a===0?c=0:r===t?c=((i-n)/a%6+6)%6:r===i?c=(n-t)/a+2:c=(t-i)/a+4,new Ra(Math.round(c*60),l,r,e.a)}static toRGBA(e){let{h:t,s:i,v:n,a:r}=e,o=n*i,a=o*(1-Math.abs(t/60%2-1)),l=n-o,[c,h,d]=[0,0,0];return t<60?(c=o,h=a):t<120?(c=a,h=o):t<180?(h=o,d=a):t<240?(h=a,d=o):t<300?(c=a,d=o):t<=360&&(c=o,d=a),c=Math.round((c+l)*255),h=Math.round((h+l)*255),d=Math.round((d+l)*255),new ge(c,h,d,r)}},A=class{constructor(e){if(e)if(e instanceof ge)this.rgba=e;else if(e instanceof Ln)this._hsla=e,this.rgba=Ln.toRGBA(e);else if(e instanceof Ra)this._hsva=e,this.rgba=Ra.toRGBA(e);else throw new Error("Invalid color ctor argument");else throw new Error("Color needs a value")}static fromHex(e){return A.Format.CSS.parseHex(e)||A.red}get hsla(){return this._hsla?this._hsla:Ln.fromRGBA(this.rgba)}get hsva(){return this._hsva?this._hsva:Ra.fromRGBA(this.rgba)}equals(e){return!!e&&ge.equals(this.rgba,e.rgba)&&Ln.equals(this.hsla,e.hsla)&&Ra.equals(this.hsva,e.hsva)}getRelativeLuminance(){let e=A._relativeLuminanceForComponent(this.rgba.r),t=A._relativeLuminanceForComponent(this.rgba.g),i=A._relativeLuminanceForComponent(this.rgba.b),n=.2126*e+.7152*t+.0722*i;return co(n,4)}static _relativeLuminanceForComponent(e){let t=e/255;return t<=.03928?t/12.92:Math.pow((t+.055)/1.055,2.4)}isLighter(){return(this.rgba.r*299+this.rgba.g*587+this.rgba.b*114)/1e3>=128}isLighterThan(e){let t=this.getRelativeLuminance(),i=e.getRelativeLuminance();return t>i}isDarkerThan(e){let t=this.getRelativeLuminance(),i=e.getRelativeLuminance();return t0&&(e[t++]=n,i+=n.length),i>=64*1024)return e.join("")}while(!0)}},Nd=()=>{throw new Error("Invalid change accessor")},gs=class{constructor(){this._searchCanceledBrand=void 0}};gs.INSTANCE=new gs;function Pm(s){return s instanceof gs?null:s}var qt=class extends M{constructor(e,t,i,n=null,r){super();this._onWillDispose=this._register(new k),this.onWillDispose=this._onWillDispose.event,this._onDidChangeDecorations=this._register(new _D(h=>this.handleBeforeFireDecorationsChangedEvent(h))),this.onDidChangeDecorations=this._onDidChangeDecorations.event,this._onDidChangeLanguage=this._register(new k),this.onDidChangeLanguage=this._onDidChangeLanguage.event,this._onDidChangeLanguageConfiguration=this._register(new k),this.onDidChangeLanguageConfiguration=this._onDidChangeLanguageConfiguration.event,this._onDidChangeTokens=this._register(new k),this.onDidChangeTokens=this._onDidChangeTokens.event,this._onDidChangeOptions=this._register(new k),this.onDidChangeOptions=this._onDidChangeOptions.event,this._onDidChangeAttached=this._register(new k),this.onDidChangeAttached=this._onDidChangeAttached.event,this._onDidChangeContentOrInjectedText=this._register(new k),this.onDidChangeContentOrInjectedText=this._onDidChangeContentOrInjectedText.event,this._eventEmitter=this._register(new bD),this._register(this._eventEmitter.fastEvent(h=>{this._onDidChangeContentOrInjectedText.fire(h.rawContentChangedEvent)})),Om++,this.id="$model"+Om,this.isForSimpleWidget=t.isForSimpleWidget,typeof n=="undefined"||n===null?this._associatedResource=K.parse("inmemory://model/"+Om):this._associatedResource=n,this._undoRedoService=r,this._attachedEditorCount=0;let{textBuffer:o,disposable:a}=dD(e,t.defaultEOL);this._buffer=o,this._bufferDisposable=a,this._options=qt.resolveOptions(this._buffer,t);let l=this._buffer.getLineCount(),c=this._buffer.getValueLengthInRange(new D(1,1,l,this._buffer.getLineLength(l)+1),0);t.largeFileOptimizations?this._isTooLargeForTokenization=c>qt.LARGE_FILE_SIZE_THRESHOLD||l>qt.LARGE_FILE_LINE_COUNT_THRESHOLD:this._isTooLargeForTokenization=!1,this._isTooLargeForSyncing=c>qt.MODEL_SYNC_LIMIT,this._versionId=1,this._alternativeVersionId=1,this._initialUndoRedoSnapshot=null,this._isDisposed=!1,this._isDisposing=!1,this._languageIdentifier=i||Ma,this._languageRegistryListener=xe.onDidChange(h=>{h.languageIdentifier.id===this._languageIdentifier.id&&this._onDidChangeLanguageConfiguration.fire({})}),this._instanceId=im(Om),this._lastDecorationId=0,this._decorations=Object.create(null),this._decorationsTree=new jw,this._commandManager=new Yh(this,r),this._isUndoing=!1,this._isRedoing=!1,this._trimAutoWhitespaceLines=null,this._tokens=new Ai,this._tokens2=new yd,this._tokenization=new Nw(this)}static resolveOptions(e,t){if(t.detectIndentation){let i=ow(e,t.tabSize,t.insertSpaces);return new Ca({tabSize:i.tabSize,indentSize:i.tabSize,insertSpaces:i.insertSpaces,trimAutoWhitespace:t.trimAutoWhitespace,defaultEOL:t.defaultEOL})}return new Ca({tabSize:t.tabSize,indentSize:t.indentSize,insertSpaces:t.insertSpaces,trimAutoWhitespace:t.trimAutoWhitespace,defaultEOL:t.defaultEOL})}onDidChangeContentFast(e){return this._eventEmitter.fastEvent(t=>e(t.contentChangedEvent))}onDidChangeContent(e){return this._eventEmitter.slowEvent(t=>e(t.contentChangedEvent))}dispose(){this._isDisposing=!0,this._onWillDispose.fire(),this._languageRegistryListener.dispose(),this._tokenization.dispose(),this._isDisposed=!0,super.dispose(),this._bufferDisposable.dispose(),this._isDisposing=!1;let e=new er([],"",` +`,!1,!1,!0,!0);e.dispose(),this._buffer=e}_assertNotDisposed(){if(this._isDisposed)throw new Error("Model is disposed!")}_emitContentChangedEvent(e,t){this._isDisposing||this._eventEmitter.fire(new nc(e,t))}setValue(e){if(this._assertNotDisposed(),e===null)return;let{textBuffer:t,disposable:i}=dD(e,this._options.defaultEOL);this._setValueFromTextBuffer(t,i)}_createContentChanged2(e,t,i,n,r,o,a){return{changes:[{range:e,rangeOffset:t,rangeLength:i,text:n}],eol:this._buffer.getEOL(),versionId:this.getVersionId(),isUndoing:r,isRedoing:o,isFlush:a}}_setValueFromTextBuffer(e,t){this._assertNotDisposed();let i=this.getFullModelRange(),n=this.getValueLengthInRange(i),r=this.getLineCount(),o=this.getLineMaxColumn(r);this._buffer=e,this._bufferDisposable.dispose(),this._bufferDisposable=t,this._increaseVersionId(),this._tokens.flush(),this._tokens2.flush(),this._decorations=Object.create(null),this._decorationsTree=new jw,this._commandManager.clear(),this._trimAutoWhitespaceLines=null,this._emitContentChangedEvent(new ms([new Dw],this._versionId,!1,!1),this._createContentChanged2(new D(1,1,r,o),0,n,this.getValue(),!1,!1,!0))}setEOL(e){this._assertNotDisposed();let t=e===1?`\r +`:` +`;if(this._buffer.getEOL()===t)return;let i=this.getFullModelRange(),n=this.getValueLengthInRange(i),r=this.getLineCount(),o=this.getLineMaxColumn(r);this._onBeforeEOLChange(),this._buffer.setEOL(t),this._increaseVersionId(),this._onAfterEOLChange(),this._emitContentChangedEvent(new ms([new Iw],this._versionId,!1,!1),this._createContentChanged2(new D(1,1,r,o),0,n,this.getValue(),!1,!1,!1))}_onBeforeEOLChange(){this._decorationsTree.ensureAllNodesHaveRanges(this)}_onAfterEOLChange(){let e=this.getVersionId(),t=this._decorationsTree.collectNodesPostOrder();for(let i=0,n=t.length;i0}getAttachedEditorCount(){return this._attachedEditorCount}isTooLargeForSyncing(){return this._isTooLargeForSyncing}isTooLargeForTokenization(){return this._isTooLargeForTokenization}isDisposed(){return this._isDisposed}isDominatedByLongLines(){if(this._assertNotDisposed(),this.isTooLargeForTokenization())return!1;let e=0,t=0,i=this._buffer.getLineCount();for(let n=1;n<=i;n++){let r=this._buffer.getLineLength(n);r>=UA?t+=r:e+=r}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();let t=typeof e.tabSize!="undefined"?e.tabSize:this._options.tabSize,i=typeof e.indentSize!="undefined"?e.indentSize:this._options.indentSize,n=typeof e.insertSpaces!="undefined"?e.insertSpaces:this._options.insertSpaces,r=typeof e.trimAutoWhitespace!="undefined"?e.trimAutoWhitespace:this._options.trimAutoWhitespace,o=new Ca({tabSize:t,indentSize:i,insertSpaces:n,defaultEOL:this._options.defaultEOL,trimAutoWhitespace:r});if(this._options.equals(o))return;let a=this._options.createChangeEvent(o);this._options=o,this._onDidChangeOptions.fire(a)}detectIndentation(e,t){this._assertNotDisposed();let i=ow(this._buffer,t,e);this.updateOptions({insertSpaces:i.insertSpaces,tabSize:i.tabSize,indentSize:i.tabSize})}static _normalizeIndentationFromWhitespace(e,t,i){let n=0;for(let o=0;o({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();let t=this._validatePosition(e.lineNumber,e.column,0);return this._buffer.getOffsetAt(t.lineNumber,t.column)}getPositionAt(e){this._assertNotDisposed();let 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){this._assertNotDisposed();let i=this.getFullModelRange(),n=this.getValueInRange(i,e);return t?this._buffer.getBOM()+n:n}createSnapshot(e=!1){return new uD(this._buffer.createSnapshot(e))}getValueLength(e,t=!1){this._assertNotDisposed();let 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 Error("Illegal value for lineNumber");return this._buffer.getLineContent(e)}getLineLength(e){if(this._assertNotDisposed(),e<1||e>this.getLineCount())throw new Error("Illegal value for lineNumber");return this._buffer.getLineLength(e)}getLinesContent(){return this._assertNotDisposed(),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 Error("Illegal value for lineNumber");return this._buffer.getLineLength(e)+1}getLineFirstNonWhitespaceColumn(e){if(this._assertNotDisposed(),e<1||e>this.getLineCount())throw new Error("Illegal value for lineNumber");return this._buffer.getLineFirstNonWhitespaceColumn(e)}getLineLastNonWhitespaceColumn(e){if(this._assertNotDisposed(),e<1||e>this.getLineCount())throw new Error("Illegal value for lineNumber");return this._buffer.getLineLastNonWhitespaceColumn(e)}_validateRangeRelaxedNoAllocations(e){let t=this._buffer.getLineCount(),i=e.startLineNumber,n=e.startColumn,r=Math.floor(typeof i=="number"&&!isNaN(i)?i:1),o=Math.floor(typeof n=="number"&&!isNaN(n)?n:1);if(r<1)r=1,o=1;else if(r>t)r=t,o=this.getLineMaxColumn(r);else if(o<=1)o=1;else{let d=this.getLineMaxColumn(r);o>=d&&(o=d)}let a=e.endLineNumber,l=e.endColumn,c=Math.floor(typeof a=="number"&&!isNaN(a)?a:1),h=Math.floor(typeof l=="number"&&!isNaN(l)?l:1);if(c<1)c=1,h=1;else if(c>t)c=t,h=this.getLineMaxColumn(c);else if(h<=1)h=1;else{let d=this.getLineMaxColumn(c);h>=d&&(h=d)}return i===r&&n===o&&a===c&&l===h&&e instanceof D&&!(e instanceof Z)?e:new D(r,o,c,h)}_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;let n=this._buffer.getLineCount();if(e>n)return!1;if(t===1)return!0;let r=this.getLineMaxColumn(e);if(t>r)return!1;if(i===1){let o=this._buffer.getLineCharCode(e,t-2);if(Xe(o))return!1}return!0}_validatePosition(e,t,i){let n=Math.floor(typeof e=="number"&&!isNaN(e)?e:1),r=Math.floor(typeof t=="number"&&!isNaN(t)?t:1),o=this._buffer.getLineCount();if(n<1)return new N(1,1);if(n>o)return new N(o,this.getLineMaxColumn(o));if(r<=1)return new N(n,1);let a=this.getLineMaxColumn(n);if(r>=a)return new N(n,a);if(i===1){let l=this._buffer.getLineCharCode(n,r-2);if(Xe(l))return new N(n,r-1)}return new N(n,r)}validatePosition(e){let t=1;return this._assertNotDisposed(),e instanceof N&&this._isValidPosition(e.lineNumber,e.column,t)?e:this._validatePosition(e.lineNumber,e.column,t)}_isValidRange(e,t){let i=e.startLineNumber,n=e.startColumn,r=e.endLineNumber,o=e.endColumn;if(!this._isValidPosition(i,n,0)||!this._isValidPosition(r,o,0))return!1;if(t===1){let a=n>1?this._buffer.getLineCharCode(i,n-2):0,l=o>1&&o<=this._buffer.getLineLength(r)?this._buffer.getLineCharCode(r,o-2):0,c=Xe(a),h=Xe(l);return!c&&!h}return!0}validateRange(e){let t=1;if(this._assertNotDisposed(),e instanceof D&&!(e instanceof Z)&&this._isValidRange(e,t))return e;let i=this._validatePosition(e.startLineNumber,e.startColumn,0),n=this._validatePosition(e.endLineNumber,e.endColumn,0),r=i.lineNumber,o=i.column,a=n.lineNumber,l=n.column;if(t===1){let c=o>1?this._buffer.getLineCharCode(r,o-2):0,h=l>1&&l<=this._buffer.getLineLength(a)?this._buffer.getLineCharCode(a,l-2):0,d=Xe(c),u=Xe(h);return!d&&!u?new D(r,o,a,l):r===a&&o===l?new D(r,o-1,a,l-1):d&&u?new D(r,o-1,a,l+1):d?new D(r,o-1,a,l):new D(r,o,a,l+1)}return new D(r,o,a,l)}modifyPosition(e,t){this._assertNotDisposed();let i=this.getOffsetAt(e)+t;return this.getPositionAt(Math.min(this._buffer.getLength(),Math.max(0,i)))}getFullModelRange(){this._assertNotDisposed();let e=this.getLineCount();return new D(1,1,e,this.getLineMaxColumn(e))}findMatchesLineByLine(e,t,i,n){return this._buffer.findMatchesLineByLine(e,t,i,n)}findMatches(e,t,i,n,r,o,a=HA){this._assertNotDisposed();let l=null;t!==null&&(Array.isArray(t)||(t=[t]),t.every(d=>D.isIRange(d))&&(l=t.map(d=>this.validateRange(d)))),l===null&&(l=[this.getFullModelRange()]),l=l.sort((d,u)=>d.startLineNumber-u.startLineNumber||d.startColumn-u.startColumn);let c=[];c.push(l.reduce((d,u)=>D.areIntersecting(d,u)?d.plusRange(u):(c.push(d),u)));let h;if(!i&&e.indexOf(` +`)<0){let u=new to(e,i,n,r).parseSearchRequest();if(!u)return[];h=f=>this.findMatchesLineByLine(f,u,o,a)}else h=d=>Jl.findMatches(this,new to(e,i,n,r),d,o,a);return c.map(h).reduce((d,u)=>d.concat(u),[])}findNextMatch(e,t,i,n,r,o){this._assertNotDisposed();let a=this.validatePosition(t);if(!i&&e.indexOf(` +`)<0){let c=new to(e,i,n,r).parseSearchRequest();if(!c)return null;let h=this.getLineCount(),d=new D(a.lineNumber,a.column,h,this.getLineMaxColumn(h)),u=this.findMatchesLineByLine(d,c,o,1);return Jl.findNextMatch(this,new to(e,i,n,r),a,o),u.length>0||(d=new D(1,1,a.lineNumber,this.getLineMaxColumn(a.lineNumber)),u=this.findMatchesLineByLine(d,c,o,1),u.length>0)?u[0]:null}return Jl.findNextMatch(this,new to(e,i,n,r),a,o)}findPreviousMatch(e,t,i,n,r,o){this._assertNotDisposed();let a=this.validatePosition(t);return Jl.findPreviousMatch(this,new to(e,i,n,r),a,o)}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){return e instanceof qh?e:new qh(e.identifier||null,this.validateRange(e.range),e.text,e.forceMoveMarkers||!1,e.isAutoWhitespaceEdit||!1,e._isTracked||!1)}_validateEditOperations(e){let t=[];for(let i=0,n=e.length;i({range:this.validateRange(o.range),text:o.text})),r=!0;if(e)for(let o=0,a=e.length;ol.endLineNumber,m=l.startLineNumber>u.endLineNumber;if(!f&&!m){c=!0;break}}if(!c){r=!1;break}}if(r)for(let o=0,a=this._trimAutoWhitespaceLines.length;of.endLineNumber)&&!(l===f.startLineNumber&&f.startColumn===c&&f.isEmpty()&&m&&m.length>0&&m.charAt(0)===` +`)&&!(l===f.startLineNumber&&f.startColumn===1&&f.isEmpty()&&m&&m.length>0&&m.charAt(m.length-1)===` +`)){h=!1;break}}if(h){let d=new D(l,1,l,c);t.push(new qh(null,d,null,!1,!1,!1))}}this._trimAutoWhitespaceLines=null}return this._initialUndoRedoSnapshot===null&&(this._initialUndoRedoSnapshot=this._undoRedoService.createSnapshot(this.uri)),this._commandManager.pushEditOperation(e,t,i)}_applyUndo(e,t,i,n){let r=e.map(o=>{let a=this.getPositionAt(o.newPosition),l=this.getPositionAt(o.newEnd);return{range:new D(a.lineNumber,a.column,l.lineNumber,l.column),text:o.oldText}});this._applyUndoRedoEdits(r,t,!0,!1,i,n)}_applyRedo(e,t,i,n){let r=e.map(o=>{let a=this.getPositionAt(o.oldPosition),l=this.getPositionAt(o.oldEnd);return{range:new D(a.lineNumber,a.column,l.lineNumber,l.column),text:o.newText}});this._applyUndoRedoEdits(r,t,!1,!0,i,n)}_applyUndoRedoEdits(e,t,i,n,r,o){try{this._onDidChangeDecorations.beginDeferredEmit(),this._eventEmitter.beginDeferredEmit(),this._isUndoing=i,this._isRedoing=n,this.applyEdits(e,!1),this.setEOL(t),this._overwriteAlternativeVersionId(r)}finally{this._isUndoing=!1,this._isRedoing=!1,this._eventEmitter.endDeferredEmit(o),this._onDidChangeDecorations.endDeferredEmit()}}applyEdits(e,t=!1){try{this._onDidChangeDecorations.beginDeferredEmit(),this._eventEmitter.beginDeferredEmit();let i=this._validateEditOperations(e);return this._doApplyEdits(i,t)}finally{this._eventEmitter.endDeferredEmit(),this._onDidChangeDecorations.endDeferredEmit()}}_doApplyEdits(e,t){let i=this._buffer.getLineCount(),n=this._buffer.applyEdits(e,this._options.trimAutoWhitespace,t),r=this._buffer.getLineCount(),o=n.changes;if(this._trimAutoWhitespaceLines=n.trimAutoWhitespaceLineNumbers,o.length!==0){for(let c=0,h=o.length;c0?d.text.charCodeAt(0):0),this._decorationsTree.acceptReplace(d.rangeOffset,d.rangeLength,d.text.length,d.forceMoveMarkers)}let a=[];this._increaseVersionId();let l=i;for(let c=0,h=o.length;c=0;E--){let T=f+E,I=v+E;L.takeFromEndWhile(B=>B.lineNumber>I);let P=L.takeFromEndWhile(B=>B.lineNumber===I);a.push(new Im(T,this.getLineContent(I),P))}if(whe.lineNumberhe.lineNumber===se)}a.push(new kw(T+1,f+b,Q,B))}l+=_}this._emitContentChangedEvent(new ms(a,this.getVersionId(),this._isUndoing,this._isRedoing),{changes:o,eol:this._buffer.getEOL(),versionId:this.getVersionId(),isUndoing:this._isUndoing,isRedoing:this._isRedoing,isFlush:!1})}return n.reverseEdits===null?void 0:n.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){if(e===null||e.size===0)return;let i=[...e].map(n=>new Im(n,this.getLineContent(n),this._getInjectedTextInLine(n)));this._onDidChangeContentOrInjectedText.fire(new Ld(i))}changeDecorations(e,t=0){this._assertNotDisposed();try{return this._onDidChangeDecorations.beginDeferredEmit(),this._changeDecorations(t,e)}finally{this._onDidChangeDecorations.endDeferredEmit()}}_changeDecorations(e,t){let i={addDecoration:(r,o)=>this._deltaDecorationsImpl(e,[],[{range:r,options:o}])[0],changeDecoration:(r,o)=>{this._changeDecorationImpl(r,o)},changeDecorationOptions:(r,o)=>{this._changeDecorationOptionsImpl(r,pD(o))},removeDecoration:r=>{this._deltaDecorationsImpl(e,[r],[])},deltaDecorations:(r,o)=>r.length===0&&o.length===0?[]:this._deltaDecorationsImpl(e,r,o)},n=null;try{n=t(i)}catch(r){de(r)}return i.addDecoration=Nd,i.changeDecoration=Nd,i.changeDecorationOptions=Nd,i.removeDecoration=Nd,i.deltaDecorations=Nd,n}deltaDecorations(e,t,i=0){if(this._assertNotDisposed(),e||(e=[]),e.length===0&&t.length===0)return[];try{return this._onDidChangeDecorations.beginDeferredEmit(),this._deltaDecorationsImpl(i,e,t)}finally{this._onDidChangeDecorations.endDeferredEmit()}}_getTrackedRange(e){return this.getDecorationRange(e)}_setTrackedRange(e,t,i){let n=e?this._decorations[e]:null;if(!n)return t?this._deltaDecorationsImpl(0,[],[{range:t,options:gD[i]}])[0]:null;if(!t)return this._decorationsTree.delete(n),delete this._decorations[n.id],null;let r=this._validateRangeRelaxedNoAllocations(t),o=this._buffer.getOffsetAt(r.startLineNumber,r.startColumn),a=this._buffer.getOffsetAt(r.endLineNumber,r.endColumn);return this._decorationsTree.delete(n),n.reset(this.getVersionId(),o,a,r),n.setOptions(gD[i]),this._decorationsTree.insert(n),n.id}removeAllDecorationsWithOwnerId(e){if(this._isDisposed)return;let t=this._decorationsTree.collectNodesFromOwner(e);for(let i=0,n=t.length;ithis.getLineCount()?[]:this.getLinesDecorations(e,e,t,i)}getLinesDecorations(e,t,i=0,n=!1){let r=this.getLineCount(),o=Math.min(r,Math.max(1,e)),a=Math.min(r,Math.max(1,t)),l=this.getLineMaxColumn(a);return this._getDecorationsInRange(new D(o,1,a,l),i,n)}getDecorationsInRange(e,t=0,i=!1){let n=this.validateRange(e);return this._getDecorationsInRange(n,t,i)}getOverviewRulerDecorations(e=0,t=!1){return this._decorationsTree.getAll(this,e,t,!0)}getInjectedTextDecorations(e=0){return this._decorationsTree.getAllInjectedText(this,e)}_getInjectedTextInLine(e){let t=this._buffer.getOffsetAt(e,1),i=t+this._buffer.getLineLength(e),n=this._decorationsTree.getInjectedTextInInterval(this,t,i,0);return Si.fromDecorations(n).filter(r=>r.lineNumber===e)}getAllDecorations(e=0,t=!1){return this._decorationsTree.getAll(this,e,t,!1)}_getDecorationsInRange(e,t,i){let n=this._buffer.getOffsetAt(e.startLineNumber,e.startColumn),r=this._buffer.getOffsetAt(e.endLineNumber,e.endColumn);return this._decorationsTree.getAllInInterval(this,n,r,t,i)}getRangeAt(e,t){return this._buffer.getRangeAt(e,t-e)}_changeDecorationImpl(e,t){let i=this._decorations[e];if(!i)return;if(i.options.after){let a=this.getDecorationRange(e);this._onDidChangeDecorations.recordLineAffectedByInjectedText(a.endLineNumber)}if(i.options.before){let a=this.getDecorationRange(e);this._onDidChangeDecorations.recordLineAffectedByInjectedText(a.startLineNumber)}let n=this._validateRangeRelaxedNoAllocations(t),r=this._buffer.getOffsetAt(n.startLineNumber,n.startColumn),o=this._buffer.getOffsetAt(n.endLineNumber,n.endColumn);this._decorationsTree.delete(i),i.reset(this.getVersionId(),r,o,n),this._decorationsTree.insert(i),this._onDidChangeDecorations.checkAffectedAndFire(i.options),i.options.after&&this._onDidChangeDecorations.recordLineAffectedByInjectedText(n.endLineNumber),i.options.before&&this._onDidChangeDecorations.recordLineAffectedByInjectedText(n.startLineNumber)}_changeDecorationOptionsImpl(e,t){let i=this._decorations[e];if(!i)return;let n=!!(i.options.overviewRuler&&i.options.overviewRuler.color),r=!!(t.overviewRuler&&t.overviewRuler.color);if(this._onDidChangeDecorations.checkAffectedAndFire(i.options),this._onDidChangeDecorations.checkAffectedAndFire(t),i.options.after||t.after){let o=this._decorationsTree.getNodeRange(this,i);this._onDidChangeDecorations.recordLineAffectedByInjectedText(o.endLineNumber)}if(i.options.before||t.before){let o=this._decorationsTree.getNodeRange(this,i);this._onDidChangeDecorations.recordLineAffectedByInjectedText(o.startLineNumber)}n!==r?(this._decorationsTree.delete(i),i.setOptions(t),this._decorationsTree.insert(i)):i.setOptions(t)}_deltaDecorationsImpl(e,t,i){let n=this.getVersionId(),r=t.length,o=0,a=i.length,l=0,c=new Array(a);for(;o0&&this._emitModelTokensChangedEvent({tokenizationSupportChanged:!1,semanticTokensApplied:!1,ranges:t})}setSemanticTokens(e,t){this._tokens2.set(e,t),this._emitModelTokensChangedEvent({tokenizationSupportChanged:!1,semanticTokensApplied:e!==null,ranges:[{fromLineNumber:1,toLineNumber:this.getLineCount()}]})}hasCompleteSemanticTokens(){return this._tokens2.isComplete()}hasSomeSemanticTokens(){return!this._tokens2.isEmpty()}setPartialSemanticTokens(e,t){if(this.hasCompleteSemanticTokens())return;let i=this._tokens2.setPartial(e,t);this._emitModelTokensChangedEvent({tokenizationSupportChanged:!1,semanticTokensApplied:!0,ranges:[{fromLineNumber:i.startLineNumber,toLineNumber:i.endLineNumber}]})}tokenizeViewport(e,t){e=Math.max(1,e),t=Math.min(this._buffer.getLineCount(),t),this._tokenization.tokenizeViewport(e,t)}clearTokens(){this._tokens.flush(),this._emitModelTokensChangedEvent({tokenizationSupportChanged:!0,semanticTokensApplied:!1,ranges:[{fromLineNumber:1,toLineNumber:this._buffer.getLineCount()}]})}_emitModelTokensChangedEvent(e){this._isDisposing||this._onDidChangeTokens.fire(e)}resetTokenization(){this._tokenization.reset()}forceTokenization(e){if(e<1||e>this.getLineCount())throw new Error("Illegal value for lineNumber");this._tokenization.forceTokenization(e)}isCheapToTokenize(e){return this._tokenization.isCheapToTokenize(e)}tokenizeIfCheap(e){this.isCheapToTokenize(e)&&this.forceTokenization(e)}getLineTokens(e){if(e<1||e>this.getLineCount())throw new Error("Illegal value for lineNumber");return this._getLineTokens(e)}_getLineTokens(e){let t=this.getLineContent(e),i=this._tokens.getTokens(this._languageIdentifier.id,e-1,t);return this._tokens2.addSemanticTokens(e,i)}getLanguageIdentifier(){return this._languageIdentifier}getModeId(){return this._languageIdentifier.language}setMode(e){if(this._languageIdentifier.id===e.id)return;let t={oldLanguage:this._languageIdentifier.language,newLanguage:e.language};this._languageIdentifier=e,this._onDidChangeLanguage.fire(t),this._onDidChangeLanguageConfiguration.fire({})}getLanguageIdAtPosition(e,t){let i=this.validatePosition(new N(e,t)),n=this.getLineTokens(i.lineNumber);return n.getLanguageId(n.findTokenIndexAtOffset(i.column-1))}getWordAtPosition(e){this._assertNotDisposed();let t=this.validatePosition(e),i=this.getLineContent(t.lineNumber),n=this._getLineTokens(t.lineNumber),r=n.findTokenIndexAtOffset(t.column-1),[o,a]=qt._findLanguageBoundaries(n,r),l=ql(t.column,xe.getWordDefinition(n.getLanguageId(r)),i.substring(o,a),o);if(l&&l.startColumn<=e.column&&e.column<=l.endColumn)return l;if(r>0&&o===t.column-1){let[c,h]=qt._findLanguageBoundaries(n,r-1),d=ql(t.column,xe.getWordDefinition(n.getLanguageId(r-1)),i.substring(c,h),c);if(d&&d.startColumn<=e.column&&e.column<=d.endColumn)return d}return null}static _findLanguageBoundaries(e,t){let i=e.getLanguageId(t),n=0;for(let o=t;o>=0&&e.getLanguageId(o)===i;o--)n=e.getStartOffset(o);let r=e.getLineContent().length;for(let o=t,a=e.getCount();o=0;c--){let h=t.getEndOffset(c);if(h<=a)break;if(yn(t.getStandardTokenType(c))||t.getLanguageId(c)!==o){a=h;break}}let l=Math.min(t.getLineContent().length,e.column-1+i.maxBracketLength);for(let c=n+1;c=l)break;if(yn(t.getStandardTokenType(c))||t.getLanguageId(c)!==o){l=h;break}}return{searchStartOffset:a,searchEndOffset:l}}_matchBracket(e){let t=e.lineNumber,i=this._getLineTokens(t),n=this._buffer.getLineContent(t),r=i.findTokenIndexAtOffset(e.column-1);if(r<0)return null;let o=xe.getBracketsSupport(i.getLanguageId(r));if(o&&!yn(i.getStandardTokenType(r))){let{searchStartOffset:a,searchEndOffset:l}=this._establishBracketSearchOffsets(e,i,o,r),c=null;for(;;){let h=Oi.findNextBracketInRange(o.forwardRegex,t,n,a,l);if(!h)break;if(h.startColumn<=e.column&&e.column<=h.endColumn){let d=n.substring(h.startColumn-1,h.endColumn-1).toLowerCase(),u=this._matchFoundBracket(h,o.textIsBracket[d],o.textIsOpenBracket[d],null);if(u){if(u instanceof gs)return null;c=u}}a=h.endColumn-1}if(c)return c}if(r>0&&i.getStartOffset(r)===e.column-1){let a=r-1,l=xe.getBracketsSupport(i.getLanguageId(a));if(l&&!yn(i.getStandardTokenType(a))){let{searchStartOffset:c,searchEndOffset:h}=this._establishBracketSearchOffsets(e,i,l,a),d=Oi.findPrevBracketInRange(l.reversedRegex,t,n,c,h);if(d&&d.startColumn<=e.column&&e.column<=d.endColumn){let u=n.substring(d.startColumn-1,d.endColumn-1).toLowerCase(),f=this._matchFoundBracket(d,l.textIsBracket[u],l.textIsOpenBracket[u],null);if(f)return f instanceof gs?null:f}}}return null}_matchFoundBracket(e,t,i,n){if(!t)return null;let r=i?this._findMatchingBracketDown(t,e.getEndPosition(),n):this._findMatchingBracketUp(t,e.getStartPosition(),n);return r?r instanceof gs?r:[e,r]:null}_findMatchingBracketUp(e,t,i){let n=e.languageIdentifier.id,r=e.reversedRegex,o=-1,a=0,l=(c,h,d,u)=>{for(;;){if(i&&++a%100==0&&!i())return gs.INSTANCE;let f=Oi.findPrevBracketInRange(r,c,h,d,u);if(!f)break;let m=h.substring(f.startColumn-1,f.endColumn-1).toLowerCase();if(e.isOpen(m)?o++:e.isClose(m)&&o--,o===0)return f;u=f.startColumn-1}return null};for(let c=t.lineNumber;c>=1;c--){let h=this._getLineTokens(c),d=h.getCount(),u=this._buffer.getLineContent(c),f=d-1,m=u.length,g=u.length;c===t.lineNumber&&(f=h.findTokenIndexAtOffset(t.column-1),m=t.column-1,g=t.column-1);let b=!0;for(;f>=0;f--){let w=h.getLanguageId(f)===n&&!yn(h.getStandardTokenType(f));if(w)b?m=h.getStartOffset(f):(m=h.getStartOffset(f),g=h.getEndOffset(f));else if(b&&m!==g){let _=l(c,u,m,g);if(_)return _}b=w}if(b&&m!==g){let w=l(c,u,m,g);if(w)return w}}return null}_findMatchingBracketDown(e,t,i){let n=e.languageIdentifier.id,r=e.forwardRegex,o=1,a=0,l=(h,d,u,f)=>{for(;;){if(i&&++a%100==0&&!i())return gs.INSTANCE;let m=Oi.findNextBracketInRange(r,h,d,u,f);if(!m)break;let g=d.substring(m.startColumn-1,m.endColumn-1).toLowerCase();if(e.isOpen(g)?o++:e.isClose(g)&&o--,o===0)return m;u=m.endColumn-1}return null},c=this.getLineCount();for(let h=t.lineNumber;h<=c;h++){let d=this._getLineTokens(h),u=d.getCount(),f=this._buffer.getLineContent(h),m=0,g=0,b=0;h===t.lineNumber&&(m=d.findTokenIndexAtOffset(t.column-1),g=t.column-1,b=t.column-1);let w=!0;for(;m=1;r--){let o=this._getLineTokens(r),a=o.getCount(),l=this._buffer.getLineContent(r),c=a-1,h=l.length,d=l.length;if(r===t.lineNumber){c=o.findTokenIndexAtOffset(t.column-1),h=t.column-1,d=t.column-1;let f=o.getLanguageId(c);i!==f&&(i=f,n=xe.getBracketsSupport(i))}let u=!0;for(;c>=0;c--){let f=o.getLanguageId(c);if(i!==f){if(n&&u&&h!==d){let g=Oi.findPrevBracketInRange(n.reversedRegex,r,l,h,d);if(g)return this._toFoundBracket(n,g);u=!1}i=f,n=xe.getBracketsSupport(i)}let m=!!n&&!yn(o.getStandardTokenType(c));if(m)u?h=o.getStartOffset(c):(h=o.getStartOffset(c),d=o.getEndOffset(c));else if(n&&u&&h!==d){let g=Oi.findPrevBracketInRange(n.reversedRegex,r,l,h,d);if(g)return this._toFoundBracket(n,g)}u=m}if(n&&u&&h!==d){let f=Oi.findPrevBracketInRange(n.reversedRegex,r,l,h,d);if(f)return this._toFoundBracket(n,f)}}return null}findNextBracket(e){let t=this.validatePosition(e),i=this.getLineCount(),n=-1,r=null;for(let o=t.lineNumber;o<=i;o++){let a=this._getLineTokens(o),l=a.getCount(),c=this._buffer.getLineContent(o),h=0,d=0,u=0;if(o===t.lineNumber){h=a.findTokenIndexAtOffset(t.column-1),d=t.column-1,u=t.column-1;let m=a.getLanguageId(h);n!==m&&(n=m,r=xe.getBracketsSupport(n))}let f=!0;for(;hDate.now()-f<=t}let n=this.validatePosition(e),r=this.getLineCount(),o=new Map,a=[],l=(f,m)=>{if(!o.has(f)){let g=[];for(let b=0,w=m?m.brackets.length:0;b{for(;;){if(i&&++c%100==0&&!i())return gs.INSTANCE;let _=Oi.findNextBracketInRange(f.forwardRegex,m,g,b,w);if(!_)break;let v=g.substring(_.startColumn-1,_.endColumn-1).toLowerCase(),C=f.textIsBracket[v];if(C&&(C.isOpen(v)?a[C.index]++:C.isClose(v)&&a[C.index]--,a[C.index]===-1))return this._matchFoundBracket(_,C,!1,i);b=_.endColumn-1}return null},d=-1,u=null;for(let f=n.lineNumber;f<=r;f++){let m=this._getLineTokens(f),g=m.getCount(),b=this._buffer.getLineContent(f),w=0,_=0,v=0;if(f===n.lineNumber){w=m.findTokenIndexAtOffset(n.column-1),_=n.column-1,v=n.column-1;let y=m.getLanguageId(w);d!==y&&(d=y,u=xe.getBracketsSupport(d),l(d,u))}let C=!0;for(;wn)throw new Error("Illegal value for lineNumber");let r=xe.getFoldingRules(this._languageIdentifier.id),o=Boolean(r&&r.offSide),a=-2,l=-1,c=-2,h=-1,d=S=>{if(a!==-1&&(a===-2||a>S-1)){a=-1,l=-1;for(let L=S-2;L>=0;L--){let E=this._computeIndentLevel(L);if(E>=0){a=L,l=E;break}}}if(c===-2){c=-1,h=-1;for(let L=S;L=0){c=L,h=E;break}}}},u=-2,f=-1,m=-2,g=-1,b=S=>{if(u===-2){u=-1,f=-1;for(let L=S-2;L>=0;L--){let E=this._computeIndentLevel(L);if(E>=0){u=L,f=E;break}}}if(m!==-1&&(m===-2||m=0){m=L,g=E;break}}}},w=0,_=!0,v=0,C=!0,y=0,x=0;for(let S=0;_||C;S++){let L=e-S,E=e+S;S>1&&(L<1||L1&&(E>n||E>i)&&(C=!1),S>5e4&&(_=!1,C=!1);let T=-1;if(_){let P=this._computeIndentLevel(L-1);P>=0?(c=L-1,h=P,T=Math.ceil(P/this._options.indentSize)):(d(L),T=this._getIndentLevelForWhitespaceLine(o,l,h))}let I=-1;if(C){let P=this._computeIndentLevel(E-1);P>=0?(u=E-1,f=P,I=Math.ceil(P/this._options.indentSize)):(b(E),I=this._getIndentLevelForWhitespaceLine(o,f,g))}if(S===0){x=T;continue}if(S===1){if(E<=n&&I>=0&&x+1===I){_=!1,w=E,v=E,y=I;continue}if(L>=1&&T>=0&&T-1===x){C=!1,w=L,v=L,y=T;continue}if(w=e,v=e,y=x,y===0)return{startLineNumber:w,endLineNumber:v,indent:y}}_&&(T>=y?w=L:_=!1),C&&(I>=y?v=E:C=!1)}return{startLineNumber:w,endLineNumber:v,indent:y}}getLinesIndentGuides(e,t){this._assertNotDisposed();let i=this.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");let n=xe.getFoldingRules(this._languageIdentifier.id),r=Boolean(n&&n.offSide),o=new Array(t-e+1),a=-2,l=-1,c=-2,h=-1;for(let d=e;d<=t;d++){let u=d-e,f=this._computeIndentLevel(d-1);if(f>=0){a=d-1,l=f,o[u]=Math.ceil(f/this._options.indentSize);continue}if(a===-2){a=-1,l=-1;for(let m=d-2;m>=0;m--){let g=this._computeIndentLevel(m);if(g>=0){a=m,l=g;break}}}if(c!==-1&&(c===-2||c=0){c=m,h=g;break}}}o[u]=this._getIndentLevelForWhitespaceLine(r,l,h)}return o}_getIndentLevelForWhitespaceLine(e,t,i){return t===-1||i===-1?0:t0){this._deferredEvent?this._deferredEvent=this._deferredEvent.merge(e):this._deferredEvent=e;return}this._fastEmitter.fire(e),this._slowEmitter.fire(e)}};var KA=()=>!0,wD=()=>!1,qA=s=>s===" "||s===" ",Ki=class{constructor(e,t,i){this._cursorMoveConfigurationBrand=void 0,this._languageIdentifier=e;let n=i.options,r=n.get(129);this.readOnly=n.get(79),this.tabSize=t.tabSize,this.indentSize=t.indentSize,this.insertSpaces=t.insertSpaces,this.stickyTabStops=n.get(103),this.lineHeight=n.get(57),this.pageSize=Math.max(1,Math.floor(r.height/this.lineHeight)-2),this.useTabStops=n.get(114),this.wordSeparators=n.get(115),this.emptySelectionClipboard=n.get(30),this.copyWithSyntaxHighlighting=n.get(19),this.multiCursorMergeOverlapping=n.get(67),this.multiCursorPaste=n.get(69),this.autoClosingBrackets=n.get(5),this.autoClosingQuotes=n.get(8),this.autoClosingDelete=n.get(6),this.autoClosingOvertype=n.get(7),this.autoSurround=n.get(11),this.autoIndent=n.get(9),this.surroundingPairs={},this._electricChars=null,this.shouldAutoCloseBefore={quote:Ki._getShouldAutoClose(e,this.autoClosingQuotes),bracket:Ki._getShouldAutoClose(e,this.autoClosingBrackets)},this.autoClosingPairs=xe.getAutoClosingPairs(e.id);let o=Ki._getSurroundingPairs(e);if(o)for(let a of o)this.surroundingPairs[a.open]=a.close}static shouldRecreate(e){return e.hasChanged(129)||e.hasChanged(115)||e.hasChanged(30)||e.hasChanged(67)||e.hasChanged(69)||e.hasChanged(5)||e.hasChanged(8)||e.hasChanged(6)||e.hasChanged(7)||e.hasChanged(11)||e.hasChanged(114)||e.hasChanged(57)||e.hasChanged(79)}get electricChars(){if(!this._electricChars){this._electricChars={};let e=Ki._getElectricCharacters(this._languageIdentifier);if(e)for(let t of e)this._electricChars[t]=!0}return this._electricChars}normalizeIndentation(e){return qt.normalizeIndentation(e,this.indentSize,this.insertSpaces)}static _getElectricCharacters(e){try{return xe.getElectricCharacters(e.id)}catch(t){return de(t),null}}static _getShouldAutoClose(e,t){switch(t){case"beforeWhitespace":return qA;case"languageDefined":return Ki._getLanguageDefinedShouldAutoClose(e);case"always":return KA;case"never":return wD}}static _getLanguageDefinedShouldAutoClose(e){try{let t=xe.getAutoCloseBeforeSet(e.id);return i=>t.indexOf(i)!==-1}catch(t){return de(t),wD}}static _getSurroundingPairs(e){try{return xe.getSurroundingPairs(e.id)}catch(t){return de(t),null}}},tt=class{constructor(e,t,i,n){this._singleCursorStateBrand=void 0,this.selectionStart=e,this.selectionStartLeftoverVisibleColumns=t,this.position=i,this.leftoverVisibleColumns=n,this.selection=tt._computeSelection(this.selectionStart,this.position)}equals(e){return this.selectionStartLeftoverVisibleColumns===e.selectionStartLeftoverVisibleColumns&&this.leftoverVisibleColumns===e.leftoverVisibleColumns&&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 tt(this.selectionStart,this.selectionStartLeftoverVisibleColumns,new N(t,i),n):new tt(new D(t,i,t,i),n,new N(t,i),n)}static _computeSelection(e,t){let i,n,r,o;return e.isEmpty()?(i=e.startLineNumber,n=e.startColumn,r=t.lineNumber,o=t.column):t.isBeforeOrEqual(e.getStartPosition())?(i=e.endLineNumber,n=e.endColumn,r=t.lineNumber,o=t.column):(i=e.startLineNumber,n=e.startColumn,r=t.lineNumber,o=t.column),new Z(i,n,r,o)}},Fm=class{constructor(e,t,i,n){this._cursorContextBrand=void 0,this.model=e,this.viewModel=t,this.coordinatesConverter=i,this.cursorConfig=n}},vD=class{constructor(e){this.modelState=e,this.viewState=null}},CD=class{constructor(e){this.modelState=null,this.viewState=e}},ne=class{constructor(e,t){this._cursorStateBrand=void 0,this.modelState=e,this.viewState=t}static fromModelState(e){return new vD(e)}static fromViewState(e){return new CD(e)}static fromModelSelection(e){let t=e.selectionStartLineNumber,i=e.selectionStartColumn,n=e.positionLineNumber,r=e.positionColumn,o=new tt(new D(t,i,t,i),0,new N(n,r),0);return ne.fromModelState(o)}static fromModelSelections(e){let t=[];for(let i=0,n=e.length;i=65536?2:1,l===9)o=ue.nextRenderTabStop(o,i);else{let c=da(l);for(;a=65536?2:1,c=d}bi(l)||ha(l)?o=o+2:o=o+1}}return o}static visibleColumnsByColumns(e,t){let i=e.length,n=new Array;n.push(-1);let r=0,o=0;for(;o=65536?2:1,n.push(r),a>=65536&&n.push(r),a===9)r=ue.nextRenderTabStop(r,t);else{let l=da(a);for(;o=65536?2:1,n.push(r),a>=65536&&n.push(r),l=h}bi(a)||ha(a)?r=r+2:r=r+1}}return n.push(r),n}static visibleColumnFromColumn2(e,t,i){return this.visibleColumnFromColumn(t.getLineContent(i.lineNumber),i.column,e.tabSize)}static columnFromVisibleColumn(e,t,i){if(t<=0)return 1;let n=e.length,r=0,o=1,a=0;for(;a=65536?2:1;let c;if(l===9)c=ue.nextRenderTabStop(r,i);else{let d=da(l);for(;a=65536?2:1,d=f}bi(l)||ha(l)?c=r+2:c=r+1}let h=a+1;if(c>=t){let d=t-r;return c-ta?a:r}static nextRenderTabStop(e,t){return e+t-e%t}static nextIndentTabStop(e,t){return e+t-e%t}static prevRenderTabStop(e,t){return Math.max(0,e-1-(e-1)%t)}static prevIndentTabStop(e,t){return Math.max(0,e-1-(e-1)%t)}};function uo(s){return s==="'"||s==='"'||s==="`"}var ir=class{static columnSelect(e,t,i,n,r,o){let a=Math.abs(r-i)+1,l=i>r,c=n>o,h=no||wn||b0&&n--,ir.columnSelect(e,t,i.fromViewLineNumber,i.fromViewVisualColumn,i.toViewLineNumber,n)}static columnSelectRight(e,t,i){let n=0,r=Math.min(i.fromViewLineNumber,i.toViewLineNumber),o=Math.max(i.fromViewLineNumber,i.toViewLineNumber);for(let l=r;l<=o;l++){let c=t.getLineMaxColumn(l),h=ue.visibleColumnFromColumn2(e,t,new N(l,c));n=Math.max(n,h)}let a=i.toViewVisualColumn;return ae.getLineMinColumn(t.lineNumber))return t.delta(void 0,-Qy(e.getLineContent(t.lineNumber),t.column-1));if(t.lineNumber>1){let i=t.lineNumber-1;return new N(i,e.getLineMaxColumn(i))}else return t}static leftPositionAtomicSoftTabs(e,t,i){if(t.column<=e.getLineIndentColumn(t.lineNumber)){let n=e.getLineMinColumn(t.lineNumber),r=e.getLineContent(t.lineNumber),o=fo.atomicPosition(r,t.column-1,i,0);if(o!==-1&&o+1>=n)return new N(t.lineNumber,o+1)}return this.leftPosition(e,t)}static left(e,t,i){let n=e.stickyTabStops?be.leftPositionAtomicSoftTabs(t,i,e.tabSize):be.leftPosition(t,i);return new Td(n.lineNumber,n.column,0)}static moveLeft(e,t,i,n,r){let o,a;if(i.hasSelection()&&!n)o=i.selection.startLineNumber,a=i.selection.startColumn;else{let l=i.position.delta(void 0,-(r-1)),c=t.normalizePosition(be.clipPositionColumn(l,t),0),h=be.left(e,t,c);o=h.lineNumber,a=h.column}return i.move(n,o,a,0)}static clipPositionColumn(e,t){return new N(e.lineNumber,be.clipRange(e.column,t.getLineMinColumn(e.lineNumber),t.getLineMaxColumn(e.lineNumber)))}static clipRange(e,t,i){return ei?i:e}static rightPosition(e,t,i){return ic?(i=c,a?n=t.getLineMaxColumn(i):n=Math.min(t.getLineMaxColumn(i),n)):n=ue.columnFromVisibleColumn2(e,t,i,l),h?r=0:r=l-ue.visibleColumnFromColumn(t.getLineContent(i),n,e.tabSize),new Td(i,n,r)}static moveDown(e,t,i,n,r){let o,a;i.hasSelection()&&!n?(o=i.selection.endLineNumber,a=i.selection.endColumn):(o=i.position.lineNumber,a=i.position.column);let l=be.down(e,t,o,a,i.leftoverVisibleColumns,r,!0);return i.move(n,l.lineNumber,l.column,l.leftoverVisibleColumns)}static translateDown(e,t,i){let n=i.selection,r=be.down(e,t,n.selectionStartLineNumber,n.selectionStartColumn,i.selectionStartLeftoverVisibleColumns,1,!1),o=be.down(e,t,n.positionLineNumber,n.positionColumn,i.leftoverVisibleColumns,1,!1);return new tt(new D(r.lineNumber,r.column,r.lineNumber,r.column),r.leftoverVisibleColumns,new N(o.lineNumber,o.column),o.leftoverVisibleColumns)}static up(e,t,i,n,r,o,a){let l=ue.visibleColumnFromColumn(t.getLineContent(i),n,e.tabSize)+r,c=i===1&&n===1;return i=i-o,i<1?(i=1,a?n=t.getLineMinColumn(i):n=Math.min(t.getLineMaxColumn(i),n)):n=ue.columnFromVisibleColumn2(e,t,i,l),c?r=0:r=l-ue.visibleColumnFromColumn(t.getLineContent(i),n,e.tabSize),new Td(i,n,r)}static moveUp(e,t,i,n,r){let o,a;i.hasSelection()&&!n?(o=i.selection.startLineNumber,a=i.selection.startColumn):(o=i.position.lineNumber,a=i.position.column);let l=be.up(e,t,o,a,i.leftoverVisibleColumns,r,!0);return i.move(n,l.lineNumber,l.column,l.leftoverVisibleColumns)}static translateUp(e,t,i){let n=i.selection,r=be.up(e,t,n.selectionStartLineNumber,n.selectionStartColumn,i.selectionStartLeftoverVisibleColumns,1,!1),o=be.up(e,t,n.positionLineNumber,n.positionColumn,i.leftoverVisibleColumns,1,!1);return new tt(new D(r.lineNumber,r.column,r.lineNumber,r.column),r.leftoverVisibleColumns,new N(o.lineNumber,o.column),o.leftoverVisibleColumns)}static _isBlankLine(e,t){return e.getLineFirstNonWhitespaceColumn(t)===0}static moveToPrevBlankLine(e,t,i,n){let r=i.position.lineNumber;for(;r>1&&this._isBlankLine(t,r);)r--;for(;r>1&&!this._isBlankLine(t,r);)r--;return i.move(n,r,t.getLineMinColumn(r),0)}static moveToNextBlankLine(e,t,i,n){let r=t.getLineCount(),o=i.position.lineNumber;for(;o=u.length+1)return!1;let f=u.charAt(d.column-2),m=n.get(f);if(!m)return!1;if(uo(f)){if(i==="never")return!1}else if(t==="never")return!1;let g=u.charAt(d.column-1),b=!1;for(let w of m)w.open===f&&w.close===g&&(b=!0);if(!b)return!1;if(e==="auto"){let w=!1;for(let _=0,v=a.length;_1){let r=t.getLineContent(n.lineNumber),o=vt(r),a=o===-1?r.length+1:o+1;if(n.column<=a){let l=ue.visibleColumnFromColumn2(i,t,n),c=ue.prevIndentTabStop(l,i.indentSize),h=ue.columnFromVisibleColumn2(i,t,n.lineNumber,c);return new D(n.lineNumber,h,n.lineNumber,n.column)}}return D.fromPositions(jn.getPositionAfterDeleteLeft(n,t),n)}static getPositionAfterDeleteLeft(e,t){if(e.column>1){let i=nL(e.column-1,t.getLineContent(e.lineNumber));return e.with(void 0,i+1)}else if(e.lineNumber>1){let i=e.lineNumber-1;return new N(i,t.getLineMaxColumn(i))}else return e}static cut(e,t,i){let n=[];for(let r=0,o=i.length;r1?(c=l.lineNumber-1,h=t.getLineMaxColumn(l.lineNumber-1),d=l.lineNumber,u=t.getLineMaxColumn(l.lineNumber)):(c=l.lineNumber,h=1,d=l.lineNumber,u=t.getLineMaxColumn(l.lineNumber));let f=new D(c,h,d,u);f.isEmpty()?n[r]=null:n[r]=new si(f,"")}else n[r]=null;else n[r]=new si(a,"")}return new Gt(0,n,{shouldPushStackElementBefore:!0,shouldPushStackElementAfter:!0})}};var pe=class{static _createWord(e,t,i,n,r){return{start:n,end:r,wordType:t,nextCharClass:i}}static _findPreviousWordOnLine(e,t,i){let n=t.getLineContent(i.lineNumber);return this._doFindPreviousWordOnLine(n,e,i)}static _doFindPreviousWordOnLine(e,t,i){let n=0;for(let r=i.column-2;r>=0;r--){let o=e.charCodeAt(r),a=t.get(o);if(a===0){if(n===2)return this._createWord(e,n,a,r+1,this._findEndOfWord(e,t,n,r+1));n=1}else if(a===2){if(n===1)return this._createWord(e,n,a,r+1,this._findEndOfWord(e,t,n,r+1));n=2}else if(a===1&&n!==0)return this._createWord(e,n,a,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){let r=e.length;for(let o=n;o=0;r--){let o=e.charCodeAt(r),a=t.get(o);if(a===1||i===1&&a===2||i===2&&a===0)return r+1}return 0}static moveWordLeft(e,t,i,n){let r=i.lineNumber,o=i.column;o===1&&r>1&&(r=r-1,o=t.getLineMaxColumn(r));let a=pe._findPreviousWordOnLine(e,t,new N(r,o));if(n===0)return new N(r,a?a.start+1:1);if(n===1)return a&&a.wordType===2&&a.end-a.start==1&&a.nextCharClass===0&&(a=pe._findPreviousWordOnLine(e,t,new N(r,a.start+1))),new N(r,a?a.start+1:1);if(n===3){for(;a&&a.wordType===2;)a=pe._findPreviousWordOnLine(e,t,new N(r,a.start+1));return new N(r,a?a.start+1:1)}return a&&o<=a.end+1&&(a=pe._findPreviousWordOnLine(e,t,new N(r,a.start+1))),new N(r,a?a.end+1:1)}static _moveWordPartLeft(e,t){let i=t.lineNumber,n=e.getLineMaxColumn(i);if(t.column===1)return i>1?new N(i-1,e.getLineMaxColumn(i-1)):t;let r=e.getLineContent(i);for(let o=t.column-1;o>1;o--){let a=r.charCodeAt(o-2),l=r.charCodeAt(o-1);if(a===95&&l!==95)return new N(i,o);if($r(a)&&ns(l))return new N(i,o);if(ns(a)&&ns(l)&&o+1=l.start+1&&(l=pe._findNextWordOnLine(e,t,new N(r,l.end+1))),l?o=l.start+1:o=t.getLineMaxColumn(r);return new N(r,o)}static _moveWordPartRight(e,t){let i=t.lineNumber,n=e.getLineMaxColumn(i);if(t.column===n)return i1?c=1:(l--,c=n.getLineMaxColumn(l)):(h&&c<=h.end+1&&(h=pe._findPreviousWordOnLine(i,n,new N(l,h.start+1))),h?c=h.end+1:c>1?c=1:(l--,c=n.getLineMaxColumn(l))),new D(l,c,a.lineNumber,a.column)}static deleteInsideWord(e,t,i){if(!i.isEmpty())return i;let n=new N(i.positionLineNumber,i.positionColumn),r=this._deleteInsideWordWhitespace(t,n);return r||this._deleteInsideWordDetermineDeleteRange(e,t,n)}static _charAtIsWhitespace(e,t){let i=e.charCodeAt(t);return i===32||i===9}static _deleteInsideWordWhitespace(e,t){let i=e.getLineContent(t.lineNumber),n=i.length;if(n===0)return null;let r=Math.max(t.column-2,0);if(!this._charAtIsWhitespace(i,r))return null;let o=Math.min(t.column-1,n-1);if(!this._charAtIsWhitespace(i,o))return null;for(;r>0&&this._charAtIsWhitespace(i,r-1);)r--;for(;o+11?new D(i.lineNumber-1,t.getLineMaxColumn(i.lineNumber-1),i.lineNumber,1):i.lineNumberd.start+1<=i.column&&i.column<=d.end+1,a=(d,u)=>(d=Math.min(d,i.column),u=Math.max(u,i.column),new D(i.lineNumber,d,i.lineNumber,u)),l=d=>{let u=d.start+1,f=d.end+1,m=!1;for(;f-11&&this._charAtIsWhitespace(n,u-2);)u--;return a(u,f)},c=pe._findPreviousWordOnLine(e,t,i);if(c&&o(c))return l(c);let h=pe._findNextWordOnLine(e,t,i);return h&&o(h)?l(h):c&&h?a(c.end+1,h.start+1):c?a(c.start+1,c.end+1):h?a(h.start+1,h.end+1):a(1,r+1)}static _deleteWordPartLeft(e,t){if(!t.isEmpty())return t;let i=t.getPosition(),n=pe._moveWordPartLeft(e,i);return new D(i.lineNumber,i.column,n.lineNumber,n.column)}static _findFirstNonWhitespaceChar(e,t){let i=e.length;for(let n=t;n=u.start+1&&(u=pe._findNextWordOnLine(i,n,new N(l,u.end+1))),u?c=u.start+1:cBoolean(e))}var Ot=class{static addCursorDown(e,t,i){let n=[],r=0;for(let o=0,a=t.length;oc&&(h=c,d=e.model.getLineMaxColumn(h)),ne.fromModelState(new tt(new D(o.lineNumber,1,h,d),0,new N(h,d),0))}let l=t.modelState.selectionStart.getStartPosition().lineNumber;if(o.lineNumberl){let c=e.getLineCount(),h=a.lineNumber+1,d=1;return h>c&&(h=c,d=e.getLineMaxColumn(h)),ne.fromViewState(t.viewState.move(t.modelState.hasSelection(),h,d,0))}else{let c=t.modelState.selectionStart.getEndPosition();return ne.fromModelState(t.modelState.move(t.modelState.hasSelection(),c.lineNumber,c.column,0))}}static word(e,t,i,n){let r=e.model.validatePosition(n);return ne.fromModelState(pe.word(e.cursorConfig,e.model,t.modelState,i,r))}static cancelSelection(e,t){if(!t.modelState.hasSelection())return new ne(t.modelState,t.viewState);let i=t.viewState.position.lineNumber,n=t.viewState.position.column;return ne.fromViewState(new tt(new D(i,n,i,n),0,new N(i,n),0))}static moveTo(e,t,i,n,r){let o=e.model.validatePosition(n),a=r?e.coordinatesConverter.validateViewPosition(new N(r.lineNumber,r.column),o):e.coordinatesConverter.convertModelPositionToViewPosition(o);return ne.fromViewState(t.viewState.move(i,a.lineNumber,a.column,0))}static simpleMove(e,t,i,n,r,o){switch(i){case 0:return o===4?this._moveHalfLineLeft(e,t,n):this._moveLeft(e,t,n,r);case 1:return o===4?this._moveHalfLineRight(e,t,n):this._moveRight(e,t,n,r);case 2:return o===2?this._moveUpByViewLines(e,t,n,r):this._moveUpByModelLines(e,t,n,r);case 3:return o===2?this._moveDownByViewLines(e,t,n,r):this._moveDownByModelLines(e,t,n,r);case 4:return o===2?t.map(a=>ne.fromViewState(be.moveToPrevBlankLine(e.cursorConfig,e,a.viewState,n))):t.map(a=>ne.fromModelState(be.moveToPrevBlankLine(e.cursorConfig,e.model,a.modelState,n)));case 5:return o===2?t.map(a=>ne.fromViewState(be.moveToNextBlankLine(e.cursorConfig,e,a.viewState,n))):t.map(a=>ne.fromModelState(be.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,r){let o=e.getCompletelyVisibleViewRange(),a=e.coordinatesConverter.convertViewRangeToModelRange(o);switch(i){case 11:{let l=this._firstLineNumberInRange(e.model,a,r),c=e.model.getLineFirstNonWhitespaceColumn(l);return[this._moveToModelPosition(e,t[0],n,l,c)]}case 13:{let l=this._lastLineNumberInRange(e.model,a,r),c=e.model.getLineFirstNonWhitespaceColumn(l);return[this._moveToModelPosition(e,t[0],n,l,c)]}case 12:{let l=Math.round((a.startLineNumber+a.endLineNumber)/2),c=e.model.getLineFirstNonWhitespaceColumn(l);return[this._moveToModelPosition(e,t[0],n,l,c)]}case 14:{let l=[];for(let c=0,h=t.length;ci.endLineNumber-1&&(r=i.endLineNumber-1),rne.fromViewState(be.moveLeft(e.cursorConfig,e,r.viewState,i,n)))}static _moveHalfLineLeft(e,t,i){let n=[];for(let r=0,o=t.length;rne.fromViewState(be.moveRight(e.cursorConfig,e,r.viewState,i,n)))}static _moveHalfLineRight(e,t,i){let n=[];for(let r=0,o=t.length;r1&&ue.visibleColumnFromColumn(u,f+1,r)%o!=0&&e.isCheapToTokenize(d-1)){let b=xe.getEnterAction(this._opts.autoIndent,e,new D(d-1,e.getLineMaxColumn(d-1),d-1,e.getLineMaxColumn(d-1)));if(b){if(h=c,b.appendText)for(let w=0,_=b.appendText.length;w<_&&h1){let a;for(a=i-1;a>=1;a--){let h=t.getLineContent(a);if(vn(h)>=0)break}if(a<1)return null;let l=t.getLineMaxColumn(a),c=xe.getEnterAction(e.autoIndent,t,new D(a,l,a,l));c&&(r=c.indentation+c.appendText)}return n&&(n===ft.Indent&&(r=je.shiftIndent(e,r)),n===ft.Outdent&&(r=je.unshiftIndent(e,r)),r=e.normalizeIndentation(r)),r||null}static _replaceJumpToNextIndent(e,t,i,n){let r="",o=i.getStartPosition();if(e.insertSpaces){let a=ue.visibleColumnFromColumn2(e,t,o),l=e.indentSize,c=l-a%l;for(let h=0;hthis._compositionType(i,h,r,o,a,l));return new Gt(4,c,{shouldPushStackElementBefore:Vm(e,4),shouldPushStackElementAfter:!1})}static _compositionType(e,t,i,n,r,o){if(!t.isEmpty())return null;let a=t.getPosition(),l=Math.max(1,a.column-n),c=Math.min(e.getLineMaxColumn(a.lineNumber),a.column+r),h=new D(a.lineNumber,l,a.lineNumber,c);return e.getValueInRange(h)===i&&o===0?null:new oc(h,i,0,o)}static _typeCommand(e,t,i){return i?new rc(e,t,!0):new si(e,t,!0)}static _enter(e,t,i,n){if(e.autoIndent===0)return je._typeCommand(n,` +`,i);if(!t.isCheapToTokenize(n.getStartPosition().lineNumber)||e.autoIndent===1){let l=t.getLineContent(n.startLineNumber),c=$t(l).substring(0,n.startColumn-1);return je._typeCommand(n,` +`+e.normalizeIndentation(c),i)}let r=xe.getEnterAction(e.autoIndent,t,n);if(r){if(r.indentAction===ft.None)return je._typeCommand(n,` +`+e.normalizeIndentation(r.indentation+r.appendText),i);if(r.indentAction===ft.Indent)return je._typeCommand(n,` +`+e.normalizeIndentation(r.indentation+r.appendText),i);if(r.indentAction===ft.IndentOutdent){let l=e.normalizeIndentation(r.indentation),c=e.normalizeIndentation(r.indentation+r.appendText),h=` +`+c+` +`+l;return i?new rc(n,h,!0):new oc(n,h,-1,c.length-l.length,!0)}else if(r.indentAction===ft.Outdent){let l=je.unshiftIndent(e,r.indentation);return je._typeCommand(n,` +`+e.normalizeIndentation(l+r.appendText),i)}}let o=t.getLineContent(n.startLineNumber),a=$t(o).substring(0,n.startColumn-1);if(e.autoIndent>=4){let l=xe.getIndentForEnter(e.autoIndent,t,n,{unshiftIndent:c=>je.unshiftIndent(e,c),shiftIndent:c=>je.shiftIndent(e,c),normalizeIndentation:c=>e.normalizeIndentation(c)});if(l){let c=ue.visibleColumnFromColumn2(e,t,n.getEndPosition()),h=n.endColumn,d=t.getLineContent(n.endLineNumber),u=vt(d);if(u>=0?n=n.setEndPosition(n.endLineNumber,Math.max(n.endColumn,u+1)):n=n.setEndPosition(n.endLineNumber,t.getLineMaxColumn(n.endLineNumber)),i)return new rc(n,` +`+e.normalizeIndentation(l.afterEnter),!0);{let f=0;return h<=u+1&&(e.insertSpaces||(c=Math.ceil(c/e.indentSize)),f=Math.min(c+1-e.normalizeIndentation(l.afterEnter).length-1,0)),new oc(n,` +`+e.normalizeIndentation(l.afterEnter),0,f,!0)}}}return je._typeCommand(n,` +`+e.normalizeIndentation(a),i)}static _isAutoIndentType(e,t,i){if(e.autoIndent<4)return!1;for(let n=0,r=i.length;nje.shiftIndent(e,a),unshiftIndent:a=>je.unshiftIndent(e,a)});if(o===null)return null;if(o!==e.normalizeIndentation(r)){let a=t.getLineFirstNonWhitespaceColumn(i.startLineNumber);return a===0?je._typeCommand(new D(i.startLineNumber,1,i.endLineNumber,i.endColumn),e.normalizeIndentation(o)+n,!1):je._typeCommand(new D(i.startLineNumber,1,i.endLineNumber,i.endColumn),e.normalizeIndentation(o)+t.getLineContent(i.startLineNumber).substring(a-1,i.startColumn-1)+n,!1)}return null}static _isAutoClosingOvertype(e,t,i,n,r){if(e.autoClosingOvertype==="never"||!e.autoClosingPairs.autoClosingPairsCloseSingleChar.has(r))return!1;for(let o=0,a=i.length;o2?h.charCodeAt(c.column-2):0)===92&&u)return!1;if(e.autoClosingOvertype==="auto"){let m=!1;for(let g=0,b=n.length;gt.startsWith(l.open)),a=r.some(l=>t.startsWith(l.close));return!o&&a}static _findAutoClosingPairOpen(e,t,i,n){let r=e.autoClosingPairs.autoClosingPairsOpenByEnd.get(n);if(!r)return null;let o=null;for(let a of r)if(o===null||a.open.length>o.open.length){let l=!0;for(let c of i)if(t.getValueInRange(new D(c.lineNumber,c.column-a.open.length+1,c.lineNumber,c.column))+n!==a.open){l=!1;break}l&&(o=a)}return o}static _findSubAutoClosingPairClose(e,t){if(t.open.length<=1)return"";let i=t.close.charAt(t.close.length-1),n=e.autoClosingPairs.autoClosingPairsCloseByEnd.get(i)||[],r=null;for(let o of n)o.open!==t.open&&t.open.includes(o.open)&&t.close.endsWith(o.close)&&(!r||o.open.length>r.open.length)&&(r=o);return r?r.close:""}static _getAutoClosingPairClose(e,t,i,n,r){let o=uo(n),a=o?e.autoClosingQuotes:e.autoClosingBrackets;if(a==="never")return null;let l=this._findAutoClosingPairOpen(e,t,i.map(u=>u.getPosition()),n);if(!l)return null;let c=this._findSubAutoClosingPairClose(e,l),h=!0,d=o?e.shouldAutoCloseBefore.quote:e.shouldAutoCloseBefore.bracket;for(let u=0,f=i.length;ug.column-1){let C=b.charAt(g.column-1);if(!je._isBeforeClosingBrace(e,w)&&!d(C))return null}if(!t.isCheapToTokenize(g.lineNumber))return null;if(l.open.length===1&&o&&a!=="always"){let C=ds(e.wordSeparators);if(r&&g.column>1&&C.get(b.charCodeAt(g.column-2))===0||!r&&g.column>2&&C.get(b.charCodeAt(g.column-3))===0)return null}t.forceTokenization(g.lineNumber);let _=t.getLineTokens(g.lineNumber),v=!1;try{v=xe.shouldAutoClosePair(l,_,r?g.column:g.column-1)}catch(C){de(C)}if(!v)return null}return h?l.close.substring(0,l.close.length-c.length):l.close}static _runAutoClosingOpenCharType(e,t,i,n,r,o,a){let l=[];for(let c=0,h=n.length;cnew si(new D(h.positionLineNumber,h.positionColumn,h.positionLineNumber,h.positionColumn+1),"",!1));return new Gt(4,c,{shouldPushStackElementBefore:!0,shouldPushStackElementAfter:!1})}let l=this._getAutoClosingPairClose(t,i,r,a,!1);return l!==null?this._runAutoClosingOpenCharType(e,t,i,r,a,!1,l):null}static typeWithInterceptors(e,t,i,n,r,o,a){if(!e&&a===` +`){let h=[];for(let d=0,u=r.length;d{let n=t.get(qe).getFocusedCodeEditor();return n&&n.hasTextFocus()?this._runEditorCommand(t,n,i):!1}),e.addImplementation(1e3,"generic-dom-input-textarea",(t,i)=>{let n=document.activeElement;return n&&["input","textarea"].indexOf(n.tagName.toLowerCase())>=0?(this.runDOMCommand(),!0):!1}),e.addImplementation(0,"generic-dom",(t,i)=>{let n=t.get(qe).getActiveCodeEditor();return n?(n.focus(),this._runEditorCommand(t,n,i)):!1})}_runEditorCommand(e,t,i){let n=this.runEditorCommand(e,t,i);return n||!0}},Lt;(function(s){class e extends it{constructor(_){super(_);this._inSelectionMode=_.inSelectionMode}runCoreEditorCommand(_,v){_.model.pushStackElement(),_.setCursorStates(v.source,3,[Ot.moveTo(_,_.getPrimaryCursorState(),this._inSelectionMode,v.position,v.viewPosition)]),_.revealPrimaryCursor(v.source,!0)}}s.MoveTo=J(new e({id:"_moveTo",inSelectionMode:!1,precondition:void 0})),s.MoveToSelect=J(new e({id:"_moveToSelect",inSelectionMode:!0,precondition:void 0}));class t extends it{runCoreEditorCommand(_,v){_.model.pushStackElement();let C=this._getColumnSelectResult(_,_.getPrimaryCursorState(),_.getCursorColumnSelectData(),v);_.setCursorStates(v.source,3,C.viewStates.map(y=>ne.fromViewState(y))),_.setCursorColumnSelectData({isReal:!0,fromViewLineNumber:C.fromLineNumber,fromViewVisualColumn:C.fromVisualColumn,toViewLineNumber:C.toLineNumber,toViewVisualColumn:C.toVisualColumn}),C.reversed?_.revealTopMostCursor(v.source):_.revealBottomMostCursor(v.source)}}s.ColumnSelect=J(new class extends t{constructor(){super({id:"columnSelect",precondition:void 0})}_getColumnSelectResult(w,_,v,C){let y=w.model.validatePosition(C.position),x=w.coordinatesConverter.validateViewPosition(new N(C.viewPosition.lineNumber,C.viewPosition.column),y),S=C.doColumnSelect?v.fromViewLineNumber:x.lineNumber,L=C.doColumnSelect?v.fromViewVisualColumn:C.mouseColumn-1;return ir.columnSelect(w.cursorConfig,w,S,L,x.lineNumber,C.mouseColumn-1)}}),s.CursorColumnSelectLeft=J(new class extends t{constructor(){super({id:"cursorColumnSelectLeft",precondition:void 0,kbOpts:{weight:_e,kbExpr:V.textInputFocus,primary:2048|1024|512|15,linux:{primary:0}}})}_getColumnSelectResult(w,_,v,C){return ir.columnSelectLeft(w.cursorConfig,w,v)}}),s.CursorColumnSelectRight=J(new class extends t{constructor(){super({id:"cursorColumnSelectRight",precondition:void 0,kbOpts:{weight:_e,kbExpr:V.textInputFocus,primary:2048|1024|512|17,linux:{primary:0}}})}_getColumnSelectResult(w,_,v,C){return ir.columnSelectRight(w.cursorConfig,w,v)}});class i extends t{constructor(_){super(_);this._isPaged=_.isPaged}_getColumnSelectResult(_,v,C,y){return ir.columnSelectUp(_.cursorConfig,_,C,this._isPaged)}}s.CursorColumnSelectUp=J(new i({isPaged:!1,id:"cursorColumnSelectUp",precondition:void 0,kbOpts:{weight:_e,kbExpr:V.textInputFocus,primary:2048|1024|512|16,linux:{primary:0}}})),s.CursorColumnSelectPageUp=J(new i({isPaged:!0,id:"cursorColumnSelectPageUp",precondition:void 0,kbOpts:{weight:_e,kbExpr:V.textInputFocus,primary:2048|1024|512|11,linux:{primary:0}}}));class n extends t{constructor(_){super(_);this._isPaged=_.isPaged}_getColumnSelectResult(_,v,C,y){return ir.columnSelectDown(_.cursorConfig,_,C,this._isPaged)}}s.CursorColumnSelectDown=J(new n({isPaged:!1,id:"cursorColumnSelectDown",precondition:void 0,kbOpts:{weight:_e,kbExpr:V.textInputFocus,primary:2048|1024|512|18,linux:{primary:0}}})),s.CursorColumnSelectPageDown=J(new n({isPaged:!0,id:"cursorColumnSelectPageDown",precondition:void 0,kbOpts:{weight:_e,kbExpr:V.textInputFocus,primary:2048|1024|512|12,linux:{primary:0}}}));class r extends it{constructor(){super({id:"cursorMove",precondition:void 0,description:Md.description})}runCoreEditorCommand(_,v){let C=Md.parse(v);!C||this._runCursorMove(_,v.source,C)}_runCursorMove(_,v,C){_.model.pushStackElement(),_.setCursorStates(v,3,r._move(_,_.getCursorStates(),C)),_.revealPrimaryCursor(v,!0)}static _move(_,v,C){let y=C.select,x=C.value;switch(C.direction){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:case 8:case 9:case 10:return Ot.simpleMove(_,v,C.direction,y,x,C.unit);case 11:case 13:case 12:case 14:return Ot.viewportMove(_,v,C.direction,y,x);default:return null}}}s.CursorMoveImpl=r,s.CursorMove=J(new r);class o extends it{constructor(_){super(_);this._staticArgs=_.args}runCoreEditorCommand(_,v){let C=this._staticArgs;this._staticArgs.value===-1&&(C={direction:this._staticArgs.direction,unit:this._staticArgs.unit,select:this._staticArgs.select,value:_.cursorConfig.pageSize}),_.model.pushStackElement(),_.setCursorStates(v.source,3,Ot.simpleMove(_,_.getCursorStates(),C.direction,C.select,C.value,C.unit)),_.revealPrimaryCursor(v.source,!0)}}s.CursorLeft=J(new o({args:{direction:0,unit:0,select:!1,value:1},id:"cursorLeft",precondition:void 0,kbOpts:{weight:_e,kbExpr:V.textInputFocus,primary:15,mac:{primary:15,secondary:[256|32]}}})),s.CursorLeftSelect=J(new o({args:{direction:0,unit:0,select:!0,value:1},id:"cursorLeftSelect",precondition:void 0,kbOpts:{weight:_e,kbExpr:V.textInputFocus,primary:1024|15}})),s.CursorRight=J(new o({args:{direction:1,unit:0,select:!1,value:1},id:"cursorRight",precondition:void 0,kbOpts:{weight:_e,kbExpr:V.textInputFocus,primary:17,mac:{primary:17,secondary:[256|36]}}})),s.CursorRightSelect=J(new o({args:{direction:1,unit:0,select:!0,value:1},id:"cursorRightSelect",precondition:void 0,kbOpts:{weight:_e,kbExpr:V.textInputFocus,primary:1024|17}})),s.CursorUp=J(new o({args:{direction:2,unit:2,select:!1,value:1},id:"cursorUp",precondition:void 0,kbOpts:{weight:_e,kbExpr:V.textInputFocus,primary:16,mac:{primary:16,secondary:[256|46]}}})),s.CursorUpSelect=J(new o({args:{direction:2,unit:2,select:!0,value:1},id:"cursorUpSelect",precondition:void 0,kbOpts:{weight:_e,kbExpr:V.textInputFocus,primary:1024|16,secondary:[2048|1024|16],mac:{primary:1024|16},linux:{primary:1024|16}}})),s.CursorPageUp=J(new o({args:{direction:2,unit:2,select:!1,value:-1},id:"cursorPageUp",precondition:void 0,kbOpts:{weight:_e,kbExpr:V.textInputFocus,primary:11}})),s.CursorPageUpSelect=J(new o({args:{direction:2,unit:2,select:!0,value:-1},id:"cursorPageUpSelect",precondition:void 0,kbOpts:{weight:_e,kbExpr:V.textInputFocus,primary:1024|11}})),s.CursorDown=J(new o({args:{direction:3,unit:2,select:!1,value:1},id:"cursorDown",precondition:void 0,kbOpts:{weight:_e,kbExpr:V.textInputFocus,primary:18,mac:{primary:18,secondary:[256|44]}}})),s.CursorDownSelect=J(new o({args:{direction:3,unit:2,select:!0,value:1},id:"cursorDownSelect",precondition:void 0,kbOpts:{weight:_e,kbExpr:V.textInputFocus,primary:1024|18,secondary:[2048|1024|18],mac:{primary:1024|18},linux:{primary:1024|18}}})),s.CursorPageDown=J(new o({args:{direction:3,unit:2,select:!1,value:-1},id:"cursorPageDown",precondition:void 0,kbOpts:{weight:_e,kbExpr:V.textInputFocus,primary:12}})),s.CursorPageDownSelect=J(new o({args:{direction:3,unit:2,select:!0,value:-1},id:"cursorPageDownSelect",precondition:void 0,kbOpts:{weight:_e,kbExpr:V.textInputFocus,primary:1024|12}})),s.CreateCursor=J(new class extends it{constructor(){super({id:"createCursor",precondition:void 0})}runCoreEditorCommand(w,_){let v;_.wholeLine?v=Ot.line(w,w.getPrimaryCursorState(),!1,_.position,_.viewPosition):v=Ot.moveTo(w,w.getPrimaryCursorState(),!1,_.position,_.viewPosition);let C=w.getCursorStates();if(C.length>1){let y=v.modelState?v.modelState.position:null,x=v.viewState?v.viewState.position:null;for(let S=0,L=C.length;Sx&&(y=x);let S=new D(y,1,y,w.model.getLineMaxColumn(y)),L=0;if(v.at)switch(v.at){case ac.RawAtArgument.Top:L=3;break;case ac.RawAtArgument.Center:L=1;break;case ac.RawAtArgument.Bottom:L=4;break;default:break}let E=w.coordinatesConverter.convertModelRangeToViewRange(S);w.revealRange(_.source,!1,E,L,0)}}),s.SelectAll=new class extends zm{constructor(){super(pL)}runDOMCommand(){at&&(document.activeElement.focus(),document.activeElement.select()),document.execCommand("selectAll")}runEditorCommand(w,_,v){let C=_._getViewModel();!C||this.runCoreEditorCommand(C,v)}runCoreEditorCommand(w,_){w.model.pushStackElement(),w.setCursorStates("keyboard",3,[Ot.selectAll(w,w.getPrimaryCursorState())])}},s.SetSelection=J(new class extends it{constructor(){super({id:"setSelection",precondition:void 0})}runCoreEditorCommand(w,_){w.model.pushStackElement(),w.setCursorStates(_.source,3,[ne.fromModelSelection(_.selection)])}})})(Lt||(Lt={}));var ZA=dt.and(V.textInputFocus,V.columnSelection);function lc(s,e){pa.registerKeybindingRule({id:s,primary:e,when:ZA,weight:_e+1})}lc(Lt.CursorColumnSelectLeft.id,1024|15);lc(Lt.CursorColumnSelectRight.id,1024|17);lc(Lt.CursorColumnSelectUp.id,1024|16);lc(Lt.CursorColumnSelectPageUp.id,1024|11);lc(Lt.CursorColumnSelectDown.id,1024|18);lc(Lt.CursorColumnSelectPageDown.id,1024|12);function LD(s){return s.register(),s}var xD;(function(s){class e extends Us{runEditorCommand(i,n,r){let o=n._getViewModel();!o||this.runCoreEditingCommand(n,o,r||{})}}s.CoreEditingCommand=e,s.LineBreakInsert=J(new class extends e{constructor(){super({id:"lineBreakInsert",precondition:V.writable,kbOpts:{weight:_e,kbExpr:V.textInputFocus,primary:0,mac:{primary:256|45}}})}runCoreEditingCommand(t,i,n){t.pushUndoStop(),t.executeCommands(this.id,je.lineBreakInsert(i.cursorConfig,i.model,i.getCursorStates().map(r=>r.modelState.selection)))}}),s.Outdent=J(new class extends e{constructor(){super({id:"outdent",precondition:V.writable,kbOpts:{weight:_e,kbExpr:dt.and(V.editorTextFocus,V.tabDoesNotMoveFocus),primary:1024|2}})}runCoreEditingCommand(t,i,n){t.pushUndoStop(),t.executeCommands(this.id,je.outdent(i.cursorConfig,i.model,i.getCursorStates().map(r=>r.modelState.selection))),t.pushUndoStop()}}),s.Tab=J(new class extends e{constructor(){super({id:"tab",precondition:V.writable,kbOpts:{weight:_e,kbExpr:dt.and(V.editorTextFocus,V.tabDoesNotMoveFocus),primary:2}})}runCoreEditingCommand(t,i,n){t.pushUndoStop(),t.executeCommands(this.id,je.tab(i.cursorConfig,i.model,i.getCursorStates().map(r=>r.modelState.selection))),t.pushUndoStop()}}),s.DeleteLeft=J(new class extends e{constructor(){super({id:"deleteLeft",precondition:void 0,kbOpts:{weight:_e,kbExpr:V.textInputFocus,primary:1,secondary:[1024|1],mac:{primary:1,secondary:[1024|1,256|38,256|1]}}})}runCoreEditingCommand(t,i,n){let[r,o]=jn.deleteLeft(i.getPrevEditOperationType(),i.cursorConfig,i.model,i.getCursorStates().map(a=>a.modelState.selection),i.getCursorAutoClosedCharacters());r&&t.pushUndoStop(),t.executeCommands(this.id,o),i.setPrevEditOperationType(2)}}),s.DeleteRight=J(new class extends e{constructor(){super({id:"deleteRight",precondition:void 0,kbOpts:{weight:_e,kbExpr:V.textInputFocus,primary:20,mac:{primary:20,secondary:[256|34,256|20]}}})}runCoreEditingCommand(t,i,n){let[r,o]=jn.deleteRight(i.getPrevEditOperationType(),i.cursorConfig,i.model,i.getCursorStates().map(a=>a.modelState.selection));r&&t.pushUndoStop(),t.executeCommands(this.id,o),i.setPrevEditOperationType(3)}}),s.Undo=new class extends zm{constructor(){super(zb)}runDOMCommand(){document.execCommand("undo")}runEditorCommand(t,i,n){if(!(!i.hasModel()||i.getOption(79)===!0))return i.getModel().undo()}},s.Redo=new class extends zm{constructor(){super(Hb)}runDOMCommand(){document.execCommand("redo")}runEditorCommand(t,i,n){if(!(!i.hasModel()||i.getOption(79)===!0))return i.getModel().redo()}}})(xD||(xD={}));var qw=class extends Kl{constructor(e,t,i){super({id:e,precondition:void 0,description:i});this._handlerId=t}runCommand(e,t){let i=e.get(qe).getFocusedCodeEditor();!i||i.trigger("keyboard",this._handlerId,t)}};function Oa(s,e){LD(new qw("default:"+s,s)),LD(new qw(s,s,e))}Oa("type",{description:"Type",args:[{name:"args",schema:{type:"object",required:["text"],properties:{text:{type:"string"}}}}]});Oa("replacePreviousChar");Oa("compositionType");Oa("compositionStart");Oa("compositionEnd");Oa("paste");Oa("cut");function Gw(s){let e=s.definition;for(;e instanceof Le;)e=e.definition;return`.codicon-${s.id}:before { content: '${e.fontCharacter}'; }`}var Hm;(function(s){s[s.Unknown=0]="Unknown",s[s.Disabled=1]="Disabled",s[s.Enabled=2]="Enabled"})(Hm||(Hm={}));var Um;(function(s){s[s.KeepWhitespace=1]="KeepWhitespace",s[s.InsertAsSnippet=4]="InsertAsSnippet"})(Um||(Um={}));var $m;(function(s){s[s.Method=0]="Method",s[s.Function=1]="Function",s[s.Constructor=2]="Constructor",s[s.Field=3]="Field",s[s.Variable=4]="Variable",s[s.Class=5]="Class",s[s.Struct=6]="Struct",s[s.Interface=7]="Interface",s[s.Module=8]="Module",s[s.Property=9]="Property",s[s.Event=10]="Event",s[s.Operator=11]="Operator",s[s.Unit=12]="Unit",s[s.Value=13]="Value",s[s.Constant=14]="Constant",s[s.Enum=15]="Enum",s[s.EnumMember=16]="EnumMember",s[s.Keyword=17]="Keyword",s[s.Text=18]="Text",s[s.Color=19]="Color",s[s.File=20]="File",s[s.Reference=21]="Reference",s[s.Customcolor=22]="Customcolor",s[s.Folder=23]="Folder",s[s.TypeParameter=24]="TypeParameter",s[s.User=25]="User",s[s.Issue=26]="Issue",s[s.Snippet=27]="Snippet"})($m||($m={}));var Km;(function(s){s[s.Deprecated=1]="Deprecated"})(Km||(Km={}));var qm;(function(s){s[s.Invoke=0]="Invoke",s[s.TriggerCharacter=1]="TriggerCharacter",s[s.TriggerForIncompleteCompletions=2]="TriggerForIncompleteCompletions"})(qm||(qm={}));var Gm;(function(s){s[s.EXACT=0]="EXACT",s[s.ABOVE=1]="ABOVE",s[s.BELOW=2]="BELOW"})(Gm||(Gm={}));var Ym;(function(s){s[s.NotSet=0]="NotSet",s[s.ContentFlush=1]="ContentFlush",s[s.RecoverFromMarkers=2]="RecoverFromMarkers",s[s.Explicit=3]="Explicit",s[s.Paste=4]="Paste",s[s.Undo=5]="Undo",s[s.Redo=6]="Redo"})(Ym||(Ym={}));var Zm;(function(s){s[s.LF=1]="LF",s[s.CRLF=2]="CRLF"})(Zm||(Zm={}));var Xm;(function(s){s[s.Text=0]="Text",s[s.Read=1]="Read",s[s.Write=2]="Write"})(Xm||(Xm={}));var Qm;(function(s){s[s.None=0]="None",s[s.Keep=1]="Keep",s[s.Brackets=2]="Brackets",s[s.Advanced=3]="Advanced",s[s.Full=4]="Full"})(Qm||(Qm={}));var Jm;(function(s){s[s.acceptSuggestionOnCommitCharacter=0]="acceptSuggestionOnCommitCharacter",s[s.acceptSuggestionOnEnter=1]="acceptSuggestionOnEnter",s[s.accessibilitySupport=2]="accessibilitySupport",s[s.accessibilityPageSize=3]="accessibilityPageSize",s[s.ariaLabel=4]="ariaLabel",s[s.autoClosingBrackets=5]="autoClosingBrackets",s[s.autoClosingDelete=6]="autoClosingDelete",s[s.autoClosingOvertype=7]="autoClosingOvertype",s[s.autoClosingQuotes=8]="autoClosingQuotes",s[s.autoIndent=9]="autoIndent",s[s.automaticLayout=10]="automaticLayout",s[s.autoSurround=11]="autoSurround",s[s.codeLens=12]="codeLens",s[s.codeLensFontFamily=13]="codeLensFontFamily",s[s.codeLensFontSize=14]="codeLensFontSize",s[s.colorDecorators=15]="colorDecorators",s[s.columnSelection=16]="columnSelection",s[s.comments=17]="comments",s[s.contextmenu=18]="contextmenu",s[s.copyWithSyntaxHighlighting=19]="copyWithSyntaxHighlighting",s[s.cursorBlinking=20]="cursorBlinking",s[s.cursorSmoothCaretAnimation=21]="cursorSmoothCaretAnimation",s[s.cursorStyle=22]="cursorStyle",s[s.cursorSurroundingLines=23]="cursorSurroundingLines",s[s.cursorSurroundingLinesStyle=24]="cursorSurroundingLinesStyle",s[s.cursorWidth=25]="cursorWidth",s[s.disableLayerHinting=26]="disableLayerHinting",s[s.disableMonospaceOptimizations=27]="disableMonospaceOptimizations",s[s.domReadOnly=28]="domReadOnly",s[s.dragAndDrop=29]="dragAndDrop",s[s.emptySelectionClipboard=30]="emptySelectionClipboard",s[s.extraEditorClassName=31]="extraEditorClassName",s[s.fastScrollSensitivity=32]="fastScrollSensitivity",s[s.find=33]="find",s[s.fixedOverflowWidgets=34]="fixedOverflowWidgets",s[s.folding=35]="folding",s[s.foldingStrategy=36]="foldingStrategy",s[s.foldingHighlight=37]="foldingHighlight",s[s.foldingImportsByDefault=38]="foldingImportsByDefault",s[s.unfoldOnClickAfterEndOfLine=39]="unfoldOnClickAfterEndOfLine",s[s.fontFamily=40]="fontFamily",s[s.fontInfo=41]="fontInfo",s[s.fontLigatures=42]="fontLigatures",s[s.fontSize=43]="fontSize",s[s.fontWeight=44]="fontWeight",s[s.formatOnPaste=45]="formatOnPaste",s[s.formatOnType=46]="formatOnType",s[s.glyphMargin=47]="glyphMargin",s[s.gotoLocation=48]="gotoLocation",s[s.hideCursorInOverviewRuler=49]="hideCursorInOverviewRuler",s[s.highlightActiveIndentGuide=50]="highlightActiveIndentGuide",s[s.hover=51]="hover",s[s.inDiffEditor=52]="inDiffEditor",s[s.inlineSuggest=53]="inlineSuggest",s[s.letterSpacing=54]="letterSpacing",s[s.lightbulb=55]="lightbulb",s[s.lineDecorationsWidth=56]="lineDecorationsWidth",s[s.lineHeight=57]="lineHeight",s[s.lineNumbers=58]="lineNumbers",s[s.lineNumbersMinChars=59]="lineNumbersMinChars",s[s.linkedEditing=60]="linkedEditing",s[s.links=61]="links",s[s.matchBrackets=62]="matchBrackets",s[s.minimap=63]="minimap",s[s.mouseStyle=64]="mouseStyle",s[s.mouseWheelScrollSensitivity=65]="mouseWheelScrollSensitivity",s[s.mouseWheelZoom=66]="mouseWheelZoom",s[s.multiCursorMergeOverlapping=67]="multiCursorMergeOverlapping",s[s.multiCursorModifier=68]="multiCursorModifier",s[s.multiCursorPaste=69]="multiCursorPaste",s[s.occurrencesHighlight=70]="occurrencesHighlight",s[s.overviewRulerBorder=71]="overviewRulerBorder",s[s.overviewRulerLanes=72]="overviewRulerLanes",s[s.padding=73]="padding",s[s.parameterHints=74]="parameterHints",s[s.peekWidgetDefaultFocus=75]="peekWidgetDefaultFocus",s[s.definitionLinkOpensInPeek=76]="definitionLinkOpensInPeek",s[s.quickSuggestions=77]="quickSuggestions",s[s.quickSuggestionsDelay=78]="quickSuggestionsDelay",s[s.readOnly=79]="readOnly",s[s.renameOnType=80]="renameOnType",s[s.renderControlCharacters=81]="renderControlCharacters",s[s.renderIndentGuides=82]="renderIndentGuides",s[s.renderFinalNewline=83]="renderFinalNewline",s[s.renderLineHighlight=84]="renderLineHighlight",s[s.renderLineHighlightOnlyWhenFocus=85]="renderLineHighlightOnlyWhenFocus",s[s.renderValidationDecorations=86]="renderValidationDecorations",s[s.renderWhitespace=87]="renderWhitespace",s[s.revealHorizontalRightPadding=88]="revealHorizontalRightPadding",s[s.roundedSelection=89]="roundedSelection",s[s.rulers=90]="rulers",s[s.scrollbar=91]="scrollbar",s[s.scrollBeyondLastColumn=92]="scrollBeyondLastColumn",s[s.scrollBeyondLastLine=93]="scrollBeyondLastLine",s[s.scrollPredominantAxis=94]="scrollPredominantAxis",s[s.selectionClipboard=95]="selectionClipboard",s[s.selectionHighlight=96]="selectionHighlight",s[s.selectOnLineNumbers=97]="selectOnLineNumbers",s[s.showFoldingControls=98]="showFoldingControls",s[s.showUnused=99]="showUnused",s[s.snippetSuggestions=100]="snippetSuggestions",s[s.smartSelect=101]="smartSelect",s[s.smoothScrolling=102]="smoothScrolling",s[s.stickyTabStops=103]="stickyTabStops",s[s.stopRenderingLineAfter=104]="stopRenderingLineAfter",s[s.suggest=105]="suggest",s[s.suggestFontSize=106]="suggestFontSize",s[s.suggestLineHeight=107]="suggestLineHeight",s[s.suggestOnTriggerCharacters=108]="suggestOnTriggerCharacters",s[s.suggestSelection=109]="suggestSelection",s[s.tabCompletion=110]="tabCompletion",s[s.tabIndex=111]="tabIndex",s[s.unusualLineTerminators=112]="unusualLineTerminators",s[s.useShadowDOM=113]="useShadowDOM",s[s.useTabStops=114]="useTabStops",s[s.wordSeparators=115]="wordSeparators",s[s.wordWrap=116]="wordWrap",s[s.wordWrapBreakAfterCharacters=117]="wordWrapBreakAfterCharacters",s[s.wordWrapBreakBeforeCharacters=118]="wordWrapBreakBeforeCharacters",s[s.wordWrapColumn=119]="wordWrapColumn",s[s.wordWrapOverride1=120]="wordWrapOverride1",s[s.wordWrapOverride2=121]="wordWrapOverride2",s[s.wrappingIndent=122]="wrappingIndent",s[s.wrappingStrategy=123]="wrappingStrategy",s[s.showDeprecated=124]="showDeprecated",s[s.inlayHints=125]="inlayHints",s[s.editorClassName=126]="editorClassName",s[s.pixelRatio=127]="pixelRatio",s[s.tabFocusMode=128]="tabFocusMode",s[s.layoutInfo=129]="layoutInfo",s[s.wrappingInfo=130]="wrappingInfo"})(Jm||(Jm={}));var eg;(function(s){s[s.TextDefined=0]="TextDefined",s[s.LF=1]="LF",s[s.CRLF=2]="CRLF"})(eg||(eg={}));var tg;(function(s){s[s.LF=0]="LF",s[s.CRLF=1]="CRLF"})(tg||(tg={}));var ig;(function(s){s[s.None=0]="None",s[s.Indent=1]="Indent",s[s.IndentOutdent=2]="IndentOutdent",s[s.Outdent=3]="Outdent"})(ig||(ig={}));var ng;(function(s){s[s.Other=0]="Other",s[s.Type=1]="Type",s[s.Parameter=2]="Parameter"})(ng||(ng={}));var sg;(function(s){s[s.Automatic=0]="Automatic",s[s.Explicit=1]="Explicit"})(sg||(sg={}));var rg;(function(s){s[s.DependsOnKbLayout=-1]="DependsOnKbLayout",s[s.Unknown=0]="Unknown",s[s.Backspace=1]="Backspace",s[s.Tab=2]="Tab",s[s.Enter=3]="Enter",s[s.Shift=4]="Shift",s[s.Ctrl=5]="Ctrl",s[s.Alt=6]="Alt",s[s.PauseBreak=7]="PauseBreak",s[s.CapsLock=8]="CapsLock",s[s.Escape=9]="Escape",s[s.Space=10]="Space",s[s.PageUp=11]="PageUp",s[s.PageDown=12]="PageDown",s[s.End=13]="End",s[s.Home=14]="Home",s[s.LeftArrow=15]="LeftArrow",s[s.UpArrow=16]="UpArrow",s[s.RightArrow=17]="RightArrow",s[s.DownArrow=18]="DownArrow",s[s.Insert=19]="Insert",s[s.Delete=20]="Delete",s[s.KEY_0=21]="KEY_0",s[s.KEY_1=22]="KEY_1",s[s.KEY_2=23]="KEY_2",s[s.KEY_3=24]="KEY_3",s[s.KEY_4=25]="KEY_4",s[s.KEY_5=26]="KEY_5",s[s.KEY_6=27]="KEY_6",s[s.KEY_7=28]="KEY_7",s[s.KEY_8=29]="KEY_8",s[s.KEY_9=30]="KEY_9",s[s.KEY_A=31]="KEY_A",s[s.KEY_B=32]="KEY_B",s[s.KEY_C=33]="KEY_C",s[s.KEY_D=34]="KEY_D",s[s.KEY_E=35]="KEY_E",s[s.KEY_F=36]="KEY_F",s[s.KEY_G=37]="KEY_G",s[s.KEY_H=38]="KEY_H",s[s.KEY_I=39]="KEY_I",s[s.KEY_J=40]="KEY_J",s[s.KEY_K=41]="KEY_K",s[s.KEY_L=42]="KEY_L",s[s.KEY_M=43]="KEY_M",s[s.KEY_N=44]="KEY_N",s[s.KEY_O=45]="KEY_O",s[s.KEY_P=46]="KEY_P",s[s.KEY_Q=47]="KEY_Q",s[s.KEY_R=48]="KEY_R",s[s.KEY_S=49]="KEY_S",s[s.KEY_T=50]="KEY_T",s[s.KEY_U=51]="KEY_U",s[s.KEY_V=52]="KEY_V",s[s.KEY_W=53]="KEY_W",s[s.KEY_X=54]="KEY_X",s[s.KEY_Y=55]="KEY_Y",s[s.KEY_Z=56]="KEY_Z",s[s.Meta=57]="Meta",s[s.ContextMenu=58]="ContextMenu",s[s.F1=59]="F1",s[s.F2=60]="F2",s[s.F3=61]="F3",s[s.F4=62]="F4",s[s.F5=63]="F5",s[s.F6=64]="F6",s[s.F7=65]="F7",s[s.F8=66]="F8",s[s.F9=67]="F9",s[s.F10=68]="F10",s[s.F11=69]="F11",s[s.F12=70]="F12",s[s.F13=71]="F13",s[s.F14=72]="F14",s[s.F15=73]="F15",s[s.F16=74]="F16",s[s.F17=75]="F17",s[s.F18=76]="F18",s[s.F19=77]="F19",s[s.NumLock=78]="NumLock",s[s.ScrollLock=79]="ScrollLock",s[s.US_SEMICOLON=80]="US_SEMICOLON",s[s.US_EQUAL=81]="US_EQUAL",s[s.US_COMMA=82]="US_COMMA",s[s.US_MINUS=83]="US_MINUS",s[s.US_DOT=84]="US_DOT",s[s.US_SLASH=85]="US_SLASH",s[s.US_BACKTICK=86]="US_BACKTICK",s[s.US_OPEN_SQUARE_BRACKET=87]="US_OPEN_SQUARE_BRACKET",s[s.US_BACKSLASH=88]="US_BACKSLASH",s[s.US_CLOSE_SQUARE_BRACKET=89]="US_CLOSE_SQUARE_BRACKET",s[s.US_QUOTE=90]="US_QUOTE",s[s.OEM_8=91]="OEM_8",s[s.OEM_102=92]="OEM_102",s[s.NUMPAD_0=93]="NUMPAD_0",s[s.NUMPAD_1=94]="NUMPAD_1",s[s.NUMPAD_2=95]="NUMPAD_2",s[s.NUMPAD_3=96]="NUMPAD_3",s[s.NUMPAD_4=97]="NUMPAD_4",s[s.NUMPAD_5=98]="NUMPAD_5",s[s.NUMPAD_6=99]="NUMPAD_6",s[s.NUMPAD_7=100]="NUMPAD_7",s[s.NUMPAD_8=101]="NUMPAD_8",s[s.NUMPAD_9=102]="NUMPAD_9",s[s.NUMPAD_MULTIPLY=103]="NUMPAD_MULTIPLY",s[s.NUMPAD_ADD=104]="NUMPAD_ADD",s[s.NUMPAD_SEPARATOR=105]="NUMPAD_SEPARATOR",s[s.NUMPAD_SUBTRACT=106]="NUMPAD_SUBTRACT",s[s.NUMPAD_DECIMAL=107]="NUMPAD_DECIMAL",s[s.NUMPAD_DIVIDE=108]="NUMPAD_DIVIDE",s[s.KEY_IN_COMPOSITION=109]="KEY_IN_COMPOSITION",s[s.ABNT_C1=110]="ABNT_C1",s[s.ABNT_C2=111]="ABNT_C2",s[s.MAX_VALUE=112]="MAX_VALUE"})(rg||(rg={}));var og;(function(s){s[s.Hint=1]="Hint",s[s.Info=2]="Info",s[s.Warning=4]="Warning",s[s.Error=8]="Error"})(og||(og={}));var ag;(function(s){s[s.Unnecessary=1]="Unnecessary",s[s.Deprecated=2]="Deprecated"})(ag||(ag={}));var lg;(function(s){s[s.Inline=1]="Inline",s[s.Gutter=2]="Gutter"})(lg||(lg={}));var cg;(function(s){s[s.UNKNOWN=0]="UNKNOWN",s[s.TEXTAREA=1]="TEXTAREA",s[s.GUTTER_GLYPH_MARGIN=2]="GUTTER_GLYPH_MARGIN",s[s.GUTTER_LINE_NUMBERS=3]="GUTTER_LINE_NUMBERS",s[s.GUTTER_LINE_DECORATIONS=4]="GUTTER_LINE_DECORATIONS",s[s.GUTTER_VIEW_ZONE=5]="GUTTER_VIEW_ZONE",s[s.CONTENT_TEXT=6]="CONTENT_TEXT",s[s.CONTENT_EMPTY=7]="CONTENT_EMPTY",s[s.CONTENT_VIEW_ZONE=8]="CONTENT_VIEW_ZONE",s[s.CONTENT_WIDGET=9]="CONTENT_WIDGET",s[s.OVERVIEW_RULER=10]="OVERVIEW_RULER",s[s.SCROLLBAR=11]="SCROLLBAR",s[s.OVERLAY_WIDGET=12]="OVERLAY_WIDGET",s[s.OUTSIDE_EDITOR=13]="OUTSIDE_EDITOR"})(cg||(cg={}));var hg;(function(s){s[s.TOP_RIGHT_CORNER=0]="TOP_RIGHT_CORNER",s[s.BOTTOM_RIGHT_CORNER=1]="BOTTOM_RIGHT_CORNER",s[s.TOP_CENTER=2]="TOP_CENTER"})(hg||(hg={}));var dg;(function(s){s[s.Left=1]="Left",s[s.Center=2]="Center",s[s.Right=4]="Right",s[s.Full=7]="Full"})(dg||(dg={}));var ug;(function(s){s[s.Off=0]="Off",s[s.On=1]="On",s[s.Relative=2]="Relative",s[s.Interval=3]="Interval",s[s.Custom=4]="Custom"})(ug||(ug={}));var fg;(function(s){s[s.None=0]="None",s[s.Text=1]="Text",s[s.Blocks=2]="Blocks"})(fg||(fg={}));var mg;(function(s){s[s.Smooth=0]="Smooth",s[s.Immediate=1]="Immediate"})(mg||(mg={}));var gg;(function(s){s[s.Auto=1]="Auto",s[s.Hidden=2]="Hidden",s[s.Visible=3]="Visible"})(gg||(gg={}));var pg;(function(s){s[s.LTR=0]="LTR",s[s.RTL=1]="RTL"})(pg||(pg={}));var _g;(function(s){s[s.Invoke=1]="Invoke",s[s.TriggerCharacter=2]="TriggerCharacter",s[s.ContentChange=3]="ContentChange"})(_g||(_g={}));var bg;(function(s){s[s.File=0]="File",s[s.Module=1]="Module",s[s.Namespace=2]="Namespace",s[s.Package=3]="Package",s[s.Class=4]="Class",s[s.Method=5]="Method",s[s.Property=6]="Property",s[s.Field=7]="Field",s[s.Constructor=8]="Constructor",s[s.Enum=9]="Enum",s[s.Interface=10]="Interface",s[s.Function=11]="Function",s[s.Variable=12]="Variable",s[s.Constant=13]="Constant",s[s.String=14]="String",s[s.Number=15]="Number",s[s.Boolean=16]="Boolean",s[s.Array=17]="Array",s[s.Object=18]="Object",s[s.Key=19]="Key",s[s.Null=20]="Null",s[s.EnumMember=21]="EnumMember",s[s.Struct=22]="Struct",s[s.Event=23]="Event",s[s.Operator=24]="Operator",s[s.TypeParameter=25]="TypeParameter"})(bg||(bg={}));var wg;(function(s){s[s.Deprecated=1]="Deprecated"})(wg||(wg={}));var vg;(function(s){s[s.Hidden=0]="Hidden",s[s.Blink=1]="Blink",s[s.Smooth=2]="Smooth",s[s.Phase=3]="Phase",s[s.Expand=4]="Expand",s[s.Solid=5]="Solid"})(vg||(vg={}));var Cg;(function(s){s[s.Line=1]="Line",s[s.Block=2]="Block",s[s.Underline=3]="Underline",s[s.LineThin=4]="LineThin",s[s.BlockOutline=5]="BlockOutline",s[s.UnderlineThin=6]="UnderlineThin"})(Cg||(Cg={}));var Sg;(function(s){s[s.AlwaysGrowsWhenTypingAtEdges=0]="AlwaysGrowsWhenTypingAtEdges",s[s.NeverGrowsWhenTypingAtEdges=1]="NeverGrowsWhenTypingAtEdges",s[s.GrowsOnlyWhenTypingBefore=2]="GrowsOnlyWhenTypingBefore",s[s.GrowsOnlyWhenTypingAfter=3]="GrowsOnlyWhenTypingAfter"})(Sg||(Sg={}));var yg;(function(s){s[s.None=0]="None",s[s.Same=1]="Same",s[s.Indent=2]="Indent",s[s.DeepIndent=3]="DeepIndent"})(yg||(yg={}));var cc=class{static chord(e,t){return ry(e,t)}};cc.CtrlCmd=2048;cc.Shift=1024;cc.Alt=512;cc.WinCtrl=256;function Lg(){return{editor:void 0,languages:void 0,CancellationTokenSource:hi,Emitter:k,KeyCode:rg,KeyMod:cc,Position:N,Range:D,Selection:Z,SelectionDirection:pg,MarkerSeverity:og,MarkerTag:ag,Uri:K,Token:tr}}function Yw(s){let e=JSON.parse(s);return e=Zw(e),e}function Zw(s,e=0){if(!s||e>200)return s;if(typeof s=="object"){switch(s.$mid){case 1:return K.revive(s);case 2:return new RegExp(s.source,s.flags)}if(s instanceof Sa||s instanceof Uint8Array)return s;if(Array.isArray(s))for(let t=0;t=0;a--)(o=s[a])&&(r=(n<3?o(r):n>3?o(e,t,r):o(e,t))||r);return n>3&&r&&Object.defineProperty(e,t,r),r},xg=function(s,e){return function(t,i){e(t,i,s)}},Fa=function(s,e,t,i){function n(r){return r instanceof t?r:new t(function(o){o(r)})}return new(t||(t=Promise))(function(r,o){function a(h){try{c(i.next(h))}catch(d){o(d)}}function l(h){try{c(i.throw(h))}catch(d){o(d)}}function c(h){h.done?r(h.value):n(h.value).then(a,l)}c((i=i.apply(s,e||[])).next())})},Jw=class{constructor(e){this._commandService=e}open(e,t){return Fa(this,void 0,void 0,function*(){if(!Pa(e,Ce.command))return!1;if(!(t==null?void 0:t.allowCommands))return!0;typeof e=="string"&&(e=K.parse(e));let i=[];try{i=Yw(decodeURIComponent(e.query))}catch(n){try{i=Yw(e.query)}catch(r){}}return Array.isArray(i)||(i=[i]),yield this._commandService.executeCommand(e.path,...i),!0})}};Jw=Qw([xg(0,It)],Jw);var ev=class{constructor(e){this._editorService=e}open(e,t){return Fa(this,void 0,void 0,function*(){typeof e=="string"&&(e=K.parse(e));let i,n=/^L?(\d+)(?:,(\d+))?/.exec(e.fragment);return n&&(i={startLineNumber:parseInt(n[1]),startColumn:n[2]?parseInt(n[2]):1},e=e.with({fragment:""})),e.scheme===Ce.file&&(e=ex(e)),yield this._editorService.openCodeEditor({resource:e,options:Object.assign({selection:i,context:(t==null?void 0:t.fromUserGesture)?Rd.USER:Rd.API},t==null?void 0:t.editorOptions)},this._editorService.getFocusedCodeEditor(),t==null?void 0:t.openToSide),!0})}};ev=Qw([xg(0,qe)],ev);var Dg=class{constructor(e,t){this._openers=new Ht,this._validators=new Ht,this._resolvers=new Ht,this._resolvedUriTargets=new At(i=>i.with({path:null,fragment:null,query:null}).toString()),this._externalOpeners=new Ht,this._defaultExternalOpener={openExternal:i=>Fa(this,void 0,void 0,function*(){return Pa(i,Ce.http)||Pa(i,Ce.https)?zf(i):window.location.href=i,!0})},this._openers.push({open:(i,n)=>Fa(this,void 0,void 0,function*(){return(n==null?void 0:n.openExternal)||Pa(i,Ce.mailto)||Pa(i,Ce.http)||Pa(i,Ce.https)?(yield this._doOpenExternal(i,n),!0):!1})}),this._openers.push(new Jw(t)),this._openers.push(new ev(e))}registerOpener(e){return{dispose:this._openers.unshift(e)}}registerValidator(e){return{dispose:this._validators.push(e)}}registerExternalUriResolver(e){return{dispose:this._resolvers.push(e)}}setDefaultExternalOpener(e){this._defaultExternalOpener=e}registerExternalOpener(e){return{dispose:this._externalOpeners.push(e)}}open(e,t){var i;return Fa(this,void 0,void 0,function*(){let n=typeof e=="string"?K.parse(e):e,r=(i=this._resolvedUriTargets.get(n))!==null&&i!==void 0?i:e;for(let o of this._validators)if(!(yield o.shouldOpen(r)))return!1;for(let o of this._openers)if(yield o.open(e,t))return!0;return!1})}resolveExternalUri(e,t){return Fa(this,void 0,void 0,function*(){for(let i of this._resolvers)try{let n=yield i.resolveExternalUri(e,t);if(n)return this._resolvedUriTargets.has(n.resolved)||this._resolvedUriTargets.set(n.resolved,e),n}catch(n){}throw new Error("Could not resolve external URI: "+e.toString())})}_doOpenExternal(e,t){return Fa(this,void 0,void 0,function*(){let i=typeof e=="string"?K.parse(e):e,n;try{n=(yield this.resolveExternalUri(i,t)).resolved}catch(o){n=i}let r;if(typeof e=="string"&&i.toString()===n.toString()?r=e:r=encodeURI(n.toString(!0)),t==null?void 0:t.allowContributedOpeners){let o=typeof(t==null?void 0:t.allowContributedOpeners)=="string"?t==null?void 0:t.allowContributedOpeners:void 0;for(let a of this._externalOpeners)if(yield a.openExternal(r,{sourceUri:i,preferredOpenerId:o},Wt.None))return!0}return this._defaultExternalOpener.openExternal(r,{sourceUri:i},Wt.None)})}dispose(){this._validators.clear()}};Dg=Qw([xg(0,qe),xg(1,It)],Dg);function nr(s){if(!s||typeof s!="object"||s instanceof RegExp)return s;let e=Array.isArray(s)?[]:{};return Object.keys(s).forEach(t=>{s[t]&&typeof s[t]=="object"?e[t]=nr(s[t]):e[t]=s[t]}),e}function ED(s){if(!s||typeof s!="object")return s;let e=[s];for(;e.length>0;){let t=e.shift();Object.freeze(t);for(let i in t)if(kD.call(t,i)){let n=t[i];typeof n=="object"&&!Object.isFrozen(n)&&e.push(n)}}return s}var kD=Object.prototype.hasOwnProperty;function U6(s,e){return tv(s,e,new Set)}function tv(s,e,t){if(Jt(s))return s;let i=e(s);if(typeof i!="undefined")return i;if(iy(s)){let n=[];for(let r of s)n.push(tv(r,e,t));return n}if(Ft(s)){if(t.has(s))throw new Error("Cannot clone recursive data-structure");t.add(s);let n={};for(let r in s)kD.call(s,r)&&(n[r]=tv(s[r],e,t));return t.delete(s),n}return s}function Pi(s,e,t=!0){return Ft(s)?(Ft(e)&&Object.keys(e).forEach(i=>{i in s?t&&(Ft(s[i])&&Ft(e[i])?Pi(s[i],e[i],t):s[i]=e[i]):s[i]=e[i]}),s):e}function an(s,e){if(s===e)return!0;if(s==null||e===null||e===void 0||typeof s!=typeof e||typeof s!="object"||Array.isArray(s)!==Array.isArray(e))return!1;let t,i;if(Array.isArray(s)){if(s.length!==e.length)return!1;for(t=0;tthis.dispose())),this._register(this._editor.onDidUpdateDiff(()=>this._onDiffUpdated())),this._options.followsCaret&&this._register(this._editor.getModifiedEditor().onDidChangeCursorPosition(i=>{this.ignoreSelectionChange||(this.nextIdx=-1)})),this._options.alwaysRevealFirst&&this._register(this._editor.getModifiedEditor().onDidChangeModel(i=>{this.revealFirst=!0})),this._init()}_init(){!!this._editor.getLineChanges()}_onDiffUpdated(){this._init(),this._compute(this._editor.getLineChanges()),this.revealFirst&&this._editor.getLineChanges()!==null&&(this.revealFirst=!1,this.nextIdx=-1,this.next(1))}_compute(e){this.ranges=[],e&&e.forEach(t=>{!this._options.ignoreCharChanges&&t.charChanges?t.charChanges.forEach(i=>{this.ranges.push({rhs:!0,range:new D(i.modifiedStartLineNumber,i.modifiedStartColumn,i.modifiedEndLineNumber,i.modifiedEndColumn)})}):this.ranges.push({rhs:!0,range:new D(t.modifiedStartLineNumber,1,t.modifiedStartLineNumber,1)})}),this.ranges.sort((t,i)=>t.range.getStartPosition().isBeforeOrEqual(i.range.getStartPosition())?-1:i.range.getStartPosition().isBeforeOrEqual(t.range.getStartPosition())?1:0),this._onDidUpdate.fire(this)}_initIdx(e){let t=!1,i=this._editor.getPosition();if(!i){this.nextIdx=0;return}for(let n=0,r=this.ranges.length;n=this.ranges.length&&(this.nextIdx=0)):(this.nextIdx-=1,this.nextIdx<0&&(this.nextIdx=this.ranges.length-1));let i=this.ranges[this.nextIdx];this.ignoreSelectionChange=!0;try{let n=i.range.getStartPosition();this._editor.setPosition(n),this._editor.revealPositionInCenter(n,t)}finally{this.ignoreSelectionChange=!1}}canNavigate(){return this.ranges&&this.ranges.length>0}next(e=0){this._move(!0,e)}previous(e=0){this._move(!1,e)}dispose(){super.dispose(),this.ranges=[],this.disposed=!0}};var Ba=new class{constructor(){this._zoomLevel=0,this._onDidChangeZoomLevel=new k,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event}getZoomLevel(){return this._zoomLevel}setZoomLevel(s){s=Math.min(Math.max(-5,s),20),this._zoomLevel!==s&&(this._zoomLevel=s,this._onDidChangeZoomLevel.fire(this._zoomLevel))}};var QA=ee?1.5:1.35,nv=8,sr=class{constructor(e){this._bareFontInfoBrand=void 0,this.zoomLevel=e.zoomLevel,this.pixelRatio=e.pixelRatio,this.fontFamily=String(e.fontFamily),this.fontWeight=String(e.fontWeight),this.fontSize=e.fontSize,this.fontFeatureSettings=e.fontFeatureSettings,this.lineHeight=e.lineHeight|0,this.letterSpacing=e.letterSpacing}static createFromValidatedSettings(e,t,i,n){let r=e.get(40),o=e.get(44),a=e.get(43),l=e.get(42),c=e.get(57),h=e.get(54);return sr._create(r,o,a,l,c,h,t,i,n)}static _create(e,t,i,n,r,o,a,l,c){r===0?r=QA*i:r{this._pendingReplies[i]={resolve:n,reject:r},this._send({vsWorker:this._workerId,req:i,method:e,args:t})})}handleMessage(e){!e||!e.vsWorker||this._workerId!==-1&&e.vsWorker!==this._workerId||this._handleMessage(e)}_handleMessage(e){if(e.seq){let r=e;if(!this._pendingReplies[r.seq]){console.warn("Got reply to unknown seq");return}let o=this._pendingReplies[r.seq];if(delete this._pendingReplies[r.seq],r.err){let a=r.err;r.err.$isError&&(a=new Error,a.name=r.err.name,a.message=r.err.message,a.stack=r.err.stack),o.reject(a);return}o.resolve(r.res);return}let t=e,i=t.req;this._handler.handleMessage(t.method,t.args).then(r=>{this._send({vsWorker:this._workerId,seq:i,res:r,err:void 0})},r=>{r.detail instanceof Error&&(r.detail=G_(r.detail)),this._send({vsWorker:this._workerId,seq:i,res:void 0,err:G_(r)})})}_send(e){let t=[];if(e.req){let i=e;for(let n=0;n{this._protocol.handleMessage(l)},l=>{n&&n(l)})),this._protocol=new TD({sendMessage:(l,c)=>{this._worker.postMessage(l,c)},handleMessage:(l,c)=>{if(typeof i[l]!="function")return Promise.reject(new Error("Missing method "+l+" on main thread host."));try{return Promise.resolve(i[l].apply(i,c))}catch(h){return Promise.reject(h)}}}),this._protocol.setWorkerId(this._worker.getId());let r=null;typeof self.require!="undefined"&&typeof self.require.getConfig=="function"?r=self.require.getConfig():typeof self.requirejs!="undefined"&&(r=self.requirejs.s.contexts._.config);let o=Dl(i);this._onModuleLoaded=this._protocol.sendMessage(t4,[this._worker.getId(),JSON.parse(JSON.stringify(r)),t,o]);let a=(l,c)=>this._request(l,c);this._lazyProxy=new Promise((l,c)=>{n=c,this._onModuleLoaded.then(h=>{l(Ef(h,a))},h=>{c(h),this._onError("Worker failed to load "+t,h)})})}getProxyObject(){return this._lazyProxy}_request(e,t){return new Promise((i,n)=>{this._onModuleLoaded.then(()=>{this._protocol.sendMessage(e,t).then(i,n)},n)})}_onError(e,t){console.error(e),console.info(t)}};var rv,MD=(rv=window.trustedTypes)===null||rv===void 0?void 0:rv.createPolicy("defaultWorkerFactory",{createScriptURL:s=>s});function i4(s,e){if(Be.MonacoEnvironment){if(typeof Be.MonacoEnvironment.getWorker=="function")return Be.MonacoEnvironment.getWorker(s,e);if(typeof Be.MonacoEnvironment.getWorkerUrl=="function"){let t=Be.MonacoEnvironment.getWorkerUrl(s,e);return new Worker(MD?MD.createScriptURL(t):t,{name:e})}}throw new Error("You must define a function MonacoEnvironment.getWorkerUrl or MonacoEnvironment.getWorker")}function n4(s){return typeof s.then=="function"}var RD=class{constructor(e,t,i,n,r){this.id=t;let o=i4("workerMain.js",i);n4(o)?this.worker=o:this.worker=Promise.resolve(o),this.postMessage(e,[]),this.worker.then(a=>{a.onmessage=function(l){n(l.data)},a.onmessageerror=r,typeof a.addEventListener=="function"&&a.addEventListener("error",r)})}getId(){return this.id}postMessage(e,t){this.worker&&this.worker.then(i=>i.postMessage(e,t))}dispose(){this.worker&&this.worker.then(e=>e.terminate()),this.worker=null}},uc=class{constructor(e){this._label=e,this._webWorkerFailedBeforeError=!1}create(e,t,i){let n=++uc.LAST_WORKER_ID;if(this._webWorkerFailedBeforeError)throw this._webWorkerFailedBeforeError;return new RD(e,n,this._label||"anonymous"+n,t,r=>{Ad(r),this._webWorkerFailedBeforeError=r,i(r)})}};uc.LAST_WORKER_ID=0;var _s=class{constructor(e,t,i,n){this.originalStart=e,this.originalLength=t,this.modifiedStart=i,this.modifiedLength=n}getOriginalEnd(){return this.originalStart+this.originalLength}getModifiedEnd(){return this.modifiedStart+this.modifiedLength}};var ov=class{constructor(e){this.source=e}getElements(){let e=this.source,t=new Int32Array(e.length);for(let i=0,n=e.length;i0||this.m_modifiedCount>0)&&this.m_changes.push(new _s(this.m_originalStart,this.m_originalCount,this.m_modifiedStart,this.m_modifiedCount)),this.m_originalCount=0,this.m_modifiedCount=0,this.m_originalStart=1073741824,this.m_modifiedStart=1073741824}AddOriginalElement(e,t){this.m_originalStart=Math.min(this.m_originalStart,e),this.m_modifiedStart=Math.min(this.m_modifiedStart,t),this.m_originalCount++}AddModifiedElement(e,t){this.m_originalStart=Math.min(this.m_originalStart,e),this.m_modifiedStart=Math.min(this.m_modifiedStart,t),this.m_modifiedCount++}getChanges(){return(this.m_originalCount>0||this.m_modifiedCount>0)&&this.MarkNextChange(),this.m_changes}getReverseChanges(){return(this.m_originalCount>0||this.m_modifiedCount>0)&&this.MarkNextChange(),this.m_changes.reverse(),this.m_changes}},xn=class{constructor(e,t,i=null){this.ContinueProcessingPredicate=i,this._originalSequence=e,this._modifiedSequence=t;let[n,r,o]=xn._getElements(e),[a,l,c]=xn._getElements(t);this._hasStrings=o&&c,this._originalStringElements=n,this._originalElementsOrHash=r,this._modifiedStringElements=a,this._modifiedElementsOrHash=l,this.m_forwardHistory=[],this.m_reverseHistory=[]}static _isStringArray(e){return e.length>0&&typeof e[0]=="string"}static _getElements(e){let t=e.getElements();if(xn._isStringArray(t)){let i=new Int32Array(t.length);for(let n=0,r=t.length;n=e&&n>=i&&this.ElementsAreEqual(t,n);)t--,n--;if(e>t||i>n){let d;return i<=n?(Wa.Assert(e===t+1,"originalStart should only be one more than originalEnd"),d=[new _s(e,0,i,n-i+1)]):e<=t?(Wa.Assert(i===n+1,"modifiedStart should only be one more than modifiedEnd"),d=[new _s(e,t-e+1,i,0)]):(Wa.Assert(e===t+1,"originalStart should only be one more than originalEnd"),Wa.Assert(i===n+1,"modifiedStart should only be one more than modifiedEnd"),d=[]),d}let o=[0],a=[0],l=this.ComputeRecursionPoint(e,t,i,n,o,a,r),c=o[0],h=a[0];if(l!==null)return l;if(!r[0]){let d=this.ComputeDiffRecursive(e,c,i,h,r),u=[];return r[0]?u=[new _s(c+1,t-(c+1)+1,h+1,n-(h+1)+1)]:u=this.ComputeDiffRecursive(c+1,t,h+1,n,r),this.ConcatenateChanges(d,u)}return[new _s(e,t-e+1,i,n-i+1)]}WALKTRACE(e,t,i,n,r,o,a,l,c,h,d,u,f,m,g,b,w,_){let v=null,C=null,y=new av,x=t,S=i,L=f[0]-b[0]-n,E=-1073741824,T=this.m_forwardHistory.length-1;do{let I=L+e;I===x||I=0&&(c=this.m_forwardHistory[T],e=c[0],x=1,S=c.length-1)}while(--T>=-1);if(v=y.getReverseChanges(),_[0]){let I=f[0]+1,P=b[0]+1;if(v!==null&&v.length>0){let B=v[v.length-1];I=Math.max(I,B.getOriginalEnd()),P=Math.max(P,B.getModifiedEnd())}C=[new _s(I,u-I+1,P,g-P+1)]}else{y=new av,x=o,S=a,L=f[0]-b[0]-l,E=1073741824,T=w?this.m_reverseHistory.length-1:this.m_reverseHistory.length-2;do{let I=L+r;I===x||I=h[I+1]?(d=h[I+1]-1,m=d-L-l,d>E&&y.MarkNextChange(),E=d+1,y.AddOriginalElement(d+1,m+1),L=I+1-r):(d=h[I-1],m=d-L-l,d>E&&y.MarkNextChange(),E=d,y.AddModifiedElement(d+1,m+1),L=I-1-r),T>=0&&(h=this.m_reverseHistory[T],r=h[0],x=1,S=h.length-1)}while(--T>=-1);C=y.getChanges()}return this.ConcatenateChanges(v,C)}ComputeRecursionPoint(e,t,i,n,r,o,a){let l=0,c=0,h=0,d=0,u=0,f=0;e--,i--,r[0]=0,o[0]=0,this.m_forwardHistory=[],this.m_reverseHistory=[];let m=t-e+(n-i),g=m+1,b=new Int32Array(g),w=new Int32Array(g),_=n-i,v=t-e,C=e-i,y=t-n,S=(v-_)%2==0;b[_]=e,w[v]=t,a[0]=!1;for(let L=1;L<=m/2+1;L++){let E=0,T=0;h=this.ClipDiagonalBound(_-L,L,_,g),d=this.ClipDiagonalBound(_+L,L,_,g);for(let P=h;P<=d;P+=2){P===h||PE+T&&(E=l,T=c),!S&&Math.abs(P-v)<=L-1&&l>=w[P])return r[0]=l,o[0]=c,B<=w[P]&&1447>0&&L<=1447+1?this.WALKTRACE(_,h,d,C,v,u,f,y,b,w,l,t,r,c,n,o,S,a):null}let I=(E-e+(T-i)-L)/2;if(this.ContinueProcessingPredicate!==null&&!this.ContinueProcessingPredicate(E,I))return a[0]=!0,r[0]=E,o[0]=T,I>0&&1447>0&&L<=1447+1?this.WALKTRACE(_,h,d,C,v,u,f,y,b,w,l,t,r,c,n,o,S,a):(e++,i++,[new _s(e,t-e+1,i,n-i+1)]);u=this.ClipDiagonalBound(v-L,L,v,g),f=this.ClipDiagonalBound(v+L,L,v,g);for(let P=u;P<=f;P+=2){P===u||P=w[P+1]?l=w[P+1]-1:l=w[P-1],c=l-(P-v)-y;let B=l;for(;l>e&&c>i&&this.ElementsAreEqual(l,c);)l--,c--;if(w[P]=l,S&&Math.abs(P-_)<=L&&l<=b[P])return r[0]=l,o[0]=c,B>=b[P]&&1447>0&&L<=1447+1?this.WALKTRACE(_,h,d,C,v,u,f,y,b,w,l,t,r,c,n,o,S,a):null}if(L<=1447){let P=new Int32Array(d-h+2);P[0]=_-h+1,Va.Copy2(b,h,P,1,d-h+1),this.m_forwardHistory.push(P),P=new Int32Array(f-u+2),P[0]=v-u+1,Va.Copy2(w,u,P,1,f-u+1),this.m_reverseHistory.push(P)}}return this.WALKTRACE(_,h,d,C,v,u,f,y,b,w,l,t,r,c,n,o,S,a)}PrettifyChanges(e){for(let t=0;t0,a=i.modifiedLength>0;for(;i.originalStart+i.originalLength=0;t--){let i=e[t],n=0,r=0;if(t>0){let d=e[t-1];n=d.originalStart+d.originalLength,r=d.modifiedStart+d.modifiedLength}let o=i.originalLength>0,a=i.modifiedLength>0,l=0,c=this._boundaryScore(i.originalStart,i.originalLength,i.modifiedStart,i.modifiedLength);for(let d=1;;d++){let u=i.originalStart-d,f=i.modifiedStart-d;if(uc&&(c=g,l=d)}i.originalStart-=l,i.modifiedStart-=l;let h=[null];if(t>0&&this.ChangesOverlap(e[t-1],e[t],h)){e[t-1]=h[0],e.splice(t,1),t++;continue}}if(this._hasStrings)for(let t=1,i=e.length;t0&&f>l&&(l=f,c=d,h=u)}return l>0?[c,h]:null}_contiguousSequenceScore(e,t,i){let n=0;for(let r=0;r=this._originalElementsOrHash.length-1?!0:this._hasStrings&&/^\s*$/.test(this._originalStringElements[e])}_OriginalRegionIsBoundary(e,t){if(this._OriginalIsBoundary(e)||this._OriginalIsBoundary(e-1))return!0;if(t>0){let i=e+t;if(this._OriginalIsBoundary(i-1)||this._OriginalIsBoundary(i))return!0}return!1}_ModifiedIsBoundary(e){return e<=0||e>=this._modifiedElementsOrHash.length-1?!0:this._hasStrings&&/^\s*$/.test(this._modifiedStringElements[e])}_ModifiedRegionIsBoundary(e,t){if(this._ModifiedIsBoundary(e)||this._ModifiedIsBoundary(e-1))return!0;if(t>0){let i=e+t;if(this._ModifiedIsBoundary(i-1)||this._ModifiedIsBoundary(i))return!0}return!1}_boundaryScore(e,t,i,n){let r=this._OriginalRegionIsBoundary(e,t)?1:0,o=this._ModifiedRegionIsBoundary(i,n)?1:0;return r+o}ConcatenateChanges(e,t){let i=[];if(e.length===0||t.length===0)return t.length>0?t:e;if(this.ChangesOverlap(e[e.length-1],t[0],i)){let n=new Array(e.length+t.length-1);return Va.Copy(e,0,n,0,e.length-1),n[e.length-1]=i[0],Va.Copy(t,1,n,e.length,t.length-1),n}else{let n=new Array(e.length+t.length);return Va.Copy(e,0,n,0,e.length),Va.Copy(t,0,n,e.length,t.length),n}}ChangesOverlap(e,t,i){if(Wa.Assert(e.originalStart<=t.originalStart,"Left change is not less than or equal to right change"),Wa.Assert(e.modifiedStart<=t.modifiedStart,"Left change is not less than or equal to right change"),e.originalStart+e.originalLength>=t.originalStart||e.modifiedStart+e.modifiedLength>=t.modifiedStart){let n=e.originalStart,r=e.originalLength,o=e.modifiedStart,a=e.modifiedLength;return e.originalStart+e.originalLength>=t.originalStart&&(r=t.originalStart+t.originalLength-e.originalStart),e.modifiedStart+e.modifiedLength>=t.modifiedStart&&(a=t.modifiedStart+t.modifiedLength-e.modifiedStart),i[0]=new _s(n,r,o,a),!0}else return i[0]=null,!1}ClipDiagonalBound(e,t,i,n){if(e>=0&&e0&&t.originalLength<20&&t.modifiedLength>0&&t.modifiedLength<20&&r()){let f=i.createCharSequence(e,t.originalStart,t.originalStart+t.originalLength-1),m=n.createCharSequence(e,t.modifiedStart,t.modifiedStart+t.modifiedLength-1),g=OD(f,m,r,!0).changes;a&&(g=r4(g)),u=[];for(let b=0,w=g.length;b1&&g>1;){let b=u.charCodeAt(m-2),w=f.charCodeAt(g-2);if(b!==w)break;m--,g--}(m>1||g>1)&&this._pushTrimWhitespaceCharChange(n,r+1,1,m,o+1,1,g)}{let m=dv(u,1),g=dv(f,1),b=u.length+1,w=f.length+1;for(;m!0;let e=Date.now();return()=>Date.now()-e=0&&this.prefixSum.set(n.subarray(0,this.prefixSumValidIndex[0]+1)),!0)}changeValue(e,t){return e=La(e),t=La(t),this.values[e]===t?!1:(this.values[e]=t,e-1=i.length)return!1;let r=i.length-e;return t>=r&&(t=r),t===0?!1:(this.values=new Uint32Array(i.length-t),this.values.set(i.subarray(0,e),0),this.values.set(i.subarray(e+t),e),this.prefixSum=new Uint32Array(this.values.length),e-1=0&&this.prefixSum.set(n.subarray(0,this.prefixSumValidIndex[0]+1)),!0)}getTotalSum(){return this.values.length===0?0:this._getPrefixSum(this.values.length-1)}getPrefixSum(e){return e<0?0:(e=La(e),this._getPrefixSum(e))}_getPrefixSum(e){if(e<=this.prefixSumValidIndex[0])return this.prefixSum[e];let t=this.prefixSumValidIndex[0]+1;t===0&&(this.prefixSum[0]=this.values[0],t++),e>=this.values.length&&(e=this.values.length-1);for(let i=t;i<=e;i++)this.prefixSum[i]=this.prefixSum[i-1]+this.values[i];return this.prefixSumValidIndex[0]=Math.max(this.prefixSumValidIndex[0],e),this.prefixSum[e]}getIndexOf(e){e=Math.floor(e),this.getTotalSum();let t=0,i=this.values.length-1,n=0,r=0,o=0;for(;t<=i;)if(n=t+(i-t)/2|0,r=this.prefixSum[n],o=r-this.values[n],e=r)t=n+1;else break;return new Eg(n,e-o)}};var fv=class{constructor(e,t,i,n){this._uri=e,this._lines=t,this._eol=i,this._versionId=n,this._lineStarts=null,this._cachedTextValue=null}dispose(){this._lines.length=0}get version(){return this._versionId}getText(){return this._cachedTextValue===null&&(this._cachedTextValue=this._lines.join(this._eol)),this._cachedTextValue}onEvents(e){e.eol&&e.eol!==this._eol&&(this._eol=e.eol,this._lineStarts=null);let t=e.changes;for(let i of t)this._acceptDeleteRange(i.range),this._acceptInsertText(new N(i.range.startLineNumber,i.range.startColumn),i.text);this._versionId=e.versionId,this._cachedTextValue=null}_ensureLineStarts(){if(!this._lineStarts){let e=this._eol.length,t=this._lines.length,i=new Uint32Array(t);for(let n=0;nt&&(t=l),a>i&&(i=a),c>i&&(i=c)}t++,i++;let n=new BD(i,t,0);for(let r=0,o=e.length;r=this._maxCharCode?0:this._states.get(e,t)}},mv=null;function o4(){return mv===null&&(mv=new WD([[1,104,2],[1,72,2],[1,102,6],[1,70,6],[2,116,3],[2,84,3],[3,116,4],[3,84,4],[4,112,5],[4,80,5],[5,115,9],[5,83,9],[5,58,10],[6,105,7],[6,73,7],[7,108,8],[7,76,8],[8,101,9],[8,69,9],[9,58,10],[10,47,11],[11,47,12]])),mv}var Od=null;function a4(){if(Od===null){Od=new hs(0);let s=` <>'"\u3001\u3002\uFF61\uFF64\uFF0C\uFF0E\uFF1A\uFF1B\u2018\u3008\u300C\u300E\u3014\uFF08\uFF3B\uFF5B\uFF62\uFF63\uFF5D\uFF3D\uFF09\u3015\u300F\u300D\u3009\u2019\uFF40\uFF5E\u2026`;for(let t=0;tn);if(n>0){let a=t.charCodeAt(n-1),l=t.charCodeAt(o);(a===40&&l===41||a===91&&l===93||a===123&&l===125)&&o--}return{range:{startLineNumber:i,startColumn:n+1,endLineNumber:i,endColumn:o+2},url:t.substring(n,o+1)}}static computeLinks(e,t=o4()){let i=a4(),n=[];for(let r=1,o=e.getLineCount();r<=o;r++){let a=e.getLineContent(r),l=a.length,c=0,h=0,d=0,u=1,f=!1,m=!1,g=!1,b=!1;for(;c=0?(n+=i?1:-1,n<0?n=e.length-1:n%=e.length,e[n]):null}};Fd.INSTANCE=new Fd;var gc=function(s,e,t,i){function n(r){return r instanceof t?r:new t(function(o){o(r)})}return new(t||(t=Promise))(function(r,o){function a(h){try{c(i.next(h))}catch(d){o(d)}}function l(h){try{c(i.throw(h))}catch(d){o(d)}}function c(h){h.done?r(h.value):n(h.value).then(a,l)}c((i=i.apply(s,e||[])).next())})},jD=class extends fv{get uri(){return this._uri}get eol(){return this._eol}getValue(){return this.getText()}getLinesContent(){return this._lines.slice(0)}getLineCount(){return this._lines.length}getLineContent(e){return this._lines[e-1]}getWordAtPosition(e,t){let i=ql(e.column,$h(t),this._lines[e.lineNumber-1],0);return i?new D(e.lineNumber,i.startColumn,e.lineNumber,i.endColumn):null}words(e){let t=this._lines,i=this._wordenize.bind(this),n=0,r="",o=0,a=[];return{*[Symbol.iterator](){for(;;)if(othis._lines.length)t=this._lines.length,i=this._lines[t-1].length+1,n=!0;else{let r=this._lines[t-1].length+1;i<1?(i=1,n=!0):i>r&&(i=r,n=!0)}return n?{lineNumber:t,column:i}:e}},rr=class{constructor(e,t){this._host=e,this._models=Object.create(null),this._foreignModuleFactory=t,this._foreignModule=null}dispose(){this._models=Object.create(null)}_getModel(e){return this._models[e]}_getModels(){let e=[];return Object.keys(this._models).forEach(t=>e.push(this._models[t])),e}acceptNewModel(e){this._models[e.url]=new jD(K.parse(e.url),e.lines,e.EOL,e.versionId)}acceptModelChanged(e,t){if(!this._models[e])return;this._models[e].onEvents(t)}acceptRemovedModel(e){!this._models[e]||delete this._models[e]}computeDiff(e,t,i,n){return gc(this,void 0,void 0,function*(){let r=this._getModel(e),o=this._getModel(t);if(!r||!o)return null;let a=r.getLinesContent(),l=o.getLinesContent(),h=new cv(a,l,{shouldComputeCharChanges:!0,shouldPostProcessCharChanges:!0,shouldIgnoreTrimWhitespace:i,shouldMakePrettyDiff:!0,maxComputationTime:n}).computeDiff(),d=h.changes.length>0?!1:this._modelsAreIdentical(r,o);return{quitEarly:h.quitEarly,identical:d,changes:h.changes}})}_modelsAreIdentical(e,t){let i=e.getLineCount(),n=t.getLineCount();if(i!==n)return!1;for(let r=1;r<=i;r++){let o=e.getLineContent(r),a=t.getLineContent(r);if(o!==a)return!1}return!0}computeMoreMinimalEdits(e,t){return gc(this,void 0,void 0,function*(){let i=this._getModel(e);if(!i)return t;let n=[],r;t=t.slice(0).sort((o,a)=>{if(o.range&&a.range)return D.compareRangesUsingStarts(o.range,a.range);let l=o.range?0:1,c=a.range?0:1;return l-c});for(let{range:o,text:a,eol:l}of t){if(typeof l=="number"&&(r=l),D.isEmpty(o)&&!a)continue;let c=i.getValueInRange(o);if(a=a.replace(/\r\n|\n|\r/g,i.eol),c===a)continue;if(Math.max(a.length,c.length)>rr._diffLimit){n.push({range:o,text:a});continue}let h=AD(c,a,!1),d=i.offsetAt(D.lift(o).getStartPosition());for(let u of h){let f=i.positionAt(d+u.originalStart),m=i.positionAt(d+u.originalStart+u.originalLength),g={text:a.substr(u.modifiedStart,u.modifiedLength),range:{startLineNumber:f.lineNumber,startColumn:f.column,endLineNumber:m.lineNumber,endColumn:m.column}};i.getValueInRange(g.range)!==g.text&&n.push(g)}}return typeof r=="number"&&n.push({eol:r,text:"",range:{startLineNumber:0,startColumn:0,endLineNumber:0,endColumn:0}}),n})}computeLinks(e){return gc(this,void 0,void 0,function*(){let t=this._getModel(e);return t?VD(t):null})}textualSuggest(e,t,i,n){return gc(this,void 0,void 0,function*(){let r=new Nn(!0),o=new RegExp(i,n),a=new Set;e:for(let l of e){let c=this._getModel(l);if(!!c){for(let h of c.words(o))if(!(h===t||!isNaN(Number(h)))&&(a.add(h),a.size>rr._suggestionsLimit))break e}}return{words:Array.from(a),duration:r.elapsed()}})}computeWordRanges(e,t,i,n){return gc(this,void 0,void 0,function*(){let r=this._getModel(e);if(!r)return Object.create(null);let o=new RegExp(i,n),a=Object.create(null);for(let l=t.startLineNumber;lthis._host.fhr(a,l)),getMirrorModels:()=>this._getModels()};return this._foreignModuleFactory?(this._foreignModule=this._foreignModuleFactory(o,t),Promise.resolve(Dl(this._foreignModule))):Promise.reject(new Error("Unexpected usage"))}fmr(e,t){if(!this._foreignModule||typeof this._foreignModule[e]!="function")return Promise.reject(new Error("Missing requestHandler or method: "+e));try{return Promise.resolve(this._foreignModule[e].apply(this._foreignModule,t))}catch(i){return Promise.reject(i)}}};rr._diffLimit=1e5;rr._suggestionsLimit=1e4;typeof importScripts=="function"&&(Be.monaco=Lg());var kg=$("textResourceConfigurationService"),Ig=$("textResourcePropertiesService");var l4=function(s,e,t,i){var n=arguments.length,r=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(s,e,t,i);else for(var a=s.length-1;a>=0;a--)(o=s[a])&&(r=(n<3?o(r):n>3?o(e,t,r):o(e,t))||r);return n>3&&r&&Object.defineProperty(e,t,r),r},gv=function(s,e){return function(t,i){e(t,i,s)}},zD=function(s,e,t,i){function n(r){return r instanceof t?r:new t(function(o){o(r)})}return new(t||(t=Promise))(function(r,o){function a(h){try{c(i.next(h))}catch(d){o(d)}}function l(h){try{c(i.throw(h))}catch(d){o(d)}}function c(h){h.done?r(h.value):n(h.value).then(a,l)}c((i=i.apply(s,e||[])).next())})},HD=60*1e3,UD=5*60*1e3;function go(s,e){let t=s.getModel(e);return!(!t||t.isTooLargeForSyncing())}var Ng=class extends M{constructor(e,t,i){super();this._modelService=e,this._workerManager=this._register(new KD(this._modelService)),this._logService=i,this._register(Dm.register("*",{provideLinks:(n,r)=>go(this._modelService,n.uri)?this._workerManager.withWorker().then(o=>o.computeLinks(n.uri)).then(o=>o&&{links:o}):Promise.resolve({links:[]})})),this._register(ka.register("*",new $D(this._workerManager,t,this._modelService)))}dispose(){super.dispose()}canComputeDiff(e,t){return go(this._modelService,e)&&go(this._modelService,t)}computeDiff(e,t,i,n){return this._workerManager.withWorker().then(r=>r.computeDiff(e,t,i,n))}computeMoreMinimalEdits(e,t){if(sd(t)){if(!go(this._modelService,e))return Promise.resolve(t);let i=Nn.create(!0),n=this._workerManager.withWorker().then(r=>r.computeMoreMinimalEdits(e,t));return n.finally(()=>this._logService.trace("FORMAT#computeMoreMinimalEdits",e.toString(!0),i.elapsed())),Promise.race([n,Or(1e3).then(()=>t)])}else return Promise.resolve(void 0)}canNavigateValueSet(e){return go(this._modelService,e)}navigateValueSet(e,t,i){return this._workerManager.withWorker().then(n=>n.navigateValueSet(e,t,i))}canComputeWordRanges(e){return go(this._modelService,e)}computeWordRanges(e,t){return this._workerManager.withWorker().then(i=>i.computeWordRanges(e,t))}};Ng=l4([gv(0,ht),gv(1,kg),gv(2,Hs)],Ng);var $D=class{constructor(e,t,i){this._debugDisplayName="wordbasedCompletions",this._workerManager=e,this._configurationService=t,this._modelService=i}provideCompletionItems(e,t){return zD(this,void 0,void 0,function*(){let i=this._configurationService.getValue(e.uri,t,"editor");if(!i.wordBasedSuggestions)return;let n=[];if(i.wordBasedSuggestionsMode==="currentDocument")go(this._modelService,e.uri)&&n.push(e.uri);else for(let d of this._modelService.getModels())!go(this._modelService,d.uri)||(d===e?n.unshift(d.uri):(i.wordBasedSuggestionsMode==="allDocuments"||d.getLanguageIdentifier().id===e.getLanguageIdentifier().id)&&n.push(d.uri));if(n.length===0)return;let r=xe.getWordDefinition(e.getLanguageIdentifier().id),o=e.getWordAtPosition(t),a=o?new D(t.lineNumber,o.startColumn,t.lineNumber,o.endColumn):D.fromPositions(t),l=a.setEndPosition(t.lineNumber,t.column),h=yield(yield this._workerManager.withWorker()).textualSuggest(n,o==null?void 0:o.word,r);if(!!h)return{duration:h.duration,suggestions:h.words.map(d=>({kind:18,label:d,insertText:d,range:{insert:l,replace:a}}))}})}},KD=class extends M{constructor(e){super();this._modelService=e,this._editorWorkerClient=null,this._lastWorkerUsedTime=new Date().getTime(),this._register(new es).cancelAndSet(()=>this._checkStopIdleWorker(),Math.round(UD/2)),this._register(this._modelService.onModelRemoved(i=>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>UD&&(this._editorWorkerClient.dispose(),this._editorWorkerClient=null)}withWorker(){return this._lastWorkerUsedTime=new Date().getTime(),this._editorWorkerClient||(this._editorWorkerClient=new Mg(this._modelService,!1,"editorWorkerService")),Promise.resolve(this._editorWorkerClient)}},qD=class extends M{constructor(e,t,i){super();if(this._syncedModels=Object.create(null),this._syncedModelsLastUsedTime=Object.create(null),this._proxy=e,this._modelService=t,!i){let n=new es;n.cancelAndSet(()=>this._checkStopModelSync(),Math.round(HD/2)),this._register(n)}}dispose(){for(let e in this._syncedModels)me(this._syncedModels[e]);this._syncedModels=Object.create(null),this._syncedModelsLastUsedTime=Object.create(null),super.dispose()}ensureSyncedResources(e){for(let t of e){let i=t.toString();this._syncedModels[i]||this._beginModelSync(t),this._syncedModels[i]&&(this._syncedModelsLastUsedTime[i]=new Date().getTime())}}_checkStopModelSync(){let e=new Date().getTime(),t=[];for(let i in this._syncedModelsLastUsedTime)e-this._syncedModelsLastUsedTime[i]>HD&&t.push(i);for(let i of t)this._stopModelSync(i)}_beginModelSync(e){let t=this._modelService.getModel(e);if(!t||t.isTooLargeForSyncing())return;let i=e.toString();this._proxy.acceptNewModel({url:t.uri.toString(),lines:t.getLinesContent(),EOL:t.getEOL(),versionId:t.getVersionId()});let n=new U;n.add(t.onDidChangeContent(r=>{this._proxy.acceptModelChanged(i.toString(),r)})),n.add(t.onWillDispose(()=>{this._stopModelSync(i)})),n.add(oe(()=>{this._proxy.acceptRemovedModel(i)})),this._syncedModels[i]=n}_stopModelSync(e){let t=this._syncedModels[e];delete this._syncedModels[e],delete this._syncedModelsLastUsedTime[e],me(t)}},pv=class{constructor(e){this._instance=e,this._proxyObj=Promise.resolve(this._instance)}dispose(){this._instance.dispose()}getProxyObject(){return this._proxyObj}},Tg=class{constructor(e){this._workerClient=e}fhr(e,t){return this._workerClient.fhr(e,t)}},Mg=class extends M{constructor(e,t,i){super();this._disposed=!1,this._modelService=e,this._keepIdleModels=t,this._workerFactory=new uc(i),this._worker=null,this._modelManager=null}fhr(e,t){throw new Error("Not implemented!")}_getOrCreateWorker(){if(!this._worker)try{this._worker=this._register(new sv(this._workerFactory,"vs/editor/common/services/editorSimpleWorker",new Tg(this)))}catch(e){Ad(e),this._worker=new pv(new rr(new Tg(this),null))}return this._worker}_getProxy(){return this._getOrCreateWorker().getProxyObject().then(void 0,e=>(Ad(e),this._worker=new pv(new rr(new Tg(this),null)),this._getOrCreateWorker().getProxyObject()))}_getOrCreateModelManager(e){return this._modelManager||(this._modelManager=this._register(new qD(e,this._modelService,this._keepIdleModels))),this._modelManager}_withSyncedResources(e){return this._disposed?Promise.reject(Ll()):this._getProxy().then(t=>(this._getOrCreateModelManager(t).ensureSyncedResources(e),t))}computeDiff(e,t,i,n){return this._withSyncedResources([e,t]).then(r=>r.computeDiff(e.toString(),t.toString(),i,n))}computeMoreMinimalEdits(e,t){return this._withSyncedResources([e]).then(i=>i.computeMoreMinimalEdits(e.toString(),t))}computeLinks(e){return this._withSyncedResources([e]).then(t=>t.computeLinks(e.toString()))}textualSuggest(e,t,i){return zD(this,void 0,void 0,function*(){let n=yield this._withSyncedResources(e),r=i.source,o=Zf(i);return n.textualSuggest(e.map(a=>a.toString()),t,r,o)})}computeWordRanges(e,t){return this._withSyncedResources([e]).then(i=>{let n=this._modelService.getModel(e);if(!n)return Promise.resolve(null);let r=xe.getWordDefinition(n.getLanguageIdentifier().id),o=r.source,a=Zf(r);return i.computeWordRanges(e.toString(),t,o,a)})}navigateValueSet(e,t,i){return this._withSyncedResources([e]).then(n=>{let r=this._modelService.getModel(e);if(!r)return null;let o=xe.getWordDefinition(r.getLanguageIdentifier().id),a=o.source,l=Zf(o);return n.navigateValueSet(e.toString(),t,i,a,l)})}dispose(){super.dispose(),this._disposed=!0}};function GD(s,e){return new YD(s,e)}var YD=class extends Mg{constructor(e,t){super(e,t.keepIdleModels||!1,t.label);this._foreignModuleId=t.moduleId,this._foreignModuleCreateData=t.createData||null,this._foreignModuleHost=t.host||null,this._foreignProxy=null}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)}}_getForeignProxy(){return this._foreignProxy||(this._foreignProxy=this._getProxy().then(e=>{let t=this._foreignModuleHost?Dl(this._foreignModuleHost):[];return e.loadForeignModule(this._foreignModuleId,this._foreignModuleCreateData,t).then(i=>{this._foreignModuleCreateData=null;let n=(a,l)=>e.fmr(a,l),r=(a,l)=>function(){let c=Array.prototype.slice.call(arguments,0);return l(a,c)},o={};for(let a of i)o[a]=r(a,n);return o})})),this._foreignProxy}getProxy(){return this._getForeignProxy()}withSyncedResources(e){return this._withSyncedResources(e).then(t=>this.getProxy())}};var yi=class{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){let i=e.length,n=t.length;if(i!==n)return!1;for(let r=0;r=r||(a[l++]=new yi(Math.max(1,c.startColumn-n+1),Math.min(o+1,c.endColumn-n+1),c.className,c.type));return a}static filter(e,t,i,n){if(e.length===0)return[];let r=[],o=0;for(let a=0,l=e.length;at||h.isEmpty()&&(c.type===0||c.type===3))continue;let d=h.startLineNumber===t?h.startColumn:i,u=h.endLineNumber===t?h.endColumn:n;r[o++]=new yi(d,u,c.inlineClassName,c.type)}return r}static _typeCompare(e,t){let 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;let i=yi._typeCompare(e.type,t.type);return i!==0?i:e.className!==t.className?e.className0&&this.stopOffsets[0]0&&t=e){this.stopOffsets.splice(n,0,e),this.classNames.splice(n,0,t),this.metadata.splice(n,0,i);break}this.count++}},bv=class{static normalize(e,t){if(t.length===0)return[];let i=[],n=new Bd,r=0;for(let o=0,a=t.length;o1){let g=e.charCodeAt(c-2);Xe(g)&&c--}if(h>1){let g=e.charCodeAt(h-2);Xe(g)&&h--}let f=c-1,m=h-2;r=n.consumeLowerThan(f,r,i),n.count===0&&(r=f),n.insert(m,d,u)}return n.consumeLowerThan(1073741824,r,i),i}};var Yt=class{constructor(e,t,i){this._linePartBrand=void 0,this.endIndex=e,this.type=t,this.metadata=i}isWhitespace(){return!!(this.metadata&1)}isPseudoAfter(){return!!(this.metadata&4)}},wv=class{constructor(e,t){this.startOffset=e,this.endOffset=t}equals(e){return this.startOffset===e.startOffset&&this.endOffset===e.endOffset}},Hn=class{constructor(e,t,i,n,r,o,a,l,c,h,d,u,f,m,g,b,w,_,v){this.useMonospaceOptimizations=e,this.canUseHalfwidthRightwardsArrow=t,this.lineContent=i,this.continuesWithWrappedLine=n,this.isBasicASCII=r,this.containsRTL=o,this.fauxIndentLength=a,this.lineTokens=l,this.lineDecorations=c.sort(yi.compare),this.tabSize=h,this.startVisibleColumn=d,this.spaceWidth=u,this.stopRenderingLineAfter=g,this.renderWhitespace=b==="all"?4:b==="boundary"?1:b==="selection"?2:b==="trailing"?3:0,this.renderControlCharacters=w,this.fontLigatures=_,this.selectionsOnLine=v&&v.sort((x,S)=>x.startOffset>>16}static getCharIndex(e){return(e&65535)>>>0}setColumnInfo(e,t,i,n){let r=(t<<16|i<<0)>>>0;this._data[e-1]=r,this._absoluteOffsets[e-1]=n+i}getAbsoluteOffset(e){return this._absoluteOffsets.length===0?0:this._absoluteOffsets[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){let t=this.charOffsetToPartData(e-1),i=Un.getPartIndex(t),n=Un.getCharIndex(t);return new Wd(i,n)}getColumn(e,t){return this.partDataToCharOffset(e.partIndex,t,e.charIndex)+1}partDataToCharOffset(e,t,i){if(this.length===0)return 0;let n=(e<<16|i<<0)>>>0,r=0,o=this.length-1;for(;r+1>>1,b=this._data[g];if(b===n)return g;b>n?o=g:r=g}if(r===o)return r;let a=this._data[r],l=this._data[o];if(a===n)return r;if(l===n)return o;let c=Un.getPartIndex(a),h=Un.getCharIndex(a),d=Un.getPartIndex(l),u;c!==d?u=t:u=Un.getCharIndex(l);let f=i-h,m=u-i;return f<=m?r:o}},Rg=class{constructor(e,t,i){this._renderLineOutputBrand=void 0,this.characterMapping=e,this.containsRTL=t,this.containsForeignElements=i}};function Vd(s,e){if(s.lineContent.length===0){if(s.lineDecorations.length>0){e.appendASCIIString("");let t=0,i=0,n=0;for(let o of s.lineDecorations)(o.type===1||o.type===2)&&(e.appendASCIIString(''),o.type===1&&(n|=1,t++),o.type===2&&(n|=2,i++));e.appendASCIIString("");let r=new Un(1,t+i);return r.setColumnInfo(1,t,0,0),new Rg(r,!1,n)}return e.appendASCIIString(""),new Rg(new Un(0,0),!1,0)}return m4(c4(s),e)}var ZD=class{constructor(e,t,i,n){this.characterMapping=e,this.html=t,this.containsRTL=i,this.containsForeignElements=n}};function pc(s){let e=as(1e4),t=Vd(s,e);return new ZD(t.characterMapping,e.build(),t.containsRTL,t.containsForeignElements)}var XD=class{constructor(e,t,i,n,r,o,a,l,c,h,d,u,f,m,g){this.fontIsMonospace=e,this.canUseHalfwidthRightwardsArrow=t,this.lineContent=i,this.len=n,this.isOverflowing=r,this.parts=o,this.containsForeignElements=a,this.fauxIndentLength=l,this.tabSize=c,this.startVisibleColumn=h,this.containsRTL=d,this.spaceWidth=u,this.renderSpaceCharCode=f,this.renderWhitespace=m,this.renderControlCharacters=g}};function c4(s){let e=s.lineContent,t,i;s.stopRenderingLineAfter!==-1&&s.stopRenderingLineAfter0){for(let o=0,a=s.lineDecorations.length;o0&&(i[n++]=new Yt(e,"",0));for(let r=0,o=s.getCount();r=t){i[n++]=new Yt(t,l,0);break}i[n++]=new Yt(a,l,0)}return i}function d4(s,e,t){let i=0,n=[],r=0;if(t)for(let o=0,a=e.length;o=50&&(n[r++]=new Yt(u+1,h,d),f=u+1,u=-1);f!==c&&(n[r++]=new Yt(c,h,d))}else n[r++]=l;i=c}else for(let o=0,a=e.length;o50){let d=l.type,u=l.metadata,f=Math.ceil(h/50);for(let m=1;m=L.endOffset&&(S++,L=c&&c[S]);let B;if(Iy)B=!0;else if(P===9)B=!0;else if(P===32)if(h)if(x)B=!0;else{let Q=I+1I),B&&d&&(B=v||I>y),x){if(!B||!l&&E>=o){if(u){let Q=m>0?f[m-1].endIndex:r;for(let Y=Q+1;Y<=I;Y++)f[m++]=new Yt(Y,"mtkw",1)}else f[m++]=new Yt(I,"mtkw",1);E=E%o}}else(I===w||B&&I>r)&&(f[m++]=new Yt(I,b,0),E=E%o);for(P===9?E=o:bi(P)?E+=2:E++,x=B;I===w&&(g++,g<_);)b=i[g].type,w=i[g].endIndex}let T=!1;if(x)if(n&&h){let I=t>0?e.charCodeAt(t-1):0,P=t>1?e.charCodeAt(t-2):0;I===32&&P!==32&&P!==9||(T=!0)}else T=!0;if(T)if(u){let I=m>0?f[m-1].endIndex:r;for(let P=I+1;P<=t;P++)f[m++]=new Yt(P,"mtkw",1)}else f[m++]=new Yt(t,"mtkw",1);else f[m++]=new Yt(t,b,0);return f}function f4(s,e,t,i){i.sort(yi.compare);let n=bv.normalize(s,i),r=n.length,o=0,a=[],l=0,c=0;for(let d=0,u=t.length;dc&&(c=w.startOffset,a[l++]=new Yt(c,g,b)),w.endOffset+1<=m)c=w.endOffset+1,a[l++]=new Yt(c,g+" "+w.className,b|w.metadata),o++;else{c=m,a[l++]=new Yt(c,g+" "+w.className,b|w.metadata);break}}m>c&&(c=m,a[l++]=new Yt(c,g,b))}let h=t[t.length-1].endIndex;if(o'):e.appendASCIIString("");for(let E=0,T=l.length;E=c&&(ye+=Ji)}}for(Y&&(e.appendASCIIString(' style="width:'),e.appendASCIIString(String(f*he)),e.appendASCIIString('px"')),e.appendASCII(62);v1?e.write1(8594):e.write1(65515);for(let Ve=2;Ve<=ye;Ve++)e.write1(160)}else ye=1,e.write1(m);y+=ye,v>=c&&(C+=ye)}S=he}else{let he=0;for(e.appendASCII(62);v=c&&(C+=Ve)}S=he}se?x++:x=0,v>=o&&!_&&I.isPseudoAfter()&&(_=!0,w.setColumnInfo(v+1,E,y,L)),e.appendASCIIString("")}return _||w.setColumnInfo(o+1,l.length-1,y,L),a&&e.appendASCIIString("…"),e.appendASCIIString(""),new Rg(w,u,n)}var Ag=class{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}},QD=class{constructor(e,t){this.outputLineIndex=e,this.outputOffset=t}toString(){return`${this.outputLineIndex}:${this.outputOffset}`}toPosition(e,t){let i=this.outputLineIndex>0?t:0;return new N(e+this.outputLineIndex,i+this.outputOffset+1)}},po=class{constructor(e,t,i,n,r){this.breakOffsets=e,this.breakOffsetsVisibleColumn=t,this.wrappedTextIndentLength=i,this.injectionOffsets=n,this.injectionOptions=r}getInputOffsetOfOutputPosition(e,t){let i=0;if(e===0?i=t:i=this.breakOffsets[e-1]+t,this.injectionOffsets!==null)for(let n=0;nthis.injectionOffsets[n];n++)i0?this.breakOffsets[r-1]:0,t===0)if(e<=o)n=r-1;else if(e>a)i=r+1;else break;else if(e=a)i=r+1;else break}return new QD(r,e-o)}outputPositionToOffsetInUnwrappedLine(e,t){let i=(e>0?this.breakOffsets[e-1]:0)+t;return e>0&&(i-=this.wrappedTextIndentLength),i}normalizeOffsetAroundInjections(e,t){let i=this.getInjectedTextAtOffset(e);if(!i)return e;if(t===2)return e===i.offsetInUnwrappedLine+i.length?i.offsetInUnwrappedLine+i.length:i.offsetInUnwrappedLine;if(t===1){let o=i.offsetInUnwrappedLine+i.length,a=i.injectedTextIndex;for(;a+1=0&&this.injectionOffsets[r-1]===this.injectionOffsets[r];)n-=this.injectionOptions[r-1].content.length,r++;return n}getInjectedText(e,t){let i=this.outputPositionToOffsetInUnwrappedLine(e,t),n=this.getInjectedTextAtOffset(i);return n?{options:this.injectionOptions[n.injectedTextIndex]}:null}getInjectedTextAtOffset(e){let t=this.injectionOffsets,i=this.injectionOptions;if(t!==null){let n=0;for(let r=0;re)break;if(e<=l)return{injectedTextIndex:r,offsetInUnwrappedLine:a,length:o};n+=o}}}};var vv=class{constructor(e,t){this.tabSize=e,this.data=t}},jd=class{constructor(e,t,i,n,r,o,a){this._viewLineDataBrand=void 0,this.content=e,this.continuesWithWrappedLine=t,this.minColumn=i,this.maxColumn=n,this.startVisibleColumn=r,this.tokens=o,this.inlineDecorations=a}},Zt=class{constructor(e,t,i,n,r,o,a,l,c,h){this.minColumn=e,this.maxColumn=t,this.content=i,this.continuesWithWrappedLine=n,this.isBasicASCII=Zt.isBasicASCII(i,o),this.containsRTL=Zt.containsRTL(i,this.isBasicASCII,r),this.tokens=a,this.inlineDecorations=l,this.tabSize=c,this.startVisibleColumn=h}static isBasicASCII(e,t){return t?em(e):!0}static containsRTL(e,t,i){return!t&&i?Wl(e):!1}},_o=class{constructor(e,t,i){this.range=e,this.inlineClassName=t,this.type=i}},Cv=class{constructor(e,t,i,n){this.startOffset=e,this.endOffset=t,this.inlineClassName=i,this.inlineClassNameAffectsLetterSpacing=n}toInlineDecoration(e){return new _o(new D(e,this.startOffset+1,e,this.endOffset+1),this.inlineClassName,this.inlineClassNameAffectsLetterSpacing?3:0)}},zd=class{constructor(e,t){this._viewModelDecorationBrand=void 0,this.range=e,this.options=t}};function g4(s){return Array.isArray(s)}function JD(s){return!g4(s)}function Sv(s){return typeof s=="string"}function yv(s){return!Sv(s)}function ja(s){return!s}function bs(s,e){return s.ignoreCase&&e?e.toLowerCase():e}function Lv(s){return s.replace(/[&<>'"_]/g,"-")}function eE(s,e){console.log(`${s.languageId}: ${e}`)}function Ne(s,e){return new Error(`${s.languageId}: ${e}`)}function ws(s,e,t,i,n){let r=/\$((\$)|(#)|(\d\d?)|[sS](\d\d?)|@(\w+))/g,o=null;return e.replace(r,function(a,l,c,h,d,u,f,m,g){return ja(c)?ja(h)?!ja(d)&&d0;){let i=s.tokenizer[t];if(i)return i;let n=t.lastIndexOf(".");n<0?t=null:t=t.substr(0,n)}return null}function tE(s,e){let t=e;for(;t&&t.length>0;){if(s.stateNames[t])return!0;let n=t.lastIndexOf(".");n<0?t=null:t=t.substr(0,n)}return!1}var iE=5,_c=class{constructor(e){this._maxCacheDepth=e,this._entries=Object.create(null)}static create(e,t){return this._INSTANCE.create(e,t)}create(e,t){if(e!==null&&e.depth>=this._maxCacheDepth)return new za(e,t);let i=za.getStackElementId(e);i.length>0&&(i+="|"),i+=t;let n=this._entries[i];return n||(n=new za(e,t),this._entries[i]=n,n)}};_c._INSTANCE=new _c(iE);var za=class{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 za._equals(this,e)}push(e){return _c.create(this,e)}pop(){return this.parent}popall(){let e=this;for(;e.parent;)e=e.parent;return e}switchTo(e){return _c.create(this.parent,e)}},bc=class{constructor(e,t){this.modeId=e,this.state=t}equals(e){return this.modeId===e.modeId&&this.state.equals(e.state)}clone(){return this.state.clone()===this.state?this:new bc(this.modeId,this.state)}},or=class{constructor(e){this._maxCacheDepth=e,this._entries=Object.create(null)}static create(e,t){return this._INSTANCE.create(e,t)}create(e,t){if(t!==null)return new wc(e,t);if(e!==null&&e.depth>=this._maxCacheDepth)return new wc(e,t);let i=za.getStackElementId(e),n=this._entries[i];return n||(n=new wc(e,null),this._entries[i]=n,n)}};or._INSTANCE=new or(iE);var wc=class{constructor(e,t){this.stack=e,this.embeddedModeData=t}clone(){return(this.embeddedModeData?this.embeddedModeData.clone():null)===this.embeddedModeData?this:or.create(this.stack,this.embeddedModeData)}equals(e){return!(e instanceof wc)||!this.stack.equals(e.stack)?!1:this.embeddedModeData===null&&e.embeddedModeData===null?!0:this.embeddedModeData===null||e.embeddedModeData===null?!1:this.embeddedModeData.equals(e.embeddedModeData)}},nE=class{constructor(){this._tokens=[],this._language=null,this._lastTokenType=null,this._lastTokenLanguage=null}enterMode(e,t){this._language=t}emit(e,t){this._lastTokenType===t&&this._lastTokenLanguage===this._language||(this._lastTokenType=t,this._lastTokenLanguage=this._language,this._tokens.push(new tr(e,t,this._language)))}nestedModeTokenize(e,t,i,n){let r=i.modeId,o=i.state,a=Pe.get(r);if(!a)return this.enterMode(n,r),this.emit(n,""),o;let l=a.tokenize(e,t,o,n);return this._tokens=this._tokens.concat(l.tokens),this._lastTokenType=null,this._lastTokenLanguage=null,this._language=null,l.endState}finalize(e){return new Na(this._tokens,e)}},Ud=class{constructor(e,t){this._modeService=e,this._theme=t,this._prependTokens=null,this._tokens=[],this._currentLanguageId=0,this._lastTokenMetadata=0}enterMode(e,t){this._currentLanguageId=this._modeService.getLanguageIdentifier(t).id}emit(e,t){let i=this._theme.match(this._currentLanguageId,t);this._lastTokenMetadata!==i&&(this._lastTokenMetadata=i,this._tokens.push(e),this._tokens.push(i))}static _merge(e,t,i){let n=e!==null?e.length:0,r=t.length,o=i!==null?i.length:0;if(n===0&&r===0&&o===0)return new Uint32Array(0);if(n===0&&r===0)return i;if(r===0&&o===0)return e;let a=new Uint32Array(n+r+o);e!==null&&a.set(e);for(let l=0;l{if(r)return;let a=!1;for(let l=0,c=o.changedLanguages.length;l{})}}getInitialState(){let e=_c.create(null,this._lexer.start);return or.create(e,null)}tokenize(e,t,i,n){let r=new nE,o=this._tokenize(e,t,i,n,r);return r.finalize(o)}tokenize2(e,t,i,n){let r=new Ud(this._modeService,this._standaloneThemeService.getColorTheme().tokenTheme),o=this._tokenize(e,t,i,n,r);return r.finalize(o)}_tokenize(e,t,i,n,r){return i.embeddedModeData?this._nestedTokenize(e,t,i,n,r):this._myTokenize(e,t,i,n,r)}_findLeavingNestedModeOffset(e,t){let i=this._lexer.tokenizer[t.stack.state];if(!i&&(i=Hd(this._lexer,t.stack.state),!i))throw Ne(this._lexer,"tokenizer state is not defined: "+t.stack.state);let n=-1,r=!1;for(let o of i){if(!yv(o.action)||o.action.nextEmbedded!=="@pop")continue;r=!0;let a=o.regex,l=o.regex.source;if(l.substr(0,4)==="^(?:"&&l.substr(l.length-1,1)===")"){let h=(a.ignoreCase?"i":"")+(a.unicode?"u":"");a=new RegExp(l.substr(4,l.length-5),h)}let c=e.search(a);c===-1||c!==0&&o.matchOnlyAtLineStart||(n===-1||c0&&r.nestedModeTokenize(a,!1,i.embeddedModeData,n);let l=e.substring(o);return this._myTokenize(l,t,i,n+o,r)}_safeRuleName(e){return e?e.name:"(unknown)"}_myTokenize(e,t,i,n,r){r.enterMode(n,this._modeId);let o=e.length,a=t&&this._lexer.includeLF?e+` +`:e,l=a.length,c=i.embeddedModeData,h=i.stack,d=0,u=null,f=!0;for(;f||d=l)break;f=!1;let E=this._lexer.tokenizer[w];if(!E&&(E=Hd(this._lexer,w),!E))throw Ne(this._lexer,"tokenizer state is not defined: "+w);let T=a.substr(d);for(let I of E)if((d===0||!I.matchOnlyAtLineStart)&&(_=T.match(I.regex),_)){v=_[0],C=I.action;break}}if(_||(_=[""],v=""),C||(d=this._lexer.maxStack)throw Ne(this._lexer,"maximum tokenizer stack size reached: ["+h.state+","+h.parent.state+",...]");h=h.push(w)}else if(C.next==="@pop"){if(h.depth<=1)throw Ne(this._lexer,"trying to pop an empty stack in rule: "+this._safeRuleName(y));h=h.pop()}else if(C.next==="@popall")h=h.popall();else{let E=ws(this._lexer,C.next,v,_,w);if(E[0]==="@"&&(E=E.substr(1)),Hd(this._lexer,E))h=h.push(E);else throw Ne(this._lexer,"trying to set a next state '"+E+"' that is undefined in rule: "+this._safeRuleName(y))}}C.log&&typeof C.log=="string"&&eE(this._lexer,this._lexer.languageId+": "+ws(this._lexer,C.log,v,_,w))}if(S===null)throw Ne(this._lexer,"lexer rule has no well-defined action in rule: "+this._safeRuleName(y));let L=E=>{let T=this._modeService.getModeIdForLanguageName(E);T&&(E=T);let I=this._getNestedEmbeddedModeData(E);if(d0)throw Ne(this._lexer,"groups cannot be nested: "+this._safeRuleName(y));if(_.length!==S.length+1)throw Ne(this._lexer,"matched number of groups does not match the number of actions in rule: "+this._safeRuleName(y));let E=0;for(let T=1;T<_.length;T++)E+=_[T].length;if(E!==v.length)throw Ne(this._lexer,"with groups, all characters should be matched in consecutive groups in rule: "+this._safeRuleName(y));u={rule:y,matches:_,groups:[]};for(let T=0;Ts}),$d=class{static colorizeElement(e,t,i,n){n=n||{};let r=n.theme||"vs",o=n.mimeType||i.getAttribute("lang")||i.getAttribute("data-lang");if(!o)return console.error("Mode not detected"),Promise.resolve();e.setTheme(r);let a=i.firstChild?i.firstChild.nodeValue:"";i.className+=" "+r;let l=c=>{var h;let d=(h=Dv==null?void 0:Dv.createHTML(c))!==null&&h!==void 0?h:c;i.innerHTML=d};return this.colorize(t,a||"",o,n).then(l,c=>console.error(c))}static colorize(e,t,i,n){let r=4;n&&typeof n.tabSize=="number"&&(r=n.tabSize),Vl(t)&&(t=t.substr(1));let o=is(t),a=e.getModeId(i);if(!a)return Promise.resolve(rE(o,r));e.triggerMode(a);let l=Pe.get(a);if(l)return Ev(o,r,l);let c=Pe.getPromise(a);return c?new Promise((h,d)=>{c.then(u=>{Ev(o,r,u).then(h,d)},d)}):new Promise((h,d)=>{let u=null,f=null,m=()=>{u&&(u.dispose(),u=null),f&&(f.dispose(),f=null);let g=Pe.get(a);if(g){Ev(o,r,g).then(h,d);return}h(rE(o,r))};f=new Ut,f.cancelAndSet(m,500),u=Pe.onDidChange(g=>{g.changedLanguages.indexOf(a)>=0&&m()})})}static colorizeLine(e,t,i,n,r=4){let o=Zt.isBasicASCII(e,t),a=Zt.containsRTL(e,o,i);return pc(new Hn(!1,!0,e,!1,o,a,0,n,[],r,0,0,0,0,-1,"none",!1,!1,null)).html}static colorizeModelLine(e,t,i=4){let n=e.getLineContent(t);e.forceTokenization(t);let o=e.getLineTokens(t).inflate();return this.colorizeLine(n,e.mightContainNonBasicASCII(),e.mightContainRTL(),o,i)}};function Ev(s,e,t){return new Promise((i,n)=>{let r=()=>{let o=_4(s,e,t);if(t instanceof vc){let a=t.getLoadStatus();if(a.loaded===!1){a.promise.then(r,n);return}}i(o)};r()})}function rE(s,e){let t=[],i=(0<<11|1<<14|2<<23)>>>0,n=new Uint32Array(2);n[0]=0,n[1]=i;for(let r=0,o=s.length;r")}return t.join("")}function _4(s,e,t){let i=[],n=t.getInitialState();for(let r=0,o=s.length;r"),n=l.endState}return i.join("")}var Kd;(function(s){s[s.Ignore=0]="Ignore",s[s.Info=1]="Info",s[s.Warning=2]="Warning",s[s.Error=3]="Error"})(Kd||(Kd={}));(function(s){let e="error",t="warning",i="warn",n="info",r="ignore";function o(l){return l?aa(e,l)?s.Error:aa(t,l)||aa(i,l)?s.Warning:aa(n,l)?s.Info:s.Ignore:s.Ignore}s.fromValue=o;function a(l){switch(l){case s.Error:return e;case s.Warning:return t;case s.Info:return n;default:return r}}s.toString=a})(Kd||(Kd={}));var Ye=Kd;function ar(s){return s&&typeof s.getEditorType=="function"?s.getEditorType()===mo.ICodeEditor:!1}var oE=$("IWorkspaceEditService");function b4(s){return Ft(s)&&(Boolean(s.newUri)||Boolean(s.oldUri))}function w4(s){return Ft(s)&&K.isUri(s.resource)&&Ft(s.edit)}var kv=class{constructor(e){this.metadata=e}static convert(e){return e.edits.map(t=>{if(w4(t))return new Og(t.resource,t.edit,t.modelVersionId,t.metadata);if(b4(t))return new aE(t.oldUri,t.newUri,t.options,t.metadata);throw new Error("Unsupported edit")})}},Og=class extends kv{constructor(e,t,i,n){super(n);this.resource=e,this.textEdit=t,this.versionId=i}},aE=class extends kv{constructor(e,t,i,n){super(n);this.oldResource=e,this.newResource=t,this.options=i}};var Ha={JSONContribution:"base.contributions.json"};function v4(s){return s.length>0&&s.charAt(s.length-1)==="#"?s.substring(0,s.length-1):s}var lE=class{constructor(){this._onDidChangeSchema=new k,this.schemasById={}}registerSchema(e,t){this.schemasById[v4(e)]=t,this._onDidChangeSchema.fire(e)}notifySchemaChanged(e){this._onDidChangeSchema.fire(e)}},C4=new lE;Te.add(Ha.JSONContribution,C4);var vs={Configuration:"base.contributions.configuration"},cE={properties:{},patternProperties:{}},hE={properties:{},patternProperties:{}},dE={properties:{},patternProperties:{}},uE={properties:{},patternProperties:{}},fE={properties:{},patternProperties:{}},Iv={properties:{},patternProperties:{}},Nv="vscode://schemas/settings/resourceLanguage",mE=Te.as(Ha.JSONContribution),gE=class{constructor(){this.overrideIdentifiers=new Set,this._onDidSchemaChange=new k,this._onDidUpdateConfiguration=new k,this.defaultValues={},this.defaultLanguageConfigurationOverridesNode={id:"defaultOverrides",title:p("defaultLanguageConfigurationOverrides.title","Default Language Configuration Overrides"),properties:{}},this.configurationContributors=[this.defaultLanguageConfigurationOverridesNode],this.resourceLanguageSettingsSchema={properties:{},patternProperties:{},additionalProperties:!1,errorMessage:"Unknown editor configuration setting",allowTrailingCommas:!0,allowComments:!0},this.configurationProperties={},this.excludedConfigurationProperties={},mE.registerSchema(Nv,this.resourceLanguageSettingsSchema)}registerConfiguration(e,t=!0){this.registerConfigurations([e],t)}registerConfigurations(e,t=!0){let i=[];e.forEach(n=>{i.push(...this.validateAndRegisterProperties(n,t,n.extensionInfo)),this.configurationContributors.push(n),this.registerJSONConfiguration(n)}),mE.registerSchema(Nv,this.resourceLanguageSettingsSchema),this._onDidSchemaChange.fire(),this._onDidUpdateConfiguration.fire(i)}registerOverrideIdentifiers(e){for(let t of e)this.overrideIdentifiers.add(t);this.updateOverridePropertyPatternKey()}validateAndRegisterProperties(e,t=!0,i,n=3){var r;n=Jt(e.scope)?n:e.scope;let o=[],a=e.properties;if(a)for(let c in a){if(t&&L4(c)){delete a[c];continue}let h=a[c];if(this.updatePropertyDefaultValue(c,h),Pg.test(c)?h.scope=void 0:(h.scope=Jt(h.scope)?n:h.scope,h.restricted=Jt(h.restricted)?!!((r=i==null?void 0:i.restrictedConfigurations)===null||r===void 0?void 0:r.includes(c)):h.restricted),a[c].hasOwnProperty("included")&&!a[c].included){this.excludedConfigurationProperties[c]=a[c],delete a[c];continue}else this.configurationProperties[c]=a[c];!a[c].deprecationMessage&&a[c].markdownDeprecationMessage&&(a[c].deprecationMessage=a[c].markdownDeprecationMessage),o.push(c)}let l=e.allOf;if(l)for(let c of l)o.push(...this.validateAndRegisterProperties(c,t,i,n));return o}getConfigurationProperties(){return this.configurationProperties}registerJSONConfiguration(e){let t=i=>{let n=i.properties;if(n)for(let o in n)this.updateSchema(o,n[o]);let r=i.allOf;r&&r.forEach(t)};t(e)}updateSchema(e,t){switch(cE.properties[e]=t,t.scope){case 1:hE.properties[e]=t;break;case 2:dE.properties[e]=t;break;case 6:uE.properties[e]=t;break;case 3:fE.properties[e]=t;break;case 4:Iv.properties[e]=t;break;case 5:Iv.properties[e]=t,this.resourceLanguageSettingsSchema.properties[e]=t;break}}updateOverridePropertyPatternKey(){for(let e of this.overrideIdentifiers.values()){let t=`[${e}]`,i={type:"object",description:p("overrideSettings.defaultDescription","Configure editor settings to be overridden for a language."),errorMessage:p("overrideSettings.errorMessage","This setting does not support per-language configuration."),$ref:Nv};this.updatePropertyDefaultValue(t,i),cE.properties[t]=i,hE.properties[t]=i,dE.properties[t]=i,uE.properties[t]=i,fE.properties[t]=i,Iv.properties[t]=i}this._onDidSchemaChange.fire()}updatePropertyDefaultValue(e,t){let i=this.defaultValues[e];li(i)&&(i=t.default),li(i)&&(i=y4(t.type)),t.default=i}},S4="\\[.*\\]$",Pg=new RegExp(S4);function pE(s){return s.substring(1,s.length-1)}function y4(s){switch(Array.isArray(s)?s[0]:s){case"boolean":return!1;case"integer":case"number":return 0;case"string":return"";case"array":return[];case"object":return{};default:return null}}var _E=new gE;Te.add(vs.Configuration,_E);function L4(s){return s.trim()?Pg.test(s)?p("config.property.languageDefault","Cannot register '{0}'. This matches property pattern '\\\\[.*\\\\]$' for describing language specific editor settings. Use 'configurationDefaults' contribution.",s):_E.getConfigurationProperties()[s]!==void 0?p("config.property.duplicate","Cannot register '{0}'. This property is already registered.",s):null:p("config.property.empty","Cannot register an empty property")}var x4=Object.prototype.hasOwnProperty;function bE(s,e){for(let t in s)if(x4.call(s,t)&&e({key:t,value:s[t]},function(){delete s[t]})===!1)return}var Tv=class{constructor(){this.map=new Map}add(e,t){let i=this.map.get(e);i||(i=new Set,this.map.set(e,i)),i.add(t)}delete(e,t){let i=this.map.get(e);!i||(i.delete(t),i.size===0&&this.map.delete(e))}forEach(e,t){let i=this.map.get(e);!i||i.forEach(t)}};var wE=new class{constructor(){this._tabFocus=!1,this._onDidChangeTabFocus=new k,this.onDidChangeTabFocus=this._onDidChangeTabFocus.event}getTabFocusMode(){return this._tabFocus}setTabFocusMode(s){this._tabFocus!==s&&(this._tabFocus=s,this._onDidChangeTabFocus.fire(this._tabFocus))}},vE=Object.hasOwnProperty,CE=class{constructor(){this._values=[]}_read(e){return this._values[e]}get(e){return this._values[e]}_write(e,t){this._values[e]=t}},SE=class{constructor(){this._values=[]}_read(e){return this._values[e]}_write(e,t){this._values[e]=t}},Cs=class{static readOptions(e){let t=e,i=new SE;for(let n of va){let r=n.name==="_never_"?void 0:t[n.name];i._write(n.id,r)}return i}static validateOptions(e){let t=new Kb;for(let i of va)t._write(i.id,i.validate(e._read(i.id)));return t}static computeOptions(e,t){let i=new CE;for(let n of va)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")return e===t;if(Array.isArray(e)||Array.isArray(t))return Array.isArray(e)&&Array.isArray(t)?Ri(e,t):!1;for(let i in e)if(!Cs._deepEquals(e[i],t[i]))return!1;return!0}static checkEquals(e,t){let i=[],n=!1;for(let r of va){let o=!Cs._deepEquals(e._read(r.id),t._read(r.id));i[r.id]=o,o&&(n=!0)}return n?new Kh(i):null}};function D4(s){let e=s.wordWrap;e===!0?s.wordWrap="on":e===!1&&(s.wordWrap="off");let t=s.lineNumbers;t===!0?s.lineNumbers="on":t===!1&&(s.lineNumbers="off"),s.autoClosingBrackets===!1&&(s.autoClosingBrackets="never",s.autoClosingQuotes="never",s.autoSurround="never"),s.cursorBlinking==="visible"&&(s.cursorBlinking="solid");let r=s.renderWhitespace;r===!0?s.renderWhitespace="boundary":r===!1&&(s.renderWhitespace="none");let o=s.renderLineHighlight;o===!0?s.renderLineHighlight="line":o===!1&&(s.renderLineHighlight="none");let a=s.acceptSuggestionOnEnter;a===!0?s.acceptSuggestionOnEnter="on":a===!1&&(s.acceptSuggestionOnEnter="off");let l=s.tabCompletion;l===!1?s.tabCompletion="off":l===!0&&(s.tabCompletion="onlySnippets");let c=s.suggest;if(c&&typeof c.filteredTypes=="object"&&c.filteredTypes){let m={};m.method="showMethods",m.function="showFunctions",m.constructor="showConstructors",m.deprecated="showDeprecated",m.field="showFields",m.variable="showVariables",m.class="showClasses",m.struct="showStructs",m.interface="showInterfaces",m.module="showModules",m.property="showProperties",m.event="showEvents",m.operator="showOperators",m.unit="showUnits",m.value="showValues",m.constant="showConstants",m.enum="showEnums",m.enumMember="showEnumMembers",m.keyword="showKeywords",m.text="showWords",m.color="showColors",m.file="showFiles",m.reference="showReferences",m.folder="showFolders",m.typeParameter="showTypeParameters",m.snippet="showSnippets",bE(m,g=>{let b=c.filteredTypes[g.key];b===!1&&(c[g.value]=b)})}let h=s.hover;h===!0?s.hover={enabled:!0}:h===!1&&(s.hover={enabled:!1});let d=s.parameterHints;d===!0?s.parameterHints={enabled:!0}:d===!1&&(s.parameterHints={enabled:!1});let u=s.autoIndent;u===!0?s.autoIndent="full":u===!1&&(s.autoIndent="advanced");let f=s.matchBrackets;f===!0?s.matchBrackets="always":f===!1&&(s.matchBrackets="never")}function yE(s){let e=nr(s);return D4(e),e}var Cc=class extends M{constructor(e,t){super();this._onDidChange=this._register(new k),this.onDidChange=this._onDidChange.event,this._onDidChangeFast=this._register(new k),this.onDidChangeFast=this._onDidChangeFast.event,this.isSimpleWidget=e,this._isDominatedByLongLines=!1,this._computeOptionsMemory=new um,this._viewLineCount=1,this._lineNumbersDigitCount=1,this._rawOptions=yE(t),this._readOptions=Cs.readOptions(this._rawOptions),this._validatedOptions=Cs.validateOptions(this._readOptions),this._register(Ba.onDidChangeZoomLevel(i=>this._recomputeOptions())),this._register(wE.onDidChangeTabFocus(i=>this._recomputeOptions()))}observeReferenceElement(e){}updatePixelRatio(){}_recomputeOptions(){let e=this.options,t=this._computeInternalOptions();if(!e)this.options=t;else{let i=Cs.checkEquals(e,t);if(i===null)return;this.options=t,this._onDidChangeFast.fire(i),this._onDidChange.fire(i)}}getRawOptions(){return this._rawOptions}_computeInternalOptions(){let e=this._getEnvConfiguration(),t=sr.createFromValidatedSettings(this._validatedOptions,e.zoomLevel,e.pixelRatio,this.isSimpleWidget),i={memory:this._computeOptionsMemory,outerWidth:e.outerWidth,outerHeight:e.outerHeight,fontInfo:this.readConfiguration(t),extraEditorClassName:e.extraEditorClassName,isDominatedByLongLines:this._isDominatedByLongLines,viewLineCount:this._viewLineCount,lineNumbersDigitCount:this._lineNumbersDigitCount,emptySelectionClipboard:e.emptySelectionClipboard,pixelRatio:e.pixelRatio,tabFocusMode:wE.getTabFocusMode(),accessibilitySupport:e.accessibilitySupport};return Cs.computeOptions(this._validatedOptions,i)}static _subsetEquals(e,t){for(let i in t)if(vE.call(t,i)){let n=t[i],r=e[i];if(r===n)continue;if(Array.isArray(r)&&Array.isArray(n)){if(!Ri(r,n))return!1;continue}if(r&&typeof r=="object"&&n&&typeof n=="object"){if(!this._subsetEquals(r,n))return!1;continue}return!1}return!0}updateOptions(e){if(typeof e=="undefined")return;let t=yE(e);Cc._subsetEquals(this._rawOptions,t)||(this._rawOptions=Pi(this._rawOptions,t||{}),this._readOptions=Cs.readOptions(this._rawOptions),this._validatedOptions=Cs.validateOptions(this._readOptions),this._recomputeOptions())}setIsDominatedByLongLines(e){this._isDominatedByLongLines=e,this._recomputeOptions()}setMaxLineNumber(e){let t=Cc._digitCount(e);this._lineNumbersDigitCount!==t&&(this._lineNumbersDigitCount=t,this._recomputeOptions())}setViewLineCount(e){this._viewLineCount!==e&&(this._viewLineCount=e,this._recomputeOptions())}static _digitCount(e){let t=0;for(;e;)e=Math.floor(e/10),t++;return t||1}},E4=Object.freeze({id:"editor",order:5,type:"object",title:p("editorConfigurationTitle","Editor"),scope:5}),k4=Te.as(vs.Configuration),Fg=Object.assign(Object.assign({},E4),{properties:{"editor.tabSize":{type:"number",default:ni.tabSize,minimum:1,markdownDescription:p("tabSize","The number of spaces a tab is equal to. This setting is overridden based on the file contents when `#editor.detectIndentation#` is on.")},"editor.insertSpaces":{type:"boolean",default:ni.insertSpaces,markdownDescription:p("insertSpaces","Insert spaces when pressing `Tab`. This setting is overridden based on the file contents when `#editor.detectIndentation#` is on.")},"editor.detectIndentation":{type:"boolean",default:ni.detectIndentation,markdownDescription:p("detectIndentation","Controls whether `#editor.tabSize#` and `#editor.insertSpaces#` will be automatically detected when a file is opened based on the file contents.")},"editor.trimAutoWhitespace":{type:"boolean",default:ni.trimAutoWhitespace,description:p("trimAutoWhitespace","Remove trailing auto inserted whitespace.")},"editor.largeFileOptimizations":{type:"boolean",default:ni.largeFileOptimizations,description:p("largeFileOptimizations","Special handling for large files to disable certain memory intensive features.")},"editor.wordBasedSuggestions":{type:"boolean",default:!0,description:p("wordBasedSuggestions","Controls whether completions should be computed based on words in the document.")},"editor.wordBasedSuggestionsMode":{enum:["currentDocument","matchingDocuments","allDocuments"],default:"matchingDocuments",enumDescriptions:[p("wordBasedSuggestionsMode.currentDocument","Only suggest words from the active document."),p("wordBasedSuggestionsMode.matchingDocuments","Suggest words from all open documents of the same language."),p("wordBasedSuggestionsMode.allDocuments","Suggest words from all open documents.")],description:p("wordBasedSuggestionsMode","Controls from which documents word based completions are computed.")},"editor.semanticHighlighting.enabled":{enum:[!0,!1,"configuredByTheme"],enumDescriptions:[p("semanticHighlighting.true","Semantic highlighting enabled for all color themes."),p("semanticHighlighting.false","Semantic highlighting disabled for all color themes."),p("semanticHighlighting.configuredByTheme","Semantic highlighting is configured by the current color theme's `semanticHighlighting` setting.")],default:"configuredByTheme",description:p("semanticHighlighting.enabled","Controls whether the semanticHighlighting is shown for the languages that support it.")},"editor.stablePeek":{type:"boolean",default:!1,markdownDescription:p("stablePeek","Keep peek editors open even when double clicking their content or when hitting `Escape`.")},"editor.maxTokenizationLineLength":{type:"integer",default:2e4,description:p("maxTokenizationLineLength","Lines above this length will not be tokenized for performance reasons")},"diffEditor.maxComputationTime":{type:"number",default:5e3,description:p("maxComputationTime","Timeout in milliseconds after which diff computation is cancelled. Use 0 for no timeout.")},"diffEditor.renderSideBySide":{type:"boolean",default:!0,description:p("sideBySide","Controls whether the diff editor shows the diff side by side or inline.")},"diffEditor.ignoreTrimWhitespace":{type:"boolean",default:!0,description:p("ignoreTrimWhitespace","When enabled, the diff editor ignores changes in leading or trailing whitespace.")},"diffEditor.renderIndicators":{type:"boolean",default:!0,description:p("renderIndicators","Controls whether the diff editor shows +/- indicators for added/removed changes.")},"diffEditor.codeLens":{type:"boolean",default:!1,description:p("codeLens","Controls whether the editor shows CodeLens.")},"diffEditor.wordWrap":{type:"string",enum:["off","on","inherit"],default:"inherit",markdownEnumDescriptions:[p("wordWrap.off","Lines will never wrap."),p("wordWrap.on","Lines will wrap at the viewport width."),p("wordWrap.inherit","Lines will wrap according to the `#editor.wordWrap#` setting.")]}}});function I4(s){return typeof s.type!="undefined"||typeof s.anyOf!="undefined"}for(let s of va){let e=s.schema;if(typeof e!="undefined")if(I4(e))Fg.properties[`editor.${s.name}`]=e;else for(let t in e)vE.call(e,t)&&(Fg.properties[t]=e[t])}var Bg=null;function LE(){return Bg===null&&(Bg=Object.create(null),Object.keys(Fg.properties).forEach(s=>{Bg[s]=!0})),Bg}function xE(s){return LE()[`editor.${s}`]||!1}function DE(s){return LE()[`diffEditor.${s}`]||!1}k4.registerConfiguration(Fg);var Sc=class{static insert(e,t){return{range:new D(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}}};var nt=$("configurationService");function Mv(s,e){let t=Object.create(null);for(let i in s)Wg(t,i,s[i],e);return t}function Wg(s,e,t,i){let n=e.split("."),r=n.pop(),o=s;for(let a=0;aconsole.error(`Conflict in default settings: ${n}`))}return s}var Fi=class{constructor(e={},t=[],i=[]){this._contents=e,this._keys=t,this._overrides=i,this.isFrozen=!1}get contents(){return this.checkAndFreeze(this._contents)}get overrides(){return this.checkAndFreeze(this._overrides)}get keys(){return this.checkAndFreeze(this._keys)}isEmpty(){return this._keys.length===0&&Object.keys(this._contents).length===0&&this._overrides.length===0}getValue(e){return e?IE(this.contents,e):this.contents}override(e){let t=this.getContentsForOverrideIdentifer(e);if(!t||typeof t!="object"||!Object.keys(t).length)return this;let i={};for(let n of bm([...Object.keys(this.contents),...Object.keys(t)])){let r=this.contents[n],o=t[n];o&&(typeof r=="object"&&typeof o=="object"?(r=nr(r),this.mergeContents(r,o)):r=o),i[n]=r}return new Fi(i,this.keys,this.overrides)}merge(...e){let t=nr(this.contents),i=nr(this.overrides),n=[...this.keys];for(let r of e){this.mergeContents(t,r.contents);for(let o of r.overrides){let[a]=i.filter(l=>Ri(l.identifiers,o.identifiers));a?this.mergeContents(a.contents,o.contents):i.push(nr(o))}for(let o of r.keys)n.indexOf(o)===-1&&n.push(o)}return new Fi(t,n,i)}freeze(){return this.isFrozen=!0,this}mergeContents(e,t){for(let i of Object.keys(t)){if(i in e&&Ft(e[i])&&Ft(t[i])){this.mergeContents(e[i],t[i]);continue}e[i]=nr(t[i])}}checkAndFreeze(e){return this.isFrozen&&!Object.isFrozen(e)?ED(e):e}getContentsForOverrideIdentifer(e){for(let t of this.overrides)if(t.identifiers.indexOf(e)!==-1)return t.contents;return null}toJSON(){return{contents:this.contents,overrides:this.overrides,keys:this.keys}}setValue(e,t){this.addKey(e),Wg(this.contents,e,t,i=>{throw new Error(i)})}removeValue(e){this.removeKey(e)&&EE(this.contents,e)}addKey(e){let t=this.keys.length;for(let i=0;iconsole.error(`Conflict in default settings file: ${r}`))});super(e,t,i)}},yc=class{constructor(e,t,i=new Fi,n=new Fi,r=new At,o=new Fi,a=new At,l=!0){this._defaultConfiguration=e,this._localUserConfiguration=t,this._remoteUserConfiguration=i,this._workspaceConfiguration=n,this._folderConfigurations=r,this._memoryConfiguration=o,this._memoryConfigurationByResource=a,this._freeze=l,this._workspaceConsolidatedConfiguration=null,this._foldersConsolidatedConfigurations=new At,this._userConfiguration=null}getValue(e,t,i){return this.getConsolidateConfigurationModel(t,i).getValue(e)}updateValue(e,t,i={}){let n;i.resource?(n=this._memoryConfigurationByResource.get(i.resource),n||(n=new Fi,this._memoryConfigurationByResource.set(i.resource,n))):n=this._memoryConfiguration,t===void 0?n.removeValue(e):n.setValue(e,t),i.resource||(this._workspaceConsolidatedConfiguration=null)}get userConfiguration(){return this._userConfiguration||(this._userConfiguration=this._remoteUserConfiguration.isEmpty()?this._localUserConfiguration:this._localUserConfiguration.merge(this._remoteUserConfiguration),this._freeze&&this._userConfiguration.freeze()),this._userConfiguration}getConsolidateConfigurationModel(e,t){let i=this.getConsolidatedConfigurationModelForResource(e,t);return e.overrideIdentifier?i.override(e.overrideIdentifier):i}getConsolidatedConfigurationModelForResource({resource:e},t){let i=this.getWorkspaceConsolidatedConfiguration();if(t&&e){let n=t.getFolder(e);n&&(i=this.getFolderConsolidatedConfiguration(n.uri)||i);let r=this._memoryConfigurationByResource.get(e);r&&(i=i.merge(r))}return i}getWorkspaceConsolidatedConfiguration(){return this._workspaceConsolidatedConfiguration||(this._workspaceConsolidatedConfiguration=this._defaultConfiguration.merge(this.userConfiguration,this._workspaceConfiguration,this._memoryConfiguration),this._freeze&&(this._workspaceConfiguration=this._workspaceConfiguration.freeze())),this._workspaceConsolidatedConfiguration}getFolderConsolidatedConfiguration(e){let t=this._foldersConsolidatedConfigurations.get(e);if(!t){let i=this.getWorkspaceConsolidatedConfiguration(),n=this._folderConfigurations.get(e);n?(t=i.merge(n),this._freeze&&(t=t.freeze()),this._foldersConsolidatedConfigurations.set(e,t)):t=i}return t}toData(){return{defaults:{contents:this._defaultConfiguration.contents,overrides:this._defaultConfiguration.overrides,keys:this._defaultConfiguration.keys},user:{contents:this.userConfiguration.contents,overrides:this.userConfiguration.overrides,keys:this.userConfiguration.keys},workspace:{contents:this._workspaceConfiguration.contents,overrides:this._workspaceConfiguration.overrides,keys:this._workspaceConfiguration.keys},folders:[...this._folderConfigurations.keys()].reduce((e,t)=>{let{contents:i,overrides:n,keys:r}=this._folderConfigurations.get(t);return e.push([t,{contents:i,overrides:n,keys:r}]),e},[])}}static parse(e){let t=this.parseConfigurationModel(e.defaults),i=this.parseConfigurationModel(e.user),n=this.parseConfigurationModel(e.workspace),r=e.folders.reduce((o,a)=>(o.set(K.revive(a[0]),this.parseConfigurationModel(a[1])),o),new At);return new yc(t,i,new Fi,n,r,new Fi,new At,!1)}static parseConfigurationModel(e){return new Fi(e.contents,e.keys,e.overrides).freeze()}},Av=class{constructor(e,t,i,n){this.change=e,this.previous=t,this.currentConfiguraiton=i,this.currentWorkspace=n,this._previousConfiguration=void 0;let r=new Set;e.keys.forEach(a=>r.add(a)),e.overrides.forEach(([,a])=>a.forEach(l=>r.add(l))),this.affectedKeys=[...r.values()];let o=new Fi;this.affectedKeys.forEach(a=>o.setValue(a,{})),this.affectedKeysTree=o.contents}get previousConfiguration(){return!this._previousConfiguration&&this.previous&&(this._previousConfiguration=yc.parse(this.previous.data)),this._previousConfiguration}affectsConfiguration(e,t){var i;if(this.doesAffectedKeysTreeContains(this.affectedKeysTree,e)){if(t){let n=this.previousConfiguration?this.previousConfiguration.getValue(e,t,(i=this.previous)===null||i===void 0?void 0:i.workspace):void 0,r=this.currentConfiguraiton.getValue(e,t,this.currentWorkspace);return!an(n,r)}return!0}return!1}doesAffectedKeysTreeContains(e,t){let i=Mv({[t]:!0},()=>{}),n;for(;typeof i=="object"&&(n=Object.keys(i)[0]);){if(e=e[n],!e)return!1;i=i[n]}return!0}};var Ov=class extends M{constructor(e,t,i,n,r){super();this._contextKeyService=e,this._commandService=t,this._telemetryService=i,this._notificationService=n,this._logService=r,this._onDidUpdateKeybindings=this._register(new k),this._currentChord=null,this._currentChordChecker=new es,this._currentChordStatusMessage=null,this._currentSingleModifier=null,this._currentSingleModifierClearTimeout=new Ut,this._logging=!1}get onDidUpdateKeybindings(){return this._onDidUpdateKeybindings?this._onDidUpdateKeybindings.event:j.None}dispose(){super.dispose()}_log(e){this._logging&&this._logService.info(`[KeybindingService]: ${e}`)}getKeybindings(){return this._getResolver().getKeybindings()}lookupKeybinding(e,t){let i=this._getResolver().lookupPrimaryKeybinding(e,t||this._contextKeyService);if(!!i)return i.resolvedKeybinding}dispatchEvent(e,t){return this._dispatch(e,t)}softDispatch(e,t){let i=this.resolveKeyboardEvent(e);if(i.isChord())return console.warn("Unexpected keyboard event mapped to a chord"),null;let[n]=i.getDispatchParts();if(n===null)return null;let r=this._contextKeyService.getContext(t),o=this._currentChord?this._currentChord.keypress:null;return this._getResolver().resolve(r,o,n)}_enterChordMode(e,t){this._currentChord={keypress:e,label:t},this._currentChordStatusMessage=this._notificationService.status(p("first.chord","({0}) was pressed. Waiting for second key of chord...",t));let i=Date.now();this._currentChordChecker.cancelAndSet(()=>{if(!this._documentHasFocus()){this._leaveChordMode();return}Date.now()-i>5e3&&this._leaveChordMode()},500)}_leaveChordMode(){this._currentChordStatusMessage&&(this._currentChordStatusMessage.dispose(),this._currentChordStatusMessage=null),this._currentChordChecker.cancel(),this._currentChord=null}_dispatch(e,t){return this._doDispatch(this.resolveKeyboardEvent(e),t,!1)}_singleModifierDispatch(e,t){let i=this.resolveKeyboardEvent(e),[n]=i.getSingleModifierDispatchParts();return n!==null&&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!==null&&n===this._currentSingleModifier?(this._log(`/ Dispatching single modifier chord ${n} ${n}`),this._currentSingleModifierClearTimeout.cancel(),this._currentSingleModifier=null,this._doDispatch(i,t,!0)):(this._currentSingleModifierClearTimeout.cancel(),this._currentSingleModifier=null,!1)}_doDispatch(e,t,i=!1){let n=!1;if(e.isChord())return console.warn("Unexpected keyboard event mapped to a chord"),!1;let r=null,o=null;if(i){let[h]=e.getSingleModifierDispatchParts();r=h,o=h}else[r]=e.getDispatchParts(),o=this._currentChord?this._currentChord.keypress:null;if(r===null)return this._log("\\ Keyboard event cannot be dispatched in keydown phase."),n;let a=this._contextKeyService.getContext(t),l=e.getLabel(),c=this._getResolver().resolve(a,o,r);return this._logService.trace("KeybindingService#dispatch",l,c==null?void 0:c.commandId),c&&c.enterChord?(n=!0,this._enterChordMode(r,l),n):(this._currentChord&&(!c||!c.commandId)&&(this._notificationService.status(p("missing.chord","The key combination ({0}, {1}) is not a command.",this._currentChord.label,l),{hideAfter:10*1e3}),n=!0),this._leaveChordMode(),c&&c.commandId&&(c.bubble||(n=!0),typeof c.commandArgs=="undefined"?this._commandService.executeCommand(c.commandId).then(void 0,h=>this._notificationService.warn(h)):this._commandService.executeCommand(c.commandId,c.commandArgs).then(void 0,h=>this._notificationService.warn(h)),this._telemetryService.publicLog2("workbenchActionExecuted",{id:c.commandId,from:"keybinding"})),n)}mightProducePrintableCharacter(e){return e.ctrlKey||e.metaKey?!1:e.keyCode>=31&&e.keyCode<=56||e.keyCode>=21&&e.keyCode<=30}};var lr=class{constructor(e,t,i){this._log=i,this._defaultKeybindings=e,this._defaultBoundCommands=new Map;for(let n=0,r=e.length;n=0;c--)this._isTargetedForRemoval(e[c],o,a,r,l)&&e.splice(c,1)}return e.concat(i)}_addKeyPress(e,t){let i=this._map.get(e);if(typeof i=="undefined"){this._map.set(e,[t]),this._addToLookupMap(t);return}for(let n=i.length-1;n>=0;n--){let r=i[n];if(r.command===t.command)continue;let o=r.keypressParts.length>1,a=t.keypressParts.length>1;o&&a&&r.keypressParts[1]!==t.keypressParts[1]||lr.whenIsEntirelyIncluded(r.when,t.when)&&this._removeFromLookupMap(r)}i.push(t),this._addToLookupMap(t)}_addToLookupMap(e){if(!e.command)return;let t=this._lookupMap.get(e.command);typeof t=="undefined"?(t=[e],this._lookupMap.set(e.command,t)):t.push(e)}_removeFromLookupMap(e){if(!e.command)return;let t=this._lookupMap.get(e.command);if(typeof t!="undefined"){for(let i=0,n=t.length;io.type===9?o.expr:[o],r=n(i).concat(n(t));for(let o=0;o=0;n--){let r=i[n];if(t.contextMatchesRules(r.when))return r}return i[i.length-1]}resolve(e,t,i){this._log(`| Resolving ${i}${t?` chorded from ${t}`:""}`);let n=null;if(t!==null){let o=this._map.get(t);if(typeof o=="undefined")return this._log("\\ No keybinding entries."),null;n=[];for(let a=0,l=o.length;a1&&r.keypressParts[1]!==null?(this._log(`\\ From ${n.length} keybinding entries, matched chord, when: ${ME(r.when)}, source: ${RE(r)}.`),{enterChord:!0,leaveChord:!1,commandId:null,commandArgs:null,bubble:!1}):(this._log(`\\ From ${n.length} keybinding entries, matched ${r.command}, when: ${ME(r.when)}, source: ${RE(r)}.`),{enterChord:!1,leaveChord:r.keypressParts.length>1,commandId:r.command,commandArgs:r.commandArgs,bubble:r.bubble}):(this._log(`\\ From ${n.length} keybinding entries, no when clauses matched the context.`),null)}_findCommand(e,t){for(let i=t.length-1;i>=0;i--){let n=t[i];if(!!lr.contextMatchesRules(e,n.when))return n}return null}static contextMatchesRules(e,t){return t?t.evaluate(e):!0}};function ME(s){return s?`${s.serialize()}`:"no when condition"}function RE(s){return s.extensionId?s.isBuiltinExtension?`built-in extension ${s.extensionId}`:`user extension ${s.extensionId}`:s.isDefault?"built-in":"user"}var Vg=class{constructor(e,t,i,n,r,o,a){this._resolvedKeybindingItemBrand=void 0,this.resolvedKeybinding=e,this.keypressParts=e?AE(e.getDispatchParts()):[],e&&this.keypressParts.length===0&&(this.keypressParts=AE(e.getSingleModifierDispatchParts())),this.bubble=t?t.charCodeAt(0)===94:!1,this.command=this.bubble?t.substr(1):t,this.commandArgs=i,this.when=n,this.isDefault=r,this.extensionId=o,this.isBuiltinExtension=a}};function AE(s){let e=[];for(let t=0,i=s.length;tthis._getLabel(e))}getAriaLabel(){return OE.toLabel(this._os,this._parts,e=>this._getAriaLabel(e))}isChord(){return this._parts.length>1}getParts(){return this._parts.map(e=>this._getPart(e))}_getPart(e){return new ab(e.ctrlKey,e.shiftKey,e.altKey,e.metaKey,this._getLabel(e),this._getAriaLabel(e))}getDispatchParts(){return this._parts.map(e=>this._getDispatchPart(e))}getSingleModifierDispatchParts(){return this._parts.map(e=>this._getSingleModifierDispatchPart(e))}};var Lc=class extends Fv{constructor(e,t){super(t,e.parts)}_keyCodeToUILabel(e){if(this._os===2)switch(e){case 15:return"\u2190";case 16:return"\u2191";case 17:return"\u2192";case 18:return"\u2193"}return Ar.toString(e)}_getLabel(e){return e.isDuplicateModifierCase()?"":this._keyCodeToUILabel(e.keyCode)}_getAriaLabel(e){return e.isDuplicateModifierCase()?"":Ar.toString(e.keyCode)}_getDispatchPart(e){return Lc.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+=Ar.toString(e.keyCode),t}_getSingleModifierDispatchPart(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}};var ri=$("notificationService"),Bv=class{};var PE=$("contextService");var Wv=class{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}}};var FE;(function(s){s.noSelection=p("noSelection","No selection"),s.singleSelectionRange=p("singleSelectionRange","Line {0}, Column {1} ({2} selected)"),s.singleSelection=p("singleSelection","Line {0}, Column {1}"),s.multiSelectionRange=p("multiSelectionRange","{0} selections ({1} characters selected)"),s.multiSelection=p("multiSelection","{0} selections"),s.emergencyConfOn=p("emergencyConfOn","Now changing the setting `accessibilitySupport` to 'on'."),s.openingDocs=p("openingDocs","Now opening the Editor Accessibility documentation page."),s.readonlyDiffEditor=p("readonlyDiffEditor"," in a read-only pane of a diff editor."),s.editableDiffEditor=p("editableDiffEditor"," in a pane of a diff editor."),s.readonlyEditor=p("readonlyEditor"," in a read-only code editor"),s.editableEditor=p("editableEditor"," in a code editor"),s.changeConfigToOnMac=p("changeConfigToOnMac","To configure the editor to be optimized for usage with a Screen Reader press Command+E now."),s.changeConfigToOnWinLinux=p("changeConfigToOnWinLinux","To configure the editor to be optimized for usage with a Screen Reader press Control+E now."),s.auto_on=p("auto_on","The editor is configured to be optimized for usage with a Screen Reader."),s.auto_off=p("auto_off","The editor is configured to never be optimized for usage with a Screen Reader, which is not the case at this time."),s.tabFocusModeOnMsg=p("tabFocusModeOnMsg","Pressing Tab in the current editor will move focus to the next focusable element. Toggle this behavior by pressing {0}."),s.tabFocusModeOnMsgNoKb=p("tabFocusModeOnMsgNoKb","Pressing Tab in the current editor will move focus to the next focusable element. The command {0} is currently not triggerable by a keybinding."),s.tabFocusModeOffMsg=p("tabFocusModeOffMsg","Pressing Tab in the current editor will insert the tab character. Toggle this behavior by pressing {0}."),s.tabFocusModeOffMsgNoKb=p("tabFocusModeOffMsgNoKb","Pressing Tab in the current editor will insert the tab character. The command {0} is currently not triggerable by a keybinding."),s.openDocMac=p("openDocMac","Press Command+H now to open a browser window with more information related to editor accessibility."),s.openDocWinLinux=p("openDocWinLinux","Press Control+H now to open a browser window with more information related to editor accessibility."),s.outroMsg=p("outroMsg","You can dismiss this tooltip and return to the editor by pressing Escape or Shift+Escape."),s.showAccessibilityHelpAction=p("showAccessibilityHelpAction","Show Accessibility Help")})(FE||(FE={}));var BE;(function(s){s.inspectTokensAction=p("inspectTokens","Developer: Inspect Tokens")})(BE||(BE={}));var WE;(function(s){s.gotoLineActionLabel=p("gotoLineActionLabel","Go to Line/Column...")})(WE||(WE={}));var VE;(function(s){s.helpQuickAccessActionLabel=p("helpQuickAccess","Show all Quick Access Providers")})(VE||(VE={}));var jE;(function(s){s.quickCommandActionLabel=p("quickCommandActionLabel","Command Palette"),s.quickCommandHelp=p("quickCommandActionHelp","Show And Run Commands")})(jE||(jE={}));var zE;(function(s){s.quickOutlineActionLabel=p("quickOutlineActionLabel","Go to Symbol..."),s.quickOutlineByCategoryActionLabel=p("quickOutlineByCategoryActionLabel","Go to Symbol by Category...")})(zE||(zE={}));var qd;(function(s){s.editorViewAccessibleLabel=p("editorViewAccessibleLabel","Editor content"),s.accessibilityHelpMessage=p("accessibilityHelpMessage","Press Alt+F1 for Accessibility Options.")})(qd||(qd={}));var HE;(function(s){s.toggleHighContrast=p("toggleHighContrast","Toggle High Contrast Theme")})(HE||(HE={}));var zg;(function(s){s.bulkEditServiceSummary=p("bulkEditServiceSummary","Made {0} edits in {1} files")})(zg||(zg={}));var UE=function(s,e,t,i){var n=arguments.length,r=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(s,e,t,i);else for(var a=s.length-1;a>=0;a--)(o=s[a])&&(r=(n<3?o(r):n>3?o(e,t,r):o(e,t))||r);return n>3&&r&&Object.defineProperty(e,t,r),r},$E=function(s,e){return function(t,i){e(t,i,s)}},KE=function(s,e,t,i){function n(r){return r instanceof t?r:new t(function(o){o(r)})}return new(t||(t=Promise))(function(r,o){function a(h){try{c(i.next(h))}catch(d){o(d)}}function l(h){try{c(i.throw(h))}catch(d){o(d)}}function c(h){h.done?r(h.value):n(h.value).then(a,l)}c((i=i.apply(s,e||[])).next())})},qE=class{constructor(e){this.disposed=!1,this.model=e,this._onWillDispose=new k}get textEditorModel(){return this.model}dispose(){this.disposed=!0,this._onWillDispose.fire()}};function T4(s,e,t){return ar(s)?e(s):t(s)}var Hg=class{constructor(e){this.modelService=e}setEditor(e){this.editor=e}createModelReference(e){let t=null;return this.editor&&(t=T4(this.editor,i=>this.findModel(i,e),i=>this.findModel(i.getOriginalEditor(),e)||this.findModel(i.getModifiedEditor(),e))),t?Promise.resolve(new X_(new qE(t))):Promise.reject(new Error("Model not found"))}findModel(e,t){let i=this.modelService.getModel(t);return i&&i.uri.toString()!==t.toString()?null:i}};Hg=UE([$E(0,ht)],Hg);var xc=class{show(){return xc.NULL_PROGRESS_RUNNER}showWhile(e,t){return KE(this,void 0,void 0,function*(){yield e})}};xc.NULL_PROGRESS_RUNNER={done:()=>{},total:()=>{},worked:()=>{}};var Vv=class{confirm(e){return this.doConfirm(e).then(t=>({confirmed:t,checkboxChecked:!1}))}doConfirm(e){let t=e.message;return e.detail&&(t=t+` + +`+e.detail),Promise.resolve(window.confirm(t))}show(e,t,i,n){return Promise.resolve({choice:0})}},Dc=class{info(e){return this.notify({severity:Ye.Info,message:e})}warn(e){return this.notify({severity:Ye.Warning,message:e})}error(e){return this.notify({severity:Ye.Error,message:e})}notify(e){switch(e.severity){case Ye.Error:console.error(e.message);break;case Ye.Warning:console.warn(e.message);break;default:console.log(e.message);break}return Dc.NO_OP}status(e,t){return M.None}};Dc.NO_OP=new Bv;var jv=class{constructor(e){this._onWillExecuteCommand=new k,this._onDidExecuteCommand=new k,this.onDidExecuteCommand=this._onDidExecuteCommand.event,this._instantiationService=e}executeCommand(e,...t){let i=Qe.getCommand(e);if(!i)return Promise.reject(new Error(`command '${e}' not found`));try{this._onWillExecuteCommand.fire({commandId:e,args:t});let 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)}}},Gd=class extends Ov{constructor(e,t,i,n,r,o){super(e,t,i,n,r);this._cachedResolver=null,this._dynamicKeybindings=[],this._register(O(o,z.KEY_DOWN,a=>{let l=new De(a);this._dispatch(l,l.target)&&(l.preventDefault(),l.stopPropagation())})),this._register(O(window,z.KEY_UP,a=>{let l=new De(a);this._singleModifierDispatch(l,l.target)&&l.preventDefault()}))}addDynamicKeybinding(e,t,i,n){let r=Lh(t,Ii),o=new U;return r&&(this._dynamicKeybindings.push({keybinding:r,command:e,when:n,weight1:1e3,weight2:0,extensionId:null,isBuiltinExtension:!1}),o.add(oe(()=>{for(let a=0;athis._log(i))}return this._cachedResolver}_documentHasFocus(){return document.hasFocus()}_toNormalizedKeybindingItems(e,t){let i=[],n=0;for(let r of e){let o=r.when||void 0,a=r.keybinding;if(!a)i[n++]=new Vg(void 0,r.command,r.commandArgs,o,t,null,!1);else{let l=this.resolveKeybinding(a);for(let c of l)i[n++]=new Vg(c,r.command,r.commandArgs,o,t,null,!1)}}return i}resolveKeybinding(e){return[new Lc(e,Ii)]}resolveKeyboardEvent(e){let t=new El(e.ctrlKey,e.shiftKey,e.altKey,e.metaKey,e.keyCode).toChord();return new Lc(t,Ii)}};function GE(s){return s&&typeof s=="object"&&(!s.overrideIdentifier||typeof s.overrideIdentifier=="string")&&(!s.resource||s.resource instanceof K)}var Ug=class{constructor(){this._onDidChangeConfiguration=new k,this.onDidChangeConfiguration=this._onDidChangeConfiguration.event,this._configuration=new yc(new Rv,new Fi)}getValue(e,t){let i=typeof e=="string"?e:void 0,n=GE(e)?e:GE(t)?t:{};return this._configuration.getValue(i,n,void 0)}updateValues(e){let t={data:this._configuration.toData()},i=[];for(let n of e){let[r,o]=n;this.getValue(r)!==o&&(this._configuration.updateValue(r,o),i.push(r))}if(i.length>0){let n=new Av({keys:i,overrides:[]},t,this._configuration);n.source=7,n.sourceConfig=null,this._onDidChangeConfiguration.fire(n)}return Promise.resolve()}},zv=class{constructor(e){this.configurationService=e,this._onDidChangeConfiguration=new k,this.configurationService.onDidChangeConfiguration(t=>{this._onDidChangeConfiguration.fire({affectedKeys:t.affectedKeys,affectsConfiguration:(i,n)=>t.affectsConfiguration(n)})})}getValue(e,t,i){let r=(N.isIPosition(t)?t:null)?typeof i=="string"?i:void 0:typeof t=="string"?t:void 0;return typeof r=="undefined"?this.configurationService.getValue():this.configurationService.getValue(r)}},$g=class{constructor(e){this.configurationService=e}getEOL(e,t){let i=this.configurationService.getValue("files.eol",{overrideIdentifier:t,resource:e});return i&&typeof i=="string"&&i!=="auto"?i:_t||ee?` +`:`\r +`}};$g=UE([$E(0,nt)],$g);var Hv=class{publicLog(e,t){return Promise.resolve(void 0)}publicLog2(e,t){return this.publicLog(e,t)}},Ec=class{constructor(){let e=K.from({scheme:Ec.SCHEME,authority:"model",path:"/"});this.workspace={id:"4064f6ec-cb38-4ad0-af64-ee6467e63c82",folders:[new Wv({uri:e,name:"",index:0})]}}getWorkspace(){return this.workspace}};Ec.SCHEME="inmemory";function Yd(s,e,t){if(!e||!(s instanceof Ug))return;let i=[];Object.keys(e).forEach(n=>{xE(n)&&i.push([`editor.${n}`,e[n]]),t&&DE(n)&&i.push([`diffEditor.${n}`,e[n]])}),i.length>0&&s.updateValues(i)}var Uv=class{constructor(e){this._modelService=e}hasPreviewHandler(){return!1}apply(e,t){return KE(this,void 0,void 0,function*(){let i=new Map;for(let o of e){if(!(o instanceof Og))throw new Error("bad edit - only text edits are supported");let a=this._modelService.getModel(o.resource);if(!a)throw new Error("bad edit - model not found");if(typeof o.versionId=="number"&&a.getVersionId()!==o.versionId)throw new Error("bad state - model changed in the meantime");let l=i.get(a);l||(l=[],i.set(a,l)),l.push(Sc.replaceMove(D.lift(o.textEdit.range),o.textEdit.text))}let n=0,r=0;for(let[o,a]of i)o.pushStackElement(),o.pushEditOperations([],a,()=>[]),o.pushStackElement(),r+=1,n+=a.length;return{ariaSummary:ji(zg.bulkEditServiceSummary,n,r)}})}},$v=class{getUriLabel(e,t){return e.scheme==="file"?e.fsPath:e.path}},Kv=class{constructor(e,t){this._codeEditorService=e,this._container=t,this.onDidLayout=j.None}get dimension(){return this._dimension||(this._dimension=Bf(window.document.body)),this._dimension}get container(){return this._container}focus(){var e;(e=this._codeEditorService.getFocusedCodeEditor())===null||e===void 0||e.focus()}};var Kg=$("markerDecorationsService");var M4=function(s,e,t,i){var n=arguments.length,r=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(s,e,t,i);else for(var a=s.length-1;a>=0;a--)(o=s[a])&&(r=(n<3?o(r):n>3?o(e,t,r):o(e,t))||r);return n>3&&r&&Object.defineProperty(e,t,r),r},R4=function(s,e){return function(t,i){e(t,i,s)}},Zd=class{constructor(e,t){}dispose(){}};Zd.ID="editor.contrib.markerDecorations";Zd=M4([R4(1,Kg)],Zd);dm(Zd.ID,Zd);var qv=class{constructor(e,t){this.chr=e,this.type=t,this.width=0}fulfill(e){this.width=e}},qg=class{constructor(e,t){this._bareFontInfo=e,this._requests=t,this._container=null,this._testElements=null}read(){this._createDomElements(),document.body.appendChild(this._container),this._readFromDomElements(),document.body.removeChild(this._container),this._container=null,this._testElements=null}_createDomElements(){let e=document.createElement("div");e.style.position="absolute",e.style.top="-50000px",e.style.width="50000px";let t=document.createElement("div");t.style.fontFamily=this._bareFontInfo.getMassagedFontFamily(),t.style.fontWeight=this._bareFontInfo.fontWeight,t.style.fontSize=this._bareFontInfo.fontSize+"px",t.style.fontFeatureSettings=this._bareFontInfo.fontFeatureSettings,t.style.lineHeight=this._bareFontInfo.lineHeight+"px",t.style.letterSpacing=this._bareFontInfo.letterSpacing+"px",e.appendChild(t);let i=document.createElement("div");i.style.fontFamily=this._bareFontInfo.getMassagedFontFamily(),i.style.fontWeight="bold",i.style.fontSize=this._bareFontInfo.fontSize+"px",i.style.fontFeatureSettings=this._bareFontInfo.fontFeatureSettings,i.style.lineHeight=this._bareFontInfo.lineHeight+"px",i.style.letterSpacing=this._bareFontInfo.letterSpacing+"px",e.appendChild(i);let n=document.createElement("div");n.style.fontFamily=this._bareFontInfo.getMassagedFontFamily(),n.style.fontWeight=this._bareFontInfo.fontWeight,n.style.fontSize=this._bareFontInfo.fontSize+"px",n.style.fontFeatureSettings=this._bareFontInfo.fontFeatureSettings,n.style.lineHeight=this._bareFontInfo.lineHeight+"px",n.style.letterSpacing=this._bareFontInfo.letterSpacing+"px",n.style.fontStyle="italic",e.appendChild(n);let r=[];for(let o of this._requests){let a;o.type===0&&(a=t),o.type===2&&(a=i),o.type===1&&(a=n),a.appendChild(document.createElement("br"));let l=document.createElement("span");qg._render(l,o),a.appendChild(l),r.push(l)}this._container=e,this._testElements=r}static _render(e,t){if(t.chr===" "){let i="\xA0";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{e&&e[0]&&e[0].contentRect?this.observe({width:e[0].contentRect.width,height:e[0].contentRect.height}):this.observe()}),this.resizeObserver.observe(this.referenceDomElement)):this.measureReferenceDomElementToken===-1&&(this.measureReferenceDomElementToken=setInterval(()=>this.observe(),100))}stopObserving(){this.resizeObserver&&(this.resizeObserver.disconnect(),this.resizeObserver=null),this.measureReferenceDomElementToken!==-1&&(clearInterval(this.measureReferenceDomElementToken),this.measureReferenceDomElementToken=-1)}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.changeCallback())}};var Gv=class{constructor(){this._keys=Object.create(null),this._values=Object.create(null)}has(e){let t=e.getId();return!!this._values[t]}get(e){let t=e.getId();return this._values[t]}put(e,t){let i=e.getId();this._keys[i]=e,this._values[i]=t}remove(e){let t=e.getId();delete this._keys[t],delete this._values[t]}getValues(){return Object.keys(this._keys).map(e=>this._values[e])}};function ZE(){bo.INSTANCE.clearCache()}var bo=class extends M{constructor(){super();this._onDidChange=this._register(new k),this.onDidChange=this._onDidChange.event,this._cache=new Gv,this._evictUntrustedReadingsTimeout=-1}dispose(){this._evictUntrustedReadingsTimeout!==-1&&(clearTimeout(this._evictUntrustedReadingsTimeout),this._evictUntrustedReadingsTimeout=-1),super.dispose()}clearCache(){this._cache=new Gv,this._onDidChange.fire()}_writeToCache(e,t){this._cache.put(e,t),!t.isTrusted&&this._evictUntrustedReadingsTimeout===-1&&(this._evictUntrustedReadingsTimeout=setTimeout(()=>{this._evictUntrustedReadingsTimeout=-1,this._evictUntrustedReadings()},5e3))}_evictUntrustedReadings(){let e=this._cache.getValues(),t=!1;for(let i of e)i.isTrusted||(t=!0,this._cache.remove(i));t&&this._onDidChange.fire()}readConfiguration(e){if(!this._cache.has(e)){let t=bo._actualReadConfiguration(e);(t.typicalHalfwidthCharacterWidth<=2||t.typicalFullwidthCharacterWidth<=2||t.spaceWidth<=2||t.maxDigitWidth<=2)&&(t=new hc({zoomLevel:xf(),pixelRatio:xl(),fontFamily:t.fontFamily,fontWeight:t.fontWeight,fontSize:t.fontSize,fontFeatureSettings:t.fontFeatureSettings,lineHeight:t.lineHeight,letterSpacing:t.letterSpacing,isMonospace:t.isMonospace,typicalHalfwidthCharacterWidth:Math.max(t.typicalHalfwidthCharacterWidth,5),typicalFullwidthCharacterWidth:Math.max(t.typicalFullwidthCharacterWidth,5),canUseHalfwidthRightwardsArrow:t.canUseHalfwidthRightwardsArrow,spaceWidth:Math.max(t.spaceWidth,5),middotWidth:Math.max(t.middotWidth,5),wsmiddotWidth:Math.max(t.wsmiddotWidth,5),maxDigitWidth:Math.max(t.maxDigitWidth,5)},!1)),this._writeToCache(e,t)}return this._cache.get(e)}static createRequest(e,t,i,n){let r=new qv(e,t);return i.push(r),n&&n.push(r),r}static _actualReadConfiguration(e){let t=[],i=[],n=this.createRequest("n",0,t,i),r=this.createRequest("\uFF4D",0,t,null),o=this.createRequest(" ",0,t,i),a=this.createRequest("0",0,t,i),l=this.createRequest("1",0,t,i),c=this.createRequest("2",0,t,i),h=this.createRequest("3",0,t,i),d=this.createRequest("4",0,t,i),u=this.createRequest("5",0,t,i),f=this.createRequest("6",0,t,i),m=this.createRequest("7",0,t,i),g=this.createRequest("8",0,t,i),b=this.createRequest("9",0,t,i),w=this.createRequest("\u2192",0,t,i),_=this.createRequest("\uFFEB",0,t,null),v=this.createRequest("\xB7",0,t,i),C=this.createRequest(String.fromCharCode(11825),0,t,null);this.createRequest("|",0,t,i),this.createRequest("/",0,t,i),this.createRequest("-",0,t,i),this.createRequest("_",0,t,i),this.createRequest("i",0,t,i),this.createRequest("l",0,t,i),this.createRequest("m",0,t,i),this.createRequest("|",1,t,i),this.createRequest("_",1,t,i),this.createRequest("i",1,t,i),this.createRequest("l",1,t,i),this.createRequest("m",1,t,i),this.createRequest("n",1,t,i),this.createRequest("|",2,t,i),this.createRequest("_",2,t,i),this.createRequest("i",2,t,i),this.createRequest("l",2,t,i),this.createRequest("m",2,t,i),this.createRequest("n",2,t,i),YE(e,t);let y=Math.max(a.width,l.width,c.width,h.width,d.width,u.width,f.width,m.width,g.width,b.width),x=e.fontFeatureSettings===ii.OFF,S=i[0].width;for(let T=1,I=i.length;x&&T.001){x=!1;break}}let L=!0;x&&_.width!==S&&(L=!1),_.width>w.width&&(L=!1);let E=X1()>2e3;return new hc({zoomLevel:xf(),pixelRatio:xl(),fontFamily:e.fontFamily,fontWeight:e.fontWeight,fontSize:e.fontSize,fontFeatureSettings:e.fontFeatureSettings,lineHeight:e.lineHeight,letterSpacing:e.letterSpacing,isMonospace:x,typicalHalfwidthCharacterWidth:n.width,typicalFullwidthCharacterWidth:r.width,canUseHalfwidthRightwardsArrow:L,spaceWidth:o.width,middotWidth:v.width,wsmiddotWidth:C.width,maxDigitWidth:y},E)}};bo.INSTANCE=new bo;var mt=class extends Cc{constructor(e,t,i=null,n){super(e,t);this.accessibilityService=n,this._elementSizeObserver=this._register(new Xd(i,t.dimension,()=>this._recomputeOptions())),this._register(bo.INSTANCE.onDidChange(()=>this._recomputeOptions())),this._validatedOptions.get(10)&&this._elementSizeObserver.startObserving(),this._register(Q1(r=>this._recomputeOptions())),this._register(this.accessibilityService.onDidChangeScreenReaderOptimized(()=>this._recomputeOptions())),this._recomputeOptions()}static applyFontInfoSlow(e,t){e.style.fontFamily=t.getMassagedFontFamily(),e.style.fontWeight=t.fontWeight,e.style.fontSize=t.fontSize+"px",e.style.fontFeatureSettings=t.fontFeatureSettings,e.style.lineHeight=t.lineHeight+"px",e.style.letterSpacing=t.letterSpacing+"px"}static applyFontInfo(e,t){e.setFontFamily(t.getMassagedFontFamily()),e.setFontWeight(t.fontWeight),e.setFontSize(t.fontSize),e.setFontFeatureSettings(t.fontFeatureSettings),e.setLineHeight(t.lineHeight),e.setLetterSpacing(t.letterSpacing)}observeReferenceElement(e){this._elementSizeObserver.observe(e)}updatePixelRatio(){this._recomputeOptions()}static _getExtraEditorClassName(){let e="";return!_n&&!ey&&(e+="no-user-select "),_n&&(e+="no-minimap-shadow "),ee&&(e+="mac "),e}_getEnvConfiguration(){return{extraEditorClassName:mt._getExtraEditorClassName(),outerWidth:this._elementSizeObserver.getWidth(),outerHeight:this._elementSizeObserver.getHeight(),emptySelectionClipboard:Tn||at,pixelRatio:xl(),zoomLevel:xf(),accessibilitySupport:this.accessibilityService.isScreenReaderOptimized()?2:this.accessibilityService.getAccessibilitySupport()}}readConfiguration(e){return bo.INSTANCE.readConfiguration(e)}};var Gg=class{constructor(e){this.domNode=e,this._maxWidth=-1,this._width=-1,this._height=-1,this._top=-1,this._left=-1,this._bottom=-1,this._right=-1,this._fontFamily="",this._fontWeight="",this._fontSize=-1,this._fontFeatureSettings="",this._lineHeight=-1,this._letterSpacing=-100,this._className="",this._display="",this._position="",this._visibility="",this._backgroundColor="",this._layerHint=!1,this._contain="none",this._boxShadow=""}setMaxWidth(e){this._maxWidth!==e&&(this._maxWidth=e,this.domNode.style.maxWidth=this._maxWidth+"px")}setWidth(e){this._width!==e&&(this._width=e,this.domNode.style.width=this._width+"px")}setHeight(e){this._height!==e&&(this._height=e,this.domNode.style.height=this._height+"px")}setTop(e){this._top!==e&&(this._top=e,this.domNode.style.top=this._top+"px")}unsetTop(){this._top!==-1&&(this._top=-1,this.domNode.style.top="")}setLeft(e){this._left!==e&&(this._left=e,this.domNode.style.left=this._left+"px")}setBottom(e){this._bottom!==e&&(this._bottom=e,this.domNode.style.bottom=this._bottom+"px")}setRight(e){this._right!==e&&(this._right=e,this.domNode.style.right=this._right+"px")}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){this._fontSize!==e&&(this._fontSize=e,this.domNode.style.fontSize=this._fontSize+"px")}setFontFeatureSettings(e){this._fontFeatureSettings!==e&&(this._fontFeatureSettings=e,this.domNode.style.fontFeatureSettings=this._fontFeatureSettings)}setLineHeight(e){this._lineHeight!==e&&(this._lineHeight=e,this.domNode.style.lineHeight=this._lineHeight+"px")}setLetterSpacing(e){this._letterSpacing!==e&&(this._letterSpacing=e,this.domNode.style.letterSpacing=this._letterSpacing+"px")}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)}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 X(s){return new Gg(s)}function ze(s,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");let r=`$memoize$${e}`;t[i]=function(...o){return this.hasOwnProperty(r)||Object.defineProperty(this,r,{configurable:!1,enumerable:!1,writable:!1,value:n.apply(this,o)}),this[r]}}var A4=function(s,e,t,i){var n=arguments.length,r=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(s,e,t,i);else for(var a=s.length-1;a>=0;a--)(o=s[a])&&(r=(n<3?o(r):n>3?o(e,t,r):o(e,t))||r);return n>3&&r&&Object.defineProperty(e,t,r),r},Re;(function(s){s.Tap="-monaco-gesturetap",s.Change="-monaco-gesturechange",s.Start="-monaco-gesturestart",s.End="-monaco-gesturesend",s.Contextmenu="-monaco-gesturecontextmenu"})(Re||(Re={}));var we=class extends M{constructor(){super();this.dispatched=!1,this.activeTouches={},this.handle=null,this.targets=[],this.ignoreTargets=[],this._lastSetTapCountTime=0,this._register(O(document,"touchstart",e=>this.onTouchStart(e),{passive:!1})),this._register(O(document,"touchend",e=>this.onTouchEnd(e))),this._register(O(document,"touchmove",e=>this.onTouchMove(e),{passive:!1}))}static addTarget(e){return we.isTouchDevice()?(we.INSTANCE||(we.INSTANCE=new we),we.INSTANCE.targets.push(e),{dispose:()=>{we.INSTANCE.targets=we.INSTANCE.targets.filter(t=>t!==e)}}):M.None}static ignoreTarget(e){return we.isTouchDevice()?(we.INSTANCE||(we.INSTANCE=new we),we.INSTANCE.ignoreTargets.push(e),{dispose:()=>{we.INSTANCE.ignoreTargets=we.INSTANCE.ignoreTargets.filter(t=>t!==e)}}):M.None}static isTouchDevice(){return"ontouchstart"in window||navigator.maxTouchPoints>0}dispose(){this.handle&&(this.handle.dispose(),this.handle=null),super.dispose()}onTouchStart(e){let t=Date.now();this.handle&&(this.handle.dispose(),this.handle=null);for(let i=0,n=e.targetTouches.length;i=we.HOLD_DELAY&&Math.abs(a.initialPageX-Ui(a.rollingPageX))<30&&Math.abs(a.initialPageY-Ui(a.rollingPageY))<30){let c=this.newGestureEvent(Re.Contextmenu,a.initialTarget);c.pageX=Ui(a.rollingPageX),c.pageY=Ui(a.rollingPageY),this.dispatchEvent(c)}else if(i===1){let c=Ui(a.rollingPageX),h=Ui(a.rollingPageY),d=Ui(a.rollingTimestamps)-a.rollingTimestamps[0],u=c-a.rollingPageX[0],f=h-a.rollingPageY[0],m=this.targets.filter(g=>a.initialTarget instanceof Node&&g.contains(a.initialTarget));this.inertia(m,t,Math.abs(u)/d,u>0?1:-1,c,Math.abs(f)/d,f>0?1:-1,h)}this.dispatchEvent(this.newGestureEvent(Re.End,a.initialTarget)),delete this.activeTouches[o.identifier]}this.dispatched&&(e.preventDefault(),e.stopPropagation(),this.dispatched=!1)}newGestureEvent(e,t){let i=document.createEvent("CustomEvent");return i.initEvent(e,!1,!0),i.initialTarget=t,i.tapCount=0,i}dispatchEvent(e){if(e.type===Re.Tap){let t=new Date().getTime(),i=0;t-this._lastSetTapCountTime>we.CLEAR_TAP_COUNT_TIME?i=1:i=2,this._lastSetTapCountTime=t,e.tapCount=i}else(e.type===Re.Change||e.type===Re.Contextmenu)&&(this._lastSetTapCountTime=0);for(let t=0;t{e.initialTarget instanceof Node&&t.contains(e.initialTarget)&&(t.dispatchEvent(e),this.dispatched=!0)})}inertia(e,t,i,n,r,o,a,l){this.handle=Ti(()=>{let c=Date.now(),h=c-t,d=0,u=0,f=!0;i+=we.SCROLL_FRICTION*h,o+=we.SCROLL_FRICTION*h,i>0&&(f=!1,d=n*i*h),o>0&&(f=!1,u=a*o*h);let m=this.newGestureEvent(Re.Change);m.translationX=d,m.translationY=u,e.forEach(g=>g.dispatchEvent(m)),f||this.inertia(e,c,i,n,r+d,o,a,l+u)})}onTouchMove(e){let t=Date.now();for(let i=0,n=e.changedTouches.length;i3&&(o.rollingPageX.shift(),o.rollingPageY.shift(),o.rollingTimestamps.shift()),o.rollingPageX.push(r.pageX),o.rollingPageY.push(r.pageY),o.rollingTimestamps.push(t)}this.dispatched&&(e.preventDefault(),e.stopPropagation(),this.dispatched=!1)}};we.SCROLL_FRICTION=-.005;we.HOLD_DELAY=700;we.CLEAR_TAP_COUNT_TIME=400;A4([ze],we,"isTouchDevice",null);function kc(s,e){let t=new Bt(e);return t.preventDefault(),{leftButton:t.leftButton,buttons:t.buttons,posx:t.posx,posy:t.posy}}var cr=class{constructor(){this._hooks=new U,this._mouseMoveEventMerger=null,this._mouseMoveCallback=null,this._onStopCallback=null}dispose(){this.stopMonitoring(!1),this._hooks.dispose()}stopMonitoring(e,t){if(!this.isMonitoring())return;this._hooks.clear(),this._mouseMoveEventMerger=null,this._mouseMoveCallback=null;let i=this._onStopCallback;this._onStopCallback=null,e&&i&&i(t)}isMonitoring(){return!!this._mouseMoveEventMerger}startMonitoring(e,t,i,n,r){if(this.isMonitoring())return;this._mouseMoveEventMerger=i,this._mouseMoveCallback=n,this._onStopCallback=r;let o=Il.getSameOriginWindowChain(),a=en?"pointermove":"mousemove",l="mouseup",c=o.map(d=>d.window.document),h=Vr(e);h&&c.unshift(h);for(let d of c)this._hooks.add(Ih(d,a,u=>{if(u.buttons!==t){this.stopMonitoring(!0);return}this._mouseMoveCallback(u)},(u,f)=>this._mouseMoveEventMerger(u,f))),this._hooks.add(O(d,l,u=>this.stopMonitoring(!0)));if(Il.hasDifferentOriginAncestor()){let d=o[o.length-1];this._hooks.add(O(d.window.document,"mouseout",u=>{new Bt(u).target.tagName.toLowerCase()==="html"&&this.stopMonitoring(!0)})),this._hooks.add(O(d.window.document,"mouseover",u=>{new Bt(u).target.tagName.toLowerCase()==="html"&&this.stopMonitoring(!0)})),this._hooks.add(O(d.window.document.body,"mouseleave",u=>{this.stopMonitoring(!0)}))}}};var Qd=class{constructor(e,t){this.x=e,this.y=t,this._pageCoordinatesBrand=void 0}toClientCoordinates(){return new Yg(this.x-An.scrollX,this.y-An.scrollY)}},Yg=class{constructor(e,t){this.clientX=e,this.clientY=t,this._clientCoordinatesBrand=void 0}toPageCoordinates(){return new Qd(this.clientX+An.scrollX,this.clientY+An.scrollY)}},XE=class{constructor(e,t,i,n){this.x=e,this.y=t,this.width=i,this.height=n,this._editorPagePositionBrand=void 0}};function Yv(s){let e=ti(s);return new XE(e.left,e.top,e.width,e.height)}var hr=class extends Bt{constructor(e,t){super(e);this._editorMouseEventBrand=void 0,this.pos=new Qd(this.posx,this.posy),this.editorPos=Yv(t)}},Zv=class{constructor(e){this._editorViewDomNode=e}_create(e){return new hr(e,this._editorViewDomNode)}onContextMenu(e,t){return O(e,"contextmenu",i=>{t(this._create(i))})}onMouseUp(e,t){return O(e,"mouseup",i=>{t(this._create(i))})}onMouseDown(e,t){return O(e,"mousedown",i=>{t(this._create(i))})}onMouseLeave(e,t){return Pf(e,i=>{t(this._create(i))})}onMouseMoveThrottled(e,t,i,n){return Ih(e,"mousemove",t,(o,a)=>i(o,this._create(a)),n)}},Xv=class{constructor(e){this._editorViewDomNode=e}_create(e){return new hr(e,this._editorViewDomNode)}onPointerUp(e,t){return O(e,"pointerup",i=>{t(this._create(i))})}onPointerDown(e,t){return O(e,"pointerdown",i=>{t(this._create(i))})}onPointerLeave(e,t){return Ey(e,i=>{t(this._create(i))})}onPointerMoveThrottled(e,t,i,n){return Ih(e,"pointermove",t,(o,a)=>i(o,this._create(a)),n)}},Qv=class extends M{constructor(e){super();this._editorViewDomNode=e,this._globalMouseMoveMonitor=this._register(new cr),this._keydownListener=null}startMonitoring(e,t,i,n,r){this._keydownListener=lt(document,"keydown",a=>{a.toKeybinding().isModifierKey()||this._globalMouseMoveMonitor.stopMonitoring(!0,a.browserEvent)},!0);let o=(a,l)=>i(a,new hr(l,this._editorViewDomNode));this._globalMouseMoveMonitor.startMonitoring(e,t,o,n,a=>{this._keydownListener.dispose(),r(a)})}stopMonitoring(){this._globalMouseMoveMonitor.stopMonitoring(!0)}};var $n=class extends M{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=c?r=Math.max(r,c+h-n):(t[i++]=new Dn(n,r),n=c,r=h)}return t[i++]=new Dn(n,r),t}static _createHorizontalRangesFromClientRects(e,t){if(!e||e.length===0)return null;let i=[];for(let n=0,r=e.length;nc)return null;if(t=Math.min(c,Math.max(l,t)),n=Math.min(c,Math.max(l,n)),t===n&&i===r&&i===0&&!e.children[t].firstChild){let f=e.children[t].getClientRects();return this._createHorizontalRangesFromClientRects(f,o)}t!==n&&n>0&&r===0&&(n--,r=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&&r===0&&n>0&&(d=e.children[n-1].firstChild,r=1073741824)),!h||!d)return null;i=Math.min(h.textContent.length,Math.max(0,i)),r=Math.min(d.textContent.length,Math.max(0,r));let u=this._readClientRects(h,i,d,r,a);return this._createHorizontalRangesFromClientRects(u,o)}};var O4=function(){return Mr?!0:!(_t||at||_n)}(),Ic=!0,Zg=class{constructor(e,t){this._domNode=e,this._clientRectDeltaLeft=0,this._clientRectDeltaLeftRead=!1,this.endNode=t}get clientRectDeltaLeft(){return this._clientRectDeltaLeftRead||(this._clientRectDeltaLeftRead=!0,this._clientRectDeltaLeft=this._domNode.getBoundingClientRect().left),this._clientRectDeltaLeft}},Xg=class{constructor(e,t){this.themeType=t;let i=e.options,n=i.get(41);this.renderWhitespace=i.get(87),this.renderControlCharacters=i.get(81),this.spaceWidth=n.spaceWidth,this.middotWidth=n.middotWidth,this.wsmiddotWidth=n.wsmiddotWidth,this.useMonospaceOptimizations=n.isMonospace&&!i.get(27),this.canUseHalfwidthRightwardsArrow=n.canUseHalfwidthRightwardsArrow,this.lineHeight=i.get(57),this.stopRenderingLineAfter=i.get(104),this.fontLigatures=i.get(42)}equals(e){return this.themeType===e.themeType&&this.renderWhitespace===e.renderWhitespace&&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}},ln=class{constructor(e){this._options=e,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=X(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 this._options.themeType===nn.HIGH_CONTRAST||this._options.renderWhitespace==="selection"?(this._isMaybeInvalid=!0,!0):!1}renderLine(e,t,i,n){if(this._isMaybeInvalid===!1)return!1;this._isMaybeInvalid=!1;let r=i.getViewLineRenderingData(e),o=this._options,a=yi.filter(r.inlineDecorations,e,r.minColumn,r.maxColumn),l=null;if(o.themeType===nn.HIGH_CONTRAST||this._options.renderWhitespace==="selection"){let u=i.selections;for(let f of u){if(f.endLineNumbere)continue;let m=f.startLineNumber===e?f.startColumn:r.minColumn,g=f.endLineNumber===e?f.endColumn:r.maxColumn;m');let h=Vd(c,n);n.appendASCIIString("");let d=null;return Ic&&O4&&r.isBasicASCII&&o.useMonospaceOptimizations&&h.containsForeignElements===0&&r.content.length<300&&c.lineTokens.getCount()<100&&(d=new eu(this._renderedViewLine?this._renderedViewLine.domNode:null,c,h.characterMapping)),d||(d=ek(this._renderedViewLine?this._renderedViewLine.domNode:null,c,h.characterMapping,h.containsRTL,h.containsForeignElements)),this._renderedViewLine=d,!0}layoutLine(e,t){this._renderedViewLine&&this._renderedViewLine.domNode&&(this._renderedViewLine.domNode.setTop(t),this._renderedViewLine.domNode.setHeight(this._options.lineHeight))}getWidth(){return this._renderedViewLine?this._renderedViewLine.getWidth():0}getWidthIsFast(){return this._renderedViewLine?this._renderedViewLine.getWidthIsFast():!0}needsMonospaceFontCheck(){return this._renderedViewLine?this._renderedViewLine instanceof eu:!1}monospaceAssumptionsAreValid(){return this._renderedViewLine&&this._renderedViewLine instanceof eu?this._renderedViewLine.monospaceAssumptionsAreValid():Ic}onMonospaceAssumptionsInvalidated(){this._renderedViewLine&&this._renderedViewLine instanceof eu&&(this._renderedViewLine=this._renderedViewLine.toSlowRenderedLine())}getVisibleRangesForRange(e,t,i){if(!this._renderedViewLine)return null;e=e|0,t=t|0,e=Math.min(this._renderedViewLine.input.lineContent.length+1,Math.max(1,e)),t=Math.min(this._renderedViewLine.input.lineContent.length+1,Math.max(1,t));let n=this._renderedViewLine.input.stopRenderingLineAfter|0,r=!1;n!==-1&&e>n+1&&t>n+1&&(r=!0),n!==-1&&e>n+1&&(e=n+1),n!==-1&&t>n+1&&(t=n+1);let o=this._renderedViewLine.getVisibleRangesForRange(e,t,i);return o&&o.length>0?new iC(r,o):null}getColumnOfNodeOffset(e,t,i){return this._renderedViewLine?this._renderedViewLine.getColumnOfNodeOffset(e,t,i):1}};ln.CLASS_NAME="view-line";var eu=class{constructor(e,t,i){this.domNode=e,this.input=t,this._characterMapping=i,this._charWidth=t.spaceWidth}getWidth(){return this._getCharPosition(this._characterMapping.length)}getWidthIsFast(){return!0}monospaceAssumptionsAreValid(){if(!this.domNode)return Ic;let e=this.getWidth(),t=this.domNode.domNode.firstChild.offsetWidth;return Math.abs(e-t)>=2&&(console.warn("monospace assumptions have been violated, therefore disabling monospace optimizations!"),Ic=!1),Ic}toSlowRenderedLine(){return ek(this.domNode,this.input,this._characterMapping,!1,0)}getVisibleRangesForRange(e,t,i){let n=this._getCharPosition(e),r=this._getCharPosition(t);return[new Dn(n,r-n)]}_getCharPosition(e){let t=this._characterMapping.getAbsoluteOffset(e);return Math.round(this._charWidth*t)}getColumnOfNodeOffset(e,t,i){let n=t.textContent.length,r=-1;for(;t;)t=t.previousSibling,r++;return this._characterMapping.getColumn(new Wd(r,i),n)}},sC=class{constructor(e,t,i,n,r){if(this.domNode=e,this.input=t,this._characterMapping=i,this._isWhitespaceOnly=/^\s*$/.test(t.lineContent),this._containsForeignElements=r,this._cachedWidth=-1,this._pixelOffsetCache=null,!n||this._characterMapping.length===0){this._pixelOffsetCache=new Int32Array(Math.max(2,this._characterMapping.length+1));for(let o=0,a=this._characterMapping.length;o<=a;o++)this._pixelOffsetCache[o]=-1}}_getReadingTarget(e){return e.domNode.firstChild}getWidth(){return this.domNode?(this._cachedWidth===-1&&(this._cachedWidth=this._getReadingTarget(this.domNode).offsetWidth),this._cachedWidth):0}getWidthIsFast(){return this._cachedWidth!==-1}getVisibleRangesForRange(e,t,i){if(!this.domNode)return null;if(this._pixelOffsetCache!==null){let n=this._readPixelOffset(this.domNode,e,i);if(n===-1)return null;let r=this._readPixelOffset(this.domNode,t,i);return r===-1?null:[new Dn(n,r-n)]}return this._readVisibleRangesForRange(this.domNode,e,t,i)}_readVisibleRangesForRange(e,t,i,n){if(t===i){let r=this._readPixelOffset(e,t,n);return r===-1?null:[new Dn(r,0)]}else return this._readRawVisibleRangesForRange(e,t,i,n)}_readPixelOffset(e,t,i){if(this._characterMapping.length===0){if(this._containsForeignElements===0||this._containsForeignElements===2)return 0;if(this._containsForeignElements===1)return this.getWidth();let n=this._getReadingTarget(e);return n.firstChild?n.firstChild.offsetWidth:0}if(this._pixelOffsetCache!==null){let n=this._pixelOffsetCache[t];if(n!==-1)return n;let r=this._actualReadPixelOffset(e,t,i);return this._pixelOffsetCache[t]=r,r}return this._actualReadPixelOffset(e,t,i)}_actualReadPixelOffset(e,t,i){if(this._characterMapping.length===0){let a=Jd.readHorizontalRanges(this._getReadingTarget(e),0,0,0,0,i.clientRectDeltaLeft,i.endNode);return!a||a.length===0?-1:a[0].left}if(t===this._characterMapping.length&&this._isWhitespaceOnly&&this._containsForeignElements===0)return this.getWidth();let n=this._characterMapping.getDomPosition(t),r=Jd.readHorizontalRanges(this._getReadingTarget(e),n.partIndex,n.charIndex,n.partIndex,n.charIndex,i.clientRectDeltaLeft,i.endNode);if(!r||r.length===0)return-1;let o=r[0].left;if(this.input.isBasicASCII){let a=this._characterMapping.getAbsoluteOffset(t),l=Math.round(this.input.spaceWidth*a);if(Math.abs(l-o)<=1)return l}return o}_readRawVisibleRangesForRange(e,t,i,n){if(t===1&&i===this._characterMapping.length)return[new Dn(0,this.getWidth())];let r=this._characterMapping.getDomPosition(t),o=this._characterMapping.getDomPosition(i);return Jd.readHorizontalRanges(this._getReadingTarget(e),r.partIndex,r.charIndex,o.partIndex,o.charIndex,n.clientRectDeltaLeft,n.endNode)}getColumnOfNodeOffset(e,t,i){let n=t.textContent.length,r=-1;for(;t;)t=t.previousSibling,r++;return this._characterMapping.getColumn(new Wd(r,i),n)}},JE=class extends sC{_readVisibleRangesForRange(e,t,i,n){let r=super._readVisibleRangesForRange(e,t,i,n);if(!r||r.length===0||t===i||t===1&&i===this._characterMapping.length)return r;if(!this.input.containsRTL){let o=this._readPixelOffset(e,i,n);if(o!==-1){let a=r[r.length-1];a.left=4&&e[0]===3&&e[3]===7}static isStrictChildOfViewLines(e){return e.length>4&&e[0]===3&&e[3]===7}static isChildOfScrollableElement(e){return e.length>=2&&e[0]===3&&e[1]===5}static isChildOfMinimap(e){return e.length>=2&&e[0]===3&&e[1]===8}static isChildOfContentWidgets(e){return e.length>=4&&e[0]===3&&e[3]===1}static isChildOfOverflowingContentWidgets(e){return e.length>=1&&e[0]===2}static isChildOfOverlayWidgets(e){return e.length>=2&&e[0]===3&&e[1]===4}},wo=class{constructor(e,t,i){this.model=e.model;let n=e.configuration.options;this.layoutInfo=n.get(129),this.viewDomNode=t.viewDomNode,this.lineHeight=n.get(57),this.stickyTabStops=n.get(103),this.typicalHalfwidthCharacterWidth=n.get(41).typicalHalfwidthCharacterWidth,this.lastRenderData=i,this._context=e,this._viewHelper=t}getZoneAtCoord(e){return wo.getZoneAtCoord(this._context,e)}static getZoneAtCoord(e,t){let i=e.viewLayout.getWhitespaceAtVerticalOffset(t);if(i){let n=i.verticalOffset+i.height/2,r=e.model.getLineCount(),o=null,a,l=null;return i.afterLineNumber!==r&&(l=new N(i.afterLineNumber+1,1)),i.afterLineNumber>0&&(o=new N(i.afterLineNumber,e.model.getLineMaxColumn(i.afterLineNumber))),l===null?a=o:o===null?a=l:t=e.layoutInfo.glyphMarginLeft,this.isInContentArea=!this.isInMarginArea,this.mouseColumn=Math.max(0,Pt._getMouseColumn(this.mouseContentHorizontalOffset,e.typicalHalfwidthCharacterWidth))}},Jg=class extends tk{constructor(e,t,i,n){super(e,t,i);this._ctx=e,n?(this.target=n,this.targetPath=Xt.collect(n,e.viewDomNode)):(this.target=null,this.targetPath=new Uint8Array(0))}toString(){return`pos(${this.pos.x},${this.pos.y}), editorPos(${this.editorPos.x},${this.editorPos.y}), mouseVerticalOffset: ${this.mouseVerticalOffset}, mouseContentHorizontalOffset: ${this.mouseContentHorizontalOffset} + target: ${this.target?this.target.outerHTML:null}`}fulfill(e,t=null,i=null,n=null){let r=this.mouseColumn;return t&&t.columno.contentLeft+o.width)continue;let a=e.getVerticalOffsetForLineNumber(o.position.lineNumber);if(a<=r&&r<=a+o.height)return t.fulfill(6,o.position,null,{mightBeForeignElement:!1})}}return null}static _hitTestViewZone(e,t){let i=e.getZoneAtCoord(t.mouseVerticalOffset);if(i){let n=t.isInContentArea?8:5;return t.fulfill(n,i.position,null,i)}return null}static _hitTestTextArea(e,t){return cn.isTextArea(t.targetPath)?e.lastRenderData.lastTextareaPosition?t.fulfill(6,e.lastRenderData.lastTextareaPosition,null,{mightBeForeignElement:!1}):t.fulfill(1,e.lastRenderData.lastTextareaPosition):null}static _hitTestMargin(e,t){if(t.isInMarginArea){let i=e.getFullLineRangeAtCoord(t.mouseVerticalOffset),n=i.range.getStartPosition(),r=Math.abs(t.pos.x-t.editorPos.x),o={isAfterLines:i.isAfterLines,glyphMarginLeft:e.layoutInfo.glyphMarginLeft,glyphMarginWidth:e.layoutInfo.glyphMarginWidth,lineNumbersWidth:e.layoutInfo.lineNumbersWidth,offsetX:r};return r-=e.layoutInfo.glyphMarginLeft,r<=e.layoutInfo.glyphMarginWidth?t.fulfill(2,n,i.range,o):(r-=e.layoutInfo.glyphMarginWidth,r<=e.layoutInfo.lineNumbersWidth?t.fulfill(3,n,i.range,o):(r-=e.layoutInfo.lineNumbersWidth,t.fulfill(4,n,i.range,o)))}return null}static _hitTestViewLines(e,t,i){if(!cn.isChildOfViewLines(t.targetPath))return null;if(e.isInTopPadding(t.mouseVerticalOffset))return t.fulfill(7,new N(1,1),null,ik);if(e.isAfterLines(t.mouseVerticalOffset)||e.isInBottomPadding(t.mouseVerticalOffset)){let r=e.model.getLineCount(),o=e.model.getLineMaxColumn(r);return t.fulfill(7,new N(r,o),null,ik)}if(i){if(cn.isStrictChildOfViewLines(t.targetPath)){let r=e.getLineNumberAtVerticalOffset(t.mouseVerticalOffset);if(e.model.getLineLength(r)===0){let a=e.getLineWidth(r),l=oC(t.mouseContentHorizontalOffset-a);return t.fulfill(7,new N(r,1),null,l)}let o=e.getLineWidth(r);if(t.mouseContentHorizontalOffset>=o){let a=oC(t.mouseContentHorizontalOffset-o),l=new N(r,e.model.getLineMaxColumn(r));return t.fulfill(7,l,null,a)}}return t.fulfill(0)}let n=Pt._doHitTest(e,t);return n.type===1?Pt.createMouseTargetFromHitTestPosition(e,t,n.spanNode,n.position,n.injectedText):this._createMouseTarget(e,t.withTarget(n.hitTarget),!0)}static _hitTestMinimap(e,t){if(cn.isChildOfMinimap(t.targetPath)){let i=e.getLineNumberAtVerticalOffset(t.mouseVerticalOffset),n=e.model.getLineMaxColumn(i);return t.fulfill(11,new N(i,n))}return null}static _hitTestScrollbarSlider(e,t){if(cn.isChildOfScrollableElement(t.targetPath)&&t.target&&t.target.nodeType===1){let i=t.target.className;if(i&&/\b(slider|scrollbar)\b/.test(i)){let n=e.getLineNumberAtVerticalOffset(t.mouseVerticalOffset),r=e.model.getLineMaxColumn(n);return t.fulfill(11,new N(n,r))}}return null}static _hitTestScrollbar(e,t){if(cn.isChildOfScrollableElement(t.targetPath)){let i=e.getLineNumberAtVerticalOffset(t.mouseVerticalOffset),n=e.model.getLineMaxColumn(i);return t.fulfill(11,new N(i,n))}return null}getMouseColumn(e,t){let i=this._context.configuration.options,n=i.get(129),r=this._context.viewLayout.getCurrentScrollLeft()+t.x-e.x-n.contentLeft;return Pt._getMouseColumn(r,i.get(41).typicalHalfwidthCharacterWidth)}static _getMouseColumn(e,t){return e<0?1:Math.round(e/t)+1}static createMouseTargetFromHitTestPosition(e,t,i,n,r){let o=n.lineNumber,a=n.column,l=e.getLineWidth(o);if(t.mouseContentHorizontalOffset>l){let b=oC(t.mouseContentHorizontalOffset-l);return t.fulfill(7,n,null,b)}let c=e.visibleRangeForPosition(o,a);if(!c)return t.fulfill(0,n);let h=c.left;if(t.mouseContentHorizontalOffset===h)return t.fulfill(6,n,null,{mightBeForeignElement:!!r});let d=[];if(d.push({offset:c.left,column:a}),a>1){let b=e.visibleRangeForPosition(o,a-1);b&&d.push({offset:b.left,column:a-1})}let u=e.model.getLineMaxColumn(o);if(ab.offset-w.offset);let f=t.pos.toClientCoordinates(),m=i.getBoundingClientRect(),g=m.left<=f.clientX&&f.clientX<=m.right;for(let b=1;b=t.editorPos.y+e.layoutInfo.height&&(o=t.editorPos.y+e.layoutInfo.height-1);let a=new Qd(t.pos.x,o),l=this._actualDoHitTestWithCaretRangeFromPoint(e,a.toClientCoordinates());return l.type===1?l:this._actualDoHitTestWithCaretRangeFromPoint(e,t.pos.toClientCoordinates())}static _actualDoHitTestWithCaretRangeFromPoint(e,t){let i=Vr(e.viewDomNode),n;if(i?typeof i.caretRangeFromPoint=="undefined"?n=B4(i,t.clientX,t.clientY):n=i.caretRangeFromPoint(t.clientX,t.clientY):n=document.caretRangeFromPoint(t.clientX,t.clientY),!n||!n.startContainer)return new dr;let r=n.startContainer;if(r.nodeType===r.TEXT_NODE){let o=r.parentNode,a=o?o.parentNode:null,l=a?a.parentNode:null;return(l&&l.nodeType===l.ELEMENT_NODE?l.className:null)===ln.CLASS_NAME?Ua.createFromDOMInfo(e,o,n.startOffset):new dr(r.parentNode)}else if(r.nodeType===r.ELEMENT_NODE){let o=r.parentNode,a=o?o.parentNode:null;return(a&&a.nodeType===a.ELEMENT_NODE?a.className:null)===ln.CLASS_NAME?Ua.createFromDOMInfo(e,r,r.textContent.length):new dr(r)}return new dr}static _doHitTestWithCaretPositionFromPoint(e,t){let i=document.caretPositionFromPoint(t.clientX,t.clientY);if(i.offsetNode.nodeType===i.offsetNode.TEXT_NODE){let n=i.offsetNode.parentNode,r=n?n.parentNode:null,o=r?r.parentNode:null;return(o&&o.nodeType===o.ELEMENT_NODE?o.className:null)===ln.CLASS_NAME?Ua.createFromDOMInfo(e,i.offsetNode.parentNode,i.offset):new dr(i.offsetNode.parentNode)}if(i.offsetNode.nodeType===i.offsetNode.ELEMENT_NODE){let n=i.offsetNode.parentNode,r=n&&n.nodeType===n.ELEMENT_NODE?n.className:null,o=n?n.parentNode:null,a=o&&o.nodeType===o.ELEMENT_NODE?o.className:null;if(r===ln.CLASS_NAME){let l=i.offsetNode.childNodes[Math.min(i.offset,i.offsetNode.childNodes.length-1)];if(l)return Ua.createFromDOMInfo(e,l,0)}else if(a===ln.CLASS_NAME)return Ua.createFromDOMInfo(e,i.offsetNode,0)}return new dr(i.offsetNode)}static _snapToSoftTabBoundary(e,t){let i=t.getLineContent(e.lineNumber),{tabSize:n}=t.getTextModelOptions(),r=fo.atomicPosition(i,e.column-1,n,2);return r!==-1?new N(e.lineNumber,r+1):e}static _doHitTest(e,t){let i=new dr;if(typeof document.caretRangeFromPoint=="function"?i=this._doHitTestWithCaretRangeFromPoint(e,t):document.caretPositionFromPoint&&(i=this._doHitTestWithCaretPositionFromPoint(e,t.pos.toClientCoordinates())),i.type===1){let n=e.model.getInjectedTextAt(i.position),r=e.model.normalizePosition(i.position,2);(n||!r.equals(i.position))&&(i=new Qg(r,i.spanNode,n))}return i.type===1&&e.stickyTabStops&&(i=new Qg(this._snapToSoftTabBoundary(i.position,e.model),i.spanNode,i.injectedText)),i}};function B4(s,e,t){let i=document.createRange(),n=s.elementFromPoint(e,t);if(n!==null){for(;n&&n.firstChild&&n.firstChild.nodeType!==n.firstChild.TEXT_NODE&&n.lastChild&&n.lastChild.firstChild;)n=n.lastChild;let r=n.getBoundingClientRect(),o=window.getComputedStyle(n,null).getPropertyValue("font"),a=n.innerText,l=r.left,c=0,h;if(e>r.left+r.width)c=a.length;else{let d=vo.getInstance();for(let u=0;uthis._createMouseTarget(o,a),o=>this._getMouseColumn(o))),this.lastMouseLeaveTime=-1,this._height=this._context.configuration.options.get(129).height;let n=new Zv(this.viewHelper.viewDomNode);this._register(n.onContextMenu(this.viewHelper.viewDomNode,o=>this._onContextMenu(o,!0))),this._register(n.onMouseMoveThrottled(this.viewHelper.viewDomNode,o=>this._onMouseMove(o),tu(this.mouseTargetFactory),ur.MOUSE_MOVE_MINIMUM_TIME)),this._register(n.onMouseUp(this.viewHelper.viewDomNode,o=>this._onMouseUp(o))),this._register(n.onMouseLeave(this.viewHelper.viewDomNode,o=>this._onMouseLeave(o))),this._register(n.onMouseDown(this.viewHelper.viewDomNode,o=>this._onMouseDown(o)));let r=o=>{if(this.viewController.emitMouseWheel(o),!this._context.configuration.options.get(66))return;let a=new Mn(o);if(ee?(o.metaKey||o.ctrlKey)&&!o.shiftKey&&!o.altKey:o.ctrlKey&&!o.metaKey&&!o.shiftKey&&!o.altKey){let c=Ba.getZoomLevel(),h=a.deltaY>0?1:-1;Ba.setZoomLevel(c+h),a.preventDefault(),a.stopPropagation()}};this._register(O(this.viewHelper.viewDomNode,z.MOUSE_WHEEL,r,{capture:!0,passive:!1})),this._context.addEventHandler(this)}dispose(){this._context.removeEventHandler(this),super.dispose()}onConfigurationChanged(e){if(e.hasChanged(129)){let t=this._context.configuration.options.get(129).height;this._height!==t&&(this._height=t,this._mouseDownOperation.onHeightChanged())}return!1}onCursorStateChanged(e){return this._mouseDownOperation.onCursorStateChanged(e),!1}onFocusChanged(e){return!1}onScrollChanged(e){return this._mouseDownOperation.onScrollChanged(),!1}getTargetAtClientPoint(e,t){let n=new Yg(e,t).toPageCoordinates(),r=Yv(this.viewHelper.viewDomNode);return n.yr.y+r.height||n.xr.x+r.width?null:this.mouseTargetFactory.createMouseTarget(this.viewHelper.getLastRenderData(),r,n,null)}_createMouseTarget(e,t){return this.mouseTargetFactory.createMouseTarget(this.viewHelper.getLastRenderData(),e.editorPos,e.pos,t?e.target:null)}_getMouseColumn(e){return this.mouseTargetFactory.getMouseColumn(e.editorPos,e.pos)}_onContextMenu(e,t){this.viewController.emitContextMenu({event:e,target:this._createMouseTarget(e,t)})}_onMouseMove(e){this._mouseDownOperation.isActive()||e.timestamp{e.preventDefault(),this.viewHelper.focusTextArea()};if(c&&(i||r&&o))h(),this._mouseDownOperation.start(t.type,e);else if(n)e.preventDefault();else if(a){let d=t.detail;this.viewHelper.shouldSuppressMouseDownOnViewZone(d.viewZoneId)&&(h(),this._mouseDownOperation.start(t.type,e),e.preventDefault())}else l&&this.viewHelper.shouldSuppressMouseDownOnWidget(t.detail)&&(h(),e.preventDefault());this.viewController.emitMouseDown({event:e,target:t})}};ur.MOUSE_MOVE_MINIMUM_TIME=100;var nk=class extends M{constructor(e,t,i,n,r){super();this._context=e,this._viewController=t,this._viewHelper=i,this._createMouseTarget=n,this._getMouseColumn=r,this._mouseMoveMonitor=this._register(new Qv(this._viewHelper.viewDomNode)),this._onScrollTimeout=this._register(new Ut),this._mouseState=new iu,this._currentSelection=new Z(1,1,1,1),this._isActive=!1,this._lastMouseEvent=null}dispose(){super.dispose()}isActive(){return this._isActive}_onMouseDownThenMove(e){this._lastMouseEvent=e,this._mouseState.setModifiers(e);let t=this._findMousePosition(e,!0);!t||(this._mouseState.isDragAndDrop?this._viewController.emitMouseDrag({event:e,target:t}):this._dispatchMouse(t,!0))}start(e,t){this._lastMouseEvent=t,this._mouseState.setStartedOnLineNumbers(e===3),this._mouseState.setStartButtons(t),this._mouseState.setModifiers(t);let i=this._findMousePosition(t,!0);if(!i||!i.position)return;this._mouseState.trySetCount(t.detail,i.position),t.detail=this._mouseState.count;let n=this._context.configuration.options;if(!n.get(79)&&n.get(29)&&!n.get(16)&&!this._mouseState.altKey&&t.detail<2&&!this._isActive&&!this._currentSelection.isEmpty()&&i.type===6&&i.position&&this._currentSelection.containsPosition(i.position)){this._mouseState.isDragAndDrop=!0,this._isActive=!0,this._mouseMoveMonitor.startMonitoring(t.target,t.buttons,tu(null),r=>this._onMouseDownThenMove(r),r=>{let o=this._findMousePosition(this._lastMouseEvent,!0);r&&r instanceof KeyboardEvent?this._viewController.emitMouseDropCanceled():this._viewController.emitMouseDrop({event:this._lastMouseEvent,target:o?this._createMouseTarget(this._lastMouseEvent,!0):null}),this._stop()});return}this._mouseState.isDragAndDrop=!1,this._dispatchMouse(i,t.shiftKey),this._isActive||(this._isActive=!0,this._mouseMoveMonitor.startMonitoring(t.target,t.buttons,tu(null),r=>this._onMouseDownThenMove(r),()=>this._stop()))}_stop(){this._isActive=!1,this._onScrollTimeout.cancel()}onHeightChanged(){this._mouseMoveMonitor.stopMonitoring()}onScrollChanged(){!this._isActive||this._onScrollTimeout.setIfNotSet(()=>{if(!this._lastMouseEvent)return;let e=this._findMousePosition(this._lastMouseEvent,!1);!e||this._mouseState.isDragAndDrop||this._dispatchMouse(e,!0)},10)}onCursorStateChanged(e){this._currentSelection=e.selections[0]}_getPositionOutsideEditor(e){let t=e.editorPos,i=this._context.model,n=this._context.viewLayout,r=this._getMouseColumn(e);if(e.posyt.y+t.height){let a=n.getCurrentScrollTop()+(e.posy-t.y),l=wo.getZoneAtCoord(this._context,a);if(l){let h=this._helpPositionJumpOverViewZone(l);if(h)return new Gi(null,13,r,h)}let c=n.getLineNumberAtVerticalOffset(a);return new Gi(null,13,r,new N(c,i.getLineMaxColumn(c)))}let o=n.getLineNumberAtVerticalOffset(n.getCurrentScrollTop()+(e.posy-t.y));return e.posxt.x+t.width?new Gi(null,13,r,new N(o,i.getLineMaxColumn(o))):null}_findMousePosition(e,t){let i=this._getPositionOutsideEditor(e);if(i)return i;let n=this._createMouseTarget(e,t);if(!n.position)return null;if(n.type===8||n.type===5){let o=this._helpPositionJumpOverViewZone(n.detail);if(o)return new Gi(n.element,n.type,n.mouseColumn,o,null,n.detail)}return n}_helpPositionJumpOverViewZone(e){let t=new N(this._currentSelection.selectionStartLineNumber,this._currentSelection.selectionStartColumn),i=e.positionBefore,n=e.positionAfter;return i&&n?i.isBefore(t)?i:n:null}_dispatchMouse(e,t){!e.position||this._viewController.dispatchMouse({position:e.position,mouseColumn:e.mouseColumn,startedOnLineNumbers:this._mouseState.startedOnLineNumbers,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})}},iu=class{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 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}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){let i=new Date().getTime();i-this._lastSetMouseDownCountTime>iu.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)}};iu.CLEAR_MOUSE_DOWN_COUNT_TIME=400;var Li;(function(s){s.text="text/plain",s.binary="application/octet-stream",s.unknown="application/unknown",s.markdown="text/markdown"})(Li||(Li={}));var ep=[],sk=[],rk=[];function nu(s,e=!1){let t=W4(s);ep.push(t),t.userConfigured?rk.push(t):sk.push(t),e&&!t.userConfigured&&ep.forEach(i=>{i.mime===t.mime||i.userConfigured||(t.extension&&i.extension===t.extension&&console.warn(`Overwriting extension <<${t.extension}>> to now point to mime <<${t.mime}>>`),t.filename&&i.filename===t.filename&&console.warn(`Overwriting filename <<${t.filename}>> to now point to mime <<${t.mime}>>`),t.filepattern&&i.filepattern===t.filepattern&&console.warn(`Overwriting filepattern <<${t.filepattern}>> to now point to mime <<${t.mime}>>`),t.firstline&&i.firstline===t.firstline&&console.warn(`Overwriting firstline <<${t.firstline}>> to now point to mime <<${t.mime}>>`))})}function W4(s){return{id:s.id,mime:s.mime,filename:s.filename,extension:s.extension,filepattern:s.filepattern,firstline:s.firstline,userConfigured:s.userConfigured,filenameLowercase:s.filename?s.filename.toLowerCase():void 0,extensionLowercase:s.extension?s.extension.toLowerCase():void 0,filepatternLowercase:s.filepattern?s.filepattern.toLowerCase():void 0,filepatternOnPath:s.filepattern?s.filepattern.indexOf(Ze.sep)>=0:!1}}function ok(s,e){let t;if(s)switch(s.scheme){case Ce.file:t=s.fsPath;break;case Ce.data:t=Gh.parseMetaData(s).get(Gh.META_DATA_LABEL);break;default:t=s.path}if(!t)return[Li.unknown];t=t.toLowerCase();let i=Rf(t),n=ak(t,i,rk);if(n)return[n,Li.text];let r=ak(t,i,sk);if(r)return[r,Li.text];if(e){let o=V4(e);if(o)return[o,Li.text]}return[Li.unknown]}function ak(s,e,t){let i=null,n=null,r=null;for(let o=t.length-1;o>=0;o--){let a=t[o];if(e===a.filenameLowercase){i=a;break}if(a.filepattern&&(!n||a.filepattern.length>n.filepattern.length)){let l=a.filepatternOnPath?s:e;Lm(a.filepatternLowercase,l)&&(n=a)}a.extension&&(!r||a.extension.length>r.extension.length)&&e.endsWith(a.extensionLowercase)&&(r=a)}return i?i.mime:n?n.mime:r?r.mime:null}function V4(s){if(Vl(s)&&(s=s.substr(1)),s.length>0)for(let e=ep.length-1;e>=0;e--){let t=ep[e];if(!t.firstline)continue;let i=s.match(t.firstline);if(i&&i.length>0)return t.mime}return null}var Yi=!1,gt=class{constructor(e,t,i,n,r){this.value=e,this.selectionStart=t,this.selectionEnd=i,this.selectionStartPosition=n,this.selectionEndPosition=r}toString(){return"[ <"+this.value+">, selectionStart: "+this.selectionStart+", selectionEnd: "+this.selectionEnd+"]"}static readFromTextArea(e){return new gt(e.getValue(),e.getSelectionStart(),e.getSelectionEnd(),null,null)}collapseSelection(){return new gt(this.value,this.value.length,this.value.length,null,null)}writeToTextArea(e,t,i){Yi&&console.log("writeToTextArea "+e+": "+this.toString()),t.setValue(e,this.value),i&&t.setSelectionRange(e,this.selectionStart,this.selectionEnd)}deduceEditorPosition(e){if(e<=this.selectionStart){let n=this.value.substring(e,this.selectionStart);return this._finishDeduceEditorPosition(this.selectionStartPosition,n,-1)}if(e>=this.selectionEnd){let n=this.value.substring(this.selectionEnd,e);return this._finishDeduceEditorPosition(this.selectionEndPosition,n,1)}let t=this.value.substring(this.selectionStart,e);if(t.indexOf(String.fromCharCode(8230))===-1)return this._finishDeduceEditorPosition(this.selectionStartPosition,t,1);let i=this.value.substring(e,this.selectionEnd);return this._finishDeduceEditorPosition(this.selectionEndPosition,i,-1)}_finishDeduceEditorPosition(e,t,i){let n=0,r=-1;for(;(r=t.indexOf(` +`,r+1))!==-1;)n++;return[e,i*t.length,n]}static selectedText(e){return new gt(e,0,e.length,null,null)}static deduceInput(e,t,i){if(!e)return{text:"",replacePrevCharCnt:0,replaceNextCharCnt:0,positionDelta:0};Yi&&(console.log("------------------------deduceInput"),console.log("PREVIOUS STATE: "+e.toString()),console.log("CURRENT STATE: "+t.toString()));let n=e.value,r=e.selectionStart,o=e.selectionEnd,a=t.value,l=t.selectionStart,c=t.selectionEnd,h=n.substring(o),d=a.substring(c),u=Mb(h,d);a=a.substring(0,a.length-u),n=n.substring(0,n.length-u);let f=n.substring(0,r),m=a.substring(0,l),g=Tb(f,m);if(a=a.substring(g),n=n.substring(g),l-=g,r-=g,c-=g,o-=g,Yi&&(console.log("AFTER DIFFING PREVIOUS STATE: <"+n+">, selectionStart: "+r+", selectionEnd: "+o),console.log("AFTER DIFFING CURRENT STATE: <"+a+">, selectionStart: "+l+", selectionEnd: "+c)),i&&l===c&&n.length>0){let w=null;if(l===a.length?a.startsWith(n)&&(w=a.substring(n.length)):a.endsWith(n)&&(w=a.substring(0,a.length-n.length)),w!==null&&w.length>0&&(/\uFE0F/.test(w)||eL(w)))return{text:w,replacePrevCharCnt:0,replaceNextCharCnt:0,positionDelta:0}}if(l===c){if(n===a&&r===0&&o===n.length&&l===a.length&&a.indexOf(` +`)===-1&&tL(a))return{text:"",replacePrevCharCnt:0,replaceNextCharCnt:0,positionDelta:0};let w=f.length-g;return Yi&&console.log("REMOVE PREVIOUS: "+(f.length-g)+" chars"),{text:a,replacePrevCharCnt:w,replaceNextCharCnt:0,positionDelta:0}}let b=o-r;return{text:a,replacePrevCharCnt:b,replaceNextCharCnt:0,positionDelta:0}}static deduceAndroidCompositionInput(e,t){if(!e)return{text:"",replacePrevCharCnt:0,replaceNextCharCnt:0,positionDelta:0};if(Yi&&(console.log("------------------------deduceAndroidCompositionInput"),console.log("PREVIOUS STATE: "+e.toString()),console.log("CURRENT STATE: "+t.toString())),e.value===t.value)return{text:"",replacePrevCharCnt:0,replaceNextCharCnt:0,positionDelta:t.selectionEnd-e.selectionEnd};let i=Math.min(Tb(e.value,t.value),e.selectionEnd),n=Math.min(Mb(e.value,t.value),e.value.length-e.selectionEnd),r=e.value.substring(i,e.value.length-n),o=t.value.substring(i,t.value.length-n),a=e.selectionStart-i,l=e.selectionEnd-i,c=t.selectionStart-i,h=t.selectionEnd-i;return Yi&&(console.log("AFTER DIFFING PREVIOUS STATE: <"+r+">, selectionStart: "+a+", selectionEnd: "+l),console.log("AFTER DIFFING CURRENT STATE: <"+o+">, selectionStart: "+c+", selectionEnd: "+h)),{text:o,replacePrevCharCnt:l,replaceNextCharCnt:r.length-l,positionDelta:h-o.length}}};gt.EMPTY=new gt("",0,0,null,null);var Co=class{static _getPageOfLine(e,t){return Math.floor((e-1)/t)}static _getRangeForPage(e,t){let i=e*t,n=i+1,r=i+t;return new D(n,1,r+1,1)}static fromEditorSelection(e,t,i,n,r){let o=Co._getPageOfLine(i.startLineNumber,n),a=Co._getRangeForPage(o,n),l=Co._getPageOfLine(i.endLineNumber,n),c=Co._getRangeForPage(l,n),h=a.intersectRanges(new D(1,1,i.startLineNumber,i.startColumn)),d=t.getValueInRange(h,1),u=t.getLineCount(),f=t.getLineMaxColumn(u),m=c.intersectRanges(new D(i.endLineNumber,i.endColumn,u,f)),g=t.getValueInRange(m,1),b;if(o===l||o+1===l)b=t.getValueInRange(i,1);else{let w=a.intersectRanges(i),_=c.intersectRanges(i);b=t.getValueInRange(w,1)+String.fromCharCode(8230)+t.getValueInRange(_,1)}if(r){let w=500;d.length>w&&(d=d.substring(d.length-w,d.length)),g.length>w&&(g=g.substring(0,w)),b.length>2*w&&(b=b.substring(0,w)+String.fromCharCode(8230)+b.substring(b.length-w,b.length))}return new gt(d+b+g,d.length,d.length+b.length,new N(i.startLineNumber,i.startColumn),new N(i.endLineNumber,i.endColumn))}};var su;(function(s){s.Tap="-monaco-textarea-synthetic-tap"})(su||(su={}));var lk={forceCopyWithSyntaxHighlighting:!1},ru=class{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)}};ru.INSTANCE=new ru;var aC=class extends M{constructor(e,t){super();this.textArea=t,this._onFocus=this._register(new k),this.onFocus=this._onFocus.event,this._onBlur=this._register(new k),this.onBlur=this._onBlur.event,this._onKeyDown=this._register(new k),this.onKeyDown=this._onKeyDown.event,this._onKeyUp=this._register(new k),this.onKeyUp=this._onKeyUp.event,this._onCut=this._register(new k),this.onCut=this._onCut.event,this._onPaste=this._register(new k),this.onPaste=this._onPaste.event,this._onType=this._register(new k),this.onType=this._onType.event,this._onCompositionStart=this._register(new k),this.onCompositionStart=this._onCompositionStart.event,this._onCompositionUpdate=this._register(new k),this.onCompositionUpdate=this._onCompositionUpdate.event,this._onCompositionEnd=this._register(new k),this.onCompositionEnd=this._onCompositionEnd.event,this._onSelectionChangeRequest=this._register(new k),this.onSelectionChangeRequest=this._onSelectionChangeRequest.event,this._host=e,this._textArea=this._register(new ck(t)),this._asyncTriggerCut=this._register(new $e(()=>this._onCut.fire(),0)),this._asyncFocusGainWriteScreenReaderContent=this._register(new $e(()=>this.writeScreenReaderContent("asyncFocusGain"),0)),this._textAreaState=gt.EMPTY,this._selectionChangeListener=null,this.writeScreenReaderContent("ctor"),this._hasFocus=!1,this._isDoingComposition=!1,this._nextCommand=0;let i=null;this._register(lt(t.domNode,"keydown",a=>{(a.keyCode===109||this._isDoingComposition&&a.keyCode===1)&&a.stopPropagation(),a.equals(9)&&a.preventDefault(),i=a,this._onKeyDown.fire(a)})),this._register(lt(t.domNode,"keyup",a=>{this._onKeyUp.fire(a)})),this._register(O(t.domNode,"compositionstart",a=>{if(Yi&&console.log("[compositionstart]",a),!this._isDoingComposition){if(this._isDoingComposition=!0,ee&&this._textAreaState.selectionStart===this._textAreaState.selectionEnd&&this._textAreaState.selectionStart>0&&this._textAreaState.value.substr(this._textAreaState.selectionStart-1,1)===a.data&&(i&&i.equals(109)&&(i.code==="ArrowRight"||i.code==="ArrowLeft")||at)){Yi&&console.log("[compositionstart] Handling long press case on macOS + arrow key or Firefox",a),this._textAreaState=new gt(this._textAreaState.value,this._textAreaState.selectionStart-1,this._textAreaState.selectionEnd,this._textAreaState.selectionStartPosition?new N(this._textAreaState.selectionStartPosition.lineNumber,this._textAreaState.selectionStartPosition.column-1):null,this._textAreaState.selectionEndPosition),this._onCompositionStart.fire({revealDeltaColumns:-1});return}if(ea){this._onCompositionStart.fire({revealDeltaColumns:-this._textAreaState.selectionStart});return}this._setAndWriteTextAreaState("compositionstart",gt.EMPTY),this._onCompositionStart.fire({revealDeltaColumns:0})}}));let n=a=>{let l=this._textAreaState,c=gt.readFromTextArea(this._textArea);return[c,gt.deduceInput(l,c,a)]},r=()=>{let a=this._textAreaState,l=gt.readFromTextArea(this._textArea);return[l,gt.deduceAndroidCompositionInput(a,l)]},o=a=>{let l=this._textAreaState,c=gt.selectedText(a),h={text:c.value,replacePrevCharCnt:l.selectionEnd-l.selectionStart,replaceNextCharCnt:0,positionDelta:0};return[c,h]};this._register(O(t.domNode,"compositionupdate",a=>{if(Yi&&console.log("[compositionupdate]",a),ea){let[h,d]=r();this._textAreaState=h,this._onType.fire(d),this._onCompositionUpdate.fire(a);return}let[l,c]=o(a.data||"");this._textAreaState=l,this._onType.fire(c),this._onCompositionUpdate.fire(a)})),this._register(O(t.domNode,"compositionend",a=>{if(Yi&&console.log("[compositionend]",a),!this._isDoingComposition)return;if(this._isDoingComposition=!1,ea){let[h,d]=r();this._textAreaState=h,this._onType.fire(d),this._onCompositionEnd.fire();return}let[l,c]=o(a.data||"");this._textAreaState=l,this._onType.fire(c),(yh||at)&&(this._textAreaState=gt.readFromTextArea(this._textArea)),this._onCompositionEnd.fire()})),this._register(O(t.domNode,"input",()=>{if(this._textArea.setIgnoreSelectionChangeTime("received input event"),this._isDoingComposition)return;let[a,l]=n(ee);l.replacePrevCharCnt===0&&l.text.length===1&&Xe(l.text.charCodeAt(0))||(this._textAreaState=a,this._nextCommand===0?(l.text!==""||l.replacePrevCharCnt!==0)&&this._onType.fire(l):((l.text!==""||l.replacePrevCharCnt!==0)&&this._firePaste(l.text,null),this._nextCommand=0))})),this._register(O(t.domNode,"cut",a=>{this._textArea.setIgnoreSelectionChangeTime("received cut event"),this._ensureClipboardGetsEditorSelection(a),this._asyncTriggerCut.schedule()})),this._register(O(t.domNode,"copy",a=>{this._ensureClipboardGetsEditorSelection(a)})),this._register(O(t.domNode,"paste",a=>{if(this._textArea.setIgnoreSelectionChangeTime("received paste event"),Nc.canUseTextData(a)){let[l,c]=Nc.getTextData(a);l!==""&&this._firePaste(l,c)}else this._textArea.getSelectionStart()!==this._textArea.getSelectionEnd()&&this._setAndWriteTextAreaState("paste",gt.EMPTY),this._nextCommand=1})),this._register(O(t.domNode,"focus",()=>{let a=this._hasFocus;this._setHasFocus(!0),_n&&!a&&this._hasFocus&&this._asyncFocusGainWriteScreenReaderContent.schedule()})),this._register(O(t.domNode,"blur",()=>{this._isDoingComposition&&(this._isDoingComposition=!1,this.writeScreenReaderContent("blurWithoutCompositionEnd"),this._onCompositionEnd.fire()),this._setHasFocus(!1)})),this._register(O(t.domNode,su.Tap,()=>{ea&&this._isDoingComposition&&(this._isDoingComposition=!1,this.writeScreenReaderContent("tapWithoutCompositionEnd"),this._onCompositionEnd.fire())}))}_installSelectionChangeListener(){let e=0;return O(document,"selectionchange",t=>{if(!this._hasFocus||this._isDoingComposition||!yh)return;let i=Date.now(),n=i-e;if(e=i,n<5)return;let r=i-this._textArea.getIgnoreSelectionChangeTime();if(this._textArea.resetSelectionChangeTime(),r<100||!this._textAreaState.selectionStartPosition||!this._textAreaState.selectionEndPosition)return;let o=this._textArea.getValue();if(this._textAreaState.value!==o)return;let a=this._textArea.getSelectionStart(),l=this._textArea.getSelectionEnd();if(this._textAreaState.selectionStart===a&&this._textAreaState.selectionEnd===l)return;let c=this._textAreaState.deduceEditorPosition(a),h=this._host.deduceModelPosition(c[0],c[1],c[2]),d=this._textAreaState.deduceEditorPosition(l),u=this._host.deduceModelPosition(d[0],d[1],d[2]),f=new Z(h.lineNumber,h.column,u.lineNumber,u.column);this._onSelectionChangeRequest.fire(f)})}dispose(){super.dispose(),this._selectionChangeListener&&(this._selectionChangeListener.dispose(),this._selectionChangeListener=null)}focusTextArea(){this._setHasFocus(!0),this.refreshFocusState()}isFocused(){return this._hasFocus}refreshFocusState(){let e=Vr(this.textArea.domNode);e?this._setHasFocus(e.activeElement===this.textArea.domNode):Of(this.textArea.domNode)?this._setHasFocus(document.activeElement===this.textArea.domNode):this._setHasFocus(!1)}_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.writeScreenReaderContent("focusgain"),this._hasFocus?this._onFocus.fire():this._onBlur.fire())}_setAndWriteTextAreaState(e,t){this._hasFocus||(t=t.collapseSelection()),t.writeToTextArea(e,this._textArea,this._hasFocus),this._textAreaState=t}writeScreenReaderContent(e){this._isDoingComposition||this._setAndWriteTextAreaState(e,this._host.getScreenReaderContent(this._textAreaState))}_ensureClipboardGetsEditorSelection(e){let t=this._host.getDataToCopy(Nc.canUseTextData(e)),i={version:1,isFromEmptySelection:t.isFromEmptySelection,multicursorText:t.multicursorText,mode:t.mode};if(ru.INSTANCE.set(at?t.text.replace(/\r\n/g,` +`):t.text,i),!Nc.canUseTextData(e)){this._setAndWriteTextAreaState("copy or cut",gt.selectedText(t.text));return}Nc.setTextData(e,t.text,t.html,i)}_firePaste(e,t){t||(t=ru.INSTANCE.get(e)),this._onPaste.fire({text:e,metadata:t})}},Nc=class{static canUseTextData(e){return!!(e.clipboardData||window.clipboardData)}static getTextData(e){if(e.clipboardData){e.preventDefault();let t=e.clipboardData.getData(Li.text),i=null,n=e.clipboardData.getData("vscode-editor-data");if(typeof n=="string")try{i=JSON.parse(n),i.version!==1&&(i=null)}catch(r){}return[t,i]}if(window.clipboardData)return e.preventDefault(),[window.clipboardData.getData("Text"),null];throw new Error("ClipboardEventUtils.getTextData: Cannot use text data!")}static setTextData(e,t,i,n){if(e.clipboardData){e.clipboardData.setData(Li.text,t),typeof i=="string"&&e.clipboardData.setData("text/html",i),e.clipboardData.setData("vscode-editor-data",JSON.stringify(n)),e.preventDefault();return}if(window.clipboardData){window.clipboardData.setData("Text",t),e.preventDefault();return}throw new Error("ClipboardEventUtils.setTextData: Cannot use text data!")}},ck=class extends M{constructor(e){super();this._actual=e,this._ignoreSelectionChangeTime=0}setIgnoreSelectionChangeTime(e){this._ignoreSelectionChangeTime=Date.now()}getIgnoreSelectionChangeTime(){return this._ignoreSelectionChangeTime}resetSelectionChangeTime(){this._ignoreSelectionChangeTime=0}getValue(){return this._actual.domNode.value}setValue(e,t){let i=this._actual.domNode;i.value!==t&&(this.setIgnoreSelectionChangeTime("setValue"),i.value=t)}getSelectionStart(){return this._actual.domNode.selectionDirection==="backward"?this._actual.domNode.selectionEnd:this._actual.domNode.selectionStart}getSelectionEnd(){return this._actual.domNode.selectionDirection==="backward"?this._actual.domNode.selectionStart:this._actual.domNode.selectionEnd}setSelectionRange(e,t,i){let n=this._actual.domNode,r=null,o=Vr(n);o?r=o.activeElement:r=document.activeElement;let a=r===n,l=n.selectionStart,c=n.selectionEnd;if(a&&l===t&&c===i){at&&window.parent!==window&&n.focus();return}if(a){this.setIgnoreSelectionChangeTime("setSelectionRange"),n.setSelectionRange(t,i),at&&window.parent!==window&&n.focus();return}try{let h=Ay(n);this.setIgnoreSelectionChangeTime("setSelectionRange"),n.focus(),n.setSelectionRange(t,i),Oy(n,h)}catch(h){}}};var hk=class extends ur{constructor(e,t,i){super(e,t,i);this._register(we.addTarget(this.viewHelper.linesContentDomNode)),this._register(O(this.viewHelper.linesContentDomNode,Re.Tap,r=>this.onTap(r))),this._register(O(this.viewHelper.linesContentDomNode,Re.Change,r=>this.onChange(r))),this._register(O(this.viewHelper.linesContentDomNode,Re.Contextmenu,r=>this._onContextMenu(new hr(r,this.viewHelper.viewDomNode),!1))),this._lastPointerType="mouse",this._register(O(this.viewHelper.linesContentDomNode,"pointerdown",r=>{let o=r.pointerType;if(o==="mouse"){this._lastPointerType="mouse";return}else o==="touch"?this._lastPointerType="touch":this._lastPointerType="pen"}));let n=new Xv(this.viewHelper.viewDomNode);this._register(n.onPointerMoveThrottled(this.viewHelper.viewDomNode,r=>this._onMouseMove(r),tu(this.mouseTargetFactory),ur.MOUSE_MOVE_MINIMUM_TIME)),this._register(n.onPointerUp(this.viewHelper.viewDomNode,r=>this._onMouseUp(r))),this._register(n.onPointerLeave(this.viewHelper.viewDomNode,r=>this._onMouseLeave(r))),this._register(n.onPointerDown(this.viewHelper.viewDomNode,r=>this._onMouseDown(r)))}onTap(e){if(!e.initialTarget||!this.viewHelper.linesContentDomNode.contains(e.initialTarget))return;e.preventDefault(),this.viewHelper.focusTextArea();let t=this._createMouseTarget(new hr(e,this.viewHelper.viewDomNode),!1);t.position&&this.viewController.dispatchMouse({position:t.position,mouseColumn:t.position.column,startedOnLineNumbers:!1,mouseDownCount:e.tapCount,inSelectionMode:!1,altKey:!1,ctrlKey:!1,metaKey:!1,shiftKey:!1,leftButton:!1,middleButton:!1})}onChange(e){this._lastPointerType==="touch"&&this._context.model.deltaScrollNow(-e.translationX,-e.translationY)}_onMouseDown(e){e.browserEvent.pointerType!=="touch"&&super._onMouseDown(e)}},dk=class extends ur{constructor(e,t,i){super(e,t,i);this._register(we.addTarget(this.viewHelper.linesContentDomNode)),this._register(O(this.viewHelper.linesContentDomNode,Re.Tap,n=>this.onTap(n))),this._register(O(this.viewHelper.linesContentDomNode,Re.Change,n=>this.onChange(n))),this._register(O(this.viewHelper.linesContentDomNode,Re.Contextmenu,n=>this._onContextMenu(new hr(n,this.viewHelper.viewDomNode),!1)))}onTap(e){e.preventDefault(),this.viewHelper.focusTextArea();let t=this._createMouseTarget(new hr(e,this.viewHelper.viewDomNode),!1);if(t.position){let i=document.createEvent("CustomEvent");i.initEvent(su.Tap,!1,!0),this.viewHelper.dispatchTextAreaEvent(i),this.viewController.moveTo(t.position)}}onChange(e){this._context.model.deltaScrollNow(-e.translationX,-e.translationY)}},lC=class extends M{constructor(e,t,i){super();en&&na.pointerEvents?this.handler=this._register(new hk(e,t,i)):window.TouchEvent?this.handler=this._register(new dk(e,t,i)):this.handler=this._register(new ur(e,t,i))}getTargetAtClientPoint(e,t){return this.handler.getTargetAtClientPoint(e,t)}};var hn=class extends $n{};var cC={ColorContribution:"base.contributions.colors"},uk=class{constructor(){this._onDidChangeSchema=new k,this.onDidChangeSchema=this._onDidChangeSchema.event,this.colorSchema={type:"object",properties:{}},this.colorReferenceSchema={type:"string",enum:[],enumDescriptions:[]},this.colorsById={}}registerColor(e,t,i,n=!1,r){let o={id:e,description:i,defaults:t,needsTransparency:n,deprecationMessage:r};this.colorsById[e]=o;let a={type:"string",description:i,format:"color-hex",defaultSnippets:[{body:"${1:#ff0000}"}]};return r&&(a.deprecationMessage=r),this.colorSchema.properties[e]=a,this.colorReferenceSchema.enum.push(e),this.colorReferenceSchema.enumDescriptions.push(i),this._onDidChangeSchema.fire(),e}resolveDefaultColor(e,t){let i=this.colorsById[e];if(i&&i.defaults){let n=i.defaults[t.type];return ys(n,t)}}getColorSchema(){return this.colorSchema}toString(){let e=(t,i)=>{let n=t.indexOf(".")===-1?0:1,r=i.indexOf(".")===-1?0:1;return n!==r?n-r:t.localeCompare(i)};return Object.keys(this.colorsById).sort(e).map(t=>`- \`${t}\`: ${this.colorsById[t].description}`).join(` +`)}},tp=new uk;Te.add(cC.ColorContribution,tp);function R(s,e,t,i,n){return tp.registerColor(s,e,t,i,n)}var $a=R("foreground",{dark:"#CCCCCC",light:"#616161",hc:"#FFFFFF"},p("foreground","Overall foreground color. This color is only used if not overridden by a component.")),zq=R("errorForeground",{dark:"#F48771",light:"#A1260D",hc:"#F48771"},p("errorForeground","Overall foreground color for error messages. This color is only used if not overridden by a component.")),Hq=R("icon.foreground",{dark:"#C5C5C5",light:"#424242",hc:"#FFFFFF"},p("iconForeground","The default color for icons in the workbench.")),Tc=R("focusBorder",{dark:"#007FD4",light:"#0090F1",hc:"#F38518"},p("focusBorder","Overall border color for focused elements. This color is only used if not overridden by a component.")),Tt=R("contrastBorder",{light:null,dark:null,hc:"#6FC3DF"},p("contrastBorder","An extra border around elements to separate them from others for greater contrast.")),xi=R("contrastActiveBorder",{light:null,dark:null,hc:Tc},p("activeContrastBorder","An extra border around active elements to separate them from others for greater contrast.")),Uq=R("textLink.foreground",{light:"#006AB1",dark:"#3794FF",hc:"#3794FF"},p("textLinkForeground","Foreground color for links in text.")),$q=R("textLink.activeForeground",{light:"#006AB1",dark:"#3794FF",hc:"#3794FF"},p("textLinkActiveForeground","Foreground color for links in text when clicked on and on mouse hover.")),Kq=R("textCodeBlock.background",{light:"#dcdcdc66",dark:"#0a0a0a66",hc:A.black},p("textCodeBlockBackground","Background color for code blocks in text.")),Mc=R("widget.shadow",{dark:xt(A.black,.36),light:xt(A.black,.16),hc:null},p("widgetShadow","Shadow color of widgets such as find/replace inside the editor.")),fk=R("input.background",{dark:"#3C3C3C",light:A.white,hc:A.black},p("inputBoxBackground","Input box background.")),mk=R("input.foreground",{dark:$a,light:$a,hc:$a},p("inputBoxForeground","Input box foreground.")),gk=R("input.border",{dark:null,light:null,hc:Tt},p("inputBoxBorder","Input box border.")),qq=R("inputOption.activeBorder",{dark:"#007ACC00",light:"#007ACC00",hc:Tt},p("inputBoxActiveOptionBorder","Border color of activated options in input fields.")),Gq=R("inputOption.activeBackground",{dark:xt(Tc,.4),light:xt(Tc,.2),hc:A.transparent},p("inputOption.activeBackground","Background color of activated options in input fields.")),Yq=R("inputOption.activeForeground",{dark:A.white,light:A.black,hc:null},p("inputOption.activeForeground","Foreground color of activated options in input fields.")),pk=R("inputValidation.infoBackground",{dark:"#063B49",light:"#D6ECF2",hc:A.black},p("inputValidationInfoBackground","Input validation background color for information severity.")),_k=R("inputValidation.infoForeground",{dark:null,light:null,hc:null},p("inputValidationInfoForeground","Input validation foreground color for information severity.")),bk=R("inputValidation.infoBorder",{dark:"#007acc",light:"#007acc",hc:Tt},p("inputValidationInfoBorder","Input validation border color for information severity.")),wk=R("inputValidation.warningBackground",{dark:"#352A05",light:"#F6F5D2",hc:A.black},p("inputValidationWarningBackground","Input validation background color for warning severity.")),vk=R("inputValidation.warningForeground",{dark:null,light:null,hc:null},p("inputValidationWarningForeground","Input validation foreground color for warning severity.")),Ck=R("inputValidation.warningBorder",{dark:"#B89500",light:"#B89500",hc:Tt},p("inputValidationWarningBorder","Input validation border color for warning severity.")),Sk=R("inputValidation.errorBackground",{dark:"#5A1D1D",light:"#F2DEDE",hc:A.black},p("inputValidationErrorBackground","Input validation background color for error severity.")),yk=R("inputValidation.errorForeground",{dark:null,light:null,hc:null},p("inputValidationErrorForeground","Input validation foreground color for error severity.")),Lk=R("inputValidation.errorBorder",{dark:"#BE1100",light:"#BE1100",hc:Tt},p("inputValidationErrorBorder","Input validation border color for error severity.")),hC=R("dropdown.background",{dark:"#3C3C3C",light:A.white,hc:A.black},p("dropdownBackground","Dropdown background.")),xk=R("dropdown.foreground",{dark:"#F0F0F0",light:null,hc:A.white},p("dropdownForeground","Dropdown foreground.")),Dk=R("button.foreground",{dark:A.white,light:A.white,hc:A.white},p("buttonForeground","Button foreground color.")),ip=R("button.background",{dark:"#0E639C",light:"#007ACC",hc:null},p("buttonBackground","Button background color.")),Ek=R("button.hoverBackground",{dark:kI(ip,.2),light:EI(ip,.2),hc:null},p("buttonHoverBackground","Button background color when hovering.")),Ka=R("badge.background",{dark:"#4D4D4D",light:"#C4C4C4",hc:A.black},p("badgeBackground","Badge background color. Badges are small information labels, e.g. for search results count.")),qa=R("badge.foreground",{dark:A.white,light:"#333",hc:A.white},p("badgeForeground","Badge foreground color. Badges are small information labels, e.g. for search results count.")),So=R("scrollbar.shadow",{dark:"#000000",light:"#DDDDDD",hc:null},p("scrollbarShadow","Scrollbar shadow to indicate that the view is scrolled.")),ou=R("scrollbarSlider.background",{dark:A.fromHex("#797979").transparent(.4),light:A.fromHex("#646464").transparent(.4),hc:xt(Tt,.6)},p("scrollbarSliderBackground","Scrollbar slider background color.")),au=R("scrollbarSlider.hoverBackground",{dark:A.fromHex("#646464").transparent(.7),light:A.fromHex("#646464").transparent(.7),hc:xt(Tt,.8)},p("scrollbarSliderHoverBackground","Scrollbar slider background color when hovering.")),lu=R("scrollbarSlider.activeBackground",{dark:A.fromHex("#BFBFBF").transparent(.4),light:A.fromHex("#000000").transparent(.6),hc:Tt},p("scrollbarSliderActiveBackground","Scrollbar slider background color when clicked on.")),kk=R("progressBar.background",{dark:A.fromHex("#0E70C0"),light:A.fromHex("#0E70C0"),hc:Tt},p("progressBarBackground","Background color of the progress bar that can show for long running operations.")),Ik=R("editorError.background",{dark:null,light:null,hc:null},p("editorError.background","Background color of error text in the editor. The color must not be opaque so as not to hide underlying decorations."),!0),cu=R("editorError.foreground",{dark:"#F48771",light:"#E51400",hc:null},p("editorError.foreground","Foreground color of error squigglies in the editor.")),Nk=R("editorError.border",{dark:null,light:null,hc:A.fromHex("#E47777").transparent(.8)},p("errorBorder","Border color of error boxes in the editor.")),Tk=R("editorWarning.background",{dark:null,light:null,hc:null},p("editorWarning.background","Background color of warning text in the editor. The color must not be opaque so as not to hide underlying decorations."),!0),Ss=R("editorWarning.foreground",{dark:"#CCA700",light:"#BF8803",hc:null},p("editorWarning.foreground","Foreground color of warning squigglies in the editor.")),hu=R("editorWarning.border",{dark:null,light:null,hc:A.fromHex("#FFCC00").transparent(.8)},p("warningBorder","Border color of warning boxes in the editor.")),Mk=R("editorInfo.background",{dark:null,light:null,hc:null},p("editorInfo.background","Background color of info text in the editor. The color must not be opaque so as not to hide underlying decorations."),!0),yo=R("editorInfo.foreground",{dark:"#75BEFF",light:"#75BEFF",hc:null},p("editorInfo.foreground","Foreground color of info squigglies in the editor.")),np=R("editorInfo.border",{dark:null,light:null,hc:A.fromHex("#75BEFF").transparent(.8)},p("infoBorder","Border color of info boxes in the editor.")),Rk=R("editorHint.foreground",{dark:A.fromHex("#eeeeee").transparent(.7),light:"#6c6c6c",hc:null},p("editorHint.foreground","Foreground color of hint squigglies in the editor.")),Ak=R("editorHint.border",{dark:null,light:null,hc:A.fromHex("#eeeeee").transparent(.8)},p("hintBorder","Border color of hint boxes in the editor.")),Kn=R("editor.background",{light:"#fffffe",dark:"#1E1E1E",hc:A.black},p("editorBackground","Editor background color.")),Lo=R("editor.foreground",{light:"#333333",dark:"#BBBBBB",hc:A.white},p("editorForeground","Editor default foreground color.")),Ga=R("editorWidget.background",{dark:"#252526",light:"#F3F3F3",hc:"#0C141F"},p("editorWidgetBackground","Background color of editor widgets, such as find/replace.")),Rc=R("editorWidget.foreground",{dark:$a,light:$a,hc:$a},p("editorWidgetForeground","Foreground color of editor widgets, such as find/replace.")),dC=R("editorWidget.border",{dark:"#454545",light:"#C8C8C8",hc:Tt},p("editorWidgetBorder","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.")),Zq=R("editorWidget.resizeBorder",{light:null,dark:null,hc:null},p("editorWidgetResizeBorder","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.")),uC=R("quickInput.background",{dark:Ga,light:Ga,hc:Ga},p("pickerBackground","Quick picker background color. The quick picker widget is the container for pickers like the command palette.")),Ok=R("quickInput.foreground",{dark:Rc,light:Rc,hc:Rc},p("pickerForeground","Quick picker foreground color. The quick picker widget is the container for pickers like the command palette.")),Pk=R("quickInputTitle.background",{dark:new A(new ge(255,255,255,.105)),light:new A(new ge(0,0,0,.06)),hc:"#000000"},p("pickerTitleBackground","Quick picker title background color. The quick picker widget is the container for pickers like the command palette.")),Fk=R("pickerGroup.foreground",{dark:"#3794FF",light:"#0066BF",hc:A.white},p("pickerGroupForeground","Quick picker color for grouping labels.")),Bk=R("pickerGroup.border",{dark:"#3F3F46",light:"#CCCEDB",hc:A.white},p("pickerGroupBorder","Quick picker color for grouping borders.")),Wk=R("keybindingLabel.background",{dark:new A(new ge(128,128,128,.17)),light:new A(new ge(221,221,221,.4)),hc:A.transparent},p("keybindingLabelBackground","Keybinding label background color. The keybinding label is used to represent a keyboard shortcut.")),Vk=R("keybindingLabel.foreground",{dark:A.fromHex("#CCCCCC"),light:A.fromHex("#555555"),hc:A.white},p("keybindingLabelForeground","Keybinding label foreground color. The keybinding label is used to represent a keyboard shortcut.")),jk=R("keybindingLabel.border",{dark:new A(new ge(51,51,51,.6)),light:new A(new ge(204,204,204,.4)),hc:new A(new ge(111,195,223))},p("keybindingLabelBorder","Keybinding label border color. The keybinding label is used to represent a keyboard shortcut.")),zk=R("keybindingLabel.bottomBorder",{dark:new A(new ge(68,68,68,.6)),light:new A(new ge(187,187,187,.4)),hc:new A(new ge(111,195,223))},p("keybindingLabelBottomBorder","Keybinding label border bottom color. The keybinding label is used to represent a keyboard shortcut.")),Ya=R("editor.selectionBackground",{light:"#ADD6FF",dark:"#264F78",hc:"#f3f518"},p("editorSelectionBackground","Color of the editor selection.")),Hk=R("editor.selectionForeground",{light:null,dark:null,hc:"#000000"},p("editorSelectionForeground","Color of the selected text for high contrast.")),du=R("editor.inactiveSelectionBackground",{light:xt(Ya,.5),dark:xt(Ya,.5),hc:xt(Ya,.5)},p("editorInactiveSelection","Color of the selection in an inactive editor. The color must not be opaque so as not to hide underlying decorations."),!0),fC=R("editor.selectionHighlightBackground",{light:NI(Ya,Kn,.3,.6),dark:NI(Ya,Kn,.3,.6),hc:null},p("editorSelectionHighlight","Color for regions with the same content as the selection. The color must not be opaque so as not to hide underlying decorations."),!0),Xq=R("editor.selectionHighlightBorder",{light:null,dark:null,hc:xi},p("editorSelectionHighlightBorder","Border color for regions with the same content as the selection.")),Qq=R("editor.findMatchBackground",{light:"#A8AC94",dark:"#515C6A",hc:null},p("editorFindMatch","Color of the current search match.")),mC=R("editor.findMatchHighlightBackground",{light:"#EA5C0055",dark:"#EA5C0055",hc:null},p("findMatchHighlight","Color of the other search matches. The color must not be opaque so as not to hide underlying decorations."),!0),Jq=R("editor.findRangeHighlightBackground",{dark:"#3a3d4166",light:"#b4b4b44d",hc:null},p("findRangeHighlight","Color of the range limiting the search. The color must not be opaque so as not to hide underlying decorations."),!0),eG=R("editor.findMatchBorder",{light:null,dark:null,hc:xi},p("editorFindMatchBorder","Border color of the current search match.")),tG=R("editor.findMatchHighlightBorder",{light:null,dark:null,hc:xi},p("findMatchHighlightBorder","Border color of the other search matches.")),iG=R("editor.findRangeHighlightBorder",{dark:null,light:null,hc:xt(xi,.4)},p("findRangeHighlightBorder","Border color of the range limiting the search. The color must not be opaque so as not to hide underlying decorations."),!0),nG=R("editor.hoverHighlightBackground",{light:"#ADD6FF26",dark:"#264f7840",hc:"#ADD6FF26"},p("hoverHighlight","Highlight below the word for which a hover is shown. The color must not be opaque so as not to hide underlying decorations."),!0),Uk=R("editorHoverWidget.background",{light:Ga,dark:Ga,hc:Ga},p("hoverBackground","Background color of the editor hover.")),sG=R("editorHoverWidget.foreground",{light:Rc,dark:Rc,hc:Rc},p("hoverForeground","Foreground color of the editor hover.")),rG=R("editorHoverWidget.border",{light:dC,dark:dC,hc:dC},p("hoverBorder","Border color of the editor hover.")),oG=R("editorHoverWidget.statusBarBackground",{dark:kI(Uk,.2),light:EI(Uk,.05),hc:Ga},p("statusBarBackground","Background color of the editor hover status bar.")),aG=R("editorLink.activeForeground",{dark:"#4E94CE",light:A.blue,hc:A.cyan},p("activeLinkForeground","Color of active links.")),lG=R("editorInlayHint.foreground",{dark:xt(qa,.8),light:xt(qa,.8),hc:qa},p("editorInlayHintForeground","Foreground color of inline hints")),cG=R("editorInlayHint.background",{dark:xt(Ka,.6),light:xt(Ka,.3),hc:Ka},p("editorInlayHintBackground","Background color of inline hints")),hG=R("editorLightBulb.foreground",{dark:"#FFCC00",light:"#DDB100",hc:"#FFCC00"},p("editorLightBulbForeground","The color used for the lightbulb actions icon.")),dG=R("editorLightBulbAutoFix.foreground",{dark:"#75BEFF",light:"#007ACC",hc:"#75BEFF"},p("editorLightBulbAutoFixForeground","The color used for the lightbulb auto fix actions icon.")),sp=new A(new ge(155,185,85,.2)),rp=new A(new ge(255,0,0,.2)),gC=R("diffEditor.insertedTextBackground",{dark:sp,light:sp,hc:null},p("diffEditorInserted","Background color for text that got inserted. The color must not be opaque so as not to hide underlying decorations."),!0),pC=R("diffEditor.removedTextBackground",{dark:rp,light:rp,hc:null},p("diffEditorRemoved","Background color for text that got removed. The color must not be opaque so as not to hide underlying decorations."),!0),$k=R("diffEditor.insertedTextBorder",{dark:null,light:null,hc:"#33ff2eff"},p("diffEditorInsertedOutline","Outline color for the text that got inserted.")),Kk=R("diffEditor.removedTextBorder",{dark:null,light:null,hc:"#FF008F"},p("diffEditorRemovedOutline","Outline color for text that got removed.")),qk=R("diffEditor.border",{dark:null,light:null,hc:Tt},p("diffEditorBorder","Border color between the two text editors.")),Gk=R("diffEditor.diagonalFill",{dark:"#cccccc33",light:"#22222233",hc:null},p("diffDiagonalFill","Color of the diff editor's diagonal fill. The diagonal fill is used in side-by-side diff views.")),Yk=R("list.focusBackground",{dark:null,light:null,hc:null},p("listFocusBackground","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.")),Zk=R("list.focusForeground",{dark:null,light:null,hc:null},p("listFocusForeground","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.")),Xk=R("list.focusOutline",{dark:Tc,light:Tc,hc:xi},p("listFocusOutline","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.")),fr=R("list.activeSelectionBackground",{dark:"#094771",light:"#0060C0",hc:null},p("listActiveSelectionBackground","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.")),mr=R("list.activeSelectionForeground",{dark:A.white,light:A.white,hc:null},p("listActiveSelectionForeground","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.")),uu=R("list.activeSelectionIconForeground",{dark:null,light:null,hc:null},p("listActiveSelectionIconForeground","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.")),Qk=R("list.inactiveSelectionBackground",{dark:"#37373D",light:"#E4E6F1",hc:null},p("listInactiveSelectionBackground","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.")),Jk=R("list.inactiveSelectionForeground",{dark:null,light:null,hc:null},p("listInactiveSelectionForeground","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.")),eI=R("list.inactiveSelectionIconForeground",{dark:null,light:null,hc:null},p("listInactiveSelectionIconForeground","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.")),tI=R("list.inactiveFocusBackground",{dark:null,light:null,hc:null},p("listInactiveFocusBackground","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.")),iI=R("list.inactiveFocusOutline",{dark:null,light:null,hc:null},p("listInactiveFocusOutline","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.")),nI=R("list.hoverBackground",{dark:"#2A2D2E",light:"#F0F0F0",hc:null},p("listHoverBackground","List/Tree background when hovering over items using the mouse.")),sI=R("list.hoverForeground",{dark:null,light:null,hc:null},p("listHoverForeground","List/Tree foreground when hovering over items using the mouse.")),rI=R("list.dropBackground",{dark:"#062F4A",light:"#D6EBFF",hc:null},p("listDropBackground","List/Tree drag and drop background when moving items around using the mouse.")),_C=R("list.highlightForeground",{dark:"#18A3FF",light:"#0066BF",hc:Tc},p("highlight","List/Tree foreground color of the match highlights when searching inside the list/tree.")),uG=R("list.focusHighlightForeground",{dark:_C,light:z4(fr,_C,"#9DDDFF"),hc:_C},p("listFocusHighlightForeground","List/Tree foreground color of the match highlights on actively focused items when searching inside the list/tree.")),oI=R("listFilterWidget.background",{light:"#efc1ad",dark:"#653723",hc:A.black},p("listFilterWidgetBackground","Background color of the type filter widget in lists and trees.")),aI=R("listFilterWidget.outline",{dark:A.transparent,light:A.transparent,hc:"#f38518"},p("listFilterWidgetOutline","Outline color of the type filter widget in lists and trees.")),lI=R("listFilterWidget.noMatchesOutline",{dark:"#BE1100",light:"#BE1100",hc:Tt},p("listFilterWidgetNoMatchesOutline","Outline color of the type filter widget in lists and trees, when there are no matches.")),cI=R("tree.indentGuidesStroke",{dark:"#585858",light:"#a9a9a9",hc:"#a9a9a9"},p("treeIndentGuidesStroke","Tree stroke color for the indentation guides.")),hI=R("tree.tableColumnsBorder",{dark:"#CCCCCC20",light:"#61616120",hc:null},p("treeIndentGuidesStroke","Tree stroke color for the indentation guides.")),dI=R("quickInput.list.focusBackground",{dark:null,light:null,hc:null},"",void 0,p("quickInput.list.focusBackground deprecation","Please use quickInputList.focusBackground instead")),uI=R("quickInputList.focusForeground",{dark:mr,light:mr,hc:mr},p("quickInput.listFocusForeground","Quick picker foreground color for the focused item.")),fI=R("quickInputList.focusIconForeground",{dark:uu,light:uu,hc:uu},p("quickInput.listFocusIconForeground","Quick picker icon foreground color for the focused item.")),mI=R("quickInputList.focusBackground",{dark:II(dI,fr),light:II(dI,fr),hc:null},p("quickInput.listFocusBackground","Quick picker background color for the focused item.")),gI=R("menu.border",{dark:null,light:null,hc:Tt},p("menuBorder","Border color of menus.")),pI=R("menu.foreground",{dark:xk,light:$a,hc:xk},p("menuForeground","Foreground color of menu items.")),_I=R("menu.background",{dark:hC,light:hC,hc:hC},p("menuBackground","Background color of menu items.")),bI=R("menu.selectionForeground",{dark:mr,light:mr,hc:mr},p("menuSelectionForeground","Foreground color of the selected menu item in menus.")),wI=R("menu.selectionBackground",{dark:fr,light:fr,hc:fr},p("menuSelectionBackground","Background color of the selected menu item in menus.")),vI=R("menu.selectionBorder",{dark:null,light:null,hc:xi},p("menuSelectionBorder","Border color of the selected menu item in menus.")),CI=R("menu.separatorBackground",{dark:"#BBBBBB",light:"#888888",hc:Tt},p("menuSeparatorBackground","Color of a separator menu item in menus.")),fG=R("editor.snippetTabstopHighlightBackground",{dark:new A(new ge(124,124,124,.3)),light:new A(new ge(10,50,100,.2)),hc:new A(new ge(124,124,124,.3))},p("snippetTabstopHighlightBackground","Highlight background color of a snippet tabstop.")),mG=R("editor.snippetTabstopHighlightBorder",{dark:null,light:null,hc:null},p("snippetTabstopHighlightBorder","Highlight border color of a snippet tabstop.")),gG=R("editor.snippetFinalTabstopHighlightBackground",{dark:null,light:null,hc:null},p("snippetFinalTabstopHighlightBackground","Highlight background color of the final tabstop of a snippet.")),pG=R("editor.snippetFinalTabstopHighlightBorder",{dark:"#525252",light:new A(new ge(10,50,100,.5)),hc:"#525252"},p("snippetFinalTabstopHighlightBorder","Highlight border color of the final tabstop of a snippet.")),_G=R("editorOverviewRuler.findMatchForeground",{dark:"#d186167e",light:"#d186167e",hc:"#AB5A00"},p("overviewRulerFindMatchForeground","Overview ruler marker color for find matches. The color must not be opaque so as not to hide underlying decorations."),!0),bG=R("editorOverviewRuler.selectionHighlightForeground",{dark:"#A0A0A0CC",light:"#A0A0A0CC",hc:"#A0A0A0CC"},p("overviewRulerSelectionHighlightForeground","Overview ruler marker color for selection highlights. The color must not be opaque so as not to hide underlying decorations."),!0),wG=R("minimap.findMatchHighlight",{light:"#d18616",dark:"#d18616",hc:"#AB5A00"},p("minimapFindMatchHighlight","Minimap marker color for find matches."),!0),bC=R("minimap.selectionHighlight",{light:"#ADD6FF",dark:"#264F78",hc:"#ffffff"},p("minimapSelectionHighlight","Minimap marker color for the editor selection."),!0),SI=R("minimap.errorHighlight",{dark:new A(new ge(255,18,18,.7)),light:new A(new ge(255,18,18,.7)),hc:new A(new ge(255,50,50,1))},p("minimapError","Minimap marker color for errors.")),yI=R("minimap.warningHighlight",{dark:Ss,light:Ss,hc:hu},p("overviewRuleWarning","Minimap marker color for warnings.")),wC=R("minimap.background",{dark:null,light:null,hc:null},p("minimapBackground","Minimap background color.")),LI=R("minimapSlider.background",{light:xt(ou,.5),dark:xt(ou,.5),hc:xt(ou,.5)},p("minimapSliderBackground","Minimap slider background color.")),xI=R("minimapSlider.hoverBackground",{light:xt(au,.5),dark:xt(au,.5),hc:xt(au,.5)},p("minimapSliderHoverBackground","Minimap slider background color when hovering.")),DI=R("minimapSlider.activeBackground",{light:xt(lu,.5),dark:xt(lu,.5),hc:xt(lu,.5)},p("minimapSliderActiveBackground","Minimap slider background color when clicked on.")),vG=R("problemsErrorIcon.foreground",{dark:cu,light:cu,hc:cu},p("problemsErrorIconForeground","The color used for the problems error icon.")),CG=R("problemsWarningIcon.foreground",{dark:Ss,light:Ss,hc:Ss},p("problemsWarningIconForeground","The color used for the problems warning icon.")),SG=R("problemsInfoIcon.foreground",{dark:yo,light:yo,hc:yo},p("problemsInfoIconForeground","The color used for the problems info icon."));function j4(s,e){var t,i,n;switch(s.op){case 0:return(t=ys(s.value,e))===null||t===void 0?void 0:t.darken(s.factor);case 1:return(i=ys(s.value,e))===null||i===void 0?void 0:i.lighten(s.factor);case 2:return(n=ys(s.value,e))===null||n===void 0?void 0:n.transparent(s.factor);case 3:for(let a of s.values){let l=ys(a,e);if(l)return l}return;case 5:return ys(e.defines(s.if)?s.then:s.else,e);case 4:let r=ys(s.value,e);if(!r)return;let o=ys(s.background,e);return o?r.isDarkerThan(o)?A.getLighterColor(r,o,s.factor).transparent(s.transparency):A.getDarkerColor(r,o,s.factor).transparent(s.transparency):r.transparent(s.factor*s.transparency);default:throw sy(s)}}function EI(s,e){return{op:0,value:s,factor:e}}function kI(s,e){return{op:1,value:s,factor:e}}function xt(s,e){return{op:2,value:s,factor:e}}function II(...s){return{op:3,values:s}}function z4(s,e,t){return{op:5,if:s,then:e,else:t}}function NI(s,e,t,i){return{op:4,value:s,background:e,factor:t,transparency:i}}function ys(s,e){if(s!==null){if(typeof s=="string")return s[0]==="#"?A.fromHex(s):e.getColor(s);if(s instanceof A)return s;if(typeof s=="object")return j4(s,e)}}var TI="vscode://schemas/workbench-colors",MI=Te.as(Ha.JSONContribution);MI.registerSchema(TI,tp.getColorSchema());var RI=new $e(()=>MI.notifySchemaChanged(TI),200);tp.onDidChangeSchema(()=>{RI.isScheduled()||RI.schedule()});var AI=R("editor.lineHighlightBackground",{dark:null,light:null,hc:null},p("lineHighlight","Background color for the highlight of line at the cursor position.")),vC=R("editor.lineHighlightBorder",{dark:"#282828",light:"#eeeeee",hc:"#f38518"},p("lineHighlightBorderBox","Background color for the border around the line at the cursor position.")),H4=R("editor.rangeHighlightBackground",{dark:"#ffffff0b",light:"#fdff0033",hc:null},p("rangeHighlight","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),U4=R("editor.rangeHighlightBorder",{dark:null,light:null,hc:xi},p("rangeHighlightBorder","Background color of the border around highlighted ranges."),!0),$4=R("editor.symbolHighlightBackground",{dark:mC,light:mC,hc:null},p("symbolHighlight","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),K4=R("editor.symbolHighlightBorder",{dark:null,light:null,hc:xi},p("symbolHighlightBorder","Background color of the border around highlighted symbols."),!0),op=R("editorCursor.foreground",{dark:"#AEAFAD",light:A.black,hc:A.white},p("caret","Color of the editor cursor.")),OI=R("editorCursor.background",null,p("editorCursorBackground","The background color of the editor cursor. Allows customizing the color of a character overlapped by a block cursor.")),Za=R("editorWhitespace.foreground",{dark:"#e3e4e229",light:"#33333333",hc:"#e3e4e229"},p("editorWhitespaces","Color of whitespace characters in the editor.")),Ac=R("editorIndentGuide.background",{dark:Za,light:Za,hc:Za},p("editorIndentGuides","Color of the editor indentation guides.")),Oc=R("editorIndentGuide.activeBackground",{dark:Za,light:Za,hc:Za},p("editorActiveIndentGuide","Color of the active editor indentation guides.")),ap=R("editorLineNumber.foreground",{dark:"#858585",light:"#237893",hc:A.white},p("editorLineNumbers","Color of editor line numbers.")),CC=R("editorActiveLineNumber.foreground",{dark:"#c6c6c6",light:"#0B216F",hc:xi},p("editorActiveLineNumber","Color of editor active line number"),!1,p("deprecatedEditorActiveLineNumber","Id is deprecated. Use 'editorLineNumber.activeForeground' instead.")),PI=R("editorLineNumber.activeForeground",{dark:CC,light:CC,hc:CC},p("editorActiveLineNumber","Color of editor active line number")),FI=R("editorRuler.foreground",{dark:"#5A5A5A",light:A.lightgrey,hc:A.white},p("editorRuler","Color of the editor rulers.")),kG=R("editorCodeLens.foreground",{dark:"#999999",light:"#919191",hc:"#999999"},p("editorCodeLensForeground","Foreground color of editor CodeLens")),IG=R("editorBracketMatch.background",{dark:"#0064001a",light:"#0064001a",hc:"#0064001a"},p("editorBracketMatchBackground","Background color behind matching brackets")),NG=R("editorBracketMatch.border",{dark:"#888",light:"#B9B9B9",hc:Tt},p("editorBracketMatchBorder","Color for matching brackets boxes")),BI=R("editorOverviewRuler.border",{dark:"#7f7f7f4d",light:"#7f7f7f4d",hc:"#7f7f7f4d"},p("editorOverviewRulerBorder","Color of the overview ruler border.")),WI=R("editorOverviewRuler.background",null,p("editorOverviewRulerBackground","Background color of the editor overview ruler. Only used when the minimap is enabled and placed on the right side of the editor.")),q4=R("editorGutter.background",{dark:Kn,light:Kn,hc:Kn},p("editorGutter","Background color of the editor gutter. The gutter contains the glyph margins and the line numbers.")),VI=R("editorUnnecessaryCode.border",{dark:null,light:null,hc:A.fromHex("#fff").transparent(.8)},p("unnecessaryCodeBorder","Border color of unnecessary (unused) source code in the editor.")),jI=R("editorUnnecessaryCode.opacity",{dark:A.fromHex("#000a"),light:A.fromHex("#0007"),hc:null},p("unnecessaryCodeOpacity",`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.`)),TG=R("editorGhostText.border",{dark:null,light:null,hc:A.fromHex("#fff").transparent(.8)},p("editorGhostTextBorder","Border color of ghost text in the editor.")),MG=R("editorGhostText.foreground",{dark:A.fromHex("#ffffff56"),light:A.fromHex("#0007"),hc:null},p("editorGhostTextForeground","Foreground color of the ghost text in the editor.")),SC=new A(new ge(0,122,204,.6)),RG=R("editorOverviewRuler.rangeHighlightForeground",{dark:SC,light:SC,hc:SC},p("overviewRulerRangeHighlight","Overview ruler marker color for range highlights. The color must not be opaque so as not to hide underlying decorations."),!0),zI=R("editorOverviewRuler.errorForeground",{dark:new A(new ge(255,18,18,.7)),light:new A(new ge(255,18,18,.7)),hc:new A(new ge(255,50,50,1))},p("overviewRuleError","Overview ruler marker color for errors.")),HI=R("editorOverviewRuler.warningForeground",{dark:Ss,light:Ss,hc:hu},p("overviewRuleWarning","Overview ruler marker color for warnings.")),UI=R("editorOverviewRuler.infoForeground",{dark:yo,light:yo,hc:np},p("overviewRuleInfo","Overview ruler marker color for infos."));bt((s,e)=>{let t=s.getColor(Kn);t&&e.addRule(`.monaco-editor, .monaco-editor-background, .monaco-editor .inputarea.ime-input { background-color: ${t}; }`);let i=s.getColor(Lo);i&&e.addRule(`.monaco-editor, .monaco-editor .inputarea.ime-input { color: ${i}; }`);let n=s.getColor(q4);n&&e.addRule(`.monaco-editor .margin { background-color: ${n}; }`);let r=s.getColor(H4);r&&e.addRule(`.monaco-editor .rangeHighlight { background-color: ${r}; }`);let o=s.getColor(U4);o&&e.addRule(`.monaco-editor .rangeHighlight { border: 1px ${s.type==="hc"?"dotted":"solid"} ${o}; }`);let a=s.getColor($4);a&&e.addRule(`.monaco-editor .symbolHighlight { background-color: ${a}; }`);let l=s.getColor(K4);l&&e.addRule(`.monaco-editor .symbolHighlight { border: 1px ${s.type==="hc"?"dotted":"solid"} ${l}; }`);let c=s.getColor(Za);c&&(e.addRule(`.monaco-editor .mtkw { color: ${c} !important; }`),e.addRule(`.monaco-editor .mtkz { color: ${c} !important; }`))});var gr=class extends hn{constructor(e){super();this._context=e,this._readConfig(),this._lastCursorModelPosition=new N(1,1),this._renderResult=null,this._activeLineNumber=1,this._context.addEventHandler(this)}_readConfig(){let e=this._context.configuration.options;this._lineHeight=e.get(57);let t=e.get(58);this._renderLineNumbers=t.renderType,this._renderCustomLineNumbers=t.renderFn,this._renderFinalNewline=e.get(83);let i=e.get(129);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){let t=e.selections[0].getPosition();this._lastCursorModelPosition=this._context.model.coordinatesConverter.convertViewPositionToModelPosition(t);let i=!1;return this._activeLineNumber!==t.lineNumber&&(this._activeLineNumber=t.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}_getLineRenderLineNumber(e){let t=this._context.model.coordinatesConverter.convertViewPositionToModelPosition(new N(e,1));if(t.column!==1)return"";let i=t.lineNumber;if(this._renderCustomLineNumbers)return this._renderCustomLineNumbers(i);if(this._renderLineNumbers===2){let n=Math.abs(this._lastCursorModelPosition.lineNumber-i);return n===0?''+i+"":String(n)}return this._renderLineNumbers===3?this._lastCursorModelPosition.lineNumber===i||i%10==0?String(i):"":String(i)}prepareRender(e){if(this._renderLineNumbers===0){this._renderResult=null;return}let t=_t?this._lineHeight%2==0?" lh-even":" lh-odd":"",i=e.visibleRange.startLineNumber,n=e.visibleRange.endLineNumber,r='
',o=this._context.model.getLineCount(),a=[];for(let l=i;l<=n;l++){let c=l-i;if(!this._renderFinalNewline&&l===o&&this._context.model.getLineLength(l)===0){a[c]="";continue}let h=this._getLineRenderLineNumber(l);h?l===this._activeLineNumber?a[c]='
'+h+"
":a[c]=r+h+"
":a[c]=""}this._renderResult=a}render(e,t){if(!this._renderResult)return"";let i=t-e;return i<0||i>=this._renderResult.length?"":this._renderResult[i]}};gr.CLASS_NAME="line-numbers";bt((s,e)=>{let t=s.getColor(ap);t&&e.addRule(`.monaco-editor .line-numbers { color: ${t}; }`);let i=s.getColor(PI);i&&e.addRule(`.monaco-editor .line-numbers.active-line-number { color: ${i}; }`)});var Ls=class extends st{constructor(e){super(e);let t=this._context.configuration.options,i=t.get(129);this._canUseLayerHinting=!t.get(26),this._contentLeft=i.contentLeft,this._glyphMarginLeft=i.glyphMarginLeft,this._glyphMarginWidth=i.glyphMarginWidth,this._domNode=X(document.createElement("div")),this._domNode.setClassName(Ls.OUTER_CLASS_NAME),this._domNode.setPosition("absolute"),this._domNode.setAttribute("role","presentation"),this._domNode.setAttribute("aria-hidden","true"),this._glyphMarginBackgroundDomNode=X(document.createElement("div")),this._glyphMarginBackgroundDomNode.setClassName(Ls.CLASS_NAME),this._domNode.appendChild(this._glyphMarginBackgroundDomNode)}dispose(){super.dispose()}getDomNode(){return this._domNode}onConfigurationChanged(e){let t=this._context.configuration.options,i=t.get(129);return this._canUseLayerHinting=!t.get(26),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");let t=e.scrollTop-e.bigNumbersDelta;this._domNode.setTop(-t);let 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)}};Ls.CLASS_NAME="glyph-margin";Ls.OUTER_CLASS_NAME="margin";var qn="monaco-mouse-cursor-text";var lp=class{constructor(e,t,i){this._visibleTextAreaBrand=void 0,this.top=e,this.left=t,this.width=i}setWidth(e){return new lp(this.top,this.left,e)}},fu=at,yC=class extends st{constructor(e,t,i){super(e);this._primaryCursorPosition=new N(1,1),this._primaryCursorVisibleRange=null,this._viewController=t,this._viewHelper=i,this._scrollLeft=0,this._scrollTop=0;let n=this._context.configuration.options,r=n.get(129);this._setAccessibilityOptions(n),this._contentLeft=r.contentLeft,this._contentWidth=r.contentWidth,this._contentHeight=r.height,this._fontInfo=n.get(41),this._lineHeight=n.get(57),this._emptySelectionClipboard=n.get(30),this._copyWithSyntaxHighlighting=n.get(19),this._visibleTextArea=null,this._selections=[new Z(1,1,1,1)],this._modelSelections=[new Z(1,1,1,1)],this._lastRenderPosition=null,this.textArea=X(document.createElement("textarea")),Xt.write(this.textArea,6),this.textArea.setClassName(`inputarea ${qn}`),this.textArea.setAttribute("wrap","off"),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",this._getAriaLabel(n)),this.textArea.setAttribute("tabindex",String(n.get(111))),this.textArea.setAttribute("role","textbox"),this.textArea.setAttribute("aria-roledescription",p("editor","editor")),this.textArea.setAttribute("aria-multiline","true"),this.textArea.setAttribute("aria-haspopup","false"),this.textArea.setAttribute("aria-autocomplete","both"),n.get(28)&&n.get(79)&&this.textArea.setAttribute("readonly","true"),this.textAreaCover=X(document.createElement("div")),this.textAreaCover.setPosition("absolute");let o={getLineCount:()=>this._context.model.getLineCount(),getLineMaxColumn:l=>this._context.model.getLineMaxColumn(l),getValueInRange:(l,c)=>this._context.model.getValueInRange(l,c)},a={getDataToCopy:l=>{let c=this._context.model.getPlainTextToCopy(this._modelSelections,this._emptySelectionClipboard,ot),h=this._context.model.getEOL(),d=this._emptySelectionClipboard&&this._modelSelections.length===1&&this._modelSelections[0].isEmpty(),u=Array.isArray(c)?c:null,f=Array.isArray(c)?c.join(h):c,m,g=null;if(l&&(lk.forceCopyWithSyntaxHighlighting||this._copyWithSyntaxHighlighting&&f.length<65536)){let b=this._context.model.getRichTextToCopy(this._modelSelections,this._emptySelectionClipboard);b&&(m=b.html,g=b.mode)}return{isFromEmptySelection:d,multicursorText:u,text:f,html:m,mode:g}},getScreenReaderContent:l=>{if(this._accessibilitySupport===1){if(ee){let c=this._selections[0];if(c.isEmpty()){let h=c.getStartPosition(),d=this._getWordBeforePosition(h);if(d.length===0&&(d=this._getCharacterBeforePosition(h)),d.length>0)return new gt(d,d.length,d.length,h,h)}}return gt.EMPTY}if(ea){let c=this._selections[0];if(c.isEmpty()){let h=c.getStartPosition(),[d,u]=this._getAndroidWordAtPosition(h);if(d.length>0)return new gt(d,u,u,h,h)}return gt.EMPTY}return Co.fromEditorSelection(l,o,this._selections[0],this._accessibilityPageSize,this._accessibilitySupport===0)},deduceModelPosition:(l,c,h)=>this._context.model.deduceModelPositionRelativeToViewPosition(l,c,h)};this._textAreaInput=this._register(new aC(a,this.textArea)),this._register(this._textAreaInput.onKeyDown(l=>{this._viewController.emitKeyDown(l)})),this._register(this._textAreaInput.onKeyUp(l=>{this._viewController.emitKeyUp(l)})),this._register(this._textAreaInput.onPaste(l=>{let c=!1,h=null,d=null;l.metadata&&(c=this._emptySelectionClipboard&&!!l.metadata.isFromEmptySelection,h=typeof l.metadata.multicursorText!="undefined"?l.metadata.multicursorText:null,d=l.metadata.mode),this._viewController.paste(l.text,c,h,d)})),this._register(this._textAreaInput.onCut(()=>{this._viewController.cut()})),this._register(this._textAreaInput.onType(l=>{l.replacePrevCharCnt||l.replaceNextCharCnt||l.positionDelta?(Yi&&console.log(` => compositionType: <<${l.text}>>, ${l.replacePrevCharCnt}, ${l.replaceNextCharCnt}, ${l.positionDelta}`),this._viewController.compositionType(l.text,l.replacePrevCharCnt,l.replaceNextCharCnt,l.positionDelta)):(Yi&&console.log(` => type: <<${l.text}>>`),this._viewController.type(l.text))})),this._register(this._textAreaInput.onSelectionChangeRequest(l=>{this._viewController.setSelection(l)})),this._register(this._textAreaInput.onCompositionStart(l=>{let c=this._selections[0].startLineNumber,h=this._selections[0].startColumn+l.revealDeltaColumns;this._context.model.revealRange("keyboard",!0,new D(c,h,c,h),0,1);let d=this._viewHelper.visibleRangeForPositionRelativeToEditor(c,h);d&&(this._visibleTextArea=new lp(this._context.viewLayout.getVerticalOffsetForLineNumber(c),d.left,fu?0:1),this._render()),this.textArea.setClassName(`inputarea ${qn} ime-input`),this._viewController.compositionStart(),this._context.model.onCompositionStart()})),this._register(this._textAreaInput.onCompositionUpdate(l=>{!this._visibleTextArea||(this._visibleTextArea=this._visibleTextArea.setWidth(G4(l.data,this._fontInfo)),this._render())})),this._register(this._textAreaInput.onCompositionEnd(()=>{this._visibleTextArea=null,this._render(),this.textArea.setClassName(`inputarea ${qn}`),this._viewController.compositionEnd(),this._context.model.onCompositionEnd()})),this._register(this._textAreaInput.onFocus(()=>{this._context.model.setHasFocus(!0)})),this._register(this._textAreaInput.onBlur(()=>{this._context.model.setHasFocus(!1)}))}dispose(){super.dispose()}_getAndroidWordAtPosition(e){let t='`~!@#$%^&*()-=+[{]}\\|;:",.<>/?',i=this._context.model.getLineContent(e.lineNumber),n=ds(t),r=!0,o=e.column,a=!0,l=e.column,c=0;for(;c<50&&(r||a);){if(r&&o<=1&&(r=!1),r){let h=i.charCodeAt(o-2);n.get(h)!==0?r=!1:o--}if(a&&l>i.length&&(a=!1),a){let h=i.charCodeAt(l-1);n.get(h)!==0?a=!1:l++}c++}return[i.substring(o-1,l-1),e.column-o]}_getWordBeforePosition(e){let t=this._context.model.getLineContent(e.lineNumber),i=ds(this._context.configuration.options.get(115)),n=e.column,r=0;for(;n>1;){let o=t.charCodeAt(n-2);if(i.get(o)!==0||r>50)return t.substring(n-1,e.column-1);r++,n--}return t.substring(0,e.column-1)}_getCharacterBeforePosition(e){if(e.column>1){let i=this._context.model.getLineContent(e.lineNumber).charAt(e.column-2);if(!Xe(i.charCodeAt(0)))return i}return""}_getAriaLabel(e){return e.get(2)===1?p("accessibilityOffAriaLabel","The editor is not accessible at this time. Press {0} for options.",_t?"Shift+Alt+F1":"Alt+F1"):e.get(4)}_setAccessibilityOptions(e){this._accessibilitySupport=e.get(2);let t=e.get(3);this._accessibilitySupport===2&&t===Wn.accessibilityPageSize.defaultValue?this._accessibilityPageSize=500:this._accessibilityPageSize=t}onConfigurationChanged(e){let t=this._context.configuration.options,i=t.get(129);return this._setAccessibilityOptions(t),this._contentLeft=i.contentLeft,this._contentWidth=i.contentWidth,this._contentHeight=i.height,this._fontInfo=t.get(41),this._lineHeight=t.get(57),this._emptySelectionClipboard=t.get(30),this._copyWithSyntaxHighlighting=t.get(19),this.textArea.setAttribute("aria-label",this._getAriaLabel(t)),this.textArea.setAttribute("tabindex",String(t.get(111))),(e.hasChanged(28)||e.hasChanged(79))&&(t.get(28)&&t.get(79)?this.textArea.setAttribute("readonly","true"):this.textArea.removeAttribute("readonly")),e.hasChanged(2)&&this._textAreaInput.writeScreenReaderContent("strategy changed"),!0}onCursorStateChanged(e){return this._selections=e.selections.slice(0),this._modelSelections=e.modelSelections.slice(0),this._textAreaInput.writeScreenReaderContent("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()}focusTextArea(){this._textAreaInput.focusTextArea()}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)}prepareRender(e){this._primaryCursorPosition=new N(this._selections[0].positionLineNumber,this._selections[0].positionColumn),this._primaryCursorVisibleRange=e.visibleRangeForPosition(this._primaryCursorPosition)}render(e){this._textAreaInput.writeScreenReaderContent("render"),this._render()}_render(){if(this._visibleTextArea){this._renderInsideEditor(null,this._visibleTextArea.top-this._scrollTop,this._contentLeft+this._visibleTextArea.left-this._scrollLeft,this._visibleTextArea.width,this._lineHeight);return}if(!this._primaryCursorVisibleRange){this._renderAtTopLeft();return}let e=this._contentLeft+this._primaryCursorVisibleRange.left-this._scrollLeft;if(ethis._contentLeft+this._contentWidth){this._renderAtTopLeft();return}let t=this._context.viewLayout.getVerticalOffsetForLineNumber(this._selections[0].positionLineNumber)-this._scrollTop;if(t<0||t>this._contentHeight){this._renderAtTopLeft();return}if(ee){this._renderInsideEditor(this._primaryCursorPosition,t,e,fu?0:1,this._lineHeight);return}this._renderInsideEditor(this._primaryCursorPosition,t,e,fu?0:1,fu?0:1)}_renderInsideEditor(e,t,i,n,r){this._lastRenderPosition=e;let o=this.textArea,a=this.textAreaCover;mt.applyFontInfo(o,this._fontInfo),o.setTop(t),o.setLeft(i),o.setWidth(n),o.setHeight(r),a.setTop(0),a.setLeft(0),a.setWidth(0),a.setHeight(0)}_renderAtTopLeft(){this._lastRenderPosition=null;let e=this.textArea,t=this.textAreaCover;if(mt.applyFontInfo(e,this._fontInfo),e.setTop(0),e.setLeft(0),t.setTop(0),t.setLeft(0),fu){e.setWidth(0),e.setHeight(0),t.setWidth(0),t.setHeight(0);return}e.setWidth(1),e.setHeight(1),t.setWidth(1),t.setHeight(1);let i=this._context.configuration.options;i.get(47)?t.setClassName("monaco-editor-background textAreaCover "+Ls.OUTER_CLASS_NAME):i.get(58).renderType!==0?t.setClassName("monaco-editor-background textAreaCover "+gr.CLASS_NAME):t.setClassName("monaco-editor-background textAreaCover")}};function G4(s,e){let i=document.createElement("canvas").getContext("2d");i.font=Y4(e);let n=i.measureText(s);return at?n.width+2:n.width}function Y4(s){return Z4("normal",s.fontWeight,s.fontSize,s.lineHeight,s.fontFamily)}function Z4(s,e,t,i,n){return`${s} normal ${e} ${t}px / ${i}px ${n}`}var LC=class{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){let t=this.viewModel.getLineMinColumn(e.lineNumber);return e.column=4?this._selectAll():e.mouseDownCount===3?this._hasMulticursorModifier(e)?e.inSelectionMode?this._lastCursorLineSelectDrag(e.position):this._lastCursorLineSelect(e.position):e.inSelectionMode?this._lineSelectDrag(e.position):this._lineSelect(e.position):e.mouseDownCount===2?this._hasMulticursorModifier(e)?this._lastCursorWordSelect(e.position):e.inSelectionMode?this._wordSelectDrag(e.position):this._wordSelect(e.position):this._hasMulticursorModifier(e)?this._hasNonMulticursorModifier(e)||(e.shiftKey?this._columnSelect(e.position,e.mouseColumn,!0):e.inSelectionMode?this._lastCursorMoveToSelect(e.position):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):this.moveTo(e.position)}_usualArgs(e){return e=this._validateViewColumn(e),{source:"mouse",position:this._convertViewToModelPosition(e),viewPosition:e}}moveTo(e){Lt.MoveTo.runCoreEditorCommand(this.viewModel,this._usualArgs(e))}_moveToSelect(e){Lt.MoveToSelect.runCoreEditorCommand(this.viewModel,this._usualArgs(e))}_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){Lt.LastCursorMoveToSelect.runCoreEditorCommand(this.viewModel,this._usualArgs(e))}_wordSelect(e){Lt.WordSelect.runCoreEditorCommand(this.viewModel,this._usualArgs(e))}_wordSelectDrag(e){Lt.WordSelectDrag.runCoreEditorCommand(this.viewModel,this._usualArgs(e))}_lastCursorWordSelect(e){Lt.LastCursorWordSelect.runCoreEditorCommand(this.viewModel,this._usualArgs(e))}_lineSelect(e){Lt.LineSelect.runCoreEditorCommand(this.viewModel,this._usualArgs(e))}_lineSelectDrag(e){Lt.LineSelectDrag.runCoreEditorCommand(this.viewModel,this._usualArgs(e))}_lastCursorLineSelect(e){Lt.LastCursorLineSelect.runCoreEditorCommand(this.viewModel,this._usualArgs(e))}_lastCursorLineSelectDrag(e){Lt.LastCursorLineSelectDrag.runCoreEditorCommand(this.viewModel,this._usualArgs(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)}};var Xa=class{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&&this.onKeyDown(e)}emitKeyUp(e){this.onKeyUp&&this.onKeyUp(e)}emitContextMenu(e){this.onContextMenu&&this.onContextMenu(this._convertViewToModelMouseEvent(e))}emitMouseMove(e){this.onMouseMove&&this.onMouseMove(this._convertViewToModelMouseEvent(e))}emitMouseLeave(e){this.onMouseLeave&&this.onMouseLeave(this._convertViewToModelMouseEvent(e))}emitMouseDown(e){this.onMouseDown&&this.onMouseDown(this._convertViewToModelMouseEvent(e))}emitMouseUp(e){this.onMouseUp&&this.onMouseUp(this._convertViewToModelMouseEvent(e))}emitMouseDrag(e){this.onMouseDrag&&this.onMouseDrag(this._convertViewToModelMouseEvent(e))}emitMouseDrop(e){this.onMouseDrop&&this.onMouseDrop(this._convertViewToModelMouseEvent(e))}emitMouseDropCanceled(){this.onMouseDropCanceled&&this.onMouseDropCanceled()}emitMouseWheel(e){this.onMouseWheel&&this.onMouseWheel(e)}_convertViewToModelMouseEvent(e){return e.target?{event:e.event,target:this._convertViewToModelMouseTarget(e.target)}:e}_convertViewToModelMouseTarget(e){return Xa.convertViewToModelMouseTarget(e,this._coordinatesConverter)}static convertViewToModelMouseTarget(e,t){return new $I(e.element,e.type,e.mouseColumn,e.position?t.convertViewPositionToModelPosition(e.position):null,e.range?t.convertViewRangeToModelRange(e.range):null,e.detail)}},$I=class{constructor(e,t,i,n,r,o){this.element=e,this.type=t,this.mouseColumn=i,this.position=n,this.range=r,this.detail=o}toString(){return Gi.toString(this)}};var xC,cp=class{constructor(e){this._createLine=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){let t=e-this._rendLineNumberStart;if(t<0||t>=this._lines.length)throw new Error("Illegal value for lineNumber");return this._lines[t]}onLinesDeleted(e,t){if(this.getCount()===0)return null;let i=this.getStartLineNumber(),n=this.getEndLineNumber();if(tn)return null;let r=0,o=0;for(let l=i;l<=n;l++){let c=l-this._rendLineNumberStart;e<=l&&l<=t&&(o===0?(r=c,o=1):o++)}if(e=i&&o<=n&&(this._lines[o-this._rendLineNumberStart].onContentChanged(),r=!0);return r}onLinesInserted(e,t){if(this.getCount()===0)return null;let i=t-e+1,n=this.getStartLineNumber(),r=this.getEndLineNumber();if(e<=n)return this._rendLineNumberStart+=i,null;if(e>r)return null;if(i+e>r)return this._lines.splice(e-this._rendLineNumberStart,r-e+1);let o=[];for(let d=0;di)continue;let l=Math.max(t,a.fromLineNumber),c=Math.min(i,a.toLineNumber);for(let h=l;h<=c;h++){let d=h-this._rendLineNumberStart;this._lines[d].onTokensChanged(),n=!0}}return n}},mu=class{constructor(e){this._host=e,this.domNode=this._createDomNode(),this._linesCollection=new cp(()=>this._host.createVisibleLine())}_createDomNode(){let e=X(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(129)}onFlushed(e){return this._linesCollection.flush(),!0}onLinesChanged(e){return this._linesCollection.onLinesChanged(e.fromLineNumber,e.toLineNumber)}onLinesDeleted(e){let t=this._linesCollection.onLinesDeleted(e.fromLineNumber,e.toLineNumber);if(t)for(let i=0,n=t.length;it){let o=t,a=Math.min(i,r.rendLineNumberStart-1);o<=a&&(this._insertLinesBefore(r,o,a,n,t),r.linesLength+=a-o+1)}else if(r.rendLineNumberStart0&&(this._removeLinesBefore(r,o),r.linesLength-=o)}if(r.rendLineNumberStart=t,r.rendLineNumberStart+r.linesLength-1i){let o=Math.max(0,i-r.rendLineNumberStart+1),l=r.linesLength-1-o+1;l>0&&(this._removeLinesAfter(r,l),r.linesLength-=l)}return this._finishRendering(r,!1,n),r}_renderUntouchedLines(e,t,i,n,r){let o=e.rendLineNumberStart,a=e.lines;for(let l=t;l<=i;l++){let c=o+l;a[l].layoutLine(c,n[c-r])}}_insertLinesBefore(e,t,i,n,r){let o=[],a=0;for(let l=t;l<=i;l++)o[a++]=this.host.createVisibleLine();e.lines=o.concat(e.lines)}_removeLinesBefore(e,t){for(let i=0;i=0;a--){let l=e.lines[a];n[a]&&(l.setDomNode(o),o=o.previousSibling)}}_finishRenderingInvalidLines(e,t,i){let n=document.createElement("div");xs._ttPolicy&&(t=xs._ttPolicy.createHTML(t)),n.innerHTML=t;for(let r=0;rs});xs._sb=as(1e5);var DC=class extends st{constructor(e){super(e);this._visibleLines=new mu(this),this.domNode=this._visibleLines.domNode,this._dynamicOverlays=[],this._isFocused=!1,this.domNode.setClassName("view-overlays")}shouldRender(){if(super.shouldRender())return!0;for(let e=0,t=this._dynamicOverlays.length;ei.shouldRender());for(let i=0,n=t.length;i'),n.appendASCIIString(r),n.appendASCIIString(""),!0)}layoutLine(e,t){this._domNode&&(this._domNode.setTop(t),this._domNode.setHeight(this._lineHeight))}},EC=class extends DC{constructor(e){super(e);let i=this._context.configuration.options.get(129);this._contentWidth=i.contentWidth,this.domNode.setHeight(0)}onConfigurationChanged(e){let i=this._context.configuration.options.get(129);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))}},kC=class extends DC{constructor(e){super(e);let t=this._context.configuration.options,i=t.get(129);this._contentLeft=i.contentLeft,this.domNode.setClassName("margin-view-overlays"),this.domNode.setWidth(1),mt.applyFontInfo(this.domNode,t.get(41))}onConfigurationChanged(e){let t=this._context.configuration.options;mt.applyFontInfo(this.domNode,t.get(41));let i=t.get(129);return this._contentLeft=i.contentLeft,super.onConfigurationChanged(e)||!0}onScrollChanged(e){return super.onScrollChanged(e)||e.scrollHeightChanged}_viewOverlaysRender(e){super._viewOverlaysRender(e);let t=Math.min(e.scrollHeight,1e6);this.domNode.setHeight(t),this.domNode.setWidth(this._contentLeft)}};var Pc=class{constructor(e,t){this._coordinateBrand=void 0,this.top=e,this.left=t}},IC=class extends st{constructor(e,t){super(e);this._viewDomNode=t,this._widgets={},this.domNode=X(document.createElement("div")),Xt.write(this.domNode,1),this.domNode.setClassName("contentWidgets"),this.domNode.setPosition("absolute"),this.domNode.setTop(0),this.overflowingContentWidgetsDomNode=X(document.createElement("div")),Xt.write(this.overflowingContentWidgetsDomNode,2),this.overflowingContentWidgetsDomNode.setClassName("overflowingContentWidgets")}dispose(){super.dispose(),this._widgets={}}onConfigurationChanged(e){let t=Object.keys(this._widgets);for(let i of t)this._widgets[i].onConfigurationChanged(e);return!0}onDecorationsChanged(e){return!0}onFlushed(e){return!0}onLineMappingChanged(e){let t=Object.keys(this._widgets);for(let i of t)this._widgets[i].onLineMappingChanged(e);return!0}onLinesChanged(e){return!0}onLinesDeleted(e){return!0}onLinesInserted(e){return!0}onScrollChanged(e){return!0}onZonesChanged(e){return!0}addWidget(e){let t=new qI(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){this._widgets[e.getId()].setPosition(t,i),this.setShouldRender()}removeWidget(e){let t=e.getId();if(this._widgets.hasOwnProperty(t)){let i=this._widgets[t];delete this._widgets[t];let n=i.domNode.domNode;n.parentNode.removeChild(n),n.removeAttribute("monaco-visible-content-widget"),this.setShouldRender()}}shouldSuppressMouseDownOnWidget(e){return this._widgets.hasOwnProperty(e)?this._widgets[e].suppressMouseDown:!1}onBeforeRender(e){let t=Object.keys(this._widgets);for(let i of t)this._widgets[i].onBeforeRender(e)}prepareRender(e){let t=Object.keys(this._widgets);for(let i of t)this._widgets[i].prepareRender(e)}render(e){let t=Object.keys(this._widgets);for(let i of t)this._widgets[i].render(e)}},qI=class{constructor(e,t,i){this._context=e,this._viewDomNode=t,this._actual=i,this.domNode=X(this._actual.getDomNode()),this.id=this._actual.getId(),this.allowEditorOverflow=this._actual.allowEditorOverflow||!1,this.suppressMouseDown=this._actual.suppressMouseDown||!1;let n=this._context.configuration.options,r=n.get(129);this._fixedOverflowWidgets=n.get(34),this._contentWidth=r.contentWidth,this._contentLeft=r.contentLeft,this._lineHeight=n.get(57),this._range=null,this._viewRange=null,this._preference=[],this._cachedDomNodeClientWidth=-1,this._cachedDomNodeClientHeight=-1,this._maxWidth=this._getMaxWidth(),this._isVisible=!1,this._renderData=null,this.domNode.setPosition(this._fixedOverflowWidgets&&this.allowEditorOverflow?"fixed":"absolute"),this.domNode.setVisibility("hidden"),this.domNode.setAttribute("widgetId",this.id),this.domNode.setMaxWidth(this._maxWidth)}onConfigurationChanged(e){let t=this._context.configuration.options;if(this._lineHeight=t.get(57),e.hasChanged(129)){let i=t.get(129);this._contentLeft=i.contentLeft,this._contentWidth=i.contentWidth,this._maxWidth=this._getMaxWidth()}}onLineMappingChanged(e){this._setPosition(this._range)}_setPosition(e){if(this._range=e,this._viewRange=null,this._range){let t=this._context.model.validateModelRange(this._range);(this._context.model.coordinatesConverter.modelPositionIsVisible(t.getStartPosition())||this._context.model.coordinatesConverter.modelPositionIsVisible(t.getEndPosition()))&&(this._viewRange=this._context.model.coordinatesConverter.convertModelRangeToViewRange(t))}}_getMaxWidth(){return this.allowEditorOverflow?window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth:this._contentWidth}setPosition(e,t){this._setPosition(e),this._preference=t,this._cachedDomNodeClientWidth=-1,this._cachedDomNodeClientHeight=-1}_layoutBoxInViewport(e,t,i,n,r){let o=e.top,a=o,l=t.top+this._lineHeight,c=r.viewportHeight-l,h=o-n,d=a>=n,u=l,f=c>=n,m=e.left,g=t.left;return m+i>r.scrollLeft+r.viewportWidth&&(m=r.scrollLeft+r.viewportWidth-i),g+i>r.scrollLeft+r.viewportWidth&&(g=r.scrollLeft+r.viewportWidth-i),mo){let l=a-(o-n);a-=l,i-=l}if(a=b,v=h+n<=d.height-w;return this._fixedOverflowWidgets?{fitsAbove:_,aboveTop:Math.max(c,b),aboveLeft:f,fitsBelow:v,belowTop:h,belowLeft:g}:{fitsAbove:_,aboveTop:o,aboveLeft:u,fitsBelow:v,belowTop:a,belowLeft:m}}_prepareRenderWidgetAtExactPositionOverflowing(e){return new Pc(e.top,e.left+this._contentLeft)}_getTopAndBottomLeft(e){if(!this._viewRange)return[null,null];let t=e.linesVisibleRangesForRange(this._viewRange,!1);if(!t||t.length===0)return[null,null];let i=t[0],n=t[0];for(let d of t)d.lineNumbern.lineNumber&&(n=d);let r=1073741824;for(let d of i.ranges)d.lefte.endLineNumber||this.domNode.setMaxWidth(this._maxWidth)}prepareRender(e){this._renderData=this._prepareRenderWidget(e)}render(e){if(!this._renderData){this._isVisible&&(this.domNode.removeAttribute("monaco-visible-content-widget"),this._isVisible=!1,this.domNode.setVisibility("hidden")),typeof this._actual.afterRender=="function"&&NC(this._actual.afterRender,this._actual,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"&&NC(this._actual.afterRender,this._actual,this._renderData.position)}};function NC(s,e,...t){try{return s.call(e,...t)}catch(i){return null}}var TC=!0,MC=class extends hn{constructor(e){super();this._context=e;let t=this._context.configuration.options,i=t.get(129);this._lineHeight=t.get(57),this._renderLineHighlight=t.get(84),this._renderLineHighlightOnlyWhenFocus=t.get(85),this._contentLeft=i.contentLeft,this._contentWidth=i.contentWidth,this._selectionIsEmpty=!0,this._focused=!1,this._cursorLineNumbers=[1],this._selections=[new Z(1,1,1,1)],this._renderData=null,this._context.addEventHandler(this)}dispose(){this._context.removeEventHandler(this),super.dispose()}_readFromSelections(){let e=!1,t=TC?this._selections.slice(0,1):this._selections,i=t.map(r=>r.positionLineNumber);i.sort((r,o)=>r-o),Ri(this._cursorLineNumbers,i)||(this._cursorLineNumbers=i,e=!0);let n=t.every(r=>r.isEmpty());return this._selectionIsEmpty!==n&&(this._selectionIsEmpty=n,e=!0),e}onThemeChanged(e){return this._readFromSelections()}onConfigurationChanged(e){let t=this._context.configuration.options,i=t.get(129);return this._lineHeight=t.get(57),this._renderLineHighlight=t.get(84),this._renderLineHighlightOnlyWhenFocus=t.get(85),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}let t=this._renderOne(e),i=e.visibleRange.startLineNumber,n=e.visibleRange.endLineNumber,r=this._cursorLineNumbers.length,o=0,a=[];for(let l=i;l<=n;l++){let c=l-i;for(;o=this._renderData.length?"":this._renderData[i]}},RC=class extends MC{_renderOne(e){return`
`}_shouldRenderThis(){return(this._renderLineHighlight==="line"||this._renderLineHighlight==="all")&&this._selectionIsEmpty&&(!this._renderLineHighlightOnlyWhenFocus||this._focused)}_shouldRenderOther(){return(this._renderLineHighlight==="gutter"||this._renderLineHighlight==="all")&&(!this._renderLineHighlightOnlyWhenFocus||this._focused)}},AC=class extends MC{_renderOne(e){return`
`}_shouldRenderMargin(){return(this._renderLineHighlight==="gutter"||this._renderLineHighlight==="all")&&(!this._renderLineHighlightOnlyWhenFocus||this._focused)}_shouldRenderThis(){return!0}_shouldRenderOther(){return(this._renderLineHighlight==="line"||this._renderLineHighlight==="all")&&this._selectionIsEmpty&&(!this._renderLineHighlightOnlyWhenFocus||this._focused)}};bt((s,e)=>{TC=!1;let t=s.getColor(AI);if(t&&(e.addRule(`.monaco-editor .view-overlays .current-line { background-color: ${t}; }`),e.addRule(`.monaco-editor .margin-view-overlays .current-line-margin { background-color: ${t}; border: none; }`)),!t||t.isTransparent()||s.defines(vC)){let i=s.getColor(vC);i&&(TC=!0,e.addRule(`.monaco-editor .view-overlays .current-line { border: 2px solid ${i}; }`),e.addRule(`.monaco-editor .margin-view-overlays .current-line-margin { border: 2px solid ${i}; }`),s.type==="hc"&&(e.addRule(".monaco-editor .view-overlays .current-line { border-width: 1px; }"),e.addRule(".monaco-editor .margin-view-overlays .current-line-margin { border-width: 1px; }")))}});var OC=class extends hn{constructor(e){super();this._context=e;let t=this._context.configuration.options;this._lineHeight=t.get(57),this._typicalHalfwidthCharacterWidth=t.get(41).typicalHalfwidthCharacterWidth,this._renderResult=null,this._context.addEventHandler(this)}dispose(){this._context.removeEventHandler(this),this._renderResult=null,super.dispose()}onConfigurationChanged(e){let t=this._context.configuration.options;return this._lineHeight=t.get(57),this._typicalHalfwidthCharacterWidth=t.get(41).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){let t=e.getDecorationsInViewport(),i=[],n=0;for(let l=0,c=t.length;l{if(l.options.zIndexc.options.zIndex)return 1;let h=l.options.className,d=c.options.className;return hd?1:D.compareRangesUsingStarts(l.range,c.range)});let r=e.visibleRange.startLineNumber,o=e.visibleRange.endLineNumber,a=[];for(let l=r;l<=o;l++){let c=l-r;a[c]=""}this._renderWholeLineDecorations(e,i,a),this._renderNormalDecorations(e,i,a),this._renderResult=a}_renderWholeLineDecorations(e,t,i){let n=String(this._lineHeight),r=e.visibleRange.startLineNumber,o=e.visibleRange.endLineNumber;for(let a=0,l=t.length;a',d=Math.max(c.range.startLineNumber,r),u=Math.min(c.range.endLineNumber,o);for(let f=d;f<=u;f++){let m=f-r;i[m]+=h}}}_renderNormalDecorations(e,t,i){let n=String(this._lineHeight),r=e.visibleRange.startLineNumber,o=null,a=!1,l=null;for(let c=0,h=t.length;c';a[u]+=b}}}render(e,t){if(!this._renderResult)return"";let i=t-e;return i<0||i>=this._renderResult.length?"":this._renderResult[i]}};var pr=class extends M{onclick(e,t){this._register(O(e,z.CLICK,i=>t(new Bt(i))))}onmousedown(e,t){this._register(O(e,z.MOUSE_DOWN,i=>t(new Bt(i))))}onmouseover(e,t){this._register(O(e,z.MOUSE_OVER,i=>t(new Bt(i))))}onnonbubblingmouseout(e,t){this._register(Pf(e,i=>t(new Bt(i))))}onkeydown(e,t){this._register(O(e,z.KEY_DOWN,i=>t(new De(i))))}onkeyup(e,t){this._register(O(e,z.KEY_UP,i=>t(new De(i))))}oninput(e,t){this._register(O(e,z.INPUT,t))}onblur(e,t){this._register(O(e,z.BLUR,t))}onfocus(e,t){this._register(O(e,z.FOCUS,t))}ignoreGesture(e){we.ignoreTarget(e)}};var xo=11,PC=class extends pr{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!="undefined"&&(this.bgDomNode.style.top="0px"),typeof e.left!="undefined"&&(this.bgDomNode.style.left="0px"),typeof e.bottom!="undefined"&&(this.bgDomNode.style.bottom="0px"),typeof e.right!="undefined"&&(this.bgDomNode.style.right="0px"),this.domNode=document.createElement("div"),this.domNode.className=e.className,this.domNode.classList.add(...e.icon.classNamesArray),this.domNode.style.position="absolute",this.domNode.style.width=xo+"px",this.domNode.style.height=xo+"px",typeof e.top!="undefined"&&(this.domNode.style.top=e.top+"px"),typeof e.left!="undefined"&&(this.domNode.style.left=e.left+"px"),typeof e.bottom!="undefined"&&(this.domNode.style.bottom=e.bottom+"px"),typeof e.right!="undefined"&&(this.domNode.style.right=e.right+"px"),this._mouseMoveMonitor=this._register(new cr),this.onmousedown(this.bgDomNode,t=>this._arrowMouseDown(t)),this.onmousedown(this.domNode,t=>this._arrowMouseDown(t)),this._mousedownRepeatTimer=this._register(new es),this._mousedownScheduleRepeatTimer=this._register(new Ut)}_arrowMouseDown(e){let t=()=>{this._mousedownRepeatTimer.cancelAndSet(()=>this._onActivate(),1e3/24)};this._onActivate(),this._mousedownRepeatTimer.cancel(),this._mousedownScheduleRepeatTimer.cancelAndSet(t,200),this._mouseMoveMonitor.startMonitoring(e.target,e.buttons,kc,i=>{},()=>{this._mousedownRepeatTimer.cancel(),this._mousedownScheduleRepeatTimer.cancel()}),e.preventDefault()}};var FC=class extends M{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 Ut)}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(){let 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&&this._domNode.setClassName(this._visibleClassName)},0))}_hide(e){this._revealTimer.cancel(),!!this._isVisible&&(this._isVisible=!1,this._domNode&&this._domNode.setClassName(this._invisibleClassName+(e?" fade":"")))}};var X4=140,gu=class extends pr{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 FC(e.visibility,"visible scrollbar "+e.extraScrollbarClassName,"invisible scrollbar "+e.extraScrollbarClassName)),this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._mouseMoveMonitor=this._register(new cr),this._shouldRender=!0,this.domNode=X(document.createElement("div")),this.domNode.setAttribute("role","presentation"),this.domNode.setAttribute("aria-hidden","true"),this._visibilityController.setDomNode(this.domNode),this.domNode.setPosition("absolute"),this.onmousedown(this.domNode.domNode,t=>this._domNodeMouseDown(t))}_createArrow(e){let t=this._register(new PC(e));this.domNode.domNode.appendChild(t.bgDomNode),this.domNode.domNode.appendChild(t.domNode)}_createSlider(e,t,i,n){this.slider=X(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.onmousedown(this.slider.domNode,r=>{r.leftButton&&(r.preventDefault(),this._sliderMouseDown(r,()=>{}))}),this.onclick(this.slider.domNode,r=>{r.leftButton&&r.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()))}_domNodeMouseDown(e){e.target===this.domNode.domNode&&this._onMouseDown(e)}delegateMouseDown(e){let t=this.domNode.domNode.getClientRects()[0].top,i=t+this._scrollbarState.getSliderPosition(),n=t+this._scrollbarState.getSliderPosition()+this._scrollbarState.getSliderSize(),r=this._sliderMousePosition(e);i<=r&&r<=n?e.leftButton&&(e.preventDefault(),this._sliderMouseDown(e,()=>{})):this._onMouseDown(e)}_onMouseDown(e){let t,i;if(e.target===this.domNode.domNode&&typeof e.browserEvent.offsetX=="number"&&typeof e.browserEvent.offsetY=="number")t=e.browserEvent.offsetX,i=e.browserEvent.offsetY;else{let r=ti(this.domNode.domNode);t=e.posx-r.left,i=e.posy-r.top}let n=this._mouseDownRelativePosition(t,i);this._setDesiredScrollPositionNow(this._scrollByPage?this._scrollbarState.getDesiredScrollPositionFromOffsetPaged(n):this._scrollbarState.getDesiredScrollPositionFromOffset(n)),e.leftButton&&(e.preventDefault(),this._sliderMouseDown(e,()=>{}))}_sliderMouseDown(e,t){let i=this._sliderMousePosition(e),n=this._sliderOrthogonalMousePosition(e),r=this._scrollbarState.clone();this.slider.toggleClassName("active",!0),this._mouseMoveMonitor.startMonitoring(e.target,e.buttons,kc,o=>{let a=this._sliderOrthogonalMousePosition(o),l=Math.abs(a-n);if(ot&&l>X4){this._setDesiredScrollPositionNow(r.getScrollPosition());return}let h=this._sliderMousePosition(o)-i;this._setDesiredScrollPositionNow(r.getDesiredScrollPositionFromDelta(h))},()=>{this.slider.toggleClassName("active",!1),this._host.onDragEnd(),t()}),this._host.onDragStart()}_setDesiredScrollPositionNow(e){let 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()}};var Q4=20,Do=class{constructor(e,t,i,n,r,o){this._scrollbarSize=Math.round(t),this._oppositeScrollbarSize=Math.round(i),this._arrowSize=Math.round(e),this._visibleSize=n,this._scrollSize=r,this._scrollPosition=o,this._computedAvailableSize=0,this._computedIsNeeded=!1,this._computedSliderSize=0,this._computedSliderRatio=0,this._computedSliderPosition=0,this._refreshComputedValues()}clone(){return new Do(this._arrowSize,this._scrollbarSize,this._oppositeScrollbarSize,this._visibleSize,this._scrollSize,this._scrollPosition)}setVisibleSize(e){let t=Math.round(e);return this._visibleSize!==t?(this._visibleSize=t,this._refreshComputedValues(),!0):!1}setScrollSize(e){let t=Math.round(e);return this._scrollSize!==t?(this._scrollSize=t,this._refreshComputedValues(),!0):!1}setScrollPosition(e){let 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,r){let o=Math.max(0,i-e),a=Math.max(0,o-2*t),l=n>0&&n>i;if(!l)return{computedAvailableSize:Math.round(o),computedIsNeeded:l,computedSliderSize:Math.round(a),computedSliderRatio:0,computedSliderPosition:0};let c=Math.round(Math.max(Q4,Math.floor(i*a/n))),h=(a-c)/(n-i),d=r*h;return{computedAvailableSize:Math.round(o),computedIsNeeded:l,computedSliderSize:Math.round(c),computedSliderRatio:h,computedSliderPosition:Math.round(d)}}_refreshComputedValues(){let e=Do._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;let t=e-this._arrowSize-this._computedSliderSize/2;return Math.round(t/this._computedSliderRatio)}getDesiredScrollPositionFromOffsetPaged(e){if(!this._computedIsNeeded)return 0;let t=e-this._arrowSize,i=this._scrollPosition;return tthis._host.onMouseWheel(new Mn(null,1,0))}),this._createArrow({className:"scra",icon:eO,top:a,left:void 0,bottom:void 0,right:o,bgWidth:t.arrowSize,bgHeight:t.horizontalScrollbarSize,onActivate:()=>this._host.onMouseWheel(new Mn(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}_mouseDownRelativePosition(e,t){return e}_sliderMousePosition(e){return e.posx}_sliderOrthogonalMousePosition(e){return e.posy}_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}};var tO=di("scrollbar-button-up",Le.triangleUp),iO=di("scrollbar-button-down",Le.triangleDown),WC=class extends gu{constructor(e,t,i){let n=e.getScrollDimensions(),r=e.getCurrentScrollPosition();super({lazyRender:t.lazyRender,host:i,scrollbarState:new Do(t.verticalHasArrows?t.arrowSize:0,t.vertical===2?0:t.verticalScrollbarSize,0,n.height,n.scrollHeight,r.scrollTop),visibility:t.vertical,extraScrollbarClassName:"vertical",scrollable:e,scrollByPage:t.scrollByPage});if(t.verticalHasArrows){let o=(t.arrowSize-xo)/2,a=(t.verticalScrollbarSize-xo)/2;this._createArrow({className:"scra",icon:tO,top:o,left:a,bottom:void 0,right:void 0,bgWidth:t.verticalScrollbarSize,bgHeight:t.arrowSize,onActivate:()=>this._host.onMouseWheel(new Mn(null,0,1))}),this._createArrow({className:"scra",icon:iO,top:void 0,left:a,bottom:o,right:void 0,bgWidth:t.verticalScrollbarSize,bgHeight:t.arrowSize,onActivate:()=>this._host.onMouseWheel(new Mn(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}_mouseDownRelativePosition(e,t){return t}_sliderMousePosition(e){return e.posy}_sliderOrthogonalMousePosition(e){return e.posx}_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}};var pu=class{constructor(e,t,i,n,r,o){this._scrollStateBrand=void 0,e=e|0,t=t|0,i=i|0,n=n|0,r=r|0,o=o|0,this.rawScrollLeft=i,this.rawScrollTop=o,e<0&&(e=0),i+e>t&&(i=t-e),i<0&&(i=0),n<0&&(n=0),o+n>r&&(o=r-n),o<0&&(o=0),this.width=e,this.scrollWidth=t,this.scrollLeft=i,this.height=n,this.scrollHeight=r,this.scrollTop=o}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 pu(typeof e.width!="undefined"?e.width:this.width,typeof e.scrollWidth!="undefined"?e.scrollWidth:this.scrollWidth,t?this.rawScrollLeft:this.scrollLeft,typeof e.height!="undefined"?e.height:this.height,typeof e.scrollHeight!="undefined"?e.scrollHeight:this.scrollHeight,t?this.rawScrollTop:this.scrollTop)}withScrollPosition(e){return new pu(this.width,this.scrollWidth,typeof e.scrollLeft!="undefined"?e.scrollLeft:this.rawScrollLeft,this.height,this.scrollHeight,typeof e.scrollTop!="undefined"?e.scrollTop:this.rawScrollTop)}createScrollEvent(e,t){let i=this.width!==e.width,n=this.scrollWidth!==e.scrollWidth,r=this.scrollLeft!==e.scrollLeft,o=this.height!==e.height,a=this.scrollHeight!==e.scrollHeight,l=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:r,heightChanged:o,scrollHeightChanged:a,scrollTopChanged:l}}},_r=class extends M{constructor(e,t){super();this._scrollableBrand=void 0,this._onScroll=this._register(new k),this.onScroll=this._onScroll.event,this._smoothScrollDuration=e,this._scheduleAtNextAnimationFrame=t,this._state=new pu(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){let i=this._state.withScrollDimensions(e,t);this._setState(i,Boolean(this._smoothScrolling)),this._smoothScrolling&&this._smoothScrolling.acceptScrollDimensions(this._state)}getFutureScrollPosition(){return this._smoothScrolling?this._smoothScrolling.to:this._state}getCurrentScrollPosition(){return this._state}setScrollPositionNow(e){let 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=="undefined"?this._smoothScrolling.to.scrollLeft:e.scrollLeft,scrollTop:typeof e.scrollTop=="undefined"?this._smoothScrolling.to.scrollTop:e.scrollTop};let i=this._state.withScrollPosition(e);if(this._smoothScrolling.to.scrollLeft===i.scrollLeft&&this._smoothScrolling.to.scrollTop===i.scrollTop)return;let n;t?n=new Fc(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{let i=this._state.withScrollPosition(e);this._smoothScrolling=Fc.start(this._state,i,this._smoothScrollDuration)}this._smoothScrolling.animationFrameDisposable=this._scheduleAtNextAnimationFrame(()=>{!this._smoothScrolling||(this._smoothScrolling.animationFrameDisposable=null,this._performSmoothScrolling())})}_performSmoothScrolling(){if(!this._smoothScrolling)return;let 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){let i=this._state;i.equals(e)||(this._state=e,this._onScroll.fire(this._state.createScrollEvent(i,t)))}},VC=class{constructor(e,t,i){this.scrollLeft=e,this.scrollTop=t,this.isDone=i}};function jC(s,e){let t=e-s;return function(i){return s+t*rO(i)}}function nO(s,e,t){return function(i){return i2.5*i){let r,o;return e0&&Math.abs(e.deltaY)>0)return 1;let t=.5,i=this._front===-1&&this._rear===-1?null:this._memory[this._rear];return(!this._isAlmostInt(e.deltaX)||!this._isAlmostInt(e.deltaY))&&(t+=.25),Math.min(Math.max(t,0),1)}_isAlmostInt(e){return Math.abs(Math.round(e)-e)<.01}};hp.INSTANCE=new hp;var zC=class extends pr{constructor(e,t,i){super();this._onScroll=this._register(new k),this.onScroll=this._onScroll.event,this._onWillScroll=this._register(new k),e.style.overflow="hidden",this._options=aO(t),this._scrollable=i,this._register(this._scrollable.onScroll(r=>{this._onWillScroll.fire(r),this._onDidScroll(r),this._onScroll.fire(r)}));let n={onMouseWheel:r=>this._onMouseWheel(r),onDragStart:()=>this._onDragStart(),onDragEnd:()=>this._onDragEnd()};this._verticalScrollbar=this._register(new WC(this._scrollable,this._options,n)),this._horizontalScrollbar=this._register(new BC(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=X(document.createElement("div")),this._leftShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._leftShadowDomNode.domNode),this._topShadowDomNode=X(document.createElement("div")),this._topShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._topShadowDomNode.domNode),this._topLeftShadowDomNode=X(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,r=>this._onMouseOver(r)),this.onnonbubblingmouseout(this._listenOnDomNode,r=>this._onMouseOut(r)),this._hideTimeout=this._register(new Ut),this._isDragging=!1,this._mouseIsOver=!1,this._shouldRender=!0,this._revealOnScroll=!0}dispose(){this._mouseWheelToDispose=me(this._mouseWheelToDispose),super.dispose()}getDomNode(){return this._domNode}getOverviewRulerLayoutInfo(){return{parent:this._domNode,insertBefore:this._verticalScrollbar.domNode.domNode}}delegateVerticalScrollbarMouseDown(e){this._verticalScrollbar.delegateMouseDown(e)}getScrollDimensions(){return this._scrollable.getScrollDimensions()}setScrollDimensions(e){this._scrollable.setScrollDimensions(e,!1)}updateClassName(e){this._options.className=e,ee&&(this._options.className+=" mac"),this._domNode.className="monaco-scrollable-element "+this._options.className}updateOptions(e){typeof e.handleMouseWheel!="undefined"&&(this._options.handleMouseWheel=e.handleMouseWheel,this._setListeningToMouseWheel(this._options.handleMouseWheel)),typeof e.mouseWheelScrollSensitivity!="undefined"&&(this._options.mouseWheelScrollSensitivity=e.mouseWheelScrollSensitivity),typeof e.fastScrollSensitivity!="undefined"&&(this._options.fastScrollSensitivity=e.fastScrollSensitivity),typeof e.scrollPredominantAxis!="undefined"&&(this._options.scrollPredominantAxis=e.scrollPredominantAxis),typeof e.horizontal!="undefined"&&(this._options.horizontal=e.horizontal),typeof e.vertical!="undefined"&&(this._options.vertical=e.vertical),typeof e.horizontalScrollbarSize!="undefined"&&(this._options.horizontalScrollbarSize=e.horizontalScrollbarSize),typeof e.verticalScrollbarSize!="undefined"&&(this._options.verticalScrollbarSize=e.verticalScrollbarSize),typeof e.scrollByPage!="undefined"&&(this._options.scrollByPage=e.scrollByPage),this._horizontalScrollbar.updateOptions(this._options),this._verticalScrollbar.updateOptions(this._options),this._options.lazyRender||this._render()}_setListeningToMouseWheel(e){if(this._mouseWheelToDispose.length>0!==e&&(this._mouseWheelToDispose=me(this._mouseWheelToDispose),e)){let i=n=>{this._onMouseWheel(new Mn(n))};this._mouseWheelToDispose.push(O(this._listenOnDomNode,z.MOUSE_WHEEL,i,{passive:!1}))}}_onMouseWheel(e){let t=hp.INSTANCE;if(YI){let r=window.devicePixelRatio/J1();ot||_t?t.accept(Date.now(),e.deltaX/r,e.deltaY/r):t.accept(Date.now(),e.deltaX,e.deltaY)}let i=!1;if(e.deltaY||e.deltaX){let r=e.deltaY*this._options.mouseWheelScrollSensitivity,o=e.deltaX*this._options.mouseWheelScrollSensitivity;this._options.scrollPredominantAxis&&(Math.abs(r)>=Math.abs(o)?o=0:r=0),this._options.flipAxes&&([r,o]=[o,r]);let a=!ee&&e.browserEvent&&e.browserEvent.shiftKey;(this._options.scrollYToX||a)&&!o&&(o=r,r=0),e.browserEvent&&e.browserEvent.altKey&&(o=o*this._options.fastScrollSensitivity,r=r*this._options.fastScrollSensitivity);let l=this._scrollable.getFutureScrollPosition(),c={};if(r){let h=l.scrollTop-GI*r;this._verticalScrollbar.writeScrollPosition(c,h)}if(o){let h=l.scrollLeft-GI*o;this._horizontalScrollbar.writeScrollPosition(c,h)}c=this._scrollable.validateScrollPosition(c),(l.scrollLeft!==c.scrollLeft||l.scrollTop!==c.scrollTop)&&(YI&&this._options.mouseWheelSmoothScroll&&t.isPhysicalMouseWheel()?this._scrollable.setScrollPositionSmooth(c):this._scrollable.setScrollPositionNow(c),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)){let e=this._scrollable.getCurrentScrollPosition(),t=e.scrollTop>0,i=e.scrollLeft>0,n=i?" left":"",r=t?" top":"",o=i||t?" top-left-corner":"";this._leftShadowDomNode.setClassName(`shadow${n}`),this._topShadowDomNode.setClassName(`shadow${r}`),this._topLeftShadowDomNode.setClassName(`shadow${o}${r}${n}`)}}_onDragStart(){this._isDragging=!0,this._reveal()}_onDragEnd(){this._isDragging=!1,this._hide()}_onMouseOut(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(),oO)}},dp=class extends zC{constructor(e,t){t=t||{},t.mouseWheelSmoothScroll=!1;let i=new _r(0,n=>Ti(n));super(e,t,i);this._register(i)}setScrollPosition(e){this._scrollable.setScrollPositionNow(e)}},Qa=class extends zC{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()}},_u=class extends dp{constructor(e,t){super(e,t);this._element=e,this.onScroll(i=>{i.scrollTopChanged&&(this._element.scrollTop=i.scrollTop),i.scrollLeftChanged&&(this._element.scrollLeft=i.scrollLeft)}),this.scanDomNode()}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 aO(s){let e={lazyRender:typeof s.lazyRender!="undefined"?s.lazyRender:!1,className:typeof s.className!="undefined"?s.className:"",useShadows:typeof s.useShadows!="undefined"?s.useShadows:!0,handleMouseWheel:typeof s.handleMouseWheel!="undefined"?s.handleMouseWheel:!0,flipAxes:typeof s.flipAxes!="undefined"?s.flipAxes:!1,consumeMouseWheelIfScrollbarIsNeeded:typeof s.consumeMouseWheelIfScrollbarIsNeeded!="undefined"?s.consumeMouseWheelIfScrollbarIsNeeded:!1,alwaysConsumeMouseWheel:typeof s.alwaysConsumeMouseWheel!="undefined"?s.alwaysConsumeMouseWheel:!1,scrollYToX:typeof s.scrollYToX!="undefined"?s.scrollYToX:!1,mouseWheelScrollSensitivity:typeof s.mouseWheelScrollSensitivity!="undefined"?s.mouseWheelScrollSensitivity:1,fastScrollSensitivity:typeof s.fastScrollSensitivity!="undefined"?s.fastScrollSensitivity:5,scrollPredominantAxis:typeof s.scrollPredominantAxis!="undefined"?s.scrollPredominantAxis:!0,mouseWheelSmoothScroll:typeof s.mouseWheelSmoothScroll!="undefined"?s.mouseWheelSmoothScroll:!0,arrowSize:typeof s.arrowSize!="undefined"?s.arrowSize:11,listenOnDomNode:typeof s.listenOnDomNode!="undefined"?s.listenOnDomNode:null,horizontal:typeof s.horizontal!="undefined"?s.horizontal:1,horizontalScrollbarSize:typeof s.horizontalScrollbarSize!="undefined"?s.horizontalScrollbarSize:10,horizontalSliderSize:typeof s.horizontalSliderSize!="undefined"?s.horizontalSliderSize:0,horizontalHasArrows:typeof s.horizontalHasArrows!="undefined"?s.horizontalHasArrows:!1,vertical:typeof s.vertical!="undefined"?s.vertical:1,verticalScrollbarSize:typeof s.verticalScrollbarSize!="undefined"?s.verticalScrollbarSize:10,verticalHasArrows:typeof s.verticalHasArrows!="undefined"?s.verticalHasArrows:!1,verticalSliderSize:typeof s.verticalSliderSize!="undefined"?s.verticalSliderSize:0,scrollByPage:typeof s.scrollByPage!="undefined"?s.scrollByPage:!1};return e.horizontalSliderSize=typeof s.horizontalSliderSize!="undefined"?s.horizontalSliderSize:e.horizontalScrollbarSize,e.verticalSliderSize=typeof s.verticalSliderSize!="undefined"?s.verticalSliderSize:e.verticalScrollbarSize,ee&&(e.className+=" mac"),e}var HC=class extends st{constructor(e,t,i,n){super(e);let r=this._context.configuration.options,o=r.get(91),a=r.get(65),l=r.get(32),c=r.get(94),h={listenOnDomNode:i.domNode,className:"editor-scrollable "+ga(e.theme.type),useShadows:!1,lazyRender:!0,vertical:o.vertical,horizontal:o.horizontal,verticalHasArrows:o.verticalHasArrows,horizontalHasArrows:o.horizontalHasArrows,verticalScrollbarSize:o.verticalScrollbarSize,verticalSliderSize:o.verticalSliderSize,horizontalScrollbarSize:o.horizontalScrollbarSize,horizontalSliderSize:o.horizontalSliderSize,handleMouseWheel:o.handleMouseWheel,alwaysConsumeMouseWheel:o.alwaysConsumeMouseWheel,arrowSize:o.arrowSize,mouseWheelScrollSensitivity:a,fastScrollSensitivity:l,scrollPredominantAxis:c,scrollByPage:o.scrollByPage};this.scrollbar=this._register(new Qa(t.domNode,h,this._context.viewLayout.getScrollable())),Xt.write(this.scrollbar.getDomNode(),5),this.scrollbarDomNode=X(this.scrollbar.getDomNode()),this.scrollbarDomNode.setPosition("absolute"),this._setLayout();let d=(u,f,m)=>{let g={};if(f){let b=u.scrollTop;b&&(g.scrollTop=this._context.viewLayout.getCurrentScrollTop()+b,u.scrollTop=0)}if(m){let b=u.scrollLeft;b&&(g.scrollLeft=this._context.viewLayout.getCurrentScrollLeft()+b,u.scrollLeft=0)}this._context.model.setScrollPosition(g,1)};this._register(O(i.domNode,"scroll",u=>d(i.domNode,!0,!0))),this._register(O(t.domNode,"scroll",u=>d(t.domNode,!0,!1))),this._register(O(n.domNode,"scroll",u=>d(n.domNode,!0,!1))),this._register(O(this.scrollbarDomNode.domNode,"scroll",u=>d(this.scrollbarDomNode.domNode,!0,!1)))}dispose(){super.dispose()}_setLayout(){let e=this._context.configuration.options,t=e.get(129);this.scrollbarDomNode.setLeft(t.contentLeft),e.get(63).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}delegateVerticalScrollbarMouseDown(e){this.scrollbar.delegateVerticalScrollbarMouseDown(e)}onConfigurationChanged(e){if(e.hasChanged(91)||e.hasChanged(65)||e.hasChanged(32)){let t=this._context.configuration.options,i=t.get(91),n=t.get(65),r=t.get(32),o=t.get(94),a={vertical:i.vertical,horizontal:i.horizontal,verticalScrollbarSize:i.verticalScrollbarSize,horizontalScrollbarSize:i.horizontalScrollbarSize,scrollByPage:i.scrollByPage,handleMouseWheel:i.handleMouseWheel,mouseWheelScrollSensitivity:n,fastScrollSensitivity:r,scrollPredominantAxis:o};this.scrollbar.updateOptions(a)}return e.hasChanged(129)&&this._setLayout(),!0}onScrollChanged(e){return!0}onThemeChanged(e){return this.scrollbar.updateClassName("editor-scrollable "+ga(this._context.theme.type)),!0}prepareRender(e){}render(e){this.scrollbar.renderNow()}};var Ja=class{constructor(e,t,i){this._decorationToRenderBrand=void 0,this.startLineNumber=+e,this.endLineNumber=+t,this.className=String(i)}},Bc=class extends hn{_render(e,t,i){let n=[];for(let a=e;a<=t;a++){let l=a-e;n[l]=[]}if(i.length===0)return n;i.sort((a,l)=>a.className===l.className?a.startLineNumber===l.startLineNumber?a.endLineNumber-l.endLineNumber:a.startLineNumber-l.startLineNumber:a.className',c=[];for(let h=t;h<=i;h++){let d=h-t,u=n[d];u.length===0?c[d]="":c[d]='
=this._renderResult.length?"":this._renderResult[i]}};var $C=class extends hn{constructor(e){super();this._context=e,this._primaryLineNumber=0;let t=this._context.configuration.options,i=t.get(130),n=t.get(41);this._lineHeight=t.get(57),this._spaceWidth=n.spaceWidth,this._enabled=t.get(82),this._activeIndentEnabled=t.get(50),this._maxIndentLeft=i.wrappingColumn===-1?-1:i.wrappingColumn*n.typicalHalfwidthCharacterWidth,this._renderResult=null,this._context.addEventHandler(this)}dispose(){this._context.removeEventHandler(this),this._renderResult=null,super.dispose()}onConfigurationChanged(e){let t=this._context.configuration.options,i=t.get(130),n=t.get(41);return this._lineHeight=t.get(57),this._spaceWidth=n.spaceWidth,this._enabled=t.get(82),this._activeIndentEnabled=t.get(50),this._maxIndentLeft=i.wrappingColumn===-1?-1:i.wrappingColumn*n.typicalHalfwidthCharacterWidth,!0}onCursorStateChanged(e){let t=e.selections[0],i=t.isEmpty()?t.positionLineNumber:0;return this._primaryLineNumber!==i?(this._primaryLineNumber=i,!0):!1}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._enabled){this._renderResult=null;return}let t=e.visibleRange.startLineNumber,i=e.visibleRange.endLineNumber,{indentSize:n}=this._context.model.getTextModelOptions(),r=n*this._spaceWidth,o=e.scrollWidth,a=this._lineHeight,l=this._context.model.getLinesIndentGuides(t,i),c=0,h=0,d=0;if(this._activeIndentEnabled&&this._primaryLineNumber){let f=this._context.model.getActiveIndentGuide(this._primaryLineNumber,t,i);c=f.startLineNumber,h=f.endLineNumber,d=f.indent}let u=[];for(let f=t;f<=i;f++){let m=c<=f&&f<=h,g=f-t,b=l[g],w="";if(b>=1){let _=e.visibleRangeForPosition(new N(f,1)),v=_?_.left:0;for(let C=1;C<=b&&(w+=`
`,v+=r,!(v>o||this._maxIndentLeft>0&&v>this._maxIndentLeft));C++);}u[g]=w}this._renderResult=u}render(e,t){if(!this._renderResult)return"";let i=t-e;return i<0||i>=this._renderResult.length?"":this._renderResult[i]}};bt((s,e)=>{let t=s.getColor(Ac);t&&e.addRule(`.monaco-editor .lines-content .cigr { box-shadow: 1px 0 0 0 ${t} inset; }`);let i=s.getColor(Oc)||t;i&&e.addRule(`.monaco-editor .lines-content .cigra { box-shadow: 1px 0 0 0 ${i} inset; }`)});var XI=class{constructor(){this._currentVisibleRange=new D(1,1,1,1)}getCurrentVisibleRange(){return this._currentVisibleRange}setCurrentVisibleRange(e){this._currentVisibleRange=e}},QI=class{constructor(e,t,i,n,r,o){this.lineNumber=e,this.startColumn=t,this.endColumn=i,this.startScrollTop=n,this.stopScrollTop=r,this.scrollType=o,this.type="range",this.minLineNumber=e,this.maxLineNumber=e}},JI=class{constructor(e,t,i,n){this.selections=e,this.startScrollTop=t,this.stopScrollTop=i,this.scrollType=n,this.type="selections";let r=e[0].startLineNumber,o=e[0].endLineNumber;for(let a=1,l=e.length;a{this._updateLineWidthsSlow()},200),this._asyncCheckMonospaceFontAssumptions=new $e(()=>{this._checkMonospaceFontAssumptions()},2e3),this._lastRenderedData=new XI,this._horizontalRevealRequest=null}dispose(){this._asyncUpdateLineWidths.dispose(),this._asyncCheckMonospaceFontAssumptions.dispose(),super.dispose()}getDomNode(){return this.domNode}createVisibleLine(){return new ln(this._viewLineOptions)}onConfigurationChanged(e){this._visibleLines.onConfigurationChanged(e),e.hasChanged(130)&&(this._maxLineWidth=0);let t=this._context.configuration.options,i=t.get(41),n=t.get(130);return this._lineHeight=t.get(57),this._typicalHalfwidthCharacterWidth=i.typicalHalfwidthCharacterWidth,this._isViewportWrapping=n.isViewportWrapping,this._revealHorizontalRightPadding=t.get(88),this._cursorSurroundingLines=t.get(23),this._cursorSurroundingLinesStyle=t.get(24),this._canUseLayerHinting=!t.get(26),mt.applyFontInfo(this.domNode,i),this._onOptionsMaybeChanged(),e.hasChanged(129)&&(this._maxLineWidth=0),!0}_onOptionsMaybeChanged(){let e=this._context.configuration,t=new Xg(e,this._context.theme.type);if(!this._viewLineOptions.equals(t)){this._viewLineOptions=t;let i=this._visibleLines.getStartLineNumber(),n=this._visibleLines.getEndLineNumber();for(let r=i;r<=n;r++)this._visibleLines.getVisibleLine(r).onOptionsChanged(this._viewLineOptions);return!0}return!1}onCursorStateChanged(e){let t=this._visibleLines.getStartLineNumber(),i=this._visibleLines.getEndLineNumber(),n=!1;for(let r=t;r<=i;r++)n=this._visibleLines.getVisibleLine(r).onSelectionChanged()||n;return n}onDecorationsChanged(e){{let t=this._visibleLines.getStartLineNumber(),i=this._visibleLines.getEndLineNumber();for(let n=t;n<=i;n++)this._visibleLines.getVisibleLine(n).onDecorationsChanged()}return!0}onFlushed(e){let t=this._visibleLines.onFlushed(e);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){let t=this._computeScrollTopToRevealRange(this._context.viewLayout.getFutureViewport(),e.source,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 QI(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 JI(e.selections,this._context.viewLayout.getCurrentScrollTop(),i.scrollTop,e.scrollType)):this._horizontalRevealRequest=null;let r=Math.abs(this._context.viewLayout.getCurrentScrollTop()-i.scrollTop)<=this._lineHeight?1:e.scrollType;return this._context.model.setScrollPosition(i,r),!0}onScrollChanged(e){if(this._horizontalRevealRequest&&e.scrollLeftChanged&&(this._horizontalRevealRequest=null),this._horizontalRevealRequest&&e.scrollTopChanged){let t=Math.min(this._horizontalRevealRequest.startScrollTop,this._horizontalRevealRequest.stopScrollTop),i=Math.max(this._horizontalRevealRequest.startScrollTop,this._horizontalRevealRequest.stopScrollTop);(e.scrollTopi)&&(this._horizontalRevealRequest=null)}return this.domNode.setWidth(e.scrollWidth),this._visibleLines.onScrollChanged(e)||!0}onTokensChanged(e){return this._visibleLines.onTokensChanged(e)}onZonesChanged(e){return this._context.model.setMaxLineWidth(this._maxLineWidth),this._visibleLines.onZonesChanged(e)}onThemeChanged(e){return this._onOptionsMaybeChanged()}getPositionFromDOMInfo(e,t){let i=this._getViewLineDomNode(e);if(i===null)return null;let n=this._getLineNumberFor(i);if(n===-1||n<1||n>this._context.model.getLineCount())return null;if(this._context.model.getLineMaxColumn(n)===1)return new N(n,1);let r=this._visibleLines.getStartLineNumber(),o=this._visibleLines.getEndLineNumber();if(no)return null;let a=this._visibleLines.getVisibleLine(n).getColumnOfNodeOffset(n,e,t),l=this._context.model.getLineMinColumn(n);return ai?-1:this._visibleLines.getVisibleLine(e).getWidth()}linesVisibleRangesForRange(e,t){if(this.shouldRender())return null;let i=e.endLineNumber,n=D.intersectRanges(e,this._lastRenderedData.getCurrentVisibleRange());if(!n)return null;let r=[],o=0,a=new Zg(this.domNode.domNode,this._textRangeRestingSpot),l=0;t&&(l=this._context.model.coordinatesConverter.convertViewPositionToModelPosition(new N(n.startLineNumber,1)).lineNumber);let c=this._visibleLines.getStartLineNumber(),h=this._visibleLines.getEndLineNumber();for(let d=n.startLineNumber;d<=n.endLineNumber;d++){if(dh)continue;let u=d===n.startLineNumber?n.startColumn:1,f=d===n.endLineNumber?n.endColumn:this._context.model.getLineMaxColumn(d),m=this._visibleLines.getVisibleLine(d).getVisibleRangesForRange(u,f,a);if(!!m){if(t&&dthis._visibleLines.getEndLineNumber()?null:this._visibleLines.getVisibleLine(e).getVisibleRangesForRange(t,i,new Zg(this.domNode.domNode,this._textRangeRestingSpot))}visibleRangeForPosition(e){let t=this._visibleRangesForLineRange(e.lineNumber,e.column,e.column);return t?new tC(t.outsideRenderedLine,t.ranges[0].left):null}updateLineWidths(){this._updateLineWidths(!1)}_updateLineWidthsFast(){return this._updateLineWidths(!0)}_updateLineWidthsSlow(){this._updateLineWidths(!1)}_updateLineWidths(e){let t=this._visibleLines.getStartLineNumber(),i=this._visibleLines.getEndLineNumber(),n=1,r=!0;for(let o=t;o<=i;o++){let a=this._visibleLines.getVisibleLine(o);if(e&&!a.getWidthIsFast()){r=!1;continue}n=Math.max(n,a.getWidth())}return r&&t===1&&i===this._context.model.getLineCount()&&(this._maxLineWidth=0),this._ensureMaxLineWidth(n),r}_checkMonospaceFontAssumptions(){let e=-1,t=-1,i=this._visibleLines.getStartLineNumber(),n=this._visibleLines.getEndLineNumber();for(let r=i;r<=n;r++){let o=this._visibleLines.getVisibleLine(r);if(o.needsMonospaceFontCheck()){let a=o.getWidth();a>t&&(t=a,e=r)}}if(e!==-1&&!this._visibleLines.getVisibleLine(e).monospaceAssumptionsAreValid())for(let r=i;r<=n;r++)this._visibleLines.getVisibleLine(r).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){let i=this._horizontalRevealRequest;if(e.startLineNumber<=i.minLineNumber&&i.maxLineNumber<=e.endLineNumber){this._horizontalRevealRequest=null,this.onDidRender();let n=this._computeScrollLeftToReveal(i);n&&(this._isViewportWrapping||this._ensureMaxLineWidth(n.maxHorizontalOffset),this._context.model.setScrollPosition({scrollLeft:n.scrollLeft},i.scrollType))}}if(this._updateLineWidthsFast()||this._asyncUpdateLineWidths.schedule(),_t&&!this._asyncCheckMonospaceFontAssumptions.isScheduled()){let i=this._visibleLines.getStartLineNumber(),n=this._visibleLines.getEndLineNumber();for(let r=i;r<=n;r++)if(this._visibleLines.getVisibleLine(r).needsMonospaceFontCheck()){this._asyncCheckMonospaceFontAssumptions.schedule();break}}this._linesContent.setLayerHinting(this._canUseLayerHinting),this._linesContent.setContain("strict");let t=this._context.viewLayout.getCurrentScrollTop()-e.bigNumbersDelta;this._linesContent.setTop(-t),this._linesContent.setLeft(-this._context.viewLayout.getCurrentScrollLeft())}_ensureMaxLineWidth(e){let t=Math.ceil(e);this._maxLineWidth0){let m=n[0].startLineNumber,g=n[0].endLineNumber;for(let b=1,w=n.length;ba){if(!c)return-1;f=h}else if(r===5||r===6)if(r===6&&o<=h&&d<=l)f=o;else{let m=Math.max(5*this._lineHeight,a*.2),g=h-m,b=d-a;f=Math.max(b,g)}else if(r===1||r===2)if(r===2&&o<=h&&d<=l)f=o;else{let m=(h+d)/2;f=Math.max(0,m-a/2)}else f=this._computeMinimumScrolling(o,l,h,d,r===3,r===4);return f}_computeScrollLeftToReveal(e){let t=this._context.viewLayout.getCurrentViewport(),i=t.left,n=i+t.width,r=1073741824,o=0;if(e.type==="range"){let l=this._visibleRangesForLineRange(e.lineNumber,e.startColumn,e.endColumn);if(!l)return null;for(let c of l.ranges)r=Math.min(r,c.left),o=Math.max(o,c.left+c.width)}else for(let l of e.selections){if(l.startLineNumber!==l.endLineNumber)return null;let c=this._visibleRangesForLineRange(l.startLineNumber,l.startColumn,l.endColumn);if(!c)return null;for(let h of c.ranges)r=Math.min(r,h.left),o=Math.max(o,h.left+h.width)}return r=Math.max(0,r-Wc.HORIZONTAL_EXTRA_PX),o+=this._revealHorizontalRightPadding,e.type==="selections"&&o-r>t.width?null:{scrollLeft:this._computeMinimumScrolling(i,n,r,o),maxHorizontalOffset:o}}_computeMinimumScrolling(e,t,i,n,r,o){e=e|0,t=t|0,i=i|0,n=n|0,r=!!r,o=!!o;let a=t-e;if(n-it)return Math.max(0,n-a)}else return i;return e}};Wc.HORIZONTAL_EXTRA_PX=30;var KC=class extends Bc{constructor(e){super();this._context=e;let i=this._context.configuration.options.get(129);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){let i=this._context.configuration.options.get(129);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){let t=e.getDecorationsInViewport(),i=[],n=0;for(let r=0,o=t.length;r
',l=[];for(let c=t;c<=i;c++){let h=c-t,d=n[h],u="";for(let f=0,m=d.length;f';r[a]=c}this._renderResult=r}render(e,t){return this._renderResult?this._renderResult[t-e]:""}};var Zi=class{constructor(e,t,i,n){this._rgba8Brand=void 0,this.r=Zi._clamp(e),this.g=Zi._clamp(t),this.b=Zi._clamp(i),this.a=Zi._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}};Zi.Empty=new Zi(0,0,0,0);var Eo=class extends M{constructor(){super();this._onDidChange=new k,this.onDidChange=this._onDidChange.event,this._updateColorMap(),this._register(Pe.onDidChange(e=>{e.changedColorMap&&this._updateColorMap()}))}static getInstance(){return this._INSTANCE||(this._INSTANCE=W1(new Eo)),this._INSTANCE}_updateColorMap(){let e=Pe.getColorMap();if(!e){this._colors=[Zi.Empty],this._backgroundIsLight=!0;return}this._colors=[Zi.Empty];for(let i=1;i=.5,this._onDidChange.fire(void 0)}getColor(e){return(e<1||e>=this._colors.length)&&(e=2),this._colors[e]}backgroundIsLight(){return this._backgroundIsLight}};Eo._INSTANCE=null;var eN=(()=>{let s=[];for(let e=32;e<=126;e++)s.push(e);return s.push(65533),s})(),tN=(s,e)=>(s-=32,s<0||s>96?e<=2?(s+96)%96:96-1:s);var el=class{constructor(e,t){this.scale=t,this._minimapCharRendererBrand=void 0,this.charDataNormal=el.soften(e,12/15),this.charDataLight=el.soften(e,50/60)}static soften(e,t){let i=new Uint8ClampedArray(e.length);for(let n=0,r=e.length;ne.width||i+u>e.height){console.warn("bad render request outside image data");return}let f=l?this.charDataLight:this.charDataNormal,m=tN(n,a),g=e.width*4,b=o.r,w=o.g,_=o.b,v=r.r-b,C=r.g-w,y=r.b-_,x=e.data,S=m*h*d,L=i*g+t*4;for(let E=0;Ee.width||i+h>e.height){console.warn("bad render request outside image data");return}let d=e.width*4,u=.5,f=r.r,m=r.g,g=r.b,b=n.r-f,w=n.g-m,_=n.b-g,v=f+b*u,C=m+w*u,y=g+_*u,x=e.data,S=i*d+t*4;for(let L=0;L{let e=new Uint8ClampedArray(s.length/2);for(let t=0;t>1]=iN[s[t]]<<4|iN[s[t+1]]&15;return e},GC={1:pn(()=>nN("0000511D6300CF609C709645A78432005642574171487021003C451900274D35D762755E8B629C5BA856AF57BA649530C167D1512A272A3F6038604460398526BCA2A968DB6F8957C768BE5FBE2FB467CF5D8D5B795DC7625B5DFF50DE64C466DB2FC47CD860A65E9A2EB96CB54CE06DA763AB2EA26860524D3763536601005116008177A8705E53AB738E6A982F88BAA35B5F5B626D9C636B449B737E5B7B678598869A662F6B5B8542706C704C80736A607578685B70594A49715A4522E792")),2:pn(()=>nN("000000000000000055394F383D2800008B8B1F210002000081B1CBCBCC820000847AAF6B9AAF2119BE08B8881AD60000A44FD07DCCF107015338130C00000000385972265F390B406E2437634B4B48031B12B8A0847000001E15B29A402F0000000000004B33460B00007A752C2A0000000000004D3900000084394B82013400ABA5CFC7AD9C0302A45A3E5A98AB000089A43382D97900008BA54AA087A70A0248A6A7AE6DBE0000BF6F94987EA40A01A06DCFA7A7A9030496C32F77891D0000A99FB1A0AFA80603B29AB9CA75930D010C0948354D3900000C0948354F37460D0028BE673D8400000000AF9D7B6E00002B007AA8933400007AA642675C2700007984CFB9C3985B768772A8A6B7B20000CAAECAAFC4B700009F94A6009F840009D09F9BA4CA9C0000CC8FC76DC87F0000C991C472A2000000A894A48CA7B501079BA2C9C69BA20000B19A5D3FA89000005CA6009DA2960901B0A7F0669FB200009D009E00B7890000DAD0F5D092820000D294D4C48BD10000B5A7A4A3B1A50402CAB6CBA6A2000000B5A7A4A3B1A8044FCDADD19D9CB00000B7778F7B8AAE0803C9AB5D3F5D3F00009EA09EA0BAB006039EA0989A8C7900009B9EF4D6B7C00000A9A7816CACA80000ABAC84705D3F000096DA635CDC8C00006F486F266F263D4784006124097B00374F6D2D6D2D6D4A3A95872322000000030000000000008D8939130000000000002E22A5C9CBC70600AB25C0B5C9B400061A2DB04CA67001082AA6BEBEBFC606002321DACBC19E03087AA08B6768380000282FBAC0B8CA7A88AD25BBA5A29900004C396C5894A6000040485A6E356E9442A32CD17EADA70000B4237923628600003E2DE9C1D7B500002F25BBA5A2990000231DB6AFB4A804023025C0B5CAB588062B2CBDBEC0C706882435A75CA20000002326BD6A82A908048B4B9A5A668000002423A09CB4BB060025259C9D8A7900001C1FCAB2C7C700002A2A9387ABA200002626A4A47D6E9D14333163A0C87500004B6F9C2D643A257049364936493647358A34438355497F1A0000A24C1D590000D38DFFBDD4CD3126"))};var tl=class{static create(e,t){if(this.lastCreated&&e===this.lastCreated.scale&&t===this.lastFontFamily)return this.lastCreated;let i;return GC[e]?i=new el(GC[e](),e):i=tl.createFromSampleData(tl.createSampleData(t).data,e),this.lastFontFamily=t,this.lastCreated=i,i}static createSampleData(e){let t=document.createElement("canvas"),i=t.getContext("2d");t.style.height=`${16}px`,t.height=16,t.width=96*10,t.style.width=96*10+"px",i.fillStyle="#ffffff",i.font=`bold ${16}px ${e}`,i.textBaseline="middle";let n=0;for(let r of eN)i.fillText(String.fromCharCode(r),n,16/2),n+=10;return i.getImageData(0,0,96*10,16)}static createFromSampleData(e,t){let i=16*10*4*96;if(e.length!==i)throw new Error("Unexpected source in MinimapCharRenderer");let n=tl._downsample(e,t);return new el(n,t)}static _downsampleChar(e,t,i,n,r){let o=1*r,a=2*r,l=n,c=0;for(let h=0;h0){let c=255/l;for(let h=0;htl.create(this.fontScale,l.fontFamily)),this.backgroundColor=bu._getMinimapBackground(t,i)}static _getMinimapBackground(e,t){let i=e.getColor(wC);return i?new Zi(i.rgba.r,i.rgba.g,i.rgba.b,i.rgba.a):t.getColor(2)}equals(e){return this.renderMinimap===e.renderMinimap&&this.size===e.size&&this.minimapHeightIsEditorHeight===e.minimapHeightIsEditorHeight&&this.scrollBeyondLastLine===e.scrollBeyondLastLine&&this.showSlider===e.showSlider&&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.backgroundColor&&this.backgroundColor.equals(e.backgroundColor)}},Vc=class{constructor(e,t,i,n,r,o,a,l){this.scrollTop=e,this.scrollHeight=t,this.sliderNeeded=i,this._computedSliderRatio=n,this.sliderTop=r,this.sliderHeight=o,this.startLineNumber=a,this.endLineNumber=l}getDesiredScrollTopFromDelta(e){return Math.round(this.scrollTop+e/this._computedSliderRatio)}getDesiredScrollTopFromTouchLocation(e){return Math.round((e-this.sliderHeight/2)/this._computedSliderRatio)}static create(e,t,i,n,r,o,a,l,c,h,d){let u=e.pixelRatio,f=e.minimapLineHeight,m=Math.floor(e.canvasInnerHeight/f),g=e.lineHeight;if(e.minimapHeightIsEditorHeight){let y=l*e.lineHeight+(e.scrollBeyondLastLine?r-e.lineHeight:0),x=Math.max(1,Math.floor(r*r/y)),S=Math.max(0,e.minimapHeight-x),L=S/(h-r),E=c*L,T=S>0,I=Math.floor(e.canvasInnerHeight/e.minimapLineHeight);return new Vc(c,h,T,L,E,x,1,Math.min(a,I))}let b;if(o&&i!==a){let y=i-t+1;b=Math.floor(y*f/u)}else{let y=r/g;b=Math.floor(y*f/u)}let w;e.scrollBeyondLastLine?w=(a-1)*f/u:w=Math.max(0,a*f/u-b),w=Math.min(e.minimapHeight-b,w);let _=w/(h-r),v=c*_,C=0;if(e.scrollBeyondLastLine&&(C=r/g-1),m>=a+C){let y=1,x=a,S=w>0;return new Vc(c,h,S,_,v,b,y,x)}else{let y=Math.max(1,Math.floor(t-v*u/f));d&&d.scrollHeight===h&&(d.scrollTop>c&&(y=Math.min(y,d.startLineNumber)),d.scrollTopwu.INVALID),this._renderedLines._set(e.startLineNumber,i)}linesEquals(e){if(!this.scrollEquals(e))return!1;let i=this._renderedLines._get().lines;for(let n=0,r=i.length;n1){for(let C=0,y=a-1;C0&&this.minimapLines[i-1]>=e;)i--;let n=this.modelLineToMinimapLine(t)-1;for(;n+1t)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){let t=e.toLineNumber-e.fromLineNumber+1,i=this.minimapLines.length,n=0;for(let r=this.minimapLines.length-1;r>=0&&!(this.minimapLines[r]=0&&!(this.minimapLines[i]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;let e=Boolean(this._samplingState),[t,i]=jc.compute(this.options,this._context.model.getLineCount(),this._samplingState);if(this._samplingState=t,e&&this._samplingState)for(let 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.model.getLineCount()}getRealLineCount(){return this._context.model.getLineCount()}getLineContent(e){return this._samplingState?this._context.model.getLineContent(this._samplingState.minimapLines[e-1]):this._context.model.getLineContent(e)}getMinimapLinesRenderingData(e,t,i){if(this._samplingState){let n=[];for(let r=0,o=t-e+1;r{if(i.preventDefault(),this._model.options.renderMinimap===0||!this._lastRenderData)return;if(this._model.options.size!=="proportional"){if(i.leftButton&&this._lastRenderData){let c=ti(this._slider.domNode),h=c.top+c.height/2;this._startSliderDragging(i.buttons,i.posx,h,i.posy,this._lastRenderData.renderedLayout)}return}let r=this._model.options.minimapLineHeight,o=this._model.options.canvasInnerHeight/this._model.options.canvasOuterHeight*i.browserEvent.offsetY,l=Math.floor(o/r)+this._lastRenderData.renderedLayout.startLineNumber;l=Math.min(l,this._model.getLineCount()),this._model.revealLineNumber(l)}),this._sliderMouseMoveMonitor=new cr,this._sliderMouseDownListener=lt(this._slider.domNode,"mousedown",i=>{i.preventDefault(),i.stopPropagation(),i.leftButton&&this._lastRenderData&&this._startSliderDragging(i.buttons,i.posx,i.posy,i.posy,this._lastRenderData.renderedLayout)}),this._gestureDisposable=we.addTarget(this._domNode.domNode),this._sliderTouchStartListener=O(this._domNode.domNode,Re.Start,i=>{i.preventDefault(),i.stopPropagation(),this._lastRenderData&&(this._slider.toggleClassName("active",!0),this._gestureInProgress=!0,this.scrollDueToTouchEvent(i))},{passive:!1}),this._sliderTouchMoveListener=O(this._domNode.domNode,Re.Change,i=>{i.preventDefault(),i.stopPropagation(),this._lastRenderData&&this._gestureInProgress&&this.scrollDueToTouchEvent(i)},{passive:!1}),this._sliderTouchEndListener=lt(this._domNode.domNode,Re.End,i=>{i.preventDefault(),i.stopPropagation(),this._gestureInProgress=!1,this._slider.toggleClassName("active",!1)})}_startSliderDragging(e,t,i,n,r){this._slider.toggleClassName("active",!0);let o=(a,l)=>{let c=Math.abs(l-t);if(ot&&c>lO){this._model.setScrollTop(r.scrollTop);return}let h=a-i;this._model.setScrollTop(r.getDesiredScrollTopFromDelta(h))};n!==i&&o(n,t),this._sliderMouseMoveMonitor.startMonitoring(this._slider.domNode,e,kc,a=>o(a.posy,a.posx),()=>{this._slider.toggleClassName("active",!1)})}scrollDueToTouchEvent(e){let t=this._domNode.domNode.getBoundingClientRect().top,i=this._lastRenderData.renderedLayout.getDesiredScrollTopFromTouchLocation(e.pageY-t);this._model.setScrollTop(i)}dispose(){this._mouseDownListener.dispose(),this._sliderMouseMoveMonitor.dispose(),this._sliderMouseDownListener.dispose(),this._gestureDisposable.dispose(),this._sliderTouchStartListener.dispose(),this._sliderTouchMoveListener.dispose(),this._sliderTouchEndListener.dispose(),super.dispose()}_getMinimapDomNodeClassName(){return this._model.options.showSlider==="always"?"minimap slider-always":"minimap slider-mouseover"}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 up(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&&this._lastRenderData.onLinesDeleted(e,t),!0}onLinesInserted(e,t){return this._lastRenderData&&this._lastRenderData.onLinesInserted(e,t),!0}onScrollChanged(){return this._renderDecorations=!0,!0}onThemeChanged(){return this._selectionColor=this._theme.getColor(bC),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");let i=Vc.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);let n=e.scrollLeft/this._model.options.typicalHalfwidthCharacterWidth,r=Math.min(this._model.options.minimapWidth,Math.round(n*this._model.options.minimapCharWidth/this._model.options.pixelRatio));this._sliderHorizontal.setLeft(r),this._sliderHorizontal.setWidth(this._model.options.minimapWidth-r),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;let t=this._model.getSelections(),i=this._model.getMinimapDecorationsInViewport(e.startLineNumber,e.endLineNumber),{canvasInnerWidth:n,canvasInnerHeight:r}=this._model.options,o=this._model.options.minimapLineHeight,a=this._model.options.minimapCharWidth,l=this._model.getOptions().tabSize,c=this._decorationsCanvas.domNode.getContext("2d");c.clearRect(0,0,n,r);let h=new Map;for(let d=0;dthis._model.options.canvasInnerHeight)return;let u=t.get(o),f=!u;if(!u){let C=this._model.getLineContent(o);u=[Gl];for(let y=1;yo?u.length-1:g-1;if(v>0){let C=u[v]-_||2;this.renderDecoration(e,n,_,d,C,a)}f&&this.renderLineHighlight(e,n,d,a)}renderLineHighlight(e,t,i,n){e.fillStyle=t&&t.transparent(.5).toString()||"",e.fillRect(Gl,i,e.canvas.width,n)}renderDecoration(e,t,i,n,r,o){e.fillStyle=t&&t.toString()||"",e.fillRect(i,n,r,o)}renderLines(e){let t=e.startLineNumber,i=e.endLineNumber,n=this._model.options.minimapLineHeight;if(this._lastRenderData&&this._lastRenderData.linesEquals(e)){let I=this._lastRenderData._get();return new YC(e,I.imageData,I.lines)}let r=this._getBuffer();if(!r)return null;let[o,a,l]=vu._renderUntouchedLines(r,t,i,n,this._lastRenderData),c=this._model.getMinimapLinesRenderingData(t,i,l),h=this._model.getOptions().tabSize,d=this._model.options.backgroundColor,u=this._model.tokensColorTracker,f=u.backgroundIsLight(),m=this._model.options.renderMinimap,g=this._model.options.charRenderer(),b=this._model.options.fontScale,w=this._model.options.minimapCharWidth,v=(m===1?2:2+1)*b,C=n>v?Math.floor((n-v)/2):0,y=0,x=[];for(let I=0,P=i-t+1;I=0&&Tb)return;let T=m.charCodeAt(v);if(T===9){let I=h-(v+C)%h;C+=I-1,_+=I*r}else if(T===32)_+=r;else{let I=bi(T)?2:1;for(let P=0;Pb)return}}}}};bt((s,e)=>{let t=s.getColor(wC);t&&e.addRule(`.monaco-editor .minimap > canvas { opacity: ${t.rgba.a}; will-change: opacity; }`);let i=s.getColor(LI);i&&e.addRule(`.monaco-editor .minimap-slider .minimap-slider-horizontal { background: ${i}; }`);let n=s.getColor(xI);n&&e.addRule(`.monaco-editor .minimap-slider:hover .minimap-slider-horizontal { background: ${n}; }`);let r=s.getColor(DI);r&&e.addRule(`.monaco-editor .minimap-slider.active .minimap-slider-horizontal { background: ${r}; }`);let o=s.getColor(So);o&&e.addRule(`.monaco-editor .minimap-shadow-visible { box-shadow: ${o} -6px 0 6px -6px inset; }`)});var XC=class extends st{constructor(e){super(e);let i=this._context.configuration.options.get(129);this._widgets={},this._verticalScrollbarWidth=i.verticalScrollbarWidth,this._minimapWidth=i.minimap.minimapWidth,this._horizontalScrollbarHeight=i.horizontalScrollbarHeight,this._editorHeight=i.height,this._editorWidth=i.width,this._domNode=X(document.createElement("div")),Xt.write(this._domNode,4),this._domNode.setClassName("overlayWidgets")}dispose(){super.dispose(),this._widgets={}}getDomNode(){return this._domNode}onConfigurationChanged(e){let i=this._context.configuration.options.get(129);return this._verticalScrollbarWidth=i.verticalScrollbarWidth,this._minimapWidth=i.minimap.minimapWidth,this._horizontalScrollbarHeight=i.horizontalScrollbarHeight,this._editorHeight=i.height,this._editorWidth=i.width,!0}addWidget(e){let t=X(e.getDomNode());this._widgets[e.getId()]={widget:e,preference:null,domNode:t},t.setPosition("absolute"),t.setAttribute("widgetId",e.getId()),this._domNode.appendChild(t),this.setShouldRender()}setWidgetPosition(e,t){let i=this._widgets[e.getId()];return i.preference===t?!1:(i.preference=t,this.setShouldRender(),!0)}removeWidget(e){let t=e.getId();if(this._widgets.hasOwnProperty(t)){let n=this._widgets[t].domNode.domNode;delete this._widgets[t],n.parentNode.removeChild(n),this.setShouldRender()}}_renderWidget(e){let t=e.domNode;if(e.preference===null){t.unsetTop();return}if(e.preference===0)t.setTop(0),t.setRight(2*this._verticalScrollbarWidth+this._minimapWidth);else if(e.preference===1){let i=t.domNode.clientHeight;t.setTop(this._editorHeight-i-2*this._horizontalScrollbarHeight),t.setRight(2*this._verticalScrollbarWidth+this._minimapWidth)}else e.preference===2&&(t.setTop(0),t.domNode.style.right="50%")}prepareRender(e){}render(e){this._domNode.setWidth(this._editorWidth);let t=Object.keys(this._widgets);for(let i=0,n=t.length;i=3){let r=Math.floor(n/3),o=Math.floor(n/3),a=n-r-o,l=e,c=l+r,h=l+r+a;return[[0,l,c,l,h,l,c,l],[0,r,a,r+a,o,r+a+o,a+o,r+a+o]]}else if(i===2){let r=Math.floor(n/2),o=n-r,a=e,l=a+r;return[[0,a,a,a,l,a,a,a],[0,r,r,r,o,r+o,r+o,r+o]]}else{let r=e,o=n;return[[0,r,r,r,r,r,r,r],[0,o,o,o,o,o,o,o]]}}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.cursorColor===e.cursorColor&&this.themeType===e.themeType&&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}},QC=class extends st{constructor(e){super(e);this._domNode=X(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=Pe.onDidChange(t=>{t.changedColorMap&&this._updateSettings(!0)}),this._cursorPositions=[]}dispose(){super.dispose(),this._tokensColorTrackerListener.dispose()}_updateSettings(e){let t=new sN(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)}onConfigurationChanged(e){return this._updateSettings(!1)}onCursorStateChanged(e){this._cursorPositions=[];for(let t=0,i=e.selections.length;tt&&(B=t-c),T=B-c,I=B+c}T>C+1||S!==_?(y!==0&&h.fillRect(d[_],v,u[_],C-v),_=S,v=T,C=I):I>C&&(C=I)}h.fillRect(d[_],v,u[_],C-v)}if(!this._settings.hideCursor&&this._settings.cursorColor){let m=2*this._settings.pixelRatio|0,g=m/2|0,b=this._settings.x[7],w=this._settings.w[7];h.fillStyle=this._settings.cursorColor;let _=-100,v=-100;for(let C=0,y=this._cursorPositions.length;Ct&&(S=t-g);let L=S-g,E=L+m;L>v+1?(C!==0&&h.fillRect(b,_,w,v-_),_=L,v=E):E>v&&(v=E)}h.fillRect(b,_,w,v-_)}this._settings.renderBorder&&this._settings.borderColor&&this._settings.overviewRulerLanes>0&&(h.beginPath(),h.lineWidth=1,h.strokeStyle=this._settings.borderColor,h.moveTo(0,0),h.lineTo(0,t),h.stroke(),h.moveTo(0,0),h.lineTo(e,0),h.stroke())}};var JC=class{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}},il=class{constructor(e,t,i){this._overviewRulerZoneBrand=void 0,this.startLineNumber=e,this.endLineNumber=t,this.color=i,this._colorZone=null}static compare(e,t){return e.color===t.color?e.startLineNumber===t.startLineNumber?e.endLineNumber-t.endLineNumber:e.startLineNumber-t.startLineNumber:e.colori&&(f=i-m);let g=h.color,b=this._color2Id[g];b||(b=++this._lastAssignedId,this._color2Id[g]=b,this._id2Color[b]=g);let w=new JC(f-m,f+m,b);h.setColorZone(w),a.push(w)}return this._colorZonesInvalid=!1,a.sort(JC.compare),a}};var t0=class extends $n{constructor(e,t){super();this._context=e;let i=this._context.configuration.options;this._domNode=X(document.createElement("canvas")),this._domNode.setClassName(t),this._domNode.setPosition("absolute"),this._domNode.setLayerHinting(!0),this._domNode.setContain("strict"),this._zoneManager=new e0(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(57)),this._zoneManager.setPixelRatio(i.get(127)),this._context.addEventHandler(this)}dispose(){this._context.removeEventHandler(this),super.dispose()}onConfigurationChanged(e){let t=this._context.configuration.options;return e.hasChanged(57)&&(this._zoneManager.setLineHeight(t.get(57)),this._render()),e.hasChanged(127)&&(this._zoneManager.setPixelRatio(t.get(127)),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;let e=this._zoneManager.getCanvasWidth(),t=this._zoneManager.getCanvasHeight(),i=this._zoneManager.resolveColorZones(),n=this._zoneManager.getId2Color(),r=this._domNode.domNode.getContext("2d");return r.clearRect(0,0,e,t),i.length>0&&this._renderOneLane(r,i,n,e),!0}_renderOneLane(e,t,i,n){let r=0,o=0,a=0;for(let l of t){let c=l.colorId,h=l.from,d=l.to;c!==r?(e.fillRect(0,o,n,a-o),r=c,e.fillStyle=i[r],o=h,a=d):a>=h?a=Math.max(a,d):(e.fillRect(0,o,n,a-o),o=h,a=d)}e.fillRect(0,o,n,a-o)}};var i0=class extends st{constructor(e){super(e);this.domNode=X(document.createElement("div")),this.domNode.setAttribute("role","presentation"),this.domNode.setAttribute("aria-hidden","true"),this.domNode.setClassName("view-rulers"),this._renderedRulers=[];let t=this._context.configuration.options;this._rulers=t.get(90),this._typicalHalfwidthCharacterWidth=t.get(41).typicalHalfwidthCharacterWidth}dispose(){super.dispose()}onConfigurationChanged(e){let t=this._context.configuration.options;return this._rulers=t.get(90),this._typicalHalfwidthCharacterWidth=t.get(41).typicalHalfwidthCharacterWidth,!0}onScrollChanged(e){return e.scrollHeightChanged}prepareRender(e){}_ensureRulersCount(){let e=this._renderedRulers.length,t=this._rulers.length;if(e===t)return;if(e0;){let a=X(document.createElement("div"));a.setClassName("view-ruler"),a.setWidth(r),this.domNode.appendChild(a),this._renderedRulers.push(a),o--}return}let i=e-t;for(;i>0;){let n=this._renderedRulers.pop();this.domNode.removeChild(n),i--}}render(e){this._ensureRulersCount();for(let t=0,i=this._rulers.length;t{let t=s.getColor(FI);t&&e.addRule(`.monaco-editor .view-ruler { box-shadow: 1px 0 0 0 ${t} inset; }`)});var n0=class extends st{constructor(e){super(e);this._scrollTop=0,this._width=0,this._updateWidth(),this._shouldShow=!1;let i=this._context.configuration.options.get(91);this._useShadows=i.useShadows,this._domNode=X(document.createElement("div")),this._domNode.setAttribute("role","presentation"),this._domNode.setAttribute("aria-hidden","true")}dispose(){super.dispose()}_updateShouldShow(){let e=this._useShadows&&this._scrollTop>0;return this._shouldShow!==e?(this._shouldShow=e,!0):!1}getDomNode(){return this._domNode}_updateWidth(){let t=this._context.configuration.options.get(129);t.minimap.renderMinimap===0||t.minimap.minimapWidth>0&&t.minimap.minimapLeft===0?this._width=t.width:this._width=t.width-t.minimap.minimapWidth-t.verticalScrollbarWidth}onConfigurationChanged(e){let i=this._context.configuration.options.get(91);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":"")}};bt((s,e)=>{let t=s.getColor(So);t&&e.addRule(`.monaco-editor .scroll-decoration { box-shadow: ${t} 0 6px 6px -6px inset; }`)});var rN=class{constructor(e){this.left=e.left,this.width=e.width,this.startStyle=null,this.endStyle=null}},oN=class{constructor(e,t){this.lineNumber=e,this.ranges=t}};function hO(s){return new rN(s)}function dO(s){return new oN(s.lineNumber,s.ranges.map(hO))}var He=class extends hn{constructor(e){super();this._previousFrameVisibleRangesWithStyle=[],this._context=e;let t=this._context.configuration.options;this._lineHeight=t.get(57),this._roundedSelection=t.get(89),this._typicalHalfwidthCharacterWidth=t.get(41).typicalHalfwidthCharacterWidth,this._selections=[],this._renderResult=null,this._context.addEventHandler(this)}dispose(){this._context.removeEventHandler(this),this._renderResult=null,super.dispose()}onConfigurationChanged(e){let t=this._context.configuration.options;return this._lineHeight=t.get(57),this._roundedSelection=t.get(89),this._typicalHalfwidthCharacterWidth=t.get(41).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;t1)return!0;return!1}_enrichVisibleRangesWithStyle(e,t,i){let n=this._typicalHalfwidthCharacterWidth/4,r=null,o=null;if(i&&i.length>0&&t.length>0){let a=t[0].lineNumber;if(a===e.startLineNumber)for(let c=0;!r&&c=0;c--)i[c].lineNumber===l&&(o=i[c].ranges[0]);r&&!r.startStyle&&(r=null),o&&!o.startStyle&&(o=null)}for(let a=0,l=t.length;a0){let m=t[a-1].ranges[0].left,g=t[a-1].ranges[0].left+t[a-1].ranges[0].width;fp(h-m)m&&(u.top=1),fp(d-g)'}_actualRenderOneSelection(e,t,i,n){if(n.length===0)return;let r=!!n[0].ranges[0].startStyle,o=this._lineHeight.toString(),a=(this._lineHeight-1).toString(),l=n[0].lineNumber,c=n[n.length-1].lineNumber;for(let h=0,d=n.length;h1,c)}this._previousFrameVisibleRangesWithStyle=r,this._renderResult=t.map(([o,a])=>o+a)}render(e,t){if(!this._renderResult)return"";let i=t-e;return i<0||i>=this._renderResult.length?"":this._renderResult[i]}};He.SELECTION_CLASS_NAME="selected-text";He.SELECTION_TOP_LEFT="top-left-radius";He.SELECTION_BOTTOM_LEFT="bottom-left-radius";He.SELECTION_TOP_RIGHT="top-right-radius";He.SELECTION_BOTTOM_RIGHT="bottom-right-radius";He.EDITOR_BACKGROUND_CLASS_NAME="monaco-editor-background";He.ROUNDED_PIECE_WIDTH=10;bt((s,e)=>{let t=s.getColor(Ya);t&&e.addRule(`.monaco-editor .focused .selected-text { background-color: ${t}; }`);let i=s.getColor(du);i&&e.addRule(`.monaco-editor .selected-text { background-color: ${i}; }`);let n=s.getColor(Hk);n&&!n.isTransparent()&&e.addRule(`.monaco-editor .view-line span.inline-selected-text { color: ${n}; }`)});function fp(s){return s<0?-s:s}var s0=class{constructor(e,t,i,n,r,o){this.top=e,this.left=t,this.width=i,this.height=n,this.textContent=r,this.textContentClassName=o}},mp=class{constructor(e){this._context=e;let t=this._context.configuration.options,i=t.get(41);this._cursorStyle=t.get(22),this._lineHeight=t.get(57),this._typicalHalfwidthCharacterWidth=i.typicalHalfwidthCharacterWidth,this._lineCursorWidth=Math.min(t.get(25),this._typicalHalfwidthCharacterWidth),this._isVisible=!0,this._domNode=X(document.createElement("div")),this._domNode.setClassName(`cursor ${qn}`),this._domNode.setHeight(this._lineHeight),this._domNode.setTop(0),this._domNode.setLeft(0),mt.applyFontInfo(this._domNode,i),this._domNode.setDisplay("none"),this._position=new N(1,1),this._lastRenderedContent="",this._renderData=null}getDomNode(){return this._domNode}getPosition(){return this._position}show(){this._isVisible||(this._domNode.setVisibility("inherit"),this._isVisible=!0)}hide(){this._isVisible&&(this._domNode.setVisibility("hidden"),this._isVisible=!1)}onConfigurationChanged(e){let t=this._context.configuration.options,i=t.get(41);return this._cursorStyle=t.get(22),this._lineHeight=t.get(57),this._typicalHalfwidthCharacterWidth=i.typicalHalfwidthCharacterWidth,this._lineCursorWidth=Math.min(t.get(25),this._typicalHalfwidthCharacterWidth),mt.applyFontInfo(this._domNode,i),!0}onCursorPositionChanged(e){return this._position=e,!0}_prepareRender(e){let t="";if(this._cursorStyle===Ct.Line||this._cursorStyle===Ct.LineThin){let u=e.visibleRangeForPosition(this._position);if(!u||u.outsideRenderedLine)return null;let f;if(this._cursorStyle===Ct.Line){if(f=Db(this._lineCursorWidth>0?this._lineCursorWidth:2),f>2){let b=this._context.model.getLineContent(this._position.lineNumber),w=ca(b,this._position.column-1);t=b.substr(this._position.column-1,w)}}else f=Db(1);let m=u.left;f>=2&&m>=1&&(m-=1);let g=e.getVerticalOffsetForLineNumber(this._position.lineNumber)-e.bigNumbersDelta;return new s0(g,m,f,this._lineHeight,t,"")}let i=this._context.model.getLineContent(this._position.lineNumber),n=ca(i,this._position.column-1),r=e.linesVisibleRangesForRange(new D(this._position.lineNumber,this._position.column,this._position.lineNumber,this._position.column+n),!1);if(!r||r.length===0)return null;let o=r[0];if(o.outsideRenderedLine||o.ranges.length===0)return null;let a=o.ranges[0],l=a.width<1?this._typicalHalfwidthCharacterWidth:a.width,c="";if(this._cursorStyle===Ct.Block){let u=this._context.model.getViewLineData(this._position.lineNumber);t=i.substr(this._position.column-1,n);let f=u.tokens.findTokenIndexAtOffset(this._position.column-1);c=u.tokens.getClassName(f)}let h=e.getVerticalOffsetForLineNumber(this._position.lineNumber)-e.bigNumbersDelta,d=this._lineHeight;return(this._cursorStyle===Ct.Underline||this._cursorStyle===Ct.UnderlineThin)&&(h+=this._lineHeight-2,d=2),new s0(h,a.left,l,d,t,c)}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 ${qn} ${this._renderData.textContentClassName}`),this._domNode.setDisplay("block"),this._domNode.setTop(this._renderData.top),this._domNode.setLeft(this._renderData.left),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)}};var nl=class extends st{constructor(e){super(e);let t=this._context.configuration.options;this._readOnly=t.get(79),this._cursorBlinking=t.get(20),this._cursorStyle=t.get(22),this._cursorSmoothCaretAnimation=t.get(21),this._selectionIsEmpty=!0,this._isComposingInput=!1,this._isVisible=!1,this._primaryCursor=new mp(this._context),this._secondaryCursors=[],this._renderData=[],this._domNode=X(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 Ut,this._cursorFlatBlinkInterval=new es,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){let t=this._context.configuration.options;this._readOnly=t.get(79),this._cursorBlinking=t.get(20),this._cursorStyle=t.get(22),this._cursorSmoothCaretAnimation=t.get(21),this._updateBlinking(),this._updateDomClassName(),this._primaryCursor.onConfigurationChanged(e);for(let i=0,n=this._secondaryCursors.length;it.length){let i=this._secondaryCursors.length-t.length;for(let n=0;n{for(let n=0,r=e.ranges.length;n{this._isVisible?this._hide():this._show()},nl.BLINK_INTERVAL):this._startCursorBlinkAnimation.setIfNotSet(()=>{this._blinkingEnabled=!0,this._updateDomClassName()},nl.BLINK_INTERVAL))}_updateDomClassName(){this._domNode.setClassName(this._getClassName())}_getClassName(){let e="cursors-layer";switch(this._selectionIsEmpty||(e+=" has-selection"),this._cursorStyle){case Ct.Line:e+=" cursor-line-style";break;case Ct.Block:e+=" cursor-block-style";break;case Ct.Underline:e+=" cursor-underline-style";break;case Ct.LineThin:e+=" cursor-line-thin-style";break;case Ct.BlockOutline:e+=" cursor-block-outline-style";break;case Ct.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&&(e+=" cursor-smooth-caret-animation"),e}_show(){this._primaryCursor.show();for(let e=0,t=this._secondaryCursors.length;e{let t=s.getColor(op);if(t){let i=s.getColor(OI);i||(i=t.opposite()),e.addRule(`.monaco-editor .cursors-layer .cursor { background-color: ${t}; border-color: ${t}; color: ${i}; }`),s.type==="hc"&&e.addRule(`.monaco-editor .cursors-layer.has-selection .cursor { border-left: 1px solid ${i}; border-right: 1px solid ${i}; }`)}});var r0=()=>{throw new Error("Invalid change accessor")},o0=class extends st{constructor(e){super(e);let t=this._context.configuration.options,i=t.get(129);this._lineHeight=t.get(57),this._contentWidth=i.contentWidth,this._contentLeft=i.contentLeft,this.domNode=X(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=X(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(){let e=this._context.viewLayout.getWhitespaces(),t=new Map;for(let n of e)t.set(n.id,n);let i=!1;return this._context.model.changeWhitespace(n=>{let r=Object.keys(this._zones);for(let o=0,a=r.length;o{let n={addZone:r=>(t=!0,this._addZone(i,r)),removeZone:r=>{!r||(t=this._removeZone(i,r)||t)},layoutZone:r=>{!r||(t=this._layoutZone(i,r)||t)}};uO(e,n),n.addZone=r0,n.removeZone=r0,n.layoutZone=r0}),t}_addZone(e,t){let i=this._computeWhitespaceProps(t),r={whitespaceId:e.insertWhitespace(i.afterViewLineNumber,this._getZoneOrdinal(t),i.heightInPx,i.minWidthInPx),delegate:t,isVisible:!1,domNode:X(t.domNode),marginDomNode:t.marginDomNode?X(t.marginDomNode):null};return this._safeCallOnComputedHeight(r.delegate,i.heightInPx),r.domNode.setPosition("absolute"),r.domNode.domNode.style.width="100%",r.domNode.setDisplay("none"),r.domNode.setAttribute("monaco-view-zone",r.whitespaceId),this.domNode.appendChild(r.domNode),r.marginDomNode&&(r.marginDomNode.setPosition("absolute"),r.marginDomNode.domNode.style.width="100%",r.marginDomNode.setDisplay("none"),r.marginDomNode.setAttribute("monaco-view-zone",r.whitespaceId),this.marginDomNode.appendChild(r.marginDomNode)),this._zones[r.whitespaceId]=r,this.setShouldRender(),r.whitespaceId}_removeZone(e,t){if(this._zones.hasOwnProperty(t)){let 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.parentNode.removeChild(i.domNode.domNode),i.marginDomNode&&(i.marginDomNode.removeAttribute("monaco-visible-view-zone"),i.marginDomNode.removeAttribute("monaco-view-zone"),i.marginDomNode.domNode.parentNode.removeChild(i.marginDomNode.domNode)),this.setShouldRender(),!0}return!1}_layoutZone(e,t){if(this._zones.hasOwnProperty(t)){let i=this._zones[t],n=this._computeWhitespaceProps(i.delegate);return e.changeOneWhitespace(i.whitespaceId,n.afterViewLineNumber,n.heightInPx),this._safeCallOnComputedHeight(i.delegate,n.heightInPx),this.setShouldRender(),!0}return!1}shouldSuppressMouseDownOnViewZone(e){if(this._zones.hasOwnProperty(e)){let t=this._zones[e];return Boolean(t.delegate.suppressMouseDown)}return!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){de(i)}}_safeCallOnDomNodeTop(e,t){if(typeof e.onDomNodeTop=="function")try{e.onDomNodeTop(t)}catch(i){de(i)}}prepareRender(e){}render(e){let t=e.viewportData.whitespaceViewportData,i={},n=!1;for(let o=0,a=t.length;o{this._context.theme.update(g),this._context.model.onDidColorThemeChange(),this.render(!0,!1)})),this._viewParts=[],this._textAreaHandler=new yC(this._context,a,this._createTextAreaHandlerHelper()),this._viewParts.push(this._textAreaHandler),this._linesContent=X(document.createElement("div")),this._linesContent.setClassName("lines-content monaco-editor-background"),this._linesContent.setPosition("absolute"),this.domNode=X(document.createElement("div")),this.domNode.setClassName(this._getEditorClassName()),this.domNode.setAttribute("role","code"),this._overflowGuardContainer=X(document.createElement("div")),Xt.write(this._overflowGuardContainer,3),this._overflowGuardContainer.setClassName("overflow-guard"),this._scrollbar=new HC(this._context,this._linesContent,this.domNode,this._overflowGuardContainer),this._viewParts.push(this._scrollbar),this._viewLines=new Wc(this._context,this._linesContent),this._viewZones=new o0(this._context),this._viewParts.push(this._viewZones);let l=new QC(this._context);this._viewParts.push(l);let c=new n0(this._context);this._viewParts.push(c);let h=new EC(this._context);this._viewParts.push(h),h.addDynamicOverlay(new RC(this._context)),h.addDynamicOverlay(new He(this._context)),h.addDynamicOverlay(new $C(this._context)),h.addDynamicOverlay(new OC(this._context));let d=new kC(this._context);this._viewParts.push(d),d.addDynamicOverlay(new AC(this._context)),d.addDynamicOverlay(new UC(this._context)),d.addDynamicOverlay(new qC(this._context)),d.addDynamicOverlay(new KC(this._context)),d.addDynamicOverlay(new gr(this._context));let u=new Ls(this._context);u.getDomNode().appendChild(this._viewZones.marginDomNode),u.getDomNode().appendChild(d.getDomNode()),this._viewParts.push(u),this._contentWidgets=new IC(this._context,this.domNode),this._viewParts.push(this._contentWidgets),this._viewCursors=new nl(this._context),this._viewParts.push(this._viewCursors),this._overlayWidgets=new XC(this._context),this._viewParts.push(this._overlayWidgets);let f=new i0(this._context);this._viewParts.push(f);let m=new ZC(this._context);if(this._viewParts.push(m),l){let g=this._scrollbar.getOverviewRulerLayoutInfo();g.parent.insertBefore(l.getDomNode(),g.insertBefore)}this._linesContent.appendChild(h.getDomNode()),this._linesContent.appendChild(f.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(u.getDomNode()),this._overflowGuardContainer.appendChild(this._scrollbar.getDomNode()),this._overflowGuardContainer.appendChild(c.getDomNode()),this._overflowGuardContainer.appendChild(this._textAreaHandler.textArea),this._overflowGuardContainer.appendChild(this._textAreaHandler.textAreaCover),this._overflowGuardContainer.appendChild(this._overlayWidgets.getDomNode()),this._overflowGuardContainer.appendChild(m.getDomNode()),this.domNode.appendChild(this._overflowGuardContainer),o?o.appendChild(this._contentWidgets.overflowingContentWidgetsDomNode.domNode):this.domNode.appendChild(this._contentWidgets.overflowingContentWidgetsDomNode),this._applyLayout(),this._pointerHandler=this._register(new lC(this._context,a,this._createPointerHandlerHelper()))}_flushAccumulatedAndRenderNow(){this._renderNow()}_createPointerHandlerHelper(){return{viewDomNode:this.domNode.domNode,linesContentDomNode:this._linesContent.domNode,focusTextArea:()=>{this.focus()},dispatchTextAreaEvent:e=>{this._textAreaHandler.textArea.domNode.dispatchEvent(e)},getLastRenderData:()=>{let e=this._viewCursors.getLastRenderData()||[],t=this._textAreaHandler.getLastRenderData();return new rC(e,t)},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(),this._viewLines.visibleRangeForPosition(new N(e,t))),getLineWidth:e=>(this._flushAccumulatedAndRenderNow(),this._viewLines.getLineWidth(e))}}_createTextAreaHandlerHelper(){return{visibleRangeForPositionRelativeToEditor:(e,t)=>(this._flushAccumulatedAndRenderNow(),this._viewLines.visibleRangeForPosition(new N(e,t)))}}_applyLayout(){let t=this._context.configuration.options.get(129);this.domNode.setWidth(t.width),this.domNode.setHeight(t.height),this._overflowGuardContainer.setWidth(t.width),this._overflowGuardContainer.setHeight(t.height),this._linesContent.setWidth(1e6),this._linesContent.setHeight(1e6)}_getEditorClassName(){let e=this._textAreaHandler.isFocused()?" focused":"";return this._context.configuration.options.get(126)+" "+ga(this._context.theme.type)+e}handleEvents(e){super.handleEvents(e),this._scheduleRender()}onConfigurationChanged(e){return this._configPixelRatio=this._context.configuration.options.get(127),this.domNode.setClassName(this._getEditorClassName()),this._applyLayout(),!1}onCursorStateChanged(e){return this._selections=e.selections,!1}onFocusChanged(e){return this.domNode.setClassName(this._getEditorClassName()),!1}onThemeChanged(e){return this.domNode.setClassName(this._getEditorClassName()),!1}dispose(){this._renderAnimationFrame!==null&&(this._renderAnimationFrame.dispose(),this._renderAnimationFrame=null),this._contentWidgets.overflowingContentWidgetsDomNode.domNode.remove(),this._context.removeEventHandler(this),this._viewLines.dispose();for(let e of this._viewParts)e.dispose();super.dispose()}_scheduleRender(){this._renderAnimationFrame===null&&(this._renderAnimationFrame=wb(this._onRenderScheduled.bind(this),100))}_onRenderScheduled(){this._renderAnimationFrame=null,this._flushAccumulatedAndRenderNow()}_renderNow(){fO(()=>this._actualRender())}_getViewPartsToRender(){let e=[],t=0;for(let i of this._viewParts)i.shouldRender()&&(e[t++]=i);return e}_actualRender(){if(!Of(this.domNode.domNode))return;let e=this._getViewPartsToRender();if(!this._viewLines.shouldRender()&&e.length===0)return;let t=this._context.viewLayout.getLinesViewportData();this._context.model.setViewport(t.startLineNumber,t.endLineNumber,t.centeredLineNumber);let i=new l0(this._selections,t,this._context.viewLayout.getWhitespaceViewportData(),this._context.model);this._contentWidgets.shouldRender()&&this._contentWidgets.onBeforeRender(i),this._viewLines.shouldRender()&&(this._viewLines.renderText(i),this._viewLines.onDidRender(),e=this._getViewPartsToRender());let n=new Jv(this._context.viewLayout,i,this._viewLines);for(let r of e)r.prepareRender(n);for(let r of e)r.render(n),r.onDidRender();Math.abs(xl()-this._configPixelRatio)>.001&&this._context.configuration.updatePixelRatio()}delegateVerticalScrollbarMouseDown(e){this._scrollbar.delegateVerticalScrollbarMouseDown(e)}restoreState(e){this._context.model.setScrollPosition({scrollTop:e.scrollTop},1),this._context.model.tokenizeViewport(),this._renderNow(),this._viewLines.updateLineWidths(),this._context.model.setScrollPosition({scrollLeft:e.scrollLeft},1)}getOffsetForColumn(e,t){let i=this._context.model.validateModelPosition({lineNumber:e,column:t}),n=this._context.model.coordinatesConverter.convertModelPositionToViewPosition(i);this._flushAccumulatedAndRenderNow();let r=this._viewLines.visibleRangeForPosition(new N(n.lineNumber,n.column));return r?r.left:-1}getTargetAtClientPoint(e,t){let i=this._pointerHandler.getTargetAtClientPoint(e,t);return i?Xa.convertViewToModelMouseTarget(i,this._context.model.coordinatesConverter):null}createOverviewRuler(e){return new t0(this._context,e)}change(e){this._viewZones.changeViewZones(e),this._scheduleRender()}render(e,t){if(t){this._viewLines.forceShouldRender();for(let i of this._viewParts)i.forceShouldRender()}e?this._flushAccumulatedAndRenderNow():this._scheduleRender()}focus(){this._textAreaHandler.focusTextArea()}isFocused(){return this._textAreaHandler.isFocused()}setAriaOptions(e){this._textAreaHandler.setAriaOptions(e)}addContentWidget(e){this._contentWidgets.addWidget(e.widget),this.layoutContentWidget(e),this._scheduleRender()}layoutContentWidget(e){let t=e.position&&e.position.range||null;if(t===null){let n=e.position?e.position.position:null;n!==null&&(t=new D(n.lineNumber,n.column,n.lineNumber,n.column))}let i=e.position?e.position.preference:null;this._contentWidgets.setWidgetPosition(e.widget,t,i),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){let t=e.position?e.position.preference:null;this._overlayWidgets.setWidgetPosition(e.widget,t)&&this._scheduleRender()}removeOverlayWidget(e){this._overlayWidgets.removeWidget(e.widget),this._scheduleRender()}};function fO(s){try{return s()}catch(e){de(e)}}var zc=class{constructor(e){this._selTrackedRange=null,this._trackSelection=!0,this._setState(e,new tt(new D(1,1,1,1),0,new N(1,1),0),new tt(new D(1,1,1,1),0,new N(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 ne(this.modelState,this.viewState)}readSelectionFromMarkers(e){let t=e.model._getTrackedRange(this._selTrackedRange);return this.modelState.selection.getDirection()===0?new Z(t.startLineNumber,t.startColumn,t.endLineNumber,t.endColumn):new Z(t.endLineNumber,t.endColumn,t.startLineNumber,t.startColumn)}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){let i=t.position,n=t.selectionStart.getStartPosition(),r=t.selectionStart.getEndPosition(),o=e.normalizePosition(i,2),a=this._validatePositionWithCache(e,n,i,o),l=this._validatePositionWithCache(e,r,n,a);return i.equals(o)&&n.equals(a)&&r.equals(l)?t:new tt(D.fromPositions(a,l),t.selectionStartLeftoverVisibleColumns+n.column-a.column,o,t.leftoverVisibleColumns+i.column-o.column)}_setState(e,t,i){if(i&&(i=zc._validateViewState(e.viewModel,i)),t){let n=e.model.validateRange(t.selectionStart),r=t.selectionStart.equalsRange(n)?t.selectionStartLeftoverVisibleColumns:0,o=e.model.validatePosition(t.position),a=t.position.equals(o)?t.leftoverVisibleColumns:0;t=new tt(n,r,o,a)}else{if(!i)return;let n=e.model.validateRange(e.coordinatesConverter.convertViewRangeToModelRange(i.selectionStart)),r=e.model.validatePosition(e.coordinatesConverter.convertViewPositionToModelPosition(i.position));t=new tt(n,i.selectionStartLeftoverVisibleColumns,r,i.leftoverVisibleColumns)}if(i){let n=e.coordinatesConverter.validateViewRange(i.selectionStart,t.selectionStart),r=e.coordinatesConverter.validateViewPosition(i.position,t.position);i=new tt(n,t.selectionStartLeftoverVisibleColumns,r,t.leftoverVisibleColumns)}else{let n=e.coordinatesConverter.convertModelPositionToViewPosition(new N(t.selectionStart.startLineNumber,t.selectionStart.startColumn)),r=e.coordinatesConverter.convertModelPositionToViewPosition(new N(t.selectionStart.endLineNumber,t.selectionStart.endColumn)),o=new D(n.lineNumber,n.column,r.lineNumber,r.column),a=e.coordinatesConverter.convertModelPositionToViewPosition(t.position);i=new tt(o,t.selectionStartLeftoverVisibleColumns,a,t.leftoverVisibleColumns)}this.modelState=t,this.viewState=i,this._updateTrackedRange(e)}};var gp=class{constructor(e){this.context=e,this.primaryCursor=new zc(e),this.secondaryCursors=[],this.lastAddedCursorIndex=0}dispose(){this.primaryCursor.dispose(this.context),this.killSecondaryCursors()}startTrackingSelections(){this.primaryCursor.startTrackingSelection(this.context);for(let e=0,t=this.secondaryCursors.length;ei){let n=t-i;for(let r=0;r=e+1&&this.lastAddedCursorIndex--,this.secondaryCursors[e].dispose(this.context),this.secondaryCursors.splice(e,1)}_getAll(){let e=[];e[0]=this.primaryCursor;for(let t=0,i=this.secondaryCursors.length;ti.selection.startLineNumber===n.selection.startLineNumber?i.selection.startColumn-n.selection.startColumn:i.selection.startLineNumber-n.selection.startLineNumber);for(let i=0;id&&g.index--;e.splice(d,1),t.splice(h,1),this._removeSecondaryCursor(d-1),i--}}}};var h0=class{constructor(){this.type=0}},d0=class{constructor(){this.type=1}},u0=class{constructor(e){this.type=2,this._source=e}hasChanged(e){return this._source.hasChanged(e)}},f0=class{constructor(e,t){this.type=3,this.selections=e,this.modelSelections=t}},ko=class{constructor(e){this.type=4,e?(this.affectsMinimap=e.affectsMinimap,this.affectsOverviewRuler=e.affectsOverviewRuler):(this.affectsMinimap=!0,this.affectsOverviewRuler=!0)}},Hc=class{constructor(){this.type=5}},m0=class{constructor(e){this.type=6,this.isFocused=e}},g0=class{constructor(){this.type=7}},Uc=class{constructor(){this.type=8}},pp=class{constructor(e,t){this.type=9,this.fromLineNumber=e,this.toLineNumber=t}},Cu=class{constructor(e,t){this.type=10,this.fromLineNumber=e,this.toLineNumber=t}},Su=class{constructor(e,t){this.type=11,this.fromLineNumber=e,this.toLineNumber=t}},sl=class{constructor(e,t,i,n,r,o){this.type=12,this.source=e,this.range=t,this.selections=i,this.verticalType=n,this.revealHorizontal=r,this.scrollType=o}},p0=class{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}},_0=class{constructor(){this.type=14}},b0=class{constructor(e){this.type=15,this.ranges=e}},w0=class{constructor(){this.type=16}},v0=class{constructor(){this.type=17}};var C0=class extends M{constructor(){super();this._onEvent=this._register(new k),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._emitOugoingEvents()}_addOutgoingEvent(e){for(let t=0,i=this._outgoingEvents.length;t0;){if(this._collector||this._isConsumingViewEventQueue)return;let e=this._outgoingEvents.shift();e.isNoOp()||this._onEvent.fire(e)}}addViewEventHandler(e){for(let t=0,i=this._eventHandlers.length;t0&&this._emitMany(t)}this._emitOugoingEvents()}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;){let e=this._viewEventQueue;this._viewEventQueue=null;let t=this._eventHandlers.slice(0);for(let i of t)i.handleEvents(e)}}},lN=class{constructor(){this.viewEvents=[],this.outgoingEvents=[]}emitViewEvent(e){this.viewEvents.push(e)}emitOutgoingEvent(e){this.outgoingEvents.push(e)}},yu=class{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}merge(e){return e.kind!==0?this:new yu(this._oldContentWidth,this._oldContentHeight,e.contentWidth,e.contentHeight)}},Lu=class{constructor(e,t){this.kind=1,this.oldHasFocus=e,this.hasFocus=t}isNoOp(){return this.oldHasFocus===this.hasFocus}merge(e){return e.kind!==1?this:new Lu(this.oldHasFocus,e.hasFocus)}},xu=class{constructor(e,t,i,n,r,o,a,l){this.kind=2,this._oldScrollWidth=e,this._oldScrollLeft=t,this._oldScrollHeight=i,this._oldScrollTop=n,this.scrollWidth=r,this.scrollLeft=o,this.scrollHeight=a,this.scrollTop=l,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}merge(e){return e.kind!==2?this:new xu(this._oldScrollWidth,this._oldScrollLeft,this._oldScrollHeight,this._oldScrollTop,e.scrollWidth,e.scrollLeft,e.scrollHeight,e.scrollTop)}},S0=class{constructor(){this.kind=3}isNoOp(){return!1}merge(e){return this}},$c=class{constructor(e,t,i,n,r,o,a){this.kind=5,this.oldSelections=e,this.selections=t,this.oldModelVersionId=i,this.modelVersionId=n,this.source=r,this.reason=o,this.reachedMaxCursorCount=a}static _selectionsAreEqual(e,t){if(!e&&!t)return!0;if(!e||!t)return!1;let i=e.length,n=t.length;if(i!==n)return!1;for(let r=0;r=t.length||!t[i].strictContainsRange(e[i]))return!1;return!0}},br=class extends M{constructor(e,t,i,n){super();this._model=e,this._knownModelVersionId=this._model.getVersionId(),this._viewModel=t,this._coordinatesConverter=i,this.context=new Fm(this._model,this._viewModel,this._coordinatesConverter,n),this._cursors=new gp(this.context),this._hasFocus=!1,this._isHandling=!1,this._isDoingComposition=!1,this._selectionsWhenCompositionStarted=null,this._columnSelectData=null,this._autoClosedActions=[],this._prevEditOperationType=0}dispose(){this._cursors.dispose(),this._autoClosedActions=me(this._autoClosedActions),super.dispose()}updateConfiguration(e){this.context=new Fm(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){let e=this._cursors.getSelections();for(let t=0;tbr.MAX_CURSOR_COUNT&&(n=n.slice(0,br.MAX_CURSOR_COUNT),r=!0);let o=new _p(this._model,this);return this._cursors.setStates(n),this._cursors.normalize(),this._columnSelectData=null,this._validateAutoClosedActions(),this._emitStateChangedIfNecessary(e,t,i,o,r)}setCursorColumnSelectData(e){this._columnSelectData=e}revealPrimary(e,t,i,n){let r=this._cursors.getViewPositions();if(r.length>1){this._emitCursorRevealRange(e,t,null,this._cursors.getViewSelections(),0,i,n);return}else{let o=r[0],a=new D(o.lineNumber,o.column,o.lineNumber,o.column);this._emitCursorRevealRange(e,t,a,null,0,i,n)}}_revealPrimaryCursor(e,t,i,n,r){let o=this._cursors.getViewPositions();if(o.length>1)this._emitCursorRevealRange(e,t,null,this._cursors.getViewSelections(),i,n,r);else{let a=o[0],l=new D(a.lineNumber,a.column,a.lineNumber,a.column);this._emitCursorRevealRange(e,t,l,null,i,n,r)}}_emitCursorRevealRange(e,t,i,n,r,o,a){e.emitViewEvent(new sl(t,i,n,r,o,a))}saveState(){let e=[],t=this._cursors.getSelections();for(let i=0,n=t.length;i0){let n=ne.fromModelSelections(t.resultingSelection);this.setStates(e,"modelChange",t.isUndoing?5:t.isRedoing?6:2,n)&&this._revealPrimaryCursor(e,"modelChange",0,!0,0)}else{let n=this._cursors.readSelectionFromMarkers();this.setStates(e,"modelChange",2,ne.fromModelSelections(n))}}}getSelection(){return this._cursors.getPrimaryCursor().modelState.selection}getTopMostViewPosition(){return this._cursors.getTopMostViewPosition()}getBottomMostViewPosition(){return this._cursors.getBottomMostViewPosition()}getCursorColumnSelectData(){if(this._columnSelectData)return this._columnSelectData;let e=this._cursors.getPrimaryCursor(),t=e.viewState.selectionStart.getStartPosition(),i=e.viewState.position;return{isReal:!1,fromViewLineNumber:t.lineNumber,fromViewVisualColumn:ue.visibleColumnFromColumn2(this.context.cursorConfig,this._viewModel,t),toViewLineNumber:i.lineNumber,toViewVisualColumn:ue.visibleColumnFromColumn2(this.context.cursorConfig,this._viewModel,i)}}getSelections(){return this._cursors.getSelections()}setSelections(e,t,i,n){this.setStates(e,t,n,ne.fromModelSelections(i))}getPrevEditOperationType(){return this._prevEditOperationType}setPrevEditOperationType(e){this._prevEditOperationType=e}_pushAutoClosedAction(e,t){let i=[],n=[];for(let a=0,l=e.length;a0&&this._pushAutoClosedAction(i,n),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,r){let o=new _p(this._model,this);if(o.equals(n))return!1;let a=this._cursors.getSelections(),l=this._cursors.getViewSelections();if(e.emitViewEvent(new f0(l,a)),!n||n.cursorState.length!==o.cursorState.length||o.cursorState.some((c,h)=>!c.modelState.equals(n.cursorState[h].modelState))){let c=n?n.cursorState.map(d=>d.modelState.selection):null,h=n?n.modelVersionId:0;e.emitOutgoingEvent(new $c(c,a,h,o.modelVersionId,t||"keyboard",i,r))}return!0}_findAutoClosingPairs(e){if(!e.length)return null;let t=[];for(let i=0,n=e.length;i=0)return null;let o=r.text.match(/([)\]}>'"`])([^)\]}>'"`]*)$/);if(!o)return null;let a=o[1],l=this.context.cursorConfig.autoClosingPairs.autoClosingPairsCloseSingleChar.get(a);if(!l||l.length!==1)return null;let c=l[0].open,h=r.text.length-o[2].length-1,d=r.text.lastIndexOf(c,h-1);if(d===-1)return null;t.push([d,h])}return t}executeEdits(e,t,i,n){let r=null;t==="snippet"&&(r=this._findAutoClosingPairs(i)),r&&(i[0]._isTracked=!0);let o=[],a=[],l=this._model.pushEditOperations(this.getSelections(),i,c=>{if(r)for(let d=0,u=r.length;d0&&this._pushAutoClosedAction(o,a)}_executeEdit(e,t,i,n=0){if(this.context.cursorConfig.readOnly)return;let r=new _p(this._model,this);this._cursors.stopTrackingSelections(),this._isHandling=!0;try{this._cursors.ensureValidState(),e()}catch(o){de(o)}this._isHandling=!1,this._cursors.startTrackingSelections(),this._validateAutoClosedActions(),this._emitStateChangedIfNecessary(t,i,n,r,!1)&&this._revealPrimaryCursor(t,i,0,!0,0)}setIsDoingComposition(e){this._isDoingComposition=e}getAutoClosedCharacters(){return L0.getAllAutoClosedCharacters(this._autoClosedActions)}startComposition(e){this._selectionsWhenCompositionStarted=this.getSelections().slice(0)}endComposition(e,t){this._executeEdit(()=>{t==="keyboard"&&(this._executeEditOperation(je.compositionEndWithInterceptors(this._prevEditOperationType,this.context.cursorConfig,this._model,this._selectionsWhenCompositionStarted,this.getSelections(),this.getAutoClosedCharacters())),this._selectionsWhenCompositionStarted=null)},e,t)}type(e,t,i){this._executeEdit(()=>{if(i==="keyboard"){let n=t.length,r=0;for(;r{let c=l.getPosition();return new Z(c.lineNumber,c.column+r,c.lineNumber,c.column+r)});this.setSelections(e,o,a,0)}return}this._executeEdit(()=>{this._executeEditOperation(je.compositionType(this._prevEditOperationType,this.context.cursorConfig,this._model,this.getSelections(),t,i,n,r))},e,o)}paste(e,t,i,n,r){this._executeEdit(()=>{this._executeEditOperation(je.paste(this.context.cursorConfig,this._model,this.getSelections(),t,i,n||[]))},e,r,4)}cut(e,t){this._executeEdit(()=>{this._executeEditOperation(jn.cut(this.context.cursorConfig,this._model,this.getSelections()))},e,t)}executeCommand(e,t,i){this._executeEdit(()=>{this._cursors.killSecondaryCursors(),this._executeEditOperation(new Gt(0,[t],{shouldPushStackElementBefore:!1,shouldPushStackElementAfter:!1}))},e,i)}executeCommands(e,t,i){this._executeEdit(()=>{this._executeEditOperation(new Gt(0,t,{shouldPushStackElementBefore:!1,shouldPushStackElementAfter:!1}))},e,i)}};br.MAX_CURSOR_COUNT=1e4;var cN=class{static executeCommands(e,t,i){let n={model:e,selectionsBefore:t,trackedRanges:[],trackedRangesDirection:[]},r=this._innerExecuteCommands(n,i);for(let o=0,a=n.trackedRanges.length;o0&&(o[0]._isTracked=!0);let a=e.model.pushEditOperations(e.selectionsBefore,o,c=>{let h=[];for(let f=0;ff.identifier.minor-m.identifier.minor,u=[];for(let f=0;f0?(h[f].sort(d),u[f]=t[f].computeCursorState(e.model,{getInverseEditOperations:()=>h[f],getTrackedSelection:m=>{let g=parseInt(m,10),b=e.model._getTrackedRange(e.trackedRanges[g]);return e.trackedRangesDirection[g]===0?new Z(b.startLineNumber,b.startColumn,b.endLineNumber,b.endColumn):new Z(b.endLineNumber,b.endColumn,b.startLineNumber,b.startColumn)}})):u[f]=e.selectionsBefore[f];return u});a||(a=e.selectionsBefore);let l=[];for(let c in r)r.hasOwnProperty(c)&&l.push(parseInt(c,10));l.sort((c,h)=>h-c);for(let c of l)a.splice(c,1);return a}static _arrayIsEmpty(e){for(let t=0,i=e.length;t{D.isEmpty(d)&&u===""||n.push({identifier:{major:t,minor:r++},range:d,text:u,forceMoveMarkers:f,isAutoWhitespaceEdit:i.insertsAutoWhitespace})},a=!1,h={addEditOperation:o,addTrackedEditOperation:(d,u,f)=>{a=!0,o(d,u,f)},trackSelection:(d,u)=>{let f=Z.liftSelection(d),m;if(f.isEmpty())if(typeof u=="boolean")u?m=2:m=3;else{let w=e.model.getLineMaxColumn(f.startLineNumber);f.startColumn===w?m=2:m=3}else m=1;let g=e.trackedRanges.length,b=e.model._setTrackedRange(null,f,m);return e.trackedRanges[g]=b,e.trackedRangesDirection[g]=f.getDirection(),g.toString()}};try{i.getEditOperations(e.model,h)}catch(d){return de(d),{operations:[],hadTrackedEditOperation:!1}}return{operations:n,hadTrackedEditOperation:a}}static _getLoserCursorMap(e){e=e.slice(0),e.sort((i,n)=>-D.compareRangesUsingEnds(i.range,n.range));let t={};for(let i=1;ir.identifier.major?o=n.identifier.major:o=r.identifier.major,t[o.toString()]=!0;for(let a=0;a0&&i--}}return t}};var Du=class{constructor(e,t,i,n,r,o){this.id=e,this.label=t,this.alias=i,this._precondition=n,this._run=r,this._contextKeyService=o}isSupported(){return this._contextKeyService.contextMatchesRules(this._precondition)}run(){return this.isSupported()?this._run():Promise.resolve(void 0)}};var hN={getInitialState:()=>Ta,tokenize2:(s,e,t,i)=>Nm(0,s,t,i)};function ete(s,e=hN){return mO(s,e||hN)}function dN(s,e,t,i,n,r,o){let a="
",l=i,c=0;for(let h=0,d=e.getCount();h0;)f+=o?" ":" ",g--;break;case 60:f+="<";break;case 62:f+=">";break;case 38:f+="&";break;case 0:f+="�";break;case 65279:case 8232:case 8233:case 133:f+="\uFFFD";break;case 13:f+="​";break;case 32:f+=o?" ":" ";break;default:f+=String.fromCharCode(m)}}if(a+=`${f}`,u>n||l>=n)break}return a+="
",a}function mO(s,e){let t='
',i=is(s),n=e.getInitialState();for(let r=0,o=i.length;r0&&(t+="
");let l=e.tokenize2(a,!0,n,0);et.convertToEndOffset(l.tokens,a.length);let h=new et(l.tokens,a).inflate(),d=0;for(let u=0,f=h.getCount();u${qf(a.substring(d,g))}`,d=g}n=l.endState}return t+="
",t}var uN=class{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)}mustCommit(){return this._hasPending}commit(e){if(!this._hasPending)return;let t=this._inserts,i=this._changes,n=this._removes;this._hasPending=!1,this._inserts=[],this._changes=[],this._removes=[],e._commitPendingChanges(t,i,n)}},fN=class{constructor(e,t,i,n,r){this.id=e,this.afterLineNumber=t,this.ordinal=i,this.height=n,this.minWidth=r,this.prefixSum=0}},rl=class{constructor(e,t,i,n){this._instanceId=im(++rl.INSTANCE_COUNT),this._pendingChanges=new uN,this._lastWhitespaceId=0,this._arr=[],this._prefixSumValidIndex=-1,this._minWidth=-1,this._lineCount=e,this._lineHeight=t,this._paddingTop=i,this._paddingBottom=n}static findInsertionIndex(e,t,i){let n=0,r=e.length;for(;n>>1;t===e[o].afterLineNumber?i{t=!0,n=n|0,r=r|0,o=o|0,a=a|0;let l=this._instanceId+ ++this._lastWhitespaceId;return this._pendingChanges.insert(new fN(l,n,r,o,a)),l},changeOneWhitespace:(n,r,o)=>{t=!0,r=r|0,o=o|0,this._pendingChanges.change({id:n,newAfterLineNumber:r,newHeight:o})},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(let l of e)this._insertWhitespace(l);for(let l of t)this._changeOneWhitespace(l.id,l.newAfterLineNumber,l.newHeight);for(let l of i){let c=this._findWhitespaceIndex(l.id);c!==-1&&this._removeWhitespace(c)}return}let n=new Set;for(let l of i)n.add(l.id);let r=new Map;for(let l of t)r.set(l.id,l);let o=l=>{let c=[];for(let h of l)if(!n.has(h.id)){if(r.has(h.id)){let d=r.get(h.id);h.afterLineNumber=d.newAfterLineNumber,h.height=d.newHeight}c.push(h)}return c},a=o(this._arr).concat(o(e));a.sort((l,c)=>l.afterLineNumber===c.afterLineNumber?l.ordinal-c.ordinal:l.afterLineNumber-c.afterLineNumber),this._arr=a,this._prefixSumValidIndex=-1}_checkPendingChanges(){this._pendingChanges.mustCommit()&&this._pendingChanges.commit(this)}_insertWhitespace(e){let t=rl.findInsertionIndex(this._arr,e.afterLineNumber,e.ordinal);this._arr.splice(t,0,e),this._prefixSumValidIndex=Math.min(this._prefixSumValidIndex,t-1)}_findWhitespaceIndex(e){let t=this._arr;for(let i=0,n=t.length;it&&(this._arr[i].afterLineNumber-=t-e+1)}}onLinesInserted(e,t){this._checkPendingChanges(),e=e|0,t=t|0,this._lineCount+=t-e+1;for(let i=0,n=this._arr.length;i=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;let i=this._findLastWhitespaceBeforeLineNumber(e)+1;return i1?t=this._lineHeight*(e-1):t=0;let i=this.getWhitespaceAccumulatedHeightBeforeLineNumber(e);return t+i+this._paddingTop}getWhitespaceMinWidth(){if(this._checkPendingChanges(),this._minWidth===-1){let e=0;for(let t=0,i=this._arr.length;tt}isInTopPadding(e){return this._paddingTop===0?!1:(this._checkPendingChanges(),e=t-this._paddingBottom}getLineNumberAtOrAfterVerticalOffset(e){if(this._checkPendingChanges(),e=e|0,e<0)return 1;let t=this._lineCount|0,i=this._lineHeight,n=1,r=t;for(;n=a+i)n=o+1;else{if(e>=a)return o;r=o}}return n>t?t:n}getLinesViewportData(e,t){this._checkPendingChanges(),e=e|0,t=t|0;let i=this._lineHeight,n=this.getLineNumberAtOrAfterVerticalOffset(e)|0,r=this.getVerticalOffsetForLineNumber(n)|0,o=this._lineCount|0,a=this.getFirstWhitespaceIndexAfterLineNumber(n)|0,l=this.getWhitespacesCount()|0,c,h;a===-1?(a=l,h=o+1,c=0):(h=this.getAfterLineNumberForWhitespaceIndex(a)|0,c=this.getHeightForWhitespaceIndex(a)|0);let d=r,u=d,f=5e5,m=0;r>=f&&(m=Math.floor(r/f)*f,m=Math.floor(m/i)*i,u-=m);let g=[],b=e+(t-e)/2,w=-1;for(let y=n;y<=o;y++){if(w===-1){let x=d,S=d+i;(x<=b&&bb)&&(w=y)}for(d+=i,g[y-n]=u,u+=i;h===y;)u+=c,d+=c,a++,a>=l?h=o+1:(h=this.getAfterLineNumberForWhitespaceIndex(a)|0,c=this.getHeightForWhitespaceIndex(a)|0);if(d>=t){o=y;break}}w===-1&&(w=o);let _=this.getVerticalOffsetForLineNumber(o)|0,v=n,C=o;return vt&&C--,{bigNumbersDelta:m,startLineNumber:n,endLineNumber:o,relativeVerticalOffset:g,centeredLineNumber:w,completelyVisibleStartLineNumber:v,completelyVisibleEndLineNumber:C}}getVerticalOffsetForWhitespaceIndex(e){this._checkPendingChanges(),e=e|0;let t=this.getAfterLineNumberForWhitespaceIndex(e),i;t>=1?i=this._lineHeight*t:i=0;let n;return e>0?n=this.getWhitespacesAccumulatedHeight(e-1):n=0,i+n+this._paddingTop}getWhitespaceIndexAtOrAfterVerticallOffset(e){this._checkPendingChanges(),e=e|0;let t=0,i=this.getWhitespacesCount()-1;if(i<0)return-1;let n=this.getVerticalOffsetForWhitespaceIndex(i),r=this.getHeightForWhitespaceIndex(i);if(e>=n+r)return-1;for(;t=a+l)t=o+1;else{if(e>=a)return o;i=o}}return t}getWhitespaceAtVerticalOffset(e){this._checkPendingChanges(),e=e|0;let t=this.getWhitespaceIndexAtOrAfterVerticallOffset(e);if(t<0||t>=this.getWhitespacesCount())return null;let i=this.getVerticalOffsetForWhitespaceIndex(t);if(i>e)return null;let n=this.getHeightForWhitespaceIndex(t),r=this.getIdForWhitespaceIndex(t),o=this.getAfterLineNumberForWhitespaceIndex(t);return{id:r,afterLineNumber:o,verticalOffset:i,height:n}}getWhitespaceViewportData(e,t){this._checkPendingChanges(),e=e|0,t=t|0;let i=this.getWhitespaceIndexAtOrAfterVerticallOffset(e),n=this.getWhitespacesCount()-1;if(i<0)return[];let r=[];for(let o=i;o<=n;o++){let a=this.getVerticalOffsetForWhitespaceIndex(o),l=this.getHeightForWhitespaceIndex(o);if(a>=t)break;r.push({id:this.getIdForWhitespaceIndex(o),afterLineNumber:this.getAfterLineNumberForWhitespaceIndex(o),verticalOffset:a,height:l})}return r}getWhitespaces(){return this._checkPendingChanges(),this._arr.slice(0)}getWhitespacesCount(){return this._checkPendingChanges(),this._arr.length}getIdForWhitespaceIndex(e){return this._checkPendingChanges(),e=e|0,this._arr[e].id}getAfterLineNumberForWhitespaceIndex(e){return this._checkPendingChanges(),e=e|0,this._arr[e].afterLineNumber}getHeightForWhitespaceIndex(e){return this._checkPendingChanges(),e=e|0,this._arr[e].height}};rl.INSTANCE_COUNT=0;var gO=125,Kc=class{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}},mN=class extends M{constructor(e,t){super();this._onDidContentSizeChange=this._register(new k),this.onDidContentSizeChange=this._onDidContentSizeChange.event,this._dimensions=new Kc(0,0,0,0),this._scrollable=this._register(new _r(e,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;let t=this._dimensions;this._dimensions=e,this._scrollable.setScrollDimensions({width:e.width,scrollWidth:e.scrollWidth,height:e.height,scrollHeight:e.scrollHeight},!0);let i=t.contentWidth!==e.contentWidth,n=t.contentHeight!==e.contentHeight;(i||n)&&this._onDidContentSizeChange.fire(new yu(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)}},x0=class extends M{constructor(e,t,i){super();this._configuration=e;let n=this._configuration.options,r=n.get(129),o=n.get(73);this._linesLayout=new rl(t,n.get(57),o.top,o.bottom),this._scrollable=this._register(new mN(0,i)),this._configureSmoothScrollDuration(),this._scrollable.setScrollDimensions(new Kc(r.contentWidth,0,r.height,0)),this.onDidScroll=this._scrollable.onDidScroll,this.onDidContentSizeChange=this._scrollable.onDidContentSizeChange,this._updateHeight()}dispose(){super.dispose()}getScrollable(){return this._scrollable.getScrollable()}onHeightMaybeChanged(){this._updateHeight()}_configureSmoothScrollDuration(){this._scrollable.setSmoothScrollDuration(this._configuration.options.get(102)?gO:0)}onConfigurationChanged(e){let t=this._configuration.options;if(e.hasChanged(57)&&this._linesLayout.setLineHeight(t.get(57)),e.hasChanged(73)){let i=t.get(73);this._linesLayout.setPadding(i.top,i.bottom)}if(e.hasChanged(129)){let i=t.get(129),n=i.contentWidth,r=i.height,o=this._scrollable.getScrollDimensions(),a=o.contentWidth;this._scrollable.setScrollDimensions(new Kc(n,o.contentWidth,r,this._getContentHeight(n,r,a)))}else this._updateHeight();e.hasChanged(102)&&this._configureSmoothScrollDuration()}onFlushed(e){this._linesLayout.onFlushed(e)}onLinesDeleted(e,t){this._linesLayout.onLinesDeleted(e,t)}onLinesInserted(e,t){this._linesLayout.onLinesInserted(e,t)}_getHorizontalScrollbarHeight(e,t){let n=this._configuration.options.get(91);return n.horizontal===2||e>=t?0:n.horizontalScrollbarSize}_getContentHeight(e,t,i){let n=this._configuration.options,r=this._linesLayout.getLinesTotalHeight();return n.get(93)?r+=Math.max(0,t-n.get(57)-n.get(73).bottom):r+=this._getHorizontalScrollbarHeight(e,i),r}_updateHeight(){let e=this._scrollable.getScrollDimensions(),t=e.width,i=e.height,n=e.contentWidth;this._scrollable.setScrollDimensions(new Kc(t,e.contentWidth,i,this._getContentHeight(t,i,n)))}getCurrentViewport(){let e=this._scrollable.getScrollDimensions(),t=this._scrollable.getCurrentScrollPosition();return new Ag(t.scrollTop,t.scrollLeft,e.width,e.height)}getFutureViewport(){let e=this._scrollable.getScrollDimensions(),t=this._scrollable.getFutureScrollPosition();return new Ag(t.scrollTop,t.scrollLeft,e.width,e.height)}_computeContentWidth(e){let t=this._configuration.options,i=t.get(130),n=t.get(41);if(i.isViewportWrapping){let r=t.get(129),o=t.get(63);return e>r.contentWidth+n.typicalHalfwidthCharacterWidth&&o.enabled&&o.side==="right"?e+r.verticalScrollbarWidth:e}else{let r=t.get(92)*n.typicalHalfwidthCharacterWidth,o=this._linesLayout.getWhitespaceMinWidth();return Math.max(e+r,o)}}setMaxLineWidth(e){let t=this._scrollable.getScrollDimensions();this._scrollable.setScrollDimensions(new Kc(t.width,this._computeContentWidth(e),t.height,t.contentHeight)),this._updateHeight()}saveState(){let 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){let t=this._linesLayout.changeWhitespace(e);return t&&this.onHeightMaybeChanged(),t}getVerticalOffsetForLineNumber(e){return this._linesLayout.getVerticalOffsetForLineNumber(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(){let e=this.getCurrentViewport();return this._linesLayout.getLinesViewportData(e.top,e.top+e.height)}getLinesViewportDataAtScrollTop(e){let 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(){let 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)}deltaScrollNow(e,t){let i=this._scrollable.getCurrentScrollPosition();this._scrollable.setScrollPositionNow({scrollLeft:i.scrollLeft+e,scrollTop:i.scrollTop+t})}};var gN=class{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){return this._lines.convertModelPositionToViewPosition(e.lineNumber,e.column,t)}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)}},pN=class{constructor(e){this._counts=e,this._isValid=!1,this._validEndIndex=-1,this._modelToView=[],this._viewToModel=[]}_invalidate(e){this._isValid=!1,this._validEndIndex=Math.min(this._validEndIndex,e-1)}_ensureValid(){if(!this._isValid){for(let e=this._validEndIndex+1,t=this._counts.length;e0?this._modelToView[e-1]:0;this._modelToView[e]=n+i;for(let r=0;r0?this._modelToView[t-1]:0;return new Eg(t,e-i)}},D0=class{constructor(e,t,i,n,r,o,a,l,c){this._editorId=e,this.model=t,this._validModelVersionId=-1,this._domLineBreaksComputerFactory=i,this._monospaceLineBreaksComputerFactory=n,this.fontInfo=r,this.tabSize=o,this.wrappingStrategy=a,this.wrappingColumn=l,this.wrappingIndent=c,this._constructLines(!0,null)}dispose(){this.hiddenAreasIds=this.model.deltaDecorations(this.hiddenAreasIds,[])}createCoordinatesConverter(){return new gN(this)}_constructLines(e,t){this.lines=[],e&&(this.hiddenAreasIds=[]);let i=this.model.getLinesContent(),n=this.model.getInjectedTextDecorations(this._editorId),r=Si.fromDecorations(n),o=i.length,a=this.createLineBreaksComputer(),l=r.length,c=0,h=cthis.model.getDecorationRange(_)).sort(D.compareRangesUsingStarts),m=1,g=0,b=-1,w=b+1=m&&v<=g,y=k0(d[_],!C);u[_]=y.getViewLineCount(),this.lines[_]=y}this._validModelVersionId=this.model.getVersionId(),this.prefixSumComputer=new pN(u)}getHiddenAreas(){return this.hiddenAreasIds.map(e=>this.model.getDecorationRange(e))}_reduceRanges(e){if(e.length===0)return[];let t=e.map(o=>this.model.validateRange(o)).sort(D.compareRangesUsingStarts),i=[],n=t[0].startLineNumber,r=t[0].endLineNumber;for(let o=1,a=t.length;or+1?(i.push(new D(n,1,r,1)),n=l.startLineNumber,r=l.endLineNumber):l.endLineNumber>r&&(r=l.endLineNumber)}return i.push(new D(n,1,r,1)),i}setHiddenAreas(e){let t=this._reduceRanges(e),i=this.hiddenAreasIds.map(d=>this.model.getDecorationRange(d)).sort(D.compareRangesUsingStarts);if(t.length===i.length){let d=!1;for(let u=0;u=o&&u<=a?this.lines[d].isVisible()&&(this.lines[d]=this.lines[d].setVisible(!1),f=!0):(h=!0,this.lines[d].isVisible()||(this.lines[d]=this.lines[d].setVisible(!0),f=!0)),f){let m=this.lines[d].getViewLineCount();this.prefixSumComputer.changeValue(d,m)}}return h||this.setHiddenAreas([]),!0}modelPositionIsVisible(e,t){return e<1||e>this.lines.length?!1:this.lines[e-1].isVisible()}getModelLineViewLineCount(e){return e<1||e>this.lines.length?1:this.lines[e-1].getViewLineCount()}setTabSize(e){return this.tabSize===e?!1:(this.tabSize=e,this._constructLines(!1,null),!0)}setWrappingSettings(e,t,i,n){let r=this.fontInfo.equals(e),o=this.wrappingStrategy===t,a=this.wrappingColumn===i,l=this.wrappingIndent===n;if(r&&o&&a&&l)return!1;let c=r&&o&&!a&&l;this.fontInfo=e,this.wrappingStrategy=t,this.wrappingColumn=i,this.wrappingIndent=n;let h=null;if(c){h=[];for(let d=0,u=this.lines.length;d2&&!this.lines[t-2].isVisible(),o=t===1?1:this.prefixSumComputer.getAccumulatedValue(t-2)+1,a=0,l=[],c=[];for(let h=0,d=n.length;hl?(h=t===1?1:this.prefixSumComputer.getAccumulatedValue(t-2)+1,d=h+l-1,m=d+1,g=m+(r-l)-1,c=!0):rt?t:e|0}getActiveIndentGuide(e,t,i){e=this._toValidViewLineNumber(e),t=this._toValidViewLineNumber(t),i=this._toValidViewLineNumber(i);let n=this.convertViewPositionToModelPosition(e,this.getViewLineMinColumn(e)),r=this.convertViewPositionToModelPosition(t,this.getViewLineMinColumn(t)),o=this.convertViewPositionToModelPosition(i,this.getViewLineMinColumn(i)),a=this.model.getActiveIndentGuide(n.lineNumber,r.lineNumber,o.lineNumber),l=this.convertModelPositionToViewPosition(a.startLineNumber,1),c=this.convertModelPositionToViewPosition(a.endLineNumber,this.model.getLineMaxColumn(a.endLineNumber));return{startLineNumber:l.lineNumber,endLineNumber:c.lineNumber,indent:a.indent}}getViewLinesIndentGuides(e,t){e=this._toValidViewLineNumber(e),t=this._toValidViewLineNumber(t);let i=this.convertViewPositionToModelPosition(e,this.getViewLineMinColumn(e)),n=this.convertViewPositionToModelPosition(t,this.getViewLineMaxColumn(t)),r=[],o=[],a=[],l=i.lineNumber-1,c=n.lineNumber-1,h=null;for(let m=l;m<=c;m++){let g=this.lines[m];if(g.isVisible()){let b=g.getViewLineNumberOfModelPosition(0,m===l?i.column:1),w=g.getViewLineNumberOfModelPosition(0,this.model.getLineMaxColumn(m+1)),_=w-b+1,v=0;_>1&&g.getViewLineMinColumn(this.model,m+1,w)===1&&(v=b===0?1:2),o.push(_),a.push(v),h===null&&(h=new N(m+1,0))}else h!==null&&(r=r.concat(this.model.getLinesIndentGuides(h.lineNumber,m)),h=null)}h!==null&&(r=r.concat(this.model.getLinesIndentGuides(h.lineNumber,n.lineNumber)),h=null);let d=t-e+1,u=new Array(d),f=0;for(let m=0,g=r.length;mt&&(m=!0,f=t-r+1);let g=u+f;if(d.getViewLinesData(this.model,c+1,u,g,r-e,i,l),r+=f,m)break}return l}validateViewPosition(e,t,i){e=this._toValidViewLineNumber(e);let n=this.prefixSumComputer.getIndexOf(e-1),r=n.index,o=n.remainder,a=this.lines[r],l=a.getViewLineMinColumn(this.model,r+1,o),c=a.getViewLineMaxColumn(this.model,r+1,o);tc&&(t=c);let h=a.getModelColumnOfViewPosition(o,t);return this.model.validatePosition(new N(r+1,h)).equals(i)?new N(e,t):this.convertModelPositionToViewPosition(i.lineNumber,i.column)}validateViewRange(e,t){let i=this.validateViewPosition(e.startLineNumber,e.startColumn,t.getStartPosition()),n=this.validateViewPosition(e.endLineNumber,e.endColumn,t.getEndPosition());return new D(i.lineNumber,i.column,n.lineNumber,n.column)}convertViewPositionToModelPosition(e,t){e=this._toValidViewLineNumber(e);let i=this.prefixSumComputer.getIndexOf(e-1),n=i.index,r=i.remainder,o=this.lines[n].getModelColumnOfViewPosition(r,t);return this.model.validatePosition(new N(n+1,o))}convertViewRangeToModelRange(e){let t=this.convertViewPositionToModelPosition(e.startLineNumber,e.startColumn),i=this.convertViewPositionToModelPosition(e.endLineNumber,e.endColumn);return new D(t.lineNumber,t.column,i.lineNumber,i.column)}convertModelPositionToViewPosition(e,t,i=2){let n=this.model.validatePosition(new N(e,t)),r=n.lineNumber,o=n.column,a=r-1,l=!1;for(;a>0&&!this.lines[a].isVisible();)a--,l=!0;if(a===0&&!this.lines[a].isVisible())return new N(1,1);let c=1+(a===0?0:this.prefixSumComputer.getAccumulatedValue(a-1)),h;return l?h=this.lines[a].getViewPositionOfModelPosition(c,this.model.getLineMaxColumn(a+1),i):h=this.lines[r-1].getViewPositionOfModelPosition(c,o,i),h}convertModelRangeToViewRange(e,t=0){if(e.isEmpty()){let i=this.convertModelPositionToViewPosition(e.startLineNumber,e.startColumn,t);return D.fromPositions(i)}else{let i=this.convertModelPositionToViewPosition(e.startLineNumber,e.startColumn,1),n=this.convertModelPositionToViewPosition(e.endLineNumber,e.endColumn,0);return new D(i.lineNumber,i.column,n.lineNumber,n.column)}}_getViewLineNumberForModelPosition(e,t){let i=e-1;if(this.lines[i].isVisible()){let r=1+(i===0?0:this.prefixSumComputer.getAccumulatedValue(i-1));return this.lines[i].getViewLineNumberOfModelPosition(r,t)}for(;i>0&&!this.lines[i].isVisible();)i--;if(i===0&&!this.lines[i].isVisible())return 1;let n=1+(i===0?0:this.prefixSumComputer.getAccumulatedValue(i-1));return this.lines[i].getViewLineNumberOfModelPosition(n,this.model.getLineMaxColumn(i+1))}getAllOverviewRulerDecorations(e,t,i){let n=this.model.getOverviewRulerDecorations(e,t),r=new N0;for(let o of n){let a=o.options.overviewRuler,l=a?a.position:0;if(l===0)continue;let c=a.getColor(i),h=this._getViewLineNumberForModelPosition(o.range.startLineNumber,o.range.startColumn),d=this._getViewLineNumberForModelPosition(o.range.endLineNumber,o.range.endColumn);r.accept(c,h,d,l)}return r.result}getDecorationsInRange(e,t,i){let n=this.convertViewPositionToModelPosition(e.startLineNumber,e.startColumn),r=this.convertViewPositionToModelPosition(e.endLineNumber,e.endColumn);if(r.lineNumber-n.lineNumber<=e.endLineNumber-e.startLineNumber)return this.model.getDecorationsInRange(new D(n.lineNumber,1,r.lineNumber,r.column),t,i);let o=[],a=n.lineNumber-1,l=r.lineNumber-1,c=null;for(let f=a;f<=l;f++)if(this.lines[f].isVisible())c===null&&(c=new N(f+1,f===a?n.column:1));else if(c!==null){let g=this.model.getLineMaxColumn(f);o=o.concat(this.model.getDecorationsInRange(new D(c.lineNumber,c.column,f,g),t,i)),c=null}c!==null&&(o=o.concat(this.model.getDecorationsInRange(new D(c.lineNumber,c.column,r.lineNumber,r.column),t,i)),c=null),o.sort((f,m)=>{let g=D.compareRangesUsingStarts(f.range,m.range);return g===0?f.idm.id?1:0:g});let h=[],d=0,u=null;for(let f of o){let m=f.id;u!==m&&(u=m,h[d++]=f)}return h}getInjectedTextAt(e){let t=this._toValidViewLineNumber(e.lineNumber),i=this.prefixSumComputer.getIndexOf(t-1),n=i.index,r=i.remainder;return this.lines[n].getInjectedTextAt(r,e.column)}normalizePosition(e,t){let i=this._toValidViewLineNumber(e.lineNumber),n=this.prefixSumComputer.getIndexOf(i-1),r=n.index,o=n.remainder;return this.lines[r].normalizePosition(this.model,r+1,o,e,t)}getLineIndentColumn(e){let t=this._toValidViewLineNumber(e),i=this.prefixSumComputer.getIndexOf(t-1),n=i.index;return i.remainder===0?this.model.getLineIndentColumn(n+1):0}},Eu=class{constructor(){}isVisible(){return!0}setVisible(e){return e?this:ku.INSTANCE}getLineBreakData(){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){let n=e.getLineTokens(t),r=n.getLineContent();return new jd(r,!1,1,r.length+1,0,n.inflate(),null)}getViewLinesData(e,t,i,n,r,o,a){if(!o[r]){a[r]=null;return}a[r]=this.getViewLineData(e,t,0)}getModelColumnOfViewPosition(e,t){return t}getViewPositionOfModelPosition(e,t){return new N(e,t)}getViewLineNumberOfModelPosition(e,t){return e}normalizePosition(e,t,i,n,r){return n}getInjectedTextAt(e,t){return null}};Eu.INSTANCE=new Eu;var ku=class{constructor(){}isVisible(){return!1}setVisible(e){return e?Eu.INSTANCE:this}getLineBreakData(){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){throw new Error("Not supported")}getViewLinesData(e,t,i,n,r,o,a){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,n,r){throw new Error("Not supported")}getInjectedTextAt(e,t){throw new Error("Not supported")}};ku.INSTANCE=new ku;var _N=class{constructor(e,t){this._lineBreakData=e,this._isVisible=t}isVisible(){return this._isVisible}setVisible(e){return this._isVisible=e,this}getLineBreakData(){return this._lineBreakData}getViewLineCount(){return this._isVisible?this._lineBreakData.breakOffsets.length:0}getInputStartOffsetOfOutputLineIndex(e){return this._lineBreakData.getInputOffsetOfOutputPosition(e,0)}getInputEndOffsetOfOutputLineIndex(e,t,i){return i+1===this._lineBreakData.breakOffsets.length?e.getLineMaxColumn(t)-1:this._lineBreakData.getInputOffsetOfOutputPosition(i+1,0)}getViewLineContent(e,t,i){if(!this._isVisible)throw new Error("Not supported");let n=i>0?this._lineBreakData.breakOffsets[i-1]:0,r=inew Si(0,0,l+1,this._lineBreakData.injectionOptions[c],0));o=Si.applyInjectedText(e.getLineContent(t),a).substring(n,r)}else o=e.getValueInRange({startLineNumber:t,startColumn:n+1,endLineNumber:t,endColumn:r+1});return i>0&&(o=bN(this._lineBreakData.wrappedTextIndentLength)+o),o}getViewLineLength(e,t,i){if(!this._isVisible)throw new Error("Not supported");let n=i>0?this._lineBreakData.breakOffsets[i-1]:0,o=(i0&&(o=this._lineBreakData.wrappedTextIndentLength+o),o}getViewLineMinColumn(e,t,i){if(!this._isVisible)throw new Error("Not supported");return this._getViewLineMinColumn(i)}_getViewLineMinColumn(e){return e>0?this._lineBreakData.wrappedTextIndentLength+1:1}getViewLineMaxColumn(e,t,i){if(!this._isVisible)throw new Error("Not supported");return this.getViewLineLength(e,t,i)+1}getViewLineData(e,t,i){if(!this._isVisible)throw new Error("Not supported");let n=this._lineBreakData,r=i>0?n.wrappedTextIndentLength:0,o=n.injectionOffsets,a=n.injectionOptions,l,c,h;if(o){let g=e.getLineTokens(t).withInserted(o.map((v,C)=>({offset:v,text:a[C].content,tokenMetadata:et.defaultTokenMetadata}))),b=i>0?n.breakOffsets[i-1]:0,w=n.breakOffsets[i];l=g.getLineContent().substring(b,w),c=g.sliceAndInflate(b,w,r),h=new Array;let _=0;for(let v=0;vw)break;if(b0?n.wrappedTextIndentLength:0,E=L+Math.max(y-b,0),T=L+Math.min(x-b,w);E!==T&&h.push(new Cv(E,T,S.inlineClassName,S.inlineClassNameAffectsLetterSpacing))}}_+=C}}else{let g=this.getInputStartOffsetOfOutputLineIndex(i),b=this.getInputEndOffsetOfOutputLineIndex(e,t,i),w=e.getLineTokens(t);l=e.getValueInRange({startLineNumber:t,startColumn:g+1,endLineNumber:t,endColumn:b+1}),c=w.sliceAndInflate(g,b,r),h=null}i>0&&(l=bN(n.wrappedTextIndentLength)+l);let d=i>0?n.wrappedTextIndentLength+1:1,u=l.length+1,f=i+10&&(i0&&(o+=this._lineBreakData.wrappedTextIndentLength),new N(e+r,o)}getViewLineNumberOfModelPosition(e,t){if(!this._isVisible)throw new Error("Not supported");let i=this._lineBreakData.getOutputPositionOfInputOffset(t-1);return e+i.outputLineIndex}normalizePosition(e,t,i,n,r){if(this._lineBreakData.injectionOffsets!==null){let o=n.lineNumber-i,a=this._lineBreakData.outputPositionToOffsetInUnwrappedLine(i,n.column-1),l=this._lineBreakData.normalizeOffsetAroundInjections(a,r);if(l!==a)return this._lineBreakData.getOutputPositionOfOffsetInUnwrappedLine(l,r).toPosition(o,this._lineBreakData.wrappedTextIndentLength)}if(r===0){if(i>0&&n.column===this._getViewLineMinColumn(i))return new N(n.lineNumber-1,this.getViewLineMaxColumn(e,t,i-1))}else if(r===1){let o=this.getViewLineCount()-1;if(i=E0.length)for(let e=1;e<=s;e++)E0[e]=pO(e);return E0[s]}function pO(s){return new Array(s+1).join(" ")}function k0(s,e){return s===null?e?Eu.INSTANCE:ku.INSTANCE:new _N(s,e)}var wN=class{constructor(e){this._lines=e}_validPosition(e){return this._lines.model.validatePosition(e)}_validRange(e){return this._lines.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){let t=this._lines.model.getLineCount();return!(e.lineNumber<1||e.lineNumber>t)}getModelLineViewLineCount(e){return 1}},I0=class{constructor(e){this.model=e}dispose(){}createCoordinatesConverter(){return new wN(this)}getHiddenAreas(){return[]}setHiddenAreas(e){return!1}setTabSize(e){return!1}setWrappingSettings(e,t,i,n){return!1}createLineBreaksComputer(){let e=[];return{addRequest:(t,i,n)=>{e.push(null)},finalize:()=>e}}onModelFlushed(){}onModelLinesDeleted(e,t,i){return new Cu(t,i)}onModelLinesInserted(e,t,i,n){return new Su(t,i)}onModelLineChanged(e,t,i){return[!1,new pp(t,t),null,null]}acceptVersionId(e){}getViewLineCount(){return this.model.getLineCount()}getActiveIndentGuide(e,t,i){return{startLineNumber:e,endLineNumber:e,indent:0}}getViewLinesIndentGuides(e,t){let i=t-e+1,n=new Array(i);for(let r=0;r=t){i>a&&(r[r.length-1]=i);return}r.push(n,t,i)}else this.result[e]=[n,t,i]}};var T0=class{constructor(e,t,i,n,r){this.editorId=e,this.model=t,this.configuration=i,this._linesCollection=n,this._coordinatesConverter=r,this._decorationsCache=Object.create(null),this._cachedModelDecorationsResolver=null,this._cachedModelDecorationsResolverViewRange=null}_clearCachedModelDecorationsResolver(){this._cachedModelDecorationsResolver=null,this._cachedModelDecorationsResolverViewRange=null}dispose(){this._decorationsCache=Object.create(null),this._clearCachedModelDecorationsResolver()}reset(){this._decorationsCache=Object.create(null),this._clearCachedModelDecorationsResolver()}onModelDecorationsChanged(){this._decorationsCache=Object.create(null),this._clearCachedModelDecorationsResolver()}onLineMappingChanged(){this._decorationsCache=Object.create(null),this._clearCachedModelDecorationsResolver()}_getOrCreateViewModelDecoration(e){let t=e.id,i=this._decorationsCache[t];if(!i){let n=e.range,r=e.options,o;if(r.isWholeLine){let a=this._coordinatesConverter.convertModelPositionToViewPosition(new N(n.startLineNumber,1),0),l=this._coordinatesConverter.convertModelPositionToViewPosition(new N(n.endLineNumber,this.model.getLineMaxColumn(n.endLineNumber)),1);o=new D(a.lineNumber,a.column,l.lineNumber,l.column)}else o=this._coordinatesConverter.convertModelRangeToViewRange(n,1);i=new zd(o,r),this._decorationsCache[t]=i}return i}getDecorationsViewportData(e){let t=this._cachedModelDecorationsResolver!==null;return t=t&&e.equalsRange(this._cachedModelDecorationsResolverViewRange),t||(this._cachedModelDecorationsResolver=this._getDecorationsViewportData(e),this._cachedModelDecorationsResolverViewRange=e),this._cachedModelDecorationsResolver}_getDecorationsViewportData(e){let t=this._linesCollection.getDecorationsInRange(e,this.editorId,Zl(this.configuration.options)),i=e.startLineNumber,n=e.endLineNumber,r=[],o=0,a=[];for(let l=i;l<=n;l++)a[l-i]=[];for(let l=0,c=t.length;lthis.tokenizeViewport(),50)),this._updateConfigurationViewLineCount=this._register(new $e(()=>this._updateConfigurationViewLineCountNow(),0)),this._hasFocus=!1,this._viewportStartLine=-1,this._viewportStartLineTrackedRange=null,this._viewportStartLineDelta=0,_O&&this.model.isTooLargeForTokenization())this._lines=new I0(this.model);else{let a=this._configuration.options,l=a.get(41),c=a.get(123),h=a.get(130),d=a.get(122);this._lines=new D0(this._editorId,this.model,n,r,l,this.model.getOptions().tabSize,c,h.wrappingColumn,d)}this.coordinatesConverter=this._lines.createCoordinatesConverter(),this._cursor=this._register(new br(i,this,this.coordinatesConverter,this.cursorConfig)),this.viewLayout=this._register(new x0(this._configuration,this.getLineCount(),o)),this._register(this.viewLayout.onDidScroll(a=>{a.scrollTopChanged&&this._tokenizeViewportSoon.schedule(),this._eventDispatcher.emitSingleViewEvent(new p0(a)),this._eventDispatcher.emitOutgoingEvent(new xu(a.oldScrollWidth,a.oldScrollLeft,a.oldScrollHeight,a.oldScrollTop,a.scrollWidth,a.scrollLeft,a.scrollHeight,a.scrollTop))})),this._register(this.viewLayout.onDidContentSizeChange(a=>{this._eventDispatcher.emitOutgoingEvent(a)})),this._decorations=new T0(this._editorId,this.model,this._configuration,this._lines,this.coordinatesConverter),this._registerModelEvents(),this._register(this._configuration.onDidChangeFast(a=>{try{let l=this._eventDispatcher.beginEmitViewEvents();this._onConfigurationChanged(l,a)}finally{this._eventDispatcher.endEmitViewEvents()}})),this._register(Eo.getInstance().onDidChange(()=>{this._eventDispatcher.emitSingleViewEvent(new w0)})),this._updateConfigurationViewLineCountNow()}dispose(){super.dispose(),this._decorations.dispose(),this._lines.dispose(),this.invalidateMinimapColorCache(),this._viewportStartLineTrackedRange=this.model._setTrackedRange(this._viewportStartLineTrackedRange,null,1),this._eventDispatcher.dispose()}createLineBreaksComputer(){return this._lines.createLineBreaksComputer()}addViewEventHandler(e){this._eventDispatcher.addViewEventHandler(e)}removeViewEventHandler(e){this._eventDispatcher.removeViewEventHandler(e)}_updateConfigurationViewLineCountNow(){this._configuration.setViewLineCount(this._lines.getViewLineCount())}tokenizeViewport(){let e=this.viewLayout.getLinesViewportData(),t=this.coordinatesConverter.convertViewPositionToModelPosition(new N(e.startLineNumber,1)),i=this.coordinatesConverter.convertViewPositionToModelPosition(new N(e.endLineNumber,1));this.model.tokenizeViewport(t.lineNumber,i.lineNumber)}setHasFocus(e){this._hasFocus=e,this._cursor.setHasFocus(e),this._eventDispatcher.emitSingleViewEvent(new m0(e)),this._eventDispatcher.emitOutgoingEvent(new Lu(!e,e))}onCompositionStart(){this._eventDispatcher.emitSingleViewEvent(new h0)}onCompositionEnd(){this._eventDispatcher.emitSingleViewEvent(new d0)}onDidColorThemeChange(){this._eventDispatcher.emitSingleViewEvent(new _0)}_onConfigurationChanged(e,t){let i=null;if(this._viewportStartLine!==-1){let h=new N(this._viewportStartLine,this.getLineMinColumn(this._viewportStartLine));i=this.coordinatesConverter.convertViewPositionToModelPosition(h)}let n=!1,r=this._configuration.options,o=r.get(41),a=r.get(123),l=r.get(130),c=r.get(122);if(this._lines.setWrappingSettings(o,a,l.wrappingColumn,c)&&(e.emitViewEvent(new Hc),e.emitViewEvent(new Uc),e.emitViewEvent(new ko(null)),this._cursor.onLineMappingChanged(e),this._decorations.onLineMappingChanged(),this.viewLayout.onFlushed(this.getLineCount()),this.viewLayout.getCurrentScrollTop()!==0&&(n=!0),this._updateConfigurationViewLineCount.schedule()),t.hasChanged(79)&&(this._decorations.reset(),e.emitViewEvent(new ko(null))),e.emitViewEvent(new u0(t)),this.viewLayout.onConfigurationChanged(t),n&&i){let h=this.coordinatesConverter.convertModelPositionToViewPosition(i),d=this.viewLayout.getVerticalOffsetForLineNumber(h.lineNumber);this.viewLayout.setScrollPosition({scrollTop:d+this._viewportStartLineDelta},1)}Ki.shouldRecreate(t)&&(this.cursorConfig=new Ki(this.model.getLanguageIdentifier(),this.model.getOptions(),this._configuration),this._cursor.updateConfiguration(this.cursorConfig))}_registerModelEvents(){this._register(this.model.onDidChangeContentOrInjectedText(e=>{try{let t=this._eventDispatcher.beginEmitViewEvents(),i=!1,n=!1,r=e.changes,o=e instanceof ms?e.versionId:null,a=this._lines.createLineBreaksComputer();for(let h of r)switch(h.changeType){case 4:{for(let d=0;d!m.ownerId||m.ownerId===this._editorId)),a.addRequest(u,f,null)}break}case 2:{let d=null;h.injectedText&&(d=h.injectedText.filter(u=>!u.ownerId||u.ownerId===this._editorId)),a.addRequest(h.detail,d,null);break}}let l=a.finalize(),c=0;for(let h of r)switch(h.changeType){case 1:{this._lines.onModelFlushed(),t.emitViewEvent(new Hc),this._decorations.reset(),this.viewLayout.onFlushed(this.getLineCount()),i=!0;break}case 3:{let d=this._lines.onModelLinesDeleted(o,h.fromLineNumber,h.toLineNumber);d!==null&&(t.emitViewEvent(d),this.viewLayout.onLinesDeleted(d.fromLineNumber,d.toLineNumber)),i=!0;break}case 4:{let d=l.slice(c,c+h.detail.length);c+=h.detail.length;let u=this._lines.onModelLinesInserted(o,h.fromLineNumber,h.toLineNumber,d);u!==null&&(t.emitViewEvent(u),this.viewLayout.onLinesInserted(u.fromLineNumber,u.toLineNumber)),i=!0;break}case 2:{let d=l[c];c++;let[u,f,m,g]=this._lines.onModelLineChanged(o,h.lineNumber,d);n=u,f&&t.emitViewEvent(f),m&&(t.emitViewEvent(m),this.viewLayout.onLinesInserted(m.fromLineNumber,m.toLineNumber)),g&&(t.emitViewEvent(g),this.viewLayout.onLinesDeleted(g.fromLineNumber,g.toLineNumber));break}case 5:break}o!==null&&this._lines.acceptVersionId(o),this.viewLayout.onHeightMaybeChanged(),!i&&n&&(t.emitViewEvent(new Uc),t.emitViewEvent(new ko(null)),this._cursor.onLineMappingChanged(t),this._decorations.onLineMappingChanged())}finally{this._eventDispatcher.endEmitViewEvents()}if(this._viewportStartLine=-1,this._configuration.setMaxLineNumber(this.model.getLineCount()),this._updateConfigurationViewLineCountNow(),!this._hasFocus&&this.model.getAttachedEditorCount()>=2&&this._viewportStartLineTrackedRange){let t=this.model._getTrackedRange(this._viewportStartLineTrackedRange);if(t){let i=this.coordinatesConverter.convertModelPositionToViewPosition(t.getStartPosition()),n=this.viewLayout.getVerticalOffsetForLineNumber(i.lineNumber);this.viewLayout.setScrollPosition({scrollTop:n+this._viewportStartLineDelta},1)}}try{let t=this._eventDispatcher.beginEmitViewEvents();this._cursor.onModelContentChanged(t,e)}finally{this._eventDispatcher.endEmitViewEvents()}})),this._register(this.model.onDidChangeTokens(e=>{let t=[];for(let i=0,n=e.ranges.length;i{this._eventDispatcher.emitSingleViewEvent(new g0),this.cursorConfig=new Ki(this.model.getLanguageIdentifier(),this.model.getOptions(),this._configuration),this._cursor.updateConfiguration(this.cursorConfig)})),this._register(this.model.onDidChangeLanguage(e=>{this.cursorConfig=new Ki(this.model.getLanguageIdentifier(),this.model.getOptions(),this._configuration),this._cursor.updateConfiguration(this.cursorConfig)})),this._register(this.model.onDidChangeOptions(e=>{if(this._lines.setTabSize(this.model.getOptions().tabSize)){try{let t=this._eventDispatcher.beginEmitViewEvents();t.emitViewEvent(new Hc),t.emitViewEvent(new Uc),t.emitViewEvent(new ko(null)),this._cursor.onLineMappingChanged(t),this._decorations.onLineMappingChanged(),this.viewLayout.onFlushed(this.getLineCount())}finally{this._eventDispatcher.endEmitViewEvents()}this._updateConfigurationViewLineCount.schedule()}this.cursorConfig=new Ki(this.model.getLanguageIdentifier(),this.model.getOptions(),this._configuration),this._cursor.updateConfiguration(this.cursorConfig)})),this._register(this.model.onDidChangeDecorations(e=>{this._decorations.onModelDecorationsChanged(),this._eventDispatcher.emitSingleViewEvent(new ko(e))}))}setHiddenAreas(e){try{let t=this._eventDispatcher.beginEmitViewEvents();this._lines.setHiddenAreas(e)&&(t.emitViewEvent(new Hc),t.emitViewEvent(new Uc),t.emitViewEvent(new ko(null)),this._cursor.onLineMappingChanged(t),this._decorations.onLineMappingChanged(),this.viewLayout.onFlushed(this.getLineCount()),this.viewLayout.onHeightMaybeChanged())}finally{this._eventDispatcher.endEmitViewEvents()}this._updateConfigurationViewLineCount.schedule()}getVisibleRangesPlusViewportAboveBelow(){let e=this._configuration.options.get(129),t=this._configuration.options.get(57),i=Math.max(20,Math.round(e.height/t)),n=this.viewLayout.getLinesViewportData(),r=Math.max(1,n.completelyVisibleStartLineNumber-i),o=Math.min(this.getLineCount(),n.completelyVisibleEndLineNumber+i);return this._toModelVisibleRanges(new D(r,this.getLineMinColumn(r),o,this.getLineMaxColumn(o)))}getVisibleRanges(){let e=this.getCompletelyVisibleViewRange();return this._toModelVisibleRanges(e)}_toModelVisibleRanges(e){let t=this.coordinatesConverter.convertViewRangeToModelRange(e),i=this._lines.getHiddenAreas();if(i.length===0)return[t];let n=[],r=0,o=t.startLineNumber,a=t.startColumn,l=t.endLineNumber,c=t.endColumn;for(let h=0,d=i.length;hl||(oc.toInlineDecoration(t))]),new Zt(o.minColumn,o.maxColumn,o.content,o.continuesWithWrappedLine,i,n,o.tokens,l,r,o.startVisibleColumn)}getViewLineData(e){return this._lines.getViewLineData(e)}getMinimapLinesRenderingData(e,t,i){let n=this._lines.getViewLinesData(e,t,i);return new vv(this.getTabSize(),n)}getAllOverviewRulerDecorations(e){return this._lines.getAllOverviewRulerDecorations(this._editorId,Zl(this._configuration.options),e)}invalidateOverviewRulerColorCache(){let e=this.model.getOverviewRulerDecorations();for(let t of e){let i=t.options.overviewRuler;i&&i.invalidateCachedColor()}}invalidateMinimapColorCache(){let e=this.model.getAllDecorations();for(let t of e){let i=t.options.minimap;i&&i.invalidateCachedColor()}}getValueInRange(e,t){let i=this.coordinatesConverter.convertViewRangeToModelRange(e);return this.model.getValueInRange(i,t)}getModelLineMaxColumn(e){return this.model.getLineMaxColumn(e)}validateModelPosition(e){return this.model.validatePosition(e)}validateModelRange(e){return this.model.validateRange(e)}deduceModelPositionRelativeToViewPosition(e,t,i){let n=this.coordinatesConverter.convertViewPositionToModelPosition(e);this.model.getEOL().length===2&&(t<0?t-=i:t+=i);let o=this.model.getOffsetAt(n)+t;return this.model.getPositionAt(o)}getEOL(){return this.model.getEOL()}getPlainTextToCopy(e,t,i){let n=i?`\r +`:this.model.getEOL();e=e.slice(0),e.sort(D.compareRangesUsingStarts);let r=!1,o=!1;for(let l of e)l.isEmpty()?r=!0:o=!0;if(!o){if(!t)return"";let l=e.map(h=>h.startLineNumber),c="";for(let h=0;h0&&l[h-1]===l[h]||(c+=this.model.getLineContent(l[h])+n);return c}if(r&&t){let l=[],c=0;for(let h of e){let d=h.startLineNumber;h.isEmpty()?d!==c&&l.push(this.model.getLineContent(d)):l.push(this.model.getValueInRange(h,i?2:0)),c=d}return l.length===1?l[0]:l}let a=[];for(let l of e)l.isEmpty()||a.push(this.model.getValueInRange(l,i?2:0));return a.length===1?a[0]:a}getRichTextToCopy(e,t){let i=this.model.getLanguageIdentifier();if(i.id===1||e.length!==1)return null;let n=e[0];if(n.isEmpty()){if(!t)return null;let h=n.startLineNumber;n=new D(h,this.model.getLineMinColumn(h),h,this.model.getLineMaxColumn(h))}let r=this._configuration.options.get(41),o=this._getColorMap(),l=/[:;\\\/<>]/.test(r.fontFamily)||r.fontFamily===sn.fontFamily,c;return l?c=sn.fontFamily:(c=r.fontFamily,c=c.replace(/"/g,"'"),/[,']/.test(c)||/[+ ]/.test(c)&&(c=`'${c}'`),c=`${c}, ${sn.fontFamily}`),{mode:i.language,html:`
`+this._getHTMLToCopy(n,o)+"
"}}_getHTMLToCopy(e,t){let i=e.startLineNumber,n=e.startColumn,r=e.endLineNumber,o=e.endColumn,a=this.getTabSize(),l="";for(let c=i;c<=r;c++){let h=this.model.getLineTokens(c),d=h.getLineContent(),u=c===i?n-1:0,f=c===r?o-1:d.length;d===""?l+="
":l+=dN(d,h.inflate(),t,u,f,a,ot)}return l}_getColorMap(){let e=Pe.getColorMap(),t=["#000000"];if(e)for(let i=1,n=e.length;ithis._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 y0);return}this._withViewEventsCollector(e)}executeEdits(e,t,i){this._executeCursorEdit(n=>this._cursor.executeEdits(n,e,t,i))}startComposition(){this._cursor.setIsDoingComposition(!0),this._executeCursorEdit(e=>this._cursor.startComposition(e))}endComposition(e){this._cursor.setIsDoingComposition(!1),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,r){this._executeCursorEdit(o=>this._cursor.compositionType(o,e,t,i,n,r))}paste(e,t,i,n){this._executeCursorEdit(r=>this._cursor.paste(r,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))}revealPrimaryCursor(e,t){this._withViewEventsCollector(i=>this._cursor.revealPrimary(i,e,t,0))}revealTopMostCursor(e){let t=this._cursor.getTopMostViewPosition(),i=new D(t.lineNumber,t.column,t.lineNumber,t.column);this._withViewEventsCollector(n=>n.emitViewEvent(new sl(e,i,null,0,!0,0)))}revealBottomMostCursor(e){let t=this._cursor.getBottomMostViewPosition(),i=new D(t.lineNumber,t.column,t.lineNumber,t.column);this._withViewEventsCollector(n=>n.emitViewEvent(new sl(e,i,null,0,!0,0)))}revealRange(e,t,i,n,r){this._withViewEventsCollector(o=>o.emitViewEvent(new sl(e,i,null,n,t,r)))}getVerticalOffsetForLineNumber(e){return this.viewLayout.getVerticalOffsetForLineNumber(e)}getScrollTop(){return this.viewLayout.getCurrentScrollTop()}setScrollTop(e,t){this.viewLayout.setScrollPosition({scrollTop:e},t)}setScrollPosition(e,t){this.viewLayout.setScrollPosition(e,t)}deltaScrollNow(e,t){this.viewLayout.deltaScrollNow(e,t)}changeWhitespace(e){this.viewLayout.changeWhitespace(e)&&(this._eventDispatcher.emitSingleViewEvent(new v0),this._eventDispatcher.emitOutgoingEvent(new S0))}setMaxLineWidth(e){this.viewLayout.setMaxLineWidth(e)}_withViewEventsCollector(e){try{let t=this._eventDispatcher.beginEmitViewEvents();e(t)}finally{this._eventDispatcher.endEmitViewEvents()}}normalizePosition(e,t){return this._lines.normalizePosition(e,t)}getLineIndentColumn(e){return this._lines.getLineIndentColumn(e)}};var Ds=class{constructor(...e){this._entries=new Map;for(let[t,i]of e)this.set(t,i)}set(e,t){let i=this._entries.get(e);return this._entries.set(e,t),i}has(e){return this._entries.has(e)}get(e){return this._entries.get(e)}};var jt=$("accessibilityService"),vN=new te("accessibilityModeEnabled",!1);var CN=class extends hs{constructor(e,t){super(0);for(let i=0;i=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}},R0=[],A0=[],Iu=class{constructor(e,t){this.classifier=new CN(e,t)}static create(e){return new Iu(e.get(118),e.get(117))}createLineBreaksComputer(e,t,i,n){t=t|0,i=+i;let r=[],o=[],a=[];return{addRequest:(l,c,h)=>{r.push(l),o.push(c),a.push(h)},finalize:()=>{let l=e.typicalFullwidthCharacterWidth/e.typicalHalfwidthCharacterWidth,c=[];for(let h=0,d=r.length;h=0){let C=Math.abs(c[v]-w);for(;v+1<_;){let y=Math.abs(c[v+1]-w);if(y>=C)break;C=y,v++}}for(;v<_;){let C=v<0?0:l[v],y=v<0?0:c[v];g>C&&(C=g,y=b);let x=0,S=0,L=0,E=0;if(y<=w){let I=y,P=C===0?0:t.charCodeAt(C-1),B=C===0?0:s.get(P),Q=!0;for(let Y=C;Yg&&O0(P,B,he,ce)&&(x=se,S=I),I+=ye,I>w){se>g?(L=se,E=I-ye):(L=Y+1,E=I),I-S>d&&(x=0),Q=!1;break}P=he,B=ce}if(Q){m>0&&(u[m]=l[l.length-1],f[m]=c[l.length-1],m++);break}}if(x===0){let I=y,P=t.charCodeAt(C),B=s.get(P),Q=!1;for(let Y=C-1;Y>=g;Y--){let se=Y+1,he=t.charCodeAt(Y);if(he===9){Q=!0;break}let ce,ye;if(la(he)?(Y--,ce=0,ye=2):(ce=s.get(he),ye=bi(he)?r:1),I<=w){if(L===0&&(L=se,E=I),I<=w-d)break;if(O0(he,ce,P,B)){x=se,S=I;break}}I-=ye,P=he,B=ce}if(x!==0){let Y=d-(E-S);if(Y<=i){let se=t.charCodeAt(L),he;Xe(se)?he=2:he=Nu(se,E,i,r),Y-he<0&&(x=0)}}if(Q){v--;continue}}if(x===0&&(x=L,S=E),x<=g){let I=t.charCodeAt(g);Xe(I)?(x=g+2,S=b+2):(x=g+1,S=b+Nu(I,b,i,r))}for(g=x,u[m]=x,b=S,f[m]=S,m++,w=S+d;v<0||v<_&&c[v]=T)break;T=I,v++}}return m===0?null:(u.length=m,f.length=m,R0=e.breakOffsets,A0=e.breakOffsetsVisibleColumn,e.breakOffsets=u,e.breakOffsetsVisibleColumn=f,e.wrappedTextIndentLength=h,e)}function wO(s,e,t,i,n,r,o){let a=Si.applyInjectedText(e,t),l,c;if(t&&t.length>0?(l=t.map(S=>S.options),c=t.map(S=>S.column-1)):(l=null,c=null),n===-1)return l?new po([a.length],[],0,c,l):null;let h=a.length;if(h<=1)return l?new po([a.length],[],0,c,l):null;let d=yN(a,i,n,r,o),u=n-d,f=[],m=[],g=0,b=0,w=0,_=n,v=a.charCodeAt(0),C=s.get(v),y=Nu(v,0,i,r),x=1;Xe(v)&&(y+=1,v=a.charCodeAt(1),C=s.get(v),x++);for(let S=x;S_&&((b===0||y-w>u)&&(b=L,w=y-I),f[g]=b,m[g]=w,g++,_=w+u,b=0),v=E,C=T}return g===0&&(!t||t.length===0)?null:(f[g]=h,m[g]=y,new po(f,m,d,c,l))}function Nu(s,e,t,i){return s===9?t-e%t:bi(s)||s<32?i:1}function SN(s,e){return e-s%e}function O0(s,e,t,i){return t!==32&&(e===2||e===3&&i!==2||i===1||i===3&&e!==1)}function yN(s,e,t,i,n){let r=0;if(n!==0){let o=vt(s);if(o!==-1){for(let l=0;lt&&(r=0)}}return r}var P0,F0=(P0=window.trustedTypes)===null||P0===void 0?void 0:P0.createPolicy("domLineBreaksComputer",{createHTML:s=>s}),Tu=class{static create(){return new Tu}constructor(){}createLineBreaksComputer(e,t,i,n){t=t|0,i=+i;let r=[],o=[];return{addRequest:(a,l,c)=>{r.push(a),o.push(l)},finalize:()=>vO(r,e,t,i,n,o)}}};function vO(s,e,t,i,n,r){var o;function a(y){let x=r[y];if(x){let S=Si.applyInjectedText(s[y],x),L=x.map(T=>T.options),E=x.map(T=>T.column-1);return new po([S.length],[],0,E,L)}else return null}if(i===-1){let y=[];for(let x=0,S=s.length;xl?(S=0,L=0):E=l-P}let T=x.substr(S),I=CO(T,L,t,E,h);d[y]=S,u[y]=L,f[y]=T,m[y]=I[0],g[y]=I[1]}let b=h.build(),w=(o=F0==null?void 0:F0.createHTML(b))!==null&&o!==void 0?o:b;c.innerHTML=w,c.style.position="absolute",c.style.top="10000",c.style.wordWrap="break-word",document.body.appendChild(c);let _=document.createRange(),v=Array.prototype.slice.call(c.children,0),C=[];for(let y=0;yY.options),B=Q.map(Y=>Y.column-1)):(P=null,B=null),C[y]=new po(S,I,E,B,P)}return document.body.removeChild(c),C}function CO(s,e,t,i,n){n.appendASCIIString('
');let r=s.length,o=e,a=0,l=[],c=[],h=0");for(let d=0;d"),l[d]=a,c[d]=o;let u=h;h=d+1"),l[s.length]=a,c[s.length]=o,n.appendASCIIString("
"),[l,c]}function SO(s,e,t,i){if(t.length<=1)return null;let n=Array.prototype.slice.call(e.children,0),r=[];try{B0(s,n,i,0,null,t.length-1,null,r)}catch(o){return console.log(o),null}return r.length===0?null:(r.push(t.length),r)}function B0(s,e,t,i,n,r,o,a){if(i===r||(n=n||W0(s,e,t[i],t[i+1]),o=o||W0(s,e,t[r],t[r+1]),Math.abs(n[0].top-o[0].top)<=.1))return;if(i+1===r){a.push(r);return}let l=i+(r-i)/2|0,c=W0(s,e,t[l],t[l+1]);B0(s,e,t,i,n,l,c,a),B0(s,e,t,l,c,r,o,a)}function W0(s,e,t,i){return s.setStart(e[t/16384|0].firstChild,t%16384),s.setEnd(e[i/16384|0].firstChild,i%16384),s.getClientRects()}var yO=function(s,e,t,i){var n=arguments.length,r=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(s,e,t,i);else for(var a=s.length-1;a>=0;a--)(o=s[a])&&(r=(n<3?o(r):n>3?o(e,t,r):o(e,t))||r);return n>3&&r&&Object.defineProperty(e,t,r),r},ol=function(s,e){return function(t,i){e(t,i,s)}},LO=0,LN=class{constructor(e,t,i,n,r){this.model=e,this.viewModel=t,this.view=i,this.hasRealView=n,this.listenersToRemove=r}dispose(){me(this.listenersToRemove),this.model.onBeforeDetached(),this.hasRealView&&this.view.dispose(),this.viewModel.dispose()}},qc=class bp extends M{constructor(e,t,i,n,r,o,a,l,c,h){super();this._onDidDispose=this._register(new k),this.onDidDispose=this._onDidDispose.event,this._onDidChangeModelContent=this._register(new k),this.onDidChangeModelContent=this._onDidChangeModelContent.event,this._onDidChangeModelLanguage=this._register(new k),this.onDidChangeModelLanguage=this._onDidChangeModelLanguage.event,this._onDidChangeModelLanguageConfiguration=this._register(new k),this.onDidChangeModelLanguageConfiguration=this._onDidChangeModelLanguageConfiguration.event,this._onDidChangeModelOptions=this._register(new k),this.onDidChangeModelOptions=this._onDidChangeModelOptions.event,this._onDidChangeModelDecorations=this._register(new k),this.onDidChangeModelDecorations=this._onDidChangeModelDecorations.event,this._onDidChangeConfiguration=this._register(new k),this.onDidChangeConfiguration=this._onDidChangeConfiguration.event,this._onDidChangeModel=this._register(new k),this.onDidChangeModel=this._onDidChangeModel.event,this._onDidChangeCursorPosition=this._register(new k),this.onDidChangeCursorPosition=this._onDidChangeCursorPosition.event,this._onDidChangeCursorSelection=this._register(new k),this.onDidChangeCursorSelection=this._onDidChangeCursorSelection.event,this._onDidAttemptReadOnlyEdit=this._register(new k),this.onDidAttemptReadOnlyEdit=this._onDidAttemptReadOnlyEdit.event,this._onDidLayoutChange=this._register(new k),this.onDidLayoutChange=this._onDidLayoutChange.event,this._editorTextFocus=this._register(new V0),this.onDidFocusEditorText=this._editorTextFocus.onDidChangeToTrue,this.onDidBlurEditorText=this._editorTextFocus.onDidChangeToFalse,this._editorWidgetFocus=this._register(new V0),this.onDidFocusEditorWidget=this._editorWidgetFocus.onDidChangeToTrue,this.onDidBlurEditorWidget=this._editorWidgetFocus.onDidChangeToFalse,this._onWillType=this._register(new k),this.onWillType=this._onWillType.event,this._onDidType=this._register(new k),this.onDidType=this._onDidType.event,this._onDidCompositionStart=this._register(new k),this.onDidCompositionStart=this._onDidCompositionStart.event,this._onDidCompositionEnd=this._register(new k),this.onDidCompositionEnd=this._onDidCompositionEnd.event,this._onDidPaste=this._register(new k),this.onDidPaste=this._onDidPaste.event,this._onMouseUp=this._register(new k),this.onMouseUp=this._onMouseUp.event,this._onMouseDown=this._register(new k),this.onMouseDown=this._onMouseDown.event,this._onMouseDrag=this._register(new k),this.onMouseDrag=this._onMouseDrag.event,this._onMouseDrop=this._register(new k),this.onMouseDrop=this._onMouseDrop.event,this._onMouseDropCanceled=this._register(new k),this.onMouseDropCanceled=this._onMouseDropCanceled.event,this._onContextMenu=this._register(new k),this.onContextMenu=this._onContextMenu.event,this._onMouseMove=this._register(new k),this.onMouseMove=this._onMouseMove.event,this._onMouseLeave=this._register(new k),this.onMouseLeave=this._onMouseLeave.event,this._onMouseWheel=this._register(new k),this.onMouseWheel=this._onMouseWheel.event,this._onKeyUp=this._register(new k),this.onKeyUp=this._onKeyUp.event,this._onKeyDown=this._register(new k),this.onKeyDown=this._onKeyDown.event,this._onDidContentSizeChange=this._register(new k),this.onDidContentSizeChange=this._onDidContentSizeChange.event,this._onDidScrollChange=this._register(new k),this.onDidScrollChange=this._onDidScrollChange.event,this._onDidChangeViewZones=this._register(new k),this.onDidChangeViewZones=this._onDidChangeViewZones.event;let d=Object.assign({},t);this._domElement=e,this._overflowWidgetsDomNode=d.overflowWidgetsDomNode,delete d.overflowWidgetsDomNode,this._id=++LO,this._decorationTypeKeysToIds={},this._decorationTypeSubtypes={},this.isSimpleWidget=i.isSimpleWidget||!1,this._telemetryData=i.telemetryData,this._configuration=this._register(this._createConfiguration(d,h)),this._register(this._configuration.onDidChange(f=>{this._onDidChangeConfiguration.fire(f);let m=this._configuration.options;if(f.hasChanged(129)){let g=m.get(129);this._onDidLayoutChange.fire(g)}})),this._contextKeyService=this._register(a.createScoped(this._domElement)),this._notificationService=c,this._codeEditorService=r,this._commandService=o,this._themeService=l,this._register(new xN(this,this._contextKeyService)),this._register(new DN(this,this._contextKeyService)),this._instantiationService=n.createChild(new Ds([fe,this._contextKeyService])),this._modelData=null,this._contributions={},this._actions={},this._focusTracker=new EN(e),this._register(this._focusTracker.onChange(()=>{this._editorWidgetFocus.setValue(this._focusTracker.hasFocus())})),this._contentWidgets={},this._overlayWidgets={};let u;Array.isArray(i.contributions)?u=i.contributions:u=Yr.getEditorContributions();for(let f of u){if(this._contributions[f.id]){de(new Error(`Cannot have two contributions with the same id ${f.id}`));continue}try{let m=this._instantiationService.createInstance(f.ctor,this);this._contributions[f.id]=m}catch(m){de(m)}}Yr.getEditorActions().forEach(f=>{if(this._actions[f.id]){de(new Error(`Cannot have two actions with the same id ${f.id}`));return}let m=new Du(f.id,f.label,f.alias,Vs(f.precondition),()=>this._instantiationService.invokeFunction(g=>Promise.resolve(f.runEditorCommand(g,this,null))),this._contextKeyService);this._actions[m.id]=m}),this._codeEditorService.addCodeEditor(this)}_createConfiguration(e,t){return new mt(this.isSimpleWidget,e,this._domElement,t)}getId(){return this.getEditorType()+":"+this._id}getEditorType(){return mo.ICodeEditor}dispose(){this._codeEditorService.removeCodeEditor(this),this._focusTracker.dispose();let e=Object.keys(this._contributions);for(let t=0,i=e.length;tD.lift(t)))}getVisibleColumnFromPosition(e){if(!this._modelData)return e.column;let t=this._modelData.model.validatePosition(e),i=this._modelData.model.getOptions().tabSize;return ue.visibleColumnFromColumn(this._modelData.model.getLineContent(t.lineNumber),t.column,i)+1}getPosition(){return this._modelData?this._modelData.viewModel.getPosition():null}setPosition(e){if(!!this._modelData){if(!N.isIPosition(e))throw new Error("Invalid arguments");this._modelData.viewModel.setSelections("api",[{selectionStartLineNumber:e.lineNumber,selectionStartColumn:e.column,positionLineNumber:e.lineNumber,positionColumn:e.column}])}}_sendRevealRange(e,t,i,n){if(!this._modelData)return;if(!D.isIRange(e))throw new Error("Invalid arguments");let r=this._modelData.model.validateRange(e),o=this._modelData.viewModel.coordinatesConverter.convertModelRangeToViewRange(r);this._modelData.viewModel.revealRange("api",i,o,t,n)}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 D(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(!N.isIPosition(e))throw new Error("Invalid arguments");this._sendRevealRange(new D(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){let t=Z.isISelection(e),i=D.isIRange(e);if(!t&&!i)throw new Error("Invalid arguments");if(t)this._setSelectionImpl(e);else if(i){let n={selectionStartLineNumber:e.startLineNumber,selectionStartColumn:e.startColumn,positionLineNumber:e.endLineNumber,positionColumn:e.endColumn};this._setSelectionImpl(n)}}_setSelectionImpl(e){if(!this._modelData)return;let t=new Z(e.selectionStartLineNumber,e.selectionStartColumn,e.positionLineNumber,e.positionColumn);this._modelData.viewModel.setSelections("api",[t])}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 D(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(!D.isIRange(e))throw new Error("Invalid arguments");this._sendRevealRange(D.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,r=e.length;nt.isSupported()),e}getAction(e){return this._actions[e]||null}trigger(e,t,i){switch(i=i||{},t){case"compositionStart":this._startComposition();return;case"compositionEnd":this._endComposition(e);return;case"type":{let r=i;this._type(e,r.text||"");return}case"replacePreviousChar":{let r=i;this._compositionType(e,r.text||"",r.replaceCharCnt||0,0,0);return}case"compositionType":{let r=i;this._compositionType(e,r.text||"",r.replacePrevCharCnt||0,r.replaceNextCharCnt||0,r.positionDelta||0);return}case"paste":{let r=i;this._paste(e,r.text||"",r.pasteOnNewLine||!1,r.multicursorText||null,r.mode||null);return}case"cut":this._cut(e);return}let n=this.getAction(t);if(n){Promise.resolve(n.run()).then(void 0,de);return}!this._modelData||this._triggerEditorCommand(e,t,i)||this._triggerCommand(t,i)}_triggerCommand(e,t){this._commandService.executeCommand(e,t)}_startComposition(){!this._modelData||(this._modelData.viewModel.startComposition(),this._onDidCompositionStart.fire())}_endComposition(e){!this._modelData||(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,r){!this._modelData||this._modelData.viewModel.compositionType(t,i,n,r,e)}_paste(e,t,i,n,r){if(!this._modelData||t.length===0)return;let o=this._modelData.viewModel.getSelection().getStartPosition();this._modelData.viewModel.paste(t,i,n,e);let a=this._modelData.viewModel.getSelection().getStartPosition();e==="keyboard"&&this._onDidPaste.fire({range:new D(o.lineNumber,o.column,a.lineNumber,a.column),mode:r})}_cut(e){!this._modelData||this._modelData.viewModel.cut(e)}_triggerEditorCommand(e,t,i){let n=Yr.getEditorCommand(t);return n?(i=i||{},i.source=e,this._instantiationService.invokeFunction(r=>{Promise.resolve(n.runEditorCommand(r,this,i)).then(void 0,de)}),!0):!1}_getViewModel(){return this._modelData?this._modelData.viewModel:null}pushUndoStop(){return!this._modelData||this._configuration.options.get(79)?!1:(this._modelData.model.pushStackElement(),!0)}popUndoStop(){return!this._modelData||this._configuration.options.get(79)?!1:(this._modelData.model.popStackElement(),!0)}executeEdits(e,t,i){if(!this._modelData||this._configuration.options.get(79))return!1;let n;return i?Array.isArray(i)?n=()=>i:n=i:n=()=>null,this._modelData.viewModel.executeEdits(e,t,n),!0}executeCommand(e,t){!this._modelData||this._modelData.viewModel.executeCommand(t,e)}executeCommands(e,t){!this._modelData||this._modelData.viewModel.executeCommands(t,e)}changeDecorations(e){return this._modelData?this._modelData.model.changeDecorations(e,this._id):null}getLineDecorations(e){return this._modelData?this._modelData.model.getLineDecorations(e,this._id,Zl(this._configuration.options)):null}deltaDecorations(e,t){return this._modelData?e.length===0&&t.length===0?e:this._modelData.model.deltaDecorations(e,t,this._id):[]}removeDecorations(e){let t=this._decorationTypeKeysToIds[e];t&&this.deltaDecorations(t,[]),this._decorationTypeKeysToIds.hasOwnProperty(e)&&delete this._decorationTypeKeysToIds[e],this._decorationTypeSubtypes.hasOwnProperty(e)&&delete this._decorationTypeSubtypes[e]}getLayoutInfo(){return this._configuration.options.get(129)}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}delegateVerticalScrollbarMouseDown(e){!this._modelData||!this._modelData.hasRealView||this._modelData.view.delegateVerticalScrollbarMouseDown(e)}layout(e){this._configuration.observeReferenceElement(e),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._focusTracker&&this._focusTracker.hasFocus()}addContentWidget(e){let t={widget:e,position:e.getPosition()};this._contentWidgets.hasOwnProperty(e.getId())&&console.warn("Overwriting a content widget with the same id."),this._contentWidgets[e.getId()]=t,this._modelData&&this._modelData.hasRealView&&this._modelData.view.addContentWidget(t)}layoutContentWidget(e){let t=e.getId();if(this._contentWidgets.hasOwnProperty(t)){let i=this._contentWidgets[t];i.position=e.getPosition(),this._modelData&&this._modelData.hasRealView&&this._modelData.view.layoutContentWidget(i)}}removeContentWidget(e){let t=e.getId();if(this._contentWidgets.hasOwnProperty(t)){let i=this._contentWidgets[t];delete this._contentWidgets[t],this._modelData&&this._modelData.hasRealView&&this._modelData.view.removeContentWidget(i)}}addOverlayWidget(e){let 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){let t=e.getId();if(this._overlayWidgets.hasOwnProperty(t)){let i=this._overlayWidgets[t];i.position=e.getPosition(),this._modelData&&this._modelData.hasRealView&&this._modelData.view.layoutOverlayWidget(i)}}removeOverlayWidget(e){let t=e.getId();if(this._overlayWidgets.hasOwnProperty(t)){let i=this._overlayWidgets[t];delete this._overlayWidgets[t],this._modelData&&this._modelData.hasRealView&&this._modelData.view.removeOverlayWidget(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;let t=this._modelData.model.validatePosition(e),i=this._configuration.options,n=i.get(129),r=bp._getVerticalOffsetForPosition(this._modelData,t.lineNumber,t.column)-this.getScrollTop(),o=this._modelData.view.getOffsetForColumn(t.lineNumber,t.column)+n.glyphMarginWidth+n.lineNumbersWidth+n.decorationsWidth-this.getScrollLeft();return{top:r,left:o,height:i.get(57)}}getOffsetForColumn(e,t){return!this._modelData||!this._modelData.hasRealView?-1:this._modelData.view.getOffsetForColumn(e,t)}render(e=!1){!this._modelData||!this._modelData.hasRealView||this._modelData.view.render(!0,e)}setAriaOptions(e){!this._modelData||!this._modelData.hasRealView||this._modelData.view.setAriaOptions(e)}applyFontInfo(e){mt.applyFontInfoSlow(e,this._configuration.options.get(41))}_attachModel(e){if(!e){this._modelData=null;return}let t=[];this._domElement.setAttribute("data-mode-id",e.getLanguageIdentifier().language),this._configuration.setIsDominatedByLongLines(e.isDominatedByLongLines()),this._configuration.setMaxLineNumber(e.getLineCount()),e.onBeforeAttached();let i=new M0(this._id,this._configuration,e,Tu.create(),Iu.create(this._configuration.options),o=>Ti(o));t.push(e.onDidChangeDecorations(o=>this._onDidChangeModelDecorations.fire(o))),t.push(e.onDidChangeLanguage(o=>{this._domElement.setAttribute("data-mode-id",e.getLanguageIdentifier().language),this._onDidChangeModelLanguage.fire(o)})),t.push(e.onDidChangeLanguageConfiguration(o=>this._onDidChangeModelLanguageConfiguration.fire(o))),t.push(e.onDidChangeContent(o=>this._onDidChangeModelContent.fire(o))),t.push(e.onDidChangeOptions(o=>this._onDidChangeModelOptions.fire(o))),t.push(e.onWillDispose(()=>this.setModel(null))),t.push(i.onEvent(o=>{switch(o.kind){case 0:this._onDidContentSizeChange.fire(o);break;case 1:this._editorTextFocus.setValue(o.hasFocus);break;case 2:this._onDidScrollChange.fire(o);break;case 3:this._onDidChangeViewZones.fire();break;case 4:this._onDidAttemptReadOnlyEdit.fire();break;case 5:{o.reachedMaxCursorCount&&this._notificationService.warn(p("cursors.maximum","The number of cursors has been limited to {0}.",br.MAX_CURSOR_COUNT));let a=[];for(let h=0,d=o.selections.length;h{this._paste("keyboard",r,o,a,l)},type:r=>{this._type("keyboard",r)},compositionType:(r,o,a,l)=>{this._compositionType("keyboard",r,o,a,l)},startComposition:()=>{this._startComposition()},endComposition:()=>{this._endComposition("keyboard")},cut:()=>{this._cut("keyboard")}}:t={paste:(r,o,a,l)=>{let c={text:r,pasteOnNewLine:o,multicursorText:a,mode:l};this._commandService.executeCommand("paste",c)},type:r=>{let o={text:r};this._commandService.executeCommand("type",o)},compositionType:(r,o,a,l)=>{if(a||l){let c={text:r,replacePrevCharCnt:o,replaceNextCharCnt:a,positionDelta:l};this._commandService.executeCommand("compositionType",c)}else{let c={text:r,replaceCharCnt:o};this._commandService.executeCommand("replacePreviousChar",c)}},startComposition:()=>{this._commandService.executeCommand("compositionStart",{})},endComposition:()=>{this._commandService.executeCommand("compositionEnd",{})},cut:()=>{this._commandService.executeCommand("cut",{})}};let i=new Xa(e.coordinatesConverter);return i.onKeyDown=r=>this._onKeyDown.fire(r),i.onKeyUp=r=>this._onKeyUp.fire(r),i.onContextMenu=r=>this._onContextMenu.fire(r),i.onMouseMove=r=>this._onMouseMove.fire(r),i.onMouseLeave=r=>this._onMouseLeave.fire(r),i.onMouseDown=r=>this._onMouseDown.fire(r),i.onMouseUp=r=>this._onMouseUp.fire(r),i.onMouseDrag=r=>this._onMouseDrag.fire(r),i.onMouseDrop=r=>this._onMouseDrop.fire(r),i.onMouseDropCanceled=r=>this._onMouseDropCanceled.fire(r),i.onMouseWheel=r=>this._onMouseWheel.fire(r),[new c0(t,this._configuration,this._themeService,e,i,this._overflowWidgetsDomNode),!0]}_postDetachModelCleanup(e){e&&e.removeAllDecorationsWithOwnerId(this._id)}_detachModel(){if(!this._modelData)return null;let 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)&&this._domElement.removeChild(t),e}_removeDecorationType(e){this._codeEditorService.removeDecorationType(e)}hasModel(){return this._modelData!==null}};qc=yO([ol(3,ct),ol(4,qe),ol(5,It),ol(6,fe),ol(7,We),ol(8,ri),ol(9,jt)],qc);var V0=class extends M{constructor(){super();this._onDidChangeToTrue=this._register(new k),this.onDidChangeToTrue=this._onDidChangeToTrue.event,this._onDidChangeToFalse=this._register(new k),this.onDidChangeToFalse=this._onDidChangeToFalse.event,this._value=0}setValue(e){let t=e?2:1;this._value!==t&&(this._value=t,this._value===2?this._onDidChangeToTrue.fire():this._value===1&&this._onDidChangeToFalse.fire())}},xN=class extends M{constructor(e,t){super();this._editor=e,t.createKey("editorId",e.getId()),this._editorSimpleInput=V.editorSimpleInput.bindTo(t),this._editorFocus=V.focus.bindTo(t),this._textInputFocus=V.textInputFocus.bindTo(t),this._editorTextFocus=V.editorTextFocus.bindTo(t),this._editorTabMovesFocus=V.tabMovesFocus.bindTo(t),this._editorReadonly=V.readOnly.bindTo(t),this._inDiffEditor=V.inDiffEditor.bindTo(t),this._editorColumnSelection=V.columnSelection.bindTo(t),this._hasMultipleSelections=V.hasMultipleSelections.bindTo(t),this._hasNonEmptySelection=V.hasNonEmptySelection.bindTo(t),this._canUndo=V.canUndo.bindTo(t),this._canRedo=V.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._updateFromConfig(),this._updateFromSelection(),this._updateFromFocus(),this._updateFromModel(),this._editorSimpleInput.set(this._editor.isSimpleWidget)}_updateFromConfig(){let e=this._editor.getOptions();this._editorTabMovesFocus.set(e.get(128)),this._editorReadonly.set(e.get(79)),this._inDiffEditor.set(e.get(52)),this._editorColumnSelection.set(e.get(16))}_updateFromSelection(){let 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(){let e=this._editor.getModel();this._canUndo.set(Boolean(e&&e.canUndo())),this._canRedo.set(Boolean(e&&e.canRedo()))}},DN=class extends M{constructor(e,t){super();this._editor=e,this._contextKeyService=t,this._langId=V.languageId.bindTo(t),this._hasCompletionItemProvider=V.hasCompletionItemProvider.bindTo(t),this._hasCodeActionsProvider=V.hasCodeActionsProvider.bindTo(t),this._hasCodeLensProvider=V.hasCodeLensProvider.bindTo(t),this._hasDefinitionProvider=V.hasDefinitionProvider.bindTo(t),this._hasDeclarationProvider=V.hasDeclarationProvider.bindTo(t),this._hasImplementationProvider=V.hasImplementationProvider.bindTo(t),this._hasTypeDefinitionProvider=V.hasTypeDefinitionProvider.bindTo(t),this._hasHoverProvider=V.hasHoverProvider.bindTo(t),this._hasDocumentHighlightProvider=V.hasDocumentHighlightProvider.bindTo(t),this._hasDocumentSymbolProvider=V.hasDocumentSymbolProvider.bindTo(t),this._hasReferenceProvider=V.hasReferenceProvider.bindTo(t),this._hasRenameProvider=V.hasRenameProvider.bindTo(t),this._hasSignatureHelpProvider=V.hasSignatureHelpProvider.bindTo(t),this._hasInlayHintsProvider=V.hasInlayHintsProvider.bindTo(t),this._hasDocumentFormattingProvider=V.hasDocumentFormattingProvider.bindTo(t),this._hasDocumentSelectionFormattingProvider=V.hasDocumentSelectionFormattingProvider.bindTo(t),this._hasMultipleDocumentFormattingProvider=V.hasMultipleDocumentFormattingProvider.bindTo(t),this._hasMultipleDocumentSelectionFormattingProvider=V.hasMultipleDocumentSelectionFormattingProvider.bindTo(t),this._isInWalkThrough=V.isInWalkThroughSnippet.bindTo(t);let i=()=>this._update();this._register(e.onDidChangeModel(i)),this._register(e.onDidChangeModelLanguage(i)),this._register(ka.onDidChange(i)),this._register(Cd.onDidChange(i)),this._register(wd.onDidChange(i)),this._register(gd.onDidChange(i)),this._register(pd.onDidChange(i)),this._register(_d.onDidChange(i)),this._register(bd.onDidChange(i)),this._register(ud.onDidChange(i)),this._register(md.onDidChange(i)),this._register(fd.onDidChange(i)),this._register(cd.onDidChange(i)),this._register(hd.onDidChange(i)),this._register(ro.onDidChange(i)),this._register(Sn.onDidChange(i)),this._register(dd.onDidChange(i)),this._register(vd.onDidChange(i)),i()}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._isInWalkThrough.reset()})}_update(){let e=this._editor.getModel();if(!e){this.reset();return}this._contextKeyService.bufferChangeEvents(()=>{this._langId.set(e.getLanguageIdentifier().language),this._hasCompletionItemProvider.set(ka.has(e)),this._hasCodeActionsProvider.set(Cd.has(e)),this._hasCodeLensProvider.set(wd.has(e)),this._hasDefinitionProvider.set(gd.has(e)),this._hasDeclarationProvider.set(pd.has(e)),this._hasImplementationProvider.set(_d.has(e)),this._hasTypeDefinitionProvider.set(bd.has(e)),this._hasHoverProvider.set(ud.has(e)),this._hasDocumentHighlightProvider.set(md.has(e)),this._hasDocumentSymbolProvider.set(fd.has(e)),this._hasReferenceProvider.set(cd.has(e)),this._hasRenameProvider.set(hd.has(e)),this._hasSignatureHelpProvider.set(dd.has(e)),this._hasInlayHintsProvider.set(vd.has(e)),this._hasDocumentFormattingProvider.set(ro.has(e)||Sn.has(e)),this._hasDocumentSelectionFormattingProvider.set(Sn.has(e)),this._hasMultipleDocumentFormattingProvider.set(ro.all(e).length+Sn.all(e).length>1),this._hasMultipleDocumentSelectionFormattingProvider.set(Sn.all(e).length>1),this._isInWalkThrough.set(e.uri.scheme===Ce.walkThroughSnippet)})}},EN=class extends M{constructor(e){super();this._onChange=this._register(new k),this.onChange=this._onChange.event,this._hasFocus=!1,this._domFocusTracker=this._register(zr(e)),this._register(this._domFocusTracker.onDidFocus(()=>{this._hasFocus=!0,this._onChange.fire(void 0)})),this._register(this._domFocusTracker.onDidBlur(()=>{this._hasFocus=!1,this._onChange.fire(void 0)}))}hasFocus(){return this._hasFocus}},xO=encodeURIComponent("");function j0(s){return xO+encodeURIComponent(s.toString())+DO}var EO=encodeURIComponent('');function IO(s){return EO+encodeURIComponent(s.toString())+kO}bt((s,e)=>{let t=s.getColor(Nk);t&&e.addRule(`.monaco-editor .squiggly-error { border-bottom: 4px double ${t}; }`);let i=s.getColor(cu);i&&e.addRule(`.monaco-editor .squiggly-error { background: url("data:image/svg+xml,${j0(i)}") repeat-x bottom left; }`);let n=s.getColor(Ik);n&&e.addRule(`.monaco-editor .squiggly-error::before { display: block; content: ''; width: 100%; height: 100%; background: ${n}; }`);let r=s.getColor(hu);r&&e.addRule(`.monaco-editor .squiggly-warning { border-bottom: 4px double ${r}; }`);let o=s.getColor(Ss);o&&e.addRule(`.monaco-editor .squiggly-warning { background: url("data:image/svg+xml,${j0(o)}") repeat-x bottom left; }`);let a=s.getColor(Tk);a&&e.addRule(`.monaco-editor .squiggly-warning::before { display: block; content: ''; width: 100%; height: 100%; background: ${a}; }`);let l=s.getColor(np);l&&e.addRule(`.monaco-editor .squiggly-info { border-bottom: 4px double ${l}; }`);let c=s.getColor(yo);c&&e.addRule(`.monaco-editor .squiggly-info { background: url("data:image/svg+xml,${j0(c)}") repeat-x bottom left; }`);let h=s.getColor(Mk);h&&e.addRule(`.monaco-editor .squiggly-info::before { display: block; content: ''; width: 100%; height: 100%; background: ${h}; }`);let d=s.getColor(Ak);d&&e.addRule(`.monaco-editor .squiggly-hint { border-bottom: 2px dotted ${d}; }`);let u=s.getColor(Rk);u&&e.addRule(`.monaco-editor .squiggly-hint { background: url("data:image/svg+xml,${IO(u)}") no-repeat bottom left; }`);let f=s.getColor(jI);f&&e.addRule(`.monaco-editor.showUnused .squiggly-inline-unnecessary { opacity: ${f.rgba.a}; }`);let m=s.getColor(VI);m&&e.addRule(`.monaco-editor.showUnused .squiggly-unnecessary { border-bottom: 2px dashed ${m}; }`);let g=s.getColor(Lo)||"inherit";e.addRule(`.monaco-editor.showDeprecated .squiggly-inline-deprecated { text-decoration: line-through; text-decoration-color: ${g}}`)});var Ee=class{constructor(e,t,i){let n=r=>this.emitter.fire(r);this.emitter=new k({onFirstListenerAdd:()=>e.addEventListener(t,n,i),onLastListenerRemove:()=>e.removeEventListener(t,n,i)})}get event(){return this.emitter.event}dispose(){this.emitter.dispose()}};function z0(s){return s.preventDefault(),s.stopPropagation(),s}var Gc=function(s,e,t,i){var n=arguments.length,r=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(s,e,t,i);else for(var a=s.length-1;a>=0;a--)(o=s[a])&&(r=(n<3?o(r):n>3?o(e,t,r):o(e,t))||r);return n>3&&r&&Object.defineProperty(e,t,r),r},NO=!1,kN;(function(s){s.North="north",s.South="south",s.East="east",s.West="west"})(kN||(kN={}));var TO=4,MO=new k,RO=300,AO=new k,wp=class{constructor(){this.disposables=new U}get onPointerMove(){return this.disposables.add(new Ee(window,"mousemove")).event}get onPointerUp(){return this.disposables.add(new Ee(window,"mouseup")).event}dispose(){this.disposables.dispose()}};Gc([ze],wp.prototype,"onPointerMove",null);Gc([ze],wp.prototype,"onPointerUp",null);var vp=class{constructor(e){this.el=e,this.disposables=new U}get onPointerMove(){return this.disposables.add(new Ee(this.el,Re.Change)).event}get onPointerUp(){return this.disposables.add(new Ee(this.el,Re.End)).event}dispose(){this.disposables.dispose()}};Gc([ze],vp.prototype,"onPointerMove",null);Gc([ze],vp.prototype,"onPointerUp",null);var Mu=class{constructor(e){this.factory=e}get onPointerMove(){return this.factory.onPointerMove}get onPointerUp(){return this.factory.onPointerUp}dispose(){}};Gc([ze],Mu.prototype,"onPointerMove",null);Gc([ze],Mu.prototype,"onPointerUp",null);var Di=class extends M{constructor(e,t,i){super();this.hoverDelay=RO,this.hoverDelayer=this._register(new Nl(this.hoverDelay)),this._state=3,this._onDidEnablementChange=this._register(new k),this.onDidEnablementChange=this._onDidEnablementChange.event,this._onDidStart=this._register(new k),this.onDidStart=this._onDidStart.event,this._onDidChange=this._register(new k),this.onDidChange=this._onDidChange.event,this._onDidReset=this._register(new k),this.onDidReset=this._onDidReset.event,this._onDidEnd=this._register(new k),this.onDidEnd=this._onDidEnd.event,this.linkedSash=void 0,this.orthogonalStartSashDisposables=this._register(new U),this.orthogonalStartDragHandleDisposables=this._register(new U),this.orthogonalEndSashDisposables=this._register(new U),this.orthogonalEndDragHandleDisposables=this._register(new U),this.el=W(e,H(".monaco-sash")),i.orthogonalEdge&&this.el.classList.add(`orthogonal-edge-${i.orthogonalEdge}`),ee&&this.el.classList.add("mac");let n=this._register(new Ee(this.el,"mousedown")).event;this._register(n(d=>this.onPointerStart(d,new wp),this));let r=this._register(new Ee(this.el,"dblclick")).event;this._register(r(this.onPointerDoublePress,this));let o=this._register(new Ee(this.el,"mouseenter")).event;this._register(o(()=>Di.onMouseEnter(this)));let a=this._register(new Ee(this.el,"mouseleave")).event;this._register(a(()=>Di.onMouseLeave(this))),this._register(we.addTarget(this.el));let l=j.map(this._register(new Ee(this.el,Re.Start)).event,d=>{var u;return Object.assign(Object.assign({},d),{target:(u=d.initialTarget)!==null&&u!==void 0?u:null})});this._register(l(d=>this.onPointerStart(d,new vp(this.el)),this));let c=this._register(new Ee(this.el,Re.Tap)).event,h=j.map(j.filter(j.debounce(c,(d,u)=>{var f;return{event:u,count:((f=d==null?void 0:d.count)!==null&&f!==void 0?f:0)+1}},250),({count:d})=>d===2),({event:d})=>{var u;return Object.assign(Object.assign({},d),{target:(u=d.initialTarget)!==null&&u!==void 0?u:null})});this._register(h(this.onPointerDoublePress,this)),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=TO,this._register(MO.event(d=>{this.size=d,this.layout()}))),this._register(AO.event(d=>this.hoverDelay=d)),this.hidden=!1,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",NO),this.layout()}get state(){return this._state}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 orthogonalStartSash(){return this._orthogonalStartSash}set orthogonalStartSash(e){if(this.orthogonalStartDragHandleDisposables.clear(),this.orthogonalStartSashDisposables.clear(),e){let t=i=>{this.orthogonalStartDragHandleDisposables.clear(),i!==0&&(this._orthogonalStartDragHandle=W(this.el,H(".orthogonal-drag-handle.start")),this.orthogonalStartDragHandleDisposables.add(oe(()=>this._orthogonalStartDragHandle.remove())),this.orthogonalStartDragHandleDisposables.add(new Ee(this._orthogonalStartDragHandle,"mouseenter")).event(()=>Di.onMouseEnter(e),void 0,this.orthogonalStartDragHandleDisposables),this.orthogonalStartDragHandleDisposables.add(new Ee(this._orthogonalStartDragHandle,"mouseleave")).event(()=>Di.onMouseLeave(e),void 0,this.orthogonalStartDragHandleDisposables))};this.orthogonalStartSashDisposables.add(e.onDidEnablementChange(t,this)),t(e.state)}this._orthogonalStartSash=e}get orthogonalEndSash(){return this._orthogonalEndSash}set orthogonalEndSash(e){if(this.orthogonalEndDragHandleDisposables.clear(),this.orthogonalEndSashDisposables.clear(),e){let t=i=>{this.orthogonalEndDragHandleDisposables.clear(),i!==0&&(this._orthogonalEndDragHandle=W(this.el,H(".orthogonal-drag-handle.end")),this.orthogonalEndDragHandleDisposables.add(oe(()=>this._orthogonalEndDragHandle.remove())),this.orthogonalEndDragHandleDisposables.add(new Ee(this._orthogonalEndDragHandle,"mouseenter")).event(()=>Di.onMouseEnter(e),void 0,this.orthogonalEndDragHandleDisposables),this.orthogonalEndDragHandleDisposables.add(new Ee(this._orthogonalEndDragHandle,"mouseleave")).event(()=>Di.onMouseLeave(e),void 0,this.orthogonalEndDragHandleDisposables))};this.orthogonalEndSashDisposables.add(e.onDidEnablementChange(t,this)),t(e.state)}this._orthogonalEndSash=e}onPointerStart(e,t){ke.stop(e);let i=!1;if(!e.__orthogonalSashEvent){let m=this.getOrthogonalSash(e);m&&(i=!0,e.__orthogonalSashEvent=!0,m.onPointerStart(e,new Mu(t)))}if(this.linkedSash&&!e.__linkedSashEvent&&(e.__linkedSashEvent=!0,this.linkedSash.onPointerStart(e,new Mu(t))),!this.state)return;let n=By("iframe");for(let m of n)m.style.pointerEvents="none";let r=e.pageX,o=e.pageY,a=e.altKey,l={startX:r,currentX:r,startY:o,currentY:o,altKey:a};this.el.classList.add("active"),this._onDidStart.fire(l);let c=kt(this.el),h=()=>{let m="";i?m="all-scroll":this.orientation===1?this.state===1?m="s-resize":this.state===2?m="n-resize":m=ee?"row-resize":"ns-resize":this.state===1?m="e-resize":this.state===2?m="w-resize":m=ee?"col-resize":"ew-resize",c.textContent=`* { cursor: ${m} !important; }`},d=new U;h(),i||this.onDidEnablementChange(h,null,d);let u=m=>{ke.stop(m,!1);let g={startX:r,currentX:m.pageX,startY:o,currentY:m.pageY,altKey:a};this._onDidChange.fire(g)},f=m=>{ke.stop(m,!1),this.el.removeChild(c),this.el.classList.remove("active"),this._onDidEnd.fire(),d.dispose();for(let g of n)g.style.pointerEvents="auto"};t.onPointerMove(u,null,d),t.onPointerUp(f,null,d),d.add(t)}onPointerDoublePress(e){let 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&&Di.onMouseEnter(e.linkedSash,!0)}static onMouseLeave(e,t=!1){e.hoverDelayer.cancel(),e.el.classList.remove("hover"),!t&&e.linkedSash&&Di.onMouseLeave(e.linkedSash,!0)}clearSashHoverState(){Di.onMouseLeave(this)}layout(){if(this.orientation===0){let 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{let 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")}}hide(){this.hidden=!0,this.el.style.display="none",this.el.setAttribute("aria-hidden","true")}getOrthogonalSash(e){if(!(!e.target||!(e.target instanceof HTMLElement))&&e.target.classList.contains("orthogonal-drag-handle"))return e.target.classList.contains("start")?this.orthogonalStartSash:this.orthogonalEndSash}dispose(){super.dispose(),this.el.remove()}};var Gn=class{constructor(e,t=[],i=!1){this.ctor=e,this.staticArguments=t,this.supportsDelayedInstantiation=i}};var IN=[];function Cp(s,e,t){e instanceof Gn||(e=new Gn(e,[],t)),IN.push([s,e])}function NN(){return IN}var H0=$("IEditorCancelService"),TN=new te("cancellableOperation",!1,p("cancellableOperation","Whether the editor runs a cancellable operation, e.g. like 'Peek References'"));Cp(H0,class{constructor(){this._tokens=new WeakMap}add(s,e){let t=this._tokens.get(s);t||(t=s.invokeWithinContext(n=>{let r=TN.bindTo(n.get(fe)),o=new Ht;return{key:r,tokens:o}}),this._tokens.set(s,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(s){let e=this._tokens.get(s);if(!e)return;let t=e.tokens.pop();t&&(t.cancel(),e.key.set(!e.tokens.isEmpty()))}},!0);var U0=class extends hi{constructor(e,t){super(t);this.editor=e,this._unregister=e.invokeWithinContext(i=>i.get(H0).add(e,this))}dispose(){this._unregister(),super.dispose()}};J(new class extends Us{constructor(){super({id:"editor.cancelOperation",kbOpts:{weight:100,primary:9},precondition:TN})}runEditorCommand(s,e){s.get(H0).cancel(e)}});var Sp=class{constructor(e,t){if(this.flags=t,(this.flags&1)!=0){let i=e.getModel();this.modelVersionId=i?ji("{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 Sp))return!1;let 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 Sp(e,this.flags))}},yp=class extends U0{constructor(e,t,i,n){super(e,n);this._listener=new U,t&4&&this._listener.add(e.onDidChangeCursorPosition(r=>{(!i||!D.containsPosition(i,r.position))&&this.cancel()})),t&2&&this._listener.add(e.onDidChangeCursorSelection(r=>{(!i||!D.containsRange(i,r.selection))&&this.cancel()})),t&8&&this._listener.add(e.onDidScrollChange(r=>this.cancel())),t&1&&(this._listener.add(e.onDidChangeModel(r=>this.cancel())),this._listener.add(e.onDidChangeModelContent(r=>this.cancel())))}dispose(){this._listener.dispose(),super.dispose()}},Lp=class extends hi{constructor(e,t){super(t);this._listener=e.onDidChangeContent(()=>this.cancel())}dispose(){this._listener.dispose(),super.dispose()}},Ru=class{constructor(e,t,i){this._visiblePosition=e,this._visiblePositionScrollDelta=t,this._cursorPosition=i}static capture(e){let t=null,i=0;if(e.getScrollTop()!==0){let n=e.getVisibleRanges();if(n.length>0){t=n[0].getStartPosition();let r=e.getTopForPosition(t.lineNumber,t.column);i=e.getScrollTop()-r}}return new Ru(t,i,e.getPosition())}restore(e){if(this._visiblePosition){let t=e.getTopForPosition(this._visiblePosition.lineNumber,this._visiblePosition.column);e.setScrollTop(t+this._visiblePositionScrollDelta)}}restoreRelativeVerticalPositionOfCursor(e){let t=e.getPosition();if(!this._cursorPosition||!t)return;let i=e.getTopForLineNumber(t.lineNumber)-e.getTopForLineNumber(this._cursorPosition.lineNumber);e.setScrollTop(e.getScrollTop()+i)}};var xp={RESOURCES:"ResourceURLs",DOWNLOAD_URL:"DownloadURL",FILES:"Files",TEXT:Li.text,TERMINALS:"Terminals"},$0=class{constructor(e){this.data=e}update(){}getData(){return this.data}},Yn={CurrentDragAndDropData:void 0};var Io=class extends M{constructor(e,t,i={}){super();this.options=i,this._context=e||this,this._action=t,t instanceof _i&&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 oa)),this._actionRunner}set actionRunner(e){this._actionRunner=e}getAction(){return this._action}isEnabled(){return this._action.enabled}setActionContext(e){this._context=e}render(e){let t=this.element=e;this._register(we.addTarget(e));let i=this.options&&this.options.draggable;i&&(e.draggable=!0,at&&this._register(O(e,z.DRAG_START,n=>{var r;return(r=n.dataTransfer)===null||r===void 0?void 0:r.setData(xp.TEXT,this._action.label)}))),this._register(O(t,Re.Tap,n=>this.onClick(n,!0))),this._register(O(t,z.MOUSE_DOWN,n=>{i||ke.stop(n,!0),this._action.enabled&&n.button===0&&t.classList.add("active")})),ee&&this._register(O(t,z.CONTEXT_MENU,n=>{n.button===0&&n.ctrlKey===!0&&this.onClick(n)})),this._register(O(t,z.CLICK,n=>{ke.stop(n,!0),this.options&&this.options.isMenu||Xo(()=>this.onClick(n))})),this._register(O(t,z.DBLCLICK,n=>{ke.stop(n,!0)})),[z.MOUSE_UP,z.MOUSE_OUT].forEach(n=>{this._register(O(t,n,r=>{ke.stop(r),t.classList.remove("active")}))})}onClick(e,t=!1){var i;ke.stop(e,!0);let n=Jt(this._context)?((i=this.options)===null||i===void 0?void 0:i.useEventAsContext)?e:{preserveFocus:t}:this._context;this.actionRunner.run(this._action,n)}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(){}updateTooltip(){}updateClass(){}updateChecked(){}dispose(){this.element&&(this.element.remove(),this.element=void 0),super.dispose()}},Au=class extends Io{constructor(e,t,i={}){super(e,t,i);this.options=i,this.options.icon=i.icon!==void 0?i.icon:!1,this.options.label=i.label!==void 0?i.label:!0,this.cssClass=""}render(e){super.render(e),this.element&&(this.label=W(this.element,H("a.action-label"))),this.label&&(this._action.id===On.ID?this.label.setAttribute("role","presentation"):this.options.isMenu?this.label.setAttribute("role","menuitem"):this.label.setAttribute("role","button")),this.options.label&&this.options.keybinding&&this.element&&(W(this.element,H("span.keybinding")).textContent=this.options.keybinding),this.updateClass(),this.updateLabel(),this.updateTooltip(),this.updateEnabled(),this.updateChecked()}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.getAction().label)}updateTooltip(){let e=null;this.getAction().tooltip?e=this.getAction().tooltip:!this.options.label&&this.getAction().label&&this.options.icon&&(e=this.getAction().label,this.options.keybinding&&(e=p({key:"titleLabel",comment:["action title","action keybinding"]},"{0} ({1})",e,this.options.keybinding))),e&&this.label&&(this.label.title=e)}updateClass(){this.cssClass&&this.label&&this.label.classList.remove(...this.cssClass.split(" ")),this.options.icon?(this.cssClass=this.getAction().class,this.label&&(this.label.classList.add("codicon"),this.cssClass&&this.label.classList.add(...this.cssClass.split(" "))),this.updateEnabled()):this.label&&this.label.classList.remove("codicon")}updateEnabled(){this.getAction().enabled?(this.label&&(this.label.removeAttribute("aria-disabled"),this.label.classList.remove("disabled")),this.element&&this.element.classList.remove("disabled")):(this.label&&(this.label.setAttribute("aria-disabled","true"),this.label.classList.add("disabled")),this.element&&this.element.classList.add("disabled"))}updateChecked(){this.label&&(this.getAction().checked?this.label.classList.add("checked"):this.label.classList.remove("checked"))}};var OO=function(s,e,t,i){function n(r){return r instanceof t?r:new t(function(o){o(r)})}return new(t||(t=Promise))(function(r,o){function a(h){try{c(i.next(h))}catch(d){o(d)}}function l(h){try{c(i.throw(h))}catch(d){o(d)}}function c(h){h.done?r(h.value):n(h.value).then(a,l)}c((i=i.apply(s,e||[])).next())})},En=class extends M{constructor(e,t={}){var i,n,r,o,a,l;super();this.triggerKeyDown=!1,this.focusable=!0,this._onDidBlur=this._register(new k),this.onDidBlur=this._onDidBlur.event,this._onDidCancel=this._register(new k({onFirstListenerAdd:()=>this.cancelHasListener=!0})),this.onDidCancel=this._onDidCancel.event,this.cancelHasListener=!1,this._onDidRun=this._register(new k),this.onDidRun=this._onDidRun.event,this._onBeforeRun=this._register(new k),this.onBeforeRun=this._onBeforeRun.event,this.options=t,this._context=(i=t.context)!==null&&i!==void 0?i:null,this._orientation=(n=this.options.orientation)!==null&&n!==void 0?n:0,this._triggerKeys={keyDown:(o=(r=this.options.triggerKeys)===null||r===void 0?void 0:r.keyDown)!==null&&o!==void 0?o:!1,keys:(l=(a=this.options.triggerKeys)===null||a===void 0?void 0:a.keys)!==null&&l!==void 0?l:[3,10]},this.options.actionRunner?this._actionRunner=this.options.actionRunner:(this._actionRunner=new oa,this._register(this._actionRunner)),this._register(this._actionRunner.onDidRun(d=>this._onDidRun.fire(d))),this._register(this._actionRunner.onBeforeRun(d=>this._onBeforeRun.fire(d))),this._actionIds=[],this.viewItems=[],this.focusedItem=void 0,this.domNode=document.createElement("div"),this.domNode.className="monaco-action-bar",t.animated!==!1&&this.domNode.classList.add("animated");let c,h;switch(this._orientation){case 0:c=[15],h=[17];break;case 1:c=[16],h=[18],this.domNode.className+=" vertical";break}this._register(O(this.domNode,z.KEY_DOWN,d=>{let u=new De(d),f=!0,m=typeof this.focusedItem=="number"?this.viewItems[this.focusedItem]:void 0;c&&(u.equals(c[0])||u.equals(c[1]))?f=this.focusPrevious():h&&(u.equals(h[0])||u.equals(h[1]))?f=this.focusNext():u.equals(9)&&this.cancelHasListener?this._onDidCancel.fire():u.equals(14)?f=this.focusFirst():u.equals(13)?f=this.focusLast():u.equals(2)&&m instanceof Io&&m.trapsArrowNavigation?f=this.focusNext():this.isTriggerKeyEvent(u)?this._triggerKeys.keyDown?this.doTrigger(u):this.triggerKeyDown=!0:f=!1,f&&(u.preventDefault(),u.stopPropagation())})),this._register(O(this.domNode,z.KEY_UP,d=>{let u=new De(d);this.isTriggerKeyEvent(u)?(!this._triggerKeys.keyDown&&this.triggerKeyDown&&(this.triggerKeyDown=!1,this.doTrigger(u)),u.preventDefault(),u.stopPropagation()):(u.equals(2)||u.equals(1024|2))&&this.updateFocusedItem()})),this.focusTracker=this._register(zr(this.domNode)),this._register(this.focusTracker.onDidBlur(()=>{(jr()===this.domNode||!bn(jr(),this.domNode))&&(this._onDidBlur.fire(),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.actionsList.setAttribute("role","toolbar"),this.options.ariaLabel&&this.actionsList.setAttribute("aria-label",this.options.ariaLabel),this.domNode.appendChild(this.actionsList),e.appendChild(this.domNode)}isTriggerKeyEvent(e){let t=!1;return this._triggerKeys.keys.forEach(i=>{t=t||e.equals(i)}),t}updateFocusedItem(){for(let e=0;et.setActionContext(e))}get actionRunner(){return this._actionRunner}set actionRunner(e){e&&(this._actionRunner=e,this.viewItems.forEach(t=>t.actionRunner=e))}getContainer(){return this.domNode}push(e,t={}){let i=Array.isArray(e)?e:[e],n=Ws(t.index)?t.index:null;i.forEach(r=>{let o=document.createElement("li");o.className="action-item",o.setAttribute("role","presentation"),this.options.allowContextMenu||this._register(O(o,z.CONTEXT_MENU,l=>{ke.stop(l,!0)}));let a;this.options.actionViewItemProvider&&(a=this.options.actionViewItemProvider(r)),a||(a=new Au(this.context,r,t)),a.actionRunner=this._actionRunner,a.setActionContext(this.context),a.render(o),this.focusable&&a instanceof Io&&this.viewItems.length===0&&a.setFocusable(!0),n===null||n<0||n>=this.actionsList.children.length?(this.actionsList.appendChild(o),this.viewItems.push(a),this._actionIds.push(r.id)):(this.actionsList.insertBefore(o,this.actionsList.children[n]),this.viewItems.splice(n,0,a),this._actionIds.splice(n,0,r.id),n++)}),typeof this.focusedItem=="number"&&this.focus(this.focusedItem)}clear(){me(this.viewItems),this.viewItems=[],this._actionIds=[],Mt(this.actionsList)}length(){return this.viewItems.length}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=="undefined"){let n=this.viewItems.findIndex(r=>r.isEnabled());this.focusedItem=n===-1?void 0:n,this.updateFocus()}else i!==void 0&&(this.focusedItem=i),this.updateFocus()}focusFirst(){return this.focusedItem=this.length()>1?1:0,this.focusPrevious()}focusLast(){return this.focusedItem=this.length()<2?0:this.length()-2,this.focusNext()}focusNext(){if(typeof this.focusedItem=="undefined")this.focusedItem=this.viewItems.length-1;else if(this.viewItems.length<=1)return!1;let e=this.focusedItem,t;do{if(this.options.preventLoopNavigation&&this.focusedItem+1>=this.viewItems.length)return this.focusedItem=e,!1;this.focusedItem=(this.focusedItem+1)%this.viewItems.length,t=this.viewItems[this.focusedItem]}while(this.focusedItem!==e&&this.options.focusOnlyEnabledItems&&!t.isEnabled());return this.updateFocus(),!0}focusPrevious(){if(typeof this.focusedItem=="undefined")this.focusedItem=0;else if(this.viewItems.length<=1)return!1;let e=this.focusedItem,t;do{if(this.focusedItem=this.focusedItem-1,this.focusedItem<0){if(this.options.preventLoopNavigation)return this.focusedItem=e,!1;this.focusedItem=this.viewItems.length-1}t=this.viewItems[this.focusedItem]}while(this.focusedItem!==e&&this.options.focusOnlyEnabledItems&&!t.isEnabled());return this.updateFocus(!0),!0}updateFocus(e,t){typeof this.focusedItem=="undefined"&&this.actionsList.focus({preventScroll:t});for(let i=0;ithis.iconsById[e])}getIcon(e){return this.iconsById[e]}getIconSchema(){return this.iconSchema}getIconFont(e){return this.iconFontsById[e]}toString(){let e=(r,o)=>r.id.localeCompare(o.id),t=r=>{for(;ui.isThemeIcon(r.defaults);)r=this.iconsById[r.defaults.id];return`codicon codicon-${r?r.id:""}`},i=[];i.push("| preview | identifier | default codicon ID | description"),i.push("| ----------- | --------------------------------- | --------------------------------- | --------------------------------- |");let n=Object.keys(this.iconsById).map(r=>this.iconsById[r]);for(let r of n.filter(o=>!!o.description).sort(e))i.push(`||${r.id}|${ui.isThemeIcon(r.defaults)?r.defaults.id:r.id}|${r.description||""}|`);i.push("| preview | identifier "),i.push("| ----------- | --------------------------------- |");for(let r of n.filter(o=>!ui.isThemeIcon(o.defaults)).sort(e))i.push(`||${r.id}|`);return i.join(` +`)}},al=new MN;Te.add(PO.IconContribution,al);function No(s,e,t,i){return al.registerIcon(s,e,t,i)}function RN(){return al}function FO(){for(let s of Ul.all)al.registerIcon(s.id,s.definition,s.description);Ul.onDidRegister(s=>al.registerIcon(s.id,s.definition,s.description))}FO();var AN="vscode://schemas/icons",ON=Te.as(Ha.JSONContribution);ON.registerSchema(AN,al.getIconSchema());var PN=new $e(()=>ON.notifySchemaChanged(AN),200);al.onDidChange(()=>{PN.isScheduled()||PN.schedule()});var sse=No("widget-close",Le.close,p("widgetClose","Icon for the close action in widgets."));var BO=function(s,e,t,i){function n(r){return r instanceof t?r:new t(function(o){o(r)})}return new(t||(t=Promise))(function(r,o){function a(h){try{c(i.next(h))}catch(d){o(d)}}function l(h){try{c(i.throw(h))}catch(d){o(d)}}function c(h){h.done?r(h.value):n(h.value).then(a,l)}c((i=i.apply(s,e||[])).next())})},K0,Dp=3,Yc=class{constructor(e,t,i,n){this.originalLineStart=e,this.originalLineEnd=t,this.modifiedLineStart=i,this.modifiedLineEnd=n}getType(){return this.originalLineStart===0?1:this.modifiedLineStart===0?2:0}},Ep=class{constructor(e){this.entries=e}},WO=No("diff-review-insert",Le.add,p("diffReviewInsertIcon","Icon for 'Insert' in diff review.")),VO=No("diff-review-remove",Le.remove,p("diffReviewRemoveIcon","Icon for 'Remove' in diff review.")),jO=No("diff-review-close",Le.close,p("diffReviewCloseIcon","Icon for 'Close' in diff review.")),Zn=class extends M{constructor(e){super();this._width=0,this._diffEditor=e,this._isVisible=!1,this.shadow=X(document.createElement("div")),this.shadow.setClassName("diff-review-shadow"),this.actionBarContainer=X(document.createElement("div")),this.actionBarContainer.setClassName("diff-review-actions"),this._actionBar=this._register(new En(this.actionBarContainer.domNode)),this._actionBar.push(new _i("diffreview.close",p("label.close","Close"),"close-diff-review "+ui.asClassName(jO),!0,()=>BO(this,void 0,void 0,function*(){return this.hide()})),{label:!1,icon:!0}),this.domNode=X(document.createElement("div")),this.domNode.setClassName("diff-review monaco-editor-background"),this._content=X(document.createElement("div")),this._content.setClassName("diff-review-content"),this._content.setAttribute("role","code"),this.scrollbar=this._register(new _u(this._content.domNode,{})),this.domNode.domNode.appendChild(this.scrollbar.getDomNode()),this._register(e.onDidUpdateDiff(()=>{!this._isVisible||(this._diffs=this._compute(),this._render())})),this._register(e.getModifiedEditor().onDidChangeCursorPosition(()=>{!this._isVisible||this._render()})),this._register(lt(this.domNode.domNode,"click",t=>{t.preventDefault();let i=vb(t.target,"diff-review-row");i&&this._goToRow(i)})),this._register(lt(this.domNode.domNode,"keydown",t=>{(t.equals(18)||t.equals(2048|18)||t.equals(512|18))&&(t.preventDefault(),this._goToRow(this._getNextRow())),(t.equals(16)||t.equals(2048|16)||t.equals(512|16))&&(t.preventDefault(),this._goToRow(this._getPrevRow())),(t.equals(9)||t.equals(2048|9)||t.equals(512|9)||t.equals(1024|9))&&(t.preventDefault(),this.hide()),(t.equals(10)||t.equals(3))&&(t.preventDefault(),this.accept())})),this._diffs=[],this._currentDiff=null}prev(){let e=0;if(this._isVisible||(this._diffs=this._compute()),this._isVisible){let i=-1;for(let n=0,r=this._diffs.length;n0){let L=e[c-1];L.originalEndLineNumber===0?C=L.originalStartLineNumber+1:C=L.originalEndLineNumber+1,L.modifiedEndLineNumber===0?y=L.modifiedStartLineNumber+1:y=L.modifiedEndLineNumber+1}let x=_-Dp+1,S=v-Dp+1;if(xC){let L=C-x;x=x+L,S=S+L}if(S>y){let L=y-S;x=x+L,S=S+L}b[w++]=new Yc(_,x,v,S)}n[r++]=new Ep(b)}let o=n[0].entries,a=[],l=0;for(let c=1,h=n.length;cd)&&(d=I),P!==0&&(u===0||Pf)&&(f=B)}let m=document.createElement("div");m.className="diff-review-row";let g=document.createElement("div");g.className="diff-review-cell diff-review-summary";let b=d-h+1,w=f-u+1;g.appendChild(document.createTextNode(`${a+1}/${this._diffs.length}: @@ -${h},${b} +${u},${w} @@`)),m.setAttribute("data-line",String(u));let _=S=>S===0?p("no_lines_changed","no lines changed"):S===1?p("one_line_changed","1 line changed"):p("more_lines_changed","{0} lines changed",S),v=_(b),C=_(w);m.setAttribute("aria-label",p({key:"header",comment:["This is the ARIA label for a git diff header.","A git diff header looks like this: @@ -154,12 +159,39 @@.","That encodes that at original line 154 (which is now line 159), 12 lines were removed/changed with 39 lines.","Variables 0 and 1 refer to the diff index out of total number of diffs.","Variables 2 and 4 will be numbers (a line number).",'Variables 3 and 5 will be "no lines changed", "1 line changed" or "X lines changed", localized separately.']},"Difference {0} of {1}: original line {2}, {3}, modified line {4}, {5}",a+1,this._diffs.length,h,v,u,C)),m.appendChild(g),m.setAttribute("role","listitem"),c.appendChild(m);let y=t.get(57),x=u;for(let S=0,L=l.length;Ss});bt((s,e)=>{let t=s.getColor(ap);t&&e.addRule(`.monaco-diff-editor .diff-review-line-number { color: ${t}; }`);let i=s.getColor(So);i&&e.addRule(`.monaco-diff-editor .diff-review-shadow { box-shadow: ${i} 0 -6px 6px -6px inset; }`)});var FN=class extends ba{constructor(){super({id:"editor.action.diffReview.next",label:p("editor.action.diffReview.next","Go to Next Difference"),alias:"Go to Next Difference",precondition:dt.has("isInDiffEditor"),kbOpts:{kbExpr:null,primary:65,weight:100}})}run(e,t){let i=WN(e);i&&i.diffReviewNext()}},BN=class extends ba{constructor(){super({id:"editor.action.diffReview.prev",label:p("editor.action.diffReview.prev","Go to Previous Difference"),alias:"Go to Previous Difference",precondition:dt.has("isInDiffEditor"),kbOpts:{kbExpr:null,primary:1024|65,weight:100}})}run(e,t){let i=WN(e);i&&i.diffReviewPrev()}};function WN(s){let e=s.get(qe),t=e.listDiffEditors(),i=e.getActiveCodeEditor();if(!i)return null;for(let n=0,r=t.length;nn.modifiedStartLineNumber?p("diff.clipboard.copyDeletedLinesContent.label","Copy deleted lines"):p("diff.clipboard.copyDeletedLinesContent.single.label","Copy deleted line"),void 0,!0,()=>q0(this,void 0,void 0,function*(){let m=new D(n.originalStartLineNumber,1,n.originalEndLineNumber+1,1),g=n.originalModel.getValueInRange(m);yield this._clipboardService.writeText(g)})));let h=0,d;n.originalEndLineNumber>n.modifiedStartLineNumber&&(d=new _i("diff.clipboard.copyDeletedLineContent",p("diff.clipboard.copyDeletedLineContent.label","Copy deleted line ({0})",n.originalStartLineNumber),void 0,!0,()=>q0(this,void 0,void 0,function*(){let m=n.originalModel.getLineContent(n.originalStartLineNumber+h);yield this._clipboardService.writeText(m)})),c.push(d)),i.getOption(79)||c.push(new _i("diff.inline.revertChange",p("diff.inline.revertChange.label","Revert this change"),void 0,!0,()=>q0(this,void 0,void 0,function*(){let m=new D(n.originalStartLineNumber,1,n.originalEndLineNumber,n.originalModel.getLineMaxColumn(n.originalEndLineNumber)),g=n.originalModel.getValueInRange(m);if(n.modifiedEndLineNumber===0){let b=i.getModel().getLineMaxColumn(n.modifiedStartLineNumber);i.executeEdits("diffEditor",[{range:new D(n.modifiedStartLineNumber,b,n.modifiedStartLineNumber,b),text:l+g}])}else{let b=i.getModel().getLineMaxColumn(n.modifiedEndLineNumber);i.executeEdits("diffEditor",[{range:new D(n.modifiedStartLineNumber,1,n.modifiedEndLineNumber,b),text:g}])}})));let f=(m,g)=>{this._contextMenuService.showContextMenu({getAnchor:()=>({x:m,y:g}),getActions:()=>(d&&(d.label=p("diff.clipboard.copyDeletedLineContent.label","Copy deleted line ({0})",n.originalStartLineNumber+h)),c),autoSelectFirstItem:!0})};this._register(lt(this._diffActions,"mousedown",m=>{let{top:g,height:b}=ti(this._diffActions),w=Math.floor(a/3);m.preventDefault(),f(m.posx,g+b+w)})),this._register(i.onMouseMove(m=>{m.target.type===8||m.target.type===5?m.target.detail.viewZoneId===this._viewZoneId?(this.visibility=!0,h=this._updateLightBulbPosition(this._marginDomNode,m.event.browserEvent.y,a)):this.visibility=!1:this.visibility=!1})),this._register(i.onMouseDown(m=>{!m.event.rightButton||(m.target.type===8||m.target.type===5)&&m.target.detail.viewZoneId===this._viewZoneId&&(m.event.preventDefault(),h=this._updateLightBulbPosition(this._marginDomNode,m.event.browserEvent.y,a),f(m.event.posx,m.event.posy+a))}))}get visibility(){return this._visibility}set visibility(e){this._visibility!==e&&(this._visibility=e,e?this._diffActions.style.visibility="visible":this._diffActions.style.visibility="hidden")}_updateLightBulbPosition(e,t,i){let{top:n}=ti(e),r=t-n,o=Math.floor(r/i),a=o*i;if(this._diffActions.style.top=`${a}px`,this.diff.viewLineCounts){let l=0;for(let c=0;c=0;a--)(o=s[a])&&(r=(n<3?o(r):n>3?o(e,t,r):o(e,t))||r);return n>3&&r&&Object.defineProperty(e,t,r),r},wr=function(s,e){return function(t,i){e(t,i,s)}},Y0,Z0=class{constructor(e,t){this._contextMenuService=e,this._clipboardService=t,this._zones=[],this._inlineDiffMargins=[],this._zonesMap={},this._decorations=[]}getForeignViewZones(e){return e.filter(t=>!this._zonesMap[String(t.id)])}clean(e){this._zones.length>0&&e.changeViewZones(t=>{for(let i of this._zones)t.removeZone(i)}),this._zones=[],this._zonesMap={},this._decorations=e.deltaDecorations(this._decorations,[])}apply(e,t,i,n){let r=n?Ru.capture(e):null;e.changeViewZones(o=>{for(let a of this._zones)o.removeZone(a);for(let a of this._inlineDiffMargins)a.dispose();this._zones=[],this._zonesMap={},this._inlineDiffMargins=[];for(let a=0,l=i.zones.length;as}),vr=class Qt extends M{constructor(e,t,i,n,r,o,a,l,c,h,d,u){super();this._editorProgressService=u,this._onDidDispose=this._register(new k),this.onDidDispose=this._onDidDispose.event,this._onDidUpdateDiff=this._register(new k),this.onDidUpdateDiff=this._onDidUpdateDiff.event,this._onDidContentSizeChange=this._register(new k),this._lastOriginalWarning=null,this._lastModifiedWarning=null,this._editorWorkerService=r,this._codeEditorService=l,this._contextKeyService=this._register(o.createScoped(e)),this._instantiationService=a.createChild(new Ds([fe,this._contextKeyService])),this._contextKeyService.createKey("isInDiffEditor",!0),this._themeService=c,this._notificationService=h,this._id=++HO,this._state=0,this._updatingDiffProgress=null,this._domElement=e,t=t||{},this._renderSideBySide=!0,typeof t.renderSideBySide!="undefined"&&(this._renderSideBySide=t.renderSideBySide),this._maxComputationTime=5e3,typeof t.maxComputationTime!="undefined"&&(this._maxComputationTime=t.maxComputationTime),this._ignoreTrimWhitespace=!0,typeof t.ignoreTrimWhitespace!="undefined"&&(this._ignoreTrimWhitespace=t.ignoreTrimWhitespace),this._renderIndicators=!0,typeof t.renderIndicators!="undefined"&&(this._renderIndicators=t.renderIndicators),this._originalIsEditable=q(t.originalEditable,!1),this._diffCodeLens=q(t.diffCodeLens,!1),this._diffWordWrap=$N(t.diffWordWrap,"inherit"),typeof t.isInEmbeddedEditor!="undefined"?this._contextKeyService.createKey("isInEmbeddedDiffEditor",t.isInEmbeddedEditor):this._contextKeyService.createKey("isInEmbeddedDiffEditor",!1),this._renderOverviewRuler=!0,typeof t.renderOverviewRuler!="undefined"&&(this._renderOverviewRuler=Boolean(t.renderOverviewRuler)),this._updateDecorationsRunner=this._register(new $e(()=>this._updateDecorations(),0)),this._containerDomElement=document.createElement("div"),this._containerDomElement.className=Qt._getClassName(this._themeService.getColorTheme(),this._renderSideBySide),this._containerDomElement.style.position="relative",this._containerDomElement.style.height="100%",this._domElement.appendChild(this._containerDomElement),this._overviewViewportDomElement=X(document.createElement("div")),this._overviewViewportDomElement.setClassName("diffViewport"),this._overviewViewportDomElement.setPosition("absolute"),this._overviewDomElement=document.createElement("div"),this._overviewDomElement.className="diffOverview",this._overviewDomElement.style.position="absolute",this._overviewDomElement.appendChild(this._overviewViewportDomElement.domNode),this._register(lt(this._overviewDomElement,"mousedown",m=>{this._modifiedEditor.delegateVerticalScrollbarMouseDown(m)})),this._renderOverviewRuler&&this._containerDomElement.appendChild(this._overviewDomElement),this._originalDomNode=document.createElement("div"),this._originalDomNode.className="editor original",this._originalDomNode.style.position="absolute",this._originalDomNode.style.height="100%",this._containerDomElement.appendChild(this._originalDomNode),this._modifiedDomNode=document.createElement("div"),this._modifiedDomNode.className="editor modified",this._modifiedDomNode.style.position="absolute",this._modifiedDomNode.style.height="100%",this._containerDomElement.appendChild(this._modifiedDomNode),this._beginUpdateDecorationsTimeout=-1,this._currentlyChangingViewZones=!1,this._diffComputationToken=0,this._originalEditorState=new Z0(d,n),this._modifiedEditorState=new Z0(d,n),this._isVisible=!0,this._isHandlingScrollEvent=!1,this._elementSizeObserver=this._register(new Xd(this._containerDomElement,t.dimension,()=>this._onDidContainerSizeChanged())),t.automaticLayout&&this._elementSizeObserver.startObserving(),this._diffComputationResult=null,this._originalEditor=this._createLeftHandSideEditor(t,i.originalEditor||{}),this._modifiedEditor=this._createRightHandSideEditor(t,i.modifiedEditor||{}),this._originalOverviewRuler=null,this._modifiedOverviewRuler=null,this._reviewPane=new Zn(this),this._containerDomElement.appendChild(this._reviewPane.domNode.domNode),this._containerDomElement.appendChild(this._reviewPane.shadow.domNode),this._containerDomElement.appendChild(this._reviewPane.actionBarContainer.domNode),this._enableSplitViewResizing=!0,typeof t.enableSplitViewResizing!="undefined"&&(this._enableSplitViewResizing=t.enableSplitViewResizing),this._renderSideBySide?this._setStrategy(new ks(this._createDataSource(),this._enableSplitViewResizing)):this._setStrategy(new J0(this._createDataSource(),this._enableSplitViewResizing)),this._register(c.onDidColorThemeChange(m=>{this._strategy&&this._strategy.applyColors(m)&&this._updateDecorationsRunner.schedule(),this._containerDomElement.className=Qt._getClassName(this._themeService.getColorTheme(),this._renderSideBySide)}));let f=Yr.getDiffEditorContributions();for(let m of f)try{this._register(a.createInstance(m.ctor,this))}catch(g){de(g)}this._codeEditorService.addDiffEditor(this)}_setState(e){this._state!==e&&(this._state=e,this._updatingDiffProgress&&(this._updatingDiffProgress.done(),this._updatingDiffProgress=null),this._state===1&&(this._updatingDiffProgress=this._editorProgressService.show(!0,1e3)))}diffReviewNext(){this._reviewPane.next()}diffReviewPrev(){this._reviewPane.prev()}static _getClassName(e,t){let i="monaco-diff-editor monaco-editor-background ";return t&&(i+="side-by-side "),i+=ga(e.type),i}_recreateOverviewRulers(){!this._renderOverviewRuler||(this._originalOverviewRuler&&(this._overviewDomElement.removeChild(this._originalOverviewRuler.getDomNode()),this._originalOverviewRuler.dispose()),this._originalEditor.hasModel()&&(this._originalOverviewRuler=this._originalEditor.createOverviewRuler("original diffOverviewRuler"),this._overviewDomElement.appendChild(this._originalOverviewRuler.getDomNode())),this._modifiedOverviewRuler&&(this._overviewDomElement.removeChild(this._modifiedOverviewRuler.getDomNode()),this._modifiedOverviewRuler.dispose()),this._modifiedEditor.hasModel()&&(this._modifiedOverviewRuler=this._modifiedEditor.createOverviewRuler("modified diffOverviewRuler"),this._overviewDomElement.appendChild(this._modifiedOverviewRuler.getDomNode())),this._layoutOverviewRulers())}_createLeftHandSideEditor(e,t){let i=this._createInnerEditor(this._instantiationService,this._originalDomNode,this._adjustOptionsForLeftHandSide(e),t);this._register(i.onDidScrollChange(r=>{this._isHandlingScrollEvent||!r.scrollTopChanged&&!r.scrollLeftChanged&&!r.scrollHeightChanged||(this._isHandlingScrollEvent=!0,this._modifiedEditor.setScrollPosition({scrollLeft:r.scrollLeft,scrollTop:r.scrollTop}),this._isHandlingScrollEvent=!1,this._layoutOverviewViewport())})),this._register(i.onDidChangeViewZones(()=>{this._onViewZonesChanged()})),this._register(i.onDidChangeConfiguration(r=>{!i.getModel()||(r.hasChanged(41)&&this._updateDecorationsRunner.schedule(),r.hasChanged(130)&&(this._updateDecorationsRunner.cancel(),this._updateDecorations()))})),this._register(i.onDidChangeModelContent(()=>{this._isVisible&&this._beginUpdateDecorationsSoon()}));let n=this._contextKeyService.createKey("isInDiffLeftEditor",i.hasWidgetFocus());return this._register(i.onDidFocusEditorWidget(()=>n.set(!0))),this._register(i.onDidBlurEditorWidget(()=>n.set(!1))),this._register(i.onDidContentSizeChange(r=>{let o=this._originalEditor.getContentWidth()+this._modifiedEditor.getContentWidth()+Qt.ONE_OVERVIEW_WIDTH,a=Math.max(this._modifiedEditor.getContentHeight(),this._originalEditor.getContentHeight());this._onDidContentSizeChange.fire({contentHeight:a,contentWidth:o,contentHeightChanged:r.contentHeightChanged,contentWidthChanged:r.contentWidthChanged})})),i}_createRightHandSideEditor(e,t){let i=this._createInnerEditor(this._instantiationService,this._modifiedDomNode,this._adjustOptionsForRightHandSide(e),t);this._register(i.onDidScrollChange(r=>{this._isHandlingScrollEvent||!r.scrollTopChanged&&!r.scrollLeftChanged&&!r.scrollHeightChanged||(this._isHandlingScrollEvent=!0,this._originalEditor.setScrollPosition({scrollLeft:r.scrollLeft,scrollTop:r.scrollTop}),this._isHandlingScrollEvent=!1,this._layoutOverviewViewport())})),this._register(i.onDidChangeViewZones(()=>{this._onViewZonesChanged()})),this._register(i.onDidChangeConfiguration(r=>{!i.getModel()||(r.hasChanged(41)&&this._updateDecorationsRunner.schedule(),r.hasChanged(130)&&(this._updateDecorationsRunner.cancel(),this._updateDecorations()))})),this._register(i.onDidChangeModelContent(()=>{this._isVisible&&this._beginUpdateDecorationsSoon()})),this._register(i.onDidChangeModelOptions(r=>{r.tabSize&&this._updateDecorationsRunner.schedule()}));let n=this._contextKeyService.createKey("isInDiffRightEditor",i.hasWidgetFocus());return this._register(i.onDidFocusEditorWidget(()=>n.set(!0))),this._register(i.onDidBlurEditorWidget(()=>n.set(!1))),this._register(i.onDidContentSizeChange(r=>{let o=this._originalEditor.getContentWidth()+this._modifiedEditor.getContentWidth()+Qt.ONE_OVERVIEW_WIDTH,a=Math.max(this._modifiedEditor.getContentHeight(),this._originalEditor.getContentHeight());this._onDidContentSizeChange.fire({contentHeight:a,contentWidth:o,contentHeightChanged:r.contentHeightChanged,contentWidthChanged:r.contentWidthChanged})})),i}_createInnerEditor(e,t,i,n){return e.createInstance(qc,t,i,n)}dispose(){this._codeEditorService.removeDiffEditor(this),this._beginUpdateDecorationsTimeout!==-1&&(window.clearTimeout(this._beginUpdateDecorationsTimeout),this._beginUpdateDecorationsTimeout=-1),this._cleanViewZonesAndDecorations(),this._originalOverviewRuler&&(this._overviewDomElement.removeChild(this._originalOverviewRuler.getDomNode()),this._originalOverviewRuler.dispose()),this._modifiedOverviewRuler&&(this._overviewDomElement.removeChild(this._modifiedOverviewRuler.getDomNode()),this._modifiedOverviewRuler.dispose()),this._overviewDomElement.removeChild(this._overviewViewportDomElement.domNode),this._renderOverviewRuler&&this._containerDomElement.removeChild(this._overviewDomElement),this._containerDomElement.removeChild(this._originalDomNode),this._originalEditor.dispose(),this._containerDomElement.removeChild(this._modifiedDomNode),this._modifiedEditor.dispose(),this._strategy.dispose(),this._containerDomElement.removeChild(this._reviewPane.domNode.domNode),this._containerDomElement.removeChild(this._reviewPane.shadow.domNode),this._containerDomElement.removeChild(this._reviewPane.actionBarContainer.domNode),this._reviewPane.dispose(),this._domElement.removeChild(this._containerDomElement),this._onDidDispose.fire(),super.dispose()}getId(){return this.getEditorType()+":"+this._id}getEditorType(){return mo.IDiffEditor}getLineChanges(){return this._diffComputationResult?this._diffComputationResult.changes:null}getOriginalEditor(){return this._originalEditor}getModifiedEditor(){return this._modifiedEditor}updateOptions(e){let t=!1;typeof e.renderSideBySide!="undefined"&&this._renderSideBySide!==e.renderSideBySide&&(this._renderSideBySide=e.renderSideBySide,t=!0),typeof e.maxComputationTime!="undefined"&&(this._maxComputationTime=e.maxComputationTime,this._isVisible&&this._beginUpdateDecorationsSoon());let i=!1;typeof e.ignoreTrimWhitespace!="undefined"&&this._ignoreTrimWhitespace!==e.ignoreTrimWhitespace&&(this._ignoreTrimWhitespace=e.ignoreTrimWhitespace,i=!0),typeof e.renderIndicators!="undefined"&&this._renderIndicators!==e.renderIndicators&&(this._renderIndicators=e.renderIndicators,i=!0),i&&this._beginUpdateDecorations(),this._originalIsEditable=q(e.originalEditable,this._originalIsEditable),this._diffCodeLens=q(e.diffCodeLens,this._diffCodeLens),this._diffWordWrap=$N(e.diffWordWrap,this._diffWordWrap),this._modifiedEditor.updateOptions(this._adjustOptionsForRightHandSide(e)),this._originalEditor.updateOptions(this._adjustOptionsForLeftHandSide(e)),typeof e.enableSplitViewResizing!="undefined"&&(this._enableSplitViewResizing=e.enableSplitViewResizing),this._strategy.setEnableSplitViewResizing(this._enableSplitViewResizing),t&&(this._renderSideBySide?this._setStrategy(new ks(this._createDataSource(),this._enableSplitViewResizing)):this._setStrategy(new J0(this._createDataSource(),this._enableSplitViewResizing)),this._containerDomElement.className=Qt._getClassName(this._themeService.getColorTheme(),this._renderSideBySide)),typeof e.renderOverviewRuler!="undefined"&&this._renderOverviewRuler!==e.renderOverviewRuler&&(this._renderOverviewRuler=e.renderOverviewRuler,this._renderOverviewRuler?this._containerDomElement.appendChild(this._overviewDomElement):this._containerDomElement.removeChild(this._overviewDomElement))}getModel(){return{original:this._originalEditor.getModel(),modified:this._modifiedEditor.getModel()}}setModel(e){if(e&&(!e.original||!e.modified))throw new Error(e.original?"DiffEditorWidget.setModel: Modified model is null":"DiffEditorWidget.setModel: Original model is null");this._cleanViewZonesAndDecorations(),this._originalEditor.setModel(e?e.original:null),this._modifiedEditor.setModel(e?e.modified:null),this._updateDecorationsRunner.cancel(),e&&(this._originalEditor.setScrollTop(0),this._modifiedEditor.setScrollTop(0)),this._diffComputationResult=null,this._diffComputationToken++,this._setState(0),e&&(this._recreateOverviewRulers(),this._beginUpdateDecorations()),this._layoutOverviewViewport()}getDomNode(){return this._domElement}getVisibleColumnFromPosition(e){return this._modifiedEditor.getVisibleColumnFromPosition(e)}getPosition(){return this._modifiedEditor.getPosition()}setPosition(e){this._modifiedEditor.setPosition(e)}revealLine(e,t=0){this._modifiedEditor.revealLine(e,t)}revealLineInCenter(e,t=0){this._modifiedEditor.revealLineInCenter(e,t)}revealLineInCenterIfOutsideViewport(e,t=0){this._modifiedEditor.revealLineInCenterIfOutsideViewport(e,t)}revealLineNearTop(e,t=0){this._modifiedEditor.revealLineNearTop(e,t)}revealPosition(e,t=0){this._modifiedEditor.revealPosition(e,t)}revealPositionInCenter(e,t=0){this._modifiedEditor.revealPositionInCenter(e,t)}revealPositionInCenterIfOutsideViewport(e,t=0){this._modifiedEditor.revealPositionInCenterIfOutsideViewport(e,t)}revealPositionNearTop(e,t=0){this._modifiedEditor.revealPositionNearTop(e,t)}getSelection(){return this._modifiedEditor.getSelection()}getSelections(){return this._modifiedEditor.getSelections()}setSelection(e){this._modifiedEditor.setSelection(e)}setSelections(e){this._modifiedEditor.setSelections(e)}revealLines(e,t,i=0){this._modifiedEditor.revealLines(e,t,i)}revealLinesInCenter(e,t,i=0){this._modifiedEditor.revealLinesInCenter(e,t,i)}revealLinesInCenterIfOutsideViewport(e,t,i=0){this._modifiedEditor.revealLinesInCenterIfOutsideViewport(e,t,i)}revealLinesNearTop(e,t,i=0){this._modifiedEditor.revealLinesNearTop(e,t,i)}revealRange(e,t=0,i=!1,n=!0){this._modifiedEditor.revealRange(e,t,i,n)}revealRangeInCenter(e,t=0){this._modifiedEditor.revealRangeInCenter(e,t)}revealRangeInCenterIfOutsideViewport(e,t=0){this._modifiedEditor.revealRangeInCenterIfOutsideViewport(e,t)}revealRangeNearTop(e,t=0){this._modifiedEditor.revealRangeNearTop(e,t)}revealRangeNearTopIfOutsideViewport(e,t=0){this._modifiedEditor.revealRangeNearTopIfOutsideViewport(e,t)}revealRangeAtTop(e,t=0){this._modifiedEditor.revealRangeAtTop(e,t)}getSupportedActions(){return this._modifiedEditor.getSupportedActions()}saveViewState(){let e=this._originalEditor.saveViewState(),t=this._modifiedEditor.saveViewState();return{original:e,modified:t}}restoreViewState(e){if(e&&e.original&&e.modified){let t=e;this._originalEditor.restoreViewState(t.original),this._modifiedEditor.restoreViewState(t.modified)}}layout(e){this._elementSizeObserver.observe(e)}focus(){this._modifiedEditor.focus()}hasTextFocus(){return this._originalEditor.hasTextFocus()||this._modifiedEditor.hasTextFocus()}trigger(e,t,i){this._modifiedEditor.trigger(e,t,i)}changeDecorations(e){return this._modifiedEditor.changeDecorations(e)}_onDidContainerSizeChanged(){this._doLayout()}_getReviewHeight(){return this._reviewPane.isVisible()?this._elementSizeObserver.getHeight():0}_layoutOverviewRulers(){if(!this._renderOverviewRuler||!this._originalOverviewRuler||!this._modifiedOverviewRuler)return;let e=this._elementSizeObserver.getHeight(),t=this._getReviewHeight(),i=Qt.ENTIRE_DIFF_OVERVIEW_WIDTH-2*Qt.ONE_OVERVIEW_WIDTH;this._modifiedEditor.getLayoutInfo()&&(this._originalOverviewRuler.setLayout({top:0,width:Qt.ONE_OVERVIEW_WIDTH,right:i+Qt.ONE_OVERVIEW_WIDTH,height:e-t}),this._modifiedOverviewRuler.setLayout({top:0,right:0,width:Qt.ONE_OVERVIEW_WIDTH,height:e-t}))}_onViewZonesChanged(){this._currentlyChangingViewZones||this._updateDecorationsRunner.schedule()}_beginUpdateDecorationsSoon(){this._beginUpdateDecorationsTimeout!==-1&&(window.clearTimeout(this._beginUpdateDecorationsTimeout),this._beginUpdateDecorationsTimeout=-1),this._beginUpdateDecorationsTimeout=window.setTimeout(()=>this._beginUpdateDecorations(),Qt.UPDATE_DIFF_DECORATIONS_DELAY)}static _equals(e,t){return!e&&!t?!0:!e||!t?!1:e.toString()===t.toString()}_beginUpdateDecorations(){this._beginUpdateDecorationsTimeout=-1;let e=this._originalEditor.getModel(),t=this._modifiedEditor.getModel();if(!e||!t)return;this._diffComputationToken++;let i=this._diffComputationToken;if(this._setState(1),!this._editorWorkerService.canComputeDiff(e.uri,t.uri)){(!Qt._equals(e.uri,this._lastOriginalWarning)||!Qt._equals(t.uri,this._lastModifiedWarning))&&(this._lastOriginalWarning=e.uri,this._lastModifiedWarning=t.uri,this._notificationService.warn(p("diff.tooLarge","Cannot compare files because one file is too large.")));return}this._editorWorkerService.computeDiff(e.uri,t.uri,this._ignoreTrimWhitespace,this._maxComputationTime).then(n=>{i===this._diffComputationToken&&e===this._originalEditor.getModel()&&t===this._modifiedEditor.getModel()&&(this._setState(2),this._diffComputationResult=n,this._updateDecorationsRunner.schedule(),this._onDidUpdateDiff.fire())},n=>{i===this._diffComputationToken&&e===this._originalEditor.getModel()&&t===this._modifiedEditor.getModel()&&(this._setState(2),this._diffComputationResult=null,this._updateDecorationsRunner.schedule())})}_cleanViewZonesAndDecorations(){this._originalEditorState.clean(this._originalEditor),this._modifiedEditorState.clean(this._modifiedEditor)}_updateDecorations(){if(!this._originalEditor.getModel()||!this._modifiedEditor.getModel())return;let e=this._diffComputationResult?this._diffComputationResult.changes:[],t=this._originalEditorState.getForeignViewZones(this._originalEditor.getWhitespaces()),i=this._modifiedEditorState.getForeignViewZones(this._modifiedEditor.getWhitespaces()),n=this._strategy.getEditorsDiffDecorations(e,this._ignoreTrimWhitespace,this._renderIndicators,t,i);try{this._currentlyChangingViewZones=!0,this._originalEditorState.apply(this._originalEditor,this._originalOverviewRuler,n.original,!1),this._modifiedEditorState.apply(this._modifiedEditor,this._modifiedOverviewRuler,n.modified,!0)}finally{this._currentlyChangingViewZones=!1}}_adjustOptionsForSubEditor(e){let t=Object.assign({},e);return t.inDiffEditor=!0,t.automaticLayout=!1,t.scrollbar=Object.assign({},t.scrollbar||{}),t.scrollbar.vertical="visible",t.folding=!1,t.codeLens=this._diffCodeLens,t.fixedOverflowWidgets=!0,t.minimap=Object.assign({},t.minimap||{}),t.minimap.enabled=!1,t}_adjustOptionsForLeftHandSide(e){let t=this._adjustOptionsForSubEditor(e);return this._renderSideBySide?t.wordWrapOverride1=this._diffWordWrap:t.wordWrapOverride1="off",e.originalAriaLabel&&(t.ariaLabel=e.originalAriaLabel),t.readOnly=!this._originalIsEditable,t.extraEditorClassName="original-in-monaco-diff-editor",Object.assign(Object.assign({},t),{dimension:{height:0,width:0}})}_adjustOptionsForRightHandSide(e){let t=this._adjustOptionsForSubEditor(e);return e.modifiedAriaLabel&&(t.ariaLabel=e.modifiedAriaLabel),t.wordWrapOverride1=this._diffWordWrap,t.revealHorizontalRightPadding=Wn.revealHorizontalRightPadding.defaultValue+Qt.ENTIRE_DIFF_OVERVIEW_WIDTH,t.scrollbar.verticalHasArrows=!1,t.extraEditorClassName="modified-in-monaco-diff-editor",Object.assign(Object.assign({},t),{dimension:{height:0,width:0}})}doLayout(){this._elementSizeObserver.observe(),this._doLayout()}_doLayout(){let e=this._elementSizeObserver.getWidth(),t=this._elementSizeObserver.getHeight(),i=this._getReviewHeight(),n=this._strategy.layout();this._originalDomNode.style.width=n+"px",this._originalDomNode.style.left="0px",this._modifiedDomNode.style.width=e-n+"px",this._modifiedDomNode.style.left=n+"px",this._overviewDomElement.style.top="0px",this._overviewDomElement.style.height=t-i+"px",this._overviewDomElement.style.width=Qt.ENTIRE_DIFF_OVERVIEW_WIDTH+"px",this._overviewDomElement.style.left=e-Qt.ENTIRE_DIFF_OVERVIEW_WIDTH+"px",this._overviewViewportDomElement.setWidth(Qt.ENTIRE_DIFF_OVERVIEW_WIDTH),this._overviewViewportDomElement.setHeight(30),this._originalEditor.layout({width:n,height:t-i}),this._modifiedEditor.layout({width:e-n-(this._renderOverviewRuler?Qt.ENTIRE_DIFF_OVERVIEW_WIDTH:0),height:t-i}),(this._originalOverviewRuler||this._modifiedOverviewRuler)&&this._layoutOverviewRulers(),this._reviewPane.layout(t-i,e,i),this._layoutOverviewViewport()}_layoutOverviewViewport(){let e=this._computeOverviewViewport();e?(this._overviewViewportDomElement.setTop(e.top),this._overviewViewportDomElement.setHeight(e.height)):(this._overviewViewportDomElement.setTop(0),this._overviewViewportDomElement.setHeight(0))}_computeOverviewViewport(){let e=this._modifiedEditor.getLayoutInfo();if(!e)return null;let t=this._modifiedEditor.getScrollTop(),i=this._modifiedEditor.getScrollHeight(),n=Math.max(0,e.height),r=Math.max(0,n-2*0),o=i>0?r/i:0,a=Math.max(0,Math.floor(e.height*o)),l=Math.floor(t*o);return{height:a,top:l}}_createDataSource(){return{getWidth:()=>this._elementSizeObserver.getWidth(),getHeight:()=>this._elementSizeObserver.getHeight()-this._getReviewHeight(),getOptions:()=>({renderOverviewRuler:this._renderOverviewRuler}),getContainerDomNode:()=>this._containerDomElement,relayoutEditors:()=>{this._doLayout()},getOriginalEditor:()=>this._originalEditor,getModifiedEditor:()=>this._modifiedEditor}}_setStrategy(e){this._strategy&&this._strategy.dispose(),this._strategy=e,e.applyColors(this._themeService.getColorTheme()),this._diffComputationResult&&this._updateDecorations(),this._doLayout()}_getLineChangeAtOrBeforeLineNumber(e,t){let i=this._diffComputationResult?this._diffComputationResult.changes:[];if(i.length===0||e=l?n=o+1:(n=o,r=o)}return i[n]}_getEquivalentLineForOriginalLineNumber(e){let t=this._getLineChangeAtOrBeforeLineNumber(e,l=>l.originalStartLineNumber);if(!t)return e;let i=t.originalStartLineNumber+(t.originalEndLineNumber>0?-1:0),n=t.modifiedStartLineNumber+(t.modifiedEndLineNumber>0?-1:0),r=t.originalEndLineNumber>0?t.originalEndLineNumber-t.originalStartLineNumber+1:0,o=t.modifiedEndLineNumber>0?t.modifiedEndLineNumber-t.modifiedStartLineNumber+1:0,a=e-i;return a<=r?n+Math.min(a,o):n+o-r+a}_getEquivalentLineForModifiedLineNumber(e){let t=this._getLineChangeAtOrBeforeLineNumber(e,l=>l.modifiedStartLineNumber);if(!t)return e;let i=t.originalStartLineNumber+(t.originalEndLineNumber>0?-1:0),n=t.modifiedStartLineNumber+(t.modifiedEndLineNumber>0?-1:0),r=t.originalEndLineNumber>0?t.originalEndLineNumber-t.originalStartLineNumber+1:0,o=t.modifiedEndLineNumber>0?t.modifiedEndLineNumber-t.modifiedStartLineNumber+1:0,a=e-n;return a<=o?i+Math.min(a,r):i+r-o+a}getDiffLineInformationForOriginal(e){return this._diffComputationResult?{equivalentLineNumber:this._getEquivalentLineForOriginalLineNumber(e)}:null}getDiffLineInformationForModified(e){return this._diffComputationResult?{equivalentLineNumber:this._getEquivalentLineForModifiedLineNumber(e)}:null}};vr.ONE_OVERVIEW_WIDTH=15;vr.ENTIRE_DIFF_OVERVIEW_WIDTH=30;vr.UPDATE_DIFF_DECORATIONS_DELAY=200;vr=zO([wr(3,Mo),wr(4,qi),wr(5,fe),wr(6,ct),wr(7,qe),wr(8,We),wr(9,ri),wr(10,To),wr(11,Ro)],vr);var X0=class extends M{constructor(e){super();this._dataSource=e,this._insertColor=null,this._removeColor=null}applyColors(e){let t=(e.getColor(gC)||sp).transparent(2),i=(e.getColor(pC)||rp).transparent(2),n=!t.equals(this._insertColor)||!i.equals(this._removeColor);return this._insertColor=t,this._removeColor=i,n}getEditorsDiffDecorations(e,t,i,n,r){r=r.sort((c,h)=>c.afterLineNumber-h.afterLineNumber),n=n.sort((c,h)=>c.afterLineNumber-h.afterLineNumber);let o=this._getViewZones(e,n,r,i),a=this._getOriginalEditorDecorations(e,t,i),l=this._getModifiedEditorDecorations(e,t,i);return{original:{decorations:a.decorations,overviewZones:a.overviewZones,zones:o.original},modified:{decorations:l.decorations,overviewZones:l.overviewZones,zones:o.modified}}}},Q0=class{constructor(e){this._source=e,this._index=-1,this.current=null,this.advance()}advance(){this._index++,this._indexx.afterLineNumber-S.afterLineNumber,w=(x,S)=>{if(S.domNode===null&&x.length>0){let L=x[x.length-1];if(L.afterLineNumber===S.afterLineNumber&&L.domNode===null){L.heightInLines+=S.heightInLines;return}}x.push(S)},_=new Q0(this._modifiedForeignVZ),v=new Q0(this._originalForeignVZ),C=1,y=1;for(let x=0,S=this._lineChanges.length;x<=S;x++){let L=x0?-1:0),f=L.modifiedStartLineNumber+(L.modifiedEndLineNumber>0?-1:0),d=L.originalEndLineNumber>0?Ao._getViewLineCount(this._originalEditor,L.originalStartLineNumber,L.originalEndLineNumber):0,h=L.modifiedEndLineNumber>0?Ao._getViewLineCount(this._modifiedEditor,L.modifiedStartLineNumber,L.modifiedEndLineNumber):0,m=Math.max(L.originalStartLineNumber,L.originalEndLineNumber),g=Math.max(L.modifiedStartLineNumber,L.modifiedEndLineNumber)):(u+=1e7+d,f+=1e7+h,m=u,g=f);let E=[],T=[];if(r){let B;L?L.originalEndLineNumber>0?B=L.originalStartLineNumber-C:B=L.modifiedStartLineNumber-y:B=o.getLineCount()-C;for(let Q=0;Qce&&T.push({afterLineNumber:se,heightInLines:he-ce,domNode:null,marginDomNode:null})}L&&(C=(L.originalEndLineNumber>0?L.originalEndLineNumber:L.originalStartLineNumber)+1,y=(L.modifiedEndLineNumber>0?L.modifiedEndLineNumber:L.modifiedStartLineNumber)+1)}for(;_.current&&_.current.afterLineNumber<=g;){let B;_.current.afterLineNumber<=f?B=u-f+_.current.afterLineNumber:B=m;let Q=null;L&&L.modifiedStartLineNumber<=_.current.afterLineNumber&&_.current.afterLineNumber<=L.modifiedEndLineNumber&&(Q=this._createOriginalMarginDomNodeForModifiedForeignViewZoneInAddedRegion()),E.push({afterLineNumber:B,heightInLines:_.current.height/t,domNode:null,marginDomNode:Q}),_.advance()}for(;v.current&&v.current.afterLineNumber<=m;){let B;v.current.afterLineNumber<=u?B=f-u+v.current.afterLineNumber:B=g,T.push({afterLineNumber:B,heightInLines:v.current.height/e,domNode:null}),v.advance()}if(L!==null&&Zc(L)){let B=this._produceOriginalFromDiff(L,d,h);B&&E.push(B)}if(L!==null&&Xc(L)){let B=this._produceModifiedFromDiff(L,d,h);B&&T.push(B)}let I=0,P=0;for(E=E.sort(b),T=T.sort(b);I=Q.heightInLines?(B.heightInLines-=Q.heightInLines,P++):(Q.heightInLines-=B.heightInLines,I++)}for(;I(t.domNode||(t.domNode=KN()),t))}};function Cr(s,e,t,i,n){return{range:new D(s,e,t,i),options:n}}var Ei={charDelete:wt.register({description:"diff-editor-char-delete",className:"char-delete"}),charDeleteWholeLine:wt.register({description:"diff-editor-char-delete-whole-line",className:"char-delete",isWholeLine:!0}),charInsert:wt.register({description:"diff-editor-char-insert",className:"char-insert"}),charInsertWholeLine:wt.register({description:"diff-editor-char-insert-whole-line",className:"char-insert",isWholeLine:!0}),lineInsert:wt.register({description:"diff-editor-line-insert",className:"line-insert",marginClassName:"line-insert",isWholeLine:!0}),lineInsertWithSign:wt.register({description:"diff-editor-line-insert-with-sign",className:"line-insert",linesDecorationsClassName:"insert-sign "+ui.asClassName(UO),marginClassName:"line-insert",isWholeLine:!0}),lineDelete:wt.register({description:"diff-editor-line-delete",className:"line-delete",marginClassName:"line-delete",isWholeLine:!0}),lineDeleteWithSign:wt.register({description:"diff-editor-line-delete-with-sign",className:"line-delete",linesDecorationsClassName:"delete-sign "+ui.asClassName(jN),marginClassName:"line-delete",isWholeLine:!0}),lineDeleteMargin:wt.register({description:"diff-editor-line-delete-margin",marginClassName:"line-delete"})},ks=class extends X0{constructor(e,t){super(e);this._disableSash=t===!1,this._sashRatio=null,this._sashPosition=null,this._startSashPosition=null,this._sash=this._register(new Di(this._dataSource.getContainerDomNode(),this,{orientation:0})),this._disableSash&&(this._sash.state=0),this._sash.onDidStart(()=>this._onSashDragStart()),this._sash.onDidChange(i=>this._onSashDrag(i)),this._sash.onDidEnd(()=>this._onSashDragEnd()),this._sash.onDidReset(()=>this._onSashReset())}setEnableSplitViewResizing(e){let t=e===!1;this._disableSash!==t&&(this._disableSash=t,this._sash.state=this._disableSash?0:3)}layout(e=this._sashRatio){let i=this._dataSource.getWidth()-(this._dataSource.getOptions().renderOverviewRuler?vr.ENTIRE_DIFF_OVERVIEW_WIDTH:0),n=Math.floor((e||.5)*i),r=Math.floor(.5*i);return n=this._disableSash?r:n||r,i>ks.MINIMUM_EDITOR_WIDTH*2?(ni-ks.MINIMUM_EDITOR_WIDTH&&(n=i-ks.MINIMUM_EDITOR_WIDTH)):n=r,this._sashPosition!==n&&(this._sashPosition=n,this._sash.layout()),this._sashPosition}_onSashDragStart(){this._startSashPosition=this._sashPosition}_onSashDrag(e){let i=this._dataSource.getWidth()-(this._dataSource.getOptions().renderOverviewRuler?vr.ENTIRE_DIFF_OVERVIEW_WIDTH:0),n=this.layout((this._startSashPosition+(e.currentX-e.startX))/i);this._sashRatio=n/i,this._dataSource.relayoutEditors()}_onSashDragEnd(){this._sash.layout()}_onSashReset(){this._sashRatio=.5,this._dataSource.relayoutEditors(),this._sash.layout()}getVerticalSashTop(e){return 0}getVerticalSashLeft(e){return this._sashPosition}getVerticalSashHeight(e){return this._dataSource.getHeight()}_getViewZones(e,t,i){let n=this._dataSource.getOriginalEditor(),r=this._dataSource.getModifiedEditor();return new HN(e,t,i,n,r).getViewZones()}_getOriginalEditorDecorations(e,t,i){let n=this._dataSource.getOriginalEditor(),r=String(this._removeColor),o={decorations:[],overviewZones:[]},a=n.getModel(),l=n._getViewModel();for(let c of e)if(Xc(c)){o.decorations.push({range:new D(c.originalStartLineNumber,1,c.originalEndLineNumber,1073741824),options:i?Ei.lineDeleteWithSign:Ei.lineDelete}),(!Zc(c)||!c.charChanges)&&o.decorations.push(Cr(c.originalStartLineNumber,1,c.originalEndLineNumber,1073741824,Ei.charDeleteWholeLine));let h=Ou(a,l,c.originalStartLineNumber,c.originalEndLineNumber);if(o.overviewZones.push(new il(h.startLineNumber,h.endLineNumber,r)),c.charChanges){for(let d of c.charChanges)if(Xc(d))if(t)for(let u=d.originalStartLineNumber;u<=d.originalEndLineNumber;u++){let f,m;u===d.originalStartLineNumber?f=d.originalStartColumn:f=a.getLineFirstNonWhitespaceColumn(u),u===d.originalEndLineNumber?m=d.originalEndColumn:m=a.getLineLastNonWhitespaceColumn(u),o.decorations.push(Cr(u,f,u,m,Ei.charDelete))}else o.decorations.push(Cr(d.originalStartLineNumber,d.originalStartColumn,d.originalEndLineNumber,d.originalEndColumn,Ei.charDelete))}}return o}_getModifiedEditorDecorations(e,t,i){let n=this._dataSource.getModifiedEditor(),r=String(this._insertColor),o={decorations:[],overviewZones:[]},a=n.getModel(),l=n._getViewModel();for(let c of e)if(Zc(c)){o.decorations.push({range:new D(c.modifiedStartLineNumber,1,c.modifiedEndLineNumber,1073741824),options:i?Ei.lineInsertWithSign:Ei.lineInsert}),(!Xc(c)||!c.charChanges)&&o.decorations.push(Cr(c.modifiedStartLineNumber,1,c.modifiedEndLineNumber,1073741824,Ei.charInsertWholeLine));let h=Ou(a,l,c.modifiedStartLineNumber,c.modifiedEndLineNumber);if(o.overviewZones.push(new il(h.startLineNumber,h.endLineNumber,r)),c.charChanges){for(let d of c.charChanges)if(Zc(d))if(t)for(let u=d.modifiedStartLineNumber;u<=d.modifiedEndLineNumber;u++){let f,m;u===d.modifiedStartLineNumber?f=d.modifiedStartColumn:f=a.getLineFirstNonWhitespaceColumn(u),u===d.modifiedEndLineNumber?m=d.modifiedEndColumn:m=a.getLineLastNonWhitespaceColumn(u),o.decorations.push(Cr(u,f,u,m,Ei.charInsert))}else o.decorations.push(Cr(d.modifiedStartLineNumber,d.modifiedStartColumn,d.modifiedEndLineNumber,d.modifiedEndColumn,Ei.charInsert))}}return o}};ks.MINIMUM_EDITOR_WIDTH=100;var HN=class extends Ao{constructor(e,t,i,n,r){super(e,t,i,n,r)}_createOriginalMarginDomNodeForModifiedForeignViewZoneInAddedRegion(){return null}_produceOriginalFromDiff(e,t,i){return i>t?{afterLineNumber:Math.max(e.originalStartLineNumber,e.originalEndLineNumber),heightInLines:i-t,domNode:null}:null}_produceModifiedFromDiff(e,t,i){return t>i?{afterLineNumber:Math.max(e.modifiedStartLineNumber,e.modifiedEndLineNumber),heightInLines:t-i,domNode:null}:null}},J0=class extends X0{constructor(e,t){super(e);this._decorationsLeft=e.getOriginalEditor().getLayoutInfo().decorationsLeft,this._register(e.getOriginalEditor().onDidLayoutChange(i=>{this._decorationsLeft!==i.decorationsLeft&&(this._decorationsLeft=i.decorationsLeft,e.relayoutEditors())}))}setEnableSplitViewResizing(e){}_getViewZones(e,t,i,n){let r=this._dataSource.getOriginalEditor(),o=this._dataSource.getModifiedEditor();return new UN(e,t,i,r,o,n).getViewZones()}_getOriginalEditorDecorations(e,t,i){let n=String(this._removeColor),r={decorations:[],overviewZones:[]},o=this._dataSource.getOriginalEditor(),a=o.getModel(),l=o._getViewModel();for(let c of e)if(Xc(c)){r.decorations.push({range:new D(c.originalStartLineNumber,1,c.originalEndLineNumber,1073741824),options:Ei.lineDeleteMargin});let h=Ou(a,l,c.originalStartLineNumber,c.originalEndLineNumber);r.overviewZones.push(new il(h.startLineNumber,h.endLineNumber,n))}return r}_getModifiedEditorDecorations(e,t,i){let n=this._dataSource.getModifiedEditor(),r=String(this._insertColor),o={decorations:[],overviewZones:[]},a=n.getModel(),l=n._getViewModel();for(let c of e)if(Zc(c)){o.decorations.push({range:new D(c.modifiedStartLineNumber,1,c.modifiedEndLineNumber,1073741824),options:i?Ei.lineInsertWithSign:Ei.lineInsert});let h=Ou(a,l,c.modifiedStartLineNumber,c.modifiedEndLineNumber);if(o.overviewZones.push(new il(h.startLineNumber,h.endLineNumber,r)),c.charChanges){for(let d of c.charChanges)if(Zc(d))if(t)for(let u=d.modifiedStartLineNumber;u<=d.modifiedEndLineNumber;u++){let f,m;u===d.modifiedStartLineNumber?f=d.modifiedStartColumn:f=a.getLineFirstNonWhitespaceColumn(u),u===d.modifiedEndLineNumber?m=d.modifiedEndColumn:m=a.getLineLastNonWhitespaceColumn(u),o.decorations.push(Cr(u,f,u,m,Ei.charInsert))}else o.decorations.push(Cr(d.modifiedStartLineNumber,d.modifiedStartColumn,d.modifiedEndLineNumber,d.modifiedEndColumn,Ei.charInsert))}else o.decorations.push(Cr(c.modifiedStartLineNumber,1,c.modifiedEndLineNumber,1073741824,Ei.charInsertWholeLine))}return o}layout(){return Math.max(5,this._decorationsLeft)}},UN=class extends Ao{constructor(e,t,i,n,r,o){super(e,t,i,n,r);this._originalModel=n.getModel(),this._renderIndicators=o,this._pendingLineChange=[],this._pendingViewZones=[],this._lineBreaksComputer=this._modifiedEditor._getViewModel().createLineBreaksComputer()}getViewZones(){let e=super.getViewZones();return this._finalize(e),e}_createOriginalMarginDomNodeForModifiedForeignViewZoneInAddedRegion(){let e=document.createElement("div");return e.className="inline-added-margin-view-zone",e}_produceOriginalFromDiff(e,t,i){let n=document.createElement("div");return n.className="inline-added-margin-view-zone",{afterLineNumber:Math.max(e.originalStartLineNumber,e.originalEndLineNumber),heightInLines:i,domNode:document.createElement("div"),marginDomNode:n}}_produceModifiedFromDiff(e,t,i){let n=document.createElement("div");n.className=`view-lines line-delete ${qn}`;let r=document.createElement("div");r.className="inline-deleted-margin-view-zone";let o={shouldNotShrink:!0,afterLineNumber:e.modifiedEndLineNumber===0?e.modifiedStartLineNumber:e.modifiedStartLineNumber-1,heightInLines:t,minWidthInPx:0,domNode:n,marginDomNode:r,diff:{originalStartLineNumber:e.originalStartLineNumber,originalEndLineNumber:e.originalEndLineNumber,modifiedStartLineNumber:e.modifiedStartLineNumber,modifiedEndLineNumber:e.modifiedEndLineNumber,originalModel:this._originalModel,viewLineCounts:null}};for(let a=e.originalStartLineNumber;a<=e.originalEndLineNumber;a++)this._lineBreaksComputer.addRequest(this._originalModel.getLineContent(a),null,null);return this._pendingLineChange.push(e),this._pendingViewZones.push(o),o}_finalize(e){let t=this._modifiedEditor.getOptions(),i=this._modifiedEditor.getModel().getOptions().tabSize,n=t.get(41),r=t.get(27),o=n.typicalHalfwidthCharacterWidth,a=t.get(92),l=this._originalModel.mightContainNonBasicASCII(),c=this._originalModel.mightContainRTL(),h=t.get(57),u=t.get(129).decorationsWidth,f=t.get(104),m=t.get(87),g=t.get(81),b=t.get(42),w=this._lineBreaksComputer.finalize(),_=0;for(let v=0;v0,T=as(1e4),I=0,P=0,B=null;for(let se=C.originalStartLineNumber;se<=C.originalEndLineNumber;se++){let he=se-C.originalStartLineNumber,ce=this._originalModel.getLineTokens(se),ye=ce.getLineContent(),Ve=w[_++],Ji=yi.filter(L,se,1,ye.length+1);if(Ve){let In=0;for(let ai of Ve.breakOffsets){let Bs=ce.sliceAndInflate(In,ai,0),_f=ye.substring(In,ai);I=Math.max(I,this._renderOriginalLine(P++,_f,Bs,yi.extractWrapped(Ji,In,ai),E,l,c,n,r,h,u,f,m,g,b,i,T,S)),In=ai}for(B||(B=[]);B.lengthv.afterLineNumber-C.afterLineNumber)}_renderOriginalLine(e,t,i,n,r,o,a,l,c,h,d,u,f,m,g,b,w,_){w.appendASCIIString('
');let v=Zt.isBasicASCII(t,o),C=Zt.containsRTL(t,v,a),y=Vd(new Hn(l.isMonospace&&!c,l.canUseHalfwidthRightwardsArrow,t,!1,v,C,0,i,n,b,0,l.spaceWidth,l.middotWidth,l.wsmiddotWidth,u,f,m,g!==ii.OFF,null),w);if(w.appendASCIIString("
"),this._renderIndicators){let x=document.createElement("div");x.className=`delete-sign ${ui.asClassName(jN)}`,x.setAttribute("style",`position:absolute;top:${e*h}px;width:${d}px;height:${h}px;right:0;`),_.appendChild(x)}return y.characterMapping.getAbsoluteOffset(y.characterMapping.length)}};function $N(s,e){return fi(s,e,["off","on","inherit"])}function Zc(s){return s.modifiedEndLineNumber>0}function Xc(s){return s.originalEndLineNumber>0}function KN(){let s=document.createElement("div");return s.className="diagonal-fill",s}function Ou(s,e,t,i){let n=s.getLineCount();return t=Math.min(n,Math.max(1,t)),i=Math.min(n,Math.max(1,i)),e.coordinatesConverter.convertModelRangeToViewRange(new D(t,s.getLineMinColumn(t),i,s.getLineMaxColumn(i)))}bt((s,e)=>{let t=s.getColor(gC);t&&(e.addRule(`.monaco-editor .line-insert, .monaco-editor .char-insert { background-color: ${t}; }`),e.addRule(`.monaco-diff-editor .line-insert, .monaco-diff-editor .char-insert { background-color: ${t}; }`),e.addRule(`.monaco-editor .inline-added-margin-view-zone { background-color: ${t}; }`));let i=s.getColor(pC);i&&(e.addRule(`.monaco-editor .line-delete, .monaco-editor .char-delete { background-color: ${i}; }`),e.addRule(`.monaco-diff-editor .line-delete, .monaco-diff-editor .char-delete { background-color: ${i}; }`),e.addRule(`.monaco-editor .inline-deleted-margin-view-zone { background-color: ${i}; }`));let n=s.getColor($k);n&&e.addRule(`.monaco-editor .line-insert, .monaco-editor .char-insert { border: 1px ${s.type==="hc"?"dashed":"solid"} ${n}; }`);let r=s.getColor(Kk);r&&e.addRule(`.monaco-editor .line-delete, .monaco-editor .char-delete { border: 1px ${s.type==="hc"?"dashed":"solid"} ${r}; }`);let o=s.getColor(So);o&&e.addRule(`.monaco-diff-editor.side-by-side .editor.modified { box-shadow: -6px 0 5px -5px ${o}; }`);let a=s.getColor(qk);a&&e.addRule(`.monaco-diff-editor.side-by-side .editor.modified { border-left: 1px solid ${a}; }`);let l=s.getColor(ou);l&&e.addRule(` + .monaco-diff-editor .diffViewport { + background: ${l}; + } + `);let c=s.getColor(au);c&&e.addRule(` + .monaco-diff-editor .diffViewport:hover { + background: ${c}; + } + `);let h=s.getColor(lu);h&&e.addRule(` + .monaco-diff-editor .diffViewport:active { + background: ${h}; + } + `);let d=s.getColor(Gk);e.addRule(` + .monaco-editor .diagonal-fill { + background-image: linear-gradient( + -45deg, + ${d} 12.5%, + #0000 12.5%, #0000 50%, + ${d} 50%, ${d} 62.5%, + #0000 62.5%, #0000 100% + ); + background-size: 8px 8px; + } + `)});var Oo=$("themeService");var zt=$("keybindingService");var eS=class extends M{constructor(){super();this._onCodeEditorAdd=this._register(new k),this.onCodeEditorAdd=this._onCodeEditorAdd.event,this._onCodeEditorRemove=this._register(new k),this.onCodeEditorRemove=this._onCodeEditorRemove.event,this._onDiffEditorAdd=this._register(new k),this._onDiffEditorRemove=this._register(new k),this._onDecorationTypeRegistered=this._register(new k),this._modelProperties=new Map,this._codeEditors=Object.create(null),this._diffEditors=Object.create(null)}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])}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,t=this.listCodeEditors();for(let i of t){if(i.hasTextFocus())return i;i.hasWidgetFocus()&&(e=i)}return e}setModelProperty(e,t,i){let n=e.toString(),r;this._modelProperties.has(n)?r=this._modelProperties.get(n):(r=new Map,this._modelProperties.set(n,r)),r.set(t,i)}getModelProperty(e,t){let i=e.toString();if(this._modelProperties.has(i))return this._modelProperties.get(i).get(t)}};var $O=function(s,e,t,i){var n=arguments.length,r=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(s,e,t,i);else for(var a=s.length-1;a>=0;a--)(o=s[a])&&(r=(n<3?o(r):n>3?o(e,t,r):o(e,t))||r);return n>3&&r&&Object.defineProperty(e,t,r),r},KO=function(s,e){return function(t,i){e(t,i,s)}},qN=class{constructor(e,t,i){this._parent=e,this._editorId=t,this._styleSheet=i,this._refCount=0}ref(){this._refCount++}unref(){var e;this._refCount--,this._refCount===0&&((e=this._styleSheet.parentNode)===null||e===void 0||e.removeChild(this._styleSheet),this._parent._removeEditorStyleSheets(this._editorId))}insertRule(e,t){this._styleSheet.sheet.insertRule(e,t)}removeRulesContainingSelector(e){Lb(e,this._styleSheet)}},GN=class{constructor(e){this._styleSheet=e}ref(){}unref(){}insertRule(e,t){this._styleSheet.sheet.insertRule(e,t)}removeRulesContainingSelector(e){Lb(e,this._styleSheet)}},kp=class extends eS{constructor(e,t){super();this._decorationOptionProviders=new Map,this._editorStyleSheets=new Map,this._globalStyleSheet=e||null,this._themeService=t}_getOrCreateGlobalStyleSheet(){return this._globalStyleSheet||(this._globalStyleSheet=new GN(kt())),this._globalStyleSheet}_getOrCreateStyleSheet(e){if(!e)return this._getOrCreateGlobalStyleSheet();let t=e.getContainerDomNode();if(!Al(t))return this._getOrCreateGlobalStyleSheet();let i=e.getId();if(!this._editorStyleSheets.has(i)){let n=new qN(this,i,kt(t));this._editorStyleSheets.set(i,n)}return this._editorStyleSheets.get(i)}_removeEditorStyleSheets(e){this._editorStyleSheets.delete(e)}registerDecorationType(e,t,i,n,r){let o=this._decorationOptionProviders.get(t);if(!o){let a=this._getOrCreateStyleSheet(r),l={styleSheet:a,key:t,parentTypeKey:n,options:i||Object.create(null)};n?o=new YN(this._themeService,a,l):o=new ZN(e,this._themeService,a,l),this._decorationOptionProviders.set(t,o),this._onDecorationTypeRegistered.fire(t)}o.refCount++}removeDecorationType(e){let t=this._decorationOptionProviders.get(e);t&&(t.refCount--,t.refCount<=0&&(this._decorationOptionProviders.delete(e),t.dispose(),this.listCodeEditors().forEach(i=>i.removeDecorations(e))))}resolveDecorationOptions(e,t){let i=this._decorationOptionProviders.get(e);if(!i)throw new Error("Unknown decoration type key: "+e);return i.getOptions(this,t)}};kp=$O([KO(1,We)],kp);var YN=class{constructor(e,t,i){this._styleSheet=t,this._styleSheet.ref(),this._parentTypeKey=i.parentTypeKey,this.refCount=0,this._beforeContentRules=new Fu(3,i,e),this._afterContentRules=new Fu(4,i,e)}getOptions(e,t){let i=e.resolveDecorationOptions(this._parentTypeKey,!0);return this._beforeContentRules&&(i.beforeContentClassName=this._beforeContentRules.className),this._afterContentRules&&(i.afterContentClassName=this._afterContentRules.className),i}dispose(){this._beforeContentRules&&(this._beforeContentRules.dispose(),this._beforeContentRules=null),this._afterContentRules&&(this._afterContentRules.dispose(),this._afterContentRules=null),this._styleSheet.unref()}},ZN=class{constructor(e,t,i,n){this._disposables=new U,this.description=e,this._styleSheet=i,this._styleSheet.ref(),this.refCount=0;let r=d=>{let u=new Fu(d,n,t);if(this._disposables.add(u),u.hasContent)return u.className},o=d=>{let u=new Fu(d,n,t);return this._disposables.add(u),u.hasContent?{className:u.className,hasLetterSpacing:u.hasLetterSpacing}:null};this.className=r(0);let a=o(1);if(a&&(this.inlineClassName=a.className,this.inlineClassNameAffectsLetterSpacing=a.hasLetterSpacing),this.beforeContentClassName=r(3),this.afterContentClassName=r(4),n.options.beforeInjectedText&&n.options.beforeInjectedText.contentText){let d=o(5);this.beforeInjectedText={content:n.options.beforeInjectedText.contentText,inlineClassName:d==null?void 0:d.className,inlineClassNameAffectsLetterSpacing:(d==null?void 0:d.hasLetterSpacing)||n.options.beforeInjectedText.affectsLetterSpacing}}if(n.options.afterInjectedText&&n.options.afterInjectedText.contentText){let d=o(6);this.afterInjectedText={content:n.options.afterInjectedText.contentText,inlineClassName:d==null?void 0:d.className,inlineClassNameAffectsLetterSpacing:(d==null?void 0:d.hasLetterSpacing)||n.options.afterInjectedText.affectsLetterSpacing}}this.glyphMarginClassName=r(2);let l=n.options;this.isWholeLine=Boolean(l.isWholeLine),this.stickiness=l.rangeBehavior;let c=l.light&&l.light.overviewRulerColor||l.overviewRulerColor,h=l.dark&&l.dark.overviewRulerColor||l.overviewRulerColor;(typeof c!="undefined"||typeof h!="undefined")&&(this.overviewRuler={color:c||h,darkColor:h||c,position:l.overviewRulerLane||Qr.Center})}getOptions(e,t){return t?{description:this.description,inlineClassName:this.inlineClassName,beforeContentClassName:this.beforeContentClassName,afterContentClassName:this.afterContentClassName,className:this.className,glyphMarginClassName:this.glyphMarginClassName,isWholeLine:this.isWholeLine,overviewRuler:this.overviewRuler,stickiness:this.stickiness,before:this.beforeInjectedText}:this}dispose(){this._disposables.dispose(),this._styleSheet.unref()}},Pu={color:"color:{0} !important;",opacity:"opacity:{0};",backgroundColor:"background-color:{0};",outline:"outline:{0};",outlineColor:"outline-color:{0};",outlineStyle:"outline-style:{0};",outlineWidth:"outline-width:{0};",border:"border:{0};",borderColor:"border-color:{0};",borderRadius:"border-radius:{0};",borderSpacing:"border-spacing:{0};",borderStyle:"border-style:{0};",borderWidth:"border-width:{0};",fontStyle:"font-style:{0};",fontWeight:"font-weight:{0};",fontSize:"font-size:{0};",fontFamily:"font-family:{0};",textDecoration:"text-decoration:{0};",cursor:"cursor:{0};",letterSpacing:"letter-spacing:{0};",gutterIconPath:"background:{0} center center no-repeat;",gutterIconSize:"background-size:{0};",contentText:"content:'{0}';",contentIconPath:"content:{0};",margin:"margin:{0};",padding:"padding:{0};",width:"width:{0};",height:"height:{0};"},Fu=class{constructor(e,t,i){this._theme=i.getColorTheme(),this._ruleType=e,this._providerArgs=t,this._usesThemeColors=!1,this._hasContent=!1,this._hasLetterSpacing=!1;let n=Ip.getClassName(this._providerArgs.key,e);this._providerArgs.parentTypeKey&&(n=n+" "+Ip.getClassName(this._providerArgs.parentTypeKey,e)),this._className=n,this._unThemedSelector=Ip.getSelector(this._providerArgs.key,this._providerArgs.parentTypeKey,e),this._buildCSS(),this._usesThemeColors?this._themeListener=i.onDidColorThemeChange(r=>{this._theme=i.getColorTheme(),this._removeCSS(),this._buildCSS()}):this._themeListener=null}dispose(){this._hasContent&&(this._removeCSS(),this._hasContent=!1),this._themeListener&&(this._themeListener.dispose(),this._themeListener=null)}get hasContent(){return this._hasContent}get hasLetterSpacing(){return this._hasLetterSpacing}get className(){return this._className}_buildCSS(){let e=this._providerArgs.options,t,i,n;switch(this._ruleType){case 0:t=this.getCSSTextForModelDecorationClassName(e),i=this.getCSSTextForModelDecorationClassName(e.light),n=this.getCSSTextForModelDecorationClassName(e.dark);break;case 1:t=this.getCSSTextForModelDecorationInlineClassName(e),i=this.getCSSTextForModelDecorationInlineClassName(e.light),n=this.getCSSTextForModelDecorationInlineClassName(e.dark);break;case 2:t=this.getCSSTextForModelDecorationGlyphMarginClassName(e),i=this.getCSSTextForModelDecorationGlyphMarginClassName(e.light),n=this.getCSSTextForModelDecorationGlyphMarginClassName(e.dark);break;case 3:t=this.getCSSTextForModelDecorationContentClassName(e.before),i=this.getCSSTextForModelDecorationContentClassName(e.light&&e.light.before),n=this.getCSSTextForModelDecorationContentClassName(e.dark&&e.dark.before);break;case 4:t=this.getCSSTextForModelDecorationContentClassName(e.after),i=this.getCSSTextForModelDecorationContentClassName(e.light&&e.light.after),n=this.getCSSTextForModelDecorationContentClassName(e.dark&&e.dark.after);break;case 5:t=this.getCSSTextForModelDecorationContentClassName(e.beforeInjectedText),i=this.getCSSTextForModelDecorationContentClassName(e.light&&e.light.beforeInjectedText),n=this.getCSSTextForModelDecorationContentClassName(e.dark&&e.dark.beforeInjectedText);break;case 6:t=this.getCSSTextForModelDecorationContentClassName(e.afterInjectedText),i=this.getCSSTextForModelDecorationContentClassName(e.light&&e.light.afterInjectedText),n=this.getCSSTextForModelDecorationContentClassName(e.dark&&e.dark.afterInjectedText);break;default:throw new Error("Unknown rule type: "+this._ruleType)}let r=this._providerArgs.styleSheet,o=!1;t.length>0&&(r.insertRule(`${this._unThemedSelector} {${t}}`,0),o=!0),i.length>0&&(r.insertRule(`.vs${this._unThemedSelector} {${i}}`,0),o=!0),n.length>0&&(r.insertRule(`.vs-dark${this._unThemedSelector}, .hc-black${this._unThemedSelector} {${n}}`,0),o=!0),this._hasContent=o}_removeCSS(){this._providerArgs.styleSheet.removeRulesContainingSelector(this._unThemedSelector)}getCSSTextForModelDecorationClassName(e){if(!e)return"";let t=[];return this.collectCSSText(e,["backgroundColor"],t),this.collectCSSText(e,["outline","outlineColor","outlineStyle","outlineWidth"],t),this.collectBorderSettingsCSSText(e,t),t.join("")}getCSSTextForModelDecorationInlineClassName(e){if(!e)return"";let t=[];return this.collectCSSText(e,["fontStyle","fontWeight","textDecoration","cursor","color","opacity","letterSpacing"],t),e.letterSpacing&&(this._hasLetterSpacing=!0),t.join("")}getCSSTextForModelDecorationContentClassName(e){if(!e)return"";let t=[];if(typeof e!="undefined"){if(this.collectBorderSettingsCSSText(e,t),typeof e.contentIconPath!="undefined"&&t.push(ji(Pu.contentIconPath,Hr(K.revive(e.contentIconPath)))),typeof e.contentText=="string"){let n=e.contentText.match(/^.*$/m)[0].replace(/['\\]/g,"\\$&");t.push(ji(Pu.contentText,n))}this.collectCSSText(e,["fontStyle","fontWeight","fontSize","fontFamily","textDecoration","color","opacity","backgroundColor","margin","padding"],t),this.collectCSSText(e,["width","height"],t)&&t.push("display:inline-block;")}return t.join("")}getCSSTextForModelDecorationGlyphMarginClassName(e){if(!e)return"";let t=[];return typeof e.gutterIconPath!="undefined"&&(t.push(ji(Pu.gutterIconPath,Hr(K.revive(e.gutterIconPath)))),typeof e.gutterIconSize!="undefined"&&t.push(ji(Pu.gutterIconSize,e.gutterIconSize))),t.join("")}collectBorderSettingsCSSText(e,t){return this.collectCSSText(e,["border","borderColor","borderRadius","borderSpacing","borderStyle","borderWidth"],t)?(t.push(ji("box-sizing: border-box;")),!0):!1}collectCSSText(e,t,i){let n=i.length;for(let r of t){let o=this.resolveValue(e[r]);typeof o=="string"&&i.push(ji(Pu[r],o))}return i.length!==n}resolveValue(e){if(ID(e)){this._usesThemeColors=!0;let t=this._theme.getColor(e.id);return t?t.toString():"transparent"}return e}},Ip=class{static getClassName(e,t){return"ced-"+e+"-"+t}static getSelector(e,t,i){let n=".monaco-editor ."+this.getClassName(e,i);return t&&(n=n+"."+this.getClassName(t,i)),i===3?n+="::before":i===4&&(n+="::after"),n}};var qO=function(s,e,t,i){var n=arguments.length,r=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(s,e,t,i);else for(var a=s.length-1;a>=0;a--)(o=s[a])&&(r=(n<3?o(r):n>3?o(e,t,r):o(e,t))||r);return n>3&&r&&Object.defineProperty(e,t,r),r},XN=function(s,e){return function(t,i){e(t,i,s)}},Qc=class extends kp{constructor(e,t,i){super(e,i);this.onCodeEditorAdd(()=>this._checkContextKey()),this.onCodeEditorRemove(()=>this._checkContextKey()),this._editorIsOpen=t.createKey("editorIsOpen",!1),this._activeCodeEditor=null}_checkContextKey(){let e=!1;for(let t of this.listCodeEditors())if(!t.isSimpleWidget){e=!0;break}this._editorIsOpen.set(e)}setActiveCodeEditor(e){this._activeCodeEditor=e}getActiveCodeEditor(){return this._activeCodeEditor}openCodeEditor(e,t,i){return t?Promise.resolve(this.doOpenEditor(t,e)):Promise.resolve(null)}doOpenEditor(e,t){if(!this.findModel(e,t.resource)){if(t.resource){let r=t.resource.scheme;if(r===Ce.http||r===Ce.https)return zf(t.resource.toString()),e}return null}let 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{let r={lineNumber:n.startLineNumber,column:n.startColumn};e.setPosition(r),e.revealPositionInCenter(r,1)}return e}findModel(e,t){let i=e.getModel();return i&&i.uri.toString()!==t.toString()?null:i}};Qc=qO([XN(1,fe),XN(2,We)],Qc);var tS=function(s,e,t,i){var n=arguments.length,r=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(s,e,t,i);else for(var a=s.length-1;a>=0;a--)(o=s[a])&&(r=(n<3?o(r):n>3?o(e,t,r):o(e,t))||r);return n>3&&r&&Object.defineProperty(e,t,r),r},Fe=function(s,e){return function(t,i){e(t,i,s)}},GO=0,QN=!1;function YO(){QN||(QN=!0,zy(document.body))}var Np=class extends qc{constructor(e,t,i,n,r,o,a,l,c,h){let d=Object.assign({},t);d.ariaLabel=d.ariaLabel||qd.editorViewAccessibleLabel,d.ariaLabel=d.ariaLabel+";"+qd.accessibilityHelpMessage;super(e,d,{},i,n,r,o,l,c,h);a instanceof Gd?this._standaloneKeybindingService=a:this._standaloneKeybindingService=null,YO()}addCommand(e,t,i){if(!this._standaloneKeybindingService)return console.warn("Cannot add command because the editor is configured with an unrecognized KeybindingService"),null;let n="DYNAMIC_"+ ++GO,r=dt.deserialize(i);return this._standaloneKeybindingService.addDynamicKeybinding(n,e,t,r),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"),M.None;let t=e.id,i=e.label,n=dt.and(dt.equals("editorId",this.getId()),dt.deserialize(e.precondition)),r=e.keybindings,o=dt.and(n,dt.deserialize(e.keybindingContext)),a=e.contextMenuGroupId||null,l=e.contextMenuOrder||0,c=(f,...m)=>Promise.resolve(e.run(this,...m)),h=new U,d=this.getId()+":"+t;if(h.add(Qe.registerCommand(d,c)),a){let f={command:{id:d,title:i},when:n,group:a,order:l};h.add(Gr.appendMenuItem(Ie.EditorContext,f))}if(Array.isArray(r))for(let f of r)h.add(this._standaloneKeybindingService.addDynamicKeybinding(d,f,c,o));let u=new Du(d,i,i,n,c,this._contextKeyService);return this._actions[t]=u,h.add(oe(()=>{delete this._actions[t]})),h}_triggerCommand(e,t){if(this._codeEditorService instanceof Qc)try{this._codeEditorService.setActiveCodeEditor(this),super._triggerCommand(e,t)}finally{this._codeEditorService.setActiveCodeEditor(null)}else super._triggerCommand(e,t)}};Np=tS([Fe(2,ct),Fe(3,qe),Fe(4,It),Fe(5,fe),Fe(6,zt),Fe(7,We),Fe(8,ri),Fe(9,jt)],Np);var Tp=class extends Np{constructor(e,t,i,n,r,o,a,l,c,h,d,u,f,m,g){let b=Object.assign({},t);Yd(u,b,!1);let w=h.registerEditorContainer(e);typeof b.theme=="string"&&h.setTheme(b.theme),typeof b.autoDetectHighContrast!="undefined"&&h.setAutoDetectHighContrast(Boolean(b.autoDetectHighContrast));let _=b.model;delete b.model;super(e,b,n,r,o,a,l,h,d,f);this._contextViewService=c,this._configurationService=u,this._standaloneThemeService=h,this._register(i),this._register(w);let v;if(typeof _=="undefined"?(v=iS(m,g,b.value||"",b.language||Li.text,void 0),this._ownsModel=!0):(v=_,this._ownsModel=!1),this._attachModel(v),v){let C={oldModelUrl:null,newModelUrl:v.uri};this._onDidChangeModel.fire(C)}}dispose(){super.dispose()}updateOptions(e){Yd(this._configurationService,e,!1),typeof e.theme=="string"&&this._standaloneThemeService.setTheme(e.theme),typeof e.autoDetectHighContrast!="undefined"&&this._standaloneThemeService.setAutoDetectHighContrast(Boolean(e.autoDetectHighContrast)),super.updateOptions(e)}_attachModel(e){super._attachModel(e),this._modelData&&this._contextViewService.setContainer(this._modelData.view.domNode.domNode)}_postDetachModelCleanup(e){super._postDetachModelCleanup(e),e&&this._ownsModel&&(e.dispose(),this._ownsModel=!1)}};Tp=tS([Fe(3,ct),Fe(4,qe),Fe(5,It),Fe(6,fe),Fe(7,zt),Fe(8,Es),Fe(9,Oo),Fe(10,ri),Fe(11,nt),Fe(12,jt),Fe(13,ht),Fe(14,dc)],Tp);var Mp=class extends vr{constructor(e,t,i,n,r,o,a,l,c,h,d,u,f,m,g){let b=Object.assign({},t);Yd(u,b,!0);let w=h.registerEditorContainer(e);typeof b.theme=="string"&&h.setTheme(b.theme),typeof b.autoDetectHighContrast!="undefined"&&h.setAutoDetectHighContrast(Boolean(b.autoDetectHighContrast));super(e,b,{},g,l,r,n,c,h,d,f,m);this._contextViewService=a,this._configurationService=u,this._standaloneThemeService=h,this._register(i),this._register(w),this._contextViewService.setContainer(this._containerDomElement)}dispose(){super.dispose()}updateOptions(e){Yd(this._configurationService,e,!0),typeof e.theme=="string"&&this._standaloneThemeService.setTheme(e.theme),typeof e.autoDetectHighContrast!="undefined"&&this._standaloneThemeService.setAutoDetectHighContrast(Boolean(e.autoDetectHighContrast)),super.updateOptions(e)}_createInnerEditor(e,t,i){return e.createInstance(Np,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)}};Mp=tS([Fe(3,ct),Fe(4,fe),Fe(5,zt),Fe(6,Es),Fe(7,qi),Fe(8,qe),Fe(9,Oo),Fe(10,ri),Fe(11,nt),Fe(12,To),Fe(13,Ro),Fe(14,Mo)],Mp);function iS(s,e,t,i,n){if(t=t||"",!i){let r=t.indexOf(` +`),o=t;return r!==-1&&(o=t.substring(0,r)),JN(s,t,e.createByFilepathOrFirstLine(n||null,o),n)}return JN(s,t,e.create(i),n)}function JN(s,e,t,i){return s.createModel(e,t,i)}var nS=class{constructor(e){this._languageIdentifier=e}getId(){return this._languageIdentifier.language}};var ZO={ModesRegistry:"editor.modesRegistry"},eT=class{constructor(){this._onDidChangeLanguages=new k,this.onDidChangeLanguages=this._onDidChangeLanguages.event,this._languages=[],this._dynamicLanguages=[]}registerLanguage(e){return this._languages.push(e),this._onDidChangeLanguages.fire(void 0),{dispose:()=>{for(let t=0,i=this._languages.length;t"},{open:'"',close:'"'},{open:"'",close:"'"},{open:"`",close:"`"}],folding:{offSide:!0}},0);var ll=Object.prototype.hasOwnProperty,rS=class extends M{constructor(e=!0,t=!1){super();this._onDidChange=this._register(new k),this.onDidChange=this._onDidChange.event,this._warnOnOverwrite=t,this._nextLanguageId2=1,this._languageIdToLanguage=[],this._languageToLanguageId=Object.create(null),this._languages={},this._mimeTypesMap={},this._nameMap={},this._lowercaseNameMap={},e&&(this._initializeFromRegistry(),this._register(Sr.onDidChangeLanguages(i=>this._initializeFromRegistry())))}_initializeFromRegistry(){this._languages={},this._mimeTypesMap={},this._nameMap={},this._lowercaseNameMap={};let e=Sr.getLanguages();this._registerLanguages(e)}_registerLanguages(e){for(let t of e)this._registerLanguage(t);this._mimeTypesMap={},this._nameMap={},this._lowercaseNameMap={},Object.keys(this._languages).forEach(t=>{let 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})}),Te.as(vs.Configuration).registerOverrideIdentifiers(Sr.getLanguages().map(t=>t.id)),this._onDidChange.fire()}_getLanguageId(e){if(this._languageToLanguageId[e])return this._languageToLanguageId[e];let t=this._nextLanguageId2++;return this._languageIdToLanguage[t]=e,this._languageToLanguageId[e]=t,t}_registerLanguage(e){let t=e.id,i;if(ll.call(this._languages,t))i=this._languages[t];else{let n=this._getLanguageId(t);i={identifier:new Ea(t,n),name:null,mimetypes:[],aliases:[],extensions:[],filenames:[],configurationFiles:[]},this._languages[t]=i}this._mergeLanguage(i,e)}_mergeLanguage(e,t){let i=t.id,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(let a of t.extensions)nu({id:i,mime:n,extension:a},this._warnOnOverwrite)}if(Array.isArray(t.filenames))for(let a of t.filenames)nu({id:i,mime:n,filename:a},this._warnOnOverwrite),e.filenames.push(a);if(Array.isArray(t.filenamePatterns))for(let a of t.filenamePatterns)nu({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{let l=new RegExp(a);Yy(l)||nu({id:i,mime:n,firstline:l},this._warnOnOverwrite)}catch(l){de(l)}}e.aliases.push(i);let r=null;if(typeof t.aliases!="undefined"&&Array.isArray(t.aliases)&&(t.aliases.length===0?r=[null]:r=t.aliases),r!==null)for(let a of r)!a||a.length===0||e.aliases.push(a);let o=r!==null&&r.length>0;if(!(o&&r[0]===null)){let a=(o?r[0]:null)||i;(o||!e.name)&&(e.name=a)}t.configuration&&e.configurationFiles.push(t.configuration)}isRegisteredMode(e){return ll.call(this._mimeTypesMap,e)?!0:ll.call(this._languages,e)}getModeIdForLanguageNameLowercase(e){return ll.call(this._lowercaseNameMap,e)?this._lowercaseNameMap[e].language:null}extractModeIds(e){return e?e.split(",").map(t=>t.trim()).map(t=>ll.call(this._mimeTypesMap,t)?this._mimeTypesMap[t].language:t).filter(t=>ll.call(this._languages,t)):[]}getLanguageIdentifier(e){if(e===xd||e===0)return Ma;let t;if(typeof e=="string")t=e;else if(t=this._languageIdToLanguage[e],!t)return null;return ll.call(this._languages,t)?this._languages[t].identifier:null}getModeIdsFromFilepathOrFirstLine(e,t){if(!e&&!t)return[];let i=ok(e,t);return this.extractModeIds(i.join(","))}};var oS=class{constructor(e,t){this._selector=t,this.languageIdentifier=this._selector();let i;this._onDidChange=new k({onFirstListenerAdd:()=>{i=e(()=>this._evaluate())},onLastListenerRemove:()=>{i.dispose()}}),this.onDidChange=this._onDidChange.event}_evaluate(){let e=this._selector();e.id!==this.languageIdentifier.id&&(this.languageIdentifier=e,this._onDidChange.fire(this.languageIdentifier))}},aS=class extends M{constructor(e=!1){super();this._onDidCreateMode=this._register(new k),this.onDidCreateMode=this._onDidCreateMode.event,this._onLanguagesMaybeChanged=this._register(new k({leakWarningThreshold:200})),this.onLanguagesMaybeChanged=this._onLanguagesMaybeChanged.event,this._instantiatedModes={},this._registry=this._register(new rS(!0,e)),this._register(this._registry.onDidChange(()=>this._onLanguagesMaybeChanged.fire()))}isRegisteredMode(e){return this._registry.isRegisteredMode(e)}getModeIdForLanguageName(e){return this._registry.getModeIdForLanguageNameLowercase(e)}getModeIdByFilepathOrFirstLine(e,t){let i=this._registry.getModeIdsFromFilepathOrFirstLine(e,t);return rd(i,null)}getModeId(e){let t=this._registry.extractModeIds(e);return rd(t,null)}getLanguageIdentifier(e){return this._registry.getLanguageIdentifier(e)}create(e){return new oS(this.onLanguagesMaybeChanged,()=>{let t=this.getModeId(e);return this._createModeAndGetLanguageIdentifier(t)})}createByFilepathOrFirstLine(e,t){return new oS(this.onLanguagesMaybeChanged,()=>{let i=this.getModeIdByFilepathOrFirstLine(e,t);return this._createModeAndGetLanguageIdentifier(i)})}_createModeAndGetLanguageIdentifier(e){let t=this.getLanguageIdentifier(e||"plaintext")||Ma;return this._getOrCreateMode(t.language),t}triggerMode(e){let t=this.getModeId(e);this._getOrCreateMode(t||"plaintext")}_getOrCreateMode(e){if(!this._instantiatedModes.hasOwnProperty(e)){let t=this.getLanguageIdentifier(e)||Ma;this._instantiatedModes[e]=new nS(t),this._onDidCreateMode.fire(this._instantiatedModes[e])}return this._instantiatedModes[e]}};var Jc=$("undoRedoService"),Rp=class{constructor(e,t){this.resource=e,this.elements=t}},Po=class{constructor(){this.id=Po._ID++,this.order=1}nextOrder(){return this.id===0?0:this.order++}};Po._ID=0;Po.None=new Po;var kn=class{constructor(){this.id=kn._ID++,this.order=1}nextOrder(){return this.id===0?0:this.order++}};kn._ID=0;kn.None=new kn;var lS=class{constructor(e,t,i){this._legend=e,this._themeService=t,this._logService=i,this._hashTable=new Is,this._hasWarnedOverlappingTokens=!1}getMetadata(e,t,i){let n=this._hashTable.get(e,t,i.id),r;if(n)r=n.metadata,this._logService.getLevel()===Cn.Trace&&this._logService.trace(`SemanticTokensProviderStyling [CACHED] ${e} / ${t}: foreground ${mi.getForeground(r)}, fontStyle ${mi.getFontStyle(r).toString(2)}`);else{let o=this._legend.tokenTypes[e],a=[];if(o){let l=t;for(let h=0;l>0&&h>1;l>0&&this._logService.getLevel()===Cn.Trace&&(this._logService.trace(`SemanticTokensProviderStyling: unknown token modifier index: ${t.toString(2)} for legend: ${JSON.stringify(this._legend.tokenModifiers)}`),a.push("not-in-legend"));let c=this._themeService.getColorTheme().getTokenStyleMetadata(o,a,i.language);typeof c=="undefined"?r=2147483647:(r=0,typeof c.italic!="undefined"&&(r|=(c.italic?1:0)<<11|1),typeof c.bold!="undefined"&&(r|=(c.bold?2:0)<<11|2),typeof c.underline!="undefined"&&(r|=(c.underline?4:0)<<11|4),c.foreground&&(r|=c.foreground<<14|8),r===0&&(r=2147483647))}else this._logService.getLevel()===Cn.Trace&&this._logService.trace(`SemanticTokensProviderStyling: unknown token type index: ${e} for legend: ${JSON.stringify(this._legend.tokenTypes)}`),r=2147483647,o="not-in-legend";this._hashTable.add(e,t,i.id,r),this._logService.getLevel()===Cn.Trace&&this._logService.trace(`SemanticTokensProviderStyling ${e} (${o}) / ${t} (${a.join(" ")}): foreground ${mi.getForeground(r)}, fontStyle ${mi.getFontStyle(r).toString(2)}`)}return r}warnOverlappingSemanticTokens(e,t){this._hasWarnedOverlappingTokens||(this._hasWarnedOverlappingTokens=!0,console.warn(`Overlapping semantic tokens detected at lineNumber ${e}, column ${t}`))}};function iT(s,e,t){let i=s.data,n=s.data.length/5|0,r=Math.max(Math.ceil(n/1024),400),o=[],a=0,l=1,c=0;for(;ah&&i[5*v]===0;)v--;if(v-1===h){let C=d;for(;C+1S&&(e.warnOverlappingSemanticTokens(x,S+1),b=this._growCount){let r=this._elements;this._currentLengthIndex++,this._currentLength=Is._SIZES[this._currentLengthIndex],this._growCount=Math.round(this._currentLengthIndex+10?e[0]:null}function oT(s){let e=Em.ordered(s);return e.length>0?e[0]:null}Qe.registerCommand("_provideDocumentSemanticTokensLegend",(s,...e)=>Ap(void 0,void 0,void 0,function*(){let[t]=e;ci(t instanceof K);let i=s.get(ht).getModel(t);if(!i)return;let n=rT(i);return n?n.getLegend():s.get(It).executeCommand("_provideDocumentRangeSemanticTokensLegend",t)}));Qe.registerCommand("_provideDocumentSemanticTokens",(s,...e)=>Ap(void 0,void 0,void 0,function*(){let[t]=e;ci(t instanceof K);let i=s.get(ht).getModel(t);if(!i)return;let n=hS(i,null,Wt.None);if(!n)return s.get(It).executeCommand("_provideDocumentRangeSemanticTokens",t,i.getFullModelRange());let{provider:r,request:o}=n,a;try{a=yield o}catch(c){Yo(c);return}if(!a||!Op(a))return;let l=cS({id:0,type:"full",data:a.data});return a.resultId&&r.releaseDocumentSemanticTokens(a.resultId),l}));Qe.registerCommand("_provideDocumentRangeSemanticTokensLegend",(s,...e)=>Ap(void 0,void 0,void 0,function*(){let[t]=e;ci(t instanceof K);let i=s.get(ht).getModel(t);if(!i)return;let n=oT(i);if(!!n)return n.getLegend()}));Qe.registerCommand("_provideDocumentRangeSemanticTokens",(s,...e)=>Ap(void 0,void 0,void 0,function*(){let[t,i]=e;ci(t instanceof K),ci(D.isIRange(i));let n=s.get(ht).getModel(t);if(!n)return;let r=oT(n);if(!r)return;let o;try{o=yield r.provideDocumentRangeSemanticTokens(n,D.lift(i),Wt.None)}catch(a){Yo(a);return}if(!(!o||!Op(o)))return cS({id:0,type:"full",data:o.data})}));var tP=function(s,e,t,i){var n=arguments.length,r=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(s,e,t,i);else for(var a=s.length-1;a>=0;a--)(o=s[a])&&(r=(n<3?o(r):n>3?o(e,t,r):o(e,t))||r);return n>3&&r&&Object.defineProperty(e,t,r),r},Bu=function(s,e){return function(t,i){e(t,i,s)}};function Fo(s){return s.toString()}function aT(s){let e=new ec,t=s.createSnapshot(),i;for(;i=t.read();)e.update(i);return e.digest()}var lT=class{constructor(e,t,i){this._modelEventListeners=new U,this.model=e,this._languageSelection=null,this._languageSelectionListener=null,this._modelEventListeners.add(e.onWillDispose(()=>t(e))),this._modelEventListeners.add(e.onDidChangeLanguage(n=>i(e,n)))}_disposeLanguageSelection(){this._languageSelectionListener&&(this._languageSelectionListener.dispose(),this._languageSelectionListener=null)}dispose(){this._modelEventListeners.dispose(),this._disposeLanguageSelection()}setLanguage(e){this._disposeLanguageSelection(),this._languageSelection=e,this._languageSelectionListener=this._languageSelection.onDidChange(()=>this.model.setMode(e.languageIdentifier)),this.model.setMode(e.languageIdentifier)}},iP=_t||ee?1:2,cT=class{constructor(e,t,i,n,r,o,a,l){this.uri=e,this.initialUndoRedoSnapshot=t,this.time=i,this.sharesUndoRedoStack=n,this.heapSize=r,this.sha1=o,this.versionId=a,this.alternativeVersionId=l}};function nP(s){return s.scheme===Ce.file||s.scheme===Ce.vscodeRemote||s.scheme===Ce.userData||s.scheme==="fake-fs"}var Wu=class Vu extends M{constructor(e,t,i,n,r){super();this._configurationService=e,this._resourcePropertiesService=t,this._themeService=i,this._logService=n,this._undoRedoService=r,this._onModelAdded=this._register(new k),this.onModelAdded=this._onModelAdded.event,this._onModelRemoved=this._register(new k),this.onModelRemoved=this._onModelRemoved.event,this._onModelModeChanged=this._register(new k),this.onModelModeChanged=this._onModelModeChanged.event,this._modelCreationOptionsByLanguageAndResource=Object.create(null),this._models={},this._disposedModels=new Map,this._disposedModelsHeapSize=0,this._semanticStyling=this._register(new fT(this._themeService,this._logService)),this._register(this._configurationService.onDidChangeConfiguration(()=>this._updateModelOptions())),this._updateModelOptions(),this._register(new uT(this,this._themeService,this._configurationService,this._semanticStyling))}static _readModelOptions(e,t){let i=ni.tabSize;if(e.editor&&typeof e.editor.tabSize!="undefined"){let d=parseInt(e.editor.tabSize,10);isNaN(d)||(i=d),i<1&&(i=1)}let n=i;if(e.editor&&typeof e.editor.indentSize!="undefined"&&e.editor.indentSize!=="tabSize"){let d=parseInt(e.editor.indentSize,10);isNaN(d)||(n=d),n<1&&(n=1)}let r=ni.insertSpaces;e.editor&&typeof e.editor.insertSpaces!="undefined"&&(r=e.editor.insertSpaces==="false"?!1:Boolean(e.editor.insertSpaces));let o=iP,a=e.eol;a===`\r +`?o=2:a===` +`&&(o=1);let l=ni.trimAutoWhitespace;e.editor&&typeof e.editor.trimAutoWhitespace!="undefined"&&(l=e.editor.trimAutoWhitespace==="false"?!1:Boolean(e.editor.trimAutoWhitespace));let c=ni.detectIndentation;e.editor&&typeof e.editor.detectIndentation!="undefined"&&(c=e.editor.detectIndentation==="false"?!1:Boolean(e.editor.detectIndentation));let h=ni.largeFileOptimizations;return e.editor&&typeof e.editor.largeFileOptimizations!="undefined"&&(h=e.editor.largeFileOptimizations==="false"?!1:Boolean(e.editor.largeFileOptimizations)),{isForSimpleWidget:t,tabSize:i,indentSize:n,insertSpaces:r,detectIndentation:c,defaultEOL:o,trimAutoWhitespace:l,largeFileOptimizations:h}}_getEOL(e,t){if(e)return this._resourcePropertiesService.getEOL(e,t);let i=this._configurationService.getValue("files.eol",{overrideIdentifier:t});return i&&typeof i=="string"&&i!=="auto"?i:Ii===3||Ii===2?` +`:`\r +`}_shouldRestoreUndoStack(){let e=this._configurationService.getValue("files.restoreUndoStack");return typeof e=="boolean"?e:!0}getCreationOptions(e,t,i){let n=this._modelCreationOptionsByLanguageAndResource[e+t];if(!n){let r=this._configurationService.getValue("editor",{overrideIdentifier:e,resource:t}),o=this._getEOL(t,e);n=Vu._readModelOptions({editor:r,eol:o},i),this._modelCreationOptionsByLanguageAndResource[e+t]=n}return n}_updateModelOptions(){let e=this._modelCreationOptionsByLanguageAndResource;this._modelCreationOptionsByLanguageAndResource=Object.create(null);let t=Object.keys(this._models);for(let i=0,n=t.length;ie){let 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;){let i=t.shift();this._removeDisposedModel(i.uri),i.initialUndoRedoSnapshot!==null&&this._undoRedoService.restoreSnapshot(i.initialUndoRedoSnapshot)}}}_createModelData(e,t,i,n){let r=this.getCreationOptions(t.language,i,n),o=new qt(e,r,t,i,this._undoRedoService);if(i&&this._disposedModels.has(Fo(i))){let c=this._removeDisposedModel(i),h=this._undoRedoService.getElements(i),d=aT(o)===c.sha1;if(d||c.sharesUndoRedoStack){for(let u of h.past)ls(u)&&u.matchesResource(i)&&u.setModel(o);for(let u of h.future)ls(u)&&u.matchesResource(i)&&u.setModel(o);this._undoRedoService.setElementsValidFlag(i,!0,u=>ls(u)&&u.matchesResource(i)),d&&(o._overwriteVersionId(c.versionId),o._overwriteAlternativeVersionId(c.alternativeVersionId),o._overwriteInitialUndoRedoSnapshot(c.initialUndoRedoSnapshot))}else c.initialUndoRedoSnapshot!==null&&this._undoRedoService.restoreSnapshot(c.initialUndoRedoSnapshot)}let a=Fo(o.uri);if(this._models[a])throw new Error("ModelService: Cannot add model because it already exists!");let l=new lT(o,c=>this._onWillDispose(c),(c,h)=>this._onDidChangeLanguage(c,h));return this._models[a]=l,l}createModel(e,t,i,n=!1){let r;return t?(r=this._createModelData(e,t.languageIdentifier,i,n),this.setMode(r.model,t)):r=this._createModelData(e,sS,i,n),this._onModelAdded.fire(r.model),r.model}setMode(e,t){if(!t)return;let i=this._models[Fo(e.uri)];!i||i.setLanguage(t)}getModels(){let e=[],t=Object.keys(this._models);for(let i=0,n=t.length;i0||l.future.length>0){for(let c of l.past)ls(c)&&c.matchesResource(e.uri)&&(r=!0,o+=c.heapSize(e.uri),c.setModel(e.uri));for(let c of l.future)ls(c)&&c.matchesResource(e.uri)&&(r=!0,o+=c.heapSize(e.uri),c.setModel(e.uri))}}let a=Vu.MAX_MEMORY_FOR_CLOSED_FILES_UNDO_STACK;if(r)if(!n&&o>a){let l=i.model.getInitialUndoRedoSnapshot();l!==null&&this._undoRedoService.restoreSnapshot(l)}else this._ensureDisposedModelsHeapSize(a-o),this._undoRedoService.setElementsValidFlag(e.uri,!1,l=>ls(l)&&l.matchesResource(e.uri)),this._insertDisposedModel(new cT(e.uri,i.model.getInitialUndoRedoSnapshot(),Date.now(),n,o,aT(e),e.getVersionId(),e.getAlternativeVersionId()));else if(!n){let l=i.model.getInitialUndoRedoSnapshot();l!==null&&this._undoRedoService.restoreSnapshot(l)}delete this._models[t],i.dispose(),delete this._modelCreationOptionsByLanguageAndResource[e.getLanguageIdentifier().language+e.uri],this._onModelRemoved.fire(e)}_onDidChangeLanguage(e,t){let i=t.oldLanguage,n=e.getLanguageIdentifier().language,r=this.getCreationOptions(i,e.uri,e.isForSimpleWidget),o=this.getCreationOptions(n,e.uri,e.isForSimpleWidget);Vu._setModelOptionsForModel(e,o,r),this._onModelModeChanged.fire({model:e,oldModeId:i})}};Wu.MAX_MEMORY_FOR_CLOSED_FILES_UNDO_STACK=20*1024*1024;Wu=tP([Bu(0,nt),Bu(1,Ig),Bu(2,We),Bu(3,Hs),Bu(4,Jc)],Wu);var hT="editor.semanticHighlighting";function dT(s,e,t){var i;let n=(i=t.getValue(hT,{overrideIdentifier:s.getLanguageIdentifier().language,resource:s.uri}))===null||i===void 0?void 0:i.enabled;return typeof n=="boolean"?n:e.getColorTheme().semanticHighlighting}var uT=class extends M{constructor(e,t,i,n){super();this._watchers=Object.create(null),this._semanticStyling=n;let r=l=>{this._watchers[l.uri.toString()]=new Bo(l,t,this._semanticStyling)},o=(l,c)=>{c.dispose(),delete this._watchers[l.uri.toString()]},a=()=>{for(let l of e.getModels()){let c=this._watchers[l.uri.toString()];dT(l,t,i)?c||r(l):c&&o(l,c)}};this._register(e.onModelAdded(l=>{dT(l,t,i)&&r(l)})),this._register(e.onModelRemoved(l=>{let c=this._watchers[l.uri.toString()];c&&o(l,c)})),this._register(i.onDidChangeConfiguration(l=>{l.affectsConfiguration(hT)&&a()})),this._register(t.onDidColorThemeChange(a))}},fT=class extends M{constructor(e,t){super();this._themeService=e,this._logService=t,this._caches=new WeakMap,this._register(this._themeService.onDidColorThemeChange(()=>{this._caches=new WeakMap}))}get(e){return this._caches.has(e)||this._caches.set(e,new lS(e.getLegend(),this._themeService,this._logService)),this._caches.get(e)}},mT=class{constructor(e,t,i){this._provider=e,this.resultId=t,this.data=i}dispose(){this._provider.releaseDocumentSemanticTokens(this.resultId)}},Bo=class extends M{constructor(e,t,i){super();this._isDisposed=!1,this._model=e,this._semanticStyling=i,this._fetchDocumentSemanticTokens=this._register(new $e(()=>this._fetchDocumentSemanticTokensNow(),Bo.FETCH_DOCUMENT_SEMANTIC_TOKENS_DELAY)),this._currentDocumentResponse=null,this._currentDocumentRequestCancellationTokenSource=null,this._documentProvidersChangeListeners=[],this._register(this._model.onDidChangeContent(()=>{this._fetchDocumentSemanticTokens.isScheduled()||this._fetchDocumentSemanticTokens.schedule()})),this._register(this._model.onDidChangeLanguage(()=>{this._currentDocumentResponse&&(this._currentDocumentResponse.dispose(),this._currentDocumentResponse=null),this._currentDocumentRequestCancellationTokenSource&&(this._currentDocumentRequestCancellationTokenSource.cancel(),this._currentDocumentRequestCancellationTokenSource=null),this._setDocumentSemanticTokens(null,null,null,[]),this._fetchDocumentSemanticTokens.schedule(0)}));let n=()=>{me(this._documentProvidersChangeListeners),this._documentProvidersChangeListeners=[];for(let r of Ia.all(e))typeof r.onDidChange=="function"&&this._documentProvidersChangeListeners.push(r.onDidChange(()=>this._fetchDocumentSemanticTokens.schedule(0)))};n(),this._register(Ia.onDidChange(()=>{n(),this._fetchDocumentSemanticTokens.schedule()})),this._register(t.onDidColorThemeChange(r=>{this._setDocumentSemanticTokens(null,null,null,[]),this._fetchDocumentSemanticTokens.schedule()})),this._fetchDocumentSemanticTokens.schedule(0)}dispose(){this._currentDocumentResponse&&(this._currentDocumentResponse.dispose(),this._currentDocumentResponse=null),this._currentDocumentRequestCancellationTokenSource&&(this._currentDocumentRequestCancellationTokenSource.cancel(),this._currentDocumentRequestCancellationTokenSource=null),this._setDocumentSemanticTokens(null,null,null,[]),this._isDisposed=!0,super.dispose()}_fetchDocumentSemanticTokensNow(){if(this._currentDocumentRequestCancellationTokenSource)return;let e=new hi,t=this._currentDocumentResponse&&this._currentDocumentResponse.resultId||null,i=hS(this._model,t,e.token);if(!i){this._currentDocumentResponse&&this._model.setSemanticTokens(null,!1);return}let{provider:n,request:r}=i;this._currentDocumentRequestCancellationTokenSource=e;let o=[],a=this._model.onDidChangeContent(c=>{o.push(c)}),l=this._semanticStyling.get(n);r.then(c=>{this._currentDocumentRequestCancellationTokenSource=null,a.dispose(),this._setDocumentSemanticTokens(n,c||null,l,o)},c=>{c&&(Ir(c)||typeof c.message=="string"&&c.message.indexOf("busy")!==-1)||de(c),this._currentDocumentRequestCancellationTokenSource=null,a.dispose(),o.length>0&&(this._fetchDocumentSemanticTokens.isScheduled()||this._fetchDocumentSemanticTokens.schedule())})}static _copy(e,t,i,n,r){for(let o=0;o{n.length>0&&!this._fetchDocumentSemanticTokens.isScheduled()&&this._fetchDocumentSemanticTokens.schedule()};if(this._currentDocumentResponse&&(this._currentDocumentResponse.dispose(),this._currentDocumentResponse=null),this._isDisposed){e&&t&&e.releaseDocumentSemanticTokens(t.resultId);return}if(!e||!i){this._model.setSemanticTokens(null,!1);return}if(!t){this._model.setSemanticTokens(null,!0),o();return}if(sT(t)){if(!r){this._model.setSemanticTokens(null,!0);return}if(t.edits.length===0)t={resultId:t.resultId,data:r.data};else{let a=0;for(let u of t.edits)a+=(u.data?u.data.length:0)-u.deleteCount;let l=r.data,c=new Uint32Array(l.length+a),h=l.length,d=c.length;for(let u=t.edits.length-1;u>=0;u--){let f=t.edits[u],m=h-(f.start+f.deleteCount);m>0&&(Bo._copy(l,h-m,c,d-m,m),d-=m),f.data&&(Bo._copy(f.data,0,c,d-f.data.length,f.data.length),d-=f.data.length),h=f.start}h>0&&Bo._copy(l,0,c,0,h),t={resultId:t.resultId,data:c}}}if(Op(t)){this._currentDocumentResponse=new mT(e,t.resultId,t.data);let a=iT(t,i,this._model.getLanguageIdentifier());if(n.length>0)for(let l of n)for(let c of a)for(let h of l.changes)c.applyEdit(h.range,h.text);this._model.setSemanticTokens(a,!0)}else this._model.setSemanticTokens(null,!0);o()}};Bo.FETCH_DOCUMENT_SEMANTIC_TOKENS_DELAY=300;var gT=class{constructor(e,t,i,n,r){this._parsedThemeRuleBrand=void 0,this.token=e,this.index=t,this.fontStyle=i,this.foreground=n,this.background=r}};function sP(s){if(!s||!Array.isArray(s))return[];let e=[],t=0;for(let i=0,n=s.length;i{let u=cP(h.token,d.token);return u!==0?u:h.index-d.index});let t=0,i="000000",n="ffffff";for(;s.length>=1&&s[0].token==="";){let h=s.shift();h.fontStyle!==-1&&(t=h.fontStyle),h.foreground!==null&&(i=h.foreground),h.background!==null&&(n=h.background)}let r=new pT;for(let h of e)r.getId(h);let o=r.getId(i),a=r.getId(n),l=new Fp(t,o,a),c=new Bp(l);for(let h=0,d=s.length;h>>0,this._cache.set(t,i)}return(i|e<<0)>>>0}},aP=/\b(comment|string|regex|regexp)\b/;function lP(s){let e=s.match(aP);if(!e)return 0;switch(e[1]){case"comment":return 1;case"string":return 2;case"regex":return 4;case"regexp":return 4}throw new Error("Unexpected match for standard token type!")}function cP(s,e){return se?1:0}var Fp=class{constructor(e,t,i){this._themeTrieElementRuleBrand=void 0,this._fontStyle=e,this._foreground=t,this._background=i,this.metadata=(this._fontStyle<<11|this._foreground<<14|this._background<<23)>>>0}clone(){return new Fp(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<<14|this._background<<23)>>>0}},Bp=class{constructor(e){this._themeTrieElementBrand=void 0,this._mainRule=e,this._children=new Map}match(e){if(e==="")return this._mainRule;let t=e.indexOf("."),i,n;t===-1?(i=e,n=""):(i=e.substring(0,t),n=e.substring(t+1));let r=this._children.get(i);return typeof r!="undefined"?r.match(n):this._mainRule}insert(e,t,i,n){if(e===""){this._mainRule.acceptOverwrite(t,i,n);return}let r=e.indexOf("."),o,a;r===-1?(o=e,a=""):(o=e.substring(0,r),a=e.substring(r+1));let l=this._children.get(o);typeof l=="undefined"&&(l=new Bp(this._mainRule.clone()),this._children.set(o,l)),l.insert(a,t,i,n)}};function _T(s){let e=[];for(let t=1,i=s.length;ts.fire()),{onDidChange:s.event,getCSS(){let t={},i=r=>{let o=r.defaults;for(;ui.isThemeIcon(o);){let l=e.getIcon(o.id);if(!l)return;o=l.defaults}let a=o.fontId;if(a){let l=e.getIconFont(a);if(l)return t[a]=l,`.codicon-${r.id}:before { content: '${o.fontCharacter}'; font-family: ${Eb(a)}; }`}return`.codicon-${r.id}:before { content: '${o.fontCharacter}'; }`},n=[];for(let r of e.getIcons()){let o=i(r);o&&n.push(o)}for(let r in t){let a=t[r].definition.src.map(l=>`${Hr(l.location)} format('${l.format}')`).join(", ");n.push(`@font-face { src: ${a}; font-family: ${Eb(r)}; }`)}return n.join(` +`)}}}var cl="vs",Wp="vs-dark",eh="hc-black",hP=Te.as(cC.ColorContribution),dP=Te.as(Ob.ThemingContribution),dS=class{constructor(e,t){this.semanticHighlighting=!1,this.themeData=t;let i=t.base;e.length>0?(Vp(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){let e=new Map;for(let t in this.themeData.colors)e.set(t,A.fromHex(this.themeData.colors[t]));if(this.themeData.inherit){let t=uS(this.themeData.base);for(let i in t.colors)e.has(i)||e.set(i,A.fromHex(t.colors[i]))}this.colors=e}return this.colors}getColor(e,t){let 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=hP.resolveDefaultColor(e,this),this.defaultColors[e]=t,t)}defines(e){return Object.prototype.hasOwnProperty.call(this.getColors(),e)}get type(){switch(this.base){case cl:return nn.LIGHT;case eh:return nn.HIGH_CONTRAST;default:return nn.DARK}}get tokenTheme(){if(!this._tokenTheme){let e=[],t=[];if(this.themeData.inherit){let i=uS(this.themeData.base);e=i.rules,i.encodedTokensColors&&(t=i.encodedTokensColors)}e=e.concat(this.themeData.rules),this.themeData.encodedTokensColors&&(t=this.themeData.encodedTokensColors),this._tokenTheme=Pp.createFromRawTokenTheme(e,t)}return this._tokenTheme}getTokenStyleMetadata(e,t,i){let r=this.tokenTheme._match([e].concat(t).join(".")).metadata,o=mi.getForeground(r),a=mi.getFontStyle(r);return{foreground:o,italic:Boolean(a&1),bold:Boolean(a&2),underline:Boolean(a&4)}}};function Vp(s){return s===cl||s===Wp||s===eh}function uS(s){switch(s){case cl:return bT;case Wp:return wT;case eh:return vT}}function fS(s){let e=uS(s);return new dS(s,e)}var mS=class extends M{constructor(){super();this._onColorThemeChange=this._register(new k),this.onDidColorThemeChange=this._onColorThemeChange.event,this._environment=Object.create(null),this._autoDetectHighContrast=!0,this._knownThemes=new Map,this._knownThemes.set(cl,fS(cl)),this._knownThemes.set(Wp,fS(Wp)),this._knownThemes.set(eh,fS(eh));let e=CT();this._codiconCSS=e.getCSS(),this._themeCSS="",this._allCSS=`${this._codiconCSS} +${this._themeCSS}`,this._globalStyleElement=null,this._styleElements=[],this._colorMapOverride=null,this.setTheme(cl),e.onDidChange(()=>{this._codiconCSS=e.getCSS(),this._updateCSS()}),Vy("(forced-colors: active)",()=>{this._updateActualTheme()})}registerEditorContainer(e){return Al(e)?this._registerShadowDomContainer(e):this._registerRegularEditorContainer()}_registerRegularEditorContainer(){return this._globalStyleElement||(this._globalStyleElement=kt(),this._globalStyleElement.className="monaco-colors",this._globalStyleElement.textContent=this._allCSS,this._styleElements.push(this._globalStyleElement)),M.None}_registerShadowDomContainer(e){let t=kt(e);return t.className="monaco-colors",t.textContent=this._allCSS,this._styleElements.push(t),{dispose:()=>{for(let i=0;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(cl),this._desiredTheme=t,this._updateActualTheme()}_updateActualTheme(){let e=this._autoDetectHighContrast&&window.matchMedia("(forced-colors: active)").matches?this._knownThemes.get(eh):this._desiredTheme;this._theme!==e&&(this._theme=e,this._updateThemeOrColorMap())}setAutoDetectHighContrast(e){this._autoDetectHighContrast=e,this._updateActualTheme()}_updateThemeOrColorMap(){let e=[],t={},i={addRule:r=>{t[r]||(e.push(r),t[r]=!0)}};dP.getThemingParticipants().forEach(r=>r(this._theme,i,this._environment));let n=this._colorMapOverride||this._theme.tokenTheme.getColorMap();i.addRule(_T(n)),this._themeCSS=e.join(` +`),this._updateCSS(),Pe.setColorMap(n),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}}};var uP=function(s,e,t,i){var n=arguments.length,r=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(s,e,t,i);else for(var a=s.length-1;a>=0;a--)(o=s[a])&&(r=(n<3?o(r):n>3?o(e,t,r):o(e,t))||r);return n>3&&r&&Object.defineProperty(e,t,r),r},fP=function(s,e){return function(t,i){e(t,i,s)}},ju="data-keybinding-context",jp=class{constructor(e,t){this._id=e,this._parent=t,this._value=Object.create(null),this._value._contextId=e}setValue(e,t){return this._value[e]!==t?(this._value[e]=t,!0):!1}removeValue(e){return e in this._value?(delete this._value[e],!0):!1}getValue(e){let t=this._value[e];return typeof t=="undefined"&&this._parent?this._parent.getValue(e):t}},hl=class extends jp{constructor(){super(-1,null)}setValue(e,t){return!1}removeValue(e){return!1}getValue(e){}};hl.INSTANCE=new hl;var th=class extends jp{constructor(e,t,i){super(e,null);this._configurationService=t,this._values=so.forConfigKeys(),this._listener=this._configurationService.onDidChangeConfiguration(n=>{if(n.source===6){let r=Array.from(re.map(this._values,([o])=>o));this._values.clear(),i.fire(new pS(r))}else{let r=[];for(let o of n.affectedKeys){let a=`config.${o}`,l=this._values.findSuperstr(a);l!==void 0&&(r.push(...re.map(l,([c])=>c)),this._values.deleteSuperstr(a)),this._values.has(a)&&(r.push(a),this._values.delete(a))}i.fire(new pS(r))}})}dispose(){this._listener.dispose()}getValue(e){if(e.indexOf(th._keyPrefix)!==0)return super.getValue(e);if(this._values.has(e))return this._values.get(e);let t=e.substr(th._keyPrefix.length),i=this._configurationService.getValue(t),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)}};th._keyPrefix="config.";var ST=class{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=="undefined"?this._service.removeContext(this._key):this._service.setContext(this._key,this._defaultValue)}get(){return this._service.getContextKeyValue(this._key)}},gS=class{constructor(e){this.key=e}affectsSome(e){return e.has(this.key)}},pS=class{constructor(e){this.keys=e}affectsSome(e){for(let t of this.keys)if(e.has(t))return!0;return!1}},yT=class{constructor(e){this.events=e}affectsSome(e){for(let t of this.events)if(t.affectsSome(e))return!0;return!1}},_S=class{constructor(e){this._onDidChangeContext=new Qo({merge:t=>new yT(t)}),this.onDidChangeContext=this._onDidChangeContext.event,this._isDisposed=!1,this._myContextId=e}createKey(e,t){if(this._isDisposed)throw new Error("AbstractContextKeyService has been disposed");return new ST(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 LT(this,e)}contextMatchesRules(e){if(this._isDisposed)throw new Error("AbstractContextKeyService has been disposed");let t=this.getContextValuesContainer(this._myContextId);return lr.contextMatchesRules(t,e)}getContextKeyValue(e){if(!this._isDisposed)return this.getContextValuesContainer(this._myContextId).getValue(e)}setContext(e,t){if(this._isDisposed)return;let i=this.getContextValuesContainer(this._myContextId);!i||i.setValue(e,t)&&this._onDidChangeContext.fire(new gS(e))}removeContext(e){this._isDisposed||this.getContextValuesContainer(this._myContextId).removeValue(e)&&this._onDidChangeContext.fire(new gS(e))}getContext(e){return this._isDisposed?hl.INSTANCE:this.getContextValuesContainer(mP(e))}},zp=class extends _S{constructor(e){super(0);this._contexts=new Map,this._toDispose=new U,this._lastContextId=0;let t=new th(this._myContextId,e,this._onDidChangeContext);this._contexts.set(this._myContextId,t),this._toDispose.add(t)}dispose(){this._onDidChangeContext.dispose(),this._isDisposed=!0,this._toDispose.dispose()}getContextValuesContainer(e){return this._isDisposed?hl.INSTANCE:this._contexts.get(e)||hl.INSTANCE}createChildContext(e=this._myContextId){if(this._isDisposed)throw new Error("ContextKeyService has been disposed");let t=++this._lastContextId;return this._contexts.set(t,new jp(t,this.getContextValuesContainer(e))),t}disposeContext(e){this._isDisposed||this._contexts.delete(e)}};zp=uP([fP(0,nt)],zp);var LT=class extends _S{constructor(e,t){super(e.createChildContext());if(this._parentChangeListener=new Z_,this._parent=e,this._updateParentChangeListener(),this._domNode=t,this._domNode.hasAttribute(ju)){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(ju,String(this._myContextId))}_updateParentChangeListener(){this._parentChangeListener.value=this._parent.onDidChangeContext(this._onDidChangeContext.fire,this._onDidChangeContext)}dispose(){this._isDisposed||(this._onDidChangeContext.dispose(),this._parent.disposeContext(this._myContextId),this._parentChangeListener.dispose(),this._domNode.removeAttribute(ju),this._isDisposed=!0)}getContextValuesContainer(e){return this._isDisposed?hl.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._isDisposed||this._parent.disposeContext(e)}};function mP(s){for(;s;){if(s.hasAttribute(ju)){let e=s.getAttribute(ju);return e?parseInt(e,10):NaN}s=s.parentElement}return 0}Qe.registerCommand(sL,function(s,e,t){s.get(fe).createKey(String(e),t)});Qe.registerCommand({id:"getContextKeyInfo",handler(){return[...te.all()].sort((s,e)=>s.key.localeCompare(e.key))},description:{description:p("getContextKeyInfo","A command that returns information about context keys"),args:[]}});Qe.registerCommand("_generateContextKeyInfo",function(){let s=[],e=new Set;for(let t of te.all())e.has(t.key)||(e.add(t.key),s.push(t));s.sort((t,i)=>t.key.localeCompare(i.key)),console.log(JSON.stringify(s,void 0,2))});var Dt;(function(s){function e(r,o){if(r.start>=o.end||o.start>=r.end)return{start:0,end:0};let a=Math.max(r.start,o.start),l=Math.min(r.end,o.end);return l-a<=0?{start:0,end:0}:{start:a,end:l}}s.intersect=e;function t(r){return r.end-r.start<=0}s.isEmpty=t;function i(r,o){return!t(e(r,o))}s.intersects=i;function n(r,o){let a=[],l={start:r.start,end:Math.min(o.start,r.end)},c={start:Math.max(o.end,r.start),end:r.end};return t(l)||a.push(l),t(c)||a.push(c),a}s.relativeComplement=n})(Dt||(Dt={}));var Wo;(function(s){s[s.AVOID=0]="AVOID",s[s.ALIGN=1]="ALIGN"})(Wo||(Wo={}));function dl(s,e,t){let i=t.mode===Wo.ALIGN?t.offset:t.offset+t.size,n=t.mode===Wo.ALIGN?t.offset+t.size:t.offset;return t.position===0?e<=s-i?i:e<=n?n-e:Math.max(s-e,0):e<=n?n-e:e<=s-i?i:0}var Vo=class extends M{constructor(e,t){super();this.container=null,this.delegate=null,this.toDisposeOnClean=M.None,this.toDisposeOnSetContainer=M.None,this.shadowRoot=null,this.shadowRootHostElement=null,this.view=H(".context-view"),this.useFixedPosition=!1,this.useShadowDOM=!1,xb(this.view),this.setContainer(e,t),this._register(oe(()=>this.setContainer(null,1)))}setContainer(e,t){var i;if(this.container&&(this.toDisposeOnSetContainer.dispose(),this.shadowRoot?(this.shadowRoot.removeChild(this.view),this.shadowRoot=null,(i=this.shadowRootHostElement)===null||i===void 0||i.remove(),this.shadowRootHostElement=null):this.container.removeChild(this.view),this.container=null),e){if(this.container=e,this.useFixedPosition=t!==1,this.useShadowDOM=t===3,this.useShadowDOM){this.shadowRootHostElement=H(".shadow-root-host"),this.container.appendChild(this.shadowRootHostElement),this.shadowRoot=this.shadowRootHostElement.attachShadow({mode:"open"});let r=document.createElement("style");r.textContent=gP,this.shadowRoot.appendChild(r),this.shadowRoot.appendChild(this.view),this.shadowRoot.appendChild(H("slot"))}else this.container.appendChild(this.view);let n=new U;Vo.BUBBLE_UP_EVENTS.forEach(r=>{n.add(lt(this.container,r,o=>{this.onDOMEvent(o,!1)}))}),Vo.BUBBLE_DOWN_EVENTS.forEach(r=>{n.add(lt(this.container,r,o=>{this.onDOMEvent(o,!0)},!0))}),this.toDisposeOnSetContainer=n}}show(e){this.isVisible()&&this.hide(),Mt(this.view),this.view.className="context-view",this.view.style.top="0px",this.view.style.left="0px",this.view.style.zIndex="2500",this.view.style.position=this.useFixedPosition?"fixed":"absolute",jf(this.view),this.toDisposeOnClean=e.render(this.view)||M.None,this.delegate=e,this.doLayout(),this.delegate.focus&&this.delegate.focus()}getViewElement(){return this.view}layout(){if(!!this.isVisible()){if(this.delegate.canRelayout===!1&&!(en&&na.pointerEvents)){this.hide();return}this.delegate.layout&&this.delegate.layout(),this.doLayout()}}doLayout(){if(!this.isVisible())return;let e=this.delegate.getAnchor(),t;if(Vf(e)){let d=ti(e);t={top:d.top,left:d.left,width:d.width,height:d.height}}else t={top:e.y,left:e.x,width:e.width||1,height:e.height||2};let i=Nh(this.view),n=Th(this.view),r=this.delegate.anchorPosition||0,o=this.delegate.anchorAlignment||0,a=this.delegate.anchorAxisAlignment||0,l,c;if(a===0){let d={offset:t.top-window.pageYOffset,size:t.height,position:r===0?0:1},u={offset:t.left,size:t.width,position:o===0?0:1,mode:Wo.ALIGN};l=dl(window.innerHeight,n,d)+window.pageYOffset,Dt.intersects({start:l,end:l+n},{start:d.offset,end:d.offset+d.size})&&(u.mode=Wo.AVOID),c=dl(window.innerWidth,i,u)}else{let d={offset:t.left,size:t.width,position:o===0?0:1},u={offset:t.top,size:t.height,position:r===0?0:1,mode:Wo.ALIGN};c=dl(window.innerWidth,i,d),Dt.intersects({start:c,end:c+i},{start:d.offset,end:d.offset+d.size})&&(u.mode=Wo.AVOID),l=dl(window.innerHeight,n,u)+window.pageYOffset}this.view.classList.remove("top","bottom","left","right"),this.view.classList.add(r===0?"bottom":"top"),this.view.classList.add(o===0?"left":"right"),this.view.classList.toggle("fixed",this.useFixedPosition);let h=ti(this.container);this.view.style.top=`${l-(this.useFixedPosition?ti(this.view).top:h.top)}px`,this.view.style.left=`${c-(this.useFixedPosition?ti(this.view).left:h.left)}px`,this.view.style.width="initial"}hide(e){let t=this.delegate;this.delegate=null,(t==null?void 0:t.onHide)&&t.onHide(e),this.toDisposeOnClean.dispose(),xb(this.view)}isVisible(){return!!this.delegate}onDOMEvent(e,t){this.delegate&&(this.delegate.onDOMEvent?this.delegate.onDOMEvent(e,document.activeElement):t&&!bn(e.target,this.container)&&this.hide())}dispose(){this.hide(),super.dispose()}};Vo.BUBBLE_UP_EVENTS=["click","keydown","focus","blur"];Vo.BUBBLE_DOWN_EVENTS=["click"];var gP=` + :host { + all: initial; /* 1st rule so subsequent properties are reset. */ + } + + @font-face { + font-family: "codicon"; + src: url("./codicon.ttf?5d4d76ab2ce5108968ad644d591a16a6") format("truetype"); + } + + .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, "Nanum Gothic", "Apple SD Gothic Neo", "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; } +`;function xT(...s){return function(e,t){for(let i=0,n=s.length;i0?[{start:0,end:e.length}]:[]:null}function _P(s,e){let t=e.toLowerCase().indexOf(s.toLowerCase());return t===-1?null:[{start:t,end:t+s.length}]}function bP(s,e){return bS(s.toLowerCase(),e.toLowerCase(),0,0)}function bS(s,e,t,i){if(t===s.length)return[];if(i===e.length)return null;if(s[t]===e[i]){let n=null;return(n=bS(s,e,t+1,i+1))?CS({start:i,end:i+1},n):null}return bS(s,e,t,i+1)}function wS(s){return 97<=s&&s<=122}function Up(s){return 65<=s&&s<=90}function vS(s){return 48<=s&&s<=57}function DT(s){return s===32||s===9||s===10||s===13}var ET=new Set;"`~!@#$%^&*()-=+[{]}\\|;:'\",.<>/?".split("").forEach(s=>ET.add(s.charCodeAt(0)));function $p(s){return DT(s)||ET.has(s)}function wP(s,e){return s===e||$p(s)&&$p(e)}function kT(s){return wS(s)||Up(s)||vS(s)}function CS(s,e){return e.length===0?e=[s]:s.end===e[0].start?e[0].start=s.start:e.unshift(s),e}function IT(s,e){for(let t=e;t0&&!kT(s.charCodeAt(t-1)))return t}return s.length}function SS(s,e,t,i){if(t===s.length)return[];if(i===e.length)return null;if(s[t]!==e[i].toLowerCase())return null;{let n=null,r=i+1;for(n=SS(s,e,t+1,i+1);!n&&(r=IT(e,r)).6}function SP(s){let{upperPercent:e,lowerPercent:t,alphaPercent:i,numericPercent:n}=s;return t>.2&&e<.8&&i>.6&&n<.2}function yP(s){let e=0,t=0,i=0,n=0;for(let r=0;r60)return null;let t=vP(e);if(!SP(t)){if(!CP(t))return null;e=e.toLowerCase()}let i=null,n=0;for(s=s.toLowerCase();n0&&$p(s.charCodeAt(t-1)))return t;return s.length}var LP=xT(Hp,NT,_P),xP=xT(Hp,NT,bP),MT=new Da(1e4);function LS(s,e,t=!1){if(typeof s!="string"||typeof e!="string")return null;let i=MT.get(s);i||(i=new RegExp(Gy(s),"i"),MT.set(s,i));let n=i.exec(e);return n?[{start:n.index,end:n.index+n[0].length}]:t?xP(s,e):LP(s,e)}function Ole(s,e,t,i,n,r){let o=Math.min(13,s.length);for(;t1;i--){let n=s[i]+t,r=e[e.length-1];r&&r.end===n?r.end=n+1:e.push({start:n,end:n+1})}return e}var jo=128;function xS(){let s=[],e=[];for(let t=0;t<=jo;t++)e[t]=0;for(let t=0;t<=jo;t++)s.push(e.slice(0));return s}function RT(s){let e=[];for(let t=0;t<=s;t++)e[t]=0;return e}var AT=RT(2*jo),DS=RT(2*jo),Ns=xS(),zo=xS(),zu=xS(),DP=!1;function ES(s,e,t,i,n){function r(a,l,c=" "){for(;a.lengthr(a,3)).join("|")} +`;for(let a=0;a<=t;a++)a===0?o+=" |":o+=`${e[a-1]}|`,o+=s[a].slice(0,n+1).map(l=>r(l.toString(),3)).join("|")+` +`;return o}function EP(s,e,t,i){s=s.substr(e),t=t.substr(i),console.log(ES(zo,s,s.length,t,t.length)),console.log(ES(zu,s,s.length,t,t.length)),console.log(ES(Ns,s,s.length,t,t.length))}function Kp(s,e){if(e<0||e>=s.length)return!1;let t=s.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 40:case 91:return!0;case void 0:return!1;default:return!!ha(t)}}function OT(s,e){if(e<0||e>=s.length)return!1;switch(s.charCodeAt(e)){case 32:case 9:return!0;default:return!1}}function qp(s,e,t){return e[s]!==t[s]}function kP(s,e,t,i,n,r,o=!1){for(;ejo?jo:s.length,l=i.length>jo?jo:i.length;if(t>=a||r>=l||a-t>l-r||!kP(e,t,a,n,r,l,!0))return;IP(a,l,t,r,e,n);let c=1,h=1,d=t,u=r,f=[!1];for(c=1,d=t;d_,E=L?zo[c][h-1]+(Ns[c][h-1]>0?-5:0):0,T=u>_+1&&Ns[c][h-1]>0,I=T?zo[c][h-2]+(Ns[c][h-2]>0?-5:0):0;if(T&&(!L||I>=E)&&(!x||I>=S))zo[c][h]=I,zu[c][h]=3,Ns[c][h]=0;else if(L&&(!x||E>=S))zo[c][h]=E,zu[c][h]=2,Ns[c][h]=0;else if(x)zo[c][h]=S,zu[c][h]=1,Ns[c][h]=Ns[c-1][h-1]+1;else throw new Error("not possible")}}if(DP&&EP(s,t,i,r),!f[0]&&!o)return;c--,h--;let m=[zo[c][h],r],g=0,b=0;for(;c>=1;){let _=h;do{let v=zu[c][_];if(v===3)_=_-2;else if(v===2)_=_-1;else break}while(_>=1);g>1&&e[t+c-1]===n[r+h-1]&&!qp(_+r-1,i,n)&&g+1>Ns[c][_]&&(_=h),_===h?g++:g=1,b||(b=_),c--,h=_-1,m.push(h)}l===a&&(m[0]+=2);let w=b-a;return m[0]-=w,m}function IP(s,e,t,i,n,r){let o=s-1,a=e-1;for(;o>=t&&a>=i;)n[o]===r[a]&&(DS[o]=a,o--),a--}function NP(s,e,t,i,n,r,o,a,l,c,h){if(e[t]!==r[o])return Number.MIN_SAFE_INTEGER;let d=1,u=!1;return o===t-i?d=s[t]===n[o]?7:5:qp(o,n,r)&&(o===0||!qp(o-1,n,r))?(d=s[t]===n[o]?7:5,u=!0):Kp(r,o)&&(o===0||!Kp(r,o-1))?d=5:(Kp(r,o-1)||OT(r,o-1))&&(d=5,u=!0),d>1&&t===i&&(h[0]=!0),u||(u=qp(o,n,r)||Kp(r,o-1)||OT(r,o-1)),t===i?o>l&&(d-=u?3:5):c?d+=u?2:0:d+=u?0:1,o+1===a&&(d-=u?3:5),d}function Fle(s,e,t,i,n,r,o){return TP(s,e,t,i,n,r,!0,o)}function TP(s,e,t,i,n,r,o,a){let l=Hu(s,e,t,i,n,r,a);if(l&&!o)return l;if(s.length>=3){let c=Math.min(7,s.length-1);for(let h=t+1;hl[0])&&(l=u))}}}return l}function MP(s,e){if(e+1>=s.length)return;let t=s[e],i=s[e+1];if(t!==i)return s.slice(0,e)+i+t+s.slice(e+2)}var Uu="$(",kS=new RegExp(`\\$\\(${Kt.iconNameExpression}(?:${Kt.iconModifierExpression})?\\)`,"g"),RP=new RegExp(`(\\\\)?${kS.source}`,"g");function zle(s){return s.replace(RP,(e,t)=>t?e:`\\${e}`)}var AP=new RegExp(`\\\\${kS.source}`,"g");function Hle(s){return s.replace(AP,e=>`\\${e}`)}var OP=new RegExp(`(\\s)?(\\\\)?${kS.source}(\\s)?`,"g");function PT(s){return s.indexOf(Uu)===-1?s:s.replace(OP,(e,t,i,n)=>i?e:t||n||"")}function $u(s){let e=s.indexOf(Uu);return e===-1?{text:s}:PP(s,e)}function PP(s,e){let t=[],i="";function n(u){if(u){i+=u;for(let f of u)t.push(a)}}let r=-1,o="",a=0,l,c,h=e,d=s.length;for(n(s.substr(0,e));hthis.doGetActionViewItem(a,i,r),context:i.context,actionRunner:i.actionRunner,ariaLabel:i.ariaLabel,focusOnlyEnabledItems:!0,triggerKeys:{keys:[3,...ee||_t?[10]:[]],keyDown:!0}});this.menuElement=n,this.actionsList.setAttribute("role","menu"),this.actionsList.tabIndex=0,this.menuDisposables=this._register(new U),this.initializeStyleSheet(e),O(n,z.KEY_DOWN,a=>{new De(a).equals(2)&&a.preventDefault()}),i.enableMnemonics&&this.menuDisposables.add(O(n,z.KEY_DOWN,a=>{let l=a.key.toLocaleLowerCase();if(this.mnemonics.has(l)){ke.stop(a,!0);let c=this.mnemonics.get(l);if(c.length===1&&(c[0]instanceof TS&&c[0].container&&this.focusItemByElement(c[0].container),c[0].onClick(a)),c.length>1){let h=c.shift();h&&h.container&&(this.focusItemByElement(h.container),c.push(h)),this.mnemonics.set(l,c)}}})),_t&&this._register(O(n,z.KEY_DOWN,a=>{let l=new De(a);l.equals(14)||l.equals(11)?(this.focusedItem=this.viewItems.length-1,this.focusNext(),ke.stop(a,!0)):(l.equals(13)||l.equals(12))&&(this.focusedItem=0,this.focusPrevious(),ke.stop(a,!0))})),this._register(O(this.domNode,z.MOUSE_OUT,a=>{let l=a.relatedTarget;bn(l,this.domNode)||(this.focusedItem=void 0,this.updateFocus(),a.stopPropagation())})),this._register(O(this.actionsList,z.MOUSE_OVER,a=>{let l=a.target;if(!(!l||!bn(l,this.actionsList)||l===this.actionsList)){for(;l.parentElement!==this.actionsList&&l.parentElement!==null;)l=l.parentElement;if(l.classList.contains("action-item")){let c=this.focusedItem;this.setFocusedItem(l),c!==this.focusedItem&&this.updateFocus()}}}));let r={parent:this};this.mnemonics=new Map,this.scrollableElement=this._register(new _u(n,{alwaysConsumeMouseWheel:!0,horizontal:2,vertical:3,verticalScrollbarSize:7,handleMouseWheel:!0,useShadows:!0}));let o=this.scrollableElement.getDomNode();o.style.position="",this._register(O(o,z.MOUSE_UP,a=>{a.preventDefault()})),n.style.maxHeight=`${Math.max(10,window.innerHeight-e.getBoundingClientRect().top-35)}px`,t=t.filter(a=>{var l;return((l=i.submenuIds)===null||l===void 0?void 0:l.has(a.id))?(console.warn(`Found submenu cycle: ${a.id}`),!1):!0}),this.push(t,{icon:!0,label:!0,isMenu:!0}),e.appendChild(this.scrollableElement.getDomNode()),this.scrollableElement.scanDomNode(),this.viewItems.filter(a=>!(a instanceof Zp)).forEach((a,l,c)=>{a.updatePositionInSet(l+1,c.length)})}initializeStyleSheet(e){Al(e)?(this.styleSheet=kt(e),this.styleSheet.textContent=WT):(yr.globalStyleSheet||(yr.globalStyleSheet=kt(),yr.globalStyleSheet.textContent=WT),this.styleSheet=yr.globalStyleSheet)}style(e){let t=this.getContainer(),i=e.foregroundColor?`${e.foregroundColor}`:"",n=e.backgroundColor?`${e.backgroundColor}`:"",r=e.borderColor?`1px solid ${e.borderColor}`:"",o=e.shadowColor?`0 2px 4px ${e.shadowColor}`:"";t.style.border=r,this.domNode.style.color=i,this.domNode.style.backgroundColor=n,t.style.boxShadow=o,this.viewItems&&this.viewItems.forEach(a=>{(a instanceof Yp||a instanceof Zp)&&a.style(e)})}getContainer(){return this.scrollableElement.getDomNode()}get onScroll(){return this.scrollableElement.onScroll}focusItemByElement(e){let t=this.focusedItem;this.setFocusedItem(e),t!==this.focusedItem&&this.updateFocus()}setFocusedItem(e){for(let t=0;t{!this.element||(this._register(O(this.element,z.MOUSE_UP,n=>{if(ke.stop(n,!0),at){if(new Bt(n).rightButton)return;this.onClick(n)}else setTimeout(()=>{this.onClick(n)},0)})),this._register(O(this.element,z.CONTEXT_MENU,n=>{ke.stop(n,!0)})))},100),this._register(this.runOnceToEnableMouseUp)}render(e){super.render(e),!!this.element&&(this.container=e,this.item=W(this.element,H("a.action-menu-item")),this._action.id===On.ID?this.item.setAttribute("role","presentation"):(this.item.setAttribute("role","menuitem"),this.mnemonic&&this.item.setAttribute("aria-keyshortcuts",`${this.mnemonic}`)),this.check=W(this.item,H("span.menu-item-check"+FT.cssSelector)),this.check.setAttribute("role","none"),this.label=W(this.item,H("span.action-label")),this.options.label&&this.options.keybinding&&(W(this.item,H("span.keybinding")).textContent=this.options.keybinding),this.runOnceToEnableMouseUp.schedule(),this.updateClass(),this.updateLabel(),this.updateTooltip(),this.updateEnabled(),this.updateChecked())}blur(){super.blur(),this.applyStyle()}focus(){super.focus(),this.item&&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){Mt(this.label);let e=PT(this.getAction().label);if(e){let t=FP(e);this.options.enableMnemonics||(e=t),this.label.setAttribute("aria-label",t.replace(/&&/g,"&"));let i=IS.exec(e);if(i){e=qf(e),NS.lastIndex=0;let n=NS.exec(e);for(;n&&n[1];)n=NS.exec(e);let r=o=>o.replace(/&&/g,"&");n?this.label.append(Gf(r(e.substr(0,n.index))," "),H("u",{"aria-hidden":"true"},n[3]),qy(r(e.substr(n.index+n[0].length))," ")):this.label.innerText=r(e).trim(),this.item&&this.item.setAttribute("aria-keyshortcuts",(i[1]?i[1]:i[3]).toLocaleLowerCase())}else this.label.innerText=e.replace(/&&/g,"&").trim()}}}updateTooltip(){let e=null;this.getAction().tooltip?e=this.getAction().tooltip:!this.options.label&&this.getAction().label&&this.options.icon&&(e=this.getAction().label,this.options.keybinding&&(e=p({key:"titleLabel",comment:["action title","action keybinding"]},"{0} ({1})",e,this.options.keybinding))),e&&this.item&&(this.item.title=e)}updateClass(){this.cssClass&&this.item&&this.item.classList.remove(...this.cssClass.split(" ")),this.options.icon&&this.label?(this.cssClass=this.getAction().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.getAction().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(){!this.item||(this.getAction().checked?(this.item.classList.add("checked"),this.item.setAttribute("role","menuitemcheckbox"),this.item.setAttribute("aria-checked","true")):(this.item.classList.remove("checked"),this.item.setAttribute("role","menuitem"),this.item.setAttribute("aria-checked","false")))}getMnemonic(){return this.mnemonic}applyStyle(){if(!this.menuStyle)return;let 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?`thin solid ${this.menuStyle.selectionBorderColor}`:"";this.item&&(this.item.style.color=t?t.toString():"",this.item.style.backgroundColor=i?i.toString():""),this.check&&(this.check.style.color=t?t.toString():""),this.container&&(this.container.style.border=n)}style(e){this.menuStyle=e,this.applyStyle()}},TS=class extends Yp{constructor(e,t,i,n){super(e,e,n);this.submenuActions=t,this.parentData=i,this.submenuOptions=n,this.mysubmenu=null,this.submenuDisposables=this._register(new U),this.mouseOver=!1,this.expandDirection=n&&n.expandDirection!==void 0?n.expandDirection:Gp.Right,this.showScheduler=new $e(()=>{this.mouseOver&&(this.cleanupExistingSubmenu(!1),this.createSubmenu(!1))},250),this.hideScheduler=new $e(()=>{this.element&&!bn(jr(),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=W(this.item,H("span.submenu-indicator"+BT.cssSelector)),this.submenuIndicator.setAttribute("aria-hidden","true")),this._register(O(this.element,z.KEY_UP,t=>{let i=new De(t);(i.equals(17)||i.equals(3))&&(ke.stop(t,!0),this.createSubmenu(!0))})),this._register(O(this.element,z.KEY_DOWN,t=>{let i=new De(t);jr()===this.item&&(i.equals(17)||i.equals(3))&&ke.stop(t,!0)})),this._register(O(this.element,z.MOUSE_OVER,t=>{this.mouseOver||(this.mouseOver=!0,this.showScheduler.schedule())})),this._register(O(this.element,z.MOUSE_LEAVE,t=>{this.mouseOver=!1})),this._register(O(this.element,z.FOCUS_OUT,t=>{this.element&&!bn(jr(),this.element)&&this.hideScheduler.schedule()})),this._register(this.parentData.parent.onScroll(()=>{this.parentData.parent.focus(!1),this.cleanupExistingSubmenu(!1)})))}updateEnabled(){}onClick(e){ke.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(t){}this.parentData.submenu=void 0,this.updateAriaExpanded("false"),this.submenuContainer&&(this.submenuDisposables.clear(),this.submenuContainer=void 0)}}calculateSubmenuMenuLayout(e,t,i,n){let r={top:0,left:0};return r.left=dl(e.width,t.width,{position:n===Gp.Right?0:1,offset:i.left,size:i.width}),r.left>=i.left&&r.left{new De(c).equals(15)&&(ke.stop(c,!0),this.parentData.parent.focus(),this.cleanupExistingSubmenu(!0))})),this.submenuDisposables.add(O(this.submenuContainer,z.KEY_DOWN,c=>{new De(c).equals(15)&&ke.stop(c,!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){var t;this.item&&((t=this.item)===null||t===void 0||t.setAttribute("aria-expanded",e))}applyStyle(){if(super.applyStyle(),!this.menuStyle)return;let t=this.element&&this.element.classList.contains("focused")&&this.menuStyle.selectionForegroundColor?this.menuStyle.selectionForegroundColor:this.menuStyle.foregroundColor;this.submenuIndicator&&(this.submenuIndicator.style.color=t?`${t}`:""),this.parentData.submenu&&this.parentData.submenu.style(this.menuStyle)}dispose(){super.dispose(),this.hideScheduler.dispose(),this.mysubmenu&&(this.mysubmenu.dispose(),this.mysubmenu=null),this.submenuContainer&&(this.submenuContainer=void 0)}},Zp=class extends Au{style(e){this.label&&(this.label.style.borderBottomColor=e.separatorColor?`${e.separatorColor}`:"")}};function FP(s){let e=IS,t=e.exec(s);if(!t)return s;let i=!t[1];return s.replace(e,i?"$2$3":"").trim()}var WT=` +.monaco-menu { + font-size: 13px; + +} + +${Gw(FT)} +${Gw(BT)} + +.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.animated .action-item.active { + transform: scale(1.272019649, 1.272019649); /* 1.272019649 = \u221A\u03C6 */ +} + +.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 { + opacity: 0.4; +} + +/* 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 #bbb; + padding-top: 1px; + margin-left: .8em; + margin-right: .8em; +} + +.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: 2em; + align-items: center; + position: relative; +} + +.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; +} + +.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 { + padding: 0.5em 0 0 0; + margin-bottom: 0.5em; + width: 100%; + height: 0px !important; + margin-left: .8em !important; + margin-right: .8em !important; +} + +.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; +} + +.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; +} + +.monaco-menu .monaco-action-bar.vertical .action-item { + border: thin solid transparent; /* prevents jumping behaviour on hover or focus */ +} + + +/* High Contrast Theming */ +:host-context(.hc-black) .context-view.monaco-menu-container { + box-shadow: none; +} + +:host-context(.hc-black) .monaco-menu .monaco-action-bar.vertical .action-item.focused { + background: none; +} + +/* Vertical Action Bar Styles */ + +.monaco-menu .monaco-action-bar.vertical { + padding: .5em 0; +} + +.monaco-menu .monaco-action-bar.vertical .action-menu-item { + height: 1.8em; +} + +.monaco-menu .monaco-action-bar.vertical .action-label:not(.separator), +.monaco-menu .monaco-action-bar.vertical .keybinding { + font-size: inherit; + padding: 0 2em; +} + +.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; + padding: 0.2em 0 0 0; + margin-bottom: 0.2em; +} + +: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; +} + +: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; +} + +/* 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%; + box-shadow: #DDD 0 6px 6px -6px inset; +} +.monaco-scrollable-element > .shadow.left { + display: block; + top: 3px; + left: 0; + height: 100%; + width: 3px; + box-shadow: #DDD 6px 0 6px -6px inset; +} +.monaco-scrollable-element > .shadow.top-left-corner { + display: block; + top: 0; + left: 0; + height: 3px; + width: 3px; +} +.monaco-scrollable-element > .shadow.top.left { + box-shadow: #DDD 6px 6px 6px -6px inset; +} + +/* ---------- Default Style ---------- */ + +:host-context(.vs) .monaco-scrollable-element > .scrollbar > .slider { + background: rgba(100, 100, 100, .4); +} +:host-context(.vs-dark) .monaco-scrollable-element > .scrollbar > .slider { + background: rgba(121, 121, 121, .4); +} +:host-context(.hc-black) .monaco-scrollable-element > .scrollbar > .slider { + background: rgba(111, 195, 223, .6); +} + +.monaco-scrollable-element > .scrollbar > .slider:hover { + background: rgba(100, 100, 100, .7); +} +:host-context(.hc-black) .monaco-scrollable-element > .scrollbar > .slider:hover { + background: rgba(111, 195, 223, .8); +} + +.monaco-scrollable-element > .scrollbar > .slider.active { + background: rgba(0, 0, 0, .6); +} +:host-context(.vs-dark) .monaco-scrollable-element > .scrollbar > .slider.active { + background: rgba(191, 191, 191, .4); +} +:host-context(.hc-black) .monaco-scrollable-element > .scrollbar > .slider.active { + background: rgba(111, 195, 223, 1); +} + +:host-context(.vs-dark) .monaco-scrollable-element .shadow.top { + box-shadow: none; +} + +:host-context(.vs-dark) .monaco-scrollable-element .shadow.left { + box-shadow: #000 6px 0 6px -6px inset; +} + +:host-context(.vs-dark) .monaco-scrollable-element .shadow.top.left { + box-shadow: #000 6px 6px 6px -6px inset; +} + +:host-context(.hc-black) .monaco-scrollable-element .shadow.top { + box-shadow: none; +} + +:host-context(.hc-black) .monaco-scrollable-element .shadow.left { + box-shadow: none; +} + +:host-context(.hc-black) .monaco-scrollable-element .shadow.top.left { + box-shadow: none; +} +`;function dn(s,e){let t=Object.create(null);for(let i in e){let n=e[i];n&&(t[i]=ys(n,s))}return t}function MS(s,e,t){function i(){let n=dn(s.getColorTheme(),e);typeof t=="function"?t(n):t.style(n)}return i(),s.onDidColorThemeChange(i)}function hce(s,e,t){return MS(e,{badgeBackground:(t==null?void 0:t.badgeBackground)||Ka,badgeForeground:(t==null?void 0:t.badgeForeground)||qa,badgeBorder:Tt},s)}function ul(s,e,t){return MS(e,Object.assign(Object.assign({},qu),t||{}),s)}var qu={listFocusBackground:Yk,listFocusForeground:Zk,listFocusOutline:Xk,listActiveSelectionBackground:fr,listActiveSelectionForeground:mr,listActiveSelectionIconForeground:uu,listFocusAndSelectionBackground:fr,listFocusAndSelectionForeground:mr,listInactiveSelectionBackground:Qk,listInactiveSelectionIconForeground:eI,listInactiveSelectionForeground:Jk,listInactiveFocusBackground:tI,listInactiveFocusOutline:iI,listHoverBackground:nI,listHoverForeground:sI,listDropBackground:rI,listSelectionOutline:xi,listHoverOutline:xi,listFilterWidgetBackground:oI,listFilterWidgetOutline:aI,listFilterWidgetNoMatchesOutline:lI,listMatchesShadow:Mc,treeIndentGuidesStroke:cI,tableColumnsBorder:hI},BP={shadowColor:Mc,borderColor:gI,foregroundColor:pI,backgroundColor:_I,selectionForegroundColor:bI,selectionBackgroundColor:wI,selectionBorderColor:vI,separatorColor:CI};function VT(s,e,t){return MS(e,Object.assign(Object.assign({},BP),t),s)}var RS=class{constructor(e,t,i,n,r){this.contextViewService=e,this.telemetryService=t,this.notificationService=i,this.keybindingService=n,this.themeService=r,this.focusToReturn=null,this.block=null,this.options={blockMouse:!0}}configure(e){this.options=e}showContextMenu(e){let t=e.getActions();if(!t.length)return;this.focusToReturn=document.activeElement;let i,n=Vf(e.domForShadowRoot)?e.domForShadowRoot:void 0;this.contextViewService.showContextView({getAnchor:()=>e.getAnchor(),canRelayout:!1,anchorAlignment:e.anchorAlignment,anchorAxisAlignment:e.anchorAxisAlignment,render:r=>{let o=e.getMenuClassName?e.getMenuClassName():"";o&&(r.className+=" "+o),this.options.blockMouse&&(this.block=r.appendChild(H(".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",O(this.block,z.MOUSE_DOWN,c=>c.stopPropagation()));let a=new U,l=e.actionRunner||new oa;return l.onBeforeRun(this.onActionRun,this,a),l.onDidRun(this.onDidActionRun,this,a),i=new yr(r,t,{actionViewItemProvider:e.getActionViewItem,context:e.getActionsContext?e.getActionsContext():null,actionRunner:l,getKeyBinding:e.getKeyBinding?e.getKeyBinding:c=>this.keybindingService.lookupKeybinding(c.id)}),a.add(VT(i,this.themeService)),i.onDidCancel(()=>this.contextViewService.hideContextView(!0),null,a),i.onDidBlur(()=>this.contextViewService.hideContextView(!0),null,a),a.add(O(window,z.BLUR,()=>this.contextViewService.hideContextView(!0))),a.add(O(window,z.MOUSE_DOWN,c=>{if(c.defaultPrevented)return;let h=new Bt(c),d=h.target;if(!h.rightButton){for(;d;){if(d===r)return;d=d.parentElement}this.contextViewService.hideContextView(!0)}})),Jn(a,i)},focus:()=>{i&&i.focus(!!e.autoSelectFirstItem)},onHide:r=>{e.onHide&&e.onHide(!!r),this.block&&(this.block.remove(),this.block=null),this.focusToReturn&&this.focusToReturn.focus()}},n,!!n)}onActionRun(e){this.telemetryService.publicLog2("workbenchActionExecuted",{id:e.action.id,from:"contextMenu"}),this.contextViewService.hideContextView(!1),this.focusToReturn&&this.focusToReturn.focus()}onDidActionRun(e){e.error&&!Ir(e.error)&&this.notificationService.error(e.error)}};var WP=function(s,e,t,i){var n=arguments.length,r=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(s,e,t,i);else for(var a=s.length-1;a>=0;a--)(o=s[a])&&(r=(n<3?o(r):n>3?o(e,t,r):o(e,t))||r);return n>3&&r&&Object.defineProperty(e,t,r),r},Gu=function(s,e){return function(t,i){e(t,i,s)}},Xp=class extends M{constructor(e,t,i,n,r){super();this.contextMenuHandler=new RS(i,e,t,n,r)}configure(e){this.contextMenuHandler.configure(e)}showContextMenu(e){this.contextMenuHandler.showContextMenu(e),Ur.getInstance().resetKeyStatus()}};Xp=WP([Gu(0,_a),Gu(1,ri),Gu(2,Es),Gu(3,zt),Gu(4,We)],Xp);var Uo=$("layoutService");var VP=function(s,e,t,i){var n=arguments.length,r=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(s,e,t,i);else for(var a=s.length-1;a>=0;a--)(o=s[a])&&(r=(n<3?o(r):n>3?o(e,t,r):o(e,t))||r);return n>3&&r&&Object.defineProperty(e,t,r),r},jP=function(s,e){return function(t,i){e(t,i,s)}},Qp=class extends M{constructor(e){super();this.layoutService=e,this.currentViewDisposable=M.None,this.container=e.container,this.contextView=this._register(new Vo(this.container,1)),this.layout(),this._register(e.onDidLayout(()=>this.layout()))}setContainer(e,t){this.contextView.setContainer(e,t||1)}showContextView(e,t,i){t?t!==this.container&&(this.container=t,this.setContainer(t,i?3:2)):this.container!==this.layoutService.container&&(this.container=this.layoutService.container,this.setContainer(this.container,1)),this.contextView.show(e);let n=oe(()=>{this.currentViewDisposable===n&&this.hideContextView()});return this.currentViewDisposable=n,n}getContextViewElement(){return this.contextView.getViewElement()}layout(){this.contextView.layout()}hideContextView(e){this.contextView.hide(e)}};Qp=VP([jP(0,Uo)],Qp);var Jp=$("dialogService");var jT=class{constructor(e){this.incoming=new Map,this.outgoing=new Map,this.data=e}},AS=class{constructor(e){this._hashFn=e,this._nodes=new Map}roots(){let e=[];for(let t of this._nodes.values())t.outgoing.size===0&&e.push(t);return e}insertEdge(e,t){let i=this.lookupOrInsertNode(e),n=this.lookupOrInsertNode(t);i.outgoing.set(this._hashFn(t),n),n.incoming.set(this._hashFn(e),i)}removeNode(e){let t=this._hashFn(e);this._nodes.delete(t);for(let i of this._nodes.values())i.outgoing.delete(t),i.incoming.delete(t)}lookupOrInsertNode(e){let t=this._hashFn(e),i=this._nodes.get(t);return i||(i=new jT(e),this._nodes.set(t,i)),i}isEmpty(){return this._nodes.size===0}toString(){let e=[];for(let[t,i]of this._nodes)e.push(`${t}, (incoming)[${[...i.incoming.keys()].join(", ")}], (outgoing)[${[...i.outgoing.keys()].join(",")}]`);return e.join(` +`)}findCycleSlow(){for(let[e,t]of this._nodes){let i=new Set([e]),n=this._findCycle(t,i);if(n)return n}}_findCycle(e,t){for(let[i,n]of e.outgoing){if(t.has(i))return[...t,i].join(" -> ");t.add(i);let r=this._findCycle(n,t);if(r)return r;t.delete(i)}}};var zT=!1,OS=class extends Error{constructor(e){var t;super("cyclic dependency between services");this.message=(t=e.findCycleSlow())!==null&&t!==void 0?t:`UNABLE to detect cycle, dumping graph: +${e.toString()}`}},ih=class{constructor(e=new Ds,t=!1,i){this._activeInstantiations=new Set,this._services=e,this._strict=t,this._parent=i,this._services.set(ct,this)}createChild(e){return new ih(e,this._strict,this)}invokeFunction(e,...t){let i=Bi.traceInvocation(e),n=!1;try{return e({get:(o,a)=>{if(n)throw B1("service accessor is only valid during the invocation of its target method");let l=this._getOrCreateServiceInstance(o,i);if(!l&&a!==Uy)throw new Error(`[invokeFunction] unknown service '${o}'`);return l}},...t)}finally{n=!0,i.stop()}}createInstance(e,...t){let i,n;return e instanceof Gn?(i=Bi.traceCreation(e.ctor),n=this._createInstance(e.ctor,e.staticArguments.concat(t),i)):(i=Bi.traceCreation(e),n=this._createInstance(e,t,i)),i.stop(),n}_createInstance(e,t=[],i){let n=wn.getServiceDependencies(e).sort((a,l)=>a.index-l.index),r=[];for(let a of n){let l=this._getOrCreateServiceInstance(a.id,i);if(!l&&this._strict&&!a.optional)throw new Error(`[createInstance] ${e.name} depends on UNKNOWN service ${a.id}.`);r.push(l)}let o=n.length>0?n[0].index:t.length;if(t.length!==o){console.warn(`[createInstance] First service dependency of ${e.name} at position ${o+1} conflicts with ${t.length} static arguments`);let a=o-t.length;a>0?t=t.concat(new Array(a)):t=t.slice(0,o)}return new e(...[...t,...r])}_setServiceInstance(e,t){if(this._services.get(e)instanceof Gn)this._services.set(e,t);else if(this._parent)this._parent._setServiceInstance(e,t);else throw new Error("illegalState - setting UNKNOWN service instance")}_getServiceInstanceOrDescriptor(e){let t=this._services.get(e);return!t&&this._parent?this._parent._getServiceInstanceOrDescriptor(e):t}_getOrCreateServiceInstance(e,t){let i=this._getServiceInstanceOrDescriptor(e);return i instanceof Gn?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){let n=new AS(a=>a.id.toString()),r=0,o=[{id:e,desc:t,_trace:i}];for(;o.length;){let a=o.pop();if(n.lookupOrInsertNode(a),r++>1e3)throw new OS(n);for(let l of wn.getServiceDependencies(a.desc.ctor)){let c=this._getServiceInstanceOrDescriptor(l.id);if(!c&&!l.optional&&console.warn(`[createInstance] ${e} depends on ${l.id} which is NOT registered.`),c instanceof Gn){let h={id:l.id,desc:c,_trace:a._trace.branch(l.id,!0)};n.insertEdge(a,h),o.push(h)}}}for(;;){let a=n.roots();if(a.length===0){if(!n.isEmpty())throw new OS(n);break}for(let{data:l}of a){if(this._getServiceInstanceOrDescriptor(l.id)instanceof Gn){let h=this._createServiceInstanceWithOwner(l.id,l.desc.ctor,l.desc.staticArguments,l.desc.supportsDelayedInstantiation,l._trace);this._setServiceInstance(l.id,h)}n.removeNode(l)}}return this._getServiceInstanceOrDescriptor(e)}_createServiceInstanceWithOwner(e,t,i=[],n,r){if(this._services.get(e)instanceof Gn)return this._createServiceInstance(t,i,n,r);if(this._parent)return this._parent._createServiceInstanceWithOwner(e,t,i,n,r);throw new Error(`illegalState - creating UNKNOWN service instance ${t.name}`)}_createServiceInstance(e,t=[],i,n){if(i){let r=new Eh(()=>this._createInstance(e,t,n));return new Proxy(Object.create(null),{get(o,a){if(a in o)return o[a];let l=r.value,c=l[a];return typeof c!="function"||(c=c.bind(l),o[a]=c),c},set(o,a,l){return r.value[a]=l,!0}})}else return this._createInstance(e,t,n)}},Bi=class{constructor(e,t){this.type=e,this.name=t,this._start=Date.now(),this._dep=[]}static traceInvocation(e){return zT?new Bi(1,e.name||e.toString().substring(0,42).replace(/\n/g,"")):Bi._None}static traceCreation(e){return zT?new Bi(0,e.name):Bi._None}branch(e,t){let i=new Bi(2,e.toString());return this._dep.push([e,t,i]),i}stop(){let e=Date.now()-this._start;Bi._totals+=e;let t=!1;function i(r,o){let a=[],l=new Array(r+1).join(" ");for(let[c,h,d]of o._dep)if(h&&d){t=!0,a.push(`${l}CREATES -> ${c}`);let u=i(r+1,d);u&&a.push(u)}else a.push(`${l}uses -> ${c}`);return a.join(` +`)}let n=[`${this.type===0?"CREATE":"CALL"} ${this.name}`,`${i(1,this)}`,`DONE, took ${e.toFixed(2)}ms (grand total ${Bi._totals.toFixed(2)}ms)`];(e>2||t)&&console.log(n.join(` +`))}};Bi._None=new class extends Bi{constructor(){super(-1,null)}stop(){}branch(){return this}};Bi._totals=0;var HT=$("labelService");var Lr=class extends Error{constructor(e,t){super(`ListError [${e}] ${t}`)}};function UT(s,e){let t=[];for(let i of e){if(s.start>=i.range.end)continue;if(s.ende.concat(t),[]))}var t_=class{constructor(){this.groups=[],this._size=0}splice(e,t,i=[]){let n=i.length-t,r=UT({start:0,end:e},this.groups),o=UT({start:e+t,end:Number.POSITIVE_INFINITY},this.groups).map(l=>({range:e_(l.range,n),size:l.size})),a=i.map((l,c)=>({range:{start:e+c,end:e+c+1},size:l.size}));this.groups=HP(r,a,o),this._size=this.groups.reduce((l,c)=>l+c.size*(c.range.end-c.range.start),0)}get count(){let 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;let t=0,i=0;for(let n of this.groups){let r=n.range.end-n.range.start,o=i+r*n.size;if(e{for(let i of e)this.getRenderer(t).disposeTemplate(i.templateData),i.templateData=null}),this.cache.clear()}getRenderer(e){let t=this.renderers.get(e);if(!t)throw new Error(`No renderer found for ${e}`);return t}};var fl=function(s,e,t,i){var n=arguments.length,r=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(s,e,t,i);else for(var a=s.length-1;a>=0;a--)(o=s[a])&&(r=(n<3?o(r):n>3?o(e,t,r):o(e,t))||r);return n>3&&r&&Object.defineProperty(e,t,r),r},Ts={useShadows:!0,verticalScrollMode:1,setRowLineHeight:!0,setRowHeight:!0,supportDynamicHeights:!1,dnd:{getDragElements(s){return[s]},getDragURI(){return null},onDragStart(){},onDragOver(){return!1},drop(){}},horizontalScrolling:!1,transformOptimization:!0,alwaysConsumeMouseWheel:!0},$o=class{constructor(e){this.elements=e}update(){}getData(){return this.elements}},$T=class{constructor(e){this.elements=e}update(){}getData(){return this.elements}},KT=class{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;tn,(e==null?void 0:e.getPosInSet)?this.getPosInSet=e.getPosInSet.bind(e):this.getPosInSet=(t,i)=>i+1,(e==null?void 0:e.getRole)?this.getRole=e.getRole.bind(e):this.getRole=t=>"listitem",(e==null?void 0:e.isChecked)?this.isChecked=e.isChecked.bind(e):this.isChecked=t=>{}}},un=class{constructor(e,t,i,n=Ts){if(this.virtualDelegate=t,this.domId=`list_id_${++un.InstanceCount}`,this.renderers=new Map,this.renderWidth=0,this._scrollHeight=0,this.scrollableElementUpdateDisposable=null,this.scrollableElementWidthDelayer=new Nl(50),this.splicing=!1,this.dragOverAnimationStopDisposable=M.None,this.dragOverMouseY=0,this.canDrop=!1,this.currentDragFeedbackDisposable=M.None,this.onDragLeaveTimeout=M.None,this.disposables=new U,this._onDidChangeContentHeight=new k,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=new t_;for(let o of i)this.renderers.set(o.templateId,o);this.cache=this.disposables.add(new PS(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=zn(n,o=>o.horizontalScrolling,Ts.horizontalScrolling),this.domNode.classList.toggle("horizontal-scrolling",this._horizontalScrolling),this.additionalScrollHeight=typeof n.additionalScrollHeight=="undefined"?0:n.additionalScrollHeight,this.accessibilityProvider=new qT(n.accessibilityProvider),this.rowsContainer=document.createElement("div"),this.rowsContainer.className="monaco-list-rows",zn(n,o=>o.transformOptimization,Ts.transformOptimization)&&(this.rowsContainer.style.transform="translate3d(0px, 0px, 0px)"),this.disposables.add(we.addTarget(this.rowsContainer)),this.scrollable=new _r(zn(n,o=>o.smoothScrolling,!1)?125:0,o=>Ti(o)),this.scrollableElement=this.disposables.add(new Qa(this.rowsContainer,{alwaysConsumeMouseWheel:zn(n,o=>o.alwaysConsumeMouseWheel,Ts.alwaysConsumeMouseWheel),horizontal:1,vertical:zn(n,o=>o.verticalScrollMode,Ts.verticalScrollMode),useShadows:zn(n,o=>o.useShadows,Ts.useShadows),mouseWheelScrollSensitivity:n.mouseWheelScrollSensitivity,fastScrollSensitivity:n.fastScrollSensitivity},this.scrollable)),this.domNode.appendChild(this.scrollableElement.getDomNode()),e.appendChild(this.domNode),this.scrollableElement.onScroll(this.onScroll,this,this.disposables),this.disposables.add(O(this.rowsContainer,Re.Change,o=>this.onTouchChange(o))),this.disposables.add(O(this.scrollableElement.getDomNode(),"scroll",o=>o.target.scrollTop=0)),this.disposables.add(O(this.domNode,"dragover",o=>this.onDragOver(this.toDragEvent(o)))),this.disposables.add(O(this.domNode,"drop",o=>this.onDrop(this.toDragEvent(o)))),this.disposables.add(O(this.domNode,"dragleave",o=>this.onDragLeave(this.toDragEvent(o)))),this.disposables.add(O(this.domNode,"dragend",o=>this.onDragEnd(o))),this.setRowLineHeight=zn(n,o=>o.setRowLineHeight,Ts.setRowLineHeight),this.setRowHeight=zn(n,o=>o.setRowHeight,Ts.setRowHeight),this.supportDynamicHeights=zn(n,o=>o.supportDynamicHeights,Ts.supportDynamicHeights),this.dnd=zn(n,o=>o.dnd,Ts.dnd),this.layout()}get contentHeight(){return this.rangeMap.size}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(let t of this.items)this.measureItemWidth(t);this.updateScrollWidth(),this.scrollableElement.setScrollDimensions({width:Wf(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=""}}updateOptions(e){e.additionalScrollHeight!==void 0&&(this.additionalScrollHeight=e.additionalScrollHeight,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),e.mouseWheelScrollSensitivity!==void 0&&this.scrollableElement.updateOptions({mouseWheelScrollSensitivity:e.mouseWheelScrollSensitivity}),e.fastScrollSensitivity!==void 0&&this.scrollableElement.updateOptions({fastScrollSensitivity:e.fastScrollSensitivity})}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=[]){let n=this.getRenderRange(this.lastRenderTop,this.lastRenderHeight),r={start:e,end:e+t},o=Dt.intersect(n,r),a=new Map;for(let x=o.start;x({id:String(this.itemId++),element:x,templateId:this.virtualDelegate.getTemplateId(x),size:this.virtualDelegate.getHeight(x),width:void 0,hasDynamicHeight:!!this.virtualDelegate.hasDynamicHeight&&this.virtualDelegate.hasDynamicHeight(x),lastDynamicHeightWidth:void 0,row:null,uri:void 0,dropTarget:!1,dragStartDisposable:M.None})),u;e===0&&t>=this.items.length?(this.rangeMap=new t_,this.rangeMap.splice(0,0,d),u=this.items,this.items=d):(this.rangeMap.splice(e,t,d),u=this.items.splice(e,t,...d));let f=i.length-t,m=this.getRenderRange(this.lastRenderTop,this.lastRenderHeight),g=e_(c,f),b=Dt.intersect(m,g);for(let x=b.start;xe_(x,f)),C=[{start:e,end:e+i.length},..._].map(x=>Dt.intersect(m,x)),y=this.getNextToLastElement(C);for(let x of C)for(let S=x.start;Sx.element)}eventuallyUpdateScrollDimensions(){this._scrollHeight=this.contentHeight,this.rowsContainer.style.height=`${this._scrollHeight}px`,this.scrollableElementUpdateDisposable||(this.scrollableElementUpdateDisposable=Ti(()=>{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(let t of this.items)typeof t.width!="undefined"&&(e=Math.max(e,t.width));this.scrollWidth=e,this.scrollableElement.setScrollDimensions({scrollWidth:e===0?0:e+10})}rerender(){if(!!this.supportDynamicHeights){for(let 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}element(e){return this.items[e].element}domElement(e){let 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){let i={height:typeof e=="number"?e:Ty(this.domNode)};this.scrollableElementUpdateDisposable&&(this.scrollableElementUpdateDisposable.dispose(),this.scrollableElementUpdateDisposable=null,i.scrollHeight=this.scrollHeight),this.scrollableElement.setScrollDimensions(i),typeof t!="undefined"&&(this.renderWidth=t,this.supportDynamicHeights&&this._rerender(this.scrollTop,this.renderHeight)),this.horizontalScrolling&&this.scrollableElement.setScrollDimensions({width:typeof t=="number"?t:Wf(this.domNode)})}render(e,t,i,n,r,o=!1){let a=this.getRenderRange(t,i),l=Dt.relativeComplement(a,e),c=Dt.relativeComplement(e,a),h=this.getNextToLastElement(l);if(o){let d=Dt.intersect(e,a);for(let u=d.start;uthis.onDragStart(n.element,l,c))),this.horizontalScrolling&&(this.measureItemWidth(n),this.eventuallyUpdateScrollWidth())}measureItemWidth(e){if(!e.row||!e.row.domNode)return;e.row.domNode.style.width=at?"-moz-fit-content":"fit-content",e.width=Wf(e.row.domNode);let t=window.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("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){let t=this.items[e];if(t.dragStartDisposable.dispose(),t.row){let i=this.renderers.get(t.templateId);i&&i.disposeElement&&i.disposeElement(t.element,e,t.row.templateData,t.size),this.cache.release(t.row),t.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.additionalScrollHeight}get onMouseClick(){return j.map(this.disposables.add(new Ee(this.domNode,"click")).event,e=>this.toMouseEvent(e))}get onMouseDblClick(){return j.map(this.disposables.add(new Ee(this.domNode,"dblclick")).event,e=>this.toMouseEvent(e))}get onMouseMiddleClick(){return j.filter(j.map(this.disposables.add(new Ee(this.domNode,"auxclick")).event,e=>this.toMouseEvent(e)),e=>e.browserEvent.button===1)}get onMouseDown(){return j.map(this.disposables.add(new Ee(this.domNode,"mousedown")).event,e=>this.toMouseEvent(e))}get onContextMenu(){return j.any(j.map(this.disposables.add(new Ee(this.domNode,"contextmenu")).event,e=>this.toMouseEvent(e)),j.map(this.disposables.add(new Ee(this.domNode,Re.Contextmenu)).event,e=>this.toGestureEvent(e)))}get onTouchStart(){return j.map(this.disposables.add(new Ee(this.domNode,"touchstart")).event,e=>this.toTouchEvent(e))}get onTap(){return j.map(this.disposables.add(new Ee(this.rowsContainer,Re.Tap)).event,e=>this.toGestureEvent(e))}toMouseEvent(e){let t=this.getItemIndexFromEventTarget(e.target||null),i=typeof t=="undefined"?void 0:this.items[t],n=i&&i.element;return{browserEvent:e,index:t,element:n}}toTouchEvent(e){let t=this.getItemIndexFromEventTarget(e.target||null),i=typeof t=="undefined"?void 0:this.items[t],n=i&&i.element;return{browserEvent:e,index:t,element:n}}toGestureEvent(e){let t=this.getItemIndexFromEventTarget(e.initialTarget||null),i=typeof t=="undefined"?void 0:this.items[t],n=i&&i.element;return{browserEvent:e,index:t,element:n}}toDragEvent(e){let t=this.getItemIndexFromEventTarget(e.target||null),i=typeof t=="undefined"?void 0:this.items[t],n=i&&i.element;return{browserEvent:e,index:t,element:n}}onScroll(e){try{let t=this.getRenderRange(this.lastRenderTop,this.lastRenderHeight);this.render(t,e.scrollTop,e.height,e.scrollLeft,e.scrollWidth),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;let n=this.dnd.getDragElements(e);if(i.dataTransfer.effectAllowed="copyMove",i.dataTransfer.setData(xp.TEXT,t),i.dataTransfer.setDragImage){let r;this.dnd.getDragLabel&&(r=this.dnd.getDragLabel(n,i)),typeof r=="undefined"&&(r=String(n.length));let o=H(".monaco-drag-image");o.textContent=r,document.body.appendChild(o),i.dataTransfer.setDragImage(o,-10,-10),setTimeout(()=>document.body.removeChild(o),0)}this.currentDragData=new $o(n),Yn.CurrentDragAndDropData=new $T(n),this.dnd.onDragStart&&this.dnd.onDragStart(this.currentDragData,i)}onDragOver(e){if(e.browserEvent.preventDefault(),this.onDragLeaveTimeout.dispose(),Yn.CurrentDragAndDropData&&Yn.CurrentDragAndDropData.getData()==="vscode-ui"||(this.setupDragAndDropScrollTopAnimation(e.browserEvent),!e.browserEvent.dataTransfer))return!1;if(!this.currentDragData)if(Yn.CurrentDragAndDropData)this.currentDragData=Yn.CurrentDragAndDropData;else{if(!e.browserEvent.dataTransfer.types)return!1;this.currentDragData=new KT}let t=this.dnd.onDragOver(this.currentDragData,e.element,e.index,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===0?"copy":"move";let i;if(typeof t!="boolean"&&t.feedback?i=t.feedback:typeof e.index=="undefined"?i=[-1]:i=[e.index],i=bm(i).filter(n=>n>=-1&&nn-r),i=i[0]===-1?[-1]:i,$P(this.currentDragFeedback,i))return!0;if(this.currentDragFeedback=i,this.currentDragFeedbackDisposable.dispose(),i[0]===-1)this.domNode.classList.add("drop-target"),this.rowsContainer.classList.add("drop-target"),this.currentDragFeedbackDisposable=oe(()=>{this.domNode.classList.remove("drop-target"),this.rowsContainer.classList.remove("drop-target")});else{for(let n of i){let r=this.items[n];r.dropTarget=!0,r.row&&r.row.domNode.classList.add("drop-target")}this.currentDragFeedbackDisposable=oe(()=>{for(let n of i){let r=this.items[n];r.dropTarget=!1,r.row&&r.row.domNode.classList.remove("drop-target")}})}return!0}onDragLeave(e){var t,i;this.onDragLeaveTimeout.dispose(),this.onDragLeaveTimeout=Dh(()=>this.clearDragOverFeedback(),100),this.currentDragData&&((i=(t=this.dnd).onDragLeave)===null||i===void 0||i.call(t,this.currentDragData,e.element,e.index,e.browserEvent))}onDrop(e){if(!this.canDrop)return;let t=this.currentDragData;this.teardownDragAndDropScrollTopAnimation(),this.clearDragOverFeedback(),this.currentDragData=void 0,Yn.CurrentDragAndDropData=void 0,!(!t||!e.browserEvent.dataTransfer)&&(e.browserEvent.preventDefault(),t.update(e.browserEvent.dataTransfer),this.dnd.drop(t,e.element,e.index,e.browserEvent))}onDragEnd(e){this.canDrop=!1,this.teardownDragAndDropScrollTopAnimation(),this.clearDragOverFeedback(),this.currentDragData=void 0,Yn.CurrentDragAndDropData=void 0,this.dnd.onDragEnd&&this.dnd.onDragEnd(e)}clearDragOverFeedback(){this.currentDragFeedback=void 0,this.currentDragFeedbackDisposable.dispose(),this.currentDragFeedbackDisposable=M.None}setupDragAndDropScrollTopAnimation(e){if(!this.dragOverAnimationDisposable){let t=Ny(this.domNode).top;this.dragOverAnimationDisposable=Wy(this.animateDragAndDropScrollTop.bind(this,t))}this.dragOverAnimationStopDisposable.dispose(),this.dragOverAnimationStopDisposable=Dh(()=>{this.dragOverAnimationDisposable&&(this.dragOverAnimationDisposable.dispose(),this.dragOverAnimationDisposable=void 0)},1e3),this.dragOverMouseY=e.pageY}animateDragAndDropScrollTop(e){if(this.dragOverMouseY===void 0)return;let 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)}getItemIndexFromEventTarget(e){let t=this.scrollableElement.getDomNode(),i=e;for(;i instanceof HTMLElement&&i!==this.rowsContainer&&t.contains(i);){let n=i.getAttribute("data-index");if(n){let r=Number(n);if(!isNaN(r))return r}i=i.parentElement}}getRenderRange(e,t){return{start:this.rangeMap.indexAt(e),end:this.rangeMap.indexAfter(e+t-1)}}_rerender(e,t,i){let n=this.getRenderRange(e,t),r,o;e===this.elementTop(n.start)?(r=n.start,o=0):n.end-n.start>1&&(r=n.start+1,o=this.elementTop(r)-e);let a=0;for(;;){let l=this.getRenderRange(e,t),c=!1;for(let h=l.start;hn.splice(e,t,i))}};var ml=function(s,e,t,i){var n=arguments.length,r=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(s,e,t,i);else for(var a=s.length-1;a>=0;a--)(o=s[a])&&(r=(n<3?o(r):n>3?o(e,t,r):o(e,t))||r);return n>3&&r&&Object.defineProperty(e,t,r),r},GT=function(s,e,t,i){function n(r){return r instanceof t?r:new t(function(o){o(r)})}return new(t||(t=Promise))(function(r,o){function a(h){try{c(i.next(h))}catch(d){o(d)}}function l(h){try{c(i.throw(h))}catch(d){o(d)}}function c(h){h.done?r(h.value):n(h.value).then(a,l)}c((i=i.apply(s,e||[])).next())})},YT=class{constructor(e){this.trait=e,this.renderedElements=[]}get templateId(){return`template:${this.trait.trait}`}renderTemplate(e){return e}renderElement(e,t,i){let n=this.renderedElements.findIndex(r=>r.templateData===i);if(n>=0){let r=this.renderedElements[n];this.trait.unrender(i),r.index=t}else{let r={index:t,templateData:i};this.renderedElements.push(r)}this.trait.renderIndex(t,i)}splice(e,t,i){let n=[];for(let r of this.renderedElements)r.index=e+t&&n.push({index:r.index+i-t,templateData:r.templateData});this.renderedElements=n}renderIndexes(e){for(let{index:t,templateData:i}of this.renderedElements)e.indexOf(t)>-1&&this.trait.renderIndex(t,i)}disposeTemplate(e){let t=this.renderedElements.findIndex(i=>i.templateData===e);t<0||this.renderedElements.splice(t,1)}},Yu=class{constructor(e){this._trait=e,this.length=0,this.indexes=[],this.sortedIndexes=[],this._onChange=new k,this.onChange=this._onChange.event}get trait(){return this._trait}get renderer(){return new YT(this)}splice(e,t,i){var n;t=Math.max(0,Math.min(t,this.length-e));let r=i.length-t,o=e+t,a=[...this.sortedIndexes.filter(c=>cc?h+e:-1).filter(c=>c!==-1),...this.sortedIndexes.filter(c=>c>=o).map(c=>c+r)],l=this.length+r;if(this.sortedIndexes.length>0&&a.length===0&&l>0){let c=(n=this.sortedIndexes.find(h=>h>=e))!==null&&n!==void 0?n:l-1;a.push(Math.min(c,l-1))}this.renderer.splice(e,t,i.length),this._set(a,a),this.length=l}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(eM),t)}_set(e,t,i){let n=this.indexes,r=this.sortedIndexes;this.indexes=e,this.sortedIndexes=t;let o=zS(r,e);return this.renderer.renderIndexes(o),this._onChange.fire({indexes:e,browserEvent:i}),n}get(){return this.indexes}contains(e){return bx(this.sortedIndexes,e,eM)>=0}dispose(){me(this._onChange)}};ml([ze],Yu.prototype,"renderer",null);var ZT=class extends Yu{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"))}},i_=class{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,i.map(()=>!1));let n=this.trait.get().map(o=>this.identityProvider.getId(this.view.element(o)).toString()),r=i.map(o=>n.indexOf(this.identityProvider.getId(o).toString())>-1);this.trait.splice(e,t,r)}};function xr(s){return s.tagName==="INPUT"||s.tagName==="TEXTAREA"}function gl(s){return s.classList.contains("monaco-editor")?!0:s.classList.contains("monaco-list")||!s.parentElement?!1:gl(s.parentElement)}var BS=class{constructor(e,t,i){this.list=e,this.view=t,this.disposables=new U,this.multipleSelectionDisposables=new U,this.onKeyDown.filter(n=>n.keyCode===3).on(this.onEnter,this,this.disposables),this.onKeyDown.filter(n=>n.keyCode===16).on(this.onUpArrow,this,this.disposables),this.onKeyDown.filter(n=>n.keyCode===18).on(this.onDownArrow,this,this.disposables),this.onKeyDown.filter(n=>n.keyCode===11).on(this.onPageUpArrow,this,this.disposables),this.onKeyDown.filter(n=>n.keyCode===12).on(this.onPageDownArrow,this,this.disposables),this.onKeyDown.filter(n=>n.keyCode===9).on(this.onEscape,this,this.disposables),i.multipleSelectionSupport!==!1&&this.onKeyDown.filter(n=>(ee?n.metaKey:n.ctrlKey)&&n.keyCode===31).on(this.onCtrlA,this,this.multipleSelectionDisposables)}get onKeyDown(){return j.chain(this.disposables.add(new Ee(this.view.domNode,"keydown")).event).filter(e=>!xr(e.target)).map(e=>new De(e))}updateOptions(e){e.multipleSelectionSupport!==void 0&&(this.multipleSelectionDisposables.clear(),e.multipleSelectionSupport&&this.onKeyDown.filter(t=>(ee?t.metaKey:t.ctrlKey)&&t.keyCode===31).on(this.onCtrlA,this,this.multipleSelectionDisposables))}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),this.list.reveal(this.list.getFocus()[0]),this.view.domNode.focus()}onDownArrow(e){e.preventDefault(),e.stopPropagation(),this.list.focusNext(1,!1,e.browserEvent),this.list.reveal(this.list.getFocus()[0]),this.view.domNode.focus()}onPageUpArrow(e){e.preventDefault(),e.stopPropagation(),this.list.focusPreviousPage(e.browserEvent),this.list.reveal(this.list.getFocus()[0]),this.view.domNode.focus()}onPageDownArrow(e){e.preventDefault(),e.stopPropagation(),this.list.focusNextPage(e.browserEvent),this.list.reveal(this.list.getFocus()[0]),this.view.domNode.focus()}onCtrlA(e){e.preventDefault(),e.stopPropagation(),this.list.setSelection(Nt(this.list.length),e.browserEvent),this.view.domNode.focus()}onEscape(e){this.list.getSelection().length&&(e.preventDefault(),e.stopPropagation(),this.list.setSelection([],e.browserEvent),this.view.domNode.focus())}dispose(){this.disposables.dispose(),this.multipleSelectionDisposables.dispose()}};ml([ze],BS.prototype,"onKeyDown",null);var nh;(function(s){s[s.Idle=0]="Idle",s[s.Typing=1]="Typing"})(nh||(nh={}));var WS=new class{mightProducePrintableCharacter(s){return s.ctrlKey||s.metaKey||s.altKey?!1:s.keyCode>=31&&s.keyCode<=56||s.keyCode>=21&&s.keyCode<=30||s.keyCode>=93&&s.keyCode<=102||s.keyCode>=80&&s.keyCode<=90}},XT=class{constructor(e,t,i,n){this.list=e,this.view=t,this.keyboardNavigationLabelProvider=i,this.delegate=n,this.enabled=!1,this.state=nh.Idle,this.automaticKeyboardNavigation=!0,this.triggered=!1,this.previouslyFocused=-1,this.enabledDisposables=new U,this.disposables=new U,this.updateOptions(e.options)}updateOptions(e){(typeof e.enableKeyboardNavigation=="undefined"?!0:!!e.enableKeyboardNavigation)?this.enable():this.disable(),typeof e.automaticKeyboardNavigation!="undefined"&&(this.automaticKeyboardNavigation=e.automaticKeyboardNavigation)}enable(){if(this.enabled)return;let e=j.chain(this.enabledDisposables.add(new Ee(this.view.domNode,"keydown")).event).filter(n=>!xr(n.target)).filter(()=>this.automaticKeyboardNavigation||this.triggered).map(n=>new De(n)).filter(n=>this.delegate.mightProducePrintableCharacter(n)).forEach(n=>{n.stopPropagation(),n.preventDefault()}).map(n=>n.browserEvent.key).event,t=j.debounce(e,()=>null,800);j.reduce(j.any(e,t),(n,r)=>r===null?null:(n||"")+r)(this.onInput,this,this.enabledDisposables),t(this.onClear,this,this.enabledDisposables),this.enabled=!0,this.triggered=!1}disable(){!this.enabled||(this.enabledDisposables.clear(),this.enabled=!1,this.triggered=!1)}onClear(){var e;let t=this.list.getFocus();if(t.length>0&&t[0]===this.previouslyFocused){let i=(e=this.list.options.accessibilityProvider)===null||e===void 0?void 0:e.getAriaLabel(this.list.element(t[0]));i&&ts(i)}this.previouslyFocused=-1}onInput(e){if(!e){this.state=nh.Idle,this.triggered=!1;return}let t=this.list.getFocus(),i=t.length>0?t[0]:0,n=this.state===nh.Idle?1:0;this.state=nh.Typing;for(let r=0;r!xr(n.target)).map(n=>new De(n)).filter(n=>n.keyCode===2&&!n.ctrlKey&&!n.metaKey&&!n.shiftKey&&!n.altKey).on(this.onTab,this,this.disposables)}onTab(e){if(e.target!==this.view.domNode)return;let t=this.list.getFocus();if(t.length===0)return;let i=this.view.domElement(t[0]);if(!i)return;let n=i.querySelector("[tabIndex]");if(!n||!(n instanceof HTMLElement)||n.tabIndex===-1)return;let r=window.getComputedStyle(n);r.visibility==="hidden"||r.display==="none"||(e.preventDefault(),e.stopPropagation(),n.focus())}dispose(){this.disposables.dispose()}};function VS(s){return ee?s.browserEvent.metaKey:s.browserEvent.ctrlKey}function jS(s){return s.browserEvent.shiftKey}function KP(s){return s instanceof MouseEvent&&s.button===2}var JT={isSelectionSingleChangeEvent:VS,isSelectionRangeChangeEvent:jS},n_=class{constructor(e){this.list=e,this.disposables=new U,this._onPointer=new k,this.onPointer=this._onPointer.event,e.options.multipleSelectionSupport!==!1&&(this.multipleSelectionController=this.list.options.multipleSelectionController||JT),this.mouseSupport=typeof e.options.mouseSupport=="undefined"||!!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(we.addTarget(e.getHTMLElement()))),j.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||JT))}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){gl(e.browserEvent.target)||document.activeElement!==e.browserEvent.target&&this.list.domFocus()}onContextMenu(e){if(gl(e.browserEvent.target))return;let t=typeof e.index=="undefined"?[]:[e.index];this.list.setFocus(t,e.browserEvent)}onViewPointer(e){if(!this.mouseSupport||xr(e.browserEvent.target)||gl(e.browserEvent.target))return;let t=e.index;if(typeof t=="undefined"){this.list.setFocus([],e.browserEvent),this.list.setSelection([],e.browserEvent),this.list.setAnchor(void 0);return}if(this.isSelectionRangeChangeEvent(e))return this.changeSelection(e);if(this.isSelectionChangeEvent(e))return this.changeSelection(e);this.list.setFocus([t],e.browserEvent),this.list.setAnchor(t),KP(e.browserEvent)||this.list.setSelection([t],e.browserEvent),this._onPointer.fire(e)}onDoubleClick(e){if(xr(e.browserEvent.target)||gl(e.browserEvent.target)||this.isSelectionChangeEvent(e))return;let t=this.list.getFocus();this.list.setSelection(t,e.browserEvent)}changeSelection(e){let t=e.index,i=this.list.getAnchor();if(this.isSelectionRangeChangeEvent(e)){if(typeof i=="undefined"){let h=this.list.getFocus()[0];i=h!=null?h:t,this.list.setAnchor(i)}let n=Math.min(i,t),r=Math.max(i,t),o=Nt(n,r+1),a=this.list.getSelection(),l=YP(zS(a,[i]),i);if(l.length===0)return;let c=zS(o,ZP(a,l));this.list.setSelection(c,e.browserEvent),this.list.setFocus([t],e.browserEvent)}else if(this.isSelectionSingleChangeEvent(e)){let n=this.list.getSelection(),r=n.filter(o=>o!==t);this.list.setFocus([t]),this.list.setAnchor(t),n.length===r.length?this.list.setSelection([...r,t],e.browserEvent):this.list.setSelection(r,e.browserEvent)}}dispose(){this.disposables.dispose()}},s_=class{constructor(e,t){this.styleElement=e,this.selectorSuffix=t}style(e){let t=this.selectorSuffix&&`.${this.selectorSuffix}`,i=[];e.listBackground&&(e.listBackground.isOpaque()?i.push(`.monaco-list${t} .monaco-list-rows { background: ${e.listBackground}; }`):ee||console.warn(`List with id '${this.selectorSuffix}' was styled with a non-opaque background color. This will break sub-pixel antialiasing.`)),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, + .monaco-list${t}:focus .monaco-list-row.selected.focused { background-color: ${e.listFocusAndSelectionBackground}; } + `),e.listFocusAndSelectionForeground&&i.push(` + .monaco-drag-image, + .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) .monaco-list-row:hover:not(.selected):not(.focused) { background-color: ${e.listHoverBackground}; }`),e.listHoverForeground&&i.push(`.monaco-list${t} .monaco-list-row:hover:not(.selected):not(.focused) { color: ${e.listHoverForeground}; }`),e.listSelectionOutline&&i.push(`.monaco-list${t} .monaco-list-row.selected { outline: 1px dotted ${e.listSelectionOutline}; outline-offset: -1px; }`),e.listFocusOutline&&i.push(` + .monaco-drag-image, + .monaco-list${t}:focus .monaco-list-row.focused { outline: 1px solid ${e.listFocusOutline}; 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.listDropBackground&&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.listDropBackground} !important; color: inherit !important; } + `),e.listFilterWidgetBackground&&i.push(`.monaco-list-type-filter { background-color: ${e.listFilterWidgetBackground} }`),e.listFilterWidgetOutline&&i.push(`.monaco-list-type-filter { border: 1px solid ${e.listFilterWidgetOutline}; }`),e.listFilterWidgetNoMatchesOutline&&i.push(`.monaco-list-type-filter.no-matches { border: 1px solid ${e.listFilterWidgetNoMatchesOutline}; }`),e.listMatchesShadow&&i.push(`.monaco-list-type-filter { box-shadow: 1px 1px 1px ${e.listMatchesShadow}; }`),e.tableColumnsBorder&&i.push(` + .monaco-table:hover > .monaco-split-view2, + .monaco-table:hover > .monaco-split-view2 .monaco-sash.vertical::before { + border-color: ${e.tableColumnsBorder}; + }`),this.styleElement.textContent=i.join(` +`)}},qP={listFocusBackground:A.fromHex("#7FB0D0"),listActiveSelectionBackground:A.fromHex("#0E639C"),listActiveSelectionForeground:A.fromHex("#FFFFFF"),listActiveSelectionIconForeground:A.fromHex("#FFFFFF"),listFocusAndSelectionBackground:A.fromHex("#094771"),listFocusAndSelectionForeground:A.fromHex("#FFFFFF"),listInactiveSelectionBackground:A.fromHex("#3F3F46"),listInactiveSelectionIconForeground:A.fromHex("#FFFFFF"),listHoverBackground:A.fromHex("#2A2D2E"),listDropBackground:A.fromHex("#383B3D"),treeIndentGuidesStroke:A.fromHex("#a9a9a9"),tableColumnsBorder:A.fromHex("#cccccc").transparent(.2)},GP={keyboardSupport:!0,mouseSupport:!0,multipleSelectionSupport:!0,dnd:{getDragURI(){return null},onDragStart(){},onDragOver(){return!1},drop(){}}};function YP(s,e){let t=s.indexOf(e);if(t===-1)return[];let i=[],n=t-1;for(;n>=0&&s[n]===e-(t-n);)i.push(s[n--]);for(i.reverse(),n=t;n=s.length)t.push(e[n++]);else if(n>=e.length)t.push(s[i++]);else if(s[i]===e[n]){t.push(s[i]),i++,n++;continue}else s[i]=s.length)t.push(e[n++]);else if(n>=e.length)t.push(s[i++]);else if(s[i]===e[n]){i++,n++;continue}else s[i]s-e,tM=class{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 r=0;for(let o of this.renderers)o.renderElement(e,t,i[r++],n)}disposeElement(e,t,i,n){let r=0;for(let o of this.renderers)o.disposeElement&&o.disposeElement(e,t,i[r],n),r+=1}disposeTemplate(e){let t=0;for(let i of this.renderers)i.disposeTemplate(e[t++])}},iM=class{constructor(e){this.accessibilityProvider=e,this.templateId="a18n"}renderTemplate(e){return e}renderElement(e,t,i){let n=this.accessibilityProvider.getAriaLabel(e);n?i.setAttribute("aria-label",n):i.removeAttribute("aria-label");let r=this.accessibilityProvider.getAriaLevel&&this.accessibilityProvider.getAriaLevel(e);typeof r=="number"?i.setAttribute("aria-level",`${r}`):i.removeAttribute("aria-level")}disposeTemplate(e){}},nM=class{constructor(e,t){this.list=e,this.dnd=t}getDragElements(e){let 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&&this.dnd.onDragStart(e,t)}onDragOver(e,t,i,n){return this.dnd.onDragOver(e,t,i,n)}onDragLeave(e,t,i,n){var r,o;(o=(r=this.dnd).onDragLeave)===null||o===void 0||o.call(r,e,t,i,n)}onDragEnd(e){this.dnd.onDragEnd&&this.dnd.onDragEnd(e)}drop(e,t,i,n){this.dnd.drop(e,t,i,n)}},Xi=class{constructor(e,t,i,n,r=GP){var o;this.user=e,this._options=r,this.focus=new Yu("focused"),this.anchor=new Yu("anchor"),this.eventBufferer=new Jo,this._ariaLabel="",this.disposables=new U,this._onDidDispose=new k,this.onDidDispose=this._onDidDispose.event;let a=this._options.accessibilityProvider&&this._options.accessibilityProvider.getWidgetRole?(o=this._options.accessibilityProvider)===null||o===void 0?void 0:o.getWidgetRole():"list";this.selection=new ZT(a!=="listbox"),Pi(r,qP,!1);let l=[this.focus.renderer,this.selection.renderer];this.accessibilityProvider=r.accessibilityProvider,this.accessibilityProvider&&(l.push(new iM(this.accessibilityProvider)),this.accessibilityProvider.onDidChangeActiveDescendant&&this.accessibilityProvider.onDidChangeActiveDescendant(this.onDidChangeActiveDescendant,this,this.disposables)),n=n.map(h=>new tM(h.templateId,[...l,h]));let c=Object.assign(Object.assign({},r),{dnd:r.dnd&&new nM(this,r.dnd)});if(this.view=new un(t,i,n,c),this.view.domNode.setAttribute("role",a),r.styleController)this.styleController=r.styleController(this.view.domId);else{let h=kt(this.view.domNode);this.styleController=new s_(h,this.view.domId)}if(this.spliceable=new FS([new i_(this.focus,this.view,r.identityProvider),new i_(this.selection,this.view,r.identityProvider),new i_(this.anchor,this.view,r.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 QT(this,this.view)),(typeof r.keyboardSupport!="boolean"||r.keyboardSupport)&&(this.keyboardController=new BS(this,this.view,r),this.disposables.add(this.keyboardController)),r.keyboardNavigationLabelProvider){let h=r.keyboardNavigationDelegate||WS;this.typeLabelController=new XT(this,this.view,r.keyboardNavigationLabelProvider,h),this.disposables.add(this.typeLabelController)}this.mouseController=this.createMouseController(r),this.disposables.add(this.mouseController),this.onDidChangeFocus(this._onFocusChange,this,this.disposables),this.onDidChangeSelection(this._onSelectionChange,this,this.disposables),this.accessibilityProvider&&(this.ariaLabel=this.accessibilityProvider.getWidgetAriaLabel()),this._options.multipleSelectionSupport!==!1&&this.view.domNode.setAttribute("aria-multiselectable","true")}get onDidChangeFocus(){return j.map(this.eventBufferer.wrapEvent(this.focus.onChange),e=>this.toListEvent(e))}get onDidChangeSelection(){return j.map(this.eventBufferer.wrapEvent(this.selection.onChange),e=>this.toListEvent(e))}get domId(){return this.view.domId}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 onTouchStart(){return this.view.onTouchStart}get onTap(){return this.view.onTap}get onContextMenu(){let e=!1,t=j.chain(this.disposables.add(new Ee(this.view.domNode,"keydown")).event).map(r=>new De(r)).filter(r=>e=r.keyCode===58||r.shiftKey&&r.keyCode===68).map(z0).filter(()=>!1).event,i=j.chain(this.disposables.add(new Ee(this.view.domNode,"keyup")).event).forEach(()=>e=!1).map(r=>new De(r)).filter(r=>r.keyCode===58||r.shiftKey&&r.keyCode===68).map(z0).map(({browserEvent:r})=>{let o=this.getFocus(),a=o.length?o[0]:void 0,l=typeof a!="undefined"?this.view.element(a):void 0,c=typeof a!="undefined"?this.view.domElement(a):this.view.domNode;return{index:a,element:l,anchor:c,browserEvent:r}}).event,n=j.chain(this.view.onContextMenu).filter(r=>!e).map(({element:r,index:o,browserEvent:a})=>({element:r,index:o,anchor:{x:a.pageX+1,y:a.pageY},browserEvent:a})).event;return j.any(t,i,n)}get onKeyDown(){return this.disposables.add(new Ee(this.view.domNode,"keydown")).event}get onDidFocus(){return j.signal(this.disposables.add(new Ee(this.view.domNode,"focus",!0)).event)}createMouseController(e){return new n_(this)}updateOptions(e={}){var t;this._options=Object.assign(Object.assign({},this._options),e),this.typeLabelController&&this.typeLabelController.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),(t=this.keyboardController)===null||t===void 0||t.updateOptions(e),this.view.updateOptions(e)}get options(){return this._options}splice(e,t,i=[]){if(e<0||e>this.view.length)throw new Lr(this.user,`Invalid start index: ${e}`);if(t<0)throw new Lr(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)}get length(){return this.view.length}get contentHeight(){return this.view.contentHeight}get scrollTop(){return this.view.getScrollTop()}set scrollTop(e){this.view.setScrollTop(e)}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(let i of e)if(i<0||i>=this.length)throw new Lr(this.user,`Invalid index ${i}`);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=="undefined"){this.anchor.set([]);return}if(e<0||e>=this.length)throw new Lr(this.user,`Invalid index ${e}`);this.anchor.set([e])}getAnchor(){return rd(this.anchor.get(),void 0)}getAnchorElement(){let e=this.getAnchor();return typeof e=="undefined"?void 0:this.element(e)}setFocus(e,t){for(let i of e)if(i<0||i>=this.length)throw new Lr(this.user,`Invalid index ${i}`);this.focus.set(e,t)}focusNext(e=1,t=!1,i,n){if(this.length===0)return;let r=this.focus.get(),o=this.findNextIndex(r.length>0?r[0]+e:0,t,n);o>-1&&this.setFocus([o],i)}focusPrevious(e=1,t=!1,i,n){if(this.length===0)return;let r=this.focus.get(),o=this.findPreviousIndex(r.length>0?r[0]-e:0,t,n);o>-1&&this.setFocus([o],i)}focusNextPage(e,t){return GT(this,void 0,void 0,function*(){let i=this.view.indexAt(this.view.getScrollTop()+this.view.renderHeight);i=i===0?0:i-1;let n=this.view.element(i),r=this.getFocusedElements()[0];if(r!==n){let o=this.findPreviousIndex(i,!1,t);o>-1&&r!==this.view.element(o)?this.setFocus([o],e):this.setFocus([i],e)}else{let o=this.view.getScrollTop();this.view.setScrollTop(o+this.view.renderHeight-this.view.elementHeight(i)),this.view.getScrollTop()!==o&&(this.setFocus([]),yield Or(0),yield this.focusNextPage(e,t))}})}focusPreviousPage(e,t){return GT(this,void 0,void 0,function*(){let i,n=this.view.getScrollTop();n===0?i=this.view.indexAt(n):i=this.view.indexAfter(n-1);let r=this.view.element(i),o=this.getFocusedElements()[0];if(o!==r){let a=this.findNextIndex(i,!1,t);a>-1&&o!==this.view.element(a)?this.setFocus([a],e):this.setFocus([i],e)}else{let a=n;this.view.setScrollTop(n-this.view.renderHeight),this.view.getScrollTop()!==a&&(this.setFocus([]),yield Or(0),yield this.focusPreviousPage(e,t))}})}focusLast(e,t){if(this.length===0)return;let 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;let n=this.findNextIndex(e,!1,i);n>-1&&this.setFocus([n],t)}findNextIndex(e,t=!1,i){for(let n=0;n=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;nthis.view.element(e))}reveal(e,t){if(e<0||e>=this.length)throw new Lr(this.user,`Invalid index ${e}`);let i=this.view.getScrollTop(),n=this.view.elementTop(e),r=this.view.elementHeight(e);if(Ws(t)){let o=r-this.view.renderHeight;this.view.setScrollTop(o*$i(t,0,1)+n)}else{let o=n+r,a=i+this.view.renderHeight;n=a||(n=a&&r>=this.view.renderHeight?this.view.setScrollTop(n):o>=a&&this.view.setScrollTop(o-this.view.renderHeight))}}getRelativeTop(e){if(e<0||e>=this.length)throw new Lr(this.user,`Invalid index ${e}`);let t=this.view.getScrollTop(),i=this.view.elementTop(e),n=this.view.elementHeight(e);if(it+this.view.renderHeight)return null;let r=n-this.view.renderHeight;return Math.abs((t-i)/r)}getHTMLElement(){return this.view.domNode}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(){let e=this.focus.get();this.view.domNode.classList.toggle("element-focused",e.length>0),this.onDidChangeActiveDescendant()}onDidChangeActiveDescendant(){var e;let t=this.focus.get();if(t.length>0){let i;((e=this.accessibilityProvider)===null||e===void 0?void 0:e.getActiveDescendantId)&&(i=this.accessibilityProvider.getActiveDescendantId(this.view.element(t[0]))),this.view.domNode.setAttribute("aria-activedescendant",i||this.view.getElementDomId(t[0]))}else this.view.domNode.removeAttribute("aria-activedescendant")}_onSelectionChange(){let 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()}};ml([ze],Xi.prototype,"onDidChangeFocus",null);ml([ze],Xi.prototype,"onDidChangeSelection",null);ml([ze],Xi.prototype,"onContextMenu",null);ml([ze],Xi.prototype,"onKeyDown",null);ml([ze],Xi.prototype,"onDidFocus",null);var sM=class{constructor(e,t){this.renderer=e,this.modelProvider=t}get templateId(){return this.renderer.templateId}renderTemplate(e){return{data:this.renderer.renderTemplate(e),disposable:M.None}}renderElement(e,t,i,n){if(i.disposable&&i.disposable.dispose(),!i.data)return;let r=this.modelProvider();if(r.isResolved(e))return this.renderer.renderElement(r.get(e),e,i.data,n);let o=new hi,a=r.resolve(e,o.token);i.disposable={dispose:()=>o.cancel()},this.renderer.renderPlaceholder(e,i.data),a.then(l=>this.renderer.renderElement(l,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)}},rM=class{constructor(e,t){this.modelProvider=e,this.accessibilityProvider=t}getWidgetAriaLabel(){return this.accessibilityProvider.getWidgetAriaLabel()}getAriaLabel(e){let t=this.modelProvider();return t.isResolved(e)?this.accessibilityProvider.getAriaLabel(t.get(e)):null}};function XP(s,e){return Object.assign(Object.assign({},e),{accessibilityProvider:e.accessibilityProvider&&new rM(s,e.accessibilityProvider)})}var HS=class{constructor(e,t,i,n,r={}){let o=()=>this.model,a=n.map(l=>new sM(l,o));this.list=new Xi(e,t,i,a,XP(o,r))}updateOptions(e){this.list.updateOptions(e)}getHTMLElement(){return this.list.getHTMLElement()}get onDidFocus(){return this.list.onDidFocus}get onDidDispose(){return this.list.onDidDispose}get onMouseDblClick(){return j.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 j.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 j.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._model=e,this.list.splice(0,this.list.length,Nt(e.length))}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()}};var Qhe=new te("isWindows",ot,p("isWindows","Whether the operating system is Windows")),oM="inputFocus";var sh;(function(s){s[s.Unknown=0]="Unknown",s[s.Twistie=1]="Twistie",s[s.Element=2]="Element"})(sh||(sh={}));var oi=class extends Error{constructor(e,t){super(`TreeError [${e}] ${t}`)}},rh=class{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 Zu(s){return typeof s=="object"&&"visibility"in s&&"data"in s}function pl(s){switch(s){case!0:return 1;case!1:return 0;default:return s}}function US(s){return typeof s.collapsible=="boolean"}var $S=class{constructor(e,t,i,n={}){this.user=e,this.list=t,this.rootRef=[],this.eventBufferer=new Jo,this._onDidChangeCollapseState=new k,this.onDidChangeCollapseState=this.eventBufferer.wrapEvent(this._onDidChangeCollapseState.event),this._onDidChangeRenderNodeCount=new k,this.onDidChangeRenderNodeCount=this.eventBufferer.wrapEvent(this._onDidChangeRenderNodeCount.event),this._onDidSplice=new k,this.onDidSplice=this._onDidSplice.event,this.collapseByDefault=typeof n.collapseByDefault=="undefined"?!1:n.collapseByDefault,this.filter=n.filter,this.autoExpandSingleChildren=typeof n.autoExpandSingleChildren=="undefined"?!1:n.autoExpandSingleChildren,this.root={parent:void 0,element:i,children:[],depth:0,visibleChildrenCount:0,visibleChildIndex:-1,collapsible:!1,collapsed:!1,renderNodeCount:0,visibility:1,visible:!0,filterData:void 0}}splice(e,t,i=re.empty(),n={}){if(e.length===0)throw new oi(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,r,o){var a;n===void 0&&(n=re.empty()),o===void 0&&(o=(a=r.diffDepth)!==null&&a!==void 0?a:0);let{parentNode:l}=this.getParentNodeWithListIndex(t),c=[...n],h=t[t.length-1],d=new xn({getElements:()=>l.children.map(b=>e.getId(b.element).toString())},{getElements:()=>[...l.children.slice(0,h),...c,...l.children.slice(h+i)].map(b=>e.getId(b.element).toString())}).ComputeDiff(!1);if(d.quitEarly)return this.spliceSimple(t,i,c,r);let u=t.slice(0,-1),f=(b,w,_)=>{if(o>0)for(let v=0;v<_;v++)b--,w--,this.spliceSmart(e,[...u,b,0],Number.MAX_SAFE_INTEGER,c[w].children,r,o-1)},m=Math.min(l.children.length,h+i),g=c.length;for(let b of d.changes.sort((w,_)=>_.originalStart-w.originalStart))f(m,g,m-(b.originalStart+b.originalLength)),m=b.originalStart,g=b.modifiedStart-h,this.spliceSimple([...u,m],b.originalLength,re.slice(c,g,g+b.modifiedLength),r);f(m,g,m)}spliceSimple(e,t,i=re.empty(),{onDidCreateNode:n,onDidDeleteNode:r}){let{parentNode:o,listIndex:a,revealed:l,visible:c}=this.getParentNodeWithListIndex(e),h=[],d=re.map(i,x=>this.createTreeNode(x,o,o.visible?1:0,l,h,n)),u=e[e.length-1],f=o.children.length>0,m=0;for(let x=u;x>=0&&xS+(L.visible?L.renderNodeCount:0),0);this._updateAncestorsRenderNodeCount(o,w-x),this.list.splice(a,x,h)}if(_.length>0&&r){let x=S=>{r(S),S.children.forEach(x)};_.forEach(x)}let C=o.children.length>0;f!==C&&this.setCollapsible(e.slice(0,-1),C),this._onDidSplice.fire({insertedNodes:g,deletedNodes:_});let y=o;for(;y;){if(y.visibility===2){this.refilter();break}y=y.parent}}rerender(e){if(e.length===0)throw new oi(this.user,"Invalid tree location");let{node:t,listIndex:i,revealed:n}=this.getTreeNodeWithListIndex(e);t.visible&&n&&this.list.splice(i,1,[t])}has(e){return this.hasTreeNode(e)}getListIndex(e){let{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){let i=this.getTreeNode(e);typeof t=="undefined"&&(t=!i.collapsible);let n={collapsible:t};return this.eventBufferer.bufferEvents(()=>this._setCollapseState(e,n))}isCollapsed(e){return this.getTreeNode(e).collapsed}setCollapsed(e,t,i){let n=this.getTreeNode(e);typeof t=="undefined"&&(t=!n.collapsed);let r={collapsed:t,recursive:i||!1};return this.eventBufferer.bufferEvents(()=>this._setCollapseState(e,r))}_setCollapseState(e,t){let{node:i,listIndex:n,revealed:r}=this.getTreeNodeWithListIndex(e),o=this._setListNodeCollapseState(i,n,r,t);if(i!==this.root&&this.autoExpandSingleChildren&&o&&!US(t)&&i.collapsible&&!i.collapsed&&!t.recursive){let a=-1;for(let l=0;l-1){a=-1;break}else a=l;a>-1&&this._setCollapseState([...e,a],t)}return o}_setListNodeCollapseState(e,t,i,n){let r=this._setNodeCollapseState(e,n,!1);if(!i||!e.visible||!r)return r;let o=e.renderNodeCount,a=this.updateNodeAfterCollapseChange(e),l=o-(t===-1?0:1);return this.list.splice(t+1,l,a.slice(1)),r}_setNodeCollapseState(e,t,i){let n;if(e===this.root?n=!1:(US(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})),!US(t)&&t.recursive)for(let r of e.children)n=this._setNodeCollapseState(r,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(){let e=this.root.renderNodeCount,t=this.updateNodeAfterFilterChange(this.root);this.list.splice(0,e,t)}createTreeNode(e,t,i,n,r,o){let 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!="undefined",collapsed:typeof e.collapsed=="undefined"?this.collapseByDefault:e.collapsed,renderNodeCount:1,visibility:1,visible:!0,filterData:void 0},l=this._filterNode(a,i);a.visibility=l,n&&r.push(a);let c=e.children||re.empty(),h=n&&l!==0&&!a.collapsed,d=re.map(c,m=>this.createTreeNode(m,a,l,h,r,o)),u=0,f=1;for(let m of d)a.children.push(m),f+=m.renderNodeCount,m.visible&&(m.visibleChildIndex=u++);return a.collapsible=a.collapsible||a.children.length>0,a.visibleChildrenCount=u,a.visible=l===2?u>0:l===1,a.visible?a.collapsed||(a.renderNodeCount=f):(a.renderNodeCount=0,n&&r.pop()),o&&o(a),a}updateNodeAfterCollapseChange(e){let 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(let i of e.children)e.renderNodeCount+=this._updateNodeAfterCollapseChange(i,t);return this._onDidChangeRenderNodeCount.fire(e),e.renderNodeCount}updateNodeAfterFilterChange(e){let 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 r;if(e!==this.root){if(r=this._filterNode(e,t),r===0)return e.visible=!1,e.renderNodeCount=0,!1;n&&i.push(e)}let o=i.length;e.renderNodeCount=e===this.root?0:1;let a=!1;if(!e.collapsed||r!==0){let l=0;for(let c of e.children)a=this._updateNodeAfterFilterChange(c,r,i,n&&!e.collapsed)||a,c.visible&&(c.visibleChildIndex=l++);e.visibleChildrenCount=l}else e.visibleChildrenCount=0;return e!==this.root&&(e.visible=r===2?a:r===1),e.visible?e.collapsed||(e.renderNodeCount+=i.length-o):(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){let i=this.filter?this.filter.filter(e.element,t):1;return typeof i=="boolean"?(e.filterData=void 0,i?1:0):Zu(i)?(e.filterData=i.data,pl(i.visibility)):(e.filterData=void 0,pl(i))}hasTreeNode(e,t=this.root){if(!e||e.length===0)return!0;let[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;let[i,...n]=e;if(i<0||i>t.children.length)throw new oi(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};let{parentNode:t,listIndex:i,revealed:n,visible:r}=this.getParentNodeWithListIndex(e),o=e[e.length-1];if(o<0||o>t.children.length)throw new oi(this.user,"Invalid tree location");let a=t.children[o];return{node:a,listIndex:i,revealed:n,visible:r&&a.visible}}getParentNodeWithListIndex(e,t=this.root,i=0,n=!0,r=!0){let[o,...a]=e;if(o<0||o>t.children.length)throw new oi(this.user,"Invalid tree location");for(let l=0;lt.element));this.data=e}};function YS(s){return s instanceof $o?new lM(s):s}var cM=class{constructor(e,t){this.modelProvider=e,this.dnd=t,this.autoExpandDisposable=M.None}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&&this.dnd.onDragStart(YS(e),t)}onDragOver(e,t,i,n,r=!0){let o=this.dnd.onDragOver(YS(e),t&&t.element,i,n),a=this.autoExpandNode!==t;if(a&&(this.autoExpandDisposable.dispose(),this.autoExpandNode=t),typeof t=="undefined")return o;if(a&&typeof o!="boolean"&&o.autoExpand&&(this.autoExpandDisposable=Dh(()=>{let u=this.modelProvider(),f=u.getNodeLocation(t);u.isCollapsed(f)&&u.setCollapsed(f,!1),this.autoExpandNode=void 0},500)),typeof o=="boolean"||!o.accept||typeof o.bubble=="undefined"||o.feedback){if(!r){let u=typeof o=="boolean"?o:o.accept,f=typeof o=="boolean"?void 0:o.effect;return{accept:u,effect:f,feedback:[i]}}return o}if(o.bubble===1){let u=this.modelProvider(),f=u.getNodeLocation(t),m=u.getParentNodeLocation(f),g=u.getNode(m),b=m&&u.getListIndex(m);return this.onDragOver(e,g,b,n,!1)}let l=this.modelProvider(),c=l.getNodeLocation(t),h=l.getListIndex(c),d=l.getListRenderCount(c);return Object.assign(Object.assign({},o),{feedback:Nt(h,h+d)})}drop(e,t,i,n){this.autoExpandDisposable.dispose(),this.autoExpandNode=void 0,this.dnd.drop(YS(e),t&&t.element,i,n)}onDragEnd(e){this.dnd.onDragEnd&&this.dnd.onDragEnd(e)}};function QP(s,e){return e&&Object.assign(Object.assign({},e),{identityProvider:e.identityProvider&&{getId(t){return e.identityProvider.getId(t.element)}},dnd:e.dnd&&new cM(s,e.dnd),multipleSelectionController:e.multipleSelectionController&&{isSelectionSingleChangeEvent(t){return e.multipleSelectionController.isSelectionSingleChangeEvent(Object.assign(Object.assign({},t),{element:t.element}))},isSelectionRangeChangeEvent(t){return e.multipleSelectionController.isSelectionRangeChangeEvent(Object.assign(Object.assign({},t),{element:t.element}))}},accessibilityProvider:e.accessibilityProvider&&Object.assign(Object.assign({},e.accessibilityProvider),{getSetSize(t){let i=s(),n=i.getNodeLocation(t),r=i.getParentNodeLocation(n);return i.getNode(r).visibleChildrenCount},getPosInSet(t){return t.visibleChildIndex+1},isChecked:e.accessibilityProvider&&e.accessibilityProvider.isChecked?t=>e.accessibilityProvider.isChecked(t.element):void 0,getRole:e.accessibilityProvider&&e.accessibilityProvider.getRole?t=>e.accessibilityProvider.getRole(t.element):()=>"treeitem",getAriaLabel(t){return e.accessibilityProvider.getAriaLabel(t.element)},getWidgetAriaLabel(){return e.accessibilityProvider.getWidgetAriaLabel()},getWidgetRole:e.accessibilityProvider&&e.accessibilityProvider.getWidgetRole?()=>e.accessibilityProvider.getWidgetRole():()=>"tree",getAriaLevel:e.accessibilityProvider&&e.accessibilityProvider.getAriaLevel?t=>e.accessibilityProvider.getAriaLevel(t.element):t=>t.depth,getActiveDescendantId:e.accessibilityProvider.getActiveDescendantId&&(t=>e.accessibilityProvider.getActiveDescendantId(t.element))}),keyboardNavigationLabelProvider:e.keyboardNavigationLabelProvider&&Object.assign(Object.assign({},e.keyboardNavigationLabelProvider),{getKeyboardNavigationLabel(t){return e.keyboardNavigationLabelProvider.getKeyboardNavigationLabel(t.element)}}),enableKeyboardNavigation:e.simpleKeyboardNavigation})}var Qu=class{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&&this.delegate.setDynamicHeight(e.element,t)}},Ju;(function(s){s.None="none",s.OnHover="onHover",s.Always="always"})(Ju||(Ju={}));var hM=class{constructor(e,t=[]){this._elements=t,this.onDidChange=j.forEach(e,i=>this._elements=i)}get elements(){return this._elements}},oh=class{constructor(e,t,i,n,r={}){this.renderer=e,this.modelProvider=t,this.activeNodes=n,this.renderedElements=new Map,this.renderedNodes=new Map,this.indent=oh.DefaultIndent,this.hideTwistiesOfChildlessElements=!1,this.shouldRenderIndentGuides=!1,this.renderedIndentGuides=new Tv,this.activeIndentNodes=new Set,this.indentGuidesDisposable=M.None,this.disposables=new U,this.templateId=e.templateId,this.updateOptions(r),j.map(i,o=>o.node)(this.onDidChangeNodeTwistieState,this,this.disposables),e.onDidChangeTwistieState&&e.onDidChangeTwistieState(this.onDidChangeTwistieState,this,this.disposables)}updateOptions(e={}){if(typeof e.indent!="undefined"&&(this.indent=$i(e.indent,0,40)),typeof e.renderIndentGuides!="undefined"){let t=e.renderIndentGuides!==Ju.None;if(t!==this.shouldRenderIndentGuides&&(this.shouldRenderIndentGuides=t,this.indentGuidesDisposable.dispose(),t)){let i=new U;this.activeNodes.onDidChange(this._onDidChangeActiveNodes,this,i),this.indentGuidesDisposable=i,this._onDidChangeActiveNodes(this.activeNodes.elements)}}typeof e.hideTwistiesOfChildlessElements!="undefined"&&(this.hideTwistiesOfChildlessElements=e.hideTwistiesOfChildlessElements)}renderTemplate(e){let t=W(e,H(".monaco-tl-row")),i=W(t,H(".monaco-tl-indent")),n=W(t,H(".monaco-tl-twistie")),r=W(t,H(".monaco-tl-contents")),o=this.renderer.renderTemplate(r);return{container:e,indent:i,twistie:n,indentGuidesDisposable:M.None,templateData:o}}renderElement(e,t,i,n){typeof n=="number"&&(this.renderedNodes.set(e,{templateData:i,height:n}),this.renderedElements.set(e.element,e));let r=oh.DefaultIndent+(e.depth-1)*this.indent;i.twistie.style.paddingLeft=`${r}px`,i.indent.style.width=`${r+this.indent-16}px`,this.renderTwistie(e,i),typeof n=="number"&&this.renderIndentGuides(e,i),this.renderer.renderElement(e,t,i.templateData,n)}disposeElement(e,t,i,n){i.indentGuidesDisposable.dispose(),this.renderer.disposeElement&&this.renderer.disposeElement(e,t,i.templateData,n),typeof n=="number"&&(this.renderedNodes.delete(e),this.renderedElements.delete(e.element))}disposeTemplate(e){this.renderer.disposeTemplate(e.templateData)}onDidChangeTwistieState(e){let t=this.renderedElements.get(e);!t||this.onDidChangeNodeTwistieState(t)}onDidChangeNodeTwistieState(e){let t=this.renderedNodes.get(e);!t||(this.renderTwistie(e,t.templateData),this._onDidChangeActiveNodes(this.activeNodes.elements),this.renderIndentGuides(e,t.templateData))}renderTwistie(e,t){t.twistie.classList.remove(...KS.classNamesArray);let i=!1;this.renderer.renderTwistie&&(i=this.renderer.renderTwistie(e.element,t.twistie)),e.collapsible&&(!this.hideTwistiesOfChildlessElements||e.visibleChildrenCount>0)?(i||t.twistie.classList.add(...KS.classNamesArray),t.twistie.classList.add("collapsible"),t.twistie.classList.toggle("collapsed",e.collapsed)):t.twistie.classList.remove("collapsible","collapsed"),e.collapsible?t.container.setAttribute("aria-expanded",String(!e.collapsed)):t.container.removeAttribute("aria-expanded")}renderIndentGuides(e,t){if(Mt(t.indent),t.indentGuidesDisposable.dispose(),!this.shouldRenderIndentGuides)return;let i=new U,n=this.modelProvider(),r=e;for(;;){let o=n.getNodeLocation(r),a=n.getParentNodeLocation(o);if(!a)break;let l=n.getNode(a),c=H(".indent-guide",{style:`width: ${this.indent}px`});this.activeIndentNodes.has(l)&&c.classList.add("active"),t.indent.childElementCount===0?t.indent.appendChild(c):t.indent.insertBefore(c,t.indent.firstElementChild),this.renderedIndentGuides.add(l,c),i.add(oe(()=>this.renderedIndentGuides.delete(l,c))),r=l}t.indentGuidesDisposable=i}_onDidChangeActiveNodes(e){if(!this.shouldRenderIndentGuides)return;let t=new Set,i=this.modelProvider();e.forEach(n=>{let r=i.getNodeLocation(n);try{let o=i.getParentNodeLocation(r);n.collapsible&&n.children.length>0&&!n.collapsed?t.add(n):o&&t.add(i.getNode(o))}catch(o){}}),this.activeIndentNodes.forEach(n=>{t.has(n)||this.renderedIndentGuides.forEach(n,r=>r.classList.remove("active"))}),t.forEach(n=>{this.activeIndentNodes.has(n)||this.renderedIndentGuides.forEach(n,r=>r.classList.add("active"))}),this.activeIndentNodes=t}dispose(){this.renderedNodes.clear(),this.renderedElements.clear(),this.indentGuidesDisposable.dispose(),me(this.disposables)}};oh.DefaultIndent=8;var dM=class{constructor(e,t,i){this.tree=e,this.keyboardNavigationLabelProvider=t,this._filter=i,this._totalCount=0,this._matchCount=0,this._pattern="",this._lowercasePattern="",this.disposables=new U,e.onWillRefilter(this.reset,this,this.disposables)}get totalCount(){return this._totalCount}get matchCount(){return this._matchCount}set pattern(e){this._pattern=e,this._lowercasePattern=e.toLowerCase()}filter(e,t){if(this._filter){let r=this._filter.filter(e,t);if(this.tree.options.simpleKeyboardNavigation)return r;let o;if(typeof r=="boolean"?o=r?1:0:Zu(r)?o=pl(r.visibility):o=r,o===0)return!1}if(this._totalCount++,this.tree.options.simpleKeyboardNavigation||!this._pattern)return this._matchCount++,{data:Ho.Default,visibility:!0};let i=this.keyboardNavigationLabelProvider.getKeyboardNavigationLabel(e),n=Array.isArray(i)?i:[i];for(let r of n){let o=r&&r.toString();if(typeof o=="undefined")return{data:Ho.Default,visibility:!0};let a=Hu(this._pattern,this._lowercasePattern,0,o,o.toLowerCase(),0,!0);if(a)return this._matchCount++,n.length===1?{data:a,visibility:!0}:{data:{label:o,score:a},visibility:!0}}return this.tree.options.filterOnType?2:{data:Ho.Default,visibility:!0}}reset(){this._totalCount=0,this._matchCount=0}dispose(){me(this.disposables)}},uM=class{constructor(e,t,i,n,r){this.tree=e,this.view=i,this.filter=n,this.keyboardNavigationDelegate=r,this._enabled=!1,this._pattern="",this._empty=!1,this._onDidChangeEmptyState=new k,this.positionClassName="ne",this.automaticKeyboardNavigation=!0,this.triggered=!1,this._onDidChangePattern=new k,this.enabledDisposables=new U,this.disposables=new U,this.domNode=H(`.monaco-list-type-filter.${this.positionClassName}`),this.domNode.draggable=!0,this.disposables.add(O(this.domNode,"dragstart",()=>this.onDragStart())),this.messageDomNode=W(i.getHTMLElement(),H(".monaco-list-type-filter-message")),this.labelDomNode=W(this.domNode,H("span.label"));let o=W(this.domNode,H(".controls"));this._filterOnType=!!e.options.filterOnType,this.filterOnTypeDomNode=W(o,H("input.filter")),this.filterOnTypeDomNode.type="checkbox",this.filterOnTypeDomNode.checked=this._filterOnType,this.filterOnTypeDomNode.tabIndex=-1,this.updateFilterOnTypeTitleAndIcon(),this.disposables.add(O(this.filterOnTypeDomNode,"input",()=>this.onDidChangeFilterOnType())),this.clearDomNode=W(o,H("button.clear"+aM.cssSelector)),this.clearDomNode.tabIndex=-1,this.clearDomNode.title=p("clear","Clear"),this.keyboardNavigationEventFilter=e.options.keyboardNavigationEventFilter,t.onDidSplice(this.onDidSpliceModel,this,this.disposables),this.updateOptions(e.options)}get enabled(){return this._enabled}get pattern(){return this._pattern}get filterOnType(){return this._filterOnType}updateOptions(e){e.simpleKeyboardNavigation?this.disable():this.enable(),typeof e.filterOnType!="undefined"&&(this._filterOnType=!!e.filterOnType,this.filterOnTypeDomNode.checked=this._filterOnType,this.updateFilterOnTypeTitleAndIcon()),typeof e.automaticKeyboardNavigation!="undefined"&&(this.automaticKeyboardNavigation=e.automaticKeyboardNavigation),this.tree.refilter(),this.render(),this.automaticKeyboardNavigation||this.onEventOrInput("")}enable(){if(this._enabled)return;let e=this.enabledDisposables.add(new Ee(this.view.getHTMLElement(),"keydown")),t=j.chain(e.event).filter(n=>!xr(n.target)||n.target===this.filterOnTypeDomNode).filter(n=>n.key!=="Dead"&&!/^Media/.test(n.key)).map(n=>new De(n)).filter(this.keyboardNavigationEventFilter||(()=>!0)).filter(()=>this.automaticKeyboardNavigation||this.triggered).filter(n=>this.keyboardNavigationDelegate.mightProducePrintableCharacter(n)&&!(n.keyCode===18||n.keyCode===16||n.keyCode===15||n.keyCode===17)||(this.pattern.length>0||this.triggered)&&(n.keyCode===9||n.keyCode===1)&&!n.altKey&&!n.ctrlKey&&!n.metaKey||n.keyCode===1&&(ee?n.altKey&&!n.metaKey:n.ctrlKey)&&!n.shiftKey).forEach(n=>{n.stopPropagation(),n.preventDefault()}).event,i=this.enabledDisposables.add(new Ee(this.clearDomNode,"click"));j.chain(j.any(t,i.event)).event(this.onEventOrInput,this,this.enabledDisposables),this.filter.pattern="",this.tree.refilter(),this.render(),this._enabled=!0,this.triggered=!1}disable(){!this._enabled||(this.domNode.remove(),this.enabledDisposables.clear(),this.tree.refilter(),this.render(),this._enabled=!1,this.triggered=!1)}onEventOrInput(e){typeof e=="string"?this.onInput(e):e instanceof MouseEvent||e.keyCode===9||e.keyCode===1&&(ee?e.altKey:e.ctrlKey)?this.onInput(""):e.keyCode===1?this.onInput(this.pattern.length===0?"":this.pattern.substr(0,this.pattern.length-1)):this.onInput(this.pattern+e.browserEvent.key)}onInput(e){let t=this.view.getHTMLElement();e&&!this.domNode.parentElement?t.append(this.domNode):!e&&this.domNode.parentElement&&(this.domNode.remove(),this.tree.domFocus()),this._pattern=e,this._onDidChangePattern.fire(e),this.filter.pattern=e,this.tree.refilter(),e&&this.tree.focusNext(0,!0,void 0,n=>!Ho.isDefault(n.filterData));let i=this.tree.getFocus();if(i.length>0){let n=i[0];this.tree.getRelativeTop(n)===null&&this.tree.reveal(n,.5)}this.render(),e||(this.triggered=!1)}onDragStart(){let e=this.view.getHTMLElement(),{left:t}=ti(e),i=e.clientWidth,n=i/2,r=this.domNode.clientWidth,o=new U,a=this.positionClassName,l=()=>{switch(a){case"nw":this.domNode.style.top="4px",this.domNode.style.left="4px";break;case"ne":this.domNode.style.top="4px",this.domNode.style.left=`${i-r-6}px`;break}},c=d=>{d.preventDefault();let u=d.clientX-t;d.dataTransfer&&(d.dataTransfer.dropEffect="none"),u{this.positionClassName=a,this.domNode.className=`monaco-list-type-filter ${this.positionClassName}`,this.domNode.style.top="",this.domNode.style.left="",me(o)};l(),this.domNode.classList.remove(a),this.domNode.classList.add("dragging"),o.add(oe(()=>this.domNode.classList.remove("dragging"))),o.add(O(document,"dragover",d=>c(d))),o.add(O(this.domNode,"dragend",()=>h())),Yn.CurrentDragAndDropData=new $0("vscode-ui"),o.add(oe(()=>Yn.CurrentDragAndDropData=void 0))}onDidSpliceModel(){!this._enabled||this.pattern.length===0||(this.tree.refilter(),this.render())}onDidChangeFilterOnType(){this.tree.updateOptions({filterOnType:this.filterOnTypeDomNode.checked}),this.tree.refilter(),this.tree.domFocus(),this.render(),this.updateFilterOnTypeTitleAndIcon()}updateFilterOnTypeTitleAndIcon(){this.filterOnType?(this.filterOnTypeDomNode.classList.remove(...GS.classNamesArray),this.filterOnTypeDomNode.classList.add(...qS.classNamesArray),this.filterOnTypeDomNode.title=p("disable filter on type","Disable Filter on Type")):(this.filterOnTypeDomNode.classList.remove(...qS.classNamesArray),this.filterOnTypeDomNode.classList.add(...GS.classNamesArray),this.filterOnTypeDomNode.title=p("enable filter on type","Enable Filter on Type"))}render(){let e=this.filter.totalCount>0&&this.filter.matchCount===0;this.pattern&&this.tree.options.filterOnType&&e?(this.messageDomNode.textContent=p("empty","No elements found"),this._empty=!0):(this.messageDomNode.innerText="",this._empty=!1),this.domNode.classList.toggle("no-matches",e),this.domNode.title=p("found","Matched {0} out of {1} elements",this.filter.matchCount,this.filter.totalCount),this.labelDomNode.textContent=this.pattern.length>16?"\u2026"+this.pattern.substr(this.pattern.length-16):this.pattern,this._onDidChangeEmptyState.fire(this._empty)}shouldAllowFocus(e){return!this.enabled||!this.pattern||this.filterOnType||this.filter.totalCount>0&&this.filter.matchCount<=1?!0:!Ho.isDefault(e.filterData)}dispose(){this._enabled&&(this.domNode.remove(),this.enabledDisposables.dispose(),this._enabled=!1,this.triggered=!1),this._onDidChangePattern.dispose(),me(this.disposables)}};function fM(s){let e=sh.Unknown;return Cb(s.browserEvent.target,"monaco-tl-twistie","monaco-tl-row")?e=sh.Twistie:Cb(s.browserEvent.target,"monaco-tl-contents","monaco-tl-row")&&(e=sh.Element),{browserEvent:s.browserEvent,element:s.element?s.element.element:null,target:e}}function r_(s,e){e(s),s.children.forEach(t=>r_(t,e))}var o_=class{constructor(e,t){this.getFirstViewElementWithTrait=e,this.identityProvider=t,this.nodes=[],this._onDidChange=new k,this.onDidChange=this._onDidChange.event}get nodeSet(){return this._nodeSet||(this._nodeSet=this.createNodeSet()),this._nodeSet}set(e,t){var i;!((i=t)===null||i===void 0?void 0:i.__forceEvent)&&Ri(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){let 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){let l=this.createNodeSet(),c=h=>l.delete(h);t.forEach(h=>r_(h,c)),this.set([...l.values()]);return}let i=new Set,n=l=>i.add(this.identityProvider.getId(l.element).toString());t.forEach(l=>r_(l,n));let r=new Map,o=l=>r.set(this.identityProvider.getId(l.element).toString(),l);e.forEach(l=>r_(l,o));let a=[];for(let l of this.nodes){let c=this.identityProvider.getId(l.element).toString();if(!i.has(c))a.push(l);else{let d=r.get(c);d&&a.push(d)}}if(this.nodes.length>0&&a.length===0){let l=this.getFirstViewElementWithTrait();l&&a.push(l)}this._set(a,!0)}createNodeSet(){let e=new Set;for(let t of this.nodes)e.add(t);return e}},mM=class extends n_{constructor(e,t){super(e);this.tree=t}onViewPointer(e){if(xr(e.browserEvent.target)||gl(e.browserEvent.target))return;let t=e.element;if(!t)return super.onViewPointer(e);if(this.isSelectionRangeChangeEvent(e)||this.isSelectionSingleChangeEvent(e))return super.onViewPointer(e);let 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,r=!1;if(typeof this.tree.expandOnlyOnTwistieClick=="function"?r=this.tree.expandOnlyOnTwistieClick(t.element):r=!!this.tree.expandOnlyOnTwistieClick,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){let o=this.tree.model,a=o.getNodeLocation(t),l=e.browserEvent.altKey;if(this.tree.setFocus([a]),o.setCollapsed(a,void 0,l),r&&n)return}super.onViewPointer(e)}onDoubleClick(e){e.browserEvent.target.classList.contains("monaco-tl-twistie")||!this.tree.expandOnDoubleClick||super.onDoubleClick(e)}},gM=class extends Xi{constructor(e,t,i,n,r,o,a,l){super(e,t,i,n,l);this.focusTrait=r,this.selectionTrait=o,this.anchorTrait=a}createMouseController(e){return new mM(this,e.tree)}splice(e,t,i=[]){if(super.splice(e,t,i),i.length===0)return;let n=[],r=[],o;i.forEach((a,l)=>{this.focusTrait.has(a)&&n.push(e+l),this.selectionTrait.has(a)&&r.push(e+l),this.anchorTrait.has(a)&&(o=e+l)}),n.length>0&&super.setFocus(gw([...super.getFocus(),...n])),r.length>0&&super.setSelection(gw([...super.getSelection(),...r])),typeof o=="number"&&super.setAnchor(o)}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=="undefined"?this.anchorTrait.set([]):this.anchorTrait.set([this.element(e)]))}},ef=class{constructor(e,t,i,n,r={}){this._options=r,this.eventBufferer=new Jo,this.disposables=new U,this._onWillRefilter=new k,this.onWillRefilter=this._onWillRefilter.event,this._onDidUpdateOptions=new k;let o=new Qu(i),a=new Lf,l=new Lf,c=new hM(l.event);this.renderers=n.map(u=>new oh(u,()=>this.model,a.event,c,r));for(let u of this.renderers)this.disposables.add(u);let h;r.keyboardNavigationLabelProvider&&(h=new dM(this,r.keyboardNavigationLabelProvider,r.filter),r=Object.assign(Object.assign({},r),{filter:h}),this.disposables.add(h)),this.focus=new o_(()=>this.view.getFocusedElements()[0],r.identityProvider),this.selection=new o_(()=>this.view.getSelectedElements()[0],r.identityProvider),this.anchor=new o_(()=>this.view.getAnchorElement(),r.identityProvider),this.view=new gM(e,t,o,this.renderers,this.focus,this.selection,this.anchor,Object.assign(Object.assign({},QP(()=>this.model,r)),{tree:this})),this.model=this.createModel(e,this.view,r),a.input=this.model.onDidChangeCollapseState;let d=j.forEach(this.model.onDidSplice,u=>{this.eventBufferer.bufferEvents(()=>{this.focus.onDidModelSplice(u),this.selection.onDidModelSplice(u)})});if(d(()=>null,null,this.disposables),l.input=j.chain(j.any(d,this.focus.onDidChange,this.selection.onDidChange)).debounce(()=>null,0).map(()=>{let u=new Set;for(let f of this.focus.getNodes())u.add(f);for(let f of this.selection.getNodes())u.add(f);return[...u.values()]}).event,r.keyboardSupport!==!1){let u=j.chain(this.view.onKeyDown).filter(f=>!xr(f.target)).map(f=>new De(f));u.filter(f=>f.keyCode===15).on(this.onLeftArrow,this,this.disposables),u.filter(f=>f.keyCode===17).on(this.onRightArrow,this,this.disposables),u.filter(f=>f.keyCode===10).on(this.onSpace,this,this.disposables)}if(r.keyboardNavigationLabelProvider){let u=r.keyboardNavigationDelegate||WS;this.typeFilterController=new uM(this,this.model,this.view,h,u),this.focusNavigationFilter=f=>this.typeFilterController.shouldAllowFocus(f),this.disposables.add(this.typeFilterController)}this.styleElement=kt(this.view.getHTMLElement()),this.getHTMLElement().classList.toggle("always",this._options.renderIndentGuides===Ju.Always)}get onDidChangeFocus(){return this.eventBufferer.wrapEvent(this.focus.onDidChange)}get onDidChangeSelection(){return this.eventBufferer.wrapEvent(this.selection.onDidChange)}get onMouseDblClick(){return j.map(this.view.onMouseDblClick,fM)}get onPointer(){return j.map(this.view.onPointer,fM)}get onDidFocus(){return this.view.onDidFocus}get onDidChangeCollapseState(){return this.model.onDidChangeCollapseState}get expandOnDoubleClick(){return typeof this._options.expandOnDoubleClick=="undefined"?!0:this._options.expandOnDoubleClick}get expandOnlyOnTwistieClick(){return typeof this._options.expandOnlyOnTwistieClick=="undefined"?!0:this._options.expandOnlyOnTwistieClick}get onDidDispose(){return this.view.onDidDispose}updateOptions(e={}){this._options=Object.assign(Object.assign({},this._options),e);for(let t of this.renderers)t.updateOptions(e);this.view.updateOptions(Object.assign(Object.assign({},this._options),{enableKeyboardNavigation:this._options.simpleKeyboardNavigation})),this.typeFilterController&&this.typeFilterController.updateOptions(this._options),this._onDidUpdateOptions.fire(this._options),this.getHTMLElement().classList.toggle("always",this._options.renderIndentGuides===Ju.Always)}get options(){return this._options}getHTMLElement(){return this.view.getHTMLElement()}get scrollTop(){return this.view.scrollTop}set scrollTop(e){this.view.scrollTop=e}domFocus(){this.view.domFocus()}layout(e,t){this.view.layout(e,t)}style(e){let 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 { border-color: ${e.treeIndentGuidesStroke.transparent(.4)}; }`),i.push(`.monaco-list${t} .monaco-tl-indent > .indent-guide.active { border-color: ${e.treeIndentGuidesStroke}; }`)),this.styleElement.textContent=i.join(` +`),this.view.style(e)}collapse(e,t=!1){return this.model.setCollapsed(e,!0,t)}expand(e,t=!1){return this.model.setCollapsed(e,!1,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){let i=e.map(r=>this.model.getNode(r));this.selection.set(i,t);let n=e.map(r=>this.model.getListIndex(r)).filter(r=>r>-1);this.view.setSelection(n,t,!0)}getSelection(){return this.selection.get()}setFocus(e,t){let i=e.map(r=>this.model.getNode(r));this.focus.set(i,t);let n=e.map(r=>this.model.getListIndex(r)).filter(r=>r>-1);this.view.setFocus(n,t,!0)}focusNext(e=1,t=!1,i,n=this.focusNavigationFilter){this.view.focusNext(e,t,i,n)}getFocus(){return this.focus.get()}reveal(e,t){this.model.expandTo(e);let i=this.model.getListIndex(e);i!==-1&&this.view.reveal(i,t)}getRelativeTop(e){let t=this.model.getListIndex(e);return t===-1?null:this.view.getRelativeTop(t)}onLeftArrow(e){e.preventDefault(),e.stopPropagation();let t=this.view.getFocusedElements();if(t.length===0)return;let i=t[0],n=this.model.getNodeLocation(i);if(!this.model.setCollapsed(n,!0)){let o=this.model.getParentNodeLocation(n);if(!o)return;let a=this.model.getListIndex(o);this.view.reveal(a),this.view.setFocus([a])}}onRightArrow(e){e.preventDefault(),e.stopPropagation();let t=this.view.getFocusedElements();if(t.length===0)return;let i=t[0],n=this.model.getNodeLocation(i);if(!this.model.setCollapsed(n,!1)){if(!i.children.some(l=>l.visible))return;let[o]=this.view.getFocus(),a=o+1;this.view.reveal(a),this.view.setFocus([a])}}onSpace(e){e.preventDefault(),e.stopPropagation();let t=this.view.getFocusedElements();if(t.length===0)return;let i=t[0],n=this.model.getNodeLocation(i),r=e.browserEvent.altKey;this.model.setCollapsed(n,void 0,r)}dispose(){me(this.disposables),this.view.dispose()}};var _l=class{constructor(e,t,i={}){this.user=e,this.rootRef=null,this.nodes=new Map,this.nodesByIdentity=new Map,this.model=new $S(e,t,null,i),this.onDidSplice=this.model.onDidSplice,this.onDidChangeCollapseState=this.model.onDidChangeCollapseState,this.onDidChangeRenderNodeCount=this.model.onDidChangeRenderNodeCount,i.sorter&&(this.sorter={compare(n,r){return i.sorter.compare(n.element,r.element)}}),this.identityProvider=i.identityProvider}setChildren(e,t=re.empty(),i={}){let n=this.getElementLocation(e);this._setChildren(n,this.preserveCollapseState(t),i)}_setChildren(e,t=re.empty(),i){let n=new Set,r=new Set,o=l=>{var c;if(l.element===null)return;let h=l;if(n.add(h.element),this.nodes.set(h.element,h),this.identityProvider){let d=this.identityProvider.getId(h.element).toString();r.add(d),this.nodesByIdentity.set(d,h)}(c=i.onDidCreateNode)===null||c===void 0||c.call(i,h)},a=l=>{var c;if(l.element===null)return;let h=l;if(n.has(h.element)||this.nodes.delete(h.element),this.identityProvider){let d=this.identityProvider.getId(h.element).toString();r.has(d)||this.nodesByIdentity.delete(d)}(c=i.onDidDeleteNode)===null||c===void 0||c.call(i,h)};this.model.splice([...e,0],Number.MAX_VALUE,t,Object.assign(Object.assign({},i),{onDidCreateNode:o,onDidDeleteNode:a}))}preserveCollapseState(e=re.empty()){return this.sorter&&(e=[...e].sort(this.sorter.compare.bind(this.sorter))),re.map(e,t=>{let i=this.nodes.get(t.element);if(!i&&this.identityProvider){let o=this.identityProvider.getId(t.element).toString();i=this.nodesByIdentity.get(o)}if(!i)return Object.assign(Object.assign({},t),{children:this.preserveCollapseState(t.children)});let n=typeof t.collapsible=="boolean"?t.collapsible:i.collapsible,r=typeof t.collapsed!="undefined"?t.collapsed:i.collapsed;return Object.assign(Object.assign({},t),{collapsible:n,collapsed:r,children:this.preserveCollapseState(t.children)})})}rerender(e){let t=this.getElementLocation(e);this.model.rerender(t)}has(e){return this.nodes.has(e)}getListIndex(e){let t=this.getElementLocation(e);return this.model.getListIndex(t)}getListRenderCount(e){let t=this.getElementLocation(e);return this.model.getListRenderCount(t)}isCollapsible(e){let t=this.getElementLocation(e);return this.model.isCollapsible(t)}setCollapsible(e,t){let i=this.getElementLocation(e);return this.model.setCollapsible(i,t)}isCollapsed(e){let t=this.getElementLocation(e);return this.model.isCollapsed(t)}setCollapsed(e,t,i){let n=this.getElementLocation(e);return this.model.setCollapsed(n,t,i)}expandTo(e){let 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);let t=this.nodes.get(e);if(!t)throw new oi(this.user,`Tree element not found: ${e}`);return t}getNodeLocation(e){return e.element}getParentNodeLocation(e){if(e===null)throw new oi(this.user,"Invalid getParentNodeLocation call");let t=this.nodes.get(e);if(!t)throw new oi(this.user,`Tree element not found: ${e}`);let i=this.model.getNodeLocation(t),n=this.model.getParentNodeLocation(i);return this.model.getNode(n).element}getElementLocation(e){if(e===null)return[];let t=this.nodes.get(e);if(!t)throw new oi(this.user,`Tree element not found: ${e}`);return this.model.getNodeLocation(t)}};function a_(s){let e=[s.element],t=s.incompressible||!1;return{element:{elements:e,incompressible:t},children:re.map(re.from(s.children),a_),collapsible:s.collapsible,collapsed:s.collapsed}}function l_(s){let e=[s.element],t=s.incompressible||!1,i,n;for(;[n,i]=re.consume(re.from(s.children),2),!(n.length!==1||n[0].incompressible);)s=n[0],e.push(s.element);return{element:{elements:e,incompressible:t},children:re.map(re.concat(n,i),l_),collapsible:s.collapsible,collapsed:s.collapsed}}function ZS(s,e=0){let t;return eZS(i,0)),e===0&&s.element.incompressible?{element:s.element.elements[e],children:t,incompressible:!0,collapsible:s.collapsible,collapsed:s.collapsed}:{element:s.element.elements[e],children:t,collapsible:s.collapsible,collapsed:s.collapsed}}function pM(s){return ZS(s,0)}function _M(s,e,t){return s.element===e?Object.assign(Object.assign({},s),{children:t}):Object.assign(Object.assign({},s),{children:re.map(re.from(s.children),i=>_M(i,e,t))})}var JP=s=>({getId(e){return e.elements.map(t=>s.getId(t).toString()).join("\0")}}),bM=class{constructor(e,t,i={}){this.user=e,this.rootRef=null,this.nodes=new Map,this.model=new _l(e,t,i),this.enabled=typeof i.compressionEnabled=="undefined"?!0:i.compressionEnabled,this.identityProvider=i.identityProvider}get onDidSplice(){return this.model.onDidSplice}get onDidChangeCollapseState(){return this.model.onDidChangeCollapseState}get onDidChangeRenderNodeCount(){return this.model.onDidChangeRenderNodeCount}setChildren(e,t=re.empty(),i){let n=i.diffIdentityProvider&&JP(i.diffIdentityProvider);if(e===null){let f=re.map(t,this.enabled?l_:a_);this._setChildren(null,f,{diffIdentityProvider:n,diffDepth:1/0});return}let r=this.nodes.get(e);if(!r)throw new Error("Unknown compressed tree node");let o=this.model.getNode(r),a=this.model.getParentNodeLocation(r),l=this.model.getNode(a),c=pM(o),h=_M(c,e,t),d=(this.enabled?l_:a_)(h),u=l.children.map(f=>f===o?d:f);this._setChildren(l.element,u,{diffIdentityProvider:n,diffDepth:o.depth-l.depth})}setCompressionEnabled(e){if(e===this.enabled)return;this.enabled=e;let i=this.model.getNode().children,n=re.map(i,pM),r=re.map(n,e?l_:a_);this._setChildren(null,r,{diffIdentityProvider:this.identityProvider,diffDepth:1/0})}_setChildren(e,t,i){let n=new Set,r=a=>{for(let l of a.element.elements)n.add(l),this.nodes.set(l,a.element)},o=a=>{for(let l of a.element.elements)n.has(l)||this.nodes.delete(l)};this.model.setChildren(e,t,Object.assign(Object.assign({},i),{onDidCreateNode:r,onDidDeleteNode:o}))}has(e){return this.nodes.has(e)}getListIndex(e){let t=this.getCompressedNode(e);return this.model.getListIndex(t)}getListRenderCount(e){let t=this.getCompressedNode(e);return this.model.getListRenderCount(t)}getNode(e){if(typeof e=="undefined")return this.model.getNode();let t=this.getCompressedNode(e);return this.model.getNode(t)}getNodeLocation(e){let t=this.model.getNodeLocation(e);return t===null?null:t.elements[t.elements.length-1]}getParentNodeLocation(e){let t=this.getCompressedNode(e),i=this.model.getParentNodeLocation(t);return i===null?null:i.elements[i.elements.length-1]}isCollapsible(e){let t=this.getCompressedNode(e);return this.model.isCollapsible(t)}setCollapsible(e,t){let i=this.getCompressedNode(e);return this.model.setCollapsible(i,t)}isCollapsed(e){let t=this.getCompressedNode(e);return this.model.isCollapsed(t)}setCollapsed(e,t,i){let n=this.getCompressedNode(e);return this.model.setCollapsed(n,t,i)}expandTo(e){let t=this.getCompressedNode(e);this.model.expandTo(t)}rerender(e){let t=this.getCompressedNode(e);this.model.rerender(t)}refilter(){this.model.refilter()}getCompressedNode(e){if(e===null)return null;let t=this.nodes.get(e);if(!t)throw new oi(this.user,`Tree element not found: ${e}`);return t}},e5=s=>s[s.length-1],c_=class{constructor(e,t){this.unwrapper=e,this.node=t}get element(){return this.node.element===null?null:this.unwrapper(this.node.element)}get children(){return this.node.children.map(e=>new c_(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}};function t5(s,e){return{splice(t,i,n){e.splice(t,i,n.map(r=>s.map(r)))},updateElementHeight(t,i){e.updateElementHeight(t,i)}}}function i5(s,e){return Object.assign(Object.assign({},e),{identityProvider:e.identityProvider&&{getId(t){return e.identityProvider.getId(s(t))}},sorter:e.sorter&&{compare(t,i){return e.sorter.compare(t.elements[0],i.elements[0])}},filter:e.filter&&{filter(t,i){return e.filter.filter(s(t),i)}}})}var XS=class{constructor(e,t,i={}){this.rootRef=null,this.elementMapper=i.elementMapper||e5;let n=r=>this.elementMapper(r.elements);this.nodeMapper=new rh(r=>new c_(n,r)),this.model=new bM(e,t5(this.nodeMapper,t),i5(n,i))}get onDidSplice(){return j.map(this.model.onDidSplice,({insertedNodes:e,deletedNodes:t})=>({insertedNodes:e.map(i=>this.nodeMapper.map(i)),deletedNodes:t.map(i=>this.nodeMapper.map(i))}))}get onDidChangeCollapseState(){return j.map(this.model.onDidChangeCollapseState,({node:e,deep:t})=>({node:this.nodeMapper.map(e),deep:t}))}get onDidChangeRenderNodeCount(){return j.map(this.model.onDidChangeRenderNodeCount,e=>this.nodeMapper.map(e))}setChildren(e,t=re.empty(),i={}){this.model.setChildren(e,t,i)}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)}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()}getCompressedTreeNode(e=null){return this.model.getNode(e)}};var n5=function(s,e,t,i){var n=arguments.length,r=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(s,e,t,i);else for(var a=s.length-1;a>=0;a--)(o=s[a])&&(r=(n<3?o(r):n>3?o(e,t,r):o(e,t))||r);return n>3&&r&&Object.defineProperty(e,t,r),r},ah=class extends ef{constructor(e,t,i,n,r={}){super(e,t,i,n,r)}get onDidChangeCollapseState(){return this.model.onDidChangeCollapseState}setChildren(e,t=re.empty(),i){this.model.setChildren(e,t,i)}rerender(e){if(e===void 0){this.view.rerender();return}this.model.rerender(e)}hasElement(e){return this.model.has(e)}createModel(e,t,i){return new _l(e,t,i)}},QS=class{constructor(e,t){this._compressedTreeNodeProvider=e,this.renderer=t,this.templateId=t.templateId,t.onDidChangeTwistieState&&(this.onDidChangeTwistieState=t.onDidChangeTwistieState)}get compressedTreeNodeProvider(){return this._compressedTreeNodeProvider()}renderTemplate(e){let t=this.renderer.renderTemplate(e);return{compressedTreeNode:void 0,data:t}}renderElement(e,t,i,n){let r=this.compressedTreeNodeProvider.getCompressedTreeNode(e.element);r.element.elements.length===1?(i.compressedTreeNode=void 0,this.renderer.renderElement(e,t,i.data,n)):(i.compressedTreeNode=r,this.renderer.renderCompressedElements(r,t,i.data,n))}disposeElement(e,t,i,n){i.compressedTreeNode?this.renderer.disposeCompressedElements&&this.renderer.disposeCompressedElements(i.compressedTreeNode,t,i.data,n):this.renderer.disposeElement&&this.renderer.disposeElement(e,t,i.data,n)}disposeTemplate(e){this.renderer.disposeTemplate(e.data)}renderTwistie(e,t){return this.renderer.renderTwistie?this.renderer.renderTwistie(e,t):!1}};n5([ze],QS.prototype,"compressedTreeNodeProvider",null);function s5(s,e){return e&&Object.assign(Object.assign({},e),{keyboardNavigationLabelProvider:e.keyboardNavigationLabelProvider&&{getKeyboardNavigationLabel(t){let i;try{i=s().getCompressedTreeNode(t)}catch(n){return e.keyboardNavigationLabelProvider.getKeyboardNavigationLabel(t)}return i.element.elements.length===1?e.keyboardNavigationLabelProvider.getKeyboardNavigationLabel(t):e.keyboardNavigationLabelProvider.getCompressedNodeKeyboardNavigationLabel(i.element.elements)}}})}var tf=class extends ah{constructor(e,t,i,n,r={}){let o=()=>this,a=n.map(l=>new QS(o,l));super(e,t,i,a,s5(o,r))}setChildren(e,t=re.empty(),i){this.model.setChildren(e,t,i)}createModel(e,t,i){return new XS(e,t,i)}updateOptions(e={}){super.updateOptions(e),typeof e.compressionEnabled!="undefined"&&this.model.setCompressionEnabled(e.compressionEnabled)}getCompressedTreeNode(e=null){return this.model.getCompressedTreeNode(e)}};var Ko=function(s,e,t,i){function n(r){return r instanceof t?r:new t(function(o){o(r)})}return new(t||(t=Promise))(function(r,o){function a(h){try{c(i.next(h))}catch(d){o(d)}}function l(h){try{c(i.throw(h))}catch(d){o(d)}}function c(h){h.done?r(h.value):n(h.value).then(a,l)}c((i=i.apply(s,e||[])).next())})};function JS(s){return Object.assign(Object.assign({},s),{children:[],refreshPromise:void 0,stale:!0,slow:!1,collapsedByDefault:void 0})}function e1(s,e){return e.parent?e.parent===s?!0:e1(s,e.parent):!1}function r5(s,e){return s===e||e1(s,e)||e1(e,s)}var h_=class{constructor(e){this.node=e}get element(){return this.node.element.element}get children(){return this.node.children.map(e=>new h_(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}},wM=class{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(...Xu.classNamesArray),!0):(t.classList.remove(...Xu.classNamesArray),!1)}disposeElement(e,t,i,n){this.renderer.disposeElement&&this.renderer.disposeElement(this.nodeMapper.map(e),t,i.templateData,n)}disposeTemplate(e){this.renderer.disposeTemplate(e.templateData)}dispose(){this.renderedNodes.clear()}};function vM(s){return{browserEvent:s.browserEvent,elements:s.elements.map(e=>e.element)}}function CM(s){return{browserEvent:s.browserEvent,element:s.element&&s.element.element,target:s.target}}var SM=class extends $o{constructor(e){super(e.elements.map(t=>t.element));this.data=e}};function t1(s){return s instanceof $o?new SM(s):s}var yM=class{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&&this.dnd.onDragStart(t1(e),t)}onDragOver(e,t,i,n,r=!0){return this.dnd.onDragOver(t1(e),t&&t.element,i,n)}drop(e,t,i,n){this.dnd.drop(t1(e),t&&t.element,i,n)}onDragEnd(e){this.dnd.onDragEnd&&this.dnd.onDragEnd(e)}};function LM(s){return s&&Object.assign(Object.assign({},s),{collapseByDefault:!0,identityProvider:s.identityProvider&&{getId(e){return s.identityProvider.getId(e.element)}},dnd:s.dnd&&new yM(s.dnd),multipleSelectionController:s.multipleSelectionController&&{isSelectionSingleChangeEvent(e){return s.multipleSelectionController.isSelectionSingleChangeEvent(Object.assign(Object.assign({},e),{element:e.element}))},isSelectionRangeChangeEvent(e){return s.multipleSelectionController.isSelectionRangeChangeEvent(Object.assign(Object.assign({},e),{element:e.element}))}},accessibilityProvider:s.accessibilityProvider&&Object.assign(Object.assign({},s.accessibilityProvider),{getPosInSet:void 0,getSetSize:void 0,getRole:s.accessibilityProvider.getRole?e=>s.accessibilityProvider.getRole(e.element):()=>"treeitem",isChecked:s.accessibilityProvider.isChecked?e=>{var t;return!!((t=s.accessibilityProvider)===null||t===void 0?void 0:t.isChecked(e.element))}:void 0,getAriaLabel(e){return s.accessibilityProvider.getAriaLabel(e.element)},getWidgetAriaLabel(){return s.accessibilityProvider.getWidgetAriaLabel()},getWidgetRole:s.accessibilityProvider.getWidgetRole?()=>s.accessibilityProvider.getWidgetRole():()=>"tree",getAriaLevel:s.accessibilityProvider.getAriaLevel&&(e=>s.accessibilityProvider.getAriaLevel(e.element)),getActiveDescendantId:s.accessibilityProvider.getActiveDescendantId&&(e=>s.accessibilityProvider.getActiveDescendantId(e.element))}),filter:s.filter&&{filter(e,t){return s.filter.filter(e.element,t)}},keyboardNavigationLabelProvider:s.keyboardNavigationLabelProvider&&Object.assign(Object.assign({},s.keyboardNavigationLabelProvider),{getKeyboardNavigationLabel(e){return s.keyboardNavigationLabelProvider.getKeyboardNavigationLabel(e.element)}}),sorter:void 0,expandOnlyOnTwistieClick:typeof s.expandOnlyOnTwistieClick=="undefined"?void 0:typeof s.expandOnlyOnTwistieClick!="function"?s.expandOnlyOnTwistieClick:e=>s.expandOnlyOnTwistieClick(e.element),additionalScrollHeight:s.additionalScrollHeight})}function i1(s,e){e(s),s.children.forEach(t=>i1(t,e))}var d_=class{constructor(e,t,i,n,r,o={}){this.user=e,this.dataSource=r,this.nodes=new Map,this.subTreeRefreshPromises=new Map,this.refreshPromises=new Map,this._onDidRender=new k,this._onDidChangeNodeSlowState=new k,this.nodeMapper=new rh(a=>new h_(a)),this.disposables=new U,this.identityProvider=o.identityProvider,this.autoExpandSingleChildren=typeof o.autoExpandSingleChildren=="undefined"?!1:o.autoExpandSingleChildren,this.sorter=o.sorter,this.collapseByDefault=o.collapseByDefault,this.tree=this.createTree(e,t,i,n,o),this.root=JS({element:void 0,parent:null,hasChildren:!0}),this.identityProvider&&(this.root=Object.assign(Object.assign({},this.root),{id:null})),this.nodes.set(null,this.root),this.tree.onDidChangeCollapseState(this._onDidChangeCollapseState,this,this.disposables)}get onDidChangeFocus(){return j.map(this.tree.onDidChangeFocus,vM)}get onDidChangeSelection(){return j.map(this.tree.onDidChangeSelection,vM)}get onMouseDblClick(){return j.map(this.tree.onMouseDblClick,CM)}get onPointer(){return j.map(this.tree.onPointer,CM)}get onDidFocus(){return this.tree.onDidFocus}get onDidDispose(){return this.tree.onDidDispose}createTree(e,t,i,n,r){let o=new Qu(i),a=n.map(c=>new wM(c,this.nodeMapper,this._onDidChangeNodeSlowState.event)),l=LM(r)||{};return new ah(e,t,o,a,l)}updateOptions(e={}){this.tree.updateOptions(e)}getHTMLElement(){return this.tree.getHTMLElement()}get scrollTop(){return this.tree.scrollTop}set scrollTop(e){this.tree.scrollTop=e}domFocus(){this.tree.domFocus()}layout(e,t){this.tree.layout(e,t)}style(e){this.tree.style(e)}getInput(){return this.root.element}setInput(e,t){return Ko(this,void 0,void 0,function*(){this.refreshPromises.forEach(n=>n.cancel()),this.refreshPromises.clear(),this.root.element=e;let i=t&&{viewState:t,focus:[],selection:[]};yield 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)})}_updateChildren(e=this.root.element,t=!0,i=!1,n,r){return Ko(this,void 0,void 0,function*(){if(typeof this.root.element=="undefined")throw new oi(this.user,"Tree input not set");this.root.refreshPromise&&(yield this.root.refreshPromise,yield j.toPromise(this._onDidRender.event));let o=this.getDataNode(e);if(yield this.refreshAndRenderNode(o,t,n,r),i)try{this.tree.rerender(o)}catch(a){}})}rerender(e){if(e===void 0||e===this.root.element){this.tree.rerender();return}let t=this.getDataNode(e);this.tree.rerender(t)}collapse(e,t=!1){let i=this.getDataNode(e);return this.tree.collapse(i===this.root?null:i,t)}expand(e,t=!1){return Ko(this,void 0,void 0,function*(){if(typeof this.root.element=="undefined")throw new oi(this.user,"Tree input not set");this.root.refreshPromise&&(yield this.root.refreshPromise,yield j.toPromise(this._onDidRender.event));let i=this.getDataNode(e);if(this.tree.hasElement(i)&&!this.tree.isCollapsible(i)||(i.refreshPromise&&(yield this.root.refreshPromise,yield j.toPromise(this._onDidRender.event)),i!==this.root&&!i.refreshPromise&&!this.tree.isCollapsed(i)))return!1;let n=this.tree.expand(i===this.root?null:i,t);return i.refreshPromise&&(yield this.root.refreshPromise,yield j.toPromise(this._onDidRender.event)),n})}setSelection(e,t){let i=e.map(n=>this.getDataNode(n));this.tree.setSelection(i,t)}getSelection(){return this.tree.getSelection().map(t=>t.element)}setFocus(e,t){let 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)}getDataNode(e){let t=this.nodes.get(e===this.root.element?null:e);if(!t)throw new oi(this.user,`Data tree node not found: ${e}`);return t}refreshAndRenderNode(e,t,i,n){return Ko(this,void 0,void 0,function*(){yield this.refreshNode(e,t,i),this.render(e,i,n)})}refreshNode(e,t,i){return Ko(this,void 0,void 0,function*(){let n;return this.subTreeRefreshPromises.forEach((r,o)=>{!n&&r5(o,e)&&(n=r.then(()=>this.refreshNode(e,t,i)))}),n||this.doRefreshSubTree(e,t,i)})}doRefreshSubTree(e,t,i){return Ko(this,void 0,void 0,function*(){let n;e.refreshPromise=new Promise(r=>n=r),this.subTreeRefreshPromises.set(e,e.refreshPromise),e.refreshPromise.finally(()=>{e.refreshPromise=void 0,this.subTreeRefreshPromises.delete(e)});try{let r=yield this.doRefreshNode(e,t,i);e.stale=!1,yield Nf.settled(r.map(o=>this.doRefreshSubTree(o,t,i)))}finally{n()}})}doRefreshNode(e,t,i){return Ko(this,void 0,void 0,function*(){e.hasChildren=!!this.dataSource.hasChildren(e.element);let n;if(!e.hasChildren)n=Promise.resolve(re.empty());else{let r=Or(800);r.then(()=>{e.slow=!0,this._onDidChangeNodeSlowState.fire(e)},o=>null),n=this.doGetChildren(e).finally(()=>r.cancel())}try{let r=yield n;return this.setChildren(e,r,t,i)}catch(r){if(e!==this.root&&this.tree.hasElement(e)&&this.tree.collapse(e),Ir(r))return[];throw r}finally{e.slow&&(e.slow=!1,this._onDidChangeNodeSlowState.fire(e))}})}doGetChildren(e){let t=this.refreshPromises.get(e);return t||(t=db(()=>Ko(this,void 0,void 0,function*(){let i=yield this.dataSource.getChildren(e.element);return this.processChildren(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(de))}setChildren(e,t,i,n){let r=[...t];if(e.children.length===0&&r.length===0)return[];let o=new Map,a=new Map;for(let h of e.children)if(o.set(h.element,h),this.identityProvider){let d=this.tree.isCollapsed(h);a.set(h.id,{node:h,collapsed:d})}let l=[],c=r.map(h=>{let d=!!this.dataSource.hasChildren(h);if(!this.identityProvider){let g=JS({element:h,parent:e,hasChildren:d});return d&&this.collapseByDefault&&!this.collapseByDefault(h)&&(g.collapsedByDefault=!1,l.push(g)),g}let u=this.identityProvider.getId(h).toString(),f=a.get(u);if(f){let g=f.node;return o.delete(g.element),this.nodes.delete(g.element),this.nodes.set(h,g),g.element=h,g.hasChildren=d,i?f.collapsed?(g.children.forEach(b=>i1(b,w=>this.nodes.delete(w.element))),g.children.splice(0,g.children.length),g.stale=!0):l.push(g):d&&this.collapseByDefault&&!this.collapseByDefault(h)&&(g.collapsedByDefault=!1,l.push(g)),g}let m=JS({element:h,parent:e,id:u,hasChildren:d});return n&&n.viewState.focus&&n.viewState.focus.indexOf(u)>-1&&n.focus.push(m),n&&n.viewState.selection&&n.viewState.selection.indexOf(u)>-1&&n.selection.push(m),n&&n.viewState.expanded&&n.viewState.expanded.indexOf(u)>-1?l.push(m):d&&this.collapseByDefault&&!this.collapseByDefault(h)&&(m.collapsedByDefault=!1,l.push(m)),m});for(let h of o.values())i1(h,d=>this.nodes.delete(d.element));for(let h of c)this.nodes.set(h.element,h);return e.children.splice(0,e.children.length,...c),e!==this.root&&this.autoExpandSingleChildren&&c.length===1&&l.length===0&&(c[0].collapsedByDefault=!1,l.push(c[0])),l}render(e,t,i){let n=e.children.map(o=>this.asTreeElement(o,t)),r=i&&Object.assign(Object.assign({},i),{diffIdentityProvider:i.diffIdentityProvider&&{getId(o){return i.diffIdentityProvider.getId(o.element)}}});this.tree.setChildren(e===this.root?null:e,n,r),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:i=e.collapsedByDefault,e.collapsedByDefault=void 0,{element:e,children:e.hasChildren?re.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.disposables.dispose()}},u_=class{constructor(e){this.node=e}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 u_(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}},xM=class{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(...Xu.classNamesArray),!0):(t.classList.remove(...Xu.classNamesArray),!1)}disposeElement(e,t,i,n){this.renderer.disposeElement&&this.renderer.disposeElement(this.nodeMapper.map(e),t,i.templateData,n)}disposeCompressedElements(e,t,i,n){this.renderer.disposeCompressedElements&&this.renderer.disposeCompressedElements(this.compressibleNodeMapperProvider().map(e),t,i.templateData,n)}disposeTemplate(e){this.renderer.disposeTemplate(e.templateData)}dispose(){this.renderedNodes.clear(),this.disposables=me(this.disposables)}};function o5(s){let e=s&&LM(s);return e&&Object.assign(Object.assign({},e),{keyboardNavigationLabelProvider:e.keyboardNavigationLabelProvider&&Object.assign(Object.assign({},e.keyboardNavigationLabelProvider),{getCompressedNodeKeyboardNavigationLabel(t){return s.keyboardNavigationLabelProvider.getCompressedNodeKeyboardNavigationLabel(t.map(i=>i.element))}})})}var n1=class extends d_{constructor(e,t,i,n,r,o,a={}){super(e,t,i,r,o,a);this.compressionDelegate=n,this.compressibleNodeMapper=new rh(l=>new u_(l)),this.filter=a.filter}createTree(e,t,i,n,r){let o=new Qu(i),a=n.map(c=>new xM(c,this.nodeMapper,()=>this.compressibleNodeMapper,this._onDidChangeNodeSlowState.event)),l=o5(r)||{};return new tf(e,t,o,a,l)}asTreeElement(e,t){return Object.assign({incompressible:this.compressionDelegate.isIncompressible(e.element)},super.asTreeElement(e,t))}updateOptions(e={}){this.tree.updateOptions(e)}render(e,t){if(!this.identityProvider)return super.render(e,t);let i=u=>this.identityProvider.getId(u).toString(),n=u=>{let f=new Set;for(let m of u){let g=this.tree.getCompressedTreeNode(m===this.root?null:m);if(!!g.element)for(let b of g.element.elements)f.add(i(b.element))}return f},r=n(this.tree.getSelection()),o=n(this.tree.getFocus());super.render(e,t);let a=this.getSelection(),l=!1,c=this.getFocus(),h=!1,d=u=>{let f=u.element;if(f)for(let m=0;m{let i=this.filter.filter(t,1),n=a5(i);if(n===2)throw new Error("Recursive tree visibility not supported in async data compressed trees");return n===1})),super.processChildren(e)}};function a5(s){return typeof s=="boolean"?s?1:0:Zu(s)?pl(s.visibility):pl(s)}var s1=class extends ef{constructor(e,t,i,n,r,o={}){super(e,t,i,n,o);this.user=e,this.dataSource=r,this.identityProvider=o.identityProvider}createModel(e,t,i){return new _l(e,t,i)}};var l5={separatorBorder:A.transparent},r1=class{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)}set size(e){this._size=e}get size(){return this._size}get visible(){return typeof this._cachedVisibleSize=="undefined"}setVisible(e,t){e!==this.visible&&(e?(this.size=$i(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),this.view.setVisible&&this.view.setVisible(e))}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 snap(){return!!this.view.snap}set enabled(e){this.container.style.pointerEvents=e?"":"none"}layout(e,t){this.layoutContainer(e),this.view.layout(this.size,e,t)}dispose(){return this.disposable.dispose(),this.view}},DM=class extends r1{layoutContainer(e){this.container.style.top=`${e}px`,this.container.style.height=`${this.size}px`}},EM=class extends r1{layoutContainer(e){this.container.style.left=`${e}px`,this.container.style.width=`${this.size}px`}},Dr;(function(s){s[s.Idle=0]="Idle",s[s.Busy=1]="Busy"})(Dr||(Dr={}));var kM;(function(s){s.Distribute={type:"distribute"};function e(i){return{type:"split",index:i}}s.Split=e;function t(i){return{type:"invisible",cachedVisibleSize:i}}s.Invisible=t})(kM||(kM={}));var o1=class extends M{constructor(e,t={}){var i,n;super();this.size=0,this.contentSize=0,this.proportions=void 0,this.viewItems=[],this.sashItems=[],this.state=Dr.Idle,this._onDidSashChange=this._register(new k),this.onDidSashChange=this._onDidSashChange.event,this._onDidSashReset=this._register(new k),this._startSnappingEnabled=!0,this._endSnappingEnabled=!0,this.orientation=li(t.orientation)?0:t.orientation,this.inverseAltBehavior=!!t.inverseAltBehavior,this.proportionalLayout=li(t.proportionalLayout)?!0:!!t.proportionalLayout,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=W(this.el,H(".sash-container")),this.viewContainer=H(".split-view-container"),this.scrollable=new _r(125,Ti),this.scrollableElement=this._register(new Qa(this.viewContainer,{vertical:this.orientation===0?(i=t.scrollbarVisibility)!==null&&i!==void 0?i:1:2,horizontal:this.orientation===1?(n=t.scrollbarVisibility)!==null&&n!==void 0?n:1:2},this.scrollable)),this.onDidScroll=this.scrollableElement.onScroll,this._register(this.onDidScroll(r=>{this.viewContainer.scrollTop=r.scrollTop,this.viewContainer.scrollLeft=r.scrollLeft})),W(this.el,this.scrollableElement.getDomNode()),this.style(t.styles||l5),t.descriptor&&(this.size=t.descriptor.size,t.descriptor.views.forEach((r,o)=>{let a=li(r.visible)||r.visible?r.size:{type:"invisible",cachedVisibleSize:r.size},l=r.view;this.doAddView(l,a,o,!0)}),this.contentSize=this.viewItems.reduce((r,o)=>r+o.size,0),this.saveProportions())}get orthogonalStartSash(){return this._orthogonalStartSash}set orthogonalStartSash(e){for(let t of this.sashItems)t.sash.orthogonalStartSash=e;this._orthogonalStartSash=e}get orthogonalEndSash(){return this._orthogonalEndSash}set orthogonalEndSash(e){for(let t of this.sashItems)t.sash.orthogonalEndSash=e;this._orthogonalEndSash=e}get startSnappingEnabled(){return this._startSnappingEnabled}set startSnappingEnabled(e){this._startSnappingEnabled!==e&&(this._startSnappingEnabled=e,this.updateSashEnablement())}get endSnappingEnabled(){return this._endSnappingEnabled}set endSnappingEnabled(e){this._endSnappingEnabled!==e&&(this._endSnappingEnabled=e,this.updateSashEnablement())}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){let i=Math.max(this.size,this.contentSize);if(this.size=e,this.layoutContext=t,this.proportions)for(let n=0;nthis.viewItems[a].priority===1),o=n.filter(a=>this.viewItems[a].priority===2);this.resize(this.viewItems.length-1,e-i,void 0,r,o)}this.distributeEmptySpace(),this.layoutViews()}saveProportions(){this.proportionalLayout&&this.contentSize>0&&(this.proportions=this.viewItems.map(e=>e.size/this.contentSize))}onSashStart({sash:e,start:t,alt:i}){for(let a of this.viewItems)a.enabled=!1;let n=this.sashItems.findIndex(a=>a.sash===e),r=Jn(O(document.body,"keydown",a=>o(this.sashDragState.current,a.altKey)),O(document.body,"keyup",()=>o(this.sashDragState.current,!1))),o=(a,l)=>{let c=this.viewItems.map(m=>m.size),h=Number.NEGATIVE_INFINITY,d=Number.POSITIVE_INFINITY;if(this.inverseAltBehavior&&(l=!l),l)if(n===this.sashItems.length-1){let g=this.viewItems[n];h=(g.minimumSize-g.size)/2,d=(g.maximumSize-g.size)/2}else{let g=this.viewItems[n+1];h=(g.size-g.maximumSize)/2,d=(g.size-g.minimumSize)/2}let u,f;if(!l){let m=Nt(n,-1),g=Nt(n+1,this.viewItems.length),b=m.reduce((L,E)=>L+(this.viewItems[E].minimumSize-c[E]),0),w=m.reduce((L,E)=>L+(this.viewItems[E].viewMaximumSize-c[E]),0),_=g.length===0?Number.POSITIVE_INFINITY:g.reduce((L,E)=>L+(c[E]-this.viewItems[E].minimumSize),0),v=g.length===0?Number.NEGATIVE_INFINITY:g.reduce((L,E)=>L+(c[E]-this.viewItems[E].viewMaximumSize),0),C=Math.max(b,v),y=Math.min(_,w),x=this.findFirstSnapIndex(m),S=this.findFirstSnapIndex(g);if(typeof x=="number"){let L=this.viewItems[x],E=Math.floor(L.viewMinimumSize/2);u={index:x,limitDelta:L.visible?C-E:C+E,size:L.size}}if(typeof S=="number"){let L=this.viewItems[S],E=Math.floor(L.viewMinimumSize/2);f={index:S,limitDelta:L.visible?y+E:y-E,size:L.size}}}this.sashDragState={start:a,current:a,index:n,sizes:c,minDelta:h,maxDelta:d,alt:l,snapBefore:u,snapAfter:f,disposable:r}};o(t,i)}onSashChange({current:e}){let{index:t,start:i,sizes:n,alt:r,minDelta:o,maxDelta:a,snapBefore:l,snapAfter:c}=this.sashDragState;this.sashDragState.current=e;let h=e-i,d=this.resize(t,h,n,void 0,void 0,o,a,l,c);if(r){let u=t===this.sashItems.length-1,f=this.viewItems.map(v=>v.size),m=u?t:t+1,g=this.viewItems[m],b=g.size-g.maximumSize,w=g.size-g.minimumSize,_=u?t-1:t+1;this.resize(_,-d,f,void 0,void 0,b,w)}this.distributeEmptySpace(),this.layoutViews()}onSashEnd(e){this._onDidSashChange.fire(e),this.sashDragState.disposable.dispose(),this.saveProportions();for(let t of this.viewItems)t.enabled=!0}onViewChange(e,t){let i=this.viewItems.indexOf(e);i<0||i>=this.viewItems.length||(t=typeof t=="number"?t:e.size,t=$i(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(this.state!==Dr.Idle)throw new Error("Cant modify splitview");if(this.state=Dr.Busy,e<0||e>=this.viewItems.length)return;let i=Nt(this.viewItems.length).filter(a=>a!==e),n=[...i.filter(a=>this.viewItems[a].priority===1),e],r=i.filter(a=>this.viewItems[a].priority===2),o=this.viewItems[e];t=Math.round(t),t=$i(t,o.minimumSize,Math.min(o.maximumSize,this.size)),o.size=t,this.relayout(n,r),this.state=Dr.Idle}distributeViewSizes(){let e=[],t=0;for(let a of this.viewItems)a.maximumSize-a.minimumSize>0&&(e.push(a),t+=a.size);let i=Math.floor(t/e.length);for(let a of e)a.size=$i(i,a.minimumSize,a.maximumSize);let n=Nt(this.viewItems.length),r=n.filter(a=>this.viewItems[a].priority===1),o=n.filter(a=>this.viewItems[a].priority===2);this.relayout(r,o)}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!==Dr.Idle)throw new Error("Cant modify splitview");this.state=Dr.Busy;let r=H(".split-view-view");i===this.viewItems.length?this.viewContainer.appendChild(r):this.viewContainer.insertBefore(r,this.viewContainer.children.item(i));let o=e.onDidChange(u=>this.onViewChange(h,u)),a=oe(()=>this.viewContainer.removeChild(r)),l=Jn(o,a),c;typeof t=="number"?c=t:t.type==="split"?c=this.getViewSize(t.index)/2:t.type==="invisible"?c={cachedVisibleSize:t.cachedVisibleSize}:c=e.minimumSize;let h=this.orientation===0?new DM(r,e,c,l):new EM(r,e,c,l);if(this.viewItems.splice(i,0,h),this.viewItems.length>1){let u={orthogonalStartSash:this.orthogonalStartSash,orthogonalEndSash:this.orthogonalEndSash},f=this.orientation===0?new Di(this.sashContainer,{getHorizontalSashTop:L=>this.getSashPosition(L),getHorizontalSashWidth:this.getSashOrthogonalSize},Object.assign(Object.assign({},u),{orientation:1})):new Di(this.sashContainer,{getVerticalSashLeft:L=>this.getSashPosition(L),getVerticalSashHeight:this.getSashOrthogonalSize},Object.assign(Object.assign({},u),{orientation:0})),m=this.orientation===0?L=>({sash:f,start:L.startY,current:L.currentY,alt:L.altKey}):L=>({sash:f,start:L.startX,current:L.currentX,alt:L.altKey}),b=j.map(f.onDidStart,m)(this.onSashStart,this),_=j.map(f.onDidChange,m)(this.onSashChange,this),C=j.map(f.onDidEnd,()=>this.sashItems.findIndex(L=>L.sash===f))(this.onSashEnd,this),y=f.onDidReset(()=>{let L=this.sashItems.findIndex(B=>B.sash===f),E=Nt(L,-1),T=Nt(L+1,this.viewItems.length),I=this.findFirstSnapIndex(E),P=this.findFirstSnapIndex(T);typeof I=="number"&&!this.viewItems[I].visible||typeof P=="number"&&!this.viewItems[P].visible||this._onDidSashReset.fire(L)}),x=Jn(b,_,C,y,f),S={sash:f,disposable:x};this.sashItems.splice(i-1,0,S)}r.appendChild(e.element);let d;typeof t!="number"&&t.type==="split"&&(d=[t.index]),n||this.relayout([i],d),this.state=Dr.Idle,!n&&typeof t!="number"&&t.type==="distribute"&&this.distributeViewSizes()}relayout(e,t){let i=this.viewItems.reduce((n,r)=>n+r.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(h=>h.size),n,r,o=Number.NEGATIVE_INFINITY,a=Number.POSITIVE_INFINITY,l,c){if(e<0||e>=this.viewItems.length)return 0;let h=Nt(e,-1),d=Nt(e+1,this.viewItems.length);if(r)for(let S of r)wm(h,S),wm(d,S);if(n)for(let S of n)od(h,S),od(d,S);let u=h.map(S=>this.viewItems[S]),f=h.map(S=>i[S]),m=d.map(S=>this.viewItems[S]),g=d.map(S=>i[S]),b=h.reduce((S,L)=>S+(this.viewItems[L].minimumSize-i[L]),0),w=h.reduce((S,L)=>S+(this.viewItems[L].maximumSize-i[L]),0),_=d.length===0?Number.POSITIVE_INFINITY:d.reduce((S,L)=>S+(i[L]-this.viewItems[L].minimumSize),0),v=d.length===0?Number.NEGATIVE_INFINITY:d.reduce((S,L)=>S+(i[L]-this.viewItems[L].maximumSize),0),C=Math.max(b,v,o),y=Math.min(_,w,a),x=!1;if(l){let S=this.viewItems[l.index],L=t>=l.limitDelta;x=L!==S.visible,S.setVisible(L,l.size)}if(!x&&c){let S=this.viewItems[c.index],L=ta+l.size,0),i=this.size-t,n=Nt(this.viewItems.length-1,-1),r=n.filter(a=>this.viewItems[a].priority===1),o=n.filter(a=>this.viewItems[a].priority===2);for(let a of o)wm(n,a);for(let a of r)od(n,a);typeof e=="number"&&od(n,e);for(let a=0;i!==0&&at+i.size,0);let e=0;for(let 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,t=this.viewItems.map(l=>e=l.size-l.minimumSize>0||e);e=!1;let i=this.viewItems.map(l=>e=l.maximumSize-l.size>0||e),n=[...this.viewItems].reverse();e=!1;let r=n.map(l=>e=l.size-l.minimumSize>0||e).reverse();e=!1;let o=n.map(l=>e=l.maximumSize-l.size>0||e).reverse(),a=0;for(let l=0;l0||this.startSnappingEnabled)?c.state=1:_&&t[l]&&(a0)return;if(!i.visible&&i.snap)return t}}dispose(){super.dispose(),this.viewItems.forEach(e=>e.dispose()),this.viewItems=[],this.sashItems.forEach(e=>e.disposable.dispose()),this.sashItems=[]}};var lh=class{constructor(e,t,i){this.columns=e,this.getColumnSize=i,this.templateId=lh.TemplateId,this.renderedTemplates=new Set;let n=new Map(t.map(r=>[r.templateId,r]));this.renderers=[];for(let r of e){let o=n.get(r.templateId);if(!o)throw new Error(`Table cell renderer for template id ${r.templateId} not found.`);this.renderers.push(o)}}renderTemplate(e){let t=W(e,H(".monaco-table-tr")),i=[],n=[];for(let o=0;onew IM(h,d)),l={size:a.reduce((h,d)=>h+d.column.weight,0),views:a.map(h=>({size:h.column.weight,view:h}))};this.splitview=new o1(this.domNode,{orientation:1,scrollbarVisibility:2,getSashOrthogonalSize:()=>this.cachedHeight,descriptor:l}),this.splitview.el.style.height=`${i.headerRowHeight}px`,this.splitview.el.style.lineHeight=`${i.headerRowHeight}px`;let c=new lh(n,r,h=>this.splitview.getViewSize(h));this.list=new Xi(e,this.domNode,c5(i),[c],o),this.columnLayoutDisposable=j.any(...a.map(h=>h.onDidLayout))(([h,d])=>c.layoutColumn(h,d)),this.styleElement=kt(this.domNode),this.style({})}get onDidChangeFocus(){return this.list.onDidChangeFocus}get onDidChangeSelection(){return this.list.onDidChangeSelection}get onMouseDblClick(){return this.list.onMouseDblClick}get onPointer(){return this.list.onPointer}get onDidFocus(){return this.list.onDidFocus}get onDidDispose(){return this.list.onDidDispose}updateOptions(e){this.list.updateOptions(e)}splice(e,t,i=[]){this.list.splice(e,t,i)}getHTMLElement(){return this.domNode}style(e){let 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.splitview.dispose(),this.list.dispose(),this.columnLayoutDisposable.dispose()}};ch.InstanceCount=0;var Ms=function(s,e,t,i){var n=arguments.length,r=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(s,e,t,i);else for(var a=s.length-1;a>=0;a--)(o=s[a])&&(r=(n<3?o(r):n>3?o(e,t,r):o(e,t))||r);return n>3&&r&&Object.defineProperty(e,t,r),r},le=function(s,e){return function(t,i){e(t,i,s)}},Xn=$("listService"),f_=class{constructor(e){this._themeService=e,this.disposables=new U,this.lists=[],this._lastFocusedWidget=void 0,this._hasCreatedStyleController=!1}get lastFocusedList(){return this._lastFocusedWidget}register(e,t){if(!this._hasCreatedStyleController){this._hasCreatedStyleController=!0;let n=new s_(kt(),"");this.disposables.add(ul(n,this._themeService))}if(this.lists.some(n=>n.widget===e))throw new Error("Cannot register the same widget multiple times");let i={widget:e,extraContextKeys:t};return this.lists.push(i),e.getHTMLElement()===document.activeElement&&(this._lastFocusedWidget=e),Jn(e.onDidFocus(()=>this._lastFocusedWidget=e),oe(()=>this.lists.splice(this.lists.indexOf(i),1)),e.onDidDispose(()=>{this.lists=this.lists.filter(n=>n!==i),this._lastFocusedWidget===e&&(this._lastFocusedWidget=void 0)}))}dispose(){this.disposables.dispose()}};f_=Ms([le(0,We)],f_);var NM=new te("listFocus",!0),m_=new te("listSupportsMultiselect",!0),Zue=dt.and(NM,dt.not(oM)),a1=new te("listHasSelectionOrFocus",!1),l1=new te("listDoubleSelection",!1),c1=new te("listMultiSelection",!1),g_=new te("listSelectionNavigation",!1),TM="listAutomaticKeyboardNavigation";function p_(s,e){let t=s.createScoped(e.getHTMLElement());return NM.bindTo(t),t}var bl="workbench.list.multiSelectModifier",h1="workbench.list.openMode",fn="workbench.list.horizontalScrolling",__="workbench.list.keyboardNavigation",d1="workbench.list.automaticKeyboardNavigation",nf="workbench.tree.indent",b_="workbench.tree.renderIndentGuides",Qn="workbench.list.smoothScrolling",Rs="workbench.list.mouseWheelScrollSensitivity",As="workbench.list.fastScrollSensitivity",w_="workbench.tree.expandMode";function Os(s){return s.getValue(bl)==="alt"}var MM=class extends M{constructor(e){super();this.configurationService=e,this.useAltAsMultipleSelectionModifier=Os(e),this.registerListeners()}registerListeners(){this._register(this.configurationService.onDidChangeConfiguration(e=>{e.affectsConfiguration(bl)&&(this.useAltAsMultipleSelectionModifier=Os(this.configurationService))}))}isSelectionSingleChangeEvent(e){return this.useAltAsMultipleSelectionModifier?e.browserEvent.altKey:VS(e)}isSelectionRangeChangeEvent(e){return jS(e)}};function v_(s,e,t){var i;let n=new U;return[Object.assign(Object.assign({},s),{keyboardNavigationDelegate:{mightProducePrintableCharacter(o){return t.mightProducePrintableCharacter(o)}},smoothScrolling:Boolean(e.getValue(Qn)),mouseWheelScrollSensitivity:e.getValue(Rs),fastScrollSensitivity:e.getValue(As),multipleSelectionController:(i=s.multipleSelectionController)!==null&&i!==void 0?i:n.add(new MM(e))}),n]}var C_=class extends Xi{constructor(e,t,i,n,r,o,a,l,c,h){let d=typeof r.horizontalScrolling!="undefined"?r.horizontalScrolling:Boolean(c.getValue(fn)),[u,f]=v_(r,c,h);super(e,t,i,n,Object.assign(Object.assign(Object.assign({keyboardSupport:!1},dn(l.getColorTheme(),qu)),u),{horizontalScrolling:d}));this.disposables.add(f),this.contextKeyService=p_(o,this),this.themeService=l,this.listSupportsMultiSelect=m_.bindTo(this.contextKeyService),this.listSupportsMultiSelect.set(r.multipleSelectionSupport!==!1),g_.bindTo(this.contextKeyService).set(Boolean(r.selectionNavigation)),this.listHasSelectionOrFocus=a1.bindTo(this.contextKeyService),this.listDoubleSelection=l1.bindTo(this.contextKeyService),this.listMultiSelection=c1.bindTo(this.contextKeyService),this.horizontalScrolling=r.horizontalScrolling,this._useAltAsMultipleSelectionModifier=Os(c),this.disposables.add(this.contextKeyService),this.disposables.add(a.register(this)),r.overrideStyles&&this.updateStyles(r.overrideStyles),this.disposables.add(this.onDidChangeSelection(()=>{let g=this.getSelection(),b=this.getFocus();this.contextKeyService.bufferChangeEvents(()=>{this.listHasSelectionOrFocus.set(g.length>0||b.length>0),this.listMultiSelection.set(g.length>1),this.listDoubleSelection.set(g.length===2)})})),this.disposables.add(this.onDidChangeFocus(()=>{let g=this.getSelection(),b=this.getFocus();this.listHasSelectionOrFocus.set(g.length>0||b.length>0)})),this.disposables.add(c.onDidChangeConfiguration(g=>{g.affectsConfiguration(bl)&&(this._useAltAsMultipleSelectionModifier=Os(c));let b={};if(g.affectsConfiguration(fn)&&this.horizontalScrolling===void 0){let w=Boolean(c.getValue(fn));b=Object.assign(Object.assign({},b),{horizontalScrolling:w})}if(g.affectsConfiguration(Qn)){let w=Boolean(c.getValue(Qn));b=Object.assign(Object.assign({},b),{smoothScrolling:w})}if(g.affectsConfiguration(Rs)){let w=c.getValue(Rs);b=Object.assign(Object.assign({},b),{mouseWheelScrollSensitivity:w})}if(g.affectsConfiguration(As)){let w=c.getValue(As);b=Object.assign(Object.assign({},b),{fastScrollSensitivity:w})}Object.keys(b).length>0&&this.updateOptions(b)})),this.navigator=new u1(this,Object.assign({configurationService:c},r)),this.disposables.add(this.navigator)}updateOptions(e){super.updateOptions(e),e.overrideStyles&&this.updateStyles(e.overrideStyles),e.multipleSelectionSupport!==void 0&&this.listSupportsMultiSelect.set(!!e.multipleSelectionSupport)}updateStyles(e){var t;(t=this._styler)===null||t===void 0||t.dispose(),this._styler=ul(this,this.themeService,e)}dispose(){var e;(e=this._styler)===null||e===void 0||e.dispose(),super.dispose()}};C_=Ms([le(5,fe),le(6,Xn),le(7,We),le(8,nt),le(9,zt)],C_);var RM=class extends HS{constructor(e,t,i,n,r,o,a,l,c,h){let d=typeof r.horizontalScrolling!="undefined"?r.horizontalScrolling:Boolean(c.getValue(fn)),[u,f]=v_(r,c,h);super(e,t,i,n,Object.assign(Object.assign(Object.assign({keyboardSupport:!1},dn(l.getColorTheme(),qu)),u),{horizontalScrolling:d}));this.disposables=new U,this.disposables.add(f),this.contextKeyService=p_(o,this),this.themeService=l,this.horizontalScrolling=r.horizontalScrolling,this.listSupportsMultiSelect=m_.bindTo(this.contextKeyService),this.listSupportsMultiSelect.set(r.multipleSelectionSupport!==!1),g_.bindTo(this.contextKeyService).set(Boolean(r.selectionNavigation)),this._useAltAsMultipleSelectionModifier=Os(c),this.disposables.add(this.contextKeyService),this.disposables.add(a.register(this)),r.overrideStyles&&this.updateStyles(r.overrideStyles),r.overrideStyles&&this.disposables.add(ul(this,l,r.overrideStyles)),this.disposables.add(c.onDidChangeConfiguration(g=>{g.affectsConfiguration(bl)&&(this._useAltAsMultipleSelectionModifier=Os(c));let b={};if(g.affectsConfiguration(fn)&&this.horizontalScrolling===void 0){let w=Boolean(c.getValue(fn));b=Object.assign(Object.assign({},b),{horizontalScrolling:w})}if(g.affectsConfiguration(Qn)){let w=Boolean(c.getValue(Qn));b=Object.assign(Object.assign({},b),{smoothScrolling:w})}if(g.affectsConfiguration(Rs)){let w=c.getValue(Rs);b=Object.assign(Object.assign({},b),{mouseWheelScrollSensitivity:w})}if(g.affectsConfiguration(As)){let w=c.getValue(As);b=Object.assign(Object.assign({},b),{fastScrollSensitivity:w})}Object.keys(b).length>0&&this.updateOptions(b)})),this.navigator=new u1(this,Object.assign({configurationService:c},r)),this.disposables.add(this.navigator)}updateOptions(e){super.updateOptions(e),e.overrideStyles&&this.updateStyles(e.overrideStyles),e.multipleSelectionSupport!==void 0&&this.listSupportsMultiSelect.set(!!e.multipleSelectionSupport)}updateStyles(e){var t;(t=this._styler)===null||t===void 0||t.dispose(),this._styler=ul(this,this.themeService,e)}dispose(){var e;(e=this._styler)===null||e===void 0||e.dispose(),this.disposables.dispose(),super.dispose()}};RM=Ms([le(5,fe),le(6,Xn),le(7,We),le(8,nt),le(9,zt)],RM);var AM=class extends ch{constructor(e,t,i,n,r,o,a,l,c,h,d){let u=typeof o.horizontalScrolling!="undefined"?o.horizontalScrolling:Boolean(h.getValue(fn)),[f,m]=v_(o,h,d);super(e,t,i,n,r,Object.assign(Object.assign(Object.assign({keyboardSupport:!1},dn(c.getColorTheme(),qu)),f),{horizontalScrolling:u}));this.disposables=new U,this.disposables.add(m),this.contextKeyService=p_(a,this),this.themeService=c,this.listSupportsMultiSelect=m_.bindTo(this.contextKeyService),this.listSupportsMultiSelect.set(o.multipleSelectionSupport!==!1),g_.bindTo(this.contextKeyService).set(Boolean(o.selectionNavigation)),this.listHasSelectionOrFocus=a1.bindTo(this.contextKeyService),this.listDoubleSelection=l1.bindTo(this.contextKeyService),this.listMultiSelection=c1.bindTo(this.contextKeyService),this.horizontalScrolling=o.horizontalScrolling,this._useAltAsMultipleSelectionModifier=Os(h),this.disposables.add(this.contextKeyService),this.disposables.add(l.register(this)),o.overrideStyles&&this.updateStyles(o.overrideStyles),this.disposables.add(this.onDidChangeSelection(()=>{let b=this.getSelection(),w=this.getFocus();this.contextKeyService.bufferChangeEvents(()=>{this.listHasSelectionOrFocus.set(b.length>0||w.length>0),this.listMultiSelection.set(b.length>1),this.listDoubleSelection.set(b.length===2)})})),this.disposables.add(this.onDidChangeFocus(()=>{let b=this.getSelection(),w=this.getFocus();this.listHasSelectionOrFocus.set(b.length>0||w.length>0)})),this.disposables.add(h.onDidChangeConfiguration(b=>{b.affectsConfiguration(bl)&&(this._useAltAsMultipleSelectionModifier=Os(h));let w={};if(b.affectsConfiguration(fn)&&this.horizontalScrolling===void 0){let _=Boolean(h.getValue(fn));w=Object.assign(Object.assign({},w),{horizontalScrolling:_})}if(b.affectsConfiguration(Qn)){let _=Boolean(h.getValue(Qn));w=Object.assign(Object.assign({},w),{smoothScrolling:_})}if(b.affectsConfiguration(Rs)){let _=h.getValue(Rs);w=Object.assign(Object.assign({},w),{mouseWheelScrollSensitivity:_})}if(b.affectsConfiguration(As)){let _=h.getValue(As);w=Object.assign(Object.assign({},w),{fastScrollSensitivity:_})}Object.keys(w).length>0&&this.updateOptions(w)})),this.navigator=new OM(this,Object.assign({configurationService:h},o)),this.disposables.add(this.navigator)}updateOptions(e){super.updateOptions(e),e.overrideStyles&&this.updateStyles(e.overrideStyles),e.multipleSelectionSupport!==void 0&&this.listSupportsMultiSelect.set(!!e.multipleSelectionSupport)}updateStyles(e){var t;(t=this._styler)===null||t===void 0||t.dispose(),this._styler=ul(this,this.themeService,e)}dispose(){var e;(e=this._styler)===null||e===void 0||e.dispose(),this.disposables.dispose(),super.dispose()}};AM=Ms([le(6,fe),le(7,Xn),le(8,We),le(9,nt),le(10,zt)],AM);var S_=class extends M{constructor(e,t){var i;super();this.widget=e,this._onDidOpen=this._register(new k),this.onDidOpen=this._onDidOpen.event,this._register(j.filter(this.widget.onDidChangeSelection,n=>n.browserEvent instanceof KeyboardEvent)(n=>this.onSelectionFromKeyboard(n))),this._register(this.widget.onPointer(n=>this.onPointer(n.element,n.browserEvent))),this._register(this.widget.onMouseDblClick(n=>this.onMouseDblClick(n.element,n.browserEvent))),typeof(t==null?void 0:t.openOnSingleClick)!="boolean"&&(t==null?void 0:t.configurationService)?(this.openOnSingleClick=(t==null?void 0:t.configurationService.getValue(h1))!=="doubleClick",this._register(t==null?void 0:t.configurationService.onDidChangeConfiguration(()=>{this.openOnSingleClick=(t==null?void 0:t.configurationService.getValue(h1))!=="doubleClick"}))):this.openOnSingleClick=(i=t==null?void 0:t.openOnSingleClick)!==null&&i!==void 0?i:!0}onSelectionFromKeyboard(e){if(e.elements.length!==1)return;let t=e.browserEvent,i=typeof t.preserveFocus=="boolean"?t.preserveFocus:!0,n=typeof t.pinned=="boolean"?t.pinned:!i,r=!1;this._open(this.getSelectedElement(),i,n,r,e.browserEvent)}onPointer(e,t){if(!this.openOnSingleClick||t.detail===2)return;let n=t.button===1,r=!0,o=n,a=t.ctrlKey||t.metaKey||t.altKey;this._open(e,r,o,a,t)}onMouseDblClick(e,t){if(!t)return;let 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;let r=!1,o=!0,a=t.ctrlKey||t.metaKey||t.altKey;this._open(e,r,o,a,t)}_open(e,t,i,n,r){!e||this._onDidOpen.fire({editorOptions:{preserveFocus:t,pinned:i,revealIfVisible:!0},sideBySide:n,element:e,browserEvent:r})}},u1=class extends S_{constructor(e,t){super(e,t);this.widget=e}getSelectedElement(){return this.widget.getSelectedElements()[0]}},OM=class extends S_{constructor(e,t){super(e,t)}getSelectedElement(){return this.widget.getSelectedElements()[0]}},PM=class extends S_{constructor(e,t){super(e,t)}getSelectedElement(){var e;return(e=this.widget.getSelection()[0])!==null&&e!==void 0?e:void 0}};function h5(s,e){let t=!1;return i=>{if(t)return t=!1,!1;let n=e.softDispatch(i,s);return n&&n.enterChord?(t=!0,!1):(t=!1,!0)}}var FM=class extends ah{constructor(e,t,i,n,r,o,a,l,c,h,d){let{options:u,getAutomaticKeyboardNavigation:f,disposable:m}=sf(t,r,o,c,h,d);super(e,t,i,n,u);this.disposables.add(m),this.internals=new wl(this,r,f,r.overrideStyles,o,a,l,c,d),this.disposables.add(this.internals)}updateOptions(e){super.updateOptions(e),this.internals.updateOptions(e)}};FM=Ms([le(5,fe),le(6,Xn),le(7,We),le(8,nt),le(9,zt),le(10,jt)],FM);var BM=class extends tf{constructor(e,t,i,n,r,o,a,l,c,h,d){let{options:u,getAutomaticKeyboardNavigation:f,disposable:m}=sf(t,r,o,c,h,d);super(e,t,i,n,u);this.disposables.add(m),this.internals=new wl(this,r,f,r.overrideStyles,o,a,l,c,d),this.disposables.add(this.internals)}updateOptions(e={}){super.updateOptions(e),e.overrideStyles&&this.internals.updateStyleOverrides(e.overrideStyles),this.internals.updateOptions(e)}};BM=Ms([le(5,fe),le(6,Xn),le(7,We),le(8,nt),le(9,zt),le(10,jt)],BM);var WM=class extends s1{constructor(e,t,i,n,r,o,a,l,c,h,d,u){let{options:f,getAutomaticKeyboardNavigation:m,disposable:g}=sf(t,o,a,h,d,u);super(e,t,i,n,r,f);this.disposables.add(g),this.internals=new wl(this,o,m,o.overrideStyles,a,l,c,h,u),this.disposables.add(this.internals)}updateOptions(e={}){super.updateOptions(e),e.overrideStyles&&this.internals.updateStyleOverrides(e.overrideStyles),this.internals.updateOptions(e)}};WM=Ms([le(6,fe),le(7,Xn),le(8,We),le(9,nt),le(10,zt),le(11,jt)],WM);var VM=class extends d_{constructor(e,t,i,n,r,o,a,l,c,h,d,u){let{options:f,getAutomaticKeyboardNavigation:m,disposable:g}=sf(t,o,a,h,d,u);super(e,t,i,n,r,f);this.disposables.add(g),this.internals=new wl(this,o,m,o.overrideStyles,a,l,c,h,u),this.disposables.add(this.internals)}get onDidOpen(){return this.internals.onDidOpen}updateOptions(e={}){super.updateOptions(e),e.overrideStyles&&this.internals.updateStyleOverrides(e.overrideStyles),this.internals.updateOptions(e)}};VM=Ms([le(6,fe),le(7,Xn),le(8,We),le(9,nt),le(10,zt),le(11,jt)],VM);var jM=class extends n1{constructor(e,t,i,n,r,o,a,l,c,h,d,u,f){let{options:m,getAutomaticKeyboardNavigation:g,disposable:b}=sf(t,a,l,d,u,f);super(e,t,i,n,r,o,m);this.disposables.add(b),this.internals=new wl(this,a,g,a.overrideStyles,l,c,h,d,f),this.disposables.add(this.internals)}updateOptions(e){super.updateOptions(e),this.internals.updateOptions(e)}};jM=Ms([le(7,fe),le(8,Xn),le(9,We),le(10,nt),le(11,zt),le(12,jt)],jM);function sf(s,e,t,i,n,r){var o;let a=()=>{let m=Boolean(t.getContextKeyValue(TM));return m&&(m=Boolean(i.getValue(d1))),m},l=r.isScreenReaderOptimized(),c=e.simpleKeyboardNavigation||l?"simple":i.getValue(__),h=e.horizontalScrolling!==void 0?e.horizontalScrolling:Boolean(i.getValue(fn)),[d,u]=v_(e,i,n),f=e.additionalScrollHeight;return{getAutomaticKeyboardNavigation:a,disposable:u,options:Object.assign(Object.assign({keyboardSupport:!1},d),{indent:typeof i.getValue(nf)=="number"?i.getValue(nf):void 0,renderIndentGuides:i.getValue(b_),smoothScrolling:Boolean(i.getValue(Qn)),automaticKeyboardNavigation:a(),simpleKeyboardNavigation:c==="simple",filterOnType:c==="filter",horizontalScrolling:h,keyboardNavigationEventFilter:h5(s,n),additionalScrollHeight:f,hideTwistiesOfChildlessElements:e.hideTwistiesOfChildlessElements,expandOnlyOnTwistieClick:(o=e.expandOnlyOnTwistieClick)!==null&&o!==void 0?o:i.getValue(w_)==="doubleClick"})}}var wl=class{constructor(e,t,i,n,r,o,a,l,c){this.tree=e,this.themeService=a,this.disposables=[],this.contextKeyService=p_(r,e),this.listSupportsMultiSelect=m_.bindTo(this.contextKeyService),this.listSupportsMultiSelect.set(t.multipleSelectionSupport!==!1),g_.bindTo(this.contextKeyService).set(Boolean(t.selectionNavigation)),this.hasSelectionOrFocus=a1.bindTo(this.contextKeyService),this.hasDoubleSelection=l1.bindTo(this.contextKeyService),this.hasMultiSelection=c1.bindTo(this.contextKeyService),this._useAltAsMultipleSelectionModifier=Os(l);let d=new Set;d.add(TM);let u=()=>{let m=c.isScreenReaderOptimized()?"simple":l.getValue(__);e.updateOptions({simpleKeyboardNavigation:m==="simple",filterOnType:m==="filter"})};this.updateStyleOverrides(n),this.disposables.push(this.contextKeyService,o.register(e),e.onDidChangeSelection(()=>{let f=e.getSelection(),m=e.getFocus();this.contextKeyService.bufferChangeEvents(()=>{this.hasSelectionOrFocus.set(f.length>0||m.length>0),this.hasMultiSelection.set(f.length>1),this.hasDoubleSelection.set(f.length===2)})}),e.onDidChangeFocus(()=>{let f=e.getSelection(),m=e.getFocus();this.hasSelectionOrFocus.set(f.length>0||m.length>0)}),l.onDidChangeConfiguration(f=>{let m={};if(f.affectsConfiguration(bl)&&(this._useAltAsMultipleSelectionModifier=Os(l)),f.affectsConfiguration(nf)){let g=l.getValue(nf);m=Object.assign(Object.assign({},m),{indent:g})}if(f.affectsConfiguration(b_)){let g=l.getValue(b_);m=Object.assign(Object.assign({},m),{renderIndentGuides:g})}if(f.affectsConfiguration(Qn)){let g=Boolean(!!l.getValue(Qn));m=Object.assign(Object.assign({},m),{smoothScrolling:g})}if(f.affectsConfiguration(__)&&u(),f.affectsConfiguration(d1)&&(m=Object.assign(Object.assign({},m),{automaticKeyboardNavigation:i()})),f.affectsConfiguration(fn)&&t.horizontalScrolling===void 0){let g=Boolean(!!l.getValue(fn));m=Object.assign(Object.assign({},m),{horizontalScrolling:g})}if(f.affectsConfiguration(w_)&&t.expandOnlyOnTwistieClick===void 0&&(m=Object.assign(Object.assign({},m),{expandOnlyOnTwistieClick:l.getValue(w_)==="doubleClick"})),f.affectsConfiguration(Rs)){let g=l.getValue(Rs);m=Object.assign(Object.assign({},m),{mouseWheelScrollSensitivity:g})}if(f.affectsConfiguration(As)){let g=l.getValue(As);m=Object.assign(Object.assign({},m),{fastScrollSensitivity:g})}Object.keys(m).length>0&&e.updateOptions(m)}),this.contextKeyService.onDidChangeContext(f=>{f.affectsSome(d)&&e.updateOptions({automaticKeyboardNavigation:i()})}),c.onDidChangeScreenReaderOptimized(()=>u())),this.navigator=new PM(e,Object.assign({configurationService:l},t)),this.disposables.push(this.navigator)}get onDidOpen(){return this.navigator.onDidOpen}updateOptions(e){e.multipleSelectionSupport!==void 0&&this.listSupportsMultiSelect.set(!!e.multipleSelectionSupport)}updateStyleOverrides(e){me(this.styler),this.styler=e?ul(this.tree,this.themeService,e):M.None}dispose(){this.disposables=me(this.disposables),me(this.styler),this.styler=void 0}};wl=Ms([le(4,fe),le(5,Xn),le(6,We),le(7,nt),le(8,jt)],wl);var d5=Te.as(vs.Configuration);d5.registerConfiguration({id:"workbench",order:7,title:p("workbenchConfigurationTitle","Workbench"),type:"object",properties:{[bl]:{type:"string",enum:["ctrlCmd","alt"],enumDescriptions:[p("multiSelectModifier.ctrlCmd","Maps to `Control` on Windows and Linux and to `Command` on macOS."),p("multiSelectModifier.alt","Maps to `Alt` on Windows and Linux and to `Option` on macOS.")],default:"ctrlCmd",description:p({key:"multiSelectModifier",comment:["- `ctrlCmd` refers to a value the setting can take and should not be localized.","- `Control` and `Command` refer to the modifier keys Ctrl or Cmd on the keyboard and can be localized."]},"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.")},[h1]:{type:"string",enum:["singleClick","doubleClick"],default:"singleClick",description:p({key:"openModeModifier",comment:["`singleClick` and `doubleClick` refers to a value the setting can take and should not be localized."]},"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.")},[fn]:{type:"boolean",default:!1,description:p("horizontalScrolling setting","Controls whether lists and trees support horizontal scrolling in the workbench. Warning: turning on this setting has a performance implication.")},[nf]:{type:"number",default:8,minimum:0,maximum:40,description:p("tree indent setting","Controls tree indentation in pixels.")},[b_]:{type:"string",enum:["none","onHover","always"],default:"onHover",description:p("render tree indent guides","Controls whether the tree should render indent guides.")},[Qn]:{type:"boolean",default:!1,description:p("list smoothScrolling setting","Controls whether lists and trees have smooth scrolling.")},[Rs]:{type:"number",default:1,description:p("Mouse Wheel Scroll Sensitivity","A multiplier to be used on the deltaX and deltaY of mouse wheel scroll events.")},[As]:{type:"number",default:5,description:p("Fast Scroll Sensitivity","Scrolling speed multiplier when pressing Alt.")},[__]:{type:"string",enum:["simple","highlight","filter"],enumDescriptions:[p("keyboardNavigationSettingKey.simple","Simple keyboard navigation focuses elements which match the keyboard input. Matching is done only on prefixes."),p("keyboardNavigationSettingKey.highlight","Highlight keyboard navigation highlights elements which match the keyboard input. Further up and down navigation will traverse only the highlighted elements."),p("keyboardNavigationSettingKey.filter","Filter keyboard navigation will filter out and hide all the elements which do not match the keyboard input.")],default:"highlight",description:p("keyboardNavigationSettingKey","Controls the keyboard navigation style for lists and trees in the workbench. Can be simple, highlight and filter.")},[d1]:{type:"boolean",default:!0,markdownDescription:p("automatic keyboard navigation setting","Controls whether keyboard navigation in lists and trees is automatically triggered simply by typing. If set to `false`, keyboard navigation is only triggered when executing the `list.toggleKeyboardNavigation` command, for which you can assign a keyboard shortcut.")},[w_]:{type:"string",enum:["singleClick","doubleClick"],default:"singleClick",description:p("expand mode","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.")}}});var Wi;(function(s){s[s.Hint=1]="Hint",s[s.Info=2]="Info",s[s.Warning=4]="Warning",s[s.Error=8]="Error"})(Wi||(Wi={}));(function(s){function e(o,a){return a-o}s.compare=e;let t=Object.create(null);t[s.Error]=p("sev.error","Error"),t[s.Warning]=p("sev.warning","Warning"),t[s.Info]=p("sev.info","Info");function i(o){return t[o]||""}s.toString=i;function n(o){switch(o){case Ye.Error:return s.Error;case Ye.Warning:return s.Warning;case Ye.Info:return s.Info;case Ye.Ignore:return s.Hint}}s.fromSeverity=n;function r(o){switch(o){case s.Error:return Ye.Error;case s.Warning:return Ye.Warning;case s.Info:return Ye.Info;case s.Hint:return Ye.Ignore}}s.toSeverity=r})(Wi||(Wi={}));var zM;(function(s){let e="";function t(n){return i(n,!0)}s.makeKey=t;function i(n,r){let o=[e];return n.source?o.push(n.source.replace("\xA6","\\\xA6")):o.push(e),n.code?typeof n.code=="string"?o.push(n.code.replace("\xA6","\\\xA6")):o.push(n.code.value.replace("\xA6","\\\xA6")):o.push(e),n.severity!==void 0&&n.severity!==null?o.push(Wi.toString(n.severity)):o.push(e),n.message&&r?o.push(n.message.replace("\xA6","\\\xA6")):o.push(e),n.startLineNumber!==void 0&&n.startLineNumber!==null?o.push(n.startLineNumber.toString()):o.push(e),n.startColumn!==void 0&&n.startColumn!==null?o.push(n.startColumn.toString()):o.push(e),n.endLineNumber!==void 0&&n.endLineNumber!==null?o.push(n.endLineNumber.toString()):o.push(e),n.endColumn!==void 0&&n.endColumn!==null?o.push(n.endColumn.toString()):o.push(e),o.push(e),o.join("\xA6")}s.makeKeyOptionalMessage=i})(zM||(zM={}));var y_=$("markerService");var HM=class{constructor(){this._byResource=new At,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 r=this._byOwner.get(t);r||(r=new At,this._byOwner.set(t,r)),r.set(e,i)}get(e,t){let i=this._byResource.get(e);return i==null?void 0:i.get(t)}delete(e,t){let i=!1,n=!1,r=this._byResource.get(e);r&&(i=r.delete(t));let o=this._byOwner.get(t);if(o&&(n=o.delete(e)),i!==n)throw new Error("illegal state");return i&&n}values(e){var t,i,n,r;return typeof e=="string"?(i=(t=this._byOwner.get(e))===null||t===void 0?void 0:t.values())!==null&&i!==void 0?i:re.empty():K.isUri(e)?(r=(n=this._byResource.get(e))===null||n===void 0?void 0:n.values())!==null&&r!==void 0?r:re.empty():re.map(re.concat(...this._byOwner.values()),o=>o[1])}},UM=class{constructor(e){this.errors=0,this.infos=0,this.warnings=0,this.unknowns=0,this._data=new At,this._service=e,this._subscription=e.onMarkerChanged(this._update,this)}dispose(){this._subscription.dispose()}_update(e){for(let t of e){let i=this._data.get(t);i&&this._substract(i);let n=this._resourceStats(t);this._add(n),this._data.set(t,n)}}_resourceStats(e){let t={errors:0,warnings:0,infos:0,unknowns:0};if(e.scheme===Ce.inMemory||e.scheme===Ce.walkThrough||e.scheme===Ce.walkThroughSnippet)return t;for(let{severity:i}of this._service.read({resource:e}))i===Wi.Error?t.errors+=1:i===Wi.Warning?t.warnings+=1:i===Wi.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}},Er=class{constructor(){this._onMarkerChanged=new ib({delay:0,merge:Er._merge}),this.onMarkerChanged=this._onMarkerChanged.event,this._data=new HM,this._stats=new UM(this)}dispose(){this._stats.dispose(),this._onMarkerChanged.dispose()}remove(e,t){for(let i of t||[])this.changeOne(e,i,[])}changeOne(e,t,i){if(Cx(i))this._data.delete(t,e)&&this._onMarkerChanged.fire([t]);else{let n=[];for(let r of i){let o=Er._toMarker(e,t,r);o&&n.push(o)}this._data.set(t,e,n),this._onMarkerChanged.fire([t])}}static _toMarker(e,t,i){let{code:n,severity:r,message:o,source:a,startLineNumber:l,startColumn:c,endLineNumber:h,endColumn:d,relatedInformation:u,tags:f}=i;if(!!o)return l=l>0?l:1,c=c>0?c:1,h=h>=l?h:l,d=d>0?d:c,{resource:t,owner:e,code:n,severity:r,message:o,source:a,startLineNumber:l,startColumn:c,endLineNumber:h,endColumn:d,relatedInformation:u,tags:f}}read(e=Object.create(null)){let{owner:t,resource:i,severities:n,take:r}=e;if((!r||r<0)&&(r=-1),t&&i){let o=this._data.get(i,t);if(o){let a=[];for(let l of o)if(Er._accept(l,n)){let c=a.push(l);if(r>0&&c===r)break}return a}else return[]}else if(!t&&!i){let o=[];for(let a of this._data.values())for(let l of a)if(Er._accept(l,n)){let c=o.push(l);if(r>0&&c===r)return o}return o}else{let o=this._data.values(i!=null?i:t),a=[];for(let l of o)for(let c of l)if(Er._accept(c,n)){let h=a.push(c);if(r>0&&h===r)return a}return a}}static _accept(e,t){return t===void 0||(t&e.severity)===e.severity}static _merge(e){let t=new At;for(let i of e)for(let n of i)t.set(n,!0);return Array.from(t.keys())}};var L_=function(s,e,t,i){function n(r){return r instanceof t?r:new t(function(o){o(r)})}return new(t||(t=Promise))(function(r,o){function a(h){try{c(i.next(h))}catch(d){o(d)}}function l(h){try{c(i.throw(h))}catch(d){o(d)}}function c(h){h.done?r(h.value):n(h.value).then(a,l)}c((i=i.apply(s,e||[])).next())})},hh;(function(s){s[s.None=0]="None",s[s.Initialized=1]="Initialized",s[s.Closed=2]="Closed"})(hh||(hh={}));var vl=class extends M{constructor(e,t=Object.create(null)){super();this.database=e,this.options=t,this._onDidChangeStorage=this._register(new k),this.onDidChangeStorage=this._onDidChangeStorage.event,this.state=hh.None,this.cache=new Map,this.flushDelayer=new ub(vl.DEFAULT_FLUSH_DELAY),this.pendingDeletes=new Set,this.pendingInserts=new Map,this.whenFlushedCallbacks=[],this.registerListeners()}registerListeners(){this._register(this.database.onDidChangeItemsExternal(e=>this.onDidChangeItemsExternal(e)))}onDidChangeItemsExternal(e){var t,i;(t=e.changed)===null||t===void 0||t.forEach((n,r)=>this.accept(r,n)),(i=e.deleted)===null||i===void 0||i.forEach(n=>this.accept(n,void 0))}accept(e,t){if(this.state===hh.Closed)return;let i=!1;Jt(t)?i=this.cache.delete(e):this.cache.get(e)!==t&&(this.cache.set(e,t),i=!0),i&&this._onDidChangeStorage.fire(e)}get(e,t){let i=this.cache.get(e);return Jt(i)?t:i}getBoolean(e,t){let i=this.get(e);return Jt(i)?t:i==="true"}getNumber(e,t){let i=this.get(e);return Jt(i)?t:parseInt(i,10)}set(e,t){return L_(this,void 0,void 0,function*(){if(this.state===hh.Closed)return;if(Jt(t))return this.delete(e);let i=String(t);if(this.cache.get(e)!==i)return this.cache.set(e,i),this.pendingInserts.set(e,i),this.pendingDeletes.delete(e),this._onDidChangeStorage.fire(e),this.flushDelayer.trigger(()=>this.flushPending())})}delete(e){return L_(this,void 0,void 0,function*(){if(!(this.state===hh.Closed||!this.cache.delete(e)))return this.pendingDeletes.has(e)||this.pendingDeletes.add(e),this.pendingInserts.delete(e),this._onDidChangeStorage.fire(e),this.flushDelayer.trigger(()=>this.flushPending())})}get hasPending(){return this.pendingInserts.size>0||this.pendingDeletes.size>0}flushPending(){return L_(this,void 0,void 0,function*(){if(!this.hasPending)return;let e={insert:this.pendingInserts,delete:this.pendingDeletes};return this.pendingDeletes=new Set,this.pendingInserts=new Map,this.database.updateItems(e).finally(()=>{var t;if(!this.hasPending)for(;this.whenFlushedCallbacks.length;)(t=this.whenFlushedCallbacks.pop())===null||t===void 0||t()})})}dispose(){this.flushDelayer.dispose(),super.dispose()}};vl.DEFAULT_FLUSH_DELAY=100;var x_=class{constructor(){this.onDidChangeItemsExternal=j.None,this.items=new Map}updateItems(e){return L_(this,void 0,void 0,function*(){e.insert&&e.insert.forEach((t,i)=>this.items.set(i,t)),e.delete&&e.delete.forEach(t=>this.items.delete(t))})}};var D_="__$__targetStorageMarker",$M=$("storageService"),KM;(function(s){s[s.NONE=0]="NONE",s[s.SHUTDOWN=1]="SHUTDOWN"})(KM||(KM={}));var rf=class extends M{constructor(e={flushInterval:rf.DEFAULT_FLUSH_INTERVAL}){super();this.options=e,this._onDidChangeValue=this._register(new Qo),this._onDidChangeTarget=this._register(new Qo),this._onWillSaveState=this._register(new k),this.onWillSaveState=this._onWillSaveState.event,this._workspaceKeyTargets=void 0,this._globalKeyTargets=void 0}emitDidChangeValue(e,t){t===D_?(e===0?this._globalKeyTargets=void 0:e===1&&(this._workspaceKeyTargets=void 0),this._onDidChangeTarget.fire({scope:e})):this._onDidChangeValue.fire({scope:e,key:t,target:this.getKeyTargets(e)[t]})}get(e,t,i){var n;return(n=this.getStorage(t))===null||n===void 0?void 0:n.get(e,i)}getBoolean(e,t,i){var n;return(n=this.getStorage(t))===null||n===void 0?void 0:n.getBoolean(e,i)}getNumber(e,t,i){var n;return(n=this.getStorage(t))===null||n===void 0?void 0:n.getNumber(e,i)}store(e,t,i,n){if(Jt(t)){this.remove(e,i);return}this.withPausedEmitters(()=>{var r;this.updateKeyTarget(e,i,n),(r=this.getStorage(i))===null||r===void 0||r.set(e,t)})}remove(e,t){this.withPausedEmitters(()=>{var i;this.updateKeyTarget(e,t,void 0),(i=this.getStorage(t))===null||i===void 0||i.delete(e)})}withPausedEmitters(e){this._onDidChangeValue.pause(),this._onDidChangeTarget.pause();try{e()}finally{this._onDidChangeValue.resume(),this._onDidChangeTarget.resume()}}updateKeyTarget(e,t,i){var n,r;let o=this.getKeyTargets(t);typeof i=="number"?o[e]!==i&&(o[e]=i,(n=this.getStorage(t))===null||n===void 0||n.set(D_,JSON.stringify(o))):typeof o[e]=="number"&&(delete o[e],(r=this.getStorage(t))===null||r===void 0||r.set(D_,JSON.stringify(o)))}get workspaceKeyTargets(){return this._workspaceKeyTargets||(this._workspaceKeyTargets=this.loadKeyTargets(1)),this._workspaceKeyTargets}get globalKeyTargets(){return this._globalKeyTargets||(this._globalKeyTargets=this.loadKeyTargets(0)),this._globalKeyTargets}getKeyTargets(e){return e===0?this.globalKeyTargets:this.workspaceKeyTargets}loadKeyTargets(e){let t=this.get(D_,e);if(t)try{return JSON.parse(t)}catch(i){}return Object.create(null)}};rf.DEFAULT_FLUSH_INTERVAL=60*1e3;var f1=class extends rf{constructor(){super();this.globalStorage=this._register(new vl(new x_)),this.workspaceStorage=this._register(new vl(new x_)),this._register(this.workspaceStorage.onDidChangeStorage(e=>this.emitDidChangeValue(1,e))),this._register(this.globalStorage.onDidChangeStorage(e=>this.emitDidChangeValue(0,e)))}getStorage(e){return e===0?this.globalStorage:this.workspaceStorage}};var qM=function(s,e,t,i){var n=arguments.length,r=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(s,e,t,i);else for(var a=s.length-1;a>=0;a--)(o=s[a])&&(r=(n<3?o(r):n>3?o(e,t,r):o(e,t))||r);return n>3&&r&&Object.defineProperty(e,t,r),r},E_=function(s,e){return function(t,i){e(t,i,s)}},k_=class{constructor(e){this._commandService=e}createMenu(e,t,i=!1){return new m1(e,i,this._commandService,t,this)}};k_=qM([E_(0,It)],k_);var m1=class dh{constructor(e,t,i,n,r){this._id=e,this._fireEventsForSubmenuChanges=t,this._commandService=i,this._contextKeyService=n,this._menuService=r,this._disposables=new U,this._menuGroups=[],this._contextKeys=new Set,this._build();let o=new $e(()=>{this._build(),this._onDidChange.fire(this)},50);this._disposables.add(o),this._disposables.add(Gr.onDidChangeMenu(c=>{c.has(e)&&o.schedule()}));let a=this._disposables.add(new U),l=()=>{let c=new $e(()=>this._onDidChange.fire(this),50);a.add(c),a.add(n.onDidChangeContext(h=>{h.affectsSome(this._contextKeys)&&c.schedule()}))};this._onDidChange=new k({onFirstListenerAdd:l,onLastListenerRemove:a.clear.bind(a)}),this.onDidChange=this._onDidChange.event}dispose(){this._disposables.dispose(),this._onDidChange.dispose()}_build(){this._menuGroups.length=0,this._contextKeys.clear();let e=Gr.getMenuItems(this._id),t;e.sort(dh._compareMenuItems);for(let i of e){let n=i.group||"";(!t||t[0]!==n)&&(t=[n,[]],this._menuGroups.push(t)),t[1].push(i),this._collectContextKeys(i)}}_collectContextKeys(e){if(dh._fillInKbExprKeys(e.when,this._contextKeys),$l(e)){if(e.command.precondition&&dh._fillInKbExprKeys(e.command.precondition,this._contextKeys),e.command.toggled){let t=e.command.toggled.condition||e.command.toggled;dh._fillInKbExprKeys(t,this._contextKeys)}}else this._fireEventsForSubmenuChanges&&Gr.getMenuItems(e.submenu).forEach(this._collectContextKeys,this)}getActions(e){let t=[];for(let i of this._menuGroups){let[n,r]=i,o=[];for(let a of r)if(this._contextKeyService.contextMatchesRules(a.when)){let l=$l(a)?new cm(a.command,a.alt,e,this._contextKeyService,this._commandService):new Fb(a,this._menuService,this._contextKeyService,e);o.push(l)}o.length>0&&t.push([n,o])}return t}static _fillInKbExprKeys(e,t){if(e)for(let i of e.keys())t.add(i)}static _compareMenuItems(e,t){let 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;let a=i.localeCompare(n);if(a!==0)return a}let r=e.order||0,o=t.order||0;return ro?1:dh._compareTitles($l(e)?e.command.title:e.title,$l(t)?t.command.title:t.title)}static _compareTitles(e,t){let i=typeof e=="string"?e:e.original,n=typeof t=="string"?t:t.original;return i.localeCompare(n)}};m1=qM([E_(2,It),E_(3,fe),E_(4,lm)],m1);var u5=function(s,e,t,i){var n=arguments.length,r=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(s,e,t,i);else for(var a=s.length-1;a>=0;a--)(o=s[a])&&(r=(n<3?o(r):n>3?o(e,t,r):o(e,t))||r);return n>3&&r&&Object.defineProperty(e,t,r),r},GM=function(s,e){return function(t,i){e(t,i,s)}},YM=class extends M{constructor(e){super();this.model=e,this._markersData=new Map,this._register(oe(()=>{this.model.deltaDecorations([...this._markersData.keys()],[]),this._markersData.clear()}))}update(e,t){let i=[...this._markersData.keys()];this._markersData.clear();let n=this.model.deltaDecorations(i,t);for(let r=0;rthis._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){let i=this._markerDecorations.get(e);return i&&i.getMarker(t)||null}_handleMarkerChange(e){e.forEach(t=>{let i=this._markerDecorations.get(t);i&&this._updateDecorations(i)})}_onModelAdded(e){let t=new YM(e);this._markerDecorations.set(e.uri,t),this._updateDecorations(t)}_onModelRemoved(e){let t=this._markerDecorations.get(e.uri);t&&(t.dispose(),this._markerDecorations.delete(e.uri)),(e.uri.scheme===Ce.inMemory||e.uri.scheme===Ce.internal||e.uri.scheme===Ce.vscode)&&this._markerService&&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}),i=t.map(n=>({range:this._createDecorationRange(e.model,n),options:this._createDecorationOption(n)}));e.update(t,i)&&this._onDidChangeMarker.fire(e.model)}_createDecorationRange(e,t){let i=D.lift(t);if(t.severity===Wi.Hint&&!this._hasMarkerTag(t,1)&&!this._hasMarkerTag(t,2)&&(i=i.setEndPosition(i.startLineNumber,i.startColumn+2)),i=e.validateRange(i),i.isEmpty()){let n=e.getWordAtPosition(i.getStartPosition());if(n)i=new D(i.startLineNumber,n.startColumn,i.endLineNumber,n.endColumn);else{let r=e.getLineLastNonWhitespaceColumn(i.startLineNumber)||e.getLineMaxColumn(i.startLineNumber);r===1||(i.endColumn>=r?i=new D(i.startLineNumber,r-1,i.endLineNumber,r):i=new D(i.startLineNumber,i.startColumn,i.endLineNumber,i.endColumn+1))}}else if(t.endColumn===Number.MAX_VALUE&&t.startColumn===1&&i.startLineNumber===i.endLineNumber){let n=e.getLineFirstNonWhitespaceColumn(t.startLineNumber);n=0:!1}};I_=u5([GM(0,ht),GM(1,y_)],I_);var f5=function(s,e,t,i){var n=arguments.length,r=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(s,e,t,i);else for(var a=s.length-1;a>=0;a--)(o=s[a])&&(r=(n<3?o(r):n>3?o(e,t,r):o(e,t))||r);return n>3&&r&&Object.defineProperty(e,t,r),r},ZM=function(s,e){return function(t,i){e(t,i,s)}},N_=class extends M{constructor(e,t){super();this._contextKeyService=e,this._configurationService=t,this._accessibilitySupport=0,this._onDidChangeScreenReaderOptimized=new k,this._accessibilityModeEnabledContext=vN.bindTo(this._contextKeyService);let i=()=>this._accessibilityModeEnabledContext.set(this.isScreenReaderOptimized());this._register(this._configurationService.onDidChangeConfiguration(n=>{n.affectsConfiguration("editor.accessibilitySupport")&&(i(),this._onDidChangeScreenReaderOptimized.fire())})),i(),this.onDidChangeScreenReaderOptimized(()=>i())}get onDidChangeScreenReaderOptimized(){return this._onDidChangeScreenReaderOptimized.event}isScreenReaderOptimized(){let e=this._configurationService.getValue("editor.accessibilitySupport");return e==="on"||e==="auto"&&this._accessibilitySupport===2}getAccessibilitySupport(){return this._accessibilitySupport}};N_=f5([ZM(0,fe),ZM(1,nt)],N_);var T_=function(s,e,t,i){function n(r){return r instanceof t?r:new t(function(o){o(r)})}return new(t||(t=Promise))(function(r,o){function a(h){try{c(i.next(h))}catch(d){o(d)}}function l(h){try{c(i.throw(h))}catch(d){o(d)}}function c(h){h.done?r(h.value):n(h.value).then(a,l)}c((i=i.apply(s,e||[])).next())})},g1=class{constructor(){this.mapTextToType=new Map,this.findText=""}writeText(e,t){return T_(this,void 0,void 0,function*(){if(t){this.mapTextToType.set(t,e);return}try{return yield navigator.clipboard.writeText(e)}catch(r){console.error(r)}let i=document.activeElement,n=document.body.appendChild(H("textarea",{"aria-hidden":!0}));n.style.height="1px",n.style.width="1px",n.style.position="absolute",n.value=e,n.focus(),n.select(),document.execCommand("copy"),i instanceof HTMLElement&&i.focus(),document.body.removeChild(n)})}readText(e){return T_(this,void 0,void 0,function*(){if(e)return this.mapTextToType.get(e)||"";try{return yield navigator.clipboard.readText()}catch(t){return console.error(t),""}})}readFindText(){return T_(this,void 0,void 0,function*(){return this.findText})}writeFindText(e){return T_(this,void 0,void 0,function*(){this.findText=e})}};var m5=function(s,e,t,i){var n=arguments.length,r=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(s,e,t,i);else for(var a=s.length-1;a>=0;a--)(o=s[a])&&(r=(n<3?o(r):n>3?o(e,t,r):o(e,t))||r);return n>3&&r&&Object.defineProperty(e,t,r),r},XM=function(s,e){return function(t,i){e(t,i,s)}},M_=function(s,e,t,i){function n(r){return r instanceof t?r:new t(function(o){o(r)})}return new(t||(t=Promise))(function(r,o){function a(h){try{c(i.next(h))}catch(d){o(d)}}function l(h){try{c(i.throw(h))}catch(d){o(d)}}function c(h){h.done?r(h.value):n(h.value).then(a,l)}c((i=i.apply(s,e||[])).next())})},uh=!1;function R_(s){return s.scheme===Ce.file?s.fsPath:s.path}var QM=0,of=class{constructor(e,t,i,n,r,o,a){this.id=++QM,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=r,this.sourceId=o,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}`}},p1=class{constructor(e,t){this.resourceLabel=e,this.reason=t}},_1=class{constructor(){this.elements=new Map}createMessage(){let e=[],t=[];for(let[,n]of this.elements)(n.reason===0?e:t).push(n.resourceLabel);let i=[];return e.length>0&&i.push(p({key:"externalRemoval",comment:["{0} is a list of filenames"]},"The following files have been closed and modified on disk: {0}.",e.join(", "))),t.length>0&&i.push(p({key:"noParallelUniverses",comment:["{0} is a list of filenames"]},"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)}},JM=class{constructor(e,t,i,n,r,o,a){this.id=++QM,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=r,this.sourceId=o,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 _1),this.removedResources.has(t)||this.removedResources.set(t,new p1(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 _1),this.invalidatedResources.has(t)||this.invalidatedResources.set(t,new p1(e,0)))}toString(){return`[id:${this.id}] [group:${this.groupId}] [${this.invalidatedResources?"INVALID":" VALID"}] ${this.actual.constructor.name} - ${this.actual}`}},b1=class{constructor(e,t){this.resourceLabel=e,this.strResource=t,this._past=[],this._future=[],this.locked=!1,this.versionId=1}dispose(){for(let e of this._past)e.type===1&&e.removeResource(this.resourceLabel,this.strResource,0);for(let e of this._future)e.type===1&&e.removeResource(this.resourceLabel,this.strResource,0);this.versionId++}toString(){let e=[];e.push(`* ${this.strResource}:`);for(let t=0;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(let i of this._past)t(i.actual)&&this._setElementValidFlag(i,e);for(let i of this._future)t(i.actual)&&this._setElementValidFlag(i,e)}pushElement(e){for(let t of this._future)t.type===1&&t.removeResource(this.resourceLabel,this.strResource,1);this._future=[],this._past.push(e),this.versionId++}createSnapshot(e){let t=[];for(let i=0,n=this._past.length;i=0;i--)t.push(this._future[i].id);return new Rp(e,t)}restoreSnapshot(e){let t=e.elements.length,i=!0,n=0,r=-1;for(let a=0,l=this._past.length;a=t||c.id!==e.elements[n])&&(i=!1,r=0),!i&&c.type===1&&c.removeResource(this.resourceLabel,this.strResource,0)}let o=-1;for(let a=this._future.length-1;a>=0;a--,n++){let l=this._future[a];i&&(n>=t||l.id!==e.elements[n])&&(i=!1,o=a),!i&&l.type===1&&l.removeResource(this.resourceLabel,this.strResource,0)}r!==-1&&(this._past=this._past.slice(0,r)),o!==-1&&(this._future=this._future.slice(o+1)),this.versionId++}getElements(){let e=[],t=[];for(let i of this._past)e.push(i.actual);for(let 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++}},A_=class{constructor(e){this.editStacks=e,this._versionIds=[];for(let t=0,i=this.editStacks.length;tt.sourceOrder)&&(t=o,i=n)}return[t,i]}canUndo(e){if(e instanceof kn){let[,i]=this._findClosestUndoElementWithSource(e.id);return!!i}let t=this.getUriComparisonKey(e);return this._editStacks.has(t)?this._editStacks.get(t).hasPastElements():!1}_onError(e,t){de(e);for(let i of t.strResources)this.removeElements(i);this._notificationService.error(e)}_acquireLocks(e){for(let t of e.editStacks)if(t.locked)throw new Error("Cannot acquire edit stack lock");for(let t of e.editStacks)t.locked=!0;return()=>{for(let t of e.editStacks)t.locked=!1}}_safeInvokeWithLocks(e,t,i,n,r){let o=this._acquireLocks(i),a;try{a=t()}catch(l){return o(),n.dispose(),this._onError(l,e)}return a?a.then(()=>(o(),n.dispose(),r()),l=>(o(),n.dispose(),this._onError(l,e))):(o(),n.dispose(),r())}_invokeWorkspacePrepare(e){return M_(this,void 0,void 0,function*(){if(typeof e.actual.prepareUndoRedo=="undefined")return M.None;let t=e.actual.prepareUndoRedo();return typeof t=="undefined"?M.None:t})}_invokeResourcePrepare(e,t){if(e.actual.type!==1||typeof e.actual.prepareUndoRedo=="undefined")return t(M.None);let i=e.actual.prepareUndoRedo();return i?j1(i)?t(i):i.then(n=>t(n)):t(M.None)}_getAffectedEditStacks(e){let t=[];for(let i of e.strResources)t.push(this._editStacks.get(i)||e2);return new A_(t)}_tryToSplitAndUndo(e,t,i,n){if(t.canSplit())return this._splitPastWorkspaceElement(t,i),this._notificationService.warn(n),new lf(this._undo(e,0,!0));for(let r of t.strResources)this.removeElements(r);return this._notificationService.warn(n),new lf}_checkWorkspaceUndo(e,t,i,n){if(t.removedResources)return this._tryToSplitAndUndo(e,t,t.removedResources,p({key:"cannotWorkspaceUndo",comment:["{0} is a label for an operation. {1} is another message."]},"Could not undo '{0}' across all files. {1}",t.label,t.removedResources.createMessage()));if(n&&t.invalidatedResources)return this._tryToSplitAndUndo(e,t,t.invalidatedResources,p({key:"cannotWorkspaceUndo",comment:["{0} is a label for an operation. {1} is another message."]},"Could not undo '{0}' across all files. {1}",t.label,t.invalidatedResources.createMessage()));let r=[];for(let a of i.editStacks)a.getClosestPastElement()!==t&&r.push(a.resourceLabel);if(r.length>0)return this._tryToSplitAndUndo(e,t,null,p({key:"cannotWorkspaceUndoDueToChanges",comment:["{0} is a label for an operation. {1} is a list of filenames."]},"Could not undo '{0}' across all files because changes were made to {1}",t.label,r.join(", ")));let o=[];for(let a of i.editStacks)a.locked&&o.push(a.resourceLabel);return o.length>0?this._tryToSplitAndUndo(e,t,null,p({key:"cannotWorkspaceUndoDueToInProgressUndoRedo",comment:["{0} is a label for an operation. {1} is a list of filenames."]},"Could not undo '{0}' across all files because there is already an undo or redo operation running on {1}",t.label,o.join(", "))):i.isValid()?null:this._tryToSplitAndUndo(e,t,null,p({key:"cannotWorkspaceUndoDueToInMeantimeUndoRedo",comment:["{0} is a label for an operation. {1} is a list of filenames."]},"Could not undo '{0}' across all files because an undo or redo operation occurred in the meantime",t.label))}_workspaceUndo(e,t,i){let n=this._getAffectedEditStacks(t),r=this._checkWorkspaceUndo(e,t,n,!1);return r?r.returnValue:this._confirmAndExecuteWorkspaceUndo(e,t,n,i)}_isPartOfUndoGroup(e){if(!e.groupId)return!1;for(let[,t]of this._editStacks){let i=t.getClosestPastElement();if(!!i){if(i===e){let n=t.getSecondClosestPastElement();if(n&&n.groupId===e.groupId)return!0}if(i.groupId===e.groupId)return!0}}return!1}_confirmAndExecuteWorkspaceUndo(e,t,i,n){return M_(this,void 0,void 0,function*(){if(t.canSplit()&&!this._isPartOfUndoGroup(t)){let a=yield this._dialogService.show(Ye.Info,p("confirmWorkspace","Would you like to undo '{0}' across all files?",t.label),[p({key:"ok",comment:["{0} denotes a number that is > 1"]},"Undo in {0} Files",i.editStacks.length),p("nok","Undo this File"),p("cancel","Cancel")],{cancelId:2});if(a.choice===2)return;if(a.choice===1)return this._splitPastWorkspaceElement(t,null),this._undo(e,0,!0);let l=this._checkWorkspaceUndo(e,t,i,!1);if(l)return l.returnValue;n=!0}let r;try{r=yield this._invokeWorkspacePrepare(t)}catch(a){return this._onError(a,t)}let o=this._checkWorkspaceUndo(e,t,i,!0);if(o)return r.dispose(),o.returnValue;for(let a of i.editStacks)a.moveBackward(t);return this._safeInvokeWithLocks(t,()=>t.actual.undo(),i,r,()=>this._continueUndoInGroup(t.groupId,n))})}_resourceUndo(e,t,i){if(!t.isValid){e.flushAllElements();return}if(e.locked){let n=p({key:"cannotResourceUndoDueToInProgressUndoRedo",comment:["{0} is a label for an operation."]},"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 A_([e]),n,()=>this._continueUndoInGroup(t.groupId,i))))}_findClosestUndoElementInGroup(e){if(!e)return[null,null];let t=null,i=null;for(let[n,r]of this._editStacks){let o=r.getClosestPastElement();!o||o.groupId===e&&(!t||o.groupOrder>t.groupOrder)&&(t=o,i=n)}return[t,i]}_continueUndoInGroup(e,t){if(!e)return;let[,i]=this._findClosestUndoElementInGroup(e);if(i)return this._undo(i,0,t)}undo(e){if(e instanceof kn){let[,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;let n=this._editStacks.get(e),r=n.getClosestPastElement();if(!r)return;if(r.groupId){let[a,l]=this._findClosestUndoElementInGroup(r.groupId);if(r!==a&&l)return this._undo(l,t,i)}if((r.sourceId!==t||r.confirmBeforeUndo)&&!i)return this._confirmAndContinueUndo(e,t,r);try{return r.type===1?this._workspaceUndo(e,r,i):this._resourceUndo(n,r,i)}finally{uh&&this._print("undo")}}_confirmAndContinueUndo(e,t,i){return M_(this,void 0,void 0,function*(){if((yield this._dialogService.show(Ye.Info,p("confirmDifferentSource","Would you like to undo '{0}'?",i.label),[p("confirmDifferentSource.yes","Yes"),p("cancel","Cancel")],{cancelId:1})).choice!==1)return this._undo(e,t,!0)})}_findClosestRedoElementWithSource(e){if(!e)return[null,null];let t=null,i=null;for(let[n,r]of this._editStacks){let o=r.getClosestFutureElement();!o||o.sourceId===e&&(!t||o.sourceOrder0)return this._tryToSplitAndRedo(e,t,null,p({key:"cannotWorkspaceRedoDueToChanges",comment:["{0} is a label for an operation. {1} is a list of filenames."]},"Could not redo '{0}' across all files because changes were made to {1}",t.label,r.join(", ")));let o=[];for(let a of i.editStacks)a.locked&&o.push(a.resourceLabel);return o.length>0?this._tryToSplitAndRedo(e,t,null,p({key:"cannotWorkspaceRedoDueToInProgressUndoRedo",comment:["{0} is a label for an operation. {1} is a list of filenames."]},"Could not redo '{0}' across all files because there is already an undo or redo operation running on {1}",t.label,o.join(", "))):i.isValid()?null:this._tryToSplitAndRedo(e,t,null,p({key:"cannotWorkspaceRedoDueToInMeantimeUndoRedo",comment:["{0} is a label for an operation. {1} is a list of filenames."]},"Could not redo '{0}' across all files because an undo or redo operation occurred in the meantime",t.label))}_workspaceRedo(e,t){let i=this._getAffectedEditStacks(t),n=this._checkWorkspaceRedo(e,t,i,!1);return n?n.returnValue:this._executeWorkspaceRedo(e,t,i)}_executeWorkspaceRedo(e,t,i){return M_(this,void 0,void 0,function*(){let n;try{n=yield this._invokeWorkspacePrepare(t)}catch(o){return this._onError(o,t)}let r=this._checkWorkspaceRedo(e,t,i,!0);if(r)return n.dispose(),r.returnValue;for(let o of i.editStacks)o.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){let i=p({key:"cannotResourceRedoDueToInProgressUndoRedo",comment:["{0} is a label for an operation."]},"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 A_([e]),i,()=>this._continueRedoInGroup(t.groupId))))}_findClosestRedoElementInGroup(e){if(!e)return[null,null];let t=null,i=null;for(let[n,r]of this._editStacks){let o=r.getClosestFutureElement();!o||o.groupId===e&&(!t||o.groupOrder{let s=new Intl.Collator(void 0,{numeric:!0,sensitivity:"base"});return{collator:s,collatorIsNumeric:s.resolvedOptions().numeric}});function g5(s,e,t=!1){let i=s||"",n=e||"",r=i2.value.collator.compare(i,n);return i2.value.collatorIsNumeric&&r===0&&i!==n?in.length)return 1}return 0}var _5=new RegExp(`(\\\\)?\\$\\((${Kt.iconNameExpression}(?:${Kt.iconModifierExpression})?)\\)`,"g");function qo(s){let e=new Array,t,i=0,n=0;for(;(t=_5.exec(s))!==null;){n=t.index||0,e.push(s.substring(i,n)),i=(t.index||0)+t[0].length;let[,r,o]=t;e.push(r?`$(${o})`:b5({id:o}))}return i{n=r===`\r +`?-1:0,o+=i;for(let a of t)a.end<=o||(a.start>=o&&(a.start+=n),a.end>=o&&(a.end+=n));return i+=n,"\u23CE"})}};var w1=function(s,e,t,i){function n(r){return r instanceof t?r:new t(function(o){o(r)})}return new(t||(t=Promise))(function(r,o){function a(h){try{c(i.next(h))}catch(d){o(d)}}function l(h){try{c(i.throw(h))}catch(d){o(d)}}function c(h){h.done?r(h.value):n(h.value).then(a,l)}c((i=i.apply(s,e||[])).next())})};function s2(s,e){Ni(e)?s.title=e:(e==null?void 0:e.markdownNotSupportedFallback)?s.title=e.markdownNotSupportedFallback:s.removeAttribute("title")}function r2(s,e,t){if(!t)return;let i=w5(t),n,r,o=l=>{if(n)return;let c=new hi,h=w=>{let _=w.type===z.MOUSE_DOWN;_&&(r==null||r.dispose(),r=void 0),(_||w.fromElement===e)&&(n==null||n.dispose(),n=void 0)},d=O(e,z.MOUSE_LEAVE,h,!0),u=O(e,z.MOUSE_DOWN,h,!0),f={targetElements:[e],dispose:()=>{}},m;if(s.placement===void 0||s.placement==="mouse"){let w=_=>f.x=_.x+10;m=O(e,z.MOUSE_MOVE,w,!0)}let g=()=>w1(this,void 0,void 0,function*(){var w;if(n){let _={text:p("iconLabel.loading","Loading..."),target:f,hoverPosition:2};r==null||r.dispose(),r=s.showHover(_);let v=(w=yield i(c.token))!==null&&w!==void 0?w:Ni(t)?void 0:t.markdownNotSupportedFallback;if(r==null||r.dispose(),r=void 0,v&&n){let C={text:v,target:f,showPointer:s.placement==="element",hoverPosition:2};r=s.showHover(C)}}m==null||m.dispose()}),b=new $e(g,s.delay);b.schedule(),n=oe(()=>{b.dispose(),m==null||m.dispose(),u.dispose(),d.dispose(),c.dispose(!0)})},a=O(e,z.MOUSE_OVER,o,!0);return oe(()=>{a.dispose(),n==null||n.dispose(),r==null||r.dispose()})}function w5(s){if(Ni(s))return()=>w1(this,void 0,void 0,function*(){return s});if(ta(s.markdown))return s.markdown;{let e=s.markdown;return()=>w1(this,void 0,void 0,function*(){return e})}}var O_=class{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 className(e){this.disposed||e===this._className||(this._className=e,this._element.className=e)}set empty(e){this.disposed||e===this._empty||(this._empty=e,this._element.style.marginLeft=e?"0":"")}dispose(){this.disposed=!0}},v1=class extends M{constructor(e,t){super();this.customHovers=new Map,this.domNode=this._register(new O_(W(e,H(".monaco-icon-label")))),this.labelContainer=W(this.domNode.element,H(".monaco-icon-label-container"));let i=W(this.labelContainer,H("span.monaco-icon-name-container"));this.descriptionContainer=this._register(new O_(W(this.labelContainer,H("span.monaco-icon-description-container")))),(t==null?void 0:t.supportHighlights)||(t==null?void 0:t.supportIcons)?this.nameNode=new a2(i,!!t.supportIcons):this.nameNode=new o2(i),(t==null?void 0:t.supportDescriptionHighlights)?this.descriptionNodeFactory=()=>new Ps(W(this.descriptionContainer.element,H("span.label-description")),!!t.supportIcons):this.descriptionNodeFactory=()=>this._register(new O_(W(this.descriptionContainer.element,H("span.label-description")))),this.hoverDelegate=t==null?void 0:t.hoverDelegate}setLabel(e,t,i){let n=["monaco-icon-label"];i&&(i.extraClasses&&n.push(...i.extraClasses),i.italic&&n.push("italic"),i.strikethrough&&n.push("strikethrough")),this.domNode.className=n.join(" "),this.setupHover(this.labelContainer,i==null?void 0:i.title),this.nameNode.setLabel(e,i),(t||this.descriptionNode)&&(this.descriptionNode||(this.descriptionNode=this.descriptionNodeFactory()),this.descriptionNode instanceof Ps?(this.descriptionNode.set(t||"",i?i.descriptionMatches:void 0),this.setupHover(this.descriptionNode.element,i==null?void 0:i.descriptionTitle)):(this.descriptionNode.textContent=t||"",this.setupHover(this.descriptionNode.element,(i==null?void 0:i.descriptionTitle)||""),this.descriptionNode.empty=!t))}setupHover(e,t){let i=this.customHovers.get(e);if(i&&(i.dispose(),this.customHovers.delete(e)),!t){e.removeAttribute("title");return}if(!this.hoverDelegate)s2(e,t);else{let n=r2(this.hoverDelegate,e,t);n&&this.customHovers.set(e,n)}}dispose(){super.dispose();for(let e of this.customHovers.values())e.dispose();this.customHovers.clear()}},o2=class{constructor(e){this.container=e,this.label=void 0,this.singleLabel=void 0}setLabel(e,t){if(!(this.label===e&&an(this.options,t)))if(this.label=e,this.options=t,typeof e=="string")this.singleLabel||(this.container.innerText="",this.container.classList.remove("multiple"),this.singleLabel=W(this.container,H("a.label-name",{id:t==null?void 0:t.domId}))),this.singleLabel.textContent=e;else{this.container.innerText="",this.container.classList.add("multiple"),this.singleLabel=void 0;for(let i=0;i{let r={start:i,end:i+n.length},o=t.map(a=>Dt.intersect(r,a)).filter(a=>!Dt.isEmpty(a)).map(({start:a,end:l})=>({start:a-i,end:l-i}));return i=r.end+e.length,o})}var a2=class{constructor(e,t){this.container=e,this.supportIcons=t,this.label=void 0,this.singleLabel=void 0}setLabel(e,t){if(!(this.label===e&&an(this.options,t)))if(this.label=e,this.options=t,typeof e=="string")this.singleLabel||(this.container.innerText="",this.container.classList.remove("multiple"),this.singleLabel=new Ps(W(this.container,H("a.label-name",{id:t==null?void 0:t.domId})),this.supportIcons)),this.singleLabel.set(e,t==null?void 0:t.matches,void 0,t==null?void 0:t.labelEscapeNewLines);else{this.container.innerText="",this.container.classList.add("multiple"),this.singleLabel=void 0;let i=(t==null?void 0:t.separator)||"/",n=v5(e,i,t==null?void 0:t.matches);for(let r=0;r=0;a--)(o=s[a])&&(r=(n<3?o(r):n>3?o(e,t,r):o(e,t))||r);return n>3&&r&&Object.defineProperty(e,t,r),r},S5=function(s,e,t,i){function n(r){return r instanceof t?r:new t(function(o){o(r)})}return new(t||(t=Promise))(function(r,o){function a(h){try{c(i.next(h))}catch(d){o(d)}}function l(h){try{c(i.throw(h))}catch(d){o(d)}}function c(h){h.done?r(h.value):n(h.value).then(a,l)}c((i=i.apply(s,e||[])).next())})},Fs=H,c2=class{constructor(e){this.hidden=!1,this._onChecked=new k,this.onChecked=this._onChecked.event,Object.assign(this,e)}get checked(){return!!this._checked}set checked(e){e!==this._checked&&(this._checked=e,this._onChecked.fire(e))}dispose(){this._onChecked.dispose()}},mh=class{get templateId(){return mh.ID}renderTemplate(e){let t=Object.create(null);t.toDisposeElement=[],t.toDisposeTemplate=[],t.entry=W(e,Fs(".quick-input-list-entry"));let i=W(t.entry,Fs("label.quick-input-list-label"));t.toDisposeTemplate.push(lt(i,z.CLICK,c=>{t.checkbox.offsetParent||c.preventDefault()})),t.checkbox=W(i,Fs("input.quick-input-list-checkbox")),t.checkbox.type="checkbox",t.toDisposeTemplate.push(lt(t.checkbox,z.CHANGE,c=>{t.element.checked=t.checkbox.checked}));let n=W(i,Fs(".quick-input-list-rows")),r=W(n,Fs(".quick-input-list-row")),o=W(n,Fs(".quick-input-list-row"));t.label=new v1(r,{supportHighlights:!0,supportDescriptionHighlights:!0,supportIcons:!0});let a=W(r,Fs(".quick-input-list-entry-keybinding"));t.keybinding=new hf(a,Ii);let l=W(o,Fs(".quick-input-list-label-meta"));return t.detail=new Ps(l,!0),t.separator=W(t.entry,Fs(".quick-input-list-separator")),t.actionBar=new En(t.entry),t.actionBar.domNode.classList.add("quick-input-list-entry-action-bar"),t.toDisposeTemplate.push(t.actionBar),t}renderElement(e,t,i){i.toDisposeElement=me(i.toDisposeElement),i.element=e,i.checkbox.checked=e.checked,i.toDisposeElement.push(e.onChecked(c=>i.checkbox.checked=c));let{labelHighlights:n,descriptionHighlights:r,detailHighlights:o}=e,a=Object.create(null);a.matches=n||[],a.descriptionTitle=e.saneDescription,a.descriptionMatches=r||[],a.extraClasses=e.item.iconClasses,a.italic=e.item.italic,a.strikethrough=e.item.strikethrough,i.label.setLabel(e.saneLabel,e.saneDescription,a),i.keybinding.set(e.item.keybinding),i.detail.set(e.saneDetail,o),e.separator&&e.separator.label?(i.separator.textContent=e.separator.label,i.separator.style.display=""):i.separator.style.display="none",i.entry.classList.toggle("quick-input-list-separator-border",!!e.separator),i.actionBar.clear();let l=e.item.buttons;l&&l.length?(i.actionBar.push(l.map((c,h)=>{let d=c.iconClass||(c.iconPath?cf(c.iconPath):void 0);c.alwaysVisible&&(d=d?`${d} always-visible`:"always-visible");let u=new _i(`id-${h}`,"",d,!0,()=>S5(this,void 0,void 0,function*(){e.fireButtonTriggered({button:c,item:e.item})}));return u.tooltip=c.tooltip||"",u}),{icon:!0,label:!1}),i.entry.classList.add("has-actions")):i.entry.classList.remove("has-actions")}disposeElement(e,t,i){i.toDisposeElement=me(i.toDisposeElement)}disposeTemplate(e){e.toDisposeElement=me(e.toDisposeElement),e.toDisposeTemplate=me(e.toDisposeTemplate)}};mh.ID="listelement";var h2=class{getHeight(e){return e.saneDetail?44:22}getTemplateId(e){return mh.ID}},rt;(function(s){s[s.First=1]="First",s[s.Second=2]="Second",s[s.Last=3]="Last",s[s.Next=4]="Next",s[s.Previous=5]="Previous",s[s.NextPage=6]="NextPage",s[s.PreviousPage=7]="PreviousPage"})(rt||(rt={}));var df=class{constructor(e,t,i){this.parent=e,this.inputElements=[],this.elements=[],this.elementsToIndexes=new Map,this.matchOnDescription=!1,this.matchOnDetail=!1,this.matchOnLabel=!0,this.matchOnMeta=!0,this.sortByLabel=!0,this._onChangedAllVisibleChecked=new k,this.onChangedAllVisibleChecked=this._onChangedAllVisibleChecked.event,this._onChangedCheckedCount=new k,this.onChangedCheckedCount=this._onChangedCheckedCount.event,this._onChangedVisibleCount=new k,this.onChangedVisibleCount=this._onChangedVisibleCount.event,this._onChangedCheckedElements=new k,this.onChangedCheckedElements=this._onChangedCheckedElements.event,this._onButtonTriggered=new k,this.onButtonTriggered=this._onButtonTriggered.event,this._onKeyDown=new k,this.onKeyDown=this._onKeyDown.event,this._onLeave=new k,this.onLeave=this._onLeave.event,this._fireCheckedEvents=!0,this.elementDisposables=[],this.disposables=[],this.id=t,this.container=W(this.parent,Fs(".quick-input-list"));let n=new h2,r=new d2;this.list=i.createList("QuickInput",this.container,n,[new mh],{identityProvider:{getId:o=>o.saneLabel},setRowLineHeight:!1,multipleSelectionSupport:!1,horizontalScrolling:!1,accessibilityProvider:r}),this.list.getHTMLElement().id=t,this.disposables.push(this.list),this.disposables.push(this.list.onKeyDown(o=>{let a=new De(o);switch(a.keyCode){case 10:this.toggleCheckbox();break;case 31:(ee?o.metaKey:o.ctrlKey)&&this.list.setFocus(Nt(this.list.length));break;case 16:let l=this.list.getFocus();l.length===1&&l[0]===0&&this._onLeave.fire();break;case 18:let c=this.list.getFocus();c.length===1&&c[0]===this.list.length-1&&this._onLeave.fire();break}this._onKeyDown.fire(a)})),this.disposables.push(this.list.onMouseDown(o=>{o.browserEvent.button!==2&&o.browserEvent.preventDefault()})),this.disposables.push(O(this.container,z.CLICK,o=>{(o.x||o.y)&&this._onLeave.fire()})),this.disposables.push(this.list.onMouseMiddleClick(o=>{this._onLeave.fire()})),this.disposables.push(this.list.onContextMenu(o=>{typeof o.index=="number"&&(o.browserEvent.preventDefault(),this.list.setSelection([o.index]))})),this.disposables.push(this._onChangedAllVisibleChecked,this._onChangedCheckedCount,this._onChangedVisibleCount,this._onChangedCheckedElements,this._onButtonTriggered,this._onLeave,this._onKeyDown)}get onDidChangeFocus(){return j.map(this.list.onDidChangeFocus,e=>e.elements.map(t=>t.item))}get onDidChangeSelection(){return j.map(this.list.onDidChangeSelection,e=>({items:e.elements.map(t=>t.item),event:e.browserEvent}))}getAllVisibleChecked(){return this.allVisibleChecked(this.elements,!1)}allVisibleChecked(e,t=!0){for(let i=0,n=e.length;i{t.hidden||(t.checked=e)})}finally{this._fireCheckedEvents=!0,this.fireCheckedEvents()}}setElements(e){this.elementDisposables=me(this.elementDisposables);let t=i=>this.fireButtonTriggered(i);this.inputElements=e,this.elements=e.reduce((i,n,r)=>{var o,a,l;if(n.type!=="separator"){let c=r&&e[r-1],h=n.label&&n.label.replace(/\r?\n/g," "),d=n.meta&&n.meta.replace(/\r?\n/g," "),u=n.description&&n.description.replace(/\r?\n/g," "),f=n.detail&&n.detail.replace(/\r?\n/g," "),m=n.ariaLabel||[h,u,f].map(g=>cL(g)).filter(g=>!!g).join(", ");i.push(new c2({index:r,item:n,saneLabel:h,saneMeta:d,saneAriaLabel:m,saneDescription:u,saneDetail:f,labelHighlights:(o=n.highlights)===null||o===void 0?void 0:o.label,descriptionHighlights:(a=n.highlights)===null||a===void 0?void 0:a.description,detailHighlights:(l=n.highlights)===null||l===void 0?void 0:l.detail,checked:!1,separator:c&&c.type==="separator"?c:void 0,fireButtonTriggered:t}))}return i},[]),this.elementDisposables.push(...this.elements),this.elementDisposables.push(...this.elements.map(i=>i.onChecked(()=>this.fireCheckedEvents()))),this.elementsToIndexes=this.elements.reduce((i,n,r)=>(i.set(n.item,r),i),new Map),this.list.splice(0,this.list.length),this.list.splice(0,this.list.length,this.elements),this._onChangedVisibleCount.fire(this.elements.length)}getFocusedElements(){return this.list.getFocusedElements().map(e=>e.item)}setFocusedElements(e){if(this.list.setFocus(e.filter(t=>this.elementsToIndexes.has(t)).map(t=>this.elementsToIndexes.get(t))),e.length>0){let t=this.list.getFocus()[0];typeof t=="number"&&this.list.reveal(t)}}getActiveDescendant(){return this.list.getHTMLElement().getAttribute("aria-activedescendant")}setSelectedElements(e){this.list.setSelection(e.filter(t=>this.elementsToIndexes.has(t)).map(t=>this.elementsToIndexes.get(t)))}getCheckedElements(){return this.elements.filter(e=>e.checked).map(e=>e.item)}setCheckedElements(e){try{this._fireCheckedEvents=!1;let t=new Set;for(let i of e)t.add(i);for(let i of this.elements)i.checked=t.has(i.item)}finally{this._fireCheckedEvents=!0,this.fireCheckedEvents()}}set enabled(e){this.list.getHTMLElement().style.pointerEvents=e?"":"none"}focus(e){if(!this.list.length)return;switch(e===rt.Next&&this.list.getFocus()[0]===this.list.length-1&&(e=rt.First),e===rt.Previous&&this.list.getFocus()[0]===0&&(e=rt.Last),e===rt.Second&&this.list.length<2&&(e=rt.First),e){case rt.First:this.list.focusFirst();break;case rt.Second:this.list.focusNth(1);break;case rt.Last:this.list.focusLast();break;case rt.Next:this.list.focusNext();break;case rt.Previous:this.list.focusPrevious();break;case rt.NextPage:this.list.focusNextPage();break;case rt.PreviousPage:this.list.focusPreviousPage();break}let t=this.list.getFocus()[0];typeof t=="number"&&this.list.reveal(t)}clearFocus(){this.list.setFocus([])}domFocus(){this.list.domFocus()}layout(e){this.list.getHTMLElement().style.maxHeight=e?`calc(${Math.floor(e/44)*44}px)`:"",this.list.layout()}filter(e){if(!(this.sortByLabel||this.matchOnLabel||this.matchOnDescription||this.matchOnDetail))return this.list.layout(),!1;if(e=e.trim(),!e||!(this.matchOnLabel||this.matchOnDescription||this.matchOnDetail))this.elements.forEach(i=>{i.labelHighlights=void 0,i.descriptionHighlights=void 0,i.detailHighlights=void 0,i.hidden=!1;let n=i.index&&this.inputElements[i.index-1];i.separator=n&&n.type==="separator"?n:void 0});else{let i;this.elements.forEach(n=>{let r=this.matchOnLabel?Vs(Ku(e,$u(n.saneLabel))):void 0,o=this.matchOnDescription?Vs(Ku(e,$u(n.saneDescription||""))):void 0,a=this.matchOnDetail?Vs(Ku(e,$u(n.saneDetail||""))):void 0,l=this.matchOnMeta?Vs(Ku(e,$u(n.saneMeta||""))):void 0;if(r||o||a||l?(n.labelHighlights=r,n.descriptionHighlights=o,n.detailHighlights=a,n.hidden=!1):(n.labelHighlights=void 0,n.descriptionHighlights=void 0,n.detailHighlights=void 0,n.hidden=!n.item.alwaysShow),n.separator=void 0,!this.sortByLabel){let c=n.index&&this.inputElements[n.index-1];i=c&&c.type==="separator"?c:i,i&&!n.hidden&&(n.separator=i,i=void 0)}})}let t=this.elements.filter(i=>!i.hidden);if(this.sortByLabel&&e){let i=e.toLowerCase();t.sort((n,r)=>y5(n,r,i))}return this.elementsToIndexes=t.reduce((i,n,r)=>(i.set(n.item,r),i),new Map),this.list.splice(0,this.list.length,t),this.list.setFocus([]),this.list.layout(),this._onChangedAllVisibleChecked.fire(this.getAllVisibleChecked()),this._onChangedVisibleCount.fire(t.length),!0}toggleCheckbox(){try{this._fireCheckedEvents=!1;let e=this.list.getFocusedElements(),t=this.allVisibleChecked(e);for(let i of e)i.checked=!t}finally{this._fireCheckedEvents=!0,this.fireCheckedEvents()}}display(e){this.container.style.display=e?"":"none"}isDisplayed(){return this.container.style.display!=="none"}dispose(){this.elementDisposables=me(this.elementDisposables),this.disposables=me(this.disposables)}fireCheckedEvents(){this._fireCheckedEvents&&(this._onChangedAllVisibleChecked.fire(this.getAllVisibleChecked()),this._onChangedCheckedCount.fire(this.getCheckedCount()),this._onChangedCheckedElements.fire(this.getCheckedElements()))}fireButtonTriggered(e){this._onButtonTriggered.fire(e)}style(e){this.list.style(e)}};l2([ze],df.prototype,"onDidChangeFocus",null);l2([ze],df.prototype,"onDidChangeSelection",null);function y5(s,e,t){let i=s.labelHighlights||[],n=e.labelHighlights||[];return i.length&&!n.length?-1:!i.length&&n.length?1:i.length===0&&n.length===0?0:n2(s.saneLabel,e.saneLabel,t)}var d2=class{getWidgetAriaLabel(){return p("quickInput","Quick Input")}getAriaLabel(e){return e.saneAriaLabel}getWidgetRole(){return"listbox"}getRole(){return"option"}};function u2(s,e={}){let t=m2(e);return t.textContent=s,t}function f2(s,e={}){let t=m2(e);return p2(t,L5(s,!!e.renderCodeSegements),e.actionHandler,e.renderCodeSegements),t}function m2(s){let e=s.inline?"span":"div",t=document.createElement(e);return s.className&&(t.className=s.className),t}var g2=class{constructor(e){this.source=e,this.index=0}eos(){return this.index>=this.source.length}next(){let e=this.peek();return this.advance(),e}peek(){return this.source[this.index]}advance(){this.index++}};function p2(s,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){let r=document.createElement("a");r.href="#",t.disposeables.add(lt(r,"click",o=>{t.callback(String(e.index),o)})),n=r}else e.type===8?n=document.createElement("br"):e.type===1&&(n=s);n&&s!==n&&s.appendChild(n),n&&Array.isArray(e.children)&&e.children.forEach(r=>{p2(n,r,t,i)})}function L5(s,e){let t={type:1,children:[]},i=0,n=t,r=[],o=new g2(s);for(;!o.eos();){let a=o.next(),l=a==="\\"&&S1(o.peek(),e)!==0;if(l&&(a=o.next()),!l&&x5(a,e)&&a===o.peek()){o.advance(),n.type===2&&(n=r.pop());let c=S1(a,e);if(n.type===c||n.type===5&&c===6)n=r.pop();else{let h={type:c,children:[]};c===5&&(h.index=i,i++),n.children.push(h),r.push(n),n=h}}else if(a===` +`)n.type===2&&(n=r.pop()),n.children.push({type:8});else if(n.type!==2){let c={type:2,content:a};n.children.push(c),r.push(n),n=c}else n.content+=a}return n.type===2&&(n=r.pop()),r.length,t}function x5(s,e){return S1(s,e)!==0}function S1(s,e){switch(s){case"*":return 3;case"_":return 4;case"[":return 5;case"]":return 6;case"`":return e?7:0;default:return 0}}var y1=class{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()}};var L1=class{constructor(e=[],t=10){this._initialize(e),this._limit=t,this._onChange()}add(e){this._history.delete(e),this._history.add(e),this._onChange()}next(){return this._currentPosition()!==this._elements.length-1?this._navigator.next():null}previous(){return this._currentPosition()!==0?this._navigator.previous():null}current(){return this._navigator.current()}first(){return this._navigator.first()}last(){return this._navigator.last()}has(e){return this._history.has(e)}_onChange(){this._reduceToLimit();let e=this._elements;this._navigator=new y1(e,0,e.length,e.length)}_reduceToLimit(){let e=this._elements;e.length>this._limit&&this._initialize(e.slice(e.length-this._limit))}_currentPosition(){let e=this._navigator.current();return e?this._elements.indexOf(e):-1}_initialize(e){this._history=new Set;for(let t of e)this._history.add(t)}get _elements(){let e=[];return this._history.forEach(t=>e.push(t)),e}};var uf=H,D5={inputBackground:A.fromHex("#3C3C3C"),inputForeground:A.fromHex("#CCCCCC"),inputValidationInfoBorder:A.fromHex("#55AAFF"),inputValidationInfoBackground:A.fromHex("#063B49"),inputValidationWarningBorder:A.fromHex("#B89500"),inputValidationWarningBackground:A.fromHex("#352A05"),inputValidationErrorBorder:A.fromHex("#BE1100"),inputValidationErrorBackground:A.fromHex("#5A1D1D")},B_=class extends pr{constructor(e,t,i){var n;super();this.state="idle",this.maxHeight=Number.POSITIVE_INFINITY,this._onDidChange=this._register(new k),this.onDidChange=this._onDidChange.event,this._onDidHeightChange=this._register(new k),this.onDidHeightChange=this._onDidHeightChange.event,this.contextViewProvider=t,this.options=i||Object.create(null),Pi(this.options,D5,!1),this.message=null,this.placeholder=this.options.placeholder||"",this.tooltip=(n=this.options.tooltip)!==null&&n!==void 0?n:this.placeholder||"",this.ariaLabel=this.options.ariaLabel||"",this.inputBackground=this.options.inputBackground,this.inputForeground=this.options.inputForeground,this.inputBorder=this.options.inputBorder,this.inputValidationInfoBorder=this.options.inputValidationInfoBorder,this.inputValidationInfoBackground=this.options.inputValidationInfoBackground,this.inputValidationInfoForeground=this.options.inputValidationInfoForeground,this.inputValidationWarningBorder=this.options.inputValidationWarningBorder,this.inputValidationWarningBackground=this.options.inputValidationWarningBackground,this.inputValidationWarningForeground=this.options.inputValidationWarningForeground,this.inputValidationErrorBorder=this.options.inputValidationErrorBorder,this.inputValidationErrorBackground=this.options.inputValidationErrorBackground,this.inputValidationErrorForeground=this.options.inputValidationErrorForeground,this.options.validationOptions&&(this.validation=this.options.validationOptions.validation),this.element=W(e,uf(".monaco-inputbox.idle"));let r=this.options.flexibleHeight?"textarea":"input",o=W(this.element,uf(".ibwrapper"));if(this.input=W(o,uf(r+".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=W(o,uf("div.mirror")),this.mirror.innerText="\xA0",this.scrollableElement=new dp(this.element,{vertical:1}),this.options.flexibleWidth&&(this.input.setAttribute("wrap","off"),this.mirror.style.whiteSpace="pre",this.mirror.style.wordWrap="initial"),W(e,this.scrollableElement.getDomNode()),this._register(this.scrollableElement),this._register(this.scrollableElement.onScroll(c=>this.input.scrollTop=c.scrollTop));let a=this._register(new Ee(document,"selectionchange")),l=j.filter(a.event,()=>{let c=document.getSelection();return(c==null?void 0:c.anchorNode)===o});this._register(l(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.ignoreGesture(this.input),setTimeout(()=>this.updateMirror(),0),this.options.actions&&(this.actionbar=this._register(new En(this.element)),this.actionbar.push(this.options.actions,{icon:!0,label:!1})),this.applyStyles()}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.input.title=e}setAriaLabel(e){this.ariaLabel=e,e?this.input.setAttribute("aria-label",this.ariaLabel):this.input.removeAttribute("aria-label")}getAriaLabel(){return this.ariaLabel}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:Th(this.element)}focus(){this.input.focus()}blur(){this.input.blur()}hasFocus(){return document.activeElement===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}enable(){this.input.removeAttribute("disabled")}disable(){this.blur(),this.input.disabled=!0,this._hideMessage()}get width(){return Nh(this.input)}set width(e){if(this.options.flexibleHeight&&this.options.flexibleWidth){let t=0;if(this.mirror){let i=parseFloat(this.mirror.style.paddingLeft||"")||0,n=parseFloat(this.mirror.style.paddingRight||"")||0;t=i+n}this.input.style.width=e-t+"px"}else this.input.style.width=e+"px";this.mirror&&(this.mirror.style.width=e+"px")}set paddingRight(e){this.options.flexibleHeight&&this.options.flexibleWidth?this.input.style.width=`calc(100% - ${e}px)`:this.input.style.paddingRight=e+"px",this.mirror&&(this.mirror.style.paddingRight=e+"px")}updateScrollDimensions(){if(typeof this.cachedContentHeight!="number"||typeof this.cachedHeight!="number"||!this.scrollableElement)return;let 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){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));let i=this.stylesForType(this.message.type);this.element.style.border=i.border?`1px solid ${i.border}`:"",(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==null?void 0:e.type}stylesForType(e){switch(e){case 1:return{border:this.inputValidationInfoBorder,background:this.inputValidationInfoBackground,foreground:this.inputValidationInfoForeground};case 2:return{border:this.inputValidationWarningBorder,background:this.inputValidationWarningBackground,foreground:this.inputValidationWarningForeground};default:return{border:this.inputValidationErrorBorder,background:this.inputValidationErrorBackground,foreground:this.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,t=()=>e.style.width=Nh(this.element)+"px";this.contextViewProvider.showContextView({getAnchor:()=>this.element,anchorAlignment:1,render:n=>{if(!this.message)return null;e=W(n,uf(".monaco-inputbox-container")),t();let r={inline:!0,className:"monaco-inputbox-message"},o=this.message.formatContent?f2(this.message.content,r):u2(this.message.content,r);o.classList.add(this.classForType(this.message.type));let a=this.stylesForType(this.message.type);return o.style.backgroundColor=a.background?a.background.toString():"",o.style.color=a.foreground?a.foreground.toString():"",o.style.border=a.border?`1px solid ${a.border}`:"",W(e,o),null},onHide:()=>{this.state="closed"},layout:t});let i;this.message.type===3?i=p("alertErrorMessage","Error: {0}",this.message.content):this.message.type===2?i=p("alertWarningMessage","Warning: {0}",this.message.content):i=p("alertInfoMessage","Info: {0}",this.message.content),ts(i),this.state="open"}_hideMessage(){!this.contextViewProvider||(this.state==="open"&&this.contextViewProvider.hideContextView(),this.state="idle")}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()}updateMirror(){if(!this.mirror)return;let e=this.value,i=e.charCodeAt(e.length-1)===10?" ":"";(e+i).replace(/\u000c/g,"")?this.mirror.textContent=e+i:this.mirror.innerText="\xA0",this.layout()}style(e){this.inputBackground=e.inputBackground,this.inputForeground=e.inputForeground,this.inputBorder=e.inputBorder,this.inputValidationInfoBackground=e.inputValidationInfoBackground,this.inputValidationInfoForeground=e.inputValidationInfoForeground,this.inputValidationInfoBorder=e.inputValidationInfoBorder,this.inputValidationWarningBackground=e.inputValidationWarningBackground,this.inputValidationWarningForeground=e.inputValidationWarningForeground,this.inputValidationWarningBorder=e.inputValidationWarningBorder,this.inputValidationErrorBackground=e.inputValidationErrorBackground,this.inputValidationErrorForeground=e.inputValidationErrorForeground,this.inputValidationErrorBorder=e.inputValidationErrorBorder,this.applyStyles()}applyStyles(){let e=this.inputBackground?this.inputBackground.toString():"",t=this.inputForeground?this.inputForeground.toString():"",i=this.inputBorder?this.inputBorder.toString():"";this.element.style.backgroundColor=e,this.element.style.color=t,this.input.style.backgroundColor="inherit",this.input.style.color=t,this.element.style.borderWidth=i?"1px":"",this.element.style.borderStyle=i?"solid":"",this.element.style.borderColor=i}layout(){if(!this.mirror)return;let e=this.cachedContentHeight;this.cachedContentHeight=Th(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))}insertAtCursor(e){let t=this.inputElement,i=t.selectionStart,n=t.selectionEnd,r=t.value;i!==null&&n!==null&&(this.value=r.substr(0,i)+e+r.substr(n),t.setSelectionRange(i+1,i+1),this.layout())}dispose(){this._hideMessage(),this.message=null,this.actionbar&&this.actionbar.dispose(),super.dispose()}},E5=class extends B_{constructor(e,t,i){super(e,t,i);this.history=new L1(i.history,100)}addToHistory(){this.value&&this.value!==this.getCurrentValue()&&this.history.add(this.value)}showNextValue(){this.history.has(this.value)||this.addToHistory();let e=this.getNextValue();e&&(e=e===this.value?this.getNextValue():e),e&&(this.value=e,Rh(this.value))}showPreviousValue(){this.history.has(this.value)||this.addToHistory();let e=this.getPreviousValue();e&&(e=e===this.value?this.getPreviousValue():e),e&&(this.value=e,Rh(this.value))}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()||this.history.last()}};var k5=H,x1=class extends M{constructor(e){super();this.parent=e,this.onKeyDown=t=>O(this.inputBox.inputElement,z.KEY_DOWN,i=>{t(new De(i))}),this.onMouseDown=t=>O(this.inputBox.inputElement,z.MOUSE_DOWN,i=>{t(new Bt(i))}),this.onDidChange=t=>this.inputBox.onDidChange(t),this.container=W(this.parent,k5(".quick-input-box")),this.inputBox=this._register(new B_(this.container,void 0))}get value(){return this.inputBox.value}set value(e){this.inputBox.value=e}select(e=null){this.inputBox.select(e)}isSelectionAtEnd(){return this.inputBox.isSelectionAtEnd()}get placeholder(){return this.inputBox.inputElement.getAttribute("placeholder")||""}set placeholder(e){this.inputBox.setPlaceHolder(e)}get ariaLabel(){return this.inputBox.getAriaLabel()}set ariaLabel(e){this.inputBox.setAriaLabel(e)}get password(){return this.inputBox.inputElement.type==="password"}set password(e){this.inputBox.inputElement.type=e?"password":"text"}setAttribute(e,t){this.inputBox.inputElement.setAttribute(e,t)}removeAttribute(e){this.inputBox.inputElement.removeAttribute(e)}showDecoration(e){e===Ye.Ignore?this.inputBox.hideMessage():this.inputBox.showMessage({type:e===Ye.Info?1:e===Ye.Warning?2:3,content:""})}stylesForType(e){return this.inputBox.stylesForType(e===Ye.Info?1:e===Ye.Warning?2:3)}setFocus(){this.inputBox.focus()}layout(){this.inputBox.layout()}style(e){this.inputBox.style(e)}};var I5={badgeBackground:A.fromHex("#4D4D4D"),badgeForeground:A.fromHex("#FFFFFF")},W_=class{constructor(e,t){this.count=0,this.options=t||Object.create(null),Pi(this.options,I5,!1),this.badgeBackground=this.options.badgeBackground,this.badgeForeground=this.options.badgeForeground,this.badgeBorder=this.options.badgeBorder,this.element=W(e,H(".monaco-count-badge")),this.countFormat=this.options.countFormat||"{0}",this.titleFormat=this.options.titleFormat||"",this.setCount(this.options.count||0)}setCount(e){this.count=e,this.render()}setTitleFormat(e){this.titleFormat=e,this.render()}render(){this.element.textContent=ji(this.countFormat,this.count),this.element.title=ji(this.titleFormat,this.count),this.applyStyles()}style(e){this.badgeBackground=e.badgeBackground,this.badgeForeground=e.badgeForeground,this.badgeBorder=e.badgeBorder,this.applyStyles()}applyStyles(){if(this.element){let e=this.badgeBackground?this.badgeBackground.toString():"",t=this.badgeForeground?this.badgeForeground.toString():"",i=this.badgeBorder?this.badgeBorder.toString():"";this.element.style.backgroundColor=e,this.element.style.color=t,this.element.style.borderWidth=i?"1px":"",this.element.style.borderStyle=i?"solid":"",this.element.style.borderColor=i}}};var _2="done",b2="active",D1="infinite",w2="discrete",N5={progressBarBackground:A.fromHex("#0E70C0")},E1=class extends M{constructor(e,t){super();this.options=t||Object.create(null),Pi(this.options,N5,!1),this.workedVal=0,this.progressBarBackground=this.options.progressBarBackground,this._register(this.showDelayedScheduler=new $e(()=>jf(this.element),0)),this.create(e)}create(e){this.element=document.createElement("div"),this.element.classList.add("monaco-progress-container"),this.element.setAttribute("role","progressbar"),this.element.setAttribute("aria-valuemin","0"),e.appendChild(this.element),this.bit=document.createElement("div"),this.bit.classList.add("progress-bit"),this.element.appendChild(this.bit),this.applyStyles()}off(){this.bit.style.width="inherit",this.bit.style.opacity="1",this.element.classList.remove(b2,D1,w2),this.workedVal=0,this.totalWork=void 0}stop(){return this.doDone(!1)}doDone(e){return this.element.classList.add(_2),this.element.classList.contains(D1)?(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(w2,_2),this.element.classList.add(b2,D1),this}getContainer(){return this.element}style(e){this.progressBarBackground=e.progressBarBackground,this.applyStyles()}applyStyles(){if(this.bit){let e=this.progressBarBackground?this.progressBarBackground.toString():"";this.bit.style.backgroundColor=e}}};var T5={buttonBackground:A.fromHex("#0E639C"),buttonHoverBackground:A.fromHex("#006BB3"),buttonForeground:A.white},V_=class extends M{constructor(e,t){super();this._onDidClick=this._register(new k),this.options=t||Object.create(null),Pi(this.options,T5,!1),this.buttonForeground=this.options.buttonForeground,this.buttonBackground=this.options.buttonBackground,this.buttonHoverBackground=this.options.buttonHoverBackground,this.buttonSecondaryForeground=this.options.buttonSecondaryForeground,this.buttonSecondaryBackground=this.options.buttonSecondaryBackground,this.buttonSecondaryHoverBackground=this.options.buttonSecondaryHoverBackground,this.buttonBorder=this.options.buttonBorder,this._element=document.createElement("a"),this._element.classList.add("monaco-button"),this._element.tabIndex=0,this._element.setAttribute("role","button"),e.appendChild(this._element),this._register(we.addTarget(this._element)),[z.CLICK,Re.Tap].forEach(i=>{this._register(O(this._element,i,n=>{if(!this.enabled){ke.stop(n);return}this._onDidClick.fire(n)}))}),this._register(O(this._element,z.KEY_DOWN,i=>{let n=new De(i),r=!1;this.enabled&&(n.equals(3)||n.equals(10))?(this._onDidClick.fire(i),r=!0):n.equals(9)&&(this._element.blur(),r=!0),r&&ke.stop(n,!0)})),this._register(O(this._element,z.MOUSE_OVER,i=>{this._element.classList.contains("disabled")||this.setHoverBackground()})),this._register(O(this._element,z.MOUSE_OUT,i=>{this.applyStyles()})),this.focusTracker=this._register(zr(this._element)),this._register(this.focusTracker.onDidFocus(()=>this.setHoverBackground())),this._register(this.focusTracker.onDidBlur(()=>this.applyStyles())),this.applyStyles()}get onDidClick(){return this._onDidClick.event}setHoverBackground(){let e;this.options.secondary?e=this.buttonSecondaryHoverBackground?this.buttonSecondaryHoverBackground.toString():null:e=this.buttonHoverBackground?this.buttonHoverBackground.toString():null,e&&(this._element.style.backgroundColor=e)}style(e){this.buttonForeground=e.buttonForeground,this.buttonBackground=e.buttonBackground,this.buttonHoverBackground=e.buttonHoverBackground,this.buttonSecondaryForeground=e.buttonSecondaryForeground,this.buttonSecondaryBackground=e.buttonSecondaryBackground,this.buttonSecondaryHoverBackground=e.buttonSecondaryHoverBackground,this.buttonBorder=e.buttonBorder,this.applyStyles()}applyStyles(){if(this._element){let e,t;this.options.secondary?(t=this.buttonSecondaryForeground?this.buttonSecondaryForeground.toString():"",e=this.buttonSecondaryBackground?this.buttonSecondaryBackground.toString():""):(t=this.buttonForeground?this.buttonForeground.toString():"",e=this.buttonBackground?this.buttonBackground.toString():"");let i=this.buttonBorder?this.buttonBorder.toString():"";this._element.style.color=t,this._element.style.backgroundColor=e,this._element.style.borderWidth=i?"1px":"",this._element.style.borderStyle=i?"solid":"",this._element.style.borderColor=i}}get element(){return this._element}set label(e){this._element.classList.add("monaco-text-button"),this.options.supportIcons?sa(this._element,...qo(e)):this._element.textContent=e,typeof this.options.title=="string"?this._element.title=this.options.title:this.options.title&&(this._element.title=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")}};var v2=function(s,e,t,i){function n(r){return r instanceof t?r:new t(function(o){o(r)})}return new(t||(t=Promise))(function(r,o){function a(h){try{c(i.next(h))}catch(d){o(d)}}function l(h){try{c(i.throw(h))}catch(d){o(d)}}function c(h){h.done?r(h.value):n(h.value).then(a,l)}c((i=i.apply(s,e||[])).next())})},Qi=H,M5=di("quick-input-back",Le.arrowLeft),k1={iconClass:M5.classNames,tooltip:p("quickInput.back","Back"),handle:-1},ff=class extends M{constructor(e){super();this.ui=e,this.visible=!1,this._enabled=!0,this._busy=!1,this._ignoreFocusOut=!1,this._buttons=[],this.noValidationMessage=ff.noPromptMessage,this._severity=Ye.Ignore,this.buttonsUpdated=!1,this.onDidTriggerButtonEmitter=this._register(new k),this.onDidHideEmitter=this._register(new k),this.onDisposeEmitter=this._register(new k),this.visibleDisposables=this._register(new U),this.onDidHide=this.onDidHideEmitter.event}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){let t=this._ignoreFocusOut!==e&&!en;this._ignoreFocusOut=e&&!en,t&&this.update()}get buttons(){return this._buttons}set buttons(e){this._buttons=e,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=!0,this.update())}hide(){!this.visible||this.ui.hide()}didHide(e=fh.Other){this.visible=!1,this.visibleDisposables.clear(),this.onDidHideEmitter.fire({reason:e})}update(){if(!this.visible)return;let e=this.getTitle();e&&this.ui.title.textContent!==e?this.ui.title.textContent=e:!e&&this.ui.title.innerHTML!==" "&&(this.ui.title.innerText="\xA0;");let 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 Ut,this.busyDelay.setIfNotSet(()=>{this.visible&&this.ui.progressBar.infinite()},800)),!this.busy&&this.busyDelay&&(this.ui.progressBar.stop(),this.busyDelay.cancel(),this.busyDelay=void 0),this.buttonsUpdated){this.buttonsUpdated=!1,this.ui.leftActionBar.clear();let n=this.buttons.filter(o=>o===k1);this.ui.leftActionBar.push(n.map((o,a)=>{let l=new _i(`id-${a}`,"",o.iconClass||cf(o.iconPath),!0,()=>v2(this,void 0,void 0,function*(){this.onDidTriggerButtonEmitter.fire(o)}));return l.tooltip=o.tooltip||"",l}),{icon:!0,label:!1}),this.ui.rightActionBar.clear();let r=this.buttons.filter(o=>o!==k1);this.ui.rightActionBar.push(r.map((o,a)=>{let l=new _i(`id-${a}`,"",o.iconClass||cf(o.iconPath),!0,()=>v2(this,void 0,void 0,function*(){this.onDidTriggerButtonEmitter.fire(o)}));return l.tooltip=o.tooltip||"",l}),{icon:!0,label:!1})}this.ui.ignoreFocusOut=this.ignoreFocusOut,this.ui.setEnabled(this.enabled),this.ui.setContextKey(this.contextKey);let i=this.validationMessage||this.noValidationMessage;this._lastValidationMessage!==i&&(this._lastValidationMessage=i,sa(this.ui.message,...qo(i))),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?p("quickInput.steps","{0}/{1}",this.step,this.totalSteps):this.step?String(this.step):""}showMessageDecoration(e){if(this.ui.inputBox.showDecoration(e),e!==Ye.Ignore){let 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.paddingBottom="4px"}else this.ui.message.style.color="",this.ui.message.style.backgroundColor="",this.ui.message.style.border="",this.ui.message.style.paddingBottom=""}dispose(){this.hide(),this.onDisposeEmitter.fire(),super.dispose()}};ff.noPromptMessage=p("inputModeEntry","Press 'Enter' to confirm your input or 'Escape' to cancel");var gh=class extends ff{constructor(){super(...arguments);this._value="",this.onDidChangeValueEmitter=this._register(new k),this.onWillAcceptEmitter=this._register(new k),this.onDidAcceptEmitter=this._register(new k),this.onDidCustomEmitter=this._register(new k),this._items=[],this.itemsUpdated=!1,this._canSelectMany=!1,this._canAcceptInBackground=!1,this._matchOnDescription=!1,this._matchOnDetail=!1,this._matchOnLabel=!0,this._sortByLabel=!0,this._autoFocusOnList=!0,this._itemActivation=this.ui.isScreenReaderOptimized()?mn.NONE:mn.FIRST,this._activeItems=[],this.activeItemsUpdated=!1,this.activeItemsToConfirm=[],this.onDidChangeActiveEmitter=this._register(new k),this._selectedItems=[],this.selectedItemsUpdated=!1,this.selectedItemsToConfirm=[],this.onDidChangeSelectionEmitter=this._register(new k),this.onDidTriggerItemButtonEmitter=this._register(new k),this.valueSelectionUpdated=!0,this._ok="default",this._customButton=!1,this.filterValue=e=>e,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}get quickNavigate(){return this._quickNavigate}set quickNavigate(e){this._quickNavigate=e,this.update()}get value(){return this._value}set value(e){this._value!==e&&(this._value=e||"",this.update(),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 items(){return this._items}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 sortByLabel(){return this._sortByLabel}set sortByLabel(e){this._sortByLabel=e,this.update()}get autoFocusOnList(){return this._autoFocusOnList}set autoFocusOnList(e){this._autoFocusOnList=e,this.update()}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?t2:this.ui.keyMods}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 ok(){return this._ok}set ok(e){this._ok=e,this.update()}get hideInput(){return!!this._hideInput}set hideInput(e){this._hideInput=e,this.update()}trySelectFirst(){this.autoFocusOnList&&(this.canSelectMany||this.ui.list.focus(rt.First))}show(){this.visible||(this.visibleDisposables.add(this.ui.inputBox.onDidChange(e=>{if(e===this.value)return;this._value=e,this.ui.list.filter(this.filterValue(this.ui.inputBox.value))&&this.trySelectFirst(),this.onDidChangeValueEmitter.fire(e)})),this.visibleDisposables.add(this.ui.inputBox.onMouseDown(e=>{this.autoFocusOnList||this.ui.list.clearFocus()})),this.visibleDisposables.add((this._hideInput?this.ui.list:this.ui.inputBox).onKeyDown(e=>{switch(e.keyCode){case 18:this.ui.list.focus(rt.Next),this.canSelectMany&&this.ui.list.domFocus(),ke.stop(e,!0);break;case 16:this.ui.list.getFocusedElements().length?this.ui.list.focus(rt.Previous):this.ui.list.focus(rt.Last),this.canSelectMany&&this.ui.list.domFocus(),ke.stop(e,!0);break;case 12:this.ui.list.focus(rt.NextPage),this.canSelectMany&&this.ui.list.domFocus(),ke.stop(e,!0);break;case 11:this.ui.list.focus(rt.PreviousPage),this.canSelectMany&&this.ui.list.domFocus(),ke.stop(e,!0);break;case 17:if(!this._canAcceptInBackground||!this.ui.inputBox.isSelectionAtEnd())return;this.activeItems[0]&&(this._selectedItems=[this.activeItems[0]],this.onDidChangeSelectionEmitter.fire(this.selectedItems),this.handleAccept(!0));break;case 14:(e.ctrlKey||e.metaKey)&&!e.shiftKey&&!e.altKey&&(this.ui.list.focus(rt.First),ke.stop(e,!0));break;case 13:(e.ctrlKey||e.metaKey)&&!e.shiftKey&&!e.altKey&&(this.ui.list.focus(rt.Last),ke.stop(e,!0));break}})),this.visibleDisposables.add(this.ui.onDidAccept(()=>{!this.canSelectMany&&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.ui.list.onDidChangeFocus(e=>{this.activeItemsUpdated||this.activeItemsToConfirm!==this._activeItems&&Ri(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.length&&this.ui.list.setSelectedElements([]);return}this.selectedItemsToConfirm!==this._selectedItems&&Ri(e,this._selectedItems,(i,n)=>i===n)||(this._selectedItems=e,this.onDidChangeSelectionEmitter.fire(e),e.length&&this.handleAccept(t instanceof MouseEvent&&t.button===1))})),this.visibleDisposables.add(this.ui.list.onChangedCheckedElements(e=>{!this.canSelectMany||this.selectedItemsToConfirm!==this._selectedItems&&Ri(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.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 O(this.ui.container,z.KEY_UP,e=>{if(this.canSelectMany||!this._quickNavigate)return;let t=new De(e),i=t.keyCode;this._quickNavigate.keybindings.some(o=>{let[a,l]=o.getParts();return l?!1:a.shiftKey&&i===4?!(t.ctrlKey||t.altKey||t.metaKey):!!(a.altKey&&i===6||a.ctrlKey&&i===5||a.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;let e=!!this._hideInput&&this._items.length>0;this.ui.container.classList.toggle("hidden-input",e&&!this.description);let t={title:!!this.title||!!this.step||!!this.buttons.length,description:!!this.description,checkAll:this.canSelectMany&&!this._hideCheckAll,checkBox:this.canSelectMany,inputBox:!e,progressBar:!e,visibleCount:!0,count:this.canSelectMany,ok:this.ok==="default"?this.canSelectMany:this.ok,list:!0,message:!!this.validationMessage,customButton:this.customButton};this.ui.setVisibilities(t),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 i=this.ariaLabel||this.placeholder||gh.DEFAULT_ARIA_LABEL;if(this.ui.inputBox.ariaLabel!==i&&(this.ui.inputBox.ariaLabel=i),this.ui.list.matchOnDescription=this.matchOnDescription,this.ui.list.matchOnDetail=this.matchOnDetail,this.ui.list.matchOnLabel=this.matchOnLabel,this.ui.list.sortByLabel=this.sortByLabel,this.itemsUpdated)switch(this.itemsUpdated=!1,this.ui.list.setElements(this.items),this.ui.list.filter(this.filterValue(this.ui.inputBox.value)),this.ui.checkAll.checked=this.ui.list.getAllVisibleChecked(),this.ui.visibleCount.setCount(this.ui.list.getVisibleCount()),this.ui.count.setCount(this.ui.list.getCheckedCount()),this._itemActivation){case mn.NONE:this._itemActivation=mn.FIRST;break;case mn.SECOND:this.ui.list.focus(rt.Second),this._itemActivation=mn.FIRST;break;case mn.LAST:this.ui.list.focus(rt.Last),this._itemActivation=mn.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.customButton.label=this.customLabel||"",this.ui.customButton.element.title=this.customHover||"",this.ui.setComboboxAccessibility(!0),t.inputBox||(this.ui.list.domFocus(),this.canSelectMany&&this.ui.list.focus(rt.First))}};gh.DEFAULT_ARIA_LABEL=p("quickInputBox.ariaLabel","Type to narrow down results.");var ph=class extends M{constructor(e){super();this.options=e,this.comboboxAccessibility=!1,this.enabled=!0,this.onDidAcceptEmitter=this._register(new k),this.onDidCustomEmitter=this._register(new k),this.onDidTriggerButtonEmitter=this._register(new k),this.keyMods={ctrlCmd:!1,alt:!1},this.controller=null,this.onShowEmitter=this._register(new k),this.onShow=this.onShowEmitter.event,this.onHideEmitter=this._register(new k),this.onHide=this.onHideEmitter.event,this.idPrefix=e.idPrefix,this.parentElement=e.container,this.styles=e.styles,this.registerKeyModsListeners()}registerKeyModsListeners(){let e=t=>{this.keyMods.ctrlCmd=t.ctrlKey||t.metaKey,this.keyMods.alt=t.altKey};this._register(O(window,z.KEY_DOWN,e,!0)),this._register(O(window,z.KEY_UP,e,!0)),this._register(O(window,z.MOUSE_DOWN,e,!0))}getUI(){if(this.ui)return this.ui;let e=W(this.parentElement,Qi(".quick-input-widget.show-file-icons"));e.tabIndex=-1,e.style.display="none";let t=kt(e),i=W(e,Qi(".quick-input-titlebar")),n=this._register(new En(i));n.domNode.classList.add("quick-input-left-action-bar");let r=W(i,Qi(".quick-input-title")),o=this._register(new En(i));o.domNode.classList.add("quick-input-right-action-bar");let a=W(e,Qi(".quick-input-description")),l=W(e,Qi(".quick-input-header")),c=W(l,Qi("input.quick-input-check-all"));c.type="checkbox",this._register(lt(c,z.CHANGE,T=>{let I=c.checked;S.setAllVisibleChecked(I)})),this._register(O(c,z.CLICK,T=>{(T.x||T.y)&&f.setFocus()}));let h=W(l,Qi(".quick-input-description")),d=W(l,Qi(".quick-input-and-message")),u=W(d,Qi(".quick-input-filter")),f=this._register(new x1(u));f.setAttribute("aria-describedby",`${this.idPrefix}message`);let m=W(u,Qi(".quick-input-visible-count"));m.setAttribute("aria-live","polite"),m.setAttribute("aria-atomic","true");let g=new W_(m,{countFormat:p({key:"quickInput.visibleCount",comment:["This tells the user how many items are shown in a list of items to select from. The items can be anything. Currently not visible, but read by screen readers."]},"{0} Results")}),b=W(u,Qi(".quick-input-count"));b.setAttribute("aria-live","polite");let w=new W_(b,{countFormat:p({key:"quickInput.countSelected",comment:["This tells the user how many items are selected in a list of items to select from. The items can be anything."]},"{0} Selected")}),_=W(l,Qi(".quick-input-action")),v=new V_(_);v.label=p("ok","OK"),this._register(v.onDidClick(T=>{this.onDidAcceptEmitter.fire()}));let C=W(l,Qi(".quick-input-action")),y=new V_(C);y.label=p("custom","Custom"),this._register(y.onDidClick(T=>{this.onDidCustomEmitter.fire()}));let x=W(d,Qi(`#${this.idPrefix}message.quick-input-message`)),S=this._register(new df(e,this.idPrefix+"list",this.options));this._register(S.onChangedAllVisibleChecked(T=>{c.checked=T})),this._register(S.onChangedVisibleCount(T=>{g.setCount(T)})),this._register(S.onChangedCheckedCount(T=>{w.setCount(T)})),this._register(S.onLeave(()=>{setTimeout(()=>{f.setFocus(),this.controller instanceof gh&&this.controller.canSelectMany&&S.clearFocus()},0)})),this._register(S.onDidChangeFocus(()=>{this.comboboxAccessibility&&this.getUI().inputBox.setAttribute("aria-activedescendant",this.getUI().list.getActiveDescendant()||"")}));let L=new E1(e);L.getContainer().classList.add("quick-input-progress");let E=zr(e);return this._register(E),this._register(O(e,z.FOCUS,T=>{this.previousFocusElement=T.relatedTarget instanceof HTMLElement?T.relatedTarget:void 0},!0)),this._register(E.onDidBlur(()=>{!this.getUI().ignoreFocusOut&&!this.options.ignoreFocusOut()&&this.hide(fh.Blur),this.previousFocusElement=void 0})),this._register(O(e,z.FOCUS,T=>{f.setFocus()})),this._register(O(e,z.KEY_DOWN,T=>{let I=new De(T);switch(I.keyCode){case 3:ke.stop(T,!0),this.onDidAcceptEmitter.fire();break;case 9:ke.stop(T,!0),this.hide(fh.Gesture);break;case 2:if(!I.altKey&&!I.ctrlKey&&!I.metaKey){let P=[".action-label.codicon"];e.classList.contains("show-checkboxes")?P.push("input"):P.push("input[type=text]"),this.getUI().list.isDisplayed()&&P.push(".monaco-list");let B=e.querySelectorAll(P.join(", "));I.shiftKey&&I.target===B[0]?(ke.stop(T,!0),B[B.length-1].focus()):!I.shiftKey&&I.target===B[B.length-1]&&(ke.stop(T,!0),B[0].focus())}break}})),this.ui={container:e,styleSheet:t,leftActionBar:n,titleBar:i,title:r,description1:a,description2:h,rightActionBar:o,checkAll:c,filterContainer:u,inputBox:f,visibleCountContainer:m,visibleCount:g,countContainer:b,count:w,okContainer:_,ok:v,message:x,customButtonContainer:C,customButton:y,list:S,progressBar:L,onDidAccept:this.onDidAcceptEmitter.event,onDidCustom:this.onDidCustomEmitter.event,onDidTriggerButton:this.onDidTriggerButtonEmitter.event,ignoreFocusOut:!1,keyMods:this.keyMods,isScreenReaderOptimized:()=>this.options.isScreenReaderOptimized(),show:T=>this.show(T),hide:()=>this.hide(),setVisibilities:T=>this.setVisibilities(T),setComboboxAccessibility:T=>this.setComboboxAccessibility(T),setEnabled:T=>this.setEnabled(T),setContextKey:T=>this.options.setContextKey(T)},this.updateStyles(),this.ui}pick(e,t={},i=Wt.None){return new Promise((n,r)=>{let o=h=>{o=n,t.onKeyMods&&t.onKeyMods(a.keyMods),n(h)};if(i.isCancellationRequested){o(void 0);return}let a=this.createQuickPick(),l,c=[a,a.onDidAccept(()=>{if(a.canSelectMany)o(a.selectedItems.slice()),a.hide();else{let h=a.activeItems[0];h&&(o(h),a.hide())}}),a.onDidChangeActive(h=>{let d=h[0];d&&t.onDidFocus&&t.onDidFocus(d)}),a.onDidChangeSelection(h=>{if(!a.canSelectMany){let d=h[0];d&&(o(d),a.hide())}}),a.onDidTriggerItemButton(h=>t.onDidTriggerItemButton&&t.onDidTriggerItemButton(Object.assign(Object.assign({},h),{removeItem:()=>{let d=a.items.indexOf(h.item);if(d!==-1){let u=a.items.slice(),f=u.splice(d,1),m=a.activeItems.filter(g=>g!==f[0]);a.items=u,m&&(a.activeItems=m)}}}))),a.onDidChangeValue(h=>{l&&!h&&(a.activeItems.length!==1||a.activeItems[0]!==l)&&(a.activeItems=[l])}),i.onCancellationRequested(()=>{a.hide()}),a.onDidHide(()=>{me(c),o(void 0)})];a.title=t.title,a.canSelectMany=!!t.canPickMany,a.placeholder=t.placeHolder,a.ignoreFocusOut=!!t.ignoreFocusLost,a.matchOnDescription=!!t.matchOnDescription,a.matchOnDetail=!!t.matchOnDetail,a.matchOnLabel=t.matchOnLabel===void 0||t.matchOnLabel,a.autoFocusOnList=t.autoFocusOnList===void 0||t.autoFocusOnList,a.quickNavigate=t.quickNavigate,a.contextKey=t.contextKey,a.busy=!0,Promise.all([e,t.activeItem]).then(([h,d])=>{l=d,a.busy=!1,a.items=h,a.canSelectMany&&(a.selectedItems=h.filter(u=>u.type!=="separator"&&u.picked)),l&&(a.activeItems=[l])}),a.show(),Promise.resolve(e).then(void 0,h=>{r(h),a.hide()})})}createQuickPick(){let e=this.getUI();return new gh(e)}show(e){let t=this.getUI();this.onShowEmitter.fire();let i=this.controller;this.controller=e,i&&i.didHide(),this.setEnabled(!0),t.leftActionBar.clear(),t.title.textContent="",t.description1.textContent="",t.description2.textContent="",t.rightActionBar.clear(),t.checkAll.checked=!1,t.inputBox.placeholder="",t.inputBox.password=!1,t.inputBox.showDecoration(Ye.Ignore),t.visibleCount.setCount(0),t.count.setCount(0),sa(t.message),t.progressBar.stop(),t.list.setElements([]),t.list.matchOnDescription=!1,t.list.matchOnDetail=!1,t.list.matchOnLabel=!0,t.list.sortByLabel=!0,t.ignoreFocusOut=!1,this.setComboboxAccessibility(!1),t.inputBox.ariaLabel="";let n=this.options.backKeybindingLabel();k1.tooltip=n?p("quickInput.backWithKeybinding","Back ({0})",n):p("quickInput.back","Back"),t.container.style.display="",this.updateLayout(),t.inputBox.setFocus()}setVisibilities(e){let 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.style.display=e.checkAll?"":"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.display(!!e.list),t.container.classList[e.checkBox?"add":"remove"]("show-checkboxes"),this.updateLayout()}setComboboxAccessibility(e){if(e!==this.comboboxAccessibility){let t=this.getUI();this.comboboxAccessibility=e,this.comboboxAccessibility?(t.inputBox.setAttribute("role","combobox"),t.inputBox.setAttribute("aria-haspopup","true"),t.inputBox.setAttribute("aria-autocomplete","list"),t.inputBox.setAttribute("aria-activedescendant",t.list.getActiveDescendant()||"")):(t.inputBox.removeAttribute("role"),t.inputBox.removeAttribute("aria-haspopup"),t.inputBox.removeAttribute("aria-autocomplete"),t.inputBox.removeAttribute("aria-activedescendant"))}}setEnabled(e){if(e!==this.enabled){this.enabled=e;for(let t of this.getUI().leftActionBar.viewItems)t.getAction().enabled=e;for(let t of this.getUI().rightActionBar.viewItems)t.getAction().enabled=e;this.getUI().checkAll.disabled=!e,this.getUI().ok.enabled=e,this.getUI().list.enabled=e}}hide(e){var t;let i=this.controller;if(i){let n=!((t=this.ui)===null||t===void 0?void 0:t.container.contains(document.activeElement));this.controller=null,this.onHideEmitter.fire(),this.getUI().container.style.display="none",n||(this.previousFocusElement&&this.previousFocusElement.offsetParent?(this.previousFocusElement.focus(),this.previousFocusElement=void 0):this.options.returnFocus()),i.didHide(e)}}layout(e,t){this.dimension=e,this.titleBarOffset=t,this.updateLayout()}updateLayout(){if(this.ui){this.ui.container.style.top=`${this.titleBarOffset}px`;let e=this.ui.container.style,t=Math.min(this.dimension.width*.62,ph.MAX_WIDTH);e.width=t+"px",e.marginLeft="-"+t/2+"px",this.ui.inputBox.layout(),this.ui.list.layout(this.dimension&&this.dimension.height*.4)}}applyStyles(e){this.styles=e,this.updateStyles()}updateStyles(){if(this.ui){let{quickInputTitleBackground:e,quickInputBackground:t,quickInputForeground:i,contrastBorder:n,widgetShadow:r}=this.styles.widget;this.ui.titleBar.style.backgroundColor=e?e.toString():"",this.ui.container.style.backgroundColor=t?t.toString():"",this.ui.container.style.color=i?i.toString():"",this.ui.container.style.border=n?`1px solid ${n}`:"",this.ui.container.style.boxShadow=r?`0 0 8px 2px ${r}`:"",this.ui.inputBox.style(this.styles.inputBox),this.ui.count.style(this.styles.countBadge),this.ui.ok.style(this.styles.button),this.ui.customButton.style(this.styles.button),this.ui.progressBar.style(this.styles.progressBar),this.ui.list.style(this.styles.list);let o=[];this.styles.list.pickerGroupBorder&&o.push(`.quick-input-list .quick-input-list-entry { border-top-color: ${this.styles.list.pickerGroupBorder}; }`),this.styles.list.pickerGroupForeground&&o.push(`.quick-input-list .quick-input-list-separator { color: ${this.styles.list.pickerGroupForeground}; }`),(this.styles.keybindingLabel.keybindingLabelBackground||this.styles.keybindingLabel.keybindingLabelBorder||this.styles.keybindingLabel.keybindingLabelBottomBorder||this.styles.keybindingLabel.keybindingLabelShadow||this.styles.keybindingLabel.keybindingLabelForeground)&&(o.push(".quick-input-list .monaco-keybinding > .monaco-keybinding-key {"),this.styles.keybindingLabel.keybindingLabelBackground&&o.push(`background-color: ${this.styles.keybindingLabel.keybindingLabelBackground};`),this.styles.keybindingLabel.keybindingLabelBorder&&o.push(`border-color: ${this.styles.keybindingLabel.keybindingLabelBorder};`),this.styles.keybindingLabel.keybindingLabelBottomBorder&&o.push(`border-bottom-color: ${this.styles.keybindingLabel.keybindingLabelBottomBorder};`),this.styles.keybindingLabel.keybindingLabelShadow&&o.push(`box-shadow: inset 0 -1px 0 ${this.styles.keybindingLabel.keybindingLabelShadow};`),this.styles.keybindingLabel.keybindingLabelForeground&&o.push(`color: ${this.styles.keybindingLabel.keybindingLabelForeground};`),o.push("}"));let a=o.join(` +`);a!==this.ui.styleSheet.textContent&&(this.ui.styleSheet.textContent=a)}}};ph.MAX_WIDTH=600;var j_=$("quickInputService");var z_;(function(s){s[s.PRESERVE=0]="PRESERVE",s[s.LAST=1]="LAST"})(z_||(z_={}));var I1={Quickaccess:"workbench.contributions.quickaccess"},C2=class{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),oe(()=>{this.providers.splice(this.providers.indexOf(e),1),this.defaultProvider===e&&(this.defaultProvider=void 0)})}getQuickAccessProviders(){return vx([this.defaultProvider,...this.providers])}getQuickAccessProvider(e){return e&&this.providers.find(i=>e.startsWith(i.prefix))||void 0||this.defaultProvider}};Te.add(I1.Quickaccess,new C2);var R5=function(s,e,t,i){var n=arguments.length,r=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(s,e,t,i);else for(var a=s.length-1;a>=0;a--)(o=s[a])&&(r=(n<3?o(r):n>3?o(e,t,r):o(e,t))||r);return n>3&&r&&Object.defineProperty(e,t,r),r},S2=function(s,e){return function(t,i){e(t,i,s)}},H_=class extends M{constructor(e,t){super();this.quickInputService=e,this.instantiationService=t,this.registry=Te.as(I1.Quickaccess),this.mapProviderToDescriptor=new Map,this.lastAcceptedPickerValues=new Map,this.visibleQuickAccess=void 0}show(e="",t){this.doShowOrPick(e,!1,t)}doShowOrPick(e,t,i){var n;let[r,o]=this.getOrInstantiateProvider(e),a=this.visibleQuickAccess,l=a==null?void 0:a.descriptor;if(a&&o&&l===o){e!==o.prefix&&!(i==null?void 0:i.preserveValue)&&(a.picker.value=e),this.adjustValueSelection(a.picker,o,i);return}if(o&&!(i==null?void 0:i.preserveValue)){let m;if(a&&l&&l!==o){let g=a.value.substr(l.prefix.length);g&&(m=`${o.prefix}${g}`)}if(!m){let g=r==null?void 0:r.defaultFilterValue;g===z_.LAST?m=this.lastAcceptedPickerValues.get(o):typeof g=="string"&&(m=`${o.prefix}${g}`)}typeof m=="string"&&(e=m)}let c=new U,h=c.add(this.quickInputService.createQuickPick());h.value=e,this.adjustValueSelection(h,o,i),h.placeholder=o==null?void 0:o.placeholder,h.quickNavigate=i==null?void 0:i.quickNavigateConfiguration,h.hideInput=!!h.quickNavigate&&!a,(typeof(i==null?void 0:i.itemActivation)=="number"||(i==null?void 0:i.quickNavigateConfiguration))&&(h.itemActivation=(n=i==null?void 0:i.itemActivation)!==null&&n!==void 0?n:mn.SECOND),h.contextKey=o==null?void 0:o.contextKey,h.filterValue=m=>m.substring(o?o.prefix.length:0),(o==null?void 0:o.placeholder)&&(h.ariaLabel=o==null?void 0:o.placeholder);let d,u;t&&(d=new Promise(m=>u=m),c.add(pn(h.onWillAccept)(m=>{m.veto(),h.hide()}))),c.add(this.registerPickerListeners(h,r,o,e));let f=c.add(new hi);if(r&&c.add(r.provide(h,f.token)),pn(h.onDidHide)(()=>{h.selectedItems.length===0&&f.cancel(),c.dispose(),u==null||u(h.selectedItems)}),h.show(),t)return d}adjustValueSelection(e,t,i){var n;let r;(i==null?void 0:i.preserveValue)?r=[e.value.length,e.value.length]:r=[(n=t==null?void 0:t.prefix.length)!==null&&n!==void 0?n:0,e.value.length],e.valueSelection=r}registerPickerListeners(e,t,i,n){let r=new U,o=this.visibleQuickAccess={picker:e,descriptor:i,value:n};return r.add(oe(()=>{o===this.visibleQuickAccess&&(this.visibleQuickAccess=void 0)})),r.add(e.onDidChangeValue(a=>{let[l]=this.getOrInstantiateProvider(a);l!==t?this.show(a,{preserveValue:!0}):o.value=a})),i&&r.add(e.onDidAccept(()=>{this.lastAcceptedPickerValues.set(i,e.value)})),r}getOrInstantiateProvider(e){let t=this.registry.getQuickAccessProvider(e);if(!t)return[void 0,void 0];let i=this.mapProviderToDescriptor.get(t);return i||(i=this.instantiationService.createInstance(t.ctor),this.mapProviderToDescriptor.set(t,i)),[i,t]}};H_=R5([S2(0,j_),S2(1,ct)],H_);var A5=function(s,e,t,i){var n=arguments.length,r=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(s,e,t,i);else for(var a=s.length-1;a>=0;a--)(o=s[a])&&(r=(n<3?o(r):n>3?o(e,t,r):o(e,t))||r);return n>3&&r&&Object.defineProperty(e,t,r),r},mf=function(s,e){return function(t,i){e(t,i,s)}},U_=class extends Pb{constructor(e,t,i,n,r){super(i);this.instantiationService=e,this.contextKeyService=t,this.accessibilityService=n,this.layoutService=r,this.contexts=new Map}get controller(){return this._controller||(this._controller=this._register(this.createController())),this._controller}get quickAccess(){return this._quickAccess||(this._quickAccess=this._register(this.instantiationService.createInstance(H_))),this._quickAccess}createController(e=this.layoutService,t){var i,n;let r={idPrefix:"quickInput_",container:e.container,ignoreFocusOut:()=>!1,isScreenReaderOptimized:()=>this.accessibilityService.isScreenReaderOptimized(),backKeybindingLabel:()=>{},setContextKey:a=>this.setContextKey(a),returnFocus:()=>e.focus(),createList:(a,l,c,h,d)=>this.instantiationService.createInstance(C_,a,l,c,h,d),styles:this.computeStyles()},o=this._register(new ph(Object.assign(Object.assign({},r),t)));return o.layout(e.dimension,(n=(i=e.offset)===null||i===void 0?void 0:i.top)!==null&&n!==void 0?n:0),this._register(e.onDidLayout(a=>{var l,c;return o.layout(a,(c=(l=e.offset)===null||l===void 0?void 0:l.top)!==null&&c!==void 0?c:0)})),this._register(o.onShow(()=>this.resetContextKeys())),this._register(o.onHide(()=>this.resetContextKeys())),o}setContextKey(e){let t;e&&(t=this.contexts.get(e),t||(t=new te(e,!1).bindTo(this.contextKeyService),this.contexts.set(e,t))),!(t&&t.get())&&(this.resetContextKeys(),t&&t.set(!0))}resetContextKeys(){this.contexts.forEach(e=>{e.get()&&e.reset()})}pick(e,t={},i=Wt.None){return this.controller.pick(e,t,i)}createQuickPick(){return this.controller.createQuickPick()}updateStyles(){this.controller.applyStyles(this.computeStyles())}computeStyles(){return{widget:Object.assign({},dn(this.theme,{quickInputBackground:uC,quickInputForeground:Ok,quickInputTitleBackground:Pk,contrastBorder:Tt,widgetShadow:Mc})),inputBox:dn(this.theme,{inputForeground:mk,inputBackground:fk,inputBorder:gk,inputValidationInfoBackground:pk,inputValidationInfoForeground:_k,inputValidationInfoBorder:bk,inputValidationWarningBackground:wk,inputValidationWarningForeground:vk,inputValidationWarningBorder:Ck,inputValidationErrorBackground:Sk,inputValidationErrorForeground:yk,inputValidationErrorBorder:Lk}),countBadge:dn(this.theme,{badgeBackground:Ka,badgeForeground:qa,badgeBorder:Tt}),button:dn(this.theme,{buttonForeground:Dk,buttonBackground:ip,buttonHoverBackground:Ek,buttonBorder:Tt}),progressBar:dn(this.theme,{progressBarBackground:kk}),keybindingLabel:dn(this.theme,{keybindingLabelBackground:Wk,keybindingLabelForeground:Vk,keybindingLabelBorder:jk,keybindingLabelBottomBorder:zk,keybindingLabelShadow:Mc}),list:dn(this.theme,{listBackground:uC,listInactiveFocusForeground:uI,listInactiveSelectionIconForeground:fI,listInactiveFocusBackground:mI,listFocusOutline:xi,listInactiveFocusOutline:xi,pickerGroupBorder:Bk,pickerGroupForeground:Fk})}}};U_=A5([mf(0,ct),mf(1,fe),mf(2,We),mf(3,jt),mf(4,Uo)],U_);var y2=function(s,e,t,i){var n=arguments.length,r=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(s,e,t,i);else for(var a=s.length-1;a>=0;a--)(o=s[a])&&(r=(n<3?o(r):n>3?o(e,t,r):o(e,t))||r);return n>3&&r&&Object.defineProperty(e,t,r),r},Cl=function(s,e){return function(t,i){e(t,i,s)}},N1=class extends U_{constructor(e,t,i,n,r,o){super(t,i,n,r,o);this.host=void 0;let a=Sl.get(e);this.host={_serviceBrand:void 0,get container(){return a.widget.getDomNode()},get dimension(){return e.getLayoutInfo()},get onDidLayout(){return e.onDidLayoutChange},focus:()=>e.focus()}}createController(){return super.createController(this.host)}};N1=y2([Cl(1,ct),Cl(2,fe),Cl(3,We),Cl(4,jt),Cl(5,Uo)],N1);var $_=class{constructor(e,t){this.instantiationService=e,this.codeEditorService=t,this.mapEditorToService=new Map}get activeService(){let 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){let i=t=this.instantiationService.createInstance(N1,e);this.mapEditorToService.set(e,t),pn(e.onDidDispose)(()=>{i.dispose(),this.mapEditorToService.delete(e)})}return t}get quickAccess(){return this.activeService.quickAccess}pick(e,t={},i=Wt.None){return this.activeService.pick(e,t,i)}createQuickPick(){return this.activeService.createQuickPick()}};$_=y2([Cl(0,ct),Cl(1,qe)],$_);var Sl=class{constructor(e){this.editor=e,this.widget=new gf(this.editor)}static get(e){return e.getContribution(Sl.ID)}dispose(){this.widget.dispose()}};Sl.ID="editor.controller.quickInput";var gf=class{constructor(e){this.codeEditor=e,this.domNode=document.createElement("div"),this.codeEditor.addOverlayWidget(this)}getId(){return gf.ID}getDomNode(){return this.domNode}getPosition(){return{preference:2}}dispose(){this.codeEditor.removeOverlayWidget(this)}};gf.ID="editor.contrib.quickInputWidget";dm(Sl.ID,Sl);var Se;(function(s){let e=new Ds;class t{constructor(l,c){this._serviceId=l,this._factory=c,this._value=null}get id(){return this._serviceId}get(l){if(!this._value){if(l&&(this._value=l[this._serviceId.toString()]),this._value||(this._value=this._factory(l)),!this._value)throw new Error("Service "+this._serviceId+" is missing!");e.set(this._serviceId,this._value)}return this._value}}s.LazyStaticService=t;let i=[];function n(a,l){let c=new t(a,l);return i.push(c),c}function r(a){let l=new Ds;for(let[h,d]of NN())l.set(h,d);for(let h in a)a.hasOwnProperty(h)&&l.set($(h),a[h]);i.forEach(h=>l.set(h.id,h.get(a)));let c=new ih(l,!0);return l.set(ct,c),[l,c]}s.init=r,s.instantiationService=n(ct,()=>new ih(e,!0));let o=new Ug;s.configurationService=n(nt,()=>o),s.resourceConfigurationService=n(kg,()=>new zv(o)),s.resourcePropertiesService=n(Ig,()=>new $g(o)),s.contextService=n(PE,()=>new Ec),s.labelService=n(HT,()=>new $v),s.telemetryService=n(_a,()=>new Hv),s.dialogService=n(Jp,()=>new Vv),s.notificationService=n(ri,()=>new Dc),s.markerService=n(y_,()=>new Er),s.modeService=n(dc,a=>new aS),s.standaloneThemeService=n(Oo,()=>new mS),s.logService=n(Hs,()=>new Wb(new Bb)),s.undoRedoService=n(Jc,a=>new af(s.dialogService.get(a),s.notificationService.get(a))),s.modelService=n(ht,a=>new Wu(s.configurationService.get(a),s.resourcePropertiesService.get(a),s.standaloneThemeService.get(a),s.logService.get(a),s.undoRedoService.get(a))),s.markerDecorationsService=n(Kg,a=>new I_(s.modelService.get(a),s.markerService.get(a))),s.contextKeyService=n(fe,a=>new zp(s.configurationService.get(a))),s.codeEditorService=n(qe,a=>new Qc(null,s.contextKeyService.get(a),s.standaloneThemeService.get(a))),s.editorProgressService=n(Ro,()=>new xc),s.storageService=n($M,()=>new f1),s.editorWorkerService=n(qi,a=>new Ng(s.modelService.get(a),s.resourceConfigurationService.get(a),s.logService.get(a)))})(Se||(Se={}));var T1=class extends M{constructor(e,t){super();let[i,n]=Se.init(t);this._serviceCollection=i,this._instantiationService=n;let r=this.get(nt),o=this.get(ri),a=this.get(_a),l=this.get(We),c=this.get(Hs),h=this.get(fe),d=(b,w)=>{let _=null;return t&&(_=t[b.toString()]),_||(_=w()),this._serviceCollection.set(b,_),_};d(jt,()=>new N_(h,r)),d(Xn,()=>new f_(l));let u=d(It,()=>new jv(this._instantiationService)),f=d(zt,()=>this._register(new Gd(h,u,a,o,c,e))),m=d(Uo,()=>new Kv(Se.codeEditorService.get(qe),e));d(j_,()=>new $_(n,Se.codeEditorService.get(qe)));let g=d(Es,()=>this._register(new Qp(m)));d(Mo,()=>new g1),d(To,()=>{let b=new Xp(a,o,g,f,l);return b.configure({blockMouse:!1}),this._register(b)}),d(lm,()=>new k_(u)),d(oE,()=>new Uv(Se.modelService.get(ht)))}get(e){let t=this._serviceCollection.get(e);if(!t)throw new Error("Missing service "+e);return t}set(e,t){this._serviceCollection.set(e,t)}has(e){return this._serviceCollection.has(e)}};function L2(s,e,t){let i=new T1(s,e),n=null;i.has(Ol)||(n=new Hg(Se.modelService.get()),i.set(Ol,n)),i.has(Xw)||i.set(Xw,new Dg(i.get(qe),i.get(It)));let r=t(i);return n&&n.setEditor(r),r}function O5(s,e,t){return L2(s,t||{},i=>new Tp(s,e,i,i.get(ct),i.get(qe),i.get(It),i.get(fe),i.get(zt),i.get(Es),i.get(Oo),i.get(ri),i.get(nt),i.get(jt),i.get(ht),i.get(dc)))}function P5(s){return Se.codeEditorService.get().onCodeEditorAdd(e=>{s(e)})}function F5(s,e,t){return L2(s,t||{},i=>new Mp(s,e,i,i.get(ct),i.get(fe),i.get(zt),i.get(Es),i.get(qi),i.get(qe),i.get(Oo),i.get(ri),i.get(nt),i.get(To),i.get(Ro),i.get(Mo)))}function B5(s,e){return new iv(s,e)}function W5(s,e,t){return iS(Se.modelService.get(),Se.modeService.get(),s,e,t)}function V5(s,e){Se.modelService.get().setMode(s,Se.modeService.get().create(e))}function j5(s,e,t){s&&Se.markerService.get().changeOne(e,s.uri,t)}function z5(s){return Se.markerService.get().read(s)}function H5(s){return Se.markerService.get().onMarkerChanged(s)}function U5(s){return Se.modelService.get().getModel(s)}function $5(){return Se.modelService.get().getModels()}function K5(s){return Se.modelService.get().onModelAdded(s)}function q5(s){return Se.modelService.get().onModelRemoved(s)}function G5(s){return Se.modelService.get().onModelModeChanged(e=>{s({model:e.model,oldLanguage:e.oldModeId})})}function Y5(s){return GD(Se.modelService.get(),s)}function Z5(s,e){let t=Se.standaloneThemeService.get();return t.registerEditorContainer(s),$d.colorizeElement(t,Se.modeService.get(),s,e)}function X5(s,e,t){return Se.standaloneThemeService.get().registerEditorContainer(document.body),$d.colorize(Se.modeService.get(),s,e,t)}function Q5(s,e,t=4){return Se.standaloneThemeService.get().registerEditorContainer(document.body),$d.colorizeModelLine(s,e,t)}function J5(s){let e=Pe.get(s);return e||{getInitialState:()=>Ta,tokenize:(t,i,n,r)=>sD(s,t,n,r)}}function eF(s,e){Se.modeService.get().triggerMode(e);let i=J5(e),n=is(s),r=[],o=i.getInitialState();for(let a=0,l=n.length;a=100){i=i-100;let n=t.split(".");if(n.unshift(t),i=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 Ne(s,"a 'bracket' attribute must be either '@open' or '@close', in rule: "+e);if(t.next){if(typeof t.next!="string")throw Ne(s,"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&&!tE(s,ws(s,n,"",[],""))))throw Ne(s,"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,s.usesEmbedded=!0),i}}else if(Array.isArray(t)){let i=[];for(let n=0,r=t.length;n0&&i[0]==="^",this.name=this.name+": "+i,this.regex=M1(e,"^(?:"+(this.matchOnlyAtLineStart?i.substr(1):i)+")")}setAction(e,t){this.action=R1(e,this.name,t)}};function I2(s,e){if(!e||typeof e!="object")throw new Error("Monarch: expecting a language definition object");let t={};t.languageId=s,t.includeLF=K_(e.includeLF,!1),t.noThrow=!1,t.maxStack=100,t.start=typeof e.start=="string"?e.start:null,t.ignoreCase=K_(e.ignoreCase,!1),t.unicode=K_(e.unicode,!1),t.tokenPostfix=D2(e.tokenPostfix,"."+t.languageId),t.defaultToken=D2(e.defaultToken,"source"),t.usesEmbedded=!1;let i=e;i.languageId=s,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(o,a,l){for(let c of l){let h=c.include;if(h){if(typeof h!="string")throw Ne(t,"an 'include' attribute must be a string at: "+o);if(h[0]==="@"&&(h=h.substr(1)),!e.tokenizer[h])throw Ne(t,"include target '"+h+"' is not defined at: "+o);n(o+"."+h,a,e.tokenizer[h])}else{let d=new k2(o);if(Array.isArray(c)&&c.length>=1&&c.length<=3)if(d.setRegex(i,c[0]),c.length>=3)if(typeof c[1]=="string")d.setAction(i,{token:c[1],next:c[2]});else if(typeof c[1]=="object"){let u=c[1];u.next=c[2],d.setAction(i,u)}else throw Ne(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: "+o);else d.setAction(i,c[1]);else{if(!c.regex)throw Ne(t,"a rule must either be an array, or an object with a 'regex' or 'include' field at: "+o);c.name&&typeof c.name=="string"&&(d.name=c.name),c.matchOnlyAtStart&&(d.matchOnlyAtLineStart=K_(c.matchOnlyAtLineStart,!1)),d.setRegex(i,c.regex),d.setAction(i,c.action)}a.push(d)}}}if(!e.tokenizer||typeof e.tokenizer!="object")throw Ne(t,"a language definition must define the 'tokenizer' attribute as an object");t.tokenizer=[];for(let o in e.tokenizer)if(e.tokenizer.hasOwnProperty(o)){t.start||(t.start=o);let a=e.tokenizer[o];t.tokenizer[o]=new Array,n("tokenizer."+o,t.tokenizer[o],a)}if(t.usesEmbedded=i.usesEmbedded,e.brackets){if(!Array.isArray(e.brackets))throw Ne(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"}];let r=[];for(let o of e.brackets){let a=o;if(a&&Array.isArray(a)&&a.length===3&&(a={token:a[2],open:a[0],close:a[1]}),a.open===a.close)throw Ne(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")r.push({token:a.token+t.tokenPostfix,open:bs(t,a.open),close:bs(t,a.close)});else throw Ne(t,"every element in the 'brackets' array must be a '{open,close,token}' object or array")}return t.brackets=r,t.noThrow=!0,t}function cF(s){Sr.registerLanguage(s)}function hF(){let s=[];return s=s.concat(Sr.getLanguages()),s}function dF(s){let e=Se.modeService.get().getLanguageIdentifier(s);return e?e.id:0}function uF(s,e){let t=Se.modeService.get().onDidCreateMode(i=>{i.getId()===s&&(t.dispose(),e())});return t}function fF(s,e){let t=Se.modeService.get().getLanguageIdentifier(s);if(!t)throw new Error(`Cannot set configuration for unknown language ${s}`);return xe.register(t,e,100)}var N2=class{constructor(e,t){this._languageIdentifier=e,this._actual=t}getInitialState(){return this._actual.getInitialState()}tokenize(e,t,i,n){if(typeof this._actual.tokenize=="function")return _h.adaptTokenize(this._languageIdentifier.language,this._actual,e,i,n);throw new Error("Not supported!")}tokenize2(e,t,i){let n=this._actual.tokenizeEncoded(e,i);return new oo(n.tokens,n.endState)}},_h=class{constructor(e,t,i){this._standaloneThemeService=e,this._languageIdentifier=t,this._actual=i}getInitialState(){return this._actual.getInitialState()}static _toClassicTokens(e,t,i){let n=[],r=0;for(let o=0,a=e.length;o0&&r[o-1]===u)continue;let f=d.startIndex;c===0?f=0:fmF(n)?new N2(t,n):new _h(Se.standaloneThemeService.get(),t,n);return T2(e)?Pe.registerPromise(s,e.then(n=>i(n))):Pe.register(s,i(e))}function _F(s,e){let t=i=>sE(Se.modeService.get(),Se.standaloneThemeService.get(),s,I2(s,i));return T2(e)?Pe.registerPromise(s,e.then(i=>t(i))):Pe.register(s,t(e))}function bF(s,e){return cd.register(s,e)}function wF(s,e){return hd.register(s,e)}function vF(s,e){return dd.register(s,e)}function CF(s,e){return ud.register(s,{provideHover:(t,i,n)=>{let r=t.getWordAtPosition(i);return Promise.resolve(e.provideHover(t,i,n)).then(o=>{if(!!o)return!o.range&&r&&(o.range=new D(i.lineNumber,r.startColumn,i.lineNumber,r.endColumn)),o.range||(o.range=new D(i.lineNumber,i.column,i.lineNumber,i.column)),o})}})}function SF(s,e){return fd.register(s,e)}function yF(s,e){return md.register(s,e)}function LF(s,e){return Zx.register(s,e)}function xF(s,e){return gd.register(s,e)}function DF(s,e){return _d.register(s,e)}function EF(s,e){return bd.register(s,e)}function kF(s,e){return wd.register(s,e)}function IF(s,e){return Cd.register(s,{provideCodeActions:(t,i,n,r)=>{let o=Se.markerService.get().read({resource:t.uri}).filter(a=>D.areIntersectingOrTouching(a,i));return e.provideCodeActions(t,i,{markers:o,only:n.only},r)}})}function NF(s,e){return ro.register(s,e)}function TF(s,e){return Sn.register(s,e)}function MF(s,e){return xm.register(s,e)}function RF(s,e){return Dm.register(s,e)}function AF(s,e){return ka.register(s,e)}function OF(s,e){return Xx.register(s,e)}function PF(s,e){return Jx.register(s,e)}function FF(s,e){return pd.register(s,e)}function BF(s,e){return Qx.register(s,e)}function WF(s,e){return Ia.register(s,e)}function VF(s,e){return Em.register(s,e)}function jF(s,e){return Yx.register(s,e)}function zF(s,e){return vd.register(s,e)}function M2(){return{register:cF,getLanguages:hF,onLanguage:uF,getEncodedLanguageId:dF,setLanguageConfiguration:fF,setColorMap:gF,setTokensProvider:pF,setMonarchTokensProvider:_F,registerReferenceProvider:bF,registerRenameProvider:wF,registerCompletionItemProvider:AF,registerSignatureHelpProvider:vF,registerHoverProvider:CF,registerDocumentSymbolProvider:SF,registerDocumentHighlightProvider:yF,registerLinkedEditingRangeProvider:LF,registerDefinitionProvider:xF,registerImplementationProvider:DF,registerTypeDefinitionProvider:EF,registerCodeLensProvider:kF,registerCodeActionProvider:IF,registerDocumentFormattingEditProvider:NF,registerDocumentRangeFormattingEditProvider:TF,registerOnTypeFormattingEditProvider:MF,registerLinkProvider:RF,registerColorProvider:OF,registerFoldingRangeProvider:PF,registerDeclarationProvider:FF,registerSelectionRangeProvider:BF,registerDocumentSemanticTokensProvider:WF,registerDocumentRangeSemanticTokensProvider:VF,registerInlineCompletionsProvider:jF,registerInlayHintsProvider:zF,DocumentHighlightKind:Xm,CompletionItemKind:$m,CompletionItemTag:Km,CompletionItemInsertTextRule:Um,SymbolKind:bg,SymbolTag:wg,IndentAction:ig,CompletionTriggerKind:qm,SignatureHelpTriggerKind:_g,InlayHintKind:ng,InlineCompletionTriggerKind:sg,FoldingRangeKind:Zs}}var yl=class{static _handleEolEdits(e,t){let i,n=[];for(let r of t)typeof r.eol=="number"&&(i=r.eol),r.range&&typeof r.text=="string"&&n.push(r);return typeof i=="number"&&e.hasModel()&&e.getModel().pushEOL(i),n}static _isFullModelReplaceEdit(e,t){if(!e.hasModel())return!1;let i=e.getModel(),n=i.validateRange(t.range);return i.getFullModelRange().equalsRange(n)}static execute(e,t,i){i&&e.pushUndoStop();let n=yl._handleEolEdits(e,t);n.length===1&&yl._isFullModelReplaceEdit(e,n[0])?e.executeEdits("formatEditsCommand",n.map(r=>Sc.replace(D.lift(r.range),r.text))):e.executeEdits("formatEditsCommand",n.map(r=>Sc.replaceMove(D.lift(r.range),r.text))),i&&e.pushUndoStop()}};var pf=class{constructor(e){this.value=e,this._lower=e.toLowerCase()}static toKey(e){return typeof e=="string"?e.toLowerCase():e._lower}};var Go=function(s,e,t,i){function n(r){return r instanceof t?r:new t(function(o){o(r)})}return new(t||(t=Promise))(function(r,o){function a(h){try{c(i.next(h))}catch(d){o(d)}}function l(h){try{c(i.throw(h))}catch(d){o(d)}}function c(h){h.done?r(h.value):n(h.value).then(a,l)}c((i=i.apply(s,e||[])).next())})};function R2(s){if(s=s.filter(n=>n.range),!s.length)return;let{range:e}=s[0];for(let n=1;n0&&D.areIntersectingOrTouching(l[c-1],m)?l[c-1]=D.fromPositions(l[c-1].getStartPosition(),m.getEndPosition()):c=l.push(m);let h=m=>Go(this,void 0,void 0,function*(){return(yield e.provideDocumentRangeFormattingEdits(o,m,o.getFormattingOptions(),a.token))||[]}),d=(m,g)=>{if(!m.length||!g.length)return!1;let b=m.reduce((w,_)=>D.plusRange(w,_.range),m[0].range);if(!g.some(w=>D.intersectRanges(b,w.range)))return!1;for(let w of m)for(let _ of g)if(D.intersectRanges(w.range,_.range))return!0;return!1},u=[],f=[];try{for(let m of l){if(a.token.isCancellationRequested)return!0;f.push(yield h(m))}for(let m=0;m({text:b.text,range:D.lift(b.range),forceMoveMarkers:!0})),b=>{for(let{range:w}of b)if(D.areIntersectingOrTouching(w,g))return[new Z(w.startLineNumber,w.startColumn,w.endLineNumber,w.endColumn)];return null})}return!0})}function lve(s,e,t,i,n){return Go(this,void 0,void 0,function*(){let r=s.get(ct),o=ar(e)?e.getModel():e,a=A2(o),l=yield kr.select(a,o,t);l&&(i.report(l),yield r.invokeFunction(UF,l,e,t,n))})}function UF(s,e,t,i,n){return Go(this,void 0,void 0,function*(){let r=s.get(qi),o,a;ar(t)?(o=t.getModel(),a=new yp(t,1|4,void 0,n)):(o=t,a=new Lp(t,n));let l;try{let c=yield e.provideDocumentFormattingEdits(o,o.getFormattingOptions(),a.token);if(l=yield r.computeMoreMinimalEdits(o.uri,c),a.token.isCancellationRequested)return!0}finally{a.dispose()}if(!l||l.length===0)return!1;if(ar(t))yl.execute(t,l,i!==2),i!==2&&(R2(l),t.revealPositionInCenterIfOutsideViewport(t.getPosition(),1));else{let[{range:c}]=l,h=new Z(c.startLineNumber,c.startColumn,c.endLineNumber,c.endColumn);o.pushEditOperations([h],l.map(d=>({text:d.text,range:D.lift(d.range),forceMoveMarkers:!0})),d=>{for(let{range:u}of d)if(D.areIntersectingOrTouching(u,h))return[new Z(u.startLineNumber,u.startColumn,u.endLineNumber,u.endColumn)];return null})}return!0})}function $F(s,e,t,i,n){return Go(this,void 0,void 0,function*(){let r=Sn.ordered(e);for(let o of r){let a=yield Promise.resolve(o.provideDocumentRangeFormattingEdits(e,t,i,n)).catch(Yo);if(sd(a))return yield s.computeMoreMinimalEdits(e.uri,a)}})}function KF(s,e,t,i){return Go(this,void 0,void 0,function*(){let n=A2(e);for(let r of n){let o=yield Promise.resolve(r.provideDocumentFormattingEdits(e,t,i)).catch(Yo);if(sd(o))return yield s.computeMoreMinimalEdits(e.uri,o)}})}function qF(s,e,t,i,n){let r=xm.ordered(e);return r.length===0||r[0].autoFormatTriggerCharacters.indexOf(i)<0?Promise.resolve(void 0):Promise.resolve(r[0].provideOnTypeFormattingEdits(e,t,i,n,Wt.None)).catch(Yo).then(o=>s.computeMoreMinimalEdits(e.uri,o))}Qe.registerCommand("_executeFormatRangeProvider",function(s,...e){let[t,i,n]=e;ci(K.isUri(t)),ci(D.isIRange(i));let r=s.get(ht).getModel(t);if(!r)throw Nr("resource");return $F(s.get(qi),r,D.lift(i),n,Wt.None)});Qe.registerCommand("_executeFormatDocumentProvider",function(s,...e){let[t,i]=e;ci(K.isUri(t));let n=s.get(ht).getModel(t);if(!n)throw Nr("resource");return KF(s.get(qi),n,i,Wt.None)});Qe.registerCommand("_executeFormatOnTypeProvider",function(s,...e){let[t,i,n,r]=e;ci(K.isUri(t)),ci(N.isIPosition(i)),ci(typeof n=="string");let o=s.get(ht).getModel(t);if(!o)throw Nr("resource");return qF(s.get(qi),o,N.lift(i),n,r)});var A1;Wn.wrappingIndent.defaultValue=0;Wn.glyphMargin.defaultValue=!1;Wn.autoIndent.defaultValue=3;Wn.overviewRulerLanes.defaultValue=2;kr.setFormatterSelector((s,e,t)=>Promise.resolve(s[0]));var gi=Lg();gi.editor=x2();gi.languages=M2();var pve=gi.CancellationTokenSource,_ve=gi.Emitter,bve=gi.KeyCode,wve=gi.KeyMod,vve=gi.Position,Cve=gi.Range,Sve=gi.Selection,yve=gi.SelectionDirection,Lve=gi.MarkerSeverity,xve=gi.MarkerTag,Dve=gi.Uri,Eve=gi.Token,kve=gi.editor,Ive=gi.languages;(((A1=Be.MonacoEnvironment)===null||A1===void 0?void 0:A1.globalAPI)||typeof define=="function"&&define.amd)&&(self.monaco=gi);typeof self.require!="undefined"&&typeof self.require.config=="function"&&self.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"]});export{p as a,ot as b,ee as c,_t as d,Mr as e,Zo as f,en as g,Ii as h,ii as i,Wn as j,de as k,Yo as l,Ir as m,Ll as n,Nr as o,j1 as p,me as q,Jn as r,oe as s,U as t,M as u,Z_ as v,Ht as w,Nn as x,j as y,k as z,Wt as A,hi as B,ry as C,El as D,my as E,Rf as F,K as G,N as H,D as I,Z as J,ct as K,$ as L,Uy as M,qe as N,Q1 as O,at as P,ty as Q,De as R,Bt as S,db as T,M3 as U,Nl as V,Or as W,Dh as X,R3 as Y,Ut as Z,$e as _,Eh as $,Ce as aa,Ly as ba,Mt as ca,Of as da,O as ea,lt as fa,sB as ga,uR as ha,rB as ia,Pf as ja,Iy as ka,Bf as la,tn as ma,Ny as na,oB as oa,ti as pa,Nh as qa,Vr as ra,yb as sa,Lb as ta,z as ua,ke as va,zr as wa,W as xa,aB as ya,sa as za,H as Aa,jf as Ba,xb as Ca,Hr as Da,Ur as Ea,Ky as Fa,ji as Ga,qf as Ha,js as Ia,is as Ja,vt as Ka,$t as La,vn as Ma,Oh as Na,Nb as Oa,$r as Pa,ns as Qa,Tb as Ra,Xe as Sa,la as Ta,Wl as Ua,em as Va,xB as Wa,so as Xa,At as Ya,Da as Za,Yw as _a,c7 as $a,qR as ab,iw as bb,Hi as cb,p7 as db,_7 as eb,nw as fb,b7 as gb,w7 as hb,v7 as ib,Gh as jb,iy as kb,Ni as lb,Ft as mb,Ws as nb,li as ob,ci as pb,u3 as qb,Vs as rb,It as sb,Qe as tb,Xw as ub,x6 as vb,nr as wb,U6 as xb,Pi as yb,Ba as zb,Qr as Ab,Jr as Bb,xx as Cb,$i as Db,ht as Eb,RA as Fb,Le as Gb,Kt as Hb,TV as Ib,MV as Jb,Ux as Kb,$x as Lb,Kx as Mb,RV as Nb,Zs as Ob,cd as Pb,hd as Qb,ka as Rb,Yx as Sb,dd as Tb,ud as Ub,md as Vb,gd as Wb,pd as Xb,_d as Yb,bd as Zb,vd as _b,Cd as $b,Sn as ac,xm as bc,Dm as cc,Xx as dc,Qx as ec,Jx as fc,Em as gc,Pe as hc,qi as ic,dc as jc,Ol as kc,ft as lc,as as mc,xe as nc,xn as oc,lA as pc,kg as qc,Ri as rc,bx as sc,Z7 as tc,wx as uc,X7 as vc,vx as wc,Cx as xc,sd as yc,Q7 as zc,Sx as Ac,Hs as Bc,et as Cc,yi as Dc,Hn as Ec,Vd as Fc,Ye as Gc,ar as Hc,oE as Ic,kv as Jc,Te as Kc,vs as Lc,wE as Mc,Sc as Nc,nt as Oc,pa as Pc,jg as Qc,ri as Rc,PE as Sc,jE as Tc,ts as Uc,Rh as Vc,Kg as Wc,_i as Xc,oa as Yc,On as Zc,Ah as _c,dt as $c,te as ad,fe as bd,nn as cd,We as dd,ma as ed,ui as fd,bt as gd,Ie as hd,lm as id,Gr as jd,Fb as kd,cm as ld,_a as md,hm as nd,Us as od,ba as pd,IR as qd,OW as rd,PW as sd,J as td,jb as ud,FW as vd,BW as wd,dm as xd,zb as yd,Hb as zd,mt as Ad,Re as Bd,we as Cd,kc as Dd,cr as Ed,ds as Fd,to as Gd,ge as Hd,Ra as Id,A as Jd,qt as Kd,wt as Ld,ne as Md,ue as Nd,lk as Od,ru as Pd,R as Qd,$a as Rd,zq as Sd,Hq as Td,Tc as Ud,Tt as Vd,xi as Wd,Uq as Xd,$q as Yd,Kq as Zd,Mc as _d,fk as $d,mk as ae,gk as be,qq as ce,Gq as de,Yq as ee,pk as fe,_k as ge,bk as he,wk as ie,vk as je,Ck as ke,Sk as le,yk as me,Lk as ne,cu as oe,Nk as pe,Ss as qe,hu as re,yo as se,np as te,Kn as ue,Lo as ve,Ga as we,Rc as xe,dC as ye,Zq as ze,Ya as Ae,fC as Be,Xq as Ce,Qq as De,mC as Ee,Jq as Fe,eG as Ge,tG as He,iG as Ie,nG as Je,Uk as Ke,sG as Le,rG as Me,oG as Ne,aG as Oe,lG as Pe,cG as Qe,hG as Re,dG as Se,_C as Te,uG as Ue,uI as Ve,fI as We,mI as Xe,fG as Ye,mG as Ze,gG as _e,pG as $e,_G as af,bG as bf,wG as cf,vG as df,CG as ef,SG as ff,xt as gf,II as hf,IG as if,NG as jf,TG as kf,MG as lf,si as mf,GA as nf,Hw as of,pe as pf,YA as qf,Ot as rf,ps as sf,je as tf,V as uf,xD as vf,pr as wf,dp as xf,_u as yf,ete as zf,jt as Af,vN as Bf,qc as Cf,Ee as Df,kN as Ef,Di as Ff,Cp as Gf,Sp as Hf,yp as If,Lp as Jf,Ru as Kf,Io as Lf,Au as Mf,En as Nf,No as Of,sse as Pf,Es as Qf,To as Rf,Mo as Sf,VN as Tf,Ro as Uf,zt as Vf,tT as Wf,Jc as Xf,iT as Yf,oT as Zf,hT as _f,dT as $f,xT as ag,Hp as bg,_P as cg,Ale as dg,Ole as eg,Ple as fg,Ho as gg,Hu as hg,Fle as ig,zle as jg,Hle as kg,PT as lg,hce as mg,ul as ng,Jp as og,HT as pg,Xi as qg,Qhe as rg,kM as sg,o1 as tg,Xn as ug,Zue as vg,VM as wg,Wi as xg,zM as yg,y_ as zg,$M as Ag,KM as Bg,qo as Cg,Ps as Dg,v1 as Eg,P_ as Fg,Gme as Gg,m2 as Hg,E5 as Ig,W_ as Jg,j_ as Kg,I1 as Lg,yl as Mg,R2 as Ng,ave as Og,lve as Pg,qF as Qg,_ve as Rg,Cve as Sg,Lve as Tg,xve as Ug,Dve as Vg,kve as Wg,Ive as Xg}; +//# sourceMappingURL=chunk-KT5CD4BK.js.map diff --git a/docs/js/chunk-KT5CD4BK.js.map b/docs/js/chunk-KT5CD4BK.js.map new file mode 100644 index 0000000..bd83762 --- /dev/null +++ b/docs/js/chunk-KT5CD4BK.js.map @@ -0,0 +1,7 @@ +{ + "version": 3, + "sources": ["node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/nls.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/base/common/errors.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/base/common/functional.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/base/common/iterator.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/base/common/lifecycle.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/base/common/linkedList.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/base/common/platform.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/base/common/stopwatch.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/base/common/event.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/base/browser/browser.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/base/common/types.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/base/common/keyCodes.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/base/browser/keyboardEvent.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/base/browser/iframe.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/base/browser/mouseEvent.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/base/common/cancellation.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/base/common/async.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/base/common/process.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/base/common/path.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/base/common/uri.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/base/common/network.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/base/browser/canIUse.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/base/browser/dom.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/base/browser/ui/aria/aria.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/platform/instantiation/common/instantiation.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/editor/browser/services/codeEditorService.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/editor/common/core/position.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/editor/common/services/modelService.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/editor/common/services/resolverService.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/base/common/actions.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/base/common/strings.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/platform/contextkey/common/contextkey.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/platform/commands/common/commands.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/base/common/assert.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/platform/registry/common/platform.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/platform/theme/common/theme.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/base/common/codicons.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/platform/theme/common/themeService.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/platform/actions/common/actions.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/platform/keybinding/common/keybindingsRegistry.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/platform/telemetry/common/telemetry.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/platform/log/common/log.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/editor/browser/editorExtensions.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/editor/common/core/range.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/editor/common/core/selection.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/editor/common/model/wordHelper.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/editor/common/config/editorOptions.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/editor/common/model.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/base/common/buffer.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/editor/common/core/stringBuilder.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/editor/common/model/textChange.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/base/common/extpath.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/base/common/resources.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/editor/common/model/editStack.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/editor/common/model/indentationGuesser.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/editor/common/model/intervalTree.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/editor/common/model/pieceTreeTextBuffer/rbTreeBase.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/base/common/uint.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/editor/common/core/characterClassifier.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/editor/common/controller/wordCharacterClassifier.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/editor/common/model/textModelSearch.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/editor/common/model/pieceTreeTextBuffer/pieceTreeBase.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/base/common/arrays.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/base/common/hash.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/base/common/map.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/base/common/numbers.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/base/common/glob.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/editor/common/modes/languageSelector.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/editor/common/modes/languageFeatureRegistry.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/editor/common/modes/tokenizationRegistry.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/editor/common/modes.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/editor/common/core/lineTokens.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/editor/common/model/tokensStore.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/editor/common/model/pieceTreeTextBuffer/pieceTreeTextBuffer.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/editor/common/model/pieceTreeTextBuffer/pieceTreeTextBufferBuilder.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/editor/common/model/textModelEvents.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/editor/common/core/token.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/editor/common/modes/nullMode.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/editor/common/model/textModelTokens.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/editor/common/modes/languageConfiguration.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/editor/common/modes/supports.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/editor/common/modes/supports/characterPair.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/editor/common/modes/supports/richEditBrackets.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/editor/common/modes/supports/electricCharacter.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/editor/common/modes/supports/indentRules.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/editor/common/modes/supports/onEnter.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/editor/common/modes/languageConfigurationRegistry.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/base/common/color.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/editor/common/model/textModel.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/editor/common/controller/cursorCommon.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/editor/common/controller/cursorColumnSelection.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/editor/common/commands/replaceCommand.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/editor/common/controller/cursorAtomicMoveOperations.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/editor/common/controller/cursorMoveOperations.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/editor/common/controller/cursorDeleteOperations.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/editor/common/controller/cursorWordOperations.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/editor/common/controller/cursorMoveCommands.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/editor/common/commands/shiftCommand.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/editor/common/commands/surroundSelectionCommand.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/editor/common/controller/cursorTypeOperations.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/editor/common/editorContextKeys.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/editor/browser/controller/coreCommands.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/base/browser/ui/codicons/codiconStyles.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/editor/common/standalone/standaloneEnums.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/editor/common/standalone/standaloneBase.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/base/common/marshalling.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/platform/editor/common/editor.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/platform/opener/common/opener.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/editor/browser/services/openerService.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/base/common/objects.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/editor/browser/widget/diffNavigator.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/editor/common/config/editorZoom.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/editor/common/config/fontInfo.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/editor/common/editorCommon.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/editor/common/services/editorWorkerService.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/editor/common/services/modeService.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/base/common/worker/simpleWorker.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/base/worker/defaultWorkerFactory.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/base/common/diff/diffChange.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/base/common/diff/diff.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/editor/common/diff/diffComputer.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/editor/common/viewModel/prefixSumComputer.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/editor/common/model/mirrorTextModel.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/editor/common/modes/linkComputer.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/editor/common/modes/supports/inplaceReplaceSupport.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/editor/common/services/editorSimpleWorker.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/editor/common/services/textResourceConfigurationService.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/editor/common/services/editorWorkerServiceImpl.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/editor/common/services/webWorker.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/editor/common/viewLayout/lineDecorations.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/editor/common/viewLayout/viewLineRenderer.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/editor/common/viewModel/viewModel.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/editor/standalone/common/monarch/monarchCommon.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/editor/standalone/common/monarch/monarchLexer.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/editor/standalone/browser/colorizer.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/base/common/severity.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/editor/browser/editorBrowser.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/editor/browser/services/bulkEditService.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/platform/jsonschemas/common/jsonContributionRegistry.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/platform/configuration/common/configurationRegistry.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/base/common/collections.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/editor/common/config/commonEditorConfig.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/editor/common/core/editOperation.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/platform/configuration/common/configuration.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/platform/configuration/common/configurationModels.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/platform/keybinding/common/abstractKeybindingService.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/platform/keybinding/common/keybindingResolver.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/platform/keybinding/common/resolvedKeybindingItem.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/base/common/keybindingLabels.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/platform/keybinding/common/baseResolvedKeybinding.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/platform/keybinding/common/usLayoutResolvedKeybinding.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/platform/notification/common/notification.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/platform/workspace/common/workspace.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/editor/common/standaloneStrings.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/editor/standalone/browser/simpleServices.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/editor/common/services/markersDecorationService.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/editor/browser/services/markerDecorations.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/editor/browser/config/charWidthReader.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/editor/browser/config/elementSizeObserver.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/editor/browser/config/configuration.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/base/browser/fastDomNode.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/base/common/decorators.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/base/browser/touch.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/base/browser/globalMouseMoveMonitor.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/editor/browser/editorDom.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/editor/common/viewModel/viewEventHandler.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/editor/browser/view/viewPart.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/editor/common/view/renderingContext.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/editor/browser/viewParts/lines/rangeUtil.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/editor/browser/viewParts/lines/viewLine.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/editor/browser/controller/mouseTarget.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/editor/browser/controller/mouseHandler.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/base/common/mime.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/editor/browser/controller/textAreaState.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/editor/browser/controller/textAreaInput.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/editor/browser/controller/pointerHandler.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/editor/browser/view/dynamicViewOverlay.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/platform/theme/common/colorRegistry.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/editor/common/view/editorColorRegistry.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/editor/browser/viewParts/lineNumbers/lineNumbers.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/editor/browser/viewParts/margin/margin.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/base/browser/ui/mouseCursor/mouseCursor.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/editor/browser/controller/textAreaHandler.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/editor/browser/view/viewController.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/editor/browser/view/viewUserInputEvents.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/editor/browser/view/viewLayer.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/editor/browser/view/viewOverlays.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/editor/browser/viewParts/contentWidgets/contentWidgets.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/editor/browser/viewParts/currentLineHighlight/currentLineHighlight.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/editor/browser/viewParts/decorations/decorations.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/base/browser/ui/widget.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/base/browser/ui/scrollbar/scrollbarArrow.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/base/browser/ui/scrollbar/scrollbarVisibilityController.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/base/browser/ui/scrollbar/abstractScrollbar.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/base/browser/ui/scrollbar/scrollbarState.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/base/browser/ui/scrollbar/horizontalScrollbar.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/base/browser/ui/scrollbar/verticalScrollbar.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/base/common/scrollable.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/base/browser/ui/scrollbar/scrollableElement.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/editor/browser/viewParts/editorScrollbar/editorScrollbar.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/editor/browser/viewParts/glyphMargin/glyphMargin.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/editor/browser/viewParts/indentGuides/indentGuides.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/editor/browser/viewParts/lines/viewLines.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/editor/browser/viewParts/linesDecorations/linesDecorations.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/editor/browser/viewParts/marginDecorations/marginDecorations.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/editor/common/core/rgba.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/editor/common/viewModel/minimapTokensColorTracker.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/editor/browser/viewParts/minimap/minimapCharSheet.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/editor/browser/viewParts/minimap/minimapCharRenderer.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/editor/browser/viewParts/minimap/minimapPreBaked.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/editor/browser/viewParts/minimap/minimapCharRendererFactory.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/editor/browser/viewParts/minimap/minimap.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/editor/browser/viewParts/overlayWidgets/overlayWidgets.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/editor/browser/viewParts/overviewRuler/decorationsOverviewRuler.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/editor/common/view/overviewZoneManager.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/editor/browser/viewParts/overviewRuler/overviewRuler.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/editor/browser/viewParts/rulers/rulers.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/editor/browser/viewParts/scrollDecoration/scrollDecoration.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/editor/browser/viewParts/selections/selections.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/editor/browser/viewParts/viewCursors/viewCursor.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/editor/browser/viewParts/viewCursors/viewCursors.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/editor/browser/viewParts/viewZones/viewZones.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/editor/common/view/viewContext.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/editor/common/viewLayout/viewLinesViewportData.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/editor/browser/view/viewImpl.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/editor/common/controller/oneCursor.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/editor/common/controller/cursorCollection.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/editor/common/view/viewEvents.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/editor/common/viewModel/viewModelEventDispatcher.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/editor/common/controller/cursor.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/editor/common/editorAction.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/editor/common/modes/textToHtmlTokenizer.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/editor/common/viewLayout/linesLayout.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/editor/common/viewLayout/viewLayout.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/editor/common/viewModel/splitLinesCollection.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/editor/common/viewModel/viewModelDecorations.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/editor/common/viewModel/viewModelImpl.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/platform/instantiation/common/serviceCollection.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/platform/accessibility/common/accessibility.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/editor/common/viewModel/monospaceLineBreaksComputer.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/editor/browser/view/domLineBreaksComputer.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/editor/browser/widget/codeEditorWidget.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/base/browser/event.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/base/browser/ui/sash/sash.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/platform/instantiation/common/descriptors.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/platform/instantiation/common/extensions.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/editor/browser/core/keybindingCancellation.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/editor/browser/core/editorState.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/base/browser/dnd.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/base/browser/ui/actionbar/actionViewItems.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/base/browser/ui/actionbar/actionbar.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/platform/theme/common/iconRegistry.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/editor/browser/widget/diffReview.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/platform/contextview/browser/contextView.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/editor/browser/widget/inlineDiffMargin.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/platform/clipboard/common/clipboardService.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/platform/progress/common/progress.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/editor/browser/widget/diffEditorWidget.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/editor/standalone/common/standaloneThemeService.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/platform/keybinding/common/keybinding.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/editor/browser/services/abstractCodeEditorService.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/editor/browser/services/codeEditorServiceImpl.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/editor/standalone/browser/standaloneCodeServiceImpl.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/editor/standalone/browser/standaloneCodeEditor.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/editor/common/modes/abstractMode.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/editor/common/modes/modesRegistry.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/editor/common/services/languagesRegistry.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/editor/common/services/modeServiceImpl.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/platform/undoRedo/common/undoRedo.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/editor/common/services/semanticTokensProviderStyling.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/editor/common/services/semanticTokensDto.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/editor/common/services/getSemanticTokens.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/editor/common/services/modelServiceImpl.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/editor/common/modes/supports/tokenization.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/editor/standalone/common/themes.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/platform/theme/browser/iconsStyleSheet.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/editor/standalone/browser/standaloneThemeServiceImpl.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/platform/contextkey/browser/contextKeyService.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/base/common/range.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/base/browser/ui/contextview/contextview.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/base/common/filters.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/base/common/iconLabels.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/base/browser/ui/menu/menu.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/platform/theme/common/styler.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/platform/contextview/browser/contextMenuHandler.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/platform/contextview/browser/contextMenuService.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/platform/layout/browser/layoutService.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/platform/contextview/browser/contextViewService.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/platform/dialogs/common/dialogs.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/platform/instantiation/common/graph.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/platform/instantiation/common/instantiationService.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/platform/label/common/label.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/base/browser/ui/list/list.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/base/browser/ui/list/rangeMap.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/base/browser/ui/list/rowCache.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/base/browser/ui/list/listView.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/base/browser/ui/list/splice.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/base/browser/ui/list/listWidget.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/base/browser/ui/list/listPaging.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/platform/contextkey/common/contextkeys.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/base/browser/ui/tree/tree.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/base/browser/ui/tree/indexTreeModel.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/base/browser/ui/tree/treeIcons.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/base/browser/ui/tree/abstractTree.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/base/browser/ui/tree/objectTreeModel.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/base/browser/ui/tree/compressedObjectTreeModel.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/base/browser/ui/tree/objectTree.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/base/browser/ui/tree/asyncDataTree.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/base/browser/ui/tree/dataTree.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/base/browser/ui/splitview/splitview.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/base/browser/ui/table/tableWidget.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/platform/list/browser/listService.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/platform/markers/common/markers.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/platform/markers/common/markerService.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/base/parts/storage/common/storage.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/platform/storage/common/storage.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/platform/actions/common/menuService.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/editor/common/services/markerDecorationsServiceImpl.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/platform/accessibility/common/accessibilityService.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/platform/clipboard/browser/clipboardService.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/platform/undoRedo/common/undoRedoService.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/base/parts/quickinput/common/quickInput.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/base/common/comparers.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/base/browser/ui/iconLabel/iconLabels.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/base/browser/ui/highlightedlabel/highlightedLabel.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/base/browser/ui/iconLabel/iconLabelHover.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/base/browser/ui/iconLabel/iconLabel.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/base/common/idGenerator.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/base/parts/quickinput/browser/quickInputUtils.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/base/browser/ui/keybindingLabel/keybindingLabel.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/base/parts/quickinput/browser/quickInputList.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/base/browser/formattedTextRenderer.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/base/common/navigator.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/base/common/history.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/base/browser/ui/inputbox/inputBox.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/base/parts/quickinput/browser/quickInputBox.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/base/browser/ui/countBadge/countBadge.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/base/browser/ui/progressbar/progressbar.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/base/browser/ui/button/button.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/base/parts/quickinput/browser/quickInput.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/platform/quickinput/common/quickInput.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/platform/quickinput/common/quickAccess.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/platform/quickinput/browser/quickAccess.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/platform/quickinput/browser/quickInput.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/editor/standalone/browser/quickInput/standaloneQuickInputServiceImpl.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/editor/standalone/browser/standaloneServices.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/editor/standalone/browser/standaloneEditor.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/editor/standalone/common/monarch/monarchCompile.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/editor/standalone/browser/standaloneLanguages.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/editor/contrib/format/formattingEdit.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/platform/extensions/common/extensions.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/editor/contrib/format/format.js", "node_modules/.pnpm/monaco-editor@0.27.0/node_modules/monaco-editor/esm/vs/editor/editor.api.js"], + "sourcesContent": ["/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License. See License.txt in the project root for license information.\r\n *--------------------------------------------------------------------------------------------*/\r\nfunction _format(message, args) {\r\n let result;\r\n if (args.length === 0) {\r\n result = message;\r\n }\r\n else {\r\n result = message.replace(/\\{(\\d+)\\}/g, function (match, rest) {\r\n const index = rest[0];\r\n return typeof args[index] !== 'undefined' ? args[index] : match;\r\n });\r\n }\r\n return result;\r\n}\r\nexport function localize(data, message, ...args) {\r\n return _format(message, args);\r\n}\r\n", "// Avoid circular dependency on EventEmitter by implementing a subset of the interface.\r\nexport class ErrorHandler {\r\n constructor() {\r\n this.listeners = [];\r\n this.unexpectedErrorHandler = function (e) {\r\n setTimeout(() => {\r\n if (e.stack) {\r\n throw new Error(e.message + '\\n\\n' + e.stack);\r\n }\r\n throw e;\r\n }, 0);\r\n };\r\n }\r\n emit(e) {\r\n this.listeners.forEach((listener) => {\r\n listener(e);\r\n });\r\n }\r\n onUnexpectedError(e) {\r\n this.unexpectedErrorHandler(e);\r\n this.emit(e);\r\n }\r\n // For external errors, we don't want the listeners to be called\r\n onUnexpectedExternalError(e) {\r\n this.unexpectedErrorHandler(e);\r\n }\r\n}\r\nexport const errorHandler = new ErrorHandler();\r\nexport function onUnexpectedError(e) {\r\n // ignore errors from cancelled promises\r\n if (!isPromiseCanceledError(e)) {\r\n errorHandler.onUnexpectedError(e);\r\n }\r\n return undefined;\r\n}\r\nexport function onUnexpectedExternalError(e) {\r\n // ignore errors from cancelled promises\r\n if (!isPromiseCanceledError(e)) {\r\n errorHandler.onUnexpectedExternalError(e);\r\n }\r\n return undefined;\r\n}\r\nexport function transformErrorForSerialization(error) {\r\n if (error instanceof Error) {\r\n let { name, message } = error;\r\n const stack = error.stacktrace || error.stack;\r\n return {\r\n $isError: true,\r\n name,\r\n message,\r\n stack\r\n };\r\n }\r\n // return as is\r\n return error;\r\n}\r\nconst canceledName = 'Canceled';\r\n/**\r\n * Checks if the given error is a promise in canceled state\r\n */\r\nexport function isPromiseCanceledError(error) {\r\n return error instanceof Error && error.name === canceledName && error.message === canceledName;\r\n}\r\n/**\r\n * Returns an error that signals cancellation.\r\n */\r\nexport function canceled() {\r\n const error = new Error(canceledName);\r\n error.name = error.message;\r\n return error;\r\n}\r\nexport function illegalArgument(name) {\r\n if (name) {\r\n return new Error(`Illegal argument: ${name}`);\r\n }\r\n else {\r\n return new Error('Illegal argument');\r\n }\r\n}\r\nexport function illegalState(name) {\r\n if (name) {\r\n return new Error(`Illegal state: ${name}`);\r\n }\r\n else {\r\n return new Error('Illegal state');\r\n }\r\n}\r\n", "/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License. See License.txt in the project root for license information.\r\n *--------------------------------------------------------------------------------------------*/\r\nexport function once(fn) {\r\n const _this = this;\r\n let didCall = false;\r\n let result;\r\n return function () {\r\n if (didCall) {\r\n return result;\r\n }\r\n didCall = true;\r\n result = fn.apply(_this, arguments);\r\n return result;\r\n };\r\n}\r\n", "/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License. See License.txt in the project root for license information.\r\n *--------------------------------------------------------------------------------------------*/\r\nexport var Iterable;\r\n(function (Iterable) {\r\n function is(thing) {\r\n return thing && typeof thing === 'object' && typeof thing[Symbol.iterator] === 'function';\r\n }\r\n Iterable.is = is;\r\n const _empty = Object.freeze([]);\r\n function empty() {\r\n return _empty;\r\n }\r\n Iterable.empty = empty;\r\n function* single(element) {\r\n yield element;\r\n }\r\n Iterable.single = single;\r\n function from(iterable) {\r\n return iterable || _empty;\r\n }\r\n Iterable.from = from;\r\n function isEmpty(iterable) {\r\n return !iterable || iterable[Symbol.iterator]().next().done === true;\r\n }\r\n Iterable.isEmpty = isEmpty;\r\n function first(iterable) {\r\n return iterable[Symbol.iterator]().next().value;\r\n }\r\n Iterable.first = first;\r\n function some(iterable, predicate) {\r\n for (const element of iterable) {\r\n if (predicate(element)) {\r\n return true;\r\n }\r\n }\r\n return false;\r\n }\r\n Iterable.some = some;\r\n function find(iterable, predicate) {\r\n for (const element of iterable) {\r\n if (predicate(element)) {\r\n return element;\r\n }\r\n }\r\n return undefined;\r\n }\r\n Iterable.find = find;\r\n function* filter(iterable, predicate) {\r\n for (const element of iterable) {\r\n if (predicate(element)) {\r\n yield element;\r\n }\r\n }\r\n }\r\n Iterable.filter = filter;\r\n function* map(iterable, fn) {\r\n let index = 0;\r\n for (const element of iterable) {\r\n yield fn(element, index++);\r\n }\r\n }\r\n Iterable.map = map;\r\n function* concat(...iterables) {\r\n for (const iterable of iterables) {\r\n for (const element of iterable) {\r\n yield element;\r\n }\r\n }\r\n }\r\n Iterable.concat = concat;\r\n function* concatNested(iterables) {\r\n for (const iterable of iterables) {\r\n for (const element of iterable) {\r\n yield element;\r\n }\r\n }\r\n }\r\n Iterable.concatNested = concatNested;\r\n function reduce(iterable, reducer, initialValue) {\r\n let value = initialValue;\r\n for (const element of iterable) {\r\n value = reducer(value, element);\r\n }\r\n return value;\r\n }\r\n Iterable.reduce = reduce;\r\n /**\r\n * Returns an iterable slice of the array, with the same semantics as `array.slice()`.\r\n */\r\n function* slice(arr, from, to = arr.length) {\r\n if (from < 0) {\r\n from += arr.length;\r\n }\r\n if (to < 0) {\r\n to += arr.length;\r\n }\r\n else if (to > arr.length) {\r\n to = arr.length;\r\n }\r\n for (; from < to; from++) {\r\n yield arr[from];\r\n }\r\n }\r\n Iterable.slice = slice;\r\n /**\r\n * Consumes `atMost` elements from iterable and returns the consumed elements,\r\n * and an iterable for the rest of the elements.\r\n */\r\n function consume(iterable, atMost = Number.POSITIVE_INFINITY) {\r\n const consumed = [];\r\n if (atMost === 0) {\r\n return [consumed, iterable];\r\n }\r\n const iterator = iterable[Symbol.iterator]();\r\n for (let i = 0; i < atMost; i++) {\r\n const next = iterator.next();\r\n if (next.done) {\r\n return [consumed, Iterable.empty()];\r\n }\r\n consumed.push(next.value);\r\n }\r\n return [consumed, { [Symbol.iterator]() { return iterator; } }];\r\n }\r\n Iterable.consume = consume;\r\n /**\r\n * Returns whether the iterables are the same length and all items are\r\n * equal using the comparator function.\r\n */\r\n function equals(a, b, comparator = (at, bt) => at === bt) {\r\n const ai = a[Symbol.iterator]();\r\n const bi = b[Symbol.iterator]();\r\n while (true) {\r\n const an = ai.next();\r\n const bn = bi.next();\r\n if (an.done !== bn.done) {\r\n return false;\r\n }\r\n else if (an.done) {\r\n return true;\r\n }\r\n else if (!comparator(an.value, bn.value)) {\r\n return false;\r\n }\r\n }\r\n }\r\n Iterable.equals = equals;\r\n})(Iterable || (Iterable = {}));\r\n", "/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License. See License.txt in the project root for license information.\r\n *--------------------------------------------------------------------------------------------*/\r\nimport { once } from './functional.js';\r\nimport { Iterable } from './iterator.js';\r\n/**\r\n * Enables logging of potentially leaked disposables.\r\n *\r\n * A disposable is considered leaked if it is not disposed or not registered as the child of\r\n * another disposable. This tracking is very simple an only works for classes that either\r\n * extend Disposable or use a DisposableStore. This means there are a lot of false positives.\r\n */\r\nconst TRACK_DISPOSABLES = false;\r\nlet disposableTracker = null;\r\nexport function setDisposableTracker(tracker) {\r\n disposableTracker = tracker;\r\n}\r\nif (TRACK_DISPOSABLES) {\r\n const __is_disposable_tracked__ = '__is_disposable_tracked__';\r\n setDisposableTracker(new class {\r\n trackDisposable(x) {\r\n const stack = new Error('Potentially leaked disposable').stack;\r\n setTimeout(() => {\r\n if (!x[__is_disposable_tracked__]) {\r\n console.log(stack);\r\n }\r\n }, 3000);\r\n }\r\n setParent(child, parent) {\r\n if (child && child !== Disposable.None) {\r\n try {\r\n child[__is_disposable_tracked__] = true;\r\n }\r\n catch (_a) {\r\n // noop\r\n }\r\n }\r\n }\r\n markAsDisposed(disposable) {\r\n if (disposable && disposable !== Disposable.None) {\r\n try {\r\n disposable[__is_disposable_tracked__] = true;\r\n }\r\n catch (_a) {\r\n // noop\r\n }\r\n }\r\n }\r\n markAsSingleton(disposable) { }\r\n });\r\n}\r\nfunction trackDisposable(x) {\r\n disposableTracker === null || disposableTracker === void 0 ? void 0 : disposableTracker.trackDisposable(x);\r\n return x;\r\n}\r\nfunction markAsDisposed(disposable) {\r\n disposableTracker === null || disposableTracker === void 0 ? void 0 : disposableTracker.markAsDisposed(disposable);\r\n}\r\nfunction setParentOfDisposable(child, parent) {\r\n disposableTracker === null || disposableTracker === void 0 ? void 0 : disposableTracker.setParent(child, parent);\r\n}\r\nfunction setParentOfDisposables(children, parent) {\r\n if (!disposableTracker) {\r\n return;\r\n }\r\n for (const child of children) {\r\n disposableTracker.setParent(child, parent);\r\n }\r\n}\r\n/**\r\n * Indicates that the given object is a singleton which does not need to be disposed.\r\n*/\r\nexport function markAsSingleton(singleton) {\r\n disposableTracker === null || disposableTracker === void 0 ? void 0 : disposableTracker.markAsSingleton(singleton);\r\n return singleton;\r\n}\r\nexport class MultiDisposeError extends Error {\r\n constructor(errors) {\r\n super(`Encountered errors while disposing of store. Errors: [${errors.join(', ')}]`);\r\n this.errors = errors;\r\n }\r\n}\r\nexport function isDisposable(thing) {\r\n return typeof thing.dispose === 'function' && thing.dispose.length === 0;\r\n}\r\nexport function dispose(arg) {\r\n if (Iterable.is(arg)) {\r\n let errors = [];\r\n for (const d of arg) {\r\n if (d) {\r\n try {\r\n d.dispose();\r\n }\r\n catch (e) {\r\n errors.push(e);\r\n }\r\n }\r\n }\r\n if (errors.length === 1) {\r\n throw errors[0];\r\n }\r\n else if (errors.length > 1) {\r\n throw new MultiDisposeError(errors);\r\n }\r\n return Array.isArray(arg) ? [] : arg;\r\n }\r\n else if (arg) {\r\n arg.dispose();\r\n return arg;\r\n }\r\n}\r\nexport function combinedDisposable(...disposables) {\r\n const parent = toDisposable(() => dispose(disposables));\r\n setParentOfDisposables(disposables, parent);\r\n return parent;\r\n}\r\nexport function toDisposable(fn) {\r\n const self = trackDisposable({\r\n dispose: once(() => {\r\n markAsDisposed(self);\r\n fn();\r\n })\r\n });\r\n return self;\r\n}\r\nexport class DisposableStore {\r\n constructor() {\r\n this._toDispose = new Set();\r\n this._isDisposed = false;\r\n trackDisposable(this);\r\n }\r\n /**\r\n * Dispose of all registered disposables and mark this object as disposed.\r\n *\r\n * Any future disposables added to this object will be disposed of on `add`.\r\n */\r\n dispose() {\r\n if (this._isDisposed) {\r\n return;\r\n }\r\n markAsDisposed(this);\r\n this._isDisposed = true;\r\n this.clear();\r\n }\r\n /**\r\n * Dispose of all registered disposables but do not mark this object as disposed.\r\n */\r\n clear() {\r\n try {\r\n dispose(this._toDispose.values());\r\n }\r\n finally {\r\n this._toDispose.clear();\r\n }\r\n }\r\n add(o) {\r\n if (!o) {\r\n return o;\r\n }\r\n if (o === this) {\r\n throw new Error('Cannot register a disposable on itself!');\r\n }\r\n setParentOfDisposable(o, this);\r\n if (this._isDisposed) {\r\n if (!DisposableStore.DISABLE_DISPOSED_WARNING) {\r\n console.warn(new Error('Trying to add a disposable to a DisposableStore that has already been disposed of. The added object will be leaked!').stack);\r\n }\r\n }\r\n else {\r\n this._toDispose.add(o);\r\n }\r\n return o;\r\n }\r\n}\r\nDisposableStore.DISABLE_DISPOSED_WARNING = false;\r\nexport class Disposable {\r\n constructor() {\r\n this._store = new DisposableStore();\r\n trackDisposable(this);\r\n setParentOfDisposable(this._store, this);\r\n }\r\n dispose() {\r\n markAsDisposed(this);\r\n this._store.dispose();\r\n }\r\n _register(o) {\r\n if (o === this) {\r\n throw new Error('Cannot register a disposable on itself!');\r\n }\r\n return this._store.add(o);\r\n }\r\n}\r\nDisposable.None = Object.freeze({ dispose() { } });\r\n/**\r\n * Manages the lifecycle of a disposable value that may be changed.\r\n *\r\n * This ensures that when the disposable value is changed, the previously held disposable is disposed of. You can\r\n * also register a `MutableDisposable` on a `Disposable` to ensure it is automatically cleaned up.\r\n */\r\nexport class MutableDisposable {\r\n constructor() {\r\n this._isDisposed = false;\r\n trackDisposable(this);\r\n }\r\n get value() {\r\n return this._isDisposed ? undefined : this._value;\r\n }\r\n set value(value) {\r\n var _a;\r\n if (this._isDisposed || value === this._value) {\r\n return;\r\n }\r\n (_a = this._value) === null || _a === void 0 ? void 0 : _a.dispose();\r\n if (value) {\r\n setParentOfDisposable(value, this);\r\n }\r\n this._value = value;\r\n }\r\n clear() {\r\n this.value = undefined;\r\n }\r\n dispose() {\r\n var _a;\r\n this._isDisposed = true;\r\n markAsDisposed(this);\r\n (_a = this._value) === null || _a === void 0 ? void 0 : _a.dispose();\r\n this._value = undefined;\r\n }\r\n /**\r\n * Clears the value, but does not dispose it.\r\n * The old value is returned.\r\n */\r\n clearAndLeak() {\r\n const oldValue = this._value;\r\n this._value = undefined;\r\n if (oldValue) {\r\n setParentOfDisposable(oldValue, null);\r\n }\r\n return oldValue;\r\n }\r\n}\r\nexport class ImmortalReference {\r\n constructor(object) {\r\n this.object = object;\r\n }\r\n dispose() { }\r\n}\r\n", "/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License. See License.txt in the project root for license information.\r\n *--------------------------------------------------------------------------------------------*/\r\nclass Node {\r\n constructor(element) {\r\n this.element = element;\r\n this.next = Node.Undefined;\r\n this.prev = Node.Undefined;\r\n }\r\n}\r\nNode.Undefined = new Node(undefined);\r\nexport class LinkedList {\r\n constructor() {\r\n this._first = Node.Undefined;\r\n this._last = Node.Undefined;\r\n this._size = 0;\r\n }\r\n get size() {\r\n return this._size;\r\n }\r\n isEmpty() {\r\n return this._first === Node.Undefined;\r\n }\r\n clear() {\r\n let node = this._first;\r\n while (node !== Node.Undefined) {\r\n const next = node.next;\r\n node.prev = Node.Undefined;\r\n node.next = Node.Undefined;\r\n node = next;\r\n }\r\n this._first = Node.Undefined;\r\n this._last = Node.Undefined;\r\n this._size = 0;\r\n }\r\n unshift(element) {\r\n return this._insert(element, false);\r\n }\r\n push(element) {\r\n return this._insert(element, true);\r\n }\r\n _insert(element, atTheEnd) {\r\n const newNode = new Node(element);\r\n if (this._first === Node.Undefined) {\r\n this._first = newNode;\r\n this._last = newNode;\r\n }\r\n else if (atTheEnd) {\r\n // push\r\n const oldLast = this._last;\r\n this._last = newNode;\r\n newNode.prev = oldLast;\r\n oldLast.next = newNode;\r\n }\r\n else {\r\n // unshift\r\n const oldFirst = this._first;\r\n this._first = newNode;\r\n newNode.next = oldFirst;\r\n oldFirst.prev = newNode;\r\n }\r\n this._size += 1;\r\n let didRemove = false;\r\n return () => {\r\n if (!didRemove) {\r\n didRemove = true;\r\n this._remove(newNode);\r\n }\r\n };\r\n }\r\n shift() {\r\n if (this._first === Node.Undefined) {\r\n return undefined;\r\n }\r\n else {\r\n const res = this._first.element;\r\n this._remove(this._first);\r\n return res;\r\n }\r\n }\r\n pop() {\r\n if (this._last === Node.Undefined) {\r\n return undefined;\r\n }\r\n else {\r\n const res = this._last.element;\r\n this._remove(this._last);\r\n return res;\r\n }\r\n }\r\n _remove(node) {\r\n if (node.prev !== Node.Undefined && node.next !== Node.Undefined) {\r\n // middle\r\n const anchor = node.prev;\r\n anchor.next = node.next;\r\n node.next.prev = anchor;\r\n }\r\n else if (node.prev === Node.Undefined && node.next === Node.Undefined) {\r\n // only node\r\n this._first = Node.Undefined;\r\n this._last = Node.Undefined;\r\n }\r\n else if (node.next === Node.Undefined) {\r\n // last\r\n this._last = this._last.prev;\r\n this._last.next = Node.Undefined;\r\n }\r\n else if (node.prev === Node.Undefined) {\r\n // first\r\n this._first = this._first.next;\r\n this._first.prev = Node.Undefined;\r\n }\r\n // done\r\n this._size -= 1;\r\n }\r\n *[Symbol.iterator]() {\r\n let node = this._first;\r\n while (node !== Node.Undefined) {\r\n yield node.element;\r\n node = node.next;\r\n }\r\n }\r\n}\r\n", "/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License. See License.txt in the project root for license information.\r\n *--------------------------------------------------------------------------------------------*/\r\nvar _a;\r\nconst LANGUAGE_DEFAULT = 'en';\r\nlet _isWindows = false;\r\nlet _isMacintosh = false;\r\nlet _isLinux = false;\r\nlet _isLinuxSnap = false;\r\nlet _isNative = false;\r\nlet _isWeb = false;\r\nlet _isIOS = false;\r\nlet _locale = undefined;\r\nlet _language = LANGUAGE_DEFAULT;\r\nlet _translationsConfigFile = undefined;\r\nlet _userAgent = undefined;\r\nexport const globals = (typeof self === 'object' ? self : typeof global === 'object' ? global : {});\r\nlet nodeProcess = undefined;\r\nif (typeof globals.vscode !== 'undefined' && typeof globals.vscode.process !== 'undefined') {\r\n // Native environment (sandboxed)\r\n nodeProcess = globals.vscode.process;\r\n}\r\nelse if (typeof process !== 'undefined') {\r\n // Native environment (non-sandboxed)\r\n nodeProcess = process;\r\n}\r\nconst isElectronRenderer = typeof ((_a = nodeProcess === null || nodeProcess === void 0 ? void 0 : nodeProcess.versions) === null || _a === void 0 ? void 0 : _a.electron) === 'string' && nodeProcess.type === 'renderer';\r\nexport const isElectronSandboxed = isElectronRenderer && (nodeProcess === null || nodeProcess === void 0 ? void 0 : nodeProcess.sandboxed);\r\nexport const browserCodeLoadingCacheStrategy = (() => {\r\n // Always enabled when sandbox is enabled\r\n if (isElectronSandboxed) {\r\n return 'bypassHeatCheck';\r\n }\r\n // Otherwise, only enabled conditionally\r\n const env = nodeProcess === null || nodeProcess === void 0 ? void 0 : nodeProcess.env['VSCODE_BROWSER_CODE_LOADING'];\r\n if (typeof env === 'string') {\r\n if (env === 'none' || env === 'code' || env === 'bypassHeatCheck' || env === 'bypassHeatCheckAndEagerCompile') {\r\n return env;\r\n }\r\n return 'bypassHeatCheck';\r\n }\r\n return undefined;\r\n})();\r\nexport const isPreferringBrowserCodeLoad = typeof browserCodeLoadingCacheStrategy === 'string';\r\n// Web environment\r\nif (typeof navigator === 'object' && !isElectronRenderer) {\r\n _userAgent = navigator.userAgent;\r\n _isWindows = _userAgent.indexOf('Windows') >= 0;\r\n _isMacintosh = _userAgent.indexOf('Macintosh') >= 0;\r\n _isIOS = (_userAgent.indexOf('Macintosh') >= 0 || _userAgent.indexOf('iPad') >= 0 || _userAgent.indexOf('iPhone') >= 0) && !!navigator.maxTouchPoints && navigator.maxTouchPoints > 0;\r\n _isLinux = _userAgent.indexOf('Linux') >= 0;\r\n _isWeb = true;\r\n _locale = navigator.language;\r\n _language = _locale;\r\n}\r\n// Native environment\r\nelse if (typeof nodeProcess === 'object') {\r\n _isWindows = (nodeProcess.platform === 'win32');\r\n _isMacintosh = (nodeProcess.platform === 'darwin');\r\n _isLinux = (nodeProcess.platform === 'linux');\r\n _isLinuxSnap = _isLinux && !!nodeProcess.env['SNAP'] && !!nodeProcess.env['SNAP_REVISION'];\r\n _locale = LANGUAGE_DEFAULT;\r\n _language = LANGUAGE_DEFAULT;\r\n const rawNlsConfig = nodeProcess.env['VSCODE_NLS_CONFIG'];\r\n if (rawNlsConfig) {\r\n try {\r\n const nlsConfig = JSON.parse(rawNlsConfig);\r\n const resolved = nlsConfig.availableLanguages['*'];\r\n _locale = nlsConfig.locale;\r\n // VSCode's default language is 'en'\r\n _language = resolved ? resolved : LANGUAGE_DEFAULT;\r\n _translationsConfigFile = nlsConfig._translationsConfigFile;\r\n }\r\n catch (e) {\r\n }\r\n }\r\n _isNative = true;\r\n}\r\n// Unknown environment\r\nelse {\r\n console.error('Unable to resolve platform.');\r\n}\r\nlet _platform = 0 /* Web */;\r\nif (_isMacintosh) {\r\n _platform = 1 /* Mac */;\r\n}\r\nelse if (_isWindows) {\r\n _platform = 3 /* Windows */;\r\n}\r\nelse if (_isLinux) {\r\n _platform = 2 /* Linux */;\r\n}\r\nexport const isWindows = _isWindows;\r\nexport const isMacintosh = _isMacintosh;\r\nexport const isLinux = _isLinux;\r\nexport const isNative = _isNative;\r\nexport const isWeb = _isWeb;\r\nexport const isIOS = _isIOS;\r\nexport const userAgent = _userAgent;\r\nexport const setImmediate = (function defineSetImmediate() {\r\n if (globals.setImmediate) {\r\n return globals.setImmediate.bind(globals);\r\n }\r\n if (typeof globals.postMessage === 'function' && !globals.importScripts) {\r\n let pending = [];\r\n globals.addEventListener('message', (e) => {\r\n if (e.data && e.data.vscodeSetImmediateId) {\r\n for (let i = 0, len = pending.length; i < len; i++) {\r\n const candidate = pending[i];\r\n if (candidate.id === e.data.vscodeSetImmediateId) {\r\n pending.splice(i, 1);\r\n candidate.callback();\r\n return;\r\n }\r\n }\r\n }\r\n });\r\n let lastId = 0;\r\n return (callback) => {\r\n const myId = ++lastId;\r\n pending.push({\r\n id: myId,\r\n callback: callback\r\n });\r\n globals.postMessage({ vscodeSetImmediateId: myId }, '*');\r\n };\r\n }\r\n if (typeof (nodeProcess === null || nodeProcess === void 0 ? void 0 : nodeProcess.nextTick) === 'function') {\r\n return nodeProcess.nextTick.bind(nodeProcess);\r\n }\r\n const _promise = Promise.resolve();\r\n return (callback) => _promise.then(callback);\r\n})();\r\nexport const OS = (_isMacintosh || _isIOS ? 2 /* Macintosh */ : (_isWindows ? 1 /* Windows */ : 3 /* Linux */));\r\nlet _isLittleEndian = true;\r\nlet _isLittleEndianComputed = false;\r\nexport function isLittleEndian() {\r\n if (!_isLittleEndianComputed) {\r\n _isLittleEndianComputed = true;\r\n const test = new Uint8Array(2);\r\n test[0] = 1;\r\n test[1] = 2;\r\n const view = new Uint16Array(test.buffer);\r\n _isLittleEndian = (view[0] === (2 << 8) + 1);\r\n }\r\n return _isLittleEndian;\r\n}\r\n", "/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License. See License.txt in the project root for license information.\r\n *--------------------------------------------------------------------------------------------*/\r\nimport { globals } from './platform.js';\r\nconst hasPerformanceNow = (globals.performance && typeof globals.performance.now === 'function');\r\nexport class StopWatch {\r\n constructor(highResolution) {\r\n this._highResolution = hasPerformanceNow && highResolution;\r\n this._startTime = this._now();\r\n this._stopTime = -1;\r\n }\r\n static create(highResolution = true) {\r\n return new StopWatch(highResolution);\r\n }\r\n stop() {\r\n this._stopTime = this._now();\r\n }\r\n elapsed() {\r\n if (this._stopTime !== -1) {\r\n return this._stopTime - this._startTime;\r\n }\r\n return this._now() - this._startTime;\r\n }\r\n _now() {\r\n return this._highResolution ? globals.performance.now() : Date.now();\r\n }\r\n}\r\n", "import { onUnexpectedError } from './errors.js';\r\nimport { Disposable, combinedDisposable, DisposableStore, toDisposable } from './lifecycle.js';\r\nimport { LinkedList } from './linkedList.js';\r\nimport { StopWatch } from './stopwatch.js';\r\nexport var Event;\r\n(function (Event) {\r\n Event.None = () => Disposable.None;\r\n /**\r\n * Given an event, returns another event which only fires once.\r\n */\r\n function once(event) {\r\n return (listener, thisArgs = null, disposables) => {\r\n // we need this, in case the event fires during the listener call\r\n let didFire = false;\r\n let result;\r\n result = event(e => {\r\n if (didFire) {\r\n return;\r\n }\r\n else if (result) {\r\n result.dispose();\r\n }\r\n else {\r\n didFire = true;\r\n }\r\n return listener.call(thisArgs, e);\r\n }, null, disposables);\r\n if (didFire) {\r\n result.dispose();\r\n }\r\n return result;\r\n };\r\n }\r\n Event.once = once;\r\n /**\r\n * @deprecated DO NOT use, this leaks memory\r\n */\r\n function map(event, map) {\r\n return snapshot((listener, thisArgs = null, disposables) => event(i => listener.call(thisArgs, map(i)), null, disposables));\r\n }\r\n Event.map = map;\r\n /**\r\n * @deprecated DO NOT use, this leaks memory\r\n */\r\n function forEach(event, each) {\r\n return snapshot((listener, thisArgs = null, disposables) => event(i => { each(i); listener.call(thisArgs, i); }, null, disposables));\r\n }\r\n Event.forEach = forEach;\r\n function filter(event, filter) {\r\n return snapshot((listener, thisArgs = null, disposables) => event(e => filter(e) && listener.call(thisArgs, e), null, disposables));\r\n }\r\n Event.filter = filter;\r\n /**\r\n * Given an event, returns the same event but typed as `Event`.\r\n */\r\n function signal(event) {\r\n return event;\r\n }\r\n Event.signal = signal;\r\n function any(...events) {\r\n return (listener, thisArgs = null, disposables) => combinedDisposable(...events.map(event => event(e => listener.call(thisArgs, e), null, disposables)));\r\n }\r\n Event.any = any;\r\n /**\r\n * @deprecated DO NOT use, this leaks memory\r\n */\r\n function reduce(event, merge, initial) {\r\n let output = initial;\r\n return map(event, e => {\r\n output = merge(output, e);\r\n return output;\r\n });\r\n }\r\n Event.reduce = reduce;\r\n /**\r\n * @deprecated DO NOT use, this leaks memory\r\n */\r\n function snapshot(event) {\r\n let listener;\r\n const emitter = new Emitter({\r\n onFirstListenerAdd() {\r\n listener = event(emitter.fire, emitter);\r\n },\r\n onLastListenerRemove() {\r\n listener.dispose();\r\n }\r\n });\r\n return emitter.event;\r\n }\r\n /**\r\n * @deprecated DO NOT use, this leaks memory\r\n */\r\n function debounce(event, merge, delay = 100, leading = false, leakWarningThreshold) {\r\n let subscription;\r\n let output = undefined;\r\n let handle = undefined;\r\n let numDebouncedCalls = 0;\r\n const emitter = new Emitter({\r\n leakWarningThreshold,\r\n onFirstListenerAdd() {\r\n subscription = event(cur => {\r\n numDebouncedCalls++;\r\n output = merge(output, cur);\r\n if (leading && !handle) {\r\n emitter.fire(output);\r\n output = undefined;\r\n }\r\n clearTimeout(handle);\r\n handle = setTimeout(() => {\r\n const _output = output;\r\n output = undefined;\r\n handle = undefined;\r\n if (!leading || numDebouncedCalls > 1) {\r\n emitter.fire(_output);\r\n }\r\n numDebouncedCalls = 0;\r\n }, delay);\r\n });\r\n },\r\n onLastListenerRemove() {\r\n subscription.dispose();\r\n }\r\n });\r\n return emitter.event;\r\n }\r\n Event.debounce = debounce;\r\n /**\r\n * @deprecated DO NOT use, this leaks memory\r\n */\r\n function latch(event, equals = (a, b) => a === b) {\r\n let firstCall = true;\r\n let cache;\r\n return filter(event, value => {\r\n const shouldEmit = firstCall || !equals(value, cache);\r\n firstCall = false;\r\n cache = value;\r\n return shouldEmit;\r\n });\r\n }\r\n Event.latch = latch;\r\n /**\r\n * @deprecated DO NOT use, this leaks memory\r\n */\r\n function split(event, isT) {\r\n return [\r\n Event.filter(event, isT),\r\n Event.filter(event, e => !isT(e)),\r\n ];\r\n }\r\n Event.split = split;\r\n /**\r\n * @deprecated DO NOT use, this leaks memory\r\n */\r\n function buffer(event, nextTick = false, _buffer = []) {\r\n let buffer = _buffer.slice();\r\n let listener = event(e => {\r\n if (buffer) {\r\n buffer.push(e);\r\n }\r\n else {\r\n emitter.fire(e);\r\n }\r\n });\r\n const flush = () => {\r\n if (buffer) {\r\n buffer.forEach(e => emitter.fire(e));\r\n }\r\n buffer = null;\r\n };\r\n const emitter = new Emitter({\r\n onFirstListenerAdd() {\r\n if (!listener) {\r\n listener = event(e => emitter.fire(e));\r\n }\r\n },\r\n onFirstListenerDidAdd() {\r\n if (buffer) {\r\n if (nextTick) {\r\n setTimeout(flush);\r\n }\r\n else {\r\n flush();\r\n }\r\n }\r\n },\r\n onLastListenerRemove() {\r\n if (listener) {\r\n listener.dispose();\r\n }\r\n listener = null;\r\n }\r\n });\r\n return emitter.event;\r\n }\r\n Event.buffer = buffer;\r\n class ChainableEvent {\r\n constructor(event) {\r\n this.event = event;\r\n }\r\n map(fn) {\r\n return new ChainableEvent(map(this.event, fn));\r\n }\r\n forEach(fn) {\r\n return new ChainableEvent(forEach(this.event, fn));\r\n }\r\n filter(fn) {\r\n return new ChainableEvent(filter(this.event, fn));\r\n }\r\n reduce(merge, initial) {\r\n return new ChainableEvent(reduce(this.event, merge, initial));\r\n }\r\n latch() {\r\n return new ChainableEvent(latch(this.event));\r\n }\r\n debounce(merge, delay = 100, leading = false, leakWarningThreshold) {\r\n return new ChainableEvent(debounce(this.event, merge, delay, leading, leakWarningThreshold));\r\n }\r\n on(listener, thisArgs, disposables) {\r\n return this.event(listener, thisArgs, disposables);\r\n }\r\n once(listener, thisArgs, disposables) {\r\n return once(this.event)(listener, thisArgs, disposables);\r\n }\r\n }\r\n /**\r\n * @deprecated DO NOT use, this leaks memory\r\n */\r\n function chain(event) {\r\n return new ChainableEvent(event);\r\n }\r\n Event.chain = chain;\r\n function fromNodeEventEmitter(emitter, eventName, map = id => id) {\r\n const fn = (...args) => result.fire(map(...args));\r\n const onFirstListenerAdd = () => emitter.on(eventName, fn);\r\n const onLastListenerRemove = () => emitter.removeListener(eventName, fn);\r\n const result = new Emitter({ onFirstListenerAdd, onLastListenerRemove });\r\n return result.event;\r\n }\r\n Event.fromNodeEventEmitter = fromNodeEventEmitter;\r\n function fromDOMEventEmitter(emitter, eventName, map = id => id) {\r\n const fn = (...args) => result.fire(map(...args));\r\n const onFirstListenerAdd = () => emitter.addEventListener(eventName, fn);\r\n const onLastListenerRemove = () => emitter.removeEventListener(eventName, fn);\r\n const result = new Emitter({ onFirstListenerAdd, onLastListenerRemove });\r\n return result.event;\r\n }\r\n Event.fromDOMEventEmitter = fromDOMEventEmitter;\r\n function toPromise(event) {\r\n return new Promise(resolve => once(event)(resolve));\r\n }\r\n Event.toPromise = toPromise;\r\n})(Event || (Event = {}));\r\nclass EventProfiling {\r\n constructor(name) {\r\n this._listenerCount = 0;\r\n this._invocationCount = 0;\r\n this._elapsedOverall = 0;\r\n this._name = `${name}_${EventProfiling._idPool++}`;\r\n }\r\n start(listenerCount) {\r\n this._stopWatch = new StopWatch(true);\r\n this._listenerCount = listenerCount;\r\n }\r\n stop() {\r\n if (this._stopWatch) {\r\n const elapsed = this._stopWatch.elapsed();\r\n this._elapsedOverall += elapsed;\r\n this._invocationCount += 1;\r\n console.info(`did FIRE ${this._name}: elapsed_ms: ${elapsed.toFixed(5)}, listener: ${this._listenerCount} (elapsed_overall: ${this._elapsedOverall.toFixed(2)}, invocations: ${this._invocationCount})`);\r\n this._stopWatch = undefined;\r\n }\r\n }\r\n}\r\nEventProfiling._idPool = 0;\r\nlet _globalLeakWarningThreshold = -1;\r\nclass LeakageMonitor {\r\n constructor(customThreshold, name = Math.random().toString(18).slice(2, 5)) {\r\n this.customThreshold = customThreshold;\r\n this.name = name;\r\n this._warnCountdown = 0;\r\n }\r\n dispose() {\r\n if (this._stacks) {\r\n this._stacks.clear();\r\n }\r\n }\r\n check(listenerCount) {\r\n let threshold = _globalLeakWarningThreshold;\r\n if (typeof this.customThreshold === 'number') {\r\n threshold = this.customThreshold;\r\n }\r\n if (threshold <= 0 || listenerCount < threshold) {\r\n return undefined;\r\n }\r\n if (!this._stacks) {\r\n this._stacks = new Map();\r\n }\r\n const stack = new Error().stack.split('\\n').slice(3).join('\\n');\r\n const count = (this._stacks.get(stack) || 0);\r\n this._stacks.set(stack, count + 1);\r\n this._warnCountdown -= 1;\r\n if (this._warnCountdown <= 0) {\r\n // only warn on first exceed and then every time the limit\r\n // is exceeded by 50% again\r\n this._warnCountdown = threshold * 0.5;\r\n // find most frequent listener and print warning\r\n let topStack;\r\n let topCount = 0;\r\n for (const [stack, count] of this._stacks) {\r\n if (!topStack || topCount < count) {\r\n topStack = stack;\r\n topCount = count;\r\n }\r\n }\r\n console.warn(`[${this.name}] potential listener LEAK detected, having ${listenerCount} listeners already. MOST frequent listener (${topCount}):`);\r\n console.warn(topStack);\r\n }\r\n return () => {\r\n const count = (this._stacks.get(stack) || 0);\r\n this._stacks.set(stack, count - 1);\r\n };\r\n }\r\n}\r\n/**\r\n * The Emitter can be used to expose an Event to the public\r\n * to fire it from the insides.\r\n * Sample:\r\n class Document {\r\n\r\n private readonly _onDidChange = new Emitter<(value:string)=>any>();\r\n\r\n public onDidChange = this._onDidChange.event;\r\n\r\n // getter-style\r\n // get onDidChange(): Event<(value:string)=>any> {\r\n // \treturn this._onDidChange.event;\r\n // }\r\n\r\n private _doIt() {\r\n //...\r\n this._onDidChange.fire(value);\r\n }\r\n }\r\n */\r\nexport class Emitter {\r\n constructor(options) {\r\n var _a;\r\n this._disposed = false;\r\n this._options = options;\r\n this._leakageMon = _globalLeakWarningThreshold > 0 ? new LeakageMonitor(this._options && this._options.leakWarningThreshold) : undefined;\r\n this._perfMon = ((_a = this._options) === null || _a === void 0 ? void 0 : _a._profName) ? new EventProfiling(this._options._profName) : undefined;\r\n }\r\n /**\r\n * For the public to allow to subscribe\r\n * to events from this Emitter\r\n */\r\n get event() {\r\n if (!this._event) {\r\n this._event = (listener, thisArgs, disposables) => {\r\n var _a;\r\n if (!this._listeners) {\r\n this._listeners = new LinkedList();\r\n }\r\n const firstListener = this._listeners.isEmpty();\r\n if (firstListener && this._options && this._options.onFirstListenerAdd) {\r\n this._options.onFirstListenerAdd(this);\r\n }\r\n const remove = this._listeners.push(!thisArgs ? listener : [listener, thisArgs]);\r\n if (firstListener && this._options && this._options.onFirstListenerDidAdd) {\r\n this._options.onFirstListenerDidAdd(this);\r\n }\r\n if (this._options && this._options.onListenerDidAdd) {\r\n this._options.onListenerDidAdd(this, listener, thisArgs);\r\n }\r\n // check and record this emitter for potential leakage\r\n const removeMonitor = (_a = this._leakageMon) === null || _a === void 0 ? void 0 : _a.check(this._listeners.size);\r\n const result = toDisposable(() => {\r\n if (removeMonitor) {\r\n removeMonitor();\r\n }\r\n if (!this._disposed) {\r\n remove();\r\n if (this._options && this._options.onLastListenerRemove) {\r\n const hasListeners = (this._listeners && !this._listeners.isEmpty());\r\n if (!hasListeners) {\r\n this._options.onLastListenerRemove(this);\r\n }\r\n }\r\n }\r\n });\r\n if (disposables instanceof DisposableStore) {\r\n disposables.add(result);\r\n }\r\n else if (Array.isArray(disposables)) {\r\n disposables.push(result);\r\n }\r\n return result;\r\n };\r\n }\r\n return this._event;\r\n }\r\n /**\r\n * To be kept private to fire an event to\r\n * subscribers\r\n */\r\n fire(event) {\r\n var _a, _b;\r\n if (this._listeners) {\r\n // put all [listener,event]-pairs into delivery queue\r\n // then emit all event. an inner/nested event might be\r\n // the driver of this\r\n if (!this._deliveryQueue) {\r\n this._deliveryQueue = new LinkedList();\r\n }\r\n for (let listener of this._listeners) {\r\n this._deliveryQueue.push([listener, event]);\r\n }\r\n // start/stop performance insight collection\r\n (_a = this._perfMon) === null || _a === void 0 ? void 0 : _a.start(this._deliveryQueue.size);\r\n while (this._deliveryQueue.size > 0) {\r\n const [listener, event] = this._deliveryQueue.shift();\r\n try {\r\n if (typeof listener === 'function') {\r\n listener.call(undefined, event);\r\n }\r\n else {\r\n listener[0].call(listener[1], event);\r\n }\r\n }\r\n catch (e) {\r\n onUnexpectedError(e);\r\n }\r\n }\r\n (_b = this._perfMon) === null || _b === void 0 ? void 0 : _b.stop();\r\n }\r\n }\r\n dispose() {\r\n var _a, _b, _c, _d, _e;\r\n if (!this._disposed) {\r\n this._disposed = true;\r\n (_a = this._listeners) === null || _a === void 0 ? void 0 : _a.clear();\r\n (_b = this._deliveryQueue) === null || _b === void 0 ? void 0 : _b.clear();\r\n (_d = (_c = this._options) === null || _c === void 0 ? void 0 : _c.onLastListenerRemove) === null || _d === void 0 ? void 0 : _d.call(_c);\r\n (_e = this._leakageMon) === null || _e === void 0 ? void 0 : _e.dispose();\r\n }\r\n }\r\n}\r\nexport class PauseableEmitter extends Emitter {\r\n constructor(options) {\r\n super(options);\r\n this._isPaused = 0;\r\n this._eventQueue = new LinkedList();\r\n this._mergeFn = options === null || options === void 0 ? void 0 : options.merge;\r\n }\r\n pause() {\r\n this._isPaused++;\r\n }\r\n resume() {\r\n if (this._isPaused !== 0 && --this._isPaused === 0) {\r\n if (this._mergeFn) {\r\n // use the merge function to create a single composite\r\n // event. make a copy in case firing pauses this emitter\r\n const events = Array.from(this._eventQueue);\r\n this._eventQueue.clear();\r\n super.fire(this._mergeFn(events));\r\n }\r\n else {\r\n // no merging, fire each event individually and test\r\n // that this emitter isn't paused halfway through\r\n while (!this._isPaused && this._eventQueue.size !== 0) {\r\n super.fire(this._eventQueue.shift());\r\n }\r\n }\r\n }\r\n }\r\n fire(event) {\r\n if (this._listeners) {\r\n if (this._isPaused !== 0) {\r\n this._eventQueue.push(event);\r\n }\r\n else {\r\n super.fire(event);\r\n }\r\n }\r\n }\r\n}\r\nexport class DebounceEmitter extends PauseableEmitter {\r\n constructor(options) {\r\n var _a;\r\n super(options);\r\n this._delay = (_a = options.delay) !== null && _a !== void 0 ? _a : 100;\r\n }\r\n fire(event) {\r\n if (!this._handle) {\r\n this.pause();\r\n this._handle = setTimeout(() => {\r\n this._handle = undefined;\r\n this.resume();\r\n }, this._delay);\r\n }\r\n super.fire(event);\r\n }\r\n}\r\n/**\r\n * The EventBufferer is useful in situations in which you want\r\n * to delay firing your events during some code.\r\n * You can wrap that code and be sure that the event will not\r\n * be fired during that wrap.\r\n *\r\n * ```\r\n * const emitter: Emitter;\r\n * const delayer = new EventDelayer();\r\n * const delayedEvent = delayer.wrapEvent(emitter.event);\r\n *\r\n * delayedEvent(console.log);\r\n *\r\n * delayer.bufferEvents(() => {\r\n * emitter.fire(); // event will not be fired yet\r\n * });\r\n *\r\n * // event will only be fired at this point\r\n * ```\r\n */\r\nexport class EventBufferer {\r\n constructor() {\r\n this.buffers = [];\r\n }\r\n wrapEvent(event) {\r\n return (listener, thisArgs, disposables) => {\r\n return event(i => {\r\n const buffer = this.buffers[this.buffers.length - 1];\r\n if (buffer) {\r\n buffer.push(() => listener.call(thisArgs, i));\r\n }\r\n else {\r\n listener.call(thisArgs, i);\r\n }\r\n }, undefined, disposables);\r\n };\r\n }\r\n bufferEvents(fn) {\r\n const buffer = [];\r\n this.buffers.push(buffer);\r\n const r = fn();\r\n this.buffers.pop();\r\n buffer.forEach(flush => flush());\r\n return r;\r\n }\r\n}\r\n/**\r\n * A Relay is an event forwarder which functions as a replugabble event pipe.\r\n * Once created, you can connect an input event to it and it will simply forward\r\n * events from that input event through its own `event` property. The `input`\r\n * can be changed at any point in time.\r\n */\r\nexport class Relay {\r\n constructor() {\r\n this.listening = false;\r\n this.inputEvent = Event.None;\r\n this.inputEventListener = Disposable.None;\r\n this.emitter = new Emitter({\r\n onFirstListenerDidAdd: () => {\r\n this.listening = true;\r\n this.inputEventListener = this.inputEvent(this.emitter.fire, this.emitter);\r\n },\r\n onLastListenerRemove: () => {\r\n this.listening = false;\r\n this.inputEventListener.dispose();\r\n }\r\n });\r\n this.event = this.emitter.event;\r\n }\r\n set input(event) {\r\n this.inputEvent = event;\r\n if (this.listening) {\r\n this.inputEventListener.dispose();\r\n this.inputEventListener = event(this.emitter.fire, this.emitter);\r\n }\r\n }\r\n dispose() {\r\n this.inputEventListener.dispose();\r\n this.emitter.dispose();\r\n }\r\n}\r\n", "/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License. See License.txt in the project root for license information.\r\n *--------------------------------------------------------------------------------------------*/\r\nimport { Emitter } from '../common/event.js';\r\nclass WindowManager {\r\n constructor() {\r\n // --- Zoom Level\r\n this._zoomLevel = 0;\r\n this._lastZoomLevelChangeTime = 0;\r\n this._onDidChangeZoomLevel = new Emitter();\r\n this.onDidChangeZoomLevel = this._onDidChangeZoomLevel.event;\r\n // --- Zoom Factor\r\n this._zoomFactor = 1;\r\n }\r\n getZoomLevel() {\r\n return this._zoomLevel;\r\n }\r\n getTimeSinceLastZoomLevelChanged() {\r\n return Date.now() - this._lastZoomLevelChangeTime;\r\n }\r\n getZoomFactor() {\r\n return this._zoomFactor;\r\n }\r\n // --- Pixel Ratio\r\n getPixelRatio() {\r\n let ctx = document.createElement('canvas').getContext('2d');\r\n let dpr = window.devicePixelRatio || 1;\r\n let bsr = ctx.webkitBackingStorePixelRatio ||\r\n ctx.mozBackingStorePixelRatio ||\r\n ctx.msBackingStorePixelRatio ||\r\n ctx.oBackingStorePixelRatio ||\r\n ctx.backingStorePixelRatio || 1;\r\n return dpr / bsr;\r\n }\r\n}\r\nWindowManager.INSTANCE = new WindowManager();\r\nexport function getZoomLevel() {\r\n return WindowManager.INSTANCE.getZoomLevel();\r\n}\r\n/** Returns the time (in ms) since the zoom level was changed */\r\nexport function getTimeSinceLastZoomLevelChanged() {\r\n return WindowManager.INSTANCE.getTimeSinceLastZoomLevelChanged();\r\n}\r\nexport function onDidChangeZoomLevel(callback) {\r\n return WindowManager.INSTANCE.onDidChangeZoomLevel(callback);\r\n}\r\n/** The zoom scale for an index, e.g. 1, 1.2, 1.4 */\r\nexport function getZoomFactor() {\r\n return WindowManager.INSTANCE.getZoomFactor();\r\n}\r\nexport function getPixelRatio() {\r\n return WindowManager.INSTANCE.getPixelRatio();\r\n}\r\nconst userAgent = navigator.userAgent;\r\nexport const isFirefox = (userAgent.indexOf('Firefox') >= 0);\r\nexport const isWebKit = (userAgent.indexOf('AppleWebKit') >= 0);\r\nexport const isChrome = (userAgent.indexOf('Chrome') >= 0);\r\nexport const isSafari = (!isChrome && (userAgent.indexOf('Safari') >= 0));\r\nexport const isWebkitWebView = (!isChrome && !isSafari && isWebKit);\r\nexport const isAndroid = (userAgent.indexOf('Android') >= 0);\r\nexport const isStandalone = (window.matchMedia && window.matchMedia('(display-mode: standalone)').matches);\r\n", "/**\r\n * @returns whether the provided parameter is a JavaScript Array or not.\r\n */\r\nexport function isArray(array) {\r\n return Array.isArray(array);\r\n}\r\n/**\r\n * @returns whether the provided parameter is a JavaScript String or not.\r\n */\r\nexport function isString(str) {\r\n return (typeof str === 'string');\r\n}\r\n/**\r\n *\r\n * @returns whether the provided parameter is of type `object` but **not**\r\n *\t`null`, an `array`, a `regexp`, nor a `date`.\r\n */\r\nexport function isObject(obj) {\r\n // The method can't do a type cast since there are type (like strings) which\r\n // are subclasses of any put not positvely matched by the function. Hence type\r\n // narrowing results in wrong results.\r\n return typeof obj === 'object'\r\n && obj !== null\r\n && !Array.isArray(obj)\r\n && !(obj instanceof RegExp)\r\n && !(obj instanceof Date);\r\n}\r\n/**\r\n * In **contrast** to just checking `typeof` this will return `false` for `NaN`.\r\n * @returns whether the provided parameter is a JavaScript Number or not.\r\n */\r\nexport function isNumber(obj) {\r\n return (typeof obj === 'number' && !isNaN(obj));\r\n}\r\n/**\r\n * @returns whether the provided parameter is a JavaScript Boolean or not.\r\n */\r\nexport function isBoolean(obj) {\r\n return (obj === true || obj === false);\r\n}\r\n/**\r\n * @returns whether the provided parameter is undefined.\r\n */\r\nexport function isUndefined(obj) {\r\n return (typeof obj === 'undefined');\r\n}\r\n/**\r\n * @returns whether the provided parameter is undefined or null.\r\n */\r\nexport function isUndefinedOrNull(obj) {\r\n return (isUndefined(obj) || obj === null);\r\n}\r\nexport function assertType(condition, type) {\r\n if (!condition) {\r\n throw new Error(type ? `Unexpected type, expected '${type}'` : 'Unexpected type');\r\n }\r\n}\r\n/**\r\n * Asserts that the argument passed in is neither undefined nor null.\r\n */\r\nexport function assertIsDefined(arg) {\r\n if (isUndefinedOrNull(arg)) {\r\n throw new Error('Assertion Failed: argument is undefined or null');\r\n }\r\n return arg;\r\n}\r\n/**\r\n * @returns whether the provided parameter is a JavaScript Function or not.\r\n */\r\nexport function isFunction(obj) {\r\n return (typeof obj === 'function');\r\n}\r\nexport function validateConstraints(args, constraints) {\r\n const len = Math.min(args.length, constraints.length);\r\n for (let i = 0; i < len; i++) {\r\n validateConstraint(args[i], constraints[i]);\r\n }\r\n}\r\nexport function validateConstraint(arg, constraint) {\r\n if (isString(constraint)) {\r\n if (typeof arg !== constraint) {\r\n throw new Error(`argument does not match constraint: typeof ${constraint}`);\r\n }\r\n }\r\n else if (isFunction(constraint)) {\r\n try {\r\n if (arg instanceof constraint) {\r\n return;\r\n }\r\n }\r\n catch (_a) {\r\n // ignore\r\n }\r\n if (!isUndefinedOrNull(arg) && arg.constructor === constraint) {\r\n return;\r\n }\r\n if (constraint.length === 1 && constraint.call(undefined, arg) === true) {\r\n return;\r\n }\r\n throw new Error(`argument does not match one of these constraints: arg instanceof constraint, arg.constructor === constraint, nor constraint(arg) === true`);\r\n }\r\n}\r\nexport function getAllPropertyNames(obj) {\r\n let res = [];\r\n let proto = Object.getPrototypeOf(obj);\r\n while (Object.prototype !== proto) {\r\n res = res.concat(Object.getOwnPropertyNames(proto));\r\n proto = Object.getPrototypeOf(proto);\r\n }\r\n return res;\r\n}\r\nexport function getAllMethodNames(obj) {\r\n const methods = [];\r\n for (const prop of getAllPropertyNames(obj)) {\r\n if (typeof obj[prop] === 'function') {\r\n methods.push(prop);\r\n }\r\n }\r\n return methods;\r\n}\r\nexport function createProxyObject(methodNames, invoke) {\r\n const createProxyMethod = (method) => {\r\n return function () {\r\n const args = Array.prototype.slice.call(arguments, 0);\r\n return invoke(method, args);\r\n };\r\n };\r\n let result = {};\r\n for (const methodName of methodNames) {\r\n result[methodName] = createProxyMethod(methodName);\r\n }\r\n return result;\r\n}\r\n/**\r\n * Converts null to undefined, passes all other values through.\r\n */\r\nexport function withNullAsUndefined(x) {\r\n return x === null ? undefined : x;\r\n}\r\nexport function assertNever(value, message = 'Unreachable') {\r\n throw new Error(message);\r\n}\r\n", "/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License. See License.txt in the project root for license information.\r\n *--------------------------------------------------------------------------------------------*/\r\nimport { illegalArgument } from './errors.js';\r\nclass KeyCodeStrMap {\r\n constructor() {\r\n this._keyCodeToStr = [];\r\n this._strToKeyCode = Object.create(null);\r\n }\r\n define(keyCode, str) {\r\n this._keyCodeToStr[keyCode] = str;\r\n this._strToKeyCode[str.toLowerCase()] = keyCode;\r\n }\r\n keyCodeToStr(keyCode) {\r\n return this._keyCodeToStr[keyCode];\r\n }\r\n strToKeyCode(str) {\r\n return this._strToKeyCode[str.toLowerCase()] || 0 /* Unknown */;\r\n }\r\n}\r\nconst uiMap = new KeyCodeStrMap();\r\nconst userSettingsUSMap = new KeyCodeStrMap();\r\nconst userSettingsGeneralMap = new KeyCodeStrMap();\r\n(function () {\r\n function define(keyCode, uiLabel, usUserSettingsLabel = uiLabel, generalUserSettingsLabel = usUserSettingsLabel) {\r\n uiMap.define(keyCode, uiLabel);\r\n userSettingsUSMap.define(keyCode, usUserSettingsLabel);\r\n userSettingsGeneralMap.define(keyCode, generalUserSettingsLabel);\r\n }\r\n define(0 /* Unknown */, 'unknown');\r\n define(1 /* Backspace */, 'Backspace');\r\n define(2 /* Tab */, 'Tab');\r\n define(3 /* Enter */, 'Enter');\r\n define(4 /* Shift */, 'Shift');\r\n define(5 /* Ctrl */, 'Ctrl');\r\n define(6 /* Alt */, 'Alt');\r\n define(7 /* PauseBreak */, 'PauseBreak');\r\n define(8 /* CapsLock */, 'CapsLock');\r\n define(9 /* Escape */, 'Escape');\r\n define(10 /* Space */, 'Space');\r\n define(11 /* PageUp */, 'PageUp');\r\n define(12 /* PageDown */, 'PageDown');\r\n define(13 /* End */, 'End');\r\n define(14 /* Home */, 'Home');\r\n define(15 /* LeftArrow */, 'LeftArrow', 'Left');\r\n define(16 /* UpArrow */, 'UpArrow', 'Up');\r\n define(17 /* RightArrow */, 'RightArrow', 'Right');\r\n define(18 /* DownArrow */, 'DownArrow', 'Down');\r\n define(19 /* Insert */, 'Insert');\r\n define(20 /* Delete */, 'Delete');\r\n define(21 /* KEY_0 */, '0');\r\n define(22 /* KEY_1 */, '1');\r\n define(23 /* KEY_2 */, '2');\r\n define(24 /* KEY_3 */, '3');\r\n define(25 /* KEY_4 */, '4');\r\n define(26 /* KEY_5 */, '5');\r\n define(27 /* KEY_6 */, '6');\r\n define(28 /* KEY_7 */, '7');\r\n define(29 /* KEY_8 */, '8');\r\n define(30 /* KEY_9 */, '9');\r\n define(31 /* KEY_A */, 'A');\r\n define(32 /* KEY_B */, 'B');\r\n define(33 /* KEY_C */, 'C');\r\n define(34 /* KEY_D */, 'D');\r\n define(35 /* KEY_E */, 'E');\r\n define(36 /* KEY_F */, 'F');\r\n define(37 /* KEY_G */, 'G');\r\n define(38 /* KEY_H */, 'H');\r\n define(39 /* KEY_I */, 'I');\r\n define(40 /* KEY_J */, 'J');\r\n define(41 /* KEY_K */, 'K');\r\n define(42 /* KEY_L */, 'L');\r\n define(43 /* KEY_M */, 'M');\r\n define(44 /* KEY_N */, 'N');\r\n define(45 /* KEY_O */, 'O');\r\n define(46 /* KEY_P */, 'P');\r\n define(47 /* KEY_Q */, 'Q');\r\n define(48 /* KEY_R */, 'R');\r\n define(49 /* KEY_S */, 'S');\r\n define(50 /* KEY_T */, 'T');\r\n define(51 /* KEY_U */, 'U');\r\n define(52 /* KEY_V */, 'V');\r\n define(53 /* KEY_W */, 'W');\r\n define(54 /* KEY_X */, 'X');\r\n define(55 /* KEY_Y */, 'Y');\r\n define(56 /* KEY_Z */, 'Z');\r\n define(57 /* Meta */, 'Meta');\r\n define(58 /* ContextMenu */, 'ContextMenu');\r\n define(59 /* F1 */, 'F1');\r\n define(60 /* F2 */, 'F2');\r\n define(61 /* F3 */, 'F3');\r\n define(62 /* F4 */, 'F4');\r\n define(63 /* F5 */, 'F5');\r\n define(64 /* F6 */, 'F6');\r\n define(65 /* F7 */, 'F7');\r\n define(66 /* F8 */, 'F8');\r\n define(67 /* F9 */, 'F9');\r\n define(68 /* F10 */, 'F10');\r\n define(69 /* F11 */, 'F11');\r\n define(70 /* F12 */, 'F12');\r\n define(71 /* F13 */, 'F13');\r\n define(72 /* F14 */, 'F14');\r\n define(73 /* F15 */, 'F15');\r\n define(74 /* F16 */, 'F16');\r\n define(75 /* F17 */, 'F17');\r\n define(76 /* F18 */, 'F18');\r\n define(77 /* F19 */, 'F19');\r\n define(78 /* NumLock */, 'NumLock');\r\n define(79 /* ScrollLock */, 'ScrollLock');\r\n define(80 /* US_SEMICOLON */, ';', ';', 'OEM_1');\r\n define(81 /* US_EQUAL */, '=', '=', 'OEM_PLUS');\r\n define(82 /* US_COMMA */, ',', ',', 'OEM_COMMA');\r\n define(83 /* US_MINUS */, '-', '-', 'OEM_MINUS');\r\n define(84 /* US_DOT */, '.', '.', 'OEM_PERIOD');\r\n define(85 /* US_SLASH */, '/', '/', 'OEM_2');\r\n define(86 /* US_BACKTICK */, '`', '`', 'OEM_3');\r\n define(110 /* ABNT_C1 */, 'ABNT_C1');\r\n define(111 /* ABNT_C2 */, 'ABNT_C2');\r\n define(87 /* US_OPEN_SQUARE_BRACKET */, '[', '[', 'OEM_4');\r\n define(88 /* US_BACKSLASH */, '\\\\', '\\\\', 'OEM_5');\r\n define(89 /* US_CLOSE_SQUARE_BRACKET */, ']', ']', 'OEM_6');\r\n define(90 /* US_QUOTE */, '\\'', '\\'', 'OEM_7');\r\n define(91 /* OEM_8 */, 'OEM_8');\r\n define(92 /* OEM_102 */, 'OEM_102');\r\n define(93 /* NUMPAD_0 */, 'NumPad0');\r\n define(94 /* NUMPAD_1 */, 'NumPad1');\r\n define(95 /* NUMPAD_2 */, 'NumPad2');\r\n define(96 /* NUMPAD_3 */, 'NumPad3');\r\n define(97 /* NUMPAD_4 */, 'NumPad4');\r\n define(98 /* NUMPAD_5 */, 'NumPad5');\r\n define(99 /* NUMPAD_6 */, 'NumPad6');\r\n define(100 /* NUMPAD_7 */, 'NumPad7');\r\n define(101 /* NUMPAD_8 */, 'NumPad8');\r\n define(102 /* NUMPAD_9 */, 'NumPad9');\r\n define(103 /* NUMPAD_MULTIPLY */, 'NumPad_Multiply');\r\n define(104 /* NUMPAD_ADD */, 'NumPad_Add');\r\n define(105 /* NUMPAD_SEPARATOR */, 'NumPad_Separator');\r\n define(106 /* NUMPAD_SUBTRACT */, 'NumPad_Subtract');\r\n define(107 /* NUMPAD_DECIMAL */, 'NumPad_Decimal');\r\n define(108 /* NUMPAD_DIVIDE */, 'NumPad_Divide');\r\n})();\r\nexport var KeyCodeUtils;\r\n(function (KeyCodeUtils) {\r\n function toString(keyCode) {\r\n return uiMap.keyCodeToStr(keyCode);\r\n }\r\n KeyCodeUtils.toString = toString;\r\n function fromString(key) {\r\n return uiMap.strToKeyCode(key);\r\n }\r\n KeyCodeUtils.fromString = fromString;\r\n function toUserSettingsUS(keyCode) {\r\n return userSettingsUSMap.keyCodeToStr(keyCode);\r\n }\r\n KeyCodeUtils.toUserSettingsUS = toUserSettingsUS;\r\n function toUserSettingsGeneral(keyCode) {\r\n return userSettingsGeneralMap.keyCodeToStr(keyCode);\r\n }\r\n KeyCodeUtils.toUserSettingsGeneral = toUserSettingsGeneral;\r\n function fromUserSettings(key) {\r\n return userSettingsUSMap.strToKeyCode(key) || userSettingsGeneralMap.strToKeyCode(key);\r\n }\r\n KeyCodeUtils.fromUserSettings = fromUserSettings;\r\n})(KeyCodeUtils || (KeyCodeUtils = {}));\r\nexport function KeyChord(firstPart, secondPart) {\r\n const chordPart = ((secondPart & 0x0000FFFF) << 16) >>> 0;\r\n return (firstPart | chordPart) >>> 0;\r\n}\r\nexport function createKeybinding(keybinding, OS) {\r\n if (keybinding === 0) {\r\n return null;\r\n }\r\n const firstPart = (keybinding & 0x0000FFFF) >>> 0;\r\n const chordPart = (keybinding & 0xFFFF0000) >>> 16;\r\n if (chordPart !== 0) {\r\n return new ChordKeybinding([\r\n createSimpleKeybinding(firstPart, OS),\r\n createSimpleKeybinding(chordPart, OS)\r\n ]);\r\n }\r\n return new ChordKeybinding([createSimpleKeybinding(firstPart, OS)]);\r\n}\r\nexport function createSimpleKeybinding(keybinding, OS) {\r\n const ctrlCmd = (keybinding & 2048 /* CtrlCmd */ ? true : false);\r\n const winCtrl = (keybinding & 256 /* WinCtrl */ ? true : false);\r\n const ctrlKey = (OS === 2 /* Macintosh */ ? winCtrl : ctrlCmd);\r\n const shiftKey = (keybinding & 1024 /* Shift */ ? true : false);\r\n const altKey = (keybinding & 512 /* Alt */ ? true : false);\r\n const metaKey = (OS === 2 /* Macintosh */ ? ctrlCmd : winCtrl);\r\n const keyCode = (keybinding & 255 /* KeyCode */);\r\n return new SimpleKeybinding(ctrlKey, shiftKey, altKey, metaKey, keyCode);\r\n}\r\nexport class SimpleKeybinding {\r\n constructor(ctrlKey, shiftKey, altKey, metaKey, keyCode) {\r\n this.ctrlKey = ctrlKey;\r\n this.shiftKey = shiftKey;\r\n this.altKey = altKey;\r\n this.metaKey = metaKey;\r\n this.keyCode = keyCode;\r\n }\r\n equals(other) {\r\n return (this.ctrlKey === other.ctrlKey\r\n && this.shiftKey === other.shiftKey\r\n && this.altKey === other.altKey\r\n && this.metaKey === other.metaKey\r\n && this.keyCode === other.keyCode);\r\n }\r\n isModifierKey() {\r\n return (this.keyCode === 0 /* Unknown */\r\n || this.keyCode === 5 /* Ctrl */\r\n || this.keyCode === 57 /* Meta */\r\n || this.keyCode === 6 /* Alt */\r\n || this.keyCode === 4 /* Shift */);\r\n }\r\n toChord() {\r\n return new ChordKeybinding([this]);\r\n }\r\n /**\r\n * Does this keybinding refer to the key code of a modifier and it also has the modifier flag?\r\n */\r\n isDuplicateModifierCase() {\r\n return ((this.ctrlKey && this.keyCode === 5 /* Ctrl */)\r\n || (this.shiftKey && this.keyCode === 4 /* Shift */)\r\n || (this.altKey && this.keyCode === 6 /* Alt */)\r\n || (this.metaKey && this.keyCode === 57 /* Meta */));\r\n }\r\n}\r\nexport class ChordKeybinding {\r\n constructor(parts) {\r\n if (parts.length === 0) {\r\n throw illegalArgument(`parts`);\r\n }\r\n this.parts = parts;\r\n }\r\n}\r\nexport class ResolvedKeybindingPart {\r\n constructor(ctrlKey, shiftKey, altKey, metaKey, kbLabel, kbAriaLabel) {\r\n this.ctrlKey = ctrlKey;\r\n this.shiftKey = shiftKey;\r\n this.altKey = altKey;\r\n this.metaKey = metaKey;\r\n this.keyLabel = kbLabel;\r\n this.keyAriaLabel = kbAriaLabel;\r\n }\r\n}\r\n/**\r\n * A resolved keybinding. Can be a simple keybinding or a chord keybinding.\r\n */\r\nexport class ResolvedKeybinding {\r\n}\r\n", "/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License. See License.txt in the project root for license information.\r\n *--------------------------------------------------------------------------------------------*/\r\nimport * as browser from './browser.js';\r\nimport { KeyCodeUtils, SimpleKeybinding } from '../common/keyCodes.js';\r\nimport * as platform from '../common/platform.js';\r\nlet KEY_CODE_MAP = new Array(230);\r\nlet INVERSE_KEY_CODE_MAP = new Array(112 /* MAX_VALUE */);\r\n(function () {\r\n for (let i = 0; i < INVERSE_KEY_CODE_MAP.length; i++) {\r\n INVERSE_KEY_CODE_MAP[i] = -1;\r\n }\r\n function define(code, keyCode) {\r\n KEY_CODE_MAP[code] = keyCode;\r\n INVERSE_KEY_CODE_MAP[keyCode] = code;\r\n }\r\n define(3, 7 /* PauseBreak */); // VK_CANCEL 0x03 Control-break processing\r\n define(8, 1 /* Backspace */);\r\n define(9, 2 /* Tab */);\r\n define(13, 3 /* Enter */);\r\n define(16, 4 /* Shift */);\r\n define(17, 5 /* Ctrl */);\r\n define(18, 6 /* Alt */);\r\n define(19, 7 /* PauseBreak */);\r\n define(20, 8 /* CapsLock */);\r\n define(27, 9 /* Escape */);\r\n define(32, 10 /* Space */);\r\n define(33, 11 /* PageUp */);\r\n define(34, 12 /* PageDown */);\r\n define(35, 13 /* End */);\r\n define(36, 14 /* Home */);\r\n define(37, 15 /* LeftArrow */);\r\n define(38, 16 /* UpArrow */);\r\n define(39, 17 /* RightArrow */);\r\n define(40, 18 /* DownArrow */);\r\n define(45, 19 /* Insert */);\r\n define(46, 20 /* Delete */);\r\n define(48, 21 /* KEY_0 */);\r\n define(49, 22 /* KEY_1 */);\r\n define(50, 23 /* KEY_2 */);\r\n define(51, 24 /* KEY_3 */);\r\n define(52, 25 /* KEY_4 */);\r\n define(53, 26 /* KEY_5 */);\r\n define(54, 27 /* KEY_6 */);\r\n define(55, 28 /* KEY_7 */);\r\n define(56, 29 /* KEY_8 */);\r\n define(57, 30 /* KEY_9 */);\r\n define(65, 31 /* KEY_A */);\r\n define(66, 32 /* KEY_B */);\r\n define(67, 33 /* KEY_C */);\r\n define(68, 34 /* KEY_D */);\r\n define(69, 35 /* KEY_E */);\r\n define(70, 36 /* KEY_F */);\r\n define(71, 37 /* KEY_G */);\r\n define(72, 38 /* KEY_H */);\r\n define(73, 39 /* KEY_I */);\r\n define(74, 40 /* KEY_J */);\r\n define(75, 41 /* KEY_K */);\r\n define(76, 42 /* KEY_L */);\r\n define(77, 43 /* KEY_M */);\r\n define(78, 44 /* KEY_N */);\r\n define(79, 45 /* KEY_O */);\r\n define(80, 46 /* KEY_P */);\r\n define(81, 47 /* KEY_Q */);\r\n define(82, 48 /* KEY_R */);\r\n define(83, 49 /* KEY_S */);\r\n define(84, 50 /* KEY_T */);\r\n define(85, 51 /* KEY_U */);\r\n define(86, 52 /* KEY_V */);\r\n define(87, 53 /* KEY_W */);\r\n define(88, 54 /* KEY_X */);\r\n define(89, 55 /* KEY_Y */);\r\n define(90, 56 /* KEY_Z */);\r\n define(93, 58 /* ContextMenu */);\r\n define(96, 93 /* NUMPAD_0 */);\r\n define(97, 94 /* NUMPAD_1 */);\r\n define(98, 95 /* NUMPAD_2 */);\r\n define(99, 96 /* NUMPAD_3 */);\r\n define(100, 97 /* NUMPAD_4 */);\r\n define(101, 98 /* NUMPAD_5 */);\r\n define(102, 99 /* NUMPAD_6 */);\r\n define(103, 100 /* NUMPAD_7 */);\r\n define(104, 101 /* NUMPAD_8 */);\r\n define(105, 102 /* NUMPAD_9 */);\r\n define(106, 103 /* NUMPAD_MULTIPLY */);\r\n define(107, 104 /* NUMPAD_ADD */);\r\n define(108, 105 /* NUMPAD_SEPARATOR */);\r\n define(109, 106 /* NUMPAD_SUBTRACT */);\r\n define(110, 107 /* NUMPAD_DECIMAL */);\r\n define(111, 108 /* NUMPAD_DIVIDE */);\r\n define(112, 59 /* F1 */);\r\n define(113, 60 /* F2 */);\r\n define(114, 61 /* F3 */);\r\n define(115, 62 /* F4 */);\r\n define(116, 63 /* F5 */);\r\n define(117, 64 /* F6 */);\r\n define(118, 65 /* F7 */);\r\n define(119, 66 /* F8 */);\r\n define(120, 67 /* F9 */);\r\n define(121, 68 /* F10 */);\r\n define(122, 69 /* F11 */);\r\n define(123, 70 /* F12 */);\r\n define(124, 71 /* F13 */);\r\n define(125, 72 /* F14 */);\r\n define(126, 73 /* F15 */);\r\n define(127, 74 /* F16 */);\r\n define(128, 75 /* F17 */);\r\n define(129, 76 /* F18 */);\r\n define(130, 77 /* F19 */);\r\n define(144, 78 /* NumLock */);\r\n define(145, 79 /* ScrollLock */);\r\n define(186, 80 /* US_SEMICOLON */);\r\n define(187, 81 /* US_EQUAL */);\r\n define(188, 82 /* US_COMMA */);\r\n define(189, 83 /* US_MINUS */);\r\n define(190, 84 /* US_DOT */);\r\n define(191, 85 /* US_SLASH */);\r\n define(192, 86 /* US_BACKTICK */);\r\n define(193, 110 /* ABNT_C1 */);\r\n define(194, 111 /* ABNT_C2 */);\r\n define(219, 87 /* US_OPEN_SQUARE_BRACKET */);\r\n define(220, 88 /* US_BACKSLASH */);\r\n define(221, 89 /* US_CLOSE_SQUARE_BRACKET */);\r\n define(222, 90 /* US_QUOTE */);\r\n define(223, 91 /* OEM_8 */);\r\n define(226, 92 /* OEM_102 */);\r\n /**\r\n * https://lists.w3.org/Archives/Public/www-dom/2010JulSep/att-0182/keyCode-spec.html\r\n * If an Input Method Editor is processing key input and the event is keydown, return 229.\r\n */\r\n define(229, 109 /* KEY_IN_COMPOSITION */);\r\n if (browser.isFirefox) {\r\n define(59, 80 /* US_SEMICOLON */);\r\n define(107, 81 /* US_EQUAL */);\r\n define(109, 83 /* US_MINUS */);\r\n if (platform.isMacintosh) {\r\n define(224, 57 /* Meta */);\r\n }\r\n }\r\n else if (browser.isWebKit) {\r\n define(91, 57 /* Meta */);\r\n if (platform.isMacintosh) {\r\n // the two meta keys in the Mac have different key codes (91 and 93)\r\n define(93, 57 /* Meta */);\r\n }\r\n else {\r\n define(92, 57 /* Meta */);\r\n }\r\n }\r\n})();\r\nfunction extractKeyCode(e) {\r\n if (e.charCode) {\r\n // \"keypress\" events mostly\r\n let char = String.fromCharCode(e.charCode).toUpperCase();\r\n return KeyCodeUtils.fromString(char);\r\n }\r\n return KEY_CODE_MAP[e.keyCode] || 0 /* Unknown */;\r\n}\r\nconst ctrlKeyMod = (platform.isMacintosh ? 256 /* WinCtrl */ : 2048 /* CtrlCmd */);\r\nconst altKeyMod = 512 /* Alt */;\r\nconst shiftKeyMod = 1024 /* Shift */;\r\nconst metaKeyMod = (platform.isMacintosh ? 2048 /* CtrlCmd */ : 256 /* WinCtrl */);\r\nexport class StandardKeyboardEvent {\r\n constructor(source) {\r\n this._standardKeyboardEventBrand = true;\r\n let e = source;\r\n this.browserEvent = e;\r\n this.target = e.target;\r\n this.ctrlKey = e.ctrlKey;\r\n this.shiftKey = e.shiftKey;\r\n this.altKey = e.altKey;\r\n this.metaKey = e.metaKey;\r\n this.keyCode = extractKeyCode(e);\r\n this.code = e.code;\r\n // console.info(e.type + \": keyCode: \" + e.keyCode + \", which: \" + e.which + \", charCode: \" + e.charCode + \", detail: \" + e.detail + \" ====> \" + this.keyCode + ' -- ' + KeyCode[this.keyCode]);\r\n this.ctrlKey = this.ctrlKey || this.keyCode === 5 /* Ctrl */;\r\n this.altKey = this.altKey || this.keyCode === 6 /* Alt */;\r\n this.shiftKey = this.shiftKey || this.keyCode === 4 /* Shift */;\r\n this.metaKey = this.metaKey || this.keyCode === 57 /* Meta */;\r\n this._asKeybinding = this._computeKeybinding();\r\n this._asRuntimeKeybinding = this._computeRuntimeKeybinding();\r\n // console.log(`code: ${e.code}, keyCode: ${e.keyCode}, key: ${e.key}`);\r\n }\r\n preventDefault() {\r\n if (this.browserEvent && this.browserEvent.preventDefault) {\r\n this.browserEvent.preventDefault();\r\n }\r\n }\r\n stopPropagation() {\r\n if (this.browserEvent && this.browserEvent.stopPropagation) {\r\n this.browserEvent.stopPropagation();\r\n }\r\n }\r\n toKeybinding() {\r\n return this._asRuntimeKeybinding;\r\n }\r\n equals(other) {\r\n return this._asKeybinding === other;\r\n }\r\n _computeKeybinding() {\r\n let key = 0 /* Unknown */;\r\n if (this.keyCode !== 5 /* Ctrl */ && this.keyCode !== 4 /* Shift */ && this.keyCode !== 6 /* Alt */ && this.keyCode !== 57 /* Meta */) {\r\n key = this.keyCode;\r\n }\r\n let result = 0;\r\n if (this.ctrlKey) {\r\n result |= ctrlKeyMod;\r\n }\r\n if (this.altKey) {\r\n result |= altKeyMod;\r\n }\r\n if (this.shiftKey) {\r\n result |= shiftKeyMod;\r\n }\r\n if (this.metaKey) {\r\n result |= metaKeyMod;\r\n }\r\n result |= key;\r\n return result;\r\n }\r\n _computeRuntimeKeybinding() {\r\n let key = 0 /* Unknown */;\r\n if (this.keyCode !== 5 /* Ctrl */ && this.keyCode !== 4 /* Shift */ && this.keyCode !== 6 /* Alt */ && this.keyCode !== 57 /* Meta */) {\r\n key = this.keyCode;\r\n }\r\n return new SimpleKeybinding(this.ctrlKey, this.shiftKey, this.altKey, this.metaKey, key);\r\n }\r\n}\r\n", "/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License. See License.txt in the project root for license information.\r\n *--------------------------------------------------------------------------------------------*/\r\nlet hasDifferentOriginAncestorFlag = false;\r\nlet sameOriginWindowChainCache = null;\r\nfunction getParentWindowIfSameOrigin(w) {\r\n if (!w.parent || w.parent === w) {\r\n return null;\r\n }\r\n // Cannot really tell if we have access to the parent window unless we try to access something in it\r\n try {\r\n let location = w.location;\r\n let parentLocation = w.parent.location;\r\n if (location.origin !== 'null' && parentLocation.origin !== 'null') {\r\n if (location.protocol !== parentLocation.protocol || location.hostname !== parentLocation.hostname || location.port !== parentLocation.port) {\r\n hasDifferentOriginAncestorFlag = true;\r\n return null;\r\n }\r\n }\r\n }\r\n catch (e) {\r\n hasDifferentOriginAncestorFlag = true;\r\n return null;\r\n }\r\n return w.parent;\r\n}\r\nexport class IframeUtils {\r\n /**\r\n * Returns a chain of embedded windows with the same origin (which can be accessed programmatically).\r\n * Having a chain of length 1 might mean that the current execution environment is running outside of an iframe or inside an iframe embedded in a window with a different origin.\r\n * To distinguish if at one point the current execution environment is running inside a window with a different origin, see hasDifferentOriginAncestor()\r\n */\r\n static getSameOriginWindowChain() {\r\n if (!sameOriginWindowChainCache) {\r\n sameOriginWindowChainCache = [];\r\n let w = window;\r\n let parent;\r\n do {\r\n parent = getParentWindowIfSameOrigin(w);\r\n if (parent) {\r\n sameOriginWindowChainCache.push({\r\n window: w,\r\n iframeElement: w.frameElement || null\r\n });\r\n }\r\n else {\r\n sameOriginWindowChainCache.push({\r\n window: w,\r\n iframeElement: null\r\n });\r\n }\r\n w = parent;\r\n } while (w);\r\n }\r\n return sameOriginWindowChainCache.slice(0);\r\n }\r\n /**\r\n * Returns true if the current execution environment is chained in a list of iframes which at one point ends in a window with a different origin.\r\n * Returns false if the current execution environment is not running inside an iframe or if the entire chain of iframes have the same origin.\r\n */\r\n static hasDifferentOriginAncestor() {\r\n if (!sameOriginWindowChainCache) {\r\n this.getSameOriginWindowChain();\r\n }\r\n return hasDifferentOriginAncestorFlag;\r\n }\r\n /**\r\n * Returns the position of `childWindow` relative to `ancestorWindow`\r\n */\r\n static getPositionOfChildWindowRelativeToAncestorWindow(childWindow, ancestorWindow) {\r\n if (!ancestorWindow || childWindow === ancestorWindow) {\r\n return {\r\n top: 0,\r\n left: 0\r\n };\r\n }\r\n let top = 0, left = 0;\r\n let windowChain = this.getSameOriginWindowChain();\r\n for (const windowChainEl of windowChain) {\r\n top += windowChainEl.window.scrollY;\r\n left += windowChainEl.window.scrollX;\r\n if (windowChainEl.window === ancestorWindow) {\r\n break;\r\n }\r\n if (!windowChainEl.iframeElement) {\r\n break;\r\n }\r\n let boundingRect = windowChainEl.iframeElement.getBoundingClientRect();\r\n top += boundingRect.top;\r\n left += boundingRect.left;\r\n }\r\n return {\r\n top: top,\r\n left: left\r\n };\r\n }\r\n}\r\n", "/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License. See License.txt in the project root for license information.\r\n *--------------------------------------------------------------------------------------------*/\r\nimport * as browser from './browser.js';\r\nimport { IframeUtils } from './iframe.js';\r\nimport * as platform from '../common/platform.js';\r\nexport class StandardMouseEvent {\r\n constructor(e) {\r\n this.timestamp = Date.now();\r\n this.browserEvent = e;\r\n this.leftButton = e.button === 0;\r\n this.middleButton = e.button === 1;\r\n this.rightButton = e.button === 2;\r\n this.buttons = e.buttons;\r\n this.target = e.target;\r\n this.detail = e.detail || 1;\r\n if (e.type === 'dblclick') {\r\n this.detail = 2;\r\n }\r\n this.ctrlKey = e.ctrlKey;\r\n this.shiftKey = e.shiftKey;\r\n this.altKey = e.altKey;\r\n this.metaKey = e.metaKey;\r\n if (typeof e.pageX === 'number') {\r\n this.posx = e.pageX;\r\n this.posy = e.pageY;\r\n }\r\n else {\r\n // Probably hit by MSGestureEvent\r\n this.posx = e.clientX + document.body.scrollLeft + document.documentElement.scrollLeft;\r\n this.posy = e.clientY + document.body.scrollTop + document.documentElement.scrollTop;\r\n }\r\n // Find the position of the iframe this code is executing in relative to the iframe where the event was captured.\r\n let iframeOffsets = IframeUtils.getPositionOfChildWindowRelativeToAncestorWindow(self, e.view);\r\n this.posx -= iframeOffsets.left;\r\n this.posy -= iframeOffsets.top;\r\n }\r\n preventDefault() {\r\n this.browserEvent.preventDefault();\r\n }\r\n stopPropagation() {\r\n this.browserEvent.stopPropagation();\r\n }\r\n}\r\nexport class StandardWheelEvent {\r\n constructor(e, deltaX = 0, deltaY = 0) {\r\n this.browserEvent = e || null;\r\n this.target = e ? (e.target || e.targetNode || e.srcElement) : null;\r\n this.deltaY = deltaY;\r\n this.deltaX = deltaX;\r\n if (e) {\r\n // Old (deprecated) wheel events\r\n let e1 = e;\r\n let e2 = e;\r\n // vertical delta scroll\r\n if (typeof e1.wheelDeltaY !== 'undefined') {\r\n this.deltaY = e1.wheelDeltaY / 120;\r\n }\r\n else if (typeof e2.VERTICAL_AXIS !== 'undefined' && e2.axis === e2.VERTICAL_AXIS) {\r\n this.deltaY = -e2.detail / 3;\r\n }\r\n else if (e.type === 'wheel') {\r\n // Modern wheel event\r\n // https://developer.mozilla.org/en-US/docs/Web/API/WheelEvent\r\n const ev = e;\r\n if (ev.deltaMode === ev.DOM_DELTA_LINE) {\r\n // the deltas are expressed in lines\r\n if (browser.isFirefox && !platform.isMacintosh) {\r\n this.deltaY = -e.deltaY / 3;\r\n }\r\n else {\r\n this.deltaY = -e.deltaY;\r\n }\r\n }\r\n else {\r\n this.deltaY = -e.deltaY / 40;\r\n }\r\n }\r\n // horizontal delta scroll\r\n if (typeof e1.wheelDeltaX !== 'undefined') {\r\n if (browser.isSafari && platform.isWindows) {\r\n this.deltaX = -(e1.wheelDeltaX / 120);\r\n }\r\n else {\r\n this.deltaX = e1.wheelDeltaX / 120;\r\n }\r\n }\r\n else if (typeof e2.HORIZONTAL_AXIS !== 'undefined' && e2.axis === e2.HORIZONTAL_AXIS) {\r\n this.deltaX = -e.detail / 3;\r\n }\r\n else if (e.type === 'wheel') {\r\n // Modern wheel event\r\n // https://developer.mozilla.org/en-US/docs/Web/API/WheelEvent\r\n const ev = e;\r\n if (ev.deltaMode === ev.DOM_DELTA_LINE) {\r\n // the deltas are expressed in lines\r\n if (browser.isFirefox && !platform.isMacintosh) {\r\n this.deltaX = -e.deltaX / 3;\r\n }\r\n else {\r\n this.deltaX = -e.deltaX;\r\n }\r\n }\r\n else {\r\n this.deltaX = -e.deltaX / 40;\r\n }\r\n }\r\n // Assume a vertical scroll if nothing else worked\r\n if (this.deltaY === 0 && this.deltaX === 0 && e.wheelDelta) {\r\n this.deltaY = e.wheelDelta / 120;\r\n }\r\n }\r\n }\r\n preventDefault() {\r\n if (this.browserEvent) {\r\n this.browserEvent.preventDefault();\r\n }\r\n }\r\n stopPropagation() {\r\n if (this.browserEvent) {\r\n this.browserEvent.stopPropagation();\r\n }\r\n }\r\n}\r\n", "/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License. See License.txt in the project root for license information.\r\n *--------------------------------------------------------------------------------------------*/\r\nimport { Emitter, Event } from './event.js';\r\nconst shortcutEvent = Object.freeze(function (callback, context) {\r\n const handle = setTimeout(callback.bind(context), 0);\r\n return { dispose() { clearTimeout(handle); } };\r\n});\r\nexport var CancellationToken;\r\n(function (CancellationToken) {\r\n function isCancellationToken(thing) {\r\n if (thing === CancellationToken.None || thing === CancellationToken.Cancelled) {\r\n return true;\r\n }\r\n if (thing instanceof MutableToken) {\r\n return true;\r\n }\r\n if (!thing || typeof thing !== 'object') {\r\n return false;\r\n }\r\n return typeof thing.isCancellationRequested === 'boolean'\r\n && typeof thing.onCancellationRequested === 'function';\r\n }\r\n CancellationToken.isCancellationToken = isCancellationToken;\r\n CancellationToken.None = Object.freeze({\r\n isCancellationRequested: false,\r\n onCancellationRequested: Event.None\r\n });\r\n CancellationToken.Cancelled = Object.freeze({\r\n isCancellationRequested: true,\r\n onCancellationRequested: shortcutEvent\r\n });\r\n})(CancellationToken || (CancellationToken = {}));\r\nclass MutableToken {\r\n constructor() {\r\n this._isCancelled = false;\r\n this._emitter = null;\r\n }\r\n cancel() {\r\n if (!this._isCancelled) {\r\n this._isCancelled = true;\r\n if (this._emitter) {\r\n this._emitter.fire(undefined);\r\n this.dispose();\r\n }\r\n }\r\n }\r\n get isCancellationRequested() {\r\n return this._isCancelled;\r\n }\r\n get onCancellationRequested() {\r\n if (this._isCancelled) {\r\n return shortcutEvent;\r\n }\r\n if (!this._emitter) {\r\n this._emitter = new Emitter();\r\n }\r\n return this._emitter.event;\r\n }\r\n dispose() {\r\n if (this._emitter) {\r\n this._emitter.dispose();\r\n this._emitter = null;\r\n }\r\n }\r\n}\r\nexport class CancellationTokenSource {\r\n constructor(parent) {\r\n this._token = undefined;\r\n this._parentListener = undefined;\r\n this._parentListener = parent && parent.onCancellationRequested(this.cancel, this);\r\n }\r\n get token() {\r\n if (!this._token) {\r\n // be lazy and create the token only when\r\n // actually needed\r\n this._token = new MutableToken();\r\n }\r\n return this._token;\r\n }\r\n cancel() {\r\n if (!this._token) {\r\n // save an object by returning the default\r\n // cancelled token when cancellation happens\r\n // before someone asks for the token\r\n this._token = CancellationToken.Cancelled;\r\n }\r\n else if (this._token instanceof MutableToken) {\r\n // actually cancel\r\n this._token.cancel();\r\n }\r\n }\r\n dispose(cancel = false) {\r\n if (cancel) {\r\n this.cancel();\r\n }\r\n if (this._parentListener) {\r\n this._parentListener.dispose();\r\n }\r\n if (!this._token) {\r\n // ensure to initialize with an empty token if we had none\r\n this._token = CancellationToken.None;\r\n }\r\n else if (this._token instanceof MutableToken) {\r\n // actually dispose\r\n this._token.dispose();\r\n }\r\n }\r\n}\r\n", "/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License. See License.txt in the project root for license information.\r\n *--------------------------------------------------------------------------------------------*/\r\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\r\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n};\r\nimport { CancellationTokenSource } from './cancellation.js';\r\nimport { canceled } from './errors.js';\r\nimport { toDisposable } from './lifecycle.js';\r\nexport function isThenable(obj) {\r\n return !!obj && typeof obj.then === 'function';\r\n}\r\nexport function createCancelablePromise(callback) {\r\n const source = new CancellationTokenSource();\r\n const thenable = callback(source.token);\r\n const promise = new Promise((resolve, reject) => {\r\n const subscription = source.token.onCancellationRequested(() => {\r\n subscription.dispose();\r\n source.dispose();\r\n reject(canceled());\r\n });\r\n Promise.resolve(thenable).then(value => {\r\n subscription.dispose();\r\n source.dispose();\r\n resolve(value);\r\n }, err => {\r\n subscription.dispose();\r\n source.dispose();\r\n reject(err);\r\n });\r\n });\r\n return new class {\r\n cancel() {\r\n source.cancel();\r\n }\r\n then(resolve, reject) {\r\n return promise.then(resolve, reject);\r\n }\r\n catch(reject) {\r\n return this.then(undefined, reject);\r\n }\r\n finally(onfinally) {\r\n return promise.finally(onfinally);\r\n }\r\n };\r\n}\r\nexport function raceCancellation(promise, token, defaultValue) {\r\n return Promise.race([promise, new Promise(resolve => token.onCancellationRequested(() => resolve(defaultValue)))]);\r\n}\r\n/**\r\n * A helper to prevent accumulation of sequential async tasks.\r\n *\r\n * Imagine a mail man with the sole task of delivering letters. As soon as\r\n * a letter submitted for delivery, he drives to the destination, delivers it\r\n * and returns to his base. Imagine that during the trip, N more letters were submitted.\r\n * When the mail man returns, he picks those N letters and delivers them all in a\r\n * single trip. Even though N+1 submissions occurred, only 2 deliveries were made.\r\n *\r\n * The throttler implements this via the queue() method, by providing it a task\r\n * factory. Following the example:\r\n *\r\n * \t\tconst throttler = new Throttler();\r\n * \t\tconst letters = [];\r\n *\r\n * \t\tfunction deliver() {\r\n * \t\t\tconst lettersToDeliver = letters;\r\n * \t\t\tletters = [];\r\n * \t\t\treturn makeTheTrip(lettersToDeliver);\r\n * \t\t}\r\n *\r\n * \t\tfunction onLetterReceived(l) {\r\n * \t\t\tletters.push(l);\r\n * \t\t\tthrottler.queue(deliver);\r\n * \t\t}\r\n */\r\nexport class Throttler {\r\n constructor() {\r\n this.activePromise = null;\r\n this.queuedPromise = null;\r\n this.queuedPromiseFactory = null;\r\n }\r\n queue(promiseFactory) {\r\n if (this.activePromise) {\r\n this.queuedPromiseFactory = promiseFactory;\r\n if (!this.queuedPromise) {\r\n const onComplete = () => {\r\n this.queuedPromise = null;\r\n const result = this.queue(this.queuedPromiseFactory);\r\n this.queuedPromiseFactory = null;\r\n return result;\r\n };\r\n this.queuedPromise = new Promise(resolve => {\r\n this.activePromise.then(onComplete, onComplete).then(resolve);\r\n });\r\n }\r\n return new Promise((resolve, reject) => {\r\n this.queuedPromise.then(resolve, reject);\r\n });\r\n }\r\n this.activePromise = promiseFactory();\r\n return new Promise((resolve, reject) => {\r\n this.activePromise.then((result) => {\r\n this.activePromise = null;\r\n resolve(result);\r\n }, (err) => {\r\n this.activePromise = null;\r\n reject(err);\r\n });\r\n });\r\n }\r\n}\r\n/**\r\n * A helper to delay (debounce) execution of a task that is being requested often.\r\n *\r\n * Following the throttler, now imagine the mail man wants to optimize the number of\r\n * trips proactively. The trip itself can be long, so he decides not to make the trip\r\n * as soon as a letter is submitted. Instead he waits a while, in case more\r\n * letters are submitted. After said waiting period, if no letters were submitted, he\r\n * decides to make the trip. Imagine that N more letters were submitted after the first\r\n * one, all within a short period of time between each other. Even though N+1\r\n * submissions occurred, only 1 delivery was made.\r\n *\r\n * The delayer offers this behavior via the trigger() method, into which both the task\r\n * to be executed and the waiting period (delay) must be passed in as arguments. Following\r\n * the example:\r\n *\r\n * \t\tconst delayer = new Delayer(WAITING_PERIOD);\r\n * \t\tconst letters = [];\r\n *\r\n * \t\tfunction letterReceived(l) {\r\n * \t\t\tletters.push(l);\r\n * \t\t\tdelayer.trigger(() => { return makeTheTrip(); });\r\n * \t\t}\r\n */\r\nexport class Delayer {\r\n constructor(defaultDelay) {\r\n this.defaultDelay = defaultDelay;\r\n this.timeout = null;\r\n this.completionPromise = null;\r\n this.doResolve = null;\r\n this.doReject = null;\r\n this.task = null;\r\n }\r\n trigger(task, delay = this.defaultDelay) {\r\n this.task = task;\r\n this.cancelTimeout();\r\n if (!this.completionPromise) {\r\n this.completionPromise = new Promise((resolve, reject) => {\r\n this.doResolve = resolve;\r\n this.doReject = reject;\r\n }).then(() => {\r\n this.completionPromise = null;\r\n this.doResolve = null;\r\n if (this.task) {\r\n const task = this.task;\r\n this.task = null;\r\n return task();\r\n }\r\n return undefined;\r\n });\r\n }\r\n this.timeout = setTimeout(() => {\r\n this.timeout = null;\r\n if (this.doResolve) {\r\n this.doResolve(null);\r\n }\r\n }, delay);\r\n return this.completionPromise;\r\n }\r\n isTriggered() {\r\n return this.timeout !== null;\r\n }\r\n cancel() {\r\n this.cancelTimeout();\r\n if (this.completionPromise) {\r\n if (this.doReject) {\r\n this.doReject(canceled());\r\n }\r\n this.completionPromise = null;\r\n }\r\n }\r\n cancelTimeout() {\r\n if (this.timeout !== null) {\r\n clearTimeout(this.timeout);\r\n this.timeout = null;\r\n }\r\n }\r\n dispose() {\r\n this.cancel();\r\n }\r\n}\r\n/**\r\n * A helper to delay execution of a task that is being requested often, while\r\n * preventing accumulation of consecutive executions, while the task runs.\r\n *\r\n * The mail man is clever and waits for a certain amount of time, before going\r\n * out to deliver letters. While the mail man is going out, more letters arrive\r\n * and can only be delivered once he is back. Once he is back the mail man will\r\n * do one more trip to deliver the letters that have accumulated while he was out.\r\n */\r\nexport class ThrottledDelayer {\r\n constructor(defaultDelay) {\r\n this.delayer = new Delayer(defaultDelay);\r\n this.throttler = new Throttler();\r\n }\r\n trigger(promiseFactory, delay) {\r\n return this.delayer.trigger(() => this.throttler.queue(promiseFactory), delay);\r\n }\r\n dispose() {\r\n this.delayer.dispose();\r\n }\r\n}\r\nexport function timeout(millis, token) {\r\n if (!token) {\r\n return createCancelablePromise(token => timeout(millis, token));\r\n }\r\n return new Promise((resolve, reject) => {\r\n const handle = setTimeout(() => {\r\n disposable.dispose();\r\n resolve();\r\n }, millis);\r\n const disposable = token.onCancellationRequested(() => {\r\n clearTimeout(handle);\r\n disposable.dispose();\r\n reject(canceled());\r\n });\r\n });\r\n}\r\nexport function disposableTimeout(handler, timeout = 0) {\r\n const timer = setTimeout(handler, timeout);\r\n return toDisposable(() => clearTimeout(timer));\r\n}\r\nexport function first(promiseFactories, shouldStop = t => !!t, defaultValue = null) {\r\n let index = 0;\r\n const len = promiseFactories.length;\r\n const loop = () => {\r\n if (index >= len) {\r\n return Promise.resolve(defaultValue);\r\n }\r\n const factory = promiseFactories[index++];\r\n const promise = Promise.resolve(factory());\r\n return promise.then(result => {\r\n if (shouldStop(result)) {\r\n return Promise.resolve(result);\r\n }\r\n return loop();\r\n });\r\n };\r\n return loop();\r\n}\r\nexport class TimeoutTimer {\r\n constructor(runner, timeout) {\r\n this._token = -1;\r\n if (typeof runner === 'function' && typeof timeout === 'number') {\r\n this.setIfNotSet(runner, timeout);\r\n }\r\n }\r\n dispose() {\r\n this.cancel();\r\n }\r\n cancel() {\r\n if (this._token !== -1) {\r\n clearTimeout(this._token);\r\n this._token = -1;\r\n }\r\n }\r\n cancelAndSet(runner, timeout) {\r\n this.cancel();\r\n this._token = setTimeout(() => {\r\n this._token = -1;\r\n runner();\r\n }, timeout);\r\n }\r\n setIfNotSet(runner, timeout) {\r\n if (this._token !== -1) {\r\n // timer is already set\r\n return;\r\n }\r\n this._token = setTimeout(() => {\r\n this._token = -1;\r\n runner();\r\n }, timeout);\r\n }\r\n}\r\nexport class IntervalTimer {\r\n constructor() {\r\n this._token = -1;\r\n }\r\n dispose() {\r\n this.cancel();\r\n }\r\n cancel() {\r\n if (this._token !== -1) {\r\n clearInterval(this._token);\r\n this._token = -1;\r\n }\r\n }\r\n cancelAndSet(runner, interval) {\r\n this.cancel();\r\n this._token = setInterval(() => {\r\n runner();\r\n }, interval);\r\n }\r\n}\r\nexport class RunOnceScheduler {\r\n constructor(runner, delay) {\r\n this.timeoutToken = -1;\r\n this.runner = runner;\r\n this.timeout = delay;\r\n this.timeoutHandler = this.onTimeout.bind(this);\r\n }\r\n /**\r\n * Dispose RunOnceScheduler\r\n */\r\n dispose() {\r\n this.cancel();\r\n this.runner = null;\r\n }\r\n /**\r\n * Cancel current scheduled runner (if any).\r\n */\r\n cancel() {\r\n if (this.isScheduled()) {\r\n clearTimeout(this.timeoutToken);\r\n this.timeoutToken = -1;\r\n }\r\n }\r\n /**\r\n * Cancel previous runner (if any) & schedule a new runner.\r\n */\r\n schedule(delay = this.timeout) {\r\n this.cancel();\r\n this.timeoutToken = setTimeout(this.timeoutHandler, delay);\r\n }\r\n get delay() {\r\n return this.timeout;\r\n }\r\n set delay(value) {\r\n this.timeout = value;\r\n }\r\n /**\r\n * Returns true if scheduled.\r\n */\r\n isScheduled() {\r\n return this.timeoutToken !== -1;\r\n }\r\n onTimeout() {\r\n this.timeoutToken = -1;\r\n if (this.runner) {\r\n this.doRun();\r\n }\r\n }\r\n doRun() {\r\n if (this.runner) {\r\n this.runner();\r\n }\r\n }\r\n}\r\n/**\r\n * Execute the callback the next time the browser is idle\r\n */\r\nexport let runWhenIdle;\r\n(function () {\r\n if (typeof requestIdleCallback !== 'function' || typeof cancelIdleCallback !== 'function') {\r\n const dummyIdle = Object.freeze({\r\n didTimeout: true,\r\n timeRemaining() { return 15; }\r\n });\r\n runWhenIdle = (runner) => {\r\n const handle = setTimeout(() => runner(dummyIdle));\r\n let disposed = false;\r\n return {\r\n dispose() {\r\n if (disposed) {\r\n return;\r\n }\r\n disposed = true;\r\n clearTimeout(handle);\r\n }\r\n };\r\n };\r\n }\r\n else {\r\n runWhenIdle = (runner, timeout) => {\r\n const handle = requestIdleCallback(runner, typeof timeout === 'number' ? { timeout } : undefined);\r\n let disposed = false;\r\n return {\r\n dispose() {\r\n if (disposed) {\r\n return;\r\n }\r\n disposed = true;\r\n cancelIdleCallback(handle);\r\n }\r\n };\r\n };\r\n }\r\n})();\r\n/**\r\n * An implementation of the \"idle-until-urgent\"-strategy as introduced\r\n * here: https://philipwalton.com/articles/idle-until-urgent/\r\n */\r\nexport class IdleValue {\r\n constructor(executor) {\r\n this._didRun = false;\r\n this._executor = () => {\r\n try {\r\n this._value = executor();\r\n }\r\n catch (err) {\r\n this._error = err;\r\n }\r\n finally {\r\n this._didRun = true;\r\n }\r\n };\r\n this._handle = runWhenIdle(() => this._executor());\r\n }\r\n dispose() {\r\n this._handle.dispose();\r\n }\r\n get value() {\r\n if (!this._didRun) {\r\n this._handle.dispose();\r\n this._executor();\r\n }\r\n if (this._error) {\r\n throw this._error;\r\n }\r\n return this._value;\r\n }\r\n}\r\n//#endregion\r\n//#region Promises\r\nexport var Promises;\r\n(function (Promises) {\r\n /**\r\n * A drop-in replacement for `Promise.all` with the only difference\r\n * that the method awaits every promise to either fulfill or reject.\r\n *\r\n * Similar to `Promise.all`, only the first error will be returned\r\n * if any.\r\n */\r\n function settled(promises) {\r\n return __awaiter(this, void 0, void 0, function* () {\r\n let firstError = undefined;\r\n const result = yield Promise.all(promises.map(promise => promise.then(value => value, error => {\r\n if (!firstError) {\r\n firstError = error;\r\n }\r\n return undefined; // do not rethrow so that other promises can settle\r\n })));\r\n if (typeof firstError !== 'undefined') {\r\n throw firstError;\r\n }\r\n return result; // cast is needed and protected by the `throw` above\r\n });\r\n }\r\n Promises.settled = settled;\r\n})(Promises || (Promises = {}));\r\n//#endregion\r\n", "/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License. See License.txt in the project root for license information.\r\n *--------------------------------------------------------------------------------------------*/\r\nimport { isWindows, isMacintosh, setImmediate, globals } from './platform.js';\r\nlet safeProcess;\r\n// Native sandbox environment\r\nif (typeof globals.vscode !== 'undefined' && typeof globals.vscode.process !== 'undefined') {\r\n const sandboxProcess = globals.vscode.process;\r\n safeProcess = {\r\n get platform() { return sandboxProcess.platform; },\r\n get env() { return sandboxProcess.env; },\r\n cwd() { return sandboxProcess.cwd(); },\r\n nextTick(callback) { return setImmediate(callback); }\r\n };\r\n}\r\n// Native node.js environment\r\nelse if (typeof process !== 'undefined') {\r\n safeProcess = {\r\n get platform() { return process.platform; },\r\n get env() { return process.env; },\r\n cwd() { return process.env['VSCODE_CWD'] || process.cwd(); },\r\n nextTick(callback) { return process.nextTick(callback); }\r\n };\r\n}\r\n// Web environment\r\nelse {\r\n safeProcess = {\r\n // Supported\r\n get platform() { return isWindows ? 'win32' : isMacintosh ? 'darwin' : 'linux'; },\r\n nextTick(callback) { return setImmediate(callback); },\r\n // Unsupported\r\n get env() { return {}; },\r\n cwd() { return '/'; }\r\n };\r\n}\r\n/**\r\n * Provides safe access to the `cwd` property in node.js, sandboxed or web\r\n * environments.\r\n *\r\n * Note: in web, this property is hardcoded to be `/`.\r\n */\r\nexport const cwd = safeProcess.cwd;\r\n/**\r\n * Provides safe access to the `env` property in node.js, sandboxed or web\r\n * environments.\r\n *\r\n * Note: in web, this property is hardcoded to be `{}`.\r\n */\r\nexport const env = safeProcess.env;\r\n/**\r\n * Provides safe access to the `platform` property in node.js, sandboxed or web\r\n * environments.\r\n */\r\nexport const platform = safeProcess.platform;\r\n", "/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License. See License.txt in the project root for license information.\r\n *--------------------------------------------------------------------------------------------*/\r\n// NOTE: VSCode's copy of nodejs path library to be usable in common (non-node) namespace\r\n// Copied from: https://github.com/nodejs/node/blob/v12.8.1/lib/path.js\r\n/**\r\n * Copyright Joyent, Inc. and other Node contributors.\r\n *\r\n * Permission is hereby granted, free of charge, to any person obtaining a\r\n * copy of this software and associated documentation files (the\r\n * \"Software\"), to deal in the Software without restriction, including\r\n * without limitation the rights to use, copy, modify, merge, publish,\r\n * distribute, sublicense, and/or sell copies of the Software, and to permit\r\n * persons to whom the Software is furnished to do so, subject to the\r\n * following conditions:\r\n *\r\n * The above copyright notice and this permission notice shall be included\r\n * in all copies or substantial portions of the Software.\r\n *\r\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\r\n * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r\n * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\r\n * NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\r\n * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\r\n * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\r\n * USE OR OTHER DEALINGS IN THE SOFTWARE.\r\n */\r\nimport * as process from './process.js';\r\nconst CHAR_UPPERCASE_A = 65; /* A */\r\nconst CHAR_LOWERCASE_A = 97; /* a */\r\nconst CHAR_UPPERCASE_Z = 90; /* Z */\r\nconst CHAR_LOWERCASE_Z = 122; /* z */\r\nconst CHAR_DOT = 46; /* . */\r\nconst CHAR_FORWARD_SLASH = 47; /* / */\r\nconst CHAR_BACKWARD_SLASH = 92; /* \\ */\r\nconst CHAR_COLON = 58; /* : */\r\nconst CHAR_QUESTION_MARK = 63; /* ? */\r\nclass ErrorInvalidArgType extends Error {\r\n constructor(name, expected, actual) {\r\n // determiner: 'must be' or 'must not be'\r\n let determiner;\r\n if (typeof expected === 'string' && expected.indexOf('not ') === 0) {\r\n determiner = 'must not be';\r\n expected = expected.replace(/^not /, '');\r\n }\r\n else {\r\n determiner = 'must be';\r\n }\r\n const type = name.indexOf('.') !== -1 ? 'property' : 'argument';\r\n let msg = `The \"${name}\" ${type} ${determiner} of type ${expected}`;\r\n msg += `. Received type ${typeof actual}`;\r\n super(msg);\r\n this.code = 'ERR_INVALID_ARG_TYPE';\r\n }\r\n}\r\nfunction validateString(value, name) {\r\n if (typeof value !== 'string') {\r\n throw new ErrorInvalidArgType(name, 'string', value);\r\n }\r\n}\r\nfunction isPathSeparator(code) {\r\n return code === CHAR_FORWARD_SLASH || code === CHAR_BACKWARD_SLASH;\r\n}\r\nfunction isPosixPathSeparator(code) {\r\n return code === CHAR_FORWARD_SLASH;\r\n}\r\nfunction isWindowsDeviceRoot(code) {\r\n return code >= CHAR_UPPERCASE_A && code <= CHAR_UPPERCASE_Z ||\r\n code >= CHAR_LOWERCASE_A && code <= CHAR_LOWERCASE_Z;\r\n}\r\n// Resolves . and .. elements in a path with directory names\r\nfunction normalizeString(path, allowAboveRoot, separator, isPathSeparator) {\r\n let res = '';\r\n let lastSegmentLength = 0;\r\n let lastSlash = -1;\r\n let dots = 0;\r\n let code = 0;\r\n for (let i = 0; i <= path.length; ++i) {\r\n if (i < path.length) {\r\n code = path.charCodeAt(i);\r\n }\r\n else if (isPathSeparator(code)) {\r\n break;\r\n }\r\n else {\r\n code = CHAR_FORWARD_SLASH;\r\n }\r\n if (isPathSeparator(code)) {\r\n if (lastSlash === i - 1 || dots === 1) {\r\n // NOOP\r\n }\r\n else if (dots === 2) {\r\n if (res.length < 2 || lastSegmentLength !== 2 ||\r\n res.charCodeAt(res.length - 1) !== CHAR_DOT ||\r\n res.charCodeAt(res.length - 2) !== CHAR_DOT) {\r\n if (res.length > 2) {\r\n const lastSlashIndex = res.lastIndexOf(separator);\r\n if (lastSlashIndex === -1) {\r\n res = '';\r\n lastSegmentLength = 0;\r\n }\r\n else {\r\n res = res.slice(0, lastSlashIndex);\r\n lastSegmentLength = res.length - 1 - res.lastIndexOf(separator);\r\n }\r\n lastSlash = i;\r\n dots = 0;\r\n continue;\r\n }\r\n else if (res.length !== 0) {\r\n res = '';\r\n lastSegmentLength = 0;\r\n lastSlash = i;\r\n dots = 0;\r\n continue;\r\n }\r\n }\r\n if (allowAboveRoot) {\r\n res += res.length > 0 ? `${separator}..` : '..';\r\n lastSegmentLength = 2;\r\n }\r\n }\r\n else {\r\n if (res.length > 0) {\r\n res += `${separator}${path.slice(lastSlash + 1, i)}`;\r\n }\r\n else {\r\n res = path.slice(lastSlash + 1, i);\r\n }\r\n lastSegmentLength = i - lastSlash - 1;\r\n }\r\n lastSlash = i;\r\n dots = 0;\r\n }\r\n else if (code === CHAR_DOT && dots !== -1) {\r\n ++dots;\r\n }\r\n else {\r\n dots = -1;\r\n }\r\n }\r\n return res;\r\n}\r\nfunction _format(sep, pathObject) {\r\n if (pathObject === null || typeof pathObject !== 'object') {\r\n throw new ErrorInvalidArgType('pathObject', 'Object', pathObject);\r\n }\r\n const dir = pathObject.dir || pathObject.root;\r\n const base = pathObject.base ||\r\n `${pathObject.name || ''}${pathObject.ext || ''}`;\r\n if (!dir) {\r\n return base;\r\n }\r\n return dir === pathObject.root ? `${dir}${base}` : `${dir}${sep}${base}`;\r\n}\r\nexport const win32 = {\r\n // path.resolve([from ...], to)\r\n resolve(...pathSegments) {\r\n let resolvedDevice = '';\r\n let resolvedTail = '';\r\n let resolvedAbsolute = false;\r\n for (let i = pathSegments.length - 1; i >= -1; i--) {\r\n let path;\r\n if (i >= 0) {\r\n path = pathSegments[i];\r\n validateString(path, 'path');\r\n // Skip empty entries\r\n if (path.length === 0) {\r\n continue;\r\n }\r\n }\r\n else if (resolvedDevice.length === 0) {\r\n path = process.cwd();\r\n }\r\n else {\r\n // Windows has the concept of drive-specific current working\r\n // directories. If we've resolved a drive letter but not yet an\r\n // absolute path, get cwd for that drive, or the process cwd if\r\n // the drive cwd is not available. We're sure the device is not\r\n // a UNC path at this points, because UNC paths are always absolute.\r\n path = process.env[`=${resolvedDevice}`] || process.cwd();\r\n // Verify that a cwd was found and that it actually points\r\n // to our drive. If not, default to the drive's root.\r\n if (path === undefined ||\r\n path.slice(0, 2).toLowerCase() !== resolvedDevice.toLowerCase() &&\r\n path.charCodeAt(2) === CHAR_BACKWARD_SLASH) {\r\n path = `${resolvedDevice}\\\\`;\r\n }\r\n }\r\n const len = path.length;\r\n let rootEnd = 0;\r\n let device = '';\r\n let isAbsolute = false;\r\n const code = path.charCodeAt(0);\r\n // Try to match a root\r\n if (len === 1) {\r\n if (isPathSeparator(code)) {\r\n // `path` contains just a path separator\r\n rootEnd = 1;\r\n isAbsolute = true;\r\n }\r\n }\r\n else if (isPathSeparator(code)) {\r\n // Possible UNC root\r\n // If we started with a separator, we know we at least have an\r\n // absolute path of some kind (UNC or otherwise)\r\n isAbsolute = true;\r\n if (isPathSeparator(path.charCodeAt(1))) {\r\n // Matched double path separator at beginning\r\n let j = 2;\r\n let last = j;\r\n // Match 1 or more non-path separators\r\n while (j < len && !isPathSeparator(path.charCodeAt(j))) {\r\n j++;\r\n }\r\n if (j < len && j !== last) {\r\n const firstPart = path.slice(last, j);\r\n // Matched!\r\n last = j;\r\n // Match 1 or more path separators\r\n while (j < len && isPathSeparator(path.charCodeAt(j))) {\r\n j++;\r\n }\r\n if (j < len && j !== last) {\r\n // Matched!\r\n last = j;\r\n // Match 1 or more non-path separators\r\n while (j < len && !isPathSeparator(path.charCodeAt(j))) {\r\n j++;\r\n }\r\n if (j === len || j !== last) {\r\n // We matched a UNC root\r\n device = `\\\\\\\\${firstPart}\\\\${path.slice(last, j)}`;\r\n rootEnd = j;\r\n }\r\n }\r\n }\r\n }\r\n else {\r\n rootEnd = 1;\r\n }\r\n }\r\n else if (isWindowsDeviceRoot(code) &&\r\n path.charCodeAt(1) === CHAR_COLON) {\r\n // Possible device root\r\n device = path.slice(0, 2);\r\n rootEnd = 2;\r\n if (len > 2 && isPathSeparator(path.charCodeAt(2))) {\r\n // Treat separator following drive name as an absolute path\r\n // indicator\r\n isAbsolute = true;\r\n rootEnd = 3;\r\n }\r\n }\r\n if (device.length > 0) {\r\n if (resolvedDevice.length > 0) {\r\n if (device.toLowerCase() !== resolvedDevice.toLowerCase()) {\r\n // This path points to another device so it is not applicable\r\n continue;\r\n }\r\n }\r\n else {\r\n resolvedDevice = device;\r\n }\r\n }\r\n if (resolvedAbsolute) {\r\n if (resolvedDevice.length > 0) {\r\n break;\r\n }\r\n }\r\n else {\r\n resolvedTail = `${path.slice(rootEnd)}\\\\${resolvedTail}`;\r\n resolvedAbsolute = isAbsolute;\r\n if (isAbsolute && resolvedDevice.length > 0) {\r\n break;\r\n }\r\n }\r\n }\r\n // At this point the path should be resolved to a full absolute path,\r\n // but handle relative paths to be safe (might happen when process.cwd()\r\n // fails)\r\n // Normalize the tail path\r\n resolvedTail = normalizeString(resolvedTail, !resolvedAbsolute, '\\\\', isPathSeparator);\r\n return resolvedAbsolute ?\r\n `${resolvedDevice}\\\\${resolvedTail}` :\r\n `${resolvedDevice}${resolvedTail}` || '.';\r\n },\r\n normalize(path) {\r\n validateString(path, 'path');\r\n const len = path.length;\r\n if (len === 0) {\r\n return '.';\r\n }\r\n let rootEnd = 0;\r\n let device;\r\n let isAbsolute = false;\r\n const code = path.charCodeAt(0);\r\n // Try to match a root\r\n if (len === 1) {\r\n // `path` contains just a single char, exit early to avoid\r\n // unnecessary work\r\n return isPosixPathSeparator(code) ? '\\\\' : path;\r\n }\r\n if (isPathSeparator(code)) {\r\n // Possible UNC root\r\n // If we started with a separator, we know we at least have an absolute\r\n // path of some kind (UNC or otherwise)\r\n isAbsolute = true;\r\n if (isPathSeparator(path.charCodeAt(1))) {\r\n // Matched double path separator at beginning\r\n let j = 2;\r\n let last = j;\r\n // Match 1 or more non-path separators\r\n while (j < len && !isPathSeparator(path.charCodeAt(j))) {\r\n j++;\r\n }\r\n if (j < len && j !== last) {\r\n const firstPart = path.slice(last, j);\r\n // Matched!\r\n last = j;\r\n // Match 1 or more path separators\r\n while (j < len && isPathSeparator(path.charCodeAt(j))) {\r\n j++;\r\n }\r\n if (j < len && j !== last) {\r\n // Matched!\r\n last = j;\r\n // Match 1 or more non-path separators\r\n while (j < len && !isPathSeparator(path.charCodeAt(j))) {\r\n j++;\r\n }\r\n if (j === len) {\r\n // We matched a UNC root only\r\n // Return the normalized version of the UNC root since there\r\n // is nothing left to process\r\n return `\\\\\\\\${firstPart}\\\\${path.slice(last)}\\\\`;\r\n }\r\n if (j !== last) {\r\n // We matched a UNC root with leftovers\r\n device = `\\\\\\\\${firstPart}\\\\${path.slice(last, j)}`;\r\n rootEnd = j;\r\n }\r\n }\r\n }\r\n }\r\n else {\r\n rootEnd = 1;\r\n }\r\n }\r\n else if (isWindowsDeviceRoot(code) && path.charCodeAt(1) === CHAR_COLON) {\r\n // Possible device root\r\n device = path.slice(0, 2);\r\n rootEnd = 2;\r\n if (len > 2 && isPathSeparator(path.charCodeAt(2))) {\r\n // Treat separator following drive name as an absolute path\r\n // indicator\r\n isAbsolute = true;\r\n rootEnd = 3;\r\n }\r\n }\r\n let tail = rootEnd < len ?\r\n normalizeString(path.slice(rootEnd), !isAbsolute, '\\\\', isPathSeparator) :\r\n '';\r\n if (tail.length === 0 && !isAbsolute) {\r\n tail = '.';\r\n }\r\n if (tail.length > 0 && isPathSeparator(path.charCodeAt(len - 1))) {\r\n tail += '\\\\';\r\n }\r\n if (device === undefined) {\r\n return isAbsolute ? `\\\\${tail}` : tail;\r\n }\r\n return isAbsolute ? `${device}\\\\${tail}` : `${device}${tail}`;\r\n },\r\n isAbsolute(path) {\r\n validateString(path, 'path');\r\n const len = path.length;\r\n if (len === 0) {\r\n return false;\r\n }\r\n const code = path.charCodeAt(0);\r\n return isPathSeparator(code) ||\r\n // Possible device root\r\n len > 2 &&\r\n isWindowsDeviceRoot(code) &&\r\n path.charCodeAt(1) === CHAR_COLON &&\r\n isPathSeparator(path.charCodeAt(2));\r\n },\r\n join(...paths) {\r\n if (paths.length === 0) {\r\n return '.';\r\n }\r\n let joined;\r\n let firstPart;\r\n for (let i = 0; i < paths.length; ++i) {\r\n const arg = paths[i];\r\n validateString(arg, 'path');\r\n if (arg.length > 0) {\r\n if (joined === undefined) {\r\n joined = firstPart = arg;\r\n }\r\n else {\r\n joined += `\\\\${arg}`;\r\n }\r\n }\r\n }\r\n if (joined === undefined) {\r\n return '.';\r\n }\r\n // Make sure that the joined path doesn't start with two slashes, because\r\n // normalize() will mistake it for an UNC path then.\r\n //\r\n // This step is skipped when it is very clear that the user actually\r\n // intended to point at an UNC path. This is assumed when the first\r\n // non-empty string arguments starts with exactly two slashes followed by\r\n // at least one more non-slash character.\r\n //\r\n // Note that for normalize() to treat a path as an UNC path it needs to\r\n // have at least 2 components, so we don't filter for that here.\r\n // This means that the user can use join to construct UNC paths from\r\n // a server name and a share name; for example:\r\n // path.join('//server', 'share') -> '\\\\\\\\server\\\\share\\\\')\r\n let needsReplace = true;\r\n let slashCount = 0;\r\n if (typeof firstPart === 'string' && isPathSeparator(firstPart.charCodeAt(0))) {\r\n ++slashCount;\r\n const firstLen = firstPart.length;\r\n if (firstLen > 1 && isPathSeparator(firstPart.charCodeAt(1))) {\r\n ++slashCount;\r\n if (firstLen > 2) {\r\n if (isPathSeparator(firstPart.charCodeAt(2))) {\r\n ++slashCount;\r\n }\r\n else {\r\n // We matched a UNC path in the first part\r\n needsReplace = false;\r\n }\r\n }\r\n }\r\n }\r\n if (needsReplace) {\r\n // Find any more consecutive slashes we need to replace\r\n while (slashCount < joined.length &&\r\n isPathSeparator(joined.charCodeAt(slashCount))) {\r\n slashCount++;\r\n }\r\n // Replace the slashes if needed\r\n if (slashCount >= 2) {\r\n joined = `\\\\${joined.slice(slashCount)}`;\r\n }\r\n }\r\n return win32.normalize(joined);\r\n },\r\n // It will solve the relative path from `from` to `to`, for instance:\r\n // from = 'C:\\\\orandea\\\\test\\\\aaa'\r\n // to = 'C:\\\\orandea\\\\impl\\\\bbb'\r\n // The output of the function should be: '..\\\\..\\\\impl\\\\bbb'\r\n relative(from, to) {\r\n validateString(from, 'from');\r\n validateString(to, 'to');\r\n if (from === to) {\r\n return '';\r\n }\r\n const fromOrig = win32.resolve(from);\r\n const toOrig = win32.resolve(to);\r\n if (fromOrig === toOrig) {\r\n return '';\r\n }\r\n from = fromOrig.toLowerCase();\r\n to = toOrig.toLowerCase();\r\n if (from === to) {\r\n return '';\r\n }\r\n // Trim any leading backslashes\r\n let fromStart = 0;\r\n while (fromStart < from.length &&\r\n from.charCodeAt(fromStart) === CHAR_BACKWARD_SLASH) {\r\n fromStart++;\r\n }\r\n // Trim trailing backslashes (applicable to UNC paths only)\r\n let fromEnd = from.length;\r\n while (fromEnd - 1 > fromStart &&\r\n from.charCodeAt(fromEnd - 1) === CHAR_BACKWARD_SLASH) {\r\n fromEnd--;\r\n }\r\n const fromLen = fromEnd - fromStart;\r\n // Trim any leading backslashes\r\n let toStart = 0;\r\n while (toStart < to.length &&\r\n to.charCodeAt(toStart) === CHAR_BACKWARD_SLASH) {\r\n toStart++;\r\n }\r\n // Trim trailing backslashes (applicable to UNC paths only)\r\n let toEnd = to.length;\r\n while (toEnd - 1 > toStart &&\r\n to.charCodeAt(toEnd - 1) === CHAR_BACKWARD_SLASH) {\r\n toEnd--;\r\n }\r\n const toLen = toEnd - toStart;\r\n // Compare paths to find the longest common path from root\r\n const length = fromLen < toLen ? fromLen : toLen;\r\n let lastCommonSep = -1;\r\n let i = 0;\r\n for (; i < length; i++) {\r\n const fromCode = from.charCodeAt(fromStart + i);\r\n if (fromCode !== to.charCodeAt(toStart + i)) {\r\n break;\r\n }\r\n else if (fromCode === CHAR_BACKWARD_SLASH) {\r\n lastCommonSep = i;\r\n }\r\n }\r\n // We found a mismatch before the first common path separator was seen, so\r\n // return the original `to`.\r\n if (i !== length) {\r\n if (lastCommonSep === -1) {\r\n return toOrig;\r\n }\r\n }\r\n else {\r\n if (toLen > length) {\r\n if (to.charCodeAt(toStart + i) === CHAR_BACKWARD_SLASH) {\r\n // We get here if `from` is the exact base path for `to`.\r\n // For example: from='C:\\\\foo\\\\bar'; to='C:\\\\foo\\\\bar\\\\baz'\r\n return toOrig.slice(toStart + i + 1);\r\n }\r\n if (i === 2) {\r\n // We get here if `from` is the device root.\r\n // For example: from='C:\\\\'; to='C:\\\\foo'\r\n return toOrig.slice(toStart + i);\r\n }\r\n }\r\n if (fromLen > length) {\r\n if (from.charCodeAt(fromStart + i) === CHAR_BACKWARD_SLASH) {\r\n // We get here if `to` is the exact base path for `from`.\r\n // For example: from='C:\\\\foo\\\\bar'; to='C:\\\\foo'\r\n lastCommonSep = i;\r\n }\r\n else if (i === 2) {\r\n // We get here if `to` is the device root.\r\n // For example: from='C:\\\\foo\\\\bar'; to='C:\\\\'\r\n lastCommonSep = 3;\r\n }\r\n }\r\n if (lastCommonSep === -1) {\r\n lastCommonSep = 0;\r\n }\r\n }\r\n let out = '';\r\n // Generate the relative path based on the path difference between `to` and\r\n // `from`\r\n for (i = fromStart + lastCommonSep + 1; i <= fromEnd; ++i) {\r\n if (i === fromEnd || from.charCodeAt(i) === CHAR_BACKWARD_SLASH) {\r\n out += out.length === 0 ? '..' : '\\\\..';\r\n }\r\n }\r\n toStart += lastCommonSep;\r\n // Lastly, append the rest of the destination (`to`) path that comes after\r\n // the common path parts\r\n if (out.length > 0) {\r\n return `${out}${toOrig.slice(toStart, toEnd)}`;\r\n }\r\n if (toOrig.charCodeAt(toStart) === CHAR_BACKWARD_SLASH) {\r\n ++toStart;\r\n }\r\n return toOrig.slice(toStart, toEnd);\r\n },\r\n toNamespacedPath(path) {\r\n // Note: this will *probably* throw somewhere.\r\n if (typeof path !== 'string') {\r\n return path;\r\n }\r\n if (path.length === 0) {\r\n return '';\r\n }\r\n const resolvedPath = win32.resolve(path);\r\n if (resolvedPath.length <= 2) {\r\n return path;\r\n }\r\n if (resolvedPath.charCodeAt(0) === CHAR_BACKWARD_SLASH) {\r\n // Possible UNC root\r\n if (resolvedPath.charCodeAt(1) === CHAR_BACKWARD_SLASH) {\r\n const code = resolvedPath.charCodeAt(2);\r\n if (code !== CHAR_QUESTION_MARK && code !== CHAR_DOT) {\r\n // Matched non-long UNC root, convert the path to a long UNC path\r\n return `\\\\\\\\?\\\\UNC\\\\${resolvedPath.slice(2)}`;\r\n }\r\n }\r\n }\r\n else if (isWindowsDeviceRoot(resolvedPath.charCodeAt(0)) &&\r\n resolvedPath.charCodeAt(1) === CHAR_COLON &&\r\n resolvedPath.charCodeAt(2) === CHAR_BACKWARD_SLASH) {\r\n // Matched device root, convert the path to a long UNC path\r\n return `\\\\\\\\?\\\\${resolvedPath}`;\r\n }\r\n return path;\r\n },\r\n dirname(path) {\r\n validateString(path, 'path');\r\n const len = path.length;\r\n if (len === 0) {\r\n return '.';\r\n }\r\n let rootEnd = -1;\r\n let offset = 0;\r\n const code = path.charCodeAt(0);\r\n if (len === 1) {\r\n // `path` contains just a path separator, exit early to avoid\r\n // unnecessary work or a dot.\r\n return isPathSeparator(code) ? path : '.';\r\n }\r\n // Try to match a root\r\n if (isPathSeparator(code)) {\r\n // Possible UNC root\r\n rootEnd = offset = 1;\r\n if (isPathSeparator(path.charCodeAt(1))) {\r\n // Matched double path separator at beginning\r\n let j = 2;\r\n let last = j;\r\n // Match 1 or more non-path separators\r\n while (j < len && !isPathSeparator(path.charCodeAt(j))) {\r\n j++;\r\n }\r\n if (j < len && j !== last) {\r\n // Matched!\r\n last = j;\r\n // Match 1 or more path separators\r\n while (j < len && isPathSeparator(path.charCodeAt(j))) {\r\n j++;\r\n }\r\n if (j < len && j !== last) {\r\n // Matched!\r\n last = j;\r\n // Match 1 or more non-path separators\r\n while (j < len && !isPathSeparator(path.charCodeAt(j))) {\r\n j++;\r\n }\r\n if (j === len) {\r\n // We matched a UNC root only\r\n return path;\r\n }\r\n if (j !== last) {\r\n // We matched a UNC root with leftovers\r\n // Offset by 1 to include the separator after the UNC root to\r\n // treat it as a \"normal root\" on top of a (UNC) root\r\n rootEnd = offset = j + 1;\r\n }\r\n }\r\n }\r\n }\r\n // Possible device root\r\n }\r\n else if (isWindowsDeviceRoot(code) && path.charCodeAt(1) === CHAR_COLON) {\r\n rootEnd = len > 2 && isPathSeparator(path.charCodeAt(2)) ? 3 : 2;\r\n offset = rootEnd;\r\n }\r\n let end = -1;\r\n let matchedSlash = true;\r\n for (let i = len - 1; i >= offset; --i) {\r\n if (isPathSeparator(path.charCodeAt(i))) {\r\n if (!matchedSlash) {\r\n end = i;\r\n break;\r\n }\r\n }\r\n else {\r\n // We saw the first non-path separator\r\n matchedSlash = false;\r\n }\r\n }\r\n if (end === -1) {\r\n if (rootEnd === -1) {\r\n return '.';\r\n }\r\n end = rootEnd;\r\n }\r\n return path.slice(0, end);\r\n },\r\n basename(path, ext) {\r\n if (ext !== undefined) {\r\n validateString(ext, 'ext');\r\n }\r\n validateString(path, 'path');\r\n let start = 0;\r\n let end = -1;\r\n let matchedSlash = true;\r\n let i;\r\n // Check for a drive letter prefix so as not to mistake the following\r\n // path separator as an extra separator at the end of the path that can be\r\n // disregarded\r\n if (path.length >= 2 &&\r\n isWindowsDeviceRoot(path.charCodeAt(0)) &&\r\n path.charCodeAt(1) === CHAR_COLON) {\r\n start = 2;\r\n }\r\n if (ext !== undefined && ext.length > 0 && ext.length <= path.length) {\r\n if (ext === path) {\r\n return '';\r\n }\r\n let extIdx = ext.length - 1;\r\n let firstNonSlashEnd = -1;\r\n for (i = path.length - 1; i >= start; --i) {\r\n const code = path.charCodeAt(i);\r\n if (isPathSeparator(code)) {\r\n // If we reached a path separator that was not part of a set of path\r\n // separators at the end of the string, stop now\r\n if (!matchedSlash) {\r\n start = i + 1;\r\n break;\r\n }\r\n }\r\n else {\r\n if (firstNonSlashEnd === -1) {\r\n // We saw the first non-path separator, remember this index in case\r\n // we need it if the extension ends up not matching\r\n matchedSlash = false;\r\n firstNonSlashEnd = i + 1;\r\n }\r\n if (extIdx >= 0) {\r\n // Try to match the explicit extension\r\n if (code === ext.charCodeAt(extIdx)) {\r\n if (--extIdx === -1) {\r\n // We matched the extension, so mark this as the end of our path\r\n // component\r\n end = i;\r\n }\r\n }\r\n else {\r\n // Extension does not match, so our result is the entire path\r\n // component\r\n extIdx = -1;\r\n end = firstNonSlashEnd;\r\n }\r\n }\r\n }\r\n }\r\n if (start === end) {\r\n end = firstNonSlashEnd;\r\n }\r\n else if (end === -1) {\r\n end = path.length;\r\n }\r\n return path.slice(start, end);\r\n }\r\n for (i = path.length - 1; i >= start; --i) {\r\n if (isPathSeparator(path.charCodeAt(i))) {\r\n // If we reached a path separator that was not part of a set of path\r\n // separators at the end of the string, stop now\r\n if (!matchedSlash) {\r\n start = i + 1;\r\n break;\r\n }\r\n }\r\n else if (end === -1) {\r\n // We saw the first non-path separator, mark this as the end of our\r\n // path component\r\n matchedSlash = false;\r\n end = i + 1;\r\n }\r\n }\r\n if (end === -1) {\r\n return '';\r\n }\r\n return path.slice(start, end);\r\n },\r\n extname(path) {\r\n validateString(path, 'path');\r\n let start = 0;\r\n let startDot = -1;\r\n let startPart = 0;\r\n let end = -1;\r\n let matchedSlash = true;\r\n // Track the state of characters (if any) we see before our first dot and\r\n // after any path separator we find\r\n let preDotState = 0;\r\n // Check for a drive letter prefix so as not to mistake the following\r\n // path separator as an extra separator at the end of the path that can be\r\n // disregarded\r\n if (path.length >= 2 &&\r\n path.charCodeAt(1) === CHAR_COLON &&\r\n isWindowsDeviceRoot(path.charCodeAt(0))) {\r\n start = startPart = 2;\r\n }\r\n for (let i = path.length - 1; i >= start; --i) {\r\n const code = path.charCodeAt(i);\r\n if (isPathSeparator(code)) {\r\n // If we reached a path separator that was not part of a set of path\r\n // separators at the end of the string, stop now\r\n if (!matchedSlash) {\r\n startPart = i + 1;\r\n break;\r\n }\r\n continue;\r\n }\r\n if (end === -1) {\r\n // We saw the first non-path separator, mark this as the end of our\r\n // extension\r\n matchedSlash = false;\r\n end = i + 1;\r\n }\r\n if (code === CHAR_DOT) {\r\n // If this is our first dot, mark it as the start of our extension\r\n if (startDot === -1) {\r\n startDot = i;\r\n }\r\n else if (preDotState !== 1) {\r\n preDotState = 1;\r\n }\r\n }\r\n else if (startDot !== -1) {\r\n // We saw a non-dot and non-path separator before our dot, so we should\r\n // have a good chance at having a non-empty extension\r\n preDotState = -1;\r\n }\r\n }\r\n if (startDot === -1 ||\r\n end === -1 ||\r\n // We saw a non-dot character immediately before the dot\r\n preDotState === 0 ||\r\n // The (right-most) trimmed path component is exactly '..'\r\n (preDotState === 1 &&\r\n startDot === end - 1 &&\r\n startDot === startPart + 1)) {\r\n return '';\r\n }\r\n return path.slice(startDot, end);\r\n },\r\n format: _format.bind(null, '\\\\'),\r\n parse(path) {\r\n validateString(path, 'path');\r\n const ret = { root: '', dir: '', base: '', ext: '', name: '' };\r\n if (path.length === 0) {\r\n return ret;\r\n }\r\n const len = path.length;\r\n let rootEnd = 0;\r\n let code = path.charCodeAt(0);\r\n if (len === 1) {\r\n if (isPathSeparator(code)) {\r\n // `path` contains just a path separator, exit early to avoid\r\n // unnecessary work\r\n ret.root = ret.dir = path;\r\n return ret;\r\n }\r\n ret.base = ret.name = path;\r\n return ret;\r\n }\r\n // Try to match a root\r\n if (isPathSeparator(code)) {\r\n // Possible UNC root\r\n rootEnd = 1;\r\n if (isPathSeparator(path.charCodeAt(1))) {\r\n // Matched double path separator at beginning\r\n let j = 2;\r\n let last = j;\r\n // Match 1 or more non-path separators\r\n while (j < len && !isPathSeparator(path.charCodeAt(j))) {\r\n j++;\r\n }\r\n if (j < len && j !== last) {\r\n // Matched!\r\n last = j;\r\n // Match 1 or more path separators\r\n while (j < len && isPathSeparator(path.charCodeAt(j))) {\r\n j++;\r\n }\r\n if (j < len && j !== last) {\r\n // Matched!\r\n last = j;\r\n // Match 1 or more non-path separators\r\n while (j < len && !isPathSeparator(path.charCodeAt(j))) {\r\n j++;\r\n }\r\n if (j === len) {\r\n // We matched a UNC root only\r\n rootEnd = j;\r\n }\r\n else if (j !== last) {\r\n // We matched a UNC root with leftovers\r\n rootEnd = j + 1;\r\n }\r\n }\r\n }\r\n }\r\n }\r\n else if (isWindowsDeviceRoot(code) && path.charCodeAt(1) === CHAR_COLON) {\r\n // Possible device root\r\n if (len <= 2) {\r\n // `path` contains just a drive root, exit early to avoid\r\n // unnecessary work\r\n ret.root = ret.dir = path;\r\n return ret;\r\n }\r\n rootEnd = 2;\r\n if (isPathSeparator(path.charCodeAt(2))) {\r\n if (len === 3) {\r\n // `path` contains just a drive root, exit early to avoid\r\n // unnecessary work\r\n ret.root = ret.dir = path;\r\n return ret;\r\n }\r\n rootEnd = 3;\r\n }\r\n }\r\n if (rootEnd > 0) {\r\n ret.root = path.slice(0, rootEnd);\r\n }\r\n let startDot = -1;\r\n let startPart = rootEnd;\r\n let end = -1;\r\n let matchedSlash = true;\r\n let i = path.length - 1;\r\n // Track the state of characters (if any) we see before our first dot and\r\n // after any path separator we find\r\n let preDotState = 0;\r\n // Get non-dir info\r\n for (; i >= rootEnd; --i) {\r\n code = path.charCodeAt(i);\r\n if (isPathSeparator(code)) {\r\n // If we reached a path separator that was not part of a set of path\r\n // separators at the end of the string, stop now\r\n if (!matchedSlash) {\r\n startPart = i + 1;\r\n break;\r\n }\r\n continue;\r\n }\r\n if (end === -1) {\r\n // We saw the first non-path separator, mark this as the end of our\r\n // extension\r\n matchedSlash = false;\r\n end = i + 1;\r\n }\r\n if (code === CHAR_DOT) {\r\n // If this is our first dot, mark it as the start of our extension\r\n if (startDot === -1) {\r\n startDot = i;\r\n }\r\n else if (preDotState !== 1) {\r\n preDotState = 1;\r\n }\r\n }\r\n else if (startDot !== -1) {\r\n // We saw a non-dot and non-path separator before our dot, so we should\r\n // have a good chance at having a non-empty extension\r\n preDotState = -1;\r\n }\r\n }\r\n if (end !== -1) {\r\n if (startDot === -1 ||\r\n // We saw a non-dot character immediately before the dot\r\n preDotState === 0 ||\r\n // The (right-most) trimmed path component is exactly '..'\r\n (preDotState === 1 &&\r\n startDot === end - 1 &&\r\n startDot === startPart + 1)) {\r\n ret.base = ret.name = path.slice(startPart, end);\r\n }\r\n else {\r\n ret.name = path.slice(startPart, startDot);\r\n ret.base = path.slice(startPart, end);\r\n ret.ext = path.slice(startDot, end);\r\n }\r\n }\r\n // If the directory is the root, use the entire root as the `dir` including\r\n // the trailing slash if any (`C:\\abc` -> `C:\\`). Otherwise, strip out the\r\n // trailing slash (`C:\\abc\\def` -> `C:\\abc`).\r\n if (startPart > 0 && startPart !== rootEnd) {\r\n ret.dir = path.slice(0, startPart - 1);\r\n }\r\n else {\r\n ret.dir = ret.root;\r\n }\r\n return ret;\r\n },\r\n sep: '\\\\',\r\n delimiter: ';',\r\n win32: null,\r\n posix: null\r\n};\r\nexport const posix = {\r\n // path.resolve([from ...], to)\r\n resolve(...pathSegments) {\r\n let resolvedPath = '';\r\n let resolvedAbsolute = false;\r\n for (let i = pathSegments.length - 1; i >= -1 && !resolvedAbsolute; i--) {\r\n const path = i >= 0 ? pathSegments[i] : process.cwd();\r\n validateString(path, 'path');\r\n // Skip empty entries\r\n if (path.length === 0) {\r\n continue;\r\n }\r\n resolvedPath = `${path}/${resolvedPath}`;\r\n resolvedAbsolute = path.charCodeAt(0) === CHAR_FORWARD_SLASH;\r\n }\r\n // At this point the path should be resolved to a full absolute path, but\r\n // handle relative paths to be safe (might happen when process.cwd() fails)\r\n // Normalize the path\r\n resolvedPath = normalizeString(resolvedPath, !resolvedAbsolute, '/', isPosixPathSeparator);\r\n if (resolvedAbsolute) {\r\n return `/${resolvedPath}`;\r\n }\r\n return resolvedPath.length > 0 ? resolvedPath : '.';\r\n },\r\n normalize(path) {\r\n validateString(path, 'path');\r\n if (path.length === 0) {\r\n return '.';\r\n }\r\n const isAbsolute = path.charCodeAt(0) === CHAR_FORWARD_SLASH;\r\n const trailingSeparator = path.charCodeAt(path.length - 1) === CHAR_FORWARD_SLASH;\r\n // Normalize the path\r\n path = normalizeString(path, !isAbsolute, '/', isPosixPathSeparator);\r\n if (path.length === 0) {\r\n if (isAbsolute) {\r\n return '/';\r\n }\r\n return trailingSeparator ? './' : '.';\r\n }\r\n if (trailingSeparator) {\r\n path += '/';\r\n }\r\n return isAbsolute ? `/${path}` : path;\r\n },\r\n isAbsolute(path) {\r\n validateString(path, 'path');\r\n return path.length > 0 && path.charCodeAt(0) === CHAR_FORWARD_SLASH;\r\n },\r\n join(...paths) {\r\n if (paths.length === 0) {\r\n return '.';\r\n }\r\n let joined;\r\n for (let i = 0; i < paths.length; ++i) {\r\n const arg = paths[i];\r\n validateString(arg, 'path');\r\n if (arg.length > 0) {\r\n if (joined === undefined) {\r\n joined = arg;\r\n }\r\n else {\r\n joined += `/${arg}`;\r\n }\r\n }\r\n }\r\n if (joined === undefined) {\r\n return '.';\r\n }\r\n return posix.normalize(joined);\r\n },\r\n relative(from, to) {\r\n validateString(from, 'from');\r\n validateString(to, 'to');\r\n if (from === to) {\r\n return '';\r\n }\r\n // Trim leading forward slashes.\r\n from = posix.resolve(from);\r\n to = posix.resolve(to);\r\n if (from === to) {\r\n return '';\r\n }\r\n const fromStart = 1;\r\n const fromEnd = from.length;\r\n const fromLen = fromEnd - fromStart;\r\n const toStart = 1;\r\n const toLen = to.length - toStart;\r\n // Compare paths to find the longest common path from root\r\n const length = (fromLen < toLen ? fromLen : toLen);\r\n let lastCommonSep = -1;\r\n let i = 0;\r\n for (; i < length; i++) {\r\n const fromCode = from.charCodeAt(fromStart + i);\r\n if (fromCode !== to.charCodeAt(toStart + i)) {\r\n break;\r\n }\r\n else if (fromCode === CHAR_FORWARD_SLASH) {\r\n lastCommonSep = i;\r\n }\r\n }\r\n if (i === length) {\r\n if (toLen > length) {\r\n if (to.charCodeAt(toStart + i) === CHAR_FORWARD_SLASH) {\r\n // We get here if `from` is the exact base path for `to`.\r\n // For example: from='/foo/bar'; to='/foo/bar/baz'\r\n return to.slice(toStart + i + 1);\r\n }\r\n if (i === 0) {\r\n // We get here if `from` is the root\r\n // For example: from='/'; to='/foo'\r\n return to.slice(toStart + i);\r\n }\r\n }\r\n else if (fromLen > length) {\r\n if (from.charCodeAt(fromStart + i) === CHAR_FORWARD_SLASH) {\r\n // We get here if `to` is the exact base path for `from`.\r\n // For example: from='/foo/bar/baz'; to='/foo/bar'\r\n lastCommonSep = i;\r\n }\r\n else if (i === 0) {\r\n // We get here if `to` is the root.\r\n // For example: from='/foo/bar'; to='/'\r\n lastCommonSep = 0;\r\n }\r\n }\r\n }\r\n let out = '';\r\n // Generate the relative path based on the path difference between `to`\r\n // and `from`.\r\n for (i = fromStart + lastCommonSep + 1; i <= fromEnd; ++i) {\r\n if (i === fromEnd || from.charCodeAt(i) === CHAR_FORWARD_SLASH) {\r\n out += out.length === 0 ? '..' : '/..';\r\n }\r\n }\r\n // Lastly, append the rest of the destination (`to`) path that comes after\r\n // the common path parts.\r\n return `${out}${to.slice(toStart + lastCommonSep)}`;\r\n },\r\n toNamespacedPath(path) {\r\n // Non-op on posix systems\r\n return path;\r\n },\r\n dirname(path) {\r\n validateString(path, 'path');\r\n if (path.length === 0) {\r\n return '.';\r\n }\r\n const hasRoot = path.charCodeAt(0) === CHAR_FORWARD_SLASH;\r\n let end = -1;\r\n let matchedSlash = true;\r\n for (let i = path.length - 1; i >= 1; --i) {\r\n if (path.charCodeAt(i) === CHAR_FORWARD_SLASH) {\r\n if (!matchedSlash) {\r\n end = i;\r\n break;\r\n }\r\n }\r\n else {\r\n // We saw the first non-path separator\r\n matchedSlash = false;\r\n }\r\n }\r\n if (end === -1) {\r\n return hasRoot ? '/' : '.';\r\n }\r\n if (hasRoot && end === 1) {\r\n return '//';\r\n }\r\n return path.slice(0, end);\r\n },\r\n basename(path, ext) {\r\n if (ext !== undefined) {\r\n validateString(ext, 'ext');\r\n }\r\n validateString(path, 'path');\r\n let start = 0;\r\n let end = -1;\r\n let matchedSlash = true;\r\n let i;\r\n if (ext !== undefined && ext.length > 0 && ext.length <= path.length) {\r\n if (ext === path) {\r\n return '';\r\n }\r\n let extIdx = ext.length - 1;\r\n let firstNonSlashEnd = -1;\r\n for (i = path.length - 1; i >= 0; --i) {\r\n const code = path.charCodeAt(i);\r\n if (code === CHAR_FORWARD_SLASH) {\r\n // If we reached a path separator that was not part of a set of path\r\n // separators at the end of the string, stop now\r\n if (!matchedSlash) {\r\n start = i + 1;\r\n break;\r\n }\r\n }\r\n else {\r\n if (firstNonSlashEnd === -1) {\r\n // We saw the first non-path separator, remember this index in case\r\n // we need it if the extension ends up not matching\r\n matchedSlash = false;\r\n firstNonSlashEnd = i + 1;\r\n }\r\n if (extIdx >= 0) {\r\n // Try to match the explicit extension\r\n if (code === ext.charCodeAt(extIdx)) {\r\n if (--extIdx === -1) {\r\n // We matched the extension, so mark this as the end of our path\r\n // component\r\n end = i;\r\n }\r\n }\r\n else {\r\n // Extension does not match, so our result is the entire path\r\n // component\r\n extIdx = -1;\r\n end = firstNonSlashEnd;\r\n }\r\n }\r\n }\r\n }\r\n if (start === end) {\r\n end = firstNonSlashEnd;\r\n }\r\n else if (end === -1) {\r\n end = path.length;\r\n }\r\n return path.slice(start, end);\r\n }\r\n for (i = path.length - 1; i >= 0; --i) {\r\n if (path.charCodeAt(i) === CHAR_FORWARD_SLASH) {\r\n // If we reached a path separator that was not part of a set of path\r\n // separators at the end of the string, stop now\r\n if (!matchedSlash) {\r\n start = i + 1;\r\n break;\r\n }\r\n }\r\n else if (end === -1) {\r\n // We saw the first non-path separator, mark this as the end of our\r\n // path component\r\n matchedSlash = false;\r\n end = i + 1;\r\n }\r\n }\r\n if (end === -1) {\r\n return '';\r\n }\r\n return path.slice(start, end);\r\n },\r\n extname(path) {\r\n validateString(path, 'path');\r\n let startDot = -1;\r\n let startPart = 0;\r\n let end = -1;\r\n let matchedSlash = true;\r\n // Track the state of characters (if any) we see before our first dot and\r\n // after any path separator we find\r\n let preDotState = 0;\r\n for (let i = path.length - 1; i >= 0; --i) {\r\n const code = path.charCodeAt(i);\r\n if (code === CHAR_FORWARD_SLASH) {\r\n // If we reached a path separator that was not part of a set of path\r\n // separators at the end of the string, stop now\r\n if (!matchedSlash) {\r\n startPart = i + 1;\r\n break;\r\n }\r\n continue;\r\n }\r\n if (end === -1) {\r\n // We saw the first non-path separator, mark this as the end of our\r\n // extension\r\n matchedSlash = false;\r\n end = i + 1;\r\n }\r\n if (code === CHAR_DOT) {\r\n // If this is our first dot, mark it as the start of our extension\r\n if (startDot === -1) {\r\n startDot = i;\r\n }\r\n else if (preDotState !== 1) {\r\n preDotState = 1;\r\n }\r\n }\r\n else if (startDot !== -1) {\r\n // We saw a non-dot and non-path separator before our dot, so we should\r\n // have a good chance at having a non-empty extension\r\n preDotState = -1;\r\n }\r\n }\r\n if (startDot === -1 ||\r\n end === -1 ||\r\n // We saw a non-dot character immediately before the dot\r\n preDotState === 0 ||\r\n // The (right-most) trimmed path component is exactly '..'\r\n (preDotState === 1 &&\r\n startDot === end - 1 &&\r\n startDot === startPart + 1)) {\r\n return '';\r\n }\r\n return path.slice(startDot, end);\r\n },\r\n format: _format.bind(null, '/'),\r\n parse(path) {\r\n validateString(path, 'path');\r\n const ret = { root: '', dir: '', base: '', ext: '', name: '' };\r\n if (path.length === 0) {\r\n return ret;\r\n }\r\n const isAbsolute = path.charCodeAt(0) === CHAR_FORWARD_SLASH;\r\n let start;\r\n if (isAbsolute) {\r\n ret.root = '/';\r\n start = 1;\r\n }\r\n else {\r\n start = 0;\r\n }\r\n let startDot = -1;\r\n let startPart = 0;\r\n let end = -1;\r\n let matchedSlash = true;\r\n let i = path.length - 1;\r\n // Track the state of characters (if any) we see before our first dot and\r\n // after any path separator we find\r\n let preDotState = 0;\r\n // Get non-dir info\r\n for (; i >= start; --i) {\r\n const code = path.charCodeAt(i);\r\n if (code === CHAR_FORWARD_SLASH) {\r\n // If we reached a path separator that was not part of a set of path\r\n // separators at the end of the string, stop now\r\n if (!matchedSlash) {\r\n startPart = i + 1;\r\n break;\r\n }\r\n continue;\r\n }\r\n if (end === -1) {\r\n // We saw the first non-path separator, mark this as the end of our\r\n // extension\r\n matchedSlash = false;\r\n end = i + 1;\r\n }\r\n if (code === CHAR_DOT) {\r\n // If this is our first dot, mark it as the start of our extension\r\n if (startDot === -1) {\r\n startDot = i;\r\n }\r\n else if (preDotState !== 1) {\r\n preDotState = 1;\r\n }\r\n }\r\n else if (startDot !== -1) {\r\n // We saw a non-dot and non-path separator before our dot, so we should\r\n // have a good chance at having a non-empty extension\r\n preDotState = -1;\r\n }\r\n }\r\n if (end !== -1) {\r\n const start = startPart === 0 && isAbsolute ? 1 : startPart;\r\n if (startDot === -1 ||\r\n // We saw a non-dot character immediately before the dot\r\n preDotState === 0 ||\r\n // The (right-most) trimmed path component is exactly '..'\r\n (preDotState === 1 &&\r\n startDot === end - 1 &&\r\n startDot === startPart + 1)) {\r\n ret.base = ret.name = path.slice(start, end);\r\n }\r\n else {\r\n ret.name = path.slice(start, startDot);\r\n ret.base = path.slice(start, end);\r\n ret.ext = path.slice(startDot, end);\r\n }\r\n }\r\n if (startPart > 0) {\r\n ret.dir = path.slice(0, startPart - 1);\r\n }\r\n else if (isAbsolute) {\r\n ret.dir = '/';\r\n }\r\n return ret;\r\n },\r\n sep: '/',\r\n delimiter: ':',\r\n win32: null,\r\n posix: null\r\n};\r\nposix.win32 = win32.win32 = win32;\r\nposix.posix = win32.posix = posix;\r\nexport const normalize = (process.platform === 'win32' ? win32.normalize : posix.normalize);\r\nexport const resolve = (process.platform === 'win32' ? win32.resolve : posix.resolve);\r\nexport const relative = (process.platform === 'win32' ? win32.relative : posix.relative);\r\nexport const dirname = (process.platform === 'win32' ? win32.dirname : posix.dirname);\r\nexport const basename = (process.platform === 'win32' ? win32.basename : posix.basename);\r\nexport const extname = (process.platform === 'win32' ? win32.extname : posix.extname);\r\nexport const sep = (process.platform === 'win32' ? win32.sep : posix.sep);\r\n", "/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License. See License.txt in the project root for license information.\r\n *--------------------------------------------------------------------------------------------*/\r\nimport { isWindows } from './platform.js';\r\nimport * as paths from './path.js';\r\nconst _schemePattern = /^\\w[\\w\\d+.-]*$/;\r\nconst _singleSlashStart = /^\\//;\r\nconst _doubleSlashStart = /^\\/\\//;\r\nfunction _validateUri(ret, _strict) {\r\n // scheme, must be set\r\n if (!ret.scheme && _strict) {\r\n throw new Error(`[UriError]: Scheme is missing: {scheme: \"\", authority: \"${ret.authority}\", path: \"${ret.path}\", query: \"${ret.query}\", fragment: \"${ret.fragment}\"}`);\r\n }\r\n // scheme, https://tools.ietf.org/html/rfc3986#section-3.1\r\n // ALPHA *( ALPHA / DIGIT / \"+\" / \"-\" / \".\" )\r\n if (ret.scheme && !_schemePattern.test(ret.scheme)) {\r\n throw new Error('[UriError]: Scheme contains illegal characters.');\r\n }\r\n // path, http://tools.ietf.org/html/rfc3986#section-3.3\r\n // If a URI contains an authority component, then the path component\r\n // must either be empty or begin with a slash (\"/\") character. If a URI\r\n // does not contain an authority component, then the path cannot begin\r\n // with two slash characters (\"//\").\r\n if (ret.path) {\r\n if (ret.authority) {\r\n if (!_singleSlashStart.test(ret.path)) {\r\n throw new Error('[UriError]: If a URI contains an authority component, then the path component must either be empty or begin with a slash (\"/\") character');\r\n }\r\n }\r\n else {\r\n if (_doubleSlashStart.test(ret.path)) {\r\n throw new Error('[UriError]: If a URI does not contain an authority component, then the path cannot begin with two slash characters (\"//\")');\r\n }\r\n }\r\n }\r\n}\r\n// for a while we allowed uris *without* schemes and this is the migration\r\n// for them, e.g. an uri without scheme and without strict-mode warns and falls\r\n// back to the file-scheme. that should cause the least carnage and still be a\r\n// clear warning\r\nfunction _schemeFix(scheme, _strict) {\r\n if (!scheme && !_strict) {\r\n return 'file';\r\n }\r\n return scheme;\r\n}\r\n// implements a bit of https://tools.ietf.org/html/rfc3986#section-5\r\nfunction _referenceResolution(scheme, path) {\r\n // the slash-character is our 'default base' as we don't\r\n // support constructing URIs relative to other URIs. This\r\n // also means that we alter and potentially break paths.\r\n // see https://tools.ietf.org/html/rfc3986#section-5.1.4\r\n switch (scheme) {\r\n case 'https':\r\n case 'http':\r\n case 'file':\r\n if (!path) {\r\n path = _slash;\r\n }\r\n else if (path[0] !== _slash) {\r\n path = _slash + path;\r\n }\r\n break;\r\n }\r\n return path;\r\n}\r\nconst _empty = '';\r\nconst _slash = '/';\r\nconst _regexp = /^(([^:/?#]+?):)?(\\/\\/([^/?#]*))?([^?#]*)(\\?([^#]*))?(#(.*))?/;\r\n/**\r\n * Uniform Resource Identifier (URI) http://tools.ietf.org/html/rfc3986.\r\n * This class is a simple parser which creates the basic component parts\r\n * (http://tools.ietf.org/html/rfc3986#section-3) with minimal validation\r\n * and encoding.\r\n *\r\n * ```txt\r\n * foo://example.com:8042/over/there?name=ferret#nose\r\n * \\_/ \\______________/\\_________/ \\_________/ \\__/\r\n * | | | | |\r\n * scheme authority path query fragment\r\n * | _____________________|__\r\n * / \\ / \\\r\n * urn:example:animal:ferret:nose\r\n * ```\r\n */\r\nexport class URI {\r\n /**\r\n * @internal\r\n */\r\n constructor(schemeOrData, authority, path, query, fragment, _strict = false) {\r\n if (typeof schemeOrData === 'object') {\r\n this.scheme = schemeOrData.scheme || _empty;\r\n this.authority = schemeOrData.authority || _empty;\r\n this.path = schemeOrData.path || _empty;\r\n this.query = schemeOrData.query || _empty;\r\n this.fragment = schemeOrData.fragment || _empty;\r\n // no validation because it's this URI\r\n // that creates uri components.\r\n // _validateUri(this);\r\n }\r\n else {\r\n this.scheme = _schemeFix(schemeOrData, _strict);\r\n this.authority = authority || _empty;\r\n this.path = _referenceResolution(this.scheme, path || _empty);\r\n this.query = query || _empty;\r\n this.fragment = fragment || _empty;\r\n _validateUri(this, _strict);\r\n }\r\n }\r\n static isUri(thing) {\r\n if (thing instanceof URI) {\r\n return true;\r\n }\r\n if (!thing) {\r\n return false;\r\n }\r\n return typeof thing.authority === 'string'\r\n && typeof thing.fragment === 'string'\r\n && typeof thing.path === 'string'\r\n && typeof thing.query === 'string'\r\n && typeof thing.scheme === 'string'\r\n && typeof thing.fsPath === 'string'\r\n && typeof thing.with === 'function'\r\n && typeof thing.toString === 'function';\r\n }\r\n // ---- filesystem path -----------------------\r\n /**\r\n * Returns a string representing the corresponding file system path of this URI.\r\n * Will handle UNC paths, normalizes windows drive letters to lower-case, and uses the\r\n * platform specific path separator.\r\n *\r\n * * Will *not* validate the path for invalid characters and semantics.\r\n * * Will *not* look at the scheme of this URI.\r\n * * The result shall *not* be used for display purposes but for accessing a file on disk.\r\n *\r\n *\r\n * The *difference* to `URI#path` is the use of the platform specific separator and the handling\r\n * of UNC paths. See the below sample of a file-uri with an authority (UNC path).\r\n *\r\n * ```ts\r\n const u = URI.parse('file://server/c$/folder/file.txt')\r\n u.authority === 'server'\r\n u.path === '/shares/c$/file.txt'\r\n u.fsPath === '\\\\server\\c$\\folder\\file.txt'\r\n ```\r\n *\r\n * Using `URI#path` to read a file (using fs-apis) would not be enough because parts of the path,\r\n * namely the server name, would be missing. Therefore `URI#fsPath` exists - it's sugar to ease working\r\n * with URIs that represent files on disk (`file` scheme).\r\n */\r\n get fsPath() {\r\n // if (this.scheme !== 'file') {\r\n // \tconsole.warn(`[UriError] calling fsPath with scheme ${this.scheme}`);\r\n // }\r\n return uriToFsPath(this, false);\r\n }\r\n // ---- modify to new -------------------------\r\n with(change) {\r\n if (!change) {\r\n return this;\r\n }\r\n let { scheme, authority, path, query, fragment } = change;\r\n if (scheme === undefined) {\r\n scheme = this.scheme;\r\n }\r\n else if (scheme === null) {\r\n scheme = _empty;\r\n }\r\n if (authority === undefined) {\r\n authority = this.authority;\r\n }\r\n else if (authority === null) {\r\n authority = _empty;\r\n }\r\n if (path === undefined) {\r\n path = this.path;\r\n }\r\n else if (path === null) {\r\n path = _empty;\r\n }\r\n if (query === undefined) {\r\n query = this.query;\r\n }\r\n else if (query === null) {\r\n query = _empty;\r\n }\r\n if (fragment === undefined) {\r\n fragment = this.fragment;\r\n }\r\n else if (fragment === null) {\r\n fragment = _empty;\r\n }\r\n if (scheme === this.scheme\r\n && authority === this.authority\r\n && path === this.path\r\n && query === this.query\r\n && fragment === this.fragment) {\r\n return this;\r\n }\r\n return new Uri(scheme, authority, path, query, fragment);\r\n }\r\n // ---- parse & validate ------------------------\r\n /**\r\n * Creates a new URI from a string, e.g. `http://www.msft.com/some/path`,\r\n * `file:///usr/home`, or `scheme:with/path`.\r\n *\r\n * @param value A string which represents an URI (see `URI#toString`).\r\n */\r\n static parse(value, _strict = false) {\r\n const match = _regexp.exec(value);\r\n if (!match) {\r\n return new Uri(_empty, _empty, _empty, _empty, _empty);\r\n }\r\n return new Uri(match[2] || _empty, percentDecode(match[4] || _empty), percentDecode(match[5] || _empty), percentDecode(match[7] || _empty), percentDecode(match[9] || _empty), _strict);\r\n }\r\n /**\r\n * Creates a new URI from a file system path, e.g. `c:\\my\\files`,\r\n * `/usr/home`, or `\\\\server\\share\\some\\path`.\r\n *\r\n * The *difference* between `URI#parse` and `URI#file` is that the latter treats the argument\r\n * as path, not as stringified-uri. E.g. `URI.file(path)` is **not the same as**\r\n * `URI.parse('file://' + path)` because the path might contain characters that are\r\n * interpreted (# and ?). See the following sample:\r\n * ```ts\r\n const good = URI.file('/coding/c#/project1');\r\n good.scheme === 'file';\r\n good.path === '/coding/c#/project1';\r\n good.fragment === '';\r\n const bad = URI.parse('file://' + '/coding/c#/project1');\r\n bad.scheme === 'file';\r\n bad.path === '/coding/c'; // path is now broken\r\n bad.fragment === '/project1';\r\n ```\r\n *\r\n * @param path A file system path (see `URI#fsPath`)\r\n */\r\n static file(path) {\r\n let authority = _empty;\r\n // normalize to fwd-slashes on windows,\r\n // on other systems bwd-slashes are valid\r\n // filename character, eg /f\\oo/ba\\r.txt\r\n if (isWindows) {\r\n path = path.replace(/\\\\/g, _slash);\r\n }\r\n // check for authority as used in UNC shares\r\n // or use the path as given\r\n if (path[0] === _slash && path[1] === _slash) {\r\n const idx = path.indexOf(_slash, 2);\r\n if (idx === -1) {\r\n authority = path.substring(2);\r\n path = _slash;\r\n }\r\n else {\r\n authority = path.substring(2, idx);\r\n path = path.substring(idx) || _slash;\r\n }\r\n }\r\n return new Uri('file', authority, path, _empty, _empty);\r\n }\r\n static from(components) {\r\n const result = new Uri(components.scheme, components.authority, components.path, components.query, components.fragment);\r\n _validateUri(result, true);\r\n return result;\r\n }\r\n /**\r\n * Join a URI path with path fragments and normalizes the resulting path.\r\n *\r\n * @param uri The input URI.\r\n * @param pathFragment The path fragment to add to the URI path.\r\n * @returns The resulting URI.\r\n */\r\n static joinPath(uri, ...pathFragment) {\r\n if (!uri.path) {\r\n throw new Error(`[UriError]: cannot call joinPath on URI without path`);\r\n }\r\n let newPath;\r\n if (isWindows && uri.scheme === 'file') {\r\n newPath = URI.file(paths.win32.join(uriToFsPath(uri, true), ...pathFragment)).path;\r\n }\r\n else {\r\n newPath = paths.posix.join(uri.path, ...pathFragment);\r\n }\r\n return uri.with({ path: newPath });\r\n }\r\n // ---- printing/externalize ---------------------------\r\n /**\r\n * Creates a string representation for this URI. It's guaranteed that calling\r\n * `URI.parse` with the result of this function creates an URI which is equal\r\n * to this URI.\r\n *\r\n * * The result shall *not* be used for display purposes but for externalization or transport.\r\n * * The result will be encoded using the percentage encoding and encoding happens mostly\r\n * ignore the scheme-specific encoding rules.\r\n *\r\n * @param skipEncoding Do not encode the result, default is `false`\r\n */\r\n toString(skipEncoding = false) {\r\n return _asFormatted(this, skipEncoding);\r\n }\r\n toJSON() {\r\n return this;\r\n }\r\n static revive(data) {\r\n if (!data) {\r\n return data;\r\n }\r\n else if (data instanceof URI) {\r\n return data;\r\n }\r\n else {\r\n const result = new Uri(data);\r\n result._formatted = data.external;\r\n result._fsPath = data._sep === _pathSepMarker ? data.fsPath : null;\r\n return result;\r\n }\r\n }\r\n}\r\nconst _pathSepMarker = isWindows ? 1 : undefined;\r\n// This class exists so that URI is compatibile with vscode.Uri (API).\r\nclass Uri extends URI {\r\n constructor() {\r\n super(...arguments);\r\n this._formatted = null;\r\n this._fsPath = null;\r\n }\r\n get fsPath() {\r\n if (!this._fsPath) {\r\n this._fsPath = uriToFsPath(this, false);\r\n }\r\n return this._fsPath;\r\n }\r\n toString(skipEncoding = false) {\r\n if (!skipEncoding) {\r\n if (!this._formatted) {\r\n this._formatted = _asFormatted(this, false);\r\n }\r\n return this._formatted;\r\n }\r\n else {\r\n // we don't cache that\r\n return _asFormatted(this, true);\r\n }\r\n }\r\n toJSON() {\r\n const res = {\r\n $mid: 1 /* Uri */\r\n };\r\n // cached state\r\n if (this._fsPath) {\r\n res.fsPath = this._fsPath;\r\n res._sep = _pathSepMarker;\r\n }\r\n if (this._formatted) {\r\n res.external = this._formatted;\r\n }\r\n // uri components\r\n if (this.path) {\r\n res.path = this.path;\r\n }\r\n if (this.scheme) {\r\n res.scheme = this.scheme;\r\n }\r\n if (this.authority) {\r\n res.authority = this.authority;\r\n }\r\n if (this.query) {\r\n res.query = this.query;\r\n }\r\n if (this.fragment) {\r\n res.fragment = this.fragment;\r\n }\r\n return res;\r\n }\r\n}\r\n// reserved characters: https://tools.ietf.org/html/rfc3986#section-2.2\r\nconst encodeTable = {\r\n [58 /* Colon */]: '%3A',\r\n [47 /* Slash */]: '%2F',\r\n [63 /* QuestionMark */]: '%3F',\r\n [35 /* Hash */]: '%23',\r\n [91 /* OpenSquareBracket */]: '%5B',\r\n [93 /* CloseSquareBracket */]: '%5D',\r\n [64 /* AtSign */]: '%40',\r\n [33 /* ExclamationMark */]: '%21',\r\n [36 /* DollarSign */]: '%24',\r\n [38 /* Ampersand */]: '%26',\r\n [39 /* SingleQuote */]: '%27',\r\n [40 /* OpenParen */]: '%28',\r\n [41 /* CloseParen */]: '%29',\r\n [42 /* Asterisk */]: '%2A',\r\n [43 /* Plus */]: '%2B',\r\n [44 /* Comma */]: '%2C',\r\n [59 /* Semicolon */]: '%3B',\r\n [61 /* Equals */]: '%3D',\r\n [32 /* Space */]: '%20',\r\n};\r\nfunction encodeURIComponentFast(uriComponent, allowSlash) {\r\n let res = undefined;\r\n let nativeEncodePos = -1;\r\n for (let pos = 0; pos < uriComponent.length; pos++) {\r\n const code = uriComponent.charCodeAt(pos);\r\n // unreserved characters: https://tools.ietf.org/html/rfc3986#section-2.3\r\n if ((code >= 97 /* a */ && code <= 122 /* z */)\r\n || (code >= 65 /* A */ && code <= 90 /* Z */)\r\n || (code >= 48 /* Digit0 */ && code <= 57 /* Digit9 */)\r\n || code === 45 /* Dash */\r\n || code === 46 /* Period */\r\n || code === 95 /* Underline */\r\n || code === 126 /* Tilde */\r\n || (allowSlash && code === 47 /* Slash */)) {\r\n // check if we are delaying native encode\r\n if (nativeEncodePos !== -1) {\r\n res += encodeURIComponent(uriComponent.substring(nativeEncodePos, pos));\r\n nativeEncodePos = -1;\r\n }\r\n // check if we write into a new string (by default we try to return the param)\r\n if (res !== undefined) {\r\n res += uriComponent.charAt(pos);\r\n }\r\n }\r\n else {\r\n // encoding needed, we need to allocate a new string\r\n if (res === undefined) {\r\n res = uriComponent.substr(0, pos);\r\n }\r\n // check with default table first\r\n const escaped = encodeTable[code];\r\n if (escaped !== undefined) {\r\n // check if we are delaying native encode\r\n if (nativeEncodePos !== -1) {\r\n res += encodeURIComponent(uriComponent.substring(nativeEncodePos, pos));\r\n nativeEncodePos = -1;\r\n }\r\n // append escaped variant to result\r\n res += escaped;\r\n }\r\n else if (nativeEncodePos === -1) {\r\n // use native encode only when needed\r\n nativeEncodePos = pos;\r\n }\r\n }\r\n }\r\n if (nativeEncodePos !== -1) {\r\n res += encodeURIComponent(uriComponent.substring(nativeEncodePos));\r\n }\r\n return res !== undefined ? res : uriComponent;\r\n}\r\nfunction encodeURIComponentMinimal(path) {\r\n let res = undefined;\r\n for (let pos = 0; pos < path.length; pos++) {\r\n const code = path.charCodeAt(pos);\r\n if (code === 35 /* Hash */ || code === 63 /* QuestionMark */) {\r\n if (res === undefined) {\r\n res = path.substr(0, pos);\r\n }\r\n res += encodeTable[code];\r\n }\r\n else {\r\n if (res !== undefined) {\r\n res += path[pos];\r\n }\r\n }\r\n }\r\n return res !== undefined ? res : path;\r\n}\r\n/**\r\n * Compute `fsPath` for the given uri\r\n */\r\nexport function uriToFsPath(uri, keepDriveLetterCasing) {\r\n let value;\r\n if (uri.authority && uri.path.length > 1 && uri.scheme === 'file') {\r\n // unc path: file://shares/c$/far/boo\r\n value = `//${uri.authority}${uri.path}`;\r\n }\r\n else if (uri.path.charCodeAt(0) === 47 /* Slash */\r\n && (uri.path.charCodeAt(1) >= 65 /* A */ && uri.path.charCodeAt(1) <= 90 /* Z */ || uri.path.charCodeAt(1) >= 97 /* a */ && uri.path.charCodeAt(1) <= 122 /* z */)\r\n && uri.path.charCodeAt(2) === 58 /* Colon */) {\r\n if (!keepDriveLetterCasing) {\r\n // windows drive letter: file:///c:/far/boo\r\n value = uri.path[1].toLowerCase() + uri.path.substr(2);\r\n }\r\n else {\r\n value = uri.path.substr(1);\r\n }\r\n }\r\n else {\r\n // other path\r\n value = uri.path;\r\n }\r\n if (isWindows) {\r\n value = value.replace(/\\//g, '\\\\');\r\n }\r\n return value;\r\n}\r\n/**\r\n * Create the external version of a uri\r\n */\r\nfunction _asFormatted(uri, skipEncoding) {\r\n const encoder = !skipEncoding\r\n ? encodeURIComponentFast\r\n : encodeURIComponentMinimal;\r\n let res = '';\r\n let { scheme, authority, path, query, fragment } = uri;\r\n if (scheme) {\r\n res += scheme;\r\n res += ':';\r\n }\r\n if (authority || scheme === 'file') {\r\n res += _slash;\r\n res += _slash;\r\n }\r\n if (authority) {\r\n let idx = authority.indexOf('@');\r\n if (idx !== -1) {\r\n // @\r\n const userinfo = authority.substr(0, idx);\r\n authority = authority.substr(idx + 1);\r\n idx = userinfo.indexOf(':');\r\n if (idx === -1) {\r\n res += encoder(userinfo, false);\r\n }\r\n else {\r\n // :@\r\n res += encoder(userinfo.substr(0, idx), false);\r\n res += ':';\r\n res += encoder(userinfo.substr(idx + 1), false);\r\n }\r\n res += '@';\r\n }\r\n authority = authority.toLowerCase();\r\n idx = authority.indexOf(':');\r\n if (idx === -1) {\r\n res += encoder(authority, false);\r\n }\r\n else {\r\n // :\r\n res += encoder(authority.substr(0, idx), false);\r\n res += authority.substr(idx);\r\n }\r\n }\r\n if (path) {\r\n // lower-case windows drive letters in /C:/fff or C:/fff\r\n if (path.length >= 3 && path.charCodeAt(0) === 47 /* Slash */ && path.charCodeAt(2) === 58 /* Colon */) {\r\n const code = path.charCodeAt(1);\r\n if (code >= 65 /* A */ && code <= 90 /* Z */) {\r\n path = `/${String.fromCharCode(code + 32)}:${path.substr(3)}`; // \"/c:\".length === 3\r\n }\r\n }\r\n else if (path.length >= 2 && path.charCodeAt(1) === 58 /* Colon */) {\r\n const code = path.charCodeAt(0);\r\n if (code >= 65 /* A */ && code <= 90 /* Z */) {\r\n path = `${String.fromCharCode(code + 32)}:${path.substr(2)}`; // \"/c:\".length === 3\r\n }\r\n }\r\n // encode the rest of the path\r\n res += encoder(path, true);\r\n }\r\n if (query) {\r\n res += '?';\r\n res += encoder(query, false);\r\n }\r\n if (fragment) {\r\n res += '#';\r\n res += !skipEncoding ? encodeURIComponentFast(fragment, false) : fragment;\r\n }\r\n return res;\r\n}\r\n// --- decode\r\nfunction decodeURIComponentGraceful(str) {\r\n try {\r\n return decodeURIComponent(str);\r\n }\r\n catch (_a) {\r\n if (str.length > 3) {\r\n return str.substr(0, 3) + decodeURIComponentGraceful(str.substr(3));\r\n }\r\n else {\r\n return str;\r\n }\r\n }\r\n}\r\nconst _rEncodedAsHex = /(%[0-9A-Za-z][0-9A-Za-z])+/g;\r\nfunction percentDecode(str) {\r\n if (!str.match(_rEncodedAsHex)) {\r\n return str;\r\n }\r\n return str.replace(_rEncodedAsHex, (match) => decodeURIComponentGraceful(match));\r\n}\r\n", "/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License. See License.txt in the project root for license information.\r\n *--------------------------------------------------------------------------------------------*/\r\nimport { URI } from './uri.js';\r\nimport * as platform from './platform.js';\r\nexport var Schemas;\r\n(function (Schemas) {\r\n /**\r\n * A schema that is used for models that exist in memory\r\n * only and that have no correspondence on a server or such.\r\n */\r\n Schemas.inMemory = 'inmemory';\r\n /**\r\n * A schema that is used for setting files\r\n */\r\n Schemas.vscode = 'vscode';\r\n /**\r\n * A schema that is used for internal private files\r\n */\r\n Schemas.internal = 'private';\r\n /**\r\n * A walk-through document.\r\n */\r\n Schemas.walkThrough = 'walkThrough';\r\n /**\r\n * An embedded code snippet.\r\n */\r\n Schemas.walkThroughSnippet = 'walkThroughSnippet';\r\n Schemas.http = 'http';\r\n Schemas.https = 'https';\r\n Schemas.file = 'file';\r\n Schemas.mailto = 'mailto';\r\n Schemas.untitled = 'untitled';\r\n Schemas.data = 'data';\r\n Schemas.command = 'command';\r\n Schemas.vscodeRemote = 'vscode-remote';\r\n Schemas.vscodeRemoteResource = 'vscode-remote-resource';\r\n Schemas.userData = 'vscode-userdata';\r\n Schemas.vscodeCustomEditor = 'vscode-custom-editor';\r\n Schemas.vscodeNotebook = 'vscode-notebook';\r\n Schemas.vscodeNotebookCell = 'vscode-notebook-cell';\r\n Schemas.vscodeNotebookCellMetadata = 'vscode-notebook-cell-metadata';\r\n Schemas.vscodeNotebookCellOutput = 'vscode-notebook-cell-output';\r\n Schemas.vscodeInteractive = 'vscode-interactive';\r\n Schemas.vscodeInteractiveInput = 'vscode-interactive-input';\r\n Schemas.vscodeSettings = 'vscode-settings';\r\n Schemas.vscodeWorkspaceTrust = 'vscode-workspace-trust';\r\n Schemas.vscodeTerminal = 'vscode-terminal';\r\n Schemas.webviewPanel = 'webview-panel';\r\n /**\r\n * Scheme used for loading the wrapper html and script in webviews.\r\n */\r\n Schemas.vscodeWebview = 'vscode-webview';\r\n /**\r\n * Scheme used for extension pages\r\n */\r\n Schemas.extension = 'extension';\r\n /**\r\n * Scheme used as a replacement of `file` scheme to load\r\n * files with our custom protocol handler (desktop only).\r\n */\r\n Schemas.vscodeFileResource = 'vscode-file';\r\n /**\r\n * Scheme used for temporary resources\r\n */\r\n Schemas.tmp = 'tmp';\r\n})(Schemas || (Schemas = {}));\r\nclass RemoteAuthoritiesImpl {\r\n constructor() {\r\n this._hosts = Object.create(null);\r\n this._ports = Object.create(null);\r\n this._connectionTokens = Object.create(null);\r\n this._preferredWebSchema = 'http';\r\n this._delegate = null;\r\n }\r\n setPreferredWebSchema(schema) {\r\n this._preferredWebSchema = schema;\r\n }\r\n rewrite(uri) {\r\n if (this._delegate) {\r\n return this._delegate(uri);\r\n }\r\n const authority = uri.authority;\r\n let host = this._hosts[authority];\r\n if (host && host.indexOf(':') !== -1) {\r\n host = `[${host}]`;\r\n }\r\n const port = this._ports[authority];\r\n const connectionToken = this._connectionTokens[authority];\r\n let query = `path=${encodeURIComponent(uri.path)}`;\r\n if (typeof connectionToken === 'string') {\r\n query += `&tkn=${encodeURIComponent(connectionToken)}`;\r\n }\r\n return URI.from({\r\n scheme: platform.isWeb ? this._preferredWebSchema : Schemas.vscodeRemoteResource,\r\n authority: `${host}:${port}`,\r\n path: `/vscode-remote-resource`,\r\n query\r\n });\r\n }\r\n}\r\nexport const RemoteAuthorities = new RemoteAuthoritiesImpl();\r\nclass FileAccessImpl {\r\n constructor() {\r\n this.FALLBACK_AUTHORITY = 'vscode-app';\r\n }\r\n asBrowserUri(uriOrModule, moduleIdToUrl, __forceCodeFileUri) {\r\n const uri = this.toUri(uriOrModule, moduleIdToUrl);\r\n // Handle remote URIs via `RemoteAuthorities`\r\n if (uri.scheme === Schemas.vscodeRemote) {\r\n return RemoteAuthorities.rewrite(uri);\r\n }\r\n let convertToVSCodeFileResource = false;\r\n // Only convert the URI if we are in a native context and it has `file:` scheme\r\n // and we have explicitly enabled the conversion (sandbox, or VSCODE_BROWSER_CODE_LOADING)\r\n if (platform.isNative && (__forceCodeFileUri || platform.isPreferringBrowserCodeLoad) && uri.scheme === Schemas.file) {\r\n convertToVSCodeFileResource = true;\r\n }\r\n // Also convert `file:` URIs in the web worker extension host (running in desktop) case\r\n if (uri.scheme === Schemas.file && typeof platform.globals.importScripts === 'function' && platform.globals.origin === 'vscode-file://vscode-app') {\r\n convertToVSCodeFileResource = true;\r\n }\r\n if (convertToVSCodeFileResource) {\r\n return uri.with({\r\n scheme: Schemas.vscodeFileResource,\r\n // We need to provide an authority here so that it can serve\r\n // as origin for network and loading matters in chromium.\r\n // If the URI is not coming with an authority already, we\r\n // add our own\r\n authority: uri.authority || this.FALLBACK_AUTHORITY,\r\n query: null,\r\n fragment: null\r\n });\r\n }\r\n return uri;\r\n }\r\n toUri(uriOrModule, moduleIdToUrl) {\r\n if (URI.isUri(uriOrModule)) {\r\n return uriOrModule;\r\n }\r\n return URI.parse(moduleIdToUrl.toUrl(uriOrModule));\r\n }\r\n}\r\nexport const FileAccess = new FileAccessImpl();\r\n", "/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License. See License.txt in the project root for license information.\r\n *--------------------------------------------------------------------------------------------*/\r\nimport * as browser from './browser.js';\r\nimport * as platform from '../common/platform.js';\r\n/**\r\n * Browser feature we can support in current platform, browser and environment.\r\n */\r\nexport const BrowserFeatures = {\r\n clipboard: {\r\n writeText: (platform.isNative\r\n || (document.queryCommandSupported && document.queryCommandSupported('copy'))\r\n || !!(navigator && navigator.clipboard && navigator.clipboard.writeText)),\r\n readText: (platform.isNative\r\n || !!(navigator && navigator.clipboard && navigator.clipboard.readText))\r\n },\r\n keyboard: (() => {\r\n if (platform.isNative || browser.isStandalone) {\r\n return 0 /* Always */;\r\n }\r\n if (navigator.keyboard || browser.isSafari) {\r\n return 1 /* FullScreen */;\r\n }\r\n return 2 /* None */;\r\n })(),\r\n // 'ontouchstart' in window always evaluates to true with typescript's modern typings. This causes `window` to be\r\n // `never` later in `window.navigator`. That's why we need the explicit `window as Window` cast\r\n touch: 'ontouchstart' in window || navigator.maxTouchPoints > 0,\r\n pointerEvents: window.PointerEvent && ('ontouchstart' in window || window.navigator.maxTouchPoints > 0 || navigator.maxTouchPoints > 0)\r\n};\r\n", "/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License. See License.txt in the project root for license information.\r\n *--------------------------------------------------------------------------------------------*/\r\nimport * as browser from './browser.js';\r\nimport { StandardKeyboardEvent } from './keyboardEvent.js';\r\nimport { StandardMouseEvent } from './mouseEvent.js';\r\nimport { TimeoutTimer } from '../common/async.js';\r\nimport { onUnexpectedError } from '../common/errors.js';\r\nimport { Emitter } from '../common/event.js';\r\nimport { Disposable, DisposableStore, toDisposable } from '../common/lifecycle.js';\r\nimport * as platform from '../common/platform.js';\r\nimport { FileAccess, RemoteAuthorities } from '../common/network.js';\r\nimport { BrowserFeatures } from './canIUse.js';\r\nexport function clearNode(node) {\r\n while (node.firstChild) {\r\n node.firstChild.remove();\r\n }\r\n}\r\n/**\r\n * @deprecated Use node.isConnected directly\r\n */\r\nexport function isInDOM(node) {\r\n var _a;\r\n return (_a = node === null || node === void 0 ? void 0 : node.isConnected) !== null && _a !== void 0 ? _a : false;\r\n}\r\nclass DomListener {\r\n constructor(node, type, handler, options) {\r\n this._node = node;\r\n this._type = type;\r\n this._handler = handler;\r\n this._options = (options || false);\r\n this._node.addEventListener(this._type, this._handler, this._options);\r\n }\r\n dispose() {\r\n if (!this._handler) {\r\n // Already disposed\r\n return;\r\n }\r\n this._node.removeEventListener(this._type, this._handler, this._options);\r\n // Prevent leakers from holding on to the dom or handler func\r\n this._node = null;\r\n this._handler = null;\r\n }\r\n}\r\nexport function addDisposableListener(node, type, handler, useCaptureOrOptions) {\r\n return new DomListener(node, type, handler, useCaptureOrOptions);\r\n}\r\nfunction _wrapAsStandardMouseEvent(handler) {\r\n return function (e) {\r\n return handler(new StandardMouseEvent(e));\r\n };\r\n}\r\nfunction _wrapAsStandardKeyboardEvent(handler) {\r\n return function (e) {\r\n return handler(new StandardKeyboardEvent(e));\r\n };\r\n}\r\nexport let addStandardDisposableListener = function addStandardDisposableListener(node, type, handler, useCapture) {\r\n let wrapHandler = handler;\r\n if (type === 'click' || type === 'mousedown') {\r\n wrapHandler = _wrapAsStandardMouseEvent(handler);\r\n }\r\n else if (type === 'keydown' || type === 'keypress' || type === 'keyup') {\r\n wrapHandler = _wrapAsStandardKeyboardEvent(handler);\r\n }\r\n return addDisposableListener(node, type, wrapHandler, useCapture);\r\n};\r\nexport let addStandardDisposableGenericMouseDownListner = function addStandardDisposableListener(node, handler, useCapture) {\r\n let wrapHandler = _wrapAsStandardMouseEvent(handler);\r\n return addDisposableGenericMouseDownListner(node, wrapHandler, useCapture);\r\n};\r\nexport function addDisposableGenericMouseDownListner(node, handler, useCapture) {\r\n return addDisposableListener(node, platform.isIOS && BrowserFeatures.pointerEvents ? EventType.POINTER_DOWN : EventType.MOUSE_DOWN, handler, useCapture);\r\n}\r\nexport function addDisposableGenericMouseUpListner(node, handler, useCapture) {\r\n return addDisposableListener(node, platform.isIOS && BrowserFeatures.pointerEvents ? EventType.POINTER_UP : EventType.MOUSE_UP, handler, useCapture);\r\n}\r\nexport function addDisposableNonBubblingMouseOutListener(node, handler) {\r\n return addDisposableListener(node, 'mouseout', (e) => {\r\n // Mouse out bubbles, so this is an attempt to ignore faux mouse outs coming from children elements\r\n let toElement = (e.relatedTarget);\r\n while (toElement && toElement !== node) {\r\n toElement = toElement.parentNode;\r\n }\r\n if (toElement === node) {\r\n return;\r\n }\r\n handler(e);\r\n });\r\n}\r\nexport function addDisposableNonBubblingPointerOutListener(node, handler) {\r\n return addDisposableListener(node, 'pointerout', (e) => {\r\n // Mouse out bubbles, so this is an attempt to ignore faux mouse outs coming from children elements\r\n let toElement = (e.relatedTarget);\r\n while (toElement && toElement !== node) {\r\n toElement = toElement.parentNode;\r\n }\r\n if (toElement === node) {\r\n return;\r\n }\r\n handler(e);\r\n });\r\n}\r\nlet _animationFrame = null;\r\nfunction doRequestAnimationFrame(callback) {\r\n if (!_animationFrame) {\r\n const emulatedRequestAnimationFrame = (callback) => {\r\n return setTimeout(() => callback(new Date().getTime()), 0);\r\n };\r\n _animationFrame = (self.requestAnimationFrame\r\n || self.msRequestAnimationFrame\r\n || self.webkitRequestAnimationFrame\r\n || self.mozRequestAnimationFrame\r\n || self.oRequestAnimationFrame\r\n || emulatedRequestAnimationFrame);\r\n }\r\n return _animationFrame.call(self, callback);\r\n}\r\n/**\r\n * Schedule a callback to be run at the next animation frame.\r\n * This allows multiple parties to register callbacks that should run at the next animation frame.\r\n * If currently in an animation frame, `runner` will be executed immediately.\r\n * @return token that can be used to cancel the scheduled runner (only if `runner` was not executed immediately).\r\n */\r\nexport let runAtThisOrScheduleAtNextAnimationFrame;\r\n/**\r\n * Schedule a callback to be run at the next animation frame.\r\n * This allows multiple parties to register callbacks that should run at the next animation frame.\r\n * If currently in an animation frame, `runner` will be executed at the next animation frame.\r\n * @return token that can be used to cancel the scheduled runner.\r\n */\r\nexport let scheduleAtNextAnimationFrame;\r\nclass AnimationFrameQueueItem {\r\n constructor(runner, priority = 0) {\r\n this._runner = runner;\r\n this.priority = priority;\r\n this._canceled = false;\r\n }\r\n dispose() {\r\n this._canceled = true;\r\n }\r\n execute() {\r\n if (this._canceled) {\r\n return;\r\n }\r\n try {\r\n this._runner();\r\n }\r\n catch (e) {\r\n onUnexpectedError(e);\r\n }\r\n }\r\n // Sort by priority (largest to lowest)\r\n static sort(a, b) {\r\n return b.priority - a.priority;\r\n }\r\n}\r\n(function () {\r\n /**\r\n * The runners scheduled at the next animation frame\r\n */\r\n let NEXT_QUEUE = [];\r\n /**\r\n * The runners scheduled at the current animation frame\r\n */\r\n let CURRENT_QUEUE = null;\r\n /**\r\n * A flag to keep track if the native requestAnimationFrame was already called\r\n */\r\n let animFrameRequested = false;\r\n /**\r\n * A flag to indicate if currently handling a native requestAnimationFrame callback\r\n */\r\n let inAnimationFrameRunner = false;\r\n let animationFrameRunner = () => {\r\n animFrameRequested = false;\r\n CURRENT_QUEUE = NEXT_QUEUE;\r\n NEXT_QUEUE = [];\r\n inAnimationFrameRunner = true;\r\n while (CURRENT_QUEUE.length > 0) {\r\n CURRENT_QUEUE.sort(AnimationFrameQueueItem.sort);\r\n let top = CURRENT_QUEUE.shift();\r\n top.execute();\r\n }\r\n inAnimationFrameRunner = false;\r\n };\r\n scheduleAtNextAnimationFrame = (runner, priority = 0) => {\r\n let item = new AnimationFrameQueueItem(runner, priority);\r\n NEXT_QUEUE.push(item);\r\n if (!animFrameRequested) {\r\n animFrameRequested = true;\r\n doRequestAnimationFrame(animationFrameRunner);\r\n }\r\n return item;\r\n };\r\n runAtThisOrScheduleAtNextAnimationFrame = (runner, priority) => {\r\n if (inAnimationFrameRunner) {\r\n let item = new AnimationFrameQueueItem(runner, priority);\r\n CURRENT_QUEUE.push(item);\r\n return item;\r\n }\r\n else {\r\n return scheduleAtNextAnimationFrame(runner, priority);\r\n }\r\n };\r\n})();\r\nconst MINIMUM_TIME_MS = 8;\r\nconst DEFAULT_EVENT_MERGER = function (lastEvent, currentEvent) {\r\n return currentEvent;\r\n};\r\nclass TimeoutThrottledDomListener extends Disposable {\r\n constructor(node, type, handler, eventMerger = DEFAULT_EVENT_MERGER, minimumTimeMs = MINIMUM_TIME_MS) {\r\n super();\r\n let lastEvent = null;\r\n let lastHandlerTime = 0;\r\n let timeout = this._register(new TimeoutTimer());\r\n let invokeHandler = () => {\r\n lastHandlerTime = (new Date()).getTime();\r\n handler(lastEvent);\r\n lastEvent = null;\r\n };\r\n this._register(addDisposableListener(node, type, (e) => {\r\n lastEvent = eventMerger(lastEvent, e);\r\n let elapsedTime = (new Date()).getTime() - lastHandlerTime;\r\n if (elapsedTime >= minimumTimeMs) {\r\n timeout.cancel();\r\n invokeHandler();\r\n }\r\n else {\r\n timeout.setIfNotSet(invokeHandler, minimumTimeMs - elapsedTime);\r\n }\r\n }));\r\n }\r\n}\r\nexport function addDisposableThrottledListener(node, type, handler, eventMerger, minimumTimeMs) {\r\n return new TimeoutThrottledDomListener(node, type, handler, eventMerger, minimumTimeMs);\r\n}\r\nexport function getComputedStyle(el) {\r\n return document.defaultView.getComputedStyle(el, null);\r\n}\r\nexport function getClientArea(element) {\r\n // Try with DOM clientWidth / clientHeight\r\n if (element !== document.body) {\r\n return new Dimension(element.clientWidth, element.clientHeight);\r\n }\r\n // If visual view port exits and it's on mobile, it should be used instead of window innerWidth / innerHeight, or document.body.clientWidth / document.body.clientHeight\r\n if (platform.isIOS && window.visualViewport) {\r\n return new Dimension(window.visualViewport.width, window.visualViewport.height);\r\n }\r\n // Try innerWidth / innerHeight\r\n if (window.innerWidth && window.innerHeight) {\r\n return new Dimension(window.innerWidth, window.innerHeight);\r\n }\r\n // Try with document.body.clientWidth / document.body.clientHeight\r\n if (document.body && document.body.clientWidth && document.body.clientHeight) {\r\n return new Dimension(document.body.clientWidth, document.body.clientHeight);\r\n }\r\n // Try with document.documentElement.clientWidth / document.documentElement.clientHeight\r\n if (document.documentElement && document.documentElement.clientWidth && document.documentElement.clientHeight) {\r\n return new Dimension(document.documentElement.clientWidth, document.documentElement.clientHeight);\r\n }\r\n throw new Error('Unable to figure out browser width and height');\r\n}\r\nclass SizeUtils {\r\n // Adapted from WinJS\r\n // Converts a CSS positioning string for the specified element to pixels.\r\n static convertToPixels(element, value) {\r\n return parseFloat(value) || 0;\r\n }\r\n static getDimension(element, cssPropertyName, jsPropertyName) {\r\n let computedStyle = getComputedStyle(element);\r\n let value = '0';\r\n if (computedStyle) {\r\n if (computedStyle.getPropertyValue) {\r\n value = computedStyle.getPropertyValue(cssPropertyName);\r\n }\r\n else {\r\n // IE8\r\n value = computedStyle.getAttribute(jsPropertyName);\r\n }\r\n }\r\n return SizeUtils.convertToPixels(element, value);\r\n }\r\n static getBorderLeftWidth(element) {\r\n return SizeUtils.getDimension(element, 'border-left-width', 'borderLeftWidth');\r\n }\r\n static getBorderRightWidth(element) {\r\n return SizeUtils.getDimension(element, 'border-right-width', 'borderRightWidth');\r\n }\r\n static getBorderTopWidth(element) {\r\n return SizeUtils.getDimension(element, 'border-top-width', 'borderTopWidth');\r\n }\r\n static getBorderBottomWidth(element) {\r\n return SizeUtils.getDimension(element, 'border-bottom-width', 'borderBottomWidth');\r\n }\r\n static getPaddingLeft(element) {\r\n return SizeUtils.getDimension(element, 'padding-left', 'paddingLeft');\r\n }\r\n static getPaddingRight(element) {\r\n return SizeUtils.getDimension(element, 'padding-right', 'paddingRight');\r\n }\r\n static getPaddingTop(element) {\r\n return SizeUtils.getDimension(element, 'padding-top', 'paddingTop');\r\n }\r\n static getPaddingBottom(element) {\r\n return SizeUtils.getDimension(element, 'padding-bottom', 'paddingBottom');\r\n }\r\n static getMarginLeft(element) {\r\n return SizeUtils.getDimension(element, 'margin-left', 'marginLeft');\r\n }\r\n static getMarginTop(element) {\r\n return SizeUtils.getDimension(element, 'margin-top', 'marginTop');\r\n }\r\n static getMarginRight(element) {\r\n return SizeUtils.getDimension(element, 'margin-right', 'marginRight');\r\n }\r\n static getMarginBottom(element) {\r\n return SizeUtils.getDimension(element, 'margin-bottom', 'marginBottom');\r\n }\r\n}\r\nexport class Dimension {\r\n constructor(width, height) {\r\n this.width = width;\r\n this.height = height;\r\n }\r\n with(width = this.width, height = this.height) {\r\n if (width !== this.width || height !== this.height) {\r\n return new Dimension(width, height);\r\n }\r\n else {\r\n return this;\r\n }\r\n }\r\n static is(obj) {\r\n return typeof obj === 'object' && typeof obj.height === 'number' && typeof obj.width === 'number';\r\n }\r\n static lift(obj) {\r\n if (obj instanceof Dimension) {\r\n return obj;\r\n }\r\n else {\r\n return new Dimension(obj.width, obj.height);\r\n }\r\n }\r\n static equals(a, b) {\r\n if (a === b) {\r\n return true;\r\n }\r\n if (!a || !b) {\r\n return false;\r\n }\r\n return a.width === b.width && a.height === b.height;\r\n }\r\n}\r\nexport function getTopLeftOffset(element) {\r\n // Adapted from WinJS.Utilities.getPosition\r\n // and added borders to the mix\r\n let offsetParent = element.offsetParent;\r\n let top = element.offsetTop;\r\n let left = element.offsetLeft;\r\n while ((element = element.parentNode) !== null\r\n && element !== document.body\r\n && element !== document.documentElement) {\r\n top -= element.scrollTop;\r\n const c = isShadowRoot(element) ? null : getComputedStyle(element);\r\n if (c) {\r\n left -= c.direction !== 'rtl' ? element.scrollLeft : -element.scrollLeft;\r\n }\r\n if (element === offsetParent) {\r\n left += SizeUtils.getBorderLeftWidth(element);\r\n top += SizeUtils.getBorderTopWidth(element);\r\n top += element.offsetTop;\r\n left += element.offsetLeft;\r\n offsetParent = element.offsetParent;\r\n }\r\n }\r\n return {\r\n left: left,\r\n top: top\r\n };\r\n}\r\nexport function size(element, width, height) {\r\n if (typeof width === 'number') {\r\n element.style.width = `${width}px`;\r\n }\r\n if (typeof height === 'number') {\r\n element.style.height = `${height}px`;\r\n }\r\n}\r\n/**\r\n * Returns the position of a dom node relative to the entire page.\r\n */\r\nexport function getDomNodePagePosition(domNode) {\r\n let bb = domNode.getBoundingClientRect();\r\n return {\r\n left: bb.left + StandardWindow.scrollX,\r\n top: bb.top + StandardWindow.scrollY,\r\n width: bb.width,\r\n height: bb.height\r\n };\r\n}\r\nexport const StandardWindow = new class {\r\n get scrollX() {\r\n if (typeof window.scrollX === 'number') {\r\n // modern browsers\r\n return window.scrollX;\r\n }\r\n else {\r\n return document.body.scrollLeft + document.documentElement.scrollLeft;\r\n }\r\n }\r\n get scrollY() {\r\n if (typeof window.scrollY === 'number') {\r\n // modern browsers\r\n return window.scrollY;\r\n }\r\n else {\r\n return document.body.scrollTop + document.documentElement.scrollTop;\r\n }\r\n }\r\n};\r\n// Adapted from WinJS\r\n// Gets the width of the element, including margins.\r\nexport function getTotalWidth(element) {\r\n let margin = SizeUtils.getMarginLeft(element) + SizeUtils.getMarginRight(element);\r\n return element.offsetWidth + margin;\r\n}\r\nexport function getContentWidth(element) {\r\n let border = SizeUtils.getBorderLeftWidth(element) + SizeUtils.getBorderRightWidth(element);\r\n let padding = SizeUtils.getPaddingLeft(element) + SizeUtils.getPaddingRight(element);\r\n return element.offsetWidth - border - padding;\r\n}\r\n// Adapted from WinJS\r\n// Gets the height of the content of the specified element. The content height does not include borders or padding.\r\nexport function getContentHeight(element) {\r\n let border = SizeUtils.getBorderTopWidth(element) + SizeUtils.getBorderBottomWidth(element);\r\n let padding = SizeUtils.getPaddingTop(element) + SizeUtils.getPaddingBottom(element);\r\n return element.offsetHeight - border - padding;\r\n}\r\n// Adapted from WinJS\r\n// Gets the height of the element, including its margins.\r\nexport function getTotalHeight(element) {\r\n let margin = SizeUtils.getMarginTop(element) + SizeUtils.getMarginBottom(element);\r\n return element.offsetHeight + margin;\r\n}\r\n// ----------------------------------------------------------------------------------------\r\nexport function isAncestor(testChild, testAncestor) {\r\n while (testChild) {\r\n if (testChild === testAncestor) {\r\n return true;\r\n }\r\n testChild = testChild.parentNode;\r\n }\r\n return false;\r\n}\r\nexport function findParentWithClass(node, clazz, stopAtClazzOrNode) {\r\n while (node && node.nodeType === node.ELEMENT_NODE) {\r\n if (node.classList.contains(clazz)) {\r\n return node;\r\n }\r\n if (stopAtClazzOrNode) {\r\n if (typeof stopAtClazzOrNode === 'string') {\r\n if (node.classList.contains(stopAtClazzOrNode)) {\r\n return null;\r\n }\r\n }\r\n else {\r\n if (node === stopAtClazzOrNode) {\r\n return null;\r\n }\r\n }\r\n }\r\n node = node.parentNode;\r\n }\r\n return null;\r\n}\r\nexport function hasParentWithClass(node, clazz, stopAtClazzOrNode) {\r\n return !!findParentWithClass(node, clazz, stopAtClazzOrNode);\r\n}\r\nexport function isShadowRoot(node) {\r\n return (node && !!node.host && !!node.mode);\r\n}\r\nexport function isInShadowDOM(domNode) {\r\n return !!getShadowRoot(domNode);\r\n}\r\nexport function getShadowRoot(domNode) {\r\n while (domNode.parentNode) {\r\n if (domNode === document.body) {\r\n // reached the body\r\n return null;\r\n }\r\n domNode = domNode.parentNode;\r\n }\r\n return isShadowRoot(domNode) ? domNode : null;\r\n}\r\nexport function getActiveElement() {\r\n let result = document.activeElement;\r\n while (result === null || result === void 0 ? void 0 : result.shadowRoot) {\r\n result = result.shadowRoot.activeElement;\r\n }\r\n return result;\r\n}\r\nexport function createStyleSheet(container = document.getElementsByTagName('head')[0]) {\r\n let style = document.createElement('style');\r\n style.type = 'text/css';\r\n style.media = 'screen';\r\n container.appendChild(style);\r\n return style;\r\n}\r\nlet _sharedStyleSheet = null;\r\nfunction getSharedStyleSheet() {\r\n if (!_sharedStyleSheet) {\r\n _sharedStyleSheet = createStyleSheet();\r\n }\r\n return _sharedStyleSheet;\r\n}\r\nfunction getDynamicStyleSheetRules(style) {\r\n var _a, _b;\r\n if ((_a = style === null || style === void 0 ? void 0 : style.sheet) === null || _a === void 0 ? void 0 : _a.rules) {\r\n // Chrome, IE\r\n return style.sheet.rules;\r\n }\r\n if ((_b = style === null || style === void 0 ? void 0 : style.sheet) === null || _b === void 0 ? void 0 : _b.cssRules) {\r\n // FF\r\n return style.sheet.cssRules;\r\n }\r\n return [];\r\n}\r\nexport function createCSSRule(selector, cssText, style = getSharedStyleSheet()) {\r\n if (!style || !cssText) {\r\n return;\r\n }\r\n style.sheet.insertRule(selector + '{' + cssText + '}', 0);\r\n}\r\nexport function removeCSSRulesContainingSelector(ruleName, style = getSharedStyleSheet()) {\r\n if (!style) {\r\n return;\r\n }\r\n let rules = getDynamicStyleSheetRules(style);\r\n let toDelete = [];\r\n for (let i = 0; i < rules.length; i++) {\r\n let rule = rules[i];\r\n if (rule.selectorText.indexOf(ruleName) !== -1) {\r\n toDelete.push(i);\r\n }\r\n }\r\n for (let i = toDelete.length - 1; i >= 0; i--) {\r\n style.sheet.deleteRule(toDelete[i]);\r\n }\r\n}\r\nexport function isHTMLElement(o) {\r\n if (typeof HTMLElement === 'object') {\r\n return o instanceof HTMLElement;\r\n }\r\n return o && typeof o === 'object' && o.nodeType === 1 && typeof o.nodeName === 'string';\r\n}\r\nexport const EventType = {\r\n // Mouse\r\n CLICK: 'click',\r\n AUXCLICK: 'auxclick',\r\n DBLCLICK: 'dblclick',\r\n MOUSE_UP: 'mouseup',\r\n MOUSE_DOWN: 'mousedown',\r\n MOUSE_OVER: 'mouseover',\r\n MOUSE_MOVE: 'mousemove',\r\n MOUSE_OUT: 'mouseout',\r\n MOUSE_ENTER: 'mouseenter',\r\n MOUSE_LEAVE: 'mouseleave',\r\n MOUSE_WHEEL: 'wheel',\r\n POINTER_UP: 'pointerup',\r\n POINTER_DOWN: 'pointerdown',\r\n POINTER_MOVE: 'pointermove',\r\n CONTEXT_MENU: 'contextmenu',\r\n WHEEL: 'wheel',\r\n // Keyboard\r\n KEY_DOWN: 'keydown',\r\n KEY_PRESS: 'keypress',\r\n KEY_UP: 'keyup',\r\n // HTML Document\r\n LOAD: 'load',\r\n BEFORE_UNLOAD: 'beforeunload',\r\n UNLOAD: 'unload',\r\n ABORT: 'abort',\r\n ERROR: 'error',\r\n RESIZE: 'resize',\r\n SCROLL: 'scroll',\r\n FULLSCREEN_CHANGE: 'fullscreenchange',\r\n WK_FULLSCREEN_CHANGE: 'webkitfullscreenchange',\r\n // Form\r\n SELECT: 'select',\r\n CHANGE: 'change',\r\n SUBMIT: 'submit',\r\n RESET: 'reset',\r\n FOCUS: 'focus',\r\n FOCUS_IN: 'focusin',\r\n FOCUS_OUT: 'focusout',\r\n BLUR: 'blur',\r\n INPUT: 'input',\r\n // Local Storage\r\n STORAGE: 'storage',\r\n // Drag\r\n DRAG_START: 'dragstart',\r\n DRAG: 'drag',\r\n DRAG_ENTER: 'dragenter',\r\n DRAG_LEAVE: 'dragleave',\r\n DRAG_OVER: 'dragover',\r\n DROP: 'drop',\r\n DRAG_END: 'dragend',\r\n // Animation\r\n ANIMATION_START: browser.isWebKit ? 'webkitAnimationStart' : 'animationstart',\r\n ANIMATION_END: browser.isWebKit ? 'webkitAnimationEnd' : 'animationend',\r\n ANIMATION_ITERATION: browser.isWebKit ? 'webkitAnimationIteration' : 'animationiteration'\r\n};\r\nexport const EventHelper = {\r\n stop: function (e, cancelBubble) {\r\n if (e.preventDefault) {\r\n e.preventDefault();\r\n }\r\n else {\r\n // IE8\r\n e.returnValue = false;\r\n }\r\n if (cancelBubble) {\r\n if (e.stopPropagation) {\r\n e.stopPropagation();\r\n }\r\n else {\r\n // IE8\r\n e.cancelBubble = true;\r\n }\r\n }\r\n }\r\n};\r\nexport function saveParentsScrollTop(node) {\r\n let r = [];\r\n for (let i = 0; node && node.nodeType === node.ELEMENT_NODE; i++) {\r\n r[i] = node.scrollTop;\r\n node = node.parentNode;\r\n }\r\n return r;\r\n}\r\nexport function restoreParentsScrollTop(node, state) {\r\n for (let i = 0; node && node.nodeType === node.ELEMENT_NODE; i++) {\r\n if (node.scrollTop !== state[i]) {\r\n node.scrollTop = state[i];\r\n }\r\n node = node.parentNode;\r\n }\r\n}\r\nclass FocusTracker extends Disposable {\r\n constructor(element) {\r\n super();\r\n this._onDidFocus = this._register(new Emitter());\r\n this.onDidFocus = this._onDidFocus.event;\r\n this._onDidBlur = this._register(new Emitter());\r\n this.onDidBlur = this._onDidBlur.event;\r\n let hasFocus = isAncestor(document.activeElement, element);\r\n let loosingFocus = false;\r\n const onFocus = () => {\r\n loosingFocus = false;\r\n if (!hasFocus) {\r\n hasFocus = true;\r\n this._onDidFocus.fire();\r\n }\r\n };\r\n const onBlur = () => {\r\n if (hasFocus) {\r\n loosingFocus = true;\r\n window.setTimeout(() => {\r\n if (loosingFocus) {\r\n loosingFocus = false;\r\n hasFocus = false;\r\n this._onDidBlur.fire();\r\n }\r\n }, 0);\r\n }\r\n };\r\n this._refreshStateHandler = () => {\r\n let currentNodeHasFocus = isAncestor(document.activeElement, element);\r\n if (currentNodeHasFocus !== hasFocus) {\r\n if (hasFocus) {\r\n onBlur();\r\n }\r\n else {\r\n onFocus();\r\n }\r\n }\r\n };\r\n this._register(addDisposableListener(element, EventType.FOCUS, onFocus, true));\r\n this._register(addDisposableListener(element, EventType.BLUR, onBlur, true));\r\n }\r\n}\r\nexport function trackFocus(element) {\r\n return new FocusTracker(element);\r\n}\r\nexport function append(parent, ...children) {\r\n parent.append(...children);\r\n if (children.length === 1 && typeof children[0] !== 'string') {\r\n return children[0];\r\n }\r\n}\r\nexport function prepend(parent, child) {\r\n parent.insertBefore(child, parent.firstChild);\r\n return child;\r\n}\r\n/**\r\n * Removes all children from `parent` and appends `children`\r\n */\r\nexport function reset(parent, ...children) {\r\n parent.innerText = '';\r\n append(parent, ...children);\r\n}\r\nconst SELECTOR_REGEX = /([\\w\\-]+)?(#([\\w\\-]+))?((\\.([\\w\\-]+))*)/;\r\nexport var Namespace;\r\n(function (Namespace) {\r\n Namespace[\"HTML\"] = \"http://www.w3.org/1999/xhtml\";\r\n Namespace[\"SVG\"] = \"http://www.w3.org/2000/svg\";\r\n})(Namespace || (Namespace = {}));\r\nfunction _$(namespace, description, attrs, ...children) {\r\n let match = SELECTOR_REGEX.exec(description);\r\n if (!match) {\r\n throw new Error('Bad use of emmet');\r\n }\r\n attrs = Object.assign({}, (attrs || {}));\r\n let tagName = match[1] || 'div';\r\n let result;\r\n if (namespace !== Namespace.HTML) {\r\n result = document.createElementNS(namespace, tagName);\r\n }\r\n else {\r\n result = document.createElement(tagName);\r\n }\r\n if (match[3]) {\r\n result.id = match[3];\r\n }\r\n if (match[4]) {\r\n result.className = match[4].replace(/\\./g, ' ').trim();\r\n }\r\n Object.keys(attrs).forEach(name => {\r\n const value = attrs[name];\r\n if (typeof value === 'undefined') {\r\n return;\r\n }\r\n if (/^on\\w+$/.test(name)) {\r\n result[name] = value;\r\n }\r\n else if (name === 'selected') {\r\n if (value) {\r\n result.setAttribute(name, 'true');\r\n }\r\n }\r\n else {\r\n result.setAttribute(name, value);\r\n }\r\n });\r\n result.append(...children);\r\n return result;\r\n}\r\nexport function $(description, attrs, ...children) {\r\n return _$(Namespace.HTML, description, attrs, ...children);\r\n}\r\n$.SVG = function (description, attrs, ...children) {\r\n return _$(Namespace.SVG, description, attrs, ...children);\r\n};\r\nexport function show(...elements) {\r\n for (let element of elements) {\r\n element.style.display = '';\r\n element.removeAttribute('aria-hidden');\r\n }\r\n}\r\nexport function hide(...elements) {\r\n for (let element of elements) {\r\n element.style.display = 'none';\r\n element.setAttribute('aria-hidden', 'true');\r\n }\r\n}\r\nexport function getElementsByTagName(tag) {\r\n return Array.prototype.slice.call(document.getElementsByTagName(tag), 0);\r\n}\r\n/**\r\n * Find a value usable for a dom node size such that the likelihood that it would be\r\n * displayed with constant screen pixels size is as high as possible.\r\n *\r\n * e.g. We would desire for the cursors to be 2px (CSS px) wide. Under a devicePixelRatio\r\n * of 1.25, the cursor will be 2.5 screen pixels wide. Depending on how the dom node aligns/\"snaps\"\r\n * with the screen pixels, it will sometimes be rendered with 2 screen pixels, and sometimes with 3 screen pixels.\r\n */\r\nexport function computeScreenAwareSize(cssPx) {\r\n const screenPx = window.devicePixelRatio * cssPx;\r\n return Math.max(1, Math.floor(screenPx)) / window.devicePixelRatio;\r\n}\r\n/**\r\n * Open safely a new window. This is the best way to do so, but you cannot tell\r\n * if the window was opened or if it was blocked by the brower's popup blocker.\r\n * If you want to tell if the browser blocked the new window, use `windowOpenNoOpenerWithSuccess`.\r\n *\r\n * See https://github.com/microsoft/monaco-editor/issues/601\r\n * To protect against malicious code in the linked site, particularly phishing attempts,\r\n * the window.opener should be set to null to prevent the linked site from having access\r\n * to change the location of the current page.\r\n * See https://mathiasbynens.github.io/rel-noopener/\r\n */\r\nexport function windowOpenNoOpener(url) {\r\n // By using 'noopener' in the `windowFeatures` argument, the newly created window will\r\n // not be able to use `window.opener` to reach back to the current page.\r\n // See https://stackoverflow.com/a/46958731\r\n // See https://developer.mozilla.org/en-US/docs/Web/API/Window/open#noopener\r\n // However, this also doesn't allow us to realize if the browser blocked\r\n // the creation of the window.\r\n window.open(url, '_blank', 'noopener');\r\n}\r\nexport function animate(fn) {\r\n const step = () => {\r\n fn();\r\n stepDisposable = scheduleAtNextAnimationFrame(step);\r\n };\r\n let stepDisposable = scheduleAtNextAnimationFrame(step);\r\n return toDisposable(() => stepDisposable.dispose());\r\n}\r\nRemoteAuthorities.setPreferredWebSchema(/^https:/.test(window.location.href) ? 'https' : 'http');\r\n/**\r\n * returns url('...')\r\n */\r\nexport function asCSSUrl(uri) {\r\n if (!uri) {\r\n return `url('')`;\r\n }\r\n return `url('${FileAccess.asBrowserUri(uri).toString(true).replace(/'/g, '%27')}')`;\r\n}\r\nexport function asCSSPropertyValue(value) {\r\n return `'${value.replace(/'/g, '%27')}'`;\r\n}\r\nexport class ModifierKeyEmitter extends Emitter {\r\n constructor() {\r\n super();\r\n this._subscriptions = new DisposableStore();\r\n this._keyStatus = {\r\n altKey: false,\r\n shiftKey: false,\r\n ctrlKey: false,\r\n metaKey: false\r\n };\r\n this._subscriptions.add(addDisposableListener(window, 'keydown', e => {\r\n if (e.defaultPrevented) {\r\n return;\r\n }\r\n const event = new StandardKeyboardEvent(e);\r\n // If Alt-key keydown event is repeated, ignore it #112347\r\n // Only known to be necessary for Alt-Key at the moment #115810\r\n if (event.keyCode === 6 /* Alt */ && e.repeat) {\r\n return;\r\n }\r\n if (e.altKey && !this._keyStatus.altKey) {\r\n this._keyStatus.lastKeyPressed = 'alt';\r\n }\r\n else if (e.ctrlKey && !this._keyStatus.ctrlKey) {\r\n this._keyStatus.lastKeyPressed = 'ctrl';\r\n }\r\n else if (e.metaKey && !this._keyStatus.metaKey) {\r\n this._keyStatus.lastKeyPressed = 'meta';\r\n }\r\n else if (e.shiftKey && !this._keyStatus.shiftKey) {\r\n this._keyStatus.lastKeyPressed = 'shift';\r\n }\r\n else if (event.keyCode !== 6 /* Alt */) {\r\n this._keyStatus.lastKeyPressed = undefined;\r\n }\r\n else {\r\n return;\r\n }\r\n this._keyStatus.altKey = e.altKey;\r\n this._keyStatus.ctrlKey = e.ctrlKey;\r\n this._keyStatus.metaKey = e.metaKey;\r\n this._keyStatus.shiftKey = e.shiftKey;\r\n if (this._keyStatus.lastKeyPressed) {\r\n this._keyStatus.event = e;\r\n this.fire(this._keyStatus);\r\n }\r\n }, true));\r\n this._subscriptions.add(addDisposableListener(window, 'keyup', e => {\r\n if (e.defaultPrevented) {\r\n return;\r\n }\r\n if (!e.altKey && this._keyStatus.altKey) {\r\n this._keyStatus.lastKeyReleased = 'alt';\r\n }\r\n else if (!e.ctrlKey && this._keyStatus.ctrlKey) {\r\n this._keyStatus.lastKeyReleased = 'ctrl';\r\n }\r\n else if (!e.metaKey && this._keyStatus.metaKey) {\r\n this._keyStatus.lastKeyReleased = 'meta';\r\n }\r\n else if (!e.shiftKey && this._keyStatus.shiftKey) {\r\n this._keyStatus.lastKeyReleased = 'shift';\r\n }\r\n else {\r\n this._keyStatus.lastKeyReleased = undefined;\r\n }\r\n if (this._keyStatus.lastKeyPressed !== this._keyStatus.lastKeyReleased) {\r\n this._keyStatus.lastKeyPressed = undefined;\r\n }\r\n this._keyStatus.altKey = e.altKey;\r\n this._keyStatus.ctrlKey = e.ctrlKey;\r\n this._keyStatus.metaKey = e.metaKey;\r\n this._keyStatus.shiftKey = e.shiftKey;\r\n if (this._keyStatus.lastKeyReleased) {\r\n this._keyStatus.event = e;\r\n this.fire(this._keyStatus);\r\n }\r\n }, true));\r\n this._subscriptions.add(addDisposableListener(document.body, 'mousedown', () => {\r\n this._keyStatus.lastKeyPressed = undefined;\r\n }, true));\r\n this._subscriptions.add(addDisposableListener(document.body, 'mouseup', () => {\r\n this._keyStatus.lastKeyPressed = undefined;\r\n }, true));\r\n this._subscriptions.add(addDisposableListener(document.body, 'mousemove', e => {\r\n if (e.buttons) {\r\n this._keyStatus.lastKeyPressed = undefined;\r\n }\r\n }, true));\r\n this._subscriptions.add(addDisposableListener(window, 'blur', () => {\r\n this.resetKeyStatus();\r\n }));\r\n }\r\n get keyStatus() {\r\n return this._keyStatus;\r\n }\r\n /**\r\n * Allows to explicitly reset the key status based on more knowledge (#109062)\r\n */\r\n resetKeyStatus() {\r\n this.doResetKeyStatus();\r\n this.fire(this._keyStatus);\r\n }\r\n doResetKeyStatus() {\r\n this._keyStatus = {\r\n altKey: false,\r\n shiftKey: false,\r\n ctrlKey: false,\r\n metaKey: false\r\n };\r\n }\r\n static getInstance() {\r\n if (!ModifierKeyEmitter.instance) {\r\n ModifierKeyEmitter.instance = new ModifierKeyEmitter();\r\n }\r\n return ModifierKeyEmitter.instance;\r\n }\r\n dispose() {\r\n super.dispose();\r\n this._subscriptions.dispose();\r\n }\r\n}\r\nexport function addMatchMediaChangeListener(query, callback) {\r\n const mediaQueryList = window.matchMedia(query);\r\n if (typeof mediaQueryList.addEventListener === 'function') {\r\n mediaQueryList.addEventListener('change', callback);\r\n }\r\n else {\r\n // Safari 13.x\r\n mediaQueryList.addListener(callback);\r\n }\r\n}\r\n", "/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License. See License.txt in the project root for license information.\r\n *--------------------------------------------------------------------------------------------*/\r\nimport './aria.css';\r\nimport { isMacintosh } from '../../../common/platform.js';\r\nimport * as dom from '../../dom.js';\r\n// Use a max length since we are inserting the whole msg in the DOM and that can cause browsers to freeze for long messages #94233\r\nconst MAX_MESSAGE_LENGTH = 20000;\r\nlet ariaContainer;\r\nlet alertContainer;\r\nlet alertContainer2;\r\nlet statusContainer;\r\nlet statusContainer2;\r\nexport function setARIAContainer(parent) {\r\n ariaContainer = document.createElement('div');\r\n ariaContainer.className = 'monaco-aria-container';\r\n const createAlertContainer = () => {\r\n const element = document.createElement('div');\r\n element.className = 'monaco-alert';\r\n element.setAttribute('role', 'alert');\r\n element.setAttribute('aria-atomic', 'true');\r\n ariaContainer.appendChild(element);\r\n return element;\r\n };\r\n alertContainer = createAlertContainer();\r\n alertContainer2 = createAlertContainer();\r\n const createStatusContainer = () => {\r\n const element = document.createElement('div');\r\n element.className = 'monaco-status';\r\n element.setAttribute('role', 'complementary');\r\n element.setAttribute('aria-live', 'polite');\r\n element.setAttribute('aria-atomic', 'true');\r\n ariaContainer.appendChild(element);\r\n return element;\r\n };\r\n statusContainer = createStatusContainer();\r\n statusContainer2 = createStatusContainer();\r\n parent.appendChild(ariaContainer);\r\n}\r\n/**\r\n * Given the provided message, will make sure that it is read as alert to screen readers.\r\n */\r\nexport function alert(msg) {\r\n if (!ariaContainer) {\r\n return;\r\n }\r\n // Use alternate containers such that duplicated messages get read out by screen readers #99466\r\n if (alertContainer.textContent !== msg) {\r\n dom.clearNode(alertContainer2);\r\n insertMessage(alertContainer, msg);\r\n }\r\n else {\r\n dom.clearNode(alertContainer);\r\n insertMessage(alertContainer2, msg);\r\n }\r\n}\r\n/**\r\n * Given the provided message, will make sure that it is read as status to screen readers.\r\n */\r\nexport function status(msg) {\r\n if (!ariaContainer) {\r\n return;\r\n }\r\n if (isMacintosh) {\r\n alert(msg); // VoiceOver does not seem to support status role\r\n }\r\n else {\r\n if (statusContainer.textContent !== msg) {\r\n dom.clearNode(statusContainer2);\r\n insertMessage(statusContainer, msg);\r\n }\r\n else {\r\n dom.clearNode(statusContainer);\r\n insertMessage(statusContainer2, msg);\r\n }\r\n }\r\n}\r\nfunction insertMessage(target, msg) {\r\n dom.clearNode(target);\r\n if (msg.length > MAX_MESSAGE_LENGTH) {\r\n msg = msg.substr(0, MAX_MESSAGE_LENGTH);\r\n }\r\n target.textContent = msg;\r\n // See https://www.paciellogroup.com/blog/2012/06/html5-accessibility-chops-aria-rolealert-browser-support/\r\n target.style.visibility = 'hidden';\r\n target.style.visibility = 'visible';\r\n}\r\n", "/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License. See License.txt in the project root for license information.\r\n *--------------------------------------------------------------------------------------------*/\r\n// ------ internal util\r\nexport var _util;\r\n(function (_util) {\r\n _util.serviceIds = new Map();\r\n _util.DI_TARGET = '$di$target';\r\n _util.DI_DEPENDENCIES = '$di$dependencies';\r\n function getServiceDependencies(ctor) {\r\n return ctor[_util.DI_DEPENDENCIES] || [];\r\n }\r\n _util.getServiceDependencies = getServiceDependencies;\r\n})(_util || (_util = {}));\r\nexport const IInstantiationService = createDecorator('instantiationService');\r\nfunction storeServiceDependency(id, target, index, optional) {\r\n if (target[_util.DI_TARGET] === target) {\r\n target[_util.DI_DEPENDENCIES].push({ id, index, optional });\r\n }\r\n else {\r\n target[_util.DI_DEPENDENCIES] = [{ id, index, optional }];\r\n target[_util.DI_TARGET] = target;\r\n }\r\n}\r\n/**\r\n * The *only* valid way to create a {{ServiceIdentifier}}.\r\n */\r\nexport function createDecorator(serviceId) {\r\n if (_util.serviceIds.has(serviceId)) {\r\n return _util.serviceIds.get(serviceId);\r\n }\r\n const id = function (target, key, index) {\r\n if (arguments.length !== 3) {\r\n throw new Error('@IServiceName-decorator can only be used to decorate a parameter');\r\n }\r\n storeServiceDependency(id, target, index, false);\r\n };\r\n id.toString = () => serviceId;\r\n _util.serviceIds.set(serviceId, id);\r\n return id;\r\n}\r\n/**\r\n * Mark a service dependency as optional.\r\n */\r\nexport function optional(serviceIdentifier) {\r\n return function (target, key, index) {\r\n if (arguments.length !== 3) {\r\n throw new Error('@optional-decorator can only be used to decorate a parameter');\r\n }\r\n storeServiceDependency(serviceIdentifier, target, index, true);\r\n };\r\n}\r\n", "/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License. See License.txt in the project root for license information.\r\n *--------------------------------------------------------------------------------------------*/\r\nimport { createDecorator } from '../../../platform/instantiation/common/instantiation.js';\r\nexport const ICodeEditorService = createDecorator('codeEditorService');\r\n", "/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License. See License.txt in the project root for license information.\r\n *--------------------------------------------------------------------------------------------*/\r\n/**\r\n * A position in the editor.\r\n */\r\nexport class Position {\r\n constructor(lineNumber, column) {\r\n this.lineNumber = lineNumber;\r\n this.column = column;\r\n }\r\n /**\r\n * Create a new position from this position.\r\n *\r\n * @param newLineNumber new line number\r\n * @param newColumn new column\r\n */\r\n with(newLineNumber = this.lineNumber, newColumn = this.column) {\r\n if (newLineNumber === this.lineNumber && newColumn === this.column) {\r\n return this;\r\n }\r\n else {\r\n return new Position(newLineNumber, newColumn);\r\n }\r\n }\r\n /**\r\n * Derive a new position from this position.\r\n *\r\n * @param deltaLineNumber line number delta\r\n * @param deltaColumn column delta\r\n */\r\n delta(deltaLineNumber = 0, deltaColumn = 0) {\r\n return this.with(this.lineNumber + deltaLineNumber, this.column + deltaColumn);\r\n }\r\n /**\r\n * Test if this position equals other position\r\n */\r\n equals(other) {\r\n return Position.equals(this, other);\r\n }\r\n /**\r\n * Test if position `a` equals position `b`\r\n */\r\n static equals(a, b) {\r\n if (!a && !b) {\r\n return true;\r\n }\r\n return (!!a &&\r\n !!b &&\r\n a.lineNumber === b.lineNumber &&\r\n a.column === b.column);\r\n }\r\n /**\r\n * Test if this position is before other position.\r\n * If the two positions are equal, the result will be false.\r\n */\r\n isBefore(other) {\r\n return Position.isBefore(this, other);\r\n }\r\n /**\r\n * Test if position `a` is before position `b`.\r\n * If the two positions are equal, the result will be false.\r\n */\r\n static isBefore(a, b) {\r\n if (a.lineNumber < b.lineNumber) {\r\n return true;\r\n }\r\n if (b.lineNumber < a.lineNumber) {\r\n return false;\r\n }\r\n return a.column < b.column;\r\n }\r\n /**\r\n * Test if this position is before other position.\r\n * If the two positions are equal, the result will be true.\r\n */\r\n isBeforeOrEqual(other) {\r\n return Position.isBeforeOrEqual(this, other);\r\n }\r\n /**\r\n * Test if position `a` is before position `b`.\r\n * If the two positions are equal, the result will be true.\r\n */\r\n static isBeforeOrEqual(a, b) {\r\n if (a.lineNumber < b.lineNumber) {\r\n return true;\r\n }\r\n if (b.lineNumber < a.lineNumber) {\r\n return false;\r\n }\r\n return a.column <= b.column;\r\n }\r\n /**\r\n * A function that compares positions, useful for sorting\r\n */\r\n static compare(a, b) {\r\n let aLineNumber = a.lineNumber | 0;\r\n let bLineNumber = b.lineNumber | 0;\r\n if (aLineNumber === bLineNumber) {\r\n let aColumn = a.column | 0;\r\n let bColumn = b.column | 0;\r\n return aColumn - bColumn;\r\n }\r\n return aLineNumber - bLineNumber;\r\n }\r\n /**\r\n * Clone this position.\r\n */\r\n clone() {\r\n return new Position(this.lineNumber, this.column);\r\n }\r\n /**\r\n * Convert to a human-readable representation.\r\n */\r\n toString() {\r\n return '(' + this.lineNumber + ',' + this.column + ')';\r\n }\r\n // ---\r\n /**\r\n * Create a `Position` from an `IPosition`.\r\n */\r\n static lift(pos) {\r\n return new Position(pos.lineNumber, pos.column);\r\n }\r\n /**\r\n * Test if `obj` is an `IPosition`.\r\n */\r\n static isIPosition(obj) {\r\n return (obj\r\n && (typeof obj.lineNumber === 'number')\r\n && (typeof obj.column === 'number'));\r\n }\r\n}\r\n", "/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License. See License.txt in the project root for license information.\r\n *--------------------------------------------------------------------------------------------*/\r\nimport { createDecorator } from '../../../platform/instantiation/common/instantiation.js';\r\nexport const IModelService = createDecorator('modelService');\r\nexport function shouldSynchronizeModel(model) {\r\n return (!model.isTooLargeForSyncing() && !model.isForSimpleWidget);\r\n}\r\n", "/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License. See License.txt in the project root for license information.\r\n *--------------------------------------------------------------------------------------------*/\r\nimport { createDecorator } from '../../../platform/instantiation/common/instantiation.js';\r\nexport const ITextModelService = createDecorator('textModelService');\r\n", "/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License. See License.txt in the project root for license information.\r\n *--------------------------------------------------------------------------------------------*/\r\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\r\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n};\r\nimport * as nls from '../../nls.js';\r\nimport { Disposable } from './lifecycle.js';\r\nimport { Emitter } from './event.js';\r\nexport class Action extends Disposable {\r\n constructor(id, label = '', cssClass = '', enabled = true, actionCallback) {\r\n super();\r\n this._onDidChange = this._register(new Emitter());\r\n this.onDidChange = this._onDidChange.event;\r\n this._enabled = true;\r\n this._checked = false;\r\n this._id = id;\r\n this._label = label;\r\n this._cssClass = cssClass;\r\n this._enabled = enabled;\r\n this._actionCallback = actionCallback;\r\n }\r\n get id() {\r\n return this._id;\r\n }\r\n get label() {\r\n return this._label;\r\n }\r\n set label(value) {\r\n this._setLabel(value);\r\n }\r\n _setLabel(value) {\r\n if (this._label !== value) {\r\n this._label = value;\r\n this._onDidChange.fire({ label: value });\r\n }\r\n }\r\n get tooltip() {\r\n return this._tooltip || '';\r\n }\r\n set tooltip(value) {\r\n this._setTooltip(value);\r\n }\r\n _setTooltip(value) {\r\n if (this._tooltip !== value) {\r\n this._tooltip = value;\r\n this._onDidChange.fire({ tooltip: value });\r\n }\r\n }\r\n get class() {\r\n return this._cssClass;\r\n }\r\n set class(value) {\r\n this._setClass(value);\r\n }\r\n _setClass(value) {\r\n if (this._cssClass !== value) {\r\n this._cssClass = value;\r\n this._onDidChange.fire({ class: value });\r\n }\r\n }\r\n get enabled() {\r\n return this._enabled;\r\n }\r\n set enabled(value) {\r\n this._setEnabled(value);\r\n }\r\n _setEnabled(value) {\r\n if (this._enabled !== value) {\r\n this._enabled = value;\r\n this._onDidChange.fire({ enabled: value });\r\n }\r\n }\r\n get checked() {\r\n return this._checked;\r\n }\r\n set checked(value) {\r\n this._setChecked(value);\r\n }\r\n _setChecked(value) {\r\n if (this._checked !== value) {\r\n this._checked = value;\r\n this._onDidChange.fire({ checked: value });\r\n }\r\n }\r\n run(event, data) {\r\n return __awaiter(this, void 0, void 0, function* () {\r\n if (this._actionCallback) {\r\n yield this._actionCallback(event);\r\n }\r\n });\r\n }\r\n}\r\nexport class ActionRunner extends Disposable {\r\n constructor() {\r\n super(...arguments);\r\n this._onBeforeRun = this._register(new Emitter());\r\n this.onBeforeRun = this._onBeforeRun.event;\r\n this._onDidRun = this._register(new Emitter());\r\n this.onDidRun = this._onDidRun.event;\r\n }\r\n run(action, context) {\r\n return __awaiter(this, void 0, void 0, function* () {\r\n if (!action.enabled) {\r\n return;\r\n }\r\n this._onBeforeRun.fire({ action });\r\n let error = undefined;\r\n try {\r\n yield this.runAction(action, context);\r\n }\r\n catch (e) {\r\n error = e;\r\n }\r\n this._onDidRun.fire({ action, error });\r\n });\r\n }\r\n runAction(action, context) {\r\n return __awaiter(this, void 0, void 0, function* () {\r\n yield action.run(context);\r\n });\r\n }\r\n}\r\nexport class Separator extends Action {\r\n constructor(label) {\r\n super(Separator.ID, label, label ? 'separator text' : 'separator');\r\n this.checked = false;\r\n this.enabled = false;\r\n }\r\n}\r\nSeparator.ID = 'vs.actions.separator';\r\nexport class SubmenuAction {\r\n constructor(id, label, actions, cssClass) {\r\n this.tooltip = '';\r\n this.enabled = true;\r\n this.checked = false;\r\n this.id = id;\r\n this.label = label;\r\n this.class = cssClass;\r\n this._actions = actions;\r\n }\r\n get actions() { return this._actions; }\r\n dispose() {\r\n // there is NOTHING to dispose and the SubmenuAction should\r\n // never have anything to dispose as it is a convenience type\r\n // to bridge into the rendering world.\r\n }\r\n run() {\r\n return __awaiter(this, void 0, void 0, function* () { });\r\n }\r\n}\r\nexport class EmptySubmenuAction extends Action {\r\n constructor() {\r\n super(EmptySubmenuAction.ID, nls.localize('submenu.empty', '(empty)'), undefined, false);\r\n }\r\n}\r\nEmptySubmenuAction.ID = 'vs.actions.empty';\r\n", "/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License. See License.txt in the project root for license information.\r\n *--------------------------------------------------------------------------------------------*/\r\nexport function isFalsyOrWhitespace(str) {\r\n if (!str || typeof str !== 'string') {\r\n return true;\r\n }\r\n return str.trim().length === 0;\r\n}\r\nconst _formatRegexp = /{(\\d+)}/g;\r\n/**\r\n * Helper to produce a string with a variable number of arguments. Insert variable segments\r\n * into the string using the {n} notation where N is the index of the argument following the string.\r\n * @param value string to which formatting is applied\r\n * @param args replacements for {n}-entries\r\n */\r\nexport function format(value, ...args) {\r\n if (args.length === 0) {\r\n return value;\r\n }\r\n return value.replace(_formatRegexp, function (match, group) {\r\n const idx = parseInt(group, 10);\r\n return isNaN(idx) || idx < 0 || idx >= args.length ?\r\n match :\r\n args[idx];\r\n });\r\n}\r\n/**\r\n * Converts HTML characters inside the string to use entities instead. Makes the string safe from\r\n * being used e.g. in HTMLElement.innerHTML.\r\n */\r\nexport function escape(html) {\r\n return html.replace(/[<>&]/g, function (match) {\r\n switch (match) {\r\n case '<': return '<';\r\n case '>': return '>';\r\n case '&': return '&';\r\n default: return match;\r\n }\r\n });\r\n}\r\n/**\r\n * Escapes regular expression characters in a given string\r\n */\r\nexport function escapeRegExpCharacters(value) {\r\n return value.replace(/[\\\\\\{\\}\\*\\+\\?\\|\\^\\$\\.\\[\\]\\(\\)]/g, '\\\\$&');\r\n}\r\n/**\r\n * Removes all occurrences of needle from the beginning and end of haystack.\r\n * @param haystack string to trim\r\n * @param needle the thing to trim (default is a blank)\r\n */\r\nexport function trim(haystack, needle = ' ') {\r\n const trimmed = ltrim(haystack, needle);\r\n return rtrim(trimmed, needle);\r\n}\r\n/**\r\n * Removes all occurrences of needle from the beginning of haystack.\r\n * @param haystack string to trim\r\n * @param needle the thing to trim\r\n */\r\nexport function ltrim(haystack, needle) {\r\n if (!haystack || !needle) {\r\n return haystack;\r\n }\r\n const needleLen = needle.length;\r\n if (needleLen === 0 || haystack.length === 0) {\r\n return haystack;\r\n }\r\n let offset = 0;\r\n while (haystack.indexOf(needle, offset) === offset) {\r\n offset = offset + needleLen;\r\n }\r\n return haystack.substring(offset);\r\n}\r\n/**\r\n * Removes all occurrences of needle from the end of haystack.\r\n * @param haystack string to trim\r\n * @param needle the thing to trim\r\n */\r\nexport function rtrim(haystack, needle) {\r\n if (!haystack || !needle) {\r\n return haystack;\r\n }\r\n const needleLen = needle.length, haystackLen = haystack.length;\r\n if (needleLen === 0 || haystackLen === 0) {\r\n return haystack;\r\n }\r\n let offset = haystackLen, idx = -1;\r\n while (true) {\r\n idx = haystack.lastIndexOf(needle, offset - 1);\r\n if (idx === -1 || idx + needleLen !== offset) {\r\n break;\r\n }\r\n if (idx === 0) {\r\n return '';\r\n }\r\n offset = idx;\r\n }\r\n return haystack.substring(0, offset);\r\n}\r\nexport function convertSimple2RegExpPattern(pattern) {\r\n return pattern.replace(/[\\-\\\\\\{\\}\\+\\?\\|\\^\\$\\.\\,\\[\\]\\(\\)\\#\\s]/g, '\\\\$&').replace(/[\\*]/g, '.*');\r\n}\r\nexport function stripWildcards(pattern) {\r\n return pattern.replace(/\\*/g, '');\r\n}\r\nexport function createRegExp(searchString, isRegex, options = {}) {\r\n if (!searchString) {\r\n throw new Error('Cannot create regex from empty string');\r\n }\r\n if (!isRegex) {\r\n searchString = escapeRegExpCharacters(searchString);\r\n }\r\n if (options.wholeWord) {\r\n if (!/\\B/.test(searchString.charAt(0))) {\r\n searchString = '\\\\b' + searchString;\r\n }\r\n if (!/\\B/.test(searchString.charAt(searchString.length - 1))) {\r\n searchString = searchString + '\\\\b';\r\n }\r\n }\r\n let modifiers = '';\r\n if (options.global) {\r\n modifiers += 'g';\r\n }\r\n if (!options.matchCase) {\r\n modifiers += 'i';\r\n }\r\n if (options.multiline) {\r\n modifiers += 'm';\r\n }\r\n if (options.unicode) {\r\n modifiers += 'u';\r\n }\r\n return new RegExp(searchString, modifiers);\r\n}\r\nexport function regExpLeadsToEndlessLoop(regexp) {\r\n // Exit early if it's one of these special cases which are meant to match\r\n // against an empty string\r\n if (regexp.source === '^' || regexp.source === '^$' || regexp.source === '$' || regexp.source === '^\\\\s*$') {\r\n return false;\r\n }\r\n // We check against an empty string. If the regular expression doesn't advance\r\n // (e.g. ends in an endless loop) it will match an empty string.\r\n const match = regexp.exec('');\r\n return !!(match && regexp.lastIndex === 0);\r\n}\r\nexport function regExpFlags(regexp) {\r\n return (regexp.global ? 'g' : '')\r\n + (regexp.ignoreCase ? 'i' : '')\r\n + (regexp.multiline ? 'm' : '')\r\n + (regexp /* standalone editor compilation */.unicode ? 'u' : '');\r\n}\r\nexport function splitLines(str) {\r\n return str.split(/\\r\\n|\\r|\\n/);\r\n}\r\n/**\r\n * Returns first index of the string that is not whitespace.\r\n * If string is empty or contains only whitespaces, returns -1\r\n */\r\nexport function firstNonWhitespaceIndex(str) {\r\n for (let i = 0, len = str.length; i < len; i++) {\r\n const chCode = str.charCodeAt(i);\r\n if (chCode !== 32 /* Space */ && chCode !== 9 /* Tab */) {\r\n return i;\r\n }\r\n }\r\n return -1;\r\n}\r\n/**\r\n * Returns the leading whitespace of the string.\r\n * If the string contains only whitespaces, returns entire string\r\n */\r\nexport function getLeadingWhitespace(str, start = 0, end = str.length) {\r\n for (let i = start; i < end; i++) {\r\n const chCode = str.charCodeAt(i);\r\n if (chCode !== 32 /* Space */ && chCode !== 9 /* Tab */) {\r\n return str.substring(start, i);\r\n }\r\n }\r\n return str.substring(start, end);\r\n}\r\n/**\r\n * Returns last index of the string that is not whitespace.\r\n * If string is empty or contains only whitespaces, returns -1\r\n */\r\nexport function lastNonWhitespaceIndex(str, startIndex = str.length - 1) {\r\n for (let i = startIndex; i >= 0; i--) {\r\n const chCode = str.charCodeAt(i);\r\n if (chCode !== 32 /* Space */ && chCode !== 9 /* Tab */) {\r\n return i;\r\n }\r\n }\r\n return -1;\r\n}\r\nexport function compare(a, b) {\r\n if (a < b) {\r\n return -1;\r\n }\r\n else if (a > b) {\r\n return 1;\r\n }\r\n else {\r\n return 0;\r\n }\r\n}\r\nexport function compareSubstring(a, b, aStart = 0, aEnd = a.length, bStart = 0, bEnd = b.length) {\r\n for (; aStart < aEnd && bStart < bEnd; aStart++, bStart++) {\r\n let codeA = a.charCodeAt(aStart);\r\n let codeB = b.charCodeAt(bStart);\r\n if (codeA < codeB) {\r\n return -1;\r\n }\r\n else if (codeA > codeB) {\r\n return 1;\r\n }\r\n }\r\n const aLen = aEnd - aStart;\r\n const bLen = bEnd - bStart;\r\n if (aLen < bLen) {\r\n return -1;\r\n }\r\n else if (aLen > bLen) {\r\n return 1;\r\n }\r\n return 0;\r\n}\r\nexport function compareIgnoreCase(a, b) {\r\n return compareSubstringIgnoreCase(a, b, 0, a.length, 0, b.length);\r\n}\r\nexport function compareSubstringIgnoreCase(a, b, aStart = 0, aEnd = a.length, bStart = 0, bEnd = b.length) {\r\n for (; aStart < aEnd && bStart < bEnd; aStart++, bStart++) {\r\n let codeA = a.charCodeAt(aStart);\r\n let codeB = b.charCodeAt(bStart);\r\n if (codeA === codeB) {\r\n // equal\r\n continue;\r\n }\r\n const diff = codeA - codeB;\r\n if (diff === 32 && isUpperAsciiLetter(codeB)) { //codeB =[65-90] && codeA =[97-122]\r\n continue;\r\n }\r\n else if (diff === -32 && isUpperAsciiLetter(codeA)) { //codeB =[97-122] && codeA =[65-90]\r\n continue;\r\n }\r\n if (isLowerAsciiLetter(codeA) && isLowerAsciiLetter(codeB)) {\r\n //\r\n return diff;\r\n }\r\n else {\r\n return compareSubstring(a.toLowerCase(), b.toLowerCase(), aStart, aEnd, bStart, bEnd);\r\n }\r\n }\r\n const aLen = aEnd - aStart;\r\n const bLen = bEnd - bStart;\r\n if (aLen < bLen) {\r\n return -1;\r\n }\r\n else if (aLen > bLen) {\r\n return 1;\r\n }\r\n return 0;\r\n}\r\nexport function isLowerAsciiLetter(code) {\r\n return code >= 97 /* a */ && code <= 122 /* z */;\r\n}\r\nexport function isUpperAsciiLetter(code) {\r\n return code >= 65 /* A */ && code <= 90 /* Z */;\r\n}\r\nfunction isAsciiLetter(code) {\r\n return isLowerAsciiLetter(code) || isUpperAsciiLetter(code);\r\n}\r\nexport function equalsIgnoreCase(a, b) {\r\n return a.length === b.length && doEqualsIgnoreCase(a, b);\r\n}\r\nfunction doEqualsIgnoreCase(a, b, stopAt = a.length) {\r\n for (let i = 0; i < stopAt; i++) {\r\n const codeA = a.charCodeAt(i);\r\n const codeB = b.charCodeAt(i);\r\n if (codeA === codeB) {\r\n continue;\r\n }\r\n // a-z A-Z\r\n if (isAsciiLetter(codeA) && isAsciiLetter(codeB)) {\r\n const diff = Math.abs(codeA - codeB);\r\n if (diff !== 0 && diff !== 32) {\r\n return false;\r\n }\r\n }\r\n // Any other charcode\r\n else {\r\n if (String.fromCharCode(codeA).toLowerCase() !== String.fromCharCode(codeB).toLowerCase()) {\r\n return false;\r\n }\r\n }\r\n }\r\n return true;\r\n}\r\nexport function startsWithIgnoreCase(str, candidate) {\r\n const candidateLength = candidate.length;\r\n if (candidate.length > str.length) {\r\n return false;\r\n }\r\n return doEqualsIgnoreCase(str, candidate, candidateLength);\r\n}\r\n/**\r\n * @returns the length of the common prefix of the two strings.\r\n */\r\nexport function commonPrefixLength(a, b) {\r\n let i, len = Math.min(a.length, b.length);\r\n for (i = 0; i < len; i++) {\r\n if (a.charCodeAt(i) !== b.charCodeAt(i)) {\r\n return i;\r\n }\r\n }\r\n return len;\r\n}\r\n/**\r\n * @returns the length of the common suffix of the two strings.\r\n */\r\nexport function commonSuffixLength(a, b) {\r\n let i, len = Math.min(a.length, b.length);\r\n const aLastIndex = a.length - 1;\r\n const bLastIndex = b.length - 1;\r\n for (i = 0; i < len; i++) {\r\n if (a.charCodeAt(aLastIndex - i) !== b.charCodeAt(bLastIndex - i)) {\r\n return i;\r\n }\r\n }\r\n return len;\r\n}\r\n/**\r\n * See http://en.wikipedia.org/wiki/Surrogate_pair\r\n */\r\nexport function isHighSurrogate(charCode) {\r\n return (0xD800 <= charCode && charCode <= 0xDBFF);\r\n}\r\n/**\r\n * See http://en.wikipedia.org/wiki/Surrogate_pair\r\n */\r\nexport function isLowSurrogate(charCode) {\r\n return (0xDC00 <= charCode && charCode <= 0xDFFF);\r\n}\r\n/**\r\n * See http://en.wikipedia.org/wiki/Surrogate_pair\r\n */\r\nexport function computeCodePoint(highSurrogate, lowSurrogate) {\r\n return ((highSurrogate - 0xD800) << 10) + (lowSurrogate - 0xDC00) + 0x10000;\r\n}\r\n/**\r\n * get the code point that begins at offset `offset`\r\n */\r\nexport function getNextCodePoint(str, len, offset) {\r\n const charCode = str.charCodeAt(offset);\r\n if (isHighSurrogate(charCode) && offset + 1 < len) {\r\n const nextCharCode = str.charCodeAt(offset + 1);\r\n if (isLowSurrogate(nextCharCode)) {\r\n return computeCodePoint(charCode, nextCharCode);\r\n }\r\n }\r\n return charCode;\r\n}\r\n/**\r\n * get the code point that ends right before offset `offset`\r\n */\r\nfunction getPrevCodePoint(str, offset) {\r\n const charCode = str.charCodeAt(offset - 1);\r\n if (isLowSurrogate(charCode) && offset > 1) {\r\n const prevCharCode = str.charCodeAt(offset - 2);\r\n if (isHighSurrogate(prevCharCode)) {\r\n return computeCodePoint(prevCharCode, charCode);\r\n }\r\n }\r\n return charCode;\r\n}\r\nexport function nextCharLength(str, offset) {\r\n const graphemeBreakTree = GraphemeBreakTree.getInstance();\r\n const initialOffset = offset;\r\n const len = str.length;\r\n const initialCodePoint = getNextCodePoint(str, len, offset);\r\n offset += (initialCodePoint >= 65536 /* UNICODE_SUPPLEMENTARY_PLANE_BEGIN */ ? 2 : 1);\r\n let graphemeBreakType = graphemeBreakTree.getGraphemeBreakType(initialCodePoint);\r\n while (offset < len) {\r\n const nextCodePoint = getNextCodePoint(str, len, offset);\r\n const nextGraphemeBreakType = graphemeBreakTree.getGraphemeBreakType(nextCodePoint);\r\n if (breakBetweenGraphemeBreakType(graphemeBreakType, nextGraphemeBreakType)) {\r\n break;\r\n }\r\n offset += (nextCodePoint >= 65536 /* UNICODE_SUPPLEMENTARY_PLANE_BEGIN */ ? 2 : 1);\r\n graphemeBreakType = nextGraphemeBreakType;\r\n }\r\n return (offset - initialOffset);\r\n}\r\nexport function prevCharLength(str, offset) {\r\n const graphemeBreakTree = GraphemeBreakTree.getInstance();\r\n const initialOffset = offset;\r\n const initialCodePoint = getPrevCodePoint(str, offset);\r\n offset -= (initialCodePoint >= 65536 /* UNICODE_SUPPLEMENTARY_PLANE_BEGIN */ ? 2 : 1);\r\n let graphemeBreakType = graphemeBreakTree.getGraphemeBreakType(initialCodePoint);\r\n while (offset > 0) {\r\n const prevCodePoint = getPrevCodePoint(str, offset);\r\n const prevGraphemeBreakType = graphemeBreakTree.getGraphemeBreakType(prevCodePoint);\r\n if (breakBetweenGraphemeBreakType(prevGraphemeBreakType, graphemeBreakType)) {\r\n break;\r\n }\r\n offset -= (prevCodePoint >= 65536 /* UNICODE_SUPPLEMENTARY_PLANE_BEGIN */ ? 2 : 1);\r\n graphemeBreakType = prevGraphemeBreakType;\r\n }\r\n return (initialOffset - offset);\r\n}\r\n/**\r\n * A manual decoding of a UTF8 string.\r\n * Use only in environments which do not offer native conversion methods!\r\n */\r\nexport function decodeUTF8(buffer) {\r\n // https://en.wikipedia.org/wiki/UTF-8\r\n const len = buffer.byteLength;\r\n const result = [];\r\n let offset = 0;\r\n while (offset < len) {\r\n const v0 = buffer[offset];\r\n let codePoint;\r\n if (v0 >= 0b11110000 && offset + 3 < len) {\r\n // 4 bytes\r\n codePoint = ((((buffer[offset++] & 0b00000111) << 18) >>> 0)\r\n | (((buffer[offset++] & 0b00111111) << 12) >>> 0)\r\n | (((buffer[offset++] & 0b00111111) << 6) >>> 0)\r\n | (((buffer[offset++] & 0b00111111) << 0) >>> 0));\r\n }\r\n else if (v0 >= 0b11100000 && offset + 2 < len) {\r\n // 3 bytes\r\n codePoint = ((((buffer[offset++] & 0b00001111) << 12) >>> 0)\r\n | (((buffer[offset++] & 0b00111111) << 6) >>> 0)\r\n | (((buffer[offset++] & 0b00111111) << 0) >>> 0));\r\n }\r\n else if (v0 >= 0b11000000 && offset + 1 < len) {\r\n // 2 bytes\r\n codePoint = ((((buffer[offset++] & 0b00011111) << 6) >>> 0)\r\n | (((buffer[offset++] & 0b00111111) << 0) >>> 0));\r\n }\r\n else {\r\n // 1 byte\r\n codePoint = buffer[offset++];\r\n }\r\n if ((codePoint >= 0 && codePoint <= 0xD7FF) || (codePoint >= 0xE000 && codePoint <= 0xFFFF)) {\r\n // Basic Multilingual Plane\r\n result.push(String.fromCharCode(codePoint));\r\n }\r\n else if (codePoint >= 0x010000 && codePoint <= 0x10FFFF) {\r\n // Supplementary Planes\r\n const uPrime = codePoint - 0x10000;\r\n const w1 = 0xD800 + ((uPrime & 0b11111111110000000000) >>> 10);\r\n const w2 = 0xDC00 + ((uPrime & 0b00000000001111111111) >>> 0);\r\n result.push(String.fromCharCode(w1));\r\n result.push(String.fromCharCode(w2));\r\n }\r\n else {\r\n // illegal code point\r\n result.push(String.fromCharCode(0xFFFD));\r\n }\r\n }\r\n return result.join('');\r\n}\r\n/**\r\n * Generated using https://github.com/alexdima/unicode-utils/blob/master/generate-rtl-test.js\r\n */\r\nconst CONTAINS_RTL = /(?:[\\u05BE\\u05C0\\u05C3\\u05C6\\u05D0-\\u05F4\\u0608\\u060B\\u060D\\u061B-\\u064A\\u066D-\\u066F\\u0671-\\u06D5\\u06E5\\u06E6\\u06EE\\u06EF\\u06FA-\\u0710\\u0712-\\u072F\\u074D-\\u07A5\\u07B1-\\u07EA\\u07F4\\u07F5\\u07FA-\\u0815\\u081A\\u0824\\u0828\\u0830-\\u0858\\u085E-\\u08BD\\u200F\\uFB1D\\uFB1F-\\uFB28\\uFB2A-\\uFD3D\\uFD50-\\uFDFC\\uFE70-\\uFEFC]|\\uD802[\\uDC00-\\uDD1B\\uDD20-\\uDE00\\uDE10-\\uDE33\\uDE40-\\uDEE4\\uDEEB-\\uDF35\\uDF40-\\uDFFF]|\\uD803[\\uDC00-\\uDCFF]|\\uD83A[\\uDC00-\\uDCCF\\uDD00-\\uDD43\\uDD50-\\uDFFF]|\\uD83B[\\uDC00-\\uDEBB])/;\r\n/**\r\n * Returns true if `str` contains any Unicode character that is classified as \"R\" or \"AL\".\r\n */\r\nexport function containsRTL(str) {\r\n return CONTAINS_RTL.test(str);\r\n}\r\n/**\r\n * Generated using https://github.com/alexdima/unicode-utils/blob/master/generate-emoji-test.js\r\n */\r\nconst CONTAINS_EMOJI = /(?:[\\u231A\\u231B\\u23F0\\u23F3\\u2600-\\u27BF\\u2B50\\u2B55]|\\uD83C[\\uDDE6-\\uDDFF\\uDF00-\\uDFFF]|\\uD83D[\\uDC00-\\uDE4F\\uDE80-\\uDEFC\\uDFE0-\\uDFEB]|\\uD83E[\\uDD00-\\uDDFF\\uDE70-\\uDED6])/;\r\nexport function containsEmoji(str) {\r\n return CONTAINS_EMOJI.test(str);\r\n}\r\nconst IS_BASIC_ASCII = /^[\\t\\n\\r\\x20-\\x7E]*$/;\r\n/**\r\n * Returns true if `str` contains only basic ASCII characters in the range 32 - 126 (including 32 and 126) or \\n, \\r, \\t\r\n */\r\nexport function isBasicASCII(str) {\r\n return IS_BASIC_ASCII.test(str);\r\n}\r\nexport const UNUSUAL_LINE_TERMINATORS = /[\\u2028\\u2029]/; // LINE SEPARATOR (LS) or PARAGRAPH SEPARATOR (PS)\r\n/**\r\n * Returns true if `str` contains unusual line terminators, like LS or PS\r\n */\r\nexport function containsUnusualLineTerminators(str) {\r\n return UNUSUAL_LINE_TERMINATORS.test(str);\r\n}\r\nexport function containsFullWidthCharacter(str) {\r\n for (let i = 0, len = str.length; i < len; i++) {\r\n if (isFullWidthCharacter(str.charCodeAt(i))) {\r\n return true;\r\n }\r\n }\r\n return false;\r\n}\r\nexport function isFullWidthCharacter(charCode) {\r\n // Do a cheap trick to better support wrapping of wide characters, treat them as 2 columns\r\n // http://jrgraphix.net/research/unicode_blocks.php\r\n // 2E80 \u2014 2EFF CJK Radicals Supplement\r\n // 2F00 \u2014 2FDF Kangxi Radicals\r\n // 2FF0 \u2014 2FFF Ideographic Description Characters\r\n // 3000 \u2014 303F CJK Symbols and Punctuation\r\n // 3040 \u2014 309F Hiragana\r\n // 30A0 \u2014 30FF Katakana\r\n // 3100 \u2014 312F Bopomofo\r\n // 3130 \u2014 318F Hangul Compatibility Jamo\r\n // 3190 \u2014 319F Kanbun\r\n // 31A0 \u2014 31BF Bopomofo Extended\r\n // 31F0 \u2014 31FF Katakana Phonetic Extensions\r\n // 3200 \u2014 32FF Enclosed CJK Letters and Months\r\n // 3300 \u2014 33FF CJK Compatibility\r\n // 3400 \u2014 4DBF CJK Unified Ideographs Extension A\r\n // 4DC0 \u2014 4DFF Yijing Hexagram Symbols\r\n // 4E00 \u2014 9FFF CJK Unified Ideographs\r\n // A000 \u2014 A48F Yi Syllables\r\n // A490 \u2014 A4CF Yi Radicals\r\n // AC00 \u2014 D7AF Hangul Syllables\r\n // [IGNORE] D800 \u2014 DB7F High Surrogates\r\n // [IGNORE] DB80 \u2014 DBFF High Private Use Surrogates\r\n // [IGNORE] DC00 \u2014 DFFF Low Surrogates\r\n // [IGNORE] E000 \u2014 F8FF Private Use Area\r\n // F900 \u2014 FAFF CJK Compatibility Ideographs\r\n // [IGNORE] FB00 \u2014 FB4F Alphabetic Presentation Forms\r\n // [IGNORE] FB50 \u2014 FDFF Arabic Presentation Forms-A\r\n // [IGNORE] FE00 \u2014 FE0F Variation Selectors\r\n // [IGNORE] FE20 \u2014 FE2F Combining Half Marks\r\n // [IGNORE] FE30 \u2014 FE4F CJK Compatibility Forms\r\n // [IGNORE] FE50 \u2014 FE6F Small Form Variants\r\n // [IGNORE] FE70 \u2014 FEFF Arabic Presentation Forms-B\r\n // FF00 \u2014 FFEF Halfwidth and Fullwidth Forms\r\n // [https://en.wikipedia.org/wiki/Halfwidth_and_fullwidth_forms]\r\n // of which FF01 - FF5E fullwidth ASCII of 21 to 7E\r\n // [IGNORE] and FF65 - FFDC halfwidth of Katakana and Hangul\r\n // [IGNORE] FFF0 \u2014 FFFF Specials\r\n charCode = +charCode; // @perf\r\n return ((charCode >= 0x2E80 && charCode <= 0xD7AF)\r\n || (charCode >= 0xF900 && charCode <= 0xFAFF)\r\n || (charCode >= 0xFF01 && charCode <= 0xFF5E));\r\n}\r\n/**\r\n * A fast function (therefore imprecise) to check if code points are emojis.\r\n * Generated using https://github.com/alexdima/unicode-utils/blob/master/generate-emoji-test.js\r\n */\r\nexport function isEmojiImprecise(x) {\r\n return ((x >= 0x1F1E6 && x <= 0x1F1FF) || (x === 8986) || (x === 8987) || (x === 9200)\r\n || (x === 9203) || (x >= 9728 && x <= 10175) || (x === 11088) || (x === 11093)\r\n || (x >= 127744 && x <= 128591) || (x >= 128640 && x <= 128764)\r\n || (x >= 128992 && x <= 129003) || (x >= 129280 && x <= 129535)\r\n || (x >= 129648 && x <= 129750));\r\n}\r\n// -- UTF-8 BOM\r\nexport const UTF8_BOM_CHARACTER = String.fromCharCode(65279 /* UTF8_BOM */);\r\nexport function startsWithUTF8BOM(str) {\r\n return !!(str && str.length > 0 && str.charCodeAt(0) === 65279 /* UTF8_BOM */);\r\n}\r\nexport function containsUppercaseCharacter(target, ignoreEscapedChars = false) {\r\n if (!target) {\r\n return false;\r\n }\r\n if (ignoreEscapedChars) {\r\n target = target.replace(/\\\\./g, '');\r\n }\r\n return target.toLowerCase() !== target;\r\n}\r\n/**\r\n * Produces 'a'-'z', followed by 'A'-'Z'... followed by 'a'-'z', etc.\r\n */\r\nexport function singleLetterHash(n) {\r\n const LETTERS_CNT = (90 /* Z */ - 65 /* A */ + 1);\r\n n = n % (2 * LETTERS_CNT);\r\n if (n < LETTERS_CNT) {\r\n return String.fromCharCode(97 /* a */ + n);\r\n }\r\n return String.fromCharCode(65 /* A */ + n - LETTERS_CNT);\r\n}\r\n//#region Unicode Grapheme Break\r\nexport function getGraphemeBreakType(codePoint) {\r\n const graphemeBreakTree = GraphemeBreakTree.getInstance();\r\n return graphemeBreakTree.getGraphemeBreakType(codePoint);\r\n}\r\nexport function breakBetweenGraphemeBreakType(breakTypeA, breakTypeB) {\r\n // http://www.unicode.org/reports/tr29/#Grapheme_Cluster_Boundary_Rules\r\n // !!! Let's make the common case a bit faster\r\n if (breakTypeA === 0 /* Other */) {\r\n // see https://www.unicode.org/Public/13.0.0/ucd/auxiliary/GraphemeBreakTest-13.0.0d10.html#table\r\n return (breakTypeB !== 5 /* Extend */ && breakTypeB !== 7 /* SpacingMark */);\r\n }\r\n // Do not break between a CR and LF. Otherwise, break before and after controls.\r\n // GB3 CR \u00D7 LF\r\n // GB4 (Control | CR | LF) \u00F7\r\n // GB5 \u00F7 (Control | CR | LF)\r\n if (breakTypeA === 2 /* CR */) {\r\n if (breakTypeB === 3 /* LF */) {\r\n return false; // GB3\r\n }\r\n }\r\n if (breakTypeA === 4 /* Control */ || breakTypeA === 2 /* CR */ || breakTypeA === 3 /* LF */) {\r\n return true; // GB4\r\n }\r\n if (breakTypeB === 4 /* Control */ || breakTypeB === 2 /* CR */ || breakTypeB === 3 /* LF */) {\r\n return true; // GB5\r\n }\r\n // Do not break Hangul syllable sequences.\r\n // GB6 L \u00D7 (L | V | LV | LVT)\r\n // GB7 (LV | V) \u00D7 (V | T)\r\n // GB8 (LVT | T) \u00D7 T\r\n if (breakTypeA === 8 /* L */) {\r\n if (breakTypeB === 8 /* L */ || breakTypeB === 9 /* V */ || breakTypeB === 11 /* LV */ || breakTypeB === 12 /* LVT */) {\r\n return false; // GB6\r\n }\r\n }\r\n if (breakTypeA === 11 /* LV */ || breakTypeA === 9 /* V */) {\r\n if (breakTypeB === 9 /* V */ || breakTypeB === 10 /* T */) {\r\n return false; // GB7\r\n }\r\n }\r\n if (breakTypeA === 12 /* LVT */ || breakTypeA === 10 /* T */) {\r\n if (breakTypeB === 10 /* T */) {\r\n return false; // GB8\r\n }\r\n }\r\n // Do not break before extending characters or ZWJ.\r\n // GB9 \u00D7 (Extend | ZWJ)\r\n if (breakTypeB === 5 /* Extend */ || breakTypeB === 13 /* ZWJ */) {\r\n return false; // GB9\r\n }\r\n // The GB9a and GB9b rules only apply to extended grapheme clusters:\r\n // Do not break before SpacingMarks, or after Prepend characters.\r\n // GB9a \u00D7 SpacingMark\r\n // GB9b Prepend \u00D7\r\n if (breakTypeB === 7 /* SpacingMark */) {\r\n return false; // GB9a\r\n }\r\n if (breakTypeA === 1 /* Prepend */) {\r\n return false; // GB9b\r\n }\r\n // Do not break within emoji modifier sequences or emoji zwj sequences.\r\n // GB11 \\p{Extended_Pictographic} Extend* ZWJ \u00D7 \\p{Extended_Pictographic}\r\n if (breakTypeA === 13 /* ZWJ */ && breakTypeB === 14 /* Extended_Pictographic */) {\r\n // Note: we are not implementing the rule entirely here to avoid introducing states\r\n return false; // GB11\r\n }\r\n // GB12 sot (RI RI)* RI \u00D7 RI\r\n // GB13 [^RI] (RI RI)* RI \u00D7 RI\r\n if (breakTypeA === 6 /* Regional_Indicator */ && breakTypeB === 6 /* Regional_Indicator */) {\r\n // Note: we are not implementing the rule entirely here to avoid introducing states\r\n return false; // GB12 & GB13\r\n }\r\n // GB999 Any \u00F7 Any\r\n return true;\r\n}\r\nclass GraphemeBreakTree {\r\n constructor() {\r\n this._data = getGraphemeBreakRawData();\r\n }\r\n static getInstance() {\r\n if (!GraphemeBreakTree._INSTANCE) {\r\n GraphemeBreakTree._INSTANCE = new GraphemeBreakTree();\r\n }\r\n return GraphemeBreakTree._INSTANCE;\r\n }\r\n getGraphemeBreakType(codePoint) {\r\n // !!! Let's make 7bit ASCII a bit faster: 0..31\r\n if (codePoint < 32) {\r\n if (codePoint === 10 /* LineFeed */) {\r\n return 3 /* LF */;\r\n }\r\n if (codePoint === 13 /* CarriageReturn */) {\r\n return 2 /* CR */;\r\n }\r\n return 4 /* Control */;\r\n }\r\n // !!! Let's make 7bit ASCII a bit faster: 32..126\r\n if (codePoint < 127) {\r\n return 0 /* Other */;\r\n }\r\n const data = this._data;\r\n const nodeCount = data.length / 3;\r\n let nodeIndex = 1;\r\n while (nodeIndex <= nodeCount) {\r\n if (codePoint < data[3 * nodeIndex]) {\r\n // go left\r\n nodeIndex = 2 * nodeIndex;\r\n }\r\n else if (codePoint > data[3 * nodeIndex + 1]) {\r\n // go right\r\n nodeIndex = 2 * nodeIndex + 1;\r\n }\r\n else {\r\n // hit\r\n return data[3 * nodeIndex + 2];\r\n }\r\n }\r\n return 0 /* Other */;\r\n }\r\n}\r\nGraphemeBreakTree._INSTANCE = null;\r\nfunction getGraphemeBreakRawData() {\r\n // generated using https://github.com/alexdima/unicode-utils/blob/master/generate-grapheme-break.js\r\n return JSON.parse('[0,0,0,51592,51592,11,44424,44424,11,72251,72254,5,7150,7150,7,48008,48008,11,55176,55176,11,128420,128420,14,3276,3277,5,9979,9980,14,46216,46216,11,49800,49800,11,53384,53384,11,70726,70726,5,122915,122916,5,129320,129327,14,2558,2558,5,5906,5908,5,9762,9763,14,43360,43388,8,45320,45320,11,47112,47112,11,48904,48904,11,50696,50696,11,52488,52488,11,54280,54280,11,70082,70083,1,71350,71350,7,73111,73111,5,127892,127893,14,128726,128727,14,129473,129474,14,2027,2035,5,2901,2902,5,3784,3789,5,6754,6754,5,8418,8420,5,9877,9877,14,11088,11088,14,44008,44008,5,44872,44872,11,45768,45768,11,46664,46664,11,47560,47560,11,48456,48456,11,49352,49352,11,50248,50248,11,51144,51144,11,52040,52040,11,52936,52936,11,53832,53832,11,54728,54728,11,69811,69814,5,70459,70460,5,71096,71099,7,71998,71998,5,72874,72880,5,119149,119149,7,127374,127374,14,128335,128335,14,128482,128482,14,128765,128767,14,129399,129400,14,129680,129685,14,1476,1477,5,2377,2380,7,2759,2760,5,3137,3140,7,3458,3459,7,4153,4154,5,6432,6434,5,6978,6978,5,7675,7679,5,9723,9726,14,9823,9823,14,9919,9923,14,10035,10036,14,42736,42737,5,43596,43596,5,44200,44200,11,44648,44648,11,45096,45096,11,45544,45544,11,45992,45992,11,46440,46440,11,46888,46888,11,47336,47336,11,47784,47784,11,48232,48232,11,48680,48680,11,49128,49128,11,49576,49576,11,50024,50024,11,50472,50472,11,50920,50920,11,51368,51368,11,51816,51816,11,52264,52264,11,52712,52712,11,53160,53160,11,53608,53608,11,54056,54056,11,54504,54504,11,54952,54952,11,68108,68111,5,69933,69940,5,70197,70197,7,70498,70499,7,70845,70845,5,71229,71229,5,71727,71735,5,72154,72155,5,72344,72345,5,73023,73029,5,94095,94098,5,121403,121452,5,126981,127182,14,127538,127546,14,127990,127990,14,128391,128391,14,128445,128449,14,128500,128505,14,128752,128752,14,129160,129167,14,129356,129356,14,129432,129442,14,129648,129651,14,129751,131069,14,173,173,4,1757,1757,1,2274,2274,1,2494,2494,5,2641,2641,5,2876,2876,5,3014,3016,7,3262,3262,7,3393,3396,5,3570,3571,7,3968,3972,5,4228,4228,7,6086,6086,5,6679,6680,5,6912,6915,5,7080,7081,5,7380,7392,5,8252,8252,14,9096,9096,14,9748,9749,14,9784,9786,14,9833,9850,14,9890,9894,14,9938,9938,14,9999,9999,14,10085,10087,14,12349,12349,14,43136,43137,7,43454,43456,7,43755,43755,7,44088,44088,11,44312,44312,11,44536,44536,11,44760,44760,11,44984,44984,11,45208,45208,11,45432,45432,11,45656,45656,11,45880,45880,11,46104,46104,11,46328,46328,11,46552,46552,11,46776,46776,11,47000,47000,11,47224,47224,11,47448,47448,11,47672,47672,11,47896,47896,11,48120,48120,11,48344,48344,11,48568,48568,11,48792,48792,11,49016,49016,11,49240,49240,11,49464,49464,11,49688,49688,11,49912,49912,11,50136,50136,11,50360,50360,11,50584,50584,11,50808,50808,11,51032,51032,11,51256,51256,11,51480,51480,11,51704,51704,11,51928,51928,11,52152,52152,11,52376,52376,11,52600,52600,11,52824,52824,11,53048,53048,11,53272,53272,11,53496,53496,11,53720,53720,11,53944,53944,11,54168,54168,11,54392,54392,11,54616,54616,11,54840,54840,11,55064,55064,11,65438,65439,5,69633,69633,5,69837,69837,1,70018,70018,7,70188,70190,7,70368,70370,7,70465,70468,7,70712,70719,5,70835,70840,5,70850,70851,5,71132,71133,5,71340,71340,7,71458,71461,5,71985,71989,7,72002,72002,7,72193,72202,5,72281,72283,5,72766,72766,7,72885,72886,5,73104,73105,5,92912,92916,5,113824,113827,4,119173,119179,5,121505,121519,5,125136,125142,5,127279,127279,14,127489,127490,14,127570,127743,14,127900,127901,14,128254,128254,14,128369,128370,14,128400,128400,14,128425,128432,14,128468,128475,14,128489,128494,14,128715,128720,14,128745,128745,14,128759,128760,14,129004,129023,14,129296,129304,14,129340,129342,14,129388,129392,14,129404,129407,14,129454,129455,14,129485,129487,14,129659,129663,14,129719,129727,14,917536,917631,5,13,13,2,1160,1161,5,1564,1564,4,1807,1807,1,2085,2087,5,2363,2363,7,2402,2403,5,2507,2508,7,2622,2624,7,2691,2691,7,2786,2787,5,2881,2884,5,3006,3006,5,3072,3072,5,3170,3171,5,3267,3268,7,3330,3331,7,3406,3406,1,3538,3540,5,3655,3662,5,3897,3897,5,4038,4038,5,4184,4185,5,4352,4447,8,6068,6069,5,6155,6157,5,6448,6449,7,6742,6742,5,6783,6783,5,6966,6970,5,7042,7042,7,7143,7143,7,7212,7219,5,7412,7412,5,8206,8207,4,8294,8303,4,8596,8601,14,9410,9410,14,9742,9742,14,9757,9757,14,9770,9770,14,9794,9794,14,9828,9828,14,9855,9855,14,9882,9882,14,9900,9903,14,9929,9933,14,9963,9967,14,9987,9988,14,10006,10006,14,10062,10062,14,10175,10175,14,11744,11775,5,42607,42607,5,43043,43044,7,43263,43263,5,43444,43445,7,43569,43570,5,43698,43700,5,43766,43766,5,44032,44032,11,44144,44144,11,44256,44256,11,44368,44368,11,44480,44480,11,44592,44592,11,44704,44704,11,44816,44816,11,44928,44928,11,45040,45040,11,45152,45152,11,45264,45264,11,45376,45376,11,45488,45488,11,45600,45600,11,45712,45712,11,45824,45824,11,45936,45936,11,46048,46048,11,46160,46160,11,46272,46272,11,46384,46384,11,46496,46496,11,46608,46608,11,46720,46720,11,46832,46832,11,46944,46944,11,47056,47056,11,47168,47168,11,47280,47280,11,47392,47392,11,47504,47504,11,47616,47616,11,47728,47728,11,47840,47840,11,47952,47952,11,48064,48064,11,48176,48176,11,48288,48288,11,48400,48400,11,48512,48512,11,48624,48624,11,48736,48736,11,48848,48848,11,48960,48960,11,49072,49072,11,49184,49184,11,49296,49296,11,49408,49408,11,49520,49520,11,49632,49632,11,49744,49744,11,49856,49856,11,49968,49968,11,50080,50080,11,50192,50192,11,50304,50304,11,50416,50416,11,50528,50528,11,50640,50640,11,50752,50752,11,50864,50864,11,50976,50976,11,51088,51088,11,51200,51200,11,51312,51312,11,51424,51424,11,51536,51536,11,51648,51648,11,51760,51760,11,51872,51872,11,51984,51984,11,52096,52096,11,52208,52208,11,52320,52320,11,52432,52432,11,52544,52544,11,52656,52656,11,52768,52768,11,52880,52880,11,52992,52992,11,53104,53104,11,53216,53216,11,53328,53328,11,53440,53440,11,53552,53552,11,53664,53664,11,53776,53776,11,53888,53888,11,54000,54000,11,54112,54112,11,54224,54224,11,54336,54336,11,54448,54448,11,54560,54560,11,54672,54672,11,54784,54784,11,54896,54896,11,55008,55008,11,55120,55120,11,64286,64286,5,66272,66272,5,68900,68903,5,69762,69762,7,69817,69818,5,69927,69931,5,70003,70003,5,70070,70078,5,70094,70094,7,70194,70195,7,70206,70206,5,70400,70401,5,70463,70463,7,70475,70477,7,70512,70516,5,70722,70724,5,70832,70832,5,70842,70842,5,70847,70848,5,71088,71089,7,71102,71102,7,71219,71226,5,71231,71232,5,71342,71343,7,71453,71455,5,71463,71467,5,71737,71738,5,71995,71996,5,72000,72000,7,72145,72147,7,72160,72160,5,72249,72249,7,72273,72278,5,72330,72342,5,72752,72758,5,72850,72871,5,72882,72883,5,73018,73018,5,73031,73031,5,73109,73109,5,73461,73462,7,94031,94031,5,94192,94193,7,119142,119142,7,119155,119162,4,119362,119364,5,121476,121476,5,122888,122904,5,123184,123190,5,126976,126979,14,127184,127231,14,127344,127345,14,127405,127461,14,127514,127514,14,127561,127567,14,127778,127779,14,127896,127896,14,127985,127986,14,127995,127999,5,128326,128328,14,128360,128366,14,128378,128378,14,128394,128397,14,128405,128406,14,128422,128423,14,128435,128443,14,128453,128464,14,128479,128480,14,128484,128487,14,128496,128498,14,128640,128709,14,128723,128724,14,128736,128741,14,128747,128748,14,128755,128755,14,128762,128762,14,128981,128991,14,129096,129103,14,129292,129292,14,129311,129311,14,129329,129330,14,129344,129349,14,129360,129374,14,129394,129394,14,129402,129402,14,129413,129425,14,129445,129450,14,129466,129471,14,129483,129483,14,129511,129535,14,129653,129655,14,129667,129670,14,129705,129711,14,129731,129743,14,917505,917505,4,917760,917999,5,10,10,3,127,159,4,768,879,5,1471,1471,5,1536,1541,1,1648,1648,5,1767,1768,5,1840,1866,5,2070,2073,5,2137,2139,5,2307,2307,7,2366,2368,7,2382,2383,7,2434,2435,7,2497,2500,5,2519,2519,5,2563,2563,7,2631,2632,5,2677,2677,5,2750,2752,7,2763,2764,7,2817,2817,5,2879,2879,5,2891,2892,7,2914,2915,5,3008,3008,5,3021,3021,5,3076,3076,5,3146,3149,5,3202,3203,7,3264,3265,7,3271,3272,7,3298,3299,5,3390,3390,5,3402,3404,7,3426,3427,5,3535,3535,5,3544,3550,7,3635,3635,7,3763,3763,7,3893,3893,5,3953,3966,5,3981,3991,5,4145,4145,7,4157,4158,5,4209,4212,5,4237,4237,5,4520,4607,10,5970,5971,5,6071,6077,5,6089,6099,5,6277,6278,5,6439,6440,5,6451,6456,7,6683,6683,5,6744,6750,5,6765,6770,7,6846,6846,5,6964,6964,5,6972,6972,5,7019,7027,5,7074,7077,5,7083,7085,5,7146,7148,7,7154,7155,7,7222,7223,5,7394,7400,5,7416,7417,5,8204,8204,5,8233,8233,4,8288,8292,4,8413,8416,5,8482,8482,14,8986,8987,14,9193,9203,14,9654,9654,14,9733,9733,14,9745,9745,14,9752,9752,14,9760,9760,14,9766,9766,14,9774,9775,14,9792,9792,14,9800,9811,14,9825,9826,14,9831,9831,14,9852,9853,14,9872,9873,14,9880,9880,14,9885,9887,14,9896,9897,14,9906,9916,14,9926,9927,14,9936,9936,14,9941,9960,14,9974,9974,14,9982,9985,14,9992,9997,14,10002,10002,14,10017,10017,14,10055,10055,14,10071,10071,14,10145,10145,14,11013,11015,14,11503,11505,5,12334,12335,5,12951,12951,14,42612,42621,5,43014,43014,5,43047,43047,7,43204,43205,5,43335,43345,5,43395,43395,7,43450,43451,7,43561,43566,5,43573,43574,5,43644,43644,5,43710,43711,5,43758,43759,7,44005,44005,5,44012,44012,7,44060,44060,11,44116,44116,11,44172,44172,11,44228,44228,11,44284,44284,11,44340,44340,11,44396,44396,11,44452,44452,11,44508,44508,11,44564,44564,11,44620,44620,11,44676,44676,11,44732,44732,11,44788,44788,11,44844,44844,11,44900,44900,11,44956,44956,11,45012,45012,11,45068,45068,11,45124,45124,11,45180,45180,11,45236,45236,11,45292,45292,11,45348,45348,11,45404,45404,11,45460,45460,11,45516,45516,11,45572,45572,11,45628,45628,11,45684,45684,11,45740,45740,11,45796,45796,11,45852,45852,11,45908,45908,11,45964,45964,11,46020,46020,11,46076,46076,11,46132,46132,11,46188,46188,11,46244,46244,11,46300,46300,11,46356,46356,11,46412,46412,11,46468,46468,11,46524,46524,11,46580,46580,11,46636,46636,11,46692,46692,11,46748,46748,11,46804,46804,11,46860,46860,11,46916,46916,11,46972,46972,11,47028,47028,11,47084,47084,11,47140,47140,11,47196,47196,11,47252,47252,11,47308,47308,11,47364,47364,11,47420,47420,11,47476,47476,11,47532,47532,11,47588,47588,11,47644,47644,11,47700,47700,11,47756,47756,11,47812,47812,11,47868,47868,11,47924,47924,11,47980,47980,11,48036,48036,11,48092,48092,11,48148,48148,11,48204,48204,11,48260,48260,11,48316,48316,11,48372,48372,11,48428,48428,11,48484,48484,11,48540,48540,11,48596,48596,11,48652,48652,11,48708,48708,11,48764,48764,11,48820,48820,11,48876,48876,11,48932,48932,11,48988,48988,11,49044,49044,11,49100,49100,11,49156,49156,11,49212,49212,11,49268,49268,11,49324,49324,11,49380,49380,11,49436,49436,11,49492,49492,11,49548,49548,11,49604,49604,11,49660,49660,11,49716,49716,11,49772,49772,11,49828,49828,11,49884,49884,11,49940,49940,11,49996,49996,11,50052,50052,11,50108,50108,11,50164,50164,11,50220,50220,11,50276,50276,11,50332,50332,11,50388,50388,11,50444,50444,11,50500,50500,11,50556,50556,11,50612,50612,11,50668,50668,11,50724,50724,11,50780,50780,11,50836,50836,11,50892,50892,11,50948,50948,11,51004,51004,11,51060,51060,11,51116,51116,11,51172,51172,11,51228,51228,11,51284,51284,11,51340,51340,11,51396,51396,11,51452,51452,11,51508,51508,11,51564,51564,11,51620,51620,11,51676,51676,11,51732,51732,11,51788,51788,11,51844,51844,11,51900,51900,11,51956,51956,11,52012,52012,11,52068,52068,11,52124,52124,11,52180,52180,11,52236,52236,11,52292,52292,11,52348,52348,11,52404,52404,11,52460,52460,11,52516,52516,11,52572,52572,11,52628,52628,11,52684,52684,11,52740,52740,11,52796,52796,11,52852,52852,11,52908,52908,11,52964,52964,11,53020,53020,11,53076,53076,11,53132,53132,11,53188,53188,11,53244,53244,11,53300,53300,11,53356,53356,11,53412,53412,11,53468,53468,11,53524,53524,11,53580,53580,11,53636,53636,11,53692,53692,11,53748,53748,11,53804,53804,11,53860,53860,11,53916,53916,11,53972,53972,11,54028,54028,11,54084,54084,11,54140,54140,11,54196,54196,11,54252,54252,11,54308,54308,11,54364,54364,11,54420,54420,11,54476,54476,11,54532,54532,11,54588,54588,11,54644,54644,11,54700,54700,11,54756,54756,11,54812,54812,11,54868,54868,11,54924,54924,11,54980,54980,11,55036,55036,11,55092,55092,11,55148,55148,11,55216,55238,9,65056,65071,5,65529,65531,4,68097,68099,5,68159,68159,5,69446,69456,5,69688,69702,5,69808,69810,7,69815,69816,7,69821,69821,1,69888,69890,5,69932,69932,7,69957,69958,7,70016,70017,5,70067,70069,7,70079,70080,7,70089,70092,5,70095,70095,5,70191,70193,5,70196,70196,5,70198,70199,5,70367,70367,5,70371,70378,5,70402,70403,7,70462,70462,5,70464,70464,5,70471,70472,7,70487,70487,5,70502,70508,5,70709,70711,7,70720,70721,7,70725,70725,7,70750,70750,5,70833,70834,7,70841,70841,7,70843,70844,7,70846,70846,7,70849,70849,7,71087,71087,5,71090,71093,5,71100,71101,5,71103,71104,5,71216,71218,7,71227,71228,7,71230,71230,7,71339,71339,5,71341,71341,5,71344,71349,5,71351,71351,5,71456,71457,7,71462,71462,7,71724,71726,7,71736,71736,7,71984,71984,5,71991,71992,7,71997,71997,7,71999,71999,1,72001,72001,1,72003,72003,5,72148,72151,5,72156,72159,7,72164,72164,7,72243,72248,5,72250,72250,1,72263,72263,5,72279,72280,7,72324,72329,1,72343,72343,7,72751,72751,7,72760,72765,5,72767,72767,5,72873,72873,7,72881,72881,7,72884,72884,7,73009,73014,5,73020,73021,5,73030,73030,1,73098,73102,7,73107,73108,7,73110,73110,7,73459,73460,5,78896,78904,4,92976,92982,5,94033,94087,7,94180,94180,5,113821,113822,5,119141,119141,5,119143,119145,5,119150,119154,5,119163,119170,5,119210,119213,5,121344,121398,5,121461,121461,5,121499,121503,5,122880,122886,5,122907,122913,5,122918,122922,5,123628,123631,5,125252,125258,5,126980,126980,14,127183,127183,14,127245,127247,14,127340,127343,14,127358,127359,14,127377,127386,14,127462,127487,6,127491,127503,14,127535,127535,14,127548,127551,14,127568,127569,14,127744,127777,14,127780,127891,14,127894,127895,14,127897,127899,14,127902,127984,14,127987,127989,14,127991,127994,14,128000,128253,14,128255,128317,14,128329,128334,14,128336,128359,14,128367,128368,14,128371,128377,14,128379,128390,14,128392,128393,14,128398,128399,14,128401,128404,14,128407,128419,14,128421,128421,14,128424,128424,14,128433,128434,14,128444,128444,14,128450,128452,14,128465,128467,14,128476,128478,14,128481,128481,14,128483,128483,14,128488,128488,14,128495,128495,14,128499,128499,14,128506,128591,14,128710,128714,14,128721,128722,14,128725,128725,14,128728,128735,14,128742,128744,14,128746,128746,14,128749,128751,14,128753,128754,14,128756,128758,14,128761,128761,14,128763,128764,14,128884,128895,14,128992,129003,14,129036,129039,14,129114,129119,14,129198,129279,14,129293,129295,14,129305,129310,14,129312,129319,14,129328,129328,14,129331,129338,14,129343,129343,14,129351,129355,14,129357,129359,14,129375,129387,14,129393,129393,14,129395,129398,14,129401,129401,14,129403,129403,14,129408,129412,14,129426,129431,14,129443,129444,14,129451,129453,14,129456,129465,14,129472,129472,14,129475,129482,14,129484,129484,14,129488,129510,14,129536,129647,14,129652,129652,14,129656,129658,14,129664,129666,14,129671,129679,14,129686,129704,14,129712,129718,14,129728,129730,14,129744,129750,14,917504,917504,4,917506,917535,4,917632,917759,4,918000,921599,4,0,9,4,11,12,4,14,31,4,169,169,14,174,174,14,1155,1159,5,1425,1469,5,1473,1474,5,1479,1479,5,1552,1562,5,1611,1631,5,1750,1756,5,1759,1764,5,1770,1773,5,1809,1809,5,1958,1968,5,2045,2045,5,2075,2083,5,2089,2093,5,2259,2273,5,2275,2306,5,2362,2362,5,2364,2364,5,2369,2376,5,2381,2381,5,2385,2391,5,2433,2433,5,2492,2492,5,2495,2496,7,2503,2504,7,2509,2509,5,2530,2531,5,2561,2562,5,2620,2620,5,2625,2626,5,2635,2637,5,2672,2673,5,2689,2690,5,2748,2748,5,2753,2757,5,2761,2761,7,2765,2765,5,2810,2815,5,2818,2819,7,2878,2878,5,2880,2880,7,2887,2888,7,2893,2893,5,2903,2903,5,2946,2946,5,3007,3007,7,3009,3010,7,3018,3020,7,3031,3031,5,3073,3075,7,3134,3136,5,3142,3144,5,3157,3158,5,3201,3201,5,3260,3260,5,3263,3263,5,3266,3266,5,3270,3270,5,3274,3275,7,3285,3286,5,3328,3329,5,3387,3388,5,3391,3392,7,3398,3400,7,3405,3405,5,3415,3415,5,3457,3457,5,3530,3530,5,3536,3537,7,3542,3542,5,3551,3551,5,3633,3633,5,3636,3642,5,3761,3761,5,3764,3772,5,3864,3865,5,3895,3895,5,3902,3903,7,3967,3967,7,3974,3975,5,3993,4028,5,4141,4144,5,4146,4151,5,4155,4156,7,4182,4183,7,4190,4192,5,4226,4226,5,4229,4230,5,4253,4253,5,4448,4519,9,4957,4959,5,5938,5940,5,6002,6003,5,6070,6070,7,6078,6085,7,6087,6088,7,6109,6109,5,6158,6158,4,6313,6313,5,6435,6438,7,6441,6443,7,6450,6450,5,6457,6459,5,6681,6682,7,6741,6741,7,6743,6743,7,6752,6752,5,6757,6764,5,6771,6780,5,6832,6845,5,6847,6848,5,6916,6916,7,6965,6965,5,6971,6971,7,6973,6977,7,6979,6980,7,7040,7041,5,7073,7073,7,7078,7079,7,7082,7082,7,7142,7142,5,7144,7145,5,7149,7149,5,7151,7153,5,7204,7211,7,7220,7221,7,7376,7378,5,7393,7393,7,7405,7405,5,7415,7415,7,7616,7673,5,8203,8203,4,8205,8205,13,8232,8232,4,8234,8238,4,8265,8265,14,8293,8293,4,8400,8412,5,8417,8417,5,8421,8432,5,8505,8505,14,8617,8618,14,9000,9000,14,9167,9167,14,9208,9210,14,9642,9643,14,9664,9664,14,9728,9732,14,9735,9741,14,9743,9744,14,9746,9746,14,9750,9751,14,9753,9756,14,9758,9759,14,9761,9761,14,9764,9765,14,9767,9769,14,9771,9773,14,9776,9783,14,9787,9791,14,9793,9793,14,9795,9799,14,9812,9822,14,9824,9824,14,9827,9827,14,9829,9830,14,9832,9832,14,9851,9851,14,9854,9854,14,9856,9861,14,9874,9876,14,9878,9879,14,9881,9881,14,9883,9884,14,9888,9889,14,9895,9895,14,9898,9899,14,9904,9905,14,9917,9918,14,9924,9925,14,9928,9928,14,9934,9935,14,9937,9937,14,9939,9940,14,9961,9962,14,9968,9973,14,9975,9978,14,9981,9981,14,9986,9986,14,9989,9989,14,9998,9998,14,10000,10001,14,10004,10004,14,10013,10013,14,10024,10024,14,10052,10052,14,10060,10060,14,10067,10069,14,10083,10084,14,10133,10135,14,10160,10160,14,10548,10549,14,11035,11036,14,11093,11093,14,11647,11647,5,12330,12333,5,12336,12336,14,12441,12442,5,12953,12953,14,42608,42610,5,42654,42655,5,43010,43010,5,43019,43019,5,43045,43046,5,43052,43052,5,43188,43203,7,43232,43249,5,43302,43309,5,43346,43347,7,43392,43394,5,43443,43443,5,43446,43449,5,43452,43453,5,43493,43493,5,43567,43568,7,43571,43572,7,43587,43587,5,43597,43597,7,43696,43696,5,43703,43704,5,43713,43713,5,43756,43757,5,43765,43765,7,44003,44004,7,44006,44007,7,44009,44010,7,44013,44013,5,44033,44059,12,44061,44087,12,44089,44115,12,44117,44143,12,44145,44171,12,44173,44199,12,44201,44227,12,44229,44255,12,44257,44283,12,44285,44311,12,44313,44339,12,44341,44367,12,44369,44395,12,44397,44423,12,44425,44451,12,44453,44479,12,44481,44507,12,44509,44535,12,44537,44563,12,44565,44591,12,44593,44619,12,44621,44647,12,44649,44675,12,44677,44703,12,44705,44731,12,44733,44759,12,44761,44787,12,44789,44815,12,44817,44843,12,44845,44871,12,44873,44899,12,44901,44927,12,44929,44955,12,44957,44983,12,44985,45011,12,45013,45039,12,45041,45067,12,45069,45095,12,45097,45123,12,45125,45151,12,45153,45179,12,45181,45207,12,45209,45235,12,45237,45263,12,45265,45291,12,45293,45319,12,45321,45347,12,45349,45375,12,45377,45403,12,45405,45431,12,45433,45459,12,45461,45487,12,45489,45515,12,45517,45543,12,45545,45571,12,45573,45599,12,45601,45627,12,45629,45655,12,45657,45683,12,45685,45711,12,45713,45739,12,45741,45767,12,45769,45795,12,45797,45823,12,45825,45851,12,45853,45879,12,45881,45907,12,45909,45935,12,45937,45963,12,45965,45991,12,45993,46019,12,46021,46047,12,46049,46075,12,46077,46103,12,46105,46131,12,46133,46159,12,46161,46187,12,46189,46215,12,46217,46243,12,46245,46271,12,46273,46299,12,46301,46327,12,46329,46355,12,46357,46383,12,46385,46411,12,46413,46439,12,46441,46467,12,46469,46495,12,46497,46523,12,46525,46551,12,46553,46579,12,46581,46607,12,46609,46635,12,46637,46663,12,46665,46691,12,46693,46719,12,46721,46747,12,46749,46775,12,46777,46803,12,46805,46831,12,46833,46859,12,46861,46887,12,46889,46915,12,46917,46943,12,46945,46971,12,46973,46999,12,47001,47027,12,47029,47055,12,47057,47083,12,47085,47111,12,47113,47139,12,47141,47167,12,47169,47195,12,47197,47223,12,47225,47251,12,47253,47279,12,47281,47307,12,47309,47335,12,47337,47363,12,47365,47391,12,47393,47419,12,47421,47447,12,47449,47475,12,47477,47503,12,47505,47531,12,47533,47559,12,47561,47587,12,47589,47615,12,47617,47643,12,47645,47671,12,47673,47699,12,47701,47727,12,47729,47755,12,47757,47783,12,47785,47811,12,47813,47839,12,47841,47867,12,47869,47895,12,47897,47923,12,47925,47951,12,47953,47979,12,47981,48007,12,48009,48035,12,48037,48063,12,48065,48091,12,48093,48119,12,48121,48147,12,48149,48175,12,48177,48203,12,48205,48231,12,48233,48259,12,48261,48287,12,48289,48315,12,48317,48343,12,48345,48371,12,48373,48399,12,48401,48427,12,48429,48455,12,48457,48483,12,48485,48511,12,48513,48539,12,48541,48567,12,48569,48595,12,48597,48623,12,48625,48651,12,48653,48679,12,48681,48707,12,48709,48735,12,48737,48763,12,48765,48791,12,48793,48819,12,48821,48847,12,48849,48875,12,48877,48903,12,48905,48931,12,48933,48959,12,48961,48987,12,48989,49015,12,49017,49043,12,49045,49071,12,49073,49099,12,49101,49127,12,49129,49155,12,49157,49183,12,49185,49211,12,49213,49239,12,49241,49267,12,49269,49295,12,49297,49323,12,49325,49351,12,49353,49379,12,49381,49407,12,49409,49435,12,49437,49463,12,49465,49491,12,49493,49519,12,49521,49547,12,49549,49575,12,49577,49603,12,49605,49631,12,49633,49659,12,49661,49687,12,49689,49715,12,49717,49743,12,49745,49771,12,49773,49799,12,49801,49827,12,49829,49855,12,49857,49883,12,49885,49911,12,49913,49939,12,49941,49967,12,49969,49995,12,49997,50023,12,50025,50051,12,50053,50079,12,50081,50107,12,50109,50135,12,50137,50163,12,50165,50191,12,50193,50219,12,50221,50247,12,50249,50275,12,50277,50303,12,50305,50331,12,50333,50359,12,50361,50387,12,50389,50415,12,50417,50443,12,50445,50471,12,50473,50499,12,50501,50527,12,50529,50555,12,50557,50583,12,50585,50611,12,50613,50639,12,50641,50667,12,50669,50695,12,50697,50723,12,50725,50751,12,50753,50779,12,50781,50807,12,50809,50835,12,50837,50863,12,50865,50891,12,50893,50919,12,50921,50947,12,50949,50975,12,50977,51003,12,51005,51031,12,51033,51059,12,51061,51087,12,51089,51115,12,51117,51143,12,51145,51171,12,51173,51199,12,51201,51227,12,51229,51255,12,51257,51283,12,51285,51311,12,51313,51339,12,51341,51367,12,51369,51395,12,51397,51423,12,51425,51451,12,51453,51479,12,51481,51507,12,51509,51535,12,51537,51563,12,51565,51591,12,51593,51619,12,51621,51647,12,51649,51675,12,51677,51703,12,51705,51731,12,51733,51759,12,51761,51787,12,51789,51815,12,51817,51843,12,51845,51871,12,51873,51899,12,51901,51927,12,51929,51955,12,51957,51983,12,51985,52011,12,52013,52039,12,52041,52067,12,52069,52095,12,52097,52123,12,52125,52151,12,52153,52179,12,52181,52207,12,52209,52235,12,52237,52263,12,52265,52291,12,52293,52319,12,52321,52347,12,52349,52375,12,52377,52403,12,52405,52431,12,52433,52459,12,52461,52487,12,52489,52515,12,52517,52543,12,52545,52571,12,52573,52599,12,52601,52627,12,52629,52655,12,52657,52683,12,52685,52711,12,52713,52739,12,52741,52767,12,52769,52795,12,52797,52823,12,52825,52851,12,52853,52879,12,52881,52907,12,52909,52935,12,52937,52963,12,52965,52991,12,52993,53019,12,53021,53047,12,53049,53075,12,53077,53103,12,53105,53131,12,53133,53159,12,53161,53187,12,53189,53215,12,53217,53243,12,53245,53271,12,53273,53299,12,53301,53327,12,53329,53355,12,53357,53383,12,53385,53411,12,53413,53439,12,53441,53467,12,53469,53495,12,53497,53523,12,53525,53551,12,53553,53579,12,53581,53607,12,53609,53635,12,53637,53663,12,53665,53691,12,53693,53719,12,53721,53747,12,53749,53775,12,53777,53803,12,53805,53831,12,53833,53859,12,53861,53887,12,53889,53915,12,53917,53943,12,53945,53971,12,53973,53999,12,54001,54027,12,54029,54055,12,54057,54083,12,54085,54111,12,54113,54139,12,54141,54167,12,54169,54195,12,54197,54223,12,54225,54251,12,54253,54279,12,54281,54307,12,54309,54335,12,54337,54363,12,54365,54391,12,54393,54419,12,54421,54447,12,54449,54475,12,54477,54503,12,54505,54531,12,54533,54559,12,54561,54587,12,54589,54615,12,54617,54643,12,54645,54671,12,54673,54699,12,54701,54727,12,54729,54755,12,54757,54783,12,54785,54811,12,54813,54839,12,54841,54867,12,54869,54895,12,54897,54923,12,54925,54951,12,54953,54979,12,54981,55007,12,55009,55035,12,55037,55063,12,55065,55091,12,55093,55119,12,55121,55147,12,55149,55175,12,55177,55203,12,55243,55291,10,65024,65039,5,65279,65279,4,65520,65528,4,66045,66045,5,66422,66426,5,68101,68102,5,68152,68154,5,68325,68326,5,69291,69292,5,69632,69632,7,69634,69634,7,69759,69761,5]');\r\n}\r\n//#endregion\r\n/**\r\n * Computes the offset after performing a left delete on the given string,\r\n * while considering unicode grapheme/emoji rules.\r\n*/\r\nexport function getLeftDeleteOffset(offset, str) {\r\n if (offset === 0) {\r\n return 0;\r\n }\r\n // Try to delete emoji part.\r\n const emojiOffset = getOffsetBeforeLastEmojiComponent(offset, str);\r\n if (emojiOffset !== undefined) {\r\n return emojiOffset;\r\n }\r\n // Otherwise, just skip a single code point.\r\n const codePoint = getPrevCodePoint(str, offset);\r\n offset -= getUTF16Length(codePoint);\r\n return offset;\r\n}\r\nfunction getOffsetBeforeLastEmojiComponent(offset, str) {\r\n // See https://www.unicode.org/reports/tr51/tr51-14.html#EBNF_and_Regex for the\r\n // structure of emojis.\r\n let codePoint = getPrevCodePoint(str, offset);\r\n offset -= getUTF16Length(codePoint);\r\n // Skip modifiers\r\n while ((isEmojiModifier(codePoint) || codePoint === 65039 /* emojiVariantSelector */ || codePoint === 8419 /* enclosingKeyCap */)) {\r\n if (offset === 0) {\r\n // Cannot skip modifier, no preceding emoji base.\r\n return undefined;\r\n }\r\n codePoint = getPrevCodePoint(str, offset);\r\n offset -= getUTF16Length(codePoint);\r\n }\r\n // Expect base emoji\r\n if (!isEmojiImprecise(codePoint)) {\r\n // Unexpected code point, not a valid emoji.\r\n return undefined;\r\n }\r\n if (offset >= 0) {\r\n // Skip optional ZWJ code points that combine multiple emojis.\r\n // In theory, we should check if that ZWJ actually combines multiple emojis\r\n // to prevent deleting ZWJs in situations we didn't account for.\r\n const optionalZwjCodePoint = getPrevCodePoint(str, offset);\r\n if (optionalZwjCodePoint === 8205 /* zwj */) {\r\n offset -= getUTF16Length(optionalZwjCodePoint);\r\n }\r\n }\r\n return offset;\r\n}\r\nfunction getUTF16Length(codePoint) {\r\n return codePoint >= 65536 /* UNICODE_SUPPLEMENTARY_PLANE_BEGIN */ ? 2 : 1;\r\n}\r\nfunction isEmojiModifier(codePoint) {\r\n return 0x1F3FB <= codePoint && codePoint <= 0x1F3FF;\r\n}\r\n", "/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License. See License.txt in the project root for license information.\r\n *--------------------------------------------------------------------------------------------*/\r\nimport { isFalsyOrWhitespace } from '../../../base/common/strings.js';\r\nimport { createDecorator } from '../../instantiation/common/instantiation.js';\r\nimport { userAgent, isMacintosh, isLinux, isWindows, isWeb } from '../../../base/common/platform.js';\r\nlet _userAgent = userAgent || '';\r\nconst STATIC_VALUES = new Map();\r\nSTATIC_VALUES.set('false', false);\r\nSTATIC_VALUES.set('true', true);\r\nSTATIC_VALUES.set('isMac', isMacintosh);\r\nSTATIC_VALUES.set('isLinux', isLinux);\r\nSTATIC_VALUES.set('isWindows', isWindows);\r\nSTATIC_VALUES.set('isWeb', isWeb);\r\nSTATIC_VALUES.set('isMacNative', isMacintosh && !isWeb);\r\nSTATIC_VALUES.set('isEdge', _userAgent.indexOf('Edg/') >= 0);\r\nSTATIC_VALUES.set('isFirefox', _userAgent.indexOf('Firefox') >= 0);\r\nSTATIC_VALUES.set('isChrome', _userAgent.indexOf('Chrome') >= 0);\r\nSTATIC_VALUES.set('isSafari', _userAgent.indexOf('Safari') >= 0);\r\nconst hasOwnProperty = Object.prototype.hasOwnProperty;\r\nexport class ContextKeyExpr {\r\n static has(key) {\r\n return ContextKeyDefinedExpr.create(key);\r\n }\r\n static equals(key, value) {\r\n return ContextKeyEqualsExpr.create(key, value);\r\n }\r\n static regex(key, value) {\r\n return ContextKeyRegexExpr.create(key, value);\r\n }\r\n static not(key) {\r\n return ContextKeyNotExpr.create(key);\r\n }\r\n static and(...expr) {\r\n return ContextKeyAndExpr.create(expr);\r\n }\r\n static or(...expr) {\r\n return ContextKeyOrExpr.create(expr);\r\n }\r\n static deserialize(serialized, strict = false) {\r\n if (!serialized) {\r\n return undefined;\r\n }\r\n return this._deserializeOrExpression(serialized, strict);\r\n }\r\n static _deserializeOrExpression(serialized, strict) {\r\n let pieces = serialized.split('||');\r\n return ContextKeyOrExpr.create(pieces.map(p => this._deserializeAndExpression(p, strict)));\r\n }\r\n static _deserializeAndExpression(serialized, strict) {\r\n let pieces = serialized.split('&&');\r\n return ContextKeyAndExpr.create(pieces.map(p => this._deserializeOne(p, strict)));\r\n }\r\n static _deserializeOne(serializedOne, strict) {\r\n serializedOne = serializedOne.trim();\r\n if (serializedOne.indexOf('!=') >= 0) {\r\n let pieces = serializedOne.split('!=');\r\n return ContextKeyNotEqualsExpr.create(pieces[0].trim(), this._deserializeValue(pieces[1], strict));\r\n }\r\n if (serializedOne.indexOf('==') >= 0) {\r\n let pieces = serializedOne.split('==');\r\n return ContextKeyEqualsExpr.create(pieces[0].trim(), this._deserializeValue(pieces[1], strict));\r\n }\r\n if (serializedOne.indexOf('=~') >= 0) {\r\n let pieces = serializedOne.split('=~');\r\n return ContextKeyRegexExpr.create(pieces[0].trim(), this._deserializeRegexValue(pieces[1], strict));\r\n }\r\n if (serializedOne.indexOf(' in ') >= 0) {\r\n let pieces = serializedOne.split(' in ');\r\n return ContextKeyInExpr.create(pieces[0].trim(), pieces[1].trim());\r\n }\r\n if (/^[^<=>]+>=[^<=>]+$/.test(serializedOne)) {\r\n const pieces = serializedOne.split('>=');\r\n return ContextKeyGreaterEqualsExpr.create(pieces[0].trim(), pieces[1].trim());\r\n }\r\n if (/^[^<=>]+>[^<=>]+$/.test(serializedOne)) {\r\n const pieces = serializedOne.split('>');\r\n return ContextKeyGreaterExpr.create(pieces[0].trim(), pieces[1].trim());\r\n }\r\n if (/^[^<=>]+<=[^<=>]+$/.test(serializedOne)) {\r\n const pieces = serializedOne.split('<=');\r\n return ContextKeySmallerEqualsExpr.create(pieces[0].trim(), pieces[1].trim());\r\n }\r\n if (/^[^<=>]+<[^<=>]+$/.test(serializedOne)) {\r\n const pieces = serializedOne.split('<');\r\n return ContextKeySmallerExpr.create(pieces[0].trim(), pieces[1].trim());\r\n }\r\n if (/^\\!\\s*/.test(serializedOne)) {\r\n return ContextKeyNotExpr.create(serializedOne.substr(1).trim());\r\n }\r\n return ContextKeyDefinedExpr.create(serializedOne);\r\n }\r\n static _deserializeValue(serializedValue, strict) {\r\n serializedValue = serializedValue.trim();\r\n if (serializedValue === 'true') {\r\n return true;\r\n }\r\n if (serializedValue === 'false') {\r\n return false;\r\n }\r\n let m = /^'([^']*)'$/.exec(serializedValue);\r\n if (m) {\r\n return m[1].trim();\r\n }\r\n return serializedValue;\r\n }\r\n static _deserializeRegexValue(serializedValue, strict) {\r\n if (isFalsyOrWhitespace(serializedValue)) {\r\n if (strict) {\r\n throw new Error('missing regexp-value for =~-expression');\r\n }\r\n else {\r\n console.warn('missing regexp-value for =~-expression');\r\n }\r\n return null;\r\n }\r\n let start = serializedValue.indexOf('/');\r\n let end = serializedValue.lastIndexOf('/');\r\n if (start === end || start < 0 /* || to < 0 */) {\r\n if (strict) {\r\n throw new Error(`bad regexp-value '${serializedValue}', missing /-enclosure`);\r\n }\r\n else {\r\n console.warn(`bad regexp-value '${serializedValue}', missing /-enclosure`);\r\n }\r\n return null;\r\n }\r\n let value = serializedValue.slice(start + 1, end);\r\n let caseIgnoreFlag = serializedValue[end + 1] === 'i' ? 'i' : '';\r\n try {\r\n return new RegExp(value, caseIgnoreFlag);\r\n }\r\n catch (e) {\r\n if (strict) {\r\n throw new Error(`bad regexp-value '${serializedValue}', parse error: ${e}`);\r\n }\r\n else {\r\n console.warn(`bad regexp-value '${serializedValue}', parse error: ${e}`);\r\n }\r\n return null;\r\n }\r\n }\r\n}\r\nfunction cmp(a, b) {\r\n return a.cmp(b);\r\n}\r\nexport class ContextKeyFalseExpr {\r\n constructor() {\r\n this.type = 0 /* False */;\r\n }\r\n cmp(other) {\r\n return this.type - other.type;\r\n }\r\n equals(other) {\r\n return (other.type === this.type);\r\n }\r\n evaluate(context) {\r\n return false;\r\n }\r\n serialize() {\r\n return 'false';\r\n }\r\n keys() {\r\n return [];\r\n }\r\n negate() {\r\n return ContextKeyTrueExpr.INSTANCE;\r\n }\r\n}\r\nContextKeyFalseExpr.INSTANCE = new ContextKeyFalseExpr();\r\nexport class ContextKeyTrueExpr {\r\n constructor() {\r\n this.type = 1 /* True */;\r\n }\r\n cmp(other) {\r\n return this.type - other.type;\r\n }\r\n equals(other) {\r\n return (other.type === this.type);\r\n }\r\n evaluate(context) {\r\n return true;\r\n }\r\n serialize() {\r\n return 'true';\r\n }\r\n keys() {\r\n return [];\r\n }\r\n negate() {\r\n return ContextKeyFalseExpr.INSTANCE;\r\n }\r\n}\r\nContextKeyTrueExpr.INSTANCE = new ContextKeyTrueExpr();\r\nexport class ContextKeyDefinedExpr {\r\n constructor(key) {\r\n this.key = key;\r\n this.type = 2 /* Defined */;\r\n }\r\n static create(key) {\r\n const staticValue = STATIC_VALUES.get(key);\r\n if (typeof staticValue === 'boolean') {\r\n return staticValue ? ContextKeyTrueExpr.INSTANCE : ContextKeyFalseExpr.INSTANCE;\r\n }\r\n return new ContextKeyDefinedExpr(key);\r\n }\r\n cmp(other) {\r\n if (other.type !== this.type) {\r\n return this.type - other.type;\r\n }\r\n return cmp1(this.key, other.key);\r\n }\r\n equals(other) {\r\n if (other.type === this.type) {\r\n return (this.key === other.key);\r\n }\r\n return false;\r\n }\r\n evaluate(context) {\r\n return (!!context.getValue(this.key));\r\n }\r\n serialize() {\r\n return this.key;\r\n }\r\n keys() {\r\n return [this.key];\r\n }\r\n negate() {\r\n return ContextKeyNotExpr.create(this.key);\r\n }\r\n}\r\nexport class ContextKeyEqualsExpr {\r\n constructor(key, value) {\r\n this.key = key;\r\n this.value = value;\r\n this.type = 4 /* Equals */;\r\n }\r\n static create(key, value) {\r\n if (typeof value === 'boolean') {\r\n return (value ? ContextKeyDefinedExpr.create(key) : ContextKeyNotExpr.create(key));\r\n }\r\n const staticValue = STATIC_VALUES.get(key);\r\n if (typeof staticValue === 'boolean') {\r\n const trueValue = staticValue ? 'true' : 'false';\r\n return (value === trueValue ? ContextKeyTrueExpr.INSTANCE : ContextKeyFalseExpr.INSTANCE);\r\n }\r\n return new ContextKeyEqualsExpr(key, value);\r\n }\r\n cmp(other) {\r\n if (other.type !== this.type) {\r\n return this.type - other.type;\r\n }\r\n return cmp2(this.key, this.value, other.key, other.value);\r\n }\r\n equals(other) {\r\n if (other.type === this.type) {\r\n return (this.key === other.key && this.value === other.value);\r\n }\r\n return false;\r\n }\r\n evaluate(context) {\r\n // Intentional ==\r\n // eslint-disable-next-line eqeqeq\r\n return (context.getValue(this.key) == this.value);\r\n }\r\n serialize() {\r\n return `${this.key} == '${this.value}'`;\r\n }\r\n keys() {\r\n return [this.key];\r\n }\r\n negate() {\r\n return ContextKeyNotEqualsExpr.create(this.key, this.value);\r\n }\r\n}\r\nexport class ContextKeyInExpr {\r\n constructor(key, valueKey) {\r\n this.key = key;\r\n this.valueKey = valueKey;\r\n this.type = 10 /* In */;\r\n }\r\n static create(key, valueKey) {\r\n return new ContextKeyInExpr(key, valueKey);\r\n }\r\n cmp(other) {\r\n if (other.type !== this.type) {\r\n return this.type - other.type;\r\n }\r\n return cmp2(this.key, this.valueKey, other.key, other.valueKey);\r\n }\r\n equals(other) {\r\n if (other.type === this.type) {\r\n return (this.key === other.key && this.valueKey === other.valueKey);\r\n }\r\n return false;\r\n }\r\n evaluate(context) {\r\n const source = context.getValue(this.valueKey);\r\n const item = context.getValue(this.key);\r\n if (Array.isArray(source)) {\r\n return (source.indexOf(item) >= 0);\r\n }\r\n if (typeof item === 'string' && typeof source === 'object' && source !== null) {\r\n return hasOwnProperty.call(source, item);\r\n }\r\n return false;\r\n }\r\n serialize() {\r\n return `${this.key} in '${this.valueKey}'`;\r\n }\r\n keys() {\r\n return [this.key, this.valueKey];\r\n }\r\n negate() {\r\n return ContextKeyNotInExpr.create(this);\r\n }\r\n}\r\nexport class ContextKeyNotInExpr {\r\n constructor(_actual) {\r\n this._actual = _actual;\r\n this.type = 11 /* NotIn */;\r\n //\r\n }\r\n static create(actual) {\r\n return new ContextKeyNotInExpr(actual);\r\n }\r\n cmp(other) {\r\n if (other.type !== this.type) {\r\n return this.type - other.type;\r\n }\r\n return this._actual.cmp(other._actual);\r\n }\r\n equals(other) {\r\n if (other.type === this.type) {\r\n return this._actual.equals(other._actual);\r\n }\r\n return false;\r\n }\r\n evaluate(context) {\r\n return !this._actual.evaluate(context);\r\n }\r\n serialize() {\r\n throw new Error('Method not implemented.');\r\n }\r\n keys() {\r\n return this._actual.keys();\r\n }\r\n negate() {\r\n return this._actual;\r\n }\r\n}\r\nexport class ContextKeyNotEqualsExpr {\r\n constructor(key, value) {\r\n this.key = key;\r\n this.value = value;\r\n this.type = 5 /* NotEquals */;\r\n }\r\n static create(key, value) {\r\n if (typeof value === 'boolean') {\r\n if (value) {\r\n return ContextKeyNotExpr.create(key);\r\n }\r\n return ContextKeyDefinedExpr.create(key);\r\n }\r\n const staticValue = STATIC_VALUES.get(key);\r\n if (typeof staticValue === 'boolean') {\r\n const falseValue = staticValue ? 'true' : 'false';\r\n return (value === falseValue ? ContextKeyFalseExpr.INSTANCE : ContextKeyTrueExpr.INSTANCE);\r\n }\r\n return new ContextKeyNotEqualsExpr(key, value);\r\n }\r\n cmp(other) {\r\n if (other.type !== this.type) {\r\n return this.type - other.type;\r\n }\r\n return cmp2(this.key, this.value, other.key, other.value);\r\n }\r\n equals(other) {\r\n if (other.type === this.type) {\r\n return (this.key === other.key && this.value === other.value);\r\n }\r\n return false;\r\n }\r\n evaluate(context) {\r\n // Intentional !=\r\n // eslint-disable-next-line eqeqeq\r\n return (context.getValue(this.key) != this.value);\r\n }\r\n serialize() {\r\n return `${this.key} != '${this.value}'`;\r\n }\r\n keys() {\r\n return [this.key];\r\n }\r\n negate() {\r\n return ContextKeyEqualsExpr.create(this.key, this.value);\r\n }\r\n}\r\nexport class ContextKeyNotExpr {\r\n constructor(key) {\r\n this.key = key;\r\n this.type = 3 /* Not */;\r\n }\r\n static create(key) {\r\n const staticValue = STATIC_VALUES.get(key);\r\n if (typeof staticValue === 'boolean') {\r\n return (staticValue ? ContextKeyFalseExpr.INSTANCE : ContextKeyTrueExpr.INSTANCE);\r\n }\r\n return new ContextKeyNotExpr(key);\r\n }\r\n cmp(other) {\r\n if (other.type !== this.type) {\r\n return this.type - other.type;\r\n }\r\n return cmp1(this.key, other.key);\r\n }\r\n equals(other) {\r\n if (other.type === this.type) {\r\n return (this.key === other.key);\r\n }\r\n return false;\r\n }\r\n evaluate(context) {\r\n return (!context.getValue(this.key));\r\n }\r\n serialize() {\r\n return `!${this.key}`;\r\n }\r\n keys() {\r\n return [this.key];\r\n }\r\n negate() {\r\n return ContextKeyDefinedExpr.create(this.key);\r\n }\r\n}\r\nexport class ContextKeyGreaterExpr {\r\n constructor(key, value) {\r\n this.key = key;\r\n this.value = value;\r\n this.type = 12 /* Greater */;\r\n }\r\n static create(key, value) {\r\n return new ContextKeyGreaterExpr(key, value);\r\n }\r\n cmp(other) {\r\n if (other.type !== this.type) {\r\n return this.type - other.type;\r\n }\r\n return cmp2(this.key, this.value, other.key, other.value);\r\n }\r\n equals(other) {\r\n if (other.type === this.type) {\r\n return (this.key === other.key && this.value === other.value);\r\n }\r\n return false;\r\n }\r\n evaluate(context) {\r\n return (parseFloat(context.getValue(this.key)) > parseFloat(this.value));\r\n }\r\n serialize() {\r\n return `${this.key} > ${this.value}`;\r\n }\r\n keys() {\r\n return [this.key];\r\n }\r\n negate() {\r\n return ContextKeySmallerEqualsExpr.create(this.key, this.value);\r\n }\r\n}\r\nexport class ContextKeyGreaterEqualsExpr {\r\n constructor(key, value) {\r\n this.key = key;\r\n this.value = value;\r\n this.type = 13 /* GreaterEquals */;\r\n }\r\n static create(key, value) {\r\n return new ContextKeyGreaterEqualsExpr(key, value);\r\n }\r\n cmp(other) {\r\n if (other.type !== this.type) {\r\n return this.type - other.type;\r\n }\r\n return cmp2(this.key, this.value, other.key, other.value);\r\n }\r\n equals(other) {\r\n if (other.type === this.type) {\r\n return (this.key === other.key && this.value === other.value);\r\n }\r\n return false;\r\n }\r\n evaluate(context) {\r\n return (parseFloat(context.getValue(this.key)) >= parseFloat(this.value));\r\n }\r\n serialize() {\r\n return `${this.key} >= ${this.value}`;\r\n }\r\n keys() {\r\n return [this.key];\r\n }\r\n negate() {\r\n return ContextKeySmallerExpr.create(this.key, this.value);\r\n }\r\n}\r\nexport class ContextKeySmallerExpr {\r\n constructor(key, value) {\r\n this.key = key;\r\n this.value = value;\r\n this.type = 14 /* Smaller */;\r\n }\r\n static create(key, value) {\r\n return new ContextKeySmallerExpr(key, value);\r\n }\r\n cmp(other) {\r\n if (other.type !== this.type) {\r\n return this.type - other.type;\r\n }\r\n return cmp2(this.key, this.value, other.key, other.value);\r\n }\r\n equals(other) {\r\n if (other.type === this.type) {\r\n return (this.key === other.key && this.value === other.value);\r\n }\r\n return false;\r\n }\r\n evaluate(context) {\r\n return (parseFloat(context.getValue(this.key)) < parseFloat(this.value));\r\n }\r\n serialize() {\r\n return `${this.key} < ${this.value}`;\r\n }\r\n keys() {\r\n return [this.key];\r\n }\r\n negate() {\r\n return ContextKeyGreaterEqualsExpr.create(this.key, this.value);\r\n }\r\n}\r\nexport class ContextKeySmallerEqualsExpr {\r\n constructor(key, value) {\r\n this.key = key;\r\n this.value = value;\r\n this.type = 15 /* SmallerEquals */;\r\n }\r\n static create(key, value) {\r\n return new ContextKeySmallerEqualsExpr(key, value);\r\n }\r\n cmp(other) {\r\n if (other.type !== this.type) {\r\n return this.type - other.type;\r\n }\r\n return cmp2(this.key, this.value, other.key, other.value);\r\n }\r\n equals(other) {\r\n if (other.type === this.type) {\r\n return (this.key === other.key && this.value === other.value);\r\n }\r\n return false;\r\n }\r\n evaluate(context) {\r\n return (parseFloat(context.getValue(this.key)) <= parseFloat(this.value));\r\n }\r\n serialize() {\r\n return `${this.key} <= ${this.value}`;\r\n }\r\n keys() {\r\n return [this.key];\r\n }\r\n negate() {\r\n return ContextKeyGreaterExpr.create(this.key, this.value);\r\n }\r\n}\r\nexport class ContextKeyRegexExpr {\r\n constructor(key, regexp) {\r\n this.key = key;\r\n this.regexp = regexp;\r\n this.type = 7 /* Regex */;\r\n //\r\n }\r\n static create(key, regexp) {\r\n return new ContextKeyRegexExpr(key, regexp);\r\n }\r\n cmp(other) {\r\n if (other.type !== this.type) {\r\n return this.type - other.type;\r\n }\r\n if (this.key < other.key) {\r\n return -1;\r\n }\r\n if (this.key > other.key) {\r\n return 1;\r\n }\r\n const thisSource = this.regexp ? this.regexp.source : '';\r\n const otherSource = other.regexp ? other.regexp.source : '';\r\n if (thisSource < otherSource) {\r\n return -1;\r\n }\r\n if (thisSource > otherSource) {\r\n return 1;\r\n }\r\n return 0;\r\n }\r\n equals(other) {\r\n if (other.type === this.type) {\r\n const thisSource = this.regexp ? this.regexp.source : '';\r\n const otherSource = other.regexp ? other.regexp.source : '';\r\n return (this.key === other.key && thisSource === otherSource);\r\n }\r\n return false;\r\n }\r\n evaluate(context) {\r\n let value = context.getValue(this.key);\r\n return this.regexp ? this.regexp.test(value) : false;\r\n }\r\n serialize() {\r\n const value = this.regexp\r\n ? `/${this.regexp.source}/${this.regexp.ignoreCase ? 'i' : ''}`\r\n : '/invalid/';\r\n return `${this.key} =~ ${value}`;\r\n }\r\n keys() {\r\n return [this.key];\r\n }\r\n negate() {\r\n return ContextKeyNotRegexExpr.create(this);\r\n }\r\n}\r\nexport class ContextKeyNotRegexExpr {\r\n constructor(_actual) {\r\n this._actual = _actual;\r\n this.type = 8 /* NotRegex */;\r\n //\r\n }\r\n static create(actual) {\r\n return new ContextKeyNotRegexExpr(actual);\r\n }\r\n cmp(other) {\r\n if (other.type !== this.type) {\r\n return this.type - other.type;\r\n }\r\n return this._actual.cmp(other._actual);\r\n }\r\n equals(other) {\r\n if (other.type === this.type) {\r\n return this._actual.equals(other._actual);\r\n }\r\n return false;\r\n }\r\n evaluate(context) {\r\n return !this._actual.evaluate(context);\r\n }\r\n serialize() {\r\n throw new Error('Method not implemented.');\r\n }\r\n keys() {\r\n return this._actual.keys();\r\n }\r\n negate() {\r\n return this._actual;\r\n }\r\n}\r\nexport class ContextKeyAndExpr {\r\n constructor(expr) {\r\n this.expr = expr;\r\n this.type = 6 /* And */;\r\n }\r\n static create(_expr) {\r\n return ContextKeyAndExpr._normalizeArr(_expr);\r\n }\r\n cmp(other) {\r\n if (other.type !== this.type) {\r\n return this.type - other.type;\r\n }\r\n if (this.expr.length < other.expr.length) {\r\n return -1;\r\n }\r\n if (this.expr.length > other.expr.length) {\r\n return 1;\r\n }\r\n for (let i = 0, len = this.expr.length; i < len; i++) {\r\n const r = cmp(this.expr[i], other.expr[i]);\r\n if (r !== 0) {\r\n return r;\r\n }\r\n }\r\n return 0;\r\n }\r\n equals(other) {\r\n if (other.type === this.type) {\r\n if (this.expr.length !== other.expr.length) {\r\n return false;\r\n }\r\n for (let i = 0, len = this.expr.length; i < len; i++) {\r\n if (!this.expr[i].equals(other.expr[i])) {\r\n return false;\r\n }\r\n }\r\n return true;\r\n }\r\n return false;\r\n }\r\n evaluate(context) {\r\n for (let i = 0, len = this.expr.length; i < len; i++) {\r\n if (!this.expr[i].evaluate(context)) {\r\n return false;\r\n }\r\n }\r\n return true;\r\n }\r\n static _normalizeArr(arr) {\r\n const expr = [];\r\n let hasTrue = false;\r\n for (const e of arr) {\r\n if (!e) {\r\n continue;\r\n }\r\n if (e.type === 1 /* True */) {\r\n // anything && true ==> anything\r\n hasTrue = true;\r\n continue;\r\n }\r\n if (e.type === 0 /* False */) {\r\n // anything && false ==> false\r\n return ContextKeyFalseExpr.INSTANCE;\r\n }\r\n if (e.type === 6 /* And */) {\r\n expr.push(...e.expr);\r\n continue;\r\n }\r\n expr.push(e);\r\n }\r\n if (expr.length === 0 && hasTrue) {\r\n return ContextKeyTrueExpr.INSTANCE;\r\n }\r\n if (expr.length === 0) {\r\n return undefined;\r\n }\r\n if (expr.length === 1) {\r\n return expr[0];\r\n }\r\n expr.sort(cmp);\r\n // We must distribute any OR expression because we don't support parens\r\n // OR extensions will be at the end (due to sorting rules)\r\n while (expr.length > 1) {\r\n const lastElement = expr[expr.length - 1];\r\n if (lastElement.type !== 9 /* Or */) {\r\n break;\r\n }\r\n // pop the last element\r\n expr.pop();\r\n // pop the second to last element\r\n const secondToLastElement = expr.pop();\r\n // distribute `lastElement` over `secondToLastElement`\r\n const resultElement = ContextKeyOrExpr.create(lastElement.expr.map(el => ContextKeyAndExpr.create([el, secondToLastElement])));\r\n if (resultElement) {\r\n expr.push(resultElement);\r\n expr.sort(cmp);\r\n }\r\n }\r\n if (expr.length === 1) {\r\n return expr[0];\r\n }\r\n return new ContextKeyAndExpr(expr);\r\n }\r\n serialize() {\r\n return this.expr.map(e => e.serialize()).join(' && ');\r\n }\r\n keys() {\r\n const result = [];\r\n for (let expr of this.expr) {\r\n result.push(...expr.keys());\r\n }\r\n return result;\r\n }\r\n negate() {\r\n let result = [];\r\n for (let expr of this.expr) {\r\n result.push(expr.negate());\r\n }\r\n return ContextKeyOrExpr.create(result);\r\n }\r\n}\r\nexport class ContextKeyOrExpr {\r\n constructor(expr) {\r\n this.expr = expr;\r\n this.type = 9 /* Or */;\r\n }\r\n static create(_expr) {\r\n const expr = ContextKeyOrExpr._normalizeArr(_expr);\r\n if (expr.length === 0) {\r\n return undefined;\r\n }\r\n if (expr.length === 1) {\r\n return expr[0];\r\n }\r\n return new ContextKeyOrExpr(expr);\r\n }\r\n cmp(other) {\r\n if (other.type !== this.type) {\r\n return this.type - other.type;\r\n }\r\n if (this.expr.length < other.expr.length) {\r\n return -1;\r\n }\r\n if (this.expr.length > other.expr.length) {\r\n return 1;\r\n }\r\n for (let i = 0, len = this.expr.length; i < len; i++) {\r\n const r = cmp(this.expr[i], other.expr[i]);\r\n if (r !== 0) {\r\n return r;\r\n }\r\n }\r\n return 0;\r\n }\r\n equals(other) {\r\n if (other.type === this.type) {\r\n if (this.expr.length !== other.expr.length) {\r\n return false;\r\n }\r\n for (let i = 0, len = this.expr.length; i < len; i++) {\r\n if (!this.expr[i].equals(other.expr[i])) {\r\n return false;\r\n }\r\n }\r\n return true;\r\n }\r\n return false;\r\n }\r\n evaluate(context) {\r\n for (let i = 0, len = this.expr.length; i < len; i++) {\r\n if (this.expr[i].evaluate(context)) {\r\n return true;\r\n }\r\n }\r\n return false;\r\n }\r\n static _normalizeArr(arr) {\r\n let expr = [];\r\n let hasFalse = false;\r\n if (arr) {\r\n for (let i = 0, len = arr.length; i < len; i++) {\r\n const e = arr[i];\r\n if (!e) {\r\n continue;\r\n }\r\n if (e.type === 0 /* False */) {\r\n // anything || false ==> anything\r\n hasFalse = true;\r\n continue;\r\n }\r\n if (e.type === 1 /* True */) {\r\n // anything || true ==> true\r\n return [ContextKeyTrueExpr.INSTANCE];\r\n }\r\n if (e.type === 9 /* Or */) {\r\n expr = expr.concat(e.expr);\r\n continue;\r\n }\r\n expr.push(e);\r\n }\r\n if (expr.length === 0 && hasFalse) {\r\n return [ContextKeyFalseExpr.INSTANCE];\r\n }\r\n expr.sort(cmp);\r\n }\r\n return expr;\r\n }\r\n serialize() {\r\n return this.expr.map(e => e.serialize()).join(' || ');\r\n }\r\n keys() {\r\n const result = [];\r\n for (let expr of this.expr) {\r\n result.push(...expr.keys());\r\n }\r\n return result;\r\n }\r\n negate() {\r\n let result = [];\r\n for (let expr of this.expr) {\r\n result.push(expr.negate());\r\n }\r\n const terminals = (node) => {\r\n if (node.type === 9 /* Or */) {\r\n return node.expr;\r\n }\r\n return [node];\r\n };\r\n // We don't support parens, so here we distribute the AND over the OR terminals\r\n // We always take the first 2 AND pairs and distribute them\r\n while (result.length > 1) {\r\n const LEFT = result.shift();\r\n const RIGHT = result.shift();\r\n const all = [];\r\n for (const left of terminals(LEFT)) {\r\n for (const right of terminals(RIGHT)) {\r\n all.push(ContextKeyExpr.and(left, right));\r\n }\r\n }\r\n result.unshift(ContextKeyExpr.or(...all));\r\n }\r\n return result[0];\r\n }\r\n}\r\nexport class RawContextKey extends ContextKeyDefinedExpr {\r\n constructor(key, defaultValue, metaOrHide) {\r\n super(key);\r\n this._defaultValue = defaultValue;\r\n // collect all context keys into a central place\r\n if (typeof metaOrHide === 'object') {\r\n RawContextKey._info.push(Object.assign(Object.assign({}, metaOrHide), { key }));\r\n }\r\n else if (metaOrHide !== true) {\r\n RawContextKey._info.push({ key, description: metaOrHide, type: defaultValue !== null && defaultValue !== undefined ? typeof defaultValue : undefined });\r\n }\r\n }\r\n static all() {\r\n return RawContextKey._info.values();\r\n }\r\n bindTo(target) {\r\n return target.createKey(this.key, this._defaultValue);\r\n }\r\n getValue(target) {\r\n return target.getContextKeyValue(this.key);\r\n }\r\n toNegated() {\r\n return ContextKeyExpr.not(this.key);\r\n }\r\n isEqualTo(value) {\r\n return ContextKeyExpr.equals(this.key, value);\r\n }\r\n}\r\nRawContextKey._info = [];\r\nexport const IContextKeyService = createDecorator('contextKeyService');\r\nexport const SET_CONTEXT_COMMAND_ID = 'setContext';\r\nfunction cmp1(key1, key2) {\r\n if (key1 < key2) {\r\n return -1;\r\n }\r\n if (key1 > key2) {\r\n return 1;\r\n }\r\n return 0;\r\n}\r\nfunction cmp2(key1, value1, key2, value2) {\r\n if (key1 < key2) {\r\n return -1;\r\n }\r\n if (key1 > key2) {\r\n return 1;\r\n }\r\n if (value1 < value2) {\r\n return -1;\r\n }\r\n if (value1 > value2) {\r\n return 1;\r\n }\r\n return 0;\r\n}\r\n", "/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License. See License.txt in the project root for license information.\r\n *--------------------------------------------------------------------------------------------*/\r\nimport { toDisposable } from '../../../base/common/lifecycle.js';\r\nimport { validateConstraints } from '../../../base/common/types.js';\r\nimport { createDecorator } from '../../instantiation/common/instantiation.js';\r\nimport { Emitter } from '../../../base/common/event.js';\r\nimport { LinkedList } from '../../../base/common/linkedList.js';\r\nimport { Iterable } from '../../../base/common/iterator.js';\r\nexport const ICommandService = createDecorator('commandService');\r\nexport const CommandsRegistry = new class {\r\n constructor() {\r\n this._commands = new Map();\r\n this._onDidRegisterCommand = new Emitter();\r\n this.onDidRegisterCommand = this._onDidRegisterCommand.event;\r\n }\r\n registerCommand(idOrCommand, handler) {\r\n if (!idOrCommand) {\r\n throw new Error(`invalid command`);\r\n }\r\n if (typeof idOrCommand === 'string') {\r\n if (!handler) {\r\n throw new Error(`invalid command`);\r\n }\r\n return this.registerCommand({ id: idOrCommand, handler });\r\n }\r\n // add argument validation if rich command metadata is provided\r\n if (idOrCommand.description) {\r\n const constraints = [];\r\n for (let arg of idOrCommand.description.args) {\r\n constraints.push(arg.constraint);\r\n }\r\n const actualHandler = idOrCommand.handler;\r\n idOrCommand.handler = function (accessor, ...args) {\r\n validateConstraints(args, constraints);\r\n return actualHandler(accessor, ...args);\r\n };\r\n }\r\n // find a place to store the command\r\n const { id } = idOrCommand;\r\n let commands = this._commands.get(id);\r\n if (!commands) {\r\n commands = new LinkedList();\r\n this._commands.set(id, commands);\r\n }\r\n let removeFn = commands.unshift(idOrCommand);\r\n let ret = toDisposable(() => {\r\n removeFn();\r\n const command = this._commands.get(id);\r\n if (command === null || command === void 0 ? void 0 : command.isEmpty()) {\r\n this._commands.delete(id);\r\n }\r\n });\r\n // tell the world about this command\r\n this._onDidRegisterCommand.fire(id);\r\n return ret;\r\n }\r\n registerCommandAlias(oldId, newId) {\r\n return CommandsRegistry.registerCommand(oldId, (accessor, ...args) => accessor.get(ICommandService).executeCommand(newId, ...args));\r\n }\r\n getCommand(id) {\r\n const list = this._commands.get(id);\r\n if (!list || list.isEmpty()) {\r\n return undefined;\r\n }\r\n return Iterable.first(list);\r\n }\r\n getCommands() {\r\n const result = new Map();\r\n for (const key of this._commands.keys()) {\r\n const command = this.getCommand(key);\r\n if (command) {\r\n result.set(key, command);\r\n }\r\n }\r\n return result;\r\n }\r\n};\r\nCommandsRegistry.registerCommand('noop', () => { });\r\n", "/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License. See License.txt in the project root for license information.\r\n *--------------------------------------------------------------------------------------------*/\r\n/**\r\n * Throws an error with the provided message if the provided value does not evaluate to a true Javascript value.\r\n */\r\nexport function ok(value, message) {\r\n if (!value) {\r\n throw new Error(message ? `Assertion failed (${message})` : 'Assertion Failed');\r\n }\r\n}\r\n", "/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License. See License.txt in the project root for license information.\r\n *--------------------------------------------------------------------------------------------*/\r\nimport * as Types from '../../../base/common/types.js';\r\nimport * as Assert from '../../../base/common/assert.js';\r\nclass RegistryImpl {\r\n constructor() {\r\n this.data = new Map();\r\n }\r\n add(id, data) {\r\n Assert.ok(Types.isString(id));\r\n Assert.ok(Types.isObject(data));\r\n Assert.ok(!this.data.has(id), 'There is already an extension with this id');\r\n this.data.set(id, data);\r\n }\r\n as(id) {\r\n return this.data.get(id) || null;\r\n }\r\n}\r\nexport const Registry = new RegistryImpl();\r\n", "/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License. See License.txt in the project root for license information.\r\n *--------------------------------------------------------------------------------------------*/\r\n/**\r\n * Color scheme used by the OS and by color themes.\r\n */\r\nexport var ColorScheme;\r\n(function (ColorScheme) {\r\n ColorScheme[\"DARK\"] = \"dark\";\r\n ColorScheme[\"LIGHT\"] = \"light\";\r\n ColorScheme[\"HIGH_CONTRAST\"] = \"hc\";\r\n})(ColorScheme || (ColorScheme = {}));\r\n", "/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License. See License.txt in the project root for license information.\r\n *--------------------------------------------------------------------------------------------*/\r\nimport { Emitter } from './event.js';\r\nclass Registry {\r\n constructor() {\r\n this._icons = new Map();\r\n this._onDidRegister = new Emitter();\r\n }\r\n add(icon) {\r\n const existing = this._icons.get(icon.id);\r\n if (!existing) {\r\n this._icons.set(icon.id, icon);\r\n this._onDidRegister.fire(icon);\r\n }\r\n else if (icon.description) {\r\n existing.description = icon.description;\r\n }\r\n else {\r\n console.error(`Duplicate registration of codicon ${icon.id}`);\r\n }\r\n }\r\n get(id) {\r\n return this._icons.get(id);\r\n }\r\n get all() {\r\n return this._icons.values();\r\n }\r\n get onDidRegister() {\r\n return this._onDidRegister.event;\r\n }\r\n}\r\nconst _registry = new Registry();\r\nexport const iconRegistry = _registry;\r\nexport function registerCodicon(id, def) {\r\n return new Codicon(id, def);\r\n}\r\n// Selects all codicon names encapsulated in the `$()` syntax and wraps the\r\n// results with spaces so that screen readers can read the text better.\r\nexport function getCodiconAriaLabel(text) {\r\n if (!text) {\r\n return '';\r\n }\r\n return text.replace(/\\$\\((.*?)\\)/g, (_match, codiconName) => ` ${codiconName} `).trim();\r\n}\r\nexport class Codicon {\r\n constructor(id, definition, description) {\r\n this.id = id;\r\n this.definition = definition;\r\n this.description = description;\r\n _registry.add(this);\r\n }\r\n get classNames() { return 'codicon codicon-' + this.id; }\r\n // classNamesArray is useful for migrating to ES6 classlist\r\n get classNamesArray() { return ['codicon', 'codicon-' + this.id]; }\r\n get cssSelector() { return '.codicon.codicon-' + this.id; }\r\n}\r\nexport var CSSIcon;\r\n(function (CSSIcon) {\r\n CSSIcon.iconNameSegment = '[A-Za-z0-9]+';\r\n CSSIcon.iconNameExpression = '[A-Za-z0-9\\\\-]+';\r\n CSSIcon.iconModifierExpression = '~[A-Za-z]+';\r\n const cssIconIdRegex = new RegExp(`^(${CSSIcon.iconNameExpression})(${CSSIcon.iconModifierExpression})?$`);\r\n function asClassNameArray(icon) {\r\n if (icon instanceof Codicon) {\r\n return ['codicon', 'codicon-' + icon.id];\r\n }\r\n const match = cssIconIdRegex.exec(icon.id);\r\n if (!match) {\r\n return asClassNameArray(Codicon.error);\r\n }\r\n let [, id, modifier] = match;\r\n const classNames = ['codicon', 'codicon-' + id];\r\n if (modifier) {\r\n classNames.push('codicon-modifier-' + modifier.substr(1));\r\n }\r\n return classNames;\r\n }\r\n CSSIcon.asClassNameArray = asClassNameArray;\r\n function asClassName(icon) {\r\n return asClassNameArray(icon).join(' ');\r\n }\r\n CSSIcon.asClassName = asClassName;\r\n function asCSSSelector(icon) {\r\n return '.' + asClassNameArray(icon).join('.');\r\n }\r\n CSSIcon.asCSSSelector = asCSSSelector;\r\n})(CSSIcon || (CSSIcon = {}));\r\n(function (Codicon) {\r\n // built-in icons, with image name\r\n Codicon.add = new Codicon('add', { fontCharacter: '\\\\ea60' });\r\n Codicon.plus = new Codicon('plus', { fontCharacter: '\\\\ea60' });\r\n Codicon.gistNew = new Codicon('gist-new', { fontCharacter: '\\\\ea60' });\r\n Codicon.repoCreate = new Codicon('repo-create', { fontCharacter: '\\\\ea60' });\r\n Codicon.lightbulb = new Codicon('lightbulb', { fontCharacter: '\\\\ea61' });\r\n Codicon.lightBulb = new Codicon('light-bulb', { fontCharacter: '\\\\ea61' });\r\n Codicon.repo = new Codicon('repo', { fontCharacter: '\\\\ea62' });\r\n Codicon.repoDelete = new Codicon('repo-delete', { fontCharacter: '\\\\ea62' });\r\n Codicon.gistFork = new Codicon('gist-fork', { fontCharacter: '\\\\ea63' });\r\n Codicon.repoForked = new Codicon('repo-forked', { fontCharacter: '\\\\ea63' });\r\n Codicon.gitPullRequest = new Codicon('git-pull-request', { fontCharacter: '\\\\ea64' });\r\n Codicon.gitPullRequestAbandoned = new Codicon('git-pull-request-abandoned', { fontCharacter: '\\\\ea64' });\r\n Codicon.recordKeys = new Codicon('record-keys', { fontCharacter: '\\\\ea65' });\r\n Codicon.keyboard = new Codicon('keyboard', { fontCharacter: '\\\\ea65' });\r\n Codicon.tag = new Codicon('tag', { fontCharacter: '\\\\ea66' });\r\n Codicon.tagAdd = new Codicon('tag-add', { fontCharacter: '\\\\ea66' });\r\n Codicon.tagRemove = new Codicon('tag-remove', { fontCharacter: '\\\\ea66' });\r\n Codicon.person = new Codicon('person', { fontCharacter: '\\\\ea67' });\r\n Codicon.personFollow = new Codicon('person-follow', { fontCharacter: '\\\\ea67' });\r\n Codicon.personOutline = new Codicon('person-outline', { fontCharacter: '\\\\ea67' });\r\n Codicon.personFilled = new Codicon('person-filled', { fontCharacter: '\\\\ea67' });\r\n Codicon.gitBranch = new Codicon('git-branch', { fontCharacter: '\\\\ea68' });\r\n Codicon.gitBranchCreate = new Codicon('git-branch-create', { fontCharacter: '\\\\ea68' });\r\n Codicon.gitBranchDelete = new Codicon('git-branch-delete', { fontCharacter: '\\\\ea68' });\r\n Codicon.sourceControl = new Codicon('source-control', { fontCharacter: '\\\\ea68' });\r\n Codicon.mirror = new Codicon('mirror', { fontCharacter: '\\\\ea69' });\r\n Codicon.mirrorPublic = new Codicon('mirror-public', { fontCharacter: '\\\\ea69' });\r\n Codicon.star = new Codicon('star', { fontCharacter: '\\\\ea6a' });\r\n Codicon.starAdd = new Codicon('star-add', { fontCharacter: '\\\\ea6a' });\r\n Codicon.starDelete = new Codicon('star-delete', { fontCharacter: '\\\\ea6a' });\r\n Codicon.starEmpty = new Codicon('star-empty', { fontCharacter: '\\\\ea6a' });\r\n Codicon.comment = new Codicon('comment', { fontCharacter: '\\\\ea6b' });\r\n Codicon.commentAdd = new Codicon('comment-add', { fontCharacter: '\\\\ea6b' });\r\n Codicon.alert = new Codicon('alert', { fontCharacter: '\\\\ea6c' });\r\n Codicon.warning = new Codicon('warning', { fontCharacter: '\\\\ea6c' });\r\n Codicon.search = new Codicon('search', { fontCharacter: '\\\\ea6d' });\r\n Codicon.searchSave = new Codicon('search-save', { fontCharacter: '\\\\ea6d' });\r\n Codicon.logOut = new Codicon('log-out', { fontCharacter: '\\\\ea6e' });\r\n Codicon.signOut = new Codicon('sign-out', { fontCharacter: '\\\\ea6e' });\r\n Codicon.logIn = new Codicon('log-in', { fontCharacter: '\\\\ea6f' });\r\n Codicon.signIn = new Codicon('sign-in', { fontCharacter: '\\\\ea6f' });\r\n Codicon.eye = new Codicon('eye', { fontCharacter: '\\\\ea70' });\r\n Codicon.eyeUnwatch = new Codicon('eye-unwatch', { fontCharacter: '\\\\ea70' });\r\n Codicon.eyeWatch = new Codicon('eye-watch', { fontCharacter: '\\\\ea70' });\r\n Codicon.circleFilled = new Codicon('circle-filled', { fontCharacter: '\\\\ea71' });\r\n Codicon.primitiveDot = new Codicon('primitive-dot', { fontCharacter: '\\\\ea71' });\r\n Codicon.closeDirty = new Codicon('close-dirty', { fontCharacter: '\\\\ea71' });\r\n Codicon.debugBreakpoint = new Codicon('debug-breakpoint', { fontCharacter: '\\\\ea71' });\r\n Codicon.debugBreakpointDisabled = new Codicon('debug-breakpoint-disabled', { fontCharacter: '\\\\ea71' });\r\n Codicon.debugHint = new Codicon('debug-hint', { fontCharacter: '\\\\ea71' });\r\n Codicon.primitiveSquare = new Codicon('primitive-square', { fontCharacter: '\\\\ea72' });\r\n Codicon.edit = new Codicon('edit', { fontCharacter: '\\\\ea73' });\r\n Codicon.pencil = new Codicon('pencil', { fontCharacter: '\\\\ea73' });\r\n Codicon.info = new Codicon('info', { fontCharacter: '\\\\ea74' });\r\n Codicon.issueOpened = new Codicon('issue-opened', { fontCharacter: '\\\\ea74' });\r\n Codicon.gistPrivate = new Codicon('gist-private', { fontCharacter: '\\\\ea75' });\r\n Codicon.gitForkPrivate = new Codicon('git-fork-private', { fontCharacter: '\\\\ea75' });\r\n Codicon.lock = new Codicon('lock', { fontCharacter: '\\\\ea75' });\r\n Codicon.mirrorPrivate = new Codicon('mirror-private', { fontCharacter: '\\\\ea75' });\r\n Codicon.close = new Codicon('close', { fontCharacter: '\\\\ea76' });\r\n Codicon.removeClose = new Codicon('remove-close', { fontCharacter: '\\\\ea76' });\r\n Codicon.x = new Codicon('x', { fontCharacter: '\\\\ea76' });\r\n Codicon.repoSync = new Codicon('repo-sync', { fontCharacter: '\\\\ea77' });\r\n Codicon.sync = new Codicon('sync', { fontCharacter: '\\\\ea77' });\r\n Codicon.clone = new Codicon('clone', { fontCharacter: '\\\\ea78' });\r\n Codicon.desktopDownload = new Codicon('desktop-download', { fontCharacter: '\\\\ea78' });\r\n Codicon.beaker = new Codicon('beaker', { fontCharacter: '\\\\ea79' });\r\n Codicon.microscope = new Codicon('microscope', { fontCharacter: '\\\\ea79' });\r\n Codicon.vm = new Codicon('vm', { fontCharacter: '\\\\ea7a' });\r\n Codicon.deviceDesktop = new Codicon('device-desktop', { fontCharacter: '\\\\ea7a' });\r\n Codicon.file = new Codicon('file', { fontCharacter: '\\\\ea7b' });\r\n Codicon.fileText = new Codicon('file-text', { fontCharacter: '\\\\ea7b' });\r\n Codicon.more = new Codicon('more', { fontCharacter: '\\\\ea7c' });\r\n Codicon.ellipsis = new Codicon('ellipsis', { fontCharacter: '\\\\ea7c' });\r\n Codicon.kebabHorizontal = new Codicon('kebab-horizontal', { fontCharacter: '\\\\ea7c' });\r\n Codicon.mailReply = new Codicon('mail-reply', { fontCharacter: '\\\\ea7d' });\r\n Codicon.reply = new Codicon('reply', { fontCharacter: '\\\\ea7d' });\r\n Codicon.organization = new Codicon('organization', { fontCharacter: '\\\\ea7e' });\r\n Codicon.organizationFilled = new Codicon('organization-filled', { fontCharacter: '\\\\ea7e' });\r\n Codicon.organizationOutline = new Codicon('organization-outline', { fontCharacter: '\\\\ea7e' });\r\n Codicon.newFile = new Codicon('new-file', { fontCharacter: '\\\\ea7f' });\r\n Codicon.fileAdd = new Codicon('file-add', { fontCharacter: '\\\\ea7f' });\r\n Codicon.newFolder = new Codicon('new-folder', { fontCharacter: '\\\\ea80' });\r\n Codicon.fileDirectoryCreate = new Codicon('file-directory-create', { fontCharacter: '\\\\ea80' });\r\n Codicon.trash = new Codicon('trash', { fontCharacter: '\\\\ea81' });\r\n Codicon.trashcan = new Codicon('trashcan', { fontCharacter: '\\\\ea81' });\r\n Codicon.history = new Codicon('history', { fontCharacter: '\\\\ea82' });\r\n Codicon.clock = new Codicon('clock', { fontCharacter: '\\\\ea82' });\r\n Codicon.folder = new Codicon('folder', { fontCharacter: '\\\\ea83' });\r\n Codicon.fileDirectory = new Codicon('file-directory', { fontCharacter: '\\\\ea83' });\r\n Codicon.symbolFolder = new Codicon('symbol-folder', { fontCharacter: '\\\\ea83' });\r\n Codicon.logoGithub = new Codicon('logo-github', { fontCharacter: '\\\\ea84' });\r\n Codicon.markGithub = new Codicon('mark-github', { fontCharacter: '\\\\ea84' });\r\n Codicon.github = new Codicon('github', { fontCharacter: '\\\\ea84' });\r\n Codicon.terminal = new Codicon('terminal', { fontCharacter: '\\\\ea85' });\r\n Codicon.console = new Codicon('console', { fontCharacter: '\\\\ea85' });\r\n Codicon.repl = new Codicon('repl', { fontCharacter: '\\\\ea85' });\r\n Codicon.zap = new Codicon('zap', { fontCharacter: '\\\\ea86' });\r\n Codicon.symbolEvent = new Codicon('symbol-event', { fontCharacter: '\\\\ea86' });\r\n Codicon.error = new Codicon('error', { fontCharacter: '\\\\ea87' });\r\n Codicon.stop = new Codicon('stop', { fontCharacter: '\\\\ea87' });\r\n Codicon.variable = new Codicon('variable', { fontCharacter: '\\\\ea88' });\r\n Codicon.symbolVariable = new Codicon('symbol-variable', { fontCharacter: '\\\\ea88' });\r\n Codicon.array = new Codicon('array', { fontCharacter: '\\\\ea8a' });\r\n Codicon.symbolArray = new Codicon('symbol-array', { fontCharacter: '\\\\ea8a' });\r\n Codicon.symbolModule = new Codicon('symbol-module', { fontCharacter: '\\\\ea8b' });\r\n Codicon.symbolPackage = new Codicon('symbol-package', { fontCharacter: '\\\\ea8b' });\r\n Codicon.symbolNamespace = new Codicon('symbol-namespace', { fontCharacter: '\\\\ea8b' });\r\n Codicon.symbolObject = new Codicon('symbol-object', { fontCharacter: '\\\\ea8b' });\r\n Codicon.symbolMethod = new Codicon('symbol-method', { fontCharacter: '\\\\ea8c' });\r\n Codicon.symbolFunction = new Codicon('symbol-function', { fontCharacter: '\\\\ea8c' });\r\n Codicon.symbolConstructor = new Codicon('symbol-constructor', { fontCharacter: '\\\\ea8c' });\r\n Codicon.symbolBoolean = new Codicon('symbol-boolean', { fontCharacter: '\\\\ea8f' });\r\n Codicon.symbolNull = new Codicon('symbol-null', { fontCharacter: '\\\\ea8f' });\r\n Codicon.symbolNumeric = new Codicon('symbol-numeric', { fontCharacter: '\\\\ea90' });\r\n Codicon.symbolNumber = new Codicon('symbol-number', { fontCharacter: '\\\\ea90' });\r\n Codicon.symbolStructure = new Codicon('symbol-structure', { fontCharacter: '\\\\ea91' });\r\n Codicon.symbolStruct = new Codicon('symbol-struct', { fontCharacter: '\\\\ea91' });\r\n Codicon.symbolParameter = new Codicon('symbol-parameter', { fontCharacter: '\\\\ea92' });\r\n Codicon.symbolTypeParameter = new Codicon('symbol-type-parameter', { fontCharacter: '\\\\ea92' });\r\n Codicon.symbolKey = new Codicon('symbol-key', { fontCharacter: '\\\\ea93' });\r\n Codicon.symbolText = new Codicon('symbol-text', { fontCharacter: '\\\\ea93' });\r\n Codicon.symbolReference = new Codicon('symbol-reference', { fontCharacter: '\\\\ea94' });\r\n Codicon.goToFile = new Codicon('go-to-file', { fontCharacter: '\\\\ea94' });\r\n Codicon.symbolEnum = new Codicon('symbol-enum', { fontCharacter: '\\\\ea95' });\r\n Codicon.symbolValue = new Codicon('symbol-value', { fontCharacter: '\\\\ea95' });\r\n Codicon.symbolRuler = new Codicon('symbol-ruler', { fontCharacter: '\\\\ea96' });\r\n Codicon.symbolUnit = new Codicon('symbol-unit', { fontCharacter: '\\\\ea96' });\r\n Codicon.activateBreakpoints = new Codicon('activate-breakpoints', { fontCharacter: '\\\\ea97' });\r\n Codicon.archive = new Codicon('archive', { fontCharacter: '\\\\ea98' });\r\n Codicon.arrowBoth = new Codicon('arrow-both', { fontCharacter: '\\\\ea99' });\r\n Codicon.arrowDown = new Codicon('arrow-down', { fontCharacter: '\\\\ea9a' });\r\n Codicon.arrowLeft = new Codicon('arrow-left', { fontCharacter: '\\\\ea9b' });\r\n Codicon.arrowRight = new Codicon('arrow-right', { fontCharacter: '\\\\ea9c' });\r\n Codicon.arrowSmallDown = new Codicon('arrow-small-down', { fontCharacter: '\\\\ea9d' });\r\n Codicon.arrowSmallLeft = new Codicon('arrow-small-left', { fontCharacter: '\\\\ea9e' });\r\n Codicon.arrowSmallRight = new Codicon('arrow-small-right', { fontCharacter: '\\\\ea9f' });\r\n Codicon.arrowSmallUp = new Codicon('arrow-small-up', { fontCharacter: '\\\\eaa0' });\r\n Codicon.arrowUp = new Codicon('arrow-up', { fontCharacter: '\\\\eaa1' });\r\n Codicon.bell = new Codicon('bell', { fontCharacter: '\\\\eaa2' });\r\n Codicon.bold = new Codicon('bold', { fontCharacter: '\\\\eaa3' });\r\n Codicon.book = new Codicon('book', { fontCharacter: '\\\\eaa4' });\r\n Codicon.bookmark = new Codicon('bookmark', { fontCharacter: '\\\\eaa5' });\r\n Codicon.debugBreakpointConditionalUnverified = new Codicon('debug-breakpoint-conditional-unverified', { fontCharacter: '\\\\eaa6' });\r\n Codicon.debugBreakpointConditional = new Codicon('debug-breakpoint-conditional', { fontCharacter: '\\\\eaa7' });\r\n Codicon.debugBreakpointConditionalDisabled = new Codicon('debug-breakpoint-conditional-disabled', { fontCharacter: '\\\\eaa7' });\r\n Codicon.debugBreakpointDataUnverified = new Codicon('debug-breakpoint-data-unverified', { fontCharacter: '\\\\eaa8' });\r\n Codicon.debugBreakpointData = new Codicon('debug-breakpoint-data', { fontCharacter: '\\\\eaa9' });\r\n Codicon.debugBreakpointDataDisabled = new Codicon('debug-breakpoint-data-disabled', { fontCharacter: '\\\\eaa9' });\r\n Codicon.debugBreakpointLogUnverified = new Codicon('debug-breakpoint-log-unverified', { fontCharacter: '\\\\eaaa' });\r\n Codicon.debugBreakpointLog = new Codicon('debug-breakpoint-log', { fontCharacter: '\\\\eaab' });\r\n Codicon.debugBreakpointLogDisabled = new Codicon('debug-breakpoint-log-disabled', { fontCharacter: '\\\\eaab' });\r\n Codicon.briefcase = new Codicon('briefcase', { fontCharacter: '\\\\eaac' });\r\n Codicon.broadcast = new Codicon('broadcast', { fontCharacter: '\\\\eaad' });\r\n Codicon.browser = new Codicon('browser', { fontCharacter: '\\\\eaae' });\r\n Codicon.bug = new Codicon('bug', { fontCharacter: '\\\\eaaf' });\r\n Codicon.calendar = new Codicon('calendar', { fontCharacter: '\\\\eab0' });\r\n Codicon.caseSensitive = new Codicon('case-sensitive', { fontCharacter: '\\\\eab1' });\r\n Codicon.check = new Codicon('check', { fontCharacter: '\\\\eab2' });\r\n Codicon.checklist = new Codicon('checklist', { fontCharacter: '\\\\eab3' });\r\n Codicon.chevronDown = new Codicon('chevron-down', { fontCharacter: '\\\\eab4' });\r\n Codicon.chevronLeft = new Codicon('chevron-left', { fontCharacter: '\\\\eab5' });\r\n Codicon.chevronRight = new Codicon('chevron-right', { fontCharacter: '\\\\eab6' });\r\n Codicon.chevronUp = new Codicon('chevron-up', { fontCharacter: '\\\\eab7' });\r\n Codicon.chromeClose = new Codicon('chrome-close', { fontCharacter: '\\\\eab8' });\r\n Codicon.chromeMaximize = new Codicon('chrome-maximize', { fontCharacter: '\\\\eab9' });\r\n Codicon.chromeMinimize = new Codicon('chrome-minimize', { fontCharacter: '\\\\eaba' });\r\n Codicon.chromeRestore = new Codicon('chrome-restore', { fontCharacter: '\\\\eabb' });\r\n Codicon.circleOutline = new Codicon('circle-outline', { fontCharacter: '\\\\eabc' });\r\n Codicon.debugBreakpointUnverified = new Codicon('debug-breakpoint-unverified', { fontCharacter: '\\\\eabc' });\r\n Codicon.circleSlash = new Codicon('circle-slash', { fontCharacter: '\\\\eabd' });\r\n Codicon.circuitBoard = new Codicon('circuit-board', { fontCharacter: '\\\\eabe' });\r\n Codicon.clearAll = new Codicon('clear-all', { fontCharacter: '\\\\eabf' });\r\n Codicon.clippy = new Codicon('clippy', { fontCharacter: '\\\\eac0' });\r\n Codicon.closeAll = new Codicon('close-all', { fontCharacter: '\\\\eac1' });\r\n Codicon.cloudDownload = new Codicon('cloud-download', { fontCharacter: '\\\\eac2' });\r\n Codicon.cloudUpload = new Codicon('cloud-upload', { fontCharacter: '\\\\eac3' });\r\n Codicon.code = new Codicon('code', { fontCharacter: '\\\\eac4' });\r\n Codicon.collapseAll = new Codicon('collapse-all', { fontCharacter: '\\\\eac5' });\r\n Codicon.colorMode = new Codicon('color-mode', { fontCharacter: '\\\\eac6' });\r\n Codicon.commentDiscussion = new Codicon('comment-discussion', { fontCharacter: '\\\\eac7' });\r\n Codicon.compareChanges = new Codicon('compare-changes', { fontCharacter: '\\\\eafd' });\r\n Codicon.creditCard = new Codicon('credit-card', { fontCharacter: '\\\\eac9' });\r\n Codicon.dash = new Codicon('dash', { fontCharacter: '\\\\eacc' });\r\n Codicon.dashboard = new Codicon('dashboard', { fontCharacter: '\\\\eacd' });\r\n Codicon.database = new Codicon('database', { fontCharacter: '\\\\eace' });\r\n Codicon.debugContinue = new Codicon('debug-continue', { fontCharacter: '\\\\eacf' });\r\n Codicon.debugDisconnect = new Codicon('debug-disconnect', { fontCharacter: '\\\\ead0' });\r\n Codicon.debugPause = new Codicon('debug-pause', { fontCharacter: '\\\\ead1' });\r\n Codicon.debugRestart = new Codicon('debug-restart', { fontCharacter: '\\\\ead2' });\r\n Codicon.debugStart = new Codicon('debug-start', { fontCharacter: '\\\\ead3' });\r\n Codicon.debugStepInto = new Codicon('debug-step-into', { fontCharacter: '\\\\ead4' });\r\n Codicon.debugStepOut = new Codicon('debug-step-out', { fontCharacter: '\\\\ead5' });\r\n Codicon.debugStepOver = new Codicon('debug-step-over', { fontCharacter: '\\\\ead6' });\r\n Codicon.debugStop = new Codicon('debug-stop', { fontCharacter: '\\\\ead7' });\r\n Codicon.debug = new Codicon('debug', { fontCharacter: '\\\\ead8' });\r\n Codicon.deviceCameraVideo = new Codicon('device-camera-video', { fontCharacter: '\\\\ead9' });\r\n Codicon.deviceCamera = new Codicon('device-camera', { fontCharacter: '\\\\eada' });\r\n Codicon.deviceMobile = new Codicon('device-mobile', { fontCharacter: '\\\\eadb' });\r\n Codicon.diffAdded = new Codicon('diff-added', { fontCharacter: '\\\\eadc' });\r\n Codicon.diffIgnored = new Codicon('diff-ignored', { fontCharacter: '\\\\eadd' });\r\n Codicon.diffModified = new Codicon('diff-modified', { fontCharacter: '\\\\eade' });\r\n Codicon.diffRemoved = new Codicon('diff-removed', { fontCharacter: '\\\\eadf' });\r\n Codicon.diffRenamed = new Codicon('diff-renamed', { fontCharacter: '\\\\eae0' });\r\n Codicon.diff = new Codicon('diff', { fontCharacter: '\\\\eae1' });\r\n Codicon.discard = new Codicon('discard', { fontCharacter: '\\\\eae2' });\r\n Codicon.editorLayout = new Codicon('editor-layout', { fontCharacter: '\\\\eae3' });\r\n Codicon.emptyWindow = new Codicon('empty-window', { fontCharacter: '\\\\eae4' });\r\n Codicon.exclude = new Codicon('exclude', { fontCharacter: '\\\\eae5' });\r\n Codicon.extensions = new Codicon('extensions', { fontCharacter: '\\\\eae6' });\r\n Codicon.eyeClosed = new Codicon('eye-closed', { fontCharacter: '\\\\eae7' });\r\n Codicon.fileBinary = new Codicon('file-binary', { fontCharacter: '\\\\eae8' });\r\n Codicon.fileCode = new Codicon('file-code', { fontCharacter: '\\\\eae9' });\r\n Codicon.fileMedia = new Codicon('file-media', { fontCharacter: '\\\\eaea' });\r\n Codicon.filePdf = new Codicon('file-pdf', { fontCharacter: '\\\\eaeb' });\r\n Codicon.fileSubmodule = new Codicon('file-submodule', { fontCharacter: '\\\\eaec' });\r\n Codicon.fileSymlinkDirectory = new Codicon('file-symlink-directory', { fontCharacter: '\\\\eaed' });\r\n Codicon.fileSymlinkFile = new Codicon('file-symlink-file', { fontCharacter: '\\\\eaee' });\r\n Codicon.fileZip = new Codicon('file-zip', { fontCharacter: '\\\\eaef' });\r\n Codicon.files = new Codicon('files', { fontCharacter: '\\\\eaf0' });\r\n Codicon.filter = new Codicon('filter', { fontCharacter: '\\\\eaf1' });\r\n Codicon.flame = new Codicon('flame', { fontCharacter: '\\\\eaf2' });\r\n Codicon.foldDown = new Codicon('fold-down', { fontCharacter: '\\\\eaf3' });\r\n Codicon.foldUp = new Codicon('fold-up', { fontCharacter: '\\\\eaf4' });\r\n Codicon.fold = new Codicon('fold', { fontCharacter: '\\\\eaf5' });\r\n Codicon.folderActive = new Codicon('folder-active', { fontCharacter: '\\\\eaf6' });\r\n Codicon.folderOpened = new Codicon('folder-opened', { fontCharacter: '\\\\eaf7' });\r\n Codicon.gear = new Codicon('gear', { fontCharacter: '\\\\eaf8' });\r\n Codicon.gift = new Codicon('gift', { fontCharacter: '\\\\eaf9' });\r\n Codicon.gistSecret = new Codicon('gist-secret', { fontCharacter: '\\\\eafa' });\r\n Codicon.gist = new Codicon('gist', { fontCharacter: '\\\\eafb' });\r\n Codicon.gitCommit = new Codicon('git-commit', { fontCharacter: '\\\\eafc' });\r\n Codicon.gitCompare = new Codicon('git-compare', { fontCharacter: '\\\\eafd' });\r\n Codicon.gitMerge = new Codicon('git-merge', { fontCharacter: '\\\\eafe' });\r\n Codicon.githubAction = new Codicon('github-action', { fontCharacter: '\\\\eaff' });\r\n Codicon.githubAlt = new Codicon('github-alt', { fontCharacter: '\\\\eb00' });\r\n Codicon.globe = new Codicon('globe', { fontCharacter: '\\\\eb01' });\r\n Codicon.grabber = new Codicon('grabber', { fontCharacter: '\\\\eb02' });\r\n Codicon.graph = new Codicon('graph', { fontCharacter: '\\\\eb03' });\r\n Codicon.gripper = new Codicon('gripper', { fontCharacter: '\\\\eb04' });\r\n Codicon.heart = new Codicon('heart', { fontCharacter: '\\\\eb05' });\r\n Codicon.home = new Codicon('home', { fontCharacter: '\\\\eb06' });\r\n Codicon.horizontalRule = new Codicon('horizontal-rule', { fontCharacter: '\\\\eb07' });\r\n Codicon.hubot = new Codicon('hubot', { fontCharacter: '\\\\eb08' });\r\n Codicon.inbox = new Codicon('inbox', { fontCharacter: '\\\\eb09' });\r\n Codicon.issueClosed = new Codicon('issue-closed', { fontCharacter: '\\\\eba4' });\r\n Codicon.issueReopened = new Codicon('issue-reopened', { fontCharacter: '\\\\eb0b' });\r\n Codicon.issues = new Codicon('issues', { fontCharacter: '\\\\eb0c' });\r\n Codicon.italic = new Codicon('italic', { fontCharacter: '\\\\eb0d' });\r\n Codicon.jersey = new Codicon('jersey', { fontCharacter: '\\\\eb0e' });\r\n Codicon.json = new Codicon('json', { fontCharacter: '\\\\eb0f' });\r\n Codicon.kebabVertical = new Codicon('kebab-vertical', { fontCharacter: '\\\\eb10' });\r\n Codicon.key = new Codicon('key', { fontCharacter: '\\\\eb11' });\r\n Codicon.law = new Codicon('law', { fontCharacter: '\\\\eb12' });\r\n Codicon.lightbulbAutofix = new Codicon('lightbulb-autofix', { fontCharacter: '\\\\eb13' });\r\n Codicon.linkExternal = new Codicon('link-external', { fontCharacter: '\\\\eb14' });\r\n Codicon.link = new Codicon('link', { fontCharacter: '\\\\eb15' });\r\n Codicon.listOrdered = new Codicon('list-ordered', { fontCharacter: '\\\\eb16' });\r\n Codicon.listUnordered = new Codicon('list-unordered', { fontCharacter: '\\\\eb17' });\r\n Codicon.liveShare = new Codicon('live-share', { fontCharacter: '\\\\eb18' });\r\n Codicon.loading = new Codicon('loading', { fontCharacter: '\\\\eb19' });\r\n Codicon.location = new Codicon('location', { fontCharacter: '\\\\eb1a' });\r\n Codicon.mailRead = new Codicon('mail-read', { fontCharacter: '\\\\eb1b' });\r\n Codicon.mail = new Codicon('mail', { fontCharacter: '\\\\eb1c' });\r\n Codicon.markdown = new Codicon('markdown', { fontCharacter: '\\\\eb1d' });\r\n Codicon.megaphone = new Codicon('megaphone', { fontCharacter: '\\\\eb1e' });\r\n Codicon.mention = new Codicon('mention', { fontCharacter: '\\\\eb1f' });\r\n Codicon.milestone = new Codicon('milestone', { fontCharacter: '\\\\eb20' });\r\n Codicon.mortarBoard = new Codicon('mortar-board', { fontCharacter: '\\\\eb21' });\r\n Codicon.move = new Codicon('move', { fontCharacter: '\\\\eb22' });\r\n Codicon.multipleWindows = new Codicon('multiple-windows', { fontCharacter: '\\\\eb23' });\r\n Codicon.mute = new Codicon('mute', { fontCharacter: '\\\\eb24' });\r\n Codicon.noNewline = new Codicon('no-newline', { fontCharacter: '\\\\eb25' });\r\n Codicon.note = new Codicon('note', { fontCharacter: '\\\\eb26' });\r\n Codicon.octoface = new Codicon('octoface', { fontCharacter: '\\\\eb27' });\r\n Codicon.openPreview = new Codicon('open-preview', { fontCharacter: '\\\\eb28' });\r\n Codicon.package_ = new Codicon('package', { fontCharacter: '\\\\eb29' });\r\n Codicon.paintcan = new Codicon('paintcan', { fontCharacter: '\\\\eb2a' });\r\n Codicon.pin = new Codicon('pin', { fontCharacter: '\\\\eb2b' });\r\n Codicon.play = new Codicon('play', { fontCharacter: '\\\\eb2c' });\r\n Codicon.run = new Codicon('run', { fontCharacter: '\\\\eb2c' });\r\n Codicon.plug = new Codicon('plug', { fontCharacter: '\\\\eb2d' });\r\n Codicon.preserveCase = new Codicon('preserve-case', { fontCharacter: '\\\\eb2e' });\r\n Codicon.preview = new Codicon('preview', { fontCharacter: '\\\\eb2f' });\r\n Codicon.project = new Codicon('project', { fontCharacter: '\\\\eb30' });\r\n Codicon.pulse = new Codicon('pulse', { fontCharacter: '\\\\eb31' });\r\n Codicon.question = new Codicon('question', { fontCharacter: '\\\\eb32' });\r\n Codicon.quote = new Codicon('quote', { fontCharacter: '\\\\eb33' });\r\n Codicon.radioTower = new Codicon('radio-tower', { fontCharacter: '\\\\eb34' });\r\n Codicon.reactions = new Codicon('reactions', { fontCharacter: '\\\\eb35' });\r\n Codicon.references = new Codicon('references', { fontCharacter: '\\\\eb36' });\r\n Codicon.refresh = new Codicon('refresh', { fontCharacter: '\\\\eb37' });\r\n Codicon.regex = new Codicon('regex', { fontCharacter: '\\\\eb38' });\r\n Codicon.remoteExplorer = new Codicon('remote-explorer', { fontCharacter: '\\\\eb39' });\r\n Codicon.remote = new Codicon('remote', { fontCharacter: '\\\\eb3a' });\r\n Codicon.remove = new Codicon('remove', { fontCharacter: '\\\\eb3b' });\r\n Codicon.replaceAll = new Codicon('replace-all', { fontCharacter: '\\\\eb3c' });\r\n Codicon.replace = new Codicon('replace', { fontCharacter: '\\\\eb3d' });\r\n Codicon.repoClone = new Codicon('repo-clone', { fontCharacter: '\\\\eb3e' });\r\n Codicon.repoForcePush = new Codicon('repo-force-push', { fontCharacter: '\\\\eb3f' });\r\n Codicon.repoPull = new Codicon('repo-pull', { fontCharacter: '\\\\eb40' });\r\n Codicon.repoPush = new Codicon('repo-push', { fontCharacter: '\\\\eb41' });\r\n Codicon.report = new Codicon('report', { fontCharacter: '\\\\eb42' });\r\n Codicon.requestChanges = new Codicon('request-changes', { fontCharacter: '\\\\eb43' });\r\n Codicon.rocket = new Codicon('rocket', { fontCharacter: '\\\\eb44' });\r\n Codicon.rootFolderOpened = new Codicon('root-folder-opened', { fontCharacter: '\\\\eb45' });\r\n Codicon.rootFolder = new Codicon('root-folder', { fontCharacter: '\\\\eb46' });\r\n Codicon.rss = new Codicon('rss', { fontCharacter: '\\\\eb47' });\r\n Codicon.ruby = new Codicon('ruby', { fontCharacter: '\\\\eb48' });\r\n Codicon.saveAll = new Codicon('save-all', { fontCharacter: '\\\\eb49' });\r\n Codicon.saveAs = new Codicon('save-as', { fontCharacter: '\\\\eb4a' });\r\n Codicon.save = new Codicon('save', { fontCharacter: '\\\\eb4b' });\r\n Codicon.screenFull = new Codicon('screen-full', { fontCharacter: '\\\\eb4c' });\r\n Codicon.screenNormal = new Codicon('screen-normal', { fontCharacter: '\\\\eb4d' });\r\n Codicon.searchStop = new Codicon('search-stop', { fontCharacter: '\\\\eb4e' });\r\n Codicon.server = new Codicon('server', { fontCharacter: '\\\\eb50' });\r\n Codicon.settingsGear = new Codicon('settings-gear', { fontCharacter: '\\\\eb51' });\r\n Codicon.settings = new Codicon('settings', { fontCharacter: '\\\\eb52' });\r\n Codicon.shield = new Codicon('shield', { fontCharacter: '\\\\eb53' });\r\n Codicon.smiley = new Codicon('smiley', { fontCharacter: '\\\\eb54' });\r\n Codicon.sortPrecedence = new Codicon('sort-precedence', { fontCharacter: '\\\\eb55' });\r\n Codicon.splitHorizontal = new Codicon('split-horizontal', { fontCharacter: '\\\\eb56' });\r\n Codicon.splitVertical = new Codicon('split-vertical', { fontCharacter: '\\\\eb57' });\r\n Codicon.squirrel = new Codicon('squirrel', { fontCharacter: '\\\\eb58' });\r\n Codicon.starFull = new Codicon('star-full', { fontCharacter: '\\\\eb59' });\r\n Codicon.starHalf = new Codicon('star-half', { fontCharacter: '\\\\eb5a' });\r\n Codicon.symbolClass = new Codicon('symbol-class', { fontCharacter: '\\\\eb5b' });\r\n Codicon.symbolColor = new Codicon('symbol-color', { fontCharacter: '\\\\eb5c' });\r\n Codicon.symbolConstant = new Codicon('symbol-constant', { fontCharacter: '\\\\eb5d' });\r\n Codicon.symbolEnumMember = new Codicon('symbol-enum-member', { fontCharacter: '\\\\eb5e' });\r\n Codicon.symbolField = new Codicon('symbol-field', { fontCharacter: '\\\\eb5f' });\r\n Codicon.symbolFile = new Codicon('symbol-file', { fontCharacter: '\\\\eb60' });\r\n Codicon.symbolInterface = new Codicon('symbol-interface', { fontCharacter: '\\\\eb61' });\r\n Codicon.symbolKeyword = new Codicon('symbol-keyword', { fontCharacter: '\\\\eb62' });\r\n Codicon.symbolMisc = new Codicon('symbol-misc', { fontCharacter: '\\\\eb63' });\r\n Codicon.symbolOperator = new Codicon('symbol-operator', { fontCharacter: '\\\\eb64' });\r\n Codicon.symbolProperty = new Codicon('symbol-property', { fontCharacter: '\\\\eb65' });\r\n Codicon.wrench = new Codicon('wrench', { fontCharacter: '\\\\eb65' });\r\n Codicon.wrenchSubaction = new Codicon('wrench-subaction', { fontCharacter: '\\\\eb65' });\r\n Codicon.symbolSnippet = new Codicon('symbol-snippet', { fontCharacter: '\\\\eb66' });\r\n Codicon.tasklist = new Codicon('tasklist', { fontCharacter: '\\\\eb67' });\r\n Codicon.telescope = new Codicon('telescope', { fontCharacter: '\\\\eb68' });\r\n Codicon.textSize = new Codicon('text-size', { fontCharacter: '\\\\eb69' });\r\n Codicon.threeBars = new Codicon('three-bars', { fontCharacter: '\\\\eb6a' });\r\n Codicon.thumbsdown = new Codicon('thumbsdown', { fontCharacter: '\\\\eb6b' });\r\n Codicon.thumbsup = new Codicon('thumbsup', { fontCharacter: '\\\\eb6c' });\r\n Codicon.tools = new Codicon('tools', { fontCharacter: '\\\\eb6d' });\r\n Codicon.triangleDown = new Codicon('triangle-down', { fontCharacter: '\\\\eb6e' });\r\n Codicon.triangleLeft = new Codicon('triangle-left', { fontCharacter: '\\\\eb6f' });\r\n Codicon.triangleRight = new Codicon('triangle-right', { fontCharacter: '\\\\eb70' });\r\n Codicon.triangleUp = new Codicon('triangle-up', { fontCharacter: '\\\\eb71' });\r\n Codicon.twitter = new Codicon('twitter', { fontCharacter: '\\\\eb72' });\r\n Codicon.unfold = new Codicon('unfold', { fontCharacter: '\\\\eb73' });\r\n Codicon.unlock = new Codicon('unlock', { fontCharacter: '\\\\eb74' });\r\n Codicon.unmute = new Codicon('unmute', { fontCharacter: '\\\\eb75' });\r\n Codicon.unverified = new Codicon('unverified', { fontCharacter: '\\\\eb76' });\r\n Codicon.verified = new Codicon('verified', { fontCharacter: '\\\\eb77' });\r\n Codicon.versions = new Codicon('versions', { fontCharacter: '\\\\eb78' });\r\n Codicon.vmActive = new Codicon('vm-active', { fontCharacter: '\\\\eb79' });\r\n Codicon.vmOutline = new Codicon('vm-outline', { fontCharacter: '\\\\eb7a' });\r\n Codicon.vmRunning = new Codicon('vm-running', { fontCharacter: '\\\\eb7b' });\r\n Codicon.watch = new Codicon('watch', { fontCharacter: '\\\\eb7c' });\r\n Codicon.whitespace = new Codicon('whitespace', { fontCharacter: '\\\\eb7d' });\r\n Codicon.wholeWord = new Codicon('whole-word', { fontCharacter: '\\\\eb7e' });\r\n Codicon.window = new Codicon('window', { fontCharacter: '\\\\eb7f' });\r\n Codicon.wordWrap = new Codicon('word-wrap', { fontCharacter: '\\\\eb80' });\r\n Codicon.zoomIn = new Codicon('zoom-in', { fontCharacter: '\\\\eb81' });\r\n Codicon.zoomOut = new Codicon('zoom-out', { fontCharacter: '\\\\eb82' });\r\n Codicon.listFilter = new Codicon('list-filter', { fontCharacter: '\\\\eb83' });\r\n Codicon.listFlat = new Codicon('list-flat', { fontCharacter: '\\\\eb84' });\r\n Codicon.listSelection = new Codicon('list-selection', { fontCharacter: '\\\\eb85' });\r\n Codicon.selection = new Codicon('selection', { fontCharacter: '\\\\eb85' });\r\n Codicon.listTree = new Codicon('list-tree', { fontCharacter: '\\\\eb86' });\r\n Codicon.debugBreakpointFunctionUnverified = new Codicon('debug-breakpoint-function-unverified', { fontCharacter: '\\\\eb87' });\r\n Codicon.debugBreakpointFunction = new Codicon('debug-breakpoint-function', { fontCharacter: '\\\\eb88' });\r\n Codicon.debugBreakpointFunctionDisabled = new Codicon('debug-breakpoint-function-disabled', { fontCharacter: '\\\\eb88' });\r\n Codicon.debugStackframeActive = new Codicon('debug-stackframe-active', { fontCharacter: '\\\\eb89' });\r\n Codicon.debugStackframeDot = new Codicon('debug-stackframe-dot', { fontCharacter: '\\\\eb8a' });\r\n Codicon.debugStackframe = new Codicon('debug-stackframe', { fontCharacter: '\\\\eb8b' });\r\n Codicon.debugStackframeFocused = new Codicon('debug-stackframe-focused', { fontCharacter: '\\\\eb8b' });\r\n Codicon.debugBreakpointUnsupported = new Codicon('debug-breakpoint-unsupported', { fontCharacter: '\\\\eb8c' });\r\n Codicon.symbolString = new Codicon('symbol-string', { fontCharacter: '\\\\eb8d' });\r\n Codicon.debugReverseContinue = new Codicon('debug-reverse-continue', { fontCharacter: '\\\\eb8e' });\r\n Codicon.debugStepBack = new Codicon('debug-step-back', { fontCharacter: '\\\\eb8f' });\r\n Codicon.debugRestartFrame = new Codicon('debug-restart-frame', { fontCharacter: '\\\\eb90' });\r\n Codicon.callIncoming = new Codicon('call-incoming', { fontCharacter: '\\\\eb92' });\r\n Codicon.callOutgoing = new Codicon('call-outgoing', { fontCharacter: '\\\\eb93' });\r\n Codicon.menu = new Codicon('menu', { fontCharacter: '\\\\eb94' });\r\n Codicon.expandAll = new Codicon('expand-all', { fontCharacter: '\\\\eb95' });\r\n Codicon.feedback = new Codicon('feedback', { fontCharacter: '\\\\eb96' });\r\n Codicon.groupByRefType = new Codicon('group-by-ref-type', { fontCharacter: '\\\\eb97' });\r\n Codicon.ungroupByRefType = new Codicon('ungroup-by-ref-type', { fontCharacter: '\\\\eb98' });\r\n Codicon.account = new Codicon('account', { fontCharacter: '\\\\eb99' });\r\n Codicon.bellDot = new Codicon('bell-dot', { fontCharacter: '\\\\eb9a' });\r\n Codicon.debugConsole = new Codicon('debug-console', { fontCharacter: '\\\\eb9b' });\r\n Codicon.library = new Codicon('library', { fontCharacter: '\\\\eb9c' });\r\n Codicon.output = new Codicon('output', { fontCharacter: '\\\\eb9d' });\r\n Codicon.runAll = new Codicon('run-all', { fontCharacter: '\\\\eb9e' });\r\n Codicon.syncIgnored = new Codicon('sync-ignored', { fontCharacter: '\\\\eb9f' });\r\n Codicon.pinned = new Codicon('pinned', { fontCharacter: '\\\\eba0' });\r\n Codicon.githubInverted = new Codicon('github-inverted', { fontCharacter: '\\\\eba1' });\r\n Codicon.debugAlt = new Codicon('debug-alt', { fontCharacter: '\\\\eb91' });\r\n Codicon.serverProcess = new Codicon('server-process', { fontCharacter: '\\\\eba2' });\r\n Codicon.serverEnvironment = new Codicon('server-environment', { fontCharacter: '\\\\eba3' });\r\n Codicon.pass = new Codicon('pass', { fontCharacter: '\\\\eba4' });\r\n Codicon.stopCircle = new Codicon('stop-circle', { fontCharacter: '\\\\eba5' });\r\n Codicon.playCircle = new Codicon('play-circle', { fontCharacter: '\\\\eba6' });\r\n Codicon.record = new Codicon('record', { fontCharacter: '\\\\eba7' });\r\n Codicon.debugAltSmall = new Codicon('debug-alt-small', { fontCharacter: '\\\\eba8' });\r\n Codicon.vmConnect = new Codicon('vm-connect', { fontCharacter: '\\\\eba9' });\r\n Codicon.cloud = new Codicon('cloud', { fontCharacter: '\\\\ebaa' });\r\n Codicon.merge = new Codicon('merge', { fontCharacter: '\\\\ebab' });\r\n Codicon.exportIcon = new Codicon('export', { fontCharacter: '\\\\ebac' });\r\n Codicon.graphLeft = new Codicon('graph-left', { fontCharacter: '\\\\ebad' });\r\n Codicon.magnet = new Codicon('magnet', { fontCharacter: '\\\\ebae' });\r\n Codicon.notebook = new Codicon('notebook', { fontCharacter: '\\\\ebaf' });\r\n Codicon.redo = new Codicon('redo', { fontCharacter: '\\\\ebb0' });\r\n Codicon.checkAll = new Codicon('check-all', { fontCharacter: '\\\\ebb1' });\r\n Codicon.pinnedDirty = new Codicon('pinned-dirty', { fontCharacter: '\\\\ebb2' });\r\n Codicon.passFilled = new Codicon('pass-filled', { fontCharacter: '\\\\ebb3' });\r\n Codicon.circleLargeFilled = new Codicon('circle-large-filled', { fontCharacter: '\\\\ebb4' });\r\n Codicon.circleLargeOutline = new Codicon('circle-large-outline', { fontCharacter: '\\\\ebb5' });\r\n Codicon.combine = new Codicon('combine', { fontCharacter: '\\\\ebb6' });\r\n Codicon.gather = new Codicon('gather', { fontCharacter: '\\\\ebb6' });\r\n Codicon.table = new Codicon('table', { fontCharacter: '\\\\ebb7' });\r\n Codicon.variableGroup = new Codicon('variable-group', { fontCharacter: '\\\\ebb8' });\r\n Codicon.typeHierarchy = new Codicon('type-hierarchy', { fontCharacter: '\\\\ebb9' });\r\n Codicon.typeHierarchySub = new Codicon('type-hierarchy-sub', { fontCharacter: '\\\\ebba' });\r\n Codicon.typeHierarchySuper = new Codicon('type-hierarchy-super', { fontCharacter: '\\\\ebbb' });\r\n Codicon.gitPullRequestCreate = new Codicon('git-pull-request-create', { fontCharacter: '\\\\ebbc' });\r\n Codicon.runAbove = new Codicon('run-above', { fontCharacter: '\\\\ebbd' });\r\n Codicon.runBelow = new Codicon('run-below', { fontCharacter: '\\\\ebbe' });\r\n Codicon.notebookTemplate = new Codicon('notebook-template', { fontCharacter: '\\\\ebbf' });\r\n Codicon.debugRerun = new Codicon('debug-rerun', { fontCharacter: '\\\\ebc0' });\r\n Codicon.workspaceTrusted = new Codicon('workspace-trusted', { fontCharacter: '\\\\ebc1' });\r\n Codicon.workspaceUntrusted = new Codicon('workspace-untrusted', { fontCharacter: '\\\\ebc2' });\r\n Codicon.workspaceUnspecified = new Codicon('workspace-unspecified', { fontCharacter: '\\\\ebc3' });\r\n Codicon.terminalCmd = new Codicon('terminal-cmd', { fontCharacter: '\\\\ebc4' });\r\n Codicon.terminalDebian = new Codicon('terminal-debian', { fontCharacter: '\\\\ebc5' });\r\n Codicon.terminalLinux = new Codicon('terminal-linux', { fontCharacter: '\\\\ebc6' });\r\n Codicon.terminalPowershell = new Codicon('terminal-powershell', { fontCharacter: '\\\\ebc7' });\r\n Codicon.terminalTmux = new Codicon('terminal-tmux', { fontCharacter: '\\\\ebc8' });\r\n Codicon.terminalUbuntu = new Codicon('terminal-ubuntu', { fontCharacter: '\\\\ebc9' });\r\n Codicon.terminalBash = new Codicon('terminal-bash', { fontCharacter: '\\\\ebca' });\r\n Codicon.arrowSwap = new Codicon('arrow-swap', { fontCharacter: '\\\\ebcb' });\r\n Codicon.copy = new Codicon('copy', { fontCharacter: '\\\\ebcc' });\r\n Codicon.personAdd = new Codicon('person-add', { fontCharacter: '\\\\ebcd' });\r\n Codicon.filterFilled = new Codicon('filter-filled', { fontCharacter: '\\\\ebce' });\r\n Codicon.wand = new Codicon('wand', { fontCharacter: '\\\\ebcf' });\r\n Codicon.debugLineByLine = new Codicon('debug-line-by-line', { fontCharacter: '\\\\ebd0' });\r\n Codicon.inspect = new Codicon('inspect', { fontCharacter: '\\\\ebd1' });\r\n Codicon.layers = new Codicon('layers', { fontCharacter: '\\\\ebd2' });\r\n Codicon.layersDot = new Codicon('layers-dot', { fontCharacter: '\\\\ebd3' });\r\n Codicon.layersActive = new Codicon('layers-active', { fontCharacter: '\\\\ebd4' });\r\n Codicon.compass = new Codicon('compass', { fontCharacter: '\\\\ebd5' });\r\n Codicon.compassDot = new Codicon('compass-dot', { fontCharacter: '\\\\ebd6' });\r\n Codicon.compassActive = new Codicon('compass-active', { fontCharacter: '\\\\ebd7' });\r\n Codicon.azure = new Codicon('azure', { fontCharacter: '\\\\ebd8' });\r\n Codicon.issueDraft = new Codicon('issue-draft', { fontCharacter: '\\\\ebd9' });\r\n Codicon.gitPullRequestClosed = new Codicon('git-pull-request-closed', { fontCharacter: '\\\\ebda' });\r\n Codicon.gitPullRequestDraft = new Codicon('git-pull-request-draft', { fontCharacter: '\\\\ebdb' });\r\n Codicon.debugAll = new Codicon('debug-all', { fontCharacter: '\\\\ebdc' });\r\n Codicon.debugCoverage = new Codicon('debug-coverage', { fontCharacter: '\\\\ebdd' });\r\n Codicon.dropDownButton = new Codicon('drop-down-button', Codicon.chevronDown.definition);\r\n})(Codicon || (Codicon = {}));\r\n", "/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License. See License.txt in the project root for license information.\r\n *--------------------------------------------------------------------------------------------*/\r\nimport { createDecorator } from '../../instantiation/common/instantiation.js';\r\nimport { toDisposable, Disposable } from '../../../base/common/lifecycle.js';\r\nimport * as platform from '../../registry/common/platform.js';\r\nimport { Emitter } from '../../../base/common/event.js';\r\nimport { ColorScheme } from './theme.js';\r\nimport { CSSIcon } from '../../../base/common/codicons.js';\r\nexport const IThemeService = createDecorator('themeService');\r\nexport var ThemeColor;\r\n(function (ThemeColor) {\r\n function isThemeColor(obj) {\r\n return obj && typeof obj === 'object' && typeof obj.id === 'string';\r\n }\r\n ThemeColor.isThemeColor = isThemeColor;\r\n})(ThemeColor || (ThemeColor = {}));\r\nexport function themeColorFromId(id) {\r\n return { id };\r\n}\r\nexport var ThemeIcon;\r\n(function (ThemeIcon) {\r\n function isThemeIcon(obj) {\r\n return obj && typeof obj === 'object' && typeof obj.id === 'string' && (typeof obj.color === 'undefined' || ThemeColor.isThemeColor(obj.color));\r\n }\r\n ThemeIcon.isThemeIcon = isThemeIcon;\r\n const _regexFromString = new RegExp(`^\\\\$\\\\((${CSSIcon.iconNameExpression}(?:${CSSIcon.iconModifierExpression})?)\\\\)$`);\r\n function fromString(str) {\r\n const match = _regexFromString.exec(str);\r\n if (!match) {\r\n return undefined;\r\n }\r\n let [, name] = match;\r\n return { id: name };\r\n }\r\n ThemeIcon.fromString = fromString;\r\n function modify(icon, modifier) {\r\n let id = icon.id;\r\n const tildeIndex = id.lastIndexOf('~');\r\n if (tildeIndex !== -1) {\r\n id = id.substring(0, tildeIndex);\r\n }\r\n if (modifier) {\r\n id = `${id}~${modifier}`;\r\n }\r\n return { id };\r\n }\r\n ThemeIcon.modify = modify;\r\n function isEqual(ti1, ti2) {\r\n var _a, _b;\r\n return ti1.id === ti2.id && ((_a = ti1.color) === null || _a === void 0 ? void 0 : _a.id) === ((_b = ti2.color) === null || _b === void 0 ? void 0 : _b.id);\r\n }\r\n ThemeIcon.isEqual = isEqual;\r\n function asThemeIcon(codicon, color) {\r\n return { id: codicon.id, color: color ? themeColorFromId(color) : undefined };\r\n }\r\n ThemeIcon.asThemeIcon = asThemeIcon;\r\n ThemeIcon.asClassNameArray = CSSIcon.asClassNameArray;\r\n ThemeIcon.asClassName = CSSIcon.asClassName;\r\n ThemeIcon.asCSSSelector = CSSIcon.asCSSSelector;\r\n})(ThemeIcon || (ThemeIcon = {}));\r\nexport function getThemeTypeSelector(type) {\r\n switch (type) {\r\n case ColorScheme.DARK: return 'vs-dark';\r\n case ColorScheme.HIGH_CONTRAST: return 'hc-black';\r\n default: return 'vs';\r\n }\r\n}\r\n// static theming participant\r\nexport const Extensions = {\r\n ThemingContribution: 'base.contributions.theming'\r\n};\r\nclass ThemingRegistry {\r\n constructor() {\r\n this.themingParticipants = [];\r\n this.themingParticipants = [];\r\n this.onThemingParticipantAddedEmitter = new Emitter();\r\n }\r\n onColorThemeChange(participant) {\r\n this.themingParticipants.push(participant);\r\n this.onThemingParticipantAddedEmitter.fire(participant);\r\n return toDisposable(() => {\r\n const idx = this.themingParticipants.indexOf(participant);\r\n this.themingParticipants.splice(idx, 1);\r\n });\r\n }\r\n getThemingParticipants() {\r\n return this.themingParticipants;\r\n }\r\n}\r\nlet themingRegistry = new ThemingRegistry();\r\nplatform.Registry.add(Extensions.ThemingContribution, themingRegistry);\r\nexport function registerThemingParticipant(participant) {\r\n return themingRegistry.onColorThemeChange(participant);\r\n}\r\n/**\r\n * Utility base class for all themable components.\r\n */\r\nexport class Themable extends Disposable {\r\n constructor(themeService) {\r\n super();\r\n this.themeService = themeService;\r\n this.theme = themeService.getColorTheme();\r\n // Hook up to theme changes\r\n this._register(this.themeService.onDidColorThemeChange(theme => this.onThemeChange(theme)));\r\n }\r\n onThemeChange(theme) {\r\n this.theme = theme;\r\n this.updateStyles();\r\n }\r\n updateStyles() {\r\n // Subclasses to override\r\n }\r\n}\r\n", "/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License. See License.txt in the project root for license information.\r\n *--------------------------------------------------------------------------------------------*/\r\nvar __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n};\r\nvar __param = (this && this.__param) || function (paramIndex, decorator) {\r\n return function (target, key) { decorator(target, key, paramIndex); }\r\n};\r\nimport { Separator, SubmenuAction } from '../../../base/common/actions.js';\r\nimport { createDecorator } from '../../instantiation/common/instantiation.js';\r\nimport { IContextKeyService } from '../../contextkey/common/contextkey.js';\r\nimport { ICommandService } from '../../commands/common/commands.js';\r\nimport { toDisposable } from '../../../base/common/lifecycle.js';\r\nimport { Emitter } from '../../../base/common/event.js';\r\nimport { ThemeIcon } from '../../theme/common/themeService.js';\r\nimport { Iterable } from '../../../base/common/iterator.js';\r\nimport { LinkedList } from '../../../base/common/linkedList.js';\r\nimport { CSSIcon } from '../../../base/common/codicons.js';\r\nexport function isIMenuItem(item) {\r\n return item.command !== undefined;\r\n}\r\nexport class MenuId {\r\n constructor(debugName) {\r\n this.id = MenuId._idPool++;\r\n this._debugName = debugName;\r\n }\r\n}\r\nMenuId._idPool = 0;\r\nMenuId.CommandPalette = new MenuId('CommandPalette');\r\nMenuId.EditorContext = new MenuId('EditorContext');\r\nMenuId.SimpleEditorContext = new MenuId('SimpleEditorContext');\r\nMenuId.EditorContextCopy = new MenuId('EditorContextCopy');\r\nMenuId.EditorContextPeek = new MenuId('EditorContextPeek');\r\nMenuId.MenubarEditMenu = new MenuId('MenubarEditMenu');\r\nMenuId.MenubarCopy = new MenuId('MenubarCopy');\r\nMenuId.MenubarGoMenu = new MenuId('MenubarGoMenu');\r\nMenuId.MenubarSelectionMenu = new MenuId('MenubarSelectionMenu');\r\nMenuId.InlineCompletionsActions = new MenuId('InlineCompletionsActions');\r\nexport const IMenuService = createDecorator('menuService');\r\nexport const MenuRegistry = new class {\r\n constructor() {\r\n this._commands = new Map();\r\n this._menuItems = new Map();\r\n this._onDidChangeMenu = new Emitter();\r\n this.onDidChangeMenu = this._onDidChangeMenu.event;\r\n this._commandPaletteChangeEvent = {\r\n has: id => id === MenuId.CommandPalette\r\n };\r\n }\r\n addCommand(command) {\r\n return this.addCommands(Iterable.single(command));\r\n }\r\n addCommands(commands) {\r\n for (const command of commands) {\r\n this._commands.set(command.id, command);\r\n }\r\n this._onDidChangeMenu.fire(this._commandPaletteChangeEvent);\r\n return toDisposable(() => {\r\n let didChange = false;\r\n for (const command of commands) {\r\n didChange = this._commands.delete(command.id) || didChange;\r\n }\r\n if (didChange) {\r\n this._onDidChangeMenu.fire(this._commandPaletteChangeEvent);\r\n }\r\n });\r\n }\r\n getCommand(id) {\r\n return this._commands.get(id);\r\n }\r\n getCommands() {\r\n const map = new Map();\r\n this._commands.forEach((value, key) => map.set(key, value));\r\n return map;\r\n }\r\n appendMenuItem(id, item) {\r\n return this.appendMenuItems(Iterable.single({ id, item }));\r\n }\r\n appendMenuItems(items) {\r\n const changedIds = new Set();\r\n const toRemove = new LinkedList();\r\n for (const { id, item } of items) {\r\n let list = this._menuItems.get(id);\r\n if (!list) {\r\n list = new LinkedList();\r\n this._menuItems.set(id, list);\r\n }\r\n toRemove.push(list.push(item));\r\n changedIds.add(id);\r\n }\r\n this._onDidChangeMenu.fire(changedIds);\r\n return toDisposable(() => {\r\n if (toRemove.size > 0) {\r\n for (let fn of toRemove) {\r\n fn();\r\n }\r\n this._onDidChangeMenu.fire(changedIds);\r\n toRemove.clear();\r\n }\r\n });\r\n }\r\n getMenuItems(id) {\r\n let result;\r\n if (this._menuItems.has(id)) {\r\n result = [...this._menuItems.get(id)];\r\n }\r\n else {\r\n result = [];\r\n }\r\n if (id === MenuId.CommandPalette) {\r\n // CommandPalette is special because it shows\r\n // all commands by default\r\n this._appendImplicitItems(result);\r\n }\r\n return result;\r\n }\r\n _appendImplicitItems(result) {\r\n const set = new Set();\r\n for (const item of result) {\r\n if (isIMenuItem(item)) {\r\n set.add(item.command.id);\r\n if (item.alt) {\r\n set.add(item.alt.id);\r\n }\r\n }\r\n }\r\n this._commands.forEach((command, id) => {\r\n if (!set.has(id)) {\r\n result.push({ command });\r\n }\r\n });\r\n }\r\n};\r\nexport class SubmenuItemAction extends SubmenuAction {\r\n constructor(item, _menuService, _contextKeyService, _options) {\r\n super(`submenuitem.${item.submenu.id}`, typeof item.title === 'string' ? item.title : item.title.value, [], 'submenu');\r\n this.item = item;\r\n this._menuService = _menuService;\r\n this._contextKeyService = _contextKeyService;\r\n this._options = _options;\r\n }\r\n get actions() {\r\n const result = [];\r\n const menu = this._menuService.createMenu(this.item.submenu, this._contextKeyService);\r\n const groups = menu.getActions(this._options);\r\n menu.dispose();\r\n for (const [, actions] of groups) {\r\n if (actions.length > 0) {\r\n result.push(...actions);\r\n result.push(new Separator());\r\n }\r\n }\r\n if (result.length) {\r\n result.pop(); // remove last separator\r\n }\r\n return result;\r\n }\r\n}\r\n// implements IAction, does NOT extend Action, so that no one\r\n// subscribes to events of Action or modified properties\r\nlet MenuItemAction = class MenuItemAction {\r\n constructor(item, alt, options, contextKeyService, _commandService) {\r\n var _a;\r\n this._commandService = _commandService;\r\n this.id = item.id;\r\n this.label = (options === null || options === void 0 ? void 0 : options.renderShortTitle) && item.shortTitle\r\n ? (typeof item.shortTitle === 'string' ? item.shortTitle : item.shortTitle.value)\r\n : (typeof item.title === 'string' ? item.title : item.title.value);\r\n this.tooltip = (_a = item.tooltip) !== null && _a !== void 0 ? _a : '';\r\n this.enabled = !item.precondition || contextKeyService.contextMatchesRules(item.precondition);\r\n this.checked = false;\r\n if (item.toggled) {\r\n const toggled = (item.toggled.condition ? item.toggled : { condition: item.toggled });\r\n this.checked = contextKeyService.contextMatchesRules(toggled.condition);\r\n if (this.checked && toggled.tooltip) {\r\n this.tooltip = typeof toggled.tooltip === 'string' ? toggled.tooltip : toggled.tooltip.value;\r\n }\r\n if (toggled.title) {\r\n this.label = typeof toggled.title === 'string' ? toggled.title : toggled.title.value;\r\n }\r\n }\r\n this.item = item;\r\n this.alt = alt ? new MenuItemAction(alt, undefined, options, contextKeyService, _commandService) : undefined;\r\n this._options = options;\r\n if (ThemeIcon.isThemeIcon(item.icon)) {\r\n this.class = CSSIcon.asClassName(item.icon);\r\n }\r\n }\r\n dispose() {\r\n // there is NOTHING to dispose and the MenuItemAction should\r\n // never have anything to dispose as it is a convenience type\r\n // to bridge into the rendering world.\r\n }\r\n run(...args) {\r\n var _a, _b;\r\n let runArgs = [];\r\n if ((_a = this._options) === null || _a === void 0 ? void 0 : _a.arg) {\r\n runArgs = [...runArgs, this._options.arg];\r\n }\r\n if ((_b = this._options) === null || _b === void 0 ? void 0 : _b.shouldForwardArgs) {\r\n runArgs = [...runArgs, ...args];\r\n }\r\n return this._commandService.executeCommand(this.id, ...runArgs);\r\n }\r\n};\r\nMenuItemAction = __decorate([\r\n __param(3, IContextKeyService),\r\n __param(4, ICommandService)\r\n], MenuItemAction);\r\nexport { MenuItemAction };\r\n//#endregion\r\n", "/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License. See License.txt in the project root for license information.\r\n *--------------------------------------------------------------------------------------------*/\r\nimport { createKeybinding } from '../../../base/common/keyCodes.js';\r\nimport { OS } from '../../../base/common/platform.js';\r\nimport { CommandsRegistry } from '../../commands/common/commands.js';\r\nimport { Registry } from '../../registry/common/platform.js';\r\nclass KeybindingsRegistryImpl {\r\n constructor() {\r\n this._coreKeybindings = [];\r\n this._extensionKeybindings = [];\r\n this._cachedMergedKeybindings = null;\r\n }\r\n /**\r\n * Take current platform into account and reduce to primary & secondary.\r\n */\r\n static bindToCurrentPlatform(kb) {\r\n if (OS === 1 /* Windows */) {\r\n if (kb && kb.win) {\r\n return kb.win;\r\n }\r\n }\r\n else if (OS === 2 /* Macintosh */) {\r\n if (kb && kb.mac) {\r\n return kb.mac;\r\n }\r\n }\r\n else {\r\n if (kb && kb.linux) {\r\n return kb.linux;\r\n }\r\n }\r\n return kb;\r\n }\r\n registerKeybindingRule(rule) {\r\n const actualKb = KeybindingsRegistryImpl.bindToCurrentPlatform(rule);\r\n if (actualKb && actualKb.primary) {\r\n const kk = createKeybinding(actualKb.primary, OS);\r\n if (kk) {\r\n this._registerDefaultKeybinding(kk, rule.id, rule.args, rule.weight, 0, rule.when);\r\n }\r\n }\r\n if (actualKb && Array.isArray(actualKb.secondary)) {\r\n for (let i = 0, len = actualKb.secondary.length; i < len; i++) {\r\n const k = actualKb.secondary[i];\r\n const kk = createKeybinding(k, OS);\r\n if (kk) {\r\n this._registerDefaultKeybinding(kk, rule.id, rule.args, rule.weight, -i - 1, rule.when);\r\n }\r\n }\r\n }\r\n }\r\n registerCommandAndKeybindingRule(desc) {\r\n this.registerKeybindingRule(desc);\r\n CommandsRegistry.registerCommand(desc);\r\n }\r\n static _mightProduceChar(keyCode) {\r\n if (keyCode >= 21 /* KEY_0 */ && keyCode <= 30 /* KEY_9 */) {\r\n return true;\r\n }\r\n if (keyCode >= 31 /* KEY_A */ && keyCode <= 56 /* KEY_Z */) {\r\n return true;\r\n }\r\n return (keyCode === 80 /* US_SEMICOLON */\r\n || keyCode === 81 /* US_EQUAL */\r\n || keyCode === 82 /* US_COMMA */\r\n || keyCode === 83 /* US_MINUS */\r\n || keyCode === 84 /* US_DOT */\r\n || keyCode === 85 /* US_SLASH */\r\n || keyCode === 86 /* US_BACKTICK */\r\n || keyCode === 110 /* ABNT_C1 */\r\n || keyCode === 111 /* ABNT_C2 */\r\n || keyCode === 87 /* US_OPEN_SQUARE_BRACKET */\r\n || keyCode === 88 /* US_BACKSLASH */\r\n || keyCode === 89 /* US_CLOSE_SQUARE_BRACKET */\r\n || keyCode === 90 /* US_QUOTE */\r\n || keyCode === 91 /* OEM_8 */\r\n || keyCode === 92 /* OEM_102 */);\r\n }\r\n _assertNoCtrlAlt(keybinding, commandId) {\r\n if (keybinding.ctrlKey && keybinding.altKey && !keybinding.metaKey) {\r\n if (KeybindingsRegistryImpl._mightProduceChar(keybinding.keyCode)) {\r\n console.warn('Ctrl+Alt+ keybindings should not be used by default under Windows. Offender: ', keybinding, ' for ', commandId);\r\n }\r\n }\r\n }\r\n _registerDefaultKeybinding(keybinding, commandId, commandArgs, weight1, weight2, when) {\r\n if (OS === 1 /* Windows */) {\r\n this._assertNoCtrlAlt(keybinding.parts[0], commandId);\r\n }\r\n this._coreKeybindings.push({\r\n keybinding: keybinding,\r\n command: commandId,\r\n commandArgs: commandArgs,\r\n when: when,\r\n weight1: weight1,\r\n weight2: weight2,\r\n extensionId: null,\r\n isBuiltinExtension: false\r\n });\r\n this._cachedMergedKeybindings = null;\r\n }\r\n getDefaultKeybindings() {\r\n if (!this._cachedMergedKeybindings) {\r\n this._cachedMergedKeybindings = [].concat(this._coreKeybindings).concat(this._extensionKeybindings);\r\n this._cachedMergedKeybindings.sort(sorter);\r\n }\r\n return this._cachedMergedKeybindings.slice(0);\r\n }\r\n}\r\nexport const KeybindingsRegistry = new KeybindingsRegistryImpl();\r\n// Define extension point ids\r\nexport const Extensions = {\r\n EditorModes: 'platform.keybindingsRegistry'\r\n};\r\nRegistry.add(Extensions.EditorModes, KeybindingsRegistry);\r\nfunction sorter(a, b) {\r\n if (a.weight1 !== b.weight1) {\r\n return a.weight1 - b.weight1;\r\n }\r\n if (a.command < b.command) {\r\n return -1;\r\n }\r\n if (a.command > b.command) {\r\n return 1;\r\n }\r\n return a.weight2 - b.weight2;\r\n}\r\n", "/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License. See License.txt in the project root for license information.\r\n *--------------------------------------------------------------------------------------------*/\r\nimport { createDecorator } from '../../instantiation/common/instantiation.js';\r\nexport const ITelemetryService = createDecorator('telemetryService');\r\n", "/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License. See License.txt in the project root for license information.\r\n *--------------------------------------------------------------------------------------------*/\r\nimport { createDecorator as createServiceDecorator } from '../../instantiation/common/instantiation.js';\r\nimport { Disposable } from '../../../base/common/lifecycle.js';\r\nimport { Emitter } from '../../../base/common/event.js';\r\nexport const ILogService = createServiceDecorator('logService');\r\nexport var LogLevel;\r\n(function (LogLevel) {\r\n LogLevel[LogLevel[\"Trace\"] = 0] = \"Trace\";\r\n LogLevel[LogLevel[\"Debug\"] = 1] = \"Debug\";\r\n LogLevel[LogLevel[\"Info\"] = 2] = \"Info\";\r\n LogLevel[LogLevel[\"Warning\"] = 3] = \"Warning\";\r\n LogLevel[LogLevel[\"Error\"] = 4] = \"Error\";\r\n LogLevel[LogLevel[\"Critical\"] = 5] = \"Critical\";\r\n LogLevel[LogLevel[\"Off\"] = 6] = \"Off\";\r\n})(LogLevel || (LogLevel = {}));\r\nexport const DEFAULT_LOG_LEVEL = LogLevel.Info;\r\nexport class AbstractLogger extends Disposable {\r\n constructor() {\r\n super(...arguments);\r\n this.level = DEFAULT_LOG_LEVEL;\r\n this._onDidChangeLogLevel = this._register(new Emitter());\r\n }\r\n setLevel(level) {\r\n if (this.level !== level) {\r\n this.level = level;\r\n this._onDidChangeLogLevel.fire(this.level);\r\n }\r\n }\r\n getLevel() {\r\n return this.level;\r\n }\r\n}\r\nexport class ConsoleLogger extends AbstractLogger {\r\n constructor(logLevel = DEFAULT_LOG_LEVEL) {\r\n super();\r\n this.setLevel(logLevel);\r\n }\r\n trace(message, ...args) {\r\n if (this.getLevel() <= LogLevel.Trace) {\r\n console.log('%cTRACE', 'color: #888', message, ...args);\r\n }\r\n }\r\n debug(message, ...args) {\r\n if (this.getLevel() <= LogLevel.Debug) {\r\n console.log('%cDEBUG', 'background: #eee; color: #888', message, ...args);\r\n }\r\n }\r\n info(message, ...args) {\r\n if (this.getLevel() <= LogLevel.Info) {\r\n console.log('%c INFO', 'color: #33f', message, ...args);\r\n }\r\n }\r\n error(message, ...args) {\r\n if (this.getLevel() <= LogLevel.Error) {\r\n console.log('%c ERR', 'color: #f33', message, ...args);\r\n }\r\n }\r\n dispose() {\r\n // noop\r\n }\r\n}\r\nexport class LogService extends Disposable {\r\n constructor(logger) {\r\n super();\r\n this.logger = logger;\r\n this._register(logger);\r\n }\r\n getLevel() {\r\n return this.logger.getLevel();\r\n }\r\n trace(message, ...args) {\r\n this.logger.trace(message, ...args);\r\n }\r\n debug(message, ...args) {\r\n this.logger.debug(message, ...args);\r\n }\r\n info(message, ...args) {\r\n this.logger.info(message, ...args);\r\n }\r\n error(message, ...args) {\r\n this.logger.error(message, ...args);\r\n }\r\n}\r\n", "/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License. See License.txt in the project root for license information.\r\n *--------------------------------------------------------------------------------------------*/\r\nimport * as nls from '../../nls.js';\r\nimport { URI } from '../../base/common/uri.js';\r\nimport { ICodeEditorService } from './services/codeEditorService.js';\r\nimport { Position } from '../common/core/position.js';\r\nimport { IModelService } from '../common/services/modelService.js';\r\nimport { ITextModelService } from '../common/services/resolverService.js';\r\nimport { MenuId, MenuRegistry } from '../../platform/actions/common/actions.js';\r\nimport { CommandsRegistry } from '../../platform/commands/common/commands.js';\r\nimport { ContextKeyExpr, IContextKeyService } from '../../platform/contextkey/common/contextkey.js';\r\nimport { KeybindingsRegistry } from '../../platform/keybinding/common/keybindingsRegistry.js';\r\nimport { Registry } from '../../platform/registry/common/platform.js';\r\nimport { ITelemetryService } from '../../platform/telemetry/common/telemetry.js';\r\nimport { withNullAsUndefined, assertType } from '../../base/common/types.js';\r\nimport { ILogService } from '../../platform/log/common/log.js';\r\nexport class Command {\r\n constructor(opts) {\r\n this.id = opts.id;\r\n this.precondition = opts.precondition;\r\n this._kbOpts = opts.kbOpts;\r\n this._menuOpts = opts.menuOpts;\r\n this._description = opts.description;\r\n }\r\n register() {\r\n if (Array.isArray(this._menuOpts)) {\r\n this._menuOpts.forEach(this._registerMenuItem, this);\r\n }\r\n else if (this._menuOpts) {\r\n this._registerMenuItem(this._menuOpts);\r\n }\r\n if (this._kbOpts) {\r\n const kbOptsArr = Array.isArray(this._kbOpts) ? this._kbOpts : [this._kbOpts];\r\n for (const kbOpts of kbOptsArr) {\r\n let kbWhen = kbOpts.kbExpr;\r\n if (this.precondition) {\r\n if (kbWhen) {\r\n kbWhen = ContextKeyExpr.and(kbWhen, this.precondition);\r\n }\r\n else {\r\n kbWhen = this.precondition;\r\n }\r\n }\r\n const desc = {\r\n id: this.id,\r\n weight: kbOpts.weight,\r\n args: kbOpts.args,\r\n when: kbWhen,\r\n primary: kbOpts.primary,\r\n secondary: kbOpts.secondary,\r\n win: kbOpts.win,\r\n linux: kbOpts.linux,\r\n mac: kbOpts.mac,\r\n };\r\n KeybindingsRegistry.registerKeybindingRule(desc);\r\n }\r\n }\r\n CommandsRegistry.registerCommand({\r\n id: this.id,\r\n handler: (accessor, args) => this.runCommand(accessor, args),\r\n description: this._description\r\n });\r\n }\r\n _registerMenuItem(item) {\r\n MenuRegistry.appendMenuItem(item.menuId, {\r\n group: item.group,\r\n command: {\r\n id: this.id,\r\n title: item.title,\r\n icon: item.icon,\r\n precondition: this.precondition\r\n },\r\n when: item.when,\r\n order: item.order\r\n });\r\n }\r\n}\r\nexport class MultiCommand extends Command {\r\n constructor() {\r\n super(...arguments);\r\n this._implementations = [];\r\n }\r\n /**\r\n * A higher priority gets to be looked at first\r\n */\r\n addImplementation(priority, name, implementation) {\r\n this._implementations.push({ priority, name, implementation });\r\n this._implementations.sort((a, b) => b.priority - a.priority);\r\n return {\r\n dispose: () => {\r\n for (let i = 0; i < this._implementations.length; i++) {\r\n if (this._implementations[i].implementation === implementation) {\r\n this._implementations.splice(i, 1);\r\n return;\r\n }\r\n }\r\n }\r\n };\r\n }\r\n runCommand(accessor, args) {\r\n const logService = accessor.get(ILogService);\r\n for (const impl of this._implementations) {\r\n const result = impl.implementation(accessor, args);\r\n if (result) {\r\n logService.trace(`Command '${this.id}' was handled by '${impl.name}'.`);\r\n if (typeof result === 'boolean') {\r\n return;\r\n }\r\n return result;\r\n }\r\n }\r\n }\r\n}\r\n//#endregion\r\n/**\r\n * A command that delegates to another command's implementation.\r\n *\r\n * This lets different commands be registered but share the same implementation\r\n */\r\nexport class ProxyCommand extends Command {\r\n constructor(command, opts) {\r\n super(opts);\r\n this.command = command;\r\n }\r\n runCommand(accessor, args) {\r\n return this.command.runCommand(accessor, args);\r\n }\r\n}\r\nexport class EditorCommand extends Command {\r\n /**\r\n * Create a command class that is bound to a certain editor contribution.\r\n */\r\n static bindToContribution(controllerGetter) {\r\n return class EditorControllerCommandImpl extends EditorCommand {\r\n constructor(opts) {\r\n super(opts);\r\n this._callback = opts.handler;\r\n }\r\n runEditorCommand(accessor, editor, args) {\r\n const controller = controllerGetter(editor);\r\n if (controller) {\r\n this._callback(controllerGetter(editor), args);\r\n }\r\n }\r\n };\r\n }\r\n runCommand(accessor, args) {\r\n const codeEditorService = accessor.get(ICodeEditorService);\r\n // Find the editor with text focus or active\r\n const editor = codeEditorService.getFocusedCodeEditor() || codeEditorService.getActiveCodeEditor();\r\n if (!editor) {\r\n // well, at least we tried...\r\n return;\r\n }\r\n return editor.invokeWithinContext((editorAccessor) => {\r\n const kbService = editorAccessor.get(IContextKeyService);\r\n if (!kbService.contextMatchesRules(withNullAsUndefined(this.precondition))) {\r\n // precondition does not hold\r\n return;\r\n }\r\n return this.runEditorCommand(editorAccessor, editor, args);\r\n });\r\n }\r\n}\r\nexport class EditorAction extends EditorCommand {\r\n constructor(opts) {\r\n super(EditorAction.convertOptions(opts));\r\n this.label = opts.label;\r\n this.alias = opts.alias;\r\n }\r\n static convertOptions(opts) {\r\n let menuOpts;\r\n if (Array.isArray(opts.menuOpts)) {\r\n menuOpts = opts.menuOpts;\r\n }\r\n else if (opts.menuOpts) {\r\n menuOpts = [opts.menuOpts];\r\n }\r\n else {\r\n menuOpts = [];\r\n }\r\n function withDefaults(item) {\r\n if (!item.menuId) {\r\n item.menuId = MenuId.EditorContext;\r\n }\r\n if (!item.title) {\r\n item.title = opts.label;\r\n }\r\n item.when = ContextKeyExpr.and(opts.precondition, item.when);\r\n return item;\r\n }\r\n if (Array.isArray(opts.contextMenuOpts)) {\r\n menuOpts.push(...opts.contextMenuOpts.map(withDefaults));\r\n }\r\n else if (opts.contextMenuOpts) {\r\n menuOpts.push(withDefaults(opts.contextMenuOpts));\r\n }\r\n opts.menuOpts = menuOpts;\r\n return opts;\r\n }\r\n runEditorCommand(accessor, editor, args) {\r\n this.reportTelemetry(accessor, editor);\r\n return this.run(accessor, editor, args || {});\r\n }\r\n reportTelemetry(accessor, editor) {\r\n accessor.get(ITelemetryService).publicLog2('editorActionInvoked', { name: this.label, id: this.id });\r\n }\r\n}\r\nexport class MultiEditorAction extends EditorAction {\r\n constructor() {\r\n super(...arguments);\r\n this._implementations = [];\r\n }\r\n /**\r\n * A higher priority gets to be looked at first\r\n */\r\n addImplementation(priority, implementation) {\r\n this._implementations.push([priority, implementation]);\r\n this._implementations.sort((a, b) => b[0] - a[0]);\r\n return {\r\n dispose: () => {\r\n for (let i = 0; i < this._implementations.length; i++) {\r\n if (this._implementations[i][1] === implementation) {\r\n this._implementations.splice(i, 1);\r\n return;\r\n }\r\n }\r\n }\r\n };\r\n }\r\n run(accessor, editor, args) {\r\n for (const impl of this._implementations) {\r\n const result = impl[1](accessor, editor, args);\r\n if (result) {\r\n if (typeof result === 'boolean') {\r\n return;\r\n }\r\n return result;\r\n }\r\n }\r\n }\r\n}\r\n//#endregion\r\n// --- Registration of commands and actions\r\nexport function registerModelAndPositionCommand(id, handler) {\r\n CommandsRegistry.registerCommand(id, function (accessor, ...args) {\r\n const [resource, position] = args;\r\n assertType(URI.isUri(resource));\r\n assertType(Position.isIPosition(position));\r\n const model = accessor.get(IModelService).getModel(resource);\r\n if (model) {\r\n const editorPosition = Position.lift(position);\r\n return handler(model, editorPosition, ...args.slice(2));\r\n }\r\n return accessor.get(ITextModelService).createModelReference(resource).then(reference => {\r\n return new Promise((resolve, reject) => {\r\n try {\r\n const result = handler(reference.object.textEditorModel, Position.lift(position), args.slice(2));\r\n resolve(result);\r\n }\r\n catch (err) {\r\n reject(err);\r\n }\r\n }).finally(() => {\r\n reference.dispose();\r\n });\r\n });\r\n });\r\n}\r\nexport function registerModelCommand(id, handler) {\r\n CommandsRegistry.registerCommand(id, function (accessor, ...args) {\r\n const [resource] = args;\r\n assertType(URI.isUri(resource));\r\n const model = accessor.get(IModelService).getModel(resource);\r\n if (model) {\r\n return handler(model, ...args.slice(1));\r\n }\r\n return accessor.get(ITextModelService).createModelReference(resource).then(reference => {\r\n return new Promise((resolve, reject) => {\r\n try {\r\n const result = handler(reference.object.textEditorModel, args.slice(1));\r\n resolve(result);\r\n }\r\n catch (err) {\r\n reject(err);\r\n }\r\n }).finally(() => {\r\n reference.dispose();\r\n });\r\n });\r\n });\r\n}\r\nexport function registerEditorCommand(editorCommand) {\r\n EditorContributionRegistry.INSTANCE.registerEditorCommand(editorCommand);\r\n return editorCommand;\r\n}\r\nexport function registerEditorAction(ctor) {\r\n const action = new ctor();\r\n EditorContributionRegistry.INSTANCE.registerEditorAction(action);\r\n return action;\r\n}\r\nexport function registerMultiEditorAction(action) {\r\n EditorContributionRegistry.INSTANCE.registerEditorAction(action);\r\n return action;\r\n}\r\nexport function registerInstantiatedEditorAction(editorAction) {\r\n EditorContributionRegistry.INSTANCE.registerEditorAction(editorAction);\r\n}\r\nexport function registerEditorContribution(id, ctor) {\r\n EditorContributionRegistry.INSTANCE.registerEditorContribution(id, ctor);\r\n}\r\nexport var EditorExtensionsRegistry;\r\n(function (EditorExtensionsRegistry) {\r\n function getEditorCommand(commandId) {\r\n return EditorContributionRegistry.INSTANCE.getEditorCommand(commandId);\r\n }\r\n EditorExtensionsRegistry.getEditorCommand = getEditorCommand;\r\n function getEditorActions() {\r\n return EditorContributionRegistry.INSTANCE.getEditorActions();\r\n }\r\n EditorExtensionsRegistry.getEditorActions = getEditorActions;\r\n function getEditorContributions() {\r\n return EditorContributionRegistry.INSTANCE.getEditorContributions();\r\n }\r\n EditorExtensionsRegistry.getEditorContributions = getEditorContributions;\r\n function getSomeEditorContributions(ids) {\r\n return EditorContributionRegistry.INSTANCE.getEditorContributions().filter(c => ids.indexOf(c.id) >= 0);\r\n }\r\n EditorExtensionsRegistry.getSomeEditorContributions = getSomeEditorContributions;\r\n function getDiffEditorContributions() {\r\n return EditorContributionRegistry.INSTANCE.getDiffEditorContributions();\r\n }\r\n EditorExtensionsRegistry.getDiffEditorContributions = getDiffEditorContributions;\r\n})(EditorExtensionsRegistry || (EditorExtensionsRegistry = {}));\r\n// Editor extension points\r\nconst Extensions = {\r\n EditorCommonContributions: 'editor.contributions'\r\n};\r\nclass EditorContributionRegistry {\r\n constructor() {\r\n this.editorContributions = [];\r\n this.diffEditorContributions = [];\r\n this.editorActions = [];\r\n this.editorCommands = Object.create(null);\r\n }\r\n registerEditorContribution(id, ctor) {\r\n this.editorContributions.push({ id, ctor: ctor });\r\n }\r\n getEditorContributions() {\r\n return this.editorContributions.slice(0);\r\n }\r\n getDiffEditorContributions() {\r\n return this.diffEditorContributions.slice(0);\r\n }\r\n registerEditorAction(action) {\r\n action.register();\r\n this.editorActions.push(action);\r\n }\r\n getEditorActions() {\r\n return this.editorActions.slice(0);\r\n }\r\n registerEditorCommand(editorCommand) {\r\n editorCommand.register();\r\n this.editorCommands[editorCommand.id] = editorCommand;\r\n }\r\n getEditorCommand(commandId) {\r\n return (this.editorCommands[commandId] || null);\r\n }\r\n}\r\nEditorContributionRegistry.INSTANCE = new EditorContributionRegistry();\r\nRegistry.add(Extensions.EditorCommonContributions, EditorContributionRegistry.INSTANCE);\r\nfunction registerCommand(command) {\r\n command.register();\r\n return command;\r\n}\r\nexport const UndoCommand = registerCommand(new MultiCommand({\r\n id: 'undo',\r\n precondition: undefined,\r\n kbOpts: {\r\n weight: 0 /* EditorCore */,\r\n primary: 2048 /* CtrlCmd */ | 56 /* KEY_Z */\r\n },\r\n menuOpts: [{\r\n menuId: MenuId.MenubarEditMenu,\r\n group: '1_do',\r\n title: nls.localize({ key: 'miUndo', comment: ['&& denotes a mnemonic'] }, \"&&Undo\"),\r\n order: 1\r\n }, {\r\n menuId: MenuId.CommandPalette,\r\n group: '',\r\n title: nls.localize('undo', \"Undo\"),\r\n order: 1\r\n }]\r\n}));\r\nregisterCommand(new ProxyCommand(UndoCommand, { id: 'default:undo', precondition: undefined }));\r\nexport const RedoCommand = registerCommand(new MultiCommand({\r\n id: 'redo',\r\n precondition: undefined,\r\n kbOpts: {\r\n weight: 0 /* EditorCore */,\r\n primary: 2048 /* CtrlCmd */ | 55 /* KEY_Y */,\r\n secondary: [2048 /* CtrlCmd */ | 1024 /* Shift */ | 56 /* KEY_Z */],\r\n mac: { primary: 2048 /* CtrlCmd */ | 1024 /* Shift */ | 56 /* KEY_Z */ }\r\n },\r\n menuOpts: [{\r\n menuId: MenuId.MenubarEditMenu,\r\n group: '1_do',\r\n title: nls.localize({ key: 'miRedo', comment: ['&& denotes a mnemonic'] }, \"&&Redo\"),\r\n order: 2\r\n }, {\r\n menuId: MenuId.CommandPalette,\r\n group: '',\r\n title: nls.localize('redo', \"Redo\"),\r\n order: 1\r\n }]\r\n}));\r\nregisterCommand(new ProxyCommand(RedoCommand, { id: 'default:redo', precondition: undefined }));\r\nexport const SelectAllCommand = registerCommand(new MultiCommand({\r\n id: 'editor.action.selectAll',\r\n precondition: undefined,\r\n kbOpts: {\r\n weight: 0 /* EditorCore */,\r\n kbExpr: null,\r\n primary: 2048 /* CtrlCmd */ | 31 /* KEY_A */\r\n },\r\n menuOpts: [{\r\n menuId: MenuId.MenubarSelectionMenu,\r\n group: '1_basic',\r\n title: nls.localize({ key: 'miSelectAll', comment: ['&& denotes a mnemonic'] }, \"&&Select All\"),\r\n order: 1\r\n }, {\r\n menuId: MenuId.CommandPalette,\r\n group: '',\r\n title: nls.localize('selectAll', \"Select All\"),\r\n order: 1\r\n }]\r\n}));\r\n", "/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License. See License.txt in the project root for license information.\r\n *--------------------------------------------------------------------------------------------*/\r\nimport { Position } from './position.js';\r\n/**\r\n * A range in the editor. (startLineNumber,startColumn) is <= (endLineNumber,endColumn)\r\n */\r\nexport class Range {\r\n constructor(startLineNumber, startColumn, endLineNumber, endColumn) {\r\n if ((startLineNumber > endLineNumber) || (startLineNumber === endLineNumber && startColumn > endColumn)) {\r\n this.startLineNumber = endLineNumber;\r\n this.startColumn = endColumn;\r\n this.endLineNumber = startLineNumber;\r\n this.endColumn = startColumn;\r\n }\r\n else {\r\n this.startLineNumber = startLineNumber;\r\n this.startColumn = startColumn;\r\n this.endLineNumber = endLineNumber;\r\n this.endColumn = endColumn;\r\n }\r\n }\r\n /**\r\n * Test if this range is empty.\r\n */\r\n isEmpty() {\r\n return Range.isEmpty(this);\r\n }\r\n /**\r\n * Test if `range` is empty.\r\n */\r\n static isEmpty(range) {\r\n return (range.startLineNumber === range.endLineNumber && range.startColumn === range.endColumn);\r\n }\r\n /**\r\n * Test if position is in this range. If the position is at the edges, will return true.\r\n */\r\n containsPosition(position) {\r\n return Range.containsPosition(this, position);\r\n }\r\n /**\r\n * Test if `position` is in `range`. If the position is at the edges, will return true.\r\n */\r\n static containsPosition(range, position) {\r\n if (position.lineNumber < range.startLineNumber || position.lineNumber > range.endLineNumber) {\r\n return false;\r\n }\r\n if (position.lineNumber === range.startLineNumber && position.column < range.startColumn) {\r\n return false;\r\n }\r\n if (position.lineNumber === range.endLineNumber && position.column > range.endColumn) {\r\n return false;\r\n }\r\n return true;\r\n }\r\n /**\r\n * Test if range is in this range. If the range is equal to this range, will return true.\r\n */\r\n containsRange(range) {\r\n return Range.containsRange(this, range);\r\n }\r\n /**\r\n * Test if `otherRange` is in `range`. If the ranges are equal, will return true.\r\n */\r\n static containsRange(range, otherRange) {\r\n if (otherRange.startLineNumber < range.startLineNumber || otherRange.endLineNumber < range.startLineNumber) {\r\n return false;\r\n }\r\n if (otherRange.startLineNumber > range.endLineNumber || otherRange.endLineNumber > range.endLineNumber) {\r\n return false;\r\n }\r\n if (otherRange.startLineNumber === range.startLineNumber && otherRange.startColumn < range.startColumn) {\r\n return false;\r\n }\r\n if (otherRange.endLineNumber === range.endLineNumber && otherRange.endColumn > range.endColumn) {\r\n return false;\r\n }\r\n return true;\r\n }\r\n /**\r\n * Test if `range` is strictly in this range. `range` must start after and end before this range for the result to be true.\r\n */\r\n strictContainsRange(range) {\r\n return Range.strictContainsRange(this, range);\r\n }\r\n /**\r\n * Test if `otherRange` is strinctly in `range` (must start after, and end before). If the ranges are equal, will return false.\r\n */\r\n static strictContainsRange(range, otherRange) {\r\n if (otherRange.startLineNumber < range.startLineNumber || otherRange.endLineNumber < range.startLineNumber) {\r\n return false;\r\n }\r\n if (otherRange.startLineNumber > range.endLineNumber || otherRange.endLineNumber > range.endLineNumber) {\r\n return false;\r\n }\r\n if (otherRange.startLineNumber === range.startLineNumber && otherRange.startColumn <= range.startColumn) {\r\n return false;\r\n }\r\n if (otherRange.endLineNumber === range.endLineNumber && otherRange.endColumn >= range.endColumn) {\r\n return false;\r\n }\r\n return true;\r\n }\r\n /**\r\n * A reunion of the two ranges.\r\n * The smallest position will be used as the start point, and the largest one as the end point.\r\n */\r\n plusRange(range) {\r\n return Range.plusRange(this, range);\r\n }\r\n /**\r\n * A reunion of the two ranges.\r\n * The smallest position will be used as the start point, and the largest one as the end point.\r\n */\r\n static plusRange(a, b) {\r\n let startLineNumber;\r\n let startColumn;\r\n let endLineNumber;\r\n let endColumn;\r\n if (b.startLineNumber < a.startLineNumber) {\r\n startLineNumber = b.startLineNumber;\r\n startColumn = b.startColumn;\r\n }\r\n else if (b.startLineNumber === a.startLineNumber) {\r\n startLineNumber = b.startLineNumber;\r\n startColumn = Math.min(b.startColumn, a.startColumn);\r\n }\r\n else {\r\n startLineNumber = a.startLineNumber;\r\n startColumn = a.startColumn;\r\n }\r\n if (b.endLineNumber > a.endLineNumber) {\r\n endLineNumber = b.endLineNumber;\r\n endColumn = b.endColumn;\r\n }\r\n else if (b.endLineNumber === a.endLineNumber) {\r\n endLineNumber = b.endLineNumber;\r\n endColumn = Math.max(b.endColumn, a.endColumn);\r\n }\r\n else {\r\n endLineNumber = a.endLineNumber;\r\n endColumn = a.endColumn;\r\n }\r\n return new Range(startLineNumber, startColumn, endLineNumber, endColumn);\r\n }\r\n /**\r\n * A intersection of the two ranges.\r\n */\r\n intersectRanges(range) {\r\n return Range.intersectRanges(this, range);\r\n }\r\n /**\r\n * A intersection of the two ranges.\r\n */\r\n static intersectRanges(a, b) {\r\n let resultStartLineNumber = a.startLineNumber;\r\n let resultStartColumn = a.startColumn;\r\n let resultEndLineNumber = a.endLineNumber;\r\n let resultEndColumn = a.endColumn;\r\n let otherStartLineNumber = b.startLineNumber;\r\n let otherStartColumn = b.startColumn;\r\n let otherEndLineNumber = b.endLineNumber;\r\n let otherEndColumn = b.endColumn;\r\n if (resultStartLineNumber < otherStartLineNumber) {\r\n resultStartLineNumber = otherStartLineNumber;\r\n resultStartColumn = otherStartColumn;\r\n }\r\n else if (resultStartLineNumber === otherStartLineNumber) {\r\n resultStartColumn = Math.max(resultStartColumn, otherStartColumn);\r\n }\r\n if (resultEndLineNumber > otherEndLineNumber) {\r\n resultEndLineNumber = otherEndLineNumber;\r\n resultEndColumn = otherEndColumn;\r\n }\r\n else if (resultEndLineNumber === otherEndLineNumber) {\r\n resultEndColumn = Math.min(resultEndColumn, otherEndColumn);\r\n }\r\n // Check if selection is now empty\r\n if (resultStartLineNumber > resultEndLineNumber) {\r\n return null;\r\n }\r\n if (resultStartLineNumber === resultEndLineNumber && resultStartColumn > resultEndColumn) {\r\n return null;\r\n }\r\n return new Range(resultStartLineNumber, resultStartColumn, resultEndLineNumber, resultEndColumn);\r\n }\r\n /**\r\n * Test if this range equals other.\r\n */\r\n equalsRange(other) {\r\n return Range.equalsRange(this, other);\r\n }\r\n /**\r\n * Test if range `a` equals `b`.\r\n */\r\n static equalsRange(a, b) {\r\n return (!!a &&\r\n !!b &&\r\n a.startLineNumber === b.startLineNumber &&\r\n a.startColumn === b.startColumn &&\r\n a.endLineNumber === b.endLineNumber &&\r\n a.endColumn === b.endColumn);\r\n }\r\n /**\r\n * Return the end position (which will be after or equal to the start position)\r\n */\r\n getEndPosition() {\r\n return Range.getEndPosition(this);\r\n }\r\n /**\r\n * Return the end position (which will be after or equal to the start position)\r\n */\r\n static getEndPosition(range) {\r\n return new Position(range.endLineNumber, range.endColumn);\r\n }\r\n /**\r\n * Return the start position (which will be before or equal to the end position)\r\n */\r\n getStartPosition() {\r\n return Range.getStartPosition(this);\r\n }\r\n /**\r\n * Return the start position (which will be before or equal to the end position)\r\n */\r\n static getStartPosition(range) {\r\n return new Position(range.startLineNumber, range.startColumn);\r\n }\r\n /**\r\n * Transform to a user presentable string representation.\r\n */\r\n toString() {\r\n return '[' + this.startLineNumber + ',' + this.startColumn + ' -> ' + this.endLineNumber + ',' + this.endColumn + ']';\r\n }\r\n /**\r\n * Create a new range using this range's start position, and using endLineNumber and endColumn as the end position.\r\n */\r\n setEndPosition(endLineNumber, endColumn) {\r\n return new Range(this.startLineNumber, this.startColumn, endLineNumber, endColumn);\r\n }\r\n /**\r\n * Create a new range using this range's end position, and using startLineNumber and startColumn as the start position.\r\n */\r\n setStartPosition(startLineNumber, startColumn) {\r\n return new Range(startLineNumber, startColumn, this.endLineNumber, this.endColumn);\r\n }\r\n /**\r\n * Create a new empty range using this range's start position.\r\n */\r\n collapseToStart() {\r\n return Range.collapseToStart(this);\r\n }\r\n /**\r\n * Create a new empty range using this range's start position.\r\n */\r\n static collapseToStart(range) {\r\n return new Range(range.startLineNumber, range.startColumn, range.startLineNumber, range.startColumn);\r\n }\r\n // ---\r\n static fromPositions(start, end = start) {\r\n return new Range(start.lineNumber, start.column, end.lineNumber, end.column);\r\n }\r\n static lift(range) {\r\n if (!range) {\r\n return null;\r\n }\r\n return new Range(range.startLineNumber, range.startColumn, range.endLineNumber, range.endColumn);\r\n }\r\n /**\r\n * Test if `obj` is an `IRange`.\r\n */\r\n static isIRange(obj) {\r\n return (obj\r\n && (typeof obj.startLineNumber === 'number')\r\n && (typeof obj.startColumn === 'number')\r\n && (typeof obj.endLineNumber === 'number')\r\n && (typeof obj.endColumn === 'number'));\r\n }\r\n /**\r\n * Test if the two ranges are touching in any way.\r\n */\r\n static areIntersectingOrTouching(a, b) {\r\n // Check if `a` is before `b`\r\n if (a.endLineNumber < b.startLineNumber || (a.endLineNumber === b.startLineNumber && a.endColumn < b.startColumn)) {\r\n return false;\r\n }\r\n // Check if `b` is before `a`\r\n if (b.endLineNumber < a.startLineNumber || (b.endLineNumber === a.startLineNumber && b.endColumn < a.startColumn)) {\r\n return false;\r\n }\r\n // These ranges must intersect\r\n return true;\r\n }\r\n /**\r\n * Test if the two ranges are intersecting. If the ranges are touching it returns true.\r\n */\r\n static areIntersecting(a, b) {\r\n // Check if `a` is before `b`\r\n if (a.endLineNumber < b.startLineNumber || (a.endLineNumber === b.startLineNumber && a.endColumn <= b.startColumn)) {\r\n return false;\r\n }\r\n // Check if `b` is before `a`\r\n if (b.endLineNumber < a.startLineNumber || (b.endLineNumber === a.startLineNumber && b.endColumn <= a.startColumn)) {\r\n return false;\r\n }\r\n // These ranges must intersect\r\n return true;\r\n }\r\n /**\r\n * A function that compares ranges, useful for sorting ranges\r\n * It will first compare ranges on the startPosition and then on the endPosition\r\n */\r\n static compareRangesUsingStarts(a, b) {\r\n if (a && b) {\r\n const aStartLineNumber = a.startLineNumber | 0;\r\n const bStartLineNumber = b.startLineNumber | 0;\r\n if (aStartLineNumber === bStartLineNumber) {\r\n const aStartColumn = a.startColumn | 0;\r\n const bStartColumn = b.startColumn | 0;\r\n if (aStartColumn === bStartColumn) {\r\n const aEndLineNumber = a.endLineNumber | 0;\r\n const bEndLineNumber = b.endLineNumber | 0;\r\n if (aEndLineNumber === bEndLineNumber) {\r\n const aEndColumn = a.endColumn | 0;\r\n const bEndColumn = b.endColumn | 0;\r\n return aEndColumn - bEndColumn;\r\n }\r\n return aEndLineNumber - bEndLineNumber;\r\n }\r\n return aStartColumn - bStartColumn;\r\n }\r\n return aStartLineNumber - bStartLineNumber;\r\n }\r\n const aExists = (a ? 1 : 0);\r\n const bExists = (b ? 1 : 0);\r\n return aExists - bExists;\r\n }\r\n /**\r\n * A function that compares ranges, useful for sorting ranges\r\n * It will first compare ranges on the endPosition and then on the startPosition\r\n */\r\n static compareRangesUsingEnds(a, b) {\r\n if (a.endLineNumber === b.endLineNumber) {\r\n if (a.endColumn === b.endColumn) {\r\n if (a.startLineNumber === b.startLineNumber) {\r\n return a.startColumn - b.startColumn;\r\n }\r\n return a.startLineNumber - b.startLineNumber;\r\n }\r\n return a.endColumn - b.endColumn;\r\n }\r\n return a.endLineNumber - b.endLineNumber;\r\n }\r\n /**\r\n * Test if the range spans multiple lines.\r\n */\r\n static spansMultipleLines(range) {\r\n return range.endLineNumber > range.startLineNumber;\r\n }\r\n}\r\n", "/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License. See License.txt in the project root for license information.\r\n *--------------------------------------------------------------------------------------------*/\r\nimport { Position } from './position.js';\r\nimport { Range } from './range.js';\r\n/**\r\n * A selection in the editor.\r\n * The selection is a range that has an orientation.\r\n */\r\nexport class Selection extends Range {\r\n constructor(selectionStartLineNumber, selectionStartColumn, positionLineNumber, positionColumn) {\r\n super(selectionStartLineNumber, selectionStartColumn, positionLineNumber, positionColumn);\r\n this.selectionStartLineNumber = selectionStartLineNumber;\r\n this.selectionStartColumn = selectionStartColumn;\r\n this.positionLineNumber = positionLineNumber;\r\n this.positionColumn = positionColumn;\r\n }\r\n /**\r\n * Transform to a human-readable representation.\r\n */\r\n toString() {\r\n return '[' + this.selectionStartLineNumber + ',' + this.selectionStartColumn + ' -> ' + this.positionLineNumber + ',' + this.positionColumn + ']';\r\n }\r\n /**\r\n * Test if equals other selection.\r\n */\r\n equalsSelection(other) {\r\n return (Selection.selectionsEqual(this, other));\r\n }\r\n /**\r\n * Test if the two selections are equal.\r\n */\r\n static selectionsEqual(a, b) {\r\n return (a.selectionStartLineNumber === b.selectionStartLineNumber &&\r\n a.selectionStartColumn === b.selectionStartColumn &&\r\n a.positionLineNumber === b.positionLineNumber &&\r\n a.positionColumn === b.positionColumn);\r\n }\r\n /**\r\n * Get directions (LTR or RTL).\r\n */\r\n getDirection() {\r\n if (this.selectionStartLineNumber === this.startLineNumber && this.selectionStartColumn === this.startColumn) {\r\n return 0 /* LTR */;\r\n }\r\n return 1 /* RTL */;\r\n }\r\n /**\r\n * Create a new selection with a different `positionLineNumber` and `positionColumn`.\r\n */\r\n setEndPosition(endLineNumber, endColumn) {\r\n if (this.getDirection() === 0 /* LTR */) {\r\n return new Selection(this.startLineNumber, this.startColumn, endLineNumber, endColumn);\r\n }\r\n return new Selection(endLineNumber, endColumn, this.startLineNumber, this.startColumn);\r\n }\r\n /**\r\n * Get the position at `positionLineNumber` and `positionColumn`.\r\n */\r\n getPosition() {\r\n return new Position(this.positionLineNumber, this.positionColumn);\r\n }\r\n /**\r\n * Create a new selection with a different `selectionStartLineNumber` and `selectionStartColumn`.\r\n */\r\n setStartPosition(startLineNumber, startColumn) {\r\n if (this.getDirection() === 0 /* LTR */) {\r\n return new Selection(startLineNumber, startColumn, this.endLineNumber, this.endColumn);\r\n }\r\n return new Selection(this.endLineNumber, this.endColumn, startLineNumber, startColumn);\r\n }\r\n // ----\r\n /**\r\n * Create a `Selection` from one or two positions\r\n */\r\n static fromPositions(start, end = start) {\r\n return new Selection(start.lineNumber, start.column, end.lineNumber, end.column);\r\n }\r\n /**\r\n * Create a `Selection` from an `ISelection`.\r\n */\r\n static liftSelection(sel) {\r\n return new Selection(sel.selectionStartLineNumber, sel.selectionStartColumn, sel.positionLineNumber, sel.positionColumn);\r\n }\r\n /**\r\n * `a` equals `b`.\r\n */\r\n static selectionsArrEqual(a, b) {\r\n if (a && !b || !a && b) {\r\n return false;\r\n }\r\n if (!a && !b) {\r\n return true;\r\n }\r\n if (a.length !== b.length) {\r\n return false;\r\n }\r\n for (let i = 0, len = a.length; i < len; i++) {\r\n if (!this.selectionsEqual(a[i], b[i])) {\r\n return false;\r\n }\r\n }\r\n return true;\r\n }\r\n /**\r\n * Test if `obj` is an `ISelection`.\r\n */\r\n static isISelection(obj) {\r\n return (obj\r\n && (typeof obj.selectionStartLineNumber === 'number')\r\n && (typeof obj.selectionStartColumn === 'number')\r\n && (typeof obj.positionLineNumber === 'number')\r\n && (typeof obj.positionColumn === 'number'));\r\n }\r\n /**\r\n * Create with a direction.\r\n */\r\n static createWithDirection(startLineNumber, startColumn, endLineNumber, endColumn, direction) {\r\n if (direction === 0 /* LTR */) {\r\n return new Selection(startLineNumber, startColumn, endLineNumber, endColumn);\r\n }\r\n return new Selection(endLineNumber, endColumn, startLineNumber, startColumn);\r\n }\r\n}\r\n", "/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License. See License.txt in the project root for license information.\r\n *--------------------------------------------------------------------------------------------*/\r\nexport const USUAL_WORD_SEPARATORS = '`~!@#$%^&*()-=+[{]}\\\\|;:\\'\",.<>/?';\r\n/**\r\n * Create a word definition regular expression based on default word separators.\r\n * Optionally provide allowed separators that should be included in words.\r\n *\r\n * The default would look like this:\r\n * /(-?\\d*\\.\\d\\w*)|([^\\`\\~\\!\\@\\#\\$\\%\\^\\&\\*\\(\\)\\-\\=\\+\\[\\{\\]\\}\\\\\\|\\;\\:\\'\\\"\\,\\.\\<\\>\\/\\?\\s]+)/g\r\n */\r\nfunction createWordRegExp(allowInWords = '') {\r\n let source = '(-?\\\\d*\\\\.\\\\d\\\\w*)|([^';\r\n for (const sep of USUAL_WORD_SEPARATORS) {\r\n if (allowInWords.indexOf(sep) >= 0) {\r\n continue;\r\n }\r\n source += '\\\\' + sep;\r\n }\r\n source += '\\\\s]+)';\r\n return new RegExp(source, 'g');\r\n}\r\n// catches numbers (including floating numbers) in the first group, and alphanum in the second\r\nexport const DEFAULT_WORD_REGEXP = createWordRegExp();\r\nexport function ensureValidWordDefinition(wordDefinition) {\r\n let result = DEFAULT_WORD_REGEXP;\r\n if (wordDefinition && (wordDefinition instanceof RegExp)) {\r\n if (!wordDefinition.global) {\r\n let flags = 'g';\r\n if (wordDefinition.ignoreCase) {\r\n flags += 'i';\r\n }\r\n if (wordDefinition.multiline) {\r\n flags += 'm';\r\n }\r\n if (wordDefinition.unicode) {\r\n flags += 'u';\r\n }\r\n result = new RegExp(wordDefinition.source, flags);\r\n }\r\n else {\r\n result = wordDefinition;\r\n }\r\n }\r\n result.lastIndex = 0;\r\n return result;\r\n}\r\nconst _defaultConfig = {\r\n maxLen: 1000,\r\n windowSize: 15,\r\n timeBudget: 150\r\n};\r\nexport function getWordAtText(column, wordDefinition, text, textOffset, config = _defaultConfig) {\r\n if (text.length > config.maxLen) {\r\n // don't throw strings that long at the regexp\r\n // but use a sub-string in which a word must occur\r\n let start = column - config.maxLen / 2;\r\n if (start < 0) {\r\n start = 0;\r\n }\r\n else {\r\n textOffset += start;\r\n }\r\n text = text.substring(start, column + config.maxLen / 2);\r\n return getWordAtText(column, wordDefinition, text, textOffset, config);\r\n }\r\n const t1 = Date.now();\r\n const pos = column - 1 - textOffset;\r\n let prevRegexIndex = -1;\r\n let match = null;\r\n for (let i = 1;; i++) {\r\n // check time budget\r\n if (Date.now() - t1 >= config.timeBudget) {\r\n break;\r\n }\r\n // reset the index at which the regexp should start matching, also know where it\r\n // should stop so that subsequent search don't repeat previous searches\r\n const regexIndex = pos - config.windowSize * i;\r\n wordDefinition.lastIndex = Math.max(0, regexIndex);\r\n const thisMatch = _findRegexMatchEnclosingPosition(wordDefinition, text, pos, prevRegexIndex);\r\n if (!thisMatch && match) {\r\n // stop: we have something\r\n break;\r\n }\r\n match = thisMatch;\r\n // stop: searched at start\r\n if (regexIndex <= 0) {\r\n break;\r\n }\r\n prevRegexIndex = regexIndex;\r\n }\r\n if (match) {\r\n let result = {\r\n word: match[0],\r\n startColumn: textOffset + 1 + match.index,\r\n endColumn: textOffset + 1 + match.index + match[0].length\r\n };\r\n wordDefinition.lastIndex = 0;\r\n return result;\r\n }\r\n return null;\r\n}\r\nfunction _findRegexMatchEnclosingPosition(wordDefinition, text, pos, stopPos) {\r\n let match;\r\n while (match = wordDefinition.exec(text)) {\r\n const matchIndex = match.index || 0;\r\n if (matchIndex <= pos && wordDefinition.lastIndex >= pos) {\r\n return match;\r\n }\r\n else if (stopPos > 0 && matchIndex > stopPos) {\r\n return null;\r\n }\r\n }\r\n return null;\r\n}\r\n", "/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License. See License.txt in the project root for license information.\r\n *--------------------------------------------------------------------------------------------*/\r\nimport * as nls from '../../../nls.js';\r\nimport * as platform from '../../../base/common/platform.js';\r\nimport { USUAL_WORD_SEPARATORS } from '../model/wordHelper.js';\r\n/**\r\n * @internal\r\n * The width of the minimap gutter, in pixels.\r\n */\r\nexport const MINIMAP_GUTTER_WIDTH = 8;\r\n//#endregion\r\n/**\r\n * An event describing that the configuration of the editor has changed.\r\n */\r\nexport class ConfigurationChangedEvent {\r\n /**\r\n * @internal\r\n */\r\n constructor(values) {\r\n this._values = values;\r\n }\r\n hasChanged(id) {\r\n return this._values[id];\r\n }\r\n}\r\n/**\r\n * @internal\r\n */\r\nexport class ValidatedEditorOptions {\r\n constructor() {\r\n this._values = [];\r\n }\r\n _read(option) {\r\n return this._values[option];\r\n }\r\n get(id) {\r\n return this._values[id];\r\n }\r\n _write(option, value) {\r\n this._values[option] = value;\r\n }\r\n}\r\n/**\r\n * @internal\r\n */\r\nexport class ComputeOptionsMemory {\r\n constructor() {\r\n this.stableMinimapLayoutInput = null;\r\n this.stableFitMaxMinimapScale = 0;\r\n this.stableFitRemainingWidth = 0;\r\n }\r\n}\r\n/**\r\n * @internal\r\n */\r\nclass BaseEditorOption {\r\n constructor(id, name, defaultValue, schema) {\r\n this.id = id;\r\n this.name = name;\r\n this.defaultValue = defaultValue;\r\n this.schema = schema;\r\n }\r\n compute(env, options, value) {\r\n return value;\r\n }\r\n}\r\n/**\r\n * @internal\r\n */\r\nclass ComputedEditorOption {\r\n constructor(id, deps = null) {\r\n this.schema = undefined;\r\n this.id = id;\r\n this.name = '_never_';\r\n this.defaultValue = undefined;\r\n this.deps = deps;\r\n }\r\n validate(input) {\r\n return this.defaultValue;\r\n }\r\n}\r\nclass SimpleEditorOption {\r\n constructor(id, name, defaultValue, schema) {\r\n this.id = id;\r\n this.name = name;\r\n this.defaultValue = defaultValue;\r\n this.schema = schema;\r\n }\r\n validate(input) {\r\n if (typeof input === 'undefined') {\r\n return this.defaultValue;\r\n }\r\n return input;\r\n }\r\n compute(env, options, value) {\r\n return value;\r\n }\r\n}\r\n/**\r\n * @internal\r\n */\r\nexport function boolean(value, defaultValue) {\r\n if (typeof value === 'undefined') {\r\n return defaultValue;\r\n }\r\n if (value === 'false') {\r\n // treat the string 'false' as false\r\n return false;\r\n }\r\n return Boolean(value);\r\n}\r\nclass EditorBooleanOption extends SimpleEditorOption {\r\n constructor(id, name, defaultValue, schema = undefined) {\r\n if (typeof schema !== 'undefined') {\r\n schema.type = 'boolean';\r\n schema.default = defaultValue;\r\n }\r\n super(id, name, defaultValue, schema);\r\n }\r\n validate(input) {\r\n return boolean(input, this.defaultValue);\r\n }\r\n}\r\nclass EditorIntOption extends SimpleEditorOption {\r\n constructor(id, name, defaultValue, minimum, maximum, schema = undefined) {\r\n if (typeof schema !== 'undefined') {\r\n schema.type = 'integer';\r\n schema.default = defaultValue;\r\n schema.minimum = minimum;\r\n schema.maximum = maximum;\r\n }\r\n super(id, name, defaultValue, schema);\r\n this.minimum = minimum;\r\n this.maximum = maximum;\r\n }\r\n static clampedInt(value, defaultValue, minimum, maximum) {\r\n if (typeof value === 'undefined') {\r\n return defaultValue;\r\n }\r\n let r = parseInt(value, 10);\r\n if (isNaN(r)) {\r\n return defaultValue;\r\n }\r\n r = Math.max(minimum, r);\r\n r = Math.min(maximum, r);\r\n return r | 0;\r\n }\r\n validate(input) {\r\n return EditorIntOption.clampedInt(input, this.defaultValue, this.minimum, this.maximum);\r\n }\r\n}\r\nclass EditorFloatOption extends SimpleEditorOption {\r\n constructor(id, name, defaultValue, validationFn, schema) {\r\n if (typeof schema !== 'undefined') {\r\n schema.type = 'number';\r\n schema.default = defaultValue;\r\n }\r\n super(id, name, defaultValue, schema);\r\n this.validationFn = validationFn;\r\n }\r\n static clamp(n, min, max) {\r\n if (n < min) {\r\n return min;\r\n }\r\n if (n > max) {\r\n return max;\r\n }\r\n return n;\r\n }\r\n static float(value, defaultValue) {\r\n if (typeof value === 'number') {\r\n return value;\r\n }\r\n if (typeof value === 'undefined') {\r\n return defaultValue;\r\n }\r\n const r = parseFloat(value);\r\n return (isNaN(r) ? defaultValue : r);\r\n }\r\n validate(input) {\r\n return this.validationFn(EditorFloatOption.float(input, this.defaultValue));\r\n }\r\n}\r\nclass EditorStringOption extends SimpleEditorOption {\r\n static string(value, defaultValue) {\r\n if (typeof value !== 'string') {\r\n return defaultValue;\r\n }\r\n return value;\r\n }\r\n constructor(id, name, defaultValue, schema = undefined) {\r\n if (typeof schema !== 'undefined') {\r\n schema.type = 'string';\r\n schema.default = defaultValue;\r\n }\r\n super(id, name, defaultValue, schema);\r\n }\r\n validate(input) {\r\n return EditorStringOption.string(input, this.defaultValue);\r\n }\r\n}\r\n/**\r\n * @internal\r\n */\r\nexport function stringSet(value, defaultValue, allowedValues) {\r\n if (typeof value !== 'string') {\r\n return defaultValue;\r\n }\r\n if (allowedValues.indexOf(value) === -1) {\r\n return defaultValue;\r\n }\r\n return value;\r\n}\r\nclass EditorStringEnumOption extends SimpleEditorOption {\r\n constructor(id, name, defaultValue, allowedValues, schema = undefined) {\r\n if (typeof schema !== 'undefined') {\r\n schema.type = 'string';\r\n schema.enum = allowedValues;\r\n schema.default = defaultValue;\r\n }\r\n super(id, name, defaultValue, schema);\r\n this._allowedValues = allowedValues;\r\n }\r\n validate(input) {\r\n return stringSet(input, this.defaultValue, this._allowedValues);\r\n }\r\n}\r\nclass EditorEnumOption extends BaseEditorOption {\r\n constructor(id, name, defaultValue, defaultStringValue, allowedValues, convert, schema = undefined) {\r\n if (typeof schema !== 'undefined') {\r\n schema.type = 'string';\r\n schema.enum = allowedValues;\r\n schema.default = defaultStringValue;\r\n }\r\n super(id, name, defaultValue, schema);\r\n this._allowedValues = allowedValues;\r\n this._convert = convert;\r\n }\r\n validate(input) {\r\n if (typeof input !== 'string') {\r\n return this.defaultValue;\r\n }\r\n if (this._allowedValues.indexOf(input) === -1) {\r\n return this.defaultValue;\r\n }\r\n return this._convert(input);\r\n }\r\n}\r\n//#endregion\r\n//#region autoIndent\r\nfunction _autoIndentFromString(autoIndent) {\r\n switch (autoIndent) {\r\n case 'none': return 0 /* None */;\r\n case 'keep': return 1 /* Keep */;\r\n case 'brackets': return 2 /* Brackets */;\r\n case 'advanced': return 3 /* Advanced */;\r\n case 'full': return 4 /* Full */;\r\n }\r\n}\r\n//#endregion\r\n//#region accessibilitySupport\r\nclass EditorAccessibilitySupport extends BaseEditorOption {\r\n constructor() {\r\n super(2 /* accessibilitySupport */, 'accessibilitySupport', 0 /* Unknown */, {\r\n type: 'string',\r\n enum: ['auto', 'on', 'off'],\r\n enumDescriptions: [\r\n nls.localize('accessibilitySupport.auto', \"The editor will use platform APIs to detect when a Screen Reader is attached.\"),\r\n nls.localize('accessibilitySupport.on', \"The editor will be permanently optimized for usage with a Screen Reader. Word wrapping will be disabled.\"),\r\n nls.localize('accessibilitySupport.off', \"The editor will never be optimized for usage with a Screen Reader.\"),\r\n ],\r\n default: 'auto',\r\n description: nls.localize('accessibilitySupport', \"Controls whether the editor should run in a mode where it is optimized for screen readers. Setting to on will disable word wrapping.\")\r\n });\r\n }\r\n validate(input) {\r\n switch (input) {\r\n case 'auto': return 0 /* Unknown */;\r\n case 'off': return 1 /* Disabled */;\r\n case 'on': return 2 /* Enabled */;\r\n }\r\n return this.defaultValue;\r\n }\r\n compute(env, options, value) {\r\n if (value === 0 /* Unknown */) {\r\n // The editor reads the `accessibilitySupport` from the environment\r\n return env.accessibilitySupport;\r\n }\r\n return value;\r\n }\r\n}\r\nclass EditorComments extends BaseEditorOption {\r\n constructor() {\r\n const defaults = {\r\n insertSpace: true,\r\n ignoreEmptyLines: true,\r\n };\r\n super(17 /* comments */, 'comments', defaults, {\r\n 'editor.comments.insertSpace': {\r\n type: 'boolean',\r\n default: defaults.insertSpace,\r\n description: nls.localize('comments.insertSpace', \"Controls whether a space character is inserted when commenting.\")\r\n },\r\n 'editor.comments.ignoreEmptyLines': {\r\n type: 'boolean',\r\n default: defaults.ignoreEmptyLines,\r\n description: nls.localize('comments.ignoreEmptyLines', 'Controls if empty lines should be ignored with toggle, add or remove actions for line comments.')\r\n },\r\n });\r\n }\r\n validate(_input) {\r\n if (!_input || typeof _input !== 'object') {\r\n return this.defaultValue;\r\n }\r\n const input = _input;\r\n return {\r\n insertSpace: boolean(input.insertSpace, this.defaultValue.insertSpace),\r\n ignoreEmptyLines: boolean(input.ignoreEmptyLines, this.defaultValue.ignoreEmptyLines),\r\n };\r\n }\r\n}\r\nfunction _cursorBlinkingStyleFromString(cursorBlinkingStyle) {\r\n switch (cursorBlinkingStyle) {\r\n case 'blink': return 1 /* Blink */;\r\n case 'smooth': return 2 /* Smooth */;\r\n case 'phase': return 3 /* Phase */;\r\n case 'expand': return 4 /* Expand */;\r\n case 'solid': return 5 /* Solid */;\r\n }\r\n}\r\n//#endregion\r\n//#region cursorStyle\r\n/**\r\n * The style in which the editor's cursor should be rendered.\r\n */\r\nexport var TextEditorCursorStyle;\r\n(function (TextEditorCursorStyle) {\r\n /**\r\n * As a vertical line (sitting between two characters).\r\n */\r\n TextEditorCursorStyle[TextEditorCursorStyle[\"Line\"] = 1] = \"Line\";\r\n /**\r\n * As a block (sitting on top of a character).\r\n */\r\n TextEditorCursorStyle[TextEditorCursorStyle[\"Block\"] = 2] = \"Block\";\r\n /**\r\n * As a horizontal line (sitting under a character).\r\n */\r\n TextEditorCursorStyle[TextEditorCursorStyle[\"Underline\"] = 3] = \"Underline\";\r\n /**\r\n * As a thin vertical line (sitting between two characters).\r\n */\r\n TextEditorCursorStyle[TextEditorCursorStyle[\"LineThin\"] = 4] = \"LineThin\";\r\n /**\r\n * As an outlined block (sitting on top of a character).\r\n */\r\n TextEditorCursorStyle[TextEditorCursorStyle[\"BlockOutline\"] = 5] = \"BlockOutline\";\r\n /**\r\n * As a thin horizontal line (sitting under a character).\r\n */\r\n TextEditorCursorStyle[TextEditorCursorStyle[\"UnderlineThin\"] = 6] = \"UnderlineThin\";\r\n})(TextEditorCursorStyle || (TextEditorCursorStyle = {}));\r\nfunction _cursorStyleFromString(cursorStyle) {\r\n switch (cursorStyle) {\r\n case 'line': return TextEditorCursorStyle.Line;\r\n case 'block': return TextEditorCursorStyle.Block;\r\n case 'underline': return TextEditorCursorStyle.Underline;\r\n case 'line-thin': return TextEditorCursorStyle.LineThin;\r\n case 'block-outline': return TextEditorCursorStyle.BlockOutline;\r\n case 'underline-thin': return TextEditorCursorStyle.UnderlineThin;\r\n }\r\n}\r\n//#endregion\r\n//#region editorClassName\r\nclass EditorClassName extends ComputedEditorOption {\r\n constructor() {\r\n super(126 /* editorClassName */, [64 /* mouseStyle */, 31 /* extraEditorClassName */]);\r\n }\r\n compute(env, options, _) {\r\n const classNames = ['monaco-editor'];\r\n if (options.get(31 /* extraEditorClassName */)) {\r\n classNames.push(options.get(31 /* extraEditorClassName */));\r\n }\r\n if (env.extraEditorClassName) {\r\n classNames.push(env.extraEditorClassName);\r\n }\r\n if (options.get(64 /* mouseStyle */) === 'default') {\r\n classNames.push('mouse-default');\r\n }\r\n else if (options.get(64 /* mouseStyle */) === 'copy') {\r\n classNames.push('mouse-copy');\r\n }\r\n if (options.get(99 /* showUnused */)) {\r\n classNames.push('showUnused');\r\n }\r\n if (options.get(124 /* showDeprecated */)) {\r\n classNames.push('showDeprecated');\r\n }\r\n return classNames.join(' ');\r\n }\r\n}\r\n//#endregion\r\n//#region emptySelectionClipboard\r\nclass EditorEmptySelectionClipboard extends EditorBooleanOption {\r\n constructor() {\r\n super(30 /* emptySelectionClipboard */, 'emptySelectionClipboard', true, { description: nls.localize('emptySelectionClipboard', \"Controls whether copying without a selection copies the current line.\") });\r\n }\r\n compute(env, options, value) {\r\n return value && env.emptySelectionClipboard;\r\n }\r\n}\r\nclass EditorFind extends BaseEditorOption {\r\n constructor() {\r\n const defaults = {\r\n cursorMoveOnType: true,\r\n seedSearchStringFromSelection: 'always',\r\n autoFindInSelection: 'never',\r\n globalFindClipboard: false,\r\n addExtraSpaceOnTop: true,\r\n loop: true\r\n };\r\n super(33 /* find */, 'find', defaults, {\r\n 'editor.find.cursorMoveOnType': {\r\n type: 'boolean',\r\n default: defaults.cursorMoveOnType,\r\n description: nls.localize('find.cursorMoveOnType', \"Controls whether the cursor should jump to find matches while typing.\")\r\n },\r\n 'editor.find.seedSearchStringFromSelection': {\r\n type: 'string',\r\n enum: ['never', 'always', 'selection'],\r\n default: defaults.seedSearchStringFromSelection,\r\n enumDescriptions: [\r\n nls.localize('editor.find.seedSearchStringFromSelection.never', 'Never seed search string from the editor selection.'),\r\n nls.localize('editor.find.seedSearchStringFromSelection.always', 'Always seed search string from the editor selection, including word at cursor position.'),\r\n nls.localize('editor.find.seedSearchStringFromSelection.selection', 'Only seed search string from the editor selection.')\r\n ],\r\n description: nls.localize('find.seedSearchStringFromSelection', \"Controls whether the search string in the Find Widget is seeded from the editor selection.\")\r\n },\r\n 'editor.find.autoFindInSelection': {\r\n type: 'string',\r\n enum: ['never', 'always', 'multiline'],\r\n default: defaults.autoFindInSelection,\r\n enumDescriptions: [\r\n nls.localize('editor.find.autoFindInSelection.never', 'Never turn on Find in Selection automatically (default).'),\r\n nls.localize('editor.find.autoFindInSelection.always', 'Always turn on Find in Selection automatically.'),\r\n nls.localize('editor.find.autoFindInSelection.multiline', 'Turn on Find in Selection automatically when multiple lines of content are selected.')\r\n ],\r\n description: nls.localize('find.autoFindInSelection', \"Controls the condition for turning on Find in Selection automatically.\")\r\n },\r\n 'editor.find.globalFindClipboard': {\r\n type: 'boolean',\r\n default: defaults.globalFindClipboard,\r\n description: nls.localize('find.globalFindClipboard', \"Controls whether the Find Widget should read or modify the shared find clipboard on macOS.\"),\r\n included: platform.isMacintosh\r\n },\r\n 'editor.find.addExtraSpaceOnTop': {\r\n type: 'boolean',\r\n default: defaults.addExtraSpaceOnTop,\r\n description: nls.localize('find.addExtraSpaceOnTop', \"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.\")\r\n },\r\n 'editor.find.loop': {\r\n type: 'boolean',\r\n default: defaults.loop,\r\n description: nls.localize('find.loop', \"Controls whether the search automatically restarts from the beginning (or the end) when no further matches can be found.\")\r\n },\r\n });\r\n }\r\n validate(_input) {\r\n if (!_input || typeof _input !== 'object') {\r\n return this.defaultValue;\r\n }\r\n const input = _input;\r\n return {\r\n cursorMoveOnType: boolean(input.cursorMoveOnType, this.defaultValue.cursorMoveOnType),\r\n seedSearchStringFromSelection: typeof _input.seedSearchStringFromSelection === 'boolean'\r\n ? (_input.seedSearchStringFromSelection ? 'always' : 'never')\r\n : stringSet(input.seedSearchStringFromSelection, this.defaultValue.seedSearchStringFromSelection, ['never', 'always', 'selection']),\r\n autoFindInSelection: typeof _input.autoFindInSelection === 'boolean'\r\n ? (_input.autoFindInSelection ? 'always' : 'never')\r\n : stringSet(input.autoFindInSelection, this.defaultValue.autoFindInSelection, ['never', 'always', 'multiline']),\r\n globalFindClipboard: boolean(input.globalFindClipboard, this.defaultValue.globalFindClipboard),\r\n addExtraSpaceOnTop: boolean(input.addExtraSpaceOnTop, this.defaultValue.addExtraSpaceOnTop),\r\n loop: boolean(input.loop, this.defaultValue.loop),\r\n };\r\n }\r\n}\r\n//#endregion\r\n//#region fontLigatures\r\n/**\r\n * @internal\r\n */\r\nexport class EditorFontLigatures extends BaseEditorOption {\r\n constructor() {\r\n super(42 /* fontLigatures */, 'fontLigatures', EditorFontLigatures.OFF, {\r\n anyOf: [\r\n {\r\n type: 'boolean',\r\n description: nls.localize('fontLigatures', \"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.\"),\r\n },\r\n {\r\n type: 'string',\r\n description: nls.localize('fontFeatureSettings', \"Explicit 'font-feature-settings' CSS property. A boolean can be passed instead if one only needs to turn on/off ligatures.\")\r\n }\r\n ],\r\n description: nls.localize('fontLigaturesGeneral', \"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.\"),\r\n default: false\r\n });\r\n }\r\n validate(input) {\r\n if (typeof input === 'undefined') {\r\n return this.defaultValue;\r\n }\r\n if (typeof input === 'string') {\r\n if (input === 'false') {\r\n return EditorFontLigatures.OFF;\r\n }\r\n if (input === 'true') {\r\n return EditorFontLigatures.ON;\r\n }\r\n return input;\r\n }\r\n if (Boolean(input)) {\r\n return EditorFontLigatures.ON;\r\n }\r\n return EditorFontLigatures.OFF;\r\n }\r\n}\r\nEditorFontLigatures.OFF = '\"liga\" off, \"calt\" off';\r\nEditorFontLigatures.ON = '\"liga\" on, \"calt\" on';\r\n//#endregion\r\n//#region fontInfo\r\nclass EditorFontInfo extends ComputedEditorOption {\r\n constructor() {\r\n super(41 /* fontInfo */);\r\n }\r\n compute(env, options, _) {\r\n return env.fontInfo;\r\n }\r\n}\r\n//#endregion\r\n//#region fontSize\r\nclass EditorFontSize extends SimpleEditorOption {\r\n constructor() {\r\n super(43 /* fontSize */, 'fontSize', EDITOR_FONT_DEFAULTS.fontSize, {\r\n type: 'number',\r\n minimum: 6,\r\n maximum: 100,\r\n default: EDITOR_FONT_DEFAULTS.fontSize,\r\n description: nls.localize('fontSize', \"Controls the font size in pixels.\")\r\n });\r\n }\r\n validate(input) {\r\n let r = EditorFloatOption.float(input, this.defaultValue);\r\n if (r === 0) {\r\n return EDITOR_FONT_DEFAULTS.fontSize;\r\n }\r\n return EditorFloatOption.clamp(r, 6, 100);\r\n }\r\n compute(env, options, value) {\r\n // The final fontSize respects the editor zoom level.\r\n // So take the result from env.fontInfo\r\n return env.fontInfo.fontSize;\r\n }\r\n}\r\n//#endregion\r\n//#region fontWeight\r\nclass EditorFontWeight extends BaseEditorOption {\r\n constructor() {\r\n super(44 /* fontWeight */, 'fontWeight', EDITOR_FONT_DEFAULTS.fontWeight, {\r\n anyOf: [\r\n {\r\n type: 'number',\r\n minimum: EditorFontWeight.MINIMUM_VALUE,\r\n maximum: EditorFontWeight.MAXIMUM_VALUE,\r\n errorMessage: nls.localize('fontWeightErrorMessage', \"Only \\\"normal\\\" and \\\"bold\\\" keywords or numbers between 1 and 1000 are allowed.\")\r\n },\r\n {\r\n type: 'string',\r\n pattern: '^(normal|bold|1000|[1-9][0-9]{0,2})$'\r\n },\r\n {\r\n enum: EditorFontWeight.SUGGESTION_VALUES\r\n }\r\n ],\r\n default: EDITOR_FONT_DEFAULTS.fontWeight,\r\n description: nls.localize('fontWeight', \"Controls the font weight. Accepts \\\"normal\\\" and \\\"bold\\\" keywords or numbers between 1 and 1000.\")\r\n });\r\n }\r\n validate(input) {\r\n if (input === 'normal' || input === 'bold') {\r\n return input;\r\n }\r\n return String(EditorIntOption.clampedInt(input, EDITOR_FONT_DEFAULTS.fontWeight, EditorFontWeight.MINIMUM_VALUE, EditorFontWeight.MAXIMUM_VALUE));\r\n }\r\n}\r\nEditorFontWeight.SUGGESTION_VALUES = ['normal', 'bold', '100', '200', '300', '400', '500', '600', '700', '800', '900'];\r\nEditorFontWeight.MINIMUM_VALUE = 1;\r\nEditorFontWeight.MAXIMUM_VALUE = 1000;\r\nclass EditorGoToLocation extends BaseEditorOption {\r\n constructor() {\r\n const defaults = {\r\n multiple: 'peek',\r\n multipleDefinitions: 'peek',\r\n multipleTypeDefinitions: 'peek',\r\n multipleDeclarations: 'peek',\r\n multipleImplementations: 'peek',\r\n multipleReferences: 'peek',\r\n alternativeDefinitionCommand: 'editor.action.goToReferences',\r\n alternativeTypeDefinitionCommand: 'editor.action.goToReferences',\r\n alternativeDeclarationCommand: 'editor.action.goToReferences',\r\n alternativeImplementationCommand: '',\r\n alternativeReferenceCommand: '',\r\n };\r\n const jsonSubset = {\r\n type: 'string',\r\n enum: ['peek', 'gotoAndPeek', 'goto'],\r\n default: defaults.multiple,\r\n enumDescriptions: [\r\n nls.localize('editor.gotoLocation.multiple.peek', 'Show peek view of the results (default)'),\r\n nls.localize('editor.gotoLocation.multiple.gotoAndPeek', 'Go to the primary result and show a peek view'),\r\n nls.localize('editor.gotoLocation.multiple.goto', 'Go to the primary result and enable peek-less navigation to others')\r\n ]\r\n };\r\n const alternativeCommandOptions = ['', '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'];\r\n super(48 /* gotoLocation */, 'gotoLocation', defaults, {\r\n 'editor.gotoLocation.multiple': {\r\n deprecationMessage: nls.localize('editor.gotoLocation.multiple.deprecated', \"This setting is deprecated, please use separate settings like 'editor.editor.gotoLocation.multipleDefinitions' or 'editor.editor.gotoLocation.multipleImplementations' instead.\"),\r\n },\r\n 'editor.gotoLocation.multipleDefinitions': Object.assign({ description: nls.localize('editor.editor.gotoLocation.multipleDefinitions', \"Controls the behavior the 'Go to Definition'-command when multiple target locations exist.\") }, jsonSubset),\r\n 'editor.gotoLocation.multipleTypeDefinitions': Object.assign({ description: nls.localize('editor.editor.gotoLocation.multipleTypeDefinitions', \"Controls the behavior the 'Go to Type Definition'-command when multiple target locations exist.\") }, jsonSubset),\r\n 'editor.gotoLocation.multipleDeclarations': Object.assign({ description: nls.localize('editor.editor.gotoLocation.multipleDeclarations', \"Controls the behavior the 'Go to Declaration'-command when multiple target locations exist.\") }, jsonSubset),\r\n 'editor.gotoLocation.multipleImplementations': Object.assign({ description: nls.localize('editor.editor.gotoLocation.multipleImplemenattions', \"Controls the behavior the 'Go to Implementations'-command when multiple target locations exist.\") }, jsonSubset),\r\n 'editor.gotoLocation.multipleReferences': Object.assign({ description: nls.localize('editor.editor.gotoLocation.multipleReferences', \"Controls the behavior the 'Go to References'-command when multiple target locations exist.\") }, jsonSubset),\r\n 'editor.gotoLocation.alternativeDefinitionCommand': {\r\n type: 'string',\r\n default: defaults.alternativeDefinitionCommand,\r\n enum: alternativeCommandOptions,\r\n description: nls.localize('alternativeDefinitionCommand', \"Alternative command id that is being executed when the result of 'Go to Definition' is the current location.\")\r\n },\r\n 'editor.gotoLocation.alternativeTypeDefinitionCommand': {\r\n type: 'string',\r\n default: defaults.alternativeTypeDefinitionCommand,\r\n enum: alternativeCommandOptions,\r\n description: nls.localize('alternativeTypeDefinitionCommand', \"Alternative command id that is being executed when the result of 'Go to Type Definition' is the current location.\")\r\n },\r\n 'editor.gotoLocation.alternativeDeclarationCommand': {\r\n type: 'string',\r\n default: defaults.alternativeDeclarationCommand,\r\n enum: alternativeCommandOptions,\r\n description: nls.localize('alternativeDeclarationCommand', \"Alternative command id that is being executed when the result of 'Go to Declaration' is the current location.\")\r\n },\r\n 'editor.gotoLocation.alternativeImplementationCommand': {\r\n type: 'string',\r\n default: defaults.alternativeImplementationCommand,\r\n enum: alternativeCommandOptions,\r\n description: nls.localize('alternativeImplementationCommand', \"Alternative command id that is being executed when the result of 'Go to Implementation' is the current location.\")\r\n },\r\n 'editor.gotoLocation.alternativeReferenceCommand': {\r\n type: 'string',\r\n default: defaults.alternativeReferenceCommand,\r\n enum: alternativeCommandOptions,\r\n description: nls.localize('alternativeReferenceCommand', \"Alternative command id that is being executed when the result of 'Go to Reference' is the current location.\")\r\n },\r\n });\r\n }\r\n validate(_input) {\r\n var _a, _b, _c, _d, _e;\r\n if (!_input || typeof _input !== 'object') {\r\n return this.defaultValue;\r\n }\r\n const input = _input;\r\n return {\r\n multiple: stringSet(input.multiple, this.defaultValue.multiple, ['peek', 'gotoAndPeek', 'goto']),\r\n multipleDefinitions: (_a = input.multipleDefinitions) !== null && _a !== void 0 ? _a : stringSet(input.multipleDefinitions, 'peek', ['peek', 'gotoAndPeek', 'goto']),\r\n multipleTypeDefinitions: (_b = input.multipleTypeDefinitions) !== null && _b !== void 0 ? _b : stringSet(input.multipleTypeDefinitions, 'peek', ['peek', 'gotoAndPeek', 'goto']),\r\n multipleDeclarations: (_c = input.multipleDeclarations) !== null && _c !== void 0 ? _c : stringSet(input.multipleDeclarations, 'peek', ['peek', 'gotoAndPeek', 'goto']),\r\n multipleImplementations: (_d = input.multipleImplementations) !== null && _d !== void 0 ? _d : stringSet(input.multipleImplementations, 'peek', ['peek', 'gotoAndPeek', 'goto']),\r\n multipleReferences: (_e = input.multipleReferences) !== null && _e !== void 0 ? _e : stringSet(input.multipleReferences, 'peek', ['peek', 'gotoAndPeek', 'goto']),\r\n alternativeDefinitionCommand: EditorStringOption.string(input.alternativeDefinitionCommand, this.defaultValue.alternativeDefinitionCommand),\r\n alternativeTypeDefinitionCommand: EditorStringOption.string(input.alternativeTypeDefinitionCommand, this.defaultValue.alternativeTypeDefinitionCommand),\r\n alternativeDeclarationCommand: EditorStringOption.string(input.alternativeDeclarationCommand, this.defaultValue.alternativeDeclarationCommand),\r\n alternativeImplementationCommand: EditorStringOption.string(input.alternativeImplementationCommand, this.defaultValue.alternativeImplementationCommand),\r\n alternativeReferenceCommand: EditorStringOption.string(input.alternativeReferenceCommand, this.defaultValue.alternativeReferenceCommand),\r\n };\r\n }\r\n}\r\nclass EditorHover extends BaseEditorOption {\r\n constructor() {\r\n const defaults = {\r\n enabled: true,\r\n delay: 300,\r\n sticky: true\r\n };\r\n super(51 /* hover */, 'hover', defaults, {\r\n 'editor.hover.enabled': {\r\n type: 'boolean',\r\n default: defaults.enabled,\r\n description: nls.localize('hover.enabled', \"Controls whether the hover is shown.\")\r\n },\r\n 'editor.hover.delay': {\r\n type: 'number',\r\n default: defaults.delay,\r\n description: nls.localize('hover.delay', \"Controls the delay in milliseconds after which the hover is shown.\")\r\n },\r\n 'editor.hover.sticky': {\r\n type: 'boolean',\r\n default: defaults.sticky,\r\n description: nls.localize('hover.sticky', \"Controls whether the hover should remain visible when mouse is moved over it.\")\r\n },\r\n });\r\n }\r\n validate(_input) {\r\n if (!_input || typeof _input !== 'object') {\r\n return this.defaultValue;\r\n }\r\n const input = _input;\r\n return {\r\n enabled: boolean(input.enabled, this.defaultValue.enabled),\r\n delay: EditorIntOption.clampedInt(input.delay, this.defaultValue.delay, 0, 10000),\r\n sticky: boolean(input.sticky, this.defaultValue.sticky)\r\n };\r\n }\r\n}\r\n/**\r\n * @internal\r\n */\r\nexport class EditorLayoutInfoComputer extends ComputedEditorOption {\r\n constructor() {\r\n super(129 /* layoutInfo */, [\r\n 47 /* glyphMargin */, 56 /* lineDecorationsWidth */, 35 /* folding */,\r\n 63 /* minimap */, 91 /* scrollbar */, 58 /* lineNumbers */,\r\n 59 /* lineNumbersMinChars */, 93 /* scrollBeyondLastLine */,\r\n 116 /* wordWrap */, 119 /* wordWrapColumn */, 120 /* wordWrapOverride1 */, 121 /* wordWrapOverride2 */,\r\n 2 /* accessibilitySupport */\r\n ]);\r\n }\r\n compute(env, options, _) {\r\n return EditorLayoutInfoComputer.computeLayout(options, {\r\n memory: env.memory,\r\n outerWidth: env.outerWidth,\r\n outerHeight: env.outerHeight,\r\n isDominatedByLongLines: env.isDominatedByLongLines,\r\n lineHeight: env.fontInfo.lineHeight,\r\n viewLineCount: env.viewLineCount,\r\n lineNumbersDigitCount: env.lineNumbersDigitCount,\r\n typicalHalfwidthCharacterWidth: env.fontInfo.typicalHalfwidthCharacterWidth,\r\n maxDigitWidth: env.fontInfo.maxDigitWidth,\r\n pixelRatio: env.pixelRatio\r\n });\r\n }\r\n static computeContainedMinimapLineCount(input) {\r\n const typicalViewportLineCount = input.height / input.lineHeight;\r\n const extraLinesBeyondLastLine = input.scrollBeyondLastLine ? (typicalViewportLineCount - 1) : 0;\r\n const desiredRatio = (input.viewLineCount + extraLinesBeyondLastLine) / (input.pixelRatio * input.height);\r\n const minimapLineCount = Math.floor(input.viewLineCount / desiredRatio);\r\n return { typicalViewportLineCount, extraLinesBeyondLastLine, desiredRatio, minimapLineCount };\r\n }\r\n static _computeMinimapLayout(input, memory) {\r\n const outerWidth = input.outerWidth;\r\n const outerHeight = input.outerHeight;\r\n const pixelRatio = input.pixelRatio;\r\n if (!input.minimap.enabled) {\r\n return {\r\n renderMinimap: 0 /* None */,\r\n minimapLeft: 0,\r\n minimapWidth: 0,\r\n minimapHeightIsEditorHeight: false,\r\n minimapIsSampling: false,\r\n minimapScale: 1,\r\n minimapLineHeight: 1,\r\n minimapCanvasInnerWidth: 0,\r\n minimapCanvasInnerHeight: Math.floor(pixelRatio * outerHeight),\r\n minimapCanvasOuterWidth: 0,\r\n minimapCanvasOuterHeight: outerHeight,\r\n };\r\n }\r\n // Can use memory if only the `viewLineCount` and `remainingWidth` have changed\r\n const stableMinimapLayoutInput = memory.stableMinimapLayoutInput;\r\n const couldUseMemory = (stableMinimapLayoutInput\r\n // && input.outerWidth === lastMinimapLayoutInput.outerWidth !!! INTENTIONAL OMITTED\r\n && input.outerHeight === stableMinimapLayoutInput.outerHeight\r\n && input.lineHeight === stableMinimapLayoutInput.lineHeight\r\n && input.typicalHalfwidthCharacterWidth === stableMinimapLayoutInput.typicalHalfwidthCharacterWidth\r\n && input.pixelRatio === stableMinimapLayoutInput.pixelRatio\r\n && input.scrollBeyondLastLine === stableMinimapLayoutInput.scrollBeyondLastLine\r\n && input.minimap.enabled === stableMinimapLayoutInput.minimap.enabled\r\n && input.minimap.side === stableMinimapLayoutInput.minimap.side\r\n && input.minimap.size === stableMinimapLayoutInput.minimap.size\r\n && input.minimap.showSlider === stableMinimapLayoutInput.minimap.showSlider\r\n && input.minimap.renderCharacters === stableMinimapLayoutInput.minimap.renderCharacters\r\n && input.minimap.maxColumn === stableMinimapLayoutInput.minimap.maxColumn\r\n && input.minimap.scale === stableMinimapLayoutInput.minimap.scale\r\n && input.verticalScrollbarWidth === stableMinimapLayoutInput.verticalScrollbarWidth\r\n // && input.viewLineCount === lastMinimapLayoutInput.viewLineCount !!! INTENTIONAL OMITTED\r\n // && input.remainingWidth === lastMinimapLayoutInput.remainingWidth !!! INTENTIONAL OMITTED\r\n && input.isViewportWrapping === stableMinimapLayoutInput.isViewportWrapping);\r\n const lineHeight = input.lineHeight;\r\n const typicalHalfwidthCharacterWidth = input.typicalHalfwidthCharacterWidth;\r\n const scrollBeyondLastLine = input.scrollBeyondLastLine;\r\n const minimapRenderCharacters = input.minimap.renderCharacters;\r\n let minimapScale = (pixelRatio >= 2 ? Math.round(input.minimap.scale * 2) : input.minimap.scale);\r\n const minimapMaxColumn = input.minimap.maxColumn;\r\n const minimapSize = input.minimap.size;\r\n const minimapSide = input.minimap.side;\r\n const verticalScrollbarWidth = input.verticalScrollbarWidth;\r\n const viewLineCount = input.viewLineCount;\r\n const remainingWidth = input.remainingWidth;\r\n const isViewportWrapping = input.isViewportWrapping;\r\n const baseCharHeight = minimapRenderCharacters ? 2 : 3;\r\n let minimapCanvasInnerHeight = Math.floor(pixelRatio * outerHeight);\r\n const minimapCanvasOuterHeight = minimapCanvasInnerHeight / pixelRatio;\r\n let minimapHeightIsEditorHeight = false;\r\n let minimapIsSampling = false;\r\n let minimapLineHeight = baseCharHeight * minimapScale;\r\n let minimapCharWidth = minimapScale / pixelRatio;\r\n let minimapWidthMultiplier = 1;\r\n if (minimapSize === 'fill' || minimapSize === 'fit') {\r\n const { typicalViewportLineCount, extraLinesBeyondLastLine, desiredRatio, minimapLineCount } = EditorLayoutInfoComputer.computeContainedMinimapLineCount({\r\n viewLineCount: viewLineCount,\r\n scrollBeyondLastLine: scrollBeyondLastLine,\r\n height: outerHeight,\r\n lineHeight: lineHeight,\r\n pixelRatio: pixelRatio\r\n });\r\n // ratio is intentionally not part of the layout to avoid the layout changing all the time\r\n // when doing sampling\r\n const ratio = viewLineCount / minimapLineCount;\r\n if (ratio > 1) {\r\n minimapHeightIsEditorHeight = true;\r\n minimapIsSampling = true;\r\n minimapScale = 1;\r\n minimapLineHeight = 1;\r\n minimapCharWidth = minimapScale / pixelRatio;\r\n }\r\n else {\r\n let fitBecomesFill = false;\r\n let maxMinimapScale = minimapScale + 1;\r\n if (minimapSize === 'fit') {\r\n const effectiveMinimapHeight = Math.ceil((viewLineCount + extraLinesBeyondLastLine) * minimapLineHeight);\r\n if (isViewportWrapping && couldUseMemory && remainingWidth <= memory.stableFitRemainingWidth) {\r\n // There is a loop when using `fit` and viewport wrapping:\r\n // - view line count impacts minimap layout\r\n // - minimap layout impacts viewport width\r\n // - viewport width impacts view line count\r\n // To break the loop, once we go to a smaller minimap scale, we try to stick with it.\r\n fitBecomesFill = true;\r\n maxMinimapScale = memory.stableFitMaxMinimapScale;\r\n }\r\n else {\r\n fitBecomesFill = (effectiveMinimapHeight > minimapCanvasInnerHeight);\r\n }\r\n }\r\n if (minimapSize === 'fill' || fitBecomesFill) {\r\n minimapHeightIsEditorHeight = true;\r\n const configuredMinimapScale = minimapScale;\r\n minimapLineHeight = Math.min(lineHeight * pixelRatio, Math.max(1, Math.floor(1 / desiredRatio)));\r\n if (isViewportWrapping && couldUseMemory && remainingWidth <= memory.stableFitRemainingWidth) {\r\n // There is a loop when using `fill` and viewport wrapping:\r\n // - view line count impacts minimap layout\r\n // - minimap layout impacts viewport width\r\n // - viewport width impacts view line count\r\n // To break the loop, once we go to a smaller minimap scale, we try to stick with it.\r\n maxMinimapScale = memory.stableFitMaxMinimapScale;\r\n }\r\n minimapScale = Math.min(maxMinimapScale, Math.max(1, Math.floor(minimapLineHeight / baseCharHeight)));\r\n if (minimapScale > configuredMinimapScale) {\r\n minimapWidthMultiplier = Math.min(2, minimapScale / configuredMinimapScale);\r\n }\r\n minimapCharWidth = minimapScale / pixelRatio / minimapWidthMultiplier;\r\n minimapCanvasInnerHeight = Math.ceil((Math.max(typicalViewportLineCount, viewLineCount + extraLinesBeyondLastLine)) * minimapLineHeight);\r\n if (isViewportWrapping) {\r\n // remember for next time\r\n memory.stableMinimapLayoutInput = input;\r\n memory.stableFitRemainingWidth = remainingWidth;\r\n memory.stableFitMaxMinimapScale = minimapScale;\r\n }\r\n else {\r\n memory.stableMinimapLayoutInput = null;\r\n memory.stableFitRemainingWidth = 0;\r\n }\r\n }\r\n }\r\n }\r\n // Given:\r\n // (leaving 2px for the cursor to have space after the last character)\r\n // viewportColumn = (contentWidth - verticalScrollbarWidth - 2) / typicalHalfwidthCharacterWidth\r\n // minimapWidth = viewportColumn * minimapCharWidth\r\n // contentWidth = remainingWidth - minimapWidth\r\n // What are good values for contentWidth and minimapWidth ?\r\n // minimapWidth = ((contentWidth - verticalScrollbarWidth - 2) / typicalHalfwidthCharacterWidth) * minimapCharWidth\r\n // typicalHalfwidthCharacterWidth * minimapWidth = (contentWidth - verticalScrollbarWidth - 2) * minimapCharWidth\r\n // typicalHalfwidthCharacterWidth * minimapWidth = (remainingWidth - minimapWidth - verticalScrollbarWidth - 2) * minimapCharWidth\r\n // (typicalHalfwidthCharacterWidth + minimapCharWidth) * minimapWidth = (remainingWidth - verticalScrollbarWidth - 2) * minimapCharWidth\r\n // minimapWidth = ((remainingWidth - verticalScrollbarWidth - 2) * minimapCharWidth) / (typicalHalfwidthCharacterWidth + minimapCharWidth)\r\n const minimapMaxWidth = Math.floor(minimapMaxColumn * minimapCharWidth);\r\n const minimapWidth = Math.min(minimapMaxWidth, Math.max(0, Math.floor(((remainingWidth - verticalScrollbarWidth - 2) * minimapCharWidth) / (typicalHalfwidthCharacterWidth + minimapCharWidth))) + MINIMAP_GUTTER_WIDTH);\r\n let minimapCanvasInnerWidth = Math.floor(pixelRatio * minimapWidth);\r\n const minimapCanvasOuterWidth = minimapCanvasInnerWidth / pixelRatio;\r\n minimapCanvasInnerWidth = Math.floor(minimapCanvasInnerWidth * minimapWidthMultiplier);\r\n const renderMinimap = (minimapRenderCharacters ? 1 /* Text */ : 2 /* Blocks */);\r\n const minimapLeft = (minimapSide === 'left' ? 0 : (outerWidth - minimapWidth - verticalScrollbarWidth));\r\n return {\r\n renderMinimap,\r\n minimapLeft,\r\n minimapWidth,\r\n minimapHeightIsEditorHeight,\r\n minimapIsSampling,\r\n minimapScale,\r\n minimapLineHeight,\r\n minimapCanvasInnerWidth,\r\n minimapCanvasInnerHeight,\r\n minimapCanvasOuterWidth,\r\n minimapCanvasOuterHeight,\r\n };\r\n }\r\n static computeLayout(options, env) {\r\n const outerWidth = env.outerWidth | 0;\r\n const outerHeight = env.outerHeight | 0;\r\n const lineHeight = env.lineHeight | 0;\r\n const lineNumbersDigitCount = env.lineNumbersDigitCount | 0;\r\n const typicalHalfwidthCharacterWidth = env.typicalHalfwidthCharacterWidth;\r\n const maxDigitWidth = env.maxDigitWidth;\r\n const pixelRatio = env.pixelRatio;\r\n const viewLineCount = env.viewLineCount;\r\n const wordWrapOverride2 = options.get(121 /* wordWrapOverride2 */);\r\n const wordWrapOverride1 = (wordWrapOverride2 === 'inherit' ? options.get(120 /* wordWrapOverride1 */) : wordWrapOverride2);\r\n const wordWrap = (wordWrapOverride1 === 'inherit' ? options.get(116 /* wordWrap */) : wordWrapOverride1);\r\n const wordWrapColumn = options.get(119 /* wordWrapColumn */);\r\n const accessibilitySupport = options.get(2 /* accessibilitySupport */);\r\n const isDominatedByLongLines = env.isDominatedByLongLines;\r\n const showGlyphMargin = options.get(47 /* glyphMargin */);\r\n const showLineNumbers = (options.get(58 /* lineNumbers */).renderType !== 0 /* Off */);\r\n const lineNumbersMinChars = options.get(59 /* lineNumbersMinChars */);\r\n const scrollBeyondLastLine = options.get(93 /* scrollBeyondLastLine */);\r\n const minimap = options.get(63 /* minimap */);\r\n const scrollbar = options.get(91 /* scrollbar */);\r\n const verticalScrollbarWidth = scrollbar.verticalScrollbarSize;\r\n const verticalScrollbarHasArrows = scrollbar.verticalHasArrows;\r\n const scrollbarArrowSize = scrollbar.arrowSize;\r\n const horizontalScrollbarHeight = scrollbar.horizontalScrollbarSize;\r\n const rawLineDecorationsWidth = options.get(56 /* lineDecorationsWidth */);\r\n const folding = options.get(35 /* folding */);\r\n let lineDecorationsWidth;\r\n if (typeof rawLineDecorationsWidth === 'string' && /^\\d+(\\.\\d+)?ch$/.test(rawLineDecorationsWidth)) {\r\n const multiple = parseFloat(rawLineDecorationsWidth.substr(0, rawLineDecorationsWidth.length - 2));\r\n lineDecorationsWidth = EditorIntOption.clampedInt(multiple * typicalHalfwidthCharacterWidth, 0, 0, 1000);\r\n }\r\n else {\r\n lineDecorationsWidth = EditorIntOption.clampedInt(rawLineDecorationsWidth, 0, 0, 1000);\r\n }\r\n if (folding) {\r\n lineDecorationsWidth += 16;\r\n }\r\n let lineNumbersWidth = 0;\r\n if (showLineNumbers) {\r\n const digitCount = Math.max(lineNumbersDigitCount, lineNumbersMinChars);\r\n lineNumbersWidth = Math.round(digitCount * maxDigitWidth);\r\n }\r\n let glyphMarginWidth = 0;\r\n if (showGlyphMargin) {\r\n glyphMarginWidth = lineHeight;\r\n }\r\n let glyphMarginLeft = 0;\r\n let lineNumbersLeft = glyphMarginLeft + glyphMarginWidth;\r\n let decorationsLeft = lineNumbersLeft + lineNumbersWidth;\r\n let contentLeft = decorationsLeft + lineDecorationsWidth;\r\n const remainingWidth = outerWidth - glyphMarginWidth - lineNumbersWidth - lineDecorationsWidth;\r\n let isWordWrapMinified = false;\r\n let isViewportWrapping = false;\r\n let wrappingColumn = -1;\r\n if (accessibilitySupport !== 2 /* Enabled */) {\r\n // See https://github.com/microsoft/vscode/issues/27766\r\n // Never enable wrapping when a screen reader is attached\r\n // because arrow down etc. will not move the cursor in the way\r\n // a screen reader expects.\r\n if (wordWrapOverride1 === 'inherit' && isDominatedByLongLines) {\r\n // Force viewport width wrapping if model is dominated by long lines\r\n isWordWrapMinified = true;\r\n isViewportWrapping = true;\r\n }\r\n else if (wordWrap === 'on' || wordWrap === 'bounded') {\r\n isViewportWrapping = true;\r\n }\r\n else if (wordWrap === 'wordWrapColumn') {\r\n wrappingColumn = wordWrapColumn;\r\n }\r\n }\r\n const minimapLayout = EditorLayoutInfoComputer._computeMinimapLayout({\r\n outerWidth: outerWidth,\r\n outerHeight: outerHeight,\r\n lineHeight: lineHeight,\r\n typicalHalfwidthCharacterWidth: typicalHalfwidthCharacterWidth,\r\n pixelRatio: pixelRatio,\r\n scrollBeyondLastLine: scrollBeyondLastLine,\r\n minimap: minimap,\r\n verticalScrollbarWidth: verticalScrollbarWidth,\r\n viewLineCount: viewLineCount,\r\n remainingWidth: remainingWidth,\r\n isViewportWrapping: isViewportWrapping,\r\n }, env.memory || new ComputeOptionsMemory());\r\n if (minimapLayout.renderMinimap !== 0 /* None */ && minimapLayout.minimapLeft === 0) {\r\n // the minimap is rendered to the left, so move everything to the right\r\n glyphMarginLeft += minimapLayout.minimapWidth;\r\n lineNumbersLeft += minimapLayout.minimapWidth;\r\n decorationsLeft += minimapLayout.minimapWidth;\r\n contentLeft += minimapLayout.minimapWidth;\r\n }\r\n const contentWidth = remainingWidth - minimapLayout.minimapWidth;\r\n // (leaving 2px for the cursor to have space after the last character)\r\n const viewportColumn = Math.max(1, Math.floor((contentWidth - verticalScrollbarWidth - 2) / typicalHalfwidthCharacterWidth));\r\n const verticalArrowSize = (verticalScrollbarHasArrows ? scrollbarArrowSize : 0);\r\n if (isViewportWrapping) {\r\n // compute the actual wrappingColumn\r\n wrappingColumn = Math.max(1, viewportColumn);\r\n if (wordWrap === 'bounded') {\r\n wrappingColumn = Math.min(wrappingColumn, wordWrapColumn);\r\n }\r\n }\r\n return {\r\n width: outerWidth,\r\n height: outerHeight,\r\n glyphMarginLeft: glyphMarginLeft,\r\n glyphMarginWidth: glyphMarginWidth,\r\n lineNumbersLeft: lineNumbersLeft,\r\n lineNumbersWidth: lineNumbersWidth,\r\n decorationsLeft: decorationsLeft,\r\n decorationsWidth: lineDecorationsWidth,\r\n contentLeft: contentLeft,\r\n contentWidth: contentWidth,\r\n minimap: minimapLayout,\r\n viewportColumn: viewportColumn,\r\n isWordWrapMinified: isWordWrapMinified,\r\n isViewportWrapping: isViewportWrapping,\r\n wrappingColumn: wrappingColumn,\r\n verticalScrollbarWidth: verticalScrollbarWidth,\r\n horizontalScrollbarHeight: horizontalScrollbarHeight,\r\n overviewRuler: {\r\n top: verticalArrowSize,\r\n width: verticalScrollbarWidth,\r\n height: (outerHeight - 2 * verticalArrowSize),\r\n right: 0\r\n }\r\n };\r\n }\r\n}\r\nclass EditorLightbulb extends BaseEditorOption {\r\n constructor() {\r\n const defaults = { enabled: true };\r\n super(55 /* lightbulb */, 'lightbulb', defaults, {\r\n 'editor.lightbulb.enabled': {\r\n type: 'boolean',\r\n default: defaults.enabled,\r\n description: nls.localize('codeActions', \"Enables the code action lightbulb in the editor.\")\r\n },\r\n });\r\n }\r\n validate(_input) {\r\n if (!_input || typeof _input !== 'object') {\r\n return this.defaultValue;\r\n }\r\n const input = _input;\r\n return {\r\n enabled: boolean(input.enabled, this.defaultValue.enabled)\r\n };\r\n }\r\n}\r\nclass EditorInlayHints extends BaseEditorOption {\r\n constructor() {\r\n const defaults = { enabled: true, fontSize: 0, fontFamily: '' };\r\n super(125 /* inlayHints */, 'inlayHints', defaults, {\r\n 'editor.inlayHints.enabled': {\r\n type: 'boolean',\r\n default: defaults.enabled,\r\n description: nls.localize('inlayHints.enable', \"Enables the inlay hints in the editor.\")\r\n },\r\n 'editor.inlayHints.fontSize': {\r\n type: 'number',\r\n default: defaults.fontSize,\r\n markdownDescription: nls.localize('inlayHints.fontSize', \"Controls font size of inlay hints in the editor. When set to `0`, the 90% of `#editor.fontSize#` is used.\")\r\n },\r\n 'editor.inlayHints.fontFamily': {\r\n type: 'string',\r\n default: defaults.fontFamily,\r\n description: nls.localize('inlayHints.fontFamily', \"Controls font family of inlay hints in the editor. When set to empty, the `#editor.fontFamily#` is used.\")\r\n },\r\n });\r\n }\r\n validate(_input) {\r\n if (!_input || typeof _input !== 'object') {\r\n return this.defaultValue;\r\n }\r\n const input = _input;\r\n return {\r\n enabled: boolean(input.enabled, this.defaultValue.enabled),\r\n fontSize: EditorIntOption.clampedInt(input.fontSize, this.defaultValue.fontSize, 0, 100),\r\n fontFamily: EditorStringOption.string(input.fontFamily, this.defaultValue.fontFamily)\r\n };\r\n }\r\n}\r\n//#endregion\r\n//#region lineHeight\r\nclass EditorLineHeight extends EditorFloatOption {\r\n constructor() {\r\n super(57 /* lineHeight */, 'lineHeight', EDITOR_FONT_DEFAULTS.lineHeight, x => EditorFloatOption.clamp(x, 0, 150), { markdownDescription: nls.localize('lineHeight', \"Controls the line height. \\n - Use 0 to automatically compute the line height from the font size.\\n - Values between 0 and 8 will be used as a multiplier with the font size.\\n - Values greater than or equal to 8 will be used as effective values.\") });\r\n }\r\n compute(env, options, value) {\r\n // The lineHeight is computed from the fontSize if it is 0.\r\n // Moreover, the final lineHeight respects the editor zoom level.\r\n // So take the result from env.fontInfo\r\n return env.fontInfo.lineHeight;\r\n }\r\n}\r\nclass EditorMinimap extends BaseEditorOption {\r\n constructor() {\r\n const defaults = {\r\n enabled: true,\r\n size: 'proportional',\r\n side: 'right',\r\n showSlider: 'mouseover',\r\n renderCharacters: true,\r\n maxColumn: 120,\r\n scale: 1,\r\n };\r\n super(63 /* minimap */, 'minimap', defaults, {\r\n 'editor.minimap.enabled': {\r\n type: 'boolean',\r\n default: defaults.enabled,\r\n description: nls.localize('minimap.enabled', \"Controls whether the minimap is shown.\")\r\n },\r\n 'editor.minimap.size': {\r\n type: 'string',\r\n enum: ['proportional', 'fill', 'fit'],\r\n enumDescriptions: [\r\n nls.localize('minimap.size.proportional', \"The minimap has the same size as the editor contents (and might scroll).\"),\r\n nls.localize('minimap.size.fill', \"The minimap will stretch or shrink as necessary to fill the height of the editor (no scrolling).\"),\r\n nls.localize('minimap.size.fit', \"The minimap will shrink as necessary to never be larger than the editor (no scrolling).\"),\r\n ],\r\n default: defaults.size,\r\n description: nls.localize('minimap.size', \"Controls the size of the minimap.\")\r\n },\r\n 'editor.minimap.side': {\r\n type: 'string',\r\n enum: ['left', 'right'],\r\n default: defaults.side,\r\n description: nls.localize('minimap.side', \"Controls the side where to render the minimap.\")\r\n },\r\n 'editor.minimap.showSlider': {\r\n type: 'string',\r\n enum: ['always', 'mouseover'],\r\n default: defaults.showSlider,\r\n description: nls.localize('minimap.showSlider', \"Controls when the minimap slider is shown.\")\r\n },\r\n 'editor.minimap.scale': {\r\n type: 'number',\r\n default: defaults.scale,\r\n minimum: 1,\r\n maximum: 3,\r\n enum: [1, 2, 3],\r\n description: nls.localize('minimap.scale', \"Scale of content drawn in the minimap: 1, 2 or 3.\")\r\n },\r\n 'editor.minimap.renderCharacters': {\r\n type: 'boolean',\r\n default: defaults.renderCharacters,\r\n description: nls.localize('minimap.renderCharacters', \"Render the actual characters on a line as opposed to color blocks.\")\r\n },\r\n 'editor.minimap.maxColumn': {\r\n type: 'number',\r\n default: defaults.maxColumn,\r\n description: nls.localize('minimap.maxColumn', \"Limit the width of the minimap to render at most a certain number of columns.\")\r\n }\r\n });\r\n }\r\n validate(_input) {\r\n if (!_input || typeof _input !== 'object') {\r\n return this.defaultValue;\r\n }\r\n const input = _input;\r\n return {\r\n enabled: boolean(input.enabled, this.defaultValue.enabled),\r\n size: stringSet(input.size, this.defaultValue.size, ['proportional', 'fill', 'fit']),\r\n side: stringSet(input.side, this.defaultValue.side, ['right', 'left']),\r\n showSlider: stringSet(input.showSlider, this.defaultValue.showSlider, ['always', 'mouseover']),\r\n renderCharacters: boolean(input.renderCharacters, this.defaultValue.renderCharacters),\r\n scale: EditorIntOption.clampedInt(input.scale, 1, 1, 3),\r\n maxColumn: EditorIntOption.clampedInt(input.maxColumn, this.defaultValue.maxColumn, 1, 10000),\r\n };\r\n }\r\n}\r\n//#endregion\r\n//#region multiCursorModifier\r\nfunction _multiCursorModifierFromString(multiCursorModifier) {\r\n if (multiCursorModifier === 'ctrlCmd') {\r\n return (platform.isMacintosh ? 'metaKey' : 'ctrlKey');\r\n }\r\n return 'altKey';\r\n}\r\nclass EditorPadding extends BaseEditorOption {\r\n constructor() {\r\n super(73 /* padding */, 'padding', { top: 0, bottom: 0 }, {\r\n 'editor.padding.top': {\r\n type: 'number',\r\n default: 0,\r\n minimum: 0,\r\n maximum: 1000,\r\n description: nls.localize('padding.top', \"Controls the amount of space between the top edge of the editor and the first line.\")\r\n },\r\n 'editor.padding.bottom': {\r\n type: 'number',\r\n default: 0,\r\n minimum: 0,\r\n maximum: 1000,\r\n description: nls.localize('padding.bottom', \"Controls the amount of space between the bottom edge of the editor and the last line.\")\r\n }\r\n });\r\n }\r\n validate(_input) {\r\n if (!_input || typeof _input !== 'object') {\r\n return this.defaultValue;\r\n }\r\n const input = _input;\r\n return {\r\n top: EditorIntOption.clampedInt(input.top, 0, 0, 1000),\r\n bottom: EditorIntOption.clampedInt(input.bottom, 0, 0, 1000)\r\n };\r\n }\r\n}\r\nclass EditorParameterHints extends BaseEditorOption {\r\n constructor() {\r\n const defaults = {\r\n enabled: true,\r\n cycle: false\r\n };\r\n super(74 /* parameterHints */, 'parameterHints', defaults, {\r\n 'editor.parameterHints.enabled': {\r\n type: 'boolean',\r\n default: defaults.enabled,\r\n description: nls.localize('parameterHints.enabled', \"Enables a pop-up that shows parameter documentation and type information as you type.\")\r\n },\r\n 'editor.parameterHints.cycle': {\r\n type: 'boolean',\r\n default: defaults.cycle,\r\n description: nls.localize('parameterHints.cycle', \"Controls whether the parameter hints menu cycles or closes when reaching the end of the list.\")\r\n },\r\n });\r\n }\r\n validate(_input) {\r\n if (!_input || typeof _input !== 'object') {\r\n return this.defaultValue;\r\n }\r\n const input = _input;\r\n return {\r\n enabled: boolean(input.enabled, this.defaultValue.enabled),\r\n cycle: boolean(input.cycle, this.defaultValue.cycle)\r\n };\r\n }\r\n}\r\n//#endregion\r\n//#region pixelRatio\r\nclass EditorPixelRatio extends ComputedEditorOption {\r\n constructor() {\r\n super(127 /* pixelRatio */);\r\n }\r\n compute(env, options, _) {\r\n return env.pixelRatio;\r\n }\r\n}\r\nclass EditorQuickSuggestions extends BaseEditorOption {\r\n constructor() {\r\n const defaults = {\r\n other: true,\r\n comments: false,\r\n strings: false\r\n };\r\n super(77 /* quickSuggestions */, 'quickSuggestions', defaults, {\r\n anyOf: [\r\n {\r\n type: 'boolean',\r\n },\r\n {\r\n type: 'object',\r\n properties: {\r\n strings: {\r\n type: 'boolean',\r\n default: defaults.strings,\r\n description: nls.localize('quickSuggestions.strings', \"Enable quick suggestions inside strings.\")\r\n },\r\n comments: {\r\n type: 'boolean',\r\n default: defaults.comments,\r\n description: nls.localize('quickSuggestions.comments', \"Enable quick suggestions inside comments.\")\r\n },\r\n other: {\r\n type: 'boolean',\r\n default: defaults.other,\r\n description: nls.localize('quickSuggestions.other', \"Enable quick suggestions outside of strings and comments.\")\r\n },\r\n }\r\n }\r\n ],\r\n default: defaults,\r\n description: nls.localize('quickSuggestions', \"Controls whether suggestions should automatically show up while typing.\")\r\n });\r\n this.defaultValue = defaults;\r\n }\r\n validate(_input) {\r\n if (typeof _input === 'boolean') {\r\n return _input;\r\n }\r\n if (_input && typeof _input === 'object') {\r\n const input = _input;\r\n const opts = {\r\n other: boolean(input.other, this.defaultValue.other),\r\n comments: boolean(input.comments, this.defaultValue.comments),\r\n strings: boolean(input.strings, this.defaultValue.strings),\r\n };\r\n if (opts.other && opts.comments && opts.strings) {\r\n return true; // all on\r\n }\r\n else if (!opts.other && !opts.comments && !opts.strings) {\r\n return false; // all off\r\n }\r\n else {\r\n return opts;\r\n }\r\n }\r\n return this.defaultValue;\r\n }\r\n}\r\nclass EditorRenderLineNumbersOption extends BaseEditorOption {\r\n constructor() {\r\n super(58 /* lineNumbers */, 'lineNumbers', { renderType: 1 /* On */, renderFn: null }, {\r\n type: 'string',\r\n enum: ['off', 'on', 'relative', 'interval'],\r\n enumDescriptions: [\r\n nls.localize('lineNumbers.off', \"Line numbers are not rendered.\"),\r\n nls.localize('lineNumbers.on', \"Line numbers are rendered as absolute number.\"),\r\n nls.localize('lineNumbers.relative', \"Line numbers are rendered as distance in lines to cursor position.\"),\r\n nls.localize('lineNumbers.interval', \"Line numbers are rendered every 10 lines.\")\r\n ],\r\n default: 'on',\r\n description: nls.localize('lineNumbers', \"Controls the display of line numbers.\")\r\n });\r\n }\r\n validate(lineNumbers) {\r\n let renderType = this.defaultValue.renderType;\r\n let renderFn = this.defaultValue.renderFn;\r\n if (typeof lineNumbers !== 'undefined') {\r\n if (typeof lineNumbers === 'function') {\r\n renderType = 4 /* Custom */;\r\n renderFn = lineNumbers;\r\n }\r\n else if (lineNumbers === 'interval') {\r\n renderType = 3 /* Interval */;\r\n }\r\n else if (lineNumbers === 'relative') {\r\n renderType = 2 /* Relative */;\r\n }\r\n else if (lineNumbers === 'on') {\r\n renderType = 1 /* On */;\r\n }\r\n else {\r\n renderType = 0 /* Off */;\r\n }\r\n }\r\n return {\r\n renderType,\r\n renderFn\r\n };\r\n }\r\n}\r\n//#endregion\r\n//#region renderValidationDecorations\r\n/**\r\n * @internal\r\n */\r\nexport function filterValidationDecorations(options) {\r\n const renderValidationDecorations = options.get(86 /* renderValidationDecorations */);\r\n if (renderValidationDecorations === 'editable') {\r\n return options.get(79 /* readOnly */);\r\n }\r\n return renderValidationDecorations === 'on' ? false : true;\r\n}\r\nclass EditorRulers extends BaseEditorOption {\r\n constructor() {\r\n const defaults = [];\r\n const columnSchema = { type: 'number', description: nls.localize('rulers.size', \"Number of monospace characters at which this editor ruler will render.\") };\r\n super(90 /* rulers */, 'rulers', defaults, {\r\n type: 'array',\r\n items: {\r\n anyOf: [\r\n columnSchema,\r\n {\r\n type: [\r\n 'object'\r\n ],\r\n properties: {\r\n column: columnSchema,\r\n color: {\r\n type: 'string',\r\n description: nls.localize('rulers.color', \"Color of this editor ruler.\"),\r\n format: 'color-hex'\r\n }\r\n }\r\n }\r\n ]\r\n },\r\n default: defaults,\r\n description: nls.localize('rulers', \"Render vertical rulers after a certain number of monospace characters. Use multiple values for multiple rulers. No rulers are drawn if array is empty.\")\r\n });\r\n }\r\n validate(input) {\r\n if (Array.isArray(input)) {\r\n let rulers = [];\r\n for (let _element of input) {\r\n if (typeof _element === 'number') {\r\n rulers.push({\r\n column: EditorIntOption.clampedInt(_element, 0, 0, 10000),\r\n color: null\r\n });\r\n }\r\n else if (_element && typeof _element === 'object') {\r\n const element = _element;\r\n rulers.push({\r\n column: EditorIntOption.clampedInt(element.column, 0, 0, 10000),\r\n color: element.color\r\n });\r\n }\r\n }\r\n rulers.sort((a, b) => a.column - b.column);\r\n return rulers;\r\n }\r\n return this.defaultValue;\r\n }\r\n}\r\nfunction _scrollbarVisibilityFromString(visibility, defaultValue) {\r\n if (typeof visibility !== 'string') {\r\n return defaultValue;\r\n }\r\n switch (visibility) {\r\n case 'hidden': return 2 /* Hidden */;\r\n case 'visible': return 3 /* Visible */;\r\n default: return 1 /* Auto */;\r\n }\r\n}\r\nclass EditorScrollbar extends BaseEditorOption {\r\n constructor() {\r\n const defaults = {\r\n vertical: 1 /* Auto */,\r\n horizontal: 1 /* Auto */,\r\n arrowSize: 11,\r\n useShadows: true,\r\n verticalHasArrows: false,\r\n horizontalHasArrows: false,\r\n horizontalScrollbarSize: 12,\r\n horizontalSliderSize: 12,\r\n verticalScrollbarSize: 14,\r\n verticalSliderSize: 14,\r\n handleMouseWheel: true,\r\n alwaysConsumeMouseWheel: true,\r\n scrollByPage: false\r\n };\r\n super(91 /* scrollbar */, 'scrollbar', defaults, {\r\n 'editor.scrollbar.vertical': {\r\n type: 'string',\r\n enum: ['auto', 'visible', 'hidden'],\r\n enumDescriptions: [\r\n nls.localize('scrollbar.vertical.auto', \"The vertical scrollbar will be visible only when necessary.\"),\r\n nls.localize('scrollbar.vertical.visible', \"The vertical scrollbar will always be visible.\"),\r\n nls.localize('scrollbar.vertical.fit', \"The vertical scrollbar will always be hidden.\"),\r\n ],\r\n default: 'auto',\r\n description: nls.localize('scrollbar.vertical', \"Controls the visibility of the vertical scrollbar.\")\r\n },\r\n 'editor.scrollbar.horizontal': {\r\n type: 'string',\r\n enum: ['auto', 'visible', 'hidden'],\r\n enumDescriptions: [\r\n nls.localize('scrollbar.horizontal.auto', \"The horizontal scrollbar will be visible only when necessary.\"),\r\n nls.localize('scrollbar.horizontal.visible', \"The horizontal scrollbar will always be visible.\"),\r\n nls.localize('scrollbar.horizontal.fit', \"The horizontal scrollbar will always be hidden.\"),\r\n ],\r\n default: 'auto',\r\n description: nls.localize('scrollbar.horizontal', \"Controls the visibility of the horizontal scrollbar.\")\r\n },\r\n 'editor.scrollbar.verticalScrollbarSize': {\r\n type: 'number',\r\n default: defaults.verticalScrollbarSize,\r\n description: nls.localize('scrollbar.verticalScrollbarSize', \"The width of the vertical scrollbar.\")\r\n },\r\n 'editor.scrollbar.horizontalScrollbarSize': {\r\n type: 'number',\r\n default: defaults.horizontalScrollbarSize,\r\n description: nls.localize('scrollbar.horizontalScrollbarSize', \"The height of the horizontal scrollbar.\")\r\n },\r\n 'editor.scrollbar.scrollByPage': {\r\n type: 'boolean',\r\n default: defaults.scrollByPage,\r\n description: nls.localize('scrollbar.scrollByPage', \"Controls whether clicks scroll by page or jump to click position.\")\r\n }\r\n });\r\n }\r\n validate(_input) {\r\n if (!_input || typeof _input !== 'object') {\r\n return this.defaultValue;\r\n }\r\n const input = _input;\r\n const horizontalScrollbarSize = EditorIntOption.clampedInt(input.horizontalScrollbarSize, this.defaultValue.horizontalScrollbarSize, 0, 1000);\r\n const verticalScrollbarSize = EditorIntOption.clampedInt(input.verticalScrollbarSize, this.defaultValue.verticalScrollbarSize, 0, 1000);\r\n return {\r\n arrowSize: EditorIntOption.clampedInt(input.arrowSize, this.defaultValue.arrowSize, 0, 1000),\r\n vertical: _scrollbarVisibilityFromString(input.vertical, this.defaultValue.vertical),\r\n horizontal: _scrollbarVisibilityFromString(input.horizontal, this.defaultValue.horizontal),\r\n useShadows: boolean(input.useShadows, this.defaultValue.useShadows),\r\n verticalHasArrows: boolean(input.verticalHasArrows, this.defaultValue.verticalHasArrows),\r\n horizontalHasArrows: boolean(input.horizontalHasArrows, this.defaultValue.horizontalHasArrows),\r\n handleMouseWheel: boolean(input.handleMouseWheel, this.defaultValue.handleMouseWheel),\r\n alwaysConsumeMouseWheel: boolean(input.alwaysConsumeMouseWheel, this.defaultValue.alwaysConsumeMouseWheel),\r\n horizontalScrollbarSize: horizontalScrollbarSize,\r\n horizontalSliderSize: EditorIntOption.clampedInt(input.horizontalSliderSize, horizontalScrollbarSize, 0, 1000),\r\n verticalScrollbarSize: verticalScrollbarSize,\r\n verticalSliderSize: EditorIntOption.clampedInt(input.verticalSliderSize, verticalScrollbarSize, 0, 1000),\r\n scrollByPage: boolean(input.scrollByPage, this.defaultValue.scrollByPage),\r\n };\r\n }\r\n}\r\n/**\r\n * Configuration options for inline suggestions\r\n */\r\nclass InlineEditorSuggest extends BaseEditorOption {\r\n constructor() {\r\n const defaults = {\r\n enabled: false,\r\n mode: 'subwordSmart'\r\n };\r\n super(53 /* inlineSuggest */, 'inlineSuggest', defaults, {\r\n 'editor.inlineSuggest.enabled': {\r\n type: 'boolean',\r\n default: defaults.enabled,\r\n description: nls.localize('inlineSuggest.enabled', \"Controls whether to automatically show inline suggestions in the editor.\")\r\n },\r\n 'editor.inlineSuggest.mode': {\r\n type: 'string',\r\n enum: ['prefix', 'subword', 'subwordSmart'],\r\n enumDescriptions: [\r\n nls.localize('inlineSuggest.mode.prefix', \"Only render an inline suggestion if the replace text is a prefix of the insert text.\"),\r\n nls.localize('inlineSuggest.mode.subword', \"Only render an inline suggestion if the replace text is a subword of the insert text.\"),\r\n nls.localize('inlineSuggest.mode.subwordSmart', \"Only render an inline suggestion if the replace text is a subword of the insert text, but the subword must start after the cursor.\"),\r\n ],\r\n default: defaults.mode,\r\n description: nls.localize('inlineSuggest.mode', \"Controls which mode to use for rendering inline suggestions.\")\r\n },\r\n });\r\n }\r\n validate(_input) {\r\n if (!_input || typeof _input !== 'object') {\r\n return this.defaultValue;\r\n }\r\n const input = _input;\r\n return {\r\n enabled: boolean(input.enabled, this.defaultValue.enabled),\r\n mode: stringSet(input.mode, this.defaultValue.mode, ['prefix', 'subword', 'subwordSmart']),\r\n };\r\n }\r\n}\r\nclass EditorSuggest extends BaseEditorOption {\r\n constructor() {\r\n const defaults = {\r\n insertMode: 'insert',\r\n filterGraceful: true,\r\n snippetsPreventQuickSuggestions: true,\r\n localityBonus: false,\r\n shareSuggestSelections: false,\r\n showIcons: true,\r\n showStatusBar: false,\r\n preview: false,\r\n previewMode: 'subwordSmart',\r\n showInlineDetails: true,\r\n showMethods: true,\r\n showFunctions: true,\r\n showConstructors: true,\r\n showDeprecated: true,\r\n showFields: true,\r\n showVariables: true,\r\n showClasses: true,\r\n showStructs: true,\r\n showInterfaces: true,\r\n showModules: true,\r\n showProperties: true,\r\n showEvents: true,\r\n showOperators: true,\r\n showUnits: true,\r\n showValues: true,\r\n showConstants: true,\r\n showEnums: true,\r\n showEnumMembers: true,\r\n showKeywords: true,\r\n showWords: true,\r\n showColors: true,\r\n showFiles: true,\r\n showReferences: true,\r\n showFolders: true,\r\n showTypeParameters: true,\r\n showSnippets: true,\r\n showUsers: true,\r\n showIssues: true,\r\n };\r\n super(105 /* suggest */, 'suggest', defaults, {\r\n 'editor.suggest.insertMode': {\r\n type: 'string',\r\n enum: ['insert', 'replace'],\r\n enumDescriptions: [\r\n nls.localize('suggest.insertMode.insert', \"Insert suggestion without overwriting text right of the cursor.\"),\r\n nls.localize('suggest.insertMode.replace', \"Insert suggestion and overwrite text right of the cursor.\"),\r\n ],\r\n default: defaults.insertMode,\r\n description: nls.localize('suggest.insertMode', \"Controls whether words are overwritten when accepting completions. Note that this depends on extensions opting into this feature.\")\r\n },\r\n 'editor.suggest.filterGraceful': {\r\n type: 'boolean',\r\n default: defaults.filterGraceful,\r\n description: nls.localize('suggest.filterGraceful', \"Controls whether filtering and sorting suggestions accounts for small typos.\")\r\n },\r\n 'editor.suggest.localityBonus': {\r\n type: 'boolean',\r\n default: defaults.localityBonus,\r\n description: nls.localize('suggest.localityBonus', \"Controls whether sorting favors words that appear close to the cursor.\")\r\n },\r\n 'editor.suggest.shareSuggestSelections': {\r\n type: 'boolean',\r\n default: defaults.shareSuggestSelections,\r\n markdownDescription: nls.localize('suggest.shareSuggestSelections', \"Controls whether remembered suggestion selections are shared between multiple workspaces and windows (needs `#editor.suggestSelection#`).\")\r\n },\r\n 'editor.suggest.snippetsPreventQuickSuggestions': {\r\n type: 'boolean',\r\n default: defaults.snippetsPreventQuickSuggestions,\r\n description: nls.localize('suggest.snippetsPreventQuickSuggestions', \"Controls whether an active snippet prevents quick suggestions.\")\r\n },\r\n 'editor.suggest.showIcons': {\r\n type: 'boolean',\r\n default: defaults.showIcons,\r\n description: nls.localize('suggest.showIcons', \"Controls whether to show or hide icons in suggestions.\")\r\n },\r\n 'editor.suggest.showStatusBar': {\r\n type: 'boolean',\r\n default: defaults.showStatusBar,\r\n description: nls.localize('suggest.showStatusBar', \"Controls the visibility of the status bar at the bottom of the suggest widget.\")\r\n },\r\n 'editor.suggest.preview': {\r\n type: 'boolean',\r\n default: defaults.preview,\r\n description: nls.localize('suggest.preview', \"Controls whether to preview the suggestion outcome in the editor.\")\r\n },\r\n 'editor.suggest.previewMode': {\r\n type: 'string',\r\n enum: ['prefix', 'subword', 'subwordSmart'],\r\n enumDescriptions: [\r\n nls.localize('suggest.previewMode.prefix', \"Only render a preview if the replace text is a prefix of the insert text.\"),\r\n nls.localize('suggest.previewMode.subword', \"Only render a preview if the replace text is a subword of the insert text.\"),\r\n nls.localize('suggest.previewMode.subwordSmart', \"Render a preview if the replace text is a subword of the insert text, or if it is a prefix of the insert text.\"),\r\n ],\r\n default: defaults.previewMode,\r\n description: nls.localize('suggest.previewMode', \"Controls which mode to use for rendering the suggest preview.\")\r\n },\r\n 'editor.suggest.showInlineDetails': {\r\n type: 'boolean',\r\n default: defaults.showInlineDetails,\r\n description: nls.localize('suggest.showInlineDetails', \"Controls whether suggest details show inline with the label or only in the details widget\")\r\n },\r\n 'editor.suggest.maxVisibleSuggestions': {\r\n type: 'number',\r\n deprecationMessage: nls.localize('suggest.maxVisibleSuggestions.dep', \"This setting is deprecated. The suggest widget can now be resized.\"),\r\n },\r\n 'editor.suggest.filteredTypes': {\r\n type: 'object',\r\n deprecationMessage: nls.localize('deprecated', \"This setting is deprecated, please use separate settings like 'editor.suggest.showKeywords' or 'editor.suggest.showSnippets' instead.\")\r\n },\r\n 'editor.suggest.showMethods': {\r\n type: 'boolean',\r\n default: true,\r\n markdownDescription: nls.localize('editor.suggest.showMethods', \"When enabled IntelliSense shows `method`-suggestions.\")\r\n },\r\n 'editor.suggest.showFunctions': {\r\n type: 'boolean',\r\n default: true,\r\n markdownDescription: nls.localize('editor.suggest.showFunctions', \"When enabled IntelliSense shows `function`-suggestions.\")\r\n },\r\n 'editor.suggest.showConstructors': {\r\n type: 'boolean',\r\n default: true,\r\n markdownDescription: nls.localize('editor.suggest.showConstructors', \"When enabled IntelliSense shows `constructor`-suggestions.\")\r\n },\r\n 'editor.suggest.showDeprecated': {\r\n type: 'boolean',\r\n default: true,\r\n markdownDescription: nls.localize('editor.suggest.showDeprecated', \"When enabled IntelliSense shows `deprecated`-suggestions.\")\r\n },\r\n 'editor.suggest.showFields': {\r\n type: 'boolean',\r\n default: true,\r\n markdownDescription: nls.localize('editor.suggest.showFields', \"When enabled IntelliSense shows `field`-suggestions.\")\r\n },\r\n 'editor.suggest.showVariables': {\r\n type: 'boolean',\r\n default: true,\r\n markdownDescription: nls.localize('editor.suggest.showVariables', \"When enabled IntelliSense shows `variable`-suggestions.\")\r\n },\r\n 'editor.suggest.showClasses': {\r\n type: 'boolean',\r\n default: true,\r\n markdownDescription: nls.localize('editor.suggest.showClasss', \"When enabled IntelliSense shows `class`-suggestions.\")\r\n },\r\n 'editor.suggest.showStructs': {\r\n type: 'boolean',\r\n default: true,\r\n markdownDescription: nls.localize('editor.suggest.showStructs', \"When enabled IntelliSense shows `struct`-suggestions.\")\r\n },\r\n 'editor.suggest.showInterfaces': {\r\n type: 'boolean',\r\n default: true,\r\n markdownDescription: nls.localize('editor.suggest.showInterfaces', \"When enabled IntelliSense shows `interface`-suggestions.\")\r\n },\r\n 'editor.suggest.showModules': {\r\n type: 'boolean',\r\n default: true,\r\n markdownDescription: nls.localize('editor.suggest.showModules', \"When enabled IntelliSense shows `module`-suggestions.\")\r\n },\r\n 'editor.suggest.showProperties': {\r\n type: 'boolean',\r\n default: true,\r\n markdownDescription: nls.localize('editor.suggest.showPropertys', \"When enabled IntelliSense shows `property`-suggestions.\")\r\n },\r\n 'editor.suggest.showEvents': {\r\n type: 'boolean',\r\n default: true,\r\n markdownDescription: nls.localize('editor.suggest.showEvents', \"When enabled IntelliSense shows `event`-suggestions.\")\r\n },\r\n 'editor.suggest.showOperators': {\r\n type: 'boolean',\r\n default: true,\r\n markdownDescription: nls.localize('editor.suggest.showOperators', \"When enabled IntelliSense shows `operator`-suggestions.\")\r\n },\r\n 'editor.suggest.showUnits': {\r\n type: 'boolean',\r\n default: true,\r\n markdownDescription: nls.localize('editor.suggest.showUnits', \"When enabled IntelliSense shows `unit`-suggestions.\")\r\n },\r\n 'editor.suggest.showValues': {\r\n type: 'boolean',\r\n default: true,\r\n markdownDescription: nls.localize('editor.suggest.showValues', \"When enabled IntelliSense shows `value`-suggestions.\")\r\n },\r\n 'editor.suggest.showConstants': {\r\n type: 'boolean',\r\n default: true,\r\n markdownDescription: nls.localize('editor.suggest.showConstants', \"When enabled IntelliSense shows `constant`-suggestions.\")\r\n },\r\n 'editor.suggest.showEnums': {\r\n type: 'boolean',\r\n default: true,\r\n markdownDescription: nls.localize('editor.suggest.showEnums', \"When enabled IntelliSense shows `enum`-suggestions.\")\r\n },\r\n 'editor.suggest.showEnumMembers': {\r\n type: 'boolean',\r\n default: true,\r\n markdownDescription: nls.localize('editor.suggest.showEnumMembers', \"When enabled IntelliSense shows `enumMember`-suggestions.\")\r\n },\r\n 'editor.suggest.showKeywords': {\r\n type: 'boolean',\r\n default: true,\r\n markdownDescription: nls.localize('editor.suggest.showKeywords', \"When enabled IntelliSense shows `keyword`-suggestions.\")\r\n },\r\n 'editor.suggest.showWords': {\r\n type: 'boolean',\r\n default: true,\r\n markdownDescription: nls.localize('editor.suggest.showTexts', \"When enabled IntelliSense shows `text`-suggestions.\")\r\n },\r\n 'editor.suggest.showColors': {\r\n type: 'boolean',\r\n default: true,\r\n markdownDescription: nls.localize('editor.suggest.showColors', \"When enabled IntelliSense shows `color`-suggestions.\")\r\n },\r\n 'editor.suggest.showFiles': {\r\n type: 'boolean',\r\n default: true,\r\n markdownDescription: nls.localize('editor.suggest.showFiles', \"When enabled IntelliSense shows `file`-suggestions.\")\r\n },\r\n 'editor.suggest.showReferences': {\r\n type: 'boolean',\r\n default: true,\r\n markdownDescription: nls.localize('editor.suggest.showReferences', \"When enabled IntelliSense shows `reference`-suggestions.\")\r\n },\r\n 'editor.suggest.showCustomcolors': {\r\n type: 'boolean',\r\n default: true,\r\n markdownDescription: nls.localize('editor.suggest.showCustomcolors', \"When enabled IntelliSense shows `customcolor`-suggestions.\")\r\n },\r\n 'editor.suggest.showFolders': {\r\n type: 'boolean',\r\n default: true,\r\n markdownDescription: nls.localize('editor.suggest.showFolders', \"When enabled IntelliSense shows `folder`-suggestions.\")\r\n },\r\n 'editor.suggest.showTypeParameters': {\r\n type: 'boolean',\r\n default: true,\r\n markdownDescription: nls.localize('editor.suggest.showTypeParameters', \"When enabled IntelliSense shows `typeParameter`-suggestions.\")\r\n },\r\n 'editor.suggest.showSnippets': {\r\n type: 'boolean',\r\n default: true,\r\n markdownDescription: nls.localize('editor.suggest.showSnippets', \"When enabled IntelliSense shows `snippet`-suggestions.\")\r\n },\r\n 'editor.suggest.showUsers': {\r\n type: 'boolean',\r\n default: true,\r\n markdownDescription: nls.localize('editor.suggest.showUsers', \"When enabled IntelliSense shows `user`-suggestions.\")\r\n },\r\n 'editor.suggest.showIssues': {\r\n type: 'boolean',\r\n default: true,\r\n markdownDescription: nls.localize('editor.suggest.showIssues', \"When enabled IntelliSense shows `issues`-suggestions.\")\r\n }\r\n });\r\n }\r\n validate(_input) {\r\n if (!_input || typeof _input !== 'object') {\r\n return this.defaultValue;\r\n }\r\n const input = _input;\r\n return {\r\n insertMode: stringSet(input.insertMode, this.defaultValue.insertMode, ['insert', 'replace']),\r\n filterGraceful: boolean(input.filterGraceful, this.defaultValue.filterGraceful),\r\n snippetsPreventQuickSuggestions: boolean(input.snippetsPreventQuickSuggestions, this.defaultValue.filterGraceful),\r\n localityBonus: boolean(input.localityBonus, this.defaultValue.localityBonus),\r\n shareSuggestSelections: boolean(input.shareSuggestSelections, this.defaultValue.shareSuggestSelections),\r\n showIcons: boolean(input.showIcons, this.defaultValue.showIcons),\r\n showStatusBar: boolean(input.showStatusBar, this.defaultValue.showStatusBar),\r\n preview: boolean(input.preview, this.defaultValue.preview),\r\n previewMode: stringSet(input.previewMode, this.defaultValue.previewMode, ['prefix', 'subword', 'subwordSmart']),\r\n showInlineDetails: boolean(input.showInlineDetails, this.defaultValue.showInlineDetails),\r\n showMethods: boolean(input.showMethods, this.defaultValue.showMethods),\r\n showFunctions: boolean(input.showFunctions, this.defaultValue.showFunctions),\r\n showConstructors: boolean(input.showConstructors, this.defaultValue.showConstructors),\r\n showDeprecated: boolean(input.showDeprecated, this.defaultValue.showDeprecated),\r\n showFields: boolean(input.showFields, this.defaultValue.showFields),\r\n showVariables: boolean(input.showVariables, this.defaultValue.showVariables),\r\n showClasses: boolean(input.showClasses, this.defaultValue.showClasses),\r\n showStructs: boolean(input.showStructs, this.defaultValue.showStructs),\r\n showInterfaces: boolean(input.showInterfaces, this.defaultValue.showInterfaces),\r\n showModules: boolean(input.showModules, this.defaultValue.showModules),\r\n showProperties: boolean(input.showProperties, this.defaultValue.showProperties),\r\n showEvents: boolean(input.showEvents, this.defaultValue.showEvents),\r\n showOperators: boolean(input.showOperators, this.defaultValue.showOperators),\r\n showUnits: boolean(input.showUnits, this.defaultValue.showUnits),\r\n showValues: boolean(input.showValues, this.defaultValue.showValues),\r\n showConstants: boolean(input.showConstants, this.defaultValue.showConstants),\r\n showEnums: boolean(input.showEnums, this.defaultValue.showEnums),\r\n showEnumMembers: boolean(input.showEnumMembers, this.defaultValue.showEnumMembers),\r\n showKeywords: boolean(input.showKeywords, this.defaultValue.showKeywords),\r\n showWords: boolean(input.showWords, this.defaultValue.showWords),\r\n showColors: boolean(input.showColors, this.defaultValue.showColors),\r\n showFiles: boolean(input.showFiles, this.defaultValue.showFiles),\r\n showReferences: boolean(input.showReferences, this.defaultValue.showReferences),\r\n showFolders: boolean(input.showFolders, this.defaultValue.showFolders),\r\n showTypeParameters: boolean(input.showTypeParameters, this.defaultValue.showTypeParameters),\r\n showSnippets: boolean(input.showSnippets, this.defaultValue.showSnippets),\r\n showUsers: boolean(input.showUsers, this.defaultValue.showUsers),\r\n showIssues: boolean(input.showIssues, this.defaultValue.showIssues),\r\n };\r\n }\r\n}\r\nclass SmartSelect extends BaseEditorOption {\r\n constructor() {\r\n super(101 /* smartSelect */, 'smartSelect', {\r\n selectLeadingAndTrailingWhitespace: true\r\n }, {\r\n 'editor.smartSelect.selectLeadingAndTrailingWhitespace': {\r\n description: nls.localize('selectLeadingAndTrailingWhitespace', \"Whether leading and trailing whitespace should always be selected.\"),\r\n default: true,\r\n type: 'boolean'\r\n }\r\n });\r\n }\r\n validate(input) {\r\n if (!input || typeof input !== 'object') {\r\n return this.defaultValue;\r\n }\r\n return {\r\n selectLeadingAndTrailingWhitespace: boolean(input.selectLeadingAndTrailingWhitespace, this.defaultValue.selectLeadingAndTrailingWhitespace)\r\n };\r\n }\r\n}\r\n//#endregion\r\n//#region tabFocusMode\r\nclass EditorTabFocusMode extends ComputedEditorOption {\r\n constructor() {\r\n super(128 /* tabFocusMode */, [79 /* readOnly */]);\r\n }\r\n compute(env, options, _) {\r\n const readOnly = options.get(79 /* readOnly */);\r\n return (readOnly ? true : env.tabFocusMode);\r\n }\r\n}\r\nfunction _wrappingIndentFromString(wrappingIndent) {\r\n switch (wrappingIndent) {\r\n case 'none': return 0 /* None */;\r\n case 'same': return 1 /* Same */;\r\n case 'indent': return 2 /* Indent */;\r\n case 'deepIndent': return 3 /* DeepIndent */;\r\n }\r\n}\r\nclass EditorWrappingInfoComputer extends ComputedEditorOption {\r\n constructor() {\r\n super(130 /* wrappingInfo */, [129 /* layoutInfo */]);\r\n }\r\n compute(env, options, _) {\r\n const layoutInfo = options.get(129 /* layoutInfo */);\r\n return {\r\n isDominatedByLongLines: env.isDominatedByLongLines,\r\n isWordWrapMinified: layoutInfo.isWordWrapMinified,\r\n isViewportWrapping: layoutInfo.isViewportWrapping,\r\n wrappingColumn: layoutInfo.wrappingColumn,\r\n };\r\n }\r\n}\r\n//#endregion\r\nconst DEFAULT_WINDOWS_FONT_FAMILY = 'Consolas, \\'Courier New\\', monospace';\r\nconst DEFAULT_MAC_FONT_FAMILY = 'Menlo, Monaco, \\'Courier New\\', monospace';\r\nconst DEFAULT_LINUX_FONT_FAMILY = '\\'Droid Sans Mono\\', \\'monospace\\', monospace, \\'Droid Sans Fallback\\'';\r\n/**\r\n * @internal\r\n */\r\nexport const EDITOR_FONT_DEFAULTS = {\r\n fontFamily: (platform.isMacintosh ? DEFAULT_MAC_FONT_FAMILY : (platform.isLinux ? DEFAULT_LINUX_FONT_FAMILY : DEFAULT_WINDOWS_FONT_FAMILY)),\r\n fontWeight: 'normal',\r\n fontSize: (platform.isMacintosh ? 12 : 14),\r\n lineHeight: 0,\r\n letterSpacing: 0,\r\n};\r\n/**\r\n * @internal\r\n */\r\nexport const EDITOR_MODEL_DEFAULTS = {\r\n tabSize: 4,\r\n indentSize: 4,\r\n insertSpaces: true,\r\n detectIndentation: true,\r\n trimAutoWhitespace: true,\r\n largeFileOptimizations: true\r\n};\r\n/**\r\n * @internal\r\n */\r\nexport const editorOptionsRegistry = [];\r\nfunction register(option) {\r\n editorOptionsRegistry[option.id] = option;\r\n return option;\r\n}\r\n/**\r\n * WORKAROUND: TS emits \"any\" for complex editor options values (anything except string, bool, enum, etc. ends up being \"any\")\r\n * @monacodtsreplace\r\n * /accessibilitySupport, any/accessibilitySupport, AccessibilitySupport/\r\n * /comments, any/comments, EditorCommentsOptions/\r\n * /find, any/find, EditorFindOptions/\r\n * /fontInfo, any/fontInfo, FontInfo/\r\n * /gotoLocation, any/gotoLocation, GoToLocationOptions/\r\n * /hover, any/hover, EditorHoverOptions/\r\n * /lightbulb, any/lightbulb, EditorLightbulbOptions/\r\n * /minimap, any/minimap, EditorMinimapOptions/\r\n * /parameterHints, any/parameterHints, InternalParameterHintOptions/\r\n * /quickSuggestions, any/quickSuggestions, ValidQuickSuggestionsOptions/\r\n * /suggest, any/suggest, InternalSuggestOptions/\r\n */\r\nexport const EditorOptions = {\r\n acceptSuggestionOnCommitCharacter: register(new EditorBooleanOption(0 /* acceptSuggestionOnCommitCharacter */, 'acceptSuggestionOnCommitCharacter', true, { markdownDescription: nls.localize('acceptSuggestionOnCommitCharacter', \"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.\") })),\r\n acceptSuggestionOnEnter: register(new EditorStringEnumOption(1 /* acceptSuggestionOnEnter */, 'acceptSuggestionOnEnter', 'on', ['on', 'smart', 'off'], {\r\n markdownEnumDescriptions: [\r\n '',\r\n nls.localize('acceptSuggestionOnEnterSmart', \"Only accept a suggestion with `Enter` when it makes a textual change.\"),\r\n ''\r\n ],\r\n markdownDescription: nls.localize('acceptSuggestionOnEnter', \"Controls whether suggestions should be accepted on `Enter`, in addition to `Tab`. Helps to avoid ambiguity between inserting new lines or accepting suggestions.\")\r\n })),\r\n accessibilitySupport: register(new EditorAccessibilitySupport()),\r\n accessibilityPageSize: register(new EditorIntOption(3 /* accessibilityPageSize */, 'accessibilityPageSize', 10, 1, 1073741824 /* MAX_SAFE_SMALL_INTEGER */, {\r\n description: nls.localize('accessibilityPageSize', \"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.\")\r\n })),\r\n ariaLabel: register(new EditorStringOption(4 /* ariaLabel */, 'ariaLabel', nls.localize('editorViewAccessibleLabel', \"Editor content\"))),\r\n autoClosingBrackets: register(new EditorStringEnumOption(5 /* autoClosingBrackets */, 'autoClosingBrackets', 'languageDefined', ['always', 'languageDefined', 'beforeWhitespace', 'never'], {\r\n enumDescriptions: [\r\n '',\r\n nls.localize('editor.autoClosingBrackets.languageDefined', \"Use language configurations to determine when to autoclose brackets.\"),\r\n nls.localize('editor.autoClosingBrackets.beforeWhitespace', \"Autoclose brackets only when the cursor is to the left of whitespace.\"),\r\n '',\r\n ],\r\n description: nls.localize('autoClosingBrackets', \"Controls whether the editor should automatically close brackets after the user adds an opening bracket.\")\r\n })),\r\n autoClosingDelete: register(new EditorStringEnumOption(6 /* autoClosingDelete */, 'autoClosingDelete', 'auto', ['always', 'auto', 'never'], {\r\n enumDescriptions: [\r\n '',\r\n nls.localize('editor.autoClosingDelete.auto', \"Remove adjacent closing quotes or brackets only if they were automatically inserted.\"),\r\n '',\r\n ],\r\n description: nls.localize('autoClosingDelete', \"Controls whether the editor should remove adjacent closing quotes or brackets when deleting.\")\r\n })),\r\n autoClosingOvertype: register(new EditorStringEnumOption(7 /* autoClosingOvertype */, 'autoClosingOvertype', 'auto', ['always', 'auto', 'never'], {\r\n enumDescriptions: [\r\n '',\r\n nls.localize('editor.autoClosingOvertype.auto', \"Type over closing quotes or brackets only if they were automatically inserted.\"),\r\n '',\r\n ],\r\n description: nls.localize('autoClosingOvertype', \"Controls whether the editor should type over closing quotes or brackets.\")\r\n })),\r\n autoClosingQuotes: register(new EditorStringEnumOption(8 /* autoClosingQuotes */, 'autoClosingQuotes', 'languageDefined', ['always', 'languageDefined', 'beforeWhitespace', 'never'], {\r\n enumDescriptions: [\r\n '',\r\n nls.localize('editor.autoClosingQuotes.languageDefined', \"Use language configurations to determine when to autoclose quotes.\"),\r\n nls.localize('editor.autoClosingQuotes.beforeWhitespace', \"Autoclose quotes only when the cursor is to the left of whitespace.\"),\r\n '',\r\n ],\r\n description: nls.localize('autoClosingQuotes', \"Controls whether the editor should automatically close quotes after the user adds an opening quote.\")\r\n })),\r\n autoIndent: register(new EditorEnumOption(9 /* autoIndent */, 'autoIndent', 4 /* Full */, 'full', ['none', 'keep', 'brackets', 'advanced', 'full'], _autoIndentFromString, {\r\n enumDescriptions: [\r\n nls.localize('editor.autoIndent.none', \"The editor will not insert indentation automatically.\"),\r\n nls.localize('editor.autoIndent.keep', \"The editor will keep the current line's indentation.\"),\r\n nls.localize('editor.autoIndent.brackets', \"The editor will keep the current line's indentation and honor language defined brackets.\"),\r\n nls.localize('editor.autoIndent.advanced', \"The editor will keep the current line's indentation, honor language defined brackets and invoke special onEnterRules defined by languages.\"),\r\n nls.localize('editor.autoIndent.full', \"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.\"),\r\n ],\r\n description: nls.localize('autoIndent', \"Controls whether the editor should automatically adjust the indentation when users type, paste, move or indent lines.\")\r\n })),\r\n automaticLayout: register(new EditorBooleanOption(10 /* automaticLayout */, 'automaticLayout', false)),\r\n autoSurround: register(new EditorStringEnumOption(11 /* autoSurround */, 'autoSurround', 'languageDefined', ['languageDefined', 'quotes', 'brackets', 'never'], {\r\n enumDescriptions: [\r\n nls.localize('editor.autoSurround.languageDefined', \"Use language configurations to determine when to automatically surround selections.\"),\r\n nls.localize('editor.autoSurround.quotes', \"Surround with quotes but not brackets.\"),\r\n nls.localize('editor.autoSurround.brackets', \"Surround with brackets but not quotes.\"),\r\n ''\r\n ],\r\n description: nls.localize('autoSurround', \"Controls whether the editor should automatically surround selections when typing quotes or brackets.\")\r\n })),\r\n stickyTabStops: register(new EditorBooleanOption(103 /* stickyTabStops */, 'stickyTabStops', false, { description: nls.localize('stickyTabStops', \"Emulate selection behavior of tab characters when using spaces for indentation. Selection will stick to tab stops.\") })),\r\n codeLens: register(new EditorBooleanOption(12 /* codeLens */, 'codeLens', true, { description: nls.localize('codeLens', \"Controls whether the editor shows CodeLens.\") })),\r\n codeLensFontFamily: register(new EditorStringOption(13 /* codeLensFontFamily */, 'codeLensFontFamily', '', { description: nls.localize('codeLensFontFamily', \"Controls the font family for CodeLens.\") })),\r\n codeLensFontSize: register(new EditorIntOption(14 /* codeLensFontSize */, 'codeLensFontSize', 0, 0, 100, {\r\n type: 'number',\r\n default: 0,\r\n minimum: 0,\r\n maximum: 100,\r\n markdownDescription: nls.localize('codeLensFontSize', \"Controls the font size in pixels for CodeLens. When set to `0`, the 90% of `#editor.fontSize#` is used.\")\r\n })),\r\n colorDecorators: register(new EditorBooleanOption(15 /* colorDecorators */, 'colorDecorators', true, { description: nls.localize('colorDecorators', \"Controls whether the editor should render the inline color decorators and color picker.\") })),\r\n columnSelection: register(new EditorBooleanOption(16 /* columnSelection */, 'columnSelection', false, { description: nls.localize('columnSelection', \"Enable that the selection with the mouse and keys is doing column selection.\") })),\r\n comments: register(new EditorComments()),\r\n contextmenu: register(new EditorBooleanOption(18 /* contextmenu */, 'contextmenu', true)),\r\n copyWithSyntaxHighlighting: register(new EditorBooleanOption(19 /* copyWithSyntaxHighlighting */, 'copyWithSyntaxHighlighting', true, { description: nls.localize('copyWithSyntaxHighlighting', \"Controls whether syntax highlighting should be copied into the clipboard.\") })),\r\n cursorBlinking: register(new EditorEnumOption(20 /* cursorBlinking */, 'cursorBlinking', 1 /* Blink */, 'blink', ['blink', 'smooth', 'phase', 'expand', 'solid'], _cursorBlinkingStyleFromString, { description: nls.localize('cursorBlinking', \"Control the cursor animation style.\") })),\r\n cursorSmoothCaretAnimation: register(new EditorBooleanOption(21 /* cursorSmoothCaretAnimation */, 'cursorSmoothCaretAnimation', false, { description: nls.localize('cursorSmoothCaretAnimation', \"Controls whether the smooth caret animation should be enabled.\") })),\r\n cursorStyle: register(new EditorEnumOption(22 /* cursorStyle */, 'cursorStyle', TextEditorCursorStyle.Line, 'line', ['line', 'block', 'underline', 'line-thin', 'block-outline', 'underline-thin'], _cursorStyleFromString, { description: nls.localize('cursorStyle', \"Controls the cursor style.\") })),\r\n cursorSurroundingLines: register(new EditorIntOption(23 /* cursorSurroundingLines */, 'cursorSurroundingLines', 0, 0, 1073741824 /* MAX_SAFE_SMALL_INTEGER */, { description: nls.localize('cursorSurroundingLines', \"Controls the minimal number of visible leading and trailing lines surrounding the cursor. Known as 'scrollOff' or 'scrollOffset' in some other editors.\") })),\r\n cursorSurroundingLinesStyle: register(new EditorStringEnumOption(24 /* cursorSurroundingLinesStyle */, 'cursorSurroundingLinesStyle', 'default', ['default', 'all'], {\r\n enumDescriptions: [\r\n nls.localize('cursorSurroundingLinesStyle.default', \"`cursorSurroundingLines` is enforced only when triggered via the keyboard or API.\"),\r\n nls.localize('cursorSurroundingLinesStyle.all', \"`cursorSurroundingLines` is enforced always.\")\r\n ],\r\n description: nls.localize('cursorSurroundingLinesStyle', \"Controls when `cursorSurroundingLines` should be enforced.\")\r\n })),\r\n cursorWidth: register(new EditorIntOption(25 /* cursorWidth */, 'cursorWidth', 0, 0, 1073741824 /* MAX_SAFE_SMALL_INTEGER */, { markdownDescription: nls.localize('cursorWidth', \"Controls the width of the cursor when `#editor.cursorStyle#` is set to `line`.\") })),\r\n disableLayerHinting: register(new EditorBooleanOption(26 /* disableLayerHinting */, 'disableLayerHinting', false)),\r\n disableMonospaceOptimizations: register(new EditorBooleanOption(27 /* disableMonospaceOptimizations */, 'disableMonospaceOptimizations', false)),\r\n domReadOnly: register(new EditorBooleanOption(28 /* domReadOnly */, 'domReadOnly', false)),\r\n dragAndDrop: register(new EditorBooleanOption(29 /* dragAndDrop */, 'dragAndDrop', true, { description: nls.localize('dragAndDrop', \"Controls whether the editor should allow moving selections via drag and drop.\") })),\r\n emptySelectionClipboard: register(new EditorEmptySelectionClipboard()),\r\n extraEditorClassName: register(new EditorStringOption(31 /* extraEditorClassName */, 'extraEditorClassName', '')),\r\n fastScrollSensitivity: register(new EditorFloatOption(32 /* fastScrollSensitivity */, 'fastScrollSensitivity', 5, x => (x <= 0 ? 5 : x), { markdownDescription: nls.localize('fastScrollSensitivity', \"Scrolling speed multiplier when pressing `Alt`.\") })),\r\n find: register(new EditorFind()),\r\n fixedOverflowWidgets: register(new EditorBooleanOption(34 /* fixedOverflowWidgets */, 'fixedOverflowWidgets', false)),\r\n folding: register(new EditorBooleanOption(35 /* folding */, 'folding', true, { description: nls.localize('folding', \"Controls whether the editor has code folding enabled.\") })),\r\n foldingStrategy: register(new EditorStringEnumOption(36 /* foldingStrategy */, 'foldingStrategy', 'auto', ['auto', 'indentation'], {\r\n enumDescriptions: [\r\n nls.localize('foldingStrategy.auto', \"Use a language-specific folding strategy if available, else the indentation-based one.\"),\r\n nls.localize('foldingStrategy.indentation', \"Use the indentation-based folding strategy.\"),\r\n ],\r\n description: nls.localize('foldingStrategy', \"Controls the strategy for computing folding ranges.\")\r\n })),\r\n foldingHighlight: register(new EditorBooleanOption(37 /* foldingHighlight */, 'foldingHighlight', true, { description: nls.localize('foldingHighlight', \"Controls whether the editor should highlight folded ranges.\") })),\r\n foldingImportsByDefault: register(new EditorBooleanOption(38 /* foldingImportsByDefault */, 'foldingImportsByDefault', false, { description: nls.localize('foldingImportsByDefault', \"Controls whether the editor automatically collapses import ranges.\") })),\r\n unfoldOnClickAfterEndOfLine: register(new EditorBooleanOption(39 /* unfoldOnClickAfterEndOfLine */, 'unfoldOnClickAfterEndOfLine', false, { description: nls.localize('unfoldOnClickAfterEndOfLine', \"Controls whether clicking on the empty content after a folded line will unfold the line.\") })),\r\n fontFamily: register(new EditorStringOption(40 /* fontFamily */, 'fontFamily', EDITOR_FONT_DEFAULTS.fontFamily, { description: nls.localize('fontFamily', \"Controls the font family.\") })),\r\n fontInfo: register(new EditorFontInfo()),\r\n fontLigatures2: register(new EditorFontLigatures()),\r\n fontSize: register(new EditorFontSize()),\r\n fontWeight: register(new EditorFontWeight()),\r\n formatOnPaste: register(new EditorBooleanOption(45 /* formatOnPaste */, 'formatOnPaste', false, { description: nls.localize('formatOnPaste', \"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.\") })),\r\n formatOnType: register(new EditorBooleanOption(46 /* formatOnType */, 'formatOnType', false, { description: nls.localize('formatOnType', \"Controls whether the editor should automatically format the line after typing.\") })),\r\n glyphMargin: register(new EditorBooleanOption(47 /* glyphMargin */, 'glyphMargin', true, { description: nls.localize('glyphMargin', \"Controls whether the editor should render the vertical glyph margin. Glyph margin is mostly used for debugging.\") })),\r\n gotoLocation: register(new EditorGoToLocation()),\r\n hideCursorInOverviewRuler: register(new EditorBooleanOption(49 /* hideCursorInOverviewRuler */, 'hideCursorInOverviewRuler', false, { description: nls.localize('hideCursorInOverviewRuler', \"Controls whether the cursor should be hidden in the overview ruler.\") })),\r\n highlightActiveIndentGuide: register(new EditorBooleanOption(50 /* highlightActiveIndentGuide */, 'highlightActiveIndentGuide', true, { description: nls.localize('highlightActiveIndentGuide', \"Controls whether the editor should highlight the active indent guide.\") })),\r\n hover: register(new EditorHover()),\r\n inDiffEditor: register(new EditorBooleanOption(52 /* inDiffEditor */, 'inDiffEditor', false)),\r\n letterSpacing: register(new EditorFloatOption(54 /* letterSpacing */, 'letterSpacing', EDITOR_FONT_DEFAULTS.letterSpacing, x => EditorFloatOption.clamp(x, -5, 20), { description: nls.localize('letterSpacing', \"Controls the letter spacing in pixels.\") })),\r\n lightbulb: register(new EditorLightbulb()),\r\n lineDecorationsWidth: register(new SimpleEditorOption(56 /* lineDecorationsWidth */, 'lineDecorationsWidth', 10)),\r\n lineHeight: register(new EditorLineHeight()),\r\n lineNumbers: register(new EditorRenderLineNumbersOption()),\r\n lineNumbersMinChars: register(new EditorIntOption(59 /* lineNumbersMinChars */, 'lineNumbersMinChars', 5, 1, 300)),\r\n linkedEditing: register(new EditorBooleanOption(60 /* linkedEditing */, 'linkedEditing', false, { description: nls.localize('linkedEditing', \"Controls whether the editor has linked editing enabled. Depending on the language, related symbols, e.g. HTML tags, are updated while editing.\") })),\r\n links: register(new EditorBooleanOption(61 /* links */, 'links', true, { description: nls.localize('links', \"Controls whether the editor should detect links and make them clickable.\") })),\r\n matchBrackets: register(new EditorStringEnumOption(62 /* matchBrackets */, 'matchBrackets', 'always', ['always', 'near', 'never'], { description: nls.localize('matchBrackets', \"Highlight matching brackets.\") })),\r\n minimap: register(new EditorMinimap()),\r\n mouseStyle: register(new EditorStringEnumOption(64 /* mouseStyle */, 'mouseStyle', 'text', ['text', 'default', 'copy'])),\r\n mouseWheelScrollSensitivity: register(new EditorFloatOption(65 /* mouseWheelScrollSensitivity */, 'mouseWheelScrollSensitivity', 1, x => (x === 0 ? 1 : x), { markdownDescription: nls.localize('mouseWheelScrollSensitivity', \"A multiplier to be used on the `deltaX` and `deltaY` of mouse wheel scroll events.\") })),\r\n mouseWheelZoom: register(new EditorBooleanOption(66 /* mouseWheelZoom */, 'mouseWheelZoom', false, { markdownDescription: nls.localize('mouseWheelZoom', \"Zoom the font of the editor when using mouse wheel and holding `Ctrl`.\") })),\r\n multiCursorMergeOverlapping: register(new EditorBooleanOption(67 /* multiCursorMergeOverlapping */, 'multiCursorMergeOverlapping', true, { description: nls.localize('multiCursorMergeOverlapping', \"Merge multiple cursors when they are overlapping.\") })),\r\n multiCursorModifier: register(new EditorEnumOption(68 /* multiCursorModifier */, 'multiCursorModifier', 'altKey', 'alt', ['ctrlCmd', 'alt'], _multiCursorModifierFromString, {\r\n markdownEnumDescriptions: [\r\n nls.localize('multiCursorModifier.ctrlCmd', \"Maps to `Control` on Windows and Linux and to `Command` on macOS.\"),\r\n nls.localize('multiCursorModifier.alt', \"Maps to `Alt` on Windows and Linux and to `Option` on macOS.\")\r\n ],\r\n markdownDescription: nls.localize({\r\n key: 'multiCursorModifier',\r\n comment: [\r\n '- `ctrlCmd` refers to a value the setting can take and should not be localized.',\r\n '- `Control` and `Command` refer to the modifier keys Ctrl or Cmd on the keyboard and can be localized.'\r\n ]\r\n }, \"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. [Read more](https://code.visualstudio.com/docs/editor/codebasics#_multicursor-modifier).\")\r\n })),\r\n multiCursorPaste: register(new EditorStringEnumOption(69 /* multiCursorPaste */, 'multiCursorPaste', 'spread', ['spread', 'full'], {\r\n markdownEnumDescriptions: [\r\n nls.localize('multiCursorPaste.spread', \"Each cursor pastes a single line of the text.\"),\r\n nls.localize('multiCursorPaste.full', \"Each cursor pastes the full text.\")\r\n ],\r\n markdownDescription: nls.localize('multiCursorPaste', \"Controls pasting when the line count of the pasted text matches the cursor count.\")\r\n })),\r\n occurrencesHighlight: register(new EditorBooleanOption(70 /* occurrencesHighlight */, 'occurrencesHighlight', true, { description: nls.localize('occurrencesHighlight', \"Controls whether the editor should highlight semantic symbol occurrences.\") })),\r\n overviewRulerBorder: register(new EditorBooleanOption(71 /* overviewRulerBorder */, 'overviewRulerBorder', true, { description: nls.localize('overviewRulerBorder', \"Controls whether a border should be drawn around the overview ruler.\") })),\r\n overviewRulerLanes: register(new EditorIntOption(72 /* overviewRulerLanes */, 'overviewRulerLanes', 3, 0, 3)),\r\n padding: register(new EditorPadding()),\r\n parameterHints: register(new EditorParameterHints()),\r\n peekWidgetDefaultFocus: register(new EditorStringEnumOption(75 /* peekWidgetDefaultFocus */, 'peekWidgetDefaultFocus', 'tree', ['tree', 'editor'], {\r\n enumDescriptions: [\r\n nls.localize('peekWidgetDefaultFocus.tree', \"Focus the tree when opening peek\"),\r\n nls.localize('peekWidgetDefaultFocus.editor', \"Focus the editor when opening peek\")\r\n ],\r\n description: nls.localize('peekWidgetDefaultFocus', \"Controls whether to focus the inline editor or the tree in the peek widget.\")\r\n })),\r\n definitionLinkOpensInPeek: register(new EditorBooleanOption(76 /* definitionLinkOpensInPeek */, 'definitionLinkOpensInPeek', false, { description: nls.localize('definitionLinkOpensInPeek', \"Controls whether the Go to Definition mouse gesture always opens the peek widget.\") })),\r\n quickSuggestions: register(new EditorQuickSuggestions()),\r\n quickSuggestionsDelay: register(new EditorIntOption(78 /* quickSuggestionsDelay */, 'quickSuggestionsDelay', 10, 0, 1073741824 /* MAX_SAFE_SMALL_INTEGER */, { description: nls.localize('quickSuggestionsDelay', \"Controls the delay in milliseconds after which quick suggestions will show up.\") })),\r\n readOnly: register(new EditorBooleanOption(79 /* readOnly */, 'readOnly', false)),\r\n renameOnType: register(new EditorBooleanOption(80 /* renameOnType */, 'renameOnType', false, { description: nls.localize('renameOnType', \"Controls whether the editor auto renames on type.\"), markdownDeprecationMessage: nls.localize('renameOnTypeDeprecate', \"Deprecated, use `editor.linkedEditing` instead.\") })),\r\n renderControlCharacters: register(new EditorBooleanOption(81 /* renderControlCharacters */, 'renderControlCharacters', false, { description: nls.localize('renderControlCharacters', \"Controls whether the editor should render control characters.\") })),\r\n renderIndentGuides: register(new EditorBooleanOption(82 /* renderIndentGuides */, 'renderIndentGuides', true, { description: nls.localize('renderIndentGuides', \"Controls whether the editor should render indent guides.\") })),\r\n renderFinalNewline: register(new EditorBooleanOption(83 /* renderFinalNewline */, 'renderFinalNewline', true, { description: nls.localize('renderFinalNewline', \"Render last line number when the file ends with a newline.\") })),\r\n renderLineHighlight: register(new EditorStringEnumOption(84 /* renderLineHighlight */, 'renderLineHighlight', 'line', ['none', 'gutter', 'line', 'all'], {\r\n enumDescriptions: [\r\n '',\r\n '',\r\n '',\r\n nls.localize('renderLineHighlight.all', \"Highlights both the gutter and the current line.\"),\r\n ],\r\n description: nls.localize('renderLineHighlight', \"Controls how the editor should render the current line highlight.\")\r\n })),\r\n renderLineHighlightOnlyWhenFocus: register(new EditorBooleanOption(85 /* renderLineHighlightOnlyWhenFocus */, 'renderLineHighlightOnlyWhenFocus', false, { description: nls.localize('renderLineHighlightOnlyWhenFocus', \"Controls if the editor should render the current line highlight only when the editor is focused.\") })),\r\n renderValidationDecorations: register(new EditorStringEnumOption(86 /* renderValidationDecorations */, 'renderValidationDecorations', 'editable', ['editable', 'on', 'off'])),\r\n renderWhitespace: register(new EditorStringEnumOption(87 /* renderWhitespace */, 'renderWhitespace', 'selection', ['none', 'boundary', 'selection', 'trailing', 'all'], {\r\n enumDescriptions: [\r\n '',\r\n nls.localize('renderWhitespace.boundary', \"Render whitespace characters except for single spaces between words.\"),\r\n nls.localize('renderWhitespace.selection', \"Render whitespace characters only on selected text.\"),\r\n nls.localize('renderWhitespace.trailing', \"Render only trailing whitespace characters.\"),\r\n ''\r\n ],\r\n description: nls.localize('renderWhitespace', \"Controls how the editor should render whitespace characters.\")\r\n })),\r\n revealHorizontalRightPadding: register(new EditorIntOption(88 /* revealHorizontalRightPadding */, 'revealHorizontalRightPadding', 30, 0, 1000)),\r\n roundedSelection: register(new EditorBooleanOption(89 /* roundedSelection */, 'roundedSelection', true, { description: nls.localize('roundedSelection', \"Controls whether selections should have rounded corners.\") })),\r\n rulers: register(new EditorRulers()),\r\n scrollbar: register(new EditorScrollbar()),\r\n scrollBeyondLastColumn: register(new EditorIntOption(92 /* scrollBeyondLastColumn */, 'scrollBeyondLastColumn', 5, 0, 1073741824 /* MAX_SAFE_SMALL_INTEGER */, { description: nls.localize('scrollBeyondLastColumn', \"Controls the number of extra characters beyond which the editor will scroll horizontally.\") })),\r\n scrollBeyondLastLine: register(new EditorBooleanOption(93 /* scrollBeyondLastLine */, 'scrollBeyondLastLine', true, { description: nls.localize('scrollBeyondLastLine', \"Controls whether the editor will scroll beyond the last line.\") })),\r\n scrollPredominantAxis: register(new EditorBooleanOption(94 /* scrollPredominantAxis */, 'scrollPredominantAxis', true, { description: nls.localize('scrollPredominantAxis', \"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.\") })),\r\n selectionClipboard: register(new EditorBooleanOption(95 /* selectionClipboard */, 'selectionClipboard', true, {\r\n description: nls.localize('selectionClipboard', \"Controls whether the Linux primary clipboard should be supported.\"),\r\n included: platform.isLinux\r\n })),\r\n selectionHighlight: register(new EditorBooleanOption(96 /* selectionHighlight */, 'selectionHighlight', true, { description: nls.localize('selectionHighlight', \"Controls whether the editor should highlight matches similar to the selection.\") })),\r\n selectOnLineNumbers: register(new EditorBooleanOption(97 /* selectOnLineNumbers */, 'selectOnLineNumbers', true)),\r\n showFoldingControls: register(new EditorStringEnumOption(98 /* showFoldingControls */, 'showFoldingControls', 'mouseover', ['always', 'mouseover'], {\r\n enumDescriptions: [\r\n nls.localize('showFoldingControls.always', \"Always show the folding controls.\"),\r\n nls.localize('showFoldingControls.mouseover', \"Only show the folding controls when the mouse is over the gutter.\"),\r\n ],\r\n description: nls.localize('showFoldingControls', \"Controls when the folding controls on the gutter are shown.\")\r\n })),\r\n showUnused: register(new EditorBooleanOption(99 /* showUnused */, 'showUnused', true, { description: nls.localize('showUnused', \"Controls fading out of unused code.\") })),\r\n showDeprecated: register(new EditorBooleanOption(124 /* showDeprecated */, 'showDeprecated', true, { description: nls.localize('showDeprecated', \"Controls strikethrough deprecated variables.\") })),\r\n inlayHints: register(new EditorInlayHints()),\r\n snippetSuggestions: register(new EditorStringEnumOption(100 /* snippetSuggestions */, 'snippetSuggestions', 'inline', ['top', 'bottom', 'inline', 'none'], {\r\n enumDescriptions: [\r\n nls.localize('snippetSuggestions.top', \"Show snippet suggestions on top of other suggestions.\"),\r\n nls.localize('snippetSuggestions.bottom', \"Show snippet suggestions below other suggestions.\"),\r\n nls.localize('snippetSuggestions.inline', \"Show snippets suggestions with other suggestions.\"),\r\n nls.localize('snippetSuggestions.none', \"Do not show snippet suggestions.\"),\r\n ],\r\n description: nls.localize('snippetSuggestions', \"Controls whether snippets are shown with other suggestions and how they are sorted.\")\r\n })),\r\n smartSelect: register(new SmartSelect()),\r\n smoothScrolling: register(new EditorBooleanOption(102 /* smoothScrolling */, 'smoothScrolling', false, { description: nls.localize('smoothScrolling', \"Controls whether the editor will scroll using an animation.\") })),\r\n stopRenderingLineAfter: register(new EditorIntOption(104 /* stopRenderingLineAfter */, 'stopRenderingLineAfter', 10000, -1, 1073741824 /* MAX_SAFE_SMALL_INTEGER */)),\r\n suggest: register(new EditorSuggest()),\r\n inlineSuggest: register(new InlineEditorSuggest()),\r\n suggestFontSize: register(new EditorIntOption(106 /* suggestFontSize */, 'suggestFontSize', 0, 0, 1000, { markdownDescription: nls.localize('suggestFontSize', \"Font size for the suggest widget. When set to `0`, the value of `#editor.fontSize#` is used.\") })),\r\n suggestLineHeight: register(new EditorIntOption(107 /* suggestLineHeight */, 'suggestLineHeight', 0, 0, 1000, { markdownDescription: nls.localize('suggestLineHeight', \"Line height for the suggest widget. When set to `0`, the value of `#editor.lineHeight#` is used. The minimum value is 8.\") })),\r\n suggestOnTriggerCharacters: register(new EditorBooleanOption(108 /* suggestOnTriggerCharacters */, 'suggestOnTriggerCharacters', true, { description: nls.localize('suggestOnTriggerCharacters', \"Controls whether suggestions should automatically show up when typing trigger characters.\") })),\r\n suggestSelection: register(new EditorStringEnumOption(109 /* suggestSelection */, 'suggestSelection', 'recentlyUsed', ['first', 'recentlyUsed', 'recentlyUsedByPrefix'], {\r\n markdownEnumDescriptions: [\r\n nls.localize('suggestSelection.first', \"Always select the first suggestion.\"),\r\n nls.localize('suggestSelection.recentlyUsed', \"Select recent suggestions unless further typing selects one, e.g. `console.| -> console.log` because `log` has been completed recently.\"),\r\n nls.localize('suggestSelection.recentlyUsedByPrefix', \"Select suggestions based on previous prefixes that have completed those suggestions, e.g. `co -> console` and `con -> const`.\"),\r\n ],\r\n description: nls.localize('suggestSelection', \"Controls how suggestions are pre-selected when showing the suggest list.\")\r\n })),\r\n tabCompletion: register(new EditorStringEnumOption(110 /* tabCompletion */, 'tabCompletion', 'off', ['on', 'off', 'onlySnippets'], {\r\n enumDescriptions: [\r\n nls.localize('tabCompletion.on', \"Tab complete will insert the best matching suggestion when pressing tab.\"),\r\n nls.localize('tabCompletion.off', \"Disable tab completions.\"),\r\n nls.localize('tabCompletion.onlySnippets', \"Tab complete snippets when their prefix match. Works best when 'quickSuggestions' aren't enabled.\"),\r\n ],\r\n description: nls.localize('tabCompletion', \"Enables tab completions.\")\r\n })),\r\n tabIndex: register(new EditorIntOption(111 /* tabIndex */, 'tabIndex', 0, -1, 1073741824 /* MAX_SAFE_SMALL_INTEGER */)),\r\n unusualLineTerminators: register(new EditorStringEnumOption(112 /* unusualLineTerminators */, 'unusualLineTerminators', 'prompt', ['auto', 'off', 'prompt'], {\r\n enumDescriptions: [\r\n nls.localize('unusualLineTerminators.auto', \"Unusual line terminators are automatically removed.\"),\r\n nls.localize('unusualLineTerminators.off', \"Unusual line terminators are ignored.\"),\r\n nls.localize('unusualLineTerminators.prompt', \"Unusual line terminators prompt to be removed.\"),\r\n ],\r\n description: nls.localize('unusualLineTerminators', \"Remove unusual line terminators that might cause problems.\")\r\n })),\r\n useShadowDOM: register(new EditorBooleanOption(113 /* useShadowDOM */, 'useShadowDOM', true)),\r\n useTabStops: register(new EditorBooleanOption(114 /* useTabStops */, 'useTabStops', true, { description: nls.localize('useTabStops', \"Inserting and deleting whitespace follows tab stops.\") })),\r\n wordSeparators: register(new EditorStringOption(115 /* wordSeparators */, 'wordSeparators', USUAL_WORD_SEPARATORS, { description: nls.localize('wordSeparators', \"Characters that will be used as word separators when doing word related navigations or operations.\") })),\r\n wordWrap: register(new EditorStringEnumOption(116 /* wordWrap */, 'wordWrap', 'off', ['off', 'on', 'wordWrapColumn', 'bounded'], {\r\n markdownEnumDescriptions: [\r\n nls.localize('wordWrap.off', \"Lines will never wrap.\"),\r\n nls.localize('wordWrap.on', \"Lines will wrap at the viewport width.\"),\r\n nls.localize({\r\n key: 'wordWrap.wordWrapColumn',\r\n comment: [\r\n '- `editor.wordWrapColumn` refers to a different setting and should not be localized.'\r\n ]\r\n }, \"Lines will wrap at `#editor.wordWrapColumn#`.\"),\r\n nls.localize({\r\n key: 'wordWrap.bounded',\r\n comment: [\r\n '- viewport means the edge of the visible window size.',\r\n '- `editor.wordWrapColumn` refers to a different setting and should not be localized.'\r\n ]\r\n }, \"Lines will wrap at the minimum of viewport and `#editor.wordWrapColumn#`.\"),\r\n ],\r\n description: nls.localize({\r\n key: 'wordWrap',\r\n comment: [\r\n '- \\'off\\', \\'on\\', \\'wordWrapColumn\\' and \\'bounded\\' refer to values the setting can take and should not be localized.',\r\n '- `editor.wordWrapColumn` refers to a different setting and should not be localized.'\r\n ]\r\n }, \"Controls how lines should wrap.\")\r\n })),\r\n wordWrapBreakAfterCharacters: register(new EditorStringOption(117 /* wordWrapBreakAfterCharacters */, 'wordWrapBreakAfterCharacters', ' \\t})]?|/&.,;\u00A2\u00B0\u2032\u2033\u2030\u2103\u3001\u3002\uFF61\uFF64\uFFE0\uFF0C\uFF0E\uFF1A\uFF1B\uFF1F\uFF01\uFF05\u30FB\uFF65\u309D\u309E\u30FD\u30FE\u30FC\u30A1\u30A3\u30A5\u30A7\u30A9\u30C3\u30E3\u30E5\u30E7\u30EE\u30F5\u30F6\u3041\u3043\u3045\u3047\u3049\u3063\u3083\u3085\u3087\u308E\u3095\u3096\u31F0\u31F1\u31F2\u31F3\u31F4\u31F5\u31F6\u31F7\u31F8\u31F9\u31FA\u31FB\u31FC\u31FD\u31FE\u31FF\u3005\u303B\uFF67\uFF68\uFF69\uFF6A\uFF6B\uFF6C\uFF6D\uFF6E\uFF6F\uFF70\u201D\u3009\u300B\u300D\u300F\u3011\u3015\uFF09\uFF3D\uFF5D\uFF63')),\r\n wordWrapBreakBeforeCharacters: register(new EditorStringOption(118 /* wordWrapBreakBeforeCharacters */, 'wordWrapBreakBeforeCharacters', '([{\u2018\u201C\u3008\u300A\u300C\u300E\u3010\u3014\uFF08\uFF3B\uFF5B\uFF62\u00A3\u00A5\uFF04\uFFE1\uFFE5+\uFF0B')),\r\n wordWrapColumn: register(new EditorIntOption(119 /* wordWrapColumn */, 'wordWrapColumn', 80, 1, 1073741824 /* MAX_SAFE_SMALL_INTEGER */, {\r\n markdownDescription: nls.localize({\r\n key: 'wordWrapColumn',\r\n comment: [\r\n '- `editor.wordWrap` refers to a different setting and should not be localized.',\r\n '- \\'wordWrapColumn\\' and \\'bounded\\' refer to values the different setting can take and should not be localized.'\r\n ]\r\n }, \"Controls the wrapping column of the editor when `#editor.wordWrap#` is `wordWrapColumn` or `bounded`.\")\r\n })),\r\n wordWrapOverride1: register(new EditorStringEnumOption(120 /* wordWrapOverride1 */, 'wordWrapOverride1', 'inherit', ['off', 'on', 'inherit'])),\r\n wordWrapOverride2: register(new EditorStringEnumOption(121 /* wordWrapOverride2 */, 'wordWrapOverride2', 'inherit', ['off', 'on', 'inherit'])),\r\n wrappingIndent: register(new EditorEnumOption(122 /* wrappingIndent */, 'wrappingIndent', 1 /* Same */, 'same', ['none', 'same', 'indent', 'deepIndent'], _wrappingIndentFromString, {\r\n enumDescriptions: [\r\n nls.localize('wrappingIndent.none', \"No indentation. Wrapped lines begin at column 1.\"),\r\n nls.localize('wrappingIndent.same', \"Wrapped lines get the same indentation as the parent.\"),\r\n nls.localize('wrappingIndent.indent', \"Wrapped lines get +1 indentation toward the parent.\"),\r\n nls.localize('wrappingIndent.deepIndent', \"Wrapped lines get +2 indentation toward the parent.\"),\r\n ],\r\n description: nls.localize('wrappingIndent', \"Controls the indentation of wrapped lines.\"),\r\n })),\r\n wrappingStrategy: register(new EditorStringEnumOption(123 /* wrappingStrategy */, 'wrappingStrategy', 'simple', ['simple', 'advanced'], {\r\n enumDescriptions: [\r\n nls.localize('wrappingStrategy.simple', \"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.\"),\r\n nls.localize('wrappingStrategy.advanced', \"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.\")\r\n ],\r\n description: nls.localize('wrappingStrategy', \"Controls the algorithm that computes wrapping points.\")\r\n })),\r\n // Leave these at the end (because they have dependencies!)\r\n editorClassName: register(new EditorClassName()),\r\n pixelRatio: register(new EditorPixelRatio()),\r\n tabFocusMode: register(new EditorTabFocusMode()),\r\n layoutInfo: register(new EditorLayoutInfoComputer()),\r\n wrappingInfo: register(new EditorWrappingInfoComputer())\r\n};\r\n", "/**\r\n * Vertical Lane in the overview ruler of the editor.\r\n */\r\nexport var OverviewRulerLane;\r\n(function (OverviewRulerLane) {\r\n OverviewRulerLane[OverviewRulerLane[\"Left\"] = 1] = \"Left\";\r\n OverviewRulerLane[OverviewRulerLane[\"Center\"] = 2] = \"Center\";\r\n OverviewRulerLane[OverviewRulerLane[\"Right\"] = 4] = \"Right\";\r\n OverviewRulerLane[OverviewRulerLane[\"Full\"] = 7] = \"Full\";\r\n})(OverviewRulerLane || (OverviewRulerLane = {}));\r\n/**\r\n * Position in the minimap to render the decoration.\r\n */\r\nexport var MinimapPosition;\r\n(function (MinimapPosition) {\r\n MinimapPosition[MinimapPosition[\"Inline\"] = 1] = \"Inline\";\r\n MinimapPosition[MinimapPosition[\"Gutter\"] = 2] = \"Gutter\";\r\n})(MinimapPosition || (MinimapPosition = {}));\r\nexport class TextModelResolvedOptions {\r\n /**\r\n * @internal\r\n */\r\n constructor(src) {\r\n this._textModelResolvedOptionsBrand = undefined;\r\n this.tabSize = Math.max(1, src.tabSize | 0);\r\n this.indentSize = src.tabSize | 0;\r\n this.insertSpaces = Boolean(src.insertSpaces);\r\n this.defaultEOL = src.defaultEOL | 0;\r\n this.trimAutoWhitespace = Boolean(src.trimAutoWhitespace);\r\n }\r\n /**\r\n * @internal\r\n */\r\n equals(other) {\r\n return (this.tabSize === other.tabSize\r\n && this.indentSize === other.indentSize\r\n && this.insertSpaces === other.insertSpaces\r\n && this.defaultEOL === other.defaultEOL\r\n && this.trimAutoWhitespace === other.trimAutoWhitespace);\r\n }\r\n /**\r\n * @internal\r\n */\r\n createChangeEvent(newOpts) {\r\n return {\r\n tabSize: this.tabSize !== newOpts.tabSize,\r\n indentSize: this.indentSize !== newOpts.indentSize,\r\n insertSpaces: this.insertSpaces !== newOpts.insertSpaces,\r\n trimAutoWhitespace: this.trimAutoWhitespace !== newOpts.trimAutoWhitespace,\r\n };\r\n }\r\n}\r\nexport class FindMatch {\r\n /**\r\n * @internal\r\n */\r\n constructor(range, matches) {\r\n this._findMatchBrand = undefined;\r\n this.range = range;\r\n this.matches = matches;\r\n }\r\n}\r\n/**\r\n * @internal\r\n */\r\nexport class ValidAnnotatedEditOperation {\r\n constructor(identifier, range, text, forceMoveMarkers, isAutoWhitespaceEdit, _isTracked) {\r\n this.identifier = identifier;\r\n this.range = range;\r\n this.text = text;\r\n this.forceMoveMarkers = forceMoveMarkers;\r\n this.isAutoWhitespaceEdit = isAutoWhitespaceEdit;\r\n this._isTracked = _isTracked;\r\n }\r\n}\r\n/**\r\n * @internal\r\n */\r\nexport class ApplyEditsResult {\r\n constructor(reverseEdits, changes, trimAutoWhitespaceLineNumbers) {\r\n this.reverseEdits = reverseEdits;\r\n this.changes = changes;\r\n this.trimAutoWhitespaceLineNumbers = trimAutoWhitespaceLineNumbers;\r\n }\r\n}\r\n", "/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License. See License.txt in the project root for license information.\r\n *--------------------------------------------------------------------------------------------*/\r\nimport * as strings from './strings.js';\r\nconst hasBuffer = (typeof Buffer !== 'undefined');\r\nconst hasTextDecoder = (typeof TextDecoder !== 'undefined');\r\nlet textDecoder;\r\nexport class VSBuffer {\r\n constructor(buffer) {\r\n this.buffer = buffer;\r\n this.byteLength = this.buffer.byteLength;\r\n }\r\n static wrap(actual) {\r\n if (hasBuffer && !(Buffer.isBuffer(actual))) {\r\n // https://nodejs.org/dist/latest-v10.x/docs/api/buffer.html#buffer_class_method_buffer_from_arraybuffer_byteoffset_length\r\n // Create a zero-copy Buffer wrapper around the ArrayBuffer pointed to by the Uint8Array\r\n actual = Buffer.from(actual.buffer, actual.byteOffset, actual.byteLength);\r\n }\r\n return new VSBuffer(actual);\r\n }\r\n toString() {\r\n if (hasBuffer) {\r\n return this.buffer.toString();\r\n }\r\n else if (hasTextDecoder) {\r\n if (!textDecoder) {\r\n textDecoder = new TextDecoder();\r\n }\r\n return textDecoder.decode(this.buffer);\r\n }\r\n else {\r\n return strings.decodeUTF8(this.buffer);\r\n }\r\n }\r\n}\r\nexport function readUInt16LE(source, offset) {\r\n return (((source[offset + 0] << 0) >>> 0) |\r\n ((source[offset + 1] << 8) >>> 0));\r\n}\r\nexport function writeUInt16LE(destination, value, offset) {\r\n destination[offset + 0] = (value & 0b11111111);\r\n value = value >>> 8;\r\n destination[offset + 1] = (value & 0b11111111);\r\n}\r\nexport function readUInt32BE(source, offset) {\r\n return (source[offset] * Math.pow(2, 24)\r\n + source[offset + 1] * Math.pow(2, 16)\r\n + source[offset + 2] * Math.pow(2, 8)\r\n + source[offset + 3]);\r\n}\r\nexport function writeUInt32BE(destination, value, offset) {\r\n destination[offset + 3] = value;\r\n value = value >>> 8;\r\n destination[offset + 2] = value;\r\n value = value >>> 8;\r\n destination[offset + 1] = value;\r\n value = value >>> 8;\r\n destination[offset] = value;\r\n}\r\nexport function readUInt8(source, offset) {\r\n return source[offset];\r\n}\r\nexport function writeUInt8(destination, value, offset) {\r\n destination[offset] = value;\r\n}\r\n", "/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License. See License.txt in the project root for license information.\r\n *--------------------------------------------------------------------------------------------*/\r\nimport * as strings from '../../../base/common/strings.js';\r\nimport * as platform from '../../../base/common/platform.js';\r\nimport * as buffer from '../../../base/common/buffer.js';\r\nlet _utf16LE_TextDecoder;\r\nfunction getUTF16LE_TextDecoder() {\r\n if (!_utf16LE_TextDecoder) {\r\n _utf16LE_TextDecoder = new TextDecoder('UTF-16LE');\r\n }\r\n return _utf16LE_TextDecoder;\r\n}\r\nlet _utf16BE_TextDecoder;\r\nfunction getUTF16BE_TextDecoder() {\r\n if (!_utf16BE_TextDecoder) {\r\n _utf16BE_TextDecoder = new TextDecoder('UTF-16BE');\r\n }\r\n return _utf16BE_TextDecoder;\r\n}\r\nlet _platformTextDecoder;\r\nexport function getPlatformTextDecoder() {\r\n if (!_platformTextDecoder) {\r\n _platformTextDecoder = platform.isLittleEndian() ? getUTF16LE_TextDecoder() : getUTF16BE_TextDecoder();\r\n }\r\n return _platformTextDecoder;\r\n}\r\nexport const hasTextDecoder = (typeof TextDecoder !== 'undefined');\r\nexport let createStringBuilder;\r\nexport let decodeUTF16LE;\r\nif (hasTextDecoder) {\r\n createStringBuilder = (capacity) => new StringBuilder(capacity);\r\n decodeUTF16LE = standardDecodeUTF16LE;\r\n}\r\nelse {\r\n createStringBuilder = (capacity) => new CompatStringBuilder();\r\n decodeUTF16LE = compatDecodeUTF16LE;\r\n}\r\nfunction standardDecodeUTF16LE(source, offset, len) {\r\n const view = new Uint16Array(source.buffer, offset, len);\r\n if (len > 0 && (view[0] === 0xFEFF || view[0] === 0xFFFE)) {\r\n // UTF16 sometimes starts with a BOM https://de.wikipedia.org/wiki/Byte_Order_Mark\r\n // It looks like TextDecoder.decode will eat up a leading BOM (0xFEFF or 0xFFFE)\r\n // We don't want that behavior because we know the string is UTF16LE and the BOM should be maintained\r\n // So we use the manual decoder\r\n return compatDecodeUTF16LE(source, offset, len);\r\n }\r\n return getUTF16LE_TextDecoder().decode(view);\r\n}\r\nfunction compatDecodeUTF16LE(source, offset, len) {\r\n let result = [];\r\n let resultLen = 0;\r\n for (let i = 0; i < len; i++) {\r\n const charCode = buffer.readUInt16LE(source, offset);\r\n offset += 2;\r\n result[resultLen++] = String.fromCharCode(charCode);\r\n }\r\n return result.join('');\r\n}\r\nclass StringBuilder {\r\n constructor(capacity) {\r\n this._capacity = capacity | 0;\r\n this._buffer = new Uint16Array(this._capacity);\r\n this._completedStrings = null;\r\n this._bufferLength = 0;\r\n }\r\n reset() {\r\n this._completedStrings = null;\r\n this._bufferLength = 0;\r\n }\r\n build() {\r\n if (this._completedStrings !== null) {\r\n this._flushBuffer();\r\n return this._completedStrings.join('');\r\n }\r\n return this._buildBuffer();\r\n }\r\n _buildBuffer() {\r\n if (this._bufferLength === 0) {\r\n return '';\r\n }\r\n const view = new Uint16Array(this._buffer.buffer, 0, this._bufferLength);\r\n return getPlatformTextDecoder().decode(view);\r\n }\r\n _flushBuffer() {\r\n const bufferString = this._buildBuffer();\r\n this._bufferLength = 0;\r\n if (this._completedStrings === null) {\r\n this._completedStrings = [bufferString];\r\n }\r\n else {\r\n this._completedStrings[this._completedStrings.length] = bufferString;\r\n }\r\n }\r\n write1(charCode) {\r\n const remainingSpace = this._capacity - this._bufferLength;\r\n if (remainingSpace <= 1) {\r\n if (remainingSpace === 0 || strings.isHighSurrogate(charCode)) {\r\n this._flushBuffer();\r\n }\r\n }\r\n this._buffer[this._bufferLength++] = charCode;\r\n }\r\n appendASCII(charCode) {\r\n if (this._bufferLength === this._capacity) {\r\n // buffer is full\r\n this._flushBuffer();\r\n }\r\n this._buffer[this._bufferLength++] = charCode;\r\n }\r\n appendASCIIString(str) {\r\n const strLen = str.length;\r\n if (this._bufferLength + strLen >= this._capacity) {\r\n // This string does not fit in the remaining buffer space\r\n this._flushBuffer();\r\n this._completedStrings[this._completedStrings.length] = str;\r\n return;\r\n }\r\n for (let i = 0; i < strLen; i++) {\r\n this._buffer[this._bufferLength++] = str.charCodeAt(i);\r\n }\r\n }\r\n}\r\nclass CompatStringBuilder {\r\n constructor() {\r\n this._pieces = [];\r\n this._piecesLen = 0;\r\n }\r\n reset() {\r\n this._pieces = [];\r\n this._piecesLen = 0;\r\n }\r\n build() {\r\n return this._pieces.join('');\r\n }\r\n write1(charCode) {\r\n this._pieces[this._piecesLen++] = String.fromCharCode(charCode);\r\n }\r\n appendASCII(charCode) {\r\n this._pieces[this._piecesLen++] = String.fromCharCode(charCode);\r\n }\r\n appendASCIIString(str) {\r\n this._pieces[this._piecesLen++] = str;\r\n }\r\n}\r\n", "/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License. See License.txt in the project root for license information.\r\n *--------------------------------------------------------------------------------------------*/\r\nimport * as buffer from '../../../base/common/buffer.js';\r\nimport { decodeUTF16LE } from '../core/stringBuilder.js';\r\nfunction escapeNewLine(str) {\r\n return (str\r\n .replace(/\\n/g, '\\\\n')\r\n .replace(/\\r/g, '\\\\r'));\r\n}\r\nexport class TextChange {\r\n constructor(oldPosition, oldText, newPosition, newText) {\r\n this.oldPosition = oldPosition;\r\n this.oldText = oldText;\r\n this.newPosition = newPosition;\r\n this.newText = newText;\r\n }\r\n get oldLength() {\r\n return this.oldText.length;\r\n }\r\n get oldEnd() {\r\n return this.oldPosition + this.oldText.length;\r\n }\r\n get newLength() {\r\n return this.newText.length;\r\n }\r\n get newEnd() {\r\n return this.newPosition + this.newText.length;\r\n }\r\n toString() {\r\n if (this.oldText.length === 0) {\r\n return `(insert@${this.oldPosition} \"${escapeNewLine(this.newText)}\")`;\r\n }\r\n if (this.newText.length === 0) {\r\n return `(delete@${this.oldPosition} \"${escapeNewLine(this.oldText)}\")`;\r\n }\r\n return `(replace@${this.oldPosition} \"${escapeNewLine(this.oldText)}\" with \"${escapeNewLine(this.newText)}\")`;\r\n }\r\n static _writeStringSize(str) {\r\n return (4 + 2 * str.length);\r\n }\r\n static _writeString(b, str, offset) {\r\n const len = str.length;\r\n buffer.writeUInt32BE(b, len, offset);\r\n offset += 4;\r\n for (let i = 0; i < len; i++) {\r\n buffer.writeUInt16LE(b, str.charCodeAt(i), offset);\r\n offset += 2;\r\n }\r\n return offset;\r\n }\r\n static _readString(b, offset) {\r\n const len = buffer.readUInt32BE(b, offset);\r\n offset += 4;\r\n return decodeUTF16LE(b, offset, len);\r\n }\r\n writeSize() {\r\n return (+4 // oldPosition\r\n + 4 // newPosition\r\n + TextChange._writeStringSize(this.oldText)\r\n + TextChange._writeStringSize(this.newText));\r\n }\r\n write(b, offset) {\r\n buffer.writeUInt32BE(b, this.oldPosition, offset);\r\n offset += 4;\r\n buffer.writeUInt32BE(b, this.newPosition, offset);\r\n offset += 4;\r\n offset = TextChange._writeString(b, this.oldText, offset);\r\n offset = TextChange._writeString(b, this.newText, offset);\r\n return offset;\r\n }\r\n static read(b, offset, dest) {\r\n const oldPosition = buffer.readUInt32BE(b, offset);\r\n offset += 4;\r\n const newPosition = buffer.readUInt32BE(b, offset);\r\n offset += 4;\r\n const oldText = TextChange._readString(b, offset);\r\n offset += TextChange._writeStringSize(oldText);\r\n const newText = TextChange._readString(b, offset);\r\n offset += TextChange._writeStringSize(newText);\r\n dest.push(new TextChange(oldPosition, oldText, newPosition, newText));\r\n return offset;\r\n }\r\n}\r\nexport function compressConsecutiveTextChanges(prevEdits, currEdits) {\r\n if (prevEdits === null || prevEdits.length === 0) {\r\n return currEdits;\r\n }\r\n const compressor = new TextChangeCompressor(prevEdits, currEdits);\r\n return compressor.compress();\r\n}\r\nclass TextChangeCompressor {\r\n constructor(prevEdits, currEdits) {\r\n this._prevEdits = prevEdits;\r\n this._currEdits = currEdits;\r\n this._result = [];\r\n this._resultLen = 0;\r\n this._prevLen = this._prevEdits.length;\r\n this._prevDeltaOffset = 0;\r\n this._currLen = this._currEdits.length;\r\n this._currDeltaOffset = 0;\r\n }\r\n compress() {\r\n let prevIndex = 0;\r\n let currIndex = 0;\r\n let prevEdit = this._getPrev(prevIndex);\r\n let currEdit = this._getCurr(currIndex);\r\n while (prevIndex < this._prevLen || currIndex < this._currLen) {\r\n if (prevEdit === null) {\r\n this._acceptCurr(currEdit);\r\n currEdit = this._getCurr(++currIndex);\r\n continue;\r\n }\r\n if (currEdit === null) {\r\n this._acceptPrev(prevEdit);\r\n prevEdit = this._getPrev(++prevIndex);\r\n continue;\r\n }\r\n if (currEdit.oldEnd <= prevEdit.newPosition) {\r\n this._acceptCurr(currEdit);\r\n currEdit = this._getCurr(++currIndex);\r\n continue;\r\n }\r\n if (prevEdit.newEnd <= currEdit.oldPosition) {\r\n this._acceptPrev(prevEdit);\r\n prevEdit = this._getPrev(++prevIndex);\r\n continue;\r\n }\r\n if (currEdit.oldPosition < prevEdit.newPosition) {\r\n const [e1, e2] = TextChangeCompressor._splitCurr(currEdit, prevEdit.newPosition - currEdit.oldPosition);\r\n this._acceptCurr(e1);\r\n currEdit = e2;\r\n continue;\r\n }\r\n if (prevEdit.newPosition < currEdit.oldPosition) {\r\n const [e1, e2] = TextChangeCompressor._splitPrev(prevEdit, currEdit.oldPosition - prevEdit.newPosition);\r\n this._acceptPrev(e1);\r\n prevEdit = e2;\r\n continue;\r\n }\r\n // At this point, currEdit.oldPosition === prevEdit.newPosition\r\n let mergePrev;\r\n let mergeCurr;\r\n if (currEdit.oldEnd === prevEdit.newEnd) {\r\n mergePrev = prevEdit;\r\n mergeCurr = currEdit;\r\n prevEdit = this._getPrev(++prevIndex);\r\n currEdit = this._getCurr(++currIndex);\r\n }\r\n else if (currEdit.oldEnd < prevEdit.newEnd) {\r\n const [e1, e2] = TextChangeCompressor._splitPrev(prevEdit, currEdit.oldLength);\r\n mergePrev = e1;\r\n mergeCurr = currEdit;\r\n prevEdit = e2;\r\n currEdit = this._getCurr(++currIndex);\r\n }\r\n else {\r\n const [e1, e2] = TextChangeCompressor._splitCurr(currEdit, prevEdit.newLength);\r\n mergePrev = prevEdit;\r\n mergeCurr = e1;\r\n prevEdit = this._getPrev(++prevIndex);\r\n currEdit = e2;\r\n }\r\n this._result[this._resultLen++] = new TextChange(mergePrev.oldPosition, mergePrev.oldText, mergeCurr.newPosition, mergeCurr.newText);\r\n this._prevDeltaOffset += mergePrev.newLength - mergePrev.oldLength;\r\n this._currDeltaOffset += mergeCurr.newLength - mergeCurr.oldLength;\r\n }\r\n const merged = TextChangeCompressor._merge(this._result);\r\n const cleaned = TextChangeCompressor._removeNoOps(merged);\r\n return cleaned;\r\n }\r\n _acceptCurr(currEdit) {\r\n this._result[this._resultLen++] = TextChangeCompressor._rebaseCurr(this._prevDeltaOffset, currEdit);\r\n this._currDeltaOffset += currEdit.newLength - currEdit.oldLength;\r\n }\r\n _getCurr(currIndex) {\r\n return (currIndex < this._currLen ? this._currEdits[currIndex] : null);\r\n }\r\n _acceptPrev(prevEdit) {\r\n this._result[this._resultLen++] = TextChangeCompressor._rebasePrev(this._currDeltaOffset, prevEdit);\r\n this._prevDeltaOffset += prevEdit.newLength - prevEdit.oldLength;\r\n }\r\n _getPrev(prevIndex) {\r\n return (prevIndex < this._prevLen ? this._prevEdits[prevIndex] : null);\r\n }\r\n static _rebaseCurr(prevDeltaOffset, currEdit) {\r\n return new TextChange(currEdit.oldPosition - prevDeltaOffset, currEdit.oldText, currEdit.newPosition, currEdit.newText);\r\n }\r\n static _rebasePrev(currDeltaOffset, prevEdit) {\r\n return new TextChange(prevEdit.oldPosition, prevEdit.oldText, prevEdit.newPosition + currDeltaOffset, prevEdit.newText);\r\n }\r\n static _splitPrev(edit, offset) {\r\n const preText = edit.newText.substr(0, offset);\r\n const postText = edit.newText.substr(offset);\r\n return [\r\n new TextChange(edit.oldPosition, edit.oldText, edit.newPosition, preText),\r\n new TextChange(edit.oldEnd, '', edit.newPosition + offset, postText)\r\n ];\r\n }\r\n static _splitCurr(edit, offset) {\r\n const preText = edit.oldText.substr(0, offset);\r\n const postText = edit.oldText.substr(offset);\r\n return [\r\n new TextChange(edit.oldPosition, preText, edit.newPosition, edit.newText),\r\n new TextChange(edit.oldPosition + offset, postText, edit.newEnd, '')\r\n ];\r\n }\r\n static _merge(edits) {\r\n if (edits.length === 0) {\r\n return edits;\r\n }\r\n let result = [], resultLen = 0;\r\n let prev = edits[0];\r\n for (let i = 1; i < edits.length; i++) {\r\n const curr = edits[i];\r\n if (prev.oldEnd === curr.oldPosition) {\r\n // Merge into `prev`\r\n prev = new TextChange(prev.oldPosition, prev.oldText + curr.oldText, prev.newPosition, prev.newText + curr.newText);\r\n }\r\n else {\r\n result[resultLen++] = prev;\r\n prev = curr;\r\n }\r\n }\r\n result[resultLen++] = prev;\r\n return result;\r\n }\r\n static _removeNoOps(edits) {\r\n if (edits.length === 0) {\r\n return edits;\r\n }\r\n let result = [], resultLen = 0;\r\n for (let i = 0; i < edits.length; i++) {\r\n const edit = edits[i];\r\n if (edit.oldText === edit.newText) {\r\n continue;\r\n }\r\n result[resultLen++] = edit;\r\n }\r\n return result;\r\n }\r\n}\r\n", "/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License. See License.txt in the project root for license information.\r\n *--------------------------------------------------------------------------------------------*/\r\nimport { isWindows } from './platform.js';\r\nimport { startsWithIgnoreCase } from './strings.js';\r\nimport { sep, posix, normalize } from './path.js';\r\n/**\r\n * Takes a Windows OS path and changes backward slashes to forward slashes.\r\n * This should only be done for OS paths from Windows (or user provided paths potentially from Windows).\r\n * Using it on a Linux or MaxOS path might change it.\r\n */\r\nexport function toSlashes(osPath) {\r\n return osPath.replace(/[\\\\/]/g, posix.sep);\r\n}\r\n/**\r\n * Takes a Windows OS path (using backward or forward slashes) and turns it into a posix path:\r\n * - turns backward slashes into forward slashes\r\n * - makes it absolute if it starts with a drive letter\r\n * This should only be done for OS paths from Windows (or user provided paths potentially from Windows).\r\n * Using it on a Linux or MaxOS path might change it.\r\n */\r\nexport function toPosixPath(osPath) {\r\n if (osPath.indexOf('/') === -1) {\r\n osPath = toSlashes(osPath);\r\n }\r\n if (/^[a-zA-Z]:(\\/|$)/.test(osPath)) { // starts with a drive letter\r\n osPath = '/' + osPath;\r\n }\r\n return osPath;\r\n}\r\nexport function isEqualOrParent(base, parentCandidate, ignoreCase, separator = sep) {\r\n if (base === parentCandidate) {\r\n return true;\r\n }\r\n if (!base || !parentCandidate) {\r\n return false;\r\n }\r\n if (parentCandidate.length > base.length) {\r\n return false;\r\n }\r\n if (ignoreCase) {\r\n const beginsWith = startsWithIgnoreCase(base, parentCandidate);\r\n if (!beginsWith) {\r\n return false;\r\n }\r\n if (parentCandidate.length === base.length) {\r\n return true; // same path, different casing\r\n }\r\n let sepOffset = parentCandidate.length;\r\n if (parentCandidate.charAt(parentCandidate.length - 1) === separator) {\r\n sepOffset--; // adjust the expected sep offset in case our candidate already ends in separator character\r\n }\r\n return base.charAt(sepOffset) === separator;\r\n }\r\n if (parentCandidate.charAt(parentCandidate.length - 1) !== separator) {\r\n parentCandidate += separator;\r\n }\r\n return base.indexOf(parentCandidate) === 0;\r\n}\r\nexport function isWindowsDriveLetter(char0) {\r\n return char0 >= 65 /* A */ && char0 <= 90 /* Z */ || char0 >= 97 /* a */ && char0 <= 122 /* z */;\r\n}\r\nexport function isRootOrDriveLetter(path) {\r\n const pathNormalized = normalize(path);\r\n if (isWindows) {\r\n if (path.length > 3) {\r\n return false;\r\n }\r\n return hasDriveLetter(pathNormalized) &&\r\n (path.length === 2 || pathNormalized.charCodeAt(2) === 92 /* Backslash */);\r\n }\r\n return pathNormalized === posix.sep;\r\n}\r\nexport function hasDriveLetter(path) {\r\n if (isWindows) {\r\n return isWindowsDriveLetter(path.charCodeAt(0)) && path.charCodeAt(1) === 58 /* Colon */;\r\n }\r\n return false;\r\n}\r\n", "/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License. See License.txt in the project root for license information.\r\n *--------------------------------------------------------------------------------------------*/\r\nimport * as extpath from './extpath.js';\r\nimport * as paths from './path.js';\r\nimport { URI, uriToFsPath } from './uri.js';\r\nimport { compare as strCompare } from './strings.js';\r\nimport { Schemas } from './network.js';\r\nexport function originalFSPath(uri) {\r\n return uriToFsPath(uri, true);\r\n}\r\nexport class ExtUri {\r\n constructor(_ignorePathCasing) {\r\n this._ignorePathCasing = _ignorePathCasing;\r\n }\r\n compare(uri1, uri2, ignoreFragment = false) {\r\n if (uri1 === uri2) {\r\n return 0;\r\n }\r\n return strCompare(this.getComparisonKey(uri1, ignoreFragment), this.getComparisonKey(uri2, ignoreFragment));\r\n }\r\n isEqual(uri1, uri2, ignoreFragment = false) {\r\n if (uri1 === uri2) {\r\n return true;\r\n }\r\n if (!uri1 || !uri2) {\r\n return false;\r\n }\r\n return this.getComparisonKey(uri1, ignoreFragment) === this.getComparisonKey(uri2, ignoreFragment);\r\n }\r\n getComparisonKey(uri, ignoreFragment = false) {\r\n return uri.with({\r\n path: this._ignorePathCasing(uri) ? uri.path.toLowerCase() : undefined,\r\n fragment: ignoreFragment ? null : undefined\r\n }).toString();\r\n }\r\n // --- path math\r\n joinPath(resource, ...pathFragment) {\r\n return URI.joinPath(resource, ...pathFragment);\r\n }\r\n basenameOrAuthority(resource) {\r\n return basename(resource) || resource.authority;\r\n }\r\n basename(resource) {\r\n return paths.posix.basename(resource.path);\r\n }\r\n dirname(resource) {\r\n if (resource.path.length === 0) {\r\n return resource;\r\n }\r\n let dirname;\r\n if (resource.scheme === Schemas.file) {\r\n dirname = URI.file(paths.dirname(originalFSPath(resource))).path;\r\n }\r\n else {\r\n dirname = paths.posix.dirname(resource.path);\r\n if (resource.authority && dirname.length && dirname.charCodeAt(0) !== 47 /* Slash */) {\r\n console.error(`dirname(\"${resource.toString})) resulted in a relative path`);\r\n dirname = '/'; // If a URI contains an authority component, then the path component must either be empty or begin with a CharCode.Slash (\"/\") character\r\n }\r\n }\r\n return resource.with({\r\n path: dirname\r\n });\r\n }\r\n normalizePath(resource) {\r\n if (!resource.path.length) {\r\n return resource;\r\n }\r\n let normalizedPath;\r\n if (resource.scheme === Schemas.file) {\r\n normalizedPath = URI.file(paths.normalize(originalFSPath(resource))).path;\r\n }\r\n else {\r\n normalizedPath = paths.posix.normalize(resource.path);\r\n }\r\n return resource.with({\r\n path: normalizedPath\r\n });\r\n }\r\n resolvePath(base, path) {\r\n if (base.scheme === Schemas.file) {\r\n const newURI = URI.file(paths.resolve(originalFSPath(base), path));\r\n return base.with({\r\n authority: newURI.authority,\r\n path: newURI.path\r\n });\r\n }\r\n path = extpath.toPosixPath(path); // we allow path to be a windows path\r\n return base.with({\r\n path: paths.posix.resolve(base.path, path)\r\n });\r\n }\r\n}\r\n/**\r\n * Unbiased utility that takes uris \"as they are\". This means it can be interchanged with\r\n * uri#toString() usages. The following is true\r\n * ```\r\n * assertEqual(aUri.toString() === bUri.toString(), exturi.isEqual(aUri, bUri))\r\n * ```\r\n */\r\nexport const extUri = new ExtUri(() => false);\r\nexport const isEqual = extUri.isEqual.bind(extUri);\r\nexport const basenameOrAuthority = extUri.basenameOrAuthority.bind(extUri);\r\nexport const basename = extUri.basename.bind(extUri);\r\nexport const dirname = extUri.dirname.bind(extUri);\r\nexport const joinPath = extUri.joinPath.bind(extUri);\r\nexport const normalizePath = extUri.normalizePath.bind(extUri);\r\nexport const resolvePath = extUri.resolvePath.bind(extUri);\r\n/**\r\n * Data URI related helpers.\r\n */\r\nexport var DataUri;\r\n(function (DataUri) {\r\n DataUri.META_DATA_LABEL = 'label';\r\n DataUri.META_DATA_DESCRIPTION = 'description';\r\n DataUri.META_DATA_SIZE = 'size';\r\n DataUri.META_DATA_MIME = 'mime';\r\n function parseMetaData(dataUri) {\r\n const metadata = new Map();\r\n // Given a URI of: data:image/png;size:2313;label:SomeLabel;description:SomeDescription;base64,77+9UE5...\r\n // the metadata is: size:2313;label:SomeLabel;description:SomeDescription\r\n const meta = dataUri.path.substring(dataUri.path.indexOf(';') + 1, dataUri.path.lastIndexOf(';'));\r\n meta.split(';').forEach(property => {\r\n const [key, value] = property.split(':');\r\n if (key && value) {\r\n metadata.set(key, value);\r\n }\r\n });\r\n // Given a URI of: data:image/png;size:2313;label:SomeLabel;description:SomeDescription;base64,77+9UE5...\r\n // the mime is: image/png\r\n const mime = dataUri.path.substring(0, dataUri.path.indexOf(';'));\r\n if (mime) {\r\n metadata.set(DataUri.META_DATA_MIME, mime);\r\n }\r\n return metadata;\r\n }\r\n DataUri.parseMetaData = parseMetaData;\r\n})(DataUri || (DataUri = {}));\r\n", "/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License. See License.txt in the project root for license information.\r\n *--------------------------------------------------------------------------------------------*/\r\nimport * as nls from '../../../nls.js';\r\nimport { onUnexpectedError } from '../../../base/common/errors.js';\r\nimport { Selection } from '../core/selection.js';\r\nimport { URI } from '../../../base/common/uri.js';\r\nimport { TextChange, compressConsecutiveTextChanges } from './textChange.js';\r\nimport * as buffer from '../../../base/common/buffer.js';\r\nimport { basename } from '../../../base/common/resources.js';\r\nfunction uriGetComparisonKey(resource) {\r\n return resource.toString();\r\n}\r\nexport class SingleModelEditStackData {\r\n constructor(beforeVersionId, afterVersionId, beforeEOL, afterEOL, beforeCursorState, afterCursorState, changes) {\r\n this.beforeVersionId = beforeVersionId;\r\n this.afterVersionId = afterVersionId;\r\n this.beforeEOL = beforeEOL;\r\n this.afterEOL = afterEOL;\r\n this.beforeCursorState = beforeCursorState;\r\n this.afterCursorState = afterCursorState;\r\n this.changes = changes;\r\n }\r\n static create(model, beforeCursorState) {\r\n const alternativeVersionId = model.getAlternativeVersionId();\r\n const eol = getModelEOL(model);\r\n return new SingleModelEditStackData(alternativeVersionId, alternativeVersionId, eol, eol, beforeCursorState, beforeCursorState, []);\r\n }\r\n append(model, textChanges, afterEOL, afterVersionId, afterCursorState) {\r\n if (textChanges.length > 0) {\r\n this.changes = compressConsecutiveTextChanges(this.changes, textChanges);\r\n }\r\n this.afterEOL = afterEOL;\r\n this.afterVersionId = afterVersionId;\r\n this.afterCursorState = afterCursorState;\r\n }\r\n static _writeSelectionsSize(selections) {\r\n return 4 + 4 * 4 * (selections ? selections.length : 0);\r\n }\r\n static _writeSelections(b, selections, offset) {\r\n buffer.writeUInt32BE(b, (selections ? selections.length : 0), offset);\r\n offset += 4;\r\n if (selections) {\r\n for (const selection of selections) {\r\n buffer.writeUInt32BE(b, selection.selectionStartLineNumber, offset);\r\n offset += 4;\r\n buffer.writeUInt32BE(b, selection.selectionStartColumn, offset);\r\n offset += 4;\r\n buffer.writeUInt32BE(b, selection.positionLineNumber, offset);\r\n offset += 4;\r\n buffer.writeUInt32BE(b, selection.positionColumn, offset);\r\n offset += 4;\r\n }\r\n }\r\n return offset;\r\n }\r\n static _readSelections(b, offset, dest) {\r\n const count = buffer.readUInt32BE(b, offset);\r\n offset += 4;\r\n for (let i = 0; i < count; i++) {\r\n const selectionStartLineNumber = buffer.readUInt32BE(b, offset);\r\n offset += 4;\r\n const selectionStartColumn = buffer.readUInt32BE(b, offset);\r\n offset += 4;\r\n const positionLineNumber = buffer.readUInt32BE(b, offset);\r\n offset += 4;\r\n const positionColumn = buffer.readUInt32BE(b, offset);\r\n offset += 4;\r\n dest.push(new Selection(selectionStartLineNumber, selectionStartColumn, positionLineNumber, positionColumn));\r\n }\r\n return offset;\r\n }\r\n serialize() {\r\n let necessarySize = (+4 // beforeVersionId\r\n + 4 // afterVersionId\r\n + 1 // beforeEOL\r\n + 1 // afterEOL\r\n + SingleModelEditStackData._writeSelectionsSize(this.beforeCursorState)\r\n + SingleModelEditStackData._writeSelectionsSize(this.afterCursorState)\r\n + 4 // change count\r\n );\r\n for (const change of this.changes) {\r\n necessarySize += change.writeSize();\r\n }\r\n const b = new Uint8Array(necessarySize);\r\n let offset = 0;\r\n buffer.writeUInt32BE(b, this.beforeVersionId, offset);\r\n offset += 4;\r\n buffer.writeUInt32BE(b, this.afterVersionId, offset);\r\n offset += 4;\r\n buffer.writeUInt8(b, this.beforeEOL, offset);\r\n offset += 1;\r\n buffer.writeUInt8(b, this.afterEOL, offset);\r\n offset += 1;\r\n offset = SingleModelEditStackData._writeSelections(b, this.beforeCursorState, offset);\r\n offset = SingleModelEditStackData._writeSelections(b, this.afterCursorState, offset);\r\n buffer.writeUInt32BE(b, this.changes.length, offset);\r\n offset += 4;\r\n for (const change of this.changes) {\r\n offset = change.write(b, offset);\r\n }\r\n return b.buffer;\r\n }\r\n static deserialize(source) {\r\n const b = new Uint8Array(source);\r\n let offset = 0;\r\n const beforeVersionId = buffer.readUInt32BE(b, offset);\r\n offset += 4;\r\n const afterVersionId = buffer.readUInt32BE(b, offset);\r\n offset += 4;\r\n const beforeEOL = buffer.readUInt8(b, offset);\r\n offset += 1;\r\n const afterEOL = buffer.readUInt8(b, offset);\r\n offset += 1;\r\n const beforeCursorState = [];\r\n offset = SingleModelEditStackData._readSelections(b, offset, beforeCursorState);\r\n const afterCursorState = [];\r\n offset = SingleModelEditStackData._readSelections(b, offset, afterCursorState);\r\n const changeCount = buffer.readUInt32BE(b, offset);\r\n offset += 4;\r\n const changes = [];\r\n for (let i = 0; i < changeCount; i++) {\r\n offset = TextChange.read(b, offset, changes);\r\n }\r\n return new SingleModelEditStackData(beforeVersionId, afterVersionId, beforeEOL, afterEOL, beforeCursorState, afterCursorState, changes);\r\n }\r\n}\r\nexport class SingleModelEditStackElement {\r\n constructor(model, beforeCursorState) {\r\n this.model = model;\r\n this._data = SingleModelEditStackData.create(model, beforeCursorState);\r\n }\r\n get type() {\r\n return 0 /* Resource */;\r\n }\r\n get resource() {\r\n if (URI.isUri(this.model)) {\r\n return this.model;\r\n }\r\n return this.model.uri;\r\n }\r\n get label() {\r\n return nls.localize('edit', \"Typing\");\r\n }\r\n toString() {\r\n const data = (this._data instanceof SingleModelEditStackData ? this._data : SingleModelEditStackData.deserialize(this._data));\r\n return data.changes.map(change => change.toString()).join(', ');\r\n }\r\n matchesResource(resource) {\r\n const uri = (URI.isUri(this.model) ? this.model : this.model.uri);\r\n return (uri.toString() === resource.toString());\r\n }\r\n setModel(model) {\r\n this.model = model;\r\n }\r\n canAppend(model) {\r\n return (this.model === model && this._data instanceof SingleModelEditStackData);\r\n }\r\n append(model, textChanges, afterEOL, afterVersionId, afterCursorState) {\r\n if (this._data instanceof SingleModelEditStackData) {\r\n this._data.append(model, textChanges, afterEOL, afterVersionId, afterCursorState);\r\n }\r\n }\r\n close() {\r\n if (this._data instanceof SingleModelEditStackData) {\r\n this._data = this._data.serialize();\r\n }\r\n }\r\n open() {\r\n if (!(this._data instanceof SingleModelEditStackData)) {\r\n this._data = SingleModelEditStackData.deserialize(this._data);\r\n }\r\n }\r\n undo() {\r\n if (URI.isUri(this.model)) {\r\n // don't have a model\r\n throw new Error(`Invalid SingleModelEditStackElement`);\r\n }\r\n if (this._data instanceof SingleModelEditStackData) {\r\n this._data = this._data.serialize();\r\n }\r\n const data = SingleModelEditStackData.deserialize(this._data);\r\n this.model._applyUndo(data.changes, data.beforeEOL, data.beforeVersionId, data.beforeCursorState);\r\n }\r\n redo() {\r\n if (URI.isUri(this.model)) {\r\n // don't have a model\r\n throw new Error(`Invalid SingleModelEditStackElement`);\r\n }\r\n if (this._data instanceof SingleModelEditStackData) {\r\n this._data = this._data.serialize();\r\n }\r\n const data = SingleModelEditStackData.deserialize(this._data);\r\n this.model._applyRedo(data.changes, data.afterEOL, data.afterVersionId, data.afterCursorState);\r\n }\r\n heapSize() {\r\n if (this._data instanceof SingleModelEditStackData) {\r\n this._data = this._data.serialize();\r\n }\r\n return this._data.byteLength + 168 /*heap overhead*/;\r\n }\r\n}\r\nexport class MultiModelEditStackElement {\r\n constructor(label, editStackElements) {\r\n this.type = 1 /* Workspace */;\r\n this.label = label;\r\n this._isOpen = true;\r\n this._editStackElementsArr = editStackElements.slice(0);\r\n this._editStackElementsMap = new Map();\r\n for (const editStackElement of this._editStackElementsArr) {\r\n const key = uriGetComparisonKey(editStackElement.resource);\r\n this._editStackElementsMap.set(key, editStackElement);\r\n }\r\n this._delegate = null;\r\n }\r\n get resources() {\r\n return this._editStackElementsArr.map(editStackElement => editStackElement.resource);\r\n }\r\n prepareUndoRedo() {\r\n if (this._delegate) {\r\n return this._delegate.prepareUndoRedo(this);\r\n }\r\n }\r\n matchesResource(resource) {\r\n const key = uriGetComparisonKey(resource);\r\n return (this._editStackElementsMap.has(key));\r\n }\r\n setModel(model) {\r\n const key = uriGetComparisonKey(URI.isUri(model) ? model : model.uri);\r\n if (this._editStackElementsMap.has(key)) {\r\n this._editStackElementsMap.get(key).setModel(model);\r\n }\r\n }\r\n canAppend(model) {\r\n if (!this._isOpen) {\r\n return false;\r\n }\r\n const key = uriGetComparisonKey(model.uri);\r\n if (this._editStackElementsMap.has(key)) {\r\n const editStackElement = this._editStackElementsMap.get(key);\r\n return editStackElement.canAppend(model);\r\n }\r\n return false;\r\n }\r\n append(model, textChanges, afterEOL, afterVersionId, afterCursorState) {\r\n const key = uriGetComparisonKey(model.uri);\r\n const editStackElement = this._editStackElementsMap.get(key);\r\n editStackElement.append(model, textChanges, afterEOL, afterVersionId, afterCursorState);\r\n }\r\n close() {\r\n this._isOpen = false;\r\n }\r\n open() {\r\n // cannot reopen\r\n }\r\n undo() {\r\n this._isOpen = false;\r\n for (const editStackElement of this._editStackElementsArr) {\r\n editStackElement.undo();\r\n }\r\n }\r\n redo() {\r\n for (const editStackElement of this._editStackElementsArr) {\r\n editStackElement.redo();\r\n }\r\n }\r\n heapSize(resource) {\r\n const key = uriGetComparisonKey(resource);\r\n if (this._editStackElementsMap.has(key)) {\r\n const editStackElement = this._editStackElementsMap.get(key);\r\n return editStackElement.heapSize();\r\n }\r\n return 0;\r\n }\r\n split() {\r\n return this._editStackElementsArr;\r\n }\r\n toString() {\r\n let result = [];\r\n for (const editStackElement of this._editStackElementsArr) {\r\n result.push(`${basename(editStackElement.resource)}: ${editStackElement}`);\r\n }\r\n return `{${result.join(', ')}}`;\r\n }\r\n}\r\nfunction getModelEOL(model) {\r\n const eol = model.getEOL();\r\n if (eol === '\\n') {\r\n return 0 /* LF */;\r\n }\r\n else {\r\n return 1 /* CRLF */;\r\n }\r\n}\r\nexport function isEditStackElement(element) {\r\n if (!element) {\r\n return false;\r\n }\r\n return ((element instanceof SingleModelEditStackElement) || (element instanceof MultiModelEditStackElement));\r\n}\r\nexport class EditStack {\r\n constructor(model, undoRedoService) {\r\n this._model = model;\r\n this._undoRedoService = undoRedoService;\r\n }\r\n pushStackElement() {\r\n const lastElement = this._undoRedoService.getLastElement(this._model.uri);\r\n if (isEditStackElement(lastElement)) {\r\n lastElement.close();\r\n }\r\n }\r\n popStackElement() {\r\n const lastElement = this._undoRedoService.getLastElement(this._model.uri);\r\n if (isEditStackElement(lastElement)) {\r\n lastElement.open();\r\n }\r\n }\r\n clear() {\r\n this._undoRedoService.removeElements(this._model.uri);\r\n }\r\n _getOrCreateEditStackElement(beforeCursorState) {\r\n const lastElement = this._undoRedoService.getLastElement(this._model.uri);\r\n if (isEditStackElement(lastElement) && lastElement.canAppend(this._model)) {\r\n return lastElement;\r\n }\r\n const newElement = new SingleModelEditStackElement(this._model, beforeCursorState);\r\n this._undoRedoService.pushElement(newElement);\r\n return newElement;\r\n }\r\n pushEOL(eol) {\r\n const editStackElement = this._getOrCreateEditStackElement(null);\r\n this._model.setEOL(eol);\r\n editStackElement.append(this._model, [], getModelEOL(this._model), this._model.getAlternativeVersionId(), null);\r\n }\r\n pushEditOperation(beforeCursorState, editOperations, cursorStateComputer) {\r\n const editStackElement = this._getOrCreateEditStackElement(beforeCursorState);\r\n const inverseEditOperations = this._model.applyEdits(editOperations, true);\r\n const afterCursorState = EditStack._computeCursorState(cursorStateComputer, inverseEditOperations);\r\n const textChanges = inverseEditOperations.map((op, index) => ({ index: index, textChange: op.textChange }));\r\n textChanges.sort((a, b) => {\r\n if (a.textChange.oldPosition === b.textChange.oldPosition) {\r\n return a.index - b.index;\r\n }\r\n return a.textChange.oldPosition - b.textChange.oldPosition;\r\n });\r\n editStackElement.append(this._model, textChanges.map(op => op.textChange), getModelEOL(this._model), this._model.getAlternativeVersionId(), afterCursorState);\r\n return afterCursorState;\r\n }\r\n static _computeCursorState(cursorStateComputer, inverseEditOperations) {\r\n try {\r\n return cursorStateComputer ? cursorStateComputer(inverseEditOperations) : null;\r\n }\r\n catch (e) {\r\n onUnexpectedError(e);\r\n return null;\r\n }\r\n }\r\n}\r\n", "/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License. See License.txt in the project root for license information.\r\n *--------------------------------------------------------------------------------------------*/\r\nclass SpacesDiffResult {\r\n constructor() {\r\n this.spacesDiff = 0;\r\n this.looksLikeAlignment = false;\r\n }\r\n}\r\n/**\r\n * Compute the diff in spaces between two line's indentation.\r\n */\r\nfunction spacesDiff(a, aLength, b, bLength, result) {\r\n result.spacesDiff = 0;\r\n result.looksLikeAlignment = false;\r\n // This can go both ways (e.g.):\r\n // - a: \"\\t\"\r\n // - b: \"\\t \"\r\n // => This should count 1 tab and 4 spaces\r\n let i;\r\n for (i = 0; i < aLength && i < bLength; i++) {\r\n let aCharCode = a.charCodeAt(i);\r\n let bCharCode = b.charCodeAt(i);\r\n if (aCharCode !== bCharCode) {\r\n break;\r\n }\r\n }\r\n let aSpacesCnt = 0, aTabsCount = 0;\r\n for (let j = i; j < aLength; j++) {\r\n let aCharCode = a.charCodeAt(j);\r\n if (aCharCode === 32 /* Space */) {\r\n aSpacesCnt++;\r\n }\r\n else {\r\n aTabsCount++;\r\n }\r\n }\r\n let bSpacesCnt = 0, bTabsCount = 0;\r\n for (let j = i; j < bLength; j++) {\r\n let bCharCode = b.charCodeAt(j);\r\n if (bCharCode === 32 /* Space */) {\r\n bSpacesCnt++;\r\n }\r\n else {\r\n bTabsCount++;\r\n }\r\n }\r\n if (aSpacesCnt > 0 && aTabsCount > 0) {\r\n return;\r\n }\r\n if (bSpacesCnt > 0 && bTabsCount > 0) {\r\n return;\r\n }\r\n let tabsDiff = Math.abs(aTabsCount - bTabsCount);\r\n let spacesDiff = Math.abs(aSpacesCnt - bSpacesCnt);\r\n if (tabsDiff === 0) {\r\n // check if the indentation difference might be caused by alignment reasons\r\n // sometime folks like to align their code, but this should not be used as a hint\r\n result.spacesDiff = spacesDiff;\r\n if (spacesDiff > 0 && 0 <= bSpacesCnt - 1 && bSpacesCnt - 1 < a.length && bSpacesCnt < b.length) {\r\n if (b.charCodeAt(bSpacesCnt) !== 32 /* Space */ && a.charCodeAt(bSpacesCnt - 1) === 32 /* Space */) {\r\n if (a.charCodeAt(a.length - 1) === 44 /* Comma */) {\r\n // This looks like an alignment desire: e.g.\r\n // const a = b + c,\r\n // d = b - c;\r\n result.looksLikeAlignment = true;\r\n }\r\n }\r\n }\r\n return;\r\n }\r\n if (spacesDiff % tabsDiff === 0) {\r\n result.spacesDiff = spacesDiff / tabsDiff;\r\n return;\r\n }\r\n}\r\nexport function guessIndentation(source, defaultTabSize, defaultInsertSpaces) {\r\n // Look at most at the first 10k lines\r\n const linesCount = Math.min(source.getLineCount(), 10000);\r\n let linesIndentedWithTabsCount = 0; // number of lines that contain at least one tab in indentation\r\n let linesIndentedWithSpacesCount = 0; // number of lines that contain only spaces in indentation\r\n let previousLineText = ''; // content of latest line that contained non-whitespace chars\r\n let previousLineIndentation = 0; // index at which latest line contained the first non-whitespace char\r\n const ALLOWED_TAB_SIZE_GUESSES = [2, 4, 6, 8, 3, 5, 7]; // prefer even guesses for `tabSize`, limit to [2, 8].\r\n const MAX_ALLOWED_TAB_SIZE_GUESS = 8; // max(ALLOWED_TAB_SIZE_GUESSES) = 8\r\n let spacesDiffCount = [0, 0, 0, 0, 0, 0, 0, 0, 0]; // `tabSize` scores\r\n let tmp = new SpacesDiffResult();\r\n for (let lineNumber = 1; lineNumber <= linesCount; lineNumber++) {\r\n let currentLineLength = source.getLineLength(lineNumber);\r\n let currentLineText = source.getLineContent(lineNumber);\r\n // if the text buffer is chunk based, so long lines are cons-string, v8 will flattern the string when we check charCode.\r\n // checking charCode on chunks directly is cheaper.\r\n const useCurrentLineText = (currentLineLength <= 65536);\r\n let currentLineHasContent = false; // does `currentLineText` contain non-whitespace chars\r\n let currentLineIndentation = 0; // index at which `currentLineText` contains the first non-whitespace char\r\n let currentLineSpacesCount = 0; // count of spaces found in `currentLineText` indentation\r\n let currentLineTabsCount = 0; // count of tabs found in `currentLineText` indentation\r\n for (let j = 0, lenJ = currentLineLength; j < lenJ; j++) {\r\n let charCode = (useCurrentLineText ? currentLineText.charCodeAt(j) : source.getLineCharCode(lineNumber, j));\r\n if (charCode === 9 /* Tab */) {\r\n currentLineTabsCount++;\r\n }\r\n else if (charCode === 32 /* Space */) {\r\n currentLineSpacesCount++;\r\n }\r\n else {\r\n // Hit non whitespace character on this line\r\n currentLineHasContent = true;\r\n currentLineIndentation = j;\r\n break;\r\n }\r\n }\r\n // Ignore empty or only whitespace lines\r\n if (!currentLineHasContent) {\r\n continue;\r\n }\r\n if (currentLineTabsCount > 0) {\r\n linesIndentedWithTabsCount++;\r\n }\r\n else if (currentLineSpacesCount > 1) {\r\n linesIndentedWithSpacesCount++;\r\n }\r\n spacesDiff(previousLineText, previousLineIndentation, currentLineText, currentLineIndentation, tmp);\r\n if (tmp.looksLikeAlignment) {\r\n // if defaultInsertSpaces === true && the spaces count == tabSize, we may want to count it as valid indentation\r\n //\r\n // - item1\r\n // - item2\r\n //\r\n // otherwise skip this line entirely\r\n //\r\n // const a = 1,\r\n // b = 2;\r\n if (!(defaultInsertSpaces && defaultTabSize === tmp.spacesDiff)) {\r\n continue;\r\n }\r\n }\r\n let currentSpacesDiff = tmp.spacesDiff;\r\n if (currentSpacesDiff <= MAX_ALLOWED_TAB_SIZE_GUESS) {\r\n spacesDiffCount[currentSpacesDiff]++;\r\n }\r\n previousLineText = currentLineText;\r\n previousLineIndentation = currentLineIndentation;\r\n }\r\n let insertSpaces = defaultInsertSpaces;\r\n if (linesIndentedWithTabsCount !== linesIndentedWithSpacesCount) {\r\n insertSpaces = (linesIndentedWithTabsCount < linesIndentedWithSpacesCount);\r\n }\r\n let tabSize = defaultTabSize;\r\n // Guess tabSize only if inserting spaces...\r\n if (insertSpaces) {\r\n let tabSizeScore = (insertSpaces ? 0 : 0.1 * linesCount);\r\n // console.log(\"score threshold: \" + tabSizeScore);\r\n ALLOWED_TAB_SIZE_GUESSES.forEach((possibleTabSize) => {\r\n let possibleTabSizeScore = spacesDiffCount[possibleTabSize];\r\n if (possibleTabSizeScore > tabSizeScore) {\r\n tabSizeScore = possibleTabSizeScore;\r\n tabSize = possibleTabSize;\r\n }\r\n });\r\n // Let a tabSize of 2 win even if it is not the maximum\r\n // (only in case 4 was guessed)\r\n if (tabSize === 4 && spacesDiffCount[4] > 0 && spacesDiffCount[2] > 0 && spacesDiffCount[2] >= spacesDiffCount[4] / 2) {\r\n tabSize = 2;\r\n }\r\n }\r\n // console.log('--------------------------');\r\n // console.log('linesIndentedWithTabsCount: ' + linesIndentedWithTabsCount + ', linesIndentedWithSpacesCount: ' + linesIndentedWithSpacesCount);\r\n // console.log('spacesDiffCount: ' + spacesDiffCount);\r\n // console.log('tabSize: ' + tabSize + ', tabSizeScore: ' + tabSizeScore);\r\n return {\r\n insertSpaces: insertSpaces,\r\n tabSize: tabSize\r\n };\r\n}\r\n", "/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License. See License.txt in the project root for license information.\r\n *--------------------------------------------------------------------------------------------*/\r\nexport function getNodeColor(node) {\r\n return ((node.metadata & 1 /* ColorMask */) >>> 0 /* ColorOffset */);\r\n}\r\nfunction setNodeColor(node, color) {\r\n node.metadata = ((node.metadata & 254 /* ColorMaskInverse */) | (color << 0 /* ColorOffset */));\r\n}\r\nfunction getNodeIsVisited(node) {\r\n return ((node.metadata & 2 /* IsVisitedMask */) >>> 1 /* IsVisitedOffset */) === 1;\r\n}\r\nfunction setNodeIsVisited(node, value) {\r\n node.metadata = ((node.metadata & 253 /* IsVisitedMaskInverse */) | ((value ? 1 : 0) << 1 /* IsVisitedOffset */));\r\n}\r\nfunction getNodeIsForValidation(node) {\r\n return ((node.metadata & 4 /* IsForValidationMask */) >>> 2 /* IsForValidationOffset */) === 1;\r\n}\r\nfunction setNodeIsForValidation(node, value) {\r\n node.metadata = ((node.metadata & 251 /* IsForValidationMaskInverse */) | ((value ? 1 : 0) << 2 /* IsForValidationOffset */));\r\n}\r\nfunction getNodeStickiness(node) {\r\n return ((node.metadata & 24 /* StickinessMask */) >>> 3 /* StickinessOffset */);\r\n}\r\nfunction _setNodeStickiness(node, stickiness) {\r\n node.metadata = ((node.metadata & 231 /* StickinessMaskInverse */) | (stickiness << 3 /* StickinessOffset */));\r\n}\r\nfunction getCollapseOnReplaceEdit(node) {\r\n return ((node.metadata & 32 /* CollapseOnReplaceEditMask */) >>> 5 /* CollapseOnReplaceEditOffset */) === 1;\r\n}\r\nfunction setCollapseOnReplaceEdit(node, value) {\r\n node.metadata = ((node.metadata & 223 /* CollapseOnReplaceEditMaskInverse */) | ((value ? 1 : 0) << 5 /* CollapseOnReplaceEditOffset */));\r\n}\r\nexport class IntervalNode {\r\n constructor(id, start, end) {\r\n this.metadata = 0;\r\n this.parent = this;\r\n this.left = this;\r\n this.right = this;\r\n setNodeColor(this, 1 /* Red */);\r\n this.start = start;\r\n this.end = end;\r\n // FORCE_OVERFLOWING_TEST: this.delta = start;\r\n this.delta = 0;\r\n this.maxEnd = end;\r\n this.id = id;\r\n this.ownerId = 0;\r\n this.options = null;\r\n setNodeIsForValidation(this, false);\r\n _setNodeStickiness(this, 1 /* NeverGrowsWhenTypingAtEdges */);\r\n setCollapseOnReplaceEdit(this, false);\r\n this.cachedVersionId = 0;\r\n this.cachedAbsoluteStart = start;\r\n this.cachedAbsoluteEnd = end;\r\n this.range = null;\r\n setNodeIsVisited(this, false);\r\n }\r\n reset(versionId, start, end, range) {\r\n this.start = start;\r\n this.end = end;\r\n this.maxEnd = end;\r\n this.cachedVersionId = versionId;\r\n this.cachedAbsoluteStart = start;\r\n this.cachedAbsoluteEnd = end;\r\n this.range = range;\r\n }\r\n setOptions(options) {\r\n this.options = options;\r\n let className = this.options.className;\r\n setNodeIsForValidation(this, (className === \"squiggly-error\" /* EditorErrorDecoration */\r\n || className === \"squiggly-warning\" /* EditorWarningDecoration */\r\n || className === \"squiggly-info\" /* EditorInfoDecoration */));\r\n _setNodeStickiness(this, this.options.stickiness);\r\n setCollapseOnReplaceEdit(this, this.options.collapseOnReplaceEdit);\r\n }\r\n setCachedOffsets(absoluteStart, absoluteEnd, cachedVersionId) {\r\n if (this.cachedVersionId !== cachedVersionId) {\r\n this.range = null;\r\n }\r\n this.cachedVersionId = cachedVersionId;\r\n this.cachedAbsoluteStart = absoluteStart;\r\n this.cachedAbsoluteEnd = absoluteEnd;\r\n }\r\n detach() {\r\n this.parent = null;\r\n this.left = null;\r\n this.right = null;\r\n }\r\n}\r\nexport const SENTINEL = new IntervalNode(null, 0, 0);\r\nSENTINEL.parent = SENTINEL;\r\nSENTINEL.left = SENTINEL;\r\nSENTINEL.right = SENTINEL;\r\nsetNodeColor(SENTINEL, 0 /* Black */);\r\nexport class IntervalTree {\r\n constructor() {\r\n this.root = SENTINEL;\r\n this.requestNormalizeDelta = false;\r\n }\r\n intervalSearch(start, end, filterOwnerId, filterOutValidation, cachedVersionId) {\r\n if (this.root === SENTINEL) {\r\n return [];\r\n }\r\n return intervalSearch(this, start, end, filterOwnerId, filterOutValidation, cachedVersionId);\r\n }\r\n search(filterOwnerId, filterOutValidation, cachedVersionId) {\r\n if (this.root === SENTINEL) {\r\n return [];\r\n }\r\n return search(this, filterOwnerId, filterOutValidation, cachedVersionId);\r\n }\r\n /**\r\n * Will not set `cachedAbsoluteStart` nor `cachedAbsoluteEnd` on the returned nodes!\r\n */\r\n collectNodesFromOwner(ownerId) {\r\n return collectNodesFromOwner(this, ownerId);\r\n }\r\n /**\r\n * Will not set `cachedAbsoluteStart` nor `cachedAbsoluteEnd` on the returned nodes!\r\n */\r\n collectNodesPostOrder() {\r\n return collectNodesPostOrder(this);\r\n }\r\n insert(node) {\r\n rbTreeInsert(this, node);\r\n this._normalizeDeltaIfNecessary();\r\n }\r\n delete(node) {\r\n rbTreeDelete(this, node);\r\n this._normalizeDeltaIfNecessary();\r\n }\r\n resolveNode(node, cachedVersionId) {\r\n const initialNode = node;\r\n let delta = 0;\r\n while (node !== this.root) {\r\n if (node === node.parent.right) {\r\n delta += node.parent.delta;\r\n }\r\n node = node.parent;\r\n }\r\n const nodeStart = initialNode.start + delta;\r\n const nodeEnd = initialNode.end + delta;\r\n initialNode.setCachedOffsets(nodeStart, nodeEnd, cachedVersionId);\r\n }\r\n acceptReplace(offset, length, textLength, forceMoveMarkers) {\r\n // Our strategy is to remove all directly impacted nodes, and then add them back to the tree.\r\n // (1) collect all nodes that are intersecting this edit as nodes of interest\r\n const nodesOfInterest = searchForEditing(this, offset, offset + length);\r\n // (2) remove all nodes that are intersecting this edit\r\n for (let i = 0, len = nodesOfInterest.length; i < len; i++) {\r\n const node = nodesOfInterest[i];\r\n rbTreeDelete(this, node);\r\n }\r\n this._normalizeDeltaIfNecessary();\r\n // (3) edit all tree nodes except the nodes of interest\r\n noOverlapReplace(this, offset, offset + length, textLength);\r\n this._normalizeDeltaIfNecessary();\r\n // (4) edit the nodes of interest and insert them back in the tree\r\n for (let i = 0, len = nodesOfInterest.length; i < len; i++) {\r\n const node = nodesOfInterest[i];\r\n node.start = node.cachedAbsoluteStart;\r\n node.end = node.cachedAbsoluteEnd;\r\n nodeAcceptEdit(node, offset, (offset + length), textLength, forceMoveMarkers);\r\n node.maxEnd = node.end;\r\n rbTreeInsert(this, node);\r\n }\r\n this._normalizeDeltaIfNecessary();\r\n }\r\n _normalizeDeltaIfNecessary() {\r\n if (!this.requestNormalizeDelta) {\r\n return;\r\n }\r\n this.requestNormalizeDelta = false;\r\n normalizeDelta(this);\r\n }\r\n}\r\n//#region Delta Normalization\r\nfunction normalizeDelta(T) {\r\n let node = T.root;\r\n let delta = 0;\r\n while (node !== SENTINEL) {\r\n if (node.left !== SENTINEL && !getNodeIsVisited(node.left)) {\r\n // go left\r\n node = node.left;\r\n continue;\r\n }\r\n if (node.right !== SENTINEL && !getNodeIsVisited(node.right)) {\r\n // go right\r\n delta += node.delta;\r\n node = node.right;\r\n continue;\r\n }\r\n // handle current node\r\n node.start = delta + node.start;\r\n node.end = delta + node.end;\r\n node.delta = 0;\r\n recomputeMaxEnd(node);\r\n setNodeIsVisited(node, true);\r\n // going up from this node\r\n setNodeIsVisited(node.left, false);\r\n setNodeIsVisited(node.right, false);\r\n if (node === node.parent.right) {\r\n delta -= node.parent.delta;\r\n }\r\n node = node.parent;\r\n }\r\n setNodeIsVisited(T.root, false);\r\n}\r\nfunction adjustMarkerBeforeColumn(markerOffset, markerStickToPreviousCharacter, checkOffset, moveSemantics) {\r\n if (markerOffset < checkOffset) {\r\n return true;\r\n }\r\n if (markerOffset > checkOffset) {\r\n return false;\r\n }\r\n if (moveSemantics === 1 /* ForceMove */) {\r\n return false;\r\n }\r\n if (moveSemantics === 2 /* ForceStay */) {\r\n return true;\r\n }\r\n return markerStickToPreviousCharacter;\r\n}\r\n/**\r\n * This is a lot more complicated than strictly necessary to maintain the same behaviour\r\n * as when decorations were implemented using two markers.\r\n */\r\nexport function nodeAcceptEdit(node, start, end, textLength, forceMoveMarkers) {\r\n const nodeStickiness = getNodeStickiness(node);\r\n const startStickToPreviousCharacter = (nodeStickiness === 0 /* AlwaysGrowsWhenTypingAtEdges */\r\n || nodeStickiness === 2 /* GrowsOnlyWhenTypingBefore */);\r\n const endStickToPreviousCharacter = (nodeStickiness === 1 /* NeverGrowsWhenTypingAtEdges */\r\n || nodeStickiness === 2 /* GrowsOnlyWhenTypingBefore */);\r\n const deletingCnt = (end - start);\r\n const insertingCnt = textLength;\r\n const commonLength = Math.min(deletingCnt, insertingCnt);\r\n const nodeStart = node.start;\r\n let startDone = false;\r\n const nodeEnd = node.end;\r\n let endDone = false;\r\n if (start <= nodeStart && nodeEnd <= end && getCollapseOnReplaceEdit(node)) {\r\n // This edit encompasses the entire decoration range\r\n // and the decoration has asked to become collapsed\r\n node.start = start;\r\n startDone = true;\r\n node.end = start;\r\n endDone = true;\r\n }\r\n {\r\n const moveSemantics = forceMoveMarkers ? 1 /* ForceMove */ : (deletingCnt > 0 ? 2 /* ForceStay */ : 0 /* MarkerDefined */);\r\n if (!startDone && adjustMarkerBeforeColumn(nodeStart, startStickToPreviousCharacter, start, moveSemantics)) {\r\n startDone = true;\r\n }\r\n if (!endDone && adjustMarkerBeforeColumn(nodeEnd, endStickToPreviousCharacter, start, moveSemantics)) {\r\n endDone = true;\r\n }\r\n }\r\n if (commonLength > 0 && !forceMoveMarkers) {\r\n const moveSemantics = (deletingCnt > insertingCnt ? 2 /* ForceStay */ : 0 /* MarkerDefined */);\r\n if (!startDone && adjustMarkerBeforeColumn(nodeStart, startStickToPreviousCharacter, start + commonLength, moveSemantics)) {\r\n startDone = true;\r\n }\r\n if (!endDone && adjustMarkerBeforeColumn(nodeEnd, endStickToPreviousCharacter, start + commonLength, moveSemantics)) {\r\n endDone = true;\r\n }\r\n }\r\n {\r\n const moveSemantics = forceMoveMarkers ? 1 /* ForceMove */ : 0 /* MarkerDefined */;\r\n if (!startDone && adjustMarkerBeforeColumn(nodeStart, startStickToPreviousCharacter, end, moveSemantics)) {\r\n node.start = start + insertingCnt;\r\n startDone = true;\r\n }\r\n if (!endDone && adjustMarkerBeforeColumn(nodeEnd, endStickToPreviousCharacter, end, moveSemantics)) {\r\n node.end = start + insertingCnt;\r\n endDone = true;\r\n }\r\n }\r\n // Finish\r\n const deltaColumn = (insertingCnt - deletingCnt);\r\n if (!startDone) {\r\n node.start = Math.max(0, nodeStart + deltaColumn);\r\n }\r\n if (!endDone) {\r\n node.end = Math.max(0, nodeEnd + deltaColumn);\r\n }\r\n if (node.start > node.end) {\r\n node.end = node.start;\r\n }\r\n}\r\nfunction searchForEditing(T, start, end) {\r\n // https://en.wikipedia.org/wiki/Interval_tree#Augmented_tree\r\n // Now, it is known that two intervals A and B overlap only when both\r\n // A.low <= B.high and A.high >= B.low. When searching the trees for\r\n // nodes overlapping with a given interval, you can immediately skip:\r\n // a) all nodes to the right of nodes whose low value is past the end of the given interval.\r\n // b) all nodes that have their maximum 'high' value below the start of the given interval.\r\n let node = T.root;\r\n let delta = 0;\r\n let nodeMaxEnd = 0;\r\n let nodeStart = 0;\r\n let nodeEnd = 0;\r\n let result = [];\r\n let resultLen = 0;\r\n while (node !== SENTINEL) {\r\n if (getNodeIsVisited(node)) {\r\n // going up from this node\r\n setNodeIsVisited(node.left, false);\r\n setNodeIsVisited(node.right, false);\r\n if (node === node.parent.right) {\r\n delta -= node.parent.delta;\r\n }\r\n node = node.parent;\r\n continue;\r\n }\r\n if (!getNodeIsVisited(node.left)) {\r\n // first time seeing this node\r\n nodeMaxEnd = delta + node.maxEnd;\r\n if (nodeMaxEnd < start) {\r\n // cover case b) from above\r\n // there is no need to search this node or its children\r\n setNodeIsVisited(node, true);\r\n continue;\r\n }\r\n if (node.left !== SENTINEL) {\r\n // go left\r\n node = node.left;\r\n continue;\r\n }\r\n }\r\n // handle current node\r\n nodeStart = delta + node.start;\r\n if (nodeStart > end) {\r\n // cover case a) from above\r\n // there is no need to search this node or its right subtree\r\n setNodeIsVisited(node, true);\r\n continue;\r\n }\r\n nodeEnd = delta + node.end;\r\n if (nodeEnd >= start) {\r\n node.setCachedOffsets(nodeStart, nodeEnd, 0);\r\n result[resultLen++] = node;\r\n }\r\n setNodeIsVisited(node, true);\r\n if (node.right !== SENTINEL && !getNodeIsVisited(node.right)) {\r\n // go right\r\n delta += node.delta;\r\n node = node.right;\r\n continue;\r\n }\r\n }\r\n setNodeIsVisited(T.root, false);\r\n return result;\r\n}\r\nfunction noOverlapReplace(T, start, end, textLength) {\r\n // https://en.wikipedia.org/wiki/Interval_tree#Augmented_tree\r\n // Now, it is known that two intervals A and B overlap only when both\r\n // A.low <= B.high and A.high >= B.low. When searching the trees for\r\n // nodes overlapping with a given interval, you can immediately skip:\r\n // a) all nodes to the right of nodes whose low value is past the end of the given interval.\r\n // b) all nodes that have their maximum 'high' value below the start of the given interval.\r\n let node = T.root;\r\n let delta = 0;\r\n let nodeMaxEnd = 0;\r\n let nodeStart = 0;\r\n const editDelta = (textLength - (end - start));\r\n while (node !== SENTINEL) {\r\n if (getNodeIsVisited(node)) {\r\n // going up from this node\r\n setNodeIsVisited(node.left, false);\r\n setNodeIsVisited(node.right, false);\r\n if (node === node.parent.right) {\r\n delta -= node.parent.delta;\r\n }\r\n recomputeMaxEnd(node);\r\n node = node.parent;\r\n continue;\r\n }\r\n if (!getNodeIsVisited(node.left)) {\r\n // first time seeing this node\r\n nodeMaxEnd = delta + node.maxEnd;\r\n if (nodeMaxEnd < start) {\r\n // cover case b) from above\r\n // there is no need to search this node or its children\r\n setNodeIsVisited(node, true);\r\n continue;\r\n }\r\n if (node.left !== SENTINEL) {\r\n // go left\r\n node = node.left;\r\n continue;\r\n }\r\n }\r\n // handle current node\r\n nodeStart = delta + node.start;\r\n if (nodeStart > end) {\r\n node.start += editDelta;\r\n node.end += editDelta;\r\n node.delta += editDelta;\r\n if (node.delta < -1073741824 /* MIN_SAFE_DELTA */ || node.delta > 1073741824 /* MAX_SAFE_DELTA */) {\r\n T.requestNormalizeDelta = true;\r\n }\r\n // cover case a) from above\r\n // there is no need to search this node or its right subtree\r\n setNodeIsVisited(node, true);\r\n continue;\r\n }\r\n setNodeIsVisited(node, true);\r\n if (node.right !== SENTINEL && !getNodeIsVisited(node.right)) {\r\n // go right\r\n delta += node.delta;\r\n node = node.right;\r\n continue;\r\n }\r\n }\r\n setNodeIsVisited(T.root, false);\r\n}\r\n//#endregion\r\n//#region Searching\r\nfunction collectNodesFromOwner(T, ownerId) {\r\n let node = T.root;\r\n let result = [];\r\n let resultLen = 0;\r\n while (node !== SENTINEL) {\r\n if (getNodeIsVisited(node)) {\r\n // going up from this node\r\n setNodeIsVisited(node.left, false);\r\n setNodeIsVisited(node.right, false);\r\n node = node.parent;\r\n continue;\r\n }\r\n if (node.left !== SENTINEL && !getNodeIsVisited(node.left)) {\r\n // go left\r\n node = node.left;\r\n continue;\r\n }\r\n // handle current node\r\n if (node.ownerId === ownerId) {\r\n result[resultLen++] = node;\r\n }\r\n setNodeIsVisited(node, true);\r\n if (node.right !== SENTINEL && !getNodeIsVisited(node.right)) {\r\n // go right\r\n node = node.right;\r\n continue;\r\n }\r\n }\r\n setNodeIsVisited(T.root, false);\r\n return result;\r\n}\r\nfunction collectNodesPostOrder(T) {\r\n let node = T.root;\r\n let result = [];\r\n let resultLen = 0;\r\n while (node !== SENTINEL) {\r\n if (getNodeIsVisited(node)) {\r\n // going up from this node\r\n setNodeIsVisited(node.left, false);\r\n setNodeIsVisited(node.right, false);\r\n node = node.parent;\r\n continue;\r\n }\r\n if (node.left !== SENTINEL && !getNodeIsVisited(node.left)) {\r\n // go left\r\n node = node.left;\r\n continue;\r\n }\r\n if (node.right !== SENTINEL && !getNodeIsVisited(node.right)) {\r\n // go right\r\n node = node.right;\r\n continue;\r\n }\r\n // handle current node\r\n result[resultLen++] = node;\r\n setNodeIsVisited(node, true);\r\n }\r\n setNodeIsVisited(T.root, false);\r\n return result;\r\n}\r\nfunction search(T, filterOwnerId, filterOutValidation, cachedVersionId) {\r\n let node = T.root;\r\n let delta = 0;\r\n let nodeStart = 0;\r\n let nodeEnd = 0;\r\n let result = [];\r\n let resultLen = 0;\r\n while (node !== SENTINEL) {\r\n if (getNodeIsVisited(node)) {\r\n // going up from this node\r\n setNodeIsVisited(node.left, false);\r\n setNodeIsVisited(node.right, false);\r\n if (node === node.parent.right) {\r\n delta -= node.parent.delta;\r\n }\r\n node = node.parent;\r\n continue;\r\n }\r\n if (node.left !== SENTINEL && !getNodeIsVisited(node.left)) {\r\n // go left\r\n node = node.left;\r\n continue;\r\n }\r\n // handle current node\r\n nodeStart = delta + node.start;\r\n nodeEnd = delta + node.end;\r\n node.setCachedOffsets(nodeStart, nodeEnd, cachedVersionId);\r\n let include = true;\r\n if (filterOwnerId && node.ownerId && node.ownerId !== filterOwnerId) {\r\n include = false;\r\n }\r\n if (filterOutValidation && getNodeIsForValidation(node)) {\r\n include = false;\r\n }\r\n if (include) {\r\n result[resultLen++] = node;\r\n }\r\n setNodeIsVisited(node, true);\r\n if (node.right !== SENTINEL && !getNodeIsVisited(node.right)) {\r\n // go right\r\n delta += node.delta;\r\n node = node.right;\r\n continue;\r\n }\r\n }\r\n setNodeIsVisited(T.root, false);\r\n return result;\r\n}\r\nfunction intervalSearch(T, intervalStart, intervalEnd, filterOwnerId, filterOutValidation, cachedVersionId) {\r\n // https://en.wikipedia.org/wiki/Interval_tree#Augmented_tree\r\n // Now, it is known that two intervals A and B overlap only when both\r\n // A.low <= B.high and A.high >= B.low. When searching the trees for\r\n // nodes overlapping with a given interval, you can immediately skip:\r\n // a) all nodes to the right of nodes whose low value is past the end of the given interval.\r\n // b) all nodes that have their maximum 'high' value below the start of the given interval.\r\n let node = T.root;\r\n let delta = 0;\r\n let nodeMaxEnd = 0;\r\n let nodeStart = 0;\r\n let nodeEnd = 0;\r\n let result = [];\r\n let resultLen = 0;\r\n while (node !== SENTINEL) {\r\n if (getNodeIsVisited(node)) {\r\n // going up from this node\r\n setNodeIsVisited(node.left, false);\r\n setNodeIsVisited(node.right, false);\r\n if (node === node.parent.right) {\r\n delta -= node.parent.delta;\r\n }\r\n node = node.parent;\r\n continue;\r\n }\r\n if (!getNodeIsVisited(node.left)) {\r\n // first time seeing this node\r\n nodeMaxEnd = delta + node.maxEnd;\r\n if (nodeMaxEnd < intervalStart) {\r\n // cover case b) from above\r\n // there is no need to search this node or its children\r\n setNodeIsVisited(node, true);\r\n continue;\r\n }\r\n if (node.left !== SENTINEL) {\r\n // go left\r\n node = node.left;\r\n continue;\r\n }\r\n }\r\n // handle current node\r\n nodeStart = delta + node.start;\r\n if (nodeStart > intervalEnd) {\r\n // cover case a) from above\r\n // there is no need to search this node or its right subtree\r\n setNodeIsVisited(node, true);\r\n continue;\r\n }\r\n nodeEnd = delta + node.end;\r\n if (nodeEnd >= intervalStart) {\r\n // There is overlap\r\n node.setCachedOffsets(nodeStart, nodeEnd, cachedVersionId);\r\n let include = true;\r\n if (filterOwnerId && node.ownerId && node.ownerId !== filterOwnerId) {\r\n include = false;\r\n }\r\n if (filterOutValidation && getNodeIsForValidation(node)) {\r\n include = false;\r\n }\r\n if (include) {\r\n result[resultLen++] = node;\r\n }\r\n }\r\n setNodeIsVisited(node, true);\r\n if (node.right !== SENTINEL && !getNodeIsVisited(node.right)) {\r\n // go right\r\n delta += node.delta;\r\n node = node.right;\r\n continue;\r\n }\r\n }\r\n setNodeIsVisited(T.root, false);\r\n return result;\r\n}\r\n//#endregion\r\n//#region Insertion\r\nfunction rbTreeInsert(T, newNode) {\r\n if (T.root === SENTINEL) {\r\n newNode.parent = SENTINEL;\r\n newNode.left = SENTINEL;\r\n newNode.right = SENTINEL;\r\n setNodeColor(newNode, 0 /* Black */);\r\n T.root = newNode;\r\n return T.root;\r\n }\r\n treeInsert(T, newNode);\r\n recomputeMaxEndWalkToRoot(newNode.parent);\r\n // repair tree\r\n let x = newNode;\r\n while (x !== T.root && getNodeColor(x.parent) === 1 /* Red */) {\r\n if (x.parent === x.parent.parent.left) {\r\n const y = x.parent.parent.right;\r\n if (getNodeColor(y) === 1 /* Red */) {\r\n setNodeColor(x.parent, 0 /* Black */);\r\n setNodeColor(y, 0 /* Black */);\r\n setNodeColor(x.parent.parent, 1 /* Red */);\r\n x = x.parent.parent;\r\n }\r\n else {\r\n if (x === x.parent.right) {\r\n x = x.parent;\r\n leftRotate(T, x);\r\n }\r\n setNodeColor(x.parent, 0 /* Black */);\r\n setNodeColor(x.parent.parent, 1 /* Red */);\r\n rightRotate(T, x.parent.parent);\r\n }\r\n }\r\n else {\r\n const y = x.parent.parent.left;\r\n if (getNodeColor(y) === 1 /* Red */) {\r\n setNodeColor(x.parent, 0 /* Black */);\r\n setNodeColor(y, 0 /* Black */);\r\n setNodeColor(x.parent.parent, 1 /* Red */);\r\n x = x.parent.parent;\r\n }\r\n else {\r\n if (x === x.parent.left) {\r\n x = x.parent;\r\n rightRotate(T, x);\r\n }\r\n setNodeColor(x.parent, 0 /* Black */);\r\n setNodeColor(x.parent.parent, 1 /* Red */);\r\n leftRotate(T, x.parent.parent);\r\n }\r\n }\r\n }\r\n setNodeColor(T.root, 0 /* Black */);\r\n return newNode;\r\n}\r\nfunction treeInsert(T, z) {\r\n let delta = 0;\r\n let x = T.root;\r\n const zAbsoluteStart = z.start;\r\n const zAbsoluteEnd = z.end;\r\n while (true) {\r\n const cmp = intervalCompare(zAbsoluteStart, zAbsoluteEnd, x.start + delta, x.end + delta);\r\n if (cmp < 0) {\r\n // this node should be inserted to the left\r\n // => it is not affected by the node's delta\r\n if (x.left === SENTINEL) {\r\n z.start -= delta;\r\n z.end -= delta;\r\n z.maxEnd -= delta;\r\n x.left = z;\r\n break;\r\n }\r\n else {\r\n x = x.left;\r\n }\r\n }\r\n else {\r\n // this node should be inserted to the right\r\n // => it is not affected by the node's delta\r\n if (x.right === SENTINEL) {\r\n z.start -= (delta + x.delta);\r\n z.end -= (delta + x.delta);\r\n z.maxEnd -= (delta + x.delta);\r\n x.right = z;\r\n break;\r\n }\r\n else {\r\n delta += x.delta;\r\n x = x.right;\r\n }\r\n }\r\n }\r\n z.parent = x;\r\n z.left = SENTINEL;\r\n z.right = SENTINEL;\r\n setNodeColor(z, 1 /* Red */);\r\n}\r\n//#endregion\r\n//#region Deletion\r\nfunction rbTreeDelete(T, z) {\r\n let x;\r\n let y;\r\n // RB-DELETE except we don't swap z and y in case c)\r\n // i.e. we always delete what's pointed at by z.\r\n if (z.left === SENTINEL) {\r\n x = z.right;\r\n y = z;\r\n // x's delta is no longer influenced by z's delta\r\n x.delta += z.delta;\r\n if (x.delta < -1073741824 /* MIN_SAFE_DELTA */ || x.delta > 1073741824 /* MAX_SAFE_DELTA */) {\r\n T.requestNormalizeDelta = true;\r\n }\r\n x.start += z.delta;\r\n x.end += z.delta;\r\n }\r\n else if (z.right === SENTINEL) {\r\n x = z.left;\r\n y = z;\r\n }\r\n else {\r\n y = leftest(z.right);\r\n x = y.right;\r\n // y's delta is no longer influenced by z's delta,\r\n // but we don't want to walk the entire right-hand-side subtree of x.\r\n // we therefore maintain z's delta in y, and adjust only x\r\n x.start += y.delta;\r\n x.end += y.delta;\r\n x.delta += y.delta;\r\n if (x.delta < -1073741824 /* MIN_SAFE_DELTA */ || x.delta > 1073741824 /* MAX_SAFE_DELTA */) {\r\n T.requestNormalizeDelta = true;\r\n }\r\n y.start += z.delta;\r\n y.end += z.delta;\r\n y.delta = z.delta;\r\n if (y.delta < -1073741824 /* MIN_SAFE_DELTA */ || y.delta > 1073741824 /* MAX_SAFE_DELTA */) {\r\n T.requestNormalizeDelta = true;\r\n }\r\n }\r\n if (y === T.root) {\r\n T.root = x;\r\n setNodeColor(x, 0 /* Black */);\r\n z.detach();\r\n resetSentinel();\r\n recomputeMaxEnd(x);\r\n T.root.parent = SENTINEL;\r\n return;\r\n }\r\n let yWasRed = (getNodeColor(y) === 1 /* Red */);\r\n if (y === y.parent.left) {\r\n y.parent.left = x;\r\n }\r\n else {\r\n y.parent.right = x;\r\n }\r\n if (y === z) {\r\n x.parent = y.parent;\r\n }\r\n else {\r\n if (y.parent === z) {\r\n x.parent = y;\r\n }\r\n else {\r\n x.parent = y.parent;\r\n }\r\n y.left = z.left;\r\n y.right = z.right;\r\n y.parent = z.parent;\r\n setNodeColor(y, getNodeColor(z));\r\n if (z === T.root) {\r\n T.root = y;\r\n }\r\n else {\r\n if (z === z.parent.left) {\r\n z.parent.left = y;\r\n }\r\n else {\r\n z.parent.right = y;\r\n }\r\n }\r\n if (y.left !== SENTINEL) {\r\n y.left.parent = y;\r\n }\r\n if (y.right !== SENTINEL) {\r\n y.right.parent = y;\r\n }\r\n }\r\n z.detach();\r\n if (yWasRed) {\r\n recomputeMaxEndWalkToRoot(x.parent);\r\n if (y !== z) {\r\n recomputeMaxEndWalkToRoot(y);\r\n recomputeMaxEndWalkToRoot(y.parent);\r\n }\r\n resetSentinel();\r\n return;\r\n }\r\n recomputeMaxEndWalkToRoot(x);\r\n recomputeMaxEndWalkToRoot(x.parent);\r\n if (y !== z) {\r\n recomputeMaxEndWalkToRoot(y);\r\n recomputeMaxEndWalkToRoot(y.parent);\r\n }\r\n // RB-DELETE-FIXUP\r\n let w;\r\n while (x !== T.root && getNodeColor(x) === 0 /* Black */) {\r\n if (x === x.parent.left) {\r\n w = x.parent.right;\r\n if (getNodeColor(w) === 1 /* Red */) {\r\n setNodeColor(w, 0 /* Black */);\r\n setNodeColor(x.parent, 1 /* Red */);\r\n leftRotate(T, x.parent);\r\n w = x.parent.right;\r\n }\r\n if (getNodeColor(w.left) === 0 /* Black */ && getNodeColor(w.right) === 0 /* Black */) {\r\n setNodeColor(w, 1 /* Red */);\r\n x = x.parent;\r\n }\r\n else {\r\n if (getNodeColor(w.right) === 0 /* Black */) {\r\n setNodeColor(w.left, 0 /* Black */);\r\n setNodeColor(w, 1 /* Red */);\r\n rightRotate(T, w);\r\n w = x.parent.right;\r\n }\r\n setNodeColor(w, getNodeColor(x.parent));\r\n setNodeColor(x.parent, 0 /* Black */);\r\n setNodeColor(w.right, 0 /* Black */);\r\n leftRotate(T, x.parent);\r\n x = T.root;\r\n }\r\n }\r\n else {\r\n w = x.parent.left;\r\n if (getNodeColor(w) === 1 /* Red */) {\r\n setNodeColor(w, 0 /* Black */);\r\n setNodeColor(x.parent, 1 /* Red */);\r\n rightRotate(T, x.parent);\r\n w = x.parent.left;\r\n }\r\n if (getNodeColor(w.left) === 0 /* Black */ && getNodeColor(w.right) === 0 /* Black */) {\r\n setNodeColor(w, 1 /* Red */);\r\n x = x.parent;\r\n }\r\n else {\r\n if (getNodeColor(w.left) === 0 /* Black */) {\r\n setNodeColor(w.right, 0 /* Black */);\r\n setNodeColor(w, 1 /* Red */);\r\n leftRotate(T, w);\r\n w = x.parent.left;\r\n }\r\n setNodeColor(w, getNodeColor(x.parent));\r\n setNodeColor(x.parent, 0 /* Black */);\r\n setNodeColor(w.left, 0 /* Black */);\r\n rightRotate(T, x.parent);\r\n x = T.root;\r\n }\r\n }\r\n }\r\n setNodeColor(x, 0 /* Black */);\r\n resetSentinel();\r\n}\r\nfunction leftest(node) {\r\n while (node.left !== SENTINEL) {\r\n node = node.left;\r\n }\r\n return node;\r\n}\r\nfunction resetSentinel() {\r\n SENTINEL.parent = SENTINEL;\r\n SENTINEL.delta = 0; // optional\r\n SENTINEL.start = 0; // optional\r\n SENTINEL.end = 0; // optional\r\n}\r\n//#endregion\r\n//#region Rotations\r\nfunction leftRotate(T, x) {\r\n const y = x.right; // set y.\r\n y.delta += x.delta; // y's delta is no longer influenced by x's delta\r\n if (y.delta < -1073741824 /* MIN_SAFE_DELTA */ || y.delta > 1073741824 /* MAX_SAFE_DELTA */) {\r\n T.requestNormalizeDelta = true;\r\n }\r\n y.start += x.delta;\r\n y.end += x.delta;\r\n x.right = y.left; // turn y's left subtree into x's right subtree.\r\n if (y.left !== SENTINEL) {\r\n y.left.parent = x;\r\n }\r\n y.parent = x.parent; // link x's parent to y.\r\n if (x.parent === SENTINEL) {\r\n T.root = y;\r\n }\r\n else if (x === x.parent.left) {\r\n x.parent.left = y;\r\n }\r\n else {\r\n x.parent.right = y;\r\n }\r\n y.left = x; // put x on y's left.\r\n x.parent = y;\r\n recomputeMaxEnd(x);\r\n recomputeMaxEnd(y);\r\n}\r\nfunction rightRotate(T, y) {\r\n const x = y.left;\r\n y.delta -= x.delta;\r\n if (y.delta < -1073741824 /* MIN_SAFE_DELTA */ || y.delta > 1073741824 /* MAX_SAFE_DELTA */) {\r\n T.requestNormalizeDelta = true;\r\n }\r\n y.start -= x.delta;\r\n y.end -= x.delta;\r\n y.left = x.right;\r\n if (x.right !== SENTINEL) {\r\n x.right.parent = y;\r\n }\r\n x.parent = y.parent;\r\n if (y.parent === SENTINEL) {\r\n T.root = x;\r\n }\r\n else if (y === y.parent.right) {\r\n y.parent.right = x;\r\n }\r\n else {\r\n y.parent.left = x;\r\n }\r\n x.right = y;\r\n y.parent = x;\r\n recomputeMaxEnd(y);\r\n recomputeMaxEnd(x);\r\n}\r\n//#endregion\r\n//#region max end computation\r\nfunction computeMaxEnd(node) {\r\n let maxEnd = node.end;\r\n if (node.left !== SENTINEL) {\r\n const leftMaxEnd = node.left.maxEnd;\r\n if (leftMaxEnd > maxEnd) {\r\n maxEnd = leftMaxEnd;\r\n }\r\n }\r\n if (node.right !== SENTINEL) {\r\n const rightMaxEnd = node.right.maxEnd + node.delta;\r\n if (rightMaxEnd > maxEnd) {\r\n maxEnd = rightMaxEnd;\r\n }\r\n }\r\n return maxEnd;\r\n}\r\nexport function recomputeMaxEnd(node) {\r\n node.maxEnd = computeMaxEnd(node);\r\n}\r\nfunction recomputeMaxEndWalkToRoot(node) {\r\n while (node !== SENTINEL) {\r\n const maxEnd = computeMaxEnd(node);\r\n if (node.maxEnd === maxEnd) {\r\n // no need to go further\r\n return;\r\n }\r\n node.maxEnd = maxEnd;\r\n node = node.parent;\r\n }\r\n}\r\n//#endregion\r\n//#region utils\r\nexport function intervalCompare(aStart, aEnd, bStart, bEnd) {\r\n if (aStart === bStart) {\r\n return aEnd - bEnd;\r\n }\r\n return aStart - bStart;\r\n}\r\n//#endregion\r\n", "/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License. See License.txt in the project root for license information.\r\n *--------------------------------------------------------------------------------------------*/\r\nexport class TreeNode {\r\n constructor(piece, color) {\r\n this.piece = piece;\r\n this.color = color;\r\n this.size_left = 0;\r\n this.lf_left = 0;\r\n this.parent = this;\r\n this.left = this;\r\n this.right = this;\r\n }\r\n next() {\r\n if (this.right !== SENTINEL) {\r\n return leftest(this.right);\r\n }\r\n let node = this;\r\n while (node.parent !== SENTINEL) {\r\n if (node.parent.left === node) {\r\n break;\r\n }\r\n node = node.parent;\r\n }\r\n if (node.parent === SENTINEL) {\r\n return SENTINEL;\r\n }\r\n else {\r\n return node.parent;\r\n }\r\n }\r\n prev() {\r\n if (this.left !== SENTINEL) {\r\n return righttest(this.left);\r\n }\r\n let node = this;\r\n while (node.parent !== SENTINEL) {\r\n if (node.parent.right === node) {\r\n break;\r\n }\r\n node = node.parent;\r\n }\r\n if (node.parent === SENTINEL) {\r\n return SENTINEL;\r\n }\r\n else {\r\n return node.parent;\r\n }\r\n }\r\n detach() {\r\n this.parent = null;\r\n this.left = null;\r\n this.right = null;\r\n }\r\n}\r\nexport const SENTINEL = new TreeNode(null, 0 /* Black */);\r\nSENTINEL.parent = SENTINEL;\r\nSENTINEL.left = SENTINEL;\r\nSENTINEL.right = SENTINEL;\r\nSENTINEL.color = 0 /* Black */;\r\nexport function leftest(node) {\r\n while (node.left !== SENTINEL) {\r\n node = node.left;\r\n }\r\n return node;\r\n}\r\nexport function righttest(node) {\r\n while (node.right !== SENTINEL) {\r\n node = node.right;\r\n }\r\n return node;\r\n}\r\nexport function calculateSize(node) {\r\n if (node === SENTINEL) {\r\n return 0;\r\n }\r\n return node.size_left + node.piece.length + calculateSize(node.right);\r\n}\r\nexport function calculateLF(node) {\r\n if (node === SENTINEL) {\r\n return 0;\r\n }\r\n return node.lf_left + node.piece.lineFeedCnt + calculateLF(node.right);\r\n}\r\nexport function resetSentinel() {\r\n SENTINEL.parent = SENTINEL;\r\n}\r\nexport function leftRotate(tree, x) {\r\n let y = x.right;\r\n // fix size_left\r\n y.size_left += x.size_left + (x.piece ? x.piece.length : 0);\r\n y.lf_left += x.lf_left + (x.piece ? x.piece.lineFeedCnt : 0);\r\n x.right = y.left;\r\n if (y.left !== SENTINEL) {\r\n y.left.parent = x;\r\n }\r\n y.parent = x.parent;\r\n if (x.parent === SENTINEL) {\r\n tree.root = y;\r\n }\r\n else if (x.parent.left === x) {\r\n x.parent.left = y;\r\n }\r\n else {\r\n x.parent.right = y;\r\n }\r\n y.left = x;\r\n x.parent = y;\r\n}\r\nexport function rightRotate(tree, y) {\r\n let x = y.left;\r\n y.left = x.right;\r\n if (x.right !== SENTINEL) {\r\n x.right.parent = y;\r\n }\r\n x.parent = y.parent;\r\n // fix size_left\r\n y.size_left -= x.size_left + (x.piece ? x.piece.length : 0);\r\n y.lf_left -= x.lf_left + (x.piece ? x.piece.lineFeedCnt : 0);\r\n if (y.parent === SENTINEL) {\r\n tree.root = x;\r\n }\r\n else if (y === y.parent.right) {\r\n y.parent.right = x;\r\n }\r\n else {\r\n y.parent.left = x;\r\n }\r\n x.right = y;\r\n y.parent = x;\r\n}\r\nexport function rbDelete(tree, z) {\r\n let x;\r\n let y;\r\n if (z.left === SENTINEL) {\r\n y = z;\r\n x = y.right;\r\n }\r\n else if (z.right === SENTINEL) {\r\n y = z;\r\n x = y.left;\r\n }\r\n else {\r\n y = leftest(z.right);\r\n x = y.right;\r\n }\r\n if (y === tree.root) {\r\n tree.root = x;\r\n // if x is null, we are removing the only node\r\n x.color = 0 /* Black */;\r\n z.detach();\r\n resetSentinel();\r\n tree.root.parent = SENTINEL;\r\n return;\r\n }\r\n let yWasRed = (y.color === 1 /* Red */);\r\n if (y === y.parent.left) {\r\n y.parent.left = x;\r\n }\r\n else {\r\n y.parent.right = x;\r\n }\r\n if (y === z) {\r\n x.parent = y.parent;\r\n recomputeTreeMetadata(tree, x);\r\n }\r\n else {\r\n if (y.parent === z) {\r\n x.parent = y;\r\n }\r\n else {\r\n x.parent = y.parent;\r\n }\r\n // as we make changes to x's hierarchy, update size_left of subtree first\r\n recomputeTreeMetadata(tree, x);\r\n y.left = z.left;\r\n y.right = z.right;\r\n y.parent = z.parent;\r\n y.color = z.color;\r\n if (z === tree.root) {\r\n tree.root = y;\r\n }\r\n else {\r\n if (z === z.parent.left) {\r\n z.parent.left = y;\r\n }\r\n else {\r\n z.parent.right = y;\r\n }\r\n }\r\n if (y.left !== SENTINEL) {\r\n y.left.parent = y;\r\n }\r\n if (y.right !== SENTINEL) {\r\n y.right.parent = y;\r\n }\r\n // update metadata\r\n // we replace z with y, so in this sub tree, the length change is z.item.length\r\n y.size_left = z.size_left;\r\n y.lf_left = z.lf_left;\r\n recomputeTreeMetadata(tree, y);\r\n }\r\n z.detach();\r\n if (x.parent.left === x) {\r\n let newSizeLeft = calculateSize(x);\r\n let newLFLeft = calculateLF(x);\r\n if (newSizeLeft !== x.parent.size_left || newLFLeft !== x.parent.lf_left) {\r\n let delta = newSizeLeft - x.parent.size_left;\r\n let lf_delta = newLFLeft - x.parent.lf_left;\r\n x.parent.size_left = newSizeLeft;\r\n x.parent.lf_left = newLFLeft;\r\n updateTreeMetadata(tree, x.parent, delta, lf_delta);\r\n }\r\n }\r\n recomputeTreeMetadata(tree, x.parent);\r\n if (yWasRed) {\r\n resetSentinel();\r\n return;\r\n }\r\n // RB-DELETE-FIXUP\r\n let w;\r\n while (x !== tree.root && x.color === 0 /* Black */) {\r\n if (x === x.parent.left) {\r\n w = x.parent.right;\r\n if (w.color === 1 /* Red */) {\r\n w.color = 0 /* Black */;\r\n x.parent.color = 1 /* Red */;\r\n leftRotate(tree, x.parent);\r\n w = x.parent.right;\r\n }\r\n if (w.left.color === 0 /* Black */ && w.right.color === 0 /* Black */) {\r\n w.color = 1 /* Red */;\r\n x = x.parent;\r\n }\r\n else {\r\n if (w.right.color === 0 /* Black */) {\r\n w.left.color = 0 /* Black */;\r\n w.color = 1 /* Red */;\r\n rightRotate(tree, w);\r\n w = x.parent.right;\r\n }\r\n w.color = x.parent.color;\r\n x.parent.color = 0 /* Black */;\r\n w.right.color = 0 /* Black */;\r\n leftRotate(tree, x.parent);\r\n x = tree.root;\r\n }\r\n }\r\n else {\r\n w = x.parent.left;\r\n if (w.color === 1 /* Red */) {\r\n w.color = 0 /* Black */;\r\n x.parent.color = 1 /* Red */;\r\n rightRotate(tree, x.parent);\r\n w = x.parent.left;\r\n }\r\n if (w.left.color === 0 /* Black */ && w.right.color === 0 /* Black */) {\r\n w.color = 1 /* Red */;\r\n x = x.parent;\r\n }\r\n else {\r\n if (w.left.color === 0 /* Black */) {\r\n w.right.color = 0 /* Black */;\r\n w.color = 1 /* Red */;\r\n leftRotate(tree, w);\r\n w = x.parent.left;\r\n }\r\n w.color = x.parent.color;\r\n x.parent.color = 0 /* Black */;\r\n w.left.color = 0 /* Black */;\r\n rightRotate(tree, x.parent);\r\n x = tree.root;\r\n }\r\n }\r\n }\r\n x.color = 0 /* Black */;\r\n resetSentinel();\r\n}\r\nexport function fixInsert(tree, x) {\r\n recomputeTreeMetadata(tree, x);\r\n while (x !== tree.root && x.parent.color === 1 /* Red */) {\r\n if (x.parent === x.parent.parent.left) {\r\n const y = x.parent.parent.right;\r\n if (y.color === 1 /* Red */) {\r\n x.parent.color = 0 /* Black */;\r\n y.color = 0 /* Black */;\r\n x.parent.parent.color = 1 /* Red */;\r\n x = x.parent.parent;\r\n }\r\n else {\r\n if (x === x.parent.right) {\r\n x = x.parent;\r\n leftRotate(tree, x);\r\n }\r\n x.parent.color = 0 /* Black */;\r\n x.parent.parent.color = 1 /* Red */;\r\n rightRotate(tree, x.parent.parent);\r\n }\r\n }\r\n else {\r\n const y = x.parent.parent.left;\r\n if (y.color === 1 /* Red */) {\r\n x.parent.color = 0 /* Black */;\r\n y.color = 0 /* Black */;\r\n x.parent.parent.color = 1 /* Red */;\r\n x = x.parent.parent;\r\n }\r\n else {\r\n if (x === x.parent.left) {\r\n x = x.parent;\r\n rightRotate(tree, x);\r\n }\r\n x.parent.color = 0 /* Black */;\r\n x.parent.parent.color = 1 /* Red */;\r\n leftRotate(tree, x.parent.parent);\r\n }\r\n }\r\n }\r\n tree.root.color = 0 /* Black */;\r\n}\r\nexport function updateTreeMetadata(tree, x, delta, lineFeedCntDelta) {\r\n // node length change or line feed count change\r\n while (x !== tree.root && x !== SENTINEL) {\r\n if (x.parent.left === x) {\r\n x.parent.size_left += delta;\r\n x.parent.lf_left += lineFeedCntDelta;\r\n }\r\n x = x.parent;\r\n }\r\n}\r\nexport function recomputeTreeMetadata(tree, x) {\r\n let delta = 0;\r\n let lf_delta = 0;\r\n if (x === tree.root) {\r\n return;\r\n }\r\n if (delta === 0) {\r\n // go upwards till the node whose left subtree is changed.\r\n while (x !== tree.root && x === x.parent.right) {\r\n x = x.parent;\r\n }\r\n if (x === tree.root) {\r\n // well, it means we add a node to the end (inorder)\r\n return;\r\n }\r\n // x is the node whose right subtree is changed.\r\n x = x.parent;\r\n delta = calculateSize(x.left) - x.size_left;\r\n lf_delta = calculateLF(x.left) - x.lf_left;\r\n x.size_left += delta;\r\n x.lf_left += lf_delta;\r\n }\r\n // go upwards till root. O(logN)\r\n while (x !== tree.root && (delta !== 0 || lf_delta !== 0)) {\r\n if (x.parent.left === x) {\r\n x.parent.size_left += delta;\r\n x.parent.lf_left += lf_delta;\r\n }\r\n x = x.parent;\r\n }\r\n}\r\n", "/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License. See License.txt in the project root for license information.\r\n *--------------------------------------------------------------------------------------------*/\r\nexport function toUint8(v) {\r\n if (v < 0) {\r\n return 0;\r\n }\r\n if (v > 255 /* MAX_UINT_8 */) {\r\n return 255 /* MAX_UINT_8 */;\r\n }\r\n return v | 0;\r\n}\r\nexport function toUint32(v) {\r\n if (v < 0) {\r\n return 0;\r\n }\r\n if (v > 4294967295 /* MAX_UINT_32 */) {\r\n return 4294967295 /* MAX_UINT_32 */;\r\n }\r\n return v | 0;\r\n}\r\n", "/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License. See License.txt in the project root for license information.\r\n *--------------------------------------------------------------------------------------------*/\r\nimport { toUint8 } from '../../../base/common/uint.js';\r\n/**\r\n * A fast character classifier that uses a compact array for ASCII values.\r\n */\r\nexport class CharacterClassifier {\r\n constructor(_defaultValue) {\r\n let defaultValue = toUint8(_defaultValue);\r\n this._defaultValue = defaultValue;\r\n this._asciiMap = CharacterClassifier._createAsciiMap(defaultValue);\r\n this._map = new Map();\r\n }\r\n static _createAsciiMap(defaultValue) {\r\n let asciiMap = new Uint8Array(256);\r\n for (let i = 0; i < 256; i++) {\r\n asciiMap[i] = defaultValue;\r\n }\r\n return asciiMap;\r\n }\r\n set(charCode, _value) {\r\n let value = toUint8(_value);\r\n if (charCode >= 0 && charCode < 256) {\r\n this._asciiMap[charCode] = value;\r\n }\r\n else {\r\n this._map.set(charCode, value);\r\n }\r\n }\r\n get(charCode) {\r\n if (charCode >= 0 && charCode < 256) {\r\n return this._asciiMap[charCode];\r\n }\r\n else {\r\n return (this._map.get(charCode) || this._defaultValue);\r\n }\r\n }\r\n}\r\nexport class CharacterSet {\r\n constructor() {\r\n this._actual = new CharacterClassifier(0 /* False */);\r\n }\r\n add(charCode) {\r\n this._actual.set(charCode, 1 /* True */);\r\n }\r\n has(charCode) {\r\n return (this._actual.get(charCode) === 1 /* True */);\r\n }\r\n}\r\n", "/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License. See License.txt in the project root for license information.\r\n *--------------------------------------------------------------------------------------------*/\r\nimport { CharacterClassifier } from '../core/characterClassifier.js';\r\nexport class WordCharacterClassifier extends CharacterClassifier {\r\n constructor(wordSeparators) {\r\n super(0 /* Regular */);\r\n for (let i = 0, len = wordSeparators.length; i < len; i++) {\r\n this.set(wordSeparators.charCodeAt(i), 2 /* WordSeparator */);\r\n }\r\n this.set(32 /* Space */, 1 /* Whitespace */);\r\n this.set(9 /* Tab */, 1 /* Whitespace */);\r\n }\r\n}\r\nfunction once(computeFn) {\r\n let cache = {}; // TODO@Alex unbounded cache\r\n return (input) => {\r\n if (!cache.hasOwnProperty(input)) {\r\n cache[input] = computeFn(input);\r\n }\r\n return cache[input];\r\n };\r\n}\r\nexport const getMapForWordSeparators = once((input) => new WordCharacterClassifier(input));\r\n", "/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License. See License.txt in the project root for license information.\r\n *--------------------------------------------------------------------------------------------*/\r\nimport * as strings from '../../../base/common/strings.js';\r\nimport { getMapForWordSeparators } from '../controller/wordCharacterClassifier.js';\r\nimport { Position } from '../core/position.js';\r\nimport { Range } from '../core/range.js';\r\nimport { FindMatch } from '../model.js';\r\nconst LIMIT_FIND_COUNT = 999;\r\nexport class SearchParams {\r\n constructor(searchString, isRegex, matchCase, wordSeparators) {\r\n this.searchString = searchString;\r\n this.isRegex = isRegex;\r\n this.matchCase = matchCase;\r\n this.wordSeparators = wordSeparators;\r\n }\r\n parseSearchRequest() {\r\n if (this.searchString === '') {\r\n return null;\r\n }\r\n // Try to create a RegExp out of the params\r\n let multiline;\r\n if (this.isRegex) {\r\n multiline = isMultilineRegexSource(this.searchString);\r\n }\r\n else {\r\n multiline = (this.searchString.indexOf('\\n') >= 0);\r\n }\r\n let regex = null;\r\n try {\r\n regex = strings.createRegExp(this.searchString, this.isRegex, {\r\n matchCase: this.matchCase,\r\n wholeWord: false,\r\n multiline: multiline,\r\n global: true,\r\n unicode: true\r\n });\r\n }\r\n catch (err) {\r\n return null;\r\n }\r\n if (!regex) {\r\n return null;\r\n }\r\n let canUseSimpleSearch = (!this.isRegex && !multiline);\r\n if (canUseSimpleSearch && this.searchString.toLowerCase() !== this.searchString.toUpperCase()) {\r\n // casing might make a difference\r\n canUseSimpleSearch = this.matchCase;\r\n }\r\n return new SearchData(regex, this.wordSeparators ? getMapForWordSeparators(this.wordSeparators) : null, canUseSimpleSearch ? this.searchString : null);\r\n }\r\n}\r\nexport function isMultilineRegexSource(searchString) {\r\n if (!searchString || searchString.length === 0) {\r\n return false;\r\n }\r\n for (let i = 0, len = searchString.length; i < len; i++) {\r\n const chCode = searchString.charCodeAt(i);\r\n if (chCode === 92 /* Backslash */) {\r\n // move to next char\r\n i++;\r\n if (i >= len) {\r\n // string ends with a \\\r\n break;\r\n }\r\n const nextChCode = searchString.charCodeAt(i);\r\n if (nextChCode === 110 /* n */ || nextChCode === 114 /* r */ || nextChCode === 87 /* W */ || nextChCode === 119 /* w */) {\r\n return true;\r\n }\r\n }\r\n }\r\n return false;\r\n}\r\nexport class SearchData {\r\n constructor(regex, wordSeparators, simpleSearch) {\r\n this.regex = regex;\r\n this.wordSeparators = wordSeparators;\r\n this.simpleSearch = simpleSearch;\r\n }\r\n}\r\nexport function createFindMatch(range, rawMatches, captureMatches) {\r\n if (!captureMatches) {\r\n return new FindMatch(range, null);\r\n }\r\n let matches = [];\r\n for (let i = 0, len = rawMatches.length; i < len; i++) {\r\n matches[i] = rawMatches[i];\r\n }\r\n return new FindMatch(range, matches);\r\n}\r\nclass LineFeedCounter {\r\n constructor(text) {\r\n let lineFeedsOffsets = [];\r\n let lineFeedsOffsetsLen = 0;\r\n for (let i = 0, textLen = text.length; i < textLen; i++) {\r\n if (text.charCodeAt(i) === 10 /* LineFeed */) {\r\n lineFeedsOffsets[lineFeedsOffsetsLen++] = i;\r\n }\r\n }\r\n this._lineFeedsOffsets = lineFeedsOffsets;\r\n }\r\n findLineFeedCountBeforeOffset(offset) {\r\n const lineFeedsOffsets = this._lineFeedsOffsets;\r\n let min = 0;\r\n let max = lineFeedsOffsets.length - 1;\r\n if (max === -1) {\r\n // no line feeds\r\n return 0;\r\n }\r\n if (offset <= lineFeedsOffsets[0]) {\r\n // before first line feed\r\n return 0;\r\n }\r\n while (min < max) {\r\n const mid = min + ((max - min) / 2 >> 0);\r\n if (lineFeedsOffsets[mid] >= offset) {\r\n max = mid - 1;\r\n }\r\n else {\r\n if (lineFeedsOffsets[mid + 1] >= offset) {\r\n // bingo!\r\n min = mid;\r\n max = mid;\r\n }\r\n else {\r\n min = mid + 1;\r\n }\r\n }\r\n }\r\n return min + 1;\r\n }\r\n}\r\nexport class TextModelSearch {\r\n static findMatches(model, searchParams, searchRange, captureMatches, limitResultCount) {\r\n const searchData = searchParams.parseSearchRequest();\r\n if (!searchData) {\r\n return [];\r\n }\r\n if (searchData.regex.multiline) {\r\n return this._doFindMatchesMultiline(model, searchRange, new Searcher(searchData.wordSeparators, searchData.regex), captureMatches, limitResultCount);\r\n }\r\n return this._doFindMatchesLineByLine(model, searchRange, searchData, captureMatches, limitResultCount);\r\n }\r\n /**\r\n * Multiline search always executes on the lines concatenated with \\n.\r\n * We must therefore compensate for the count of \\n in case the model is CRLF\r\n */\r\n static _getMultilineMatchRange(model, deltaOffset, text, lfCounter, matchIndex, match0) {\r\n let startOffset;\r\n let lineFeedCountBeforeMatch = 0;\r\n if (lfCounter) {\r\n lineFeedCountBeforeMatch = lfCounter.findLineFeedCountBeforeOffset(matchIndex);\r\n startOffset = deltaOffset + matchIndex + lineFeedCountBeforeMatch /* add as many \\r as there were \\n */;\r\n }\r\n else {\r\n startOffset = deltaOffset + matchIndex;\r\n }\r\n let endOffset;\r\n if (lfCounter) {\r\n let lineFeedCountBeforeEndOfMatch = lfCounter.findLineFeedCountBeforeOffset(matchIndex + match0.length);\r\n let lineFeedCountInMatch = lineFeedCountBeforeEndOfMatch - lineFeedCountBeforeMatch;\r\n endOffset = startOffset + match0.length + lineFeedCountInMatch /* add as many \\r as there were \\n */;\r\n }\r\n else {\r\n endOffset = startOffset + match0.length;\r\n }\r\n const startPosition = model.getPositionAt(startOffset);\r\n const endPosition = model.getPositionAt(endOffset);\r\n return new Range(startPosition.lineNumber, startPosition.column, endPosition.lineNumber, endPosition.column);\r\n }\r\n static _doFindMatchesMultiline(model, searchRange, searcher, captureMatches, limitResultCount) {\r\n const deltaOffset = model.getOffsetAt(searchRange.getStartPosition());\r\n // We always execute multiline search over the lines joined with \\n\r\n // This makes it that \\n will match the EOL for both CRLF and LF models\r\n // We compensate for offset errors in `_getMultilineMatchRange`\r\n const text = model.getValueInRange(searchRange, 1 /* LF */);\r\n const lfCounter = (model.getEOL() === '\\r\\n' ? new LineFeedCounter(text) : null);\r\n const result = [];\r\n let counter = 0;\r\n let m;\r\n searcher.reset(0);\r\n while ((m = searcher.next(text))) {\r\n result[counter++] = createFindMatch(this._getMultilineMatchRange(model, deltaOffset, text, lfCounter, m.index, m[0]), m, captureMatches);\r\n if (counter >= limitResultCount) {\r\n return result;\r\n }\r\n }\r\n return result;\r\n }\r\n static _doFindMatchesLineByLine(model, searchRange, searchData, captureMatches, limitResultCount) {\r\n const result = [];\r\n let resultLen = 0;\r\n // Early case for a search range that starts & stops on the same line number\r\n if (searchRange.startLineNumber === searchRange.endLineNumber) {\r\n const text = model.getLineContent(searchRange.startLineNumber).substring(searchRange.startColumn - 1, searchRange.endColumn - 1);\r\n resultLen = this._findMatchesInLine(searchData, text, searchRange.startLineNumber, searchRange.startColumn - 1, resultLen, result, captureMatches, limitResultCount);\r\n return result;\r\n }\r\n // Collect results from first line\r\n const text = model.getLineContent(searchRange.startLineNumber).substring(searchRange.startColumn - 1);\r\n resultLen = this._findMatchesInLine(searchData, text, searchRange.startLineNumber, searchRange.startColumn - 1, resultLen, result, captureMatches, limitResultCount);\r\n // Collect results from middle lines\r\n for (let lineNumber = searchRange.startLineNumber + 1; lineNumber < searchRange.endLineNumber && resultLen < limitResultCount; lineNumber++) {\r\n resultLen = this._findMatchesInLine(searchData, model.getLineContent(lineNumber), lineNumber, 0, resultLen, result, captureMatches, limitResultCount);\r\n }\r\n // Collect results from last line\r\n if (resultLen < limitResultCount) {\r\n const text = model.getLineContent(searchRange.endLineNumber).substring(0, searchRange.endColumn - 1);\r\n resultLen = this._findMatchesInLine(searchData, text, searchRange.endLineNumber, 0, resultLen, result, captureMatches, limitResultCount);\r\n }\r\n return result;\r\n }\r\n static _findMatchesInLine(searchData, text, lineNumber, deltaOffset, resultLen, result, captureMatches, limitResultCount) {\r\n const wordSeparators = searchData.wordSeparators;\r\n if (!captureMatches && searchData.simpleSearch) {\r\n const searchString = searchData.simpleSearch;\r\n const searchStringLen = searchString.length;\r\n const textLength = text.length;\r\n let lastMatchIndex = -searchStringLen;\r\n while ((lastMatchIndex = text.indexOf(searchString, lastMatchIndex + searchStringLen)) !== -1) {\r\n if (!wordSeparators || isValidMatch(wordSeparators, text, textLength, lastMatchIndex, searchStringLen)) {\r\n result[resultLen++] = new FindMatch(new Range(lineNumber, lastMatchIndex + 1 + deltaOffset, lineNumber, lastMatchIndex + 1 + searchStringLen + deltaOffset), null);\r\n if (resultLen >= limitResultCount) {\r\n return resultLen;\r\n }\r\n }\r\n }\r\n return resultLen;\r\n }\r\n const searcher = new Searcher(searchData.wordSeparators, searchData.regex);\r\n let m;\r\n // Reset regex to search from the beginning\r\n searcher.reset(0);\r\n do {\r\n m = searcher.next(text);\r\n if (m) {\r\n result[resultLen++] = createFindMatch(new Range(lineNumber, m.index + 1 + deltaOffset, lineNumber, m.index + 1 + m[0].length + deltaOffset), m, captureMatches);\r\n if (resultLen >= limitResultCount) {\r\n return resultLen;\r\n }\r\n }\r\n } while (m);\r\n return resultLen;\r\n }\r\n static findNextMatch(model, searchParams, searchStart, captureMatches) {\r\n const searchData = searchParams.parseSearchRequest();\r\n if (!searchData) {\r\n return null;\r\n }\r\n const searcher = new Searcher(searchData.wordSeparators, searchData.regex);\r\n if (searchData.regex.multiline) {\r\n return this._doFindNextMatchMultiline(model, searchStart, searcher, captureMatches);\r\n }\r\n return this._doFindNextMatchLineByLine(model, searchStart, searcher, captureMatches);\r\n }\r\n static _doFindNextMatchMultiline(model, searchStart, searcher, captureMatches) {\r\n const searchTextStart = new Position(searchStart.lineNumber, 1);\r\n const deltaOffset = model.getOffsetAt(searchTextStart);\r\n const lineCount = model.getLineCount();\r\n // We always execute multiline search over the lines joined with \\n\r\n // This makes it that \\n will match the EOL for both CRLF and LF models\r\n // We compensate for offset errors in `_getMultilineMatchRange`\r\n const text = model.getValueInRange(new Range(searchTextStart.lineNumber, searchTextStart.column, lineCount, model.getLineMaxColumn(lineCount)), 1 /* LF */);\r\n const lfCounter = (model.getEOL() === '\\r\\n' ? new LineFeedCounter(text) : null);\r\n searcher.reset(searchStart.column - 1);\r\n let m = searcher.next(text);\r\n if (m) {\r\n return createFindMatch(this._getMultilineMatchRange(model, deltaOffset, text, lfCounter, m.index, m[0]), m, captureMatches);\r\n }\r\n if (searchStart.lineNumber !== 1 || searchStart.column !== 1) {\r\n // Try again from the top\r\n return this._doFindNextMatchMultiline(model, new Position(1, 1), searcher, captureMatches);\r\n }\r\n return null;\r\n }\r\n static _doFindNextMatchLineByLine(model, searchStart, searcher, captureMatches) {\r\n const lineCount = model.getLineCount();\r\n const startLineNumber = searchStart.lineNumber;\r\n // Look in first line\r\n const text = model.getLineContent(startLineNumber);\r\n const r = this._findFirstMatchInLine(searcher, text, startLineNumber, searchStart.column, captureMatches);\r\n if (r) {\r\n return r;\r\n }\r\n for (let i = 1; i <= lineCount; i++) {\r\n const lineIndex = (startLineNumber + i - 1) % lineCount;\r\n const text = model.getLineContent(lineIndex + 1);\r\n const r = this._findFirstMatchInLine(searcher, text, lineIndex + 1, 1, captureMatches);\r\n if (r) {\r\n return r;\r\n }\r\n }\r\n return null;\r\n }\r\n static _findFirstMatchInLine(searcher, text, lineNumber, fromColumn, captureMatches) {\r\n // Set regex to search from column\r\n searcher.reset(fromColumn - 1);\r\n const m = searcher.next(text);\r\n if (m) {\r\n return createFindMatch(new Range(lineNumber, m.index + 1, lineNumber, m.index + 1 + m[0].length), m, captureMatches);\r\n }\r\n return null;\r\n }\r\n static findPreviousMatch(model, searchParams, searchStart, captureMatches) {\r\n const searchData = searchParams.parseSearchRequest();\r\n if (!searchData) {\r\n return null;\r\n }\r\n const searcher = new Searcher(searchData.wordSeparators, searchData.regex);\r\n if (searchData.regex.multiline) {\r\n return this._doFindPreviousMatchMultiline(model, searchStart, searcher, captureMatches);\r\n }\r\n return this._doFindPreviousMatchLineByLine(model, searchStart, searcher, captureMatches);\r\n }\r\n static _doFindPreviousMatchMultiline(model, searchStart, searcher, captureMatches) {\r\n const matches = this._doFindMatchesMultiline(model, new Range(1, 1, searchStart.lineNumber, searchStart.column), searcher, captureMatches, 10 * LIMIT_FIND_COUNT);\r\n if (matches.length > 0) {\r\n return matches[matches.length - 1];\r\n }\r\n const lineCount = model.getLineCount();\r\n if (searchStart.lineNumber !== lineCount || searchStart.column !== model.getLineMaxColumn(lineCount)) {\r\n // Try again with all content\r\n return this._doFindPreviousMatchMultiline(model, new Position(lineCount, model.getLineMaxColumn(lineCount)), searcher, captureMatches);\r\n }\r\n return null;\r\n }\r\n static _doFindPreviousMatchLineByLine(model, searchStart, searcher, captureMatches) {\r\n const lineCount = model.getLineCount();\r\n const startLineNumber = searchStart.lineNumber;\r\n // Look in first line\r\n const text = model.getLineContent(startLineNumber).substring(0, searchStart.column - 1);\r\n const r = this._findLastMatchInLine(searcher, text, startLineNumber, captureMatches);\r\n if (r) {\r\n return r;\r\n }\r\n for (let i = 1; i <= lineCount; i++) {\r\n const lineIndex = (lineCount + startLineNumber - i - 1) % lineCount;\r\n const text = model.getLineContent(lineIndex + 1);\r\n const r = this._findLastMatchInLine(searcher, text, lineIndex + 1, captureMatches);\r\n if (r) {\r\n return r;\r\n }\r\n }\r\n return null;\r\n }\r\n static _findLastMatchInLine(searcher, text, lineNumber, captureMatches) {\r\n let bestResult = null;\r\n let m;\r\n searcher.reset(0);\r\n while ((m = searcher.next(text))) {\r\n bestResult = createFindMatch(new Range(lineNumber, m.index + 1, lineNumber, m.index + 1 + m[0].length), m, captureMatches);\r\n }\r\n return bestResult;\r\n }\r\n}\r\nfunction leftIsWordBounday(wordSeparators, text, textLength, matchStartIndex, matchLength) {\r\n if (matchStartIndex === 0) {\r\n // Match starts at start of string\r\n return true;\r\n }\r\n const charBefore = text.charCodeAt(matchStartIndex - 1);\r\n if (wordSeparators.get(charBefore) !== 0 /* Regular */) {\r\n // The character before the match is a word separator\r\n return true;\r\n }\r\n if (charBefore === 13 /* CarriageReturn */ || charBefore === 10 /* LineFeed */) {\r\n // The character before the match is line break or carriage return.\r\n return true;\r\n }\r\n if (matchLength > 0) {\r\n const firstCharInMatch = text.charCodeAt(matchStartIndex);\r\n if (wordSeparators.get(firstCharInMatch) !== 0 /* Regular */) {\r\n // The first character inside the match is a word separator\r\n return true;\r\n }\r\n }\r\n return false;\r\n}\r\nfunction rightIsWordBounday(wordSeparators, text, textLength, matchStartIndex, matchLength) {\r\n if (matchStartIndex + matchLength === textLength) {\r\n // Match ends at end of string\r\n return true;\r\n }\r\n const charAfter = text.charCodeAt(matchStartIndex + matchLength);\r\n if (wordSeparators.get(charAfter) !== 0 /* Regular */) {\r\n // The character after the match is a word separator\r\n return true;\r\n }\r\n if (charAfter === 13 /* CarriageReturn */ || charAfter === 10 /* LineFeed */) {\r\n // The character after the match is line break or carriage return.\r\n return true;\r\n }\r\n if (matchLength > 0) {\r\n const lastCharInMatch = text.charCodeAt(matchStartIndex + matchLength - 1);\r\n if (wordSeparators.get(lastCharInMatch) !== 0 /* Regular */) {\r\n // The last character in the match is a word separator\r\n return true;\r\n }\r\n }\r\n return false;\r\n}\r\nexport function isValidMatch(wordSeparators, text, textLength, matchStartIndex, matchLength) {\r\n return (leftIsWordBounday(wordSeparators, text, textLength, matchStartIndex, matchLength)\r\n && rightIsWordBounday(wordSeparators, text, textLength, matchStartIndex, matchLength));\r\n}\r\nexport class Searcher {\r\n constructor(wordSeparators, searchRegex) {\r\n this._wordSeparators = wordSeparators;\r\n this._searchRegex = searchRegex;\r\n this._prevMatchStartIndex = -1;\r\n this._prevMatchLength = 0;\r\n }\r\n reset(lastIndex) {\r\n this._searchRegex.lastIndex = lastIndex;\r\n this._prevMatchStartIndex = -1;\r\n this._prevMatchLength = 0;\r\n }\r\n next(text) {\r\n const textLength = text.length;\r\n let m;\r\n do {\r\n if (this._prevMatchStartIndex + this._prevMatchLength === textLength) {\r\n // Reached the end of the line\r\n return null;\r\n }\r\n m = this._searchRegex.exec(text);\r\n if (!m) {\r\n return null;\r\n }\r\n const matchStartIndex = m.index;\r\n const matchLength = m[0].length;\r\n if (matchStartIndex === this._prevMatchStartIndex && matchLength === this._prevMatchLength) {\r\n if (matchLength === 0) {\r\n // the search result is an empty string and won't advance `regex.lastIndex`, so `regex.exec` will stuck here\r\n // we attempt to recover from that by advancing by two if surrogate pair found and by one otherwise\r\n if (strings.getNextCodePoint(text, textLength, this._searchRegex.lastIndex) > 0xFFFF) {\r\n this._searchRegex.lastIndex += 2;\r\n }\r\n else {\r\n this._searchRegex.lastIndex += 1;\r\n }\r\n continue;\r\n }\r\n // Exit early if the regex matches the same range twice\r\n return null;\r\n }\r\n this._prevMatchStartIndex = matchStartIndex;\r\n this._prevMatchLength = matchLength;\r\n if (!this._wordSeparators || isValidMatch(this._wordSeparators, text, textLength, matchStartIndex, matchLength)) {\r\n return m;\r\n }\r\n } while (m);\r\n return null;\r\n }\r\n}\r\n", "/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License. See License.txt in the project root for license information.\r\n *--------------------------------------------------------------------------------------------*/\r\nimport { Position } from '../../core/position.js';\r\nimport { Range } from '../../core/range.js';\r\nimport { FindMatch } from '../../model.js';\r\nimport { SENTINEL, TreeNode, fixInsert, leftest, rbDelete, righttest, updateTreeMetadata } from './rbTreeBase.js';\r\nimport { Searcher, createFindMatch, isValidMatch } from '../textModelSearch.js';\r\n// const lfRegex = new RegExp(/\\r\\n|\\r|\\n/g);\r\nexport const AverageBufferSize = 65535;\r\nexport function createUintArray(arr) {\r\n let r;\r\n if (arr[arr.length - 1] < 65536) {\r\n r = new Uint16Array(arr.length);\r\n }\r\n else {\r\n r = new Uint32Array(arr.length);\r\n }\r\n r.set(arr, 0);\r\n return r;\r\n}\r\nexport class LineStarts {\r\n constructor(lineStarts, cr, lf, crlf, isBasicASCII) {\r\n this.lineStarts = lineStarts;\r\n this.cr = cr;\r\n this.lf = lf;\r\n this.crlf = crlf;\r\n this.isBasicASCII = isBasicASCII;\r\n }\r\n}\r\nexport function createLineStartsFast(str, readonly = true) {\r\n let r = [0], rLength = 1;\r\n for (let i = 0, len = str.length; i < len; i++) {\r\n const chr = str.charCodeAt(i);\r\n if (chr === 13 /* CarriageReturn */) {\r\n if (i + 1 < len && str.charCodeAt(i + 1) === 10 /* LineFeed */) {\r\n // \\r\\n... case\r\n r[rLength++] = i + 2;\r\n i++; // skip \\n\r\n }\r\n else {\r\n // \\r... case\r\n r[rLength++] = i + 1;\r\n }\r\n }\r\n else if (chr === 10 /* LineFeed */) {\r\n r[rLength++] = i + 1;\r\n }\r\n }\r\n if (readonly) {\r\n return createUintArray(r);\r\n }\r\n else {\r\n return r;\r\n }\r\n}\r\nexport function createLineStarts(r, str) {\r\n r.length = 0;\r\n r[0] = 0;\r\n let rLength = 1;\r\n let cr = 0, lf = 0, crlf = 0;\r\n let isBasicASCII = true;\r\n for (let i = 0, len = str.length; i < len; i++) {\r\n const chr = str.charCodeAt(i);\r\n if (chr === 13 /* CarriageReturn */) {\r\n if (i + 1 < len && str.charCodeAt(i + 1) === 10 /* LineFeed */) {\r\n // \\r\\n... case\r\n crlf++;\r\n r[rLength++] = i + 2;\r\n i++; // skip \\n\r\n }\r\n else {\r\n cr++;\r\n // \\r... case\r\n r[rLength++] = i + 1;\r\n }\r\n }\r\n else if (chr === 10 /* LineFeed */) {\r\n lf++;\r\n r[rLength++] = i + 1;\r\n }\r\n else {\r\n if (isBasicASCII) {\r\n if (chr !== 9 /* Tab */ && (chr < 32 || chr > 126)) {\r\n isBasicASCII = false;\r\n }\r\n }\r\n }\r\n }\r\n const result = new LineStarts(createUintArray(r), cr, lf, crlf, isBasicASCII);\r\n r.length = 0;\r\n return result;\r\n}\r\nexport class Piece {\r\n constructor(bufferIndex, start, end, lineFeedCnt, length) {\r\n this.bufferIndex = bufferIndex;\r\n this.start = start;\r\n this.end = end;\r\n this.lineFeedCnt = lineFeedCnt;\r\n this.length = length;\r\n }\r\n}\r\nexport class StringBuffer {\r\n constructor(buffer, lineStarts) {\r\n this.buffer = buffer;\r\n this.lineStarts = lineStarts;\r\n }\r\n}\r\n/**\r\n * Readonly snapshot for piece tree.\r\n * In a real multiple thread environment, to make snapshot reading always work correctly, we need to\r\n * 1. Make TreeNode.piece immutable, then reading and writing can run in parallel.\r\n * 2. TreeNode/Buffers normalization should not happen during snapshot reading.\r\n */\r\nclass PieceTreeSnapshot {\r\n constructor(tree, BOM) {\r\n this._pieces = [];\r\n this._tree = tree;\r\n this._BOM = BOM;\r\n this._index = 0;\r\n if (tree.root !== SENTINEL) {\r\n tree.iterate(tree.root, node => {\r\n if (node !== SENTINEL) {\r\n this._pieces.push(node.piece);\r\n }\r\n return true;\r\n });\r\n }\r\n }\r\n read() {\r\n if (this._pieces.length === 0) {\r\n if (this._index === 0) {\r\n this._index++;\r\n return this._BOM;\r\n }\r\n else {\r\n return null;\r\n }\r\n }\r\n if (this._index > this._pieces.length - 1) {\r\n return null;\r\n }\r\n if (this._index === 0) {\r\n return this._BOM + this._tree.getPieceContent(this._pieces[this._index++]);\r\n }\r\n return this._tree.getPieceContent(this._pieces[this._index++]);\r\n }\r\n}\r\nclass PieceTreeSearchCache {\r\n constructor(limit) {\r\n this._limit = limit;\r\n this._cache = [];\r\n }\r\n get(offset) {\r\n for (let i = this._cache.length - 1; i >= 0; i--) {\r\n let nodePos = this._cache[i];\r\n if (nodePos.nodeStartOffset <= offset && nodePos.nodeStartOffset + nodePos.node.piece.length >= offset) {\r\n return nodePos;\r\n }\r\n }\r\n return null;\r\n }\r\n get2(lineNumber) {\r\n for (let i = this._cache.length - 1; i >= 0; i--) {\r\n let nodePos = this._cache[i];\r\n if (nodePos.nodeStartLineNumber && nodePos.nodeStartLineNumber < lineNumber && nodePos.nodeStartLineNumber + nodePos.node.piece.lineFeedCnt >= lineNumber) {\r\n return nodePos;\r\n }\r\n }\r\n return null;\r\n }\r\n set(nodePosition) {\r\n if (this._cache.length >= this._limit) {\r\n this._cache.shift();\r\n }\r\n this._cache.push(nodePosition);\r\n }\r\n validate(offset) {\r\n let hasInvalidVal = false;\r\n let tmp = this._cache;\r\n for (let i = 0; i < tmp.length; i++) {\r\n let nodePos = tmp[i];\r\n if (nodePos.node.parent === null || nodePos.nodeStartOffset >= offset) {\r\n tmp[i] = null;\r\n hasInvalidVal = true;\r\n continue;\r\n }\r\n }\r\n if (hasInvalidVal) {\r\n let newArr = [];\r\n for (const entry of tmp) {\r\n if (entry !== null) {\r\n newArr.push(entry);\r\n }\r\n }\r\n this._cache = newArr;\r\n }\r\n }\r\n}\r\nexport class PieceTreeBase {\r\n constructor(chunks, eol, eolNormalized) {\r\n this.create(chunks, eol, eolNormalized);\r\n }\r\n create(chunks, eol, eolNormalized) {\r\n this._buffers = [\r\n new StringBuffer('', [0])\r\n ];\r\n this._lastChangeBufferPos = { line: 0, column: 0 };\r\n this.root = SENTINEL;\r\n this._lineCnt = 1;\r\n this._length = 0;\r\n this._EOL = eol;\r\n this._EOLLength = eol.length;\r\n this._EOLNormalized = eolNormalized;\r\n let lastNode = null;\r\n for (let i = 0, len = chunks.length; i < len; i++) {\r\n if (chunks[i].buffer.length > 0) {\r\n if (!chunks[i].lineStarts) {\r\n chunks[i].lineStarts = createLineStartsFast(chunks[i].buffer);\r\n }\r\n let piece = new Piece(i + 1, { line: 0, column: 0 }, { line: chunks[i].lineStarts.length - 1, column: chunks[i].buffer.length - chunks[i].lineStarts[chunks[i].lineStarts.length - 1] }, chunks[i].lineStarts.length - 1, chunks[i].buffer.length);\r\n this._buffers.push(chunks[i]);\r\n lastNode = this.rbInsertRight(lastNode, piece);\r\n }\r\n }\r\n this._searchCache = new PieceTreeSearchCache(1);\r\n this._lastVisitedLine = { lineNumber: 0, value: '' };\r\n this.computeBufferMetadata();\r\n }\r\n normalizeEOL(eol) {\r\n let averageBufferSize = AverageBufferSize;\r\n let min = averageBufferSize - Math.floor(averageBufferSize / 3);\r\n let max = min * 2;\r\n let tempChunk = '';\r\n let tempChunkLen = 0;\r\n let chunks = [];\r\n this.iterate(this.root, node => {\r\n let str = this.getNodeContent(node);\r\n let len = str.length;\r\n if (tempChunkLen <= min || tempChunkLen + len < max) {\r\n tempChunk += str;\r\n tempChunkLen += len;\r\n return true;\r\n }\r\n // flush anyways\r\n let text = tempChunk.replace(/\\r\\n|\\r|\\n/g, eol);\r\n chunks.push(new StringBuffer(text, createLineStartsFast(text)));\r\n tempChunk = str;\r\n tempChunkLen = len;\r\n return true;\r\n });\r\n if (tempChunkLen > 0) {\r\n let text = tempChunk.replace(/\\r\\n|\\r|\\n/g, eol);\r\n chunks.push(new StringBuffer(text, createLineStartsFast(text)));\r\n }\r\n this.create(chunks, eol, true);\r\n }\r\n // #region Buffer API\r\n getEOL() {\r\n return this._EOL;\r\n }\r\n setEOL(newEOL) {\r\n this._EOL = newEOL;\r\n this._EOLLength = this._EOL.length;\r\n this.normalizeEOL(newEOL);\r\n }\r\n createSnapshot(BOM) {\r\n return new PieceTreeSnapshot(this, BOM);\r\n }\r\n getOffsetAt(lineNumber, column) {\r\n let leftLen = 0; // inorder\r\n let x = this.root;\r\n while (x !== SENTINEL) {\r\n if (x.left !== SENTINEL && x.lf_left + 1 >= lineNumber) {\r\n x = x.left;\r\n }\r\n else if (x.lf_left + x.piece.lineFeedCnt + 1 >= lineNumber) {\r\n leftLen += x.size_left;\r\n // lineNumber >= 2\r\n let accumualtedValInCurrentIndex = this.getAccumulatedValue(x, lineNumber - x.lf_left - 2);\r\n return leftLen += accumualtedValInCurrentIndex + column - 1;\r\n }\r\n else {\r\n lineNumber -= x.lf_left + x.piece.lineFeedCnt;\r\n leftLen += x.size_left + x.piece.length;\r\n x = x.right;\r\n }\r\n }\r\n return leftLen;\r\n }\r\n getPositionAt(offset) {\r\n offset = Math.floor(offset);\r\n offset = Math.max(0, offset);\r\n let x = this.root;\r\n let lfCnt = 0;\r\n let originalOffset = offset;\r\n while (x !== SENTINEL) {\r\n if (x.size_left !== 0 && x.size_left >= offset) {\r\n x = x.left;\r\n }\r\n else if (x.size_left + x.piece.length >= offset) {\r\n let out = this.getIndexOf(x, offset - x.size_left);\r\n lfCnt += x.lf_left + out.index;\r\n if (out.index === 0) {\r\n let lineStartOffset = this.getOffsetAt(lfCnt + 1, 1);\r\n let column = originalOffset - lineStartOffset;\r\n return new Position(lfCnt + 1, column + 1);\r\n }\r\n return new Position(lfCnt + 1, out.remainder + 1);\r\n }\r\n else {\r\n offset -= x.size_left + x.piece.length;\r\n lfCnt += x.lf_left + x.piece.lineFeedCnt;\r\n if (x.right === SENTINEL) {\r\n // last node\r\n let lineStartOffset = this.getOffsetAt(lfCnt + 1, 1);\r\n let column = originalOffset - offset - lineStartOffset;\r\n return new Position(lfCnt + 1, column + 1);\r\n }\r\n else {\r\n x = x.right;\r\n }\r\n }\r\n }\r\n return new Position(1, 1);\r\n }\r\n getValueInRange(range, eol) {\r\n if (range.startLineNumber === range.endLineNumber && range.startColumn === range.endColumn) {\r\n return '';\r\n }\r\n let startPosition = this.nodeAt2(range.startLineNumber, range.startColumn);\r\n let endPosition = this.nodeAt2(range.endLineNumber, range.endColumn);\r\n let value = this.getValueInRange2(startPosition, endPosition);\r\n if (eol) {\r\n if (eol !== this._EOL || !this._EOLNormalized) {\r\n return value.replace(/\\r\\n|\\r|\\n/g, eol);\r\n }\r\n if (eol === this.getEOL() && this._EOLNormalized) {\r\n if (eol === '\\r\\n') {\r\n }\r\n return value;\r\n }\r\n return value.replace(/\\r\\n|\\r|\\n/g, eol);\r\n }\r\n return value;\r\n }\r\n getValueInRange2(startPosition, endPosition) {\r\n if (startPosition.node === endPosition.node) {\r\n let node = startPosition.node;\r\n let buffer = this._buffers[node.piece.bufferIndex].buffer;\r\n let startOffset = this.offsetInBuffer(node.piece.bufferIndex, node.piece.start);\r\n return buffer.substring(startOffset + startPosition.remainder, startOffset + endPosition.remainder);\r\n }\r\n let x = startPosition.node;\r\n let buffer = this._buffers[x.piece.bufferIndex].buffer;\r\n let startOffset = this.offsetInBuffer(x.piece.bufferIndex, x.piece.start);\r\n let ret = buffer.substring(startOffset + startPosition.remainder, startOffset + x.piece.length);\r\n x = x.next();\r\n while (x !== SENTINEL) {\r\n let buffer = this._buffers[x.piece.bufferIndex].buffer;\r\n let startOffset = this.offsetInBuffer(x.piece.bufferIndex, x.piece.start);\r\n if (x === endPosition.node) {\r\n ret += buffer.substring(startOffset, startOffset + endPosition.remainder);\r\n break;\r\n }\r\n else {\r\n ret += buffer.substr(startOffset, x.piece.length);\r\n }\r\n x = x.next();\r\n }\r\n return ret;\r\n }\r\n getLinesContent() {\r\n let lines = [];\r\n let linesLength = 0;\r\n let currentLine = '';\r\n let danglingCR = false;\r\n this.iterate(this.root, node => {\r\n if (node === SENTINEL) {\r\n return true;\r\n }\r\n const piece = node.piece;\r\n let pieceLength = piece.length;\r\n if (pieceLength === 0) {\r\n return true;\r\n }\r\n const buffer = this._buffers[piece.bufferIndex].buffer;\r\n const lineStarts = this._buffers[piece.bufferIndex].lineStarts;\r\n const pieceStartLine = piece.start.line;\r\n const pieceEndLine = piece.end.line;\r\n let pieceStartOffset = lineStarts[pieceStartLine] + piece.start.column;\r\n if (danglingCR) {\r\n if (buffer.charCodeAt(pieceStartOffset) === 10 /* LineFeed */) {\r\n // pretend the \\n was in the previous piece..\r\n pieceStartOffset++;\r\n pieceLength--;\r\n }\r\n lines[linesLength++] = currentLine;\r\n currentLine = '';\r\n danglingCR = false;\r\n if (pieceLength === 0) {\r\n return true;\r\n }\r\n }\r\n if (pieceStartLine === pieceEndLine) {\r\n // this piece has no new lines\r\n if (!this._EOLNormalized && buffer.charCodeAt(pieceStartOffset + pieceLength - 1) === 13 /* CarriageReturn */) {\r\n danglingCR = true;\r\n currentLine += buffer.substr(pieceStartOffset, pieceLength - 1);\r\n }\r\n else {\r\n currentLine += buffer.substr(pieceStartOffset, pieceLength);\r\n }\r\n return true;\r\n }\r\n // add the text before the first line start in this piece\r\n currentLine += (this._EOLNormalized\r\n ? buffer.substring(pieceStartOffset, Math.max(pieceStartOffset, lineStarts[pieceStartLine + 1] - this._EOLLength))\r\n : buffer.substring(pieceStartOffset, lineStarts[pieceStartLine + 1]).replace(/(\\r\\n|\\r|\\n)$/, ''));\r\n lines[linesLength++] = currentLine;\r\n for (let line = pieceStartLine + 1; line < pieceEndLine; line++) {\r\n currentLine = (this._EOLNormalized\r\n ? buffer.substring(lineStarts[line], lineStarts[line + 1] - this._EOLLength)\r\n : buffer.substring(lineStarts[line], lineStarts[line + 1]).replace(/(\\r\\n|\\r|\\n)$/, ''));\r\n lines[linesLength++] = currentLine;\r\n }\r\n if (!this._EOLNormalized && buffer.charCodeAt(lineStarts[pieceEndLine] + piece.end.column - 1) === 13 /* CarriageReturn */) {\r\n danglingCR = true;\r\n if (piece.end.column === 0) {\r\n // The last line ended with a \\r, let's undo the push, it will be pushed by next iteration\r\n linesLength--;\r\n }\r\n else {\r\n currentLine = buffer.substr(lineStarts[pieceEndLine], piece.end.column - 1);\r\n }\r\n }\r\n else {\r\n currentLine = buffer.substr(lineStarts[pieceEndLine], piece.end.column);\r\n }\r\n return true;\r\n });\r\n if (danglingCR) {\r\n lines[linesLength++] = currentLine;\r\n currentLine = '';\r\n }\r\n lines[linesLength++] = currentLine;\r\n return lines;\r\n }\r\n getLength() {\r\n return this._length;\r\n }\r\n getLineCount() {\r\n return this._lineCnt;\r\n }\r\n getLineContent(lineNumber) {\r\n if (this._lastVisitedLine.lineNumber === lineNumber) {\r\n return this._lastVisitedLine.value;\r\n }\r\n this._lastVisitedLine.lineNumber = lineNumber;\r\n if (lineNumber === this._lineCnt) {\r\n this._lastVisitedLine.value = this.getLineRawContent(lineNumber);\r\n }\r\n else if (this._EOLNormalized) {\r\n this._lastVisitedLine.value = this.getLineRawContent(lineNumber, this._EOLLength);\r\n }\r\n else {\r\n this._lastVisitedLine.value = this.getLineRawContent(lineNumber).replace(/(\\r\\n|\\r|\\n)$/, '');\r\n }\r\n return this._lastVisitedLine.value;\r\n }\r\n _getCharCode(nodePos) {\r\n if (nodePos.remainder === nodePos.node.piece.length) {\r\n // the char we want to fetch is at the head of next node.\r\n let matchingNode = nodePos.node.next();\r\n if (!matchingNode) {\r\n return 0;\r\n }\r\n let buffer = this._buffers[matchingNode.piece.bufferIndex];\r\n let startOffset = this.offsetInBuffer(matchingNode.piece.bufferIndex, matchingNode.piece.start);\r\n return buffer.buffer.charCodeAt(startOffset);\r\n }\r\n else {\r\n let buffer = this._buffers[nodePos.node.piece.bufferIndex];\r\n let startOffset = this.offsetInBuffer(nodePos.node.piece.bufferIndex, nodePos.node.piece.start);\r\n let targetOffset = startOffset + nodePos.remainder;\r\n return buffer.buffer.charCodeAt(targetOffset);\r\n }\r\n }\r\n getLineCharCode(lineNumber, index) {\r\n let nodePos = this.nodeAt2(lineNumber, index + 1);\r\n return this._getCharCode(nodePos);\r\n }\r\n getLineLength(lineNumber) {\r\n if (lineNumber === this.getLineCount()) {\r\n let startOffset = this.getOffsetAt(lineNumber, 1);\r\n return this.getLength() - startOffset;\r\n }\r\n return this.getOffsetAt(lineNumber + 1, 1) - this.getOffsetAt(lineNumber, 1) - this._EOLLength;\r\n }\r\n findMatchesInNode(node, searcher, startLineNumber, startColumn, startCursor, endCursor, searchData, captureMatches, limitResultCount, resultLen, result) {\r\n let buffer = this._buffers[node.piece.bufferIndex];\r\n let startOffsetInBuffer = this.offsetInBuffer(node.piece.bufferIndex, node.piece.start);\r\n let start = this.offsetInBuffer(node.piece.bufferIndex, startCursor);\r\n let end = this.offsetInBuffer(node.piece.bufferIndex, endCursor);\r\n let m;\r\n // Reset regex to search from the beginning\r\n let ret = { line: 0, column: 0 };\r\n let searchText;\r\n let offsetInBuffer;\r\n if (searcher._wordSeparators) {\r\n searchText = buffer.buffer.substring(start, end);\r\n offsetInBuffer = (offset) => offset + start;\r\n searcher.reset(0);\r\n }\r\n else {\r\n searchText = buffer.buffer;\r\n offsetInBuffer = (offset) => offset;\r\n searcher.reset(start);\r\n }\r\n do {\r\n m = searcher.next(searchText);\r\n if (m) {\r\n if (offsetInBuffer(m.index) >= end) {\r\n return resultLen;\r\n }\r\n this.positionInBuffer(node, offsetInBuffer(m.index) - startOffsetInBuffer, ret);\r\n let lineFeedCnt = this.getLineFeedCnt(node.piece.bufferIndex, startCursor, ret);\r\n let retStartColumn = ret.line === startCursor.line ? ret.column - startCursor.column + startColumn : ret.column + 1;\r\n let retEndColumn = retStartColumn + m[0].length;\r\n result[resultLen++] = createFindMatch(new Range(startLineNumber + lineFeedCnt, retStartColumn, startLineNumber + lineFeedCnt, retEndColumn), m, captureMatches);\r\n if (offsetInBuffer(m.index) + m[0].length >= end) {\r\n return resultLen;\r\n }\r\n if (resultLen >= limitResultCount) {\r\n return resultLen;\r\n }\r\n }\r\n } while (m);\r\n return resultLen;\r\n }\r\n findMatchesLineByLine(searchRange, searchData, captureMatches, limitResultCount) {\r\n const result = [];\r\n let resultLen = 0;\r\n const searcher = new Searcher(searchData.wordSeparators, searchData.regex);\r\n let startPosition = this.nodeAt2(searchRange.startLineNumber, searchRange.startColumn);\r\n if (startPosition === null) {\r\n return [];\r\n }\r\n let endPosition = this.nodeAt2(searchRange.endLineNumber, searchRange.endColumn);\r\n if (endPosition === null) {\r\n return [];\r\n }\r\n let start = this.positionInBuffer(startPosition.node, startPosition.remainder);\r\n let end = this.positionInBuffer(endPosition.node, endPosition.remainder);\r\n if (startPosition.node === endPosition.node) {\r\n this.findMatchesInNode(startPosition.node, searcher, searchRange.startLineNumber, searchRange.startColumn, start, end, searchData, captureMatches, limitResultCount, resultLen, result);\r\n return result;\r\n }\r\n let startLineNumber = searchRange.startLineNumber;\r\n let currentNode = startPosition.node;\r\n while (currentNode !== endPosition.node) {\r\n let lineBreakCnt = this.getLineFeedCnt(currentNode.piece.bufferIndex, start, currentNode.piece.end);\r\n if (lineBreakCnt >= 1) {\r\n // last line break position\r\n let lineStarts = this._buffers[currentNode.piece.bufferIndex].lineStarts;\r\n let startOffsetInBuffer = this.offsetInBuffer(currentNode.piece.bufferIndex, currentNode.piece.start);\r\n let nextLineStartOffset = lineStarts[start.line + lineBreakCnt];\r\n let startColumn = startLineNumber === searchRange.startLineNumber ? searchRange.startColumn : 1;\r\n resultLen = this.findMatchesInNode(currentNode, searcher, startLineNumber, startColumn, start, this.positionInBuffer(currentNode, nextLineStartOffset - startOffsetInBuffer), searchData, captureMatches, limitResultCount, resultLen, result);\r\n if (resultLen >= limitResultCount) {\r\n return result;\r\n }\r\n startLineNumber += lineBreakCnt;\r\n }\r\n let startColumn = startLineNumber === searchRange.startLineNumber ? searchRange.startColumn - 1 : 0;\r\n // search for the remaining content\r\n if (startLineNumber === searchRange.endLineNumber) {\r\n const text = this.getLineContent(startLineNumber).substring(startColumn, searchRange.endColumn - 1);\r\n resultLen = this._findMatchesInLine(searchData, searcher, text, searchRange.endLineNumber, startColumn, resultLen, result, captureMatches, limitResultCount);\r\n return result;\r\n }\r\n resultLen = this._findMatchesInLine(searchData, searcher, this.getLineContent(startLineNumber).substr(startColumn), startLineNumber, startColumn, resultLen, result, captureMatches, limitResultCount);\r\n if (resultLen >= limitResultCount) {\r\n return result;\r\n }\r\n startLineNumber++;\r\n startPosition = this.nodeAt2(startLineNumber, 1);\r\n currentNode = startPosition.node;\r\n start = this.positionInBuffer(startPosition.node, startPosition.remainder);\r\n }\r\n if (startLineNumber === searchRange.endLineNumber) {\r\n let startColumn = startLineNumber === searchRange.startLineNumber ? searchRange.startColumn - 1 : 0;\r\n const text = this.getLineContent(startLineNumber).substring(startColumn, searchRange.endColumn - 1);\r\n resultLen = this._findMatchesInLine(searchData, searcher, text, searchRange.endLineNumber, startColumn, resultLen, result, captureMatches, limitResultCount);\r\n return result;\r\n }\r\n let startColumn = startLineNumber === searchRange.startLineNumber ? searchRange.startColumn : 1;\r\n resultLen = this.findMatchesInNode(endPosition.node, searcher, startLineNumber, startColumn, start, end, searchData, captureMatches, limitResultCount, resultLen, result);\r\n return result;\r\n }\r\n _findMatchesInLine(searchData, searcher, text, lineNumber, deltaOffset, resultLen, result, captureMatches, limitResultCount) {\r\n const wordSeparators = searchData.wordSeparators;\r\n if (!captureMatches && searchData.simpleSearch) {\r\n const searchString = searchData.simpleSearch;\r\n const searchStringLen = searchString.length;\r\n const textLength = text.length;\r\n let lastMatchIndex = -searchStringLen;\r\n while ((lastMatchIndex = text.indexOf(searchString, lastMatchIndex + searchStringLen)) !== -1) {\r\n if (!wordSeparators || isValidMatch(wordSeparators, text, textLength, lastMatchIndex, searchStringLen)) {\r\n result[resultLen++] = new FindMatch(new Range(lineNumber, lastMatchIndex + 1 + deltaOffset, lineNumber, lastMatchIndex + 1 + searchStringLen + deltaOffset), null);\r\n if (resultLen >= limitResultCount) {\r\n return resultLen;\r\n }\r\n }\r\n }\r\n return resultLen;\r\n }\r\n let m;\r\n // Reset regex to search from the beginning\r\n searcher.reset(0);\r\n do {\r\n m = searcher.next(text);\r\n if (m) {\r\n result[resultLen++] = createFindMatch(new Range(lineNumber, m.index + 1 + deltaOffset, lineNumber, m.index + 1 + m[0].length + deltaOffset), m, captureMatches);\r\n if (resultLen >= limitResultCount) {\r\n return resultLen;\r\n }\r\n }\r\n } while (m);\r\n return resultLen;\r\n }\r\n // #endregion\r\n // #region Piece Table\r\n insert(offset, value, eolNormalized = false) {\r\n this._EOLNormalized = this._EOLNormalized && eolNormalized;\r\n this._lastVisitedLine.lineNumber = 0;\r\n this._lastVisitedLine.value = '';\r\n if (this.root !== SENTINEL) {\r\n let { node, remainder, nodeStartOffset } = this.nodeAt(offset);\r\n let piece = node.piece;\r\n let bufferIndex = piece.bufferIndex;\r\n let insertPosInBuffer = this.positionInBuffer(node, remainder);\r\n if (node.piece.bufferIndex === 0 &&\r\n piece.end.line === this._lastChangeBufferPos.line &&\r\n piece.end.column === this._lastChangeBufferPos.column &&\r\n (nodeStartOffset + piece.length === offset) &&\r\n value.length < AverageBufferSize) {\r\n // changed buffer\r\n this.appendToNode(node, value);\r\n this.computeBufferMetadata();\r\n return;\r\n }\r\n if (nodeStartOffset === offset) {\r\n this.insertContentToNodeLeft(value, node);\r\n this._searchCache.validate(offset);\r\n }\r\n else if (nodeStartOffset + node.piece.length > offset) {\r\n // we are inserting into the middle of a node.\r\n let nodesToDel = [];\r\n let newRightPiece = new Piece(piece.bufferIndex, insertPosInBuffer, piece.end, this.getLineFeedCnt(piece.bufferIndex, insertPosInBuffer, piece.end), this.offsetInBuffer(bufferIndex, piece.end) - this.offsetInBuffer(bufferIndex, insertPosInBuffer));\r\n if (this.shouldCheckCRLF() && this.endWithCR(value)) {\r\n let headOfRight = this.nodeCharCodeAt(node, remainder);\r\n if (headOfRight === 10 /** \\n */) {\r\n let newStart = { line: newRightPiece.start.line + 1, column: 0 };\r\n newRightPiece = new Piece(newRightPiece.bufferIndex, newStart, newRightPiece.end, this.getLineFeedCnt(newRightPiece.bufferIndex, newStart, newRightPiece.end), newRightPiece.length - 1);\r\n value += '\\n';\r\n }\r\n }\r\n // reuse node for content before insertion point.\r\n if (this.shouldCheckCRLF() && this.startWithLF(value)) {\r\n let tailOfLeft = this.nodeCharCodeAt(node, remainder - 1);\r\n if (tailOfLeft === 13 /** \\r */) {\r\n let previousPos = this.positionInBuffer(node, remainder - 1);\r\n this.deleteNodeTail(node, previousPos);\r\n value = '\\r' + value;\r\n if (node.piece.length === 0) {\r\n nodesToDel.push(node);\r\n }\r\n }\r\n else {\r\n this.deleteNodeTail(node, insertPosInBuffer);\r\n }\r\n }\r\n else {\r\n this.deleteNodeTail(node, insertPosInBuffer);\r\n }\r\n let newPieces = this.createNewPieces(value);\r\n if (newRightPiece.length > 0) {\r\n this.rbInsertRight(node, newRightPiece);\r\n }\r\n let tmpNode = node;\r\n for (let k = 0; k < newPieces.length; k++) {\r\n tmpNode = this.rbInsertRight(tmpNode, newPieces[k]);\r\n }\r\n this.deleteNodes(nodesToDel);\r\n }\r\n else {\r\n this.insertContentToNodeRight(value, node);\r\n }\r\n }\r\n else {\r\n // insert new node\r\n let pieces = this.createNewPieces(value);\r\n let node = this.rbInsertLeft(null, pieces[0]);\r\n for (let k = 1; k < pieces.length; k++) {\r\n node = this.rbInsertRight(node, pieces[k]);\r\n }\r\n }\r\n // todo, this is too brutal. Total line feed count should be updated the same way as lf_left.\r\n this.computeBufferMetadata();\r\n }\r\n delete(offset, cnt) {\r\n this._lastVisitedLine.lineNumber = 0;\r\n this._lastVisitedLine.value = '';\r\n if (cnt <= 0 || this.root === SENTINEL) {\r\n return;\r\n }\r\n let startPosition = this.nodeAt(offset);\r\n let endPosition = this.nodeAt(offset + cnt);\r\n let startNode = startPosition.node;\r\n let endNode = endPosition.node;\r\n if (startNode === endNode) {\r\n let startSplitPosInBuffer = this.positionInBuffer(startNode, startPosition.remainder);\r\n let endSplitPosInBuffer = this.positionInBuffer(startNode, endPosition.remainder);\r\n if (startPosition.nodeStartOffset === offset) {\r\n if (cnt === startNode.piece.length) { // delete node\r\n let next = startNode.next();\r\n rbDelete(this, startNode);\r\n this.validateCRLFWithPrevNode(next);\r\n this.computeBufferMetadata();\r\n return;\r\n }\r\n this.deleteNodeHead(startNode, endSplitPosInBuffer);\r\n this._searchCache.validate(offset);\r\n this.validateCRLFWithPrevNode(startNode);\r\n this.computeBufferMetadata();\r\n return;\r\n }\r\n if (startPosition.nodeStartOffset + startNode.piece.length === offset + cnt) {\r\n this.deleteNodeTail(startNode, startSplitPosInBuffer);\r\n this.validateCRLFWithNextNode(startNode);\r\n this.computeBufferMetadata();\r\n return;\r\n }\r\n // delete content in the middle, this node will be splitted to nodes\r\n this.shrinkNode(startNode, startSplitPosInBuffer, endSplitPosInBuffer);\r\n this.computeBufferMetadata();\r\n return;\r\n }\r\n let nodesToDel = [];\r\n let startSplitPosInBuffer = this.positionInBuffer(startNode, startPosition.remainder);\r\n this.deleteNodeTail(startNode, startSplitPosInBuffer);\r\n this._searchCache.validate(offset);\r\n if (startNode.piece.length === 0) {\r\n nodesToDel.push(startNode);\r\n }\r\n // update last touched node\r\n let endSplitPosInBuffer = this.positionInBuffer(endNode, endPosition.remainder);\r\n this.deleteNodeHead(endNode, endSplitPosInBuffer);\r\n if (endNode.piece.length === 0) {\r\n nodesToDel.push(endNode);\r\n }\r\n // delete nodes in between\r\n let secondNode = startNode.next();\r\n for (let node = secondNode; node !== SENTINEL && node !== endNode; node = node.next()) {\r\n nodesToDel.push(node);\r\n }\r\n let prev = startNode.piece.length === 0 ? startNode.prev() : startNode;\r\n this.deleteNodes(nodesToDel);\r\n this.validateCRLFWithNextNode(prev);\r\n this.computeBufferMetadata();\r\n }\r\n insertContentToNodeLeft(value, node) {\r\n // we are inserting content to the beginning of node\r\n let nodesToDel = [];\r\n if (this.shouldCheckCRLF() && this.endWithCR(value) && this.startWithLF(node)) {\r\n // move `\\n` to new node.\r\n let piece = node.piece;\r\n let newStart = { line: piece.start.line + 1, column: 0 };\r\n let nPiece = new Piece(piece.bufferIndex, newStart, piece.end, this.getLineFeedCnt(piece.bufferIndex, newStart, piece.end), piece.length - 1);\r\n node.piece = nPiece;\r\n value += '\\n';\r\n updateTreeMetadata(this, node, -1, -1);\r\n if (node.piece.length === 0) {\r\n nodesToDel.push(node);\r\n }\r\n }\r\n let newPieces = this.createNewPieces(value);\r\n let newNode = this.rbInsertLeft(node, newPieces[newPieces.length - 1]);\r\n for (let k = newPieces.length - 2; k >= 0; k--) {\r\n newNode = this.rbInsertLeft(newNode, newPieces[k]);\r\n }\r\n this.validateCRLFWithPrevNode(newNode);\r\n this.deleteNodes(nodesToDel);\r\n }\r\n insertContentToNodeRight(value, node) {\r\n // we are inserting to the right of this node.\r\n if (this.adjustCarriageReturnFromNext(value, node)) {\r\n // move \\n to the new node.\r\n value += '\\n';\r\n }\r\n let newPieces = this.createNewPieces(value);\r\n let newNode = this.rbInsertRight(node, newPieces[0]);\r\n let tmpNode = newNode;\r\n for (let k = 1; k < newPieces.length; k++) {\r\n tmpNode = this.rbInsertRight(tmpNode, newPieces[k]);\r\n }\r\n this.validateCRLFWithPrevNode(newNode);\r\n }\r\n positionInBuffer(node, remainder, ret) {\r\n let piece = node.piece;\r\n let bufferIndex = node.piece.bufferIndex;\r\n let lineStarts = this._buffers[bufferIndex].lineStarts;\r\n let startOffset = lineStarts[piece.start.line] + piece.start.column;\r\n let offset = startOffset + remainder;\r\n // binary search offset between startOffset and endOffset\r\n let low = piece.start.line;\r\n let high = piece.end.line;\r\n let mid = 0;\r\n let midStop = 0;\r\n let midStart = 0;\r\n while (low <= high) {\r\n mid = low + ((high - low) / 2) | 0;\r\n midStart = lineStarts[mid];\r\n if (mid === high) {\r\n break;\r\n }\r\n midStop = lineStarts[mid + 1];\r\n if (offset < midStart) {\r\n high = mid - 1;\r\n }\r\n else if (offset >= midStop) {\r\n low = mid + 1;\r\n }\r\n else {\r\n break;\r\n }\r\n }\r\n if (ret) {\r\n ret.line = mid;\r\n ret.column = offset - midStart;\r\n return null;\r\n }\r\n return {\r\n line: mid,\r\n column: offset - midStart\r\n };\r\n }\r\n getLineFeedCnt(bufferIndex, start, end) {\r\n // we don't need to worry about start: abc\\r|\\n, or abc|\\r, or abc|\\n, or abc|\\r\\n doesn't change the fact that, there is one line break after start.\r\n // now let's take care of end: abc\\r|\\n, if end is in between \\r and \\n, we need to add line feed count by 1\r\n if (end.column === 0) {\r\n return end.line - start.line;\r\n }\r\n let lineStarts = this._buffers[bufferIndex].lineStarts;\r\n if (end.line === lineStarts.length - 1) { // it means, there is no \\n after end, otherwise, there will be one more lineStart.\r\n return end.line - start.line;\r\n }\r\n let nextLineStartOffset = lineStarts[end.line + 1];\r\n let endOffset = lineStarts[end.line] + end.column;\r\n if (nextLineStartOffset > endOffset + 1) { // there are more than 1 character after end, which means it can't be \\n\r\n return end.line - start.line;\r\n }\r\n // endOffset + 1 === nextLineStartOffset\r\n // character at endOffset is \\n, so we check the character before first\r\n // if character at endOffset is \\r, end.column is 0 and we can't get here.\r\n let previousCharOffset = endOffset - 1; // end.column > 0 so it's okay.\r\n let buffer = this._buffers[bufferIndex].buffer;\r\n if (buffer.charCodeAt(previousCharOffset) === 13) {\r\n return end.line - start.line + 1;\r\n }\r\n else {\r\n return end.line - start.line;\r\n }\r\n }\r\n offsetInBuffer(bufferIndex, cursor) {\r\n let lineStarts = this._buffers[bufferIndex].lineStarts;\r\n return lineStarts[cursor.line] + cursor.column;\r\n }\r\n deleteNodes(nodes) {\r\n for (let i = 0; i < nodes.length; i++) {\r\n rbDelete(this, nodes[i]);\r\n }\r\n }\r\n createNewPieces(text) {\r\n if (text.length > AverageBufferSize) {\r\n // the content is large, operations like substring, charCode becomes slow\r\n // so here we split it into smaller chunks, just like what we did for CR/LF normalization\r\n let newPieces = [];\r\n while (text.length > AverageBufferSize) {\r\n const lastChar = text.charCodeAt(AverageBufferSize - 1);\r\n let splitText;\r\n if (lastChar === 13 /* CarriageReturn */ || (lastChar >= 0xD800 && lastChar <= 0xDBFF)) {\r\n // last character is \\r or a high surrogate => keep it back\r\n splitText = text.substring(0, AverageBufferSize - 1);\r\n text = text.substring(AverageBufferSize - 1);\r\n }\r\n else {\r\n splitText = text.substring(0, AverageBufferSize);\r\n text = text.substring(AverageBufferSize);\r\n }\r\n let lineStarts = createLineStartsFast(splitText);\r\n newPieces.push(new Piece(this._buffers.length, /* buffer index */ { line: 0, column: 0 }, { line: lineStarts.length - 1, column: splitText.length - lineStarts[lineStarts.length - 1] }, lineStarts.length - 1, splitText.length));\r\n this._buffers.push(new StringBuffer(splitText, lineStarts));\r\n }\r\n let lineStarts = createLineStartsFast(text);\r\n newPieces.push(new Piece(this._buffers.length, /* buffer index */ { line: 0, column: 0 }, { line: lineStarts.length - 1, column: text.length - lineStarts[lineStarts.length - 1] }, lineStarts.length - 1, text.length));\r\n this._buffers.push(new StringBuffer(text, lineStarts));\r\n return newPieces;\r\n }\r\n let startOffset = this._buffers[0].buffer.length;\r\n const lineStarts = createLineStartsFast(text, false);\r\n let start = this._lastChangeBufferPos;\r\n if (this._buffers[0].lineStarts[this._buffers[0].lineStarts.length - 1] === startOffset\r\n && startOffset !== 0\r\n && this.startWithLF(text)\r\n && this.endWithCR(this._buffers[0].buffer) // todo, we can check this._lastChangeBufferPos's column as it's the last one\r\n ) {\r\n this._lastChangeBufferPos = { line: this._lastChangeBufferPos.line, column: this._lastChangeBufferPos.column + 1 };\r\n start = this._lastChangeBufferPos;\r\n for (let i = 0; i < lineStarts.length; i++) {\r\n lineStarts[i] += startOffset + 1;\r\n }\r\n this._buffers[0].lineStarts = this._buffers[0].lineStarts.concat(lineStarts.slice(1));\r\n this._buffers[0].buffer += '_' + text;\r\n startOffset += 1;\r\n }\r\n else {\r\n if (startOffset !== 0) {\r\n for (let i = 0; i < lineStarts.length; i++) {\r\n lineStarts[i] += startOffset;\r\n }\r\n }\r\n this._buffers[0].lineStarts = this._buffers[0].lineStarts.concat(lineStarts.slice(1));\r\n this._buffers[0].buffer += text;\r\n }\r\n const endOffset = this._buffers[0].buffer.length;\r\n let endIndex = this._buffers[0].lineStarts.length - 1;\r\n let endColumn = endOffset - this._buffers[0].lineStarts[endIndex];\r\n let endPos = { line: endIndex, column: endColumn };\r\n let newPiece = new Piece(0, /** todo@peng */ start, endPos, this.getLineFeedCnt(0, start, endPos), endOffset - startOffset);\r\n this._lastChangeBufferPos = endPos;\r\n return [newPiece];\r\n }\r\n getLineRawContent(lineNumber, endOffset = 0) {\r\n let x = this.root;\r\n let ret = '';\r\n let cache = this._searchCache.get2(lineNumber);\r\n if (cache) {\r\n x = cache.node;\r\n let prevAccumulatedValue = this.getAccumulatedValue(x, lineNumber - cache.nodeStartLineNumber - 1);\r\n let buffer = this._buffers[x.piece.bufferIndex].buffer;\r\n let startOffset = this.offsetInBuffer(x.piece.bufferIndex, x.piece.start);\r\n if (cache.nodeStartLineNumber + x.piece.lineFeedCnt === lineNumber) {\r\n ret = buffer.substring(startOffset + prevAccumulatedValue, startOffset + x.piece.length);\r\n }\r\n else {\r\n let accumulatedValue = this.getAccumulatedValue(x, lineNumber - cache.nodeStartLineNumber);\r\n return buffer.substring(startOffset + prevAccumulatedValue, startOffset + accumulatedValue - endOffset);\r\n }\r\n }\r\n else {\r\n let nodeStartOffset = 0;\r\n const originalLineNumber = lineNumber;\r\n while (x !== SENTINEL) {\r\n if (x.left !== SENTINEL && x.lf_left >= lineNumber - 1) {\r\n x = x.left;\r\n }\r\n else if (x.lf_left + x.piece.lineFeedCnt > lineNumber - 1) {\r\n let prevAccumulatedValue = this.getAccumulatedValue(x, lineNumber - x.lf_left - 2);\r\n let accumulatedValue = this.getAccumulatedValue(x, lineNumber - x.lf_left - 1);\r\n let buffer = this._buffers[x.piece.bufferIndex].buffer;\r\n let startOffset = this.offsetInBuffer(x.piece.bufferIndex, x.piece.start);\r\n nodeStartOffset += x.size_left;\r\n this._searchCache.set({\r\n node: x,\r\n nodeStartOffset,\r\n nodeStartLineNumber: originalLineNumber - (lineNumber - 1 - x.lf_left)\r\n });\r\n return buffer.substring(startOffset + prevAccumulatedValue, startOffset + accumulatedValue - endOffset);\r\n }\r\n else if (x.lf_left + x.piece.lineFeedCnt === lineNumber - 1) {\r\n let prevAccumulatedValue = this.getAccumulatedValue(x, lineNumber - x.lf_left - 2);\r\n let buffer = this._buffers[x.piece.bufferIndex].buffer;\r\n let startOffset = this.offsetInBuffer(x.piece.bufferIndex, x.piece.start);\r\n ret = buffer.substring(startOffset + prevAccumulatedValue, startOffset + x.piece.length);\r\n break;\r\n }\r\n else {\r\n lineNumber -= x.lf_left + x.piece.lineFeedCnt;\r\n nodeStartOffset += x.size_left + x.piece.length;\r\n x = x.right;\r\n }\r\n }\r\n }\r\n // search in order, to find the node contains end column\r\n x = x.next();\r\n while (x !== SENTINEL) {\r\n let buffer = this._buffers[x.piece.bufferIndex].buffer;\r\n if (x.piece.lineFeedCnt > 0) {\r\n let accumulatedValue = this.getAccumulatedValue(x, 0);\r\n let startOffset = this.offsetInBuffer(x.piece.bufferIndex, x.piece.start);\r\n ret += buffer.substring(startOffset, startOffset + accumulatedValue - endOffset);\r\n return ret;\r\n }\r\n else {\r\n let startOffset = this.offsetInBuffer(x.piece.bufferIndex, x.piece.start);\r\n ret += buffer.substr(startOffset, x.piece.length);\r\n }\r\n x = x.next();\r\n }\r\n return ret;\r\n }\r\n computeBufferMetadata() {\r\n let x = this.root;\r\n let lfCnt = 1;\r\n let len = 0;\r\n while (x !== SENTINEL) {\r\n lfCnt += x.lf_left + x.piece.lineFeedCnt;\r\n len += x.size_left + x.piece.length;\r\n x = x.right;\r\n }\r\n this._lineCnt = lfCnt;\r\n this._length = len;\r\n this._searchCache.validate(this._length);\r\n }\r\n // #region node operations\r\n getIndexOf(node, accumulatedValue) {\r\n let piece = node.piece;\r\n let pos = this.positionInBuffer(node, accumulatedValue);\r\n let lineCnt = pos.line - piece.start.line;\r\n if (this.offsetInBuffer(piece.bufferIndex, piece.end) - this.offsetInBuffer(piece.bufferIndex, piece.start) === accumulatedValue) {\r\n // we are checking the end of this node, so a CRLF check is necessary.\r\n let realLineCnt = this.getLineFeedCnt(node.piece.bufferIndex, piece.start, pos);\r\n if (realLineCnt !== lineCnt) {\r\n // aha yes, CRLF\r\n return { index: realLineCnt, remainder: 0 };\r\n }\r\n }\r\n return { index: lineCnt, remainder: pos.column };\r\n }\r\n getAccumulatedValue(node, index) {\r\n if (index < 0) {\r\n return 0;\r\n }\r\n let piece = node.piece;\r\n let lineStarts = this._buffers[piece.bufferIndex].lineStarts;\r\n let expectedLineStartIndex = piece.start.line + index + 1;\r\n if (expectedLineStartIndex > piece.end.line) {\r\n return lineStarts[piece.end.line] + piece.end.column - lineStarts[piece.start.line] - piece.start.column;\r\n }\r\n else {\r\n return lineStarts[expectedLineStartIndex] - lineStarts[piece.start.line] - piece.start.column;\r\n }\r\n }\r\n deleteNodeTail(node, pos) {\r\n const piece = node.piece;\r\n const originalLFCnt = piece.lineFeedCnt;\r\n const originalEndOffset = this.offsetInBuffer(piece.bufferIndex, piece.end);\r\n const newEnd = pos;\r\n const newEndOffset = this.offsetInBuffer(piece.bufferIndex, newEnd);\r\n const newLineFeedCnt = this.getLineFeedCnt(piece.bufferIndex, piece.start, newEnd);\r\n const lf_delta = newLineFeedCnt - originalLFCnt;\r\n const size_delta = newEndOffset - originalEndOffset;\r\n const newLength = piece.length + size_delta;\r\n node.piece = new Piece(piece.bufferIndex, piece.start, newEnd, newLineFeedCnt, newLength);\r\n updateTreeMetadata(this, node, size_delta, lf_delta);\r\n }\r\n deleteNodeHead(node, pos) {\r\n const piece = node.piece;\r\n const originalLFCnt = piece.lineFeedCnt;\r\n const originalStartOffset = this.offsetInBuffer(piece.bufferIndex, piece.start);\r\n const newStart = pos;\r\n const newLineFeedCnt = this.getLineFeedCnt(piece.bufferIndex, newStart, piece.end);\r\n const newStartOffset = this.offsetInBuffer(piece.bufferIndex, newStart);\r\n const lf_delta = newLineFeedCnt - originalLFCnt;\r\n const size_delta = originalStartOffset - newStartOffset;\r\n const newLength = piece.length + size_delta;\r\n node.piece = new Piece(piece.bufferIndex, newStart, piece.end, newLineFeedCnt, newLength);\r\n updateTreeMetadata(this, node, size_delta, lf_delta);\r\n }\r\n shrinkNode(node, start, end) {\r\n const piece = node.piece;\r\n const originalStartPos = piece.start;\r\n const originalEndPos = piece.end;\r\n // old piece, originalStartPos, start\r\n const oldLength = piece.length;\r\n const oldLFCnt = piece.lineFeedCnt;\r\n const newEnd = start;\r\n const newLineFeedCnt = this.getLineFeedCnt(piece.bufferIndex, piece.start, newEnd);\r\n const newLength = this.offsetInBuffer(piece.bufferIndex, start) - this.offsetInBuffer(piece.bufferIndex, originalStartPos);\r\n node.piece = new Piece(piece.bufferIndex, piece.start, newEnd, newLineFeedCnt, newLength);\r\n updateTreeMetadata(this, node, newLength - oldLength, newLineFeedCnt - oldLFCnt);\r\n // new right piece, end, originalEndPos\r\n let newPiece = new Piece(piece.bufferIndex, end, originalEndPos, this.getLineFeedCnt(piece.bufferIndex, end, originalEndPos), this.offsetInBuffer(piece.bufferIndex, originalEndPos) - this.offsetInBuffer(piece.bufferIndex, end));\r\n let newNode = this.rbInsertRight(node, newPiece);\r\n this.validateCRLFWithPrevNode(newNode);\r\n }\r\n appendToNode(node, value) {\r\n if (this.adjustCarriageReturnFromNext(value, node)) {\r\n value += '\\n';\r\n }\r\n const hitCRLF = this.shouldCheckCRLF() && this.startWithLF(value) && this.endWithCR(node);\r\n const startOffset = this._buffers[0].buffer.length;\r\n this._buffers[0].buffer += value;\r\n const lineStarts = createLineStartsFast(value, false);\r\n for (let i = 0; i < lineStarts.length; i++) {\r\n lineStarts[i] += startOffset;\r\n }\r\n if (hitCRLF) {\r\n let prevStartOffset = this._buffers[0].lineStarts[this._buffers[0].lineStarts.length - 2];\r\n this._buffers[0].lineStarts.pop();\r\n // _lastChangeBufferPos is already wrong\r\n this._lastChangeBufferPos = { line: this._lastChangeBufferPos.line - 1, column: startOffset - prevStartOffset };\r\n }\r\n this._buffers[0].lineStarts = this._buffers[0].lineStarts.concat(lineStarts.slice(1));\r\n const endIndex = this._buffers[0].lineStarts.length - 1;\r\n const endColumn = this._buffers[0].buffer.length - this._buffers[0].lineStarts[endIndex];\r\n const newEnd = { line: endIndex, column: endColumn };\r\n const newLength = node.piece.length + value.length;\r\n const oldLineFeedCnt = node.piece.lineFeedCnt;\r\n const newLineFeedCnt = this.getLineFeedCnt(0, node.piece.start, newEnd);\r\n const lf_delta = newLineFeedCnt - oldLineFeedCnt;\r\n node.piece = new Piece(node.piece.bufferIndex, node.piece.start, newEnd, newLineFeedCnt, newLength);\r\n this._lastChangeBufferPos = newEnd;\r\n updateTreeMetadata(this, node, value.length, lf_delta);\r\n }\r\n nodeAt(offset) {\r\n let x = this.root;\r\n let cache = this._searchCache.get(offset);\r\n if (cache) {\r\n return {\r\n node: cache.node,\r\n nodeStartOffset: cache.nodeStartOffset,\r\n remainder: offset - cache.nodeStartOffset\r\n };\r\n }\r\n let nodeStartOffset = 0;\r\n while (x !== SENTINEL) {\r\n if (x.size_left > offset) {\r\n x = x.left;\r\n }\r\n else if (x.size_left + x.piece.length >= offset) {\r\n nodeStartOffset += x.size_left;\r\n let ret = {\r\n node: x,\r\n remainder: offset - x.size_left,\r\n nodeStartOffset\r\n };\r\n this._searchCache.set(ret);\r\n return ret;\r\n }\r\n else {\r\n offset -= x.size_left + x.piece.length;\r\n nodeStartOffset += x.size_left + x.piece.length;\r\n x = x.right;\r\n }\r\n }\r\n return null;\r\n }\r\n nodeAt2(lineNumber, column) {\r\n let x = this.root;\r\n let nodeStartOffset = 0;\r\n while (x !== SENTINEL) {\r\n if (x.left !== SENTINEL && x.lf_left >= lineNumber - 1) {\r\n x = x.left;\r\n }\r\n else if (x.lf_left + x.piece.lineFeedCnt > lineNumber - 1) {\r\n let prevAccumualtedValue = this.getAccumulatedValue(x, lineNumber - x.lf_left - 2);\r\n let accumulatedValue = this.getAccumulatedValue(x, lineNumber - x.lf_left - 1);\r\n nodeStartOffset += x.size_left;\r\n return {\r\n node: x,\r\n remainder: Math.min(prevAccumualtedValue + column - 1, accumulatedValue),\r\n nodeStartOffset\r\n };\r\n }\r\n else if (x.lf_left + x.piece.lineFeedCnt === lineNumber - 1) {\r\n let prevAccumualtedValue = this.getAccumulatedValue(x, lineNumber - x.lf_left - 2);\r\n if (prevAccumualtedValue + column - 1 <= x.piece.length) {\r\n return {\r\n node: x,\r\n remainder: prevAccumualtedValue + column - 1,\r\n nodeStartOffset\r\n };\r\n }\r\n else {\r\n column -= x.piece.length - prevAccumualtedValue;\r\n break;\r\n }\r\n }\r\n else {\r\n lineNumber -= x.lf_left + x.piece.lineFeedCnt;\r\n nodeStartOffset += x.size_left + x.piece.length;\r\n x = x.right;\r\n }\r\n }\r\n // search in order, to find the node contains position.column\r\n x = x.next();\r\n while (x !== SENTINEL) {\r\n if (x.piece.lineFeedCnt > 0) {\r\n let accumulatedValue = this.getAccumulatedValue(x, 0);\r\n let nodeStartOffset = this.offsetOfNode(x);\r\n return {\r\n node: x,\r\n remainder: Math.min(column - 1, accumulatedValue),\r\n nodeStartOffset\r\n };\r\n }\r\n else {\r\n if (x.piece.length >= column - 1) {\r\n let nodeStartOffset = this.offsetOfNode(x);\r\n return {\r\n node: x,\r\n remainder: column - 1,\r\n nodeStartOffset\r\n };\r\n }\r\n else {\r\n column -= x.piece.length;\r\n }\r\n }\r\n x = x.next();\r\n }\r\n return null;\r\n }\r\n nodeCharCodeAt(node, offset) {\r\n if (node.piece.lineFeedCnt < 1) {\r\n return -1;\r\n }\r\n let buffer = this._buffers[node.piece.bufferIndex];\r\n let newOffset = this.offsetInBuffer(node.piece.bufferIndex, node.piece.start) + offset;\r\n return buffer.buffer.charCodeAt(newOffset);\r\n }\r\n offsetOfNode(node) {\r\n if (!node) {\r\n return 0;\r\n }\r\n let pos = node.size_left;\r\n while (node !== this.root) {\r\n if (node.parent.right === node) {\r\n pos += node.parent.size_left + node.parent.piece.length;\r\n }\r\n node = node.parent;\r\n }\r\n return pos;\r\n }\r\n // #endregion\r\n // #region CRLF\r\n shouldCheckCRLF() {\r\n return !(this._EOLNormalized && this._EOL === '\\n');\r\n }\r\n startWithLF(val) {\r\n if (typeof val === 'string') {\r\n return val.charCodeAt(0) === 10;\r\n }\r\n if (val === SENTINEL || val.piece.lineFeedCnt === 0) {\r\n return false;\r\n }\r\n let piece = val.piece;\r\n let lineStarts = this._buffers[piece.bufferIndex].lineStarts;\r\n let line = piece.start.line;\r\n let startOffset = lineStarts[line] + piece.start.column;\r\n if (line === lineStarts.length - 1) {\r\n // last line, so there is no line feed at the end of this line\r\n return false;\r\n }\r\n let nextLineOffset = lineStarts[line + 1];\r\n if (nextLineOffset > startOffset + 1) {\r\n return false;\r\n }\r\n return this._buffers[piece.bufferIndex].buffer.charCodeAt(startOffset) === 10;\r\n }\r\n endWithCR(val) {\r\n if (typeof val === 'string') {\r\n return val.charCodeAt(val.length - 1) === 13;\r\n }\r\n if (val === SENTINEL || val.piece.lineFeedCnt === 0) {\r\n return false;\r\n }\r\n return this.nodeCharCodeAt(val, val.piece.length - 1) === 13;\r\n }\r\n validateCRLFWithPrevNode(nextNode) {\r\n if (this.shouldCheckCRLF() && this.startWithLF(nextNode)) {\r\n let node = nextNode.prev();\r\n if (this.endWithCR(node)) {\r\n this.fixCRLF(node, nextNode);\r\n }\r\n }\r\n }\r\n validateCRLFWithNextNode(node) {\r\n if (this.shouldCheckCRLF() && this.endWithCR(node)) {\r\n let nextNode = node.next();\r\n if (this.startWithLF(nextNode)) {\r\n this.fixCRLF(node, nextNode);\r\n }\r\n }\r\n }\r\n fixCRLF(prev, next) {\r\n let nodesToDel = [];\r\n // update node\r\n let lineStarts = this._buffers[prev.piece.bufferIndex].lineStarts;\r\n let newEnd;\r\n if (prev.piece.end.column === 0) {\r\n // it means, last line ends with \\r, not \\r\\n\r\n newEnd = { line: prev.piece.end.line - 1, column: lineStarts[prev.piece.end.line] - lineStarts[prev.piece.end.line - 1] - 1 };\r\n }\r\n else {\r\n // \\r\\n\r\n newEnd = { line: prev.piece.end.line, column: prev.piece.end.column - 1 };\r\n }\r\n const prevNewLength = prev.piece.length - 1;\r\n const prevNewLFCnt = prev.piece.lineFeedCnt - 1;\r\n prev.piece = new Piece(prev.piece.bufferIndex, prev.piece.start, newEnd, prevNewLFCnt, prevNewLength);\r\n updateTreeMetadata(this, prev, -1, -1);\r\n if (prev.piece.length === 0) {\r\n nodesToDel.push(prev);\r\n }\r\n // update nextNode\r\n let newStart = { line: next.piece.start.line + 1, column: 0 };\r\n const newLength = next.piece.length - 1;\r\n const newLineFeedCnt = this.getLineFeedCnt(next.piece.bufferIndex, newStart, next.piece.end);\r\n next.piece = new Piece(next.piece.bufferIndex, newStart, next.piece.end, newLineFeedCnt, newLength);\r\n updateTreeMetadata(this, next, -1, -1);\r\n if (next.piece.length === 0) {\r\n nodesToDel.push(next);\r\n }\r\n // create new piece which contains \\r\\n\r\n let pieces = this.createNewPieces('\\r\\n');\r\n this.rbInsertRight(prev, pieces[0]);\r\n // delete empty nodes\r\n for (let i = 0; i < nodesToDel.length; i++) {\r\n rbDelete(this, nodesToDel[i]);\r\n }\r\n }\r\n adjustCarriageReturnFromNext(value, node) {\r\n if (this.shouldCheckCRLF() && this.endWithCR(value)) {\r\n let nextNode = node.next();\r\n if (this.startWithLF(nextNode)) {\r\n // move `\\n` forward\r\n value += '\\n';\r\n if (nextNode.piece.length === 1) {\r\n rbDelete(this, nextNode);\r\n }\r\n else {\r\n const piece = nextNode.piece;\r\n const newStart = { line: piece.start.line + 1, column: 0 };\r\n const newLength = piece.length - 1;\r\n const newLineFeedCnt = this.getLineFeedCnt(piece.bufferIndex, newStart, piece.end);\r\n nextNode.piece = new Piece(piece.bufferIndex, newStart, piece.end, newLineFeedCnt, newLength);\r\n updateTreeMetadata(this, nextNode, -1, -1);\r\n }\r\n return true;\r\n }\r\n }\r\n return false;\r\n }\r\n // #endregion\r\n // #endregion\r\n // #region Tree operations\r\n iterate(node, callback) {\r\n if (node === SENTINEL) {\r\n return callback(SENTINEL);\r\n }\r\n let leftRet = this.iterate(node.left, callback);\r\n if (!leftRet) {\r\n return leftRet;\r\n }\r\n return callback(node) && this.iterate(node.right, callback);\r\n }\r\n getNodeContent(node) {\r\n if (node === SENTINEL) {\r\n return '';\r\n }\r\n let buffer = this._buffers[node.piece.bufferIndex];\r\n let currentContent;\r\n let piece = node.piece;\r\n let startOffset = this.offsetInBuffer(piece.bufferIndex, piece.start);\r\n let endOffset = this.offsetInBuffer(piece.bufferIndex, piece.end);\r\n currentContent = buffer.buffer.substring(startOffset, endOffset);\r\n return currentContent;\r\n }\r\n getPieceContent(piece) {\r\n let buffer = this._buffers[piece.bufferIndex];\r\n let startOffset = this.offsetInBuffer(piece.bufferIndex, piece.start);\r\n let endOffset = this.offsetInBuffer(piece.bufferIndex, piece.end);\r\n let currentContent = buffer.buffer.substring(startOffset, endOffset);\r\n return currentContent;\r\n }\r\n /**\r\n * node node\r\n * / \\ / \\\r\n * a b <---- a b\r\n * /\r\n * z\r\n */\r\n rbInsertRight(node, p) {\r\n let z = new TreeNode(p, 1 /* Red */);\r\n z.left = SENTINEL;\r\n z.right = SENTINEL;\r\n z.parent = SENTINEL;\r\n z.size_left = 0;\r\n z.lf_left = 0;\r\n let x = this.root;\r\n if (x === SENTINEL) {\r\n this.root = z;\r\n z.color = 0 /* Black */;\r\n }\r\n else if (node.right === SENTINEL) {\r\n node.right = z;\r\n z.parent = node;\r\n }\r\n else {\r\n let nextNode = leftest(node.right);\r\n nextNode.left = z;\r\n z.parent = nextNode;\r\n }\r\n fixInsert(this, z);\r\n return z;\r\n }\r\n /**\r\n * node node\r\n * / \\ / \\\r\n * a b ----> a b\r\n * \\\r\n * z\r\n */\r\n rbInsertLeft(node, p) {\r\n let z = new TreeNode(p, 1 /* Red */);\r\n z.left = SENTINEL;\r\n z.right = SENTINEL;\r\n z.parent = SENTINEL;\r\n z.size_left = 0;\r\n z.lf_left = 0;\r\n if (this.root === SENTINEL) {\r\n this.root = z;\r\n z.color = 0 /* Black */;\r\n }\r\n else if (node.left === SENTINEL) {\r\n node.left = z;\r\n z.parent = node;\r\n }\r\n else {\r\n let prevNode = righttest(node.left); // a\r\n prevNode.right = z;\r\n z.parent = prevNode;\r\n }\r\n fixInsert(this, z);\r\n return z;\r\n }\r\n}\r\n", "/**\r\n * Returns the last element of an array.\r\n * @param array The array.\r\n * @param n Which element from the end (default is zero).\r\n */\r\nexport function tail(array, n = 0) {\r\n return array[array.length - (1 + n)];\r\n}\r\nexport function tail2(arr) {\r\n if (arr.length === 0) {\r\n throw new Error('Invalid tail call');\r\n }\r\n return [arr.slice(0, arr.length - 1), arr[arr.length - 1]];\r\n}\r\nexport function equals(one, other, itemEquals = (a, b) => a === b) {\r\n if (one === other) {\r\n return true;\r\n }\r\n if (!one || !other) {\r\n return false;\r\n }\r\n if (one.length !== other.length) {\r\n return false;\r\n }\r\n for (let i = 0, len = one.length; i < len; i++) {\r\n if (!itemEquals(one[i], other[i])) {\r\n return false;\r\n }\r\n }\r\n return true;\r\n}\r\nexport function binarySearch(array, key, comparator) {\r\n let low = 0, high = array.length - 1;\r\n while (low <= high) {\r\n const mid = ((low + high) / 2) | 0;\r\n const comp = comparator(array[mid], key);\r\n if (comp < 0) {\r\n low = mid + 1;\r\n }\r\n else if (comp > 0) {\r\n high = mid - 1;\r\n }\r\n else {\r\n return mid;\r\n }\r\n }\r\n return -(low + 1);\r\n}\r\n/**\r\n * Takes a sorted array and a function p. The array is sorted in such a way that all elements where p(x) is false\r\n * are located before all elements where p(x) is true.\r\n * @returns the least x for which p(x) is true or array.length if no element fullfills the given function.\r\n */\r\nexport function findFirstInSorted(array, p) {\r\n let low = 0, high = array.length;\r\n if (high === 0) {\r\n return 0; // no children\r\n }\r\n while (low < high) {\r\n const mid = Math.floor((low + high) / 2);\r\n if (p(array[mid])) {\r\n high = mid;\r\n }\r\n else {\r\n low = mid + 1;\r\n }\r\n }\r\n return low;\r\n}\r\nexport function quickSelect(nth, data, compare) {\r\n nth = nth | 0;\r\n if (nth >= data.length) {\r\n throw new TypeError('invalid index');\r\n }\r\n let pivotValue = data[Math.floor(data.length * Math.random())];\r\n let lower = [];\r\n let higher = [];\r\n let pivots = [];\r\n for (let value of data) {\r\n const val = compare(value, pivotValue);\r\n if (val < 0) {\r\n lower.push(value);\r\n }\r\n else if (val > 0) {\r\n higher.push(value);\r\n }\r\n else {\r\n pivots.push(value);\r\n }\r\n }\r\n if (nth < lower.length) {\r\n return quickSelect(nth, lower, compare);\r\n }\r\n else if (nth < lower.length + pivots.length) {\r\n return pivots[0];\r\n }\r\n else {\r\n return quickSelect(nth - (lower.length + pivots.length), higher, compare);\r\n }\r\n}\r\nexport function groupBy(data, compare) {\r\n const result = [];\r\n let currentGroup = undefined;\r\n for (const element of data.slice(0).sort(compare)) {\r\n if (!currentGroup || compare(currentGroup[0], element) !== 0) {\r\n currentGroup = [element];\r\n result.push(currentGroup);\r\n }\r\n else {\r\n currentGroup.push(element);\r\n }\r\n }\r\n return result;\r\n}\r\n/**\r\n * @returns New array with all falsy values removed. The original array IS NOT modified.\r\n */\r\nexport function coalesce(array) {\r\n return array.filter(e => !!e);\r\n}\r\n/**\r\n * @returns false if the provided object is an array and not empty.\r\n */\r\nexport function isFalsyOrEmpty(obj) {\r\n return !Array.isArray(obj) || obj.length === 0;\r\n}\r\nexport function isNonEmptyArray(obj) {\r\n return Array.isArray(obj) && obj.length > 0;\r\n}\r\n/**\r\n * Removes duplicates from the given array. The optional keyFn allows to specify\r\n * how elements are checked for equalness by returning a unique string for each.\r\n */\r\nexport function distinct(array, keyFn) {\r\n if (!keyFn) {\r\n return array.filter((element, position) => {\r\n return array.indexOf(element) === position;\r\n });\r\n }\r\n const seen = Object.create(null);\r\n return array.filter((elem) => {\r\n const key = keyFn(elem);\r\n if (seen[key]) {\r\n return false;\r\n }\r\n seen[key] = true;\r\n return true;\r\n });\r\n}\r\nexport function distinctES6(array) {\r\n const seen = new Set();\r\n return array.filter(element => {\r\n if (seen.has(element)) {\r\n return false;\r\n }\r\n seen.add(element);\r\n return true;\r\n });\r\n}\r\nexport function firstOrDefault(array, notFoundValue) {\r\n return array.length > 0 ? array[0] : notFoundValue;\r\n}\r\nexport function flatten(arr) {\r\n return [].concat(...arr);\r\n}\r\nexport function range(arg, to) {\r\n let from = typeof to === 'number' ? arg : 0;\r\n if (typeof to === 'number') {\r\n from = arg;\r\n }\r\n else {\r\n from = 0;\r\n to = arg;\r\n }\r\n const result = [];\r\n if (from <= to) {\r\n for (let i = from; i < to; i++) {\r\n result.push(i);\r\n }\r\n }\r\n else {\r\n for (let i = from; i > to; i--) {\r\n result.push(i);\r\n }\r\n }\r\n return result;\r\n}\r\n/**\r\n * Insert `insertArr` inside `target` at `insertIndex`.\r\n * Please don't touch unless you understand https://jsperf.com/inserting-an-array-within-an-array\r\n */\r\nexport function arrayInsert(target, insertIndex, insertArr) {\r\n const before = target.slice(0, insertIndex);\r\n const after = target.slice(insertIndex);\r\n return before.concat(insertArr, after);\r\n}\r\n/**\r\n * Pushes an element to the start of the array, if found.\r\n */\r\nexport function pushToStart(arr, value) {\r\n const index = arr.indexOf(value);\r\n if (index > -1) {\r\n arr.splice(index, 1);\r\n arr.unshift(value);\r\n }\r\n}\r\n/**\r\n * Pushes an element to the end of the array, if found.\r\n */\r\nexport function pushToEnd(arr, value) {\r\n const index = arr.indexOf(value);\r\n if (index > -1) {\r\n arr.splice(index, 1);\r\n arr.push(value);\r\n }\r\n}\r\nexport function asArray(x) {\r\n return Array.isArray(x) ? x : [x];\r\n}\r\n/**\r\n * Insert the new items in the array.\r\n * @param array The original array.\r\n * @param start The zero-based location in the array from which to start inserting elements.\r\n * @param newItems The items to be inserted\r\n */\r\nexport function insertInto(array, start, newItems) {\r\n const startIdx = getActualStartIndex(array, start);\r\n const originalLength = array.length;\r\n const newItemsLength = newItems.length;\r\n array.length = originalLength + newItemsLength;\r\n // Move the items after the start index, start from the end so that we don't overwrite any value.\r\n for (let i = originalLength - 1; i >= startIdx; i--) {\r\n array[i + newItemsLength] = array[i];\r\n }\r\n for (let i = 0; i < newItemsLength; i++) {\r\n array[i + startIdx] = newItems[i];\r\n }\r\n}\r\n/**\r\n * Removes elements from an array and inserts new elements in their place, returning the deleted elements. Alternative to the native Array.splice method, it\r\n * can only support limited number of items due to the maximum call stack size limit.\r\n * @param array The original array.\r\n * @param start The zero-based location in the array from which to start removing elements.\r\n * @param deleteCount The number of elements to remove.\r\n * @returns An array containing the elements that were deleted.\r\n */\r\nexport function splice(array, start, deleteCount, newItems) {\r\n const index = getActualStartIndex(array, start);\r\n const result = array.splice(index, deleteCount);\r\n insertInto(array, index, newItems);\r\n return result;\r\n}\r\n/**\r\n * Determine the actual start index (same logic as the native splice() or slice())\r\n * If greater than the length of the array, start will be set to the length of the array. In this case, no element will be deleted but the method will behave as an adding function, adding as many element as item[n*] provided.\r\n * If negative, it will begin that many elements from the end of the array. (In this case, the origin -1, meaning -n is the index of the nth last element, and is therefore equivalent to the index of array.length - n.) If array.length + start is less than 0, it will begin from index 0.\r\n * @param array The target array.\r\n * @param start The operation index.\r\n */\r\nfunction getActualStartIndex(array, start) {\r\n return start < 0 ? Math.max(start + array.length, 0) : Math.min(start, array.length);\r\n}\r\nexport class ArrayQueue {\r\n /**\r\n * Constructs a queue that is backed by the given array. Runtime is O(1).\r\n */\r\n constructor(items) {\r\n this.items = items;\r\n this.firstIdx = 0;\r\n this.lastIdx = this.items.length - 1;\r\n }\r\n /**\r\n * Consumes elements from the beginning of the queue as long as the predicate returns true.\r\n * If no elements were consumed, `null` is returned. Has a runtime of O(result.length).\r\n */\r\n takeWhile(predicate) {\r\n // P(k) := k <= this.lastIdx && predicate(this.items[k])\r\n // Find s := min { k | k >= this.firstIdx && !P(k) } and return this.data[this.firstIdx...s)\r\n let startIdx = this.firstIdx;\r\n while (startIdx < this.items.length && predicate(this.items[startIdx])) {\r\n startIdx++;\r\n }\r\n const result = startIdx === this.firstIdx ? null : this.items.slice(this.firstIdx, startIdx);\r\n this.firstIdx = startIdx;\r\n return result;\r\n }\r\n /**\r\n * Consumes elements from the end of the queue as long as the predicate returns true.\r\n * If no elements were consumed, `null` is returned.\r\n * The result has the same order as the underlying array!\r\n */\r\n takeFromEndWhile(predicate) {\r\n // P(k) := this.firstIdx >= k && predicate(this.items[k])\r\n // Find s := max { k | k <= this.lastIdx && !P(k) } and return this.data(s...this.lastIdx]\r\n let endIdx = this.lastIdx;\r\n while (endIdx >= 0 && predicate(this.items[endIdx])) {\r\n endIdx--;\r\n }\r\n const result = endIdx === this.lastIdx ? null : this.items.slice(endIdx + 1, this.lastIdx + 1);\r\n this.lastIdx = endIdx;\r\n return result;\r\n }\r\n}\r\n", "/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License. See License.txt in the project root for license information.\r\n *--------------------------------------------------------------------------------------------*/\r\nimport * as strings from './strings.js';\r\n/**\r\n * Return a hash value for an object.\r\n */\r\nexport function hash(obj) {\r\n return doHash(obj, 0);\r\n}\r\nexport function doHash(obj, hashVal) {\r\n switch (typeof obj) {\r\n case 'object':\r\n if (obj === null) {\r\n return numberHash(349, hashVal);\r\n }\r\n else if (Array.isArray(obj)) {\r\n return arrayHash(obj, hashVal);\r\n }\r\n return objectHash(obj, hashVal);\r\n case 'string':\r\n return stringHash(obj, hashVal);\r\n case 'boolean':\r\n return booleanHash(obj, hashVal);\r\n case 'number':\r\n return numberHash(obj, hashVal);\r\n case 'undefined':\r\n return numberHash(937, hashVal);\r\n default:\r\n return numberHash(617, hashVal);\r\n }\r\n}\r\nfunction numberHash(val, initialHashVal) {\r\n return (((initialHashVal << 5) - initialHashVal) + val) | 0; // hashVal * 31 + ch, keep as int32\r\n}\r\nfunction booleanHash(b, initialHashVal) {\r\n return numberHash(b ? 433 : 863, initialHashVal);\r\n}\r\nexport function stringHash(s, hashVal) {\r\n hashVal = numberHash(149417, hashVal);\r\n for (let i = 0, length = s.length; i < length; i++) {\r\n hashVal = numberHash(s.charCodeAt(i), hashVal);\r\n }\r\n return hashVal;\r\n}\r\nfunction arrayHash(arr, initialHashVal) {\r\n initialHashVal = numberHash(104579, initialHashVal);\r\n return arr.reduce((hashVal, item) => doHash(item, hashVal), initialHashVal);\r\n}\r\nfunction objectHash(obj, initialHashVal) {\r\n initialHashVal = numberHash(181387, initialHashVal);\r\n return Object.keys(obj).sort().reduce((hashVal, key) => {\r\n hashVal = stringHash(key, hashVal);\r\n return doHash(obj[key], hashVal);\r\n }, initialHashVal);\r\n}\r\nfunction leftRotate(value, bits, totalBits = 32) {\r\n // delta + bits = totalBits\r\n const delta = totalBits - bits;\r\n // All ones, expect `delta` zeros aligned to the right\r\n const mask = ~((1 << delta) - 1);\r\n // Join (value left-shifted `bits` bits) with (masked value right-shifted `delta` bits)\r\n return ((value << bits) | ((mask & value) >>> delta)) >>> 0;\r\n}\r\nfunction fill(dest, index = 0, count = dest.byteLength, value = 0) {\r\n for (let i = 0; i < count; i++) {\r\n dest[index + i] = value;\r\n }\r\n}\r\nfunction leftPad(value, length, char = '0') {\r\n while (value.length < length) {\r\n value = char + value;\r\n }\r\n return value;\r\n}\r\nexport function toHexString(bufferOrValue, bitsize = 32) {\r\n if (bufferOrValue instanceof ArrayBuffer) {\r\n return Array.from(new Uint8Array(bufferOrValue)).map(b => b.toString(16).padStart(2, '0')).join('');\r\n }\r\n return leftPad((bufferOrValue >>> 0).toString(16), bitsize / 4);\r\n}\r\n/**\r\n * A SHA1 implementation that works with strings and does not allocate.\r\n */\r\nexport class StringSHA1 {\r\n constructor() {\r\n this._h0 = 0x67452301;\r\n this._h1 = 0xEFCDAB89;\r\n this._h2 = 0x98BADCFE;\r\n this._h3 = 0x10325476;\r\n this._h4 = 0xC3D2E1F0;\r\n this._buff = new Uint8Array(64 /* BLOCK_SIZE */ + 3 /* to fit any utf-8 */);\r\n this._buffDV = new DataView(this._buff.buffer);\r\n this._buffLen = 0;\r\n this._totalLen = 0;\r\n this._leftoverHighSurrogate = 0;\r\n this._finished = false;\r\n }\r\n update(str) {\r\n const strLen = str.length;\r\n if (strLen === 0) {\r\n return;\r\n }\r\n const buff = this._buff;\r\n let buffLen = this._buffLen;\r\n let leftoverHighSurrogate = this._leftoverHighSurrogate;\r\n let charCode;\r\n let offset;\r\n if (leftoverHighSurrogate !== 0) {\r\n charCode = leftoverHighSurrogate;\r\n offset = -1;\r\n leftoverHighSurrogate = 0;\r\n }\r\n else {\r\n charCode = str.charCodeAt(0);\r\n offset = 0;\r\n }\r\n while (true) {\r\n let codePoint = charCode;\r\n if (strings.isHighSurrogate(charCode)) {\r\n if (offset + 1 < strLen) {\r\n const nextCharCode = str.charCodeAt(offset + 1);\r\n if (strings.isLowSurrogate(nextCharCode)) {\r\n offset++;\r\n codePoint = strings.computeCodePoint(charCode, nextCharCode);\r\n }\r\n else {\r\n // illegal => unicode replacement character\r\n codePoint = 65533 /* UNICODE_REPLACEMENT */;\r\n }\r\n }\r\n else {\r\n // last character is a surrogate pair\r\n leftoverHighSurrogate = charCode;\r\n break;\r\n }\r\n }\r\n else if (strings.isLowSurrogate(charCode)) {\r\n // illegal => unicode replacement character\r\n codePoint = 65533 /* UNICODE_REPLACEMENT */;\r\n }\r\n buffLen = this._push(buff, buffLen, codePoint);\r\n offset++;\r\n if (offset < strLen) {\r\n charCode = str.charCodeAt(offset);\r\n }\r\n else {\r\n break;\r\n }\r\n }\r\n this._buffLen = buffLen;\r\n this._leftoverHighSurrogate = leftoverHighSurrogate;\r\n }\r\n _push(buff, buffLen, codePoint) {\r\n if (codePoint < 0x0080) {\r\n buff[buffLen++] = codePoint;\r\n }\r\n else if (codePoint < 0x0800) {\r\n buff[buffLen++] = 0b11000000 | ((codePoint & 0b00000000000000000000011111000000) >>> 6);\r\n buff[buffLen++] = 0b10000000 | ((codePoint & 0b00000000000000000000000000111111) >>> 0);\r\n }\r\n else if (codePoint < 0x10000) {\r\n buff[buffLen++] = 0b11100000 | ((codePoint & 0b00000000000000001111000000000000) >>> 12);\r\n buff[buffLen++] = 0b10000000 | ((codePoint & 0b00000000000000000000111111000000) >>> 6);\r\n buff[buffLen++] = 0b10000000 | ((codePoint & 0b00000000000000000000000000111111) >>> 0);\r\n }\r\n else {\r\n buff[buffLen++] = 0b11110000 | ((codePoint & 0b00000000000111000000000000000000) >>> 18);\r\n buff[buffLen++] = 0b10000000 | ((codePoint & 0b00000000000000111111000000000000) >>> 12);\r\n buff[buffLen++] = 0b10000000 | ((codePoint & 0b00000000000000000000111111000000) >>> 6);\r\n buff[buffLen++] = 0b10000000 | ((codePoint & 0b00000000000000000000000000111111) >>> 0);\r\n }\r\n if (buffLen >= 64 /* BLOCK_SIZE */) {\r\n this._step();\r\n buffLen -= 64 /* BLOCK_SIZE */;\r\n this._totalLen += 64 /* BLOCK_SIZE */;\r\n // take last 3 in case of UTF8 overflow\r\n buff[0] = buff[64 /* BLOCK_SIZE */ + 0];\r\n buff[1] = buff[64 /* BLOCK_SIZE */ + 1];\r\n buff[2] = buff[64 /* BLOCK_SIZE */ + 2];\r\n }\r\n return buffLen;\r\n }\r\n digest() {\r\n if (!this._finished) {\r\n this._finished = true;\r\n if (this._leftoverHighSurrogate) {\r\n // illegal => unicode replacement character\r\n this._leftoverHighSurrogate = 0;\r\n this._buffLen = this._push(this._buff, this._buffLen, 65533 /* UNICODE_REPLACEMENT */);\r\n }\r\n this._totalLen += this._buffLen;\r\n this._wrapUp();\r\n }\r\n return toHexString(this._h0) + toHexString(this._h1) + toHexString(this._h2) + toHexString(this._h3) + toHexString(this._h4);\r\n }\r\n _wrapUp() {\r\n this._buff[this._buffLen++] = 0x80;\r\n fill(this._buff, this._buffLen);\r\n if (this._buffLen > 56) {\r\n this._step();\r\n fill(this._buff);\r\n }\r\n // this will fit because the mantissa can cover up to 52 bits\r\n const ml = 8 * this._totalLen;\r\n this._buffDV.setUint32(56, Math.floor(ml / 4294967296), false);\r\n this._buffDV.setUint32(60, ml % 4294967296, false);\r\n this._step();\r\n }\r\n _step() {\r\n const bigBlock32 = StringSHA1._bigBlock32;\r\n const data = this._buffDV;\r\n for (let j = 0; j < 64 /* 16*4 */; j += 4) {\r\n bigBlock32.setUint32(j, data.getUint32(j, false), false);\r\n }\r\n for (let j = 64; j < 320 /* 80*4 */; j += 4) {\r\n bigBlock32.setUint32(j, leftRotate((bigBlock32.getUint32(j - 12, false) ^ bigBlock32.getUint32(j - 32, false) ^ bigBlock32.getUint32(j - 56, false) ^ bigBlock32.getUint32(j - 64, false)), 1), false);\r\n }\r\n let a = this._h0;\r\n let b = this._h1;\r\n let c = this._h2;\r\n let d = this._h3;\r\n let e = this._h4;\r\n let f, k;\r\n let temp;\r\n for (let j = 0; j < 80; j++) {\r\n if (j < 20) {\r\n f = (b & c) | ((~b) & d);\r\n k = 0x5A827999;\r\n }\r\n else if (j < 40) {\r\n f = b ^ c ^ d;\r\n k = 0x6ED9EBA1;\r\n }\r\n else if (j < 60) {\r\n f = (b & c) | (b & d) | (c & d);\r\n k = 0x8F1BBCDC;\r\n }\r\n else {\r\n f = b ^ c ^ d;\r\n k = 0xCA62C1D6;\r\n }\r\n temp = (leftRotate(a, 5) + f + e + k + bigBlock32.getUint32(j * 4, false)) & 0xffffffff;\r\n e = d;\r\n d = c;\r\n c = leftRotate(b, 30);\r\n b = a;\r\n a = temp;\r\n }\r\n this._h0 = (this._h0 + a) & 0xffffffff;\r\n this._h1 = (this._h1 + b) & 0xffffffff;\r\n this._h2 = (this._h2 + c) & 0xffffffff;\r\n this._h3 = (this._h3 + d) & 0xffffffff;\r\n this._h4 = (this._h4 + e) & 0xffffffff;\r\n }\r\n}\r\nStringSHA1._bigBlock32 = new DataView(new ArrayBuffer(320)); // 80 * 4 = 320\r\n", "/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License. See License.txt in the project root for license information.\r\n *--------------------------------------------------------------------------------------------*/\r\nvar _a, _b;\r\nimport { URI } from './uri.js';\r\nimport { compareSubstringIgnoreCase, compare, compareSubstring, compareIgnoreCase } from './strings.js';\r\nexport class StringIterator {\r\n constructor() {\r\n this._value = '';\r\n this._pos = 0;\r\n }\r\n reset(key) {\r\n this._value = key;\r\n this._pos = 0;\r\n return this;\r\n }\r\n next() {\r\n this._pos += 1;\r\n return this;\r\n }\r\n hasNext() {\r\n return this._pos < this._value.length - 1;\r\n }\r\n cmp(a) {\r\n const aCode = a.charCodeAt(0);\r\n const thisCode = this._value.charCodeAt(this._pos);\r\n return aCode - thisCode;\r\n }\r\n value() {\r\n return this._value[this._pos];\r\n }\r\n}\r\nexport class ConfigKeysIterator {\r\n constructor(_caseSensitive = true) {\r\n this._caseSensitive = _caseSensitive;\r\n }\r\n reset(key) {\r\n this._value = key;\r\n this._from = 0;\r\n this._to = 0;\r\n return this.next();\r\n }\r\n hasNext() {\r\n return this._to < this._value.length;\r\n }\r\n next() {\r\n // this._data = key.split(/[\\\\/]/).filter(s => !!s);\r\n this._from = this._to;\r\n let justSeps = true;\r\n for (; this._to < this._value.length; this._to++) {\r\n const ch = this._value.charCodeAt(this._to);\r\n if (ch === 46 /* Period */) {\r\n if (justSeps) {\r\n this._from++;\r\n }\r\n else {\r\n break;\r\n }\r\n }\r\n else {\r\n justSeps = false;\r\n }\r\n }\r\n return this;\r\n }\r\n cmp(a) {\r\n return this._caseSensitive\r\n ? compareSubstring(a, this._value, 0, a.length, this._from, this._to)\r\n : compareSubstringIgnoreCase(a, this._value, 0, a.length, this._from, this._to);\r\n }\r\n value() {\r\n return this._value.substring(this._from, this._to);\r\n }\r\n}\r\nexport class PathIterator {\r\n constructor(_splitOnBackslash = true, _caseSensitive = true) {\r\n this._splitOnBackslash = _splitOnBackslash;\r\n this._caseSensitive = _caseSensitive;\r\n }\r\n reset(key) {\r\n this._value = key.replace(/\\\\$|\\/$/, '');\r\n this._from = 0;\r\n this._to = 0;\r\n return this.next();\r\n }\r\n hasNext() {\r\n return this._to < this._value.length;\r\n }\r\n next() {\r\n // this._data = key.split(/[\\\\/]/).filter(s => !!s);\r\n this._from = this._to;\r\n let justSeps = true;\r\n for (; this._to < this._value.length; this._to++) {\r\n const ch = this._value.charCodeAt(this._to);\r\n if (ch === 47 /* Slash */ || this._splitOnBackslash && ch === 92 /* Backslash */) {\r\n if (justSeps) {\r\n this._from++;\r\n }\r\n else {\r\n break;\r\n }\r\n }\r\n else {\r\n justSeps = false;\r\n }\r\n }\r\n return this;\r\n }\r\n cmp(a) {\r\n return this._caseSensitive\r\n ? compareSubstring(a, this._value, 0, a.length, this._from, this._to)\r\n : compareSubstringIgnoreCase(a, this._value, 0, a.length, this._from, this._to);\r\n }\r\n value() {\r\n return this._value.substring(this._from, this._to);\r\n }\r\n}\r\nexport class UriIterator {\r\n constructor(_ignorePathCasing) {\r\n this._ignorePathCasing = _ignorePathCasing;\r\n this._states = [];\r\n this._stateIdx = 0;\r\n }\r\n reset(key) {\r\n this._value = key;\r\n this._states = [];\r\n if (this._value.scheme) {\r\n this._states.push(1 /* Scheme */);\r\n }\r\n if (this._value.authority) {\r\n this._states.push(2 /* Authority */);\r\n }\r\n if (this._value.path) {\r\n this._pathIterator = new PathIterator(false, !this._ignorePathCasing(key));\r\n this._pathIterator.reset(key.path);\r\n if (this._pathIterator.value()) {\r\n this._states.push(3 /* Path */);\r\n }\r\n }\r\n if (this._value.query) {\r\n this._states.push(4 /* Query */);\r\n }\r\n if (this._value.fragment) {\r\n this._states.push(5 /* Fragment */);\r\n }\r\n this._stateIdx = 0;\r\n return this;\r\n }\r\n next() {\r\n if (this._states[this._stateIdx] === 3 /* Path */ && this._pathIterator.hasNext()) {\r\n this._pathIterator.next();\r\n }\r\n else {\r\n this._stateIdx += 1;\r\n }\r\n return this;\r\n }\r\n hasNext() {\r\n return (this._states[this._stateIdx] === 3 /* Path */ && this._pathIterator.hasNext())\r\n || this._stateIdx < this._states.length - 1;\r\n }\r\n cmp(a) {\r\n if (this._states[this._stateIdx] === 1 /* Scheme */) {\r\n return compareIgnoreCase(a, this._value.scheme);\r\n }\r\n else if (this._states[this._stateIdx] === 2 /* Authority */) {\r\n return compareIgnoreCase(a, this._value.authority);\r\n }\r\n else if (this._states[this._stateIdx] === 3 /* Path */) {\r\n return this._pathIterator.cmp(a);\r\n }\r\n else if (this._states[this._stateIdx] === 4 /* Query */) {\r\n return compare(a, this._value.query);\r\n }\r\n else if (this._states[this._stateIdx] === 5 /* Fragment */) {\r\n return compare(a, this._value.fragment);\r\n }\r\n throw new Error();\r\n }\r\n value() {\r\n if (this._states[this._stateIdx] === 1 /* Scheme */) {\r\n return this._value.scheme;\r\n }\r\n else if (this._states[this._stateIdx] === 2 /* Authority */) {\r\n return this._value.authority;\r\n }\r\n else if (this._states[this._stateIdx] === 3 /* Path */) {\r\n return this._pathIterator.value();\r\n }\r\n else if (this._states[this._stateIdx] === 4 /* Query */) {\r\n return this._value.query;\r\n }\r\n else if (this._states[this._stateIdx] === 5 /* Fragment */) {\r\n return this._value.fragment;\r\n }\r\n throw new Error();\r\n }\r\n}\r\nclass TernarySearchTreeNode {\r\n isEmpty() {\r\n return !this.left && !this.mid && !this.right && !this.value;\r\n }\r\n}\r\nexport class TernarySearchTree {\r\n constructor(segments) {\r\n this._iter = segments;\r\n }\r\n static forUris(ignorePathCasing = () => false) {\r\n return new TernarySearchTree(new UriIterator(ignorePathCasing));\r\n }\r\n static forStrings() {\r\n return new TernarySearchTree(new StringIterator());\r\n }\r\n static forConfigKeys() {\r\n return new TernarySearchTree(new ConfigKeysIterator());\r\n }\r\n clear() {\r\n this._root = undefined;\r\n }\r\n set(key, element) {\r\n const iter = this._iter.reset(key);\r\n let node;\r\n if (!this._root) {\r\n this._root = new TernarySearchTreeNode();\r\n this._root.segment = iter.value();\r\n }\r\n node = this._root;\r\n while (true) {\r\n const val = iter.cmp(node.segment);\r\n if (val > 0) {\r\n // left\r\n if (!node.left) {\r\n node.left = new TernarySearchTreeNode();\r\n node.left.segment = iter.value();\r\n }\r\n node = node.left;\r\n }\r\n else if (val < 0) {\r\n // right\r\n if (!node.right) {\r\n node.right = new TernarySearchTreeNode();\r\n node.right.segment = iter.value();\r\n }\r\n node = node.right;\r\n }\r\n else if (iter.hasNext()) {\r\n // mid\r\n iter.next();\r\n if (!node.mid) {\r\n node.mid = new TernarySearchTreeNode();\r\n node.mid.segment = iter.value();\r\n }\r\n node = node.mid;\r\n }\r\n else {\r\n break;\r\n }\r\n }\r\n const oldElement = node.value;\r\n node.value = element;\r\n node.key = key;\r\n return oldElement;\r\n }\r\n get(key) {\r\n var _c;\r\n return (_c = this._getNode(key)) === null || _c === void 0 ? void 0 : _c.value;\r\n }\r\n _getNode(key) {\r\n const iter = this._iter.reset(key);\r\n let node = this._root;\r\n while (node) {\r\n const val = iter.cmp(node.segment);\r\n if (val > 0) {\r\n // left\r\n node = node.left;\r\n }\r\n else if (val < 0) {\r\n // right\r\n node = node.right;\r\n }\r\n else if (iter.hasNext()) {\r\n // mid\r\n iter.next();\r\n node = node.mid;\r\n }\r\n else {\r\n break;\r\n }\r\n }\r\n return node;\r\n }\r\n has(key) {\r\n const node = this._getNode(key);\r\n return !((node === null || node === void 0 ? void 0 : node.value) === undefined && (node === null || node === void 0 ? void 0 : node.mid) === undefined);\r\n }\r\n delete(key) {\r\n return this._delete(key, false);\r\n }\r\n deleteSuperstr(key) {\r\n return this._delete(key, true);\r\n }\r\n _delete(key, superStr) {\r\n const iter = this._iter.reset(key);\r\n const stack = [];\r\n let node = this._root;\r\n // find and unset node\r\n while (node) {\r\n const val = iter.cmp(node.segment);\r\n if (val > 0) {\r\n // left\r\n stack.push([1, node]);\r\n node = node.left;\r\n }\r\n else if (val < 0) {\r\n // right\r\n stack.push([-1, node]);\r\n node = node.right;\r\n }\r\n else if (iter.hasNext()) {\r\n // mid\r\n iter.next();\r\n stack.push([0, node]);\r\n node = node.mid;\r\n }\r\n else {\r\n if (superStr) {\r\n // remove children\r\n node.left = undefined;\r\n node.mid = undefined;\r\n node.right = undefined;\r\n }\r\n else {\r\n // remove element\r\n node.value = undefined;\r\n }\r\n // clean up empty nodes\r\n while (stack.length > 0 && node.isEmpty()) {\r\n let [dir, parent] = stack.pop();\r\n switch (dir) {\r\n case 1:\r\n parent.left = undefined;\r\n break;\r\n case 0:\r\n parent.mid = undefined;\r\n break;\r\n case -1:\r\n parent.right = undefined;\r\n break;\r\n }\r\n node = parent;\r\n }\r\n break;\r\n }\r\n }\r\n }\r\n findSubstr(key) {\r\n const iter = this._iter.reset(key);\r\n let node = this._root;\r\n let candidate = undefined;\r\n while (node) {\r\n const val = iter.cmp(node.segment);\r\n if (val > 0) {\r\n // left\r\n node = node.left;\r\n }\r\n else if (val < 0) {\r\n // right\r\n node = node.right;\r\n }\r\n else if (iter.hasNext()) {\r\n // mid\r\n iter.next();\r\n candidate = node.value || candidate;\r\n node = node.mid;\r\n }\r\n else {\r\n break;\r\n }\r\n }\r\n return node && node.value || candidate;\r\n }\r\n findSuperstr(key) {\r\n const iter = this._iter.reset(key);\r\n let node = this._root;\r\n while (node) {\r\n const val = iter.cmp(node.segment);\r\n if (val > 0) {\r\n // left\r\n node = node.left;\r\n }\r\n else if (val < 0) {\r\n // right\r\n node = node.right;\r\n }\r\n else if (iter.hasNext()) {\r\n // mid\r\n iter.next();\r\n node = node.mid;\r\n }\r\n else {\r\n // collect\r\n if (!node.mid) {\r\n return undefined;\r\n }\r\n else {\r\n return this._entries(node.mid);\r\n }\r\n }\r\n }\r\n return undefined;\r\n }\r\n forEach(callback) {\r\n for (const [key, value] of this) {\r\n callback(value, key);\r\n }\r\n }\r\n *[Symbol.iterator]() {\r\n yield* this._entries(this._root);\r\n }\r\n *_entries(node) {\r\n // DFS\r\n if (!node) {\r\n return;\r\n }\r\n const stack = [node];\r\n while (stack.length > 0) {\r\n const node = stack.pop();\r\n if (node) {\r\n if (node.value) {\r\n yield [node.key, node.value];\r\n }\r\n if (node.left) {\r\n stack.push(node.left);\r\n }\r\n if (node.mid) {\r\n stack.push(node.mid);\r\n }\r\n if (node.right) {\r\n stack.push(node.right);\r\n }\r\n }\r\n }\r\n }\r\n}\r\nexport class ResourceMap {\r\n constructor(mapOrKeyFn, toKey) {\r\n this[_a] = 'ResourceMap';\r\n if (mapOrKeyFn instanceof ResourceMap) {\r\n this.map = new Map(mapOrKeyFn.map);\r\n this.toKey = toKey !== null && toKey !== void 0 ? toKey : ResourceMap.defaultToKey;\r\n }\r\n else {\r\n this.map = new Map();\r\n this.toKey = mapOrKeyFn !== null && mapOrKeyFn !== void 0 ? mapOrKeyFn : ResourceMap.defaultToKey;\r\n }\r\n }\r\n set(resource, value) {\r\n this.map.set(this.toKey(resource), value);\r\n return this;\r\n }\r\n get(resource) {\r\n return this.map.get(this.toKey(resource));\r\n }\r\n has(resource) {\r\n return this.map.has(this.toKey(resource));\r\n }\r\n get size() {\r\n return this.map.size;\r\n }\r\n clear() {\r\n this.map.clear();\r\n }\r\n delete(resource) {\r\n return this.map.delete(this.toKey(resource));\r\n }\r\n forEach(clb, thisArg) {\r\n if (typeof thisArg !== 'undefined') {\r\n clb = clb.bind(thisArg);\r\n }\r\n for (let [index, value] of this.map) {\r\n clb(value, URI.parse(index), this);\r\n }\r\n }\r\n values() {\r\n return this.map.values();\r\n }\r\n *keys() {\r\n for (let key of this.map.keys()) {\r\n yield URI.parse(key);\r\n }\r\n }\r\n *entries() {\r\n for (let tuple of this.map.entries()) {\r\n yield [URI.parse(tuple[0]), tuple[1]];\r\n }\r\n }\r\n *[(_a = Symbol.toStringTag, Symbol.iterator)]() {\r\n for (let item of this.map) {\r\n yield [URI.parse(item[0]), item[1]];\r\n }\r\n }\r\n}\r\nResourceMap.defaultToKey = (resource) => resource.toString();\r\nexport class LinkedMap {\r\n constructor() {\r\n this[_b] = 'LinkedMap';\r\n this._map = new Map();\r\n this._head = undefined;\r\n this._tail = undefined;\r\n this._size = 0;\r\n this._state = 0;\r\n }\r\n clear() {\r\n this._map.clear();\r\n this._head = undefined;\r\n this._tail = undefined;\r\n this._size = 0;\r\n this._state++;\r\n }\r\n isEmpty() {\r\n return !this._head && !this._tail;\r\n }\r\n get size() {\r\n return this._size;\r\n }\r\n get first() {\r\n var _c;\r\n return (_c = this._head) === null || _c === void 0 ? void 0 : _c.value;\r\n }\r\n get last() {\r\n var _c;\r\n return (_c = this._tail) === null || _c === void 0 ? void 0 : _c.value;\r\n }\r\n has(key) {\r\n return this._map.has(key);\r\n }\r\n get(key, touch = 0 /* None */) {\r\n const item = this._map.get(key);\r\n if (!item) {\r\n return undefined;\r\n }\r\n if (touch !== 0 /* None */) {\r\n this.touch(item, touch);\r\n }\r\n return item.value;\r\n }\r\n set(key, value, touch = 0 /* None */) {\r\n let item = this._map.get(key);\r\n if (item) {\r\n item.value = value;\r\n if (touch !== 0 /* None */) {\r\n this.touch(item, touch);\r\n }\r\n }\r\n else {\r\n item = { key, value, next: undefined, previous: undefined };\r\n switch (touch) {\r\n case 0 /* None */:\r\n this.addItemLast(item);\r\n break;\r\n case 1 /* AsOld */:\r\n this.addItemFirst(item);\r\n break;\r\n case 2 /* AsNew */:\r\n this.addItemLast(item);\r\n break;\r\n default:\r\n this.addItemLast(item);\r\n break;\r\n }\r\n this._map.set(key, item);\r\n this._size++;\r\n }\r\n return this;\r\n }\r\n delete(key) {\r\n return !!this.remove(key);\r\n }\r\n remove(key) {\r\n const item = this._map.get(key);\r\n if (!item) {\r\n return undefined;\r\n }\r\n this._map.delete(key);\r\n this.removeItem(item);\r\n this._size--;\r\n return item.value;\r\n }\r\n shift() {\r\n if (!this._head && !this._tail) {\r\n return undefined;\r\n }\r\n if (!this._head || !this._tail) {\r\n throw new Error('Invalid list');\r\n }\r\n const item = this._head;\r\n this._map.delete(item.key);\r\n this.removeItem(item);\r\n this._size--;\r\n return item.value;\r\n }\r\n forEach(callbackfn, thisArg) {\r\n const state = this._state;\r\n let current = this._head;\r\n while (current) {\r\n if (thisArg) {\r\n callbackfn.bind(thisArg)(current.value, current.key, this);\r\n }\r\n else {\r\n callbackfn(current.value, current.key, this);\r\n }\r\n if (this._state !== state) {\r\n throw new Error(`LinkedMap got modified during iteration.`);\r\n }\r\n current = current.next;\r\n }\r\n }\r\n keys() {\r\n const map = this;\r\n const state = this._state;\r\n let current = this._head;\r\n const iterator = {\r\n [Symbol.iterator]() {\r\n return iterator;\r\n },\r\n next() {\r\n if (map._state !== state) {\r\n throw new Error(`LinkedMap got modified during iteration.`);\r\n }\r\n if (current) {\r\n const result = { value: current.key, done: false };\r\n current = current.next;\r\n return result;\r\n }\r\n else {\r\n return { value: undefined, done: true };\r\n }\r\n }\r\n };\r\n return iterator;\r\n }\r\n values() {\r\n const map = this;\r\n const state = this._state;\r\n let current = this._head;\r\n const iterator = {\r\n [Symbol.iterator]() {\r\n return iterator;\r\n },\r\n next() {\r\n if (map._state !== state) {\r\n throw new Error(`LinkedMap got modified during iteration.`);\r\n }\r\n if (current) {\r\n const result = { value: current.value, done: false };\r\n current = current.next;\r\n return result;\r\n }\r\n else {\r\n return { value: undefined, done: true };\r\n }\r\n }\r\n };\r\n return iterator;\r\n }\r\n entries() {\r\n const map = this;\r\n const state = this._state;\r\n let current = this._head;\r\n const iterator = {\r\n [Symbol.iterator]() {\r\n return iterator;\r\n },\r\n next() {\r\n if (map._state !== state) {\r\n throw new Error(`LinkedMap got modified during iteration.`);\r\n }\r\n if (current) {\r\n const result = { value: [current.key, current.value], done: false };\r\n current = current.next;\r\n return result;\r\n }\r\n else {\r\n return { value: undefined, done: true };\r\n }\r\n }\r\n };\r\n return iterator;\r\n }\r\n [(_b = Symbol.toStringTag, Symbol.iterator)]() {\r\n return this.entries();\r\n }\r\n trimOld(newSize) {\r\n if (newSize >= this.size) {\r\n return;\r\n }\r\n if (newSize === 0) {\r\n this.clear();\r\n return;\r\n }\r\n let current = this._head;\r\n let currentSize = this.size;\r\n while (current && currentSize > newSize) {\r\n this._map.delete(current.key);\r\n current = current.next;\r\n currentSize--;\r\n }\r\n this._head = current;\r\n this._size = currentSize;\r\n if (current) {\r\n current.previous = undefined;\r\n }\r\n this._state++;\r\n }\r\n addItemFirst(item) {\r\n // First time Insert\r\n if (!this._head && !this._tail) {\r\n this._tail = item;\r\n }\r\n else if (!this._head) {\r\n throw new Error('Invalid list');\r\n }\r\n else {\r\n item.next = this._head;\r\n this._head.previous = item;\r\n }\r\n this._head = item;\r\n this._state++;\r\n }\r\n addItemLast(item) {\r\n // First time Insert\r\n if (!this._head && !this._tail) {\r\n this._head = item;\r\n }\r\n else if (!this._tail) {\r\n throw new Error('Invalid list');\r\n }\r\n else {\r\n item.previous = this._tail;\r\n this._tail.next = item;\r\n }\r\n this._tail = item;\r\n this._state++;\r\n }\r\n removeItem(item) {\r\n if (item === this._head && item === this._tail) {\r\n this._head = undefined;\r\n this._tail = undefined;\r\n }\r\n else if (item === this._head) {\r\n // This can only happen if size === 1 which is handled\r\n // by the case above.\r\n if (!item.next) {\r\n throw new Error('Invalid list');\r\n }\r\n item.next.previous = undefined;\r\n this._head = item.next;\r\n }\r\n else if (item === this._tail) {\r\n // This can only happen if size === 1 which is handled\r\n // by the case above.\r\n if (!item.previous) {\r\n throw new Error('Invalid list');\r\n }\r\n item.previous.next = undefined;\r\n this._tail = item.previous;\r\n }\r\n else {\r\n const next = item.next;\r\n const previous = item.previous;\r\n if (!next || !previous) {\r\n throw new Error('Invalid list');\r\n }\r\n next.previous = previous;\r\n previous.next = next;\r\n }\r\n item.next = undefined;\r\n item.previous = undefined;\r\n this._state++;\r\n }\r\n touch(item, touch) {\r\n if (!this._head || !this._tail) {\r\n throw new Error('Invalid list');\r\n }\r\n if ((touch !== 1 /* AsOld */ && touch !== 2 /* AsNew */)) {\r\n return;\r\n }\r\n if (touch === 1 /* AsOld */) {\r\n if (item === this._head) {\r\n return;\r\n }\r\n const next = item.next;\r\n const previous = item.previous;\r\n // Unlink the item\r\n if (item === this._tail) {\r\n // previous must be defined since item was not head but is tail\r\n // So there are more than on item in the map\r\n previous.next = undefined;\r\n this._tail = previous;\r\n }\r\n else {\r\n // Both next and previous are not undefined since item was neither head nor tail.\r\n next.previous = previous;\r\n previous.next = next;\r\n }\r\n // Insert the node at head\r\n item.previous = undefined;\r\n item.next = this._head;\r\n this._head.previous = item;\r\n this._head = item;\r\n this._state++;\r\n }\r\n else if (touch === 2 /* AsNew */) {\r\n if (item === this._tail) {\r\n return;\r\n }\r\n const next = item.next;\r\n const previous = item.previous;\r\n // Unlink the item.\r\n if (item === this._head) {\r\n // next must be defined since item was not tail but is head\r\n // So there are more than on item in the map\r\n next.previous = undefined;\r\n this._head = next;\r\n }\r\n else {\r\n // Both next and previous are not undefined since item was neither head nor tail.\r\n next.previous = previous;\r\n previous.next = next;\r\n }\r\n item.next = undefined;\r\n item.previous = this._tail;\r\n this._tail.next = item;\r\n this._tail = item;\r\n this._state++;\r\n }\r\n }\r\n toJSON() {\r\n const data = [];\r\n this.forEach((value, key) => {\r\n data.push([key, value]);\r\n });\r\n return data;\r\n }\r\n fromJSON(data) {\r\n this.clear();\r\n for (const [key, value] of data) {\r\n this.set(key, value);\r\n }\r\n }\r\n}\r\nexport class LRUCache extends LinkedMap {\r\n constructor(limit, ratio = 1) {\r\n super();\r\n this._limit = limit;\r\n this._ratio = Math.min(Math.max(0, ratio), 1);\r\n }\r\n get limit() {\r\n return this._limit;\r\n }\r\n set limit(limit) {\r\n this._limit = limit;\r\n this.checkTrim();\r\n }\r\n get(key, touch = 2 /* AsNew */) {\r\n return super.get(key, touch);\r\n }\r\n peek(key) {\r\n return super.get(key, 0 /* None */);\r\n }\r\n set(key, value) {\r\n super.set(key, value, 2 /* AsNew */);\r\n this.checkTrim();\r\n return this;\r\n }\r\n checkTrim() {\r\n if (this.size > this._limit) {\r\n this.trimOld(Math.round(this._limit * this._ratio));\r\n }\r\n }\r\n}\r\n", "/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License. See License.txt in the project root for license information.\r\n *--------------------------------------------------------------------------------------------*/\r\nexport function clamp(value, min, max) {\r\n return Math.min(Math.max(value, min), max);\r\n}\r\nexport class MovingAverage {\r\n constructor() {\r\n this._n = 1;\r\n this._val = 0;\r\n }\r\n update(value) {\r\n this._val = this._val + (value - this._val) / this._n;\r\n this._n += 1;\r\n return this;\r\n }\r\n get value() {\r\n return this._val;\r\n }\r\n}\r\n", "/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License. See License.txt in the project root for license information.\r\n *--------------------------------------------------------------------------------------------*/\r\nimport * as strings from './strings.js';\r\nimport * as extpath from './extpath.js';\r\nimport * as paths from './path.js';\r\nimport { LRUCache } from './map.js';\r\nimport { isThenable } from './async.js';\r\nconst GLOBSTAR = '**';\r\nconst GLOB_SPLIT = '/';\r\nconst PATH_REGEX = '[/\\\\\\\\]'; // any slash or backslash\r\nconst NO_PATH_REGEX = '[^/\\\\\\\\]'; // any non-slash and non-backslash\r\nconst ALL_FORWARD_SLASHES = /\\//g;\r\nfunction starsToRegExp(starCount) {\r\n switch (starCount) {\r\n case 0:\r\n return '';\r\n case 1:\r\n return `${NO_PATH_REGEX}*?`; // 1 star matches any number of characters except path separator (/ and \\) - non greedy (?)\r\n default:\r\n // Matches: (Path Sep OR Path Val followed by Path Sep OR Path Sep followed by Path Val) 0-many times\r\n // Group is non capturing because we don't need to capture at all (?:...)\r\n // Overall we use non-greedy matching because it could be that we match too much\r\n return `(?:${PATH_REGEX}|${NO_PATH_REGEX}+${PATH_REGEX}|${PATH_REGEX}${NO_PATH_REGEX}+)*?`;\r\n }\r\n}\r\nexport function splitGlobAware(pattern, splitChar) {\r\n if (!pattern) {\r\n return [];\r\n }\r\n const segments = [];\r\n let inBraces = false;\r\n let inBrackets = false;\r\n let curVal = '';\r\n for (const char of pattern) {\r\n switch (char) {\r\n case splitChar:\r\n if (!inBraces && !inBrackets) {\r\n segments.push(curVal);\r\n curVal = '';\r\n continue;\r\n }\r\n break;\r\n case '{':\r\n inBraces = true;\r\n break;\r\n case '}':\r\n inBraces = false;\r\n break;\r\n case '[':\r\n inBrackets = true;\r\n break;\r\n case ']':\r\n inBrackets = false;\r\n break;\r\n }\r\n curVal += char;\r\n }\r\n // Tail\r\n if (curVal) {\r\n segments.push(curVal);\r\n }\r\n return segments;\r\n}\r\nfunction parseRegExp(pattern) {\r\n if (!pattern) {\r\n return '';\r\n }\r\n let regEx = '';\r\n // Split up into segments for each slash found\r\n const segments = splitGlobAware(pattern, GLOB_SPLIT);\r\n // Special case where we only have globstars\r\n if (segments.every(s => s === GLOBSTAR)) {\r\n regEx = '.*';\r\n }\r\n // Build regex over segments\r\n else {\r\n let previousSegmentWasGlobStar = false;\r\n segments.forEach((segment, index) => {\r\n // Globstar is special\r\n if (segment === GLOBSTAR) {\r\n // if we have more than one globstar after another, just ignore it\r\n if (!previousSegmentWasGlobStar) {\r\n regEx += starsToRegExp(2);\r\n previousSegmentWasGlobStar = true;\r\n }\r\n return;\r\n }\r\n // States\r\n let inBraces = false;\r\n let braceVal = '';\r\n let inBrackets = false;\r\n let bracketVal = '';\r\n for (const char of segment) {\r\n // Support brace expansion\r\n if (char !== '}' && inBraces) {\r\n braceVal += char;\r\n continue;\r\n }\r\n // Support brackets\r\n if (inBrackets && (char !== ']' || !bracketVal) /* ] is literally only allowed as first character in brackets to match it */) {\r\n let res;\r\n // range operator\r\n if (char === '-') {\r\n res = char;\r\n }\r\n // negation operator (only valid on first index in bracket)\r\n else if ((char === '^' || char === '!') && !bracketVal) {\r\n res = '^';\r\n }\r\n // glob split matching is not allowed within character ranges\r\n // see http://man7.org/linux/man-pages/man7/glob.7.html\r\n else if (char === GLOB_SPLIT) {\r\n res = '';\r\n }\r\n // anything else gets escaped\r\n else {\r\n res = strings.escapeRegExpCharacters(char);\r\n }\r\n bracketVal += res;\r\n continue;\r\n }\r\n switch (char) {\r\n case '{':\r\n inBraces = true;\r\n continue;\r\n case '[':\r\n inBrackets = true;\r\n continue;\r\n case '}':\r\n const choices = splitGlobAware(braceVal, ',');\r\n // Converts {foo,bar} => [foo|bar]\r\n const braceRegExp = `(?:${choices.map(c => parseRegExp(c)).join('|')})`;\r\n regEx += braceRegExp;\r\n inBraces = false;\r\n braceVal = '';\r\n break;\r\n case ']':\r\n regEx += ('[' + bracketVal + ']');\r\n inBrackets = false;\r\n bracketVal = '';\r\n break;\r\n case '?':\r\n regEx += NO_PATH_REGEX; // 1 ? matches any single character except path separator (/ and \\)\r\n continue;\r\n case '*':\r\n regEx += starsToRegExp(1);\r\n continue;\r\n default:\r\n regEx += strings.escapeRegExpCharacters(char);\r\n }\r\n }\r\n // Tail: Add the slash we had split on if there is more to come and the remaining pattern is not a globstar\r\n // For example if pattern: some/**/*.js we want the \"/\" after some to be included in the RegEx to prevent\r\n // a folder called \"something\" to match as well.\r\n // However, if pattern: some/**, we tolerate that we also match on \"something\" because our globstar behaviour\r\n // is to match 0-N segments.\r\n if (index < segments.length - 1 && (segments[index + 1] !== GLOBSTAR || index + 2 < segments.length)) {\r\n regEx += PATH_REGEX;\r\n }\r\n // reset state\r\n previousSegmentWasGlobStar = false;\r\n });\r\n }\r\n return regEx;\r\n}\r\n// regexes to check for trival glob patterns that just check for String#endsWith\r\nconst T1 = /^\\*\\*\\/\\*\\.[\\w\\.-]+$/; // **/*.something\r\nconst T2 = /^\\*\\*\\/([\\w\\.-]+)\\/?$/; // **/something\r\nconst T3 = /^{\\*\\*\\/[\\*\\.]?[\\w\\.-]+\\/?(,\\*\\*\\/[\\*\\.]?[\\w\\.-]+\\/?)*}$/; // {**/*.something,**/*.else} or {**/package.json,**/project.json}\r\nconst T3_2 = /^{\\*\\*\\/[\\*\\.]?[\\w\\.-]+(\\/(\\*\\*)?)?(,\\*\\*\\/[\\*\\.]?[\\w\\.-]+(\\/(\\*\\*)?)?)*}$/; // Like T3, with optional trailing /**\r\nconst T4 = /^\\*\\*((\\/[\\w\\.-]+)+)\\/?$/; // **/something/else\r\nconst T5 = /^([\\w\\.-]+(\\/[\\w\\.-]+)*)\\/?$/; // something/else\r\nconst CACHE = new LRUCache(10000); // bounded to 10000 elements\r\nconst FALSE = function () {\r\n return false;\r\n};\r\nconst NULL = function () {\r\n return null;\r\n};\r\nfunction parsePattern(arg1, options) {\r\n if (!arg1) {\r\n return NULL;\r\n }\r\n // Handle IRelativePattern\r\n let pattern;\r\n if (typeof arg1 !== 'string') {\r\n pattern = arg1.pattern;\r\n }\r\n else {\r\n pattern = arg1;\r\n }\r\n // Whitespace trimming\r\n pattern = pattern.trim();\r\n // Check cache\r\n const patternKey = `${pattern}_${!!options.trimForExclusions}`;\r\n let parsedPattern = CACHE.get(patternKey);\r\n if (parsedPattern) {\r\n return wrapRelativePattern(parsedPattern, arg1);\r\n }\r\n // Check for Trivias\r\n let match;\r\n if (T1.test(pattern)) { // common pattern: **/*.txt just need endsWith check\r\n const base = pattern.substr(4); // '**/*'.length === 4\r\n parsedPattern = function (path, basename) {\r\n return typeof path === 'string' && path.endsWith(base) ? pattern : null;\r\n };\r\n }\r\n else if (match = T2.exec(trimForExclusions(pattern, options))) { // common pattern: **/some.txt just need basename check\r\n parsedPattern = trivia2(match[1], pattern);\r\n }\r\n else if ((options.trimForExclusions ? T3_2 : T3).test(pattern)) { // repetition of common patterns (see above) {**/*.txt,**/*.png}\r\n parsedPattern = trivia3(pattern, options);\r\n }\r\n else if (match = T4.exec(trimForExclusions(pattern, options))) { // common pattern: **/something/else just need endsWith check\r\n parsedPattern = trivia4and5(match[1].substr(1), pattern, true);\r\n }\r\n else if (match = T5.exec(trimForExclusions(pattern, options))) { // common pattern: something/else just need equals check\r\n parsedPattern = trivia4and5(match[1], pattern, false);\r\n }\r\n // Otherwise convert to pattern\r\n else {\r\n parsedPattern = toRegExp(pattern);\r\n }\r\n // Cache\r\n CACHE.set(patternKey, parsedPattern);\r\n return wrapRelativePattern(parsedPattern, arg1);\r\n}\r\nfunction wrapRelativePattern(parsedPattern, arg2) {\r\n if (typeof arg2 === 'string') {\r\n return parsedPattern;\r\n }\r\n return function (path, basename) {\r\n if (!extpath.isEqualOrParent(path, arg2.base)) {\r\n return null;\r\n }\r\n return parsedPattern(paths.relative(arg2.base, path), basename);\r\n };\r\n}\r\nfunction trimForExclusions(pattern, options) {\r\n return options.trimForExclusions && pattern.endsWith('/**') ? pattern.substr(0, pattern.length - 2) : pattern; // dropping **, tailing / is dropped later\r\n}\r\n// common pattern: **/some.txt just need basename check\r\nfunction trivia2(base, originalPattern) {\r\n const slashBase = `/${base}`;\r\n const backslashBase = `\\\\${base}`;\r\n const parsedPattern = function (path, basename) {\r\n if (typeof path !== 'string') {\r\n return null;\r\n }\r\n if (basename) {\r\n return basename === base ? originalPattern : null;\r\n }\r\n return path === base || path.endsWith(slashBase) || path.endsWith(backslashBase) ? originalPattern : null;\r\n };\r\n const basenames = [base];\r\n parsedPattern.basenames = basenames;\r\n parsedPattern.patterns = [originalPattern];\r\n parsedPattern.allBasenames = basenames;\r\n return parsedPattern;\r\n}\r\n// repetition of common patterns (see above) {**/*.txt,**/*.png}\r\nfunction trivia3(pattern, options) {\r\n const parsedPatterns = aggregateBasenameMatches(pattern.slice(1, -1).split(',')\r\n .map(pattern => parsePattern(pattern, options))\r\n .filter(pattern => pattern !== NULL), pattern);\r\n const n = parsedPatterns.length;\r\n if (!n) {\r\n return NULL;\r\n }\r\n if (n === 1) {\r\n return parsedPatterns[0];\r\n }\r\n const parsedPattern = function (path, basename) {\r\n for (let i = 0, n = parsedPatterns.length; i < n; i++) {\r\n if (parsedPatterns[i](path, basename)) {\r\n return pattern;\r\n }\r\n }\r\n return null;\r\n };\r\n const withBasenames = parsedPatterns.find(pattern => !!pattern.allBasenames);\r\n if (withBasenames) {\r\n parsedPattern.allBasenames = withBasenames.allBasenames;\r\n }\r\n const allPaths = parsedPatterns.reduce((all, current) => current.allPaths ? all.concat(current.allPaths) : all, []);\r\n if (allPaths.length) {\r\n parsedPattern.allPaths = allPaths;\r\n }\r\n return parsedPattern;\r\n}\r\n// common patterns: **/something/else just need endsWith check, something/else just needs and equals check\r\nfunction trivia4and5(targetPath, pattern, matchPathEnds) {\r\n const usingPosixSep = paths.sep === paths.posix.sep;\r\n const nativePath = usingPosixSep ? targetPath : targetPath.replace(ALL_FORWARD_SLASHES, paths.sep);\r\n const nativePathEnd = paths.sep + nativePath;\r\n const targetPathEnd = paths.posix.sep + targetPath;\r\n const parsedPattern = matchPathEnds ? function (testPath, basename) {\r\n return typeof testPath === 'string' &&\r\n ((testPath === nativePath || testPath.endsWith(nativePathEnd))\r\n || !usingPosixSep && (testPath === targetPath || testPath.endsWith(targetPathEnd)))\r\n ? pattern : null;\r\n } : function (testPath, basename) {\r\n return typeof testPath === 'string' &&\r\n (testPath === nativePath\r\n || (!usingPosixSep && testPath === targetPath))\r\n ? pattern : null;\r\n };\r\n parsedPattern.allPaths = [(matchPathEnds ? '*/' : './') + targetPath];\r\n return parsedPattern;\r\n}\r\nfunction toRegExp(pattern) {\r\n try {\r\n const regExp = new RegExp(`^${parseRegExp(pattern)}$`);\r\n return function (path) {\r\n regExp.lastIndex = 0; // reset RegExp to its initial state to reuse it!\r\n return typeof path === 'string' && regExp.test(path) ? pattern : null;\r\n };\r\n }\r\n catch (error) {\r\n return NULL;\r\n }\r\n}\r\nexport function match(arg1, path, hasSibling) {\r\n if (!arg1 || typeof path !== 'string') {\r\n return false;\r\n }\r\n return parse(arg1)(path, undefined, hasSibling);\r\n}\r\nexport function parse(arg1, options = {}) {\r\n if (!arg1) {\r\n return FALSE;\r\n }\r\n // Glob with String\r\n if (typeof arg1 === 'string' || isRelativePattern(arg1)) {\r\n const parsedPattern = parsePattern(arg1, options);\r\n if (parsedPattern === NULL) {\r\n return FALSE;\r\n }\r\n const resultPattern = function (path, basename) {\r\n return !!parsedPattern(path, basename);\r\n };\r\n if (parsedPattern.allBasenames) {\r\n resultPattern.allBasenames = parsedPattern.allBasenames;\r\n }\r\n if (parsedPattern.allPaths) {\r\n resultPattern.allPaths = parsedPattern.allPaths;\r\n }\r\n return resultPattern;\r\n }\r\n // Glob with Expression\r\n return parsedExpression(arg1, options);\r\n}\r\nexport function isRelativePattern(obj) {\r\n const rp = obj;\r\n return rp && typeof rp.base === 'string' && typeof rp.pattern === 'string';\r\n}\r\nfunction parsedExpression(expression, options) {\r\n const parsedPatterns = aggregateBasenameMatches(Object.getOwnPropertyNames(expression)\r\n .map(pattern => parseExpressionPattern(pattern, expression[pattern], options))\r\n .filter(pattern => pattern !== NULL));\r\n const n = parsedPatterns.length;\r\n if (!n) {\r\n return NULL;\r\n }\r\n if (!parsedPatterns.some(parsedPattern => !!parsedPattern.requiresSiblings)) {\r\n if (n === 1) {\r\n return parsedPatterns[0];\r\n }\r\n const resultExpression = function (path, basename) {\r\n for (let i = 0, n = parsedPatterns.length; i < n; i++) {\r\n // Pattern matches path\r\n const result = parsedPatterns[i](path, basename);\r\n if (result) {\r\n return result;\r\n }\r\n }\r\n return null;\r\n };\r\n const withBasenames = parsedPatterns.find(pattern => !!pattern.allBasenames);\r\n if (withBasenames) {\r\n resultExpression.allBasenames = withBasenames.allBasenames;\r\n }\r\n const allPaths = parsedPatterns.reduce((all, current) => current.allPaths ? all.concat(current.allPaths) : all, []);\r\n if (allPaths.length) {\r\n resultExpression.allPaths = allPaths;\r\n }\r\n return resultExpression;\r\n }\r\n const resultExpression = function (path, basename, hasSibling) {\r\n let name = undefined;\r\n for (let i = 0, n = parsedPatterns.length; i < n; i++) {\r\n // Pattern matches path\r\n const parsedPattern = parsedPatterns[i];\r\n if (parsedPattern.requiresSiblings && hasSibling) {\r\n if (!basename) {\r\n basename = paths.basename(path);\r\n }\r\n if (!name) {\r\n name = basename.substr(0, basename.length - paths.extname(path).length);\r\n }\r\n }\r\n const result = parsedPattern(path, basename, name, hasSibling);\r\n if (result) {\r\n return result;\r\n }\r\n }\r\n return null;\r\n };\r\n const withBasenames = parsedPatterns.find(pattern => !!pattern.allBasenames);\r\n if (withBasenames) {\r\n resultExpression.allBasenames = withBasenames.allBasenames;\r\n }\r\n const allPaths = parsedPatterns.reduce((all, current) => current.allPaths ? all.concat(current.allPaths) : all, []);\r\n if (allPaths.length) {\r\n resultExpression.allPaths = allPaths;\r\n }\r\n return resultExpression;\r\n}\r\nfunction parseExpressionPattern(pattern, value, options) {\r\n if (value === false) {\r\n return NULL; // pattern is disabled\r\n }\r\n const parsedPattern = parsePattern(pattern, options);\r\n if (parsedPattern === NULL) {\r\n return NULL;\r\n }\r\n // Expression Pattern is \r\n if (typeof value === 'boolean') {\r\n return parsedPattern;\r\n }\r\n // Expression Pattern is \r\n if (value) {\r\n const when = value.when;\r\n if (typeof when === 'string') {\r\n const result = (path, basename, name, hasSibling) => {\r\n if (!hasSibling || !parsedPattern(path, basename)) {\r\n return null;\r\n }\r\n const clausePattern = when.replace('$(basename)', name);\r\n const matched = hasSibling(clausePattern);\r\n return isThenable(matched) ?\r\n matched.then(m => m ? pattern : null) :\r\n matched ? pattern : null;\r\n };\r\n result.requiresSiblings = true;\r\n return result;\r\n }\r\n }\r\n // Expression is Anything\r\n return parsedPattern;\r\n}\r\nfunction aggregateBasenameMatches(parsedPatterns, result) {\r\n const basenamePatterns = parsedPatterns.filter(parsedPattern => !!parsedPattern.basenames);\r\n if (basenamePatterns.length < 2) {\r\n return parsedPatterns;\r\n }\r\n const basenames = basenamePatterns.reduce((all, current) => {\r\n const basenames = current.basenames;\r\n return basenames ? all.concat(basenames) : all;\r\n }, []);\r\n let patterns;\r\n if (result) {\r\n patterns = [];\r\n for (let i = 0, n = basenames.length; i < n; i++) {\r\n patterns.push(result);\r\n }\r\n }\r\n else {\r\n patterns = basenamePatterns.reduce((all, current) => {\r\n const patterns = current.patterns;\r\n return patterns ? all.concat(patterns) : all;\r\n }, []);\r\n }\r\n const aggregate = function (path, basename) {\r\n if (typeof path !== 'string') {\r\n return null;\r\n }\r\n if (!basename) {\r\n let i;\r\n for (i = path.length; i > 0; i--) {\r\n const ch = path.charCodeAt(i - 1);\r\n if (ch === 47 /* Slash */ || ch === 92 /* Backslash */) {\r\n break;\r\n }\r\n }\r\n basename = path.substr(i);\r\n }\r\n const index = basenames.indexOf(basename);\r\n return index !== -1 ? patterns[index] : null;\r\n };\r\n aggregate.basenames = basenames;\r\n aggregate.patterns = patterns;\r\n aggregate.allBasenames = basenames;\r\n const aggregatedPatterns = parsedPatterns.filter(parsedPattern => !parsedPattern.basenames);\r\n aggregatedPatterns.push(aggregate);\r\n return aggregatedPatterns;\r\n}\r\n", "/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License. See License.txt in the project root for license information.\r\n *--------------------------------------------------------------------------------------------*/\r\nimport { match as matchGlobPattern } from '../../../base/common/glob.js';\r\nimport { normalize } from '../../../base/common/path.js';\r\nexport function score(selector, candidateUri, candidateLanguage, candidateIsSynchronized) {\r\n if (Array.isArray(selector)) {\r\n // array -> take max individual value\r\n let ret = 0;\r\n for (const filter of selector) {\r\n const value = score(filter, candidateUri, candidateLanguage, candidateIsSynchronized);\r\n if (value === 10) {\r\n return value; // already at the highest\r\n }\r\n if (value > ret) {\r\n ret = value;\r\n }\r\n }\r\n return ret;\r\n }\r\n else if (typeof selector === 'string') {\r\n if (!candidateIsSynchronized) {\r\n return 0;\r\n }\r\n // short-hand notion, desugars to\r\n // 'fooLang' -> { language: 'fooLang'}\r\n // '*' -> { language: '*' }\r\n if (selector === '*') {\r\n return 5;\r\n }\r\n else if (selector === candidateLanguage) {\r\n return 10;\r\n }\r\n else {\r\n return 0;\r\n }\r\n }\r\n else if (selector) {\r\n // filter -> select accordingly, use defaults for scheme\r\n const { language, pattern, scheme, hasAccessToAllModels } = selector; // TODO: microsoft/TypeScript#42768\r\n if (!candidateIsSynchronized && !hasAccessToAllModels) {\r\n return 0;\r\n }\r\n let ret = 0;\r\n if (scheme) {\r\n if (scheme === candidateUri.scheme) {\r\n ret = 10;\r\n }\r\n else if (scheme === '*') {\r\n ret = 5;\r\n }\r\n else {\r\n return 0;\r\n }\r\n }\r\n if (language) {\r\n if (language === candidateLanguage) {\r\n ret = 10;\r\n }\r\n else if (language === '*') {\r\n ret = Math.max(ret, 5);\r\n }\r\n else {\r\n return 0;\r\n }\r\n }\r\n if (pattern) {\r\n let normalizedPattern;\r\n if (typeof pattern === 'string') {\r\n normalizedPattern = pattern;\r\n }\r\n else {\r\n // Since this pattern has a `base` property, we need\r\n // to normalize this path first before passing it on\r\n // because we will compare it against `Uri.fsPath`\r\n // which uses platform specific separators.\r\n // Refs: https://github.com/microsoft/vscode/issues/99938\r\n normalizedPattern = Object.assign(Object.assign({}, pattern), { base: normalize(pattern.base) });\r\n }\r\n if (normalizedPattern === candidateUri.fsPath || matchGlobPattern(normalizedPattern, candidateUri.fsPath)) {\r\n ret = 10;\r\n }\r\n else {\r\n return 0;\r\n }\r\n }\r\n return ret;\r\n }\r\n else {\r\n return 0;\r\n }\r\n}\r\n", "/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License. See License.txt in the project root for license information.\r\n *--------------------------------------------------------------------------------------------*/\r\nimport { Emitter } from '../../../base/common/event.js';\r\nimport { hash } from '../../../base/common/hash.js';\r\nimport { toDisposable } from '../../../base/common/lifecycle.js';\r\nimport { LRUCache } from '../../../base/common/map.js';\r\nimport { MovingAverage } from '../../../base/common/numbers.js';\r\nimport { score } from './languageSelector.js';\r\nimport { shouldSynchronizeModel } from '../services/modelService.js';\r\nfunction isExclusive(selector) {\r\n if (typeof selector === 'string') {\r\n return false;\r\n }\r\n else if (Array.isArray(selector)) {\r\n return selector.every(isExclusive);\r\n }\r\n else {\r\n return !!selector.exclusive; // TODO: microsoft/TypeScript#42768\r\n }\r\n}\r\nexport class LanguageFeatureRegistry {\r\n constructor() {\r\n this._clock = 0;\r\n this._entries = [];\r\n this._onDidChange = new Emitter();\r\n }\r\n get onDidChange() {\r\n return this._onDidChange.event;\r\n }\r\n register(selector, provider) {\r\n let entry = {\r\n selector,\r\n provider,\r\n _score: -1,\r\n _time: this._clock++\r\n };\r\n this._entries.push(entry);\r\n this._lastCandidate = undefined;\r\n this._onDidChange.fire(this._entries.length);\r\n return toDisposable(() => {\r\n if (entry) {\r\n let idx = this._entries.indexOf(entry);\r\n if (idx >= 0) {\r\n this._entries.splice(idx, 1);\r\n this._lastCandidate = undefined;\r\n this._onDidChange.fire(this._entries.length);\r\n entry = undefined;\r\n }\r\n }\r\n });\r\n }\r\n has(model) {\r\n return this.all(model).length > 0;\r\n }\r\n all(model) {\r\n if (!model) {\r\n return [];\r\n }\r\n this._updateScores(model);\r\n const result = [];\r\n // from registry\r\n for (let entry of this._entries) {\r\n if (entry._score > 0) {\r\n result.push(entry.provider);\r\n }\r\n }\r\n return result;\r\n }\r\n ordered(model) {\r\n const result = [];\r\n this._orderedForEach(model, entry => result.push(entry.provider));\r\n return result;\r\n }\r\n orderedGroups(model) {\r\n const result = [];\r\n let lastBucket;\r\n let lastBucketScore;\r\n this._orderedForEach(model, entry => {\r\n if (lastBucket && lastBucketScore === entry._score) {\r\n lastBucket.push(entry.provider);\r\n }\r\n else {\r\n lastBucketScore = entry._score;\r\n lastBucket = [entry.provider];\r\n result.push(lastBucket);\r\n }\r\n });\r\n return result;\r\n }\r\n _orderedForEach(model, callback) {\r\n if (!model) {\r\n return;\r\n }\r\n this._updateScores(model);\r\n for (const entry of this._entries) {\r\n if (entry._score > 0) {\r\n callback(entry);\r\n }\r\n }\r\n }\r\n _updateScores(model) {\r\n let candidate = {\r\n uri: model.uri.toString(),\r\n language: model.getLanguageIdentifier().language\r\n };\r\n if (this._lastCandidate\r\n && this._lastCandidate.language === candidate.language\r\n && this._lastCandidate.uri === candidate.uri) {\r\n // nothing has changed\r\n return;\r\n }\r\n this._lastCandidate = candidate;\r\n for (let entry of this._entries) {\r\n entry._score = score(entry.selector, model.uri, model.getLanguageIdentifier().language, shouldSynchronizeModel(model));\r\n if (isExclusive(entry.selector) && entry._score > 0) {\r\n // support for one exclusive selector that overwrites\r\n // any other selector\r\n for (let entry of this._entries) {\r\n entry._score = 0;\r\n }\r\n entry._score = 1000;\r\n break;\r\n }\r\n }\r\n // needs sorting\r\n this._entries.sort(LanguageFeatureRegistry._compareByScoreAndTime);\r\n }\r\n static _compareByScoreAndTime(a, b) {\r\n if (a._score < b._score) {\r\n return 1;\r\n }\r\n else if (a._score > b._score) {\r\n return -1;\r\n }\r\n else if (a._time < b._time) {\r\n return 1;\r\n }\r\n else if (a._time > b._time) {\r\n return -1;\r\n }\r\n else {\r\n return 0;\r\n }\r\n }\r\n}\r\n/**\r\n * Keeps moving average per model and set of providers so that requests\r\n * can be debounce according to the provider performance\r\n */\r\nexport class LanguageFeatureRequestDelays {\r\n constructor(_registry, min, max = Number.MAX_SAFE_INTEGER) {\r\n this._registry = _registry;\r\n this.min = min;\r\n this.max = max;\r\n this._cache = new LRUCache(50, 0.7);\r\n }\r\n _key(model) {\r\n return model.id + hash(this._registry.all(model));\r\n }\r\n _clamp(value) {\r\n if (value === undefined) {\r\n return this.min;\r\n }\r\n else {\r\n return Math.min(this.max, Math.max(this.min, Math.floor(value * 1.3)));\r\n }\r\n }\r\n get(model) {\r\n const key = this._key(model);\r\n const avg = this._cache.get(key);\r\n return this._clamp(avg === null || avg === void 0 ? void 0 : avg.value);\r\n }\r\n update(model, value) {\r\n const key = this._key(model);\r\n let avg = this._cache.get(key);\r\n if (!avg) {\r\n avg = new MovingAverage();\r\n this._cache.set(key, avg);\r\n }\r\n avg.update(value);\r\n return this.get(model);\r\n }\r\n}\r\n", "/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License. See License.txt in the project root for license information.\r\n *--------------------------------------------------------------------------------------------*/\r\nimport { Emitter } from '../../../base/common/event.js';\r\nimport { toDisposable } from '../../../base/common/lifecycle.js';\r\nexport class TokenizationRegistryImpl {\r\n constructor() {\r\n this._map = new Map();\r\n this._promises = new Map();\r\n this._onDidChange = new Emitter();\r\n this.onDidChange = this._onDidChange.event;\r\n this._colorMap = null;\r\n }\r\n fire(languages) {\r\n this._onDidChange.fire({\r\n changedLanguages: languages,\r\n changedColorMap: false\r\n });\r\n }\r\n register(language, support) {\r\n this._map.set(language, support);\r\n this.fire([language]);\r\n return toDisposable(() => {\r\n if (this._map.get(language) !== support) {\r\n return;\r\n }\r\n this._map.delete(language);\r\n this.fire([language]);\r\n });\r\n }\r\n registerPromise(language, supportPromise) {\r\n let registration = null;\r\n let isDisposed = false;\r\n this._promises.set(language, supportPromise.then(support => {\r\n this._promises.delete(language);\r\n if (isDisposed || !support) {\r\n return;\r\n }\r\n registration = this.register(language, support);\r\n }));\r\n return toDisposable(() => {\r\n isDisposed = true;\r\n if (registration) {\r\n registration.dispose();\r\n }\r\n });\r\n }\r\n getPromise(language) {\r\n const support = this.get(language);\r\n if (support) {\r\n return Promise.resolve(support);\r\n }\r\n const promise = this._promises.get(language);\r\n if (promise) {\r\n return promise.then(_ => this.get(language));\r\n }\r\n return null;\r\n }\r\n get(language) {\r\n return (this._map.get(language) || null);\r\n }\r\n setColorMap(colorMap) {\r\n this._colorMap = colorMap;\r\n this._onDidChange.fire({\r\n changedLanguages: Array.from(this._map.keys()),\r\n changedColorMap: true\r\n });\r\n }\r\n getColorMap() {\r\n return this._colorMap;\r\n }\r\n getDefaultBackground() {\r\n if (this._colorMap && this._colorMap.length > 2 /* DefaultBackground */) {\r\n return this._colorMap[2 /* DefaultBackground */];\r\n }\r\n return null;\r\n }\r\n}\r\n", "/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License. See License.txt in the project root for license information.\r\n *--------------------------------------------------------------------------------------------*/\r\nimport { URI } from '../../base/common/uri.js';\r\nimport { Range } from './core/range.js';\r\nimport { LanguageFeatureRegistry } from './modes/languageFeatureRegistry.js';\r\nimport { TokenizationRegistryImpl } from './modes/tokenizationRegistry.js';\r\nimport { iconRegistry, Codicon } from '../../base/common/codicons.js';\r\n/**\r\n * @internal\r\n */\r\nexport class LanguageIdentifier {\r\n constructor(language, id) {\r\n this.language = language;\r\n this.id = id;\r\n }\r\n}\r\n/**\r\n * @internal\r\n */\r\nexport class TokenMetadata {\r\n static getLanguageId(metadata) {\r\n return (metadata & 255 /* LANGUAGEID_MASK */) >>> 0 /* LANGUAGEID_OFFSET */;\r\n }\r\n static getTokenType(metadata) {\r\n return (metadata & 1792 /* TOKEN_TYPE_MASK */) >>> 8 /* TOKEN_TYPE_OFFSET */;\r\n }\r\n static getFontStyle(metadata) {\r\n return (metadata & 14336 /* FONT_STYLE_MASK */) >>> 11 /* FONT_STYLE_OFFSET */;\r\n }\r\n static getForeground(metadata) {\r\n return (metadata & 8372224 /* FOREGROUND_MASK */) >>> 14 /* FOREGROUND_OFFSET */;\r\n }\r\n static getBackground(metadata) {\r\n return (metadata & 4286578688 /* BACKGROUND_MASK */) >>> 23 /* BACKGROUND_OFFSET */;\r\n }\r\n static getClassNameFromMetadata(metadata) {\r\n let foreground = this.getForeground(metadata);\r\n let className = 'mtk' + foreground;\r\n let fontStyle = this.getFontStyle(metadata);\r\n if (fontStyle & 1 /* Italic */) {\r\n className += ' mtki';\r\n }\r\n if (fontStyle & 2 /* Bold */) {\r\n className += ' mtkb';\r\n }\r\n if (fontStyle & 4 /* Underline */) {\r\n className += ' mtku';\r\n }\r\n return className;\r\n }\r\n static getInlineStyleFromMetadata(metadata, colorMap) {\r\n const foreground = this.getForeground(metadata);\r\n const fontStyle = this.getFontStyle(metadata);\r\n let result = `color: ${colorMap[foreground]};`;\r\n if (fontStyle & 1 /* Italic */) {\r\n result += 'font-style: italic;';\r\n }\r\n if (fontStyle & 2 /* Bold */) {\r\n result += 'font-weight: bold;';\r\n }\r\n if (fontStyle & 4 /* Underline */) {\r\n result += 'text-decoration: underline;';\r\n }\r\n return result;\r\n }\r\n}\r\n/**\r\n * @internal\r\n */\r\nexport const completionKindToCssClass = (function () {\r\n let data = Object.create(null);\r\n data[0 /* Method */] = 'symbol-method';\r\n data[1 /* Function */] = 'symbol-function';\r\n data[2 /* Constructor */] = 'symbol-constructor';\r\n data[3 /* Field */] = 'symbol-field';\r\n data[4 /* Variable */] = 'symbol-variable';\r\n data[5 /* Class */] = 'symbol-class';\r\n data[6 /* Struct */] = 'symbol-struct';\r\n data[7 /* Interface */] = 'symbol-interface';\r\n data[8 /* Module */] = 'symbol-module';\r\n data[9 /* Property */] = 'symbol-property';\r\n data[10 /* Event */] = 'symbol-event';\r\n data[11 /* Operator */] = 'symbol-operator';\r\n data[12 /* Unit */] = 'symbol-unit';\r\n data[13 /* Value */] = 'symbol-value';\r\n data[14 /* Constant */] = 'symbol-constant';\r\n data[15 /* Enum */] = 'symbol-enum';\r\n data[16 /* EnumMember */] = 'symbol-enum-member';\r\n data[17 /* Keyword */] = 'symbol-keyword';\r\n data[27 /* Snippet */] = 'symbol-snippet';\r\n data[18 /* Text */] = 'symbol-text';\r\n data[19 /* Color */] = 'symbol-color';\r\n data[20 /* File */] = 'symbol-file';\r\n data[21 /* Reference */] = 'symbol-reference';\r\n data[22 /* Customcolor */] = 'symbol-customcolor';\r\n data[23 /* Folder */] = 'symbol-folder';\r\n data[24 /* TypeParameter */] = 'symbol-type-parameter';\r\n data[25 /* User */] = 'account';\r\n data[26 /* Issue */] = 'issues';\r\n return function (kind) {\r\n const name = data[kind];\r\n let codicon = name && iconRegistry.get(name);\r\n if (!codicon) {\r\n console.info('No codicon found for CompletionItemKind ' + kind);\r\n codicon = Codicon.symbolProperty;\r\n }\r\n return codicon.classNames;\r\n };\r\n})();\r\n/**\r\n * @internal\r\n */\r\nexport let completionKindFromString = (function () {\r\n let data = Object.create(null);\r\n data['method'] = 0 /* Method */;\r\n data['function'] = 1 /* Function */;\r\n data['constructor'] = 2 /* Constructor */;\r\n data['field'] = 3 /* Field */;\r\n data['variable'] = 4 /* Variable */;\r\n data['class'] = 5 /* Class */;\r\n data['struct'] = 6 /* Struct */;\r\n data['interface'] = 7 /* Interface */;\r\n data['module'] = 8 /* Module */;\r\n data['property'] = 9 /* Property */;\r\n data['event'] = 10 /* Event */;\r\n data['operator'] = 11 /* Operator */;\r\n data['unit'] = 12 /* Unit */;\r\n data['value'] = 13 /* Value */;\r\n data['constant'] = 14 /* Constant */;\r\n data['enum'] = 15 /* Enum */;\r\n data['enum-member'] = 16 /* EnumMember */;\r\n data['enumMember'] = 16 /* EnumMember */;\r\n data['keyword'] = 17 /* Keyword */;\r\n data['snippet'] = 27 /* Snippet */;\r\n data['text'] = 18 /* Text */;\r\n data['color'] = 19 /* Color */;\r\n data['file'] = 20 /* File */;\r\n data['reference'] = 21 /* Reference */;\r\n data['customcolor'] = 22 /* Customcolor */;\r\n data['folder'] = 23 /* Folder */;\r\n data['type-parameter'] = 24 /* TypeParameter */;\r\n data['typeParameter'] = 24 /* TypeParameter */;\r\n data['account'] = 25 /* User */;\r\n data['issue'] = 26 /* Issue */;\r\n return function (value, strict) {\r\n let res = data[value];\r\n if (typeof res === 'undefined' && !strict) {\r\n res = 9 /* Property */;\r\n }\r\n return res;\r\n };\r\n})();\r\n/**\r\n * How an {@link InlineCompletionsProvider inline completion provider} was triggered.\r\n */\r\nexport var InlineCompletionTriggerKind;\r\n(function (InlineCompletionTriggerKind) {\r\n /**\r\n * Completion was triggered automatically while editing.\r\n * It is sufficient to return a single completion item in this case.\r\n */\r\n InlineCompletionTriggerKind[InlineCompletionTriggerKind[\"Automatic\"] = 0] = \"Automatic\";\r\n /**\r\n * Completion was triggered explicitly by a user gesture.\r\n * Return multiple completion items to enable cycling through them.\r\n */\r\n InlineCompletionTriggerKind[InlineCompletionTriggerKind[\"Explicit\"] = 1] = \"Explicit\";\r\n})(InlineCompletionTriggerKind || (InlineCompletionTriggerKind = {}));\r\nexport var SignatureHelpTriggerKind;\r\n(function (SignatureHelpTriggerKind) {\r\n SignatureHelpTriggerKind[SignatureHelpTriggerKind[\"Invoke\"] = 1] = \"Invoke\";\r\n SignatureHelpTriggerKind[SignatureHelpTriggerKind[\"TriggerCharacter\"] = 2] = \"TriggerCharacter\";\r\n SignatureHelpTriggerKind[SignatureHelpTriggerKind[\"ContentChange\"] = 3] = \"ContentChange\";\r\n})(SignatureHelpTriggerKind || (SignatureHelpTriggerKind = {}));\r\n/**\r\n * A document highlight kind.\r\n */\r\nexport var DocumentHighlightKind;\r\n(function (DocumentHighlightKind) {\r\n /**\r\n * A textual occurrence.\r\n */\r\n DocumentHighlightKind[DocumentHighlightKind[\"Text\"] = 0] = \"Text\";\r\n /**\r\n * Read-access of a symbol, like reading a variable.\r\n */\r\n DocumentHighlightKind[DocumentHighlightKind[\"Read\"] = 1] = \"Read\";\r\n /**\r\n * Write-access of a symbol, like writing to a variable.\r\n */\r\n DocumentHighlightKind[DocumentHighlightKind[\"Write\"] = 2] = \"Write\";\r\n})(DocumentHighlightKind || (DocumentHighlightKind = {}));\r\n/**\r\n * @internal\r\n */\r\nexport function isLocationLink(thing) {\r\n return thing\r\n && URI.isUri(thing.uri)\r\n && Range.isIRange(thing.range)\r\n && (Range.isIRange(thing.originSelectionRange) || Range.isIRange(thing.targetSelectionRange));\r\n}\r\n/**\r\n * @internal\r\n */\r\nexport var SymbolKinds;\r\n(function (SymbolKinds) {\r\n const byName = new Map();\r\n byName.set('file', 0 /* File */);\r\n byName.set('module', 1 /* Module */);\r\n byName.set('namespace', 2 /* Namespace */);\r\n byName.set('package', 3 /* Package */);\r\n byName.set('class', 4 /* Class */);\r\n byName.set('method', 5 /* Method */);\r\n byName.set('property', 6 /* Property */);\r\n byName.set('field', 7 /* Field */);\r\n byName.set('constructor', 8 /* Constructor */);\r\n byName.set('enum', 9 /* Enum */);\r\n byName.set('interface', 10 /* Interface */);\r\n byName.set('function', 11 /* Function */);\r\n byName.set('variable', 12 /* Variable */);\r\n byName.set('constant', 13 /* Constant */);\r\n byName.set('string', 14 /* String */);\r\n byName.set('number', 15 /* Number */);\r\n byName.set('boolean', 16 /* Boolean */);\r\n byName.set('array', 17 /* Array */);\r\n byName.set('object', 18 /* Object */);\r\n byName.set('key', 19 /* Key */);\r\n byName.set('null', 20 /* Null */);\r\n byName.set('enum-member', 21 /* EnumMember */);\r\n byName.set('struct', 22 /* Struct */);\r\n byName.set('event', 23 /* Event */);\r\n byName.set('operator', 24 /* Operator */);\r\n byName.set('type-parameter', 25 /* TypeParameter */);\r\n const byKind = new Map();\r\n byKind.set(0 /* File */, 'file');\r\n byKind.set(1 /* Module */, 'module');\r\n byKind.set(2 /* Namespace */, 'namespace');\r\n byKind.set(3 /* Package */, 'package');\r\n byKind.set(4 /* Class */, 'class');\r\n byKind.set(5 /* Method */, 'method');\r\n byKind.set(6 /* Property */, 'property');\r\n byKind.set(7 /* Field */, 'field');\r\n byKind.set(8 /* Constructor */, 'constructor');\r\n byKind.set(9 /* Enum */, 'enum');\r\n byKind.set(10 /* Interface */, 'interface');\r\n byKind.set(11 /* Function */, 'function');\r\n byKind.set(12 /* Variable */, 'variable');\r\n byKind.set(13 /* Constant */, 'constant');\r\n byKind.set(14 /* String */, 'string');\r\n byKind.set(15 /* Number */, 'number');\r\n byKind.set(16 /* Boolean */, 'boolean');\r\n byKind.set(17 /* Array */, 'array');\r\n byKind.set(18 /* Object */, 'object');\r\n byKind.set(19 /* Key */, 'key');\r\n byKind.set(20 /* Null */, 'null');\r\n byKind.set(21 /* EnumMember */, 'enum-member');\r\n byKind.set(22 /* Struct */, 'struct');\r\n byKind.set(23 /* Event */, 'event');\r\n byKind.set(24 /* Operator */, 'operator');\r\n byKind.set(25 /* TypeParameter */, 'type-parameter');\r\n /**\r\n * @internal\r\n */\r\n function fromString(value) {\r\n return byName.get(value);\r\n }\r\n SymbolKinds.fromString = fromString;\r\n /**\r\n * @internal\r\n */\r\n function toString(kind) {\r\n return byKind.get(kind);\r\n }\r\n SymbolKinds.toString = toString;\r\n /**\r\n * @internal\r\n */\r\n function toCssClassName(kind, inline) {\r\n const symbolName = byKind.get(kind);\r\n let codicon = symbolName && iconRegistry.get('symbol-' + symbolName);\r\n if (!codicon) {\r\n console.info('No codicon found for SymbolKind ' + kind);\r\n codicon = Codicon.symbolProperty;\r\n }\r\n return `${inline ? 'inline' : 'block'} ${codicon.classNames}`;\r\n }\r\n SymbolKinds.toCssClassName = toCssClassName;\r\n})(SymbolKinds || (SymbolKinds = {}));\r\nexport class FoldingRangeKind {\r\n /**\r\n * Creates a new {@link FoldingRangeKind}.\r\n *\r\n * @param value of the kind.\r\n */\r\n constructor(value) {\r\n this.value = value;\r\n }\r\n}\r\n/**\r\n * Kind for folding range representing a comment. The value of the kind is 'comment'.\r\n */\r\nFoldingRangeKind.Comment = new FoldingRangeKind('comment');\r\n/**\r\n * Kind for folding range representing a import. The value of the kind is 'imports'.\r\n */\r\nFoldingRangeKind.Imports = new FoldingRangeKind('imports');\r\n/**\r\n * Kind for folding range representing regions (for example marked by `#region`, `#endregion`).\r\n * The value of the kind is 'region'.\r\n */\r\nFoldingRangeKind.Region = new FoldingRangeKind('region');\r\nexport var InlayHintKind;\r\n(function (InlayHintKind) {\r\n InlayHintKind[InlayHintKind[\"Other\"] = 0] = \"Other\";\r\n InlayHintKind[InlayHintKind[\"Type\"] = 1] = \"Type\";\r\n InlayHintKind[InlayHintKind[\"Parameter\"] = 2] = \"Parameter\";\r\n})(InlayHintKind || (InlayHintKind = {}));\r\n// --- feature registries ------\r\n/**\r\n * @internal\r\n */\r\nexport const ReferenceProviderRegistry = new LanguageFeatureRegistry();\r\n/**\r\n * @internal\r\n */\r\nexport const RenameProviderRegistry = new LanguageFeatureRegistry();\r\n/**\r\n * @internal\r\n */\r\nexport const CompletionProviderRegistry = new LanguageFeatureRegistry();\r\n/**\r\n * @internal\r\n */\r\nexport const InlineCompletionsProviderRegistry = new LanguageFeatureRegistry();\r\n/**\r\n * @internal\r\n */\r\nexport const SignatureHelpProviderRegistry = new LanguageFeatureRegistry();\r\n/**\r\n * @internal\r\n */\r\nexport const HoverProviderRegistry = new LanguageFeatureRegistry();\r\n/**\r\n * @internal\r\n */\r\nexport const DocumentSymbolProviderRegistry = new LanguageFeatureRegistry();\r\n/**\r\n * @internal\r\n */\r\nexport const DocumentHighlightProviderRegistry = new LanguageFeatureRegistry();\r\n/**\r\n * @internal\r\n */\r\nexport const LinkedEditingRangeProviderRegistry = new LanguageFeatureRegistry();\r\n/**\r\n * @internal\r\n */\r\nexport const DefinitionProviderRegistry = new LanguageFeatureRegistry();\r\n/**\r\n * @internal\r\n */\r\nexport const DeclarationProviderRegistry = new LanguageFeatureRegistry();\r\n/**\r\n * @internal\r\n */\r\nexport const ImplementationProviderRegistry = new LanguageFeatureRegistry();\r\n/**\r\n * @internal\r\n */\r\nexport const TypeDefinitionProviderRegistry = new LanguageFeatureRegistry();\r\n/**\r\n * @internal\r\n */\r\nexport const CodeLensProviderRegistry = new LanguageFeatureRegistry();\r\n/**\r\n * @internal\r\n */\r\nexport const InlayHintsProviderRegistry = new LanguageFeatureRegistry();\r\n/**\r\n * @internal\r\n */\r\nexport const CodeActionProviderRegistry = new LanguageFeatureRegistry();\r\n/**\r\n * @internal\r\n */\r\nexport const DocumentFormattingEditProviderRegistry = new LanguageFeatureRegistry();\r\n/**\r\n * @internal\r\n */\r\nexport const DocumentRangeFormattingEditProviderRegistry = new LanguageFeatureRegistry();\r\n/**\r\n * @internal\r\n */\r\nexport const OnTypeFormattingEditProviderRegistry = new LanguageFeatureRegistry();\r\n/**\r\n * @internal\r\n */\r\nexport const LinkProviderRegistry = new LanguageFeatureRegistry();\r\n/**\r\n * @internal\r\n */\r\nexport const ColorProviderRegistry = new LanguageFeatureRegistry();\r\n/**\r\n * @internal\r\n */\r\nexport const SelectionRangeRegistry = new LanguageFeatureRegistry();\r\n/**\r\n * @internal\r\n */\r\nexport const FoldingRangeProviderRegistry = new LanguageFeatureRegistry();\r\n/**\r\n * @internal\r\n */\r\nexport const DocumentSemanticTokensProviderRegistry = new LanguageFeatureRegistry();\r\n/**\r\n * @internal\r\n */\r\nexport const DocumentRangeSemanticTokensProviderRegistry = new LanguageFeatureRegistry();\r\n/**\r\n * @internal\r\n */\r\nexport const TokenizationRegistry = new TokenizationRegistryImpl();\r\n", "/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License. See License.txt in the project root for license information.\r\n *--------------------------------------------------------------------------------------------*/\r\nimport { TokenMetadata } from '../modes.js';\r\nexport class LineTokens {\r\n constructor(tokens, text) {\r\n this._lineTokensBrand = undefined;\r\n this._tokens = tokens;\r\n this._tokensCount = (this._tokens.length >>> 1);\r\n this._text = text;\r\n }\r\n static createEmpty(lineContent) {\r\n const defaultMetadata = LineTokens.defaultTokenMetadata;\r\n const tokens = new Uint32Array(2);\r\n tokens[0] = lineContent.length;\r\n tokens[1] = defaultMetadata;\r\n return new LineTokens(tokens, lineContent);\r\n }\r\n equals(other) {\r\n if (other instanceof LineTokens) {\r\n return this.slicedEquals(other, 0, this._tokensCount);\r\n }\r\n return false;\r\n }\r\n slicedEquals(other, sliceFromTokenIndex, sliceTokenCount) {\r\n if (this._text !== other._text) {\r\n return false;\r\n }\r\n if (this._tokensCount !== other._tokensCount) {\r\n return false;\r\n }\r\n const from = (sliceFromTokenIndex << 1);\r\n const to = from + (sliceTokenCount << 1);\r\n for (let i = from; i < to; i++) {\r\n if (this._tokens[i] !== other._tokens[i]) {\r\n return false;\r\n }\r\n }\r\n return true;\r\n }\r\n getLineContent() {\r\n return this._text;\r\n }\r\n getCount() {\r\n return this._tokensCount;\r\n }\r\n getStartOffset(tokenIndex) {\r\n if (tokenIndex > 0) {\r\n return this._tokens[(tokenIndex - 1) << 1];\r\n }\r\n return 0;\r\n }\r\n getMetadata(tokenIndex) {\r\n const metadata = this._tokens[(tokenIndex << 1) + 1];\r\n return metadata;\r\n }\r\n getLanguageId(tokenIndex) {\r\n const metadata = this._tokens[(tokenIndex << 1) + 1];\r\n return TokenMetadata.getLanguageId(metadata);\r\n }\r\n getStandardTokenType(tokenIndex) {\r\n const metadata = this._tokens[(tokenIndex << 1) + 1];\r\n return TokenMetadata.getTokenType(metadata);\r\n }\r\n getForeground(tokenIndex) {\r\n const metadata = this._tokens[(tokenIndex << 1) + 1];\r\n return TokenMetadata.getForeground(metadata);\r\n }\r\n getClassName(tokenIndex) {\r\n const metadata = this._tokens[(tokenIndex << 1) + 1];\r\n return TokenMetadata.getClassNameFromMetadata(metadata);\r\n }\r\n getInlineStyle(tokenIndex, colorMap) {\r\n const metadata = this._tokens[(tokenIndex << 1) + 1];\r\n return TokenMetadata.getInlineStyleFromMetadata(metadata, colorMap);\r\n }\r\n getEndOffset(tokenIndex) {\r\n return this._tokens[tokenIndex << 1];\r\n }\r\n /**\r\n * Find the token containing offset `offset`.\r\n * @param offset The search offset\r\n * @return The index of the token containing the offset.\r\n */\r\n findTokenIndexAtOffset(offset) {\r\n return LineTokens.findIndexInTokensArray(this._tokens, offset);\r\n }\r\n inflate() {\r\n return this;\r\n }\r\n sliceAndInflate(startOffset, endOffset, deltaOffset) {\r\n return new SlicedLineTokens(this, startOffset, endOffset, deltaOffset);\r\n }\r\n static convertToEndOffset(tokens, lineTextLength) {\r\n const tokenCount = (tokens.length >>> 1);\r\n const lastTokenIndex = tokenCount - 1;\r\n for (let tokenIndex = 0; tokenIndex < lastTokenIndex; tokenIndex++) {\r\n tokens[tokenIndex << 1] = tokens[(tokenIndex + 1) << 1];\r\n }\r\n tokens[lastTokenIndex << 1] = lineTextLength;\r\n }\r\n static findIndexInTokensArray(tokens, desiredIndex) {\r\n if (tokens.length <= 2) {\r\n return 0;\r\n }\r\n let low = 0;\r\n let high = (tokens.length >>> 1) - 1;\r\n while (low < high) {\r\n const mid = low + Math.floor((high - low) / 2);\r\n const endOffset = tokens[(mid << 1)];\r\n if (endOffset === desiredIndex) {\r\n return mid + 1;\r\n }\r\n else if (endOffset < desiredIndex) {\r\n low = mid + 1;\r\n }\r\n else if (endOffset > desiredIndex) {\r\n high = mid;\r\n }\r\n }\r\n return low;\r\n }\r\n /**\r\n * @pure\r\n * @param insertTokens Must be sorted by offset.\r\n */\r\n withInserted(insertTokens) {\r\n if (insertTokens.length === 0) {\r\n return this;\r\n }\r\n let nextOriginalTokenIdx = 0;\r\n let nextInsertTokenIdx = 0;\r\n let text = '';\r\n const newTokens = new Array();\r\n let originalEndOffset = 0;\r\n while (true) {\r\n let nextOriginalTokenEndOffset = nextOriginalTokenIdx < this._tokensCount ? this._tokens[nextOriginalTokenIdx << 1] : -1;\r\n let nextInsertToken = nextInsertTokenIdx < insertTokens.length ? insertTokens[nextInsertTokenIdx] : null;\r\n if (nextOriginalTokenEndOffset !== -1 && (nextInsertToken === null || nextOriginalTokenEndOffset <= nextInsertToken.offset)) {\r\n // original token ends before next insert token\r\n text += this._text.substring(originalEndOffset, nextOriginalTokenEndOffset);\r\n const metadata = this._tokens[(nextOriginalTokenIdx << 1) + 1];\r\n newTokens.push(text.length, metadata);\r\n nextOriginalTokenIdx++;\r\n originalEndOffset = nextOriginalTokenEndOffset;\r\n }\r\n else if (nextInsertToken) {\r\n if (nextInsertToken.offset > originalEndOffset) {\r\n // insert token is in the middle of the next token.\r\n text += this._text.substring(originalEndOffset, nextInsertToken.offset);\r\n const metadata = this._tokens[(nextOriginalTokenIdx << 1) + 1];\r\n newTokens.push(text.length, metadata);\r\n originalEndOffset = nextInsertToken.offset;\r\n }\r\n text += nextInsertToken.text;\r\n newTokens.push(text.length, nextInsertToken.tokenMetadata);\r\n nextInsertTokenIdx++;\r\n }\r\n else {\r\n break;\r\n }\r\n }\r\n return new LineTokens(new Uint32Array(newTokens), text);\r\n }\r\n}\r\nLineTokens.defaultTokenMetadata = ((0 /* None */ << 11 /* FONT_STYLE_OFFSET */)\r\n | (1 /* DefaultForeground */ << 14 /* FOREGROUND_OFFSET */)\r\n | (2 /* DefaultBackground */ << 23 /* BACKGROUND_OFFSET */)) >>> 0;\r\nexport class SlicedLineTokens {\r\n constructor(source, startOffset, endOffset, deltaOffset) {\r\n this._source = source;\r\n this._startOffset = startOffset;\r\n this._endOffset = endOffset;\r\n this._deltaOffset = deltaOffset;\r\n this._firstTokenIndex = source.findTokenIndexAtOffset(startOffset);\r\n this._tokensCount = 0;\r\n for (let i = this._firstTokenIndex, len = source.getCount(); i < len; i++) {\r\n const tokenStartOffset = source.getStartOffset(i);\r\n if (tokenStartOffset >= endOffset) {\r\n break;\r\n }\r\n this._tokensCount++;\r\n }\r\n }\r\n equals(other) {\r\n if (other instanceof SlicedLineTokens) {\r\n return (this._startOffset === other._startOffset\r\n && this._endOffset === other._endOffset\r\n && this._deltaOffset === other._deltaOffset\r\n && this._source.slicedEquals(other._source, this._firstTokenIndex, this._tokensCount));\r\n }\r\n return false;\r\n }\r\n getCount() {\r\n return this._tokensCount;\r\n }\r\n getForeground(tokenIndex) {\r\n return this._source.getForeground(this._firstTokenIndex + tokenIndex);\r\n }\r\n getEndOffset(tokenIndex) {\r\n const tokenEndOffset = this._source.getEndOffset(this._firstTokenIndex + tokenIndex);\r\n return Math.min(this._endOffset, tokenEndOffset) - this._startOffset + this._deltaOffset;\r\n }\r\n getClassName(tokenIndex) {\r\n return this._source.getClassName(this._firstTokenIndex + tokenIndex);\r\n }\r\n getInlineStyle(tokenIndex, colorMap) {\r\n return this._source.getInlineStyle(this._firstTokenIndex + tokenIndex, colorMap);\r\n }\r\n findTokenIndexAtOffset(offset) {\r\n return this._source.findTokenIndexAtOffset(offset + this._startOffset - this._deltaOffset) - this._firstTokenIndex;\r\n }\r\n}\r\n", "/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License. See License.txt in the project root for license information.\r\n *--------------------------------------------------------------------------------------------*/\r\nimport * as arrays from '../../../base/common/arrays.js';\r\nimport { LineTokens } from '../core/lineTokens.js';\r\nimport { Position } from '../core/position.js';\r\nimport { Range } from '../core/range.js';\r\nimport { TokenMetadata } from '../modes.js';\r\nexport function countEOL(text) {\r\n let eolCount = 0;\r\n let firstLineLength = 0;\r\n let lastLineStart = 0;\r\n let eol = 0 /* Unknown */;\r\n for (let i = 0, len = text.length; i < len; i++) {\r\n const chr = text.charCodeAt(i);\r\n if (chr === 13 /* CarriageReturn */) {\r\n if (eolCount === 0) {\r\n firstLineLength = i;\r\n }\r\n eolCount++;\r\n if (i + 1 < len && text.charCodeAt(i + 1) === 10 /* LineFeed */) {\r\n // \\r\\n... case\r\n eol |= 2 /* CRLF */;\r\n i++; // skip \\n\r\n }\r\n else {\r\n // \\r... case\r\n eol |= 3 /* Invalid */;\r\n }\r\n lastLineStart = i + 1;\r\n }\r\n else if (chr === 10 /* LineFeed */) {\r\n // \\n... case\r\n eol |= 1 /* LF */;\r\n if (eolCount === 0) {\r\n firstLineLength = i;\r\n }\r\n eolCount++;\r\n lastLineStart = i + 1;\r\n }\r\n }\r\n if (eolCount === 0) {\r\n firstLineLength = text.length;\r\n }\r\n return [eolCount, firstLineLength, text.length - lastLineStart, eol];\r\n}\r\nfunction getDefaultMetadata(topLevelLanguageId) {\r\n return ((topLevelLanguageId << 0 /* LANGUAGEID_OFFSET */)\r\n | (0 /* Other */ << 8 /* TOKEN_TYPE_OFFSET */)\r\n | (0 /* None */ << 11 /* FONT_STYLE_OFFSET */)\r\n | (1 /* DefaultForeground */ << 14 /* FOREGROUND_OFFSET */)\r\n | (2 /* DefaultBackground */ << 23 /* BACKGROUND_OFFSET */)) >>> 0;\r\n}\r\nconst EMPTY_LINE_TOKENS = (new Uint32Array(0)).buffer;\r\nexport class MultilineTokensBuilder {\r\n constructor() {\r\n this.tokens = [];\r\n }\r\n add(lineNumber, lineTokens) {\r\n if (this.tokens.length > 0) {\r\n const last = this.tokens[this.tokens.length - 1];\r\n const lastLineNumber = last.startLineNumber + last.tokens.length - 1;\r\n if (lastLineNumber + 1 === lineNumber) {\r\n // append\r\n last.tokens.push(lineTokens);\r\n return;\r\n }\r\n }\r\n this.tokens.push(new MultilineTokens(lineNumber, [lineTokens]));\r\n }\r\n}\r\nexport class SparseEncodedTokens {\r\n constructor(tokens) {\r\n this._tokens = tokens;\r\n this._tokenCount = tokens.length / 4;\r\n }\r\n toString(startLineNumber) {\r\n let pieces = [];\r\n for (let i = 0; i < this._tokenCount; i++) {\r\n pieces.push(`(${this._getDeltaLine(i) + startLineNumber},${this._getStartCharacter(i)}-${this._getEndCharacter(i)})`);\r\n }\r\n return `[${pieces.join(',')}]`;\r\n }\r\n getMaxDeltaLine() {\r\n const tokenCount = this._getTokenCount();\r\n if (tokenCount === 0) {\r\n return -1;\r\n }\r\n return this._getDeltaLine(tokenCount - 1);\r\n }\r\n getRange() {\r\n const tokenCount = this._getTokenCount();\r\n if (tokenCount === 0) {\r\n return null;\r\n }\r\n const startChar = this._getStartCharacter(0);\r\n const maxDeltaLine = this._getDeltaLine(tokenCount - 1);\r\n const endChar = this._getEndCharacter(tokenCount - 1);\r\n return new Range(0, startChar + 1, maxDeltaLine, endChar + 1);\r\n }\r\n _getTokenCount() {\r\n return this._tokenCount;\r\n }\r\n _getDeltaLine(tokenIndex) {\r\n return this._tokens[4 * tokenIndex];\r\n }\r\n _getStartCharacter(tokenIndex) {\r\n return this._tokens[4 * tokenIndex + 1];\r\n }\r\n _getEndCharacter(tokenIndex) {\r\n return this._tokens[4 * tokenIndex + 2];\r\n }\r\n isEmpty() {\r\n return (this._getTokenCount() === 0);\r\n }\r\n getLineTokens(deltaLine) {\r\n let low = 0;\r\n let high = this._getTokenCount() - 1;\r\n while (low < high) {\r\n const mid = low + Math.floor((high - low) / 2);\r\n const midDeltaLine = this._getDeltaLine(mid);\r\n if (midDeltaLine < deltaLine) {\r\n low = mid + 1;\r\n }\r\n else if (midDeltaLine > deltaLine) {\r\n high = mid - 1;\r\n }\r\n else {\r\n let min = mid;\r\n while (min > low && this._getDeltaLine(min - 1) === deltaLine) {\r\n min--;\r\n }\r\n let max = mid;\r\n while (max < high && this._getDeltaLine(max + 1) === deltaLine) {\r\n max++;\r\n }\r\n return new LineTokens2(this._tokens.subarray(4 * min, 4 * max + 4));\r\n }\r\n }\r\n if (this._getDeltaLine(low) === deltaLine) {\r\n return new LineTokens2(this._tokens.subarray(4 * low, 4 * low + 4));\r\n }\r\n return null;\r\n }\r\n clear() {\r\n this._tokenCount = 0;\r\n }\r\n removeTokens(startDeltaLine, startChar, endDeltaLine, endChar) {\r\n const tokens = this._tokens;\r\n const tokenCount = this._tokenCount;\r\n let newTokenCount = 0;\r\n let hasDeletedTokens = false;\r\n let firstDeltaLine = 0;\r\n for (let i = 0; i < tokenCount; i++) {\r\n const srcOffset = 4 * i;\r\n const tokenDeltaLine = tokens[srcOffset];\r\n const tokenStartCharacter = tokens[srcOffset + 1];\r\n const tokenEndCharacter = tokens[srcOffset + 2];\r\n const tokenMetadata = tokens[srcOffset + 3];\r\n if ((tokenDeltaLine > startDeltaLine || (tokenDeltaLine === startDeltaLine && tokenEndCharacter >= startChar))\r\n && (tokenDeltaLine < endDeltaLine || (tokenDeltaLine === endDeltaLine && tokenStartCharacter <= endChar))) {\r\n hasDeletedTokens = true;\r\n }\r\n else {\r\n if (newTokenCount === 0) {\r\n firstDeltaLine = tokenDeltaLine;\r\n }\r\n if (hasDeletedTokens) {\r\n // must move the token to the left\r\n const destOffset = 4 * newTokenCount;\r\n tokens[destOffset] = tokenDeltaLine - firstDeltaLine;\r\n tokens[destOffset + 1] = tokenStartCharacter;\r\n tokens[destOffset + 2] = tokenEndCharacter;\r\n tokens[destOffset + 3] = tokenMetadata;\r\n }\r\n newTokenCount++;\r\n }\r\n }\r\n this._tokenCount = newTokenCount;\r\n return firstDeltaLine;\r\n }\r\n split(startDeltaLine, startChar, endDeltaLine, endChar) {\r\n const tokens = this._tokens;\r\n const tokenCount = this._tokenCount;\r\n let aTokens = [];\r\n let bTokens = [];\r\n let destTokens = aTokens;\r\n let destOffset = 0;\r\n let destFirstDeltaLine = 0;\r\n for (let i = 0; i < tokenCount; i++) {\r\n const srcOffset = 4 * i;\r\n const tokenDeltaLine = tokens[srcOffset];\r\n const tokenStartCharacter = tokens[srcOffset + 1];\r\n const tokenEndCharacter = tokens[srcOffset + 2];\r\n const tokenMetadata = tokens[srcOffset + 3];\r\n if ((tokenDeltaLine > startDeltaLine || (tokenDeltaLine === startDeltaLine && tokenEndCharacter >= startChar))) {\r\n if ((tokenDeltaLine < endDeltaLine || (tokenDeltaLine === endDeltaLine && tokenStartCharacter <= endChar))) {\r\n // this token is touching the range\r\n continue;\r\n }\r\n else {\r\n // this token is after the range\r\n if (destTokens !== bTokens) {\r\n // this token is the first token after the range\r\n destTokens = bTokens;\r\n destOffset = 0;\r\n destFirstDeltaLine = tokenDeltaLine;\r\n }\r\n }\r\n }\r\n destTokens[destOffset++] = tokenDeltaLine - destFirstDeltaLine;\r\n destTokens[destOffset++] = tokenStartCharacter;\r\n destTokens[destOffset++] = tokenEndCharacter;\r\n destTokens[destOffset++] = tokenMetadata;\r\n }\r\n return [new SparseEncodedTokens(new Uint32Array(aTokens)), new SparseEncodedTokens(new Uint32Array(bTokens)), destFirstDeltaLine];\r\n }\r\n acceptDeleteRange(horizontalShiftForFirstLineTokens, startDeltaLine, startCharacter, endDeltaLine, endCharacter) {\r\n // This is a bit complex, here are the cases I used to think about this:\r\n //\r\n // 1. The token starts before the deletion range\r\n // 1a. The token is completely before the deletion range\r\n // -----------\r\n // xxxxxxxxxxx\r\n // 1b. The token starts before, the deletion range ends after the token\r\n // -----------\r\n // xxxxxxxxxxx\r\n // 1c. The token starts before, the deletion range ends precisely with the token\r\n // ---------------\r\n // xxxxxxxx\r\n // 1d. The token starts before, the deletion range is inside the token\r\n // ---------------\r\n // xxxxx\r\n //\r\n // 2. The token starts at the same position with the deletion range\r\n // 2a. The token starts at the same position, and ends inside the deletion range\r\n // -------\r\n // xxxxxxxxxxx\r\n // 2b. The token starts at the same position, and ends at the same position as the deletion range\r\n // ----------\r\n // xxxxxxxxxx\r\n // 2c. The token starts at the same position, and ends after the deletion range\r\n // -------------\r\n // xxxxxxx\r\n //\r\n // 3. The token starts inside the deletion range\r\n // 3a. The token is inside the deletion range\r\n // -------\r\n // xxxxxxxxxxxxx\r\n // 3b. The token starts inside the deletion range, and ends at the same position as the deletion range\r\n // ----------\r\n // xxxxxxxxxxxxx\r\n // 3c. The token starts inside the deletion range, and ends after the deletion range\r\n // ------------\r\n // xxxxxxxxxxx\r\n //\r\n // 4. The token starts after the deletion range\r\n // -----------\r\n // xxxxxxxx\r\n //\r\n const tokens = this._tokens;\r\n const tokenCount = this._tokenCount;\r\n const deletedLineCount = (endDeltaLine - startDeltaLine);\r\n let newTokenCount = 0;\r\n let hasDeletedTokens = false;\r\n for (let i = 0; i < tokenCount; i++) {\r\n const srcOffset = 4 * i;\r\n let tokenDeltaLine = tokens[srcOffset];\r\n let tokenStartCharacter = tokens[srcOffset + 1];\r\n let tokenEndCharacter = tokens[srcOffset + 2];\r\n const tokenMetadata = tokens[srcOffset + 3];\r\n if (tokenDeltaLine < startDeltaLine || (tokenDeltaLine === startDeltaLine && tokenEndCharacter <= startCharacter)) {\r\n // 1a. The token is completely before the deletion range\r\n // => nothing to do\r\n newTokenCount++;\r\n continue;\r\n }\r\n else if (tokenDeltaLine === startDeltaLine && tokenStartCharacter < startCharacter) {\r\n // 1b, 1c, 1d\r\n // => the token survives, but it needs to shrink\r\n if (tokenDeltaLine === endDeltaLine && tokenEndCharacter > endCharacter) {\r\n // 1d. The token starts before, the deletion range is inside the token\r\n // => the token shrinks by the deletion character count\r\n tokenEndCharacter -= (endCharacter - startCharacter);\r\n }\r\n else {\r\n // 1b. The token starts before, the deletion range ends after the token\r\n // 1c. The token starts before, the deletion range ends precisely with the token\r\n // => the token shrinks its ending to the deletion start\r\n tokenEndCharacter = startCharacter;\r\n }\r\n }\r\n else if (tokenDeltaLine === startDeltaLine && tokenStartCharacter === startCharacter) {\r\n // 2a, 2b, 2c\r\n if (tokenDeltaLine === endDeltaLine && tokenEndCharacter > endCharacter) {\r\n // 2c. The token starts at the same position, and ends after the deletion range\r\n // => the token shrinks by the deletion character count\r\n tokenEndCharacter -= (endCharacter - startCharacter);\r\n }\r\n else {\r\n // 2a. The token starts at the same position, and ends inside the deletion range\r\n // 2b. The token starts at the same position, and ends at the same position as the deletion range\r\n // => the token is deleted\r\n hasDeletedTokens = true;\r\n continue;\r\n }\r\n }\r\n else if (tokenDeltaLine < endDeltaLine || (tokenDeltaLine === endDeltaLine && tokenStartCharacter < endCharacter)) {\r\n // 3a, 3b, 3c\r\n if (tokenDeltaLine === endDeltaLine && tokenEndCharacter > endCharacter) {\r\n // 3c. The token starts inside the deletion range, and ends after the deletion range\r\n // => the token moves left and shrinks\r\n if (tokenDeltaLine === startDeltaLine) {\r\n // the deletion started on the same line as the token\r\n // => the token moves left and shrinks\r\n tokenStartCharacter = startCharacter;\r\n tokenEndCharacter = tokenStartCharacter + (tokenEndCharacter - endCharacter);\r\n }\r\n else {\r\n // the deletion started on a line above the token\r\n // => the token moves to the beginning of the line\r\n tokenStartCharacter = 0;\r\n tokenEndCharacter = tokenStartCharacter + (tokenEndCharacter - endCharacter);\r\n }\r\n }\r\n else {\r\n // 3a. The token is inside the deletion range\r\n // 3b. The token starts inside the deletion range, and ends at the same position as the deletion range\r\n // => the token is deleted\r\n hasDeletedTokens = true;\r\n continue;\r\n }\r\n }\r\n else if (tokenDeltaLine > endDeltaLine) {\r\n // 4. (partial) The token starts after the deletion range, on a line below...\r\n if (deletedLineCount === 0 && !hasDeletedTokens) {\r\n // early stop, there is no need to walk all the tokens and do nothing...\r\n newTokenCount = tokenCount;\r\n break;\r\n }\r\n tokenDeltaLine -= deletedLineCount;\r\n }\r\n else if (tokenDeltaLine === endDeltaLine && tokenStartCharacter >= endCharacter) {\r\n // 4. (continued) The token starts after the deletion range, on the last line where a deletion occurs\r\n if (horizontalShiftForFirstLineTokens && tokenDeltaLine === 0) {\r\n tokenStartCharacter += horizontalShiftForFirstLineTokens;\r\n tokenEndCharacter += horizontalShiftForFirstLineTokens;\r\n }\r\n tokenDeltaLine -= deletedLineCount;\r\n tokenStartCharacter -= (endCharacter - startCharacter);\r\n tokenEndCharacter -= (endCharacter - startCharacter);\r\n }\r\n else {\r\n throw new Error(`Not possible!`);\r\n }\r\n const destOffset = 4 * newTokenCount;\r\n tokens[destOffset] = tokenDeltaLine;\r\n tokens[destOffset + 1] = tokenStartCharacter;\r\n tokens[destOffset + 2] = tokenEndCharacter;\r\n tokens[destOffset + 3] = tokenMetadata;\r\n newTokenCount++;\r\n }\r\n this._tokenCount = newTokenCount;\r\n }\r\n acceptInsertText(deltaLine, character, eolCount, firstLineLength, lastLineLength, firstCharCode) {\r\n // Here are the cases I used to think about this:\r\n //\r\n // 1. The token is completely before the insertion point\r\n // ----------- |\r\n // 2. The token ends precisely at the insertion point\r\n // -----------|\r\n // 3. The token contains the insertion point\r\n // -----|------\r\n // 4. The token starts precisely at the insertion point\r\n // |-----------\r\n // 5. The token is completely after the insertion point\r\n // | -----------\r\n //\r\n const isInsertingPreciselyOneWordCharacter = (eolCount === 0\r\n && firstLineLength === 1\r\n && ((firstCharCode >= 48 /* Digit0 */ && firstCharCode <= 57 /* Digit9 */)\r\n || (firstCharCode >= 65 /* A */ && firstCharCode <= 90 /* Z */)\r\n || (firstCharCode >= 97 /* a */ && firstCharCode <= 122 /* z */)));\r\n const tokens = this._tokens;\r\n const tokenCount = this._tokenCount;\r\n for (let i = 0; i < tokenCount; i++) {\r\n const offset = 4 * i;\r\n let tokenDeltaLine = tokens[offset];\r\n let tokenStartCharacter = tokens[offset + 1];\r\n let tokenEndCharacter = tokens[offset + 2];\r\n if (tokenDeltaLine < deltaLine || (tokenDeltaLine === deltaLine && tokenEndCharacter < character)) {\r\n // 1. The token is completely before the insertion point\r\n // => nothing to do\r\n continue;\r\n }\r\n else if (tokenDeltaLine === deltaLine && tokenEndCharacter === character) {\r\n // 2. The token ends precisely at the insertion point\r\n // => expand the end character only if inserting precisely one character that is a word character\r\n if (isInsertingPreciselyOneWordCharacter) {\r\n tokenEndCharacter += 1;\r\n }\r\n else {\r\n continue;\r\n }\r\n }\r\n else if (tokenDeltaLine === deltaLine && tokenStartCharacter < character && character < tokenEndCharacter) {\r\n // 3. The token contains the insertion point\r\n if (eolCount === 0) {\r\n // => just expand the end character\r\n tokenEndCharacter += firstLineLength;\r\n }\r\n else {\r\n // => cut off the token\r\n tokenEndCharacter = character;\r\n }\r\n }\r\n else {\r\n // 4. or 5.\r\n if (tokenDeltaLine === deltaLine && tokenStartCharacter === character) {\r\n // 4. The token starts precisely at the insertion point\r\n // => grow the token (by keeping its start constant) only if inserting precisely one character that is a word character\r\n // => otherwise behave as in case 5.\r\n if (isInsertingPreciselyOneWordCharacter) {\r\n continue;\r\n }\r\n }\r\n // => the token must move and keep its size constant\r\n if (tokenDeltaLine === deltaLine) {\r\n tokenDeltaLine += eolCount;\r\n // this token is on the line where the insertion is taking place\r\n if (eolCount === 0) {\r\n tokenStartCharacter += firstLineLength;\r\n tokenEndCharacter += firstLineLength;\r\n }\r\n else {\r\n const tokenLength = tokenEndCharacter - tokenStartCharacter;\r\n tokenStartCharacter = lastLineLength + (tokenStartCharacter - character);\r\n tokenEndCharacter = tokenStartCharacter + tokenLength;\r\n }\r\n }\r\n else {\r\n tokenDeltaLine += eolCount;\r\n }\r\n }\r\n tokens[offset] = tokenDeltaLine;\r\n tokens[offset + 1] = tokenStartCharacter;\r\n tokens[offset + 2] = tokenEndCharacter;\r\n }\r\n }\r\n}\r\nexport class LineTokens2 {\r\n constructor(tokens) {\r\n this._tokens = tokens;\r\n }\r\n getCount() {\r\n return this._tokens.length / 4;\r\n }\r\n getStartCharacter(tokenIndex) {\r\n return this._tokens[4 * tokenIndex + 1];\r\n }\r\n getEndCharacter(tokenIndex) {\r\n return this._tokens[4 * tokenIndex + 2];\r\n }\r\n getMetadata(tokenIndex) {\r\n return this._tokens[4 * tokenIndex + 3];\r\n }\r\n}\r\nexport class MultilineTokens2 {\r\n constructor(startLineNumber, tokens) {\r\n this.startLineNumber = startLineNumber;\r\n this.tokens = tokens;\r\n this.endLineNumber = this.startLineNumber + this.tokens.getMaxDeltaLine();\r\n }\r\n toString() {\r\n return this.tokens.toString(this.startLineNumber);\r\n }\r\n _updateEndLineNumber() {\r\n this.endLineNumber = this.startLineNumber + this.tokens.getMaxDeltaLine();\r\n }\r\n isEmpty() {\r\n return this.tokens.isEmpty();\r\n }\r\n getLineTokens(lineNumber) {\r\n if (this.startLineNumber <= lineNumber && lineNumber <= this.endLineNumber) {\r\n return this.tokens.getLineTokens(lineNumber - this.startLineNumber);\r\n }\r\n return null;\r\n }\r\n getRange() {\r\n const deltaRange = this.tokens.getRange();\r\n if (!deltaRange) {\r\n return deltaRange;\r\n }\r\n return new Range(this.startLineNumber + deltaRange.startLineNumber, deltaRange.startColumn, this.startLineNumber + deltaRange.endLineNumber, deltaRange.endColumn);\r\n }\r\n removeTokens(range) {\r\n const startLineIndex = range.startLineNumber - this.startLineNumber;\r\n const endLineIndex = range.endLineNumber - this.startLineNumber;\r\n this.startLineNumber += this.tokens.removeTokens(startLineIndex, range.startColumn - 1, endLineIndex, range.endColumn - 1);\r\n this._updateEndLineNumber();\r\n }\r\n split(range) {\r\n // split tokens to two:\r\n // a) all the tokens before `range`\r\n // b) all the tokens after `range`\r\n const startLineIndex = range.startLineNumber - this.startLineNumber;\r\n const endLineIndex = range.endLineNumber - this.startLineNumber;\r\n const [a, b, bDeltaLine] = this.tokens.split(startLineIndex, range.startColumn - 1, endLineIndex, range.endColumn - 1);\r\n return [new MultilineTokens2(this.startLineNumber, a), new MultilineTokens2(this.startLineNumber + bDeltaLine, b)];\r\n }\r\n applyEdit(range, text) {\r\n const [eolCount, firstLineLength, lastLineLength] = countEOL(text);\r\n this.acceptEdit(range, eolCount, firstLineLength, lastLineLength, text.length > 0 ? text.charCodeAt(0) : 0 /* Null */);\r\n }\r\n acceptEdit(range, eolCount, firstLineLength, lastLineLength, firstCharCode) {\r\n this._acceptDeleteRange(range);\r\n this._acceptInsertText(new Position(range.startLineNumber, range.startColumn), eolCount, firstLineLength, lastLineLength, firstCharCode);\r\n this._updateEndLineNumber();\r\n }\r\n _acceptDeleteRange(range) {\r\n if (range.startLineNumber === range.endLineNumber && range.startColumn === range.endColumn) {\r\n // Nothing to delete\r\n return;\r\n }\r\n const firstLineIndex = range.startLineNumber - this.startLineNumber;\r\n const lastLineIndex = range.endLineNumber - this.startLineNumber;\r\n if (lastLineIndex < 0) {\r\n // this deletion occurs entirely before this block, so we only need to adjust line numbers\r\n const deletedLinesCount = lastLineIndex - firstLineIndex;\r\n this.startLineNumber -= deletedLinesCount;\r\n return;\r\n }\r\n const tokenMaxDeltaLine = this.tokens.getMaxDeltaLine();\r\n if (firstLineIndex >= tokenMaxDeltaLine + 1) {\r\n // this deletion occurs entirely after this block, so there is nothing to do\r\n return;\r\n }\r\n if (firstLineIndex < 0 && lastLineIndex >= tokenMaxDeltaLine + 1) {\r\n // this deletion completely encompasses this block\r\n this.startLineNumber = 0;\r\n this.tokens.clear();\r\n return;\r\n }\r\n if (firstLineIndex < 0) {\r\n const deletedBefore = -firstLineIndex;\r\n this.startLineNumber -= deletedBefore;\r\n this.tokens.acceptDeleteRange(range.startColumn - 1, 0, 0, lastLineIndex, range.endColumn - 1);\r\n }\r\n else {\r\n this.tokens.acceptDeleteRange(0, firstLineIndex, range.startColumn - 1, lastLineIndex, range.endColumn - 1);\r\n }\r\n }\r\n _acceptInsertText(position, eolCount, firstLineLength, lastLineLength, firstCharCode) {\r\n if (eolCount === 0 && firstLineLength === 0) {\r\n // Nothing to insert\r\n return;\r\n }\r\n const lineIndex = position.lineNumber - this.startLineNumber;\r\n if (lineIndex < 0) {\r\n // this insertion occurs before this block, so we only need to adjust line numbers\r\n this.startLineNumber += eolCount;\r\n return;\r\n }\r\n const tokenMaxDeltaLine = this.tokens.getMaxDeltaLine();\r\n if (lineIndex >= tokenMaxDeltaLine + 1) {\r\n // this insertion occurs after this block, so there is nothing to do\r\n return;\r\n }\r\n this.tokens.acceptInsertText(lineIndex, position.column - 1, eolCount, firstLineLength, lastLineLength, firstCharCode);\r\n }\r\n}\r\nexport class MultilineTokens {\r\n constructor(startLineNumber, tokens) {\r\n this.startLineNumber = startLineNumber;\r\n this.tokens = tokens;\r\n }\r\n}\r\nfunction toUint32Array(arr) {\r\n if (arr instanceof Uint32Array) {\r\n return arr;\r\n }\r\n else {\r\n return new Uint32Array(arr);\r\n }\r\n}\r\nexport class TokensStore2 {\r\n constructor() {\r\n this._pieces = [];\r\n this._isComplete = false;\r\n }\r\n flush() {\r\n this._pieces = [];\r\n this._isComplete = false;\r\n }\r\n isEmpty() {\r\n return (this._pieces.length === 0);\r\n }\r\n set(pieces, isComplete) {\r\n this._pieces = pieces || [];\r\n this._isComplete = isComplete;\r\n }\r\n setPartial(_range, pieces) {\r\n // console.log(`setPartial ${_range} ${pieces.map(p => p.toString()).join(', ')}`);\r\n let range = _range;\r\n if (pieces.length > 0) {\r\n const _firstRange = pieces[0].getRange();\r\n const _lastRange = pieces[pieces.length - 1].getRange();\r\n if (!_firstRange || !_lastRange) {\r\n return _range;\r\n }\r\n range = _range.plusRange(_firstRange).plusRange(_lastRange);\r\n }\r\n let insertPosition = null;\r\n for (let i = 0, len = this._pieces.length; i < len; i++) {\r\n const piece = this._pieces[i];\r\n if (piece.endLineNumber < range.startLineNumber) {\r\n // this piece is before the range\r\n continue;\r\n }\r\n if (piece.startLineNumber > range.endLineNumber) {\r\n // this piece is after the range, so mark the spot before this piece\r\n // as a good insertion position and stop looping\r\n insertPosition = insertPosition || { index: i };\r\n break;\r\n }\r\n // this piece might intersect with the range\r\n piece.removeTokens(range);\r\n if (piece.isEmpty()) {\r\n // remove the piece if it became empty\r\n this._pieces.splice(i, 1);\r\n i--;\r\n len--;\r\n continue;\r\n }\r\n if (piece.endLineNumber < range.startLineNumber) {\r\n // after removal, this piece is before the range\r\n continue;\r\n }\r\n if (piece.startLineNumber > range.endLineNumber) {\r\n // after removal, this piece is after the range\r\n insertPosition = insertPosition || { index: i };\r\n continue;\r\n }\r\n // after removal, this piece contains the range\r\n const [a, b] = piece.split(range);\r\n if (a.isEmpty()) {\r\n // this piece is actually after the range\r\n insertPosition = insertPosition || { index: i };\r\n continue;\r\n }\r\n if (b.isEmpty()) {\r\n // this piece is actually before the range\r\n continue;\r\n }\r\n this._pieces.splice(i, 1, a, b);\r\n i++;\r\n len++;\r\n insertPosition = insertPosition || { index: i };\r\n }\r\n insertPosition = insertPosition || { index: this._pieces.length };\r\n if (pieces.length > 0) {\r\n this._pieces = arrays.arrayInsert(this._pieces, insertPosition.index, pieces);\r\n }\r\n // console.log(`I HAVE ${this._pieces.length} pieces`);\r\n // console.log(`${this._pieces.map(p => p.toString()).join('\\n')}`);\r\n return range;\r\n }\r\n isComplete() {\r\n return this._isComplete;\r\n }\r\n addSemanticTokens(lineNumber, aTokens) {\r\n const pieces = this._pieces;\r\n if (pieces.length === 0) {\r\n return aTokens;\r\n }\r\n const pieceIndex = TokensStore2._findFirstPieceWithLine(pieces, lineNumber);\r\n const bTokens = pieces[pieceIndex].getLineTokens(lineNumber);\r\n if (!bTokens) {\r\n return aTokens;\r\n }\r\n const aLen = aTokens.getCount();\r\n const bLen = bTokens.getCount();\r\n let aIndex = 0;\r\n let result = [], resultLen = 0;\r\n let lastEndOffset = 0;\r\n const emitToken = (endOffset, metadata) => {\r\n if (endOffset === lastEndOffset) {\r\n return;\r\n }\r\n lastEndOffset = endOffset;\r\n result[resultLen++] = endOffset;\r\n result[resultLen++] = metadata;\r\n };\r\n for (let bIndex = 0; bIndex < bLen; bIndex++) {\r\n const bStartCharacter = bTokens.getStartCharacter(bIndex);\r\n const bEndCharacter = bTokens.getEndCharacter(bIndex);\r\n const bMetadata = bTokens.getMetadata(bIndex);\r\n const bMask = (((bMetadata & 1 /* SEMANTIC_USE_ITALIC */) ? 2048 /* ITALIC_MASK */ : 0)\r\n | ((bMetadata & 2 /* SEMANTIC_USE_BOLD */) ? 4096 /* BOLD_MASK */ : 0)\r\n | ((bMetadata & 4 /* SEMANTIC_USE_UNDERLINE */) ? 8192 /* UNDERLINE_MASK */ : 0)\r\n | ((bMetadata & 8 /* SEMANTIC_USE_FOREGROUND */) ? 8372224 /* FOREGROUND_MASK */ : 0)\r\n | ((bMetadata & 16 /* SEMANTIC_USE_BACKGROUND */) ? 4286578688 /* BACKGROUND_MASK */ : 0)) >>> 0;\r\n const aMask = (~bMask) >>> 0;\r\n // push any token from `a` that is before `b`\r\n while (aIndex < aLen && aTokens.getEndOffset(aIndex) <= bStartCharacter) {\r\n emitToken(aTokens.getEndOffset(aIndex), aTokens.getMetadata(aIndex));\r\n aIndex++;\r\n }\r\n // push the token from `a` if it intersects the token from `b`\r\n if (aIndex < aLen && aTokens.getStartOffset(aIndex) < bStartCharacter) {\r\n emitToken(bStartCharacter, aTokens.getMetadata(aIndex));\r\n }\r\n // skip any tokens from `a` that are contained inside `b`\r\n while (aIndex < aLen && aTokens.getEndOffset(aIndex) < bEndCharacter) {\r\n emitToken(aTokens.getEndOffset(aIndex), (aTokens.getMetadata(aIndex) & aMask) | (bMetadata & bMask));\r\n aIndex++;\r\n }\r\n if (aIndex < aLen) {\r\n emitToken(bEndCharacter, (aTokens.getMetadata(aIndex) & aMask) | (bMetadata & bMask));\r\n if (aTokens.getEndOffset(aIndex) === bEndCharacter) {\r\n // `a` ends exactly at the same spot as `b`!\r\n aIndex++;\r\n }\r\n }\r\n else {\r\n const aMergeIndex = Math.min(Math.max(0, aIndex - 1), aLen - 1);\r\n // push the token from `b`\r\n emitToken(bEndCharacter, (aTokens.getMetadata(aMergeIndex) & aMask) | (bMetadata & bMask));\r\n }\r\n }\r\n // push the remaining tokens from `a`\r\n while (aIndex < aLen) {\r\n emitToken(aTokens.getEndOffset(aIndex), aTokens.getMetadata(aIndex));\r\n aIndex++;\r\n }\r\n return new LineTokens(new Uint32Array(result), aTokens.getLineContent());\r\n }\r\n static _findFirstPieceWithLine(pieces, lineNumber) {\r\n let low = 0;\r\n let high = pieces.length - 1;\r\n while (low < high) {\r\n let mid = low + Math.floor((high - low) / 2);\r\n if (pieces[mid].endLineNumber < lineNumber) {\r\n low = mid + 1;\r\n }\r\n else if (pieces[mid].startLineNumber > lineNumber) {\r\n high = mid - 1;\r\n }\r\n else {\r\n while (mid > low && pieces[mid - 1].startLineNumber <= lineNumber && lineNumber <= pieces[mid - 1].endLineNumber) {\r\n mid--;\r\n }\r\n return mid;\r\n }\r\n }\r\n return low;\r\n }\r\n //#region Editing\r\n acceptEdit(range, eolCount, firstLineLength, lastLineLength, firstCharCode) {\r\n for (const piece of this._pieces) {\r\n piece.acceptEdit(range, eolCount, firstLineLength, lastLineLength, firstCharCode);\r\n }\r\n }\r\n}\r\nexport class TokensStore {\r\n constructor() {\r\n this._lineTokens = [];\r\n this._len = 0;\r\n }\r\n flush() {\r\n this._lineTokens = [];\r\n this._len = 0;\r\n }\r\n getTokens(topLevelLanguageId, lineIndex, lineText) {\r\n let rawLineTokens = null;\r\n if (lineIndex < this._len) {\r\n rawLineTokens = this._lineTokens[lineIndex];\r\n }\r\n if (rawLineTokens !== null && rawLineTokens !== EMPTY_LINE_TOKENS) {\r\n return new LineTokens(toUint32Array(rawLineTokens), lineText);\r\n }\r\n let lineTokens = new Uint32Array(2);\r\n lineTokens[0] = lineText.length;\r\n lineTokens[1] = getDefaultMetadata(topLevelLanguageId);\r\n return new LineTokens(lineTokens, lineText);\r\n }\r\n static _massageTokens(topLevelLanguageId, lineTextLength, _tokens) {\r\n const tokens = _tokens ? toUint32Array(_tokens) : null;\r\n if (lineTextLength === 0) {\r\n let hasDifferentLanguageId = false;\r\n if (tokens && tokens.length > 1) {\r\n hasDifferentLanguageId = (TokenMetadata.getLanguageId(tokens[1]) !== topLevelLanguageId);\r\n }\r\n if (!hasDifferentLanguageId) {\r\n return EMPTY_LINE_TOKENS;\r\n }\r\n }\r\n if (!tokens || tokens.length === 0) {\r\n const tokens = new Uint32Array(2);\r\n tokens[0] = lineTextLength;\r\n tokens[1] = getDefaultMetadata(topLevelLanguageId);\r\n return tokens.buffer;\r\n }\r\n // Ensure the last token covers the end of the text\r\n tokens[tokens.length - 2] = lineTextLength;\r\n if (tokens.byteOffset === 0 && tokens.byteLength === tokens.buffer.byteLength) {\r\n // Store directly the ArrayBuffer pointer to save an object\r\n return tokens.buffer;\r\n }\r\n return tokens;\r\n }\r\n _ensureLine(lineIndex) {\r\n while (lineIndex >= this._len) {\r\n this._lineTokens[this._len] = null;\r\n this._len++;\r\n }\r\n }\r\n _deleteLines(start, deleteCount) {\r\n if (deleteCount === 0) {\r\n return;\r\n }\r\n if (start + deleteCount > this._len) {\r\n deleteCount = this._len - start;\r\n }\r\n this._lineTokens.splice(start, deleteCount);\r\n this._len -= deleteCount;\r\n }\r\n _insertLines(insertIndex, insertCount) {\r\n if (insertCount === 0) {\r\n return;\r\n }\r\n let lineTokens = [];\r\n for (let i = 0; i < insertCount; i++) {\r\n lineTokens[i] = null;\r\n }\r\n this._lineTokens = arrays.arrayInsert(this._lineTokens, insertIndex, lineTokens);\r\n this._len += insertCount;\r\n }\r\n setTokens(topLevelLanguageId, lineIndex, lineTextLength, _tokens, checkEquality) {\r\n const tokens = TokensStore._massageTokens(topLevelLanguageId, lineTextLength, _tokens);\r\n this._ensureLine(lineIndex);\r\n const oldTokens = this._lineTokens[lineIndex];\r\n this._lineTokens[lineIndex] = tokens;\r\n if (checkEquality) {\r\n return !TokensStore._equals(oldTokens, tokens);\r\n }\r\n return false;\r\n }\r\n static _equals(_a, _b) {\r\n if (!_a || !_b) {\r\n return !_a && !_b;\r\n }\r\n const a = toUint32Array(_a);\r\n const b = toUint32Array(_b);\r\n if (a.length !== b.length) {\r\n return false;\r\n }\r\n for (let i = 0, len = a.length; i < len; i++) {\r\n if (a[i] !== b[i]) {\r\n return false;\r\n }\r\n }\r\n return true;\r\n }\r\n //#region Editing\r\n acceptEdit(range, eolCount, firstLineLength) {\r\n this._acceptDeleteRange(range);\r\n this._acceptInsertText(new Position(range.startLineNumber, range.startColumn), eolCount, firstLineLength);\r\n }\r\n _acceptDeleteRange(range) {\r\n const firstLineIndex = range.startLineNumber - 1;\r\n if (firstLineIndex >= this._len) {\r\n return;\r\n }\r\n if (range.startLineNumber === range.endLineNumber) {\r\n if (range.startColumn === range.endColumn) {\r\n // Nothing to delete\r\n return;\r\n }\r\n this._lineTokens[firstLineIndex] = TokensStore._delete(this._lineTokens[firstLineIndex], range.startColumn - 1, range.endColumn - 1);\r\n return;\r\n }\r\n this._lineTokens[firstLineIndex] = TokensStore._deleteEnding(this._lineTokens[firstLineIndex], range.startColumn - 1);\r\n const lastLineIndex = range.endLineNumber - 1;\r\n let lastLineTokens = null;\r\n if (lastLineIndex < this._len) {\r\n lastLineTokens = TokensStore._deleteBeginning(this._lineTokens[lastLineIndex], range.endColumn - 1);\r\n }\r\n // Take remaining text on last line and append it to remaining text on first line\r\n this._lineTokens[firstLineIndex] = TokensStore._append(this._lineTokens[firstLineIndex], lastLineTokens);\r\n // Delete middle lines\r\n this._deleteLines(range.startLineNumber, range.endLineNumber - range.startLineNumber);\r\n }\r\n _acceptInsertText(position, eolCount, firstLineLength) {\r\n if (eolCount === 0 && firstLineLength === 0) {\r\n // Nothing to insert\r\n return;\r\n }\r\n const lineIndex = position.lineNumber - 1;\r\n if (lineIndex >= this._len) {\r\n return;\r\n }\r\n if (eolCount === 0) {\r\n // Inserting text on one line\r\n this._lineTokens[lineIndex] = TokensStore._insert(this._lineTokens[lineIndex], position.column - 1, firstLineLength);\r\n return;\r\n }\r\n this._lineTokens[lineIndex] = TokensStore._deleteEnding(this._lineTokens[lineIndex], position.column - 1);\r\n this._lineTokens[lineIndex] = TokensStore._insert(this._lineTokens[lineIndex], position.column - 1, firstLineLength);\r\n this._insertLines(position.lineNumber, eolCount);\r\n }\r\n static _deleteBeginning(lineTokens, toChIndex) {\r\n if (lineTokens === null || lineTokens === EMPTY_LINE_TOKENS) {\r\n return lineTokens;\r\n }\r\n return TokensStore._delete(lineTokens, 0, toChIndex);\r\n }\r\n static _deleteEnding(lineTokens, fromChIndex) {\r\n if (lineTokens === null || lineTokens === EMPTY_LINE_TOKENS) {\r\n return lineTokens;\r\n }\r\n const tokens = toUint32Array(lineTokens);\r\n const lineTextLength = tokens[tokens.length - 2];\r\n return TokensStore._delete(lineTokens, fromChIndex, lineTextLength);\r\n }\r\n static _delete(lineTokens, fromChIndex, toChIndex) {\r\n if (lineTokens === null || lineTokens === EMPTY_LINE_TOKENS || fromChIndex === toChIndex) {\r\n return lineTokens;\r\n }\r\n const tokens = toUint32Array(lineTokens);\r\n const tokensCount = (tokens.length >>> 1);\r\n // special case: deleting everything\r\n if (fromChIndex === 0 && tokens[tokens.length - 2] === toChIndex) {\r\n return EMPTY_LINE_TOKENS;\r\n }\r\n const fromTokenIndex = LineTokens.findIndexInTokensArray(tokens, fromChIndex);\r\n const fromTokenStartOffset = (fromTokenIndex > 0 ? tokens[(fromTokenIndex - 1) << 1] : 0);\r\n const fromTokenEndOffset = tokens[fromTokenIndex << 1];\r\n if (toChIndex < fromTokenEndOffset) {\r\n // the delete range is inside a single token\r\n const delta = (toChIndex - fromChIndex);\r\n for (let i = fromTokenIndex; i < tokensCount; i++) {\r\n tokens[i << 1] -= delta;\r\n }\r\n return lineTokens;\r\n }\r\n let dest;\r\n let lastEnd;\r\n if (fromTokenStartOffset !== fromChIndex) {\r\n tokens[fromTokenIndex << 1] = fromChIndex;\r\n dest = ((fromTokenIndex + 1) << 1);\r\n lastEnd = fromChIndex;\r\n }\r\n else {\r\n dest = (fromTokenIndex << 1);\r\n lastEnd = fromTokenStartOffset;\r\n }\r\n const delta = (toChIndex - fromChIndex);\r\n for (let tokenIndex = fromTokenIndex + 1; tokenIndex < tokensCount; tokenIndex++) {\r\n const tokenEndOffset = tokens[tokenIndex << 1] - delta;\r\n if (tokenEndOffset > lastEnd) {\r\n tokens[dest++] = tokenEndOffset;\r\n tokens[dest++] = tokens[(tokenIndex << 1) + 1];\r\n lastEnd = tokenEndOffset;\r\n }\r\n }\r\n if (dest === tokens.length) {\r\n // nothing to trim\r\n return lineTokens;\r\n }\r\n let tmp = new Uint32Array(dest);\r\n tmp.set(tokens.subarray(0, dest), 0);\r\n return tmp.buffer;\r\n }\r\n static _append(lineTokens, _otherTokens) {\r\n if (_otherTokens === EMPTY_LINE_TOKENS) {\r\n return lineTokens;\r\n }\r\n if (lineTokens === EMPTY_LINE_TOKENS) {\r\n return _otherTokens;\r\n }\r\n if (lineTokens === null) {\r\n return lineTokens;\r\n }\r\n if (_otherTokens === null) {\r\n // cannot determine combined line length...\r\n return null;\r\n }\r\n const myTokens = toUint32Array(lineTokens);\r\n const otherTokens = toUint32Array(_otherTokens);\r\n const otherTokensCount = (otherTokens.length >>> 1);\r\n let result = new Uint32Array(myTokens.length + otherTokens.length);\r\n result.set(myTokens, 0);\r\n let dest = myTokens.length;\r\n const delta = myTokens[myTokens.length - 2];\r\n for (let i = 0; i < otherTokensCount; i++) {\r\n result[dest++] = otherTokens[(i << 1)] + delta;\r\n result[dest++] = otherTokens[(i << 1) + 1];\r\n }\r\n return result.buffer;\r\n }\r\n static _insert(lineTokens, chIndex, textLength) {\r\n if (lineTokens === null || lineTokens === EMPTY_LINE_TOKENS) {\r\n // nothing to do\r\n return lineTokens;\r\n }\r\n const tokens = toUint32Array(lineTokens);\r\n const tokensCount = (tokens.length >>> 1);\r\n let fromTokenIndex = LineTokens.findIndexInTokensArray(tokens, chIndex);\r\n if (fromTokenIndex > 0) {\r\n const fromTokenStartOffset = tokens[(fromTokenIndex - 1) << 1];\r\n if (fromTokenStartOffset === chIndex) {\r\n fromTokenIndex--;\r\n }\r\n }\r\n for (let tokenIndex = fromTokenIndex; tokenIndex < tokensCount; tokenIndex++) {\r\n tokens[tokenIndex << 1] += textLength;\r\n }\r\n return lineTokens;\r\n }\r\n}\r\n", "/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License. See License.txt in the project root for license information.\r\n *--------------------------------------------------------------------------------------------*/\r\nimport { Emitter } from '../../../../base/common/event.js';\r\nimport * as strings from '../../../../base/common/strings.js';\r\nimport { Range } from '../../core/range.js';\r\nimport { ApplyEditsResult } from '../../model.js';\r\nimport { PieceTreeBase } from './pieceTreeBase.js';\r\nimport { countEOL } from '../tokensStore.js';\r\nimport { TextChange } from '../textChange.js';\r\nimport { Disposable } from '../../../../base/common/lifecycle.js';\r\nexport class PieceTreeTextBuffer extends Disposable {\r\n constructor(chunks, BOM, eol, containsRTL, containsUnusualLineTerminators, isBasicASCII, eolNormalized) {\r\n super();\r\n this._onDidChangeContent = this._register(new Emitter());\r\n this._BOM = BOM;\r\n this._mightContainNonBasicASCII = !isBasicASCII;\r\n this._mightContainRTL = containsRTL;\r\n this._mightContainUnusualLineTerminators = containsUnusualLineTerminators;\r\n this._pieceTree = new PieceTreeBase(chunks, eol, eolNormalized);\r\n }\r\n mightContainRTL() {\r\n return this._mightContainRTL;\r\n }\r\n mightContainUnusualLineTerminators() {\r\n return this._mightContainUnusualLineTerminators;\r\n }\r\n resetMightContainUnusualLineTerminators() {\r\n this._mightContainUnusualLineTerminators = false;\r\n }\r\n mightContainNonBasicASCII() {\r\n return this._mightContainNonBasicASCII;\r\n }\r\n getBOM() {\r\n return this._BOM;\r\n }\r\n getEOL() {\r\n return this._pieceTree.getEOL();\r\n }\r\n createSnapshot(preserveBOM) {\r\n return this._pieceTree.createSnapshot(preserveBOM ? this._BOM : '');\r\n }\r\n getOffsetAt(lineNumber, column) {\r\n return this._pieceTree.getOffsetAt(lineNumber, column);\r\n }\r\n getPositionAt(offset) {\r\n return this._pieceTree.getPositionAt(offset);\r\n }\r\n getRangeAt(start, length) {\r\n let end = start + length;\r\n const startPosition = this.getPositionAt(start);\r\n const endPosition = this.getPositionAt(end);\r\n return new Range(startPosition.lineNumber, startPosition.column, endPosition.lineNumber, endPosition.column);\r\n }\r\n getValueInRange(range, eol = 0 /* TextDefined */) {\r\n if (range.isEmpty()) {\r\n return '';\r\n }\r\n const lineEnding = this._getEndOfLine(eol);\r\n return this._pieceTree.getValueInRange(range, lineEnding);\r\n }\r\n getValueLengthInRange(range, eol = 0 /* TextDefined */) {\r\n if (range.isEmpty()) {\r\n return 0;\r\n }\r\n if (range.startLineNumber === range.endLineNumber) {\r\n return (range.endColumn - range.startColumn);\r\n }\r\n let startOffset = this.getOffsetAt(range.startLineNumber, range.startColumn);\r\n let endOffset = this.getOffsetAt(range.endLineNumber, range.endColumn);\r\n return endOffset - startOffset;\r\n }\r\n getCharacterCountInRange(range, eol = 0 /* TextDefined */) {\r\n if (this._mightContainNonBasicASCII) {\r\n // we must count by iterating\r\n let result = 0;\r\n const fromLineNumber = range.startLineNumber;\r\n const toLineNumber = range.endLineNumber;\r\n for (let lineNumber = fromLineNumber; lineNumber <= toLineNumber; lineNumber++) {\r\n const lineContent = this.getLineContent(lineNumber);\r\n const fromOffset = (lineNumber === fromLineNumber ? range.startColumn - 1 : 0);\r\n const toOffset = (lineNumber === toLineNumber ? range.endColumn - 1 : lineContent.length);\r\n for (let offset = fromOffset; offset < toOffset; offset++) {\r\n if (strings.isHighSurrogate(lineContent.charCodeAt(offset))) {\r\n result = result + 1;\r\n offset = offset + 1;\r\n }\r\n else {\r\n result = result + 1;\r\n }\r\n }\r\n }\r\n result += this._getEndOfLine(eol).length * (toLineNumber - fromLineNumber);\r\n return result;\r\n }\r\n return this.getValueLengthInRange(range, eol);\r\n }\r\n getLength() {\r\n return this._pieceTree.getLength();\r\n }\r\n getLineCount() {\r\n return this._pieceTree.getLineCount();\r\n }\r\n getLinesContent() {\r\n return this._pieceTree.getLinesContent();\r\n }\r\n getLineContent(lineNumber) {\r\n return this._pieceTree.getLineContent(lineNumber);\r\n }\r\n getLineCharCode(lineNumber, index) {\r\n return this._pieceTree.getLineCharCode(lineNumber, index);\r\n }\r\n getLineLength(lineNumber) {\r\n return this._pieceTree.getLineLength(lineNumber);\r\n }\r\n getLineFirstNonWhitespaceColumn(lineNumber) {\r\n const result = strings.firstNonWhitespaceIndex(this.getLineContent(lineNumber));\r\n if (result === -1) {\r\n return 0;\r\n }\r\n return result + 1;\r\n }\r\n getLineLastNonWhitespaceColumn(lineNumber) {\r\n const result = strings.lastNonWhitespaceIndex(this.getLineContent(lineNumber));\r\n if (result === -1) {\r\n return 0;\r\n }\r\n return result + 2;\r\n }\r\n _getEndOfLine(eol) {\r\n switch (eol) {\r\n case 1 /* LF */:\r\n return '\\n';\r\n case 2 /* CRLF */:\r\n return '\\r\\n';\r\n case 0 /* TextDefined */:\r\n return this.getEOL();\r\n default:\r\n throw new Error('Unknown EOL preference');\r\n }\r\n }\r\n setEOL(newEOL) {\r\n this._pieceTree.setEOL(newEOL);\r\n }\r\n applyEdits(rawOperations, recordTrimAutoWhitespace, computeUndoEdits) {\r\n let mightContainRTL = this._mightContainRTL;\r\n let mightContainUnusualLineTerminators = this._mightContainUnusualLineTerminators;\r\n let mightContainNonBasicASCII = this._mightContainNonBasicASCII;\r\n let canReduceOperations = true;\r\n let operations = [];\r\n for (let i = 0; i < rawOperations.length; i++) {\r\n let op = rawOperations[i];\r\n if (canReduceOperations && op._isTracked) {\r\n canReduceOperations = false;\r\n }\r\n let validatedRange = op.range;\r\n if (op.text) {\r\n let textMightContainNonBasicASCII = true;\r\n if (!mightContainNonBasicASCII) {\r\n textMightContainNonBasicASCII = !strings.isBasicASCII(op.text);\r\n mightContainNonBasicASCII = textMightContainNonBasicASCII;\r\n }\r\n if (!mightContainRTL && textMightContainNonBasicASCII) {\r\n // check if the new inserted text contains RTL\r\n mightContainRTL = strings.containsRTL(op.text);\r\n }\r\n if (!mightContainUnusualLineTerminators && textMightContainNonBasicASCII) {\r\n // check if the new inserted text contains unusual line terminators\r\n mightContainUnusualLineTerminators = strings.containsUnusualLineTerminators(op.text);\r\n }\r\n }\r\n let validText = '';\r\n let eolCount = 0;\r\n let firstLineLength = 0;\r\n let lastLineLength = 0;\r\n if (op.text) {\r\n let strEOL;\r\n [eolCount, firstLineLength, lastLineLength, strEOL] = countEOL(op.text);\r\n const bufferEOL = this.getEOL();\r\n const expectedStrEOL = (bufferEOL === '\\r\\n' ? 2 /* CRLF */ : 1 /* LF */);\r\n if (strEOL === 0 /* Unknown */ || strEOL === expectedStrEOL) {\r\n validText = op.text;\r\n }\r\n else {\r\n validText = op.text.replace(/\\r\\n|\\r|\\n/g, bufferEOL);\r\n }\r\n }\r\n operations[i] = {\r\n sortIndex: i,\r\n identifier: op.identifier || null,\r\n range: validatedRange,\r\n rangeOffset: this.getOffsetAt(validatedRange.startLineNumber, validatedRange.startColumn),\r\n rangeLength: this.getValueLengthInRange(validatedRange),\r\n text: validText,\r\n eolCount: eolCount,\r\n firstLineLength: firstLineLength,\r\n lastLineLength: lastLineLength,\r\n forceMoveMarkers: Boolean(op.forceMoveMarkers),\r\n isAutoWhitespaceEdit: op.isAutoWhitespaceEdit || false\r\n };\r\n }\r\n // Sort operations ascending\r\n operations.sort(PieceTreeTextBuffer._sortOpsAscending);\r\n let hasTouchingRanges = false;\r\n for (let i = 0, count = operations.length - 1; i < count; i++) {\r\n let rangeEnd = operations[i].range.getEndPosition();\r\n let nextRangeStart = operations[i + 1].range.getStartPosition();\r\n if (nextRangeStart.isBeforeOrEqual(rangeEnd)) {\r\n if (nextRangeStart.isBefore(rangeEnd)) {\r\n // overlapping ranges\r\n throw new Error('Overlapping ranges are not allowed!');\r\n }\r\n hasTouchingRanges = true;\r\n }\r\n }\r\n if (canReduceOperations) {\r\n operations = this._reduceOperations(operations);\r\n }\r\n // Delta encode operations\r\n let reverseRanges = (computeUndoEdits || recordTrimAutoWhitespace ? PieceTreeTextBuffer._getInverseEditRanges(operations) : []);\r\n let newTrimAutoWhitespaceCandidates = [];\r\n if (recordTrimAutoWhitespace) {\r\n for (let i = 0; i < operations.length; i++) {\r\n let op = operations[i];\r\n let reverseRange = reverseRanges[i];\r\n if (op.isAutoWhitespaceEdit && op.range.isEmpty()) {\r\n // Record already the future line numbers that might be auto whitespace removal candidates on next edit\r\n for (let lineNumber = reverseRange.startLineNumber; lineNumber <= reverseRange.endLineNumber; lineNumber++) {\r\n let currentLineContent = '';\r\n if (lineNumber === reverseRange.startLineNumber) {\r\n currentLineContent = this.getLineContent(op.range.startLineNumber);\r\n if (strings.firstNonWhitespaceIndex(currentLineContent) !== -1) {\r\n continue;\r\n }\r\n }\r\n newTrimAutoWhitespaceCandidates.push({ lineNumber: lineNumber, oldContent: currentLineContent });\r\n }\r\n }\r\n }\r\n }\r\n let reverseOperations = null;\r\n if (computeUndoEdits) {\r\n let reverseRangeDeltaOffset = 0;\r\n reverseOperations = [];\r\n for (let i = 0; i < operations.length; i++) {\r\n const op = operations[i];\r\n const reverseRange = reverseRanges[i];\r\n const bufferText = this.getValueInRange(op.range);\r\n const reverseRangeOffset = op.rangeOffset + reverseRangeDeltaOffset;\r\n reverseRangeDeltaOffset += (op.text.length - bufferText.length);\r\n reverseOperations[i] = {\r\n sortIndex: op.sortIndex,\r\n identifier: op.identifier,\r\n range: reverseRange,\r\n text: bufferText,\r\n textChange: new TextChange(op.rangeOffset, bufferText, reverseRangeOffset, op.text)\r\n };\r\n }\r\n // Can only sort reverse operations when the order is not significant\r\n if (!hasTouchingRanges) {\r\n reverseOperations.sort((a, b) => a.sortIndex - b.sortIndex);\r\n }\r\n }\r\n this._mightContainRTL = mightContainRTL;\r\n this._mightContainUnusualLineTerminators = mightContainUnusualLineTerminators;\r\n this._mightContainNonBasicASCII = mightContainNonBasicASCII;\r\n const contentChanges = this._doApplyEdits(operations);\r\n let trimAutoWhitespaceLineNumbers = null;\r\n if (recordTrimAutoWhitespace && newTrimAutoWhitespaceCandidates.length > 0) {\r\n // sort line numbers auto whitespace removal candidates for next edit descending\r\n newTrimAutoWhitespaceCandidates.sort((a, b) => b.lineNumber - a.lineNumber);\r\n trimAutoWhitespaceLineNumbers = [];\r\n for (let i = 0, len = newTrimAutoWhitespaceCandidates.length; i < len; i++) {\r\n let lineNumber = newTrimAutoWhitespaceCandidates[i].lineNumber;\r\n if (i > 0 && newTrimAutoWhitespaceCandidates[i - 1].lineNumber === lineNumber) {\r\n // Do not have the same line number twice\r\n continue;\r\n }\r\n let prevContent = newTrimAutoWhitespaceCandidates[i].oldContent;\r\n let lineContent = this.getLineContent(lineNumber);\r\n if (lineContent.length === 0 || lineContent === prevContent || strings.firstNonWhitespaceIndex(lineContent) !== -1) {\r\n continue;\r\n }\r\n trimAutoWhitespaceLineNumbers.push(lineNumber);\r\n }\r\n }\r\n this._onDidChangeContent.fire();\r\n return new ApplyEditsResult(reverseOperations, contentChanges, trimAutoWhitespaceLineNumbers);\r\n }\r\n /**\r\n * Transform operations such that they represent the same logic edit,\r\n * but that they also do not cause OOM crashes.\r\n */\r\n _reduceOperations(operations) {\r\n if (operations.length < 1000) {\r\n // We know from empirical testing that a thousand edits work fine regardless of their shape.\r\n return operations;\r\n }\r\n // At one point, due to how events are emitted and how each operation is handled,\r\n // some operations can trigger a high amount of temporary string allocations,\r\n // that will immediately get edited again.\r\n // e.g. a formatter inserting ridiculous ammounts of \\n on a model with a single line\r\n // Therefore, the strategy is to collapse all the operations into a huge single edit operation\r\n return [this._toSingleEditOperation(operations)];\r\n }\r\n _toSingleEditOperation(operations) {\r\n let forceMoveMarkers = false;\r\n const firstEditRange = operations[0].range;\r\n const lastEditRange = operations[operations.length - 1].range;\r\n const entireEditRange = new Range(firstEditRange.startLineNumber, firstEditRange.startColumn, lastEditRange.endLineNumber, lastEditRange.endColumn);\r\n let lastEndLineNumber = firstEditRange.startLineNumber;\r\n let lastEndColumn = firstEditRange.startColumn;\r\n const result = [];\r\n for (let i = 0, len = operations.length; i < len; i++) {\r\n const operation = operations[i];\r\n const range = operation.range;\r\n forceMoveMarkers = forceMoveMarkers || operation.forceMoveMarkers;\r\n // (1) -- Push old text\r\n result.push(this.getValueInRange(new Range(lastEndLineNumber, lastEndColumn, range.startLineNumber, range.startColumn)));\r\n // (2) -- Push new text\r\n if (operation.text.length > 0) {\r\n result.push(operation.text);\r\n }\r\n lastEndLineNumber = range.endLineNumber;\r\n lastEndColumn = range.endColumn;\r\n }\r\n const text = result.join('');\r\n const [eolCount, firstLineLength, lastLineLength] = countEOL(text);\r\n return {\r\n sortIndex: 0,\r\n identifier: operations[0].identifier,\r\n range: entireEditRange,\r\n rangeOffset: this.getOffsetAt(entireEditRange.startLineNumber, entireEditRange.startColumn),\r\n rangeLength: this.getValueLengthInRange(entireEditRange, 0 /* TextDefined */),\r\n text: text,\r\n eolCount: eolCount,\r\n firstLineLength: firstLineLength,\r\n lastLineLength: lastLineLength,\r\n forceMoveMarkers: forceMoveMarkers,\r\n isAutoWhitespaceEdit: false\r\n };\r\n }\r\n _doApplyEdits(operations) {\r\n operations.sort(PieceTreeTextBuffer._sortOpsDescending);\r\n let contentChanges = [];\r\n // operations are from bottom to top\r\n for (let i = 0; i < operations.length; i++) {\r\n let op = operations[i];\r\n const startLineNumber = op.range.startLineNumber;\r\n const startColumn = op.range.startColumn;\r\n const endLineNumber = op.range.endLineNumber;\r\n const endColumn = op.range.endColumn;\r\n if (startLineNumber === endLineNumber && startColumn === endColumn && op.text.length === 0) {\r\n // no-op\r\n continue;\r\n }\r\n if (op.text) {\r\n // replacement\r\n this._pieceTree.delete(op.rangeOffset, op.rangeLength);\r\n this._pieceTree.insert(op.rangeOffset, op.text, true);\r\n }\r\n else {\r\n // deletion\r\n this._pieceTree.delete(op.rangeOffset, op.rangeLength);\r\n }\r\n const contentChangeRange = new Range(startLineNumber, startColumn, endLineNumber, endColumn);\r\n contentChanges.push({\r\n range: contentChangeRange,\r\n rangeLength: op.rangeLength,\r\n text: op.text,\r\n rangeOffset: op.rangeOffset,\r\n forceMoveMarkers: op.forceMoveMarkers\r\n });\r\n }\r\n return contentChanges;\r\n }\r\n findMatchesLineByLine(searchRange, searchData, captureMatches, limitResultCount) {\r\n return this._pieceTree.findMatchesLineByLine(searchRange, searchData, captureMatches, limitResultCount);\r\n }\r\n /**\r\n * Assumes `operations` are validated and sorted ascending\r\n */\r\n static _getInverseEditRanges(operations) {\r\n let result = [];\r\n let prevOpEndLineNumber = 0;\r\n let prevOpEndColumn = 0;\r\n let prevOp = null;\r\n for (let i = 0, len = operations.length; i < len; i++) {\r\n let op = operations[i];\r\n let startLineNumber;\r\n let startColumn;\r\n if (prevOp) {\r\n if (prevOp.range.endLineNumber === op.range.startLineNumber) {\r\n startLineNumber = prevOpEndLineNumber;\r\n startColumn = prevOpEndColumn + (op.range.startColumn - prevOp.range.endColumn);\r\n }\r\n else {\r\n startLineNumber = prevOpEndLineNumber + (op.range.startLineNumber - prevOp.range.endLineNumber);\r\n startColumn = op.range.startColumn;\r\n }\r\n }\r\n else {\r\n startLineNumber = op.range.startLineNumber;\r\n startColumn = op.range.startColumn;\r\n }\r\n let resultRange;\r\n if (op.text.length > 0) {\r\n // the operation inserts something\r\n const lineCount = op.eolCount + 1;\r\n if (lineCount === 1) {\r\n // single line insert\r\n resultRange = new Range(startLineNumber, startColumn, startLineNumber, startColumn + op.firstLineLength);\r\n }\r\n else {\r\n // multi line insert\r\n resultRange = new Range(startLineNumber, startColumn, startLineNumber + lineCount - 1, op.lastLineLength + 1);\r\n }\r\n }\r\n else {\r\n // There is nothing to insert\r\n resultRange = new Range(startLineNumber, startColumn, startLineNumber, startColumn);\r\n }\r\n prevOpEndLineNumber = resultRange.endLineNumber;\r\n prevOpEndColumn = resultRange.endColumn;\r\n result.push(resultRange);\r\n prevOp = op;\r\n }\r\n return result;\r\n }\r\n static _sortOpsAscending(a, b) {\r\n let r = Range.compareRangesUsingEnds(a.range, b.range);\r\n if (r === 0) {\r\n return a.sortIndex - b.sortIndex;\r\n }\r\n return r;\r\n }\r\n static _sortOpsDescending(a, b) {\r\n let r = Range.compareRangesUsingEnds(a.range, b.range);\r\n if (r === 0) {\r\n return b.sortIndex - a.sortIndex;\r\n }\r\n return -r;\r\n }\r\n}\r\n", "/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License. See License.txt in the project root for license information.\r\n *--------------------------------------------------------------------------------------------*/\r\nimport * as strings from '../../../../base/common/strings.js';\r\nimport { StringBuffer, createLineStarts, createLineStartsFast } from './pieceTreeBase.js';\r\nimport { PieceTreeTextBuffer } from './pieceTreeTextBuffer.js';\r\nexport class PieceTreeTextBufferFactory {\r\n constructor(_chunks, _bom, _cr, _lf, _crlf, _containsRTL, _containsUnusualLineTerminators, _isBasicASCII, _normalizeEOL) {\r\n this._chunks = _chunks;\r\n this._bom = _bom;\r\n this._cr = _cr;\r\n this._lf = _lf;\r\n this._crlf = _crlf;\r\n this._containsRTL = _containsRTL;\r\n this._containsUnusualLineTerminators = _containsUnusualLineTerminators;\r\n this._isBasicASCII = _isBasicASCII;\r\n this._normalizeEOL = _normalizeEOL;\r\n }\r\n _getEOL(defaultEOL) {\r\n const totalEOLCount = this._cr + this._lf + this._crlf;\r\n const totalCRCount = this._cr + this._crlf;\r\n if (totalEOLCount === 0) {\r\n // This is an empty file or a file with precisely one line\r\n return (defaultEOL === 1 /* LF */ ? '\\n' : '\\r\\n');\r\n }\r\n if (totalCRCount > totalEOLCount / 2) {\r\n // More than half of the file contains \\r\\n ending lines\r\n return '\\r\\n';\r\n }\r\n // At least one line more ends in \\n\r\n return '\\n';\r\n }\r\n create(defaultEOL) {\r\n const eol = this._getEOL(defaultEOL);\r\n let chunks = this._chunks;\r\n if (this._normalizeEOL &&\r\n ((eol === '\\r\\n' && (this._cr > 0 || this._lf > 0))\r\n || (eol === '\\n' && (this._cr > 0 || this._crlf > 0)))) {\r\n // Normalize pieces\r\n for (let i = 0, len = chunks.length; i < len; i++) {\r\n let str = chunks[i].buffer.replace(/\\r\\n|\\r|\\n/g, eol);\r\n let newLineStart = createLineStartsFast(str);\r\n chunks[i] = new StringBuffer(str, newLineStart);\r\n }\r\n }\r\n const textBuffer = new PieceTreeTextBuffer(chunks, this._bom, eol, this._containsRTL, this._containsUnusualLineTerminators, this._isBasicASCII, this._normalizeEOL);\r\n return { textBuffer: textBuffer, disposable: textBuffer };\r\n }\r\n}\r\nexport class PieceTreeTextBufferBuilder {\r\n constructor() {\r\n this.chunks = [];\r\n this.BOM = '';\r\n this._hasPreviousChar = false;\r\n this._previousChar = 0;\r\n this._tmpLineStarts = [];\r\n this.cr = 0;\r\n this.lf = 0;\r\n this.crlf = 0;\r\n this.containsRTL = false;\r\n this.containsUnusualLineTerminators = false;\r\n this.isBasicASCII = true;\r\n }\r\n acceptChunk(chunk) {\r\n if (chunk.length === 0) {\r\n return;\r\n }\r\n if (this.chunks.length === 0) {\r\n if (strings.startsWithUTF8BOM(chunk)) {\r\n this.BOM = strings.UTF8_BOM_CHARACTER;\r\n chunk = chunk.substr(1);\r\n }\r\n }\r\n const lastChar = chunk.charCodeAt(chunk.length - 1);\r\n if (lastChar === 13 /* CarriageReturn */ || (lastChar >= 0xD800 && lastChar <= 0xDBFF)) {\r\n // last character is \\r or a high surrogate => keep it back\r\n this._acceptChunk1(chunk.substr(0, chunk.length - 1), false);\r\n this._hasPreviousChar = true;\r\n this._previousChar = lastChar;\r\n }\r\n else {\r\n this._acceptChunk1(chunk, false);\r\n this._hasPreviousChar = false;\r\n this._previousChar = lastChar;\r\n }\r\n }\r\n _acceptChunk1(chunk, allowEmptyStrings) {\r\n if (!allowEmptyStrings && chunk.length === 0) {\r\n // Nothing to do\r\n return;\r\n }\r\n if (this._hasPreviousChar) {\r\n this._acceptChunk2(String.fromCharCode(this._previousChar) + chunk);\r\n }\r\n else {\r\n this._acceptChunk2(chunk);\r\n }\r\n }\r\n _acceptChunk2(chunk) {\r\n const lineStarts = createLineStarts(this._tmpLineStarts, chunk);\r\n this.chunks.push(new StringBuffer(chunk, lineStarts.lineStarts));\r\n this.cr += lineStarts.cr;\r\n this.lf += lineStarts.lf;\r\n this.crlf += lineStarts.crlf;\r\n if (this.isBasicASCII) {\r\n this.isBasicASCII = lineStarts.isBasicASCII;\r\n }\r\n if (!this.isBasicASCII && !this.containsRTL) {\r\n // No need to check if it is basic ASCII\r\n this.containsRTL = strings.containsRTL(chunk);\r\n }\r\n if (!this.isBasicASCII && !this.containsUnusualLineTerminators) {\r\n // No need to check if it is basic ASCII\r\n this.containsUnusualLineTerminators = strings.containsUnusualLineTerminators(chunk);\r\n }\r\n }\r\n finish(normalizeEOL = true) {\r\n this._finish();\r\n return new PieceTreeTextBufferFactory(this.chunks, this.BOM, this.cr, this.lf, this.crlf, this.containsRTL, this.containsUnusualLineTerminators, this.isBasicASCII, normalizeEOL);\r\n }\r\n _finish() {\r\n if (this.chunks.length === 0) {\r\n this._acceptChunk1('', true);\r\n }\r\n if (this._hasPreviousChar) {\r\n this._hasPreviousChar = false;\r\n // recreate last chunk\r\n let lastChunk = this.chunks[this.chunks.length - 1];\r\n lastChunk.buffer += String.fromCharCode(this._previousChar);\r\n let newLineStarts = createLineStartsFast(lastChunk.buffer);\r\n lastChunk.lineStarts = newLineStarts;\r\n if (this._previousChar === 13 /* CarriageReturn */) {\r\n this.cr++;\r\n }\r\n }\r\n }\r\n}\r\n", "/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License. See License.txt in the project root for license information.\r\n *--------------------------------------------------------------------------------------------*/\r\n/**\r\n * An event describing that a model has been reset to a new value.\r\n * @internal\r\n */\r\nexport class ModelRawFlush {\r\n constructor() {\r\n this.changeType = 1 /* Flush */;\r\n }\r\n}\r\n/**\r\n * Represents text injected on a line\r\n * @internal\r\n */\r\nexport class LineInjectedText {\r\n constructor(ownerId, lineNumber, column, options, order) {\r\n this.ownerId = ownerId;\r\n this.lineNumber = lineNumber;\r\n this.column = column;\r\n this.options = options;\r\n this.order = order;\r\n }\r\n static applyInjectedText(lineText, injectedTexts) {\r\n if (!injectedTexts || injectedTexts.length === 0) {\r\n return lineText;\r\n }\r\n let result = '';\r\n let lastOriginalOffset = 0;\r\n for (const injectedText of injectedTexts) {\r\n result += lineText.substring(lastOriginalOffset, injectedText.column - 1);\r\n lastOriginalOffset = injectedText.column - 1;\r\n result += injectedText.options.content;\r\n }\r\n result += lineText.substring(lastOriginalOffset);\r\n return result;\r\n }\r\n static fromDecorations(decorations) {\r\n const result = [];\r\n for (const decoration of decorations) {\r\n if (decoration.options.before && decoration.options.before.content.length > 0) {\r\n result.push(new LineInjectedText(decoration.ownerId, decoration.range.startLineNumber, decoration.range.startColumn, decoration.options.before, 0));\r\n }\r\n if (decoration.options.after && decoration.options.after.content.length > 0) {\r\n result.push(new LineInjectedText(decoration.ownerId, decoration.range.endLineNumber, decoration.range.endColumn, decoration.options.after, 1));\r\n }\r\n }\r\n result.sort((a, b) => {\r\n if (a.lineNumber === b.lineNumber) {\r\n if (a.column === b.column) {\r\n return a.order - b.order;\r\n }\r\n return a.column - b.column;\r\n }\r\n return a.lineNumber - b.lineNumber;\r\n });\r\n return result;\r\n }\r\n}\r\n/**\r\n * An event describing that a line has changed in a model.\r\n * @internal\r\n */\r\nexport class ModelRawLineChanged {\r\n constructor(lineNumber, detail, injectedText) {\r\n this.changeType = 2 /* LineChanged */;\r\n this.lineNumber = lineNumber;\r\n this.detail = detail;\r\n this.injectedText = injectedText;\r\n }\r\n}\r\n/**\r\n * An event describing that line(s) have been deleted in a model.\r\n * @internal\r\n */\r\nexport class ModelRawLinesDeleted {\r\n constructor(fromLineNumber, toLineNumber) {\r\n this.changeType = 3 /* LinesDeleted */;\r\n this.fromLineNumber = fromLineNumber;\r\n this.toLineNumber = toLineNumber;\r\n }\r\n}\r\n/**\r\n * An event describing that line(s) have been inserted in a model.\r\n * @internal\r\n */\r\nexport class ModelRawLinesInserted {\r\n constructor(fromLineNumber, toLineNumber, detail, injectedTexts) {\r\n this.changeType = 4 /* LinesInserted */;\r\n this.injectedTexts = injectedTexts;\r\n this.fromLineNumber = fromLineNumber;\r\n this.toLineNumber = toLineNumber;\r\n this.detail = detail;\r\n }\r\n}\r\n/**\r\n * An event describing that a model has had its EOL changed.\r\n * @internal\r\n */\r\nexport class ModelRawEOLChanged {\r\n constructor() {\r\n this.changeType = 5 /* EOLChanged */;\r\n }\r\n}\r\n/**\r\n * An event describing a change in the text of a model.\r\n * @internal\r\n */\r\nexport class ModelRawContentChangedEvent {\r\n constructor(changes, versionId, isUndoing, isRedoing) {\r\n this.changes = changes;\r\n this.versionId = versionId;\r\n this.isUndoing = isUndoing;\r\n this.isRedoing = isRedoing;\r\n this.resultingSelection = null;\r\n }\r\n containsEvent(type) {\r\n for (let i = 0, len = this.changes.length; i < len; i++) {\r\n const change = this.changes[i];\r\n if (change.changeType === type) {\r\n return true;\r\n }\r\n }\r\n return false;\r\n }\r\n static merge(a, b) {\r\n const changes = [].concat(a.changes).concat(b.changes);\r\n const versionId = b.versionId;\r\n const isUndoing = (a.isUndoing || b.isUndoing);\r\n const isRedoing = (a.isRedoing || b.isRedoing);\r\n return new ModelRawContentChangedEvent(changes, versionId, isUndoing, isRedoing);\r\n }\r\n}\r\n/**\r\n * An event describing a change in injected text.\r\n * @internal\r\n */\r\nexport class ModelInjectedTextChangedEvent {\r\n constructor(changes) {\r\n this.changes = changes;\r\n }\r\n}\r\n/**\r\n * @internal\r\n */\r\nexport class InternalModelContentChangeEvent {\r\n constructor(rawContentChangedEvent, contentChangedEvent) {\r\n this.rawContentChangedEvent = rawContentChangedEvent;\r\n this.contentChangedEvent = contentChangedEvent;\r\n }\r\n merge(other) {\r\n const rawContentChangedEvent = ModelRawContentChangedEvent.merge(this.rawContentChangedEvent, other.rawContentChangedEvent);\r\n const contentChangedEvent = InternalModelContentChangeEvent._mergeChangeEvents(this.contentChangedEvent, other.contentChangedEvent);\r\n return new InternalModelContentChangeEvent(rawContentChangedEvent, contentChangedEvent);\r\n }\r\n static _mergeChangeEvents(a, b) {\r\n const changes = [].concat(a.changes).concat(b.changes);\r\n const eol = b.eol;\r\n const versionId = b.versionId;\r\n const isUndoing = (a.isUndoing || b.isUndoing);\r\n const isRedoing = (a.isRedoing || b.isRedoing);\r\n const isFlush = (a.isFlush || b.isFlush);\r\n return {\r\n changes: changes,\r\n eol: eol,\r\n versionId: versionId,\r\n isUndoing: isUndoing,\r\n isRedoing: isRedoing,\r\n isFlush: isFlush\r\n };\r\n }\r\n}\r\n", "/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License. See License.txt in the project root for license information.\r\n *--------------------------------------------------------------------------------------------*/\r\nexport class Token {\r\n constructor(offset, type, language) {\r\n this._tokenBrand = undefined;\r\n this.offset = offset | 0; // @perf\r\n this.type = type;\r\n this.language = language;\r\n }\r\n toString() {\r\n return '(' + this.offset + ', ' + this.type + ')';\r\n }\r\n}\r\nexport class TokenizationResult {\r\n constructor(tokens, endState) {\r\n this._tokenizationResultBrand = undefined;\r\n this.tokens = tokens;\r\n this.endState = endState;\r\n }\r\n}\r\nexport class TokenizationResult2 {\r\n constructor(tokens, endState) {\r\n this._tokenizationResult2Brand = undefined;\r\n this.tokens = tokens;\r\n this.endState = endState;\r\n }\r\n}\r\n", "/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License. See License.txt in the project root for license information.\r\n *--------------------------------------------------------------------------------------------*/\r\nimport { Token, TokenizationResult, TokenizationResult2 } from '../core/token.js';\r\nimport { LanguageIdentifier } from '../modes.js';\r\nclass NullStateImpl {\r\n clone() {\r\n return this;\r\n }\r\n equals(other) {\r\n return (this === other);\r\n }\r\n}\r\nexport const NULL_STATE = new NullStateImpl();\r\nexport const NULL_MODE_ID = 'vs.editor.nullMode';\r\nexport const NULL_LANGUAGE_IDENTIFIER = new LanguageIdentifier(NULL_MODE_ID, 0 /* Null */);\r\nexport function nullTokenize(modeId, buffer, state, deltaOffset) {\r\n return new TokenizationResult([new Token(deltaOffset, '', modeId)], state);\r\n}\r\nexport function nullTokenize2(languageId, buffer, state, deltaOffset) {\r\n let tokens = new Uint32Array(2);\r\n tokens[0] = deltaOffset;\r\n tokens[1] = ((languageId << 0 /* LANGUAGEID_OFFSET */)\r\n | (0 /* Other */ << 8 /* TOKEN_TYPE_OFFSET */)\r\n | (0 /* None */ << 11 /* FONT_STYLE_OFFSET */)\r\n | (1 /* DefaultForeground */ << 14 /* FOREGROUND_OFFSET */)\r\n | (2 /* DefaultBackground */ << 23 /* BACKGROUND_OFFSET */)) >>> 0;\r\n return new TokenizationResult2(tokens, state === null ? NULL_STATE : state);\r\n}\r\n", "/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License. See License.txt in the project root for license information.\r\n *--------------------------------------------------------------------------------------------*/\r\nimport * as arrays from '../../../base/common/arrays.js';\r\nimport { onUnexpectedError } from '../../../base/common/errors.js';\r\nimport { LineTokens } from '../core/lineTokens.js';\r\nimport { Position } from '../core/position.js';\r\nimport { TokenizationRegistry } from '../modes.js';\r\nimport { nullTokenize2 } from '../modes/nullMode.js';\r\nimport { Disposable } from '../../../base/common/lifecycle.js';\r\nimport { StopWatch } from '../../../base/common/stopwatch.js';\r\nimport { MultilineTokensBuilder, countEOL } from './tokensStore.js';\r\nimport * as platform from '../../../base/common/platform.js';\r\nexport class TokenizationStateStore {\r\n constructor() {\r\n this._beginState = [];\r\n this._valid = [];\r\n this._len = 0;\r\n this._invalidLineStartIndex = 0;\r\n }\r\n _reset(initialState) {\r\n this._beginState = [];\r\n this._valid = [];\r\n this._len = 0;\r\n this._invalidLineStartIndex = 0;\r\n if (initialState) {\r\n this._setBeginState(0, initialState);\r\n }\r\n }\r\n flush(initialState) {\r\n this._reset(initialState);\r\n }\r\n get invalidLineStartIndex() {\r\n return this._invalidLineStartIndex;\r\n }\r\n _invalidateLine(lineIndex) {\r\n if (lineIndex < this._len) {\r\n this._valid[lineIndex] = false;\r\n }\r\n if (lineIndex < this._invalidLineStartIndex) {\r\n this._invalidLineStartIndex = lineIndex;\r\n }\r\n }\r\n _isValid(lineIndex) {\r\n if (lineIndex < this._len) {\r\n return this._valid[lineIndex];\r\n }\r\n return false;\r\n }\r\n getBeginState(lineIndex) {\r\n if (lineIndex < this._len) {\r\n return this._beginState[lineIndex];\r\n }\r\n return null;\r\n }\r\n _ensureLine(lineIndex) {\r\n while (lineIndex >= this._len) {\r\n this._beginState[this._len] = null;\r\n this._valid[this._len] = false;\r\n this._len++;\r\n }\r\n }\r\n _deleteLines(start, deleteCount) {\r\n if (deleteCount === 0) {\r\n return;\r\n }\r\n if (start + deleteCount > this._len) {\r\n deleteCount = this._len - start;\r\n }\r\n this._beginState.splice(start, deleteCount);\r\n this._valid.splice(start, deleteCount);\r\n this._len -= deleteCount;\r\n }\r\n _insertLines(insertIndex, insertCount) {\r\n if (insertCount === 0) {\r\n return;\r\n }\r\n let beginState = [];\r\n let valid = [];\r\n for (let i = 0; i < insertCount; i++) {\r\n beginState[i] = null;\r\n valid[i] = false;\r\n }\r\n this._beginState = arrays.arrayInsert(this._beginState, insertIndex, beginState);\r\n this._valid = arrays.arrayInsert(this._valid, insertIndex, valid);\r\n this._len += insertCount;\r\n }\r\n _setValid(lineIndex, valid) {\r\n this._ensureLine(lineIndex);\r\n this._valid[lineIndex] = valid;\r\n }\r\n _setBeginState(lineIndex, beginState) {\r\n this._ensureLine(lineIndex);\r\n this._beginState[lineIndex] = beginState;\r\n }\r\n setEndState(linesLength, lineIndex, endState) {\r\n this._setValid(lineIndex, true);\r\n this._invalidLineStartIndex = lineIndex + 1;\r\n // Check if this was the last line\r\n if (lineIndex === linesLength - 1) {\r\n return;\r\n }\r\n // Check if the end state has changed\r\n const previousEndState = this.getBeginState(lineIndex + 1);\r\n if (previousEndState === null || !endState.equals(previousEndState)) {\r\n this._setBeginState(lineIndex + 1, endState);\r\n this._invalidateLine(lineIndex + 1);\r\n return;\r\n }\r\n // Perhaps we can skip tokenizing some lines...\r\n let i = lineIndex + 1;\r\n while (i < linesLength) {\r\n if (!this._isValid(i)) {\r\n break;\r\n }\r\n i++;\r\n }\r\n this._invalidLineStartIndex = i;\r\n }\r\n setFakeTokens(lineIndex) {\r\n this._setValid(lineIndex, false);\r\n }\r\n //#region Editing\r\n applyEdits(range, eolCount) {\r\n const deletingLinesCnt = range.endLineNumber - range.startLineNumber;\r\n const insertingLinesCnt = eolCount;\r\n const editingLinesCnt = Math.min(deletingLinesCnt, insertingLinesCnt);\r\n for (let j = editingLinesCnt; j >= 0; j--) {\r\n this._invalidateLine(range.startLineNumber + j - 1);\r\n }\r\n this._acceptDeleteRange(range);\r\n this._acceptInsertText(new Position(range.startLineNumber, range.startColumn), eolCount);\r\n }\r\n _acceptDeleteRange(range) {\r\n const firstLineIndex = range.startLineNumber - 1;\r\n if (firstLineIndex >= this._len) {\r\n return;\r\n }\r\n this._deleteLines(range.startLineNumber, range.endLineNumber - range.startLineNumber);\r\n }\r\n _acceptInsertText(position, eolCount) {\r\n const lineIndex = position.lineNumber - 1;\r\n if (lineIndex >= this._len) {\r\n return;\r\n }\r\n this._insertLines(position.lineNumber, eolCount);\r\n }\r\n}\r\nexport class TextModelTokenization extends Disposable {\r\n constructor(textModel) {\r\n super();\r\n this._isDisposed = false;\r\n this._textModel = textModel;\r\n this._tokenizationStateStore = new TokenizationStateStore();\r\n this._tokenizationSupport = null;\r\n this._register(TokenizationRegistry.onDidChange((e) => {\r\n const languageIdentifier = this._textModel.getLanguageIdentifier();\r\n if (e.changedLanguages.indexOf(languageIdentifier.language) === -1) {\r\n return;\r\n }\r\n this._resetTokenizationState();\r\n this._textModel.clearTokens();\r\n }));\r\n this._register(this._textModel.onDidChangeContentFast((e) => {\r\n if (e.isFlush) {\r\n this._resetTokenizationState();\r\n return;\r\n }\r\n for (let i = 0, len = e.changes.length; i < len; i++) {\r\n const change = e.changes[i];\r\n const [eolCount] = countEOL(change.text);\r\n this._tokenizationStateStore.applyEdits(change.range, eolCount);\r\n }\r\n this._beginBackgroundTokenization();\r\n }));\r\n this._register(this._textModel.onDidChangeAttached(() => {\r\n this._beginBackgroundTokenization();\r\n }));\r\n this._register(this._textModel.onDidChangeLanguage(() => {\r\n this._resetTokenizationState();\r\n this._textModel.clearTokens();\r\n }));\r\n this._resetTokenizationState();\r\n }\r\n dispose() {\r\n this._isDisposed = true;\r\n super.dispose();\r\n }\r\n _resetTokenizationState() {\r\n const [tokenizationSupport, initialState] = initializeTokenization(this._textModel);\r\n this._tokenizationSupport = tokenizationSupport;\r\n this._tokenizationStateStore.flush(initialState);\r\n this._beginBackgroundTokenization();\r\n }\r\n _beginBackgroundTokenization() {\r\n if (this._textModel.isAttachedToEditor() && this._hasLinesToTokenize()) {\r\n platform.setImmediate(() => {\r\n if (this._isDisposed) {\r\n // disposed in the meantime\r\n return;\r\n }\r\n this._revalidateTokensNow();\r\n });\r\n }\r\n }\r\n _revalidateTokensNow(toLineNumber = this._textModel.getLineCount()) {\r\n const MAX_ALLOWED_TIME = 1;\r\n const builder = new MultilineTokensBuilder();\r\n const sw = StopWatch.create(false);\r\n while (this._hasLinesToTokenize()) {\r\n if (sw.elapsed() > MAX_ALLOWED_TIME) {\r\n // Stop if MAX_ALLOWED_TIME is reached\r\n break;\r\n }\r\n const tokenizedLineNumber = this._tokenizeOneInvalidLine(builder);\r\n if (tokenizedLineNumber >= toLineNumber) {\r\n break;\r\n }\r\n }\r\n this._beginBackgroundTokenization();\r\n this._textModel.setTokens(builder.tokens);\r\n }\r\n tokenizeViewport(startLineNumber, endLineNumber) {\r\n const builder = new MultilineTokensBuilder();\r\n this._tokenizeViewport(builder, startLineNumber, endLineNumber);\r\n this._textModel.setTokens(builder.tokens);\r\n }\r\n reset() {\r\n this._resetTokenizationState();\r\n this._textModel.clearTokens();\r\n }\r\n forceTokenization(lineNumber) {\r\n const builder = new MultilineTokensBuilder();\r\n this._updateTokensUntilLine(builder, lineNumber);\r\n this._textModel.setTokens(builder.tokens);\r\n }\r\n isCheapToTokenize(lineNumber) {\r\n if (!this._tokenizationSupport) {\r\n return true;\r\n }\r\n const firstInvalidLineNumber = this._tokenizationStateStore.invalidLineStartIndex + 1;\r\n if (lineNumber > firstInvalidLineNumber) {\r\n return false;\r\n }\r\n if (lineNumber < firstInvalidLineNumber) {\r\n return true;\r\n }\r\n if (this._textModel.getLineLength(lineNumber) < 2048 /* CHEAP_TOKENIZATION_LENGTH_LIMIT */) {\r\n return true;\r\n }\r\n return false;\r\n }\r\n _hasLinesToTokenize() {\r\n if (!this._tokenizationSupport) {\r\n return false;\r\n }\r\n return (this._tokenizationStateStore.invalidLineStartIndex < this._textModel.getLineCount());\r\n }\r\n _tokenizeOneInvalidLine(builder) {\r\n if (!this._hasLinesToTokenize()) {\r\n return this._textModel.getLineCount() + 1;\r\n }\r\n const lineNumber = this._tokenizationStateStore.invalidLineStartIndex + 1;\r\n this._updateTokensUntilLine(builder, lineNumber);\r\n return lineNumber;\r\n }\r\n _updateTokensUntilLine(builder, lineNumber) {\r\n if (!this._tokenizationSupport) {\r\n return;\r\n }\r\n const languageIdentifier = this._textModel.getLanguageIdentifier();\r\n const linesLength = this._textModel.getLineCount();\r\n const endLineIndex = lineNumber - 1;\r\n // Validate all states up to and including endLineIndex\r\n for (let lineIndex = this._tokenizationStateStore.invalidLineStartIndex; lineIndex <= endLineIndex; lineIndex++) {\r\n const text = this._textModel.getLineContent(lineIndex + 1);\r\n const lineStartState = this._tokenizationStateStore.getBeginState(lineIndex);\r\n const r = safeTokenize(languageIdentifier, this._tokenizationSupport, text, true, lineStartState);\r\n builder.add(lineIndex + 1, r.tokens);\r\n this._tokenizationStateStore.setEndState(linesLength, lineIndex, r.endState);\r\n lineIndex = this._tokenizationStateStore.invalidLineStartIndex - 1; // -1 because the outer loop increments it\r\n }\r\n }\r\n _tokenizeViewport(builder, startLineNumber, endLineNumber) {\r\n if (!this._tokenizationSupport) {\r\n // nothing to do\r\n return;\r\n }\r\n if (endLineNumber <= this._tokenizationStateStore.invalidLineStartIndex) {\r\n // nothing to do\r\n return;\r\n }\r\n if (startLineNumber <= this._tokenizationStateStore.invalidLineStartIndex) {\r\n // tokenization has reached the viewport start...\r\n this._updateTokensUntilLine(builder, endLineNumber);\r\n return;\r\n }\r\n let nonWhitespaceColumn = this._textModel.getLineFirstNonWhitespaceColumn(startLineNumber);\r\n let fakeLines = [];\r\n let initialState = null;\r\n for (let i = startLineNumber - 1; nonWhitespaceColumn > 0 && i >= 1; i--) {\r\n let newNonWhitespaceIndex = this._textModel.getLineFirstNonWhitespaceColumn(i);\r\n if (newNonWhitespaceIndex === 0) {\r\n continue;\r\n }\r\n if (newNonWhitespaceIndex < nonWhitespaceColumn) {\r\n initialState = this._tokenizationStateStore.getBeginState(i - 1);\r\n if (initialState) {\r\n break;\r\n }\r\n fakeLines.push(this._textModel.getLineContent(i));\r\n nonWhitespaceColumn = newNonWhitespaceIndex;\r\n }\r\n }\r\n if (!initialState) {\r\n initialState = this._tokenizationSupport.getInitialState();\r\n }\r\n const languageIdentifier = this._textModel.getLanguageIdentifier();\r\n let state = initialState;\r\n for (let i = fakeLines.length - 1; i >= 0; i--) {\r\n let r = safeTokenize(languageIdentifier, this._tokenizationSupport, fakeLines[i], false, state);\r\n state = r.endState;\r\n }\r\n for (let lineNumber = startLineNumber; lineNumber <= endLineNumber; lineNumber++) {\r\n let text = this._textModel.getLineContent(lineNumber);\r\n let r = safeTokenize(languageIdentifier, this._tokenizationSupport, text, true, state);\r\n builder.add(lineNumber, r.tokens);\r\n this._tokenizationStateStore.setFakeTokens(lineNumber - 1);\r\n state = r.endState;\r\n }\r\n }\r\n}\r\nfunction initializeTokenization(textModel) {\r\n const languageIdentifier = textModel.getLanguageIdentifier();\r\n let tokenizationSupport = (textModel.isTooLargeForTokenization()\r\n ? null\r\n : TokenizationRegistry.get(languageIdentifier.language));\r\n let initialState = null;\r\n if (tokenizationSupport) {\r\n try {\r\n initialState = tokenizationSupport.getInitialState();\r\n }\r\n catch (e) {\r\n onUnexpectedError(e);\r\n tokenizationSupport = null;\r\n }\r\n }\r\n return [tokenizationSupport, initialState];\r\n}\r\nfunction safeTokenize(languageIdentifier, tokenizationSupport, text, hasEOL, state) {\r\n let r = null;\r\n if (tokenizationSupport) {\r\n try {\r\n r = tokenizationSupport.tokenize2(text, hasEOL, state.clone(), 0);\r\n }\r\n catch (e) {\r\n onUnexpectedError(e);\r\n }\r\n }\r\n if (!r) {\r\n r = nullTokenize2(languageIdentifier.id, text, state, 0);\r\n }\r\n LineTokens.convertToEndOffset(r.tokens, text.length);\r\n return r;\r\n}\r\n", "/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License. See License.txt in the project root for license information.\r\n *--------------------------------------------------------------------------------------------*/\r\n/**\r\n * Describes what to do with the indentation when pressing Enter.\r\n */\r\nexport var IndentAction;\r\n(function (IndentAction) {\r\n /**\r\n * Insert new line and copy the previous line's indentation.\r\n */\r\n IndentAction[IndentAction[\"None\"] = 0] = \"None\";\r\n /**\r\n * Insert new line and indent once (relative to the previous line's indentation).\r\n */\r\n IndentAction[IndentAction[\"Indent\"] = 1] = \"Indent\";\r\n /**\r\n * Insert two new lines:\r\n * - the first one indented which will hold the cursor\r\n * - the second one at the same indentation level\r\n */\r\n IndentAction[IndentAction[\"IndentOutdent\"] = 2] = \"IndentOutdent\";\r\n /**\r\n * Insert new line and outdent once (relative to the previous line's indentation).\r\n */\r\n IndentAction[IndentAction[\"Outdent\"] = 3] = \"Outdent\";\r\n})(IndentAction || (IndentAction = {}));\r\n/**\r\n * @internal\r\n */\r\nexport class StandardAutoClosingPairConditional {\r\n constructor(source) {\r\n this._standardAutoClosingPairConditionalBrand = undefined;\r\n this.open = source.open;\r\n this.close = source.close;\r\n // initially allowed in all tokens\r\n this._standardTokenMask = 0;\r\n if (Array.isArray(source.notIn)) {\r\n for (let i = 0, len = source.notIn.length; i < len; i++) {\r\n const notIn = source.notIn[i];\r\n switch (notIn) {\r\n case 'string':\r\n this._standardTokenMask |= 2 /* String */;\r\n break;\r\n case 'comment':\r\n this._standardTokenMask |= 1 /* Comment */;\r\n break;\r\n case 'regex':\r\n this._standardTokenMask |= 4 /* RegEx */;\r\n break;\r\n }\r\n }\r\n }\r\n }\r\n isOK(standardToken) {\r\n return (this._standardTokenMask & standardToken) === 0;\r\n }\r\n}\r\n/**\r\n * @internal\r\n */\r\nexport class AutoClosingPairs {\r\n constructor(autoClosingPairs) {\r\n this.autoClosingPairsOpenByStart = new Map();\r\n this.autoClosingPairsOpenByEnd = new Map();\r\n this.autoClosingPairsCloseByStart = new Map();\r\n this.autoClosingPairsCloseByEnd = new Map();\r\n this.autoClosingPairsCloseSingleChar = new Map();\r\n for (const pair of autoClosingPairs) {\r\n appendEntry(this.autoClosingPairsOpenByStart, pair.open.charAt(0), pair);\r\n appendEntry(this.autoClosingPairsOpenByEnd, pair.open.charAt(pair.open.length - 1), pair);\r\n appendEntry(this.autoClosingPairsCloseByStart, pair.close.charAt(0), pair);\r\n appendEntry(this.autoClosingPairsCloseByEnd, pair.close.charAt(pair.close.length - 1), pair);\r\n if (pair.close.length === 1 && pair.open.length === 1) {\r\n appendEntry(this.autoClosingPairsCloseSingleChar, pair.close, pair);\r\n }\r\n }\r\n }\r\n}\r\nfunction appendEntry(target, key, value) {\r\n if (target.has(key)) {\r\n target.get(key).push(value);\r\n }\r\n else {\r\n target.set(key, [value]);\r\n }\r\n}\r\n", "/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License. See License.txt in the project root for license information.\r\n *--------------------------------------------------------------------------------------------*/\r\nexport function createScopedLineTokens(context, offset) {\r\n let tokenCount = context.getCount();\r\n let tokenIndex = context.findTokenIndexAtOffset(offset);\r\n let desiredLanguageId = context.getLanguageId(tokenIndex);\r\n let lastTokenIndex = tokenIndex;\r\n while (lastTokenIndex + 1 < tokenCount && context.getLanguageId(lastTokenIndex + 1) === desiredLanguageId) {\r\n lastTokenIndex++;\r\n }\r\n let firstTokenIndex = tokenIndex;\r\n while (firstTokenIndex > 0 && context.getLanguageId(firstTokenIndex - 1) === desiredLanguageId) {\r\n firstTokenIndex--;\r\n }\r\n return new ScopedLineTokens(context, desiredLanguageId, firstTokenIndex, lastTokenIndex + 1, context.getStartOffset(firstTokenIndex), context.getEndOffset(lastTokenIndex));\r\n}\r\nexport class ScopedLineTokens {\r\n constructor(actual, languageId, firstTokenIndex, lastTokenIndex, firstCharOffset, lastCharOffset) {\r\n this._scopedLineTokensBrand = undefined;\r\n this._actual = actual;\r\n this.languageId = languageId;\r\n this._firstTokenIndex = firstTokenIndex;\r\n this._lastTokenIndex = lastTokenIndex;\r\n this.firstCharOffset = firstCharOffset;\r\n this._lastCharOffset = lastCharOffset;\r\n }\r\n getLineContent() {\r\n const actualLineContent = this._actual.getLineContent();\r\n return actualLineContent.substring(this.firstCharOffset, this._lastCharOffset);\r\n }\r\n getActualLineContentBefore(offset) {\r\n const actualLineContent = this._actual.getLineContent();\r\n return actualLineContent.substring(0, this.firstCharOffset + offset);\r\n }\r\n getTokenCount() {\r\n return this._lastTokenIndex - this._firstTokenIndex;\r\n }\r\n findTokenIndexAtOffset(offset) {\r\n return this._actual.findTokenIndexAtOffset(offset + this.firstCharOffset) - this._firstTokenIndex;\r\n }\r\n getStandardTokenType(tokenIndex) {\r\n return this._actual.getStandardTokenType(tokenIndex + this._firstTokenIndex);\r\n }\r\n}\r\nexport function ignoreBracketsInToken(standardTokenType) {\r\n return (standardTokenType & 7 /* value */) !== 0;\r\n}\r\n", "/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License. See License.txt in the project root for license information.\r\n *--------------------------------------------------------------------------------------------*/\r\nimport { StandardAutoClosingPairConditional } from '../languageConfiguration.js';\r\nexport class CharacterPairSupport {\r\n constructor(config) {\r\n if (config.autoClosingPairs) {\r\n this._autoClosingPairs = config.autoClosingPairs.map(el => new StandardAutoClosingPairConditional(el));\r\n }\r\n else if (config.brackets) {\r\n this._autoClosingPairs = config.brackets.map(b => new StandardAutoClosingPairConditional({ open: b[0], close: b[1] }));\r\n }\r\n else {\r\n this._autoClosingPairs = [];\r\n }\r\n if (config.__electricCharacterSupport && config.__electricCharacterSupport.docComment) {\r\n const docComment = config.__electricCharacterSupport.docComment;\r\n // IDocComment is legacy, only partially supported\r\n this._autoClosingPairs.push(new StandardAutoClosingPairConditional({ open: docComment.open, close: docComment.close || '' }));\r\n }\r\n this._autoCloseBefore = typeof config.autoCloseBefore === 'string' ? config.autoCloseBefore : CharacterPairSupport.DEFAULT_AUTOCLOSE_BEFORE_LANGUAGE_DEFINED;\r\n this._surroundingPairs = config.surroundingPairs || this._autoClosingPairs;\r\n }\r\n getAutoClosingPairs() {\r\n return this._autoClosingPairs;\r\n }\r\n getAutoCloseBeforeSet() {\r\n return this._autoCloseBefore;\r\n }\r\n static shouldAutoClosePair(autoClosingPair, context, column) {\r\n // Always complete on empty line\r\n if (context.getTokenCount() === 0) {\r\n return true;\r\n }\r\n const tokenIndex = context.findTokenIndexAtOffset(column - 2);\r\n const standardTokenType = context.getStandardTokenType(tokenIndex);\r\n return autoClosingPair.isOK(standardTokenType);\r\n }\r\n getSurroundingPairs() {\r\n return this._surroundingPairs;\r\n }\r\n}\r\nCharacterPairSupport.DEFAULT_AUTOCLOSE_BEFORE_LANGUAGE_DEFINED = ';:.,=}])> \\n\\t';\r\n", "/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License. See License.txt in the project root for license information.\r\n *--------------------------------------------------------------------------------------------*/\r\nimport * as strings from '../../../../base/common/strings.js';\r\nimport * as stringBuilder from '../../core/stringBuilder.js';\r\nimport { Range } from '../../core/range.js';\r\nexport class RichEditBracket {\r\n constructor(languageIdentifier, index, open, close, forwardRegex, reversedRegex) {\r\n this._richEditBracketBrand = undefined;\r\n this.languageIdentifier = languageIdentifier;\r\n this.index = index;\r\n this.open = open;\r\n this.close = close;\r\n this.forwardRegex = forwardRegex;\r\n this.reversedRegex = reversedRegex;\r\n this._openSet = RichEditBracket._toSet(this.open);\r\n this._closeSet = RichEditBracket._toSet(this.close);\r\n }\r\n isOpen(text) {\r\n return this._openSet.has(text);\r\n }\r\n isClose(text) {\r\n return this._closeSet.has(text);\r\n }\r\n static _toSet(arr) {\r\n const result = new Set();\r\n for (const element of arr) {\r\n result.add(element);\r\n }\r\n return result;\r\n }\r\n}\r\nfunction groupFuzzyBrackets(brackets) {\r\n const N = brackets.length;\r\n brackets = brackets.map(b => [b[0].toLowerCase(), b[1].toLowerCase()]);\r\n const group = [];\r\n for (let i = 0; i < N; i++) {\r\n group[i] = i;\r\n }\r\n const areOverlapping = (a, b) => {\r\n const [aOpen, aClose] = a;\r\n const [bOpen, bClose] = b;\r\n return (aOpen === bOpen || aOpen === bClose || aClose === bOpen || aClose === bClose);\r\n };\r\n const mergeGroups = (g1, g2) => {\r\n const newG = Math.min(g1, g2);\r\n const oldG = Math.max(g1, g2);\r\n for (let i = 0; i < N; i++) {\r\n if (group[i] === oldG) {\r\n group[i] = newG;\r\n }\r\n }\r\n };\r\n // group together brackets that have the same open or the same close sequence\r\n for (let i = 0; i < N; i++) {\r\n const a = brackets[i];\r\n for (let j = i + 1; j < N; j++) {\r\n const b = brackets[j];\r\n if (areOverlapping(a, b)) {\r\n mergeGroups(group[i], group[j]);\r\n }\r\n }\r\n }\r\n const result = [];\r\n for (let g = 0; g < N; g++) {\r\n let currentOpen = [];\r\n let currentClose = [];\r\n for (let i = 0; i < N; i++) {\r\n if (group[i] === g) {\r\n const [open, close] = brackets[i];\r\n currentOpen.push(open);\r\n currentClose.push(close);\r\n }\r\n }\r\n if (currentOpen.length > 0) {\r\n result.push({\r\n open: currentOpen,\r\n close: currentClose\r\n });\r\n }\r\n }\r\n return result;\r\n}\r\nexport class RichEditBrackets {\r\n constructor(languageIdentifier, _brackets) {\r\n this._richEditBracketsBrand = undefined;\r\n const brackets = groupFuzzyBrackets(_brackets);\r\n this.brackets = brackets.map((b, index) => {\r\n return new RichEditBracket(languageIdentifier, index, b.open, b.close, getRegexForBracketPair(b.open, b.close, brackets, index), getReversedRegexForBracketPair(b.open, b.close, brackets, index));\r\n });\r\n this.forwardRegex = getRegexForBrackets(this.brackets);\r\n this.reversedRegex = getReversedRegexForBrackets(this.brackets);\r\n this.textIsBracket = {};\r\n this.textIsOpenBracket = {};\r\n this.maxBracketLength = 0;\r\n for (const bracket of this.brackets) {\r\n for (const open of bracket.open) {\r\n this.textIsBracket[open] = bracket;\r\n this.textIsOpenBracket[open] = true;\r\n this.maxBracketLength = Math.max(this.maxBracketLength, open.length);\r\n }\r\n for (const close of bracket.close) {\r\n this.textIsBracket[close] = bracket;\r\n this.textIsOpenBracket[close] = false;\r\n this.maxBracketLength = Math.max(this.maxBracketLength, close.length);\r\n }\r\n }\r\n }\r\n}\r\nfunction collectSuperstrings(str, brackets, currentIndex, dest) {\r\n for (let i = 0, len = brackets.length; i < len; i++) {\r\n if (i === currentIndex) {\r\n continue;\r\n }\r\n const bracket = brackets[i];\r\n for (const open of bracket.open) {\r\n if (open.indexOf(str) >= 0) {\r\n dest.push(open);\r\n }\r\n }\r\n for (const close of bracket.close) {\r\n if (close.indexOf(str) >= 0) {\r\n dest.push(close);\r\n }\r\n }\r\n }\r\n}\r\nfunction lengthcmp(a, b) {\r\n return a.length - b.length;\r\n}\r\nfunction unique(arr) {\r\n if (arr.length <= 1) {\r\n return arr;\r\n }\r\n const result = [];\r\n const seen = new Set();\r\n for (const element of arr) {\r\n if (seen.has(element)) {\r\n continue;\r\n }\r\n result.push(element);\r\n seen.add(element);\r\n }\r\n return result;\r\n}\r\nfunction getRegexForBracketPair(open, close, brackets, currentIndex) {\r\n // search in all brackets for other brackets that are a superstring of these brackets\r\n let pieces = [];\r\n pieces = pieces.concat(open);\r\n pieces = pieces.concat(close);\r\n for (let i = 0, len = pieces.length; i < len; i++) {\r\n collectSuperstrings(pieces[i], brackets, currentIndex, pieces);\r\n }\r\n pieces = unique(pieces);\r\n pieces.sort(lengthcmp);\r\n pieces.reverse();\r\n return createBracketOrRegExp(pieces);\r\n}\r\nfunction getReversedRegexForBracketPair(open, close, brackets, currentIndex) {\r\n // search in all brackets for other brackets that are a superstring of these brackets\r\n let pieces = [];\r\n pieces = pieces.concat(open);\r\n pieces = pieces.concat(close);\r\n for (let i = 0, len = pieces.length; i < len; i++) {\r\n collectSuperstrings(pieces[i], brackets, currentIndex, pieces);\r\n }\r\n pieces = unique(pieces);\r\n pieces.sort(lengthcmp);\r\n pieces.reverse();\r\n return createBracketOrRegExp(pieces.map(toReversedString));\r\n}\r\nfunction getRegexForBrackets(brackets) {\r\n let pieces = [];\r\n for (const bracket of brackets) {\r\n for (const open of bracket.open) {\r\n pieces.push(open);\r\n }\r\n for (const close of bracket.close) {\r\n pieces.push(close);\r\n }\r\n }\r\n pieces = unique(pieces);\r\n return createBracketOrRegExp(pieces);\r\n}\r\nfunction getReversedRegexForBrackets(brackets) {\r\n let pieces = [];\r\n for (const bracket of brackets) {\r\n for (const open of bracket.open) {\r\n pieces.push(open);\r\n }\r\n for (const close of bracket.close) {\r\n pieces.push(close);\r\n }\r\n }\r\n pieces = unique(pieces);\r\n return createBracketOrRegExp(pieces.map(toReversedString));\r\n}\r\nfunction prepareBracketForRegExp(str) {\r\n // This bracket pair uses letters like e.g. \"begin\" - \"end\"\r\n const insertWordBoundaries = (/^[\\w ]+$/.test(str));\r\n str = strings.escapeRegExpCharacters(str);\r\n return (insertWordBoundaries ? `\\\\b${str}\\\\b` : str);\r\n}\r\nfunction createBracketOrRegExp(pieces) {\r\n let regexStr = `(${pieces.map(prepareBracketForRegExp).join(')|(')})`;\r\n return strings.createRegExp(regexStr, true);\r\n}\r\nconst toReversedString = (function () {\r\n function reverse(str) {\r\n if (stringBuilder.hasTextDecoder) {\r\n // create a Uint16Array and then use a TextDecoder to create a string\r\n const arr = new Uint16Array(str.length);\r\n let offset = 0;\r\n for (let i = str.length - 1; i >= 0; i--) {\r\n arr[offset++] = str.charCodeAt(i);\r\n }\r\n return stringBuilder.getPlatformTextDecoder().decode(arr);\r\n }\r\n else {\r\n let result = [], resultLen = 0;\r\n for (let i = str.length - 1; i >= 0; i--) {\r\n result[resultLen++] = str.charAt(i);\r\n }\r\n return result.join('');\r\n }\r\n }\r\n let lastInput = null;\r\n let lastOutput = null;\r\n return function toReversedString(str) {\r\n if (lastInput !== str) {\r\n lastInput = str;\r\n lastOutput = reverse(lastInput);\r\n }\r\n return lastOutput;\r\n };\r\n})();\r\nexport class BracketsUtils {\r\n static _findPrevBracketInText(reversedBracketRegex, lineNumber, reversedText, offset) {\r\n let m = reversedText.match(reversedBracketRegex);\r\n if (!m) {\r\n return null;\r\n }\r\n let matchOffset = reversedText.length - (m.index || 0);\r\n let matchLength = m[0].length;\r\n let absoluteMatchOffset = offset + matchOffset;\r\n return new Range(lineNumber, absoluteMatchOffset - matchLength + 1, lineNumber, absoluteMatchOffset + 1);\r\n }\r\n static findPrevBracketInRange(reversedBracketRegex, lineNumber, lineText, startOffset, endOffset) {\r\n // Because JS does not support backwards regex search, we search forwards in a reversed string with a reversed regex ;)\r\n const reversedLineText = toReversedString(lineText);\r\n const reversedSubstr = reversedLineText.substring(lineText.length - endOffset, lineText.length - startOffset);\r\n return this._findPrevBracketInText(reversedBracketRegex, lineNumber, reversedSubstr, startOffset);\r\n }\r\n static findNextBracketInText(bracketRegex, lineNumber, text, offset) {\r\n let m = text.match(bracketRegex);\r\n if (!m) {\r\n return null;\r\n }\r\n let matchOffset = m.index || 0;\r\n let matchLength = m[0].length;\r\n if (matchLength === 0) {\r\n return null;\r\n }\r\n let absoluteMatchOffset = offset + matchOffset;\r\n return new Range(lineNumber, absoluteMatchOffset + 1, lineNumber, absoluteMatchOffset + 1 + matchLength);\r\n }\r\n static findNextBracketInRange(bracketRegex, lineNumber, lineText, startOffset, endOffset) {\r\n const substr = lineText.substring(startOffset, endOffset);\r\n return this.findNextBracketInText(bracketRegex, lineNumber, substr, startOffset);\r\n }\r\n}\r\n", "/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License. See License.txt in the project root for license information.\r\n *--------------------------------------------------------------------------------------------*/\r\nimport { ignoreBracketsInToken } from '../supports.js';\r\nimport { BracketsUtils } from './richEditBrackets.js';\r\nexport class BracketElectricCharacterSupport {\r\n constructor(richEditBrackets) {\r\n this._richEditBrackets = richEditBrackets;\r\n }\r\n getElectricCharacters() {\r\n let result = [];\r\n if (this._richEditBrackets) {\r\n for (const bracket of this._richEditBrackets.brackets) {\r\n for (const close of bracket.close) {\r\n const lastChar = close.charAt(close.length - 1);\r\n result.push(lastChar);\r\n }\r\n }\r\n }\r\n // Filter duplicate entries\r\n result = result.filter((item, pos, array) => {\r\n return array.indexOf(item) === pos;\r\n });\r\n return result;\r\n }\r\n onElectricCharacter(character, context, column) {\r\n if (!this._richEditBrackets || this._richEditBrackets.brackets.length === 0) {\r\n return null;\r\n }\r\n const tokenIndex = context.findTokenIndexAtOffset(column - 1);\r\n if (ignoreBracketsInToken(context.getStandardTokenType(tokenIndex))) {\r\n return null;\r\n }\r\n const reversedBracketRegex = this._richEditBrackets.reversedRegex;\r\n const text = context.getLineContent().substring(0, column - 1) + character;\r\n const r = BracketsUtils.findPrevBracketInRange(reversedBracketRegex, 1, text, 0, text.length);\r\n if (!r) {\r\n return null;\r\n }\r\n const bracketText = text.substring(r.startColumn - 1, r.endColumn - 1).toLowerCase();\r\n const isOpen = this._richEditBrackets.textIsOpenBracket[bracketText];\r\n if (isOpen) {\r\n return null;\r\n }\r\n const textBeforeBracket = context.getActualLineContentBefore(r.startColumn - 1);\r\n if (!/^\\s*$/.test(textBeforeBracket)) {\r\n // There is other text on the line before the bracket\r\n return null;\r\n }\r\n return {\r\n matchOpenBracket: bracketText\r\n };\r\n }\r\n}\r\n", "/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License. See License.txt in the project root for license information.\r\n *--------------------------------------------------------------------------------------------*/\r\nfunction resetGlobalRegex(reg) {\r\n if (reg.global) {\r\n reg.lastIndex = 0;\r\n }\r\n return true;\r\n}\r\nexport class IndentRulesSupport {\r\n constructor(indentationRules) {\r\n this._indentationRules = indentationRules;\r\n }\r\n shouldIncrease(text) {\r\n if (this._indentationRules) {\r\n if (this._indentationRules.increaseIndentPattern && resetGlobalRegex(this._indentationRules.increaseIndentPattern) && this._indentationRules.increaseIndentPattern.test(text)) {\r\n return true;\r\n }\r\n // if (this._indentationRules.indentNextLinePattern && this._indentationRules.indentNextLinePattern.test(text)) {\r\n // \treturn true;\r\n // }\r\n }\r\n return false;\r\n }\r\n shouldDecrease(text) {\r\n if (this._indentationRules && this._indentationRules.decreaseIndentPattern && resetGlobalRegex(this._indentationRules.decreaseIndentPattern) && this._indentationRules.decreaseIndentPattern.test(text)) {\r\n return true;\r\n }\r\n return false;\r\n }\r\n shouldIndentNextLine(text) {\r\n if (this._indentationRules && this._indentationRules.indentNextLinePattern && resetGlobalRegex(this._indentationRules.indentNextLinePattern) && this._indentationRules.indentNextLinePattern.test(text)) {\r\n return true;\r\n }\r\n return false;\r\n }\r\n shouldIgnore(text) {\r\n // the text matches `unIndentedLinePattern`\r\n if (this._indentationRules && this._indentationRules.unIndentedLinePattern && resetGlobalRegex(this._indentationRules.unIndentedLinePattern) && this._indentationRules.unIndentedLinePattern.test(text)) {\r\n return true;\r\n }\r\n return false;\r\n }\r\n getIndentMetadata(text) {\r\n let ret = 0;\r\n if (this.shouldIncrease(text)) {\r\n ret += 1 /* INCREASE_MASK */;\r\n }\r\n if (this.shouldDecrease(text)) {\r\n ret += 2 /* DECREASE_MASK */;\r\n }\r\n if (this.shouldIndentNextLine(text)) {\r\n ret += 4 /* INDENT_NEXTLINE_MASK */;\r\n }\r\n if (this.shouldIgnore(text)) {\r\n ret += 8 /* UNINDENT_MASK */;\r\n }\r\n return ret;\r\n }\r\n}\r\n", "/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License. See License.txt in the project root for license information.\r\n *--------------------------------------------------------------------------------------------*/\r\nimport { onUnexpectedError } from '../../../../base/common/errors.js';\r\nimport * as strings from '../../../../base/common/strings.js';\r\nimport { IndentAction } from '../languageConfiguration.js';\r\nexport class OnEnterSupport {\r\n constructor(opts) {\r\n opts = opts || {};\r\n opts.brackets = opts.brackets || [\r\n ['(', ')'],\r\n ['{', '}'],\r\n ['[', ']']\r\n ];\r\n this._brackets = [];\r\n opts.brackets.forEach((bracket) => {\r\n const openRegExp = OnEnterSupport._createOpenBracketRegExp(bracket[0]);\r\n const closeRegExp = OnEnterSupport._createCloseBracketRegExp(bracket[1]);\r\n if (openRegExp && closeRegExp) {\r\n this._brackets.push({\r\n open: bracket[0],\r\n openRegExp: openRegExp,\r\n close: bracket[1],\r\n closeRegExp: closeRegExp,\r\n });\r\n }\r\n });\r\n this._regExpRules = opts.onEnterRules || [];\r\n }\r\n onEnter(autoIndent, previousLineText, beforeEnterText, afterEnterText) {\r\n // (1): `regExpRules`\r\n if (autoIndent >= 3 /* Advanced */) {\r\n for (let i = 0, len = this._regExpRules.length; i < len; i++) {\r\n let rule = this._regExpRules[i];\r\n const regResult = [{\r\n reg: rule.beforeText,\r\n text: beforeEnterText\r\n }, {\r\n reg: rule.afterText,\r\n text: afterEnterText\r\n }, {\r\n reg: rule.previousLineText,\r\n text: previousLineText\r\n }].every((obj) => {\r\n if (!obj.reg) {\r\n return true;\r\n }\r\n obj.reg.lastIndex = 0; // To disable the effect of the \"g\" flag.\r\n return obj.reg.test(obj.text);\r\n });\r\n if (regResult) {\r\n return rule.action;\r\n }\r\n }\r\n }\r\n // (2): Special indent-outdent\r\n if (autoIndent >= 2 /* Brackets */) {\r\n if (beforeEnterText.length > 0 && afterEnterText.length > 0) {\r\n for (let i = 0, len = this._brackets.length; i < len; i++) {\r\n let bracket = this._brackets[i];\r\n if (bracket.openRegExp.test(beforeEnterText) && bracket.closeRegExp.test(afterEnterText)) {\r\n return { indentAction: IndentAction.IndentOutdent };\r\n }\r\n }\r\n }\r\n }\r\n // (4): Open bracket based logic\r\n if (autoIndent >= 2 /* Brackets */) {\r\n if (beforeEnterText.length > 0) {\r\n for (let i = 0, len = this._brackets.length; i < len; i++) {\r\n let bracket = this._brackets[i];\r\n if (bracket.openRegExp.test(beforeEnterText)) {\r\n return { indentAction: IndentAction.Indent };\r\n }\r\n }\r\n }\r\n }\r\n return null;\r\n }\r\n static _createOpenBracketRegExp(bracket) {\r\n let str = strings.escapeRegExpCharacters(bracket);\r\n if (!/\\B/.test(str.charAt(0))) {\r\n str = '\\\\b' + str;\r\n }\r\n str += '\\\\s*$';\r\n return OnEnterSupport._safeRegExp(str);\r\n }\r\n static _createCloseBracketRegExp(bracket) {\r\n let str = strings.escapeRegExpCharacters(bracket);\r\n if (!/\\B/.test(str.charAt(str.length - 1))) {\r\n str = str + '\\\\b';\r\n }\r\n str = '^\\\\s*' + str;\r\n return OnEnterSupport._safeRegExp(str);\r\n }\r\n static _safeRegExp(def) {\r\n try {\r\n return new RegExp(def);\r\n }\r\n catch (err) {\r\n onUnexpectedError(err);\r\n return null;\r\n }\r\n }\r\n}\r\n", "/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License. See License.txt in the project root for license information.\r\n *--------------------------------------------------------------------------------------------*/\r\nimport { Emitter } from '../../../base/common/event.js';\r\nimport { toDisposable } from '../../../base/common/lifecycle.js';\r\nimport * as strings from '../../../base/common/strings.js';\r\nimport { DEFAULT_WORD_REGEXP, ensureValidWordDefinition } from '../model/wordHelper.js';\r\nimport { IndentAction, AutoClosingPairs } from './languageConfiguration.js';\r\nimport { createScopedLineTokens } from './supports.js';\r\nimport { CharacterPairSupport } from './supports/characterPair.js';\r\nimport { BracketElectricCharacterSupport } from './supports/electricCharacter.js';\r\nimport { IndentRulesSupport } from './supports/indentRules.js';\r\nimport { OnEnterSupport } from './supports/onEnter.js';\r\nimport { RichEditBrackets } from './supports/richEditBrackets.js';\r\nexport class RichEditSupport {\r\n constructor(languageIdentifier, rawConf) {\r\n this._languageIdentifier = languageIdentifier;\r\n this._brackets = null;\r\n this._electricCharacter = null;\r\n this._conf = rawConf;\r\n this._onEnterSupport = (this._conf.brackets || this._conf.indentationRules || this._conf.onEnterRules ? new OnEnterSupport(this._conf) : null);\r\n this.comments = RichEditSupport._handleComments(this._conf);\r\n this.characterPair = new CharacterPairSupport(this._conf);\r\n this.wordDefinition = this._conf.wordPattern || DEFAULT_WORD_REGEXP;\r\n this.indentationRules = this._conf.indentationRules;\r\n if (this._conf.indentationRules) {\r\n this.indentRulesSupport = new IndentRulesSupport(this._conf.indentationRules);\r\n }\r\n else {\r\n this.indentRulesSupport = null;\r\n }\r\n this.foldingRules = this._conf.folding || {};\r\n }\r\n get brackets() {\r\n if (!this._brackets && this._conf.brackets) {\r\n this._brackets = new RichEditBrackets(this._languageIdentifier, this._conf.brackets);\r\n }\r\n return this._brackets;\r\n }\r\n get electricCharacter() {\r\n if (!this._electricCharacter) {\r\n this._electricCharacter = new BracketElectricCharacterSupport(this.brackets);\r\n }\r\n return this._electricCharacter;\r\n }\r\n onEnter(autoIndent, previousLineText, beforeEnterText, afterEnterText) {\r\n if (!this._onEnterSupport) {\r\n return null;\r\n }\r\n return this._onEnterSupport.onEnter(autoIndent, previousLineText, beforeEnterText, afterEnterText);\r\n }\r\n static _handleComments(conf) {\r\n let commentRule = conf.comments;\r\n if (!commentRule) {\r\n return null;\r\n }\r\n // comment configuration\r\n let comments = {};\r\n if (commentRule.lineComment) {\r\n comments.lineCommentToken = commentRule.lineComment;\r\n }\r\n if (commentRule.blockComment) {\r\n let [blockStart, blockEnd] = commentRule.blockComment;\r\n comments.blockCommentStartToken = blockStart;\r\n comments.blockCommentEndToken = blockEnd;\r\n }\r\n return comments;\r\n }\r\n}\r\nexport class LanguageConfigurationChangeEvent {\r\n constructor(languageIdentifier) {\r\n this.languageIdentifier = languageIdentifier;\r\n }\r\n}\r\nclass LanguageConfigurationEntry {\r\n constructor(configuration, priority, order) {\r\n this.configuration = configuration;\r\n this.priority = priority;\r\n this.order = order;\r\n }\r\n static cmp(a, b) {\r\n if (a.priority === b.priority) {\r\n // higher order last\r\n return a.order - b.order;\r\n }\r\n // higher priority last\r\n return a.priority - b.priority;\r\n }\r\n}\r\nclass LanguageConfigurationEntries {\r\n constructor(languageIdentifier) {\r\n this.languageIdentifier = languageIdentifier;\r\n this._resolved = null;\r\n this._entries = [];\r\n this._order = 0;\r\n this._resolved = null;\r\n }\r\n register(configuration, priority) {\r\n const entry = new LanguageConfigurationEntry(configuration, priority, ++this._order);\r\n this._entries.push(entry);\r\n this._resolved = null;\r\n return toDisposable(() => {\r\n for (let i = 0; i < this._entries.length; i++) {\r\n if (this._entries[i] === entry) {\r\n this._entries.splice(i, 1);\r\n this._resolved = null;\r\n break;\r\n }\r\n }\r\n });\r\n }\r\n getRichEditSupport() {\r\n if (!this._resolved) {\r\n const config = this._resolve();\r\n if (config) {\r\n this._resolved = new RichEditSupport(this.languageIdentifier, config);\r\n }\r\n }\r\n return this._resolved;\r\n }\r\n _resolve() {\r\n if (this._entries.length === 0) {\r\n return null;\r\n }\r\n this._entries.sort(LanguageConfigurationEntry.cmp);\r\n const result = {};\r\n for (const entry of this._entries) {\r\n const conf = entry.configuration;\r\n result.comments = conf.comments || result.comments;\r\n result.brackets = conf.brackets || result.brackets;\r\n result.wordPattern = conf.wordPattern || result.wordPattern;\r\n result.indentationRules = conf.indentationRules || result.indentationRules;\r\n result.onEnterRules = conf.onEnterRules || result.onEnterRules;\r\n result.autoClosingPairs = conf.autoClosingPairs || result.autoClosingPairs;\r\n result.surroundingPairs = conf.surroundingPairs || result.surroundingPairs;\r\n result.autoCloseBefore = conf.autoCloseBefore || result.autoCloseBefore;\r\n result.folding = conf.folding || result.folding;\r\n result.__electricCharacterSupport = conf.__electricCharacterSupport || result.__electricCharacterSupport;\r\n }\r\n return result;\r\n }\r\n}\r\nexport class LanguageConfigurationRegistryImpl {\r\n constructor() {\r\n this._entries2 = new Map();\r\n this._onDidChange = new Emitter();\r\n this.onDidChange = this._onDidChange.event;\r\n }\r\n /**\r\n * @param priority Use a higher number for higher priority\r\n */\r\n register(languageIdentifier, configuration, priority = 0) {\r\n let entries = this._entries2.get(languageIdentifier.id);\r\n if (!entries) {\r\n entries = new LanguageConfigurationEntries(languageIdentifier);\r\n this._entries2.set(languageIdentifier.id, entries);\r\n }\r\n const disposable = entries.register(configuration, priority);\r\n this._onDidChange.fire(new LanguageConfigurationChangeEvent(languageIdentifier));\r\n return toDisposable(() => {\r\n disposable.dispose();\r\n this._onDidChange.fire(new LanguageConfigurationChangeEvent(languageIdentifier));\r\n });\r\n }\r\n _getRichEditSupport(languageId) {\r\n const entries = this._entries2.get(languageId);\r\n return entries ? entries.getRichEditSupport() : null;\r\n }\r\n getIndentationRules(languageId) {\r\n const value = this._getRichEditSupport(languageId);\r\n return value ? value.indentationRules || null : null;\r\n }\r\n // begin electricCharacter\r\n _getElectricCharacterSupport(languageId) {\r\n let value = this._getRichEditSupport(languageId);\r\n if (!value) {\r\n return null;\r\n }\r\n return value.electricCharacter || null;\r\n }\r\n getElectricCharacters(languageId) {\r\n let electricCharacterSupport = this._getElectricCharacterSupport(languageId);\r\n if (!electricCharacterSupport) {\r\n return [];\r\n }\r\n return electricCharacterSupport.getElectricCharacters();\r\n }\r\n /**\r\n * Should return opening bracket type to match indentation with\r\n */\r\n onElectricCharacter(character, context, column) {\r\n let scopedLineTokens = createScopedLineTokens(context, column - 1);\r\n let electricCharacterSupport = this._getElectricCharacterSupport(scopedLineTokens.languageId);\r\n if (!electricCharacterSupport) {\r\n return null;\r\n }\r\n return electricCharacterSupport.onElectricCharacter(character, scopedLineTokens, column - scopedLineTokens.firstCharOffset);\r\n }\r\n // end electricCharacter\r\n getComments(languageId) {\r\n let value = this._getRichEditSupport(languageId);\r\n if (!value) {\r\n return null;\r\n }\r\n return value.comments || null;\r\n }\r\n // begin characterPair\r\n _getCharacterPairSupport(languageId) {\r\n let value = this._getRichEditSupport(languageId);\r\n if (!value) {\r\n return null;\r\n }\r\n return value.characterPair || null;\r\n }\r\n getAutoClosingPairs(languageId) {\r\n const characterPairSupport = this._getCharacterPairSupport(languageId);\r\n return new AutoClosingPairs(characterPairSupport ? characterPairSupport.getAutoClosingPairs() : []);\r\n }\r\n getAutoCloseBeforeSet(languageId) {\r\n let characterPairSupport = this._getCharacterPairSupport(languageId);\r\n if (!characterPairSupport) {\r\n return CharacterPairSupport.DEFAULT_AUTOCLOSE_BEFORE_LANGUAGE_DEFINED;\r\n }\r\n return characterPairSupport.getAutoCloseBeforeSet();\r\n }\r\n getSurroundingPairs(languageId) {\r\n let characterPairSupport = this._getCharacterPairSupport(languageId);\r\n if (!characterPairSupport) {\r\n return [];\r\n }\r\n return characterPairSupport.getSurroundingPairs();\r\n }\r\n shouldAutoClosePair(autoClosingPair, context, column) {\r\n const scopedLineTokens = createScopedLineTokens(context, column - 1);\r\n return CharacterPairSupport.shouldAutoClosePair(autoClosingPair, scopedLineTokens, column - scopedLineTokens.firstCharOffset);\r\n }\r\n // end characterPair\r\n getWordDefinition(languageId) {\r\n let value = this._getRichEditSupport(languageId);\r\n if (!value) {\r\n return ensureValidWordDefinition(null);\r\n }\r\n return ensureValidWordDefinition(value.wordDefinition || null);\r\n }\r\n getFoldingRules(languageId) {\r\n let value = this._getRichEditSupport(languageId);\r\n if (!value) {\r\n return {};\r\n }\r\n return value.foldingRules;\r\n }\r\n // begin Indent Rules\r\n getIndentRulesSupport(languageId) {\r\n let value = this._getRichEditSupport(languageId);\r\n if (!value) {\r\n return null;\r\n }\r\n return value.indentRulesSupport || null;\r\n }\r\n /**\r\n * Get nearest preceiding line which doesn't match unIndentPattern or contains all whitespace.\r\n * Result:\r\n * -1: run into the boundary of embedded languages\r\n * 0: every line above are invalid\r\n * else: nearest preceding line of the same language\r\n */\r\n getPrecedingValidLine(model, lineNumber, indentRulesSupport) {\r\n let languageID = model.getLanguageIdAtPosition(lineNumber, 0);\r\n if (lineNumber > 1) {\r\n let lastLineNumber;\r\n let resultLineNumber = -1;\r\n for (lastLineNumber = lineNumber - 1; lastLineNumber >= 1; lastLineNumber--) {\r\n if (model.getLanguageIdAtPosition(lastLineNumber, 0) !== languageID) {\r\n return resultLineNumber;\r\n }\r\n let text = model.getLineContent(lastLineNumber);\r\n if (indentRulesSupport.shouldIgnore(text) || /^\\s+$/.test(text) || text === '') {\r\n resultLineNumber = lastLineNumber;\r\n continue;\r\n }\r\n return lastLineNumber;\r\n }\r\n }\r\n return -1;\r\n }\r\n /**\r\n * Get inherited indentation from above lines.\r\n * 1. Find the nearest preceding line which doesn't match unIndentedLinePattern.\r\n * 2. If this line matches indentNextLinePattern or increaseIndentPattern, it means that the indent level of `lineNumber` should be 1 greater than this line.\r\n * 3. If this line doesn't match any indent rules\r\n * a. check whether the line above it matches indentNextLinePattern\r\n * b. If not, the indent level of this line is the result\r\n * c. If so, it means the indent of this line is *temporary*, go upward utill we find a line whose indent is not temporary (the same workflow a -> b -> c).\r\n * 4. Otherwise, we fail to get an inherited indent from aboves. Return null and we should not touch the indent of `lineNumber`\r\n *\r\n * This function only return the inherited indent based on above lines, it doesn't check whether current line should decrease or not.\r\n */\r\n getInheritIndentForLine(autoIndent, model, lineNumber, honorIntentialIndent = true) {\r\n if (autoIndent < 4 /* Full */) {\r\n return null;\r\n }\r\n const indentRulesSupport = this.getIndentRulesSupport(model.getLanguageIdentifier().id);\r\n if (!indentRulesSupport) {\r\n return null;\r\n }\r\n if (lineNumber <= 1) {\r\n return {\r\n indentation: '',\r\n action: null\r\n };\r\n }\r\n const precedingUnIgnoredLine = this.getPrecedingValidLine(model, lineNumber, indentRulesSupport);\r\n if (precedingUnIgnoredLine < 0) {\r\n return null;\r\n }\r\n else if (precedingUnIgnoredLine < 1) {\r\n return {\r\n indentation: '',\r\n action: null\r\n };\r\n }\r\n const precedingUnIgnoredLineContent = model.getLineContent(precedingUnIgnoredLine);\r\n if (indentRulesSupport.shouldIncrease(precedingUnIgnoredLineContent) || indentRulesSupport.shouldIndentNextLine(precedingUnIgnoredLineContent)) {\r\n return {\r\n indentation: strings.getLeadingWhitespace(precedingUnIgnoredLineContent),\r\n action: IndentAction.Indent,\r\n line: precedingUnIgnoredLine\r\n };\r\n }\r\n else if (indentRulesSupport.shouldDecrease(precedingUnIgnoredLineContent)) {\r\n return {\r\n indentation: strings.getLeadingWhitespace(precedingUnIgnoredLineContent),\r\n action: null,\r\n line: precedingUnIgnoredLine\r\n };\r\n }\r\n else {\r\n // precedingUnIgnoredLine can not be ignored.\r\n // it doesn't increase indent of following lines\r\n // it doesn't increase just next line\r\n // so current line is not affect by precedingUnIgnoredLine\r\n // and then we should get a correct inheritted indentation from above lines\r\n if (precedingUnIgnoredLine === 1) {\r\n return {\r\n indentation: strings.getLeadingWhitespace(model.getLineContent(precedingUnIgnoredLine)),\r\n action: null,\r\n line: precedingUnIgnoredLine\r\n };\r\n }\r\n const previousLine = precedingUnIgnoredLine - 1;\r\n const previousLineIndentMetadata = indentRulesSupport.getIndentMetadata(model.getLineContent(previousLine));\r\n if (!(previousLineIndentMetadata & (1 /* INCREASE_MASK */ | 2 /* DECREASE_MASK */)) &&\r\n (previousLineIndentMetadata & 4 /* INDENT_NEXTLINE_MASK */)) {\r\n let stopLine = 0;\r\n for (let i = previousLine - 1; i > 0; i--) {\r\n if (indentRulesSupport.shouldIndentNextLine(model.getLineContent(i))) {\r\n continue;\r\n }\r\n stopLine = i;\r\n break;\r\n }\r\n return {\r\n indentation: strings.getLeadingWhitespace(model.getLineContent(stopLine + 1)),\r\n action: null,\r\n line: stopLine + 1\r\n };\r\n }\r\n if (honorIntentialIndent) {\r\n return {\r\n indentation: strings.getLeadingWhitespace(model.getLineContent(precedingUnIgnoredLine)),\r\n action: null,\r\n line: precedingUnIgnoredLine\r\n };\r\n }\r\n else {\r\n // search from precedingUnIgnoredLine until we find one whose indent is not temporary\r\n for (let i = precedingUnIgnoredLine; i > 0; i--) {\r\n const lineContent = model.getLineContent(i);\r\n if (indentRulesSupport.shouldIncrease(lineContent)) {\r\n return {\r\n indentation: strings.getLeadingWhitespace(lineContent),\r\n action: IndentAction.Indent,\r\n line: i\r\n };\r\n }\r\n else if (indentRulesSupport.shouldIndentNextLine(lineContent)) {\r\n let stopLine = 0;\r\n for (let j = i - 1; j > 0; j--) {\r\n if (indentRulesSupport.shouldIndentNextLine(model.getLineContent(i))) {\r\n continue;\r\n }\r\n stopLine = j;\r\n break;\r\n }\r\n return {\r\n indentation: strings.getLeadingWhitespace(model.getLineContent(stopLine + 1)),\r\n action: null,\r\n line: stopLine + 1\r\n };\r\n }\r\n else if (indentRulesSupport.shouldDecrease(lineContent)) {\r\n return {\r\n indentation: strings.getLeadingWhitespace(lineContent),\r\n action: null,\r\n line: i\r\n };\r\n }\r\n }\r\n return {\r\n indentation: strings.getLeadingWhitespace(model.getLineContent(1)),\r\n action: null,\r\n line: 1\r\n };\r\n }\r\n }\r\n }\r\n getGoodIndentForLine(autoIndent, virtualModel, languageId, lineNumber, indentConverter) {\r\n if (autoIndent < 4 /* Full */) {\r\n return null;\r\n }\r\n const richEditSupport = this._getRichEditSupport(languageId);\r\n if (!richEditSupport) {\r\n return null;\r\n }\r\n const indentRulesSupport = this.getIndentRulesSupport(languageId);\r\n if (!indentRulesSupport) {\r\n return null;\r\n }\r\n const indent = this.getInheritIndentForLine(autoIndent, virtualModel, lineNumber);\r\n const lineContent = virtualModel.getLineContent(lineNumber);\r\n if (indent) {\r\n const inheritLine = indent.line;\r\n if (inheritLine !== undefined) {\r\n const enterResult = richEditSupport.onEnter(autoIndent, '', virtualModel.getLineContent(inheritLine), '');\r\n if (enterResult) {\r\n let indentation = strings.getLeadingWhitespace(virtualModel.getLineContent(inheritLine));\r\n if (enterResult.removeText) {\r\n indentation = indentation.substring(0, indentation.length - enterResult.removeText);\r\n }\r\n if ((enterResult.indentAction === IndentAction.Indent) ||\r\n (enterResult.indentAction === IndentAction.IndentOutdent)) {\r\n indentation = indentConverter.shiftIndent(indentation);\r\n }\r\n else if (enterResult.indentAction === IndentAction.Outdent) {\r\n indentation = indentConverter.unshiftIndent(indentation);\r\n }\r\n if (indentRulesSupport.shouldDecrease(lineContent)) {\r\n indentation = indentConverter.unshiftIndent(indentation);\r\n }\r\n if (enterResult.appendText) {\r\n indentation += enterResult.appendText;\r\n }\r\n return strings.getLeadingWhitespace(indentation);\r\n }\r\n }\r\n if (indentRulesSupport.shouldDecrease(lineContent)) {\r\n if (indent.action === IndentAction.Indent) {\r\n return indent.indentation;\r\n }\r\n else {\r\n return indentConverter.unshiftIndent(indent.indentation);\r\n }\r\n }\r\n else {\r\n if (indent.action === IndentAction.Indent) {\r\n return indentConverter.shiftIndent(indent.indentation);\r\n }\r\n else {\r\n return indent.indentation;\r\n }\r\n }\r\n }\r\n return null;\r\n }\r\n getIndentForEnter(autoIndent, model, range, indentConverter) {\r\n if (autoIndent < 4 /* Full */) {\r\n return null;\r\n }\r\n model.forceTokenization(range.startLineNumber);\r\n const lineTokens = model.getLineTokens(range.startLineNumber);\r\n const scopedLineTokens = createScopedLineTokens(lineTokens, range.startColumn - 1);\r\n const scopedLineText = scopedLineTokens.getLineContent();\r\n let embeddedLanguage = false;\r\n let beforeEnterText;\r\n if (scopedLineTokens.firstCharOffset > 0 && lineTokens.getLanguageId(0) !== scopedLineTokens.languageId) {\r\n // we are in the embeded language content\r\n embeddedLanguage = true; // if embeddedLanguage is true, then we don't touch the indentation of current line\r\n beforeEnterText = scopedLineText.substr(0, range.startColumn - 1 - scopedLineTokens.firstCharOffset);\r\n }\r\n else {\r\n beforeEnterText = lineTokens.getLineContent().substring(0, range.startColumn - 1);\r\n }\r\n let afterEnterText;\r\n if (range.isEmpty()) {\r\n afterEnterText = scopedLineText.substr(range.startColumn - 1 - scopedLineTokens.firstCharOffset);\r\n }\r\n else {\r\n const endScopedLineTokens = this.getScopedLineTokens(model, range.endLineNumber, range.endColumn);\r\n afterEnterText = endScopedLineTokens.getLineContent().substr(range.endColumn - 1 - scopedLineTokens.firstCharOffset);\r\n }\r\n const indentRulesSupport = this.getIndentRulesSupport(scopedLineTokens.languageId);\r\n if (!indentRulesSupport) {\r\n return null;\r\n }\r\n const beforeEnterResult = beforeEnterText;\r\n const beforeEnterIndent = strings.getLeadingWhitespace(beforeEnterText);\r\n const virtualModel = {\r\n getLineTokens: (lineNumber) => {\r\n return model.getLineTokens(lineNumber);\r\n },\r\n getLanguageIdentifier: () => {\r\n return model.getLanguageIdentifier();\r\n },\r\n getLanguageIdAtPosition: (lineNumber, column) => {\r\n return model.getLanguageIdAtPosition(lineNumber, column);\r\n },\r\n getLineContent: (lineNumber) => {\r\n if (lineNumber === range.startLineNumber) {\r\n return beforeEnterResult;\r\n }\r\n else {\r\n return model.getLineContent(lineNumber);\r\n }\r\n }\r\n };\r\n const currentLineIndent = strings.getLeadingWhitespace(lineTokens.getLineContent());\r\n const afterEnterAction = this.getInheritIndentForLine(autoIndent, virtualModel, range.startLineNumber + 1);\r\n if (!afterEnterAction) {\r\n const beforeEnter = embeddedLanguage ? currentLineIndent : beforeEnterIndent;\r\n return {\r\n beforeEnter: beforeEnter,\r\n afterEnter: beforeEnter\r\n };\r\n }\r\n let afterEnterIndent = embeddedLanguage ? currentLineIndent : afterEnterAction.indentation;\r\n if (afterEnterAction.action === IndentAction.Indent) {\r\n afterEnterIndent = indentConverter.shiftIndent(afterEnterIndent);\r\n }\r\n if (indentRulesSupport.shouldDecrease(afterEnterText)) {\r\n afterEnterIndent = indentConverter.unshiftIndent(afterEnterIndent);\r\n }\r\n return {\r\n beforeEnter: embeddedLanguage ? currentLineIndent : beforeEnterIndent,\r\n afterEnter: afterEnterIndent\r\n };\r\n }\r\n /**\r\n * We should always allow intentional indentation. It means, if users change the indentation of `lineNumber` and the content of\r\n * this line doesn't match decreaseIndentPattern, we should not adjust the indentation.\r\n */\r\n getIndentActionForType(autoIndent, model, range, ch, indentConverter) {\r\n if (autoIndent < 4 /* Full */) {\r\n return null;\r\n }\r\n const scopedLineTokens = this.getScopedLineTokens(model, range.startLineNumber, range.startColumn);\r\n if (scopedLineTokens.firstCharOffset) {\r\n // this line has mixed languages and indentation rules will not work\r\n return null;\r\n }\r\n const indentRulesSupport = this.getIndentRulesSupport(scopedLineTokens.languageId);\r\n if (!indentRulesSupport) {\r\n return null;\r\n }\r\n const scopedLineText = scopedLineTokens.getLineContent();\r\n const beforeTypeText = scopedLineText.substr(0, range.startColumn - 1 - scopedLineTokens.firstCharOffset);\r\n // selection support\r\n let afterTypeText;\r\n if (range.isEmpty()) {\r\n afterTypeText = scopedLineText.substr(range.startColumn - 1 - scopedLineTokens.firstCharOffset);\r\n }\r\n else {\r\n const endScopedLineTokens = this.getScopedLineTokens(model, range.endLineNumber, range.endColumn);\r\n afterTypeText = endScopedLineTokens.getLineContent().substr(range.endColumn - 1 - scopedLineTokens.firstCharOffset);\r\n }\r\n // If previous content already matches decreaseIndentPattern, it means indentation of this line should already be adjusted\r\n // Users might change the indentation by purpose and we should honor that instead of readjusting.\r\n if (!indentRulesSupport.shouldDecrease(beforeTypeText + afterTypeText) && indentRulesSupport.shouldDecrease(beforeTypeText + ch + afterTypeText)) {\r\n // after typing `ch`, the content matches decreaseIndentPattern, we should adjust the indent to a good manner.\r\n // 1. Get inherited indent action\r\n const r = this.getInheritIndentForLine(autoIndent, model, range.startLineNumber, false);\r\n if (!r) {\r\n return null;\r\n }\r\n let indentation = r.indentation;\r\n if (r.action !== IndentAction.Indent) {\r\n indentation = indentConverter.unshiftIndent(indentation);\r\n }\r\n return indentation;\r\n }\r\n return null;\r\n }\r\n getIndentMetadata(model, lineNumber) {\r\n const indentRulesSupport = this.getIndentRulesSupport(model.getLanguageIdentifier().id);\r\n if (!indentRulesSupport) {\r\n return null;\r\n }\r\n if (lineNumber < 1 || lineNumber > model.getLineCount()) {\r\n return null;\r\n }\r\n return indentRulesSupport.getIndentMetadata(model.getLineContent(lineNumber));\r\n }\r\n // end Indent Rules\r\n // begin onEnter\r\n getEnterAction(autoIndent, model, range) {\r\n const scopedLineTokens = this.getScopedLineTokens(model, range.startLineNumber, range.startColumn);\r\n const richEditSupport = this._getRichEditSupport(scopedLineTokens.languageId);\r\n if (!richEditSupport) {\r\n return null;\r\n }\r\n const scopedLineText = scopedLineTokens.getLineContent();\r\n const beforeEnterText = scopedLineText.substr(0, range.startColumn - 1 - scopedLineTokens.firstCharOffset);\r\n // selection support\r\n let afterEnterText;\r\n if (range.isEmpty()) {\r\n afterEnterText = scopedLineText.substr(range.startColumn - 1 - scopedLineTokens.firstCharOffset);\r\n }\r\n else {\r\n const endScopedLineTokens = this.getScopedLineTokens(model, range.endLineNumber, range.endColumn);\r\n afterEnterText = endScopedLineTokens.getLineContent().substr(range.endColumn - 1 - scopedLineTokens.firstCharOffset);\r\n }\r\n let previousLineText = '';\r\n if (range.startLineNumber > 1 && scopedLineTokens.firstCharOffset === 0) {\r\n // This is not the first line and the entire line belongs to this mode\r\n const oneLineAboveScopedLineTokens = this.getScopedLineTokens(model, range.startLineNumber - 1);\r\n if (oneLineAboveScopedLineTokens.languageId === scopedLineTokens.languageId) {\r\n // The line above ends with text belonging to the same mode\r\n previousLineText = oneLineAboveScopedLineTokens.getLineContent();\r\n }\r\n }\r\n const enterResult = richEditSupport.onEnter(autoIndent, previousLineText, beforeEnterText, afterEnterText);\r\n if (!enterResult) {\r\n return null;\r\n }\r\n const indentAction = enterResult.indentAction;\r\n let appendText = enterResult.appendText;\r\n const removeText = enterResult.removeText || 0;\r\n // Here we add `\\t` to appendText first because enterAction is leveraging appendText and removeText to change indentation.\r\n if (!appendText) {\r\n if ((indentAction === IndentAction.Indent) ||\r\n (indentAction === IndentAction.IndentOutdent)) {\r\n appendText = '\\t';\r\n }\r\n else {\r\n appendText = '';\r\n }\r\n }\r\n else if (indentAction === IndentAction.Indent) {\r\n appendText = '\\t' + appendText;\r\n }\r\n let indentation = this.getIndentationAtPosition(model, range.startLineNumber, range.startColumn);\r\n if (removeText) {\r\n indentation = indentation.substring(0, indentation.length - removeText);\r\n }\r\n return {\r\n indentAction: indentAction,\r\n appendText: appendText,\r\n removeText: removeText,\r\n indentation: indentation\r\n };\r\n }\r\n getIndentationAtPosition(model, lineNumber, column) {\r\n const lineText = model.getLineContent(lineNumber);\r\n let indentation = strings.getLeadingWhitespace(lineText);\r\n if (indentation.length > column - 1) {\r\n indentation = indentation.substring(0, column - 1);\r\n }\r\n return indentation;\r\n }\r\n getScopedLineTokens(model, lineNumber, columnNumber) {\r\n model.forceTokenization(lineNumber);\r\n const lineTokens = model.getLineTokens(lineNumber);\r\n const column = (typeof columnNumber === 'undefined' ? model.getLineMaxColumn(lineNumber) - 1 : columnNumber - 1);\r\n return createScopedLineTokens(lineTokens, column);\r\n }\r\n // end onEnter\r\n getBracketsSupport(languageId) {\r\n const value = this._getRichEditSupport(languageId);\r\n if (!value) {\r\n return null;\r\n }\r\n return value.brackets || null;\r\n }\r\n}\r\nexport const LanguageConfigurationRegistry = new LanguageConfigurationRegistryImpl();\r\n", "/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License. See License.txt in the project root for license information.\r\n *--------------------------------------------------------------------------------------------*/\r\nfunction roundFloat(number, decimalPoints) {\r\n const decimal = Math.pow(10, decimalPoints);\r\n return Math.round(number * decimal) / decimal;\r\n}\r\nexport class RGBA {\r\n constructor(r, g, b, a = 1) {\r\n this._rgbaBrand = undefined;\r\n this.r = Math.min(255, Math.max(0, r)) | 0;\r\n this.g = Math.min(255, Math.max(0, g)) | 0;\r\n this.b = Math.min(255, Math.max(0, b)) | 0;\r\n this.a = roundFloat(Math.max(Math.min(1, a), 0), 3);\r\n }\r\n static equals(a, b) {\r\n return a.r === b.r && a.g === b.g && a.b === b.b && a.a === b.a;\r\n }\r\n}\r\nexport class HSLA {\r\n constructor(h, s, l, a) {\r\n this._hslaBrand = undefined;\r\n this.h = Math.max(Math.min(360, h), 0) | 0;\r\n this.s = roundFloat(Math.max(Math.min(1, s), 0), 3);\r\n this.l = roundFloat(Math.max(Math.min(1, l), 0), 3);\r\n this.a = roundFloat(Math.max(Math.min(1, a), 0), 3);\r\n }\r\n static equals(a, b) {\r\n return a.h === b.h && a.s === b.s && a.l === b.l && a.a === b.a;\r\n }\r\n /**\r\n * Converts an RGB color value to HSL. Conversion formula\r\n * adapted from http://en.wikipedia.org/wiki/HSL_color_space.\r\n * Assumes r, g, and b are contained in the set [0, 255] and\r\n * returns h in the set [0, 360], s, and l in the set [0, 1].\r\n */\r\n static fromRGBA(rgba) {\r\n const r = rgba.r / 255;\r\n const g = rgba.g / 255;\r\n const b = rgba.b / 255;\r\n const a = rgba.a;\r\n const max = Math.max(r, g, b);\r\n const min = Math.min(r, g, b);\r\n let h = 0;\r\n let s = 0;\r\n const l = (min + max) / 2;\r\n const chroma = max - min;\r\n if (chroma > 0) {\r\n s = Math.min((l <= 0.5 ? chroma / (2 * l) : chroma / (2 - (2 * l))), 1);\r\n switch (max) {\r\n case r:\r\n h = (g - b) / chroma + (g < b ? 6 : 0);\r\n break;\r\n case g:\r\n h = (b - r) / chroma + 2;\r\n break;\r\n case b:\r\n h = (r - g) / chroma + 4;\r\n break;\r\n }\r\n h *= 60;\r\n h = Math.round(h);\r\n }\r\n return new HSLA(h, s, l, a);\r\n }\r\n static _hue2rgb(p, q, t) {\r\n if (t < 0) {\r\n t += 1;\r\n }\r\n if (t > 1) {\r\n t -= 1;\r\n }\r\n if (t < 1 / 6) {\r\n return p + (q - p) * 6 * t;\r\n }\r\n if (t < 1 / 2) {\r\n return q;\r\n }\r\n if (t < 2 / 3) {\r\n return p + (q - p) * (2 / 3 - t) * 6;\r\n }\r\n return p;\r\n }\r\n /**\r\n * Converts an HSL color value to RGB. Conversion formula\r\n * adapted from http://en.wikipedia.org/wiki/HSL_color_space.\r\n * Assumes h in the set [0, 360] s, and l are contained in the set [0, 1] and\r\n * returns r, g, and b in the set [0, 255].\r\n */\r\n static toRGBA(hsla) {\r\n const h = hsla.h / 360;\r\n const { s, l, a } = hsla;\r\n let r, g, b;\r\n if (s === 0) {\r\n r = g = b = l; // achromatic\r\n }\r\n else {\r\n const q = l < 0.5 ? l * (1 + s) : l + s - l * s;\r\n const p = 2 * l - q;\r\n r = HSLA._hue2rgb(p, q, h + 1 / 3);\r\n g = HSLA._hue2rgb(p, q, h);\r\n b = HSLA._hue2rgb(p, q, h - 1 / 3);\r\n }\r\n return new RGBA(Math.round(r * 255), Math.round(g * 255), Math.round(b * 255), a);\r\n }\r\n}\r\nexport class HSVA {\r\n constructor(h, s, v, a) {\r\n this._hsvaBrand = undefined;\r\n this.h = Math.max(Math.min(360, h), 0) | 0;\r\n this.s = roundFloat(Math.max(Math.min(1, s), 0), 3);\r\n this.v = roundFloat(Math.max(Math.min(1, v), 0), 3);\r\n this.a = roundFloat(Math.max(Math.min(1, a), 0), 3);\r\n }\r\n static equals(a, b) {\r\n return a.h === b.h && a.s === b.s && a.v === b.v && a.a === b.a;\r\n }\r\n // from http://www.rapidtables.com/convert/color/rgb-to-hsv.htm\r\n static fromRGBA(rgba) {\r\n const r = rgba.r / 255;\r\n const g = rgba.g / 255;\r\n const b = rgba.b / 255;\r\n const cmax = Math.max(r, g, b);\r\n const cmin = Math.min(r, g, b);\r\n const delta = cmax - cmin;\r\n const s = cmax === 0 ? 0 : (delta / cmax);\r\n let m;\r\n if (delta === 0) {\r\n m = 0;\r\n }\r\n else if (cmax === r) {\r\n m = ((((g - b) / delta) % 6) + 6) % 6;\r\n }\r\n else if (cmax === g) {\r\n m = ((b - r) / delta) + 2;\r\n }\r\n else {\r\n m = ((r - g) / delta) + 4;\r\n }\r\n return new HSVA(Math.round(m * 60), s, cmax, rgba.a);\r\n }\r\n // from http://www.rapidtables.com/convert/color/hsv-to-rgb.htm\r\n static toRGBA(hsva) {\r\n const { h, s, v, a } = hsva;\r\n const c = v * s;\r\n const x = c * (1 - Math.abs((h / 60) % 2 - 1));\r\n const m = v - c;\r\n let [r, g, b] = [0, 0, 0];\r\n if (h < 60) {\r\n r = c;\r\n g = x;\r\n }\r\n else if (h < 120) {\r\n r = x;\r\n g = c;\r\n }\r\n else if (h < 180) {\r\n g = c;\r\n b = x;\r\n }\r\n else if (h < 240) {\r\n g = x;\r\n b = c;\r\n }\r\n else if (h < 300) {\r\n r = x;\r\n b = c;\r\n }\r\n else if (h <= 360) {\r\n r = c;\r\n b = x;\r\n }\r\n r = Math.round((r + m) * 255);\r\n g = Math.round((g + m) * 255);\r\n b = Math.round((b + m) * 255);\r\n return new RGBA(r, g, b, a);\r\n }\r\n}\r\nexport class Color {\r\n constructor(arg) {\r\n if (!arg) {\r\n throw new Error('Color needs a value');\r\n }\r\n else if (arg instanceof RGBA) {\r\n this.rgba = arg;\r\n }\r\n else if (arg instanceof HSLA) {\r\n this._hsla = arg;\r\n this.rgba = HSLA.toRGBA(arg);\r\n }\r\n else if (arg instanceof HSVA) {\r\n this._hsva = arg;\r\n this.rgba = HSVA.toRGBA(arg);\r\n }\r\n else {\r\n throw new Error('Invalid color ctor argument');\r\n }\r\n }\r\n static fromHex(hex) {\r\n return Color.Format.CSS.parseHex(hex) || Color.red;\r\n }\r\n get hsla() {\r\n if (this._hsla) {\r\n return this._hsla;\r\n }\r\n else {\r\n return HSLA.fromRGBA(this.rgba);\r\n }\r\n }\r\n get hsva() {\r\n if (this._hsva) {\r\n return this._hsva;\r\n }\r\n return HSVA.fromRGBA(this.rgba);\r\n }\r\n equals(other) {\r\n return !!other && RGBA.equals(this.rgba, other.rgba) && HSLA.equals(this.hsla, other.hsla) && HSVA.equals(this.hsva, other.hsva);\r\n }\r\n /**\r\n * http://www.w3.org/TR/WCAG20/#relativeluminancedef\r\n * Returns the number in the set [0, 1]. O => Darkest Black. 1 => Lightest white.\r\n */\r\n getRelativeLuminance() {\r\n const R = Color._relativeLuminanceForComponent(this.rgba.r);\r\n const G = Color._relativeLuminanceForComponent(this.rgba.g);\r\n const B = Color._relativeLuminanceForComponent(this.rgba.b);\r\n const luminance = 0.2126 * R + 0.7152 * G + 0.0722 * B;\r\n return roundFloat(luminance, 4);\r\n }\r\n static _relativeLuminanceForComponent(color) {\r\n const c = color / 255;\r\n return (c <= 0.03928) ? c / 12.92 : Math.pow(((c + 0.055) / 1.055), 2.4);\r\n }\r\n /**\r\n *\thttp://24ways.org/2010/calculating-color-contrast\r\n * Return 'true' if lighter color otherwise 'false'\r\n */\r\n isLighter() {\r\n const yiq = (this.rgba.r * 299 + this.rgba.g * 587 + this.rgba.b * 114) / 1000;\r\n return yiq >= 128;\r\n }\r\n isLighterThan(another) {\r\n const lum1 = this.getRelativeLuminance();\r\n const lum2 = another.getRelativeLuminance();\r\n return lum1 > lum2;\r\n }\r\n isDarkerThan(another) {\r\n const lum1 = this.getRelativeLuminance();\r\n const lum2 = another.getRelativeLuminance();\r\n return lum1 < lum2;\r\n }\r\n lighten(factor) {\r\n return new Color(new HSLA(this.hsla.h, this.hsla.s, this.hsla.l + this.hsla.l * factor, this.hsla.a));\r\n }\r\n darken(factor) {\r\n return new Color(new HSLA(this.hsla.h, this.hsla.s, this.hsla.l - this.hsla.l * factor, this.hsla.a));\r\n }\r\n transparent(factor) {\r\n const { r, g, b, a } = this.rgba;\r\n return new Color(new RGBA(r, g, b, a * factor));\r\n }\r\n isTransparent() {\r\n return this.rgba.a === 0;\r\n }\r\n isOpaque() {\r\n return this.rgba.a === 1;\r\n }\r\n opposite() {\r\n return new Color(new RGBA(255 - this.rgba.r, 255 - this.rgba.g, 255 - this.rgba.b, this.rgba.a));\r\n }\r\n toString() {\r\n return '' + Color.Format.CSS.format(this);\r\n }\r\n static getLighterColor(of, relative, factor) {\r\n if (of.isLighterThan(relative)) {\r\n return of;\r\n }\r\n factor = factor ? factor : 0.5;\r\n const lum1 = of.getRelativeLuminance();\r\n const lum2 = relative.getRelativeLuminance();\r\n factor = factor * (lum2 - lum1) / lum2;\r\n return of.lighten(factor);\r\n }\r\n static getDarkerColor(of, relative, factor) {\r\n if (of.isDarkerThan(relative)) {\r\n return of;\r\n }\r\n factor = factor ? factor : 0.5;\r\n const lum1 = of.getRelativeLuminance();\r\n const lum2 = relative.getRelativeLuminance();\r\n factor = factor * (lum1 - lum2) / lum1;\r\n return of.darken(factor);\r\n }\r\n}\r\nColor.white = new Color(new RGBA(255, 255, 255, 1));\r\nColor.black = new Color(new RGBA(0, 0, 0, 1));\r\nColor.red = new Color(new RGBA(255, 0, 0, 1));\r\nColor.blue = new Color(new RGBA(0, 0, 255, 1));\r\nColor.cyan = new Color(new RGBA(0, 255, 255, 1));\r\nColor.lightgrey = new Color(new RGBA(211, 211, 211, 1));\r\nColor.transparent = new Color(new RGBA(0, 0, 0, 0));\r\n(function (Color) {\r\n let Format;\r\n (function (Format) {\r\n let CSS;\r\n (function (CSS) {\r\n function formatRGB(color) {\r\n if (color.rgba.a === 1) {\r\n return `rgb(${color.rgba.r}, ${color.rgba.g}, ${color.rgba.b})`;\r\n }\r\n return Color.Format.CSS.formatRGBA(color);\r\n }\r\n CSS.formatRGB = formatRGB;\r\n function formatRGBA(color) {\r\n return `rgba(${color.rgba.r}, ${color.rgba.g}, ${color.rgba.b}, ${+(color.rgba.a).toFixed(2)})`;\r\n }\r\n CSS.formatRGBA = formatRGBA;\r\n function formatHSL(color) {\r\n if (color.hsla.a === 1) {\r\n return `hsl(${color.hsla.h}, ${(color.hsla.s * 100).toFixed(2)}%, ${(color.hsla.l * 100).toFixed(2)}%)`;\r\n }\r\n return Color.Format.CSS.formatHSLA(color);\r\n }\r\n CSS.formatHSL = formatHSL;\r\n function formatHSLA(color) {\r\n return `hsla(${color.hsla.h}, ${(color.hsla.s * 100).toFixed(2)}%, ${(color.hsla.l * 100).toFixed(2)}%, ${color.hsla.a.toFixed(2)})`;\r\n }\r\n CSS.formatHSLA = formatHSLA;\r\n function _toTwoDigitHex(n) {\r\n const r = n.toString(16);\r\n return r.length !== 2 ? '0' + r : r;\r\n }\r\n /**\r\n * Formats the color as #RRGGBB\r\n */\r\n function formatHex(color) {\r\n return `#${_toTwoDigitHex(color.rgba.r)}${_toTwoDigitHex(color.rgba.g)}${_toTwoDigitHex(color.rgba.b)}`;\r\n }\r\n CSS.formatHex = formatHex;\r\n /**\r\n * Formats the color as #RRGGBBAA\r\n * If 'compact' is set, colors without transparancy will be printed as #RRGGBB\r\n */\r\n function formatHexA(color, compact = false) {\r\n if (compact && color.rgba.a === 1) {\r\n return Color.Format.CSS.formatHex(color);\r\n }\r\n return `#${_toTwoDigitHex(color.rgba.r)}${_toTwoDigitHex(color.rgba.g)}${_toTwoDigitHex(color.rgba.b)}${_toTwoDigitHex(Math.round(color.rgba.a * 255))}`;\r\n }\r\n CSS.formatHexA = formatHexA;\r\n /**\r\n * The default format will use HEX if opaque and RGBA otherwise.\r\n */\r\n function format(color) {\r\n if (color.isOpaque()) {\r\n return Color.Format.CSS.formatHex(color);\r\n }\r\n return Color.Format.CSS.formatRGBA(color);\r\n }\r\n CSS.format = format;\r\n /**\r\n * Converts an Hex color value to a Color.\r\n * returns r, g, and b are contained in the set [0, 255]\r\n * @param hex string (#RGB, #RGBA, #RRGGBB or #RRGGBBAA).\r\n */\r\n function parseHex(hex) {\r\n const length = hex.length;\r\n if (length === 0) {\r\n // Invalid color\r\n return null;\r\n }\r\n if (hex.charCodeAt(0) !== 35 /* Hash */) {\r\n // Does not begin with a #\r\n return null;\r\n }\r\n if (length === 7) {\r\n // #RRGGBB format\r\n const r = 16 * _parseHexDigit(hex.charCodeAt(1)) + _parseHexDigit(hex.charCodeAt(2));\r\n const g = 16 * _parseHexDigit(hex.charCodeAt(3)) + _parseHexDigit(hex.charCodeAt(4));\r\n const b = 16 * _parseHexDigit(hex.charCodeAt(5)) + _parseHexDigit(hex.charCodeAt(6));\r\n return new Color(new RGBA(r, g, b, 1));\r\n }\r\n if (length === 9) {\r\n // #RRGGBBAA format\r\n const r = 16 * _parseHexDigit(hex.charCodeAt(1)) + _parseHexDigit(hex.charCodeAt(2));\r\n const g = 16 * _parseHexDigit(hex.charCodeAt(3)) + _parseHexDigit(hex.charCodeAt(4));\r\n const b = 16 * _parseHexDigit(hex.charCodeAt(5)) + _parseHexDigit(hex.charCodeAt(6));\r\n const a = 16 * _parseHexDigit(hex.charCodeAt(7)) + _parseHexDigit(hex.charCodeAt(8));\r\n return new Color(new RGBA(r, g, b, a / 255));\r\n }\r\n if (length === 4) {\r\n // #RGB format\r\n const r = _parseHexDigit(hex.charCodeAt(1));\r\n const g = _parseHexDigit(hex.charCodeAt(2));\r\n const b = _parseHexDigit(hex.charCodeAt(3));\r\n return new Color(new RGBA(16 * r + r, 16 * g + g, 16 * b + b));\r\n }\r\n if (length === 5) {\r\n // #RGBA format\r\n const r = _parseHexDigit(hex.charCodeAt(1));\r\n const g = _parseHexDigit(hex.charCodeAt(2));\r\n const b = _parseHexDigit(hex.charCodeAt(3));\r\n const a = _parseHexDigit(hex.charCodeAt(4));\r\n return new Color(new RGBA(16 * r + r, 16 * g + g, 16 * b + b, (16 * a + a) / 255));\r\n }\r\n // Invalid color\r\n return null;\r\n }\r\n CSS.parseHex = parseHex;\r\n function _parseHexDigit(charCode) {\r\n switch (charCode) {\r\n case 48 /* Digit0 */: return 0;\r\n case 49 /* Digit1 */: return 1;\r\n case 50 /* Digit2 */: return 2;\r\n case 51 /* Digit3 */: return 3;\r\n case 52 /* Digit4 */: return 4;\r\n case 53 /* Digit5 */: return 5;\r\n case 54 /* Digit6 */: return 6;\r\n case 55 /* Digit7 */: return 7;\r\n case 56 /* Digit8 */: return 8;\r\n case 57 /* Digit9 */: return 9;\r\n case 97 /* a */: return 10;\r\n case 65 /* A */: return 10;\r\n case 98 /* b */: return 11;\r\n case 66 /* B */: return 11;\r\n case 99 /* c */: return 12;\r\n case 67 /* C */: return 12;\r\n case 100 /* d */: return 13;\r\n case 68 /* D */: return 13;\r\n case 101 /* e */: return 14;\r\n case 69 /* E */: return 14;\r\n case 102 /* f */: return 15;\r\n case 70 /* F */: return 15;\r\n }\r\n return 0;\r\n }\r\n })(CSS = Format.CSS || (Format.CSS = {}));\r\n })(Format = Color.Format || (Color.Format = {}));\r\n})(Color || (Color = {}));\r\n", "/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License. See License.txt in the project root for license information.\r\n *--------------------------------------------------------------------------------------------*/\r\nimport { onUnexpectedError } from '../../../base/common/errors.js';\r\nimport { Emitter } from '../../../base/common/event.js';\r\nimport { Disposable } from '../../../base/common/lifecycle.js';\r\nimport * as strings from '../../../base/common/strings.js';\r\nimport { URI } from '../../../base/common/uri.js';\r\nimport { EDITOR_MODEL_DEFAULTS } from '../config/editorOptions.js';\r\nimport { Position } from '../core/position.js';\r\nimport { Range } from '../core/range.js';\r\nimport { Selection } from '../core/selection.js';\r\nimport * as model from '../model.js';\r\nimport { EditStack } from './editStack.js';\r\nimport { guessIndentation } from './indentationGuesser.js';\r\nimport { IntervalNode, IntervalTree, recomputeMaxEnd } from './intervalTree.js';\r\nimport { PieceTreeTextBufferBuilder } from './pieceTreeTextBuffer/pieceTreeTextBufferBuilder.js';\r\nimport { InternalModelContentChangeEvent, LineInjectedText, ModelInjectedTextChangedEvent, ModelRawContentChangedEvent, ModelRawEOLChanged, ModelRawFlush, ModelRawLineChanged, ModelRawLinesDeleted, ModelRawLinesInserted } from './textModelEvents.js';\r\nimport { SearchParams, TextModelSearch } from './textModelSearch.js';\r\nimport { TextModelTokenization } from './textModelTokens.js';\r\nimport { getWordAtText } from './wordHelper.js';\r\nimport { LanguageConfigurationRegistry } from '../modes/languageConfigurationRegistry.js';\r\nimport { NULL_LANGUAGE_IDENTIFIER } from '../modes/nullMode.js';\r\nimport { ignoreBracketsInToken } from '../modes/supports.js';\r\nimport { BracketsUtils } from '../modes/supports/richEditBrackets.js';\r\nimport { TokensStore, countEOL, TokensStore2 } from './tokensStore.js';\r\nimport { Color } from '../../../base/common/color.js';\r\nimport { PieceTreeTextBuffer } from './pieceTreeTextBuffer/pieceTreeTextBuffer.js';\r\nimport { ArrayQueue } from '../../../base/common/arrays.js';\r\nfunction createTextBufferBuilder() {\r\n return new PieceTreeTextBufferBuilder();\r\n}\r\nexport function createTextBufferFactory(text) {\r\n const builder = createTextBufferBuilder();\r\n builder.acceptChunk(text);\r\n return builder.finish();\r\n}\r\nexport function createTextBuffer(value, defaultEOL) {\r\n const factory = (typeof value === 'string' ? createTextBufferFactory(value) : value);\r\n return factory.create(defaultEOL);\r\n}\r\nlet MODEL_ID = 0;\r\nconst LIMIT_FIND_COUNT = 999;\r\nexport const LONG_LINE_BOUNDARY = 10000;\r\nclass TextModelSnapshot {\r\n constructor(source) {\r\n this._source = source;\r\n this._eos = false;\r\n }\r\n read() {\r\n if (this._eos) {\r\n return null;\r\n }\r\n let result = [], resultCnt = 0, resultLength = 0;\r\n do {\r\n let tmp = this._source.read();\r\n if (tmp === null) {\r\n // end-of-stream\r\n this._eos = true;\r\n if (resultCnt === 0) {\r\n return null;\r\n }\r\n else {\r\n return result.join('');\r\n }\r\n }\r\n if (tmp.length > 0) {\r\n result[resultCnt++] = tmp;\r\n resultLength += tmp.length;\r\n }\r\n if (resultLength >= 64 * 1024) {\r\n return result.join('');\r\n }\r\n } while (true);\r\n }\r\n}\r\nconst invalidFunc = () => { throw new Error(`Invalid change accessor`); };\r\nclass BracketSearchCanceled {\r\n constructor() {\r\n this._searchCanceledBrand = undefined;\r\n }\r\n}\r\nBracketSearchCanceled.INSTANCE = new BracketSearchCanceled();\r\nfunction stripBracketSearchCanceled(result) {\r\n if (result instanceof BracketSearchCanceled) {\r\n return null;\r\n }\r\n return result;\r\n}\r\nexport class TextModel extends Disposable {\r\n //#endregion\r\n constructor(source, creationOptions, languageIdentifier, associatedResource = null, undoRedoService) {\r\n super();\r\n //#region Events\r\n this._onWillDispose = this._register(new Emitter());\r\n this.onWillDispose = this._onWillDispose.event;\r\n this._onDidChangeDecorations = this._register(new DidChangeDecorationsEmitter(affectedInjectedTextLines => this.handleBeforeFireDecorationsChangedEvent(affectedInjectedTextLines)));\r\n this.onDidChangeDecorations = this._onDidChangeDecorations.event;\r\n this._onDidChangeLanguage = this._register(new Emitter());\r\n this.onDidChangeLanguage = this._onDidChangeLanguage.event;\r\n this._onDidChangeLanguageConfiguration = this._register(new Emitter());\r\n this.onDidChangeLanguageConfiguration = this._onDidChangeLanguageConfiguration.event;\r\n this._onDidChangeTokens = this._register(new Emitter());\r\n this.onDidChangeTokens = this._onDidChangeTokens.event;\r\n this._onDidChangeOptions = this._register(new Emitter());\r\n this.onDidChangeOptions = this._onDidChangeOptions.event;\r\n this._onDidChangeAttached = this._register(new Emitter());\r\n this.onDidChangeAttached = this._onDidChangeAttached.event;\r\n this._onDidChangeContentOrInjectedText = this._register(new Emitter());\r\n this.onDidChangeContentOrInjectedText = this._onDidChangeContentOrInjectedText.event;\r\n this._eventEmitter = this._register(new DidChangeContentEmitter());\r\n this._register(this._eventEmitter.fastEvent((e) => {\r\n this._onDidChangeContentOrInjectedText.fire(e.rawContentChangedEvent);\r\n }));\r\n // Generate a new unique model id\r\n MODEL_ID++;\r\n this.id = '$model' + MODEL_ID;\r\n this.isForSimpleWidget = creationOptions.isForSimpleWidget;\r\n if (typeof associatedResource === 'undefined' || associatedResource === null) {\r\n this._associatedResource = URI.parse('inmemory://model/' + MODEL_ID);\r\n }\r\n else {\r\n this._associatedResource = associatedResource;\r\n }\r\n this._undoRedoService = undoRedoService;\r\n this._attachedEditorCount = 0;\r\n const { textBuffer, disposable } = createTextBuffer(source, creationOptions.defaultEOL);\r\n this._buffer = textBuffer;\r\n this._bufferDisposable = disposable;\r\n this._options = TextModel.resolveOptions(this._buffer, creationOptions);\r\n const bufferLineCount = this._buffer.getLineCount();\r\n const bufferTextLength = this._buffer.getValueLengthInRange(new Range(1, 1, bufferLineCount, this._buffer.getLineLength(bufferLineCount) + 1), 0 /* TextDefined */);\r\n // !!! Make a decision in the ctor and permanently respect this decision !!!\r\n // If a model is too large at construction time, it will never get tokenized,\r\n // under no circumstances.\r\n if (creationOptions.largeFileOptimizations) {\r\n this._isTooLargeForTokenization = ((bufferTextLength > TextModel.LARGE_FILE_SIZE_THRESHOLD)\r\n || (bufferLineCount > TextModel.LARGE_FILE_LINE_COUNT_THRESHOLD));\r\n }\r\n else {\r\n this._isTooLargeForTokenization = false;\r\n }\r\n this._isTooLargeForSyncing = (bufferTextLength > TextModel.MODEL_SYNC_LIMIT);\r\n this._versionId = 1;\r\n this._alternativeVersionId = 1;\r\n this._initialUndoRedoSnapshot = null;\r\n this._isDisposed = false;\r\n this._isDisposing = false;\r\n this._languageIdentifier = languageIdentifier || NULL_LANGUAGE_IDENTIFIER;\r\n this._languageRegistryListener = LanguageConfigurationRegistry.onDidChange((e) => {\r\n if (e.languageIdentifier.id === this._languageIdentifier.id) {\r\n this._onDidChangeLanguageConfiguration.fire({});\r\n }\r\n });\r\n this._instanceId = strings.singleLetterHash(MODEL_ID);\r\n this._lastDecorationId = 0;\r\n this._decorations = Object.create(null);\r\n this._decorationsTree = new DecorationsTrees();\r\n this._commandManager = new EditStack(this, undoRedoService);\r\n this._isUndoing = false;\r\n this._isRedoing = false;\r\n this._trimAutoWhitespaceLines = null;\r\n this._tokens = new TokensStore();\r\n this._tokens2 = new TokensStore2();\r\n this._tokenization = new TextModelTokenization(this);\r\n }\r\n static resolveOptions(textBuffer, options) {\r\n if (options.detectIndentation) {\r\n const guessedIndentation = guessIndentation(textBuffer, options.tabSize, options.insertSpaces);\r\n return new model.TextModelResolvedOptions({\r\n tabSize: guessedIndentation.tabSize,\r\n indentSize: guessedIndentation.tabSize,\r\n insertSpaces: guessedIndentation.insertSpaces,\r\n trimAutoWhitespace: options.trimAutoWhitespace,\r\n defaultEOL: options.defaultEOL\r\n });\r\n }\r\n return new model.TextModelResolvedOptions({\r\n tabSize: options.tabSize,\r\n indentSize: options.indentSize,\r\n insertSpaces: options.insertSpaces,\r\n trimAutoWhitespace: options.trimAutoWhitespace,\r\n defaultEOL: options.defaultEOL\r\n });\r\n }\r\n onDidChangeContentFast(listener) {\r\n return this._eventEmitter.fastEvent((e) => listener(e.contentChangedEvent));\r\n }\r\n onDidChangeContent(listener) {\r\n return this._eventEmitter.slowEvent((e) => listener(e.contentChangedEvent));\r\n }\r\n dispose() {\r\n this._isDisposing = true;\r\n this._onWillDispose.fire();\r\n this._languageRegistryListener.dispose();\r\n this._tokenization.dispose();\r\n this._isDisposed = true;\r\n super.dispose();\r\n this._bufferDisposable.dispose();\r\n this._isDisposing = false;\r\n // Manually release reference to previous text buffer to avoid large leaks\r\n // in case someone leaks a TextModel reference\r\n const emptyDisposedTextBuffer = new PieceTreeTextBuffer([], '', '\\n', false, false, true, true);\r\n emptyDisposedTextBuffer.dispose();\r\n this._buffer = emptyDisposedTextBuffer;\r\n }\r\n _assertNotDisposed() {\r\n if (this._isDisposed) {\r\n throw new Error('Model is disposed!');\r\n }\r\n }\r\n _emitContentChangedEvent(rawChange, change) {\r\n if (this._isDisposing) {\r\n // Do not confuse listeners by emitting any event after disposing\r\n return;\r\n }\r\n this._eventEmitter.fire(new InternalModelContentChangeEvent(rawChange, change));\r\n }\r\n setValue(value) {\r\n this._assertNotDisposed();\r\n if (value === null) {\r\n // There's nothing to do\r\n return;\r\n }\r\n const { textBuffer, disposable } = createTextBuffer(value, this._options.defaultEOL);\r\n this._setValueFromTextBuffer(textBuffer, disposable);\r\n }\r\n _createContentChanged2(range, rangeOffset, rangeLength, text, isUndoing, isRedoing, isFlush) {\r\n return {\r\n changes: [{\r\n range: range,\r\n rangeOffset: rangeOffset,\r\n rangeLength: rangeLength,\r\n text: text,\r\n }],\r\n eol: this._buffer.getEOL(),\r\n versionId: this.getVersionId(),\r\n isUndoing: isUndoing,\r\n isRedoing: isRedoing,\r\n isFlush: isFlush\r\n };\r\n }\r\n _setValueFromTextBuffer(textBuffer, textBufferDisposable) {\r\n this._assertNotDisposed();\r\n const oldFullModelRange = this.getFullModelRange();\r\n const oldModelValueLength = this.getValueLengthInRange(oldFullModelRange);\r\n const endLineNumber = this.getLineCount();\r\n const endColumn = this.getLineMaxColumn(endLineNumber);\r\n this._buffer = textBuffer;\r\n this._bufferDisposable.dispose();\r\n this._bufferDisposable = textBufferDisposable;\r\n this._increaseVersionId();\r\n // Flush all tokens\r\n this._tokens.flush();\r\n this._tokens2.flush();\r\n // Destroy all my decorations\r\n this._decorations = Object.create(null);\r\n this._decorationsTree = new DecorationsTrees();\r\n // Destroy my edit history and settings\r\n this._commandManager.clear();\r\n this._trimAutoWhitespaceLines = null;\r\n this._emitContentChangedEvent(new ModelRawContentChangedEvent([\r\n new ModelRawFlush()\r\n ], this._versionId, false, false), this._createContentChanged2(new Range(1, 1, endLineNumber, endColumn), 0, oldModelValueLength, this.getValue(), false, false, true));\r\n }\r\n setEOL(eol) {\r\n this._assertNotDisposed();\r\n const newEOL = (eol === 1 /* CRLF */ ? '\\r\\n' : '\\n');\r\n if (this._buffer.getEOL() === newEOL) {\r\n // Nothing to do\r\n return;\r\n }\r\n const oldFullModelRange = this.getFullModelRange();\r\n const oldModelValueLength = this.getValueLengthInRange(oldFullModelRange);\r\n const endLineNumber = this.getLineCount();\r\n const endColumn = this.getLineMaxColumn(endLineNumber);\r\n this._onBeforeEOLChange();\r\n this._buffer.setEOL(newEOL);\r\n this._increaseVersionId();\r\n this._onAfterEOLChange();\r\n this._emitContentChangedEvent(new ModelRawContentChangedEvent([\r\n new ModelRawEOLChanged()\r\n ], this._versionId, false, false), this._createContentChanged2(new Range(1, 1, endLineNumber, endColumn), 0, oldModelValueLength, this.getValue(), false, false, false));\r\n }\r\n _onBeforeEOLChange() {\r\n // Ensure all decorations get their `range` set.\r\n this._decorationsTree.ensureAllNodesHaveRanges(this);\r\n }\r\n _onAfterEOLChange() {\r\n // Transform back `range` to offsets\r\n const versionId = this.getVersionId();\r\n const allDecorations = this._decorationsTree.collectNodesPostOrder();\r\n for (let i = 0, len = allDecorations.length; i < len; i++) {\r\n const node = allDecorations[i];\r\n const range = node.range; // the range is defined due to `_onBeforeEOLChange`\r\n const delta = node.cachedAbsoluteStart - node.start;\r\n const startOffset = this._buffer.getOffsetAt(range.startLineNumber, range.startColumn);\r\n const endOffset = this._buffer.getOffsetAt(range.endLineNumber, range.endColumn);\r\n node.cachedAbsoluteStart = startOffset;\r\n node.cachedAbsoluteEnd = endOffset;\r\n node.cachedVersionId = versionId;\r\n node.start = startOffset - delta;\r\n node.end = endOffset - delta;\r\n recomputeMaxEnd(node);\r\n }\r\n }\r\n onBeforeAttached() {\r\n this._attachedEditorCount++;\r\n if (this._attachedEditorCount === 1) {\r\n this._onDidChangeAttached.fire(undefined);\r\n }\r\n }\r\n onBeforeDetached() {\r\n this._attachedEditorCount--;\r\n if (this._attachedEditorCount === 0) {\r\n this._onDidChangeAttached.fire(undefined);\r\n }\r\n }\r\n isAttachedToEditor() {\r\n return this._attachedEditorCount > 0;\r\n }\r\n getAttachedEditorCount() {\r\n return this._attachedEditorCount;\r\n }\r\n isTooLargeForSyncing() {\r\n return this._isTooLargeForSyncing;\r\n }\r\n isTooLargeForTokenization() {\r\n return this._isTooLargeForTokenization;\r\n }\r\n isDisposed() {\r\n return this._isDisposed;\r\n }\r\n isDominatedByLongLines() {\r\n this._assertNotDisposed();\r\n if (this.isTooLargeForTokenization()) {\r\n // Cannot word wrap huge files anyways, so it doesn't really matter\r\n return false;\r\n }\r\n let smallLineCharCount = 0;\r\n let longLineCharCount = 0;\r\n const lineCount = this._buffer.getLineCount();\r\n for (let lineNumber = 1; lineNumber <= lineCount; lineNumber++) {\r\n const lineLength = this._buffer.getLineLength(lineNumber);\r\n if (lineLength >= LONG_LINE_BOUNDARY) {\r\n longLineCharCount += lineLength;\r\n }\r\n else {\r\n smallLineCharCount += lineLength;\r\n }\r\n }\r\n return (longLineCharCount > smallLineCharCount);\r\n }\r\n get uri() {\r\n return this._associatedResource;\r\n }\r\n //#region Options\r\n getOptions() {\r\n this._assertNotDisposed();\r\n return this._options;\r\n }\r\n getFormattingOptions() {\r\n return {\r\n tabSize: this._options.indentSize,\r\n insertSpaces: this._options.insertSpaces\r\n };\r\n }\r\n updateOptions(_newOpts) {\r\n this._assertNotDisposed();\r\n let tabSize = (typeof _newOpts.tabSize !== 'undefined') ? _newOpts.tabSize : this._options.tabSize;\r\n let indentSize = (typeof _newOpts.indentSize !== 'undefined') ? _newOpts.indentSize : this._options.indentSize;\r\n let insertSpaces = (typeof _newOpts.insertSpaces !== 'undefined') ? _newOpts.insertSpaces : this._options.insertSpaces;\r\n let trimAutoWhitespace = (typeof _newOpts.trimAutoWhitespace !== 'undefined') ? _newOpts.trimAutoWhitespace : this._options.trimAutoWhitespace;\r\n let newOpts = new model.TextModelResolvedOptions({\r\n tabSize: tabSize,\r\n indentSize: indentSize,\r\n insertSpaces: insertSpaces,\r\n defaultEOL: this._options.defaultEOL,\r\n trimAutoWhitespace: trimAutoWhitespace\r\n });\r\n if (this._options.equals(newOpts)) {\r\n return;\r\n }\r\n let e = this._options.createChangeEvent(newOpts);\r\n this._options = newOpts;\r\n this._onDidChangeOptions.fire(e);\r\n }\r\n detectIndentation(defaultInsertSpaces, defaultTabSize) {\r\n this._assertNotDisposed();\r\n let guessedIndentation = guessIndentation(this._buffer, defaultTabSize, defaultInsertSpaces);\r\n this.updateOptions({\r\n insertSpaces: guessedIndentation.insertSpaces,\r\n tabSize: guessedIndentation.tabSize,\r\n indentSize: guessedIndentation.tabSize, // TODO@Alex: guess indentSize independent of tabSize\r\n });\r\n }\r\n static _normalizeIndentationFromWhitespace(str, indentSize, insertSpaces) {\r\n let spacesCnt = 0;\r\n for (let i = 0; i < str.length; i++) {\r\n if (str.charAt(i) === '\\t') {\r\n spacesCnt += indentSize;\r\n }\r\n else {\r\n spacesCnt++;\r\n }\r\n }\r\n let result = '';\r\n if (!insertSpaces) {\r\n let tabsCnt = Math.floor(spacesCnt / indentSize);\r\n spacesCnt = spacesCnt % indentSize;\r\n for (let i = 0; i < tabsCnt; i++) {\r\n result += '\\t';\r\n }\r\n }\r\n for (let i = 0; i < spacesCnt; i++) {\r\n result += ' ';\r\n }\r\n return result;\r\n }\r\n static normalizeIndentation(str, indentSize, insertSpaces) {\r\n let firstNonWhitespaceIndex = strings.firstNonWhitespaceIndex(str);\r\n if (firstNonWhitespaceIndex === -1) {\r\n firstNonWhitespaceIndex = str.length;\r\n }\r\n return TextModel._normalizeIndentationFromWhitespace(str.substring(0, firstNonWhitespaceIndex), indentSize, insertSpaces) + str.substring(firstNonWhitespaceIndex);\r\n }\r\n normalizeIndentation(str) {\r\n this._assertNotDisposed();\r\n return TextModel.normalizeIndentation(str, this._options.indentSize, this._options.insertSpaces);\r\n }\r\n //#endregion\r\n //#region Reading\r\n getVersionId() {\r\n this._assertNotDisposed();\r\n return this._versionId;\r\n }\r\n mightContainRTL() {\r\n return this._buffer.mightContainRTL();\r\n }\r\n mightContainUnusualLineTerminators() {\r\n return this._buffer.mightContainUnusualLineTerminators();\r\n }\r\n removeUnusualLineTerminators(selections = null) {\r\n const matches = this.findMatches(strings.UNUSUAL_LINE_TERMINATORS.source, false, true, false, null, false, 1073741824 /* MAX_SAFE_SMALL_INTEGER */);\r\n this._buffer.resetMightContainUnusualLineTerminators();\r\n this.pushEditOperations(selections, matches.map(m => ({ range: m.range, text: null })), () => null);\r\n }\r\n mightContainNonBasicASCII() {\r\n return this._buffer.mightContainNonBasicASCII();\r\n }\r\n getAlternativeVersionId() {\r\n this._assertNotDisposed();\r\n return this._alternativeVersionId;\r\n }\r\n getInitialUndoRedoSnapshot() {\r\n this._assertNotDisposed();\r\n return this._initialUndoRedoSnapshot;\r\n }\r\n getOffsetAt(rawPosition) {\r\n this._assertNotDisposed();\r\n let position = this._validatePosition(rawPosition.lineNumber, rawPosition.column, 0 /* Relaxed */);\r\n return this._buffer.getOffsetAt(position.lineNumber, position.column);\r\n }\r\n getPositionAt(rawOffset) {\r\n this._assertNotDisposed();\r\n let offset = (Math.min(this._buffer.getLength(), Math.max(0, rawOffset)));\r\n return this._buffer.getPositionAt(offset);\r\n }\r\n _increaseVersionId() {\r\n this._versionId = this._versionId + 1;\r\n this._alternativeVersionId = this._versionId;\r\n }\r\n _overwriteVersionId(versionId) {\r\n this._versionId = versionId;\r\n }\r\n _overwriteAlternativeVersionId(newAlternativeVersionId) {\r\n this._alternativeVersionId = newAlternativeVersionId;\r\n }\r\n _overwriteInitialUndoRedoSnapshot(newInitialUndoRedoSnapshot) {\r\n this._initialUndoRedoSnapshot = newInitialUndoRedoSnapshot;\r\n }\r\n getValue(eol, preserveBOM = false) {\r\n this._assertNotDisposed();\r\n const fullModelRange = this.getFullModelRange();\r\n const fullModelValue = this.getValueInRange(fullModelRange, eol);\r\n if (preserveBOM) {\r\n return this._buffer.getBOM() + fullModelValue;\r\n }\r\n return fullModelValue;\r\n }\r\n createSnapshot(preserveBOM = false) {\r\n return new TextModelSnapshot(this._buffer.createSnapshot(preserveBOM));\r\n }\r\n getValueLength(eol, preserveBOM = false) {\r\n this._assertNotDisposed();\r\n const fullModelRange = this.getFullModelRange();\r\n const fullModelValue = this.getValueLengthInRange(fullModelRange, eol);\r\n if (preserveBOM) {\r\n return this._buffer.getBOM().length + fullModelValue;\r\n }\r\n return fullModelValue;\r\n }\r\n getValueInRange(rawRange, eol = 0 /* TextDefined */) {\r\n this._assertNotDisposed();\r\n return this._buffer.getValueInRange(this.validateRange(rawRange), eol);\r\n }\r\n getValueLengthInRange(rawRange, eol = 0 /* TextDefined */) {\r\n this._assertNotDisposed();\r\n return this._buffer.getValueLengthInRange(this.validateRange(rawRange), eol);\r\n }\r\n getCharacterCountInRange(rawRange, eol = 0 /* TextDefined */) {\r\n this._assertNotDisposed();\r\n return this._buffer.getCharacterCountInRange(this.validateRange(rawRange), eol);\r\n }\r\n getLineCount() {\r\n this._assertNotDisposed();\r\n return this._buffer.getLineCount();\r\n }\r\n getLineContent(lineNumber) {\r\n this._assertNotDisposed();\r\n if (lineNumber < 1 || lineNumber > this.getLineCount()) {\r\n throw new Error('Illegal value for lineNumber');\r\n }\r\n return this._buffer.getLineContent(lineNumber);\r\n }\r\n getLineLength(lineNumber) {\r\n this._assertNotDisposed();\r\n if (lineNumber < 1 || lineNumber > this.getLineCount()) {\r\n throw new Error('Illegal value for lineNumber');\r\n }\r\n return this._buffer.getLineLength(lineNumber);\r\n }\r\n getLinesContent() {\r\n this._assertNotDisposed();\r\n return this._buffer.getLinesContent();\r\n }\r\n getEOL() {\r\n this._assertNotDisposed();\r\n return this._buffer.getEOL();\r\n }\r\n getEndOfLineSequence() {\r\n this._assertNotDisposed();\r\n return (this._buffer.getEOL() === '\\n'\r\n ? 0 /* LF */\r\n : 1 /* CRLF */);\r\n }\r\n getLineMinColumn(lineNumber) {\r\n this._assertNotDisposed();\r\n return 1;\r\n }\r\n getLineMaxColumn(lineNumber) {\r\n this._assertNotDisposed();\r\n if (lineNumber < 1 || lineNumber > this.getLineCount()) {\r\n throw new Error('Illegal value for lineNumber');\r\n }\r\n return this._buffer.getLineLength(lineNumber) + 1;\r\n }\r\n getLineFirstNonWhitespaceColumn(lineNumber) {\r\n this._assertNotDisposed();\r\n if (lineNumber < 1 || lineNumber > this.getLineCount()) {\r\n throw new Error('Illegal value for lineNumber');\r\n }\r\n return this._buffer.getLineFirstNonWhitespaceColumn(lineNumber);\r\n }\r\n getLineLastNonWhitespaceColumn(lineNumber) {\r\n this._assertNotDisposed();\r\n if (lineNumber < 1 || lineNumber > this.getLineCount()) {\r\n throw new Error('Illegal value for lineNumber');\r\n }\r\n return this._buffer.getLineLastNonWhitespaceColumn(lineNumber);\r\n }\r\n /**\r\n * Validates `range` is within buffer bounds, but allows it to sit in between surrogate pairs, etc.\r\n * Will try to not allocate if possible.\r\n */\r\n _validateRangeRelaxedNoAllocations(range) {\r\n const linesCount = this._buffer.getLineCount();\r\n const initialStartLineNumber = range.startLineNumber;\r\n const initialStartColumn = range.startColumn;\r\n let startLineNumber = Math.floor((typeof initialStartLineNumber === 'number' && !isNaN(initialStartLineNumber)) ? initialStartLineNumber : 1);\r\n let startColumn = Math.floor((typeof initialStartColumn === 'number' && !isNaN(initialStartColumn)) ? initialStartColumn : 1);\r\n if (startLineNumber < 1) {\r\n startLineNumber = 1;\r\n startColumn = 1;\r\n }\r\n else if (startLineNumber > linesCount) {\r\n startLineNumber = linesCount;\r\n startColumn = this.getLineMaxColumn(startLineNumber);\r\n }\r\n else {\r\n if (startColumn <= 1) {\r\n startColumn = 1;\r\n }\r\n else {\r\n const maxColumn = this.getLineMaxColumn(startLineNumber);\r\n if (startColumn >= maxColumn) {\r\n startColumn = maxColumn;\r\n }\r\n }\r\n }\r\n const initialEndLineNumber = range.endLineNumber;\r\n const initialEndColumn = range.endColumn;\r\n let endLineNumber = Math.floor((typeof initialEndLineNumber === 'number' && !isNaN(initialEndLineNumber)) ? initialEndLineNumber : 1);\r\n let endColumn = Math.floor((typeof initialEndColumn === 'number' && !isNaN(initialEndColumn)) ? initialEndColumn : 1);\r\n if (endLineNumber < 1) {\r\n endLineNumber = 1;\r\n endColumn = 1;\r\n }\r\n else if (endLineNumber > linesCount) {\r\n endLineNumber = linesCount;\r\n endColumn = this.getLineMaxColumn(endLineNumber);\r\n }\r\n else {\r\n if (endColumn <= 1) {\r\n endColumn = 1;\r\n }\r\n else {\r\n const maxColumn = this.getLineMaxColumn(endLineNumber);\r\n if (endColumn >= maxColumn) {\r\n endColumn = maxColumn;\r\n }\r\n }\r\n }\r\n if (initialStartLineNumber === startLineNumber\r\n && initialStartColumn === startColumn\r\n && initialEndLineNumber === endLineNumber\r\n && initialEndColumn === endColumn\r\n && range instanceof Range\r\n && !(range instanceof Selection)) {\r\n return range;\r\n }\r\n return new Range(startLineNumber, startColumn, endLineNumber, endColumn);\r\n }\r\n _isValidPosition(lineNumber, column, validationType) {\r\n if (typeof lineNumber !== 'number' || typeof column !== 'number') {\r\n return false;\r\n }\r\n if (isNaN(lineNumber) || isNaN(column)) {\r\n return false;\r\n }\r\n if (lineNumber < 1 || column < 1) {\r\n return false;\r\n }\r\n if ((lineNumber | 0) !== lineNumber || (column | 0) !== column) {\r\n return false;\r\n }\r\n const lineCount = this._buffer.getLineCount();\r\n if (lineNumber > lineCount) {\r\n return false;\r\n }\r\n if (column === 1) {\r\n return true;\r\n }\r\n const maxColumn = this.getLineMaxColumn(lineNumber);\r\n if (column > maxColumn) {\r\n return false;\r\n }\r\n if (validationType === 1 /* SurrogatePairs */) {\r\n // !!At this point, column > 1\r\n const charCodeBefore = this._buffer.getLineCharCode(lineNumber, column - 2);\r\n if (strings.isHighSurrogate(charCodeBefore)) {\r\n return false;\r\n }\r\n }\r\n return true;\r\n }\r\n _validatePosition(_lineNumber, _column, validationType) {\r\n const lineNumber = Math.floor((typeof _lineNumber === 'number' && !isNaN(_lineNumber)) ? _lineNumber : 1);\r\n const column = Math.floor((typeof _column === 'number' && !isNaN(_column)) ? _column : 1);\r\n const lineCount = this._buffer.getLineCount();\r\n if (lineNumber < 1) {\r\n return new Position(1, 1);\r\n }\r\n if (lineNumber > lineCount) {\r\n return new Position(lineCount, this.getLineMaxColumn(lineCount));\r\n }\r\n if (column <= 1) {\r\n return new Position(lineNumber, 1);\r\n }\r\n const maxColumn = this.getLineMaxColumn(lineNumber);\r\n if (column >= maxColumn) {\r\n return new Position(lineNumber, maxColumn);\r\n }\r\n if (validationType === 1 /* SurrogatePairs */) {\r\n // If the position would end up in the middle of a high-low surrogate pair,\r\n // we move it to before the pair\r\n // !!At this point, column > 1\r\n const charCodeBefore = this._buffer.getLineCharCode(lineNumber, column - 2);\r\n if (strings.isHighSurrogate(charCodeBefore)) {\r\n return new Position(lineNumber, column - 1);\r\n }\r\n }\r\n return new Position(lineNumber, column);\r\n }\r\n validatePosition(position) {\r\n const validationType = 1 /* SurrogatePairs */;\r\n this._assertNotDisposed();\r\n // Avoid object allocation and cover most likely case\r\n if (position instanceof Position) {\r\n if (this._isValidPosition(position.lineNumber, position.column, validationType)) {\r\n return position;\r\n }\r\n }\r\n return this._validatePosition(position.lineNumber, position.column, validationType);\r\n }\r\n _isValidRange(range, validationType) {\r\n const startLineNumber = range.startLineNumber;\r\n const startColumn = range.startColumn;\r\n const endLineNumber = range.endLineNumber;\r\n const endColumn = range.endColumn;\r\n if (!this._isValidPosition(startLineNumber, startColumn, 0 /* Relaxed */)) {\r\n return false;\r\n }\r\n if (!this._isValidPosition(endLineNumber, endColumn, 0 /* Relaxed */)) {\r\n return false;\r\n }\r\n if (validationType === 1 /* SurrogatePairs */) {\r\n const charCodeBeforeStart = (startColumn > 1 ? this._buffer.getLineCharCode(startLineNumber, startColumn - 2) : 0);\r\n const charCodeBeforeEnd = (endColumn > 1 && endColumn <= this._buffer.getLineLength(endLineNumber) ? this._buffer.getLineCharCode(endLineNumber, endColumn - 2) : 0);\r\n const startInsideSurrogatePair = strings.isHighSurrogate(charCodeBeforeStart);\r\n const endInsideSurrogatePair = strings.isHighSurrogate(charCodeBeforeEnd);\r\n if (!startInsideSurrogatePair && !endInsideSurrogatePair) {\r\n return true;\r\n }\r\n return false;\r\n }\r\n return true;\r\n }\r\n validateRange(_range) {\r\n const validationType = 1 /* SurrogatePairs */;\r\n this._assertNotDisposed();\r\n // Avoid object allocation and cover most likely case\r\n if ((_range instanceof Range) && !(_range instanceof Selection)) {\r\n if (this._isValidRange(_range, validationType)) {\r\n return _range;\r\n }\r\n }\r\n const start = this._validatePosition(_range.startLineNumber, _range.startColumn, 0 /* Relaxed */);\r\n const end = this._validatePosition(_range.endLineNumber, _range.endColumn, 0 /* Relaxed */);\r\n const startLineNumber = start.lineNumber;\r\n const startColumn = start.column;\r\n const endLineNumber = end.lineNumber;\r\n const endColumn = end.column;\r\n if (validationType === 1 /* SurrogatePairs */) {\r\n const charCodeBeforeStart = (startColumn > 1 ? this._buffer.getLineCharCode(startLineNumber, startColumn - 2) : 0);\r\n const charCodeBeforeEnd = (endColumn > 1 && endColumn <= this._buffer.getLineLength(endLineNumber) ? this._buffer.getLineCharCode(endLineNumber, endColumn - 2) : 0);\r\n const startInsideSurrogatePair = strings.isHighSurrogate(charCodeBeforeStart);\r\n const endInsideSurrogatePair = strings.isHighSurrogate(charCodeBeforeEnd);\r\n if (!startInsideSurrogatePair && !endInsideSurrogatePair) {\r\n return new Range(startLineNumber, startColumn, endLineNumber, endColumn);\r\n }\r\n if (startLineNumber === endLineNumber && startColumn === endColumn) {\r\n // do not expand a collapsed range, simply move it to a valid location\r\n return new Range(startLineNumber, startColumn - 1, endLineNumber, endColumn - 1);\r\n }\r\n if (startInsideSurrogatePair && endInsideSurrogatePair) {\r\n // expand range at both ends\r\n return new Range(startLineNumber, startColumn - 1, endLineNumber, endColumn + 1);\r\n }\r\n if (startInsideSurrogatePair) {\r\n // only expand range at the start\r\n return new Range(startLineNumber, startColumn - 1, endLineNumber, endColumn);\r\n }\r\n // only expand range at the end\r\n return new Range(startLineNumber, startColumn, endLineNumber, endColumn + 1);\r\n }\r\n return new Range(startLineNumber, startColumn, endLineNumber, endColumn);\r\n }\r\n modifyPosition(rawPosition, offset) {\r\n this._assertNotDisposed();\r\n let candidate = this.getOffsetAt(rawPosition) + offset;\r\n return this.getPositionAt(Math.min(this._buffer.getLength(), Math.max(0, candidate)));\r\n }\r\n getFullModelRange() {\r\n this._assertNotDisposed();\r\n const lineCount = this.getLineCount();\r\n return new Range(1, 1, lineCount, this.getLineMaxColumn(lineCount));\r\n }\r\n findMatchesLineByLine(searchRange, searchData, captureMatches, limitResultCount) {\r\n return this._buffer.findMatchesLineByLine(searchRange, searchData, captureMatches, limitResultCount);\r\n }\r\n findMatches(searchString, rawSearchScope, isRegex, matchCase, wordSeparators, captureMatches, limitResultCount = LIMIT_FIND_COUNT) {\r\n this._assertNotDisposed();\r\n let searchRanges = null;\r\n if (rawSearchScope !== null) {\r\n if (!Array.isArray(rawSearchScope)) {\r\n rawSearchScope = [rawSearchScope];\r\n }\r\n if (rawSearchScope.every((searchScope) => Range.isIRange(searchScope))) {\r\n searchRanges = rawSearchScope.map((searchScope) => this.validateRange(searchScope));\r\n }\r\n }\r\n if (searchRanges === null) {\r\n searchRanges = [this.getFullModelRange()];\r\n }\r\n searchRanges = searchRanges.sort((d1, d2) => d1.startLineNumber - d2.startLineNumber || d1.startColumn - d2.startColumn);\r\n const uniqueSearchRanges = [];\r\n uniqueSearchRanges.push(searchRanges.reduce((prev, curr) => {\r\n if (Range.areIntersecting(prev, curr)) {\r\n return prev.plusRange(curr);\r\n }\r\n uniqueSearchRanges.push(prev);\r\n return curr;\r\n }));\r\n let matchMapper;\r\n if (!isRegex && searchString.indexOf('\\n') < 0) {\r\n // not regex, not multi line\r\n const searchParams = new SearchParams(searchString, isRegex, matchCase, wordSeparators);\r\n const searchData = searchParams.parseSearchRequest();\r\n if (!searchData) {\r\n return [];\r\n }\r\n matchMapper = (searchRange) => this.findMatchesLineByLine(searchRange, searchData, captureMatches, limitResultCount);\r\n }\r\n else {\r\n matchMapper = (searchRange) => TextModelSearch.findMatches(this, new SearchParams(searchString, isRegex, matchCase, wordSeparators), searchRange, captureMatches, limitResultCount);\r\n }\r\n return uniqueSearchRanges.map(matchMapper).reduce((arr, matches) => arr.concat(matches), []);\r\n }\r\n findNextMatch(searchString, rawSearchStart, isRegex, matchCase, wordSeparators, captureMatches) {\r\n this._assertNotDisposed();\r\n const searchStart = this.validatePosition(rawSearchStart);\r\n if (!isRegex && searchString.indexOf('\\n') < 0) {\r\n const searchParams = new SearchParams(searchString, isRegex, matchCase, wordSeparators);\r\n const searchData = searchParams.parseSearchRequest();\r\n if (!searchData) {\r\n return null;\r\n }\r\n const lineCount = this.getLineCount();\r\n let searchRange = new Range(searchStart.lineNumber, searchStart.column, lineCount, this.getLineMaxColumn(lineCount));\r\n let ret = this.findMatchesLineByLine(searchRange, searchData, captureMatches, 1);\r\n TextModelSearch.findNextMatch(this, new SearchParams(searchString, isRegex, matchCase, wordSeparators), searchStart, captureMatches);\r\n if (ret.length > 0) {\r\n return ret[0];\r\n }\r\n searchRange = new Range(1, 1, searchStart.lineNumber, this.getLineMaxColumn(searchStart.lineNumber));\r\n ret = this.findMatchesLineByLine(searchRange, searchData, captureMatches, 1);\r\n if (ret.length > 0) {\r\n return ret[0];\r\n }\r\n return null;\r\n }\r\n return TextModelSearch.findNextMatch(this, new SearchParams(searchString, isRegex, matchCase, wordSeparators), searchStart, captureMatches);\r\n }\r\n findPreviousMatch(searchString, rawSearchStart, isRegex, matchCase, wordSeparators, captureMatches) {\r\n this._assertNotDisposed();\r\n const searchStart = this.validatePosition(rawSearchStart);\r\n return TextModelSearch.findPreviousMatch(this, new SearchParams(searchString, isRegex, matchCase, wordSeparators), searchStart, captureMatches);\r\n }\r\n //#endregion\r\n //#region Editing\r\n pushStackElement() {\r\n this._commandManager.pushStackElement();\r\n }\r\n popStackElement() {\r\n this._commandManager.popStackElement();\r\n }\r\n pushEOL(eol) {\r\n const currentEOL = (this.getEOL() === '\\n' ? 0 /* LF */ : 1 /* CRLF */);\r\n if (currentEOL === eol) {\r\n return;\r\n }\r\n try {\r\n this._onDidChangeDecorations.beginDeferredEmit();\r\n this._eventEmitter.beginDeferredEmit();\r\n if (this._initialUndoRedoSnapshot === null) {\r\n this._initialUndoRedoSnapshot = this._undoRedoService.createSnapshot(this.uri);\r\n }\r\n this._commandManager.pushEOL(eol);\r\n }\r\n finally {\r\n this._eventEmitter.endDeferredEmit();\r\n this._onDidChangeDecorations.endDeferredEmit();\r\n }\r\n }\r\n _validateEditOperation(rawOperation) {\r\n if (rawOperation instanceof model.ValidAnnotatedEditOperation) {\r\n return rawOperation;\r\n }\r\n return new model.ValidAnnotatedEditOperation(rawOperation.identifier || null, this.validateRange(rawOperation.range), rawOperation.text, rawOperation.forceMoveMarkers || false, rawOperation.isAutoWhitespaceEdit || false, rawOperation._isTracked || false);\r\n }\r\n _validateEditOperations(rawOperations) {\r\n const result = [];\r\n for (let i = 0, len = rawOperations.length; i < len; i++) {\r\n result[i] = this._validateEditOperation(rawOperations[i]);\r\n }\r\n return result;\r\n }\r\n pushEditOperations(beforeCursorState, editOperations, cursorStateComputer) {\r\n try {\r\n this._onDidChangeDecorations.beginDeferredEmit();\r\n this._eventEmitter.beginDeferredEmit();\r\n return this._pushEditOperations(beforeCursorState, this._validateEditOperations(editOperations), cursorStateComputer);\r\n }\r\n finally {\r\n this._eventEmitter.endDeferredEmit();\r\n this._onDidChangeDecorations.endDeferredEmit();\r\n }\r\n }\r\n _pushEditOperations(beforeCursorState, editOperations, cursorStateComputer) {\r\n if (this._options.trimAutoWhitespace && this._trimAutoWhitespaceLines) {\r\n // Go through each saved line number and insert a trim whitespace edit\r\n // if it is safe to do so (no conflicts with other edits).\r\n let incomingEdits = editOperations.map((op) => {\r\n return {\r\n range: this.validateRange(op.range),\r\n text: op.text\r\n };\r\n });\r\n // Sometimes, auto-formatters change ranges automatically which can cause undesired auto whitespace trimming near the cursor\r\n // We'll use the following heuristic: if the edits occur near the cursor, then it's ok to trim auto whitespace\r\n let editsAreNearCursors = true;\r\n if (beforeCursorState) {\r\n for (let i = 0, len = beforeCursorState.length; i < len; i++) {\r\n let sel = beforeCursorState[i];\r\n let foundEditNearSel = false;\r\n for (let j = 0, lenJ = incomingEdits.length; j < lenJ; j++) {\r\n let editRange = incomingEdits[j].range;\r\n let selIsAbove = editRange.startLineNumber > sel.endLineNumber;\r\n let selIsBelow = sel.startLineNumber > editRange.endLineNumber;\r\n if (!selIsAbove && !selIsBelow) {\r\n foundEditNearSel = true;\r\n break;\r\n }\r\n }\r\n if (!foundEditNearSel) {\r\n editsAreNearCursors = false;\r\n break;\r\n }\r\n }\r\n }\r\n if (editsAreNearCursors) {\r\n for (let i = 0, len = this._trimAutoWhitespaceLines.length; i < len; i++) {\r\n let trimLineNumber = this._trimAutoWhitespaceLines[i];\r\n let maxLineColumn = this.getLineMaxColumn(trimLineNumber);\r\n let allowTrimLine = true;\r\n for (let j = 0, lenJ = incomingEdits.length; j < lenJ; j++) {\r\n let editRange = incomingEdits[j].range;\r\n let editText = incomingEdits[j].text;\r\n if (trimLineNumber < editRange.startLineNumber || trimLineNumber > editRange.endLineNumber) {\r\n // `trimLine` is completely outside this edit\r\n continue;\r\n }\r\n // At this point:\r\n // editRange.startLineNumber <= trimLine <= editRange.endLineNumber\r\n if (trimLineNumber === editRange.startLineNumber && editRange.startColumn === maxLineColumn\r\n && editRange.isEmpty() && editText && editText.length > 0 && editText.charAt(0) === '\\n') {\r\n // This edit inserts a new line (and maybe other text) after `trimLine`\r\n continue;\r\n }\r\n if (trimLineNumber === editRange.startLineNumber && editRange.startColumn === 1\r\n && editRange.isEmpty() && editText && editText.length > 0 && editText.charAt(editText.length - 1) === '\\n') {\r\n // This edit inserts a new line (and maybe other text) before `trimLine`\r\n continue;\r\n }\r\n // Looks like we can't trim this line as it would interfere with an incoming edit\r\n allowTrimLine = false;\r\n break;\r\n }\r\n if (allowTrimLine) {\r\n const trimRange = new Range(trimLineNumber, 1, trimLineNumber, maxLineColumn);\r\n editOperations.push(new model.ValidAnnotatedEditOperation(null, trimRange, null, false, false, false));\r\n }\r\n }\r\n }\r\n this._trimAutoWhitespaceLines = null;\r\n }\r\n if (this._initialUndoRedoSnapshot === null) {\r\n this._initialUndoRedoSnapshot = this._undoRedoService.createSnapshot(this.uri);\r\n }\r\n return this._commandManager.pushEditOperation(beforeCursorState, editOperations, cursorStateComputer);\r\n }\r\n _applyUndo(changes, eol, resultingAlternativeVersionId, resultingSelection) {\r\n const edits = changes.map((change) => {\r\n const rangeStart = this.getPositionAt(change.newPosition);\r\n const rangeEnd = this.getPositionAt(change.newEnd);\r\n return {\r\n range: new Range(rangeStart.lineNumber, rangeStart.column, rangeEnd.lineNumber, rangeEnd.column),\r\n text: change.oldText\r\n };\r\n });\r\n this._applyUndoRedoEdits(edits, eol, true, false, resultingAlternativeVersionId, resultingSelection);\r\n }\r\n _applyRedo(changes, eol, resultingAlternativeVersionId, resultingSelection) {\r\n const edits = changes.map((change) => {\r\n const rangeStart = this.getPositionAt(change.oldPosition);\r\n const rangeEnd = this.getPositionAt(change.oldEnd);\r\n return {\r\n range: new Range(rangeStart.lineNumber, rangeStart.column, rangeEnd.lineNumber, rangeEnd.column),\r\n text: change.newText\r\n };\r\n });\r\n this._applyUndoRedoEdits(edits, eol, false, true, resultingAlternativeVersionId, resultingSelection);\r\n }\r\n _applyUndoRedoEdits(edits, eol, isUndoing, isRedoing, resultingAlternativeVersionId, resultingSelection) {\r\n try {\r\n this._onDidChangeDecorations.beginDeferredEmit();\r\n this._eventEmitter.beginDeferredEmit();\r\n this._isUndoing = isUndoing;\r\n this._isRedoing = isRedoing;\r\n this.applyEdits(edits, false);\r\n this.setEOL(eol);\r\n this._overwriteAlternativeVersionId(resultingAlternativeVersionId);\r\n }\r\n finally {\r\n this._isUndoing = false;\r\n this._isRedoing = false;\r\n this._eventEmitter.endDeferredEmit(resultingSelection);\r\n this._onDidChangeDecorations.endDeferredEmit();\r\n }\r\n }\r\n applyEdits(rawOperations, computeUndoEdits = false) {\r\n try {\r\n this._onDidChangeDecorations.beginDeferredEmit();\r\n this._eventEmitter.beginDeferredEmit();\r\n const operations = this._validateEditOperations(rawOperations);\r\n return this._doApplyEdits(operations, computeUndoEdits);\r\n }\r\n finally {\r\n this._eventEmitter.endDeferredEmit();\r\n this._onDidChangeDecorations.endDeferredEmit();\r\n }\r\n }\r\n _doApplyEdits(rawOperations, computeUndoEdits) {\r\n const oldLineCount = this._buffer.getLineCount();\r\n const result = this._buffer.applyEdits(rawOperations, this._options.trimAutoWhitespace, computeUndoEdits);\r\n const newLineCount = this._buffer.getLineCount();\r\n const contentChanges = result.changes;\r\n this._trimAutoWhitespaceLines = result.trimAutoWhitespaceLineNumbers;\r\n if (contentChanges.length !== 0) {\r\n // We do a first pass to update tokens and decorations\r\n // because we want to read decorations in the second pass\r\n // where we will emit content change events\r\n // and we want to read the final decorations\r\n for (let i = 0, len = contentChanges.length; i < len; i++) {\r\n const change = contentChanges[i];\r\n const [eolCount, firstLineLength, lastLineLength] = countEOL(change.text);\r\n this._tokens.acceptEdit(change.range, eolCount, firstLineLength);\r\n this._tokens2.acceptEdit(change.range, eolCount, firstLineLength, lastLineLength, change.text.length > 0 ? change.text.charCodeAt(0) : 0 /* Null */);\r\n this._decorationsTree.acceptReplace(change.rangeOffset, change.rangeLength, change.text.length, change.forceMoveMarkers);\r\n }\r\n let rawContentChanges = [];\r\n this._increaseVersionId();\r\n let lineCount = oldLineCount;\r\n for (let i = 0, len = contentChanges.length; i < len; i++) {\r\n const change = contentChanges[i];\r\n const [eolCount] = countEOL(change.text);\r\n this._onDidChangeDecorations.fire();\r\n const startLineNumber = change.range.startLineNumber;\r\n const endLineNumber = change.range.endLineNumber;\r\n const deletingLinesCnt = endLineNumber - startLineNumber;\r\n const insertingLinesCnt = eolCount;\r\n const editingLinesCnt = Math.min(deletingLinesCnt, insertingLinesCnt);\r\n const changeLineCountDelta = (insertingLinesCnt - deletingLinesCnt);\r\n const currentEditStartLineNumber = newLineCount - lineCount - changeLineCountDelta + startLineNumber;\r\n const firstEditLineNumber = currentEditStartLineNumber;\r\n const lastInsertedLineNumber = currentEditStartLineNumber + insertingLinesCnt;\r\n const decorationsWithInjectedTextInEditedRange = this._decorationsTree.getInjectedTextInInterval(this, this.getOffsetAt(new Position(firstEditLineNumber, 1)), this.getOffsetAt(new Position(lastInsertedLineNumber, this.getLineMaxColumn(lastInsertedLineNumber))), 0);\r\n const injectedTextInEditedRange = LineInjectedText.fromDecorations(decorationsWithInjectedTextInEditedRange);\r\n const injectedTextInEditedRangeQueue = new ArrayQueue(injectedTextInEditedRange);\r\n for (let j = editingLinesCnt; j >= 0; j--) {\r\n const editLineNumber = startLineNumber + j;\r\n const currentEditLineNumber = currentEditStartLineNumber + j;\r\n injectedTextInEditedRangeQueue.takeFromEndWhile(r => r.lineNumber > currentEditLineNumber);\r\n const decorationsInCurrentLine = injectedTextInEditedRangeQueue.takeFromEndWhile(r => r.lineNumber === currentEditLineNumber);\r\n rawContentChanges.push(new ModelRawLineChanged(editLineNumber, this.getLineContent(currentEditLineNumber), decorationsInCurrentLine));\r\n }\r\n if (editingLinesCnt < deletingLinesCnt) {\r\n // Must delete some lines\r\n const spliceStartLineNumber = startLineNumber + editingLinesCnt;\r\n rawContentChanges.push(new ModelRawLinesDeleted(spliceStartLineNumber + 1, endLineNumber));\r\n }\r\n if (editingLinesCnt < insertingLinesCnt) {\r\n const injectedTextInEditedRangeQueue = new ArrayQueue(injectedTextInEditedRange);\r\n // Must insert some lines\r\n const spliceLineNumber = startLineNumber + editingLinesCnt;\r\n const cnt = insertingLinesCnt - editingLinesCnt;\r\n const fromLineNumber = newLineCount - lineCount - cnt + spliceLineNumber + 1;\r\n let injectedTexts = [];\r\n let newLines = [];\r\n for (let i = 0; i < cnt; i++) {\r\n let lineNumber = fromLineNumber + i;\r\n newLines[i] = this.getLineContent(lineNumber);\r\n injectedTextInEditedRangeQueue.takeWhile(r => r.lineNumber < lineNumber);\r\n injectedTexts[i] = injectedTextInEditedRangeQueue.takeWhile(r => r.lineNumber === lineNumber);\r\n }\r\n rawContentChanges.push(new ModelRawLinesInserted(spliceLineNumber + 1, startLineNumber + insertingLinesCnt, newLines, injectedTexts));\r\n }\r\n lineCount += changeLineCountDelta;\r\n }\r\n this._emitContentChangedEvent(new ModelRawContentChangedEvent(rawContentChanges, this.getVersionId(), this._isUndoing, this._isRedoing), {\r\n changes: contentChanges,\r\n eol: this._buffer.getEOL(),\r\n versionId: this.getVersionId(),\r\n isUndoing: this._isUndoing,\r\n isRedoing: this._isRedoing,\r\n isFlush: false\r\n });\r\n }\r\n return (result.reverseEdits === null ? undefined : result.reverseEdits);\r\n }\r\n undo() {\r\n return this._undoRedoService.undo(this.uri);\r\n }\r\n canUndo() {\r\n return this._undoRedoService.canUndo(this.uri);\r\n }\r\n redo() {\r\n return this._undoRedoService.redo(this.uri);\r\n }\r\n canRedo() {\r\n return this._undoRedoService.canRedo(this.uri);\r\n }\r\n //#endregion\r\n //#region Decorations\r\n handleBeforeFireDecorationsChangedEvent(affectedInjectedTextLines) {\r\n // This is called before the decoration changed event is fired.\r\n if (affectedInjectedTextLines === null || affectedInjectedTextLines.size === 0) {\r\n return;\r\n }\r\n const affectedLines = [...affectedInjectedTextLines];\r\n const lineChangeEvents = affectedLines.map(lineNumber => new ModelRawLineChanged(lineNumber, this.getLineContent(lineNumber), this._getInjectedTextInLine(lineNumber)));\r\n this._onDidChangeContentOrInjectedText.fire(new ModelInjectedTextChangedEvent(lineChangeEvents));\r\n }\r\n changeDecorations(callback, ownerId = 0) {\r\n this._assertNotDisposed();\r\n try {\r\n this._onDidChangeDecorations.beginDeferredEmit();\r\n return this._changeDecorations(ownerId, callback);\r\n }\r\n finally {\r\n this._onDidChangeDecorations.endDeferredEmit();\r\n }\r\n }\r\n _changeDecorations(ownerId, callback) {\r\n let changeAccessor = {\r\n addDecoration: (range, options) => {\r\n return this._deltaDecorationsImpl(ownerId, [], [{ range: range, options: options }])[0];\r\n },\r\n changeDecoration: (id, newRange) => {\r\n this._changeDecorationImpl(id, newRange);\r\n },\r\n changeDecorationOptions: (id, options) => {\r\n this._changeDecorationOptionsImpl(id, _normalizeOptions(options));\r\n },\r\n removeDecoration: (id) => {\r\n this._deltaDecorationsImpl(ownerId, [id], []);\r\n },\r\n deltaDecorations: (oldDecorations, newDecorations) => {\r\n if (oldDecorations.length === 0 && newDecorations.length === 0) {\r\n // nothing to do\r\n return [];\r\n }\r\n return this._deltaDecorationsImpl(ownerId, oldDecorations, newDecorations);\r\n }\r\n };\r\n let result = null;\r\n try {\r\n result = callback(changeAccessor);\r\n }\r\n catch (e) {\r\n onUnexpectedError(e);\r\n }\r\n // Invalidate change accessor\r\n changeAccessor.addDecoration = invalidFunc;\r\n changeAccessor.changeDecoration = invalidFunc;\r\n changeAccessor.changeDecorationOptions = invalidFunc;\r\n changeAccessor.removeDecoration = invalidFunc;\r\n changeAccessor.deltaDecorations = invalidFunc;\r\n return result;\r\n }\r\n deltaDecorations(oldDecorations, newDecorations, ownerId = 0) {\r\n this._assertNotDisposed();\r\n if (!oldDecorations) {\r\n oldDecorations = [];\r\n }\r\n if (oldDecorations.length === 0 && newDecorations.length === 0) {\r\n // nothing to do\r\n return [];\r\n }\r\n try {\r\n this._onDidChangeDecorations.beginDeferredEmit();\r\n return this._deltaDecorationsImpl(ownerId, oldDecorations, newDecorations);\r\n }\r\n finally {\r\n this._onDidChangeDecorations.endDeferredEmit();\r\n }\r\n }\r\n _getTrackedRange(id) {\r\n return this.getDecorationRange(id);\r\n }\r\n _setTrackedRange(id, newRange, newStickiness) {\r\n const node = (id ? this._decorations[id] : null);\r\n if (!node) {\r\n if (!newRange) {\r\n // node doesn't exist, the request is to delete => nothing to do\r\n return null;\r\n }\r\n // node doesn't exist, the request is to set => add the tracked range\r\n return this._deltaDecorationsImpl(0, [], [{ range: newRange, options: TRACKED_RANGE_OPTIONS[newStickiness] }])[0];\r\n }\r\n if (!newRange) {\r\n // node exists, the request is to delete => delete node\r\n this._decorationsTree.delete(node);\r\n delete this._decorations[node.id];\r\n return null;\r\n }\r\n // node exists, the request is to set => change the tracked range and its options\r\n const range = this._validateRangeRelaxedNoAllocations(newRange);\r\n const startOffset = this._buffer.getOffsetAt(range.startLineNumber, range.startColumn);\r\n const endOffset = this._buffer.getOffsetAt(range.endLineNumber, range.endColumn);\r\n this._decorationsTree.delete(node);\r\n node.reset(this.getVersionId(), startOffset, endOffset, range);\r\n node.setOptions(TRACKED_RANGE_OPTIONS[newStickiness]);\r\n this._decorationsTree.insert(node);\r\n return node.id;\r\n }\r\n removeAllDecorationsWithOwnerId(ownerId) {\r\n if (this._isDisposed) {\r\n return;\r\n }\r\n const nodes = this._decorationsTree.collectNodesFromOwner(ownerId);\r\n for (let i = 0, len = nodes.length; i < len; i++) {\r\n const node = nodes[i];\r\n this._decorationsTree.delete(node);\r\n delete this._decorations[node.id];\r\n }\r\n }\r\n getDecorationOptions(decorationId) {\r\n const node = this._decorations[decorationId];\r\n if (!node) {\r\n return null;\r\n }\r\n return node.options;\r\n }\r\n getDecorationRange(decorationId) {\r\n const node = this._decorations[decorationId];\r\n if (!node) {\r\n return null;\r\n }\r\n return this._decorationsTree.getNodeRange(this, node);\r\n }\r\n getLineDecorations(lineNumber, ownerId = 0, filterOutValidation = false) {\r\n if (lineNumber < 1 || lineNumber > this.getLineCount()) {\r\n return [];\r\n }\r\n return this.getLinesDecorations(lineNumber, lineNumber, ownerId, filterOutValidation);\r\n }\r\n getLinesDecorations(_startLineNumber, _endLineNumber, ownerId = 0, filterOutValidation = false) {\r\n let lineCount = this.getLineCount();\r\n let startLineNumber = Math.min(lineCount, Math.max(1, _startLineNumber));\r\n let endLineNumber = Math.min(lineCount, Math.max(1, _endLineNumber));\r\n let endColumn = this.getLineMaxColumn(endLineNumber);\r\n return this._getDecorationsInRange(new Range(startLineNumber, 1, endLineNumber, endColumn), ownerId, filterOutValidation);\r\n }\r\n getDecorationsInRange(range, ownerId = 0, filterOutValidation = false) {\r\n let validatedRange = this.validateRange(range);\r\n return this._getDecorationsInRange(validatedRange, ownerId, filterOutValidation);\r\n }\r\n getOverviewRulerDecorations(ownerId = 0, filterOutValidation = false) {\r\n return this._decorationsTree.getAll(this, ownerId, filterOutValidation, true);\r\n }\r\n getInjectedTextDecorations(ownerId = 0) {\r\n return this._decorationsTree.getAllInjectedText(this, ownerId);\r\n }\r\n _getInjectedTextInLine(lineNumber) {\r\n const startOffset = this._buffer.getOffsetAt(lineNumber, 1);\r\n const endOffset = startOffset + this._buffer.getLineLength(lineNumber);\r\n const result = this._decorationsTree.getInjectedTextInInterval(this, startOffset, endOffset, 0);\r\n return LineInjectedText.fromDecorations(result).filter(t => t.lineNumber === lineNumber);\r\n }\r\n getAllDecorations(ownerId = 0, filterOutValidation = false) {\r\n return this._decorationsTree.getAll(this, ownerId, filterOutValidation, false);\r\n }\r\n _getDecorationsInRange(filterRange, filterOwnerId, filterOutValidation) {\r\n const startOffset = this._buffer.getOffsetAt(filterRange.startLineNumber, filterRange.startColumn);\r\n const endOffset = this._buffer.getOffsetAt(filterRange.endLineNumber, filterRange.endColumn);\r\n return this._decorationsTree.getAllInInterval(this, startOffset, endOffset, filterOwnerId, filterOutValidation);\r\n }\r\n getRangeAt(start, end) {\r\n return this._buffer.getRangeAt(start, end - start);\r\n }\r\n _changeDecorationImpl(decorationId, _range) {\r\n const node = this._decorations[decorationId];\r\n if (!node) {\r\n return;\r\n }\r\n if (node.options.after) {\r\n const oldRange = this.getDecorationRange(decorationId);\r\n this._onDidChangeDecorations.recordLineAffectedByInjectedText(oldRange.endLineNumber);\r\n }\r\n if (node.options.before) {\r\n const oldRange = this.getDecorationRange(decorationId);\r\n this._onDidChangeDecorations.recordLineAffectedByInjectedText(oldRange.startLineNumber);\r\n }\r\n const range = this._validateRangeRelaxedNoAllocations(_range);\r\n const startOffset = this._buffer.getOffsetAt(range.startLineNumber, range.startColumn);\r\n const endOffset = this._buffer.getOffsetAt(range.endLineNumber, range.endColumn);\r\n this._decorationsTree.delete(node);\r\n node.reset(this.getVersionId(), startOffset, endOffset, range);\r\n this._decorationsTree.insert(node);\r\n this._onDidChangeDecorations.checkAffectedAndFire(node.options);\r\n if (node.options.after) {\r\n this._onDidChangeDecorations.recordLineAffectedByInjectedText(range.endLineNumber);\r\n }\r\n if (node.options.before) {\r\n this._onDidChangeDecorations.recordLineAffectedByInjectedText(range.startLineNumber);\r\n }\r\n }\r\n _changeDecorationOptionsImpl(decorationId, options) {\r\n const node = this._decorations[decorationId];\r\n if (!node) {\r\n return;\r\n }\r\n const nodeWasInOverviewRuler = (node.options.overviewRuler && node.options.overviewRuler.color ? true : false);\r\n const nodeIsInOverviewRuler = (options.overviewRuler && options.overviewRuler.color ? true : false);\r\n this._onDidChangeDecorations.checkAffectedAndFire(node.options);\r\n this._onDidChangeDecorations.checkAffectedAndFire(options);\r\n if (node.options.after || options.after) {\r\n const nodeRange = this._decorationsTree.getNodeRange(this, node);\r\n this._onDidChangeDecorations.recordLineAffectedByInjectedText(nodeRange.endLineNumber);\r\n }\r\n if (node.options.before || options.before) {\r\n const nodeRange = this._decorationsTree.getNodeRange(this, node);\r\n this._onDidChangeDecorations.recordLineAffectedByInjectedText(nodeRange.startLineNumber);\r\n }\r\n if (nodeWasInOverviewRuler !== nodeIsInOverviewRuler) {\r\n // Delete + Insert due to an overview ruler status change\r\n this._decorationsTree.delete(node);\r\n node.setOptions(options);\r\n this._decorationsTree.insert(node);\r\n }\r\n else {\r\n node.setOptions(options);\r\n }\r\n }\r\n _deltaDecorationsImpl(ownerId, oldDecorationsIds, newDecorations) {\r\n const versionId = this.getVersionId();\r\n const oldDecorationsLen = oldDecorationsIds.length;\r\n let oldDecorationIndex = 0;\r\n const newDecorationsLen = newDecorations.length;\r\n let newDecorationIndex = 0;\r\n let result = new Array(newDecorationsLen);\r\n while (oldDecorationIndex < oldDecorationsLen || newDecorationIndex < newDecorationsLen) {\r\n let node = null;\r\n if (oldDecorationIndex < oldDecorationsLen) {\r\n // (1) get ourselves an old node\r\n do {\r\n node = this._decorations[oldDecorationsIds[oldDecorationIndex++]];\r\n } while (!node && oldDecorationIndex < oldDecorationsLen);\r\n // (2) remove the node from the tree (if it exists)\r\n if (node) {\r\n if (node.options.after) {\r\n const nodeRange = this._decorationsTree.getNodeRange(this, node);\r\n this._onDidChangeDecorations.recordLineAffectedByInjectedText(nodeRange.endLineNumber);\r\n }\r\n if (node.options.before) {\r\n const nodeRange = this._decorationsTree.getNodeRange(this, node);\r\n this._onDidChangeDecorations.recordLineAffectedByInjectedText(nodeRange.startLineNumber);\r\n }\r\n this._decorationsTree.delete(node);\r\n this._onDidChangeDecorations.checkAffectedAndFire(node.options);\r\n }\r\n }\r\n if (newDecorationIndex < newDecorationsLen) {\r\n // (3) create a new node if necessary\r\n if (!node) {\r\n const internalDecorationId = (++this._lastDecorationId);\r\n const decorationId = `${this._instanceId};${internalDecorationId}`;\r\n node = new IntervalNode(decorationId, 0, 0);\r\n this._decorations[decorationId] = node;\r\n }\r\n // (4) initialize node\r\n const newDecoration = newDecorations[newDecorationIndex];\r\n const range = this._validateRangeRelaxedNoAllocations(newDecoration.range);\r\n const options = _normalizeOptions(newDecoration.options);\r\n const startOffset = this._buffer.getOffsetAt(range.startLineNumber, range.startColumn);\r\n const endOffset = this._buffer.getOffsetAt(range.endLineNumber, range.endColumn);\r\n node.ownerId = ownerId;\r\n node.reset(versionId, startOffset, endOffset, range);\r\n node.setOptions(options);\r\n if (node.options.after) {\r\n this._onDidChangeDecorations.recordLineAffectedByInjectedText(range.endLineNumber);\r\n }\r\n if (node.options.before) {\r\n this._onDidChangeDecorations.recordLineAffectedByInjectedText(range.startLineNumber);\r\n }\r\n this._onDidChangeDecorations.checkAffectedAndFire(options);\r\n this._decorationsTree.insert(node);\r\n result[newDecorationIndex] = node.id;\r\n newDecorationIndex++;\r\n }\r\n else {\r\n if (node) {\r\n delete this._decorations[node.id];\r\n }\r\n }\r\n }\r\n return result;\r\n }\r\n setTokens(tokens) {\r\n if (tokens.length === 0) {\r\n return;\r\n }\r\n let ranges = [];\r\n for (let i = 0, len = tokens.length; i < len; i++) {\r\n const element = tokens[i];\r\n let minChangedLineNumber = 0;\r\n let maxChangedLineNumber = 0;\r\n let hasChange = false;\r\n for (let j = 0, lenJ = element.tokens.length; j < lenJ; j++) {\r\n const lineNumber = element.startLineNumber + j;\r\n if (hasChange) {\r\n this._tokens.setTokens(this._languageIdentifier.id, lineNumber - 1, this._buffer.getLineLength(lineNumber), element.tokens[j], false);\r\n maxChangedLineNumber = lineNumber;\r\n }\r\n else {\r\n const lineHasChange = this._tokens.setTokens(this._languageIdentifier.id, lineNumber - 1, this._buffer.getLineLength(lineNumber), element.tokens[j], true);\r\n if (lineHasChange) {\r\n hasChange = true;\r\n minChangedLineNumber = lineNumber;\r\n maxChangedLineNumber = lineNumber;\r\n }\r\n }\r\n }\r\n if (hasChange) {\r\n ranges.push({ fromLineNumber: minChangedLineNumber, toLineNumber: maxChangedLineNumber });\r\n }\r\n }\r\n if (ranges.length > 0) {\r\n this._emitModelTokensChangedEvent({\r\n tokenizationSupportChanged: false,\r\n semanticTokensApplied: false,\r\n ranges: ranges\r\n });\r\n }\r\n }\r\n setSemanticTokens(tokens, isComplete) {\r\n this._tokens2.set(tokens, isComplete);\r\n this._emitModelTokensChangedEvent({\r\n tokenizationSupportChanged: false,\r\n semanticTokensApplied: tokens !== null,\r\n ranges: [{ fromLineNumber: 1, toLineNumber: this.getLineCount() }]\r\n });\r\n }\r\n hasCompleteSemanticTokens() {\r\n return this._tokens2.isComplete();\r\n }\r\n hasSomeSemanticTokens() {\r\n return !this._tokens2.isEmpty();\r\n }\r\n setPartialSemanticTokens(range, tokens) {\r\n if (this.hasCompleteSemanticTokens()) {\r\n return;\r\n }\r\n const changedRange = this._tokens2.setPartial(range, tokens);\r\n this._emitModelTokensChangedEvent({\r\n tokenizationSupportChanged: false,\r\n semanticTokensApplied: true,\r\n ranges: [{ fromLineNumber: changedRange.startLineNumber, toLineNumber: changedRange.endLineNumber }]\r\n });\r\n }\r\n tokenizeViewport(startLineNumber, endLineNumber) {\r\n startLineNumber = Math.max(1, startLineNumber);\r\n endLineNumber = Math.min(this._buffer.getLineCount(), endLineNumber);\r\n this._tokenization.tokenizeViewport(startLineNumber, endLineNumber);\r\n }\r\n clearTokens() {\r\n this._tokens.flush();\r\n this._emitModelTokensChangedEvent({\r\n tokenizationSupportChanged: true,\r\n semanticTokensApplied: false,\r\n ranges: [{\r\n fromLineNumber: 1,\r\n toLineNumber: this._buffer.getLineCount()\r\n }]\r\n });\r\n }\r\n _emitModelTokensChangedEvent(e) {\r\n if (!this._isDisposing) {\r\n this._onDidChangeTokens.fire(e);\r\n }\r\n }\r\n resetTokenization() {\r\n this._tokenization.reset();\r\n }\r\n forceTokenization(lineNumber) {\r\n if (lineNumber < 1 || lineNumber > this.getLineCount()) {\r\n throw new Error('Illegal value for lineNumber');\r\n }\r\n this._tokenization.forceTokenization(lineNumber);\r\n }\r\n isCheapToTokenize(lineNumber) {\r\n return this._tokenization.isCheapToTokenize(lineNumber);\r\n }\r\n tokenizeIfCheap(lineNumber) {\r\n if (this.isCheapToTokenize(lineNumber)) {\r\n this.forceTokenization(lineNumber);\r\n }\r\n }\r\n getLineTokens(lineNumber) {\r\n if (lineNumber < 1 || lineNumber > this.getLineCount()) {\r\n throw new Error('Illegal value for lineNumber');\r\n }\r\n return this._getLineTokens(lineNumber);\r\n }\r\n _getLineTokens(lineNumber) {\r\n const lineText = this.getLineContent(lineNumber);\r\n const syntacticTokens = this._tokens.getTokens(this._languageIdentifier.id, lineNumber - 1, lineText);\r\n return this._tokens2.addSemanticTokens(lineNumber, syntacticTokens);\r\n }\r\n getLanguageIdentifier() {\r\n return this._languageIdentifier;\r\n }\r\n getModeId() {\r\n return this._languageIdentifier.language;\r\n }\r\n setMode(languageIdentifier) {\r\n if (this._languageIdentifier.id === languageIdentifier.id) {\r\n // There's nothing to do\r\n return;\r\n }\r\n let e = {\r\n oldLanguage: this._languageIdentifier.language,\r\n newLanguage: languageIdentifier.language\r\n };\r\n this._languageIdentifier = languageIdentifier;\r\n this._onDidChangeLanguage.fire(e);\r\n this._onDidChangeLanguageConfiguration.fire({});\r\n }\r\n getLanguageIdAtPosition(lineNumber, column) {\r\n const position = this.validatePosition(new Position(lineNumber, column));\r\n const lineTokens = this.getLineTokens(position.lineNumber);\r\n return lineTokens.getLanguageId(lineTokens.findTokenIndexAtOffset(position.column - 1));\r\n }\r\n // Having tokens allows implementing additional helper methods\r\n getWordAtPosition(_position) {\r\n this._assertNotDisposed();\r\n const position = this.validatePosition(_position);\r\n const lineContent = this.getLineContent(position.lineNumber);\r\n const lineTokens = this._getLineTokens(position.lineNumber);\r\n const tokenIndex = lineTokens.findTokenIndexAtOffset(position.column - 1);\r\n // (1). First try checking right biased word\r\n const [rbStartOffset, rbEndOffset] = TextModel._findLanguageBoundaries(lineTokens, tokenIndex);\r\n const rightBiasedWord = getWordAtText(position.column, LanguageConfigurationRegistry.getWordDefinition(lineTokens.getLanguageId(tokenIndex)), lineContent.substring(rbStartOffset, rbEndOffset), rbStartOffset);\r\n // Make sure the result touches the original passed in position\r\n if (rightBiasedWord && rightBiasedWord.startColumn <= _position.column && _position.column <= rightBiasedWord.endColumn) {\r\n return rightBiasedWord;\r\n }\r\n // (2). Else, if we were at a language boundary, check the left biased word\r\n if (tokenIndex > 0 && rbStartOffset === position.column - 1) {\r\n // edge case, where `position` sits between two tokens belonging to two different languages\r\n const [lbStartOffset, lbEndOffset] = TextModel._findLanguageBoundaries(lineTokens, tokenIndex - 1);\r\n const leftBiasedWord = getWordAtText(position.column, LanguageConfigurationRegistry.getWordDefinition(lineTokens.getLanguageId(tokenIndex - 1)), lineContent.substring(lbStartOffset, lbEndOffset), lbStartOffset);\r\n // Make sure the result touches the original passed in position\r\n if (leftBiasedWord && leftBiasedWord.startColumn <= _position.column && _position.column <= leftBiasedWord.endColumn) {\r\n return leftBiasedWord;\r\n }\r\n }\r\n return null;\r\n }\r\n static _findLanguageBoundaries(lineTokens, tokenIndex) {\r\n const languageId = lineTokens.getLanguageId(tokenIndex);\r\n // go left until a different language is hit\r\n let startOffset = 0;\r\n for (let i = tokenIndex; i >= 0 && lineTokens.getLanguageId(i) === languageId; i--) {\r\n startOffset = lineTokens.getStartOffset(i);\r\n }\r\n // go right until a different language is hit\r\n let endOffset = lineTokens.getLineContent().length;\r\n for (let i = tokenIndex, tokenCount = lineTokens.getCount(); i < tokenCount && lineTokens.getLanguageId(i) === languageId; i++) {\r\n endOffset = lineTokens.getEndOffset(i);\r\n }\r\n return [startOffset, endOffset];\r\n }\r\n getWordUntilPosition(position) {\r\n const wordAtPosition = this.getWordAtPosition(position);\r\n if (!wordAtPosition) {\r\n return {\r\n word: '',\r\n startColumn: position.column,\r\n endColumn: position.column\r\n };\r\n }\r\n return {\r\n word: wordAtPosition.word.substr(0, position.column - wordAtPosition.startColumn),\r\n startColumn: wordAtPosition.startColumn,\r\n endColumn: position.column\r\n };\r\n }\r\n findMatchingBracketUp(_bracket, _position) {\r\n let bracket = _bracket.toLowerCase();\r\n let position = this.validatePosition(_position);\r\n let lineTokens = this._getLineTokens(position.lineNumber);\r\n let languageId = lineTokens.getLanguageId(lineTokens.findTokenIndexAtOffset(position.column - 1));\r\n let bracketsSupport = LanguageConfigurationRegistry.getBracketsSupport(languageId);\r\n if (!bracketsSupport) {\r\n return null;\r\n }\r\n let data = bracketsSupport.textIsBracket[bracket];\r\n if (!data) {\r\n return null;\r\n }\r\n return stripBracketSearchCanceled(this._findMatchingBracketUp(data, position, null));\r\n }\r\n matchBracket(position) {\r\n return this._matchBracket(this.validatePosition(position));\r\n }\r\n _establishBracketSearchOffsets(position, lineTokens, modeBrackets, tokenIndex) {\r\n const tokenCount = lineTokens.getCount();\r\n const currentLanguageId = lineTokens.getLanguageId(tokenIndex);\r\n // limit search to not go before `maxBracketLength`\r\n let searchStartOffset = Math.max(0, position.column - 1 - modeBrackets.maxBracketLength);\r\n for (let i = tokenIndex - 1; i >= 0; i--) {\r\n const tokenEndOffset = lineTokens.getEndOffset(i);\r\n if (tokenEndOffset <= searchStartOffset) {\r\n break;\r\n }\r\n if (ignoreBracketsInToken(lineTokens.getStandardTokenType(i)) || lineTokens.getLanguageId(i) !== currentLanguageId) {\r\n searchStartOffset = tokenEndOffset;\r\n break;\r\n }\r\n }\r\n // limit search to not go after `maxBracketLength`\r\n let searchEndOffset = Math.min(lineTokens.getLineContent().length, position.column - 1 + modeBrackets.maxBracketLength);\r\n for (let i = tokenIndex + 1; i < tokenCount; i++) {\r\n const tokenStartOffset = lineTokens.getStartOffset(i);\r\n if (tokenStartOffset >= searchEndOffset) {\r\n break;\r\n }\r\n if (ignoreBracketsInToken(lineTokens.getStandardTokenType(i)) || lineTokens.getLanguageId(i) !== currentLanguageId) {\r\n searchEndOffset = tokenStartOffset;\r\n break;\r\n }\r\n }\r\n return { searchStartOffset, searchEndOffset };\r\n }\r\n _matchBracket(position) {\r\n const lineNumber = position.lineNumber;\r\n const lineTokens = this._getLineTokens(lineNumber);\r\n const lineText = this._buffer.getLineContent(lineNumber);\r\n const tokenIndex = lineTokens.findTokenIndexAtOffset(position.column - 1);\r\n if (tokenIndex < 0) {\r\n return null;\r\n }\r\n const currentModeBrackets = LanguageConfigurationRegistry.getBracketsSupport(lineTokens.getLanguageId(tokenIndex));\r\n // check that the token is not to be ignored\r\n if (currentModeBrackets && !ignoreBracketsInToken(lineTokens.getStandardTokenType(tokenIndex))) {\r\n let { searchStartOffset, searchEndOffset } = this._establishBracketSearchOffsets(position, lineTokens, currentModeBrackets, tokenIndex);\r\n // it might be the case that [currentTokenStart -> currentTokenEnd] contains multiple brackets\r\n // `bestResult` will contain the most right-side result\r\n let bestResult = null;\r\n while (true) {\r\n const foundBracket = BracketsUtils.findNextBracketInRange(currentModeBrackets.forwardRegex, lineNumber, lineText, searchStartOffset, searchEndOffset);\r\n if (!foundBracket) {\r\n // there are no more brackets in this text\r\n break;\r\n }\r\n // check that we didn't hit a bracket too far away from position\r\n if (foundBracket.startColumn <= position.column && position.column <= foundBracket.endColumn) {\r\n const foundBracketText = lineText.substring(foundBracket.startColumn - 1, foundBracket.endColumn - 1).toLowerCase();\r\n const r = this._matchFoundBracket(foundBracket, currentModeBrackets.textIsBracket[foundBracketText], currentModeBrackets.textIsOpenBracket[foundBracketText], null);\r\n if (r) {\r\n if (r instanceof BracketSearchCanceled) {\r\n return null;\r\n }\r\n bestResult = r;\r\n }\r\n }\r\n searchStartOffset = foundBracket.endColumn - 1;\r\n }\r\n if (bestResult) {\r\n return bestResult;\r\n }\r\n }\r\n // If position is in between two tokens, try also looking in the previous token\r\n if (tokenIndex > 0 && lineTokens.getStartOffset(tokenIndex) === position.column - 1) {\r\n const prevTokenIndex = tokenIndex - 1;\r\n const prevModeBrackets = LanguageConfigurationRegistry.getBracketsSupport(lineTokens.getLanguageId(prevTokenIndex));\r\n // check that previous token is not to be ignored\r\n if (prevModeBrackets && !ignoreBracketsInToken(lineTokens.getStandardTokenType(prevTokenIndex))) {\r\n let { searchStartOffset, searchEndOffset } = this._establishBracketSearchOffsets(position, lineTokens, prevModeBrackets, prevTokenIndex);\r\n const foundBracket = BracketsUtils.findPrevBracketInRange(prevModeBrackets.reversedRegex, lineNumber, lineText, searchStartOffset, searchEndOffset);\r\n // check that we didn't hit a bracket too far away from position\r\n if (foundBracket && foundBracket.startColumn <= position.column && position.column <= foundBracket.endColumn) {\r\n const foundBracketText = lineText.substring(foundBracket.startColumn - 1, foundBracket.endColumn - 1).toLowerCase();\r\n const r = this._matchFoundBracket(foundBracket, prevModeBrackets.textIsBracket[foundBracketText], prevModeBrackets.textIsOpenBracket[foundBracketText], null);\r\n if (r) {\r\n if (r instanceof BracketSearchCanceled) {\r\n return null;\r\n }\r\n return r;\r\n }\r\n }\r\n }\r\n }\r\n return null;\r\n }\r\n _matchFoundBracket(foundBracket, data, isOpen, continueSearchPredicate) {\r\n if (!data) {\r\n return null;\r\n }\r\n const matched = (isOpen\r\n ? this._findMatchingBracketDown(data, foundBracket.getEndPosition(), continueSearchPredicate)\r\n : this._findMatchingBracketUp(data, foundBracket.getStartPosition(), continueSearchPredicate));\r\n if (!matched) {\r\n return null;\r\n }\r\n if (matched instanceof BracketSearchCanceled) {\r\n return matched;\r\n }\r\n return [foundBracket, matched];\r\n }\r\n _findMatchingBracketUp(bracket, position, continueSearchPredicate) {\r\n // console.log('_findMatchingBracketUp: ', 'bracket: ', JSON.stringify(bracket), 'startPosition: ', String(position));\r\n const languageId = bracket.languageIdentifier.id;\r\n const reversedBracketRegex = bracket.reversedRegex;\r\n let count = -1;\r\n let totalCallCount = 0;\r\n const searchPrevMatchingBracketInRange = (lineNumber, lineText, searchStartOffset, searchEndOffset) => {\r\n while (true) {\r\n if (continueSearchPredicate && (++totalCallCount) % 100 === 0 && !continueSearchPredicate()) {\r\n return BracketSearchCanceled.INSTANCE;\r\n }\r\n const r = BracketsUtils.findPrevBracketInRange(reversedBracketRegex, lineNumber, lineText, searchStartOffset, searchEndOffset);\r\n if (!r) {\r\n break;\r\n }\r\n const hitText = lineText.substring(r.startColumn - 1, r.endColumn - 1).toLowerCase();\r\n if (bracket.isOpen(hitText)) {\r\n count++;\r\n }\r\n else if (bracket.isClose(hitText)) {\r\n count--;\r\n }\r\n if (count === 0) {\r\n return r;\r\n }\r\n searchEndOffset = r.startColumn - 1;\r\n }\r\n return null;\r\n };\r\n for (let lineNumber = position.lineNumber; lineNumber >= 1; lineNumber--) {\r\n const lineTokens = this._getLineTokens(lineNumber);\r\n const tokenCount = lineTokens.getCount();\r\n const lineText = this._buffer.getLineContent(lineNumber);\r\n let tokenIndex = tokenCount - 1;\r\n let searchStartOffset = lineText.length;\r\n let searchEndOffset = lineText.length;\r\n if (lineNumber === position.lineNumber) {\r\n tokenIndex = lineTokens.findTokenIndexAtOffset(position.column - 1);\r\n searchStartOffset = position.column - 1;\r\n searchEndOffset = position.column - 1;\r\n }\r\n let prevSearchInToken = true;\r\n for (; tokenIndex >= 0; tokenIndex--) {\r\n const searchInToken = (lineTokens.getLanguageId(tokenIndex) === languageId && !ignoreBracketsInToken(lineTokens.getStandardTokenType(tokenIndex)));\r\n if (searchInToken) {\r\n // this token should be searched\r\n if (prevSearchInToken) {\r\n // the previous token should be searched, simply extend searchStartOffset\r\n searchStartOffset = lineTokens.getStartOffset(tokenIndex);\r\n }\r\n else {\r\n // the previous token should not be searched\r\n searchStartOffset = lineTokens.getStartOffset(tokenIndex);\r\n searchEndOffset = lineTokens.getEndOffset(tokenIndex);\r\n }\r\n }\r\n else {\r\n // this token should not be searched\r\n if (prevSearchInToken && searchStartOffset !== searchEndOffset) {\r\n const r = searchPrevMatchingBracketInRange(lineNumber, lineText, searchStartOffset, searchEndOffset);\r\n if (r) {\r\n return r;\r\n }\r\n }\r\n }\r\n prevSearchInToken = searchInToken;\r\n }\r\n if (prevSearchInToken && searchStartOffset !== searchEndOffset) {\r\n const r = searchPrevMatchingBracketInRange(lineNumber, lineText, searchStartOffset, searchEndOffset);\r\n if (r) {\r\n return r;\r\n }\r\n }\r\n }\r\n return null;\r\n }\r\n _findMatchingBracketDown(bracket, position, continueSearchPredicate) {\r\n // console.log('_findMatchingBracketDown: ', 'bracket: ', JSON.stringify(bracket), 'startPosition: ', String(position));\r\n const languageId = bracket.languageIdentifier.id;\r\n const bracketRegex = bracket.forwardRegex;\r\n let count = 1;\r\n let totalCallCount = 0;\r\n const searchNextMatchingBracketInRange = (lineNumber, lineText, searchStartOffset, searchEndOffset) => {\r\n while (true) {\r\n if (continueSearchPredicate && (++totalCallCount) % 100 === 0 && !continueSearchPredicate()) {\r\n return BracketSearchCanceled.INSTANCE;\r\n }\r\n const r = BracketsUtils.findNextBracketInRange(bracketRegex, lineNumber, lineText, searchStartOffset, searchEndOffset);\r\n if (!r) {\r\n break;\r\n }\r\n const hitText = lineText.substring(r.startColumn - 1, r.endColumn - 1).toLowerCase();\r\n if (bracket.isOpen(hitText)) {\r\n count++;\r\n }\r\n else if (bracket.isClose(hitText)) {\r\n count--;\r\n }\r\n if (count === 0) {\r\n return r;\r\n }\r\n searchStartOffset = r.endColumn - 1;\r\n }\r\n return null;\r\n };\r\n const lineCount = this.getLineCount();\r\n for (let lineNumber = position.lineNumber; lineNumber <= lineCount; lineNumber++) {\r\n const lineTokens = this._getLineTokens(lineNumber);\r\n const tokenCount = lineTokens.getCount();\r\n const lineText = this._buffer.getLineContent(lineNumber);\r\n let tokenIndex = 0;\r\n let searchStartOffset = 0;\r\n let searchEndOffset = 0;\r\n if (lineNumber === position.lineNumber) {\r\n tokenIndex = lineTokens.findTokenIndexAtOffset(position.column - 1);\r\n searchStartOffset = position.column - 1;\r\n searchEndOffset = position.column - 1;\r\n }\r\n let prevSearchInToken = true;\r\n for (; tokenIndex < tokenCount; tokenIndex++) {\r\n const searchInToken = (lineTokens.getLanguageId(tokenIndex) === languageId && !ignoreBracketsInToken(lineTokens.getStandardTokenType(tokenIndex)));\r\n if (searchInToken) {\r\n // this token should be searched\r\n if (prevSearchInToken) {\r\n // the previous token should be searched, simply extend searchEndOffset\r\n searchEndOffset = lineTokens.getEndOffset(tokenIndex);\r\n }\r\n else {\r\n // the previous token should not be searched\r\n searchStartOffset = lineTokens.getStartOffset(tokenIndex);\r\n searchEndOffset = lineTokens.getEndOffset(tokenIndex);\r\n }\r\n }\r\n else {\r\n // this token should not be searched\r\n if (prevSearchInToken && searchStartOffset !== searchEndOffset) {\r\n const r = searchNextMatchingBracketInRange(lineNumber, lineText, searchStartOffset, searchEndOffset);\r\n if (r) {\r\n return r;\r\n }\r\n }\r\n }\r\n prevSearchInToken = searchInToken;\r\n }\r\n if (prevSearchInToken && searchStartOffset !== searchEndOffset) {\r\n const r = searchNextMatchingBracketInRange(lineNumber, lineText, searchStartOffset, searchEndOffset);\r\n if (r) {\r\n return r;\r\n }\r\n }\r\n }\r\n return null;\r\n }\r\n findPrevBracket(_position) {\r\n const position = this.validatePosition(_position);\r\n let languageId = -1;\r\n let modeBrackets = null;\r\n for (let lineNumber = position.lineNumber; lineNumber >= 1; lineNumber--) {\r\n const lineTokens = this._getLineTokens(lineNumber);\r\n const tokenCount = lineTokens.getCount();\r\n const lineText = this._buffer.getLineContent(lineNumber);\r\n let tokenIndex = tokenCount - 1;\r\n let searchStartOffset = lineText.length;\r\n let searchEndOffset = lineText.length;\r\n if (lineNumber === position.lineNumber) {\r\n tokenIndex = lineTokens.findTokenIndexAtOffset(position.column - 1);\r\n searchStartOffset = position.column - 1;\r\n searchEndOffset = position.column - 1;\r\n const tokenLanguageId = lineTokens.getLanguageId(tokenIndex);\r\n if (languageId !== tokenLanguageId) {\r\n languageId = tokenLanguageId;\r\n modeBrackets = LanguageConfigurationRegistry.getBracketsSupport(languageId);\r\n }\r\n }\r\n let prevSearchInToken = true;\r\n for (; tokenIndex >= 0; tokenIndex--) {\r\n const tokenLanguageId = lineTokens.getLanguageId(tokenIndex);\r\n if (languageId !== tokenLanguageId) {\r\n // language id change!\r\n if (modeBrackets && prevSearchInToken && searchStartOffset !== searchEndOffset) {\r\n const r = BracketsUtils.findPrevBracketInRange(modeBrackets.reversedRegex, lineNumber, lineText, searchStartOffset, searchEndOffset);\r\n if (r) {\r\n return this._toFoundBracket(modeBrackets, r);\r\n }\r\n prevSearchInToken = false;\r\n }\r\n languageId = tokenLanguageId;\r\n modeBrackets = LanguageConfigurationRegistry.getBracketsSupport(languageId);\r\n }\r\n const searchInToken = (!!modeBrackets && !ignoreBracketsInToken(lineTokens.getStandardTokenType(tokenIndex)));\r\n if (searchInToken) {\r\n // this token should be searched\r\n if (prevSearchInToken) {\r\n // the previous token should be searched, simply extend searchStartOffset\r\n searchStartOffset = lineTokens.getStartOffset(tokenIndex);\r\n }\r\n else {\r\n // the previous token should not be searched\r\n searchStartOffset = lineTokens.getStartOffset(tokenIndex);\r\n searchEndOffset = lineTokens.getEndOffset(tokenIndex);\r\n }\r\n }\r\n else {\r\n // this token should not be searched\r\n if (modeBrackets && prevSearchInToken && searchStartOffset !== searchEndOffset) {\r\n const r = BracketsUtils.findPrevBracketInRange(modeBrackets.reversedRegex, lineNumber, lineText, searchStartOffset, searchEndOffset);\r\n if (r) {\r\n return this._toFoundBracket(modeBrackets, r);\r\n }\r\n }\r\n }\r\n prevSearchInToken = searchInToken;\r\n }\r\n if (modeBrackets && prevSearchInToken && searchStartOffset !== searchEndOffset) {\r\n const r = BracketsUtils.findPrevBracketInRange(modeBrackets.reversedRegex, lineNumber, lineText, searchStartOffset, searchEndOffset);\r\n if (r) {\r\n return this._toFoundBracket(modeBrackets, r);\r\n }\r\n }\r\n }\r\n return null;\r\n }\r\n findNextBracket(_position) {\r\n const position = this.validatePosition(_position);\r\n const lineCount = this.getLineCount();\r\n let languageId = -1;\r\n let modeBrackets = null;\r\n for (let lineNumber = position.lineNumber; lineNumber <= lineCount; lineNumber++) {\r\n const lineTokens = this._getLineTokens(lineNumber);\r\n const tokenCount = lineTokens.getCount();\r\n const lineText = this._buffer.getLineContent(lineNumber);\r\n let tokenIndex = 0;\r\n let searchStartOffset = 0;\r\n let searchEndOffset = 0;\r\n if (lineNumber === position.lineNumber) {\r\n tokenIndex = lineTokens.findTokenIndexAtOffset(position.column - 1);\r\n searchStartOffset = position.column - 1;\r\n searchEndOffset = position.column - 1;\r\n const tokenLanguageId = lineTokens.getLanguageId(tokenIndex);\r\n if (languageId !== tokenLanguageId) {\r\n languageId = tokenLanguageId;\r\n modeBrackets = LanguageConfigurationRegistry.getBracketsSupport(languageId);\r\n }\r\n }\r\n let prevSearchInToken = true;\r\n for (; tokenIndex < tokenCount; tokenIndex++) {\r\n const tokenLanguageId = lineTokens.getLanguageId(tokenIndex);\r\n if (languageId !== tokenLanguageId) {\r\n // language id change!\r\n if (modeBrackets && prevSearchInToken && searchStartOffset !== searchEndOffset) {\r\n const r = BracketsUtils.findNextBracketInRange(modeBrackets.forwardRegex, lineNumber, lineText, searchStartOffset, searchEndOffset);\r\n if (r) {\r\n return this._toFoundBracket(modeBrackets, r);\r\n }\r\n prevSearchInToken = false;\r\n }\r\n languageId = tokenLanguageId;\r\n modeBrackets = LanguageConfigurationRegistry.getBracketsSupport(languageId);\r\n }\r\n const searchInToken = (!!modeBrackets && !ignoreBracketsInToken(lineTokens.getStandardTokenType(tokenIndex)));\r\n if (searchInToken) {\r\n // this token should be searched\r\n if (prevSearchInToken) {\r\n // the previous token should be searched, simply extend searchEndOffset\r\n searchEndOffset = lineTokens.getEndOffset(tokenIndex);\r\n }\r\n else {\r\n // the previous token should not be searched\r\n searchStartOffset = lineTokens.getStartOffset(tokenIndex);\r\n searchEndOffset = lineTokens.getEndOffset(tokenIndex);\r\n }\r\n }\r\n else {\r\n // this token should not be searched\r\n if (modeBrackets && prevSearchInToken && searchStartOffset !== searchEndOffset) {\r\n const r = BracketsUtils.findNextBracketInRange(modeBrackets.forwardRegex, lineNumber, lineText, searchStartOffset, searchEndOffset);\r\n if (r) {\r\n return this._toFoundBracket(modeBrackets, r);\r\n }\r\n }\r\n }\r\n prevSearchInToken = searchInToken;\r\n }\r\n if (modeBrackets && prevSearchInToken && searchStartOffset !== searchEndOffset) {\r\n const r = BracketsUtils.findNextBracketInRange(modeBrackets.forwardRegex, lineNumber, lineText, searchStartOffset, searchEndOffset);\r\n if (r) {\r\n return this._toFoundBracket(modeBrackets, r);\r\n }\r\n }\r\n }\r\n return null;\r\n }\r\n findEnclosingBrackets(_position, maxDuration) {\r\n let continueSearchPredicate;\r\n if (typeof maxDuration === 'undefined') {\r\n continueSearchPredicate = null;\r\n }\r\n else {\r\n const startTime = Date.now();\r\n continueSearchPredicate = () => {\r\n return (Date.now() - startTime <= maxDuration);\r\n };\r\n }\r\n const position = this.validatePosition(_position);\r\n const lineCount = this.getLineCount();\r\n const savedCounts = new Map();\r\n let counts = [];\r\n const resetCounts = (languageId, modeBrackets) => {\r\n if (!savedCounts.has(languageId)) {\r\n let tmp = [];\r\n for (let i = 0, len = modeBrackets ? modeBrackets.brackets.length : 0; i < len; i++) {\r\n tmp[i] = 0;\r\n }\r\n savedCounts.set(languageId, tmp);\r\n }\r\n counts = savedCounts.get(languageId);\r\n };\r\n let totalCallCount = 0;\r\n const searchInRange = (modeBrackets, lineNumber, lineText, searchStartOffset, searchEndOffset) => {\r\n while (true) {\r\n if (continueSearchPredicate && (++totalCallCount) % 100 === 0 && !continueSearchPredicate()) {\r\n return BracketSearchCanceled.INSTANCE;\r\n }\r\n const r = BracketsUtils.findNextBracketInRange(modeBrackets.forwardRegex, lineNumber, lineText, searchStartOffset, searchEndOffset);\r\n if (!r) {\r\n break;\r\n }\r\n const hitText = lineText.substring(r.startColumn - 1, r.endColumn - 1).toLowerCase();\r\n const bracket = modeBrackets.textIsBracket[hitText];\r\n if (bracket) {\r\n if (bracket.isOpen(hitText)) {\r\n counts[bracket.index]++;\r\n }\r\n else if (bracket.isClose(hitText)) {\r\n counts[bracket.index]--;\r\n }\r\n if (counts[bracket.index] === -1) {\r\n return this._matchFoundBracket(r, bracket, false, continueSearchPredicate);\r\n }\r\n }\r\n searchStartOffset = r.endColumn - 1;\r\n }\r\n return null;\r\n };\r\n let languageId = -1;\r\n let modeBrackets = null;\r\n for (let lineNumber = position.lineNumber; lineNumber <= lineCount; lineNumber++) {\r\n const lineTokens = this._getLineTokens(lineNumber);\r\n const tokenCount = lineTokens.getCount();\r\n const lineText = this._buffer.getLineContent(lineNumber);\r\n let tokenIndex = 0;\r\n let searchStartOffset = 0;\r\n let searchEndOffset = 0;\r\n if (lineNumber === position.lineNumber) {\r\n tokenIndex = lineTokens.findTokenIndexAtOffset(position.column - 1);\r\n searchStartOffset = position.column - 1;\r\n searchEndOffset = position.column - 1;\r\n const tokenLanguageId = lineTokens.getLanguageId(tokenIndex);\r\n if (languageId !== tokenLanguageId) {\r\n languageId = tokenLanguageId;\r\n modeBrackets = LanguageConfigurationRegistry.getBracketsSupport(languageId);\r\n resetCounts(languageId, modeBrackets);\r\n }\r\n }\r\n let prevSearchInToken = true;\r\n for (; tokenIndex < tokenCount; tokenIndex++) {\r\n const tokenLanguageId = lineTokens.getLanguageId(tokenIndex);\r\n if (languageId !== tokenLanguageId) {\r\n // language id change!\r\n if (modeBrackets && prevSearchInToken && searchStartOffset !== searchEndOffset) {\r\n const r = searchInRange(modeBrackets, lineNumber, lineText, searchStartOffset, searchEndOffset);\r\n if (r) {\r\n return stripBracketSearchCanceled(r);\r\n }\r\n prevSearchInToken = false;\r\n }\r\n languageId = tokenLanguageId;\r\n modeBrackets = LanguageConfigurationRegistry.getBracketsSupport(languageId);\r\n resetCounts(languageId, modeBrackets);\r\n }\r\n const searchInToken = (!!modeBrackets && !ignoreBracketsInToken(lineTokens.getStandardTokenType(tokenIndex)));\r\n if (searchInToken) {\r\n // this token should be searched\r\n if (prevSearchInToken) {\r\n // the previous token should be searched, simply extend searchEndOffset\r\n searchEndOffset = lineTokens.getEndOffset(tokenIndex);\r\n }\r\n else {\r\n // the previous token should not be searched\r\n searchStartOffset = lineTokens.getStartOffset(tokenIndex);\r\n searchEndOffset = lineTokens.getEndOffset(tokenIndex);\r\n }\r\n }\r\n else {\r\n // this token should not be searched\r\n if (modeBrackets && prevSearchInToken && searchStartOffset !== searchEndOffset) {\r\n const r = searchInRange(modeBrackets, lineNumber, lineText, searchStartOffset, searchEndOffset);\r\n if (r) {\r\n return stripBracketSearchCanceled(r);\r\n }\r\n }\r\n }\r\n prevSearchInToken = searchInToken;\r\n }\r\n if (modeBrackets && prevSearchInToken && searchStartOffset !== searchEndOffset) {\r\n const r = searchInRange(modeBrackets, lineNumber, lineText, searchStartOffset, searchEndOffset);\r\n if (r) {\r\n return stripBracketSearchCanceled(r);\r\n }\r\n }\r\n }\r\n return null;\r\n }\r\n _toFoundBracket(modeBrackets, r) {\r\n if (!r) {\r\n return null;\r\n }\r\n let text = this.getValueInRange(r);\r\n text = text.toLowerCase();\r\n let data = modeBrackets.textIsBracket[text];\r\n if (!data) {\r\n return null;\r\n }\r\n return {\r\n range: r,\r\n open: data.open,\r\n close: data.close,\r\n isOpen: modeBrackets.textIsOpenBracket[text]\r\n };\r\n }\r\n /**\r\n * Returns:\r\n * - -1 => the line consists of whitespace\r\n * - otherwise => the indent level is returned value\r\n */\r\n static computeIndentLevel(line, tabSize) {\r\n let indent = 0;\r\n let i = 0;\r\n let len = line.length;\r\n while (i < len) {\r\n let chCode = line.charCodeAt(i);\r\n if (chCode === 32 /* Space */) {\r\n indent++;\r\n }\r\n else if (chCode === 9 /* Tab */) {\r\n indent = indent - indent % tabSize + tabSize;\r\n }\r\n else {\r\n break;\r\n }\r\n i++;\r\n }\r\n if (i === len) {\r\n return -1; // line only consists of whitespace\r\n }\r\n return indent;\r\n }\r\n _computeIndentLevel(lineIndex) {\r\n return TextModel.computeIndentLevel(this._buffer.getLineContent(lineIndex + 1), this._options.tabSize);\r\n }\r\n getActiveIndentGuide(lineNumber, minLineNumber, maxLineNumber) {\r\n this._assertNotDisposed();\r\n const lineCount = this.getLineCount();\r\n if (lineNumber < 1 || lineNumber > lineCount) {\r\n throw new Error('Illegal value for lineNumber');\r\n }\r\n const foldingRules = LanguageConfigurationRegistry.getFoldingRules(this._languageIdentifier.id);\r\n const offSide = Boolean(foldingRules && foldingRules.offSide);\r\n let up_aboveContentLineIndex = -2; /* -2 is a marker for not having computed it */\r\n let up_aboveContentLineIndent = -1;\r\n let up_belowContentLineIndex = -2; /* -2 is a marker for not having computed it */\r\n let up_belowContentLineIndent = -1;\r\n const up_resolveIndents = (lineNumber) => {\r\n if (up_aboveContentLineIndex !== -1 && (up_aboveContentLineIndex === -2 || up_aboveContentLineIndex > lineNumber - 1)) {\r\n up_aboveContentLineIndex = -1;\r\n up_aboveContentLineIndent = -1;\r\n // must find previous line with content\r\n for (let lineIndex = lineNumber - 2; lineIndex >= 0; lineIndex--) {\r\n let indent = this._computeIndentLevel(lineIndex);\r\n if (indent >= 0) {\r\n up_aboveContentLineIndex = lineIndex;\r\n up_aboveContentLineIndent = indent;\r\n break;\r\n }\r\n }\r\n }\r\n if (up_belowContentLineIndex === -2) {\r\n up_belowContentLineIndex = -1;\r\n up_belowContentLineIndent = -1;\r\n // must find next line with content\r\n for (let lineIndex = lineNumber; lineIndex < lineCount; lineIndex++) {\r\n let indent = this._computeIndentLevel(lineIndex);\r\n if (indent >= 0) {\r\n up_belowContentLineIndex = lineIndex;\r\n up_belowContentLineIndent = indent;\r\n break;\r\n }\r\n }\r\n }\r\n };\r\n let down_aboveContentLineIndex = -2; /* -2 is a marker for not having computed it */\r\n let down_aboveContentLineIndent = -1;\r\n let down_belowContentLineIndex = -2; /* -2 is a marker for not having computed it */\r\n let down_belowContentLineIndent = -1;\r\n const down_resolveIndents = (lineNumber) => {\r\n if (down_aboveContentLineIndex === -2) {\r\n down_aboveContentLineIndex = -1;\r\n down_aboveContentLineIndent = -1;\r\n // must find previous line with content\r\n for (let lineIndex = lineNumber - 2; lineIndex >= 0; lineIndex--) {\r\n let indent = this._computeIndentLevel(lineIndex);\r\n if (indent >= 0) {\r\n down_aboveContentLineIndex = lineIndex;\r\n down_aboveContentLineIndent = indent;\r\n break;\r\n }\r\n }\r\n }\r\n if (down_belowContentLineIndex !== -1 && (down_belowContentLineIndex === -2 || down_belowContentLineIndex < lineNumber - 1)) {\r\n down_belowContentLineIndex = -1;\r\n down_belowContentLineIndent = -1;\r\n // must find next line with content\r\n for (let lineIndex = lineNumber; lineIndex < lineCount; lineIndex++) {\r\n let indent = this._computeIndentLevel(lineIndex);\r\n if (indent >= 0) {\r\n down_belowContentLineIndex = lineIndex;\r\n down_belowContentLineIndent = indent;\r\n break;\r\n }\r\n }\r\n }\r\n };\r\n let startLineNumber = 0;\r\n let goUp = true;\r\n let endLineNumber = 0;\r\n let goDown = true;\r\n let indent = 0;\r\n let initialIndent = 0;\r\n for (let distance = 0; goUp || goDown; distance++) {\r\n const upLineNumber = lineNumber - distance;\r\n const downLineNumber = lineNumber + distance;\r\n if (distance > 1 && (upLineNumber < 1 || upLineNumber < minLineNumber)) {\r\n goUp = false;\r\n }\r\n if (distance > 1 && (downLineNumber > lineCount || downLineNumber > maxLineNumber)) {\r\n goDown = false;\r\n }\r\n if (distance > 50000) {\r\n // stop processing\r\n goUp = false;\r\n goDown = false;\r\n }\r\n let upLineIndentLevel = -1;\r\n if (goUp) {\r\n // compute indent level going up\r\n const currentIndent = this._computeIndentLevel(upLineNumber - 1);\r\n if (currentIndent >= 0) {\r\n // This line has content (besides whitespace)\r\n // Use the line's indent\r\n up_belowContentLineIndex = upLineNumber - 1;\r\n up_belowContentLineIndent = currentIndent;\r\n upLineIndentLevel = Math.ceil(currentIndent / this._options.indentSize);\r\n }\r\n else {\r\n up_resolveIndents(upLineNumber);\r\n upLineIndentLevel = this._getIndentLevelForWhitespaceLine(offSide, up_aboveContentLineIndent, up_belowContentLineIndent);\r\n }\r\n }\r\n let downLineIndentLevel = -1;\r\n if (goDown) {\r\n // compute indent level going down\r\n const currentIndent = this._computeIndentLevel(downLineNumber - 1);\r\n if (currentIndent >= 0) {\r\n // This line has content (besides whitespace)\r\n // Use the line's indent\r\n down_aboveContentLineIndex = downLineNumber - 1;\r\n down_aboveContentLineIndent = currentIndent;\r\n downLineIndentLevel = Math.ceil(currentIndent / this._options.indentSize);\r\n }\r\n else {\r\n down_resolveIndents(downLineNumber);\r\n downLineIndentLevel = this._getIndentLevelForWhitespaceLine(offSide, down_aboveContentLineIndent, down_belowContentLineIndent);\r\n }\r\n }\r\n if (distance === 0) {\r\n initialIndent = upLineIndentLevel;\r\n continue;\r\n }\r\n if (distance === 1) {\r\n if (downLineNumber <= lineCount && downLineIndentLevel >= 0 && initialIndent + 1 === downLineIndentLevel) {\r\n // This is the beginning of a scope, we have special handling here, since we want the\r\n // child scope indent to be active, not the parent scope\r\n goUp = false;\r\n startLineNumber = downLineNumber;\r\n endLineNumber = downLineNumber;\r\n indent = downLineIndentLevel;\r\n continue;\r\n }\r\n if (upLineNumber >= 1 && upLineIndentLevel >= 0 && upLineIndentLevel - 1 === initialIndent) {\r\n // This is the end of a scope, just like above\r\n goDown = false;\r\n startLineNumber = upLineNumber;\r\n endLineNumber = upLineNumber;\r\n indent = upLineIndentLevel;\r\n continue;\r\n }\r\n startLineNumber = lineNumber;\r\n endLineNumber = lineNumber;\r\n indent = initialIndent;\r\n if (indent === 0) {\r\n // No need to continue\r\n return { startLineNumber, endLineNumber, indent };\r\n }\r\n }\r\n if (goUp) {\r\n if (upLineIndentLevel >= indent) {\r\n startLineNumber = upLineNumber;\r\n }\r\n else {\r\n goUp = false;\r\n }\r\n }\r\n if (goDown) {\r\n if (downLineIndentLevel >= indent) {\r\n endLineNumber = downLineNumber;\r\n }\r\n else {\r\n goDown = false;\r\n }\r\n }\r\n }\r\n return { startLineNumber, endLineNumber, indent };\r\n }\r\n getLinesIndentGuides(startLineNumber, endLineNumber) {\r\n this._assertNotDisposed();\r\n const lineCount = this.getLineCount();\r\n if (startLineNumber < 1 || startLineNumber > lineCount) {\r\n throw new Error('Illegal value for startLineNumber');\r\n }\r\n if (endLineNumber < 1 || endLineNumber > lineCount) {\r\n throw new Error('Illegal value for endLineNumber');\r\n }\r\n const foldingRules = LanguageConfigurationRegistry.getFoldingRules(this._languageIdentifier.id);\r\n const offSide = Boolean(foldingRules && foldingRules.offSide);\r\n let result = new Array(endLineNumber - startLineNumber + 1);\r\n let aboveContentLineIndex = -2; /* -2 is a marker for not having computed it */\r\n let aboveContentLineIndent = -1;\r\n let belowContentLineIndex = -2; /* -2 is a marker for not having computed it */\r\n let belowContentLineIndent = -1;\r\n for (let lineNumber = startLineNumber; lineNumber <= endLineNumber; lineNumber++) {\r\n let resultIndex = lineNumber - startLineNumber;\r\n const currentIndent = this._computeIndentLevel(lineNumber - 1);\r\n if (currentIndent >= 0) {\r\n // This line has content (besides whitespace)\r\n // Use the line's indent\r\n aboveContentLineIndex = lineNumber - 1;\r\n aboveContentLineIndent = currentIndent;\r\n result[resultIndex] = Math.ceil(currentIndent / this._options.indentSize);\r\n continue;\r\n }\r\n if (aboveContentLineIndex === -2) {\r\n aboveContentLineIndex = -1;\r\n aboveContentLineIndent = -1;\r\n // must find previous line with content\r\n for (let lineIndex = lineNumber - 2; lineIndex >= 0; lineIndex--) {\r\n let indent = this._computeIndentLevel(lineIndex);\r\n if (indent >= 0) {\r\n aboveContentLineIndex = lineIndex;\r\n aboveContentLineIndent = indent;\r\n break;\r\n }\r\n }\r\n }\r\n if (belowContentLineIndex !== -1 && (belowContentLineIndex === -2 || belowContentLineIndex < lineNumber - 1)) {\r\n belowContentLineIndex = -1;\r\n belowContentLineIndent = -1;\r\n // must find next line with content\r\n for (let lineIndex = lineNumber; lineIndex < lineCount; lineIndex++) {\r\n let indent = this._computeIndentLevel(lineIndex);\r\n if (indent >= 0) {\r\n belowContentLineIndex = lineIndex;\r\n belowContentLineIndent = indent;\r\n break;\r\n }\r\n }\r\n }\r\n result[resultIndex] = this._getIndentLevelForWhitespaceLine(offSide, aboveContentLineIndent, belowContentLineIndent);\r\n }\r\n return result;\r\n }\r\n _getIndentLevelForWhitespaceLine(offSide, aboveContentLineIndent, belowContentLineIndent) {\r\n if (aboveContentLineIndent === -1 || belowContentLineIndent === -1) {\r\n // At the top or bottom of the file\r\n return 0;\r\n }\r\n else if (aboveContentLineIndent < belowContentLineIndent) {\r\n // we are inside the region above\r\n return (1 + Math.floor(aboveContentLineIndent / this._options.indentSize));\r\n }\r\n else if (aboveContentLineIndent === belowContentLineIndent) {\r\n // we are in between two regions\r\n return Math.ceil(belowContentLineIndent / this._options.indentSize);\r\n }\r\n else {\r\n if (offSide) {\r\n // same level as region below\r\n return Math.ceil(belowContentLineIndent / this._options.indentSize);\r\n }\r\n else {\r\n // we are inside the region that ends below\r\n return (1 + Math.floor(belowContentLineIndent / this._options.indentSize));\r\n }\r\n }\r\n }\r\n //#endregion\r\n normalizePosition(position, affinity) {\r\n return position;\r\n }\r\n /**\r\n * Gets the column at which indentation stops at a given line.\r\n * @internal\r\n */\r\n getLineIndentColumn(lineNumber) {\r\n // Columns start with 1.\r\n return indentOfLine(this.getLineContent(lineNumber)) + 1;\r\n }\r\n}\r\nTextModel.MODEL_SYNC_LIMIT = 50 * 1024 * 1024; // 50 MB\r\nTextModel.LARGE_FILE_SIZE_THRESHOLD = 20 * 1024 * 1024; // 20 MB;\r\nTextModel.LARGE_FILE_LINE_COUNT_THRESHOLD = 300 * 1000; // 300K lines\r\nTextModel.DEFAULT_CREATION_OPTIONS = {\r\n isForSimpleWidget: false,\r\n tabSize: EDITOR_MODEL_DEFAULTS.tabSize,\r\n indentSize: EDITOR_MODEL_DEFAULTS.indentSize,\r\n insertSpaces: EDITOR_MODEL_DEFAULTS.insertSpaces,\r\n detectIndentation: false,\r\n defaultEOL: 1 /* LF */,\r\n trimAutoWhitespace: EDITOR_MODEL_DEFAULTS.trimAutoWhitespace,\r\n largeFileOptimizations: EDITOR_MODEL_DEFAULTS.largeFileOptimizations,\r\n};\r\nfunction indentOfLine(line) {\r\n let indent = 0;\r\n for (const c of line) {\r\n if (c === ' ' || c === '\\t') {\r\n indent++;\r\n }\r\n else {\r\n break;\r\n }\r\n }\r\n return indent;\r\n}\r\n//#region Decorations\r\nfunction isNodeInOverviewRuler(node) {\r\n return (node.options.overviewRuler && node.options.overviewRuler.color ? true : false);\r\n}\r\nfunction isNodeInjectedText(node) {\r\n return !!node.options.after || !!node.options.before;\r\n}\r\nclass DecorationsTrees {\r\n constructor() {\r\n this._decorationsTree0 = new IntervalTree();\r\n this._decorationsTree1 = new IntervalTree();\r\n this._injectedTextDecorationsTree = new IntervalTree();\r\n }\r\n ensureAllNodesHaveRanges(host) {\r\n this.getAll(host, 0, false, false);\r\n }\r\n _ensureNodesHaveRanges(host, nodes) {\r\n for (const node of nodes) {\r\n if (node.range === null) {\r\n node.range = host.getRangeAt(node.cachedAbsoluteStart, node.cachedAbsoluteEnd);\r\n }\r\n }\r\n return nodes;\r\n }\r\n getAllInInterval(host, start, end, filterOwnerId, filterOutValidation) {\r\n const versionId = host.getVersionId();\r\n const result = this._intervalSearch(start, end, filterOwnerId, filterOutValidation, versionId);\r\n return this._ensureNodesHaveRanges(host, result);\r\n }\r\n _intervalSearch(start, end, filterOwnerId, filterOutValidation, cachedVersionId) {\r\n const r0 = this._decorationsTree0.intervalSearch(start, end, filterOwnerId, filterOutValidation, cachedVersionId);\r\n const r1 = this._decorationsTree1.intervalSearch(start, end, filterOwnerId, filterOutValidation, cachedVersionId);\r\n const r2 = this._injectedTextDecorationsTree.intervalSearch(start, end, filterOwnerId, filterOutValidation, cachedVersionId);\r\n return r0.concat(r1).concat(r2);\r\n }\r\n getInjectedTextInInterval(host, start, end, filterOwnerId) {\r\n const versionId = host.getVersionId();\r\n const result = this._injectedTextDecorationsTree.intervalSearch(start, end, filterOwnerId, false, versionId);\r\n return this._ensureNodesHaveRanges(host, result);\r\n }\r\n getAllInjectedText(host, filterOwnerId) {\r\n const versionId = host.getVersionId();\r\n const result = this._injectedTextDecorationsTree.search(filterOwnerId, false, versionId);\r\n return this._ensureNodesHaveRanges(host, result);\r\n }\r\n getAll(host, filterOwnerId, filterOutValidation, overviewRulerOnly) {\r\n const versionId = host.getVersionId();\r\n const result = this._search(filterOwnerId, filterOutValidation, overviewRulerOnly, versionId);\r\n return this._ensureNodesHaveRanges(host, result);\r\n }\r\n _search(filterOwnerId, filterOutValidation, overviewRulerOnly, cachedVersionId) {\r\n if (overviewRulerOnly) {\r\n return this._decorationsTree1.search(filterOwnerId, filterOutValidation, cachedVersionId);\r\n }\r\n else {\r\n const r0 = this._decorationsTree0.search(filterOwnerId, filterOutValidation, cachedVersionId);\r\n const r1 = this._decorationsTree1.search(filterOwnerId, filterOutValidation, cachedVersionId);\r\n const r2 = this._injectedTextDecorationsTree.search(filterOwnerId, filterOutValidation, cachedVersionId);\r\n return r0.concat(r1).concat(r2);\r\n }\r\n }\r\n collectNodesFromOwner(ownerId) {\r\n const r0 = this._decorationsTree0.collectNodesFromOwner(ownerId);\r\n const r1 = this._decorationsTree1.collectNodesFromOwner(ownerId);\r\n const r2 = this._injectedTextDecorationsTree.collectNodesFromOwner(ownerId);\r\n return r0.concat(r1).concat(r2);\r\n }\r\n collectNodesPostOrder() {\r\n const r0 = this._decorationsTree0.collectNodesPostOrder();\r\n const r1 = this._decorationsTree1.collectNodesPostOrder();\r\n const r2 = this._injectedTextDecorationsTree.collectNodesPostOrder();\r\n return r0.concat(r1).concat(r2);\r\n }\r\n insert(node) {\r\n if (isNodeInjectedText(node)) {\r\n this._injectedTextDecorationsTree.insert(node);\r\n }\r\n else if (isNodeInOverviewRuler(node)) {\r\n this._decorationsTree1.insert(node);\r\n }\r\n else {\r\n this._decorationsTree0.insert(node);\r\n }\r\n }\r\n delete(node) {\r\n if (isNodeInjectedText(node)) {\r\n this._injectedTextDecorationsTree.delete(node);\r\n }\r\n else if (isNodeInOverviewRuler(node)) {\r\n this._decorationsTree1.delete(node);\r\n }\r\n else {\r\n this._decorationsTree0.delete(node);\r\n }\r\n }\r\n getNodeRange(host, node) {\r\n const versionId = host.getVersionId();\r\n if (node.cachedVersionId !== versionId) {\r\n this._resolveNode(node, versionId);\r\n }\r\n if (node.range === null) {\r\n node.range = host.getRangeAt(node.cachedAbsoluteStart, node.cachedAbsoluteEnd);\r\n }\r\n return node.range;\r\n }\r\n _resolveNode(node, cachedVersionId) {\r\n if (isNodeInjectedText(node)) {\r\n this._injectedTextDecorationsTree.resolveNode(node, cachedVersionId);\r\n }\r\n else if (isNodeInOverviewRuler(node)) {\r\n this._decorationsTree1.resolveNode(node, cachedVersionId);\r\n }\r\n else {\r\n this._decorationsTree0.resolveNode(node, cachedVersionId);\r\n }\r\n }\r\n acceptReplace(offset, length, textLength, forceMoveMarkers) {\r\n this._decorationsTree0.acceptReplace(offset, length, textLength, forceMoveMarkers);\r\n this._decorationsTree1.acceptReplace(offset, length, textLength, forceMoveMarkers);\r\n this._injectedTextDecorationsTree.acceptReplace(offset, length, textLength, forceMoveMarkers);\r\n }\r\n}\r\nfunction cleanClassName(className) {\r\n return className.replace(/[^a-z0-9\\-_]/gi, ' ');\r\n}\r\nclass DecorationOptions {\r\n constructor(options) {\r\n this.color = options.color || '';\r\n this.darkColor = options.darkColor || '';\r\n }\r\n}\r\nexport class ModelDecorationOverviewRulerOptions extends DecorationOptions {\r\n constructor(options) {\r\n super(options);\r\n this._resolvedColor = null;\r\n this.position = (typeof options.position === 'number' ? options.position : model.OverviewRulerLane.Center);\r\n }\r\n getColor(theme) {\r\n if (!this._resolvedColor) {\r\n if (theme.type !== 'light' && this.darkColor) {\r\n this._resolvedColor = this._resolveColor(this.darkColor, theme);\r\n }\r\n else {\r\n this._resolvedColor = this._resolveColor(this.color, theme);\r\n }\r\n }\r\n return this._resolvedColor;\r\n }\r\n invalidateCachedColor() {\r\n this._resolvedColor = null;\r\n }\r\n _resolveColor(color, theme) {\r\n if (typeof color === 'string') {\r\n return color;\r\n }\r\n let c = color ? theme.getColor(color.id) : null;\r\n if (!c) {\r\n return '';\r\n }\r\n return c.toString();\r\n }\r\n}\r\nexport class ModelDecorationMinimapOptions extends DecorationOptions {\r\n constructor(options) {\r\n super(options);\r\n this.position = options.position;\r\n }\r\n getColor(theme) {\r\n if (!this._resolvedColor) {\r\n if (theme.type !== 'light' && this.darkColor) {\r\n this._resolvedColor = this._resolveColor(this.darkColor, theme);\r\n }\r\n else {\r\n this._resolvedColor = this._resolveColor(this.color, theme);\r\n }\r\n }\r\n return this._resolvedColor;\r\n }\r\n invalidateCachedColor() {\r\n this._resolvedColor = undefined;\r\n }\r\n _resolveColor(color, theme) {\r\n if (typeof color === 'string') {\r\n return Color.fromHex(color);\r\n }\r\n return theme.getColor(color.id);\r\n }\r\n}\r\nexport class ModelDecorationInjectedTextOptions {\r\n constructor(options) {\r\n this.content = options.content || '';\r\n this.inlineClassName = options.inlineClassName || null;\r\n this.inlineClassNameAffectsLetterSpacing = options.inlineClassNameAffectsLetterSpacing || false;\r\n }\r\n static from(options) {\r\n if (options instanceof ModelDecorationInjectedTextOptions) {\r\n return options;\r\n }\r\n return new ModelDecorationInjectedTextOptions(options);\r\n }\r\n}\r\nexport class ModelDecorationOptions {\r\n constructor(options) {\r\n this.description = options.description;\r\n this.stickiness = options.stickiness || 0 /* AlwaysGrowsWhenTypingAtEdges */;\r\n this.zIndex = options.zIndex || 0;\r\n this.className = options.className ? cleanClassName(options.className) : null;\r\n this.hoverMessage = options.hoverMessage || null;\r\n this.glyphMarginHoverMessage = options.glyphMarginHoverMessage || null;\r\n this.isWholeLine = options.isWholeLine || false;\r\n this.showIfCollapsed = options.showIfCollapsed || false;\r\n this.collapseOnReplaceEdit = options.collapseOnReplaceEdit || false;\r\n this.overviewRuler = options.overviewRuler ? new ModelDecorationOverviewRulerOptions(options.overviewRuler) : null;\r\n this.minimap = options.minimap ? new ModelDecorationMinimapOptions(options.minimap) : null;\r\n this.glyphMarginClassName = options.glyphMarginClassName ? cleanClassName(options.glyphMarginClassName) : null;\r\n this.linesDecorationsClassName = options.linesDecorationsClassName ? cleanClassName(options.linesDecorationsClassName) : null;\r\n this.firstLineDecorationClassName = options.firstLineDecorationClassName ? cleanClassName(options.firstLineDecorationClassName) : null;\r\n this.marginClassName = options.marginClassName ? cleanClassName(options.marginClassName) : null;\r\n this.inlineClassName = options.inlineClassName ? cleanClassName(options.inlineClassName) : null;\r\n this.inlineClassNameAffectsLetterSpacing = options.inlineClassNameAffectsLetterSpacing || false;\r\n this.beforeContentClassName = options.beforeContentClassName ? cleanClassName(options.beforeContentClassName) : null;\r\n this.afterContentClassName = options.afterContentClassName ? cleanClassName(options.afterContentClassName) : null;\r\n this.after = options.after ? ModelDecorationInjectedTextOptions.from(options.after) : null;\r\n this.before = options.before ? ModelDecorationInjectedTextOptions.from(options.before) : null;\r\n }\r\n static register(options) {\r\n return new ModelDecorationOptions(options);\r\n }\r\n static createDynamic(options) {\r\n return new ModelDecorationOptions(options);\r\n }\r\n}\r\nModelDecorationOptions.EMPTY = ModelDecorationOptions.register({ description: 'empty' });\r\n/**\r\n * The order carefully matches the values of the enum.\r\n */\r\nconst TRACKED_RANGE_OPTIONS = [\r\n ModelDecorationOptions.register({ description: 'tracked-range-always-grows-when-typing-at-edges', stickiness: 0 /* AlwaysGrowsWhenTypingAtEdges */ }),\r\n ModelDecorationOptions.register({ description: 'tracked-range-never-grows-when-typing-at-edges', stickiness: 1 /* NeverGrowsWhenTypingAtEdges */ }),\r\n ModelDecorationOptions.register({ description: 'tracked-range-grows-only-when-typing-before', stickiness: 2 /* GrowsOnlyWhenTypingBefore */ }),\r\n ModelDecorationOptions.register({ description: 'tracked-range-grows-only-when-typing-after', stickiness: 3 /* GrowsOnlyWhenTypingAfter */ }),\r\n];\r\nfunction _normalizeOptions(options) {\r\n if (options instanceof ModelDecorationOptions) {\r\n return options;\r\n }\r\n return ModelDecorationOptions.createDynamic(options);\r\n}\r\nexport class DidChangeDecorationsEmitter extends Disposable {\r\n constructor(handleBeforeFire) {\r\n super();\r\n this.handleBeforeFire = handleBeforeFire;\r\n this._actual = this._register(new Emitter());\r\n this.event = this._actual.event;\r\n this._affectedInjectedTextLines = null;\r\n this._deferredCnt = 0;\r\n this._shouldFire = false;\r\n this._affectsMinimap = false;\r\n this._affectsOverviewRuler = false;\r\n }\r\n beginDeferredEmit() {\r\n this._deferredCnt++;\r\n }\r\n endDeferredEmit() {\r\n var _a;\r\n this._deferredCnt--;\r\n if (this._deferredCnt === 0) {\r\n if (this._shouldFire) {\r\n this.handleBeforeFire(this._affectedInjectedTextLines);\r\n const event = {\r\n affectsMinimap: this._affectsMinimap,\r\n affectsOverviewRuler: this._affectsOverviewRuler\r\n };\r\n this._shouldFire = false;\r\n this._affectsMinimap = false;\r\n this._affectsOverviewRuler = false;\r\n this._actual.fire(event);\r\n }\r\n (_a = this._affectedInjectedTextLines) === null || _a === void 0 ? void 0 : _a.clear();\r\n this._affectedInjectedTextLines = null;\r\n }\r\n }\r\n recordLineAffectedByInjectedText(lineNumber) {\r\n if (!this._affectedInjectedTextLines) {\r\n this._affectedInjectedTextLines = new Set();\r\n }\r\n this._affectedInjectedTextLines.add(lineNumber);\r\n }\r\n checkAffectedAndFire(options) {\r\n if (!this._affectsMinimap) {\r\n this._affectsMinimap = options.minimap && options.minimap.position ? true : false;\r\n }\r\n if (!this._affectsOverviewRuler) {\r\n this._affectsOverviewRuler = options.overviewRuler && options.overviewRuler.color ? true : false;\r\n }\r\n this._shouldFire = true;\r\n }\r\n fire() {\r\n this._affectsMinimap = true;\r\n this._affectsOverviewRuler = true;\r\n this._shouldFire = true;\r\n }\r\n}\r\n//#endregion\r\nexport class DidChangeContentEmitter extends Disposable {\r\n constructor() {\r\n super();\r\n /**\r\n * Both `fastEvent` and `slowEvent` work the same way and contain the same events, but first we invoke `fastEvent` and then `slowEvent`.\r\n */\r\n this._fastEmitter = this._register(new Emitter());\r\n this.fastEvent = this._fastEmitter.event;\r\n this._slowEmitter = this._register(new Emitter());\r\n this.slowEvent = this._slowEmitter.event;\r\n this._deferredCnt = 0;\r\n this._deferredEvent = null;\r\n }\r\n beginDeferredEmit() {\r\n this._deferredCnt++;\r\n }\r\n endDeferredEmit(resultingSelection = null) {\r\n this._deferredCnt--;\r\n if (this._deferredCnt === 0) {\r\n if (this._deferredEvent !== null) {\r\n this._deferredEvent.rawContentChangedEvent.resultingSelection = resultingSelection;\r\n const e = this._deferredEvent;\r\n this._deferredEvent = null;\r\n this._fastEmitter.fire(e);\r\n this._slowEmitter.fire(e);\r\n }\r\n }\r\n }\r\n fire(e) {\r\n if (this._deferredCnt > 0) {\r\n if (this._deferredEvent) {\r\n this._deferredEvent = this._deferredEvent.merge(e);\r\n }\r\n else {\r\n this._deferredEvent = e;\r\n }\r\n return;\r\n }\r\n this._fastEmitter.fire(e);\r\n this._slowEmitter.fire(e);\r\n }\r\n}\r\n", "/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License. See License.txt in the project root for license information.\r\n *--------------------------------------------------------------------------------------------*/\r\nimport { onUnexpectedError } from '../../../base/common/errors.js';\r\nimport * as strings from '../../../base/common/strings.js';\r\nimport { Position } from '../core/position.js';\r\nimport { Range } from '../core/range.js';\r\nimport { Selection } from '../core/selection.js';\r\nimport { TextModel } from '../model/textModel.js';\r\nimport { LanguageConfigurationRegistry } from '../modes/languageConfigurationRegistry.js';\r\nconst autoCloseAlways = () => true;\r\nconst autoCloseNever = () => false;\r\nconst autoCloseBeforeWhitespace = (chr) => (chr === ' ' || chr === '\\t');\r\nexport class CursorConfiguration {\r\n constructor(languageIdentifier, modelOptions, configuration) {\r\n this._cursorMoveConfigurationBrand = undefined;\r\n this._languageIdentifier = languageIdentifier;\r\n const options = configuration.options;\r\n const layoutInfo = options.get(129 /* layoutInfo */);\r\n this.readOnly = options.get(79 /* readOnly */);\r\n this.tabSize = modelOptions.tabSize;\r\n this.indentSize = modelOptions.indentSize;\r\n this.insertSpaces = modelOptions.insertSpaces;\r\n this.stickyTabStops = options.get(103 /* stickyTabStops */);\r\n this.lineHeight = options.get(57 /* lineHeight */);\r\n this.pageSize = Math.max(1, Math.floor(layoutInfo.height / this.lineHeight) - 2);\r\n this.useTabStops = options.get(114 /* useTabStops */);\r\n this.wordSeparators = options.get(115 /* wordSeparators */);\r\n this.emptySelectionClipboard = options.get(30 /* emptySelectionClipboard */);\r\n this.copyWithSyntaxHighlighting = options.get(19 /* copyWithSyntaxHighlighting */);\r\n this.multiCursorMergeOverlapping = options.get(67 /* multiCursorMergeOverlapping */);\r\n this.multiCursorPaste = options.get(69 /* multiCursorPaste */);\r\n this.autoClosingBrackets = options.get(5 /* autoClosingBrackets */);\r\n this.autoClosingQuotes = options.get(8 /* autoClosingQuotes */);\r\n this.autoClosingDelete = options.get(6 /* autoClosingDelete */);\r\n this.autoClosingOvertype = options.get(7 /* autoClosingOvertype */);\r\n this.autoSurround = options.get(11 /* autoSurround */);\r\n this.autoIndent = options.get(9 /* autoIndent */);\r\n this.surroundingPairs = {};\r\n this._electricChars = null;\r\n this.shouldAutoCloseBefore = {\r\n quote: CursorConfiguration._getShouldAutoClose(languageIdentifier, this.autoClosingQuotes),\r\n bracket: CursorConfiguration._getShouldAutoClose(languageIdentifier, this.autoClosingBrackets)\r\n };\r\n this.autoClosingPairs = LanguageConfigurationRegistry.getAutoClosingPairs(languageIdentifier.id);\r\n let surroundingPairs = CursorConfiguration._getSurroundingPairs(languageIdentifier);\r\n if (surroundingPairs) {\r\n for (const pair of surroundingPairs) {\r\n this.surroundingPairs[pair.open] = pair.close;\r\n }\r\n }\r\n }\r\n static shouldRecreate(e) {\r\n return (e.hasChanged(129 /* layoutInfo */)\r\n || e.hasChanged(115 /* wordSeparators */)\r\n || e.hasChanged(30 /* emptySelectionClipboard */)\r\n || e.hasChanged(67 /* multiCursorMergeOverlapping */)\r\n || e.hasChanged(69 /* multiCursorPaste */)\r\n || e.hasChanged(5 /* autoClosingBrackets */)\r\n || e.hasChanged(8 /* autoClosingQuotes */)\r\n || e.hasChanged(6 /* autoClosingDelete */)\r\n || e.hasChanged(7 /* autoClosingOvertype */)\r\n || e.hasChanged(11 /* autoSurround */)\r\n || e.hasChanged(114 /* useTabStops */)\r\n || e.hasChanged(57 /* lineHeight */)\r\n || e.hasChanged(79 /* readOnly */));\r\n }\r\n get electricChars() {\r\n if (!this._electricChars) {\r\n this._electricChars = {};\r\n let electricChars = CursorConfiguration._getElectricCharacters(this._languageIdentifier);\r\n if (electricChars) {\r\n for (const char of electricChars) {\r\n this._electricChars[char] = true;\r\n }\r\n }\r\n }\r\n return this._electricChars;\r\n }\r\n normalizeIndentation(str) {\r\n return TextModel.normalizeIndentation(str, this.indentSize, this.insertSpaces);\r\n }\r\n static _getElectricCharacters(languageIdentifier) {\r\n try {\r\n return LanguageConfigurationRegistry.getElectricCharacters(languageIdentifier.id);\r\n }\r\n catch (e) {\r\n onUnexpectedError(e);\r\n return null;\r\n }\r\n }\r\n static _getShouldAutoClose(languageIdentifier, autoCloseConfig) {\r\n switch (autoCloseConfig) {\r\n case 'beforeWhitespace':\r\n return autoCloseBeforeWhitespace;\r\n case 'languageDefined':\r\n return CursorConfiguration._getLanguageDefinedShouldAutoClose(languageIdentifier);\r\n case 'always':\r\n return autoCloseAlways;\r\n case 'never':\r\n return autoCloseNever;\r\n }\r\n }\r\n static _getLanguageDefinedShouldAutoClose(languageIdentifier) {\r\n try {\r\n const autoCloseBeforeSet = LanguageConfigurationRegistry.getAutoCloseBeforeSet(languageIdentifier.id);\r\n return c => autoCloseBeforeSet.indexOf(c) !== -1;\r\n }\r\n catch (e) {\r\n onUnexpectedError(e);\r\n return autoCloseNever;\r\n }\r\n }\r\n static _getSurroundingPairs(languageIdentifier) {\r\n try {\r\n return LanguageConfigurationRegistry.getSurroundingPairs(languageIdentifier.id);\r\n }\r\n catch (e) {\r\n onUnexpectedError(e);\r\n return null;\r\n }\r\n }\r\n}\r\n/**\r\n * Represents the cursor state on either the model or on the view model.\r\n */\r\nexport class SingleCursorState {\r\n constructor(selectionStart, selectionStartLeftoverVisibleColumns, position, leftoverVisibleColumns) {\r\n this._singleCursorStateBrand = undefined;\r\n this.selectionStart = selectionStart;\r\n this.selectionStartLeftoverVisibleColumns = selectionStartLeftoverVisibleColumns;\r\n this.position = position;\r\n this.leftoverVisibleColumns = leftoverVisibleColumns;\r\n this.selection = SingleCursorState._computeSelection(this.selectionStart, this.position);\r\n }\r\n equals(other) {\r\n return (this.selectionStartLeftoverVisibleColumns === other.selectionStartLeftoverVisibleColumns\r\n && this.leftoverVisibleColumns === other.leftoverVisibleColumns\r\n && this.position.equals(other.position)\r\n && this.selectionStart.equalsRange(other.selectionStart));\r\n }\r\n hasSelection() {\r\n return (!this.selection.isEmpty() || !this.selectionStart.isEmpty());\r\n }\r\n move(inSelectionMode, lineNumber, column, leftoverVisibleColumns) {\r\n if (inSelectionMode) {\r\n // move just position\r\n return new SingleCursorState(this.selectionStart, this.selectionStartLeftoverVisibleColumns, new Position(lineNumber, column), leftoverVisibleColumns);\r\n }\r\n else {\r\n // move everything\r\n return new SingleCursorState(new Range(lineNumber, column, lineNumber, column), leftoverVisibleColumns, new Position(lineNumber, column), leftoverVisibleColumns);\r\n }\r\n }\r\n static _computeSelection(selectionStart, position) {\r\n let startLineNumber, startColumn, endLineNumber, endColumn;\r\n if (selectionStart.isEmpty()) {\r\n startLineNumber = selectionStart.startLineNumber;\r\n startColumn = selectionStart.startColumn;\r\n endLineNumber = position.lineNumber;\r\n endColumn = position.column;\r\n }\r\n else {\r\n if (position.isBeforeOrEqual(selectionStart.getStartPosition())) {\r\n startLineNumber = selectionStart.endLineNumber;\r\n startColumn = selectionStart.endColumn;\r\n endLineNumber = position.lineNumber;\r\n endColumn = position.column;\r\n }\r\n else {\r\n startLineNumber = selectionStart.startLineNumber;\r\n startColumn = selectionStart.startColumn;\r\n endLineNumber = position.lineNumber;\r\n endColumn = position.column;\r\n }\r\n }\r\n return new Selection(startLineNumber, startColumn, endLineNumber, endColumn);\r\n }\r\n}\r\nexport class CursorContext {\r\n constructor(model, viewModel, coordinatesConverter, cursorConfig) {\r\n this._cursorContextBrand = undefined;\r\n this.model = model;\r\n this.viewModel = viewModel;\r\n this.coordinatesConverter = coordinatesConverter;\r\n this.cursorConfig = cursorConfig;\r\n }\r\n}\r\nexport class PartialModelCursorState {\r\n constructor(modelState) {\r\n this.modelState = modelState;\r\n this.viewState = null;\r\n }\r\n}\r\nexport class PartialViewCursorState {\r\n constructor(viewState) {\r\n this.modelState = null;\r\n this.viewState = viewState;\r\n }\r\n}\r\nexport class CursorState {\r\n constructor(modelState, viewState) {\r\n this._cursorStateBrand = undefined;\r\n this.modelState = modelState;\r\n this.viewState = viewState;\r\n }\r\n static fromModelState(modelState) {\r\n return new PartialModelCursorState(modelState);\r\n }\r\n static fromViewState(viewState) {\r\n return new PartialViewCursorState(viewState);\r\n }\r\n static fromModelSelection(modelSelection) {\r\n const selectionStartLineNumber = modelSelection.selectionStartLineNumber;\r\n const selectionStartColumn = modelSelection.selectionStartColumn;\r\n const positionLineNumber = modelSelection.positionLineNumber;\r\n const positionColumn = modelSelection.positionColumn;\r\n const modelState = new SingleCursorState(new Range(selectionStartLineNumber, selectionStartColumn, selectionStartLineNumber, selectionStartColumn), 0, new Position(positionLineNumber, positionColumn), 0);\r\n return CursorState.fromModelState(modelState);\r\n }\r\n static fromModelSelections(modelSelections) {\r\n let states = [];\r\n for (let i = 0, len = modelSelections.length; i < len; i++) {\r\n states[i] = this.fromModelSelection(modelSelections[i]);\r\n }\r\n return states;\r\n }\r\n equals(other) {\r\n return (this.viewState.equals(other.viewState) && this.modelState.equals(other.modelState));\r\n }\r\n}\r\nexport class EditOperationResult {\r\n constructor(type, commands, opts) {\r\n this._editOperationResultBrand = undefined;\r\n this.type = type;\r\n this.commands = commands;\r\n this.shouldPushStackElementBefore = opts.shouldPushStackElementBefore;\r\n this.shouldPushStackElementAfter = opts.shouldPushStackElementAfter;\r\n }\r\n}\r\n/**\r\n * Common operations that work and make sense both on the model and on the view model.\r\n */\r\nexport class CursorColumns {\r\n static visibleColumnFromColumn(lineContent, column, tabSize) {\r\n const lineContentLength = lineContent.length;\r\n const endOffset = column - 1 < lineContentLength ? column - 1 : lineContentLength;\r\n let result = 0;\r\n let i = 0;\r\n while (i < endOffset) {\r\n const codePoint = strings.getNextCodePoint(lineContent, endOffset, i);\r\n i += (codePoint >= 65536 /* UNICODE_SUPPLEMENTARY_PLANE_BEGIN */ ? 2 : 1);\r\n if (codePoint === 9 /* Tab */) {\r\n result = CursorColumns.nextRenderTabStop(result, tabSize);\r\n }\r\n else {\r\n let graphemeBreakType = strings.getGraphemeBreakType(codePoint);\r\n while (i < endOffset) {\r\n const nextCodePoint = strings.getNextCodePoint(lineContent, endOffset, i);\r\n const nextGraphemeBreakType = strings.getGraphemeBreakType(nextCodePoint);\r\n if (strings.breakBetweenGraphemeBreakType(graphemeBreakType, nextGraphemeBreakType)) {\r\n break;\r\n }\r\n i += (nextCodePoint >= 65536 /* UNICODE_SUPPLEMENTARY_PLANE_BEGIN */ ? 2 : 1);\r\n graphemeBreakType = nextGraphemeBreakType;\r\n }\r\n if (strings.isFullWidthCharacter(codePoint) || strings.isEmojiImprecise(codePoint)) {\r\n result = result + 2;\r\n }\r\n else {\r\n result = result + 1;\r\n }\r\n }\r\n }\r\n return result;\r\n }\r\n /**\r\n * Returns an array that maps one based columns to one based visible columns. The entry at position 0 is -1.\r\n */\r\n static visibleColumnsByColumns(lineContent, tabSize) {\r\n const endOffset = lineContent.length;\r\n let result = new Array();\r\n result.push(-1);\r\n let pos = 0;\r\n let i = 0;\r\n while (i < endOffset) {\r\n const codePoint = strings.getNextCodePoint(lineContent, endOffset, i);\r\n i += (codePoint >= 65536 /* UNICODE_SUPPLEMENTARY_PLANE_BEGIN */ ? 2 : 1);\r\n result.push(pos);\r\n if (codePoint >= 65536 /* UNICODE_SUPPLEMENTARY_PLANE_BEGIN */) {\r\n result.push(pos);\r\n }\r\n if (codePoint === 9 /* Tab */) {\r\n pos = CursorColumns.nextRenderTabStop(pos, tabSize);\r\n }\r\n else {\r\n let graphemeBreakType = strings.getGraphemeBreakType(codePoint);\r\n while (i < endOffset) {\r\n const nextCodePoint = strings.getNextCodePoint(lineContent, endOffset, i);\r\n const nextGraphemeBreakType = strings.getGraphemeBreakType(nextCodePoint);\r\n if (strings.breakBetweenGraphemeBreakType(graphemeBreakType, nextGraphemeBreakType)) {\r\n break;\r\n }\r\n i += (nextCodePoint >= 65536 /* UNICODE_SUPPLEMENTARY_PLANE_BEGIN */ ? 2 : 1);\r\n result.push(pos);\r\n if (codePoint >= 65536 /* UNICODE_SUPPLEMENTARY_PLANE_BEGIN */) {\r\n result.push(pos);\r\n }\r\n graphemeBreakType = nextGraphemeBreakType;\r\n }\r\n if (strings.isFullWidthCharacter(codePoint) || strings.isEmojiImprecise(codePoint)) {\r\n pos = pos + 2;\r\n }\r\n else {\r\n pos = pos + 1;\r\n }\r\n }\r\n }\r\n result.push(pos);\r\n return result;\r\n }\r\n static visibleColumnFromColumn2(config, model, position) {\r\n return this.visibleColumnFromColumn(model.getLineContent(position.lineNumber), position.column, config.tabSize);\r\n }\r\n static columnFromVisibleColumn(lineContent, visibleColumn, tabSize) {\r\n if (visibleColumn <= 0) {\r\n return 1;\r\n }\r\n const lineLength = lineContent.length;\r\n let beforeVisibleColumn = 0;\r\n let beforeColumn = 1;\r\n let i = 0;\r\n while (i < lineLength) {\r\n const codePoint = strings.getNextCodePoint(lineContent, lineLength, i);\r\n i += (codePoint >= 65536 /* UNICODE_SUPPLEMENTARY_PLANE_BEGIN */ ? 2 : 1);\r\n let afterVisibleColumn;\r\n if (codePoint === 9 /* Tab */) {\r\n afterVisibleColumn = CursorColumns.nextRenderTabStop(beforeVisibleColumn, tabSize);\r\n }\r\n else {\r\n let graphemeBreakType = strings.getGraphemeBreakType(codePoint);\r\n while (i < lineLength) {\r\n const nextCodePoint = strings.getNextCodePoint(lineContent, lineLength, i);\r\n const nextGraphemeBreakType = strings.getGraphemeBreakType(nextCodePoint);\r\n if (strings.breakBetweenGraphemeBreakType(graphemeBreakType, nextGraphemeBreakType)) {\r\n break;\r\n }\r\n i += (nextCodePoint >= 65536 /* UNICODE_SUPPLEMENTARY_PLANE_BEGIN */ ? 2 : 1);\r\n graphemeBreakType = nextGraphemeBreakType;\r\n }\r\n if (strings.isFullWidthCharacter(codePoint) || strings.isEmojiImprecise(codePoint)) {\r\n afterVisibleColumn = beforeVisibleColumn + 2;\r\n }\r\n else {\r\n afterVisibleColumn = beforeVisibleColumn + 1;\r\n }\r\n }\r\n const afterColumn = i + 1;\r\n if (afterVisibleColumn >= visibleColumn) {\r\n const beforeDelta = visibleColumn - beforeVisibleColumn;\r\n const afterDelta = afterVisibleColumn - visibleColumn;\r\n if (afterDelta < beforeDelta) {\r\n return afterColumn;\r\n }\r\n else {\r\n return beforeColumn;\r\n }\r\n }\r\n beforeVisibleColumn = afterVisibleColumn;\r\n beforeColumn = afterColumn;\r\n }\r\n // walked the entire string\r\n return lineLength + 1;\r\n }\r\n static columnFromVisibleColumn2(config, model, lineNumber, visibleColumn) {\r\n let result = this.columnFromVisibleColumn(model.getLineContent(lineNumber), visibleColumn, config.tabSize);\r\n let minColumn = model.getLineMinColumn(lineNumber);\r\n if (result < minColumn) {\r\n return minColumn;\r\n }\r\n let maxColumn = model.getLineMaxColumn(lineNumber);\r\n if (result > maxColumn) {\r\n return maxColumn;\r\n }\r\n return result;\r\n }\r\n /**\r\n * ATTENTION: This works with 0-based columns (as oposed to the regular 1-based columns)\r\n */\r\n static nextRenderTabStop(visibleColumn, tabSize) {\r\n return visibleColumn + tabSize - visibleColumn % tabSize;\r\n }\r\n /**\r\n * ATTENTION: This works with 0-based columns (as oposed to the regular 1-based columns)\r\n */\r\n static nextIndentTabStop(visibleColumn, indentSize) {\r\n return visibleColumn + indentSize - visibleColumn % indentSize;\r\n }\r\n /**\r\n * ATTENTION: This works with 0-based columns (as opposed to the regular 1-based columns)\r\n */\r\n static prevRenderTabStop(column, tabSize) {\r\n return Math.max(0, column - 1 - (column - 1) % tabSize);\r\n }\r\n /**\r\n * ATTENTION: This works with 0-based columns (as opposed to the regular 1-based columns)\r\n */\r\n static prevIndentTabStop(column, indentSize) {\r\n return Math.max(0, column - 1 - (column - 1) % indentSize);\r\n }\r\n}\r\nexport function isQuote(ch) {\r\n return (ch === '\\'' || ch === '\"' || ch === '`');\r\n}\r\n", "/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License. See License.txt in the project root for license information.\r\n *--------------------------------------------------------------------------------------------*/\r\nimport { CursorColumns, SingleCursorState } from './cursorCommon.js';\r\nimport { Position } from '../core/position.js';\r\nimport { Range } from '../core/range.js';\r\nexport class ColumnSelection {\r\n static columnSelect(config, model, fromLineNumber, fromVisibleColumn, toLineNumber, toVisibleColumn) {\r\n let lineCount = Math.abs(toLineNumber - fromLineNumber) + 1;\r\n let reversed = (fromLineNumber > toLineNumber);\r\n let isRTL = (fromVisibleColumn > toVisibleColumn);\r\n let isLTR = (fromVisibleColumn < toVisibleColumn);\r\n let result = [];\r\n // console.log(`fromVisibleColumn: ${fromVisibleColumn}, toVisibleColumn: ${toVisibleColumn}`);\r\n for (let i = 0; i < lineCount; i++) {\r\n let lineNumber = fromLineNumber + (reversed ? -i : i);\r\n let startColumn = CursorColumns.columnFromVisibleColumn2(config, model, lineNumber, fromVisibleColumn);\r\n let endColumn = CursorColumns.columnFromVisibleColumn2(config, model, lineNumber, toVisibleColumn);\r\n let visibleStartColumn = CursorColumns.visibleColumnFromColumn2(config, model, new Position(lineNumber, startColumn));\r\n let visibleEndColumn = CursorColumns.visibleColumnFromColumn2(config, model, new Position(lineNumber, endColumn));\r\n // console.log(`lineNumber: ${lineNumber}: visibleStartColumn: ${visibleStartColumn}, visibleEndColumn: ${visibleEndColumn}`);\r\n if (isLTR) {\r\n if (visibleStartColumn > toVisibleColumn) {\r\n continue;\r\n }\r\n if (visibleEndColumn < fromVisibleColumn) {\r\n continue;\r\n }\r\n }\r\n if (isRTL) {\r\n if (visibleEndColumn > fromVisibleColumn) {\r\n continue;\r\n }\r\n if (visibleStartColumn < toVisibleColumn) {\r\n continue;\r\n }\r\n }\r\n result.push(new SingleCursorState(new Range(lineNumber, startColumn, lineNumber, startColumn), 0, new Position(lineNumber, endColumn), 0));\r\n }\r\n if (result.length === 0) {\r\n // We are after all the lines, so add cursor at the end of each line\r\n for (let i = 0; i < lineCount; i++) {\r\n const lineNumber = fromLineNumber + (reversed ? -i : i);\r\n const maxColumn = model.getLineMaxColumn(lineNumber);\r\n result.push(new SingleCursorState(new Range(lineNumber, maxColumn, lineNumber, maxColumn), 0, new Position(lineNumber, maxColumn), 0));\r\n }\r\n }\r\n return {\r\n viewStates: result,\r\n reversed: reversed,\r\n fromLineNumber: fromLineNumber,\r\n fromVisualColumn: fromVisibleColumn,\r\n toLineNumber: toLineNumber,\r\n toVisualColumn: toVisibleColumn\r\n };\r\n }\r\n static columnSelectLeft(config, model, prevColumnSelectData) {\r\n let toViewVisualColumn = prevColumnSelectData.toViewVisualColumn;\r\n if (toViewVisualColumn > 0) {\r\n toViewVisualColumn--;\r\n }\r\n return ColumnSelection.columnSelect(config, model, prevColumnSelectData.fromViewLineNumber, prevColumnSelectData.fromViewVisualColumn, prevColumnSelectData.toViewLineNumber, toViewVisualColumn);\r\n }\r\n static columnSelectRight(config, model, prevColumnSelectData) {\r\n let maxVisualViewColumn = 0;\r\n const minViewLineNumber = Math.min(prevColumnSelectData.fromViewLineNumber, prevColumnSelectData.toViewLineNumber);\r\n const maxViewLineNumber = Math.max(prevColumnSelectData.fromViewLineNumber, prevColumnSelectData.toViewLineNumber);\r\n for (let lineNumber = minViewLineNumber; lineNumber <= maxViewLineNumber; lineNumber++) {\r\n const lineMaxViewColumn = model.getLineMaxColumn(lineNumber);\r\n const lineMaxVisualViewColumn = CursorColumns.visibleColumnFromColumn2(config, model, new Position(lineNumber, lineMaxViewColumn));\r\n maxVisualViewColumn = Math.max(maxVisualViewColumn, lineMaxVisualViewColumn);\r\n }\r\n let toViewVisualColumn = prevColumnSelectData.toViewVisualColumn;\r\n if (toViewVisualColumn < maxVisualViewColumn) {\r\n toViewVisualColumn++;\r\n }\r\n return this.columnSelect(config, model, prevColumnSelectData.fromViewLineNumber, prevColumnSelectData.fromViewVisualColumn, prevColumnSelectData.toViewLineNumber, toViewVisualColumn);\r\n }\r\n static columnSelectUp(config, model, prevColumnSelectData, isPaged) {\r\n const linesCount = isPaged ? config.pageSize : 1;\r\n const toViewLineNumber = Math.max(1, prevColumnSelectData.toViewLineNumber - linesCount);\r\n return this.columnSelect(config, model, prevColumnSelectData.fromViewLineNumber, prevColumnSelectData.fromViewVisualColumn, toViewLineNumber, prevColumnSelectData.toViewVisualColumn);\r\n }\r\n static columnSelectDown(config, model, prevColumnSelectData, isPaged) {\r\n const linesCount = isPaged ? config.pageSize : 1;\r\n const toViewLineNumber = Math.min(model.getLineCount(), prevColumnSelectData.toViewLineNumber + linesCount);\r\n return this.columnSelect(config, model, prevColumnSelectData.fromViewLineNumber, prevColumnSelectData.fromViewVisualColumn, toViewLineNumber, prevColumnSelectData.toViewVisualColumn);\r\n }\r\n}\r\n", "/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License. See License.txt in the project root for license information.\r\n *--------------------------------------------------------------------------------------------*/\r\nimport { Selection } from '../core/selection.js';\r\nexport class ReplaceCommand {\r\n constructor(range, text, insertsAutoWhitespace = false) {\r\n this._range = range;\r\n this._text = text;\r\n this.insertsAutoWhitespace = insertsAutoWhitespace;\r\n }\r\n getEditOperations(model, builder) {\r\n builder.addTrackedEditOperation(this._range, this._text);\r\n }\r\n computeCursorState(model, helper) {\r\n let inverseEditOperations = helper.getInverseEditOperations();\r\n let srcRange = inverseEditOperations[0].range;\r\n return new Selection(srcRange.endLineNumber, srcRange.endColumn, srcRange.endLineNumber, srcRange.endColumn);\r\n }\r\n}\r\nexport class ReplaceCommandThatSelectsText {\r\n constructor(range, text) {\r\n this._range = range;\r\n this._text = text;\r\n }\r\n getEditOperations(model, builder) {\r\n builder.addTrackedEditOperation(this._range, this._text);\r\n }\r\n computeCursorState(model, helper) {\r\n const inverseEditOperations = helper.getInverseEditOperations();\r\n const srcRange = inverseEditOperations[0].range;\r\n return new Selection(srcRange.startLineNumber, srcRange.startColumn, srcRange.endLineNumber, srcRange.endColumn);\r\n }\r\n}\r\nexport class ReplaceCommandWithoutChangingPosition {\r\n constructor(range, text, insertsAutoWhitespace = false) {\r\n this._range = range;\r\n this._text = text;\r\n this.insertsAutoWhitespace = insertsAutoWhitespace;\r\n }\r\n getEditOperations(model, builder) {\r\n builder.addTrackedEditOperation(this._range, this._text);\r\n }\r\n computeCursorState(model, helper) {\r\n let inverseEditOperations = helper.getInverseEditOperations();\r\n let srcRange = inverseEditOperations[0].range;\r\n return new Selection(srcRange.startLineNumber, srcRange.startColumn, srcRange.startLineNumber, srcRange.startColumn);\r\n }\r\n}\r\nexport class ReplaceCommandWithOffsetCursorState {\r\n constructor(range, text, lineNumberDeltaOffset, columnDeltaOffset, insertsAutoWhitespace = false) {\r\n this._range = range;\r\n this._text = text;\r\n this._columnDeltaOffset = columnDeltaOffset;\r\n this._lineNumberDeltaOffset = lineNumberDeltaOffset;\r\n this.insertsAutoWhitespace = insertsAutoWhitespace;\r\n }\r\n getEditOperations(model, builder) {\r\n builder.addTrackedEditOperation(this._range, this._text);\r\n }\r\n computeCursorState(model, helper) {\r\n let inverseEditOperations = helper.getInverseEditOperations();\r\n let srcRange = inverseEditOperations[0].range;\r\n return new Selection(srcRange.endLineNumber + this._lineNumberDeltaOffset, srcRange.endColumn + this._columnDeltaOffset, srcRange.endLineNumber + this._lineNumberDeltaOffset, srcRange.endColumn + this._columnDeltaOffset);\r\n }\r\n}\r\nexport class ReplaceCommandThatPreservesSelection {\r\n constructor(editRange, text, initialSelection, forceMoveMarkers = false) {\r\n this._range = editRange;\r\n this._text = text;\r\n this._initialSelection = initialSelection;\r\n this._forceMoveMarkers = forceMoveMarkers;\r\n this._selectionId = null;\r\n }\r\n getEditOperations(model, builder) {\r\n builder.addTrackedEditOperation(this._range, this._text, this._forceMoveMarkers);\r\n this._selectionId = builder.trackSelection(this._initialSelection);\r\n }\r\n computeCursorState(model, helper) {\r\n return helper.getTrackedSelection(this._selectionId);\r\n }\r\n}\r\n", "/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License. See License.txt in the project root for license information.\r\n *--------------------------------------------------------------------------------------------*/\r\nimport { CursorColumns } from './cursorCommon.js';\r\nexport class AtomicTabMoveOperations {\r\n /**\r\n * Get the visible column at the position. If we get to a non-whitespace character first\r\n * or past the end of string then return -1.\r\n *\r\n * **Note** `position` and the return value are 0-based.\r\n */\r\n static whitespaceVisibleColumn(lineContent, position, tabSize) {\r\n const lineLength = lineContent.length;\r\n let visibleColumn = 0;\r\n let prevTabStopPosition = -1;\r\n let prevTabStopVisibleColumn = -1;\r\n for (let i = 0; i < lineLength; i++) {\r\n if (i === position) {\r\n return [prevTabStopPosition, prevTabStopVisibleColumn, visibleColumn];\r\n }\r\n if (visibleColumn % tabSize === 0) {\r\n prevTabStopPosition = i;\r\n prevTabStopVisibleColumn = visibleColumn;\r\n }\r\n const chCode = lineContent.charCodeAt(i);\r\n switch (chCode) {\r\n case 32 /* Space */:\r\n visibleColumn += 1;\r\n break;\r\n case 9 /* Tab */:\r\n // Skip to the next multiple of tabSize.\r\n visibleColumn = CursorColumns.nextRenderTabStop(visibleColumn, tabSize);\r\n break;\r\n default:\r\n return [-1, -1, -1];\r\n }\r\n }\r\n if (position === lineLength) {\r\n return [prevTabStopPosition, prevTabStopVisibleColumn, visibleColumn];\r\n }\r\n return [-1, -1, -1];\r\n }\r\n /**\r\n * Return the position that should result from a move left, right or to the\r\n * nearest tab, if atomic tabs are enabled. Left and right are used for the\r\n * arrow key movements, nearest is used for mouse selection. It returns\r\n * -1 if atomic tabs are not relevant and you should fall back to normal\r\n * behaviour.\r\n *\r\n * **Note**: `position` and the return value are 0-based.\r\n */\r\n static atomicPosition(lineContent, position, tabSize, direction) {\r\n const lineLength = lineContent.length;\r\n // Get the 0-based visible column corresponding to the position, or return\r\n // -1 if it is not in the initial whitespace.\r\n const [prevTabStopPosition, prevTabStopVisibleColumn, visibleColumn] = AtomicTabMoveOperations.whitespaceVisibleColumn(lineContent, position, tabSize);\r\n if (visibleColumn === -1) {\r\n return -1;\r\n }\r\n // Is the output left or right of the current position. The case for nearest\r\n // where it is the same as the current position is handled in the switch.\r\n let left;\r\n switch (direction) {\r\n case 0 /* Left */:\r\n left = true;\r\n break;\r\n case 1 /* Right */:\r\n left = false;\r\n break;\r\n case 2 /* Nearest */:\r\n // The code below assumes the output position is either left or right\r\n // of the input position. If it is the same, return immediately.\r\n if (visibleColumn % tabSize === 0) {\r\n return position;\r\n }\r\n // Go to the nearest indentation.\r\n left = visibleColumn % tabSize <= (tabSize / 2);\r\n break;\r\n }\r\n // If going left, we can just use the info about the last tab stop position and\r\n // last tab stop visible column that we computed in the first walk over the whitespace.\r\n if (left) {\r\n if (prevTabStopPosition === -1) {\r\n return -1;\r\n }\r\n // If the direction is left, we need to keep scanning right to ensure\r\n // that targetVisibleColumn + tabSize is before non-whitespace.\r\n // This is so that when we press left at the end of a partial\r\n // indentation it only goes one character. For example ' foo' with\r\n // tabSize 4, should jump from position 6 to position 5, not 4.\r\n let currentVisibleColumn = prevTabStopVisibleColumn;\r\n for (let i = prevTabStopPosition; i < lineLength; ++i) {\r\n if (currentVisibleColumn === prevTabStopVisibleColumn + tabSize) {\r\n // It is a full indentation.\r\n return prevTabStopPosition;\r\n }\r\n const chCode = lineContent.charCodeAt(i);\r\n switch (chCode) {\r\n case 32 /* Space */:\r\n currentVisibleColumn += 1;\r\n break;\r\n case 9 /* Tab */:\r\n currentVisibleColumn = CursorColumns.nextRenderTabStop(currentVisibleColumn, tabSize);\r\n break;\r\n default:\r\n return -1;\r\n }\r\n }\r\n if (currentVisibleColumn === prevTabStopVisibleColumn + tabSize) {\r\n return prevTabStopPosition;\r\n }\r\n // It must have been a partial indentation.\r\n return -1;\r\n }\r\n // We are going right.\r\n const targetVisibleColumn = CursorColumns.nextRenderTabStop(visibleColumn, tabSize);\r\n // We can just continue from where whitespaceVisibleColumn got to.\r\n let currentVisibleColumn = visibleColumn;\r\n for (let i = position; i < lineLength; i++) {\r\n if (currentVisibleColumn === targetVisibleColumn) {\r\n return i;\r\n }\r\n const chCode = lineContent.charCodeAt(i);\r\n switch (chCode) {\r\n case 32 /* Space */:\r\n currentVisibleColumn += 1;\r\n break;\r\n case 9 /* Tab */:\r\n currentVisibleColumn = CursorColumns.nextRenderTabStop(currentVisibleColumn, tabSize);\r\n break;\r\n default:\r\n return -1;\r\n }\r\n }\r\n // This condition handles when the target column is at the end of the line.\r\n if (currentVisibleColumn === targetVisibleColumn) {\r\n return lineLength;\r\n }\r\n return -1;\r\n }\r\n}\r\n", "/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License. See License.txt in the project root for license information.\r\n *--------------------------------------------------------------------------------------------*/\r\nimport { CursorColumns, SingleCursorState } from './cursorCommon.js';\r\nimport { Position } from '../core/position.js';\r\nimport { Range } from '../core/range.js';\r\nimport * as strings from '../../../base/common/strings.js';\r\nimport { AtomicTabMoveOperations } from './cursorAtomicMoveOperations.js';\r\nexport class CursorPosition {\r\n constructor(lineNumber, column, leftoverVisibleColumns) {\r\n this._cursorPositionBrand = undefined;\r\n this.lineNumber = lineNumber;\r\n this.column = column;\r\n this.leftoverVisibleColumns = leftoverVisibleColumns;\r\n }\r\n}\r\nexport class MoveOperations {\r\n static leftPosition(model, position) {\r\n if (position.column > model.getLineMinColumn(position.lineNumber)) {\r\n return position.delta(undefined, -strings.prevCharLength(model.getLineContent(position.lineNumber), position.column - 1));\r\n }\r\n else if (position.lineNumber > 1) {\r\n const newLineNumber = position.lineNumber - 1;\r\n return new Position(newLineNumber, model.getLineMaxColumn(newLineNumber));\r\n }\r\n else {\r\n return position;\r\n }\r\n }\r\n static leftPositionAtomicSoftTabs(model, position, tabSize) {\r\n if (position.column <= model.getLineIndentColumn(position.lineNumber)) {\r\n const minColumn = model.getLineMinColumn(position.lineNumber);\r\n const lineContent = model.getLineContent(position.lineNumber);\r\n const newPosition = AtomicTabMoveOperations.atomicPosition(lineContent, position.column - 1, tabSize, 0 /* Left */);\r\n if (newPosition !== -1 && newPosition + 1 >= minColumn) {\r\n return new Position(position.lineNumber, newPosition + 1);\r\n }\r\n }\r\n return this.leftPosition(model, position);\r\n }\r\n static left(config, model, position) {\r\n const pos = config.stickyTabStops\r\n ? MoveOperations.leftPositionAtomicSoftTabs(model, position, config.tabSize)\r\n : MoveOperations.leftPosition(model, position);\r\n return new CursorPosition(pos.lineNumber, pos.column, 0);\r\n }\r\n /**\r\n * @param noOfColumns Must be either `1`\r\n * or `Math.round(viewModel.getLineContent(viewLineNumber).length / 2)` (for half lines).\r\n */\r\n static moveLeft(config, model, cursor, inSelectionMode, noOfColumns) {\r\n let lineNumber, column;\r\n if (cursor.hasSelection() && !inSelectionMode) {\r\n // If the user has a selection and does not want to extend it,\r\n // put the cursor at the beginning of the selection.\r\n lineNumber = cursor.selection.startLineNumber;\r\n column = cursor.selection.startColumn;\r\n }\r\n else {\r\n // This has no effect if noOfColumns === 1.\r\n // It is ok to do so in the half-line scenario.\r\n const pos = cursor.position.delta(undefined, -(noOfColumns - 1));\r\n // We clip the position before normalization, as normalization is not defined\r\n // for possibly negative columns.\r\n const normalizedPos = model.normalizePosition(MoveOperations.clipPositionColumn(pos, model), 0 /* Left */);\r\n const p = MoveOperations.left(config, model, normalizedPos);\r\n lineNumber = p.lineNumber;\r\n column = p.column;\r\n }\r\n return cursor.move(inSelectionMode, lineNumber, column, 0);\r\n }\r\n /**\r\n * Adjusts the column so that it is within min/max of the line.\r\n */\r\n static clipPositionColumn(position, model) {\r\n return new Position(position.lineNumber, MoveOperations.clipRange(position.column, model.getLineMinColumn(position.lineNumber), model.getLineMaxColumn(position.lineNumber)));\r\n }\r\n static clipRange(value, min, max) {\r\n if (value < min) {\r\n return min;\r\n }\r\n if (value > max) {\r\n return max;\r\n }\r\n return value;\r\n }\r\n static rightPosition(model, lineNumber, column) {\r\n if (column < model.getLineMaxColumn(lineNumber)) {\r\n column = column + strings.nextCharLength(model.getLineContent(lineNumber), column - 1);\r\n }\r\n else if (lineNumber < model.getLineCount()) {\r\n lineNumber = lineNumber + 1;\r\n column = model.getLineMinColumn(lineNumber);\r\n }\r\n return new Position(lineNumber, column);\r\n }\r\n static rightPositionAtomicSoftTabs(model, lineNumber, column, tabSize, indentSize) {\r\n if (column < model.getLineIndentColumn(lineNumber)) {\r\n const lineContent = model.getLineContent(lineNumber);\r\n const newPosition = AtomicTabMoveOperations.atomicPosition(lineContent, column - 1, tabSize, 1 /* Right */);\r\n if (newPosition !== -1) {\r\n return new Position(lineNumber, newPosition + 1);\r\n }\r\n }\r\n return this.rightPosition(model, lineNumber, column);\r\n }\r\n static right(config, model, position) {\r\n const pos = config.stickyTabStops\r\n ? MoveOperations.rightPositionAtomicSoftTabs(model, position.lineNumber, position.column, config.tabSize, config.indentSize)\r\n : MoveOperations.rightPosition(model, position.lineNumber, position.column);\r\n return new CursorPosition(pos.lineNumber, pos.column, 0);\r\n }\r\n static moveRight(config, model, cursor, inSelectionMode, noOfColumns) {\r\n let lineNumber, column;\r\n if (cursor.hasSelection() && !inSelectionMode) {\r\n // If we are in selection mode, move right without selection cancels selection and puts cursor at the end of the selection\r\n lineNumber = cursor.selection.endLineNumber;\r\n column = cursor.selection.endColumn;\r\n }\r\n else {\r\n const pos = cursor.position.delta(undefined, noOfColumns - 1);\r\n const normalizedPos = model.normalizePosition(MoveOperations.clipPositionColumn(pos, model), 1 /* Right */);\r\n const r = MoveOperations.right(config, model, normalizedPos);\r\n lineNumber = r.lineNumber;\r\n column = r.column;\r\n }\r\n return cursor.move(inSelectionMode, lineNumber, column, 0);\r\n }\r\n static down(config, model, lineNumber, column, leftoverVisibleColumns, count, allowMoveOnLastLine) {\r\n const currentVisibleColumn = CursorColumns.visibleColumnFromColumn(model.getLineContent(lineNumber), column, config.tabSize) + leftoverVisibleColumns;\r\n const lineCount = model.getLineCount();\r\n const wasOnLastPosition = (lineNumber === lineCount && column === model.getLineMaxColumn(lineNumber));\r\n lineNumber = lineNumber + count;\r\n if (lineNumber > lineCount) {\r\n lineNumber = lineCount;\r\n if (allowMoveOnLastLine) {\r\n column = model.getLineMaxColumn(lineNumber);\r\n }\r\n else {\r\n column = Math.min(model.getLineMaxColumn(lineNumber), column);\r\n }\r\n }\r\n else {\r\n column = CursorColumns.columnFromVisibleColumn2(config, model, lineNumber, currentVisibleColumn);\r\n }\r\n if (wasOnLastPosition) {\r\n leftoverVisibleColumns = 0;\r\n }\r\n else {\r\n leftoverVisibleColumns = currentVisibleColumn - CursorColumns.visibleColumnFromColumn(model.getLineContent(lineNumber), column, config.tabSize);\r\n }\r\n return new CursorPosition(lineNumber, column, leftoverVisibleColumns);\r\n }\r\n static moveDown(config, model, cursor, inSelectionMode, linesCount) {\r\n let lineNumber, column;\r\n if (cursor.hasSelection() && !inSelectionMode) {\r\n // If we are in selection mode, move down acts relative to the end of selection\r\n lineNumber = cursor.selection.endLineNumber;\r\n column = cursor.selection.endColumn;\r\n }\r\n else {\r\n lineNumber = cursor.position.lineNumber;\r\n column = cursor.position.column;\r\n }\r\n let r = MoveOperations.down(config, model, lineNumber, column, cursor.leftoverVisibleColumns, linesCount, true);\r\n return cursor.move(inSelectionMode, r.lineNumber, r.column, r.leftoverVisibleColumns);\r\n }\r\n static translateDown(config, model, cursor) {\r\n let selection = cursor.selection;\r\n let selectionStart = MoveOperations.down(config, model, selection.selectionStartLineNumber, selection.selectionStartColumn, cursor.selectionStartLeftoverVisibleColumns, 1, false);\r\n let position = MoveOperations.down(config, model, selection.positionLineNumber, selection.positionColumn, cursor.leftoverVisibleColumns, 1, false);\r\n return new SingleCursorState(new Range(selectionStart.lineNumber, selectionStart.column, selectionStart.lineNumber, selectionStart.column), selectionStart.leftoverVisibleColumns, new Position(position.lineNumber, position.column), position.leftoverVisibleColumns);\r\n }\r\n static up(config, model, lineNumber, column, leftoverVisibleColumns, count, allowMoveOnFirstLine) {\r\n const currentVisibleColumn = CursorColumns.visibleColumnFromColumn(model.getLineContent(lineNumber), column, config.tabSize) + leftoverVisibleColumns;\r\n const wasOnFirstPosition = (lineNumber === 1 && column === 1);\r\n lineNumber = lineNumber - count;\r\n if (lineNumber < 1) {\r\n lineNumber = 1;\r\n if (allowMoveOnFirstLine) {\r\n column = model.getLineMinColumn(lineNumber);\r\n }\r\n else {\r\n column = Math.min(model.getLineMaxColumn(lineNumber), column);\r\n }\r\n }\r\n else {\r\n column = CursorColumns.columnFromVisibleColumn2(config, model, lineNumber, currentVisibleColumn);\r\n }\r\n if (wasOnFirstPosition) {\r\n leftoverVisibleColumns = 0;\r\n }\r\n else {\r\n leftoverVisibleColumns = currentVisibleColumn - CursorColumns.visibleColumnFromColumn(model.getLineContent(lineNumber), column, config.tabSize);\r\n }\r\n return new CursorPosition(lineNumber, column, leftoverVisibleColumns);\r\n }\r\n static moveUp(config, model, cursor, inSelectionMode, linesCount) {\r\n let lineNumber, column;\r\n if (cursor.hasSelection() && !inSelectionMode) {\r\n // If we are in selection mode, move up acts relative to the beginning of selection\r\n lineNumber = cursor.selection.startLineNumber;\r\n column = cursor.selection.startColumn;\r\n }\r\n else {\r\n lineNumber = cursor.position.lineNumber;\r\n column = cursor.position.column;\r\n }\r\n let r = MoveOperations.up(config, model, lineNumber, column, cursor.leftoverVisibleColumns, linesCount, true);\r\n return cursor.move(inSelectionMode, r.lineNumber, r.column, r.leftoverVisibleColumns);\r\n }\r\n static translateUp(config, model, cursor) {\r\n let selection = cursor.selection;\r\n let selectionStart = MoveOperations.up(config, model, selection.selectionStartLineNumber, selection.selectionStartColumn, cursor.selectionStartLeftoverVisibleColumns, 1, false);\r\n let position = MoveOperations.up(config, model, selection.positionLineNumber, selection.positionColumn, cursor.leftoverVisibleColumns, 1, false);\r\n return new SingleCursorState(new Range(selectionStart.lineNumber, selectionStart.column, selectionStart.lineNumber, selectionStart.column), selectionStart.leftoverVisibleColumns, new Position(position.lineNumber, position.column), position.leftoverVisibleColumns);\r\n }\r\n static _isBlankLine(model, lineNumber) {\r\n if (model.getLineFirstNonWhitespaceColumn(lineNumber) === 0) {\r\n // empty or contains only whitespace\r\n return true;\r\n }\r\n return false;\r\n }\r\n static moveToPrevBlankLine(config, model, cursor, inSelectionMode) {\r\n let lineNumber = cursor.position.lineNumber;\r\n // If our current line is blank, move to the previous non-blank line\r\n while (lineNumber > 1 && this._isBlankLine(model, lineNumber)) {\r\n lineNumber--;\r\n }\r\n // Find the previous blank line\r\n while (lineNumber > 1 && !this._isBlankLine(model, lineNumber)) {\r\n lineNumber--;\r\n }\r\n return cursor.move(inSelectionMode, lineNumber, model.getLineMinColumn(lineNumber), 0);\r\n }\r\n static moveToNextBlankLine(config, model, cursor, inSelectionMode) {\r\n const lineCount = model.getLineCount();\r\n let lineNumber = cursor.position.lineNumber;\r\n // If our current line is blank, move to the next non-blank line\r\n while (lineNumber < lineCount && this._isBlankLine(model, lineNumber)) {\r\n lineNumber++;\r\n }\r\n // Find the next blank line\r\n while (lineNumber < lineCount && !this._isBlankLine(model, lineNumber)) {\r\n lineNumber++;\r\n }\r\n return cursor.move(inSelectionMode, lineNumber, model.getLineMinColumn(lineNumber), 0);\r\n }\r\n static moveToBeginningOfLine(config, model, cursor, inSelectionMode) {\r\n let lineNumber = cursor.position.lineNumber;\r\n let minColumn = model.getLineMinColumn(lineNumber);\r\n let firstNonBlankColumn = model.getLineFirstNonWhitespaceColumn(lineNumber) || minColumn;\r\n let column;\r\n let relevantColumnNumber = cursor.position.column;\r\n if (relevantColumnNumber === firstNonBlankColumn) {\r\n column = minColumn;\r\n }\r\n else {\r\n column = firstNonBlankColumn;\r\n }\r\n return cursor.move(inSelectionMode, lineNumber, column, 0);\r\n }\r\n static moveToEndOfLine(config, model, cursor, inSelectionMode, sticky) {\r\n let lineNumber = cursor.position.lineNumber;\r\n let maxColumn = model.getLineMaxColumn(lineNumber);\r\n return cursor.move(inSelectionMode, lineNumber, maxColumn, sticky ? 1073741824 /* MAX_SAFE_SMALL_INTEGER */ - maxColumn : 0);\r\n }\r\n static moveToBeginningOfBuffer(config, model, cursor, inSelectionMode) {\r\n return cursor.move(inSelectionMode, 1, 1, 0);\r\n }\r\n static moveToEndOfBuffer(config, model, cursor, inSelectionMode) {\r\n let lastLineNumber = model.getLineCount();\r\n let lastColumn = model.getLineMaxColumn(lastLineNumber);\r\n return cursor.move(inSelectionMode, lastLineNumber, lastColumn, 0);\r\n }\r\n}\r\n", "/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License. See License.txt in the project root for license information.\r\n *--------------------------------------------------------------------------------------------*/\r\nimport * as strings from '../../../base/common/strings.js';\r\nimport { ReplaceCommand } from '../commands/replaceCommand.js';\r\nimport { CursorColumns, EditOperationResult, isQuote } from './cursorCommon.js';\r\nimport { MoveOperations } from './cursorMoveOperations.js';\r\nimport { Range } from '../core/range.js';\r\nimport { Position } from '../core/position.js';\r\nexport class DeleteOperations {\r\n static deleteRight(prevEditOperationType, config, model, selections) {\r\n let commands = [];\r\n let shouldPushStackElementBefore = (prevEditOperationType !== 3 /* DeletingRight */);\r\n for (let i = 0, len = selections.length; i < len; i++) {\r\n const selection = selections[i];\r\n let deleteSelection = selection;\r\n if (deleteSelection.isEmpty()) {\r\n let position = selection.getPosition();\r\n let rightOfPosition = MoveOperations.right(config, model, position);\r\n deleteSelection = new Range(rightOfPosition.lineNumber, rightOfPosition.column, position.lineNumber, position.column);\r\n }\r\n if (deleteSelection.isEmpty()) {\r\n // Probably at end of file => ignore\r\n commands[i] = null;\r\n continue;\r\n }\r\n if (deleteSelection.startLineNumber !== deleteSelection.endLineNumber) {\r\n shouldPushStackElementBefore = true;\r\n }\r\n commands[i] = new ReplaceCommand(deleteSelection, '');\r\n }\r\n return [shouldPushStackElementBefore, commands];\r\n }\r\n static isAutoClosingPairDelete(autoClosingDelete, autoClosingBrackets, autoClosingQuotes, autoClosingPairsOpen, model, selections, autoClosedCharacters) {\r\n if (autoClosingBrackets === 'never' && autoClosingQuotes === 'never') {\r\n return false;\r\n }\r\n if (autoClosingDelete === 'never') {\r\n return false;\r\n }\r\n for (let i = 0, len = selections.length; i < len; i++) {\r\n const selection = selections[i];\r\n const position = selection.getPosition();\r\n if (!selection.isEmpty()) {\r\n return false;\r\n }\r\n const lineText = model.getLineContent(position.lineNumber);\r\n if (position.column < 2 || position.column >= lineText.length + 1) {\r\n return false;\r\n }\r\n const character = lineText.charAt(position.column - 2);\r\n const autoClosingPairCandidates = autoClosingPairsOpen.get(character);\r\n if (!autoClosingPairCandidates) {\r\n return false;\r\n }\r\n if (isQuote(character)) {\r\n if (autoClosingQuotes === 'never') {\r\n return false;\r\n }\r\n }\r\n else {\r\n if (autoClosingBrackets === 'never') {\r\n return false;\r\n }\r\n }\r\n const afterCharacter = lineText.charAt(position.column - 1);\r\n let foundAutoClosingPair = false;\r\n for (const autoClosingPairCandidate of autoClosingPairCandidates) {\r\n if (autoClosingPairCandidate.open === character && autoClosingPairCandidate.close === afterCharacter) {\r\n foundAutoClosingPair = true;\r\n }\r\n }\r\n if (!foundAutoClosingPair) {\r\n return false;\r\n }\r\n // Must delete the pair only if it was automatically inserted by the editor\r\n if (autoClosingDelete === 'auto') {\r\n let found = false;\r\n for (let j = 0, lenJ = autoClosedCharacters.length; j < lenJ; j++) {\r\n const autoClosedCharacter = autoClosedCharacters[j];\r\n if (position.lineNumber === autoClosedCharacter.startLineNumber && position.column === autoClosedCharacter.startColumn) {\r\n found = true;\r\n break;\r\n }\r\n }\r\n if (!found) {\r\n return false;\r\n }\r\n }\r\n }\r\n return true;\r\n }\r\n static _runAutoClosingPairDelete(config, model, selections) {\r\n let commands = [];\r\n for (let i = 0, len = selections.length; i < len; i++) {\r\n const position = selections[i].getPosition();\r\n const deleteSelection = new Range(position.lineNumber, position.column - 1, position.lineNumber, position.column + 1);\r\n commands[i] = new ReplaceCommand(deleteSelection, '');\r\n }\r\n return [true, commands];\r\n }\r\n static deleteLeft(prevEditOperationType, config, model, selections, autoClosedCharacters) {\r\n if (this.isAutoClosingPairDelete(config.autoClosingDelete, config.autoClosingBrackets, config.autoClosingQuotes, config.autoClosingPairs.autoClosingPairsOpenByEnd, model, selections, autoClosedCharacters)) {\r\n return this._runAutoClosingPairDelete(config, model, selections);\r\n }\r\n const commands = [];\r\n let shouldPushStackElementBefore = (prevEditOperationType !== 2 /* DeletingLeft */);\r\n for (let i = 0, len = selections.length; i < len; i++) {\r\n let deleteRange = DeleteOperations.getDeleteRange(selections[i], model, config);\r\n // Ignore empty delete ranges, as they have no effect\r\n // They happen if the cursor is at the beginning of the file.\r\n if (deleteRange.isEmpty()) {\r\n commands[i] = null;\r\n continue;\r\n }\r\n if (deleteRange.startLineNumber !== deleteRange.endLineNumber) {\r\n shouldPushStackElementBefore = true;\r\n }\r\n commands[i] = new ReplaceCommand(deleteRange, '');\r\n }\r\n return [shouldPushStackElementBefore, commands];\r\n }\r\n static getDeleteRange(selection, model, config) {\r\n if (!selection.isEmpty()) {\r\n return selection;\r\n }\r\n const position = selection.getPosition();\r\n // Unintend when using tab stops and cursor is within indentation\r\n if (config.useTabStops && position.column > 1) {\r\n const lineContent = model.getLineContent(position.lineNumber);\r\n const firstNonWhitespaceIndex = strings.firstNonWhitespaceIndex(lineContent);\r\n const lastIndentationColumn = (firstNonWhitespaceIndex === -1\r\n ? /* entire string is whitespace */ lineContent.length + 1\r\n : firstNonWhitespaceIndex + 1);\r\n if (position.column <= lastIndentationColumn) {\r\n const fromVisibleColumn = CursorColumns.visibleColumnFromColumn2(config, model, position);\r\n const toVisibleColumn = CursorColumns.prevIndentTabStop(fromVisibleColumn, config.indentSize);\r\n const toColumn = CursorColumns.columnFromVisibleColumn2(config, model, position.lineNumber, toVisibleColumn);\r\n return new Range(position.lineNumber, toColumn, position.lineNumber, position.column);\r\n }\r\n }\r\n return Range.fromPositions(DeleteOperations.getPositionAfterDeleteLeft(position, model), position);\r\n }\r\n static getPositionAfterDeleteLeft(position, model) {\r\n if (position.column > 1) {\r\n // Convert 1-based columns to 0-based offsets and back.\r\n const idx = strings.getLeftDeleteOffset(position.column - 1, model.getLineContent(position.lineNumber));\r\n return position.with(undefined, idx + 1);\r\n }\r\n else if (position.lineNumber > 1) {\r\n const newLine = position.lineNumber - 1;\r\n return new Position(newLine, model.getLineMaxColumn(newLine));\r\n }\r\n else {\r\n return position;\r\n }\r\n }\r\n static cut(config, model, selections) {\r\n let commands = [];\r\n for (let i = 0, len = selections.length; i < len; i++) {\r\n const selection = selections[i];\r\n if (selection.isEmpty()) {\r\n if (config.emptySelectionClipboard) {\r\n // This is a full line cut\r\n let position = selection.getPosition();\r\n let startLineNumber, startColumn, endLineNumber, endColumn;\r\n if (position.lineNumber < model.getLineCount()) {\r\n // Cutting a line in the middle of the model\r\n startLineNumber = position.lineNumber;\r\n startColumn = 1;\r\n endLineNumber = position.lineNumber + 1;\r\n endColumn = 1;\r\n }\r\n else if (position.lineNumber > 1) {\r\n // Cutting the last line & there are more than 1 lines in the model\r\n startLineNumber = position.lineNumber - 1;\r\n startColumn = model.getLineMaxColumn(position.lineNumber - 1);\r\n endLineNumber = position.lineNumber;\r\n endColumn = model.getLineMaxColumn(position.lineNumber);\r\n }\r\n else {\r\n // Cutting the single line that the model contains\r\n startLineNumber = position.lineNumber;\r\n startColumn = 1;\r\n endLineNumber = position.lineNumber;\r\n endColumn = model.getLineMaxColumn(position.lineNumber);\r\n }\r\n let deleteSelection = new Range(startLineNumber, startColumn, endLineNumber, endColumn);\r\n if (!deleteSelection.isEmpty()) {\r\n commands[i] = new ReplaceCommand(deleteSelection, '');\r\n }\r\n else {\r\n commands[i] = null;\r\n }\r\n }\r\n else {\r\n // Cannot cut empty selection\r\n commands[i] = null;\r\n }\r\n }\r\n else {\r\n commands[i] = new ReplaceCommand(selection, '');\r\n }\r\n }\r\n return new EditOperationResult(0 /* Other */, commands, {\r\n shouldPushStackElementBefore: true,\r\n shouldPushStackElementAfter: true\r\n });\r\n }\r\n}\r\n", "/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License. See License.txt in the project root for license information.\r\n *--------------------------------------------------------------------------------------------*/\r\nimport * as strings from '../../../base/common/strings.js';\r\nimport { SingleCursorState } from './cursorCommon.js';\r\nimport { DeleteOperations } from './cursorDeleteOperations.js';\r\nimport { getMapForWordSeparators } from './wordCharacterClassifier.js';\r\nimport { Position } from '../core/position.js';\r\nimport { Range } from '../core/range.js';\r\nexport class WordOperations {\r\n static _createWord(lineContent, wordType, nextCharClass, start, end) {\r\n // console.log('WORD ==> ' + start + ' => ' + end + ':::: <<<' + lineContent.substring(start, end) + '>>>');\r\n return { start: start, end: end, wordType: wordType, nextCharClass: nextCharClass };\r\n }\r\n static _findPreviousWordOnLine(wordSeparators, model, position) {\r\n let lineContent = model.getLineContent(position.lineNumber);\r\n return this._doFindPreviousWordOnLine(lineContent, wordSeparators, position);\r\n }\r\n static _doFindPreviousWordOnLine(lineContent, wordSeparators, position) {\r\n let wordType = 0 /* None */;\r\n for (let chIndex = position.column - 2; chIndex >= 0; chIndex--) {\r\n let chCode = lineContent.charCodeAt(chIndex);\r\n let chClass = wordSeparators.get(chCode);\r\n if (chClass === 0 /* Regular */) {\r\n if (wordType === 2 /* Separator */) {\r\n return this._createWord(lineContent, wordType, chClass, chIndex + 1, this._findEndOfWord(lineContent, wordSeparators, wordType, chIndex + 1));\r\n }\r\n wordType = 1 /* Regular */;\r\n }\r\n else if (chClass === 2 /* WordSeparator */) {\r\n if (wordType === 1 /* Regular */) {\r\n return this._createWord(lineContent, wordType, chClass, chIndex + 1, this._findEndOfWord(lineContent, wordSeparators, wordType, chIndex + 1));\r\n }\r\n wordType = 2 /* Separator */;\r\n }\r\n else if (chClass === 1 /* Whitespace */) {\r\n if (wordType !== 0 /* None */) {\r\n return this._createWord(lineContent, wordType, chClass, chIndex + 1, this._findEndOfWord(lineContent, wordSeparators, wordType, chIndex + 1));\r\n }\r\n }\r\n }\r\n if (wordType !== 0 /* None */) {\r\n return this._createWord(lineContent, wordType, 1 /* Whitespace */, 0, this._findEndOfWord(lineContent, wordSeparators, wordType, 0));\r\n }\r\n return null;\r\n }\r\n static _findEndOfWord(lineContent, wordSeparators, wordType, startIndex) {\r\n let len = lineContent.length;\r\n for (let chIndex = startIndex; chIndex < len; chIndex++) {\r\n let chCode = lineContent.charCodeAt(chIndex);\r\n let chClass = wordSeparators.get(chCode);\r\n if (chClass === 1 /* Whitespace */) {\r\n return chIndex;\r\n }\r\n if (wordType === 1 /* Regular */ && chClass === 2 /* WordSeparator */) {\r\n return chIndex;\r\n }\r\n if (wordType === 2 /* Separator */ && chClass === 0 /* Regular */) {\r\n return chIndex;\r\n }\r\n }\r\n return len;\r\n }\r\n static _findNextWordOnLine(wordSeparators, model, position) {\r\n let lineContent = model.getLineContent(position.lineNumber);\r\n return this._doFindNextWordOnLine(lineContent, wordSeparators, position);\r\n }\r\n static _doFindNextWordOnLine(lineContent, wordSeparators, position) {\r\n let wordType = 0 /* None */;\r\n let len = lineContent.length;\r\n for (let chIndex = position.column - 1; chIndex < len; chIndex++) {\r\n let chCode = lineContent.charCodeAt(chIndex);\r\n let chClass = wordSeparators.get(chCode);\r\n if (chClass === 0 /* Regular */) {\r\n if (wordType === 2 /* Separator */) {\r\n return this._createWord(lineContent, wordType, chClass, this._findStartOfWord(lineContent, wordSeparators, wordType, chIndex - 1), chIndex);\r\n }\r\n wordType = 1 /* Regular */;\r\n }\r\n else if (chClass === 2 /* WordSeparator */) {\r\n if (wordType === 1 /* Regular */) {\r\n return this._createWord(lineContent, wordType, chClass, this._findStartOfWord(lineContent, wordSeparators, wordType, chIndex - 1), chIndex);\r\n }\r\n wordType = 2 /* Separator */;\r\n }\r\n else if (chClass === 1 /* Whitespace */) {\r\n if (wordType !== 0 /* None */) {\r\n return this._createWord(lineContent, wordType, chClass, this._findStartOfWord(lineContent, wordSeparators, wordType, chIndex - 1), chIndex);\r\n }\r\n }\r\n }\r\n if (wordType !== 0 /* None */) {\r\n return this._createWord(lineContent, wordType, 1 /* Whitespace */, this._findStartOfWord(lineContent, wordSeparators, wordType, len - 1), len);\r\n }\r\n return null;\r\n }\r\n static _findStartOfWord(lineContent, wordSeparators, wordType, startIndex) {\r\n for (let chIndex = startIndex; chIndex >= 0; chIndex--) {\r\n let chCode = lineContent.charCodeAt(chIndex);\r\n let chClass = wordSeparators.get(chCode);\r\n if (chClass === 1 /* Whitespace */) {\r\n return chIndex + 1;\r\n }\r\n if (wordType === 1 /* Regular */ && chClass === 2 /* WordSeparator */) {\r\n return chIndex + 1;\r\n }\r\n if (wordType === 2 /* Separator */ && chClass === 0 /* Regular */) {\r\n return chIndex + 1;\r\n }\r\n }\r\n return 0;\r\n }\r\n static moveWordLeft(wordSeparators, model, position, wordNavigationType) {\r\n let lineNumber = position.lineNumber;\r\n let column = position.column;\r\n if (column === 1) {\r\n if (lineNumber > 1) {\r\n lineNumber = lineNumber - 1;\r\n column = model.getLineMaxColumn(lineNumber);\r\n }\r\n }\r\n let prevWordOnLine = WordOperations._findPreviousWordOnLine(wordSeparators, model, new Position(lineNumber, column));\r\n if (wordNavigationType === 0 /* WordStart */) {\r\n return new Position(lineNumber, prevWordOnLine ? prevWordOnLine.start + 1 : 1);\r\n }\r\n if (wordNavigationType === 1 /* WordStartFast */) {\r\n if (prevWordOnLine\r\n && prevWordOnLine.wordType === 2 /* Separator */\r\n && prevWordOnLine.end - prevWordOnLine.start === 1\r\n && prevWordOnLine.nextCharClass === 0 /* Regular */) {\r\n // Skip over a word made up of one single separator and followed by a regular character\r\n prevWordOnLine = WordOperations._findPreviousWordOnLine(wordSeparators, model, new Position(lineNumber, prevWordOnLine.start + 1));\r\n }\r\n return new Position(lineNumber, prevWordOnLine ? prevWordOnLine.start + 1 : 1);\r\n }\r\n if (wordNavigationType === 3 /* WordAccessibility */) {\r\n while (prevWordOnLine\r\n && prevWordOnLine.wordType === 2 /* Separator */) {\r\n // Skip over words made up of only separators\r\n prevWordOnLine = WordOperations._findPreviousWordOnLine(wordSeparators, model, new Position(lineNumber, prevWordOnLine.start + 1));\r\n }\r\n return new Position(lineNumber, prevWordOnLine ? prevWordOnLine.start + 1 : 1);\r\n }\r\n // We are stopping at the ending of words\r\n if (prevWordOnLine && column <= prevWordOnLine.end + 1) {\r\n prevWordOnLine = WordOperations._findPreviousWordOnLine(wordSeparators, model, new Position(lineNumber, prevWordOnLine.start + 1));\r\n }\r\n return new Position(lineNumber, prevWordOnLine ? prevWordOnLine.end + 1 : 1);\r\n }\r\n static _moveWordPartLeft(model, position) {\r\n const lineNumber = position.lineNumber;\r\n const maxColumn = model.getLineMaxColumn(lineNumber);\r\n if (position.column === 1) {\r\n return (lineNumber > 1 ? new Position(lineNumber - 1, model.getLineMaxColumn(lineNumber - 1)) : position);\r\n }\r\n const lineContent = model.getLineContent(lineNumber);\r\n for (let column = position.column - 1; column > 1; column--) {\r\n const left = lineContent.charCodeAt(column - 2);\r\n const right = lineContent.charCodeAt(column - 1);\r\n if (left === 95 /* Underline */ && right !== 95 /* Underline */) {\r\n // snake_case_variables\r\n return new Position(lineNumber, column);\r\n }\r\n if (strings.isLowerAsciiLetter(left) && strings.isUpperAsciiLetter(right)) {\r\n // camelCaseVariables\r\n return new Position(lineNumber, column);\r\n }\r\n if (strings.isUpperAsciiLetter(left) && strings.isUpperAsciiLetter(right)) {\r\n // thisIsACamelCaseWithOneLetterWords\r\n if (column + 1 < maxColumn) {\r\n const rightRight = lineContent.charCodeAt(column);\r\n if (strings.isLowerAsciiLetter(rightRight)) {\r\n return new Position(lineNumber, column);\r\n }\r\n }\r\n }\r\n }\r\n return new Position(lineNumber, 1);\r\n }\r\n static moveWordRight(wordSeparators, model, position, wordNavigationType) {\r\n let lineNumber = position.lineNumber;\r\n let column = position.column;\r\n let movedDown = false;\r\n if (column === model.getLineMaxColumn(lineNumber)) {\r\n if (lineNumber < model.getLineCount()) {\r\n movedDown = true;\r\n lineNumber = lineNumber + 1;\r\n column = 1;\r\n }\r\n }\r\n let nextWordOnLine = WordOperations._findNextWordOnLine(wordSeparators, model, new Position(lineNumber, column));\r\n if (wordNavigationType === 2 /* WordEnd */) {\r\n if (nextWordOnLine && nextWordOnLine.wordType === 2 /* Separator */) {\r\n if (nextWordOnLine.end - nextWordOnLine.start === 1 && nextWordOnLine.nextCharClass === 0 /* Regular */) {\r\n // Skip over a word made up of one single separator and followed by a regular character\r\n nextWordOnLine = WordOperations._findNextWordOnLine(wordSeparators, model, new Position(lineNumber, nextWordOnLine.end + 1));\r\n }\r\n }\r\n if (nextWordOnLine) {\r\n column = nextWordOnLine.end + 1;\r\n }\r\n else {\r\n column = model.getLineMaxColumn(lineNumber);\r\n }\r\n }\r\n else if (wordNavigationType === 3 /* WordAccessibility */) {\r\n if (movedDown) {\r\n // If we move to the next line, pretend that the cursor is right before the first character.\r\n // This is needed when the first word starts right at the first character - and in order not to miss it,\r\n // we need to start before.\r\n column = 0;\r\n }\r\n while (nextWordOnLine\r\n && (nextWordOnLine.wordType === 2 /* Separator */\r\n || nextWordOnLine.start + 1 <= column)) {\r\n // Skip over a word made up of one single separator\r\n // Also skip over word if it begins before current cursor position to ascertain we're moving forward at least 1 character.\r\n nextWordOnLine = WordOperations._findNextWordOnLine(wordSeparators, model, new Position(lineNumber, nextWordOnLine.end + 1));\r\n }\r\n if (nextWordOnLine) {\r\n column = nextWordOnLine.start + 1;\r\n }\r\n else {\r\n column = model.getLineMaxColumn(lineNumber);\r\n }\r\n }\r\n else {\r\n if (nextWordOnLine && !movedDown && column >= nextWordOnLine.start + 1) {\r\n nextWordOnLine = WordOperations._findNextWordOnLine(wordSeparators, model, new Position(lineNumber, nextWordOnLine.end + 1));\r\n }\r\n if (nextWordOnLine) {\r\n column = nextWordOnLine.start + 1;\r\n }\r\n else {\r\n column = model.getLineMaxColumn(lineNumber);\r\n }\r\n }\r\n return new Position(lineNumber, column);\r\n }\r\n static _moveWordPartRight(model, position) {\r\n const lineNumber = position.lineNumber;\r\n const maxColumn = model.getLineMaxColumn(lineNumber);\r\n if (position.column === maxColumn) {\r\n return (lineNumber < model.getLineCount() ? new Position(lineNumber + 1, 1) : position);\r\n }\r\n const lineContent = model.getLineContent(lineNumber);\r\n for (let column = position.column + 1; column < maxColumn; column++) {\r\n const left = lineContent.charCodeAt(column - 2);\r\n const right = lineContent.charCodeAt(column - 1);\r\n if (left !== 95 /* Underline */ && right === 95 /* Underline */) {\r\n // snake_case_variables\r\n return new Position(lineNumber, column);\r\n }\r\n if (strings.isLowerAsciiLetter(left) && strings.isUpperAsciiLetter(right)) {\r\n // camelCaseVariables\r\n return new Position(lineNumber, column);\r\n }\r\n if (strings.isUpperAsciiLetter(left) && strings.isUpperAsciiLetter(right)) {\r\n // thisIsACamelCaseWithOneLetterWords\r\n if (column + 1 < maxColumn) {\r\n const rightRight = lineContent.charCodeAt(column);\r\n if (strings.isLowerAsciiLetter(rightRight)) {\r\n return new Position(lineNumber, column);\r\n }\r\n }\r\n }\r\n }\r\n return new Position(lineNumber, maxColumn);\r\n }\r\n static _deleteWordLeftWhitespace(model, position) {\r\n const lineContent = model.getLineContent(position.lineNumber);\r\n const startIndex = position.column - 2;\r\n const lastNonWhitespace = strings.lastNonWhitespaceIndex(lineContent, startIndex);\r\n if (lastNonWhitespace + 1 < startIndex) {\r\n return new Range(position.lineNumber, lastNonWhitespace + 2, position.lineNumber, position.column);\r\n }\r\n return null;\r\n }\r\n static deleteWordLeft(ctx, wordNavigationType) {\r\n const wordSeparators = ctx.wordSeparators;\r\n const model = ctx.model;\r\n const selection = ctx.selection;\r\n const whitespaceHeuristics = ctx.whitespaceHeuristics;\r\n if (!selection.isEmpty()) {\r\n return selection;\r\n }\r\n if (DeleteOperations.isAutoClosingPairDelete(ctx.autoClosingDelete, ctx.autoClosingBrackets, ctx.autoClosingQuotes, ctx.autoClosingPairs.autoClosingPairsOpenByEnd, ctx.model, [ctx.selection], ctx.autoClosedCharacters)) {\r\n const position = ctx.selection.getPosition();\r\n return new Range(position.lineNumber, position.column - 1, position.lineNumber, position.column + 1);\r\n }\r\n const position = new Position(selection.positionLineNumber, selection.positionColumn);\r\n let lineNumber = position.lineNumber;\r\n let column = position.column;\r\n if (lineNumber === 1 && column === 1) {\r\n // Ignore deleting at beginning of file\r\n return null;\r\n }\r\n if (whitespaceHeuristics) {\r\n let r = this._deleteWordLeftWhitespace(model, position);\r\n if (r) {\r\n return r;\r\n }\r\n }\r\n let prevWordOnLine = WordOperations._findPreviousWordOnLine(wordSeparators, model, position);\r\n if (wordNavigationType === 0 /* WordStart */) {\r\n if (prevWordOnLine) {\r\n column = prevWordOnLine.start + 1;\r\n }\r\n else {\r\n if (column > 1) {\r\n column = 1;\r\n }\r\n else {\r\n lineNumber--;\r\n column = model.getLineMaxColumn(lineNumber);\r\n }\r\n }\r\n }\r\n else {\r\n if (prevWordOnLine && column <= prevWordOnLine.end + 1) {\r\n prevWordOnLine = WordOperations._findPreviousWordOnLine(wordSeparators, model, new Position(lineNumber, prevWordOnLine.start + 1));\r\n }\r\n if (prevWordOnLine) {\r\n column = prevWordOnLine.end + 1;\r\n }\r\n else {\r\n if (column > 1) {\r\n column = 1;\r\n }\r\n else {\r\n lineNumber--;\r\n column = model.getLineMaxColumn(lineNumber);\r\n }\r\n }\r\n }\r\n return new Range(lineNumber, column, position.lineNumber, position.column);\r\n }\r\n static deleteInsideWord(wordSeparators, model, selection) {\r\n if (!selection.isEmpty()) {\r\n return selection;\r\n }\r\n const position = new Position(selection.positionLineNumber, selection.positionColumn);\r\n let r = this._deleteInsideWordWhitespace(model, position);\r\n if (r) {\r\n return r;\r\n }\r\n return this._deleteInsideWordDetermineDeleteRange(wordSeparators, model, position);\r\n }\r\n static _charAtIsWhitespace(str, index) {\r\n const charCode = str.charCodeAt(index);\r\n return (charCode === 32 /* Space */ || charCode === 9 /* Tab */);\r\n }\r\n static _deleteInsideWordWhitespace(model, position) {\r\n const lineContent = model.getLineContent(position.lineNumber);\r\n const lineContentLength = lineContent.length;\r\n if (lineContentLength === 0) {\r\n // empty line\r\n return null;\r\n }\r\n let leftIndex = Math.max(position.column - 2, 0);\r\n if (!this._charAtIsWhitespace(lineContent, leftIndex)) {\r\n // touches a non-whitespace character to the left\r\n return null;\r\n }\r\n let rightIndex = Math.min(position.column - 1, lineContentLength - 1);\r\n if (!this._charAtIsWhitespace(lineContent, rightIndex)) {\r\n // touches a non-whitespace character to the right\r\n return null;\r\n }\r\n // walk over whitespace to the left\r\n while (leftIndex > 0 && this._charAtIsWhitespace(lineContent, leftIndex - 1)) {\r\n leftIndex--;\r\n }\r\n // walk over whitespace to the right\r\n while (rightIndex + 1 < lineContentLength && this._charAtIsWhitespace(lineContent, rightIndex + 1)) {\r\n rightIndex++;\r\n }\r\n return new Range(position.lineNumber, leftIndex + 1, position.lineNumber, rightIndex + 2);\r\n }\r\n static _deleteInsideWordDetermineDeleteRange(wordSeparators, model, position) {\r\n const lineContent = model.getLineContent(position.lineNumber);\r\n const lineLength = lineContent.length;\r\n if (lineLength === 0) {\r\n // empty line\r\n if (position.lineNumber > 1) {\r\n return new Range(position.lineNumber - 1, model.getLineMaxColumn(position.lineNumber - 1), position.lineNumber, 1);\r\n }\r\n else {\r\n if (position.lineNumber < model.getLineCount()) {\r\n return new Range(position.lineNumber, 1, position.lineNumber + 1, 1);\r\n }\r\n else {\r\n // empty model\r\n return new Range(position.lineNumber, 1, position.lineNumber, 1);\r\n }\r\n }\r\n }\r\n const touchesWord = (word) => {\r\n return (word.start + 1 <= position.column && position.column <= word.end + 1);\r\n };\r\n const createRangeWithPosition = (startColumn, endColumn) => {\r\n startColumn = Math.min(startColumn, position.column);\r\n endColumn = Math.max(endColumn, position.column);\r\n return new Range(position.lineNumber, startColumn, position.lineNumber, endColumn);\r\n };\r\n const deleteWordAndAdjacentWhitespace = (word) => {\r\n let startColumn = word.start + 1;\r\n let endColumn = word.end + 1;\r\n let expandedToTheRight = false;\r\n while (endColumn - 1 < lineLength && this._charAtIsWhitespace(lineContent, endColumn - 1)) {\r\n expandedToTheRight = true;\r\n endColumn++;\r\n }\r\n if (!expandedToTheRight) {\r\n while (startColumn > 1 && this._charAtIsWhitespace(lineContent, startColumn - 2)) {\r\n startColumn--;\r\n }\r\n }\r\n return createRangeWithPosition(startColumn, endColumn);\r\n };\r\n const prevWordOnLine = WordOperations._findPreviousWordOnLine(wordSeparators, model, position);\r\n if (prevWordOnLine && touchesWord(prevWordOnLine)) {\r\n return deleteWordAndAdjacentWhitespace(prevWordOnLine);\r\n }\r\n const nextWordOnLine = WordOperations._findNextWordOnLine(wordSeparators, model, position);\r\n if (nextWordOnLine && touchesWord(nextWordOnLine)) {\r\n return deleteWordAndAdjacentWhitespace(nextWordOnLine);\r\n }\r\n if (prevWordOnLine && nextWordOnLine) {\r\n return createRangeWithPosition(prevWordOnLine.end + 1, nextWordOnLine.start + 1);\r\n }\r\n if (prevWordOnLine) {\r\n return createRangeWithPosition(prevWordOnLine.start + 1, prevWordOnLine.end + 1);\r\n }\r\n if (nextWordOnLine) {\r\n return createRangeWithPosition(nextWordOnLine.start + 1, nextWordOnLine.end + 1);\r\n }\r\n return createRangeWithPosition(1, lineLength + 1);\r\n }\r\n static _deleteWordPartLeft(model, selection) {\r\n if (!selection.isEmpty()) {\r\n return selection;\r\n }\r\n const pos = selection.getPosition();\r\n const toPosition = WordOperations._moveWordPartLeft(model, pos);\r\n return new Range(pos.lineNumber, pos.column, toPosition.lineNumber, toPosition.column);\r\n }\r\n static _findFirstNonWhitespaceChar(str, startIndex) {\r\n let len = str.length;\r\n for (let chIndex = startIndex; chIndex < len; chIndex++) {\r\n let ch = str.charAt(chIndex);\r\n if (ch !== ' ' && ch !== '\\t') {\r\n return chIndex;\r\n }\r\n }\r\n return len;\r\n }\r\n static _deleteWordRightWhitespace(model, position) {\r\n const lineContent = model.getLineContent(position.lineNumber);\r\n const startIndex = position.column - 1;\r\n const firstNonWhitespace = this._findFirstNonWhitespaceChar(lineContent, startIndex);\r\n if (startIndex + 1 < firstNonWhitespace) {\r\n // bingo\r\n return new Range(position.lineNumber, position.column, position.lineNumber, firstNonWhitespace + 1);\r\n }\r\n return null;\r\n }\r\n static deleteWordRight(ctx, wordNavigationType) {\r\n const wordSeparators = ctx.wordSeparators;\r\n const model = ctx.model;\r\n const selection = ctx.selection;\r\n const whitespaceHeuristics = ctx.whitespaceHeuristics;\r\n if (!selection.isEmpty()) {\r\n return selection;\r\n }\r\n const position = new Position(selection.positionLineNumber, selection.positionColumn);\r\n let lineNumber = position.lineNumber;\r\n let column = position.column;\r\n const lineCount = model.getLineCount();\r\n const maxColumn = model.getLineMaxColumn(lineNumber);\r\n if (lineNumber === lineCount && column === maxColumn) {\r\n // Ignore deleting at end of file\r\n return null;\r\n }\r\n if (whitespaceHeuristics) {\r\n let r = this._deleteWordRightWhitespace(model, position);\r\n if (r) {\r\n return r;\r\n }\r\n }\r\n let nextWordOnLine = WordOperations._findNextWordOnLine(wordSeparators, model, position);\r\n if (wordNavigationType === 2 /* WordEnd */) {\r\n if (nextWordOnLine) {\r\n column = nextWordOnLine.end + 1;\r\n }\r\n else {\r\n if (column < maxColumn || lineNumber === lineCount) {\r\n column = maxColumn;\r\n }\r\n else {\r\n lineNumber++;\r\n nextWordOnLine = WordOperations._findNextWordOnLine(wordSeparators, model, new Position(lineNumber, 1));\r\n if (nextWordOnLine) {\r\n column = nextWordOnLine.start + 1;\r\n }\r\n else {\r\n column = model.getLineMaxColumn(lineNumber);\r\n }\r\n }\r\n }\r\n }\r\n else {\r\n if (nextWordOnLine && column >= nextWordOnLine.start + 1) {\r\n nextWordOnLine = WordOperations._findNextWordOnLine(wordSeparators, model, new Position(lineNumber, nextWordOnLine.end + 1));\r\n }\r\n if (nextWordOnLine) {\r\n column = nextWordOnLine.start + 1;\r\n }\r\n else {\r\n if (column < maxColumn || lineNumber === lineCount) {\r\n column = maxColumn;\r\n }\r\n else {\r\n lineNumber++;\r\n nextWordOnLine = WordOperations._findNextWordOnLine(wordSeparators, model, new Position(lineNumber, 1));\r\n if (nextWordOnLine) {\r\n column = nextWordOnLine.start + 1;\r\n }\r\n else {\r\n column = model.getLineMaxColumn(lineNumber);\r\n }\r\n }\r\n }\r\n }\r\n return new Range(lineNumber, column, position.lineNumber, position.column);\r\n }\r\n static _deleteWordPartRight(model, selection) {\r\n if (!selection.isEmpty()) {\r\n return selection;\r\n }\r\n const pos = selection.getPosition();\r\n const toPosition = WordOperations._moveWordPartRight(model, pos);\r\n return new Range(pos.lineNumber, pos.column, toPosition.lineNumber, toPosition.column);\r\n }\r\n static _createWordAtPosition(model, lineNumber, word) {\r\n const range = new Range(lineNumber, word.start + 1, lineNumber, word.end + 1);\r\n return {\r\n word: model.getValueInRange(range),\r\n startColumn: range.startColumn,\r\n endColumn: range.endColumn\r\n };\r\n }\r\n static getWordAtPosition(model, _wordSeparators, position) {\r\n const wordSeparators = getMapForWordSeparators(_wordSeparators);\r\n const prevWord = WordOperations._findPreviousWordOnLine(wordSeparators, model, position);\r\n if (prevWord && prevWord.wordType === 1 /* Regular */ && prevWord.start <= position.column - 1 && position.column - 1 <= prevWord.end) {\r\n return WordOperations._createWordAtPosition(model, position.lineNumber, prevWord);\r\n }\r\n const nextWord = WordOperations._findNextWordOnLine(wordSeparators, model, position);\r\n if (nextWord && nextWord.wordType === 1 /* Regular */ && nextWord.start <= position.column - 1 && position.column - 1 <= nextWord.end) {\r\n return WordOperations._createWordAtPosition(model, position.lineNumber, nextWord);\r\n }\r\n return null;\r\n }\r\n static word(config, model, cursor, inSelectionMode, position) {\r\n const wordSeparators = getMapForWordSeparators(config.wordSeparators);\r\n let prevWord = WordOperations._findPreviousWordOnLine(wordSeparators, model, position);\r\n let nextWord = WordOperations._findNextWordOnLine(wordSeparators, model, position);\r\n if (!inSelectionMode) {\r\n // Entering word selection for the first time\r\n let startColumn;\r\n let endColumn;\r\n if (prevWord && prevWord.wordType === 1 /* Regular */ && prevWord.start <= position.column - 1 && position.column - 1 <= prevWord.end) {\r\n // isTouchingPrevWord\r\n startColumn = prevWord.start + 1;\r\n endColumn = prevWord.end + 1;\r\n }\r\n else if (nextWord && nextWord.wordType === 1 /* Regular */ && nextWord.start <= position.column - 1 && position.column - 1 <= nextWord.end) {\r\n // isTouchingNextWord\r\n startColumn = nextWord.start + 1;\r\n endColumn = nextWord.end + 1;\r\n }\r\n else {\r\n if (prevWord) {\r\n startColumn = prevWord.end + 1;\r\n }\r\n else {\r\n startColumn = 1;\r\n }\r\n if (nextWord) {\r\n endColumn = nextWord.start + 1;\r\n }\r\n else {\r\n endColumn = model.getLineMaxColumn(position.lineNumber);\r\n }\r\n }\r\n return new SingleCursorState(new Range(position.lineNumber, startColumn, position.lineNumber, endColumn), 0, new Position(position.lineNumber, endColumn), 0);\r\n }\r\n let startColumn;\r\n let endColumn;\r\n if (prevWord && prevWord.wordType === 1 /* Regular */ && prevWord.start < position.column - 1 && position.column - 1 < prevWord.end) {\r\n // isInsidePrevWord\r\n startColumn = prevWord.start + 1;\r\n endColumn = prevWord.end + 1;\r\n }\r\n else if (nextWord && nextWord.wordType === 1 /* Regular */ && nextWord.start < position.column - 1 && position.column - 1 < nextWord.end) {\r\n // isInsideNextWord\r\n startColumn = nextWord.start + 1;\r\n endColumn = nextWord.end + 1;\r\n }\r\n else {\r\n startColumn = position.column;\r\n endColumn = position.column;\r\n }\r\n let lineNumber = position.lineNumber;\r\n let column;\r\n if (cursor.selectionStart.containsPosition(position)) {\r\n column = cursor.selectionStart.endColumn;\r\n }\r\n else if (position.isBeforeOrEqual(cursor.selectionStart.getStartPosition())) {\r\n column = startColumn;\r\n let possiblePosition = new Position(lineNumber, column);\r\n if (cursor.selectionStart.containsPosition(possiblePosition)) {\r\n column = cursor.selectionStart.endColumn;\r\n }\r\n }\r\n else {\r\n column = endColumn;\r\n let possiblePosition = new Position(lineNumber, column);\r\n if (cursor.selectionStart.containsPosition(possiblePosition)) {\r\n column = cursor.selectionStart.startColumn;\r\n }\r\n }\r\n return cursor.move(true, lineNumber, column, 0);\r\n }\r\n}\r\nexport class WordPartOperations extends WordOperations {\r\n static deleteWordPartLeft(ctx) {\r\n const candidates = enforceDefined([\r\n WordOperations.deleteWordLeft(ctx, 0 /* WordStart */),\r\n WordOperations.deleteWordLeft(ctx, 2 /* WordEnd */),\r\n WordOperations._deleteWordPartLeft(ctx.model, ctx.selection)\r\n ]);\r\n candidates.sort(Range.compareRangesUsingEnds);\r\n return candidates[2];\r\n }\r\n static deleteWordPartRight(ctx) {\r\n const candidates = enforceDefined([\r\n WordOperations.deleteWordRight(ctx, 0 /* WordStart */),\r\n WordOperations.deleteWordRight(ctx, 2 /* WordEnd */),\r\n WordOperations._deleteWordPartRight(ctx.model, ctx.selection)\r\n ]);\r\n candidates.sort(Range.compareRangesUsingStarts);\r\n return candidates[0];\r\n }\r\n static moveWordPartLeft(wordSeparators, model, position) {\r\n const candidates = enforceDefined([\r\n WordOperations.moveWordLeft(wordSeparators, model, position, 0 /* WordStart */),\r\n WordOperations.moveWordLeft(wordSeparators, model, position, 2 /* WordEnd */),\r\n WordOperations._moveWordPartLeft(model, position)\r\n ]);\r\n candidates.sort(Position.compare);\r\n return candidates[2];\r\n }\r\n static moveWordPartRight(wordSeparators, model, position) {\r\n const candidates = enforceDefined([\r\n WordOperations.moveWordRight(wordSeparators, model, position, 0 /* WordStart */),\r\n WordOperations.moveWordRight(wordSeparators, model, position, 2 /* WordEnd */),\r\n WordOperations._moveWordPartRight(model, position)\r\n ]);\r\n candidates.sort(Position.compare);\r\n return candidates[0];\r\n }\r\n}\r\nfunction enforceDefined(arr) {\r\n return arr.filter(el => Boolean(el));\r\n}\r\n", "/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License. See License.txt in the project root for license information.\r\n *--------------------------------------------------------------------------------------------*/\r\nimport * as types from '../../../base/common/types.js';\r\nimport { CursorState, SingleCursorState } from './cursorCommon.js';\r\nimport { MoveOperations } from './cursorMoveOperations.js';\r\nimport { WordOperations } from './cursorWordOperations.js';\r\nimport { Position } from '../core/position.js';\r\nimport { Range } from '../core/range.js';\r\nexport class CursorMoveCommands {\r\n static addCursorDown(viewModel, cursors, useLogicalLine) {\r\n let result = [], resultLen = 0;\r\n for (let i = 0, len = cursors.length; i < len; i++) {\r\n const cursor = cursors[i];\r\n result[resultLen++] = new CursorState(cursor.modelState, cursor.viewState);\r\n if (useLogicalLine) {\r\n result[resultLen++] = CursorState.fromModelState(MoveOperations.translateDown(viewModel.cursorConfig, viewModel.model, cursor.modelState));\r\n }\r\n else {\r\n result[resultLen++] = CursorState.fromViewState(MoveOperations.translateDown(viewModel.cursorConfig, viewModel, cursor.viewState));\r\n }\r\n }\r\n return result;\r\n }\r\n static addCursorUp(viewModel, cursors, useLogicalLine) {\r\n let result = [], resultLen = 0;\r\n for (let i = 0, len = cursors.length; i < len; i++) {\r\n const cursor = cursors[i];\r\n result[resultLen++] = new CursorState(cursor.modelState, cursor.viewState);\r\n if (useLogicalLine) {\r\n result[resultLen++] = CursorState.fromModelState(MoveOperations.translateUp(viewModel.cursorConfig, viewModel.model, cursor.modelState));\r\n }\r\n else {\r\n result[resultLen++] = CursorState.fromViewState(MoveOperations.translateUp(viewModel.cursorConfig, viewModel, cursor.viewState));\r\n }\r\n }\r\n return result;\r\n }\r\n static moveToBeginningOfLine(viewModel, cursors, inSelectionMode) {\r\n let result = [];\r\n for (let i = 0, len = cursors.length; i < len; i++) {\r\n const cursor = cursors[i];\r\n result[i] = this._moveToLineStart(viewModel, cursor, inSelectionMode);\r\n }\r\n return result;\r\n }\r\n static _moveToLineStart(viewModel, cursor, inSelectionMode) {\r\n const currentViewStateColumn = cursor.viewState.position.column;\r\n const currentModelStateColumn = cursor.modelState.position.column;\r\n const isFirstLineOfWrappedLine = currentViewStateColumn === currentModelStateColumn;\r\n const currentViewStatelineNumber = cursor.viewState.position.lineNumber;\r\n const firstNonBlankColumn = viewModel.getLineFirstNonWhitespaceColumn(currentViewStatelineNumber);\r\n const isBeginningOfViewLine = currentViewStateColumn === firstNonBlankColumn;\r\n if (!isFirstLineOfWrappedLine && !isBeginningOfViewLine) {\r\n return this._moveToLineStartByView(viewModel, cursor, inSelectionMode);\r\n }\r\n else {\r\n return this._moveToLineStartByModel(viewModel, cursor, inSelectionMode);\r\n }\r\n }\r\n static _moveToLineStartByView(viewModel, cursor, inSelectionMode) {\r\n return CursorState.fromViewState(MoveOperations.moveToBeginningOfLine(viewModel.cursorConfig, viewModel, cursor.viewState, inSelectionMode));\r\n }\r\n static _moveToLineStartByModel(viewModel, cursor, inSelectionMode) {\r\n return CursorState.fromModelState(MoveOperations.moveToBeginningOfLine(viewModel.cursorConfig, viewModel.model, cursor.modelState, inSelectionMode));\r\n }\r\n static moveToEndOfLine(viewModel, cursors, inSelectionMode, sticky) {\r\n let result = [];\r\n for (let i = 0, len = cursors.length; i < len; i++) {\r\n const cursor = cursors[i];\r\n result[i] = this._moveToLineEnd(viewModel, cursor, inSelectionMode, sticky);\r\n }\r\n return result;\r\n }\r\n static _moveToLineEnd(viewModel, cursor, inSelectionMode, sticky) {\r\n const viewStatePosition = cursor.viewState.position;\r\n const viewModelMaxColumn = viewModel.getLineMaxColumn(viewStatePosition.lineNumber);\r\n const isEndOfViewLine = viewStatePosition.column === viewModelMaxColumn;\r\n const modelStatePosition = cursor.modelState.position;\r\n const modelMaxColumn = viewModel.model.getLineMaxColumn(modelStatePosition.lineNumber);\r\n const isEndLineOfWrappedLine = viewModelMaxColumn - viewStatePosition.column === modelMaxColumn - modelStatePosition.column;\r\n if (isEndOfViewLine || isEndLineOfWrappedLine) {\r\n return this._moveToLineEndByModel(viewModel, cursor, inSelectionMode, sticky);\r\n }\r\n else {\r\n return this._moveToLineEndByView(viewModel, cursor, inSelectionMode, sticky);\r\n }\r\n }\r\n static _moveToLineEndByView(viewModel, cursor, inSelectionMode, sticky) {\r\n return CursorState.fromViewState(MoveOperations.moveToEndOfLine(viewModel.cursorConfig, viewModel, cursor.viewState, inSelectionMode, sticky));\r\n }\r\n static _moveToLineEndByModel(viewModel, cursor, inSelectionMode, sticky) {\r\n return CursorState.fromModelState(MoveOperations.moveToEndOfLine(viewModel.cursorConfig, viewModel.model, cursor.modelState, inSelectionMode, sticky));\r\n }\r\n static expandLineSelection(viewModel, cursors) {\r\n let result = [];\r\n for (let i = 0, len = cursors.length; i < len; i++) {\r\n const cursor = cursors[i];\r\n const startLineNumber = cursor.modelState.selection.startLineNumber;\r\n const lineCount = viewModel.model.getLineCount();\r\n let endLineNumber = cursor.modelState.selection.endLineNumber;\r\n let endColumn;\r\n if (endLineNumber === lineCount) {\r\n endColumn = viewModel.model.getLineMaxColumn(lineCount);\r\n }\r\n else {\r\n endLineNumber++;\r\n endColumn = 1;\r\n }\r\n result[i] = CursorState.fromModelState(new SingleCursorState(new Range(startLineNumber, 1, startLineNumber, 1), 0, new Position(endLineNumber, endColumn), 0));\r\n }\r\n return result;\r\n }\r\n static moveToBeginningOfBuffer(viewModel, cursors, inSelectionMode) {\r\n let result = [];\r\n for (let i = 0, len = cursors.length; i < len; i++) {\r\n const cursor = cursors[i];\r\n result[i] = CursorState.fromModelState(MoveOperations.moveToBeginningOfBuffer(viewModel.cursorConfig, viewModel.model, cursor.modelState, inSelectionMode));\r\n }\r\n return result;\r\n }\r\n static moveToEndOfBuffer(viewModel, cursors, inSelectionMode) {\r\n let result = [];\r\n for (let i = 0, len = cursors.length; i < len; i++) {\r\n const cursor = cursors[i];\r\n result[i] = CursorState.fromModelState(MoveOperations.moveToEndOfBuffer(viewModel.cursorConfig, viewModel.model, cursor.modelState, inSelectionMode));\r\n }\r\n return result;\r\n }\r\n static selectAll(viewModel, cursor) {\r\n const lineCount = viewModel.model.getLineCount();\r\n const maxColumn = viewModel.model.getLineMaxColumn(lineCount);\r\n return CursorState.fromModelState(new SingleCursorState(new Range(1, 1, 1, 1), 0, new Position(lineCount, maxColumn), 0));\r\n }\r\n static line(viewModel, cursor, inSelectionMode, _position, _viewPosition) {\r\n const position = viewModel.model.validatePosition(_position);\r\n const viewPosition = (_viewPosition\r\n ? viewModel.coordinatesConverter.validateViewPosition(new Position(_viewPosition.lineNumber, _viewPosition.column), position)\r\n : viewModel.coordinatesConverter.convertModelPositionToViewPosition(position));\r\n if (!inSelectionMode || !cursor.modelState.hasSelection()) {\r\n // Entering line selection for the first time\r\n const lineCount = viewModel.model.getLineCount();\r\n let selectToLineNumber = position.lineNumber + 1;\r\n let selectToColumn = 1;\r\n if (selectToLineNumber > lineCount) {\r\n selectToLineNumber = lineCount;\r\n selectToColumn = viewModel.model.getLineMaxColumn(selectToLineNumber);\r\n }\r\n return CursorState.fromModelState(new SingleCursorState(new Range(position.lineNumber, 1, selectToLineNumber, selectToColumn), 0, new Position(selectToLineNumber, selectToColumn), 0));\r\n }\r\n // Continuing line selection\r\n const enteringLineNumber = cursor.modelState.selectionStart.getStartPosition().lineNumber;\r\n if (position.lineNumber < enteringLineNumber) {\r\n return CursorState.fromViewState(cursor.viewState.move(cursor.modelState.hasSelection(), viewPosition.lineNumber, 1, 0));\r\n }\r\n else if (position.lineNumber > enteringLineNumber) {\r\n const lineCount = viewModel.getLineCount();\r\n let selectToViewLineNumber = viewPosition.lineNumber + 1;\r\n let selectToViewColumn = 1;\r\n if (selectToViewLineNumber > lineCount) {\r\n selectToViewLineNumber = lineCount;\r\n selectToViewColumn = viewModel.getLineMaxColumn(selectToViewLineNumber);\r\n }\r\n return CursorState.fromViewState(cursor.viewState.move(cursor.modelState.hasSelection(), selectToViewLineNumber, selectToViewColumn, 0));\r\n }\r\n else {\r\n const endPositionOfSelectionStart = cursor.modelState.selectionStart.getEndPosition();\r\n return CursorState.fromModelState(cursor.modelState.move(cursor.modelState.hasSelection(), endPositionOfSelectionStart.lineNumber, endPositionOfSelectionStart.column, 0));\r\n }\r\n }\r\n static word(viewModel, cursor, inSelectionMode, _position) {\r\n const position = viewModel.model.validatePosition(_position);\r\n return CursorState.fromModelState(WordOperations.word(viewModel.cursorConfig, viewModel.model, cursor.modelState, inSelectionMode, position));\r\n }\r\n static cancelSelection(viewModel, cursor) {\r\n if (!cursor.modelState.hasSelection()) {\r\n return new CursorState(cursor.modelState, cursor.viewState);\r\n }\r\n const lineNumber = cursor.viewState.position.lineNumber;\r\n const column = cursor.viewState.position.column;\r\n return CursorState.fromViewState(new SingleCursorState(new Range(lineNumber, column, lineNumber, column), 0, new Position(lineNumber, column), 0));\r\n }\r\n static moveTo(viewModel, cursor, inSelectionMode, _position, _viewPosition) {\r\n const position = viewModel.model.validatePosition(_position);\r\n const viewPosition = (_viewPosition\r\n ? viewModel.coordinatesConverter.validateViewPosition(new Position(_viewPosition.lineNumber, _viewPosition.column), position)\r\n : viewModel.coordinatesConverter.convertModelPositionToViewPosition(position));\r\n return CursorState.fromViewState(cursor.viewState.move(inSelectionMode, viewPosition.lineNumber, viewPosition.column, 0));\r\n }\r\n static simpleMove(viewModel, cursors, direction, inSelectionMode, value, unit) {\r\n switch (direction) {\r\n case 0 /* Left */: {\r\n if (unit === 4 /* HalfLine */) {\r\n // Move left by half the current line length\r\n return this._moveHalfLineLeft(viewModel, cursors, inSelectionMode);\r\n }\r\n else {\r\n // Move left by `moveParams.value` columns\r\n return this._moveLeft(viewModel, cursors, inSelectionMode, value);\r\n }\r\n }\r\n case 1 /* Right */: {\r\n if (unit === 4 /* HalfLine */) {\r\n // Move right by half the current line length\r\n return this._moveHalfLineRight(viewModel, cursors, inSelectionMode);\r\n }\r\n else {\r\n // Move right by `moveParams.value` columns\r\n return this._moveRight(viewModel, cursors, inSelectionMode, value);\r\n }\r\n }\r\n case 2 /* Up */: {\r\n if (unit === 2 /* WrappedLine */) {\r\n // Move up by view lines\r\n return this._moveUpByViewLines(viewModel, cursors, inSelectionMode, value);\r\n }\r\n else {\r\n // Move up by model lines\r\n return this._moveUpByModelLines(viewModel, cursors, inSelectionMode, value);\r\n }\r\n }\r\n case 3 /* Down */: {\r\n if (unit === 2 /* WrappedLine */) {\r\n // Move down by view lines\r\n return this._moveDownByViewLines(viewModel, cursors, inSelectionMode, value);\r\n }\r\n else {\r\n // Move down by model lines\r\n return this._moveDownByModelLines(viewModel, cursors, inSelectionMode, value);\r\n }\r\n }\r\n case 4 /* PrevBlankLine */: {\r\n if (unit === 2 /* WrappedLine */) {\r\n return cursors.map(cursor => CursorState.fromViewState(MoveOperations.moveToPrevBlankLine(viewModel.cursorConfig, viewModel, cursor.viewState, inSelectionMode)));\r\n }\r\n else {\r\n return cursors.map(cursor => CursorState.fromModelState(MoveOperations.moveToPrevBlankLine(viewModel.cursorConfig, viewModel.model, cursor.modelState, inSelectionMode)));\r\n }\r\n }\r\n case 5 /* NextBlankLine */: {\r\n if (unit === 2 /* WrappedLine */) {\r\n return cursors.map(cursor => CursorState.fromViewState(MoveOperations.moveToNextBlankLine(viewModel.cursorConfig, viewModel, cursor.viewState, inSelectionMode)));\r\n }\r\n else {\r\n return cursors.map(cursor => CursorState.fromModelState(MoveOperations.moveToNextBlankLine(viewModel.cursorConfig, viewModel.model, cursor.modelState, inSelectionMode)));\r\n }\r\n }\r\n case 6 /* WrappedLineStart */: {\r\n // Move to the beginning of the current view line\r\n return this._moveToViewMinColumn(viewModel, cursors, inSelectionMode);\r\n }\r\n case 7 /* WrappedLineFirstNonWhitespaceCharacter */: {\r\n // Move to the first non-whitespace column of the current view line\r\n return this._moveToViewFirstNonWhitespaceColumn(viewModel, cursors, inSelectionMode);\r\n }\r\n case 8 /* WrappedLineColumnCenter */: {\r\n // Move to the \"center\" of the current view line\r\n return this._moveToViewCenterColumn(viewModel, cursors, inSelectionMode);\r\n }\r\n case 9 /* WrappedLineEnd */: {\r\n // Move to the end of the current view line\r\n return this._moveToViewMaxColumn(viewModel, cursors, inSelectionMode);\r\n }\r\n case 10 /* WrappedLineLastNonWhitespaceCharacter */: {\r\n // Move to the last non-whitespace column of the current view line\r\n return this._moveToViewLastNonWhitespaceColumn(viewModel, cursors, inSelectionMode);\r\n }\r\n default:\r\n return null;\r\n }\r\n }\r\n static viewportMove(viewModel, cursors, direction, inSelectionMode, value) {\r\n const visibleViewRange = viewModel.getCompletelyVisibleViewRange();\r\n const visibleModelRange = viewModel.coordinatesConverter.convertViewRangeToModelRange(visibleViewRange);\r\n switch (direction) {\r\n case 11 /* ViewPortTop */: {\r\n // Move to the nth line start in the viewport (from the top)\r\n const modelLineNumber = this._firstLineNumberInRange(viewModel.model, visibleModelRange, value);\r\n const modelColumn = viewModel.model.getLineFirstNonWhitespaceColumn(modelLineNumber);\r\n return [this._moveToModelPosition(viewModel, cursors[0], inSelectionMode, modelLineNumber, modelColumn)];\r\n }\r\n case 13 /* ViewPortBottom */: {\r\n // Move to the nth line start in the viewport (from the bottom)\r\n const modelLineNumber = this._lastLineNumberInRange(viewModel.model, visibleModelRange, value);\r\n const modelColumn = viewModel.model.getLineFirstNonWhitespaceColumn(modelLineNumber);\r\n return [this._moveToModelPosition(viewModel, cursors[0], inSelectionMode, modelLineNumber, modelColumn)];\r\n }\r\n case 12 /* ViewPortCenter */: {\r\n // Move to the line start in the viewport center\r\n const modelLineNumber = Math.round((visibleModelRange.startLineNumber + visibleModelRange.endLineNumber) / 2);\r\n const modelColumn = viewModel.model.getLineFirstNonWhitespaceColumn(modelLineNumber);\r\n return [this._moveToModelPosition(viewModel, cursors[0], inSelectionMode, modelLineNumber, modelColumn)];\r\n }\r\n case 14 /* ViewPortIfOutside */: {\r\n // Move to a position inside the viewport\r\n let result = [];\r\n for (let i = 0, len = cursors.length; i < len; i++) {\r\n const cursor = cursors[i];\r\n result[i] = this.findPositionInViewportIfOutside(viewModel, cursor, visibleViewRange, inSelectionMode);\r\n }\r\n return result;\r\n }\r\n default:\r\n return null;\r\n }\r\n }\r\n static findPositionInViewportIfOutside(viewModel, cursor, visibleViewRange, inSelectionMode) {\r\n let viewLineNumber = cursor.viewState.position.lineNumber;\r\n if (visibleViewRange.startLineNumber <= viewLineNumber && viewLineNumber <= visibleViewRange.endLineNumber - 1) {\r\n // Nothing to do, cursor is in viewport\r\n return new CursorState(cursor.modelState, cursor.viewState);\r\n }\r\n else {\r\n if (viewLineNumber > visibleViewRange.endLineNumber - 1) {\r\n viewLineNumber = visibleViewRange.endLineNumber - 1;\r\n }\r\n if (viewLineNumber < visibleViewRange.startLineNumber) {\r\n viewLineNumber = visibleViewRange.startLineNumber;\r\n }\r\n const viewColumn = viewModel.getLineFirstNonWhitespaceColumn(viewLineNumber);\r\n return this._moveToViewPosition(viewModel, cursor, inSelectionMode, viewLineNumber, viewColumn);\r\n }\r\n }\r\n /**\r\n * Find the nth line start included in the range (from the start).\r\n */\r\n static _firstLineNumberInRange(model, range, count) {\r\n let startLineNumber = range.startLineNumber;\r\n if (range.startColumn !== model.getLineMinColumn(startLineNumber)) {\r\n // Move on to the second line if the first line start is not included in the range\r\n startLineNumber++;\r\n }\r\n return Math.min(range.endLineNumber, startLineNumber + count - 1);\r\n }\r\n /**\r\n * Find the nth line start included in the range (from the end).\r\n */\r\n static _lastLineNumberInRange(model, range, count) {\r\n let startLineNumber = range.startLineNumber;\r\n if (range.startColumn !== model.getLineMinColumn(startLineNumber)) {\r\n // Move on to the second line if the first line start is not included in the range\r\n startLineNumber++;\r\n }\r\n return Math.max(startLineNumber, range.endLineNumber - count + 1);\r\n }\r\n static _moveLeft(viewModel, cursors, inSelectionMode, noOfColumns) {\r\n return cursors.map(cursor => CursorState.fromViewState(MoveOperations.moveLeft(viewModel.cursorConfig, viewModel, cursor.viewState, inSelectionMode, noOfColumns)));\r\n }\r\n static _moveHalfLineLeft(viewModel, cursors, inSelectionMode) {\r\n let result = [];\r\n for (let i = 0, len = cursors.length; i < len; i++) {\r\n const cursor = cursors[i];\r\n const viewLineNumber = cursor.viewState.position.lineNumber;\r\n const halfLine = Math.round(viewModel.getLineContent(viewLineNumber).length / 2);\r\n result[i] = CursorState.fromViewState(MoveOperations.moveLeft(viewModel.cursorConfig, viewModel, cursor.viewState, inSelectionMode, halfLine));\r\n }\r\n return result;\r\n }\r\n static _moveRight(viewModel, cursors, inSelectionMode, noOfColumns) {\r\n return cursors.map(cursor => CursorState.fromViewState(MoveOperations.moveRight(viewModel.cursorConfig, viewModel, cursor.viewState, inSelectionMode, noOfColumns)));\r\n }\r\n static _moveHalfLineRight(viewModel, cursors, inSelectionMode) {\r\n let result = [];\r\n for (let i = 0, len = cursors.length; i < len; i++) {\r\n const cursor = cursors[i];\r\n const viewLineNumber = cursor.viewState.position.lineNumber;\r\n const halfLine = Math.round(viewModel.getLineContent(viewLineNumber).length / 2);\r\n result[i] = CursorState.fromViewState(MoveOperations.moveRight(viewModel.cursorConfig, viewModel, cursor.viewState, inSelectionMode, halfLine));\r\n }\r\n return result;\r\n }\r\n static _moveDownByViewLines(viewModel, cursors, inSelectionMode, linesCount) {\r\n let result = [];\r\n for (let i = 0, len = cursors.length; i < len; i++) {\r\n const cursor = cursors[i];\r\n result[i] = CursorState.fromViewState(MoveOperations.moveDown(viewModel.cursorConfig, viewModel, cursor.viewState, inSelectionMode, linesCount));\r\n }\r\n return result;\r\n }\r\n static _moveDownByModelLines(viewModel, cursors, inSelectionMode, linesCount) {\r\n let result = [];\r\n for (let i = 0, len = cursors.length; i < len; i++) {\r\n const cursor = cursors[i];\r\n result[i] = CursorState.fromModelState(MoveOperations.moveDown(viewModel.cursorConfig, viewModel.model, cursor.modelState, inSelectionMode, linesCount));\r\n }\r\n return result;\r\n }\r\n static _moveUpByViewLines(viewModel, cursors, inSelectionMode, linesCount) {\r\n let result = [];\r\n for (let i = 0, len = cursors.length; i < len; i++) {\r\n const cursor = cursors[i];\r\n result[i] = CursorState.fromViewState(MoveOperations.moveUp(viewModel.cursorConfig, viewModel, cursor.viewState, inSelectionMode, linesCount));\r\n }\r\n return result;\r\n }\r\n static _moveUpByModelLines(viewModel, cursors, inSelectionMode, linesCount) {\r\n let result = [];\r\n for (let i = 0, len = cursors.length; i < len; i++) {\r\n const cursor = cursors[i];\r\n result[i] = CursorState.fromModelState(MoveOperations.moveUp(viewModel.cursorConfig, viewModel.model, cursor.modelState, inSelectionMode, linesCount));\r\n }\r\n return result;\r\n }\r\n static _moveToViewPosition(viewModel, cursor, inSelectionMode, toViewLineNumber, toViewColumn) {\r\n return CursorState.fromViewState(cursor.viewState.move(inSelectionMode, toViewLineNumber, toViewColumn, 0));\r\n }\r\n static _moveToModelPosition(viewModel, cursor, inSelectionMode, toModelLineNumber, toModelColumn) {\r\n return CursorState.fromModelState(cursor.modelState.move(inSelectionMode, toModelLineNumber, toModelColumn, 0));\r\n }\r\n static _moveToViewMinColumn(viewModel, cursors, inSelectionMode) {\r\n let result = [];\r\n for (let i = 0, len = cursors.length; i < len; i++) {\r\n const cursor = cursors[i];\r\n const viewLineNumber = cursor.viewState.position.lineNumber;\r\n const viewColumn = viewModel.getLineMinColumn(viewLineNumber);\r\n result[i] = this._moveToViewPosition(viewModel, cursor, inSelectionMode, viewLineNumber, viewColumn);\r\n }\r\n return result;\r\n }\r\n static _moveToViewFirstNonWhitespaceColumn(viewModel, cursors, inSelectionMode) {\r\n let result = [];\r\n for (let i = 0, len = cursors.length; i < len; i++) {\r\n const cursor = cursors[i];\r\n const viewLineNumber = cursor.viewState.position.lineNumber;\r\n const viewColumn = viewModel.getLineFirstNonWhitespaceColumn(viewLineNumber);\r\n result[i] = this._moveToViewPosition(viewModel, cursor, inSelectionMode, viewLineNumber, viewColumn);\r\n }\r\n return result;\r\n }\r\n static _moveToViewCenterColumn(viewModel, cursors, inSelectionMode) {\r\n let result = [];\r\n for (let i = 0, len = cursors.length; i < len; i++) {\r\n const cursor = cursors[i];\r\n const viewLineNumber = cursor.viewState.position.lineNumber;\r\n const viewColumn = Math.round((viewModel.getLineMaxColumn(viewLineNumber) + viewModel.getLineMinColumn(viewLineNumber)) / 2);\r\n result[i] = this._moveToViewPosition(viewModel, cursor, inSelectionMode, viewLineNumber, viewColumn);\r\n }\r\n return result;\r\n }\r\n static _moveToViewMaxColumn(viewModel, cursors, inSelectionMode) {\r\n let result = [];\r\n for (let i = 0, len = cursors.length; i < len; i++) {\r\n const cursor = cursors[i];\r\n const viewLineNumber = cursor.viewState.position.lineNumber;\r\n const viewColumn = viewModel.getLineMaxColumn(viewLineNumber);\r\n result[i] = this._moveToViewPosition(viewModel, cursor, inSelectionMode, viewLineNumber, viewColumn);\r\n }\r\n return result;\r\n }\r\n static _moveToViewLastNonWhitespaceColumn(viewModel, cursors, inSelectionMode) {\r\n let result = [];\r\n for (let i = 0, len = cursors.length; i < len; i++) {\r\n const cursor = cursors[i];\r\n const viewLineNumber = cursor.viewState.position.lineNumber;\r\n const viewColumn = viewModel.getLineLastNonWhitespaceColumn(viewLineNumber);\r\n result[i] = this._moveToViewPosition(viewModel, cursor, inSelectionMode, viewLineNumber, viewColumn);\r\n }\r\n return result;\r\n }\r\n}\r\nexport var CursorMove;\r\n(function (CursorMove) {\r\n const isCursorMoveArgs = function (arg) {\r\n if (!types.isObject(arg)) {\r\n return false;\r\n }\r\n let cursorMoveArg = arg;\r\n if (!types.isString(cursorMoveArg.to)) {\r\n return false;\r\n }\r\n if (!types.isUndefined(cursorMoveArg.select) && !types.isBoolean(cursorMoveArg.select)) {\r\n return false;\r\n }\r\n if (!types.isUndefined(cursorMoveArg.by) && !types.isString(cursorMoveArg.by)) {\r\n return false;\r\n }\r\n if (!types.isUndefined(cursorMoveArg.value) && !types.isNumber(cursorMoveArg.value)) {\r\n return false;\r\n }\r\n return true;\r\n };\r\n CursorMove.description = {\r\n description: 'Move cursor to a logical position in the view',\r\n args: [\r\n {\r\n name: 'Cursor move argument object',\r\n description: `Property-value pairs that can be passed through this argument:\n\t\t\t\t\t* 'to': A mandatory logical position value providing where to move the cursor.\n\t\t\t\t\t\t\\`\\`\\`\n\t\t\t\t\t\t'left', 'right', 'up', 'down', 'prevBlankLine', 'nextBlankLine',\n\t\t\t\t\t\t'wrappedLineStart', 'wrappedLineEnd', 'wrappedLineColumnCenter'\n\t\t\t\t\t\t'wrappedLineFirstNonWhitespaceCharacter', 'wrappedLineLastNonWhitespaceCharacter'\n\t\t\t\t\t\t'viewPortTop', 'viewPortCenter', 'viewPortBottom', 'viewPortIfOutside'\n\t\t\t\t\t\t\\`\\`\\`\n\t\t\t\t\t* 'by': Unit to move. Default is computed based on 'to' value.\n\t\t\t\t\t\t\\`\\`\\`\n\t\t\t\t\t\t'line', 'wrappedLine', 'character', 'halfLine'\n\t\t\t\t\t\t\\`\\`\\`\n\t\t\t\t\t* 'value': Number of units to move. Default is '1'.\n\t\t\t\t\t* 'select': If 'true' makes the selection. Default is 'false'.\n\t\t\t\t`,\r\n constraint: isCursorMoveArgs,\r\n schema: {\r\n 'type': 'object',\r\n 'required': ['to'],\r\n 'properties': {\r\n 'to': {\r\n 'type': 'string',\r\n 'enum': ['left', 'right', 'up', 'down', 'prevBlankLine', 'nextBlankLine', 'wrappedLineStart', 'wrappedLineEnd', 'wrappedLineColumnCenter', 'wrappedLineFirstNonWhitespaceCharacter', 'wrappedLineLastNonWhitespaceCharacter', 'viewPortTop', 'viewPortCenter', 'viewPortBottom', 'viewPortIfOutside']\r\n },\r\n 'by': {\r\n 'type': 'string',\r\n 'enum': ['line', 'wrappedLine', 'character', 'halfLine']\r\n },\r\n 'value': {\r\n 'type': 'number',\r\n 'default': 1\r\n },\r\n 'select': {\r\n 'type': 'boolean',\r\n 'default': false\r\n }\r\n }\r\n }\r\n }\r\n ]\r\n };\r\n /**\r\n * Positions in the view for cursor move command.\r\n */\r\n CursorMove.RawDirection = {\r\n Left: 'left',\r\n Right: 'right',\r\n Up: 'up',\r\n Down: 'down',\r\n PrevBlankLine: 'prevBlankLine',\r\n NextBlankLine: 'nextBlankLine',\r\n WrappedLineStart: 'wrappedLineStart',\r\n WrappedLineFirstNonWhitespaceCharacter: 'wrappedLineFirstNonWhitespaceCharacter',\r\n WrappedLineColumnCenter: 'wrappedLineColumnCenter',\r\n WrappedLineEnd: 'wrappedLineEnd',\r\n WrappedLineLastNonWhitespaceCharacter: 'wrappedLineLastNonWhitespaceCharacter',\r\n ViewPortTop: 'viewPortTop',\r\n ViewPortCenter: 'viewPortCenter',\r\n ViewPortBottom: 'viewPortBottom',\r\n ViewPortIfOutside: 'viewPortIfOutside'\r\n };\r\n /**\r\n * Units for Cursor move 'by' argument\r\n */\r\n CursorMove.RawUnit = {\r\n Line: 'line',\r\n WrappedLine: 'wrappedLine',\r\n Character: 'character',\r\n HalfLine: 'halfLine'\r\n };\r\n function parse(args) {\r\n if (!args.to) {\r\n // illegal arguments\r\n return null;\r\n }\r\n let direction;\r\n switch (args.to) {\r\n case CursorMove.RawDirection.Left:\r\n direction = 0 /* Left */;\r\n break;\r\n case CursorMove.RawDirection.Right:\r\n direction = 1 /* Right */;\r\n break;\r\n case CursorMove.RawDirection.Up:\r\n direction = 2 /* Up */;\r\n break;\r\n case CursorMove.RawDirection.Down:\r\n direction = 3 /* Down */;\r\n break;\r\n case CursorMove.RawDirection.PrevBlankLine:\r\n direction = 4 /* PrevBlankLine */;\r\n break;\r\n case CursorMove.RawDirection.NextBlankLine:\r\n direction = 5 /* NextBlankLine */;\r\n break;\r\n case CursorMove.RawDirection.WrappedLineStart:\r\n direction = 6 /* WrappedLineStart */;\r\n break;\r\n case CursorMove.RawDirection.WrappedLineFirstNonWhitespaceCharacter:\r\n direction = 7 /* WrappedLineFirstNonWhitespaceCharacter */;\r\n break;\r\n case CursorMove.RawDirection.WrappedLineColumnCenter:\r\n direction = 8 /* WrappedLineColumnCenter */;\r\n break;\r\n case CursorMove.RawDirection.WrappedLineEnd:\r\n direction = 9 /* WrappedLineEnd */;\r\n break;\r\n case CursorMove.RawDirection.WrappedLineLastNonWhitespaceCharacter:\r\n direction = 10 /* WrappedLineLastNonWhitespaceCharacter */;\r\n break;\r\n case CursorMove.RawDirection.ViewPortTop:\r\n direction = 11 /* ViewPortTop */;\r\n break;\r\n case CursorMove.RawDirection.ViewPortBottom:\r\n direction = 13 /* ViewPortBottom */;\r\n break;\r\n case CursorMove.RawDirection.ViewPortCenter:\r\n direction = 12 /* ViewPortCenter */;\r\n break;\r\n case CursorMove.RawDirection.ViewPortIfOutside:\r\n direction = 14 /* ViewPortIfOutside */;\r\n break;\r\n default:\r\n // illegal arguments\r\n return null;\r\n }\r\n let unit = 0 /* None */;\r\n switch (args.by) {\r\n case CursorMove.RawUnit.Line:\r\n unit = 1 /* Line */;\r\n break;\r\n case CursorMove.RawUnit.WrappedLine:\r\n unit = 2 /* WrappedLine */;\r\n break;\r\n case CursorMove.RawUnit.Character:\r\n unit = 3 /* Character */;\r\n break;\r\n case CursorMove.RawUnit.HalfLine:\r\n unit = 4 /* HalfLine */;\r\n break;\r\n }\r\n return {\r\n direction: direction,\r\n unit: unit,\r\n select: (!!args.select),\r\n value: (args.value || 1)\r\n };\r\n }\r\n CursorMove.parse = parse;\r\n})(CursorMove || (CursorMove = {}));\r\n", "/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License. See License.txt in the project root for license information.\r\n *--------------------------------------------------------------------------------------------*/\r\nimport * as strings from '../../../base/common/strings.js';\r\nimport { CursorColumns } from '../controller/cursorCommon.js';\r\nimport { Range } from '../core/range.js';\r\nimport { Selection } from '../core/selection.js';\r\nimport { LanguageConfigurationRegistry } from '../modes/languageConfigurationRegistry.js';\r\nconst repeatCache = Object.create(null);\r\nexport function cachedStringRepeat(str, count) {\r\n if (count <= 0) {\r\n return '';\r\n }\r\n if (!repeatCache[str]) {\r\n repeatCache[str] = ['', str];\r\n }\r\n const cache = repeatCache[str];\r\n for (let i = cache.length; i <= count; i++) {\r\n cache[i] = cache[i - 1] + str;\r\n }\r\n return cache[count];\r\n}\r\nexport class ShiftCommand {\r\n constructor(range, opts) {\r\n this._opts = opts;\r\n this._selection = range;\r\n this._selectionId = null;\r\n this._useLastEditRangeForCursorEndPosition = false;\r\n this._selectionStartColumnStaysPut = false;\r\n }\r\n static unshiftIndent(line, column, tabSize, indentSize, insertSpaces) {\r\n // Determine the visible column where the content starts\r\n const contentStartVisibleColumn = CursorColumns.visibleColumnFromColumn(line, column, tabSize);\r\n if (insertSpaces) {\r\n const indent = cachedStringRepeat(' ', indentSize);\r\n const desiredTabStop = CursorColumns.prevIndentTabStop(contentStartVisibleColumn, indentSize);\r\n const indentCount = desiredTabStop / indentSize; // will be an integer\r\n return cachedStringRepeat(indent, indentCount);\r\n }\r\n else {\r\n const indent = '\\t';\r\n const desiredTabStop = CursorColumns.prevRenderTabStop(contentStartVisibleColumn, tabSize);\r\n const indentCount = desiredTabStop / tabSize; // will be an integer\r\n return cachedStringRepeat(indent, indentCount);\r\n }\r\n }\r\n static shiftIndent(line, column, tabSize, indentSize, insertSpaces) {\r\n // Determine the visible column where the content starts\r\n const contentStartVisibleColumn = CursorColumns.visibleColumnFromColumn(line, column, tabSize);\r\n if (insertSpaces) {\r\n const indent = cachedStringRepeat(' ', indentSize);\r\n const desiredTabStop = CursorColumns.nextIndentTabStop(contentStartVisibleColumn, indentSize);\r\n const indentCount = desiredTabStop / indentSize; // will be an integer\r\n return cachedStringRepeat(indent, indentCount);\r\n }\r\n else {\r\n const indent = '\\t';\r\n const desiredTabStop = CursorColumns.nextRenderTabStop(contentStartVisibleColumn, tabSize);\r\n const indentCount = desiredTabStop / tabSize; // will be an integer\r\n return cachedStringRepeat(indent, indentCount);\r\n }\r\n }\r\n _addEditOperation(builder, range, text) {\r\n if (this._useLastEditRangeForCursorEndPosition) {\r\n builder.addTrackedEditOperation(range, text);\r\n }\r\n else {\r\n builder.addEditOperation(range, text);\r\n }\r\n }\r\n getEditOperations(model, builder) {\r\n const startLine = this._selection.startLineNumber;\r\n let endLine = this._selection.endLineNumber;\r\n if (this._selection.endColumn === 1 && startLine !== endLine) {\r\n endLine = endLine - 1;\r\n }\r\n const { tabSize, indentSize, insertSpaces } = this._opts;\r\n const shouldIndentEmptyLines = (startLine === endLine);\r\n if (this._opts.useTabStops) {\r\n // if indenting or outdenting on a whitespace only line\r\n if (this._selection.isEmpty()) {\r\n if (/^\\s*$/.test(model.getLineContent(startLine))) {\r\n this._useLastEditRangeForCursorEndPosition = true;\r\n }\r\n }\r\n // keep track of previous line's \"miss-alignment\"\r\n let previousLineExtraSpaces = 0, extraSpaces = 0;\r\n for (let lineNumber = startLine; lineNumber <= endLine; lineNumber++, previousLineExtraSpaces = extraSpaces) {\r\n extraSpaces = 0;\r\n let lineText = model.getLineContent(lineNumber);\r\n let indentationEndIndex = strings.firstNonWhitespaceIndex(lineText);\r\n if (this._opts.isUnshift && (lineText.length === 0 || indentationEndIndex === 0)) {\r\n // empty line or line with no leading whitespace => nothing to do\r\n continue;\r\n }\r\n if (!shouldIndentEmptyLines && !this._opts.isUnshift && lineText.length === 0) {\r\n // do not indent empty lines => nothing to do\r\n continue;\r\n }\r\n if (indentationEndIndex === -1) {\r\n // the entire line is whitespace\r\n indentationEndIndex = lineText.length;\r\n }\r\n if (lineNumber > 1) {\r\n let contentStartVisibleColumn = CursorColumns.visibleColumnFromColumn(lineText, indentationEndIndex + 1, tabSize);\r\n if (contentStartVisibleColumn % indentSize !== 0) {\r\n // The current line is \"miss-aligned\", so let's see if this is expected...\r\n // This can only happen when it has trailing commas in the indent\r\n if (model.isCheapToTokenize(lineNumber - 1)) {\r\n let enterAction = LanguageConfigurationRegistry.getEnterAction(this._opts.autoIndent, model, new Range(lineNumber - 1, model.getLineMaxColumn(lineNumber - 1), lineNumber - 1, model.getLineMaxColumn(lineNumber - 1)));\r\n if (enterAction) {\r\n extraSpaces = previousLineExtraSpaces;\r\n if (enterAction.appendText) {\r\n for (let j = 0, lenJ = enterAction.appendText.length; j < lenJ && extraSpaces < indentSize; j++) {\r\n if (enterAction.appendText.charCodeAt(j) === 32 /* Space */) {\r\n extraSpaces++;\r\n }\r\n else {\r\n break;\r\n }\r\n }\r\n }\r\n if (enterAction.removeText) {\r\n extraSpaces = Math.max(0, extraSpaces - enterAction.removeText);\r\n }\r\n // Act as if `prefixSpaces` is not part of the indentation\r\n for (let j = 0; j < extraSpaces; j++) {\r\n if (indentationEndIndex === 0 || lineText.charCodeAt(indentationEndIndex - 1) !== 32 /* Space */) {\r\n break;\r\n }\r\n indentationEndIndex--;\r\n }\r\n }\r\n }\r\n }\r\n }\r\n if (this._opts.isUnshift && indentationEndIndex === 0) {\r\n // line with no leading whitespace => nothing to do\r\n continue;\r\n }\r\n let desiredIndent;\r\n if (this._opts.isUnshift) {\r\n desiredIndent = ShiftCommand.unshiftIndent(lineText, indentationEndIndex + 1, tabSize, indentSize, insertSpaces);\r\n }\r\n else {\r\n desiredIndent = ShiftCommand.shiftIndent(lineText, indentationEndIndex + 1, tabSize, indentSize, insertSpaces);\r\n }\r\n this._addEditOperation(builder, new Range(lineNumber, 1, lineNumber, indentationEndIndex + 1), desiredIndent);\r\n if (lineNumber === startLine && !this._selection.isEmpty()) {\r\n // Force the startColumn to stay put because we're inserting after it\r\n this._selectionStartColumnStaysPut = (this._selection.startColumn <= indentationEndIndex + 1);\r\n }\r\n }\r\n }\r\n else {\r\n // if indenting or outdenting on a whitespace only line\r\n if (!this._opts.isUnshift && this._selection.isEmpty() && model.getLineLength(startLine) === 0) {\r\n this._useLastEditRangeForCursorEndPosition = true;\r\n }\r\n const oneIndent = (insertSpaces ? cachedStringRepeat(' ', indentSize) : '\\t');\r\n for (let lineNumber = startLine; lineNumber <= endLine; lineNumber++) {\r\n const lineText = model.getLineContent(lineNumber);\r\n let indentationEndIndex = strings.firstNonWhitespaceIndex(lineText);\r\n if (this._opts.isUnshift && (lineText.length === 0 || indentationEndIndex === 0)) {\r\n // empty line or line with no leading whitespace => nothing to do\r\n continue;\r\n }\r\n if (!shouldIndentEmptyLines && !this._opts.isUnshift && lineText.length === 0) {\r\n // do not indent empty lines => nothing to do\r\n continue;\r\n }\r\n if (indentationEndIndex === -1) {\r\n // the entire line is whitespace\r\n indentationEndIndex = lineText.length;\r\n }\r\n if (this._opts.isUnshift && indentationEndIndex === 0) {\r\n // line with no leading whitespace => nothing to do\r\n continue;\r\n }\r\n if (this._opts.isUnshift) {\r\n indentationEndIndex = Math.min(indentationEndIndex, indentSize);\r\n for (let i = 0; i < indentationEndIndex; i++) {\r\n const chr = lineText.charCodeAt(i);\r\n if (chr === 9 /* Tab */) {\r\n indentationEndIndex = i + 1;\r\n break;\r\n }\r\n }\r\n this._addEditOperation(builder, new Range(lineNumber, 1, lineNumber, indentationEndIndex + 1), '');\r\n }\r\n else {\r\n this._addEditOperation(builder, new Range(lineNumber, 1, lineNumber, 1), oneIndent);\r\n if (lineNumber === startLine && !this._selection.isEmpty()) {\r\n // Force the startColumn to stay put because we're inserting after it\r\n this._selectionStartColumnStaysPut = (this._selection.startColumn === 1);\r\n }\r\n }\r\n }\r\n }\r\n this._selectionId = builder.trackSelection(this._selection);\r\n }\r\n computeCursorState(model, helper) {\r\n if (this._useLastEditRangeForCursorEndPosition) {\r\n let lastOp = helper.getInverseEditOperations()[0];\r\n return new Selection(lastOp.range.endLineNumber, lastOp.range.endColumn, lastOp.range.endLineNumber, lastOp.range.endColumn);\r\n }\r\n const result = helper.getTrackedSelection(this._selectionId);\r\n if (this._selectionStartColumnStaysPut) {\r\n // The selection start should not move\r\n let initialStartColumn = this._selection.startColumn;\r\n let resultStartColumn = result.startColumn;\r\n if (resultStartColumn <= initialStartColumn) {\r\n return result;\r\n }\r\n if (result.getDirection() === 0 /* LTR */) {\r\n return new Selection(result.startLineNumber, initialStartColumn, result.endLineNumber, result.endColumn);\r\n }\r\n return new Selection(result.endLineNumber, result.endColumn, result.startLineNumber, initialStartColumn);\r\n }\r\n return result;\r\n }\r\n}\r\n", "/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License. See License.txt in the project root for license information.\r\n *--------------------------------------------------------------------------------------------*/\r\nimport { Range } from '../core/range.js';\r\nimport { Selection } from '../core/selection.js';\r\nexport class SurroundSelectionCommand {\r\n constructor(range, charBeforeSelection, charAfterSelection) {\r\n this._range = range;\r\n this._charBeforeSelection = charBeforeSelection;\r\n this._charAfterSelection = charAfterSelection;\r\n }\r\n getEditOperations(model, builder) {\r\n builder.addTrackedEditOperation(new Range(this._range.startLineNumber, this._range.startColumn, this._range.startLineNumber, this._range.startColumn), this._charBeforeSelection);\r\n builder.addTrackedEditOperation(new Range(this._range.endLineNumber, this._range.endColumn, this._range.endLineNumber, this._range.endColumn), this._charAfterSelection);\r\n }\r\n computeCursorState(model, helper) {\r\n let inverseEditOperations = helper.getInverseEditOperations();\r\n let firstOperationRange = inverseEditOperations[0].range;\r\n let secondOperationRange = inverseEditOperations[1].range;\r\n return new Selection(firstOperationRange.endLineNumber, firstOperationRange.endColumn, secondOperationRange.endLineNumber, secondOperationRange.endColumn - this._charAfterSelection.length);\r\n }\r\n}\r\n", "/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License. See License.txt in the project root for license information.\r\n *--------------------------------------------------------------------------------------------*/\r\nimport { onUnexpectedError } from '../../../base/common/errors.js';\r\nimport * as strings from '../../../base/common/strings.js';\r\nimport { ReplaceCommand, ReplaceCommandWithOffsetCursorState, ReplaceCommandWithoutChangingPosition, ReplaceCommandThatPreservesSelection } from '../commands/replaceCommand.js';\r\nimport { ShiftCommand } from '../commands/shiftCommand.js';\r\nimport { SurroundSelectionCommand } from '../commands/surroundSelectionCommand.js';\r\nimport { CursorColumns, EditOperationResult, isQuote } from './cursorCommon.js';\r\nimport { getMapForWordSeparators } from './wordCharacterClassifier.js';\r\nimport { Range } from '../core/range.js';\r\nimport { Selection } from '../core/selection.js';\r\nimport { IndentAction } from '../modes/languageConfiguration.js';\r\nimport { LanguageConfigurationRegistry } from '../modes/languageConfigurationRegistry.js';\r\nexport class TypeOperations {\r\n static indent(config, model, selections) {\r\n if (model === null || selections === null) {\r\n return [];\r\n }\r\n let commands = [];\r\n for (let i = 0, len = selections.length; i < len; i++) {\r\n commands[i] = new ShiftCommand(selections[i], {\r\n isUnshift: false,\r\n tabSize: config.tabSize,\r\n indentSize: config.indentSize,\r\n insertSpaces: config.insertSpaces,\r\n useTabStops: config.useTabStops,\r\n autoIndent: config.autoIndent\r\n });\r\n }\r\n return commands;\r\n }\r\n static outdent(config, model, selections) {\r\n let commands = [];\r\n for (let i = 0, len = selections.length; i < len; i++) {\r\n commands[i] = new ShiftCommand(selections[i], {\r\n isUnshift: true,\r\n tabSize: config.tabSize,\r\n indentSize: config.indentSize,\r\n insertSpaces: config.insertSpaces,\r\n useTabStops: config.useTabStops,\r\n autoIndent: config.autoIndent\r\n });\r\n }\r\n return commands;\r\n }\r\n static shiftIndent(config, indentation, count) {\r\n count = count || 1;\r\n return ShiftCommand.shiftIndent(indentation, indentation.length + count, config.tabSize, config.indentSize, config.insertSpaces);\r\n }\r\n static unshiftIndent(config, indentation, count) {\r\n count = count || 1;\r\n return ShiftCommand.unshiftIndent(indentation, indentation.length + count, config.tabSize, config.indentSize, config.insertSpaces);\r\n }\r\n static _distributedPaste(config, model, selections, text) {\r\n let commands = [];\r\n for (let i = 0, len = selections.length; i < len; i++) {\r\n commands[i] = new ReplaceCommand(selections[i], text[i]);\r\n }\r\n return new EditOperationResult(0 /* Other */, commands, {\r\n shouldPushStackElementBefore: true,\r\n shouldPushStackElementAfter: true\r\n });\r\n }\r\n static _simplePaste(config, model, selections, text, pasteOnNewLine) {\r\n let commands = [];\r\n for (let i = 0, len = selections.length; i < len; i++) {\r\n const selection = selections[i];\r\n let position = selection.getPosition();\r\n if (pasteOnNewLine && !selection.isEmpty()) {\r\n pasteOnNewLine = false;\r\n }\r\n if (pasteOnNewLine && text.indexOf('\\n') !== text.length - 1) {\r\n pasteOnNewLine = false;\r\n }\r\n if (pasteOnNewLine) {\r\n // Paste entire line at the beginning of line\r\n let typeSelection = new Range(position.lineNumber, 1, position.lineNumber, 1);\r\n commands[i] = new ReplaceCommandThatPreservesSelection(typeSelection, text, selection, true);\r\n }\r\n else {\r\n commands[i] = new ReplaceCommand(selection, text);\r\n }\r\n }\r\n return new EditOperationResult(0 /* Other */, commands, {\r\n shouldPushStackElementBefore: true,\r\n shouldPushStackElementAfter: true\r\n });\r\n }\r\n static _distributePasteToCursors(config, selections, text, pasteOnNewLine, multicursorText) {\r\n if (pasteOnNewLine) {\r\n return null;\r\n }\r\n if (selections.length === 1) {\r\n return null;\r\n }\r\n if (multicursorText && multicursorText.length === selections.length) {\r\n return multicursorText;\r\n }\r\n if (config.multiCursorPaste === 'spread') {\r\n // Try to spread the pasted text in case the line count matches the cursor count\r\n // Remove trailing \\n if present\r\n if (text.charCodeAt(text.length - 1) === 10 /* LineFeed */) {\r\n text = text.substr(0, text.length - 1);\r\n }\r\n // Remove trailing \\r if present\r\n if (text.charCodeAt(text.length - 1) === 13 /* CarriageReturn */) {\r\n text = text.substr(0, text.length - 1);\r\n }\r\n let lines = strings.splitLines(text);\r\n if (lines.length === selections.length) {\r\n return lines;\r\n }\r\n }\r\n return null;\r\n }\r\n static paste(config, model, selections, text, pasteOnNewLine, multicursorText) {\r\n const distributedPaste = this._distributePasteToCursors(config, selections, text, pasteOnNewLine, multicursorText);\r\n if (distributedPaste) {\r\n selections = selections.sort(Range.compareRangesUsingStarts);\r\n return this._distributedPaste(config, model, selections, distributedPaste);\r\n }\r\n else {\r\n return this._simplePaste(config, model, selections, text, pasteOnNewLine);\r\n }\r\n }\r\n static _goodIndentForLine(config, model, lineNumber) {\r\n let action = null;\r\n let indentation = '';\r\n const expectedIndentAction = LanguageConfigurationRegistry.getInheritIndentForLine(config.autoIndent, model, lineNumber, false);\r\n if (expectedIndentAction) {\r\n action = expectedIndentAction.action;\r\n indentation = expectedIndentAction.indentation;\r\n }\r\n else if (lineNumber > 1) {\r\n let lastLineNumber;\r\n for (lastLineNumber = lineNumber - 1; lastLineNumber >= 1; lastLineNumber--) {\r\n const lineText = model.getLineContent(lastLineNumber);\r\n const nonWhitespaceIdx = strings.lastNonWhitespaceIndex(lineText);\r\n if (nonWhitespaceIdx >= 0) {\r\n break;\r\n }\r\n }\r\n if (lastLineNumber < 1) {\r\n // No previous line with content found\r\n return null;\r\n }\r\n const maxColumn = model.getLineMaxColumn(lastLineNumber);\r\n const expectedEnterAction = LanguageConfigurationRegistry.getEnterAction(config.autoIndent, model, new Range(lastLineNumber, maxColumn, lastLineNumber, maxColumn));\r\n if (expectedEnterAction) {\r\n indentation = expectedEnterAction.indentation + expectedEnterAction.appendText;\r\n }\r\n }\r\n if (action) {\r\n if (action === IndentAction.Indent) {\r\n indentation = TypeOperations.shiftIndent(config, indentation);\r\n }\r\n if (action === IndentAction.Outdent) {\r\n indentation = TypeOperations.unshiftIndent(config, indentation);\r\n }\r\n indentation = config.normalizeIndentation(indentation);\r\n }\r\n if (!indentation) {\r\n return null;\r\n }\r\n return indentation;\r\n }\r\n static _replaceJumpToNextIndent(config, model, selection, insertsAutoWhitespace) {\r\n let typeText = '';\r\n let position = selection.getStartPosition();\r\n if (config.insertSpaces) {\r\n let visibleColumnFromColumn = CursorColumns.visibleColumnFromColumn2(config, model, position);\r\n let indentSize = config.indentSize;\r\n let spacesCnt = indentSize - (visibleColumnFromColumn % indentSize);\r\n for (let i = 0; i < spacesCnt; i++) {\r\n typeText += ' ';\r\n }\r\n }\r\n else {\r\n typeText = '\\t';\r\n }\r\n return new ReplaceCommand(selection, typeText, insertsAutoWhitespace);\r\n }\r\n static tab(config, model, selections) {\r\n let commands = [];\r\n for (let i = 0, len = selections.length; i < len; i++) {\r\n const selection = selections[i];\r\n if (selection.isEmpty()) {\r\n let lineText = model.getLineContent(selection.startLineNumber);\r\n if (/^\\s*$/.test(lineText) && model.isCheapToTokenize(selection.startLineNumber)) {\r\n let goodIndent = this._goodIndentForLine(config, model, selection.startLineNumber);\r\n goodIndent = goodIndent || '\\t';\r\n let possibleTypeText = config.normalizeIndentation(goodIndent);\r\n if (!lineText.startsWith(possibleTypeText)) {\r\n commands[i] = new ReplaceCommand(new Range(selection.startLineNumber, 1, selection.startLineNumber, lineText.length + 1), possibleTypeText, true);\r\n continue;\r\n }\r\n }\r\n commands[i] = this._replaceJumpToNextIndent(config, model, selection, true);\r\n }\r\n else {\r\n if (selection.startLineNumber === selection.endLineNumber) {\r\n let lineMaxColumn = model.getLineMaxColumn(selection.startLineNumber);\r\n if (selection.startColumn !== 1 || selection.endColumn !== lineMaxColumn) {\r\n // This is a single line selection that is not the entire line\r\n commands[i] = this._replaceJumpToNextIndent(config, model, selection, false);\r\n continue;\r\n }\r\n }\r\n commands[i] = new ShiftCommand(selection, {\r\n isUnshift: false,\r\n tabSize: config.tabSize,\r\n indentSize: config.indentSize,\r\n insertSpaces: config.insertSpaces,\r\n useTabStops: config.useTabStops,\r\n autoIndent: config.autoIndent\r\n });\r\n }\r\n }\r\n return commands;\r\n }\r\n static compositionType(prevEditOperationType, config, model, selections, text, replacePrevCharCnt, replaceNextCharCnt, positionDelta) {\r\n const commands = selections.map(selection => this._compositionType(model, selection, text, replacePrevCharCnt, replaceNextCharCnt, positionDelta));\r\n return new EditOperationResult(4 /* TypingOther */, commands, {\r\n shouldPushStackElementBefore: shouldPushStackElementBetween(prevEditOperationType, 4 /* TypingOther */),\r\n shouldPushStackElementAfter: false\r\n });\r\n }\r\n static _compositionType(model, selection, text, replacePrevCharCnt, replaceNextCharCnt, positionDelta) {\r\n if (!selection.isEmpty()) {\r\n // looks like https://github.com/microsoft/vscode/issues/2773\r\n // where a cursor operation occurred before a canceled composition\r\n // => ignore composition\r\n return null;\r\n }\r\n const pos = selection.getPosition();\r\n const startColumn = Math.max(1, pos.column - replacePrevCharCnt);\r\n const endColumn = Math.min(model.getLineMaxColumn(pos.lineNumber), pos.column + replaceNextCharCnt);\r\n const range = new Range(pos.lineNumber, startColumn, pos.lineNumber, endColumn);\r\n const oldText = model.getValueInRange(range);\r\n if (oldText === text && positionDelta === 0) {\r\n // => ignore composition that doesn't do anything\r\n return null;\r\n }\r\n return new ReplaceCommandWithOffsetCursorState(range, text, 0, positionDelta);\r\n }\r\n static _typeCommand(range, text, keepPosition) {\r\n if (keepPosition) {\r\n return new ReplaceCommandWithoutChangingPosition(range, text, true);\r\n }\r\n else {\r\n return new ReplaceCommand(range, text, true);\r\n }\r\n }\r\n static _enter(config, model, keepPosition, range) {\r\n if (config.autoIndent === 0 /* None */) {\r\n return TypeOperations._typeCommand(range, '\\n', keepPosition);\r\n }\r\n if (!model.isCheapToTokenize(range.getStartPosition().lineNumber) || config.autoIndent === 1 /* Keep */) {\r\n let lineText = model.getLineContent(range.startLineNumber);\r\n let indentation = strings.getLeadingWhitespace(lineText).substring(0, range.startColumn - 1);\r\n return TypeOperations._typeCommand(range, '\\n' + config.normalizeIndentation(indentation), keepPosition);\r\n }\r\n const r = LanguageConfigurationRegistry.getEnterAction(config.autoIndent, model, range);\r\n if (r) {\r\n if (r.indentAction === IndentAction.None) {\r\n // Nothing special\r\n return TypeOperations._typeCommand(range, '\\n' + config.normalizeIndentation(r.indentation + r.appendText), keepPosition);\r\n }\r\n else if (r.indentAction === IndentAction.Indent) {\r\n // Indent once\r\n return TypeOperations._typeCommand(range, '\\n' + config.normalizeIndentation(r.indentation + r.appendText), keepPosition);\r\n }\r\n else if (r.indentAction === IndentAction.IndentOutdent) {\r\n // Ultra special\r\n const normalIndent = config.normalizeIndentation(r.indentation);\r\n const increasedIndent = config.normalizeIndentation(r.indentation + r.appendText);\r\n const typeText = '\\n' + increasedIndent + '\\n' + normalIndent;\r\n if (keepPosition) {\r\n return new ReplaceCommandWithoutChangingPosition(range, typeText, true);\r\n }\r\n else {\r\n return new ReplaceCommandWithOffsetCursorState(range, typeText, -1, increasedIndent.length - normalIndent.length, true);\r\n }\r\n }\r\n else if (r.indentAction === IndentAction.Outdent) {\r\n const actualIndentation = TypeOperations.unshiftIndent(config, r.indentation);\r\n return TypeOperations._typeCommand(range, '\\n' + config.normalizeIndentation(actualIndentation + r.appendText), keepPosition);\r\n }\r\n }\r\n const lineText = model.getLineContent(range.startLineNumber);\r\n const indentation = strings.getLeadingWhitespace(lineText).substring(0, range.startColumn - 1);\r\n if (config.autoIndent >= 4 /* Full */) {\r\n const ir = LanguageConfigurationRegistry.getIndentForEnter(config.autoIndent, model, range, {\r\n unshiftIndent: (indent) => {\r\n return TypeOperations.unshiftIndent(config, indent);\r\n },\r\n shiftIndent: (indent) => {\r\n return TypeOperations.shiftIndent(config, indent);\r\n },\r\n normalizeIndentation: (indent) => {\r\n return config.normalizeIndentation(indent);\r\n }\r\n });\r\n if (ir) {\r\n let oldEndViewColumn = CursorColumns.visibleColumnFromColumn2(config, model, range.getEndPosition());\r\n const oldEndColumn = range.endColumn;\r\n const newLineContent = model.getLineContent(range.endLineNumber);\r\n const firstNonWhitespace = strings.firstNonWhitespaceIndex(newLineContent);\r\n if (firstNonWhitespace >= 0) {\r\n range = range.setEndPosition(range.endLineNumber, Math.max(range.endColumn, firstNonWhitespace + 1));\r\n }\r\n else {\r\n range = range.setEndPosition(range.endLineNumber, model.getLineMaxColumn(range.endLineNumber));\r\n }\r\n if (keepPosition) {\r\n return new ReplaceCommandWithoutChangingPosition(range, '\\n' + config.normalizeIndentation(ir.afterEnter), true);\r\n }\r\n else {\r\n let offset = 0;\r\n if (oldEndColumn <= firstNonWhitespace + 1) {\r\n if (!config.insertSpaces) {\r\n oldEndViewColumn = Math.ceil(oldEndViewColumn / config.indentSize);\r\n }\r\n offset = Math.min(oldEndViewColumn + 1 - config.normalizeIndentation(ir.afterEnter).length - 1, 0);\r\n }\r\n return new ReplaceCommandWithOffsetCursorState(range, '\\n' + config.normalizeIndentation(ir.afterEnter), 0, offset, true);\r\n }\r\n }\r\n }\r\n return TypeOperations._typeCommand(range, '\\n' + config.normalizeIndentation(indentation), keepPosition);\r\n }\r\n static _isAutoIndentType(config, model, selections) {\r\n if (config.autoIndent < 4 /* Full */) {\r\n return false;\r\n }\r\n for (let i = 0, len = selections.length; i < len; i++) {\r\n if (!model.isCheapToTokenize(selections[i].getEndPosition().lineNumber)) {\r\n return false;\r\n }\r\n }\r\n return true;\r\n }\r\n static _runAutoIndentType(config, model, range, ch) {\r\n const currentIndentation = LanguageConfigurationRegistry.getIndentationAtPosition(model, range.startLineNumber, range.startColumn);\r\n const actualIndentation = LanguageConfigurationRegistry.getIndentActionForType(config.autoIndent, model, range, ch, {\r\n shiftIndent: (indentation) => {\r\n return TypeOperations.shiftIndent(config, indentation);\r\n },\r\n unshiftIndent: (indentation) => {\r\n return TypeOperations.unshiftIndent(config, indentation);\r\n },\r\n });\r\n if (actualIndentation === null) {\r\n return null;\r\n }\r\n if (actualIndentation !== config.normalizeIndentation(currentIndentation)) {\r\n const firstNonWhitespace = model.getLineFirstNonWhitespaceColumn(range.startLineNumber);\r\n if (firstNonWhitespace === 0) {\r\n return TypeOperations._typeCommand(new Range(range.startLineNumber, 1, range.endLineNumber, range.endColumn), config.normalizeIndentation(actualIndentation) + ch, false);\r\n }\r\n else {\r\n return TypeOperations._typeCommand(new Range(range.startLineNumber, 1, range.endLineNumber, range.endColumn), config.normalizeIndentation(actualIndentation) +\r\n model.getLineContent(range.startLineNumber).substring(firstNonWhitespace - 1, range.startColumn - 1) + ch, false);\r\n }\r\n }\r\n return null;\r\n }\r\n static _isAutoClosingOvertype(config, model, selections, autoClosedCharacters, ch) {\r\n if (config.autoClosingOvertype === 'never') {\r\n return false;\r\n }\r\n if (!config.autoClosingPairs.autoClosingPairsCloseSingleChar.has(ch)) {\r\n return false;\r\n }\r\n for (let i = 0, len = selections.length; i < len; i++) {\r\n const selection = selections[i];\r\n if (!selection.isEmpty()) {\r\n return false;\r\n }\r\n const position = selection.getPosition();\r\n const lineText = model.getLineContent(position.lineNumber);\r\n const afterCharacter = lineText.charAt(position.column - 1);\r\n if (afterCharacter !== ch) {\r\n return false;\r\n }\r\n // Do not over-type quotes after a backslash\r\n const chIsQuote = isQuote(ch);\r\n const beforeCharacter = position.column > 2 ? lineText.charCodeAt(position.column - 2) : 0 /* Null */;\r\n if (beforeCharacter === 92 /* Backslash */ && chIsQuote) {\r\n return false;\r\n }\r\n // Must over-type a closing character typed by the editor\r\n if (config.autoClosingOvertype === 'auto') {\r\n let found = false;\r\n for (let j = 0, lenJ = autoClosedCharacters.length; j < lenJ; j++) {\r\n const autoClosedCharacter = autoClosedCharacters[j];\r\n if (position.lineNumber === autoClosedCharacter.startLineNumber && position.column === autoClosedCharacter.startColumn) {\r\n found = true;\r\n break;\r\n }\r\n }\r\n if (!found) {\r\n return false;\r\n }\r\n }\r\n }\r\n return true;\r\n }\r\n static _runAutoClosingOvertype(prevEditOperationType, config, model, selections, ch) {\r\n let commands = [];\r\n for (let i = 0, len = selections.length; i < len; i++) {\r\n const selection = selections[i];\r\n const position = selection.getPosition();\r\n const typeSelection = new Range(position.lineNumber, position.column, position.lineNumber, position.column + 1);\r\n commands[i] = new ReplaceCommand(typeSelection, ch);\r\n }\r\n return new EditOperationResult(4 /* TypingOther */, commands, {\r\n shouldPushStackElementBefore: shouldPushStackElementBetween(prevEditOperationType, 4 /* TypingOther */),\r\n shouldPushStackElementAfter: false\r\n });\r\n }\r\n static _isBeforeClosingBrace(config, lineAfter) {\r\n // If the start of lineAfter can be interpretted as both a starting or ending brace, default to returning false\r\n const nextChar = lineAfter.charAt(0);\r\n const potentialStartingBraces = config.autoClosingPairs.autoClosingPairsOpenByStart.get(nextChar) || [];\r\n const potentialClosingBraces = config.autoClosingPairs.autoClosingPairsCloseByStart.get(nextChar) || [];\r\n const isBeforeStartingBrace = potentialStartingBraces.some(x => lineAfter.startsWith(x.open));\r\n const isBeforeClosingBrace = potentialClosingBraces.some(x => lineAfter.startsWith(x.close));\r\n return !isBeforeStartingBrace && isBeforeClosingBrace;\r\n }\r\n static _findAutoClosingPairOpen(config, model, positions, ch) {\r\n const autoClosingPairCandidates = config.autoClosingPairs.autoClosingPairsOpenByEnd.get(ch);\r\n if (!autoClosingPairCandidates) {\r\n return null;\r\n }\r\n // Determine which auto-closing pair it is\r\n let autoClosingPair = null;\r\n for (const autoClosingPairCandidate of autoClosingPairCandidates) {\r\n if (autoClosingPair === null || autoClosingPairCandidate.open.length > autoClosingPair.open.length) {\r\n let candidateIsMatch = true;\r\n for (const position of positions) {\r\n const relevantText = model.getValueInRange(new Range(position.lineNumber, position.column - autoClosingPairCandidate.open.length + 1, position.lineNumber, position.column));\r\n if (relevantText + ch !== autoClosingPairCandidate.open) {\r\n candidateIsMatch = false;\r\n break;\r\n }\r\n }\r\n if (candidateIsMatch) {\r\n autoClosingPair = autoClosingPairCandidate;\r\n }\r\n }\r\n }\r\n return autoClosingPair;\r\n }\r\n static _findSubAutoClosingPairClose(config, autoClosingPair) {\r\n if (autoClosingPair.open.length <= 1) {\r\n return '';\r\n }\r\n const lastChar = autoClosingPair.close.charAt(autoClosingPair.close.length - 1);\r\n // get candidates with the same last character as close\r\n const subPairCandidates = config.autoClosingPairs.autoClosingPairsCloseByEnd.get(lastChar) || [];\r\n let subPairMatch = null;\r\n for (const x of subPairCandidates) {\r\n if (x.open !== autoClosingPair.open && autoClosingPair.open.includes(x.open) && autoClosingPair.close.endsWith(x.close)) {\r\n if (!subPairMatch || x.open.length > subPairMatch.open.length) {\r\n subPairMatch = x;\r\n }\r\n }\r\n }\r\n if (subPairMatch) {\r\n return subPairMatch.close;\r\n }\r\n else {\r\n return '';\r\n }\r\n }\r\n static _getAutoClosingPairClose(config, model, selections, ch, insertOpenCharacter) {\r\n const chIsQuote = isQuote(ch);\r\n const autoCloseConfig = chIsQuote ? config.autoClosingQuotes : config.autoClosingBrackets;\r\n if (autoCloseConfig === 'never') {\r\n return null;\r\n }\r\n const autoClosingPair = this._findAutoClosingPairOpen(config, model, selections.map(s => s.getPosition()), ch);\r\n if (!autoClosingPair) {\r\n return null;\r\n }\r\n const subAutoClosingPairClose = this._findSubAutoClosingPairClose(config, autoClosingPair);\r\n let isSubAutoClosingPairPresent = true;\r\n const shouldAutoCloseBefore = chIsQuote ? config.shouldAutoCloseBefore.quote : config.shouldAutoCloseBefore.bracket;\r\n for (let i = 0, len = selections.length; i < len; i++) {\r\n const selection = selections[i];\r\n if (!selection.isEmpty()) {\r\n return null;\r\n }\r\n const position = selection.getPosition();\r\n const lineText = model.getLineContent(position.lineNumber);\r\n const lineAfter = lineText.substring(position.column - 1);\r\n if (!lineAfter.startsWith(subAutoClosingPairClose)) {\r\n isSubAutoClosingPairPresent = false;\r\n }\r\n // Only consider auto closing the pair if an allowed character follows or if another autoclosed pair closing brace follows\r\n if (lineText.length > position.column - 1) {\r\n const characterAfter = lineText.charAt(position.column - 1);\r\n const isBeforeCloseBrace = TypeOperations._isBeforeClosingBrace(config, lineAfter);\r\n if (!isBeforeCloseBrace && !shouldAutoCloseBefore(characterAfter)) {\r\n return null;\r\n }\r\n }\r\n if (!model.isCheapToTokenize(position.lineNumber)) {\r\n // Do not force tokenization\r\n return null;\r\n }\r\n // Do not auto-close ' or \" after a word character\r\n if (autoClosingPair.open.length === 1 && chIsQuote && autoCloseConfig !== 'always') {\r\n const wordSeparators = getMapForWordSeparators(config.wordSeparators);\r\n if (insertOpenCharacter && position.column > 1 && wordSeparators.get(lineText.charCodeAt(position.column - 2)) === 0 /* Regular */) {\r\n return null;\r\n }\r\n if (!insertOpenCharacter && position.column > 2 && wordSeparators.get(lineText.charCodeAt(position.column - 3)) === 0 /* Regular */) {\r\n return null;\r\n }\r\n }\r\n model.forceTokenization(position.lineNumber);\r\n const lineTokens = model.getLineTokens(position.lineNumber);\r\n let shouldAutoClosePair = false;\r\n try {\r\n shouldAutoClosePair = LanguageConfigurationRegistry.shouldAutoClosePair(autoClosingPair, lineTokens, insertOpenCharacter ? position.column : position.column - 1);\r\n }\r\n catch (e) {\r\n onUnexpectedError(e);\r\n }\r\n if (!shouldAutoClosePair) {\r\n return null;\r\n }\r\n }\r\n if (isSubAutoClosingPairPresent) {\r\n return autoClosingPair.close.substring(0, autoClosingPair.close.length - subAutoClosingPairClose.length);\r\n }\r\n else {\r\n return autoClosingPair.close;\r\n }\r\n }\r\n static _runAutoClosingOpenCharType(prevEditOperationType, config, model, selections, ch, insertOpenCharacter, autoClosingPairClose) {\r\n let commands = [];\r\n for (let i = 0, len = selections.length; i < len; i++) {\r\n const selection = selections[i];\r\n commands[i] = new TypeWithAutoClosingCommand(selection, ch, insertOpenCharacter, autoClosingPairClose);\r\n }\r\n return new EditOperationResult(4 /* TypingOther */, commands, {\r\n shouldPushStackElementBefore: true,\r\n shouldPushStackElementAfter: false\r\n });\r\n }\r\n static _shouldSurroundChar(config, ch) {\r\n if (isQuote(ch)) {\r\n return (config.autoSurround === 'quotes' || config.autoSurround === 'languageDefined');\r\n }\r\n else {\r\n // Character is a bracket\r\n return (config.autoSurround === 'brackets' || config.autoSurround === 'languageDefined');\r\n }\r\n }\r\n static _isSurroundSelectionType(config, model, selections, ch) {\r\n if (!TypeOperations._shouldSurroundChar(config, ch) || !config.surroundingPairs.hasOwnProperty(ch)) {\r\n return false;\r\n }\r\n const isTypingAQuoteCharacter = isQuote(ch);\r\n for (let i = 0, len = selections.length; i < len; i++) {\r\n const selection = selections[i];\r\n if (selection.isEmpty()) {\r\n return false;\r\n }\r\n let selectionContainsOnlyWhitespace = true;\r\n for (let lineNumber = selection.startLineNumber; lineNumber <= selection.endLineNumber; lineNumber++) {\r\n const lineText = model.getLineContent(lineNumber);\r\n const startIndex = (lineNumber === selection.startLineNumber ? selection.startColumn - 1 : 0);\r\n const endIndex = (lineNumber === selection.endLineNumber ? selection.endColumn - 1 : lineText.length);\r\n const selectedText = lineText.substring(startIndex, endIndex);\r\n if (/[^ \\t]/.test(selectedText)) {\r\n // this selected text contains something other than whitespace\r\n selectionContainsOnlyWhitespace = false;\r\n break;\r\n }\r\n }\r\n if (selectionContainsOnlyWhitespace) {\r\n return false;\r\n }\r\n if (isTypingAQuoteCharacter && selection.startLineNumber === selection.endLineNumber && selection.startColumn + 1 === selection.endColumn) {\r\n const selectionText = model.getValueInRange(selection);\r\n if (isQuote(selectionText)) {\r\n // Typing a quote character on top of another quote character\r\n // => disable surround selection type\r\n return false;\r\n }\r\n }\r\n }\r\n return true;\r\n }\r\n static _runSurroundSelectionType(prevEditOperationType, config, model, selections, ch) {\r\n let commands = [];\r\n for (let i = 0, len = selections.length; i < len; i++) {\r\n const selection = selections[i];\r\n const closeCharacter = config.surroundingPairs[ch];\r\n commands[i] = new SurroundSelectionCommand(selection, ch, closeCharacter);\r\n }\r\n return new EditOperationResult(0 /* Other */, commands, {\r\n shouldPushStackElementBefore: true,\r\n shouldPushStackElementAfter: true\r\n });\r\n }\r\n static _isTypeInterceptorElectricChar(config, model, selections) {\r\n if (selections.length === 1 && model.isCheapToTokenize(selections[0].getEndPosition().lineNumber)) {\r\n return true;\r\n }\r\n return false;\r\n }\r\n static _typeInterceptorElectricChar(prevEditOperationType, config, model, selection, ch) {\r\n if (!config.electricChars.hasOwnProperty(ch) || !selection.isEmpty()) {\r\n return null;\r\n }\r\n let position = selection.getPosition();\r\n model.forceTokenization(position.lineNumber);\r\n let lineTokens = model.getLineTokens(position.lineNumber);\r\n let electricAction;\r\n try {\r\n electricAction = LanguageConfigurationRegistry.onElectricCharacter(ch, lineTokens, position.column);\r\n }\r\n catch (e) {\r\n onUnexpectedError(e);\r\n return null;\r\n }\r\n if (!electricAction) {\r\n return null;\r\n }\r\n if (electricAction.matchOpenBracket) {\r\n let endColumn = (lineTokens.getLineContent() + ch).lastIndexOf(electricAction.matchOpenBracket) + 1;\r\n let match = model.findMatchingBracketUp(electricAction.matchOpenBracket, {\r\n lineNumber: position.lineNumber,\r\n column: endColumn\r\n });\r\n if (match) {\r\n if (match.startLineNumber === position.lineNumber) {\r\n // matched something on the same line => no change in indentation\r\n return null;\r\n }\r\n let matchLine = model.getLineContent(match.startLineNumber);\r\n let matchLineIndentation = strings.getLeadingWhitespace(matchLine);\r\n let newIndentation = config.normalizeIndentation(matchLineIndentation);\r\n let lineText = model.getLineContent(position.lineNumber);\r\n let lineFirstNonBlankColumn = model.getLineFirstNonWhitespaceColumn(position.lineNumber) || position.column;\r\n let prefix = lineText.substring(lineFirstNonBlankColumn - 1, position.column - 1);\r\n let typeText = newIndentation + prefix + ch;\r\n let typeSelection = new Range(position.lineNumber, 1, position.lineNumber, position.column);\r\n const command = new ReplaceCommand(typeSelection, typeText);\r\n return new EditOperationResult(getTypingOperation(typeText, prevEditOperationType), [command], {\r\n shouldPushStackElementBefore: false,\r\n shouldPushStackElementAfter: true\r\n });\r\n }\r\n }\r\n return null;\r\n }\r\n /**\r\n * This is very similar with typing, but the character is already in the text buffer!\r\n */\r\n static compositionEndWithInterceptors(prevEditOperationType, config, model, selectionsWhenCompositionStarted, selections, autoClosedCharacters) {\r\n if (!selectionsWhenCompositionStarted || Selection.selectionsArrEqual(selectionsWhenCompositionStarted, selections)) {\r\n // no content was typed\r\n return null;\r\n }\r\n let ch = null;\r\n // extract last typed character\r\n for (const selection of selections) {\r\n if (!selection.isEmpty()) {\r\n return null;\r\n }\r\n const position = selection.getPosition();\r\n const currentChar = model.getValueInRange(new Range(position.lineNumber, position.column - 1, position.lineNumber, position.column));\r\n if (ch === null) {\r\n ch = currentChar;\r\n }\r\n else if (ch !== currentChar) {\r\n return null;\r\n }\r\n }\r\n if (!ch) {\r\n return null;\r\n }\r\n if (this._isAutoClosingOvertype(config, model, selections, autoClosedCharacters, ch)) {\r\n // Unfortunately, the close character is at this point \"doubled\", so we need to delete it...\r\n const commands = selections.map(s => new ReplaceCommand(new Range(s.positionLineNumber, s.positionColumn, s.positionLineNumber, s.positionColumn + 1), '', false));\r\n return new EditOperationResult(4 /* TypingOther */, commands, {\r\n shouldPushStackElementBefore: true,\r\n shouldPushStackElementAfter: false\r\n });\r\n }\r\n const autoClosingPairClose = this._getAutoClosingPairClose(config, model, selections, ch, false);\r\n if (autoClosingPairClose !== null) {\r\n return this._runAutoClosingOpenCharType(prevEditOperationType, config, model, selections, ch, false, autoClosingPairClose);\r\n }\r\n return null;\r\n }\r\n static typeWithInterceptors(isDoingComposition, prevEditOperationType, config, model, selections, autoClosedCharacters, ch) {\r\n if (!isDoingComposition && ch === '\\n') {\r\n let commands = [];\r\n for (let i = 0, len = selections.length; i < len; i++) {\r\n commands[i] = TypeOperations._enter(config, model, false, selections[i]);\r\n }\r\n return new EditOperationResult(4 /* TypingOther */, commands, {\r\n shouldPushStackElementBefore: true,\r\n shouldPushStackElementAfter: false,\r\n });\r\n }\r\n if (!isDoingComposition && this._isAutoIndentType(config, model, selections)) {\r\n let commands = [];\r\n let autoIndentFails = false;\r\n for (let i = 0, len = selections.length; i < len; i++) {\r\n commands[i] = this._runAutoIndentType(config, model, selections[i], ch);\r\n if (!commands[i]) {\r\n autoIndentFails = true;\r\n break;\r\n }\r\n }\r\n if (!autoIndentFails) {\r\n return new EditOperationResult(4 /* TypingOther */, commands, {\r\n shouldPushStackElementBefore: true,\r\n shouldPushStackElementAfter: false,\r\n });\r\n }\r\n }\r\n if (!isDoingComposition && this._isAutoClosingOvertype(config, model, selections, autoClosedCharacters, ch)) {\r\n return this._runAutoClosingOvertype(prevEditOperationType, config, model, selections, ch);\r\n }\r\n if (!isDoingComposition) {\r\n const autoClosingPairClose = this._getAutoClosingPairClose(config, model, selections, ch, true);\r\n if (autoClosingPairClose) {\r\n return this._runAutoClosingOpenCharType(prevEditOperationType, config, model, selections, ch, true, autoClosingPairClose);\r\n }\r\n }\r\n if (this._isSurroundSelectionType(config, model, selections, ch)) {\r\n return this._runSurroundSelectionType(prevEditOperationType, config, model, selections, ch);\r\n }\r\n // Electric characters make sense only when dealing with a single cursor,\r\n // as multiple cursors typing brackets for example would interfer with bracket matching\r\n if (!isDoingComposition && this._isTypeInterceptorElectricChar(config, model, selections)) {\r\n const r = this._typeInterceptorElectricChar(prevEditOperationType, config, model, selections[0], ch);\r\n if (r) {\r\n return r;\r\n }\r\n }\r\n // A simple character type\r\n let commands = [];\r\n for (let i = 0, len = selections.length; i < len; i++) {\r\n commands[i] = new ReplaceCommand(selections[i], ch);\r\n }\r\n const opType = getTypingOperation(ch, prevEditOperationType);\r\n return new EditOperationResult(opType, commands, {\r\n shouldPushStackElementBefore: shouldPushStackElementBetween(prevEditOperationType, opType),\r\n shouldPushStackElementAfter: false\r\n });\r\n }\r\n static typeWithoutInterceptors(prevEditOperationType, config, model, selections, str) {\r\n let commands = [];\r\n for (let i = 0, len = selections.length; i < len; i++) {\r\n commands[i] = new ReplaceCommand(selections[i], str);\r\n }\r\n const opType = getTypingOperation(str, prevEditOperationType);\r\n return new EditOperationResult(opType, commands, {\r\n shouldPushStackElementBefore: shouldPushStackElementBetween(prevEditOperationType, opType),\r\n shouldPushStackElementAfter: false\r\n });\r\n }\r\n static lineInsertBefore(config, model, selections) {\r\n if (model === null || selections === null) {\r\n return [];\r\n }\r\n let commands = [];\r\n for (let i = 0, len = selections.length; i < len; i++) {\r\n let lineNumber = selections[i].positionLineNumber;\r\n if (lineNumber === 1) {\r\n commands[i] = new ReplaceCommandWithoutChangingPosition(new Range(1, 1, 1, 1), '\\n');\r\n }\r\n else {\r\n lineNumber--;\r\n let column = model.getLineMaxColumn(lineNumber);\r\n commands[i] = this._enter(config, model, false, new Range(lineNumber, column, lineNumber, column));\r\n }\r\n }\r\n return commands;\r\n }\r\n static lineInsertAfter(config, model, selections) {\r\n if (model === null || selections === null) {\r\n return [];\r\n }\r\n let commands = [];\r\n for (let i = 0, len = selections.length; i < len; i++) {\r\n const lineNumber = selections[i].positionLineNumber;\r\n let column = model.getLineMaxColumn(lineNumber);\r\n commands[i] = this._enter(config, model, false, new Range(lineNumber, column, lineNumber, column));\r\n }\r\n return commands;\r\n }\r\n static lineBreakInsert(config, model, selections) {\r\n let commands = [];\r\n for (let i = 0, len = selections.length; i < len; i++) {\r\n commands[i] = this._enter(config, model, true, selections[i]);\r\n }\r\n return commands;\r\n }\r\n}\r\nexport class TypeWithAutoClosingCommand extends ReplaceCommandWithOffsetCursorState {\r\n constructor(selection, openCharacter, insertOpenCharacter, closeCharacter) {\r\n super(selection, (insertOpenCharacter ? openCharacter : '') + closeCharacter, 0, -closeCharacter.length);\r\n this._openCharacter = openCharacter;\r\n this._closeCharacter = closeCharacter;\r\n this.closeCharacterRange = null;\r\n this.enclosingRange = null;\r\n }\r\n computeCursorState(model, helper) {\r\n let inverseEditOperations = helper.getInverseEditOperations();\r\n let range = inverseEditOperations[0].range;\r\n this.closeCharacterRange = new Range(range.startLineNumber, range.endColumn - this._closeCharacter.length, range.endLineNumber, range.endColumn);\r\n this.enclosingRange = new Range(range.startLineNumber, range.endColumn - this._openCharacter.length - this._closeCharacter.length, range.endLineNumber, range.endColumn);\r\n return super.computeCursorState(model, helper);\r\n }\r\n}\r\nfunction getTypingOperation(typedText, previousTypingOperation) {\r\n if (typedText === ' ') {\r\n return previousTypingOperation === 5 /* TypingFirstSpace */\r\n || previousTypingOperation === 6 /* TypingConsecutiveSpace */\r\n ? 6 /* TypingConsecutiveSpace */\r\n : 5 /* TypingFirstSpace */;\r\n }\r\n return 4 /* TypingOther */;\r\n}\r\nfunction shouldPushStackElementBetween(previousTypingOperation, typingOperation) {\r\n if (isTypingOperation(previousTypingOperation) && !isTypingOperation(typingOperation)) {\r\n // Always set an undo stop before non-type operations\r\n return true;\r\n }\r\n if (previousTypingOperation === 5 /* TypingFirstSpace */) {\r\n // `abc |d`: No undo stop\r\n // `abc |d`: Undo stop\r\n return false;\r\n }\r\n // Insert undo stop between different operation types\r\n return normalizeOperationType(previousTypingOperation) !== normalizeOperationType(typingOperation);\r\n}\r\nfunction normalizeOperationType(type) {\r\n return (type === 6 /* TypingConsecutiveSpace */ || type === 5 /* TypingFirstSpace */)\r\n ? 'space'\r\n : type;\r\n}\r\nfunction isTypingOperation(type) {\r\n return type === 4 /* TypingOther */\r\n || type === 5 /* TypingFirstSpace */\r\n || type === 6 /* TypingConsecutiveSpace */;\r\n}\r\n", "/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License. See License.txt in the project root for license information.\r\n *--------------------------------------------------------------------------------------------*/\r\nimport * as nls from '../../nls.js';\r\nimport { RawContextKey } from '../../platform/contextkey/common/contextkey.js';\r\nexport var EditorContextKeys;\r\n(function (EditorContextKeys) {\r\n EditorContextKeys.editorSimpleInput = new RawContextKey('editorSimpleInput', false, true);\r\n /**\r\n * A context key that is set when the editor's text has focus (cursor is blinking).\r\n * Is false when focus is in simple editor widgets (repl input, scm commit input).\r\n */\r\n EditorContextKeys.editorTextFocus = new RawContextKey('editorTextFocus', false, nls.localize('editorTextFocus', \"Whether the editor text has focus (cursor is blinking)\"));\r\n /**\r\n * A context key that is set when the editor's text or an editor's widget has focus.\r\n */\r\n EditorContextKeys.focus = new RawContextKey('editorFocus', false, nls.localize('editorFocus', \"Whether the editor or an editor widget has focus (e.g. focus is in the find widget)\"));\r\n /**\r\n * A context key that is set when any editor input has focus (regular editor, repl input...).\r\n */\r\n EditorContextKeys.textInputFocus = new RawContextKey('textInputFocus', false, nls.localize('textInputFocus', \"Whether an editor or a rich text input has focus (cursor is blinking)\"));\r\n EditorContextKeys.readOnly = new RawContextKey('editorReadonly', false, nls.localize('editorReadonly', \"Whether the editor is read only\"));\r\n EditorContextKeys.inDiffEditor = new RawContextKey('inDiffEditor', false, nls.localize('inDiffEditor', \"Whether the context is a diff editor\"));\r\n EditorContextKeys.columnSelection = new RawContextKey('editorColumnSelection', false, nls.localize('editorColumnSelection', \"Whether `editor.columnSelection` is enabled\"));\r\n EditorContextKeys.writable = EditorContextKeys.readOnly.toNegated();\r\n EditorContextKeys.hasNonEmptySelection = new RawContextKey('editorHasSelection', false, nls.localize('editorHasSelection', \"Whether the editor has text selected\"));\r\n EditorContextKeys.hasOnlyEmptySelection = EditorContextKeys.hasNonEmptySelection.toNegated();\r\n EditorContextKeys.hasMultipleSelections = new RawContextKey('editorHasMultipleSelections', false, nls.localize('editorHasMultipleSelections', \"Whether the editor has multiple selections\"));\r\n EditorContextKeys.hasSingleSelection = EditorContextKeys.hasMultipleSelections.toNegated();\r\n EditorContextKeys.tabMovesFocus = new RawContextKey('editorTabMovesFocus', false, nls.localize('editorTabMovesFocus', \"Whether `Tab` will move focus out of the editor\"));\r\n EditorContextKeys.tabDoesNotMoveFocus = EditorContextKeys.tabMovesFocus.toNegated();\r\n EditorContextKeys.isInWalkThroughSnippet = new RawContextKey('isInEmbeddedEditor', false, true);\r\n EditorContextKeys.canUndo = new RawContextKey('canUndo', false, true);\r\n EditorContextKeys.canRedo = new RawContextKey('canRedo', false, true);\r\n EditorContextKeys.hoverVisible = new RawContextKey('editorHoverVisible', false, nls.localize('editorHoverVisible', \"Whether the editor hover is visible\"));\r\n /**\r\n * A context key that is set when an editor is part of a larger editor, like notebooks or\r\n * (future) a diff editor\r\n */\r\n EditorContextKeys.inCompositeEditor = new RawContextKey('inCompositeEditor', undefined, nls.localize('inCompositeEditor', \"Whether the editor is part of a larger editor (e.g. notebooks)\"));\r\n EditorContextKeys.notInCompositeEditor = EditorContextKeys.inCompositeEditor.toNegated();\r\n // -- mode context keys\r\n EditorContextKeys.languageId = new RawContextKey('editorLangId', '', nls.localize('editorLangId', \"The language identifier of the editor\"));\r\n EditorContextKeys.hasCompletionItemProvider = new RawContextKey('editorHasCompletionItemProvider', false, nls.localize('editorHasCompletionItemProvider', \"Whether the editor has a completion item provider\"));\r\n EditorContextKeys.hasCodeActionsProvider = new RawContextKey('editorHasCodeActionsProvider', false, nls.localize('editorHasCodeActionsProvider', \"Whether the editor has a code actions provider\"));\r\n EditorContextKeys.hasCodeLensProvider = new RawContextKey('editorHasCodeLensProvider', false, nls.localize('editorHasCodeLensProvider', \"Whether the editor has a code lens provider\"));\r\n EditorContextKeys.hasDefinitionProvider = new RawContextKey('editorHasDefinitionProvider', false, nls.localize('editorHasDefinitionProvider', \"Whether the editor has a definition provider\"));\r\n EditorContextKeys.hasDeclarationProvider = new RawContextKey('editorHasDeclarationProvider', false, nls.localize('editorHasDeclarationProvider', \"Whether the editor has a declaration provider\"));\r\n EditorContextKeys.hasImplementationProvider = new RawContextKey('editorHasImplementationProvider', false, nls.localize('editorHasImplementationProvider', \"Whether the editor has an implementation provider\"));\r\n EditorContextKeys.hasTypeDefinitionProvider = new RawContextKey('editorHasTypeDefinitionProvider', false, nls.localize('editorHasTypeDefinitionProvider', \"Whether the editor has a type definition provider\"));\r\n EditorContextKeys.hasHoverProvider = new RawContextKey('editorHasHoverProvider', false, nls.localize('editorHasHoverProvider', \"Whether the editor has a hover provider\"));\r\n EditorContextKeys.hasDocumentHighlightProvider = new RawContextKey('editorHasDocumentHighlightProvider', false, nls.localize('editorHasDocumentHighlightProvider', \"Whether the editor has a document highlight provider\"));\r\n EditorContextKeys.hasDocumentSymbolProvider = new RawContextKey('editorHasDocumentSymbolProvider', false, nls.localize('editorHasDocumentSymbolProvider', \"Whether the editor has a document symbol provider\"));\r\n EditorContextKeys.hasReferenceProvider = new RawContextKey('editorHasReferenceProvider', false, nls.localize('editorHasReferenceProvider', \"Whether the editor has a reference provider\"));\r\n EditorContextKeys.hasRenameProvider = new RawContextKey('editorHasRenameProvider', false, nls.localize('editorHasRenameProvider', \"Whether the editor has a rename provider\"));\r\n EditorContextKeys.hasSignatureHelpProvider = new RawContextKey('editorHasSignatureHelpProvider', false, nls.localize('editorHasSignatureHelpProvider', \"Whether the editor has a signature help provider\"));\r\n EditorContextKeys.hasInlayHintsProvider = new RawContextKey('editorHasInlayHintsProvider', false, nls.localize('editorHasInlayHintsProvider', \"Whether the editor has an inline hints provider\"));\r\n // -- mode context keys: formatting\r\n EditorContextKeys.hasDocumentFormattingProvider = new RawContextKey('editorHasDocumentFormattingProvider', false, nls.localize('editorHasDocumentFormattingProvider', \"Whether the editor has a document formatting provider\"));\r\n EditorContextKeys.hasDocumentSelectionFormattingProvider = new RawContextKey('editorHasDocumentSelectionFormattingProvider', false, nls.localize('editorHasDocumentSelectionFormattingProvider', \"Whether the editor has a document selection formatting provider\"));\r\n EditorContextKeys.hasMultipleDocumentFormattingProvider = new RawContextKey('editorHasMultipleDocumentFormattingProvider', false, nls.localize('editorHasMultipleDocumentFormattingProvider', \"Whether the editor has multiple document formatting providers\"));\r\n EditorContextKeys.hasMultipleDocumentSelectionFormattingProvider = new RawContextKey('editorHasMultipleDocumentSelectionFormattingProvider', false, nls.localize('editorHasMultipleDocumentSelectionFormattingProvider', \"Whether the editor has multiple document selection formatting providers\"));\r\n})(EditorContextKeys || (EditorContextKeys = {}));\r\n", "/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License. See License.txt in the project root for license information.\r\n *--------------------------------------------------------------------------------------------*/\r\nimport * as nls from '../../../nls.js';\r\nimport { isFirefox } from '../../../base/browser/browser.js';\r\nimport * as types from '../../../base/common/types.js';\r\nimport { status } from '../../../base/browser/ui/aria/aria.js';\r\nimport { Command, EditorCommand, registerEditorCommand, UndoCommand, RedoCommand, SelectAllCommand } from '../editorExtensions.js';\r\nimport { ICodeEditorService } from '../services/codeEditorService.js';\r\nimport { ColumnSelection } from '../../common/controller/cursorColumnSelection.js';\r\nimport { CursorState } from '../../common/controller/cursorCommon.js';\r\nimport { DeleteOperations } from '../../common/controller/cursorDeleteOperations.js';\r\nimport { CursorMove as CursorMove_, CursorMoveCommands } from '../../common/controller/cursorMoveCommands.js';\r\nimport { TypeOperations } from '../../common/controller/cursorTypeOperations.js';\r\nimport { Position } from '../../common/core/position.js';\r\nimport { Range } from '../../common/core/range.js';\r\nimport { EditorContextKeys } from '../../common/editorContextKeys.js';\r\nimport { ContextKeyExpr } from '../../../platform/contextkey/common/contextkey.js';\r\nimport { KeybindingsRegistry } from '../../../platform/keybinding/common/keybindingsRegistry.js';\r\nconst CORE_WEIGHT = 0 /* EditorCore */;\r\nexport class CoreEditorCommand extends EditorCommand {\r\n runEditorCommand(accessor, editor, args) {\r\n const viewModel = editor._getViewModel();\r\n if (!viewModel) {\r\n // the editor has no view => has no cursors\r\n return;\r\n }\r\n this.runCoreEditorCommand(viewModel, args || {});\r\n }\r\n}\r\nexport var EditorScroll_;\r\n(function (EditorScroll_) {\r\n const isEditorScrollArgs = function (arg) {\r\n if (!types.isObject(arg)) {\r\n return false;\r\n }\r\n const scrollArg = arg;\r\n if (!types.isString(scrollArg.to)) {\r\n return false;\r\n }\r\n if (!types.isUndefined(scrollArg.by) && !types.isString(scrollArg.by)) {\r\n return false;\r\n }\r\n if (!types.isUndefined(scrollArg.value) && !types.isNumber(scrollArg.value)) {\r\n return false;\r\n }\r\n if (!types.isUndefined(scrollArg.revealCursor) && !types.isBoolean(scrollArg.revealCursor)) {\r\n return false;\r\n }\r\n return true;\r\n };\r\n EditorScroll_.description = {\r\n description: 'Scroll editor in the given direction',\r\n args: [\r\n {\r\n name: 'Editor scroll argument object',\r\n description: `Property-value pairs that can be passed through this argument:\n\t\t\t\t\t* 'to': A mandatory direction value.\n\t\t\t\t\t\t\\`\\`\\`\n\t\t\t\t\t\t'up', 'down'\n\t\t\t\t\t\t\\`\\`\\`\n\t\t\t\t\t* 'by': Unit to move. Default is computed based on 'to' value.\n\t\t\t\t\t\t\\`\\`\\`\n\t\t\t\t\t\t'line', 'wrappedLine', 'page', 'halfPage'\n\t\t\t\t\t\t\\`\\`\\`\n\t\t\t\t\t* 'value': Number of units to move. Default is '1'.\n\t\t\t\t\t* 'revealCursor': If 'true' reveals the cursor if it is outside view port.\n\t\t\t\t`,\r\n constraint: isEditorScrollArgs,\r\n schema: {\r\n 'type': 'object',\r\n 'required': ['to'],\r\n 'properties': {\r\n 'to': {\r\n 'type': 'string',\r\n 'enum': ['up', 'down']\r\n },\r\n 'by': {\r\n 'type': 'string',\r\n 'enum': ['line', 'wrappedLine', 'page', 'halfPage']\r\n },\r\n 'value': {\r\n 'type': 'number',\r\n 'default': 1\r\n },\r\n 'revealCursor': {\r\n 'type': 'boolean',\r\n }\r\n }\r\n }\r\n }\r\n ]\r\n };\r\n /**\r\n * Directions in the view for editor scroll command.\r\n */\r\n EditorScroll_.RawDirection = {\r\n Up: 'up',\r\n Down: 'down',\r\n };\r\n /**\r\n * Units for editor scroll 'by' argument\r\n */\r\n EditorScroll_.RawUnit = {\r\n Line: 'line',\r\n WrappedLine: 'wrappedLine',\r\n Page: 'page',\r\n HalfPage: 'halfPage'\r\n };\r\n function parse(args) {\r\n let direction;\r\n switch (args.to) {\r\n case EditorScroll_.RawDirection.Up:\r\n direction = 1 /* Up */;\r\n break;\r\n case EditorScroll_.RawDirection.Down:\r\n direction = 2 /* Down */;\r\n break;\r\n default:\r\n // Illegal arguments\r\n return null;\r\n }\r\n let unit;\r\n switch (args.by) {\r\n case EditorScroll_.RawUnit.Line:\r\n unit = 1 /* Line */;\r\n break;\r\n case EditorScroll_.RawUnit.WrappedLine:\r\n unit = 2 /* WrappedLine */;\r\n break;\r\n case EditorScroll_.RawUnit.Page:\r\n unit = 3 /* Page */;\r\n break;\r\n case EditorScroll_.RawUnit.HalfPage:\r\n unit = 4 /* HalfPage */;\r\n break;\r\n default:\r\n unit = 2 /* WrappedLine */;\r\n }\r\n const value = Math.floor(args.value || 1);\r\n const revealCursor = !!args.revealCursor;\r\n return {\r\n direction: direction,\r\n unit: unit,\r\n value: value,\r\n revealCursor: revealCursor,\r\n select: (!!args.select)\r\n };\r\n }\r\n EditorScroll_.parse = parse;\r\n})(EditorScroll_ || (EditorScroll_ = {}));\r\nexport var RevealLine_;\r\n(function (RevealLine_) {\r\n const isRevealLineArgs = function (arg) {\r\n if (!types.isObject(arg)) {\r\n return false;\r\n }\r\n const reveaLineArg = arg;\r\n if (!types.isNumber(reveaLineArg.lineNumber) && !types.isString(reveaLineArg.lineNumber)) {\r\n return false;\r\n }\r\n if (!types.isUndefined(reveaLineArg.at) && !types.isString(reveaLineArg.at)) {\r\n return false;\r\n }\r\n return true;\r\n };\r\n RevealLine_.description = {\r\n description: 'Reveal the given line at the given logical position',\r\n args: [\r\n {\r\n name: 'Reveal line argument object',\r\n description: `Property-value pairs that can be passed through this argument:\n\t\t\t\t\t* 'lineNumber': A mandatory line number value.\n\t\t\t\t\t* 'at': Logical position at which line has to be revealed.\n\t\t\t\t\t\t\\`\\`\\`\n\t\t\t\t\t\t'top', 'center', 'bottom'\n\t\t\t\t\t\t\\`\\`\\`\n\t\t\t\t`,\r\n constraint: isRevealLineArgs,\r\n schema: {\r\n 'type': 'object',\r\n 'required': ['lineNumber'],\r\n 'properties': {\r\n 'lineNumber': {\r\n 'type': ['number', 'string'],\r\n },\r\n 'at': {\r\n 'type': 'string',\r\n 'enum': ['top', 'center', 'bottom']\r\n }\r\n }\r\n }\r\n }\r\n ]\r\n };\r\n /**\r\n * Values for reveal line 'at' argument\r\n */\r\n RevealLine_.RawAtArgument = {\r\n Top: 'top',\r\n Center: 'center',\r\n Bottom: 'bottom'\r\n };\r\n})(RevealLine_ || (RevealLine_ = {}));\r\nclass EditorOrNativeTextInputCommand {\r\n constructor(target) {\r\n // 1. handle case when focus is in editor.\r\n target.addImplementation(10000, 'code-editor', (accessor, args) => {\r\n // Only if editor text focus (i.e. not if editor has widget focus).\r\n const focusedEditor = accessor.get(ICodeEditorService).getFocusedCodeEditor();\r\n if (focusedEditor && focusedEditor.hasTextFocus()) {\r\n return this._runEditorCommand(accessor, focusedEditor, args);\r\n }\r\n return false;\r\n });\r\n // 2. handle case when focus is in some other `input` / `textarea`.\r\n target.addImplementation(1000, 'generic-dom-input-textarea', (accessor, args) => {\r\n // Only if focused on an element that allows for entering text\r\n const activeElement = document.activeElement;\r\n if (activeElement && ['input', 'textarea'].indexOf(activeElement.tagName.toLowerCase()) >= 0) {\r\n this.runDOMCommand();\r\n return true;\r\n }\r\n return false;\r\n });\r\n // 3. (default) handle case when focus is somewhere else.\r\n target.addImplementation(0, 'generic-dom', (accessor, args) => {\r\n // Redirecting to active editor\r\n const activeEditor = accessor.get(ICodeEditorService).getActiveCodeEditor();\r\n if (activeEditor) {\r\n activeEditor.focus();\r\n return this._runEditorCommand(accessor, activeEditor, args);\r\n }\r\n return false;\r\n });\r\n }\r\n _runEditorCommand(accessor, editor, args) {\r\n const result = this.runEditorCommand(accessor, editor, args);\r\n if (result) {\r\n return result;\r\n }\r\n return true;\r\n }\r\n}\r\nexport var CoreNavigationCommands;\r\n(function (CoreNavigationCommands) {\r\n class BaseMoveToCommand extends CoreEditorCommand {\r\n constructor(opts) {\r\n super(opts);\r\n this._inSelectionMode = opts.inSelectionMode;\r\n }\r\n runCoreEditorCommand(viewModel, args) {\r\n viewModel.model.pushStackElement();\r\n viewModel.setCursorStates(args.source, 3 /* Explicit */, [\r\n CursorMoveCommands.moveTo(viewModel, viewModel.getPrimaryCursorState(), this._inSelectionMode, args.position, args.viewPosition)\r\n ]);\r\n viewModel.revealPrimaryCursor(args.source, true);\r\n }\r\n }\r\n CoreNavigationCommands.MoveTo = registerEditorCommand(new BaseMoveToCommand({\r\n id: '_moveTo',\r\n inSelectionMode: false,\r\n precondition: undefined\r\n }));\r\n CoreNavigationCommands.MoveToSelect = registerEditorCommand(new BaseMoveToCommand({\r\n id: '_moveToSelect',\r\n inSelectionMode: true,\r\n precondition: undefined\r\n }));\r\n class ColumnSelectCommand extends CoreEditorCommand {\r\n runCoreEditorCommand(viewModel, args) {\r\n viewModel.model.pushStackElement();\r\n const result = this._getColumnSelectResult(viewModel, viewModel.getPrimaryCursorState(), viewModel.getCursorColumnSelectData(), args);\r\n viewModel.setCursorStates(args.source, 3 /* Explicit */, result.viewStates.map((viewState) => CursorState.fromViewState(viewState)));\r\n viewModel.setCursorColumnSelectData({\r\n isReal: true,\r\n fromViewLineNumber: result.fromLineNumber,\r\n fromViewVisualColumn: result.fromVisualColumn,\r\n toViewLineNumber: result.toLineNumber,\r\n toViewVisualColumn: result.toVisualColumn\r\n });\r\n if (result.reversed) {\r\n viewModel.revealTopMostCursor(args.source);\r\n }\r\n else {\r\n viewModel.revealBottomMostCursor(args.source);\r\n }\r\n }\r\n }\r\n CoreNavigationCommands.ColumnSelect = registerEditorCommand(new class extends ColumnSelectCommand {\r\n constructor() {\r\n super({\r\n id: 'columnSelect',\r\n precondition: undefined\r\n });\r\n }\r\n _getColumnSelectResult(viewModel, primary, prevColumnSelectData, args) {\r\n // validate `args`\r\n const validatedPosition = viewModel.model.validatePosition(args.position);\r\n const validatedViewPosition = viewModel.coordinatesConverter.validateViewPosition(new Position(args.viewPosition.lineNumber, args.viewPosition.column), validatedPosition);\r\n let fromViewLineNumber = args.doColumnSelect ? prevColumnSelectData.fromViewLineNumber : validatedViewPosition.lineNumber;\r\n let fromViewVisualColumn = args.doColumnSelect ? prevColumnSelectData.fromViewVisualColumn : args.mouseColumn - 1;\r\n return ColumnSelection.columnSelect(viewModel.cursorConfig, viewModel, fromViewLineNumber, fromViewVisualColumn, validatedViewPosition.lineNumber, args.mouseColumn - 1);\r\n }\r\n });\r\n CoreNavigationCommands.CursorColumnSelectLeft = registerEditorCommand(new class extends ColumnSelectCommand {\r\n constructor() {\r\n super({\r\n id: 'cursorColumnSelectLeft',\r\n precondition: undefined,\r\n kbOpts: {\r\n weight: CORE_WEIGHT,\r\n kbExpr: EditorContextKeys.textInputFocus,\r\n primary: 2048 /* CtrlCmd */ | 1024 /* Shift */ | 512 /* Alt */ | 15 /* LeftArrow */,\r\n linux: { primary: 0 }\r\n }\r\n });\r\n }\r\n _getColumnSelectResult(viewModel, primary, prevColumnSelectData, args) {\r\n return ColumnSelection.columnSelectLeft(viewModel.cursorConfig, viewModel, prevColumnSelectData);\r\n }\r\n });\r\n CoreNavigationCommands.CursorColumnSelectRight = registerEditorCommand(new class extends ColumnSelectCommand {\r\n constructor() {\r\n super({\r\n id: 'cursorColumnSelectRight',\r\n precondition: undefined,\r\n kbOpts: {\r\n weight: CORE_WEIGHT,\r\n kbExpr: EditorContextKeys.textInputFocus,\r\n primary: 2048 /* CtrlCmd */ | 1024 /* Shift */ | 512 /* Alt */ | 17 /* RightArrow */,\r\n linux: { primary: 0 }\r\n }\r\n });\r\n }\r\n _getColumnSelectResult(viewModel, primary, prevColumnSelectData, args) {\r\n return ColumnSelection.columnSelectRight(viewModel.cursorConfig, viewModel, prevColumnSelectData);\r\n }\r\n });\r\n class ColumnSelectUpCommand extends ColumnSelectCommand {\r\n constructor(opts) {\r\n super(opts);\r\n this._isPaged = opts.isPaged;\r\n }\r\n _getColumnSelectResult(viewModel, primary, prevColumnSelectData, args) {\r\n return ColumnSelection.columnSelectUp(viewModel.cursorConfig, viewModel, prevColumnSelectData, this._isPaged);\r\n }\r\n }\r\n CoreNavigationCommands.CursorColumnSelectUp = registerEditorCommand(new ColumnSelectUpCommand({\r\n isPaged: false,\r\n id: 'cursorColumnSelectUp',\r\n precondition: undefined,\r\n kbOpts: {\r\n weight: CORE_WEIGHT,\r\n kbExpr: EditorContextKeys.textInputFocus,\r\n primary: 2048 /* CtrlCmd */ | 1024 /* Shift */ | 512 /* Alt */ | 16 /* UpArrow */,\r\n linux: { primary: 0 }\r\n }\r\n }));\r\n CoreNavigationCommands.CursorColumnSelectPageUp = registerEditorCommand(new ColumnSelectUpCommand({\r\n isPaged: true,\r\n id: 'cursorColumnSelectPageUp',\r\n precondition: undefined,\r\n kbOpts: {\r\n weight: CORE_WEIGHT,\r\n kbExpr: EditorContextKeys.textInputFocus,\r\n primary: 2048 /* CtrlCmd */ | 1024 /* Shift */ | 512 /* Alt */ | 11 /* PageUp */,\r\n linux: { primary: 0 }\r\n }\r\n }));\r\n class ColumnSelectDownCommand extends ColumnSelectCommand {\r\n constructor(opts) {\r\n super(opts);\r\n this._isPaged = opts.isPaged;\r\n }\r\n _getColumnSelectResult(viewModel, primary, prevColumnSelectData, args) {\r\n return ColumnSelection.columnSelectDown(viewModel.cursorConfig, viewModel, prevColumnSelectData, this._isPaged);\r\n }\r\n }\r\n CoreNavigationCommands.CursorColumnSelectDown = registerEditorCommand(new ColumnSelectDownCommand({\r\n isPaged: false,\r\n id: 'cursorColumnSelectDown',\r\n precondition: undefined,\r\n kbOpts: {\r\n weight: CORE_WEIGHT,\r\n kbExpr: EditorContextKeys.textInputFocus,\r\n primary: 2048 /* CtrlCmd */ | 1024 /* Shift */ | 512 /* Alt */ | 18 /* DownArrow */,\r\n linux: { primary: 0 }\r\n }\r\n }));\r\n CoreNavigationCommands.CursorColumnSelectPageDown = registerEditorCommand(new ColumnSelectDownCommand({\r\n isPaged: true,\r\n id: 'cursorColumnSelectPageDown',\r\n precondition: undefined,\r\n kbOpts: {\r\n weight: CORE_WEIGHT,\r\n kbExpr: EditorContextKeys.textInputFocus,\r\n primary: 2048 /* CtrlCmd */ | 1024 /* Shift */ | 512 /* Alt */ | 12 /* PageDown */,\r\n linux: { primary: 0 }\r\n }\r\n }));\r\n class CursorMoveImpl extends CoreEditorCommand {\r\n constructor() {\r\n super({\r\n id: 'cursorMove',\r\n precondition: undefined,\r\n description: CursorMove_.description\r\n });\r\n }\r\n runCoreEditorCommand(viewModel, args) {\r\n const parsed = CursorMove_.parse(args);\r\n if (!parsed) {\r\n // illegal arguments\r\n return;\r\n }\r\n this._runCursorMove(viewModel, args.source, parsed);\r\n }\r\n _runCursorMove(viewModel, source, args) {\r\n viewModel.model.pushStackElement();\r\n viewModel.setCursorStates(source, 3 /* Explicit */, CursorMoveImpl._move(viewModel, viewModel.getCursorStates(), args));\r\n viewModel.revealPrimaryCursor(source, true);\r\n }\r\n static _move(viewModel, cursors, args) {\r\n const inSelectionMode = args.select;\r\n const value = args.value;\r\n switch (args.direction) {\r\n case 0 /* Left */:\r\n case 1 /* Right */:\r\n case 2 /* Up */:\r\n case 3 /* Down */:\r\n case 4 /* PrevBlankLine */:\r\n case 5 /* NextBlankLine */:\r\n case 6 /* WrappedLineStart */:\r\n case 7 /* WrappedLineFirstNonWhitespaceCharacter */:\r\n case 8 /* WrappedLineColumnCenter */:\r\n case 9 /* WrappedLineEnd */:\r\n case 10 /* WrappedLineLastNonWhitespaceCharacter */:\r\n return CursorMoveCommands.simpleMove(viewModel, cursors, args.direction, inSelectionMode, value, args.unit);\r\n case 11 /* ViewPortTop */:\r\n case 13 /* ViewPortBottom */:\r\n case 12 /* ViewPortCenter */:\r\n case 14 /* ViewPortIfOutside */:\r\n return CursorMoveCommands.viewportMove(viewModel, cursors, args.direction, inSelectionMode, value);\r\n default:\r\n return null;\r\n }\r\n }\r\n }\r\n CoreNavigationCommands.CursorMoveImpl = CursorMoveImpl;\r\n CoreNavigationCommands.CursorMove = registerEditorCommand(new CursorMoveImpl());\r\n class CursorMoveBasedCommand extends CoreEditorCommand {\r\n constructor(opts) {\r\n super(opts);\r\n this._staticArgs = opts.args;\r\n }\r\n runCoreEditorCommand(viewModel, dynamicArgs) {\r\n let args = this._staticArgs;\r\n if (this._staticArgs.value === -1 /* PAGE_SIZE_MARKER */) {\r\n // -1 is a marker for page size\r\n args = {\r\n direction: this._staticArgs.direction,\r\n unit: this._staticArgs.unit,\r\n select: this._staticArgs.select,\r\n value: viewModel.cursorConfig.pageSize\r\n };\r\n }\r\n viewModel.model.pushStackElement();\r\n viewModel.setCursorStates(dynamicArgs.source, 3 /* Explicit */, CursorMoveCommands.simpleMove(viewModel, viewModel.getCursorStates(), args.direction, args.select, args.value, args.unit));\r\n viewModel.revealPrimaryCursor(dynamicArgs.source, true);\r\n }\r\n }\r\n CoreNavigationCommands.CursorLeft = registerEditorCommand(new CursorMoveBasedCommand({\r\n args: {\r\n direction: 0 /* Left */,\r\n unit: 0 /* None */,\r\n select: false,\r\n value: 1\r\n },\r\n id: 'cursorLeft',\r\n precondition: undefined,\r\n kbOpts: {\r\n weight: CORE_WEIGHT,\r\n kbExpr: EditorContextKeys.textInputFocus,\r\n primary: 15 /* LeftArrow */,\r\n mac: { primary: 15 /* LeftArrow */, secondary: [256 /* WinCtrl */ | 32 /* KEY_B */] }\r\n }\r\n }));\r\n CoreNavigationCommands.CursorLeftSelect = registerEditorCommand(new CursorMoveBasedCommand({\r\n args: {\r\n direction: 0 /* Left */,\r\n unit: 0 /* None */,\r\n select: true,\r\n value: 1\r\n },\r\n id: 'cursorLeftSelect',\r\n precondition: undefined,\r\n kbOpts: {\r\n weight: CORE_WEIGHT,\r\n kbExpr: EditorContextKeys.textInputFocus,\r\n primary: 1024 /* Shift */ | 15 /* LeftArrow */\r\n }\r\n }));\r\n CoreNavigationCommands.CursorRight = registerEditorCommand(new CursorMoveBasedCommand({\r\n args: {\r\n direction: 1 /* Right */,\r\n unit: 0 /* None */,\r\n select: false,\r\n value: 1\r\n },\r\n id: 'cursorRight',\r\n precondition: undefined,\r\n kbOpts: {\r\n weight: CORE_WEIGHT,\r\n kbExpr: EditorContextKeys.textInputFocus,\r\n primary: 17 /* RightArrow */,\r\n mac: { primary: 17 /* RightArrow */, secondary: [256 /* WinCtrl */ | 36 /* KEY_F */] }\r\n }\r\n }));\r\n CoreNavigationCommands.CursorRightSelect = registerEditorCommand(new CursorMoveBasedCommand({\r\n args: {\r\n direction: 1 /* Right */,\r\n unit: 0 /* None */,\r\n select: true,\r\n value: 1\r\n },\r\n id: 'cursorRightSelect',\r\n precondition: undefined,\r\n kbOpts: {\r\n weight: CORE_WEIGHT,\r\n kbExpr: EditorContextKeys.textInputFocus,\r\n primary: 1024 /* Shift */ | 17 /* RightArrow */\r\n }\r\n }));\r\n CoreNavigationCommands.CursorUp = registerEditorCommand(new CursorMoveBasedCommand({\r\n args: {\r\n direction: 2 /* Up */,\r\n unit: 2 /* WrappedLine */,\r\n select: false,\r\n value: 1\r\n },\r\n id: 'cursorUp',\r\n precondition: undefined,\r\n kbOpts: {\r\n weight: CORE_WEIGHT,\r\n kbExpr: EditorContextKeys.textInputFocus,\r\n primary: 16 /* UpArrow */,\r\n mac: { primary: 16 /* UpArrow */, secondary: [256 /* WinCtrl */ | 46 /* KEY_P */] }\r\n }\r\n }));\r\n CoreNavigationCommands.CursorUpSelect = registerEditorCommand(new CursorMoveBasedCommand({\r\n args: {\r\n direction: 2 /* Up */,\r\n unit: 2 /* WrappedLine */,\r\n select: true,\r\n value: 1\r\n },\r\n id: 'cursorUpSelect',\r\n precondition: undefined,\r\n kbOpts: {\r\n weight: CORE_WEIGHT,\r\n kbExpr: EditorContextKeys.textInputFocus,\r\n primary: 1024 /* Shift */ | 16 /* UpArrow */,\r\n secondary: [2048 /* CtrlCmd */ | 1024 /* Shift */ | 16 /* UpArrow */],\r\n mac: { primary: 1024 /* Shift */ | 16 /* UpArrow */ },\r\n linux: { primary: 1024 /* Shift */ | 16 /* UpArrow */ }\r\n }\r\n }));\r\n CoreNavigationCommands.CursorPageUp = registerEditorCommand(new CursorMoveBasedCommand({\r\n args: {\r\n direction: 2 /* Up */,\r\n unit: 2 /* WrappedLine */,\r\n select: false,\r\n value: -1 /* PAGE_SIZE_MARKER */\r\n },\r\n id: 'cursorPageUp',\r\n precondition: undefined,\r\n kbOpts: {\r\n weight: CORE_WEIGHT,\r\n kbExpr: EditorContextKeys.textInputFocus,\r\n primary: 11 /* PageUp */\r\n }\r\n }));\r\n CoreNavigationCommands.CursorPageUpSelect = registerEditorCommand(new CursorMoveBasedCommand({\r\n args: {\r\n direction: 2 /* Up */,\r\n unit: 2 /* WrappedLine */,\r\n select: true,\r\n value: -1 /* PAGE_SIZE_MARKER */\r\n },\r\n id: 'cursorPageUpSelect',\r\n precondition: undefined,\r\n kbOpts: {\r\n weight: CORE_WEIGHT,\r\n kbExpr: EditorContextKeys.textInputFocus,\r\n primary: 1024 /* Shift */ | 11 /* PageUp */\r\n }\r\n }));\r\n CoreNavigationCommands.CursorDown = registerEditorCommand(new CursorMoveBasedCommand({\r\n args: {\r\n direction: 3 /* Down */,\r\n unit: 2 /* WrappedLine */,\r\n select: false,\r\n value: 1\r\n },\r\n id: 'cursorDown',\r\n precondition: undefined,\r\n kbOpts: {\r\n weight: CORE_WEIGHT,\r\n kbExpr: EditorContextKeys.textInputFocus,\r\n primary: 18 /* DownArrow */,\r\n mac: { primary: 18 /* DownArrow */, secondary: [256 /* WinCtrl */ | 44 /* KEY_N */] }\r\n }\r\n }));\r\n CoreNavigationCommands.CursorDownSelect = registerEditorCommand(new CursorMoveBasedCommand({\r\n args: {\r\n direction: 3 /* Down */,\r\n unit: 2 /* WrappedLine */,\r\n select: true,\r\n value: 1\r\n },\r\n id: 'cursorDownSelect',\r\n precondition: undefined,\r\n kbOpts: {\r\n weight: CORE_WEIGHT,\r\n kbExpr: EditorContextKeys.textInputFocus,\r\n primary: 1024 /* Shift */ | 18 /* DownArrow */,\r\n secondary: [2048 /* CtrlCmd */ | 1024 /* Shift */ | 18 /* DownArrow */],\r\n mac: { primary: 1024 /* Shift */ | 18 /* DownArrow */ },\r\n linux: { primary: 1024 /* Shift */ | 18 /* DownArrow */ }\r\n }\r\n }));\r\n CoreNavigationCommands.CursorPageDown = registerEditorCommand(new CursorMoveBasedCommand({\r\n args: {\r\n direction: 3 /* Down */,\r\n unit: 2 /* WrappedLine */,\r\n select: false,\r\n value: -1 /* PAGE_SIZE_MARKER */\r\n },\r\n id: 'cursorPageDown',\r\n precondition: undefined,\r\n kbOpts: {\r\n weight: CORE_WEIGHT,\r\n kbExpr: EditorContextKeys.textInputFocus,\r\n primary: 12 /* PageDown */\r\n }\r\n }));\r\n CoreNavigationCommands.CursorPageDownSelect = registerEditorCommand(new CursorMoveBasedCommand({\r\n args: {\r\n direction: 3 /* Down */,\r\n unit: 2 /* WrappedLine */,\r\n select: true,\r\n value: -1 /* PAGE_SIZE_MARKER */\r\n },\r\n id: 'cursorPageDownSelect',\r\n precondition: undefined,\r\n kbOpts: {\r\n weight: CORE_WEIGHT,\r\n kbExpr: EditorContextKeys.textInputFocus,\r\n primary: 1024 /* Shift */ | 12 /* PageDown */\r\n }\r\n }));\r\n CoreNavigationCommands.CreateCursor = registerEditorCommand(new class extends CoreEditorCommand {\r\n constructor() {\r\n super({\r\n id: 'createCursor',\r\n precondition: undefined\r\n });\r\n }\r\n runCoreEditorCommand(viewModel, args) {\r\n let newState;\r\n if (args.wholeLine) {\r\n newState = CursorMoveCommands.line(viewModel, viewModel.getPrimaryCursorState(), false, args.position, args.viewPosition);\r\n }\r\n else {\r\n newState = CursorMoveCommands.moveTo(viewModel, viewModel.getPrimaryCursorState(), false, args.position, args.viewPosition);\r\n }\r\n const states = viewModel.getCursorStates();\r\n // Check if we should remove a cursor (sort of like a toggle)\r\n if (states.length > 1) {\r\n const newModelPosition = (newState.modelState ? newState.modelState.position : null);\r\n const newViewPosition = (newState.viewState ? newState.viewState.position : null);\r\n for (let i = 0, len = states.length; i < len; i++) {\r\n const state = states[i];\r\n if (newModelPosition && !state.modelState.selection.containsPosition(newModelPosition)) {\r\n continue;\r\n }\r\n if (newViewPosition && !state.viewState.selection.containsPosition(newViewPosition)) {\r\n continue;\r\n }\r\n // => Remove the cursor\r\n states.splice(i, 1);\r\n viewModel.model.pushStackElement();\r\n viewModel.setCursorStates(args.source, 3 /* Explicit */, states);\r\n return;\r\n }\r\n }\r\n // => Add the new cursor\r\n states.push(newState);\r\n viewModel.model.pushStackElement();\r\n viewModel.setCursorStates(args.source, 3 /* Explicit */, states);\r\n }\r\n });\r\n CoreNavigationCommands.LastCursorMoveToSelect = registerEditorCommand(new class extends CoreEditorCommand {\r\n constructor() {\r\n super({\r\n id: '_lastCursorMoveToSelect',\r\n precondition: undefined\r\n });\r\n }\r\n runCoreEditorCommand(viewModel, args) {\r\n const lastAddedCursorIndex = viewModel.getLastAddedCursorIndex();\r\n const states = viewModel.getCursorStates();\r\n const newStates = states.slice(0);\r\n newStates[lastAddedCursorIndex] = CursorMoveCommands.moveTo(viewModel, states[lastAddedCursorIndex], true, args.position, args.viewPosition);\r\n viewModel.model.pushStackElement();\r\n viewModel.setCursorStates(args.source, 3 /* Explicit */, newStates);\r\n }\r\n });\r\n class HomeCommand extends CoreEditorCommand {\r\n constructor(opts) {\r\n super(opts);\r\n this._inSelectionMode = opts.inSelectionMode;\r\n }\r\n runCoreEditorCommand(viewModel, args) {\r\n viewModel.model.pushStackElement();\r\n viewModel.setCursorStates(args.source, 3 /* Explicit */, CursorMoveCommands.moveToBeginningOfLine(viewModel, viewModel.getCursorStates(), this._inSelectionMode));\r\n viewModel.revealPrimaryCursor(args.source, true);\r\n }\r\n }\r\n CoreNavigationCommands.CursorHome = registerEditorCommand(new HomeCommand({\r\n inSelectionMode: false,\r\n id: 'cursorHome',\r\n precondition: undefined,\r\n kbOpts: {\r\n weight: CORE_WEIGHT,\r\n kbExpr: EditorContextKeys.textInputFocus,\r\n primary: 14 /* Home */,\r\n mac: { primary: 14 /* Home */, secondary: [2048 /* CtrlCmd */ | 15 /* LeftArrow */] }\r\n }\r\n }));\r\n CoreNavigationCommands.CursorHomeSelect = registerEditorCommand(new HomeCommand({\r\n inSelectionMode: true,\r\n id: 'cursorHomeSelect',\r\n precondition: undefined,\r\n kbOpts: {\r\n weight: CORE_WEIGHT,\r\n kbExpr: EditorContextKeys.textInputFocus,\r\n primary: 1024 /* Shift */ | 14 /* Home */,\r\n mac: { primary: 1024 /* Shift */ | 14 /* Home */, secondary: [2048 /* CtrlCmd */ | 1024 /* Shift */ | 15 /* LeftArrow */] }\r\n }\r\n }));\r\n class LineStartCommand extends CoreEditorCommand {\r\n constructor(opts) {\r\n super(opts);\r\n this._inSelectionMode = opts.inSelectionMode;\r\n }\r\n runCoreEditorCommand(viewModel, args) {\r\n viewModel.model.pushStackElement();\r\n viewModel.setCursorStates(args.source, 3 /* Explicit */, this._exec(viewModel.getCursorStates()));\r\n viewModel.revealPrimaryCursor(args.source, true);\r\n }\r\n _exec(cursors) {\r\n const result = [];\r\n for (let i = 0, len = cursors.length; i < len; i++) {\r\n const cursor = cursors[i];\r\n const lineNumber = cursor.modelState.position.lineNumber;\r\n result[i] = CursorState.fromModelState(cursor.modelState.move(this._inSelectionMode, lineNumber, 1, 0));\r\n }\r\n return result;\r\n }\r\n }\r\n CoreNavigationCommands.CursorLineStart = registerEditorCommand(new LineStartCommand({\r\n inSelectionMode: false,\r\n id: 'cursorLineStart',\r\n precondition: undefined,\r\n kbOpts: {\r\n weight: CORE_WEIGHT,\r\n kbExpr: EditorContextKeys.textInputFocus,\r\n primary: 0,\r\n mac: { primary: 256 /* WinCtrl */ | 31 /* KEY_A */ }\r\n }\r\n }));\r\n CoreNavigationCommands.CursorLineStartSelect = registerEditorCommand(new LineStartCommand({\r\n inSelectionMode: true,\r\n id: 'cursorLineStartSelect',\r\n precondition: undefined,\r\n kbOpts: {\r\n weight: CORE_WEIGHT,\r\n kbExpr: EditorContextKeys.textInputFocus,\r\n primary: 0,\r\n mac: { primary: 256 /* WinCtrl */ | 1024 /* Shift */ | 31 /* KEY_A */ }\r\n }\r\n }));\r\n class EndCommand extends CoreEditorCommand {\r\n constructor(opts) {\r\n super(opts);\r\n this._inSelectionMode = opts.inSelectionMode;\r\n }\r\n runCoreEditorCommand(viewModel, args) {\r\n viewModel.model.pushStackElement();\r\n viewModel.setCursorStates(args.source, 3 /* Explicit */, CursorMoveCommands.moveToEndOfLine(viewModel, viewModel.getCursorStates(), this._inSelectionMode, args.sticky || false));\r\n viewModel.revealPrimaryCursor(args.source, true);\r\n }\r\n }\r\n CoreNavigationCommands.CursorEnd = registerEditorCommand(new EndCommand({\r\n inSelectionMode: false,\r\n id: 'cursorEnd',\r\n precondition: undefined,\r\n kbOpts: {\r\n args: { sticky: false },\r\n weight: CORE_WEIGHT,\r\n kbExpr: EditorContextKeys.textInputFocus,\r\n primary: 13 /* End */,\r\n mac: { primary: 13 /* End */, secondary: [2048 /* CtrlCmd */ | 17 /* RightArrow */] }\r\n },\r\n description: {\r\n description: `Go to End`,\r\n args: [{\r\n name: 'args',\r\n schema: {\r\n type: 'object',\r\n properties: {\r\n 'sticky': {\r\n description: nls.localize('stickydesc', \"Stick to the end even when going to longer lines\"),\r\n type: 'boolean',\r\n default: false\r\n }\r\n }\r\n }\r\n }]\r\n }\r\n }));\r\n CoreNavigationCommands.CursorEndSelect = registerEditorCommand(new EndCommand({\r\n inSelectionMode: true,\r\n id: 'cursorEndSelect',\r\n precondition: undefined,\r\n kbOpts: {\r\n args: { sticky: false },\r\n weight: CORE_WEIGHT,\r\n kbExpr: EditorContextKeys.textInputFocus,\r\n primary: 1024 /* Shift */ | 13 /* End */,\r\n mac: { primary: 1024 /* Shift */ | 13 /* End */, secondary: [2048 /* CtrlCmd */ | 1024 /* Shift */ | 17 /* RightArrow */] }\r\n },\r\n description: {\r\n description: `Select to End`,\r\n args: [{\r\n name: 'args',\r\n schema: {\r\n type: 'object',\r\n properties: {\r\n 'sticky': {\r\n description: nls.localize('stickydesc', \"Stick to the end even when going to longer lines\"),\r\n type: 'boolean',\r\n default: false\r\n }\r\n }\r\n }\r\n }]\r\n }\r\n }));\r\n class LineEndCommand extends CoreEditorCommand {\r\n constructor(opts) {\r\n super(opts);\r\n this._inSelectionMode = opts.inSelectionMode;\r\n }\r\n runCoreEditorCommand(viewModel, args) {\r\n viewModel.model.pushStackElement();\r\n viewModel.setCursorStates(args.source, 3 /* Explicit */, this._exec(viewModel, viewModel.getCursorStates()));\r\n viewModel.revealPrimaryCursor(args.source, true);\r\n }\r\n _exec(viewModel, cursors) {\r\n const result = [];\r\n for (let i = 0, len = cursors.length; i < len; i++) {\r\n const cursor = cursors[i];\r\n const lineNumber = cursor.modelState.position.lineNumber;\r\n const maxColumn = viewModel.model.getLineMaxColumn(lineNumber);\r\n result[i] = CursorState.fromModelState(cursor.modelState.move(this._inSelectionMode, lineNumber, maxColumn, 0));\r\n }\r\n return result;\r\n }\r\n }\r\n CoreNavigationCommands.CursorLineEnd = registerEditorCommand(new LineEndCommand({\r\n inSelectionMode: false,\r\n id: 'cursorLineEnd',\r\n precondition: undefined,\r\n kbOpts: {\r\n weight: CORE_WEIGHT,\r\n kbExpr: EditorContextKeys.textInputFocus,\r\n primary: 0,\r\n mac: { primary: 256 /* WinCtrl */ | 35 /* KEY_E */ }\r\n }\r\n }));\r\n CoreNavigationCommands.CursorLineEndSelect = registerEditorCommand(new LineEndCommand({\r\n inSelectionMode: true,\r\n id: 'cursorLineEndSelect',\r\n precondition: undefined,\r\n kbOpts: {\r\n weight: CORE_WEIGHT,\r\n kbExpr: EditorContextKeys.textInputFocus,\r\n primary: 0,\r\n mac: { primary: 256 /* WinCtrl */ | 1024 /* Shift */ | 35 /* KEY_E */ }\r\n }\r\n }));\r\n class TopCommand extends CoreEditorCommand {\r\n constructor(opts) {\r\n super(opts);\r\n this._inSelectionMode = opts.inSelectionMode;\r\n }\r\n runCoreEditorCommand(viewModel, args) {\r\n viewModel.model.pushStackElement();\r\n viewModel.setCursorStates(args.source, 3 /* Explicit */, CursorMoveCommands.moveToBeginningOfBuffer(viewModel, viewModel.getCursorStates(), this._inSelectionMode));\r\n viewModel.revealPrimaryCursor(args.source, true);\r\n }\r\n }\r\n CoreNavigationCommands.CursorTop = registerEditorCommand(new TopCommand({\r\n inSelectionMode: false,\r\n id: 'cursorTop',\r\n precondition: undefined,\r\n kbOpts: {\r\n weight: CORE_WEIGHT,\r\n kbExpr: EditorContextKeys.textInputFocus,\r\n primary: 2048 /* CtrlCmd */ | 14 /* Home */,\r\n mac: { primary: 2048 /* CtrlCmd */ | 16 /* UpArrow */ }\r\n }\r\n }));\r\n CoreNavigationCommands.CursorTopSelect = registerEditorCommand(new TopCommand({\r\n inSelectionMode: true,\r\n id: 'cursorTopSelect',\r\n precondition: undefined,\r\n kbOpts: {\r\n weight: CORE_WEIGHT,\r\n kbExpr: EditorContextKeys.textInputFocus,\r\n primary: 2048 /* CtrlCmd */ | 1024 /* Shift */ | 14 /* Home */,\r\n mac: { primary: 2048 /* CtrlCmd */ | 1024 /* Shift */ | 16 /* UpArrow */ }\r\n }\r\n }));\r\n class BottomCommand extends CoreEditorCommand {\r\n constructor(opts) {\r\n super(opts);\r\n this._inSelectionMode = opts.inSelectionMode;\r\n }\r\n runCoreEditorCommand(viewModel, args) {\r\n viewModel.model.pushStackElement();\r\n viewModel.setCursorStates(args.source, 3 /* Explicit */, CursorMoveCommands.moveToEndOfBuffer(viewModel, viewModel.getCursorStates(), this._inSelectionMode));\r\n viewModel.revealPrimaryCursor(args.source, true);\r\n }\r\n }\r\n CoreNavigationCommands.CursorBottom = registerEditorCommand(new BottomCommand({\r\n inSelectionMode: false,\r\n id: 'cursorBottom',\r\n precondition: undefined,\r\n kbOpts: {\r\n weight: CORE_WEIGHT,\r\n kbExpr: EditorContextKeys.textInputFocus,\r\n primary: 2048 /* CtrlCmd */ | 13 /* End */,\r\n mac: { primary: 2048 /* CtrlCmd */ | 18 /* DownArrow */ }\r\n }\r\n }));\r\n CoreNavigationCommands.CursorBottomSelect = registerEditorCommand(new BottomCommand({\r\n inSelectionMode: true,\r\n id: 'cursorBottomSelect',\r\n precondition: undefined,\r\n kbOpts: {\r\n weight: CORE_WEIGHT,\r\n kbExpr: EditorContextKeys.textInputFocus,\r\n primary: 2048 /* CtrlCmd */ | 1024 /* Shift */ | 13 /* End */,\r\n mac: { primary: 2048 /* CtrlCmd */ | 1024 /* Shift */ | 18 /* DownArrow */ }\r\n }\r\n }));\r\n class EditorScrollImpl extends CoreEditorCommand {\r\n constructor() {\r\n super({\r\n id: 'editorScroll',\r\n precondition: undefined,\r\n description: EditorScroll_.description\r\n });\r\n }\r\n runCoreEditorCommand(viewModel, args) {\r\n const parsed = EditorScroll_.parse(args);\r\n if (!parsed) {\r\n // illegal arguments\r\n return;\r\n }\r\n this._runEditorScroll(viewModel, args.source, parsed);\r\n }\r\n _runEditorScroll(viewModel, source, args) {\r\n const desiredScrollTop = this._computeDesiredScrollTop(viewModel, args);\r\n if (args.revealCursor) {\r\n // must ensure cursor is in new visible range\r\n const desiredVisibleViewRange = viewModel.getCompletelyVisibleViewRangeAtScrollTop(desiredScrollTop);\r\n viewModel.setCursorStates(source, 3 /* Explicit */, [\r\n CursorMoveCommands.findPositionInViewportIfOutside(viewModel, viewModel.getPrimaryCursorState(), desiredVisibleViewRange, args.select)\r\n ]);\r\n }\r\n viewModel.setScrollTop(desiredScrollTop, 0 /* Smooth */);\r\n }\r\n _computeDesiredScrollTop(viewModel, args) {\r\n if (args.unit === 1 /* Line */) {\r\n // scrolling by model lines\r\n const visibleViewRange = viewModel.getCompletelyVisibleViewRange();\r\n const visibleModelRange = viewModel.coordinatesConverter.convertViewRangeToModelRange(visibleViewRange);\r\n let desiredTopModelLineNumber;\r\n if (args.direction === 1 /* Up */) {\r\n // must go x model lines up\r\n desiredTopModelLineNumber = Math.max(1, visibleModelRange.startLineNumber - args.value);\r\n }\r\n else {\r\n // must go x model lines down\r\n desiredTopModelLineNumber = Math.min(viewModel.model.getLineCount(), visibleModelRange.startLineNumber + args.value);\r\n }\r\n const viewPosition = viewModel.coordinatesConverter.convertModelPositionToViewPosition(new Position(desiredTopModelLineNumber, 1));\r\n return viewModel.getVerticalOffsetForLineNumber(viewPosition.lineNumber);\r\n }\r\n let noOfLines;\r\n if (args.unit === 3 /* Page */) {\r\n noOfLines = viewModel.cursorConfig.pageSize * args.value;\r\n }\r\n else if (args.unit === 4 /* HalfPage */) {\r\n noOfLines = Math.round(viewModel.cursorConfig.pageSize / 2) * args.value;\r\n }\r\n else {\r\n noOfLines = args.value;\r\n }\r\n const deltaLines = (args.direction === 1 /* Up */ ? -1 : 1) * noOfLines;\r\n return viewModel.getScrollTop() + deltaLines * viewModel.cursorConfig.lineHeight;\r\n }\r\n }\r\n CoreNavigationCommands.EditorScrollImpl = EditorScrollImpl;\r\n CoreNavigationCommands.EditorScroll = registerEditorCommand(new EditorScrollImpl());\r\n CoreNavigationCommands.ScrollLineUp = registerEditorCommand(new class extends CoreEditorCommand {\r\n constructor() {\r\n super({\r\n id: 'scrollLineUp',\r\n precondition: undefined,\r\n kbOpts: {\r\n weight: CORE_WEIGHT,\r\n kbExpr: EditorContextKeys.textInputFocus,\r\n primary: 2048 /* CtrlCmd */ | 16 /* UpArrow */,\r\n mac: { primary: 256 /* WinCtrl */ | 11 /* PageUp */ }\r\n }\r\n });\r\n }\r\n runCoreEditorCommand(viewModel, args) {\r\n CoreNavigationCommands.EditorScroll._runEditorScroll(viewModel, args.source, {\r\n direction: 1 /* Up */,\r\n unit: 2 /* WrappedLine */,\r\n value: 1,\r\n revealCursor: false,\r\n select: false\r\n });\r\n }\r\n });\r\n CoreNavigationCommands.ScrollPageUp = registerEditorCommand(new class extends CoreEditorCommand {\r\n constructor() {\r\n super({\r\n id: 'scrollPageUp',\r\n precondition: undefined,\r\n kbOpts: {\r\n weight: CORE_WEIGHT,\r\n kbExpr: EditorContextKeys.textInputFocus,\r\n primary: 2048 /* CtrlCmd */ | 11 /* PageUp */,\r\n win: { primary: 512 /* Alt */ | 11 /* PageUp */ },\r\n linux: { primary: 512 /* Alt */ | 11 /* PageUp */ }\r\n }\r\n });\r\n }\r\n runCoreEditorCommand(viewModel, args) {\r\n CoreNavigationCommands.EditorScroll._runEditorScroll(viewModel, args.source, {\r\n direction: 1 /* Up */,\r\n unit: 3 /* Page */,\r\n value: 1,\r\n revealCursor: false,\r\n select: false\r\n });\r\n }\r\n });\r\n CoreNavigationCommands.ScrollLineDown = registerEditorCommand(new class extends CoreEditorCommand {\r\n constructor() {\r\n super({\r\n id: 'scrollLineDown',\r\n precondition: undefined,\r\n kbOpts: {\r\n weight: CORE_WEIGHT,\r\n kbExpr: EditorContextKeys.textInputFocus,\r\n primary: 2048 /* CtrlCmd */ | 18 /* DownArrow */,\r\n mac: { primary: 256 /* WinCtrl */ | 12 /* PageDown */ }\r\n }\r\n });\r\n }\r\n runCoreEditorCommand(viewModel, args) {\r\n CoreNavigationCommands.EditorScroll._runEditorScroll(viewModel, args.source, {\r\n direction: 2 /* Down */,\r\n unit: 2 /* WrappedLine */,\r\n value: 1,\r\n revealCursor: false,\r\n select: false\r\n });\r\n }\r\n });\r\n CoreNavigationCommands.ScrollPageDown = registerEditorCommand(new class extends CoreEditorCommand {\r\n constructor() {\r\n super({\r\n id: 'scrollPageDown',\r\n precondition: undefined,\r\n kbOpts: {\r\n weight: CORE_WEIGHT,\r\n kbExpr: EditorContextKeys.textInputFocus,\r\n primary: 2048 /* CtrlCmd */ | 12 /* PageDown */,\r\n win: { primary: 512 /* Alt */ | 12 /* PageDown */ },\r\n linux: { primary: 512 /* Alt */ | 12 /* PageDown */ }\r\n }\r\n });\r\n }\r\n runCoreEditorCommand(viewModel, args) {\r\n CoreNavigationCommands.EditorScroll._runEditorScroll(viewModel, args.source, {\r\n direction: 2 /* Down */,\r\n unit: 3 /* Page */,\r\n value: 1,\r\n revealCursor: false,\r\n select: false\r\n });\r\n }\r\n });\r\n class WordCommand extends CoreEditorCommand {\r\n constructor(opts) {\r\n super(opts);\r\n this._inSelectionMode = opts.inSelectionMode;\r\n }\r\n runCoreEditorCommand(viewModel, args) {\r\n viewModel.model.pushStackElement();\r\n viewModel.setCursorStates(args.source, 3 /* Explicit */, [\r\n CursorMoveCommands.word(viewModel, viewModel.getPrimaryCursorState(), this._inSelectionMode, args.position)\r\n ]);\r\n viewModel.revealPrimaryCursor(args.source, true);\r\n }\r\n }\r\n CoreNavigationCommands.WordSelect = registerEditorCommand(new WordCommand({\r\n inSelectionMode: false,\r\n id: '_wordSelect',\r\n precondition: undefined\r\n }));\r\n CoreNavigationCommands.WordSelectDrag = registerEditorCommand(new WordCommand({\r\n inSelectionMode: true,\r\n id: '_wordSelectDrag',\r\n precondition: undefined\r\n }));\r\n CoreNavigationCommands.LastCursorWordSelect = registerEditorCommand(new class extends CoreEditorCommand {\r\n constructor() {\r\n super({\r\n id: 'lastCursorWordSelect',\r\n precondition: undefined\r\n });\r\n }\r\n runCoreEditorCommand(viewModel, args) {\r\n const lastAddedCursorIndex = viewModel.getLastAddedCursorIndex();\r\n const states = viewModel.getCursorStates();\r\n const newStates = states.slice(0);\r\n const lastAddedState = states[lastAddedCursorIndex];\r\n newStates[lastAddedCursorIndex] = CursorMoveCommands.word(viewModel, lastAddedState, lastAddedState.modelState.hasSelection(), args.position);\r\n viewModel.model.pushStackElement();\r\n viewModel.setCursorStates(args.source, 3 /* Explicit */, newStates);\r\n }\r\n });\r\n class LineCommand extends CoreEditorCommand {\r\n constructor(opts) {\r\n super(opts);\r\n this._inSelectionMode = opts.inSelectionMode;\r\n }\r\n runCoreEditorCommand(viewModel, args) {\r\n viewModel.model.pushStackElement();\r\n viewModel.setCursorStates(args.source, 3 /* Explicit */, [\r\n CursorMoveCommands.line(viewModel, viewModel.getPrimaryCursorState(), this._inSelectionMode, args.position, args.viewPosition)\r\n ]);\r\n viewModel.revealPrimaryCursor(args.source, false);\r\n }\r\n }\r\n CoreNavigationCommands.LineSelect = registerEditorCommand(new LineCommand({\r\n inSelectionMode: false,\r\n id: '_lineSelect',\r\n precondition: undefined\r\n }));\r\n CoreNavigationCommands.LineSelectDrag = registerEditorCommand(new LineCommand({\r\n inSelectionMode: true,\r\n id: '_lineSelectDrag',\r\n precondition: undefined\r\n }));\r\n class LastCursorLineCommand extends CoreEditorCommand {\r\n constructor(opts) {\r\n super(opts);\r\n this._inSelectionMode = opts.inSelectionMode;\r\n }\r\n runCoreEditorCommand(viewModel, args) {\r\n const lastAddedCursorIndex = viewModel.getLastAddedCursorIndex();\r\n const states = viewModel.getCursorStates();\r\n const newStates = states.slice(0);\r\n newStates[lastAddedCursorIndex] = CursorMoveCommands.line(viewModel, states[lastAddedCursorIndex], this._inSelectionMode, args.position, args.viewPosition);\r\n viewModel.model.pushStackElement();\r\n viewModel.setCursorStates(args.source, 3 /* Explicit */, newStates);\r\n }\r\n }\r\n CoreNavigationCommands.LastCursorLineSelect = registerEditorCommand(new LastCursorLineCommand({\r\n inSelectionMode: false,\r\n id: 'lastCursorLineSelect',\r\n precondition: undefined\r\n }));\r\n CoreNavigationCommands.LastCursorLineSelectDrag = registerEditorCommand(new LastCursorLineCommand({\r\n inSelectionMode: true,\r\n id: 'lastCursorLineSelectDrag',\r\n precondition: undefined\r\n }));\r\n CoreNavigationCommands.ExpandLineSelection = registerEditorCommand(new class extends CoreEditorCommand {\r\n constructor() {\r\n super({\r\n id: 'expandLineSelection',\r\n precondition: undefined,\r\n kbOpts: {\r\n weight: CORE_WEIGHT,\r\n kbExpr: EditorContextKeys.textInputFocus,\r\n primary: 2048 /* CtrlCmd */ | 42 /* KEY_L */\r\n }\r\n });\r\n }\r\n runCoreEditorCommand(viewModel, args) {\r\n viewModel.model.pushStackElement();\r\n viewModel.setCursorStates(args.source, 3 /* Explicit */, CursorMoveCommands.expandLineSelection(viewModel, viewModel.getCursorStates()));\r\n viewModel.revealPrimaryCursor(args.source, true);\r\n }\r\n });\r\n CoreNavigationCommands.CancelSelection = registerEditorCommand(new class extends CoreEditorCommand {\r\n constructor() {\r\n super({\r\n id: 'cancelSelection',\r\n precondition: EditorContextKeys.hasNonEmptySelection,\r\n kbOpts: {\r\n weight: CORE_WEIGHT,\r\n kbExpr: EditorContextKeys.textInputFocus,\r\n primary: 9 /* Escape */,\r\n secondary: [1024 /* Shift */ | 9 /* Escape */]\r\n }\r\n });\r\n }\r\n runCoreEditorCommand(viewModel, args) {\r\n viewModel.model.pushStackElement();\r\n viewModel.setCursorStates(args.source, 3 /* Explicit */, [\r\n CursorMoveCommands.cancelSelection(viewModel, viewModel.getPrimaryCursorState())\r\n ]);\r\n viewModel.revealPrimaryCursor(args.source, true);\r\n }\r\n });\r\n CoreNavigationCommands.RemoveSecondaryCursors = registerEditorCommand(new class extends CoreEditorCommand {\r\n constructor() {\r\n super({\r\n id: 'removeSecondaryCursors',\r\n precondition: EditorContextKeys.hasMultipleSelections,\r\n kbOpts: {\r\n weight: CORE_WEIGHT + 1,\r\n kbExpr: EditorContextKeys.textInputFocus,\r\n primary: 9 /* Escape */,\r\n secondary: [1024 /* Shift */ | 9 /* Escape */]\r\n }\r\n });\r\n }\r\n runCoreEditorCommand(viewModel, args) {\r\n viewModel.model.pushStackElement();\r\n viewModel.setCursorStates(args.source, 3 /* Explicit */, [\r\n viewModel.getPrimaryCursorState()\r\n ]);\r\n viewModel.revealPrimaryCursor(args.source, true);\r\n status(nls.localize('removedCursor', \"Removed secondary cursors\"));\r\n }\r\n });\r\n CoreNavigationCommands.RevealLine = registerEditorCommand(new class extends CoreEditorCommand {\r\n constructor() {\r\n super({\r\n id: 'revealLine',\r\n precondition: undefined,\r\n description: RevealLine_.description\r\n });\r\n }\r\n runCoreEditorCommand(viewModel, args) {\r\n const revealLineArg = args;\r\n const lineNumberArg = revealLineArg.lineNumber || 0;\r\n let lineNumber = typeof lineNumberArg === 'number' ? (lineNumberArg + 1) : (parseInt(lineNumberArg) + 1);\r\n if (lineNumber < 1) {\r\n lineNumber = 1;\r\n }\r\n const lineCount = viewModel.model.getLineCount();\r\n if (lineNumber > lineCount) {\r\n lineNumber = lineCount;\r\n }\r\n const range = new Range(lineNumber, 1, lineNumber, viewModel.model.getLineMaxColumn(lineNumber));\r\n let revealAt = 0 /* Simple */;\r\n if (revealLineArg.at) {\r\n switch (revealLineArg.at) {\r\n case RevealLine_.RawAtArgument.Top:\r\n revealAt = 3 /* Top */;\r\n break;\r\n case RevealLine_.RawAtArgument.Center:\r\n revealAt = 1 /* Center */;\r\n break;\r\n case RevealLine_.RawAtArgument.Bottom:\r\n revealAt = 4 /* Bottom */;\r\n break;\r\n default:\r\n break;\r\n }\r\n }\r\n const viewRange = viewModel.coordinatesConverter.convertModelRangeToViewRange(range);\r\n viewModel.revealRange(args.source, false, viewRange, revealAt, 0 /* Smooth */);\r\n }\r\n });\r\n CoreNavigationCommands.SelectAll = new class extends EditorOrNativeTextInputCommand {\r\n constructor() {\r\n super(SelectAllCommand);\r\n }\r\n runDOMCommand() {\r\n if (isFirefox) {\r\n document.activeElement.focus();\r\n document.activeElement.select();\r\n }\r\n document.execCommand('selectAll');\r\n }\r\n runEditorCommand(accessor, editor, args) {\r\n const viewModel = editor._getViewModel();\r\n if (!viewModel) {\r\n // the editor has no view => has no cursors\r\n return;\r\n }\r\n this.runCoreEditorCommand(viewModel, args);\r\n }\r\n runCoreEditorCommand(viewModel, args) {\r\n viewModel.model.pushStackElement();\r\n viewModel.setCursorStates('keyboard', 3 /* Explicit */, [\r\n CursorMoveCommands.selectAll(viewModel, viewModel.getPrimaryCursorState())\r\n ]);\r\n }\r\n }();\r\n CoreNavigationCommands.SetSelection = registerEditorCommand(new class extends CoreEditorCommand {\r\n constructor() {\r\n super({\r\n id: 'setSelection',\r\n precondition: undefined\r\n });\r\n }\r\n runCoreEditorCommand(viewModel, args) {\r\n viewModel.model.pushStackElement();\r\n viewModel.setCursorStates(args.source, 3 /* Explicit */, [\r\n CursorState.fromModelSelection(args.selection)\r\n ]);\r\n }\r\n });\r\n})(CoreNavigationCommands || (CoreNavigationCommands = {}));\r\nconst columnSelectionCondition = ContextKeyExpr.and(EditorContextKeys.textInputFocus, EditorContextKeys.columnSelection);\r\nfunction registerColumnSelection(id, keybinding) {\r\n KeybindingsRegistry.registerKeybindingRule({\r\n id: id,\r\n primary: keybinding,\r\n when: columnSelectionCondition,\r\n weight: CORE_WEIGHT + 1\r\n });\r\n}\r\nregisterColumnSelection(CoreNavigationCommands.CursorColumnSelectLeft.id, 1024 /* Shift */ | 15 /* LeftArrow */);\r\nregisterColumnSelection(CoreNavigationCommands.CursorColumnSelectRight.id, 1024 /* Shift */ | 17 /* RightArrow */);\r\nregisterColumnSelection(CoreNavigationCommands.CursorColumnSelectUp.id, 1024 /* Shift */ | 16 /* UpArrow */);\r\nregisterColumnSelection(CoreNavigationCommands.CursorColumnSelectPageUp.id, 1024 /* Shift */ | 11 /* PageUp */);\r\nregisterColumnSelection(CoreNavigationCommands.CursorColumnSelectDown.id, 1024 /* Shift */ | 18 /* DownArrow */);\r\nregisterColumnSelection(CoreNavigationCommands.CursorColumnSelectPageDown.id, 1024 /* Shift */ | 12 /* PageDown */);\r\nfunction registerCommand(command) {\r\n command.register();\r\n return command;\r\n}\r\nexport var CoreEditingCommands;\r\n(function (CoreEditingCommands) {\r\n class CoreEditingCommand extends EditorCommand {\r\n runEditorCommand(accessor, editor, args) {\r\n const viewModel = editor._getViewModel();\r\n if (!viewModel) {\r\n // the editor has no view => has no cursors\r\n return;\r\n }\r\n this.runCoreEditingCommand(editor, viewModel, args || {});\r\n }\r\n }\r\n CoreEditingCommands.CoreEditingCommand = CoreEditingCommand;\r\n CoreEditingCommands.LineBreakInsert = registerEditorCommand(new class extends CoreEditingCommand {\r\n constructor() {\r\n super({\r\n id: 'lineBreakInsert',\r\n precondition: EditorContextKeys.writable,\r\n kbOpts: {\r\n weight: CORE_WEIGHT,\r\n kbExpr: EditorContextKeys.textInputFocus,\r\n primary: 0,\r\n mac: { primary: 256 /* WinCtrl */ | 45 /* KEY_O */ }\r\n }\r\n });\r\n }\r\n runCoreEditingCommand(editor, viewModel, args) {\r\n editor.pushUndoStop();\r\n editor.executeCommands(this.id, TypeOperations.lineBreakInsert(viewModel.cursorConfig, viewModel.model, viewModel.getCursorStates().map(s => s.modelState.selection)));\r\n }\r\n });\r\n CoreEditingCommands.Outdent = registerEditorCommand(new class extends CoreEditingCommand {\r\n constructor() {\r\n super({\r\n id: 'outdent',\r\n precondition: EditorContextKeys.writable,\r\n kbOpts: {\r\n weight: CORE_WEIGHT,\r\n kbExpr: ContextKeyExpr.and(EditorContextKeys.editorTextFocus, EditorContextKeys.tabDoesNotMoveFocus),\r\n primary: 1024 /* Shift */ | 2 /* Tab */\r\n }\r\n });\r\n }\r\n runCoreEditingCommand(editor, viewModel, args) {\r\n editor.pushUndoStop();\r\n editor.executeCommands(this.id, TypeOperations.outdent(viewModel.cursorConfig, viewModel.model, viewModel.getCursorStates().map(s => s.modelState.selection)));\r\n editor.pushUndoStop();\r\n }\r\n });\r\n CoreEditingCommands.Tab = registerEditorCommand(new class extends CoreEditingCommand {\r\n constructor() {\r\n super({\r\n id: 'tab',\r\n precondition: EditorContextKeys.writable,\r\n kbOpts: {\r\n weight: CORE_WEIGHT,\r\n kbExpr: ContextKeyExpr.and(EditorContextKeys.editorTextFocus, EditorContextKeys.tabDoesNotMoveFocus),\r\n primary: 2 /* Tab */\r\n }\r\n });\r\n }\r\n runCoreEditingCommand(editor, viewModel, args) {\r\n editor.pushUndoStop();\r\n editor.executeCommands(this.id, TypeOperations.tab(viewModel.cursorConfig, viewModel.model, viewModel.getCursorStates().map(s => s.modelState.selection)));\r\n editor.pushUndoStop();\r\n }\r\n });\r\n CoreEditingCommands.DeleteLeft = registerEditorCommand(new class extends CoreEditingCommand {\r\n constructor() {\r\n super({\r\n id: 'deleteLeft',\r\n precondition: undefined,\r\n kbOpts: {\r\n weight: CORE_WEIGHT,\r\n kbExpr: EditorContextKeys.textInputFocus,\r\n primary: 1 /* Backspace */,\r\n secondary: [1024 /* Shift */ | 1 /* Backspace */],\r\n mac: { primary: 1 /* Backspace */, secondary: [1024 /* Shift */ | 1 /* Backspace */, 256 /* WinCtrl */ | 38 /* KEY_H */, 256 /* WinCtrl */ | 1 /* Backspace */] }\r\n }\r\n });\r\n }\r\n runCoreEditingCommand(editor, viewModel, args) {\r\n const [shouldPushStackElementBefore, commands] = DeleteOperations.deleteLeft(viewModel.getPrevEditOperationType(), viewModel.cursorConfig, viewModel.model, viewModel.getCursorStates().map(s => s.modelState.selection), viewModel.getCursorAutoClosedCharacters());\r\n if (shouldPushStackElementBefore) {\r\n editor.pushUndoStop();\r\n }\r\n editor.executeCommands(this.id, commands);\r\n viewModel.setPrevEditOperationType(2 /* DeletingLeft */);\r\n }\r\n });\r\n CoreEditingCommands.DeleteRight = registerEditorCommand(new class extends CoreEditingCommand {\r\n constructor() {\r\n super({\r\n id: 'deleteRight',\r\n precondition: undefined,\r\n kbOpts: {\r\n weight: CORE_WEIGHT,\r\n kbExpr: EditorContextKeys.textInputFocus,\r\n primary: 20 /* Delete */,\r\n mac: { primary: 20 /* Delete */, secondary: [256 /* WinCtrl */ | 34 /* KEY_D */, 256 /* WinCtrl */ | 20 /* Delete */] }\r\n }\r\n });\r\n }\r\n runCoreEditingCommand(editor, viewModel, args) {\r\n const [shouldPushStackElementBefore, commands] = DeleteOperations.deleteRight(viewModel.getPrevEditOperationType(), viewModel.cursorConfig, viewModel.model, viewModel.getCursorStates().map(s => s.modelState.selection));\r\n if (shouldPushStackElementBefore) {\r\n editor.pushUndoStop();\r\n }\r\n editor.executeCommands(this.id, commands);\r\n viewModel.setPrevEditOperationType(3 /* DeletingRight */);\r\n }\r\n });\r\n CoreEditingCommands.Undo = new class extends EditorOrNativeTextInputCommand {\r\n constructor() {\r\n super(UndoCommand);\r\n }\r\n runDOMCommand() {\r\n document.execCommand('undo');\r\n }\r\n runEditorCommand(accessor, editor, args) {\r\n if (!editor.hasModel() || editor.getOption(79 /* readOnly */) === true) {\r\n return;\r\n }\r\n return editor.getModel().undo();\r\n }\r\n }();\r\n CoreEditingCommands.Redo = new class extends EditorOrNativeTextInputCommand {\r\n constructor() {\r\n super(RedoCommand);\r\n }\r\n runDOMCommand() {\r\n document.execCommand('redo');\r\n }\r\n runEditorCommand(accessor, editor, args) {\r\n if (!editor.hasModel() || editor.getOption(79 /* readOnly */) === true) {\r\n return;\r\n }\r\n return editor.getModel().redo();\r\n }\r\n }();\r\n})(CoreEditingCommands || (CoreEditingCommands = {}));\r\n/**\r\n * A command that will invoke a command on the focused editor.\r\n */\r\nclass EditorHandlerCommand extends Command {\r\n constructor(id, handlerId, description) {\r\n super({\r\n id: id,\r\n precondition: undefined,\r\n description: description\r\n });\r\n this._handlerId = handlerId;\r\n }\r\n runCommand(accessor, args) {\r\n const editor = accessor.get(ICodeEditorService).getFocusedCodeEditor();\r\n if (!editor) {\r\n return;\r\n }\r\n editor.trigger('keyboard', this._handlerId, args);\r\n }\r\n}\r\nfunction registerOverwritableCommand(handlerId, description) {\r\n registerCommand(new EditorHandlerCommand('default:' + handlerId, handlerId));\r\n registerCommand(new EditorHandlerCommand(handlerId, handlerId, description));\r\n}\r\nregisterOverwritableCommand(\"type\" /* Type */, {\r\n description: `Type`,\r\n args: [{\r\n name: 'args',\r\n schema: {\r\n 'type': 'object',\r\n 'required': ['text'],\r\n 'properties': {\r\n 'text': {\r\n 'type': 'string'\r\n }\r\n },\r\n }\r\n }]\r\n});\r\nregisterOverwritableCommand(\"replacePreviousChar\" /* ReplacePreviousChar */);\r\nregisterOverwritableCommand(\"compositionType\" /* CompositionType */);\r\nregisterOverwritableCommand(\"compositionStart\" /* CompositionStart */);\r\nregisterOverwritableCommand(\"compositionEnd\" /* CompositionEnd */);\r\nregisterOverwritableCommand(\"paste\" /* Paste */);\r\nregisterOverwritableCommand(\"cut\" /* Cut */);\r\n", "/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License. See License.txt in the project root for license information.\r\n *--------------------------------------------------------------------------------------------*/\r\nimport './codicon/codicon.css';\r\nimport './codicon/codicon-modifiers.css';\r\nimport { Codicon } from '../../../common/codicons.js';\r\nexport function formatRule(c) {\r\n let def = c.definition;\r\n while (def instanceof Codicon) {\r\n def = def.definition;\r\n }\r\n return `.codicon-${c.id}:before { content: '${def.fontCharacter}'; }`;\r\n}\r\n", "/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License. See License.txt in the project root for license information.\r\n *--------------------------------------------------------------------------------------------*/\r\n// THIS IS A GENERATED FILE. DO NOT EDIT DIRECTLY.\r\nexport var AccessibilitySupport;\r\n(function (AccessibilitySupport) {\r\n /**\r\n * This should be the browser case where it is not known if a screen reader is attached or no.\r\n */\r\n AccessibilitySupport[AccessibilitySupport[\"Unknown\"] = 0] = \"Unknown\";\r\n AccessibilitySupport[AccessibilitySupport[\"Disabled\"] = 1] = \"Disabled\";\r\n AccessibilitySupport[AccessibilitySupport[\"Enabled\"] = 2] = \"Enabled\";\r\n})(AccessibilitySupport || (AccessibilitySupport = {}));\r\nexport var CompletionItemInsertTextRule;\r\n(function (CompletionItemInsertTextRule) {\r\n /**\r\n * Adjust whitespace/indentation of multiline insert texts to\r\n * match the current line indentation.\r\n */\r\n CompletionItemInsertTextRule[CompletionItemInsertTextRule[\"KeepWhitespace\"] = 1] = \"KeepWhitespace\";\r\n /**\r\n * `insertText` is a snippet.\r\n */\r\n CompletionItemInsertTextRule[CompletionItemInsertTextRule[\"InsertAsSnippet\"] = 4] = \"InsertAsSnippet\";\r\n})(CompletionItemInsertTextRule || (CompletionItemInsertTextRule = {}));\r\nexport var CompletionItemKind;\r\n(function (CompletionItemKind) {\r\n CompletionItemKind[CompletionItemKind[\"Method\"] = 0] = \"Method\";\r\n CompletionItemKind[CompletionItemKind[\"Function\"] = 1] = \"Function\";\r\n CompletionItemKind[CompletionItemKind[\"Constructor\"] = 2] = \"Constructor\";\r\n CompletionItemKind[CompletionItemKind[\"Field\"] = 3] = \"Field\";\r\n CompletionItemKind[CompletionItemKind[\"Variable\"] = 4] = \"Variable\";\r\n CompletionItemKind[CompletionItemKind[\"Class\"] = 5] = \"Class\";\r\n CompletionItemKind[CompletionItemKind[\"Struct\"] = 6] = \"Struct\";\r\n CompletionItemKind[CompletionItemKind[\"Interface\"] = 7] = \"Interface\";\r\n CompletionItemKind[CompletionItemKind[\"Module\"] = 8] = \"Module\";\r\n CompletionItemKind[CompletionItemKind[\"Property\"] = 9] = \"Property\";\r\n CompletionItemKind[CompletionItemKind[\"Event\"] = 10] = \"Event\";\r\n CompletionItemKind[CompletionItemKind[\"Operator\"] = 11] = \"Operator\";\r\n CompletionItemKind[CompletionItemKind[\"Unit\"] = 12] = \"Unit\";\r\n CompletionItemKind[CompletionItemKind[\"Value\"] = 13] = \"Value\";\r\n CompletionItemKind[CompletionItemKind[\"Constant\"] = 14] = \"Constant\";\r\n CompletionItemKind[CompletionItemKind[\"Enum\"] = 15] = \"Enum\";\r\n CompletionItemKind[CompletionItemKind[\"EnumMember\"] = 16] = \"EnumMember\";\r\n CompletionItemKind[CompletionItemKind[\"Keyword\"] = 17] = \"Keyword\";\r\n CompletionItemKind[CompletionItemKind[\"Text\"] = 18] = \"Text\";\r\n CompletionItemKind[CompletionItemKind[\"Color\"] = 19] = \"Color\";\r\n CompletionItemKind[CompletionItemKind[\"File\"] = 20] = \"File\";\r\n CompletionItemKind[CompletionItemKind[\"Reference\"] = 21] = \"Reference\";\r\n CompletionItemKind[CompletionItemKind[\"Customcolor\"] = 22] = \"Customcolor\";\r\n CompletionItemKind[CompletionItemKind[\"Folder\"] = 23] = \"Folder\";\r\n CompletionItemKind[CompletionItemKind[\"TypeParameter\"] = 24] = \"TypeParameter\";\r\n CompletionItemKind[CompletionItemKind[\"User\"] = 25] = \"User\";\r\n CompletionItemKind[CompletionItemKind[\"Issue\"] = 26] = \"Issue\";\r\n CompletionItemKind[CompletionItemKind[\"Snippet\"] = 27] = \"Snippet\";\r\n})(CompletionItemKind || (CompletionItemKind = {}));\r\nexport var CompletionItemTag;\r\n(function (CompletionItemTag) {\r\n CompletionItemTag[CompletionItemTag[\"Deprecated\"] = 1] = \"Deprecated\";\r\n})(CompletionItemTag || (CompletionItemTag = {}));\r\n/**\r\n * How a suggest provider was triggered.\r\n */\r\nexport var CompletionTriggerKind;\r\n(function (CompletionTriggerKind) {\r\n CompletionTriggerKind[CompletionTriggerKind[\"Invoke\"] = 0] = \"Invoke\";\r\n CompletionTriggerKind[CompletionTriggerKind[\"TriggerCharacter\"] = 1] = \"TriggerCharacter\";\r\n CompletionTriggerKind[CompletionTriggerKind[\"TriggerForIncompleteCompletions\"] = 2] = \"TriggerForIncompleteCompletions\";\r\n})(CompletionTriggerKind || (CompletionTriggerKind = {}));\r\n/**\r\n * A positioning preference for rendering content widgets.\r\n */\r\nexport var ContentWidgetPositionPreference;\r\n(function (ContentWidgetPositionPreference) {\r\n /**\r\n * Place the content widget exactly at a position\r\n */\r\n ContentWidgetPositionPreference[ContentWidgetPositionPreference[\"EXACT\"] = 0] = \"EXACT\";\r\n /**\r\n * Place the content widget above a position\r\n */\r\n ContentWidgetPositionPreference[ContentWidgetPositionPreference[\"ABOVE\"] = 1] = \"ABOVE\";\r\n /**\r\n * Place the content widget below a position\r\n */\r\n ContentWidgetPositionPreference[ContentWidgetPositionPreference[\"BELOW\"] = 2] = \"BELOW\";\r\n})(ContentWidgetPositionPreference || (ContentWidgetPositionPreference = {}));\r\n/**\r\n * Describes the reason the cursor has changed its position.\r\n */\r\nexport var CursorChangeReason;\r\n(function (CursorChangeReason) {\r\n /**\r\n * Unknown or not set.\r\n */\r\n CursorChangeReason[CursorChangeReason[\"NotSet\"] = 0] = \"NotSet\";\r\n /**\r\n * A `model.setValue()` was called.\r\n */\r\n CursorChangeReason[CursorChangeReason[\"ContentFlush\"] = 1] = \"ContentFlush\";\r\n /**\r\n * The `model` has been changed outside of this cursor and the cursor recovers its position from associated markers.\r\n */\r\n CursorChangeReason[CursorChangeReason[\"RecoverFromMarkers\"] = 2] = \"RecoverFromMarkers\";\r\n /**\r\n * There was an explicit user gesture.\r\n */\r\n CursorChangeReason[CursorChangeReason[\"Explicit\"] = 3] = \"Explicit\";\r\n /**\r\n * There was a Paste.\r\n */\r\n CursorChangeReason[CursorChangeReason[\"Paste\"] = 4] = \"Paste\";\r\n /**\r\n * There was an Undo.\r\n */\r\n CursorChangeReason[CursorChangeReason[\"Undo\"] = 5] = \"Undo\";\r\n /**\r\n * There was a Redo.\r\n */\r\n CursorChangeReason[CursorChangeReason[\"Redo\"] = 6] = \"Redo\";\r\n})(CursorChangeReason || (CursorChangeReason = {}));\r\n/**\r\n * The default end of line to use when instantiating models.\r\n */\r\nexport var DefaultEndOfLine;\r\n(function (DefaultEndOfLine) {\r\n /**\r\n * Use line feed (\\n) as the end of line character.\r\n */\r\n DefaultEndOfLine[DefaultEndOfLine[\"LF\"] = 1] = \"LF\";\r\n /**\r\n * Use carriage return and line feed (\\r\\n) as the end of line character.\r\n */\r\n DefaultEndOfLine[DefaultEndOfLine[\"CRLF\"] = 2] = \"CRLF\";\r\n})(DefaultEndOfLine || (DefaultEndOfLine = {}));\r\n/**\r\n * A document highlight kind.\r\n */\r\nexport var DocumentHighlightKind;\r\n(function (DocumentHighlightKind) {\r\n /**\r\n * A textual occurrence.\r\n */\r\n DocumentHighlightKind[DocumentHighlightKind[\"Text\"] = 0] = \"Text\";\r\n /**\r\n * Read-access of a symbol, like reading a variable.\r\n */\r\n DocumentHighlightKind[DocumentHighlightKind[\"Read\"] = 1] = \"Read\";\r\n /**\r\n * Write-access of a symbol, like writing to a variable.\r\n */\r\n DocumentHighlightKind[DocumentHighlightKind[\"Write\"] = 2] = \"Write\";\r\n})(DocumentHighlightKind || (DocumentHighlightKind = {}));\r\n/**\r\n * Configuration options for auto indentation in the editor\r\n */\r\nexport var EditorAutoIndentStrategy;\r\n(function (EditorAutoIndentStrategy) {\r\n EditorAutoIndentStrategy[EditorAutoIndentStrategy[\"None\"] = 0] = \"None\";\r\n EditorAutoIndentStrategy[EditorAutoIndentStrategy[\"Keep\"] = 1] = \"Keep\";\r\n EditorAutoIndentStrategy[EditorAutoIndentStrategy[\"Brackets\"] = 2] = \"Brackets\";\r\n EditorAutoIndentStrategy[EditorAutoIndentStrategy[\"Advanced\"] = 3] = \"Advanced\";\r\n EditorAutoIndentStrategy[EditorAutoIndentStrategy[\"Full\"] = 4] = \"Full\";\r\n})(EditorAutoIndentStrategy || (EditorAutoIndentStrategy = {}));\r\nexport var EditorOption;\r\n(function (EditorOption) {\r\n EditorOption[EditorOption[\"acceptSuggestionOnCommitCharacter\"] = 0] = \"acceptSuggestionOnCommitCharacter\";\r\n EditorOption[EditorOption[\"acceptSuggestionOnEnter\"] = 1] = \"acceptSuggestionOnEnter\";\r\n EditorOption[EditorOption[\"accessibilitySupport\"] = 2] = \"accessibilitySupport\";\r\n EditorOption[EditorOption[\"accessibilityPageSize\"] = 3] = \"accessibilityPageSize\";\r\n EditorOption[EditorOption[\"ariaLabel\"] = 4] = \"ariaLabel\";\r\n EditorOption[EditorOption[\"autoClosingBrackets\"] = 5] = \"autoClosingBrackets\";\r\n EditorOption[EditorOption[\"autoClosingDelete\"] = 6] = \"autoClosingDelete\";\r\n EditorOption[EditorOption[\"autoClosingOvertype\"] = 7] = \"autoClosingOvertype\";\r\n EditorOption[EditorOption[\"autoClosingQuotes\"] = 8] = \"autoClosingQuotes\";\r\n EditorOption[EditorOption[\"autoIndent\"] = 9] = \"autoIndent\";\r\n EditorOption[EditorOption[\"automaticLayout\"] = 10] = \"automaticLayout\";\r\n EditorOption[EditorOption[\"autoSurround\"] = 11] = \"autoSurround\";\r\n EditorOption[EditorOption[\"codeLens\"] = 12] = \"codeLens\";\r\n EditorOption[EditorOption[\"codeLensFontFamily\"] = 13] = \"codeLensFontFamily\";\r\n EditorOption[EditorOption[\"codeLensFontSize\"] = 14] = \"codeLensFontSize\";\r\n EditorOption[EditorOption[\"colorDecorators\"] = 15] = \"colorDecorators\";\r\n EditorOption[EditorOption[\"columnSelection\"] = 16] = \"columnSelection\";\r\n EditorOption[EditorOption[\"comments\"] = 17] = \"comments\";\r\n EditorOption[EditorOption[\"contextmenu\"] = 18] = \"contextmenu\";\r\n EditorOption[EditorOption[\"copyWithSyntaxHighlighting\"] = 19] = \"copyWithSyntaxHighlighting\";\r\n EditorOption[EditorOption[\"cursorBlinking\"] = 20] = \"cursorBlinking\";\r\n EditorOption[EditorOption[\"cursorSmoothCaretAnimation\"] = 21] = \"cursorSmoothCaretAnimation\";\r\n EditorOption[EditorOption[\"cursorStyle\"] = 22] = \"cursorStyle\";\r\n EditorOption[EditorOption[\"cursorSurroundingLines\"] = 23] = \"cursorSurroundingLines\";\r\n EditorOption[EditorOption[\"cursorSurroundingLinesStyle\"] = 24] = \"cursorSurroundingLinesStyle\";\r\n EditorOption[EditorOption[\"cursorWidth\"] = 25] = \"cursorWidth\";\r\n EditorOption[EditorOption[\"disableLayerHinting\"] = 26] = \"disableLayerHinting\";\r\n EditorOption[EditorOption[\"disableMonospaceOptimizations\"] = 27] = \"disableMonospaceOptimizations\";\r\n EditorOption[EditorOption[\"domReadOnly\"] = 28] = \"domReadOnly\";\r\n EditorOption[EditorOption[\"dragAndDrop\"] = 29] = \"dragAndDrop\";\r\n EditorOption[EditorOption[\"emptySelectionClipboard\"] = 30] = \"emptySelectionClipboard\";\r\n EditorOption[EditorOption[\"extraEditorClassName\"] = 31] = \"extraEditorClassName\";\r\n EditorOption[EditorOption[\"fastScrollSensitivity\"] = 32] = \"fastScrollSensitivity\";\r\n EditorOption[EditorOption[\"find\"] = 33] = \"find\";\r\n EditorOption[EditorOption[\"fixedOverflowWidgets\"] = 34] = \"fixedOverflowWidgets\";\r\n EditorOption[EditorOption[\"folding\"] = 35] = \"folding\";\r\n EditorOption[EditorOption[\"foldingStrategy\"] = 36] = \"foldingStrategy\";\r\n EditorOption[EditorOption[\"foldingHighlight\"] = 37] = \"foldingHighlight\";\r\n EditorOption[EditorOption[\"foldingImportsByDefault\"] = 38] = \"foldingImportsByDefault\";\r\n EditorOption[EditorOption[\"unfoldOnClickAfterEndOfLine\"] = 39] = \"unfoldOnClickAfterEndOfLine\";\r\n EditorOption[EditorOption[\"fontFamily\"] = 40] = \"fontFamily\";\r\n EditorOption[EditorOption[\"fontInfo\"] = 41] = \"fontInfo\";\r\n EditorOption[EditorOption[\"fontLigatures\"] = 42] = \"fontLigatures\";\r\n EditorOption[EditorOption[\"fontSize\"] = 43] = \"fontSize\";\r\n EditorOption[EditorOption[\"fontWeight\"] = 44] = \"fontWeight\";\r\n EditorOption[EditorOption[\"formatOnPaste\"] = 45] = \"formatOnPaste\";\r\n EditorOption[EditorOption[\"formatOnType\"] = 46] = \"formatOnType\";\r\n EditorOption[EditorOption[\"glyphMargin\"] = 47] = \"glyphMargin\";\r\n EditorOption[EditorOption[\"gotoLocation\"] = 48] = \"gotoLocation\";\r\n EditorOption[EditorOption[\"hideCursorInOverviewRuler\"] = 49] = \"hideCursorInOverviewRuler\";\r\n EditorOption[EditorOption[\"highlightActiveIndentGuide\"] = 50] = \"highlightActiveIndentGuide\";\r\n EditorOption[EditorOption[\"hover\"] = 51] = \"hover\";\r\n EditorOption[EditorOption[\"inDiffEditor\"] = 52] = \"inDiffEditor\";\r\n EditorOption[EditorOption[\"inlineSuggest\"] = 53] = \"inlineSuggest\";\r\n EditorOption[EditorOption[\"letterSpacing\"] = 54] = \"letterSpacing\";\r\n EditorOption[EditorOption[\"lightbulb\"] = 55] = \"lightbulb\";\r\n EditorOption[EditorOption[\"lineDecorationsWidth\"] = 56] = \"lineDecorationsWidth\";\r\n EditorOption[EditorOption[\"lineHeight\"] = 57] = \"lineHeight\";\r\n EditorOption[EditorOption[\"lineNumbers\"] = 58] = \"lineNumbers\";\r\n EditorOption[EditorOption[\"lineNumbersMinChars\"] = 59] = \"lineNumbersMinChars\";\r\n EditorOption[EditorOption[\"linkedEditing\"] = 60] = \"linkedEditing\";\r\n EditorOption[EditorOption[\"links\"] = 61] = \"links\";\r\n EditorOption[EditorOption[\"matchBrackets\"] = 62] = \"matchBrackets\";\r\n EditorOption[EditorOption[\"minimap\"] = 63] = \"minimap\";\r\n EditorOption[EditorOption[\"mouseStyle\"] = 64] = \"mouseStyle\";\r\n EditorOption[EditorOption[\"mouseWheelScrollSensitivity\"] = 65] = \"mouseWheelScrollSensitivity\";\r\n EditorOption[EditorOption[\"mouseWheelZoom\"] = 66] = \"mouseWheelZoom\";\r\n EditorOption[EditorOption[\"multiCursorMergeOverlapping\"] = 67] = \"multiCursorMergeOverlapping\";\r\n EditorOption[EditorOption[\"multiCursorModifier\"] = 68] = \"multiCursorModifier\";\r\n EditorOption[EditorOption[\"multiCursorPaste\"] = 69] = \"multiCursorPaste\";\r\n EditorOption[EditorOption[\"occurrencesHighlight\"] = 70] = \"occurrencesHighlight\";\r\n EditorOption[EditorOption[\"overviewRulerBorder\"] = 71] = \"overviewRulerBorder\";\r\n EditorOption[EditorOption[\"overviewRulerLanes\"] = 72] = \"overviewRulerLanes\";\r\n EditorOption[EditorOption[\"padding\"] = 73] = \"padding\";\r\n EditorOption[EditorOption[\"parameterHints\"] = 74] = \"parameterHints\";\r\n EditorOption[EditorOption[\"peekWidgetDefaultFocus\"] = 75] = \"peekWidgetDefaultFocus\";\r\n EditorOption[EditorOption[\"definitionLinkOpensInPeek\"] = 76] = \"definitionLinkOpensInPeek\";\r\n EditorOption[EditorOption[\"quickSuggestions\"] = 77] = \"quickSuggestions\";\r\n EditorOption[EditorOption[\"quickSuggestionsDelay\"] = 78] = \"quickSuggestionsDelay\";\r\n EditorOption[EditorOption[\"readOnly\"] = 79] = \"readOnly\";\r\n EditorOption[EditorOption[\"renameOnType\"] = 80] = \"renameOnType\";\r\n EditorOption[EditorOption[\"renderControlCharacters\"] = 81] = \"renderControlCharacters\";\r\n EditorOption[EditorOption[\"renderIndentGuides\"] = 82] = \"renderIndentGuides\";\r\n EditorOption[EditorOption[\"renderFinalNewline\"] = 83] = \"renderFinalNewline\";\r\n EditorOption[EditorOption[\"renderLineHighlight\"] = 84] = \"renderLineHighlight\";\r\n EditorOption[EditorOption[\"renderLineHighlightOnlyWhenFocus\"] = 85] = \"renderLineHighlightOnlyWhenFocus\";\r\n EditorOption[EditorOption[\"renderValidationDecorations\"] = 86] = \"renderValidationDecorations\";\r\n EditorOption[EditorOption[\"renderWhitespace\"] = 87] = \"renderWhitespace\";\r\n EditorOption[EditorOption[\"revealHorizontalRightPadding\"] = 88] = \"revealHorizontalRightPadding\";\r\n EditorOption[EditorOption[\"roundedSelection\"] = 89] = \"roundedSelection\";\r\n EditorOption[EditorOption[\"rulers\"] = 90] = \"rulers\";\r\n EditorOption[EditorOption[\"scrollbar\"] = 91] = \"scrollbar\";\r\n EditorOption[EditorOption[\"scrollBeyondLastColumn\"] = 92] = \"scrollBeyondLastColumn\";\r\n EditorOption[EditorOption[\"scrollBeyondLastLine\"] = 93] = \"scrollBeyondLastLine\";\r\n EditorOption[EditorOption[\"scrollPredominantAxis\"] = 94] = \"scrollPredominantAxis\";\r\n EditorOption[EditorOption[\"selectionClipboard\"] = 95] = \"selectionClipboard\";\r\n EditorOption[EditorOption[\"selectionHighlight\"] = 96] = \"selectionHighlight\";\r\n EditorOption[EditorOption[\"selectOnLineNumbers\"] = 97] = \"selectOnLineNumbers\";\r\n EditorOption[EditorOption[\"showFoldingControls\"] = 98] = \"showFoldingControls\";\r\n EditorOption[EditorOption[\"showUnused\"] = 99] = \"showUnused\";\r\n EditorOption[EditorOption[\"snippetSuggestions\"] = 100] = \"snippetSuggestions\";\r\n EditorOption[EditorOption[\"smartSelect\"] = 101] = \"smartSelect\";\r\n EditorOption[EditorOption[\"smoothScrolling\"] = 102] = \"smoothScrolling\";\r\n EditorOption[EditorOption[\"stickyTabStops\"] = 103] = \"stickyTabStops\";\r\n EditorOption[EditorOption[\"stopRenderingLineAfter\"] = 104] = \"stopRenderingLineAfter\";\r\n EditorOption[EditorOption[\"suggest\"] = 105] = \"suggest\";\r\n EditorOption[EditorOption[\"suggestFontSize\"] = 106] = \"suggestFontSize\";\r\n EditorOption[EditorOption[\"suggestLineHeight\"] = 107] = \"suggestLineHeight\";\r\n EditorOption[EditorOption[\"suggestOnTriggerCharacters\"] = 108] = \"suggestOnTriggerCharacters\";\r\n EditorOption[EditorOption[\"suggestSelection\"] = 109] = \"suggestSelection\";\r\n EditorOption[EditorOption[\"tabCompletion\"] = 110] = \"tabCompletion\";\r\n EditorOption[EditorOption[\"tabIndex\"] = 111] = \"tabIndex\";\r\n EditorOption[EditorOption[\"unusualLineTerminators\"] = 112] = \"unusualLineTerminators\";\r\n EditorOption[EditorOption[\"useShadowDOM\"] = 113] = \"useShadowDOM\";\r\n EditorOption[EditorOption[\"useTabStops\"] = 114] = \"useTabStops\";\r\n EditorOption[EditorOption[\"wordSeparators\"] = 115] = \"wordSeparators\";\r\n EditorOption[EditorOption[\"wordWrap\"] = 116] = \"wordWrap\";\r\n EditorOption[EditorOption[\"wordWrapBreakAfterCharacters\"] = 117] = \"wordWrapBreakAfterCharacters\";\r\n EditorOption[EditorOption[\"wordWrapBreakBeforeCharacters\"] = 118] = \"wordWrapBreakBeforeCharacters\";\r\n EditorOption[EditorOption[\"wordWrapColumn\"] = 119] = \"wordWrapColumn\";\r\n EditorOption[EditorOption[\"wordWrapOverride1\"] = 120] = \"wordWrapOverride1\";\r\n EditorOption[EditorOption[\"wordWrapOverride2\"] = 121] = \"wordWrapOverride2\";\r\n EditorOption[EditorOption[\"wrappingIndent\"] = 122] = \"wrappingIndent\";\r\n EditorOption[EditorOption[\"wrappingStrategy\"] = 123] = \"wrappingStrategy\";\r\n EditorOption[EditorOption[\"showDeprecated\"] = 124] = \"showDeprecated\";\r\n EditorOption[EditorOption[\"inlayHints\"] = 125] = \"inlayHints\";\r\n EditorOption[EditorOption[\"editorClassName\"] = 126] = \"editorClassName\";\r\n EditorOption[EditorOption[\"pixelRatio\"] = 127] = \"pixelRatio\";\r\n EditorOption[EditorOption[\"tabFocusMode\"] = 128] = \"tabFocusMode\";\r\n EditorOption[EditorOption[\"layoutInfo\"] = 129] = \"layoutInfo\";\r\n EditorOption[EditorOption[\"wrappingInfo\"] = 130] = \"wrappingInfo\";\r\n})(EditorOption || (EditorOption = {}));\r\n/**\r\n * End of line character preference.\r\n */\r\nexport var EndOfLinePreference;\r\n(function (EndOfLinePreference) {\r\n /**\r\n * Use the end of line character identified in the text buffer.\r\n */\r\n EndOfLinePreference[EndOfLinePreference[\"TextDefined\"] = 0] = \"TextDefined\";\r\n /**\r\n * Use line feed (\\n) as the end of line character.\r\n */\r\n EndOfLinePreference[EndOfLinePreference[\"LF\"] = 1] = \"LF\";\r\n /**\r\n * Use carriage return and line feed (\\r\\n) as the end of line character.\r\n */\r\n EndOfLinePreference[EndOfLinePreference[\"CRLF\"] = 2] = \"CRLF\";\r\n})(EndOfLinePreference || (EndOfLinePreference = {}));\r\n/**\r\n * End of line character preference.\r\n */\r\nexport var EndOfLineSequence;\r\n(function (EndOfLineSequence) {\r\n /**\r\n * Use line feed (\\n) as the end of line character.\r\n */\r\n EndOfLineSequence[EndOfLineSequence[\"LF\"] = 0] = \"LF\";\r\n /**\r\n * Use carriage return and line feed (\\r\\n) as the end of line character.\r\n */\r\n EndOfLineSequence[EndOfLineSequence[\"CRLF\"] = 1] = \"CRLF\";\r\n})(EndOfLineSequence || (EndOfLineSequence = {}));\r\n/**\r\n * Describes what to do with the indentation when pressing Enter.\r\n */\r\nexport var IndentAction;\r\n(function (IndentAction) {\r\n /**\r\n * Insert new line and copy the previous line's indentation.\r\n */\r\n IndentAction[IndentAction[\"None\"] = 0] = \"None\";\r\n /**\r\n * Insert new line and indent once (relative to the previous line's indentation).\r\n */\r\n IndentAction[IndentAction[\"Indent\"] = 1] = \"Indent\";\r\n /**\r\n * Insert two new lines:\r\n * - the first one indented which will hold the cursor\r\n * - the second one at the same indentation level\r\n */\r\n IndentAction[IndentAction[\"IndentOutdent\"] = 2] = \"IndentOutdent\";\r\n /**\r\n * Insert new line and outdent once (relative to the previous line's indentation).\r\n */\r\n IndentAction[IndentAction[\"Outdent\"] = 3] = \"Outdent\";\r\n})(IndentAction || (IndentAction = {}));\r\nexport var InlayHintKind;\r\n(function (InlayHintKind) {\r\n InlayHintKind[InlayHintKind[\"Other\"] = 0] = \"Other\";\r\n InlayHintKind[InlayHintKind[\"Type\"] = 1] = \"Type\";\r\n InlayHintKind[InlayHintKind[\"Parameter\"] = 2] = \"Parameter\";\r\n})(InlayHintKind || (InlayHintKind = {}));\r\n/**\r\n * How an {@link InlineCompletionsProvider inline completion provider} was triggered.\r\n */\r\nexport var InlineCompletionTriggerKind;\r\n(function (InlineCompletionTriggerKind) {\r\n /**\r\n * Completion was triggered automatically while editing.\r\n * It is sufficient to return a single completion item in this case.\r\n */\r\n InlineCompletionTriggerKind[InlineCompletionTriggerKind[\"Automatic\"] = 0] = \"Automatic\";\r\n /**\r\n * Completion was triggered explicitly by a user gesture.\r\n * Return multiple completion items to enable cycling through them.\r\n */\r\n InlineCompletionTriggerKind[InlineCompletionTriggerKind[\"Explicit\"] = 1] = \"Explicit\";\r\n})(InlineCompletionTriggerKind || (InlineCompletionTriggerKind = {}));\r\n/**\r\n * Virtual Key Codes, the value does not hold any inherent meaning.\r\n * Inspired somewhat from https://msdn.microsoft.com/en-us/library/windows/desktop/dd375731(v=vs.85).aspx\r\n * But these are \"more general\", as they should work across browsers & OS`s.\r\n */\r\nexport var KeyCode;\r\n(function (KeyCode) {\r\n KeyCode[KeyCode[\"DependsOnKbLayout\"] = -1] = \"DependsOnKbLayout\";\r\n /**\r\n * Placed first to cover the 0 value of the enum.\r\n */\r\n KeyCode[KeyCode[\"Unknown\"] = 0] = \"Unknown\";\r\n KeyCode[KeyCode[\"Backspace\"] = 1] = \"Backspace\";\r\n KeyCode[KeyCode[\"Tab\"] = 2] = \"Tab\";\r\n KeyCode[KeyCode[\"Enter\"] = 3] = \"Enter\";\r\n KeyCode[KeyCode[\"Shift\"] = 4] = \"Shift\";\r\n KeyCode[KeyCode[\"Ctrl\"] = 5] = \"Ctrl\";\r\n KeyCode[KeyCode[\"Alt\"] = 6] = \"Alt\";\r\n KeyCode[KeyCode[\"PauseBreak\"] = 7] = \"PauseBreak\";\r\n KeyCode[KeyCode[\"CapsLock\"] = 8] = \"CapsLock\";\r\n KeyCode[KeyCode[\"Escape\"] = 9] = \"Escape\";\r\n KeyCode[KeyCode[\"Space\"] = 10] = \"Space\";\r\n KeyCode[KeyCode[\"PageUp\"] = 11] = \"PageUp\";\r\n KeyCode[KeyCode[\"PageDown\"] = 12] = \"PageDown\";\r\n KeyCode[KeyCode[\"End\"] = 13] = \"End\";\r\n KeyCode[KeyCode[\"Home\"] = 14] = \"Home\";\r\n KeyCode[KeyCode[\"LeftArrow\"] = 15] = \"LeftArrow\";\r\n KeyCode[KeyCode[\"UpArrow\"] = 16] = \"UpArrow\";\r\n KeyCode[KeyCode[\"RightArrow\"] = 17] = \"RightArrow\";\r\n KeyCode[KeyCode[\"DownArrow\"] = 18] = \"DownArrow\";\r\n KeyCode[KeyCode[\"Insert\"] = 19] = \"Insert\";\r\n KeyCode[KeyCode[\"Delete\"] = 20] = \"Delete\";\r\n KeyCode[KeyCode[\"KEY_0\"] = 21] = \"KEY_0\";\r\n KeyCode[KeyCode[\"KEY_1\"] = 22] = \"KEY_1\";\r\n KeyCode[KeyCode[\"KEY_2\"] = 23] = \"KEY_2\";\r\n KeyCode[KeyCode[\"KEY_3\"] = 24] = \"KEY_3\";\r\n KeyCode[KeyCode[\"KEY_4\"] = 25] = \"KEY_4\";\r\n KeyCode[KeyCode[\"KEY_5\"] = 26] = \"KEY_5\";\r\n KeyCode[KeyCode[\"KEY_6\"] = 27] = \"KEY_6\";\r\n KeyCode[KeyCode[\"KEY_7\"] = 28] = \"KEY_7\";\r\n KeyCode[KeyCode[\"KEY_8\"] = 29] = \"KEY_8\";\r\n KeyCode[KeyCode[\"KEY_9\"] = 30] = \"KEY_9\";\r\n KeyCode[KeyCode[\"KEY_A\"] = 31] = \"KEY_A\";\r\n KeyCode[KeyCode[\"KEY_B\"] = 32] = \"KEY_B\";\r\n KeyCode[KeyCode[\"KEY_C\"] = 33] = \"KEY_C\";\r\n KeyCode[KeyCode[\"KEY_D\"] = 34] = \"KEY_D\";\r\n KeyCode[KeyCode[\"KEY_E\"] = 35] = \"KEY_E\";\r\n KeyCode[KeyCode[\"KEY_F\"] = 36] = \"KEY_F\";\r\n KeyCode[KeyCode[\"KEY_G\"] = 37] = \"KEY_G\";\r\n KeyCode[KeyCode[\"KEY_H\"] = 38] = \"KEY_H\";\r\n KeyCode[KeyCode[\"KEY_I\"] = 39] = \"KEY_I\";\r\n KeyCode[KeyCode[\"KEY_J\"] = 40] = \"KEY_J\";\r\n KeyCode[KeyCode[\"KEY_K\"] = 41] = \"KEY_K\";\r\n KeyCode[KeyCode[\"KEY_L\"] = 42] = \"KEY_L\";\r\n KeyCode[KeyCode[\"KEY_M\"] = 43] = \"KEY_M\";\r\n KeyCode[KeyCode[\"KEY_N\"] = 44] = \"KEY_N\";\r\n KeyCode[KeyCode[\"KEY_O\"] = 45] = \"KEY_O\";\r\n KeyCode[KeyCode[\"KEY_P\"] = 46] = \"KEY_P\";\r\n KeyCode[KeyCode[\"KEY_Q\"] = 47] = \"KEY_Q\";\r\n KeyCode[KeyCode[\"KEY_R\"] = 48] = \"KEY_R\";\r\n KeyCode[KeyCode[\"KEY_S\"] = 49] = \"KEY_S\";\r\n KeyCode[KeyCode[\"KEY_T\"] = 50] = \"KEY_T\";\r\n KeyCode[KeyCode[\"KEY_U\"] = 51] = \"KEY_U\";\r\n KeyCode[KeyCode[\"KEY_V\"] = 52] = \"KEY_V\";\r\n KeyCode[KeyCode[\"KEY_W\"] = 53] = \"KEY_W\";\r\n KeyCode[KeyCode[\"KEY_X\"] = 54] = \"KEY_X\";\r\n KeyCode[KeyCode[\"KEY_Y\"] = 55] = \"KEY_Y\";\r\n KeyCode[KeyCode[\"KEY_Z\"] = 56] = \"KEY_Z\";\r\n KeyCode[KeyCode[\"Meta\"] = 57] = \"Meta\";\r\n KeyCode[KeyCode[\"ContextMenu\"] = 58] = \"ContextMenu\";\r\n KeyCode[KeyCode[\"F1\"] = 59] = \"F1\";\r\n KeyCode[KeyCode[\"F2\"] = 60] = \"F2\";\r\n KeyCode[KeyCode[\"F3\"] = 61] = \"F3\";\r\n KeyCode[KeyCode[\"F4\"] = 62] = \"F4\";\r\n KeyCode[KeyCode[\"F5\"] = 63] = \"F5\";\r\n KeyCode[KeyCode[\"F6\"] = 64] = \"F6\";\r\n KeyCode[KeyCode[\"F7\"] = 65] = \"F7\";\r\n KeyCode[KeyCode[\"F8\"] = 66] = \"F8\";\r\n KeyCode[KeyCode[\"F9\"] = 67] = \"F9\";\r\n KeyCode[KeyCode[\"F10\"] = 68] = \"F10\";\r\n KeyCode[KeyCode[\"F11\"] = 69] = \"F11\";\r\n KeyCode[KeyCode[\"F12\"] = 70] = \"F12\";\r\n KeyCode[KeyCode[\"F13\"] = 71] = \"F13\";\r\n KeyCode[KeyCode[\"F14\"] = 72] = \"F14\";\r\n KeyCode[KeyCode[\"F15\"] = 73] = \"F15\";\r\n KeyCode[KeyCode[\"F16\"] = 74] = \"F16\";\r\n KeyCode[KeyCode[\"F17\"] = 75] = \"F17\";\r\n KeyCode[KeyCode[\"F18\"] = 76] = \"F18\";\r\n KeyCode[KeyCode[\"F19\"] = 77] = \"F19\";\r\n KeyCode[KeyCode[\"NumLock\"] = 78] = \"NumLock\";\r\n KeyCode[KeyCode[\"ScrollLock\"] = 79] = \"ScrollLock\";\r\n /**\r\n * Used for miscellaneous characters; it can vary by keyboard.\r\n * For the US standard keyboard, the ';:' key\r\n */\r\n KeyCode[KeyCode[\"US_SEMICOLON\"] = 80] = \"US_SEMICOLON\";\r\n /**\r\n * For any country/region, the '+' key\r\n * For the US standard keyboard, the '=+' key\r\n */\r\n KeyCode[KeyCode[\"US_EQUAL\"] = 81] = \"US_EQUAL\";\r\n /**\r\n * For any country/region, the ',' key\r\n * For the US standard keyboard, the ',<' key\r\n */\r\n KeyCode[KeyCode[\"US_COMMA\"] = 82] = \"US_COMMA\";\r\n /**\r\n * For any country/region, the '-' key\r\n * For the US standard keyboard, the '-_' key\r\n */\r\n KeyCode[KeyCode[\"US_MINUS\"] = 83] = \"US_MINUS\";\r\n /**\r\n * For any country/region, the '.' key\r\n * For the US standard keyboard, the '.>' key\r\n */\r\n KeyCode[KeyCode[\"US_DOT\"] = 84] = \"US_DOT\";\r\n /**\r\n * Used for miscellaneous characters; it can vary by keyboard.\r\n * For the US standard keyboard, the '/?' key\r\n */\r\n KeyCode[KeyCode[\"US_SLASH\"] = 85] = \"US_SLASH\";\r\n /**\r\n * Used for miscellaneous characters; it can vary by keyboard.\r\n * For the US standard keyboard, the '`~' key\r\n */\r\n KeyCode[KeyCode[\"US_BACKTICK\"] = 86] = \"US_BACKTICK\";\r\n /**\r\n * Used for miscellaneous characters; it can vary by keyboard.\r\n * For the US standard keyboard, the '[{' key\r\n */\r\n KeyCode[KeyCode[\"US_OPEN_SQUARE_BRACKET\"] = 87] = \"US_OPEN_SQUARE_BRACKET\";\r\n /**\r\n * Used for miscellaneous characters; it can vary by keyboard.\r\n * For the US standard keyboard, the '\\|' key\r\n */\r\n KeyCode[KeyCode[\"US_BACKSLASH\"] = 88] = \"US_BACKSLASH\";\r\n /**\r\n * Used for miscellaneous characters; it can vary by keyboard.\r\n * For the US standard keyboard, the ']}' key\r\n */\r\n KeyCode[KeyCode[\"US_CLOSE_SQUARE_BRACKET\"] = 89] = \"US_CLOSE_SQUARE_BRACKET\";\r\n /**\r\n * Used for miscellaneous characters; it can vary by keyboard.\r\n * For the US standard keyboard, the ''\"' key\r\n */\r\n KeyCode[KeyCode[\"US_QUOTE\"] = 90] = \"US_QUOTE\";\r\n /**\r\n * Used for miscellaneous characters; it can vary by keyboard.\r\n */\r\n KeyCode[KeyCode[\"OEM_8\"] = 91] = \"OEM_8\";\r\n /**\r\n * Either the angle bracket key or the backslash key on the RT 102-key keyboard.\r\n */\r\n KeyCode[KeyCode[\"OEM_102\"] = 92] = \"OEM_102\";\r\n KeyCode[KeyCode[\"NUMPAD_0\"] = 93] = \"NUMPAD_0\";\r\n KeyCode[KeyCode[\"NUMPAD_1\"] = 94] = \"NUMPAD_1\";\r\n KeyCode[KeyCode[\"NUMPAD_2\"] = 95] = \"NUMPAD_2\";\r\n KeyCode[KeyCode[\"NUMPAD_3\"] = 96] = \"NUMPAD_3\";\r\n KeyCode[KeyCode[\"NUMPAD_4\"] = 97] = \"NUMPAD_4\";\r\n KeyCode[KeyCode[\"NUMPAD_5\"] = 98] = \"NUMPAD_5\";\r\n KeyCode[KeyCode[\"NUMPAD_6\"] = 99] = \"NUMPAD_6\";\r\n KeyCode[KeyCode[\"NUMPAD_7\"] = 100] = \"NUMPAD_7\";\r\n KeyCode[KeyCode[\"NUMPAD_8\"] = 101] = \"NUMPAD_8\";\r\n KeyCode[KeyCode[\"NUMPAD_9\"] = 102] = \"NUMPAD_9\";\r\n KeyCode[KeyCode[\"NUMPAD_MULTIPLY\"] = 103] = \"NUMPAD_MULTIPLY\";\r\n KeyCode[KeyCode[\"NUMPAD_ADD\"] = 104] = \"NUMPAD_ADD\";\r\n KeyCode[KeyCode[\"NUMPAD_SEPARATOR\"] = 105] = \"NUMPAD_SEPARATOR\";\r\n KeyCode[KeyCode[\"NUMPAD_SUBTRACT\"] = 106] = \"NUMPAD_SUBTRACT\";\r\n KeyCode[KeyCode[\"NUMPAD_DECIMAL\"] = 107] = \"NUMPAD_DECIMAL\";\r\n KeyCode[KeyCode[\"NUMPAD_DIVIDE\"] = 108] = \"NUMPAD_DIVIDE\";\r\n /**\r\n * Cover all key codes when IME is processing input.\r\n */\r\n KeyCode[KeyCode[\"KEY_IN_COMPOSITION\"] = 109] = \"KEY_IN_COMPOSITION\";\r\n KeyCode[KeyCode[\"ABNT_C1\"] = 110] = \"ABNT_C1\";\r\n KeyCode[KeyCode[\"ABNT_C2\"] = 111] = \"ABNT_C2\";\r\n /**\r\n * Placed last to cover the length of the enum.\r\n * Please do not depend on this value!\r\n */\r\n KeyCode[KeyCode[\"MAX_VALUE\"] = 112] = \"MAX_VALUE\";\r\n})(KeyCode || (KeyCode = {}));\r\nexport var MarkerSeverity;\r\n(function (MarkerSeverity) {\r\n MarkerSeverity[MarkerSeverity[\"Hint\"] = 1] = \"Hint\";\r\n MarkerSeverity[MarkerSeverity[\"Info\"] = 2] = \"Info\";\r\n MarkerSeverity[MarkerSeverity[\"Warning\"] = 4] = \"Warning\";\r\n MarkerSeverity[MarkerSeverity[\"Error\"] = 8] = \"Error\";\r\n})(MarkerSeverity || (MarkerSeverity = {}));\r\nexport var MarkerTag;\r\n(function (MarkerTag) {\r\n MarkerTag[MarkerTag[\"Unnecessary\"] = 1] = \"Unnecessary\";\r\n MarkerTag[MarkerTag[\"Deprecated\"] = 2] = \"Deprecated\";\r\n})(MarkerTag || (MarkerTag = {}));\r\n/**\r\n * Position in the minimap to render the decoration.\r\n */\r\nexport var MinimapPosition;\r\n(function (MinimapPosition) {\r\n MinimapPosition[MinimapPosition[\"Inline\"] = 1] = \"Inline\";\r\n MinimapPosition[MinimapPosition[\"Gutter\"] = 2] = \"Gutter\";\r\n})(MinimapPosition || (MinimapPosition = {}));\r\n/**\r\n * Type of hit element with the mouse in the editor.\r\n */\r\nexport var MouseTargetType;\r\n(function (MouseTargetType) {\r\n /**\r\n * Mouse is on top of an unknown element.\r\n */\r\n MouseTargetType[MouseTargetType[\"UNKNOWN\"] = 0] = \"UNKNOWN\";\r\n /**\r\n * Mouse is on top of the textarea used for input.\r\n */\r\n MouseTargetType[MouseTargetType[\"TEXTAREA\"] = 1] = \"TEXTAREA\";\r\n /**\r\n * Mouse is on top of the glyph margin\r\n */\r\n MouseTargetType[MouseTargetType[\"GUTTER_GLYPH_MARGIN\"] = 2] = \"GUTTER_GLYPH_MARGIN\";\r\n /**\r\n * Mouse is on top of the line numbers\r\n */\r\n MouseTargetType[MouseTargetType[\"GUTTER_LINE_NUMBERS\"] = 3] = \"GUTTER_LINE_NUMBERS\";\r\n /**\r\n * Mouse is on top of the line decorations\r\n */\r\n MouseTargetType[MouseTargetType[\"GUTTER_LINE_DECORATIONS\"] = 4] = \"GUTTER_LINE_DECORATIONS\";\r\n /**\r\n * Mouse is on top of the whitespace left in the gutter by a view zone.\r\n */\r\n MouseTargetType[MouseTargetType[\"GUTTER_VIEW_ZONE\"] = 5] = \"GUTTER_VIEW_ZONE\";\r\n /**\r\n * Mouse is on top of text in the content.\r\n */\r\n MouseTargetType[MouseTargetType[\"CONTENT_TEXT\"] = 6] = \"CONTENT_TEXT\";\r\n /**\r\n * Mouse is on top of empty space in the content (e.g. after line text or below last line)\r\n */\r\n MouseTargetType[MouseTargetType[\"CONTENT_EMPTY\"] = 7] = \"CONTENT_EMPTY\";\r\n /**\r\n * Mouse is on top of a view zone in the content.\r\n */\r\n MouseTargetType[MouseTargetType[\"CONTENT_VIEW_ZONE\"] = 8] = \"CONTENT_VIEW_ZONE\";\r\n /**\r\n * Mouse is on top of a content widget.\r\n */\r\n MouseTargetType[MouseTargetType[\"CONTENT_WIDGET\"] = 9] = \"CONTENT_WIDGET\";\r\n /**\r\n * Mouse is on top of the decorations overview ruler.\r\n */\r\n MouseTargetType[MouseTargetType[\"OVERVIEW_RULER\"] = 10] = \"OVERVIEW_RULER\";\r\n /**\r\n * Mouse is on top of a scrollbar.\r\n */\r\n MouseTargetType[MouseTargetType[\"SCROLLBAR\"] = 11] = \"SCROLLBAR\";\r\n /**\r\n * Mouse is on top of an overlay widget.\r\n */\r\n MouseTargetType[MouseTargetType[\"OVERLAY_WIDGET\"] = 12] = \"OVERLAY_WIDGET\";\r\n /**\r\n * Mouse is outside of the editor.\r\n */\r\n MouseTargetType[MouseTargetType[\"OUTSIDE_EDITOR\"] = 13] = \"OUTSIDE_EDITOR\";\r\n})(MouseTargetType || (MouseTargetType = {}));\r\n/**\r\n * A positioning preference for rendering overlay widgets.\r\n */\r\nexport var OverlayWidgetPositionPreference;\r\n(function (OverlayWidgetPositionPreference) {\r\n /**\r\n * Position the overlay widget in the top right corner\r\n */\r\n OverlayWidgetPositionPreference[OverlayWidgetPositionPreference[\"TOP_RIGHT_CORNER\"] = 0] = \"TOP_RIGHT_CORNER\";\r\n /**\r\n * Position the overlay widget in the bottom right corner\r\n */\r\n OverlayWidgetPositionPreference[OverlayWidgetPositionPreference[\"BOTTOM_RIGHT_CORNER\"] = 1] = \"BOTTOM_RIGHT_CORNER\";\r\n /**\r\n * Position the overlay widget in the top center\r\n */\r\n OverlayWidgetPositionPreference[OverlayWidgetPositionPreference[\"TOP_CENTER\"] = 2] = \"TOP_CENTER\";\r\n})(OverlayWidgetPositionPreference || (OverlayWidgetPositionPreference = {}));\r\n/**\r\n * Vertical Lane in the overview ruler of the editor.\r\n */\r\nexport var OverviewRulerLane;\r\n(function (OverviewRulerLane) {\r\n OverviewRulerLane[OverviewRulerLane[\"Left\"] = 1] = \"Left\";\r\n OverviewRulerLane[OverviewRulerLane[\"Center\"] = 2] = \"Center\";\r\n OverviewRulerLane[OverviewRulerLane[\"Right\"] = 4] = \"Right\";\r\n OverviewRulerLane[OverviewRulerLane[\"Full\"] = 7] = \"Full\";\r\n})(OverviewRulerLane || (OverviewRulerLane = {}));\r\nexport var RenderLineNumbersType;\r\n(function (RenderLineNumbersType) {\r\n RenderLineNumbersType[RenderLineNumbersType[\"Off\"] = 0] = \"Off\";\r\n RenderLineNumbersType[RenderLineNumbersType[\"On\"] = 1] = \"On\";\r\n RenderLineNumbersType[RenderLineNumbersType[\"Relative\"] = 2] = \"Relative\";\r\n RenderLineNumbersType[RenderLineNumbersType[\"Interval\"] = 3] = \"Interval\";\r\n RenderLineNumbersType[RenderLineNumbersType[\"Custom\"] = 4] = \"Custom\";\r\n})(RenderLineNumbersType || (RenderLineNumbersType = {}));\r\nexport var RenderMinimap;\r\n(function (RenderMinimap) {\r\n RenderMinimap[RenderMinimap[\"None\"] = 0] = \"None\";\r\n RenderMinimap[RenderMinimap[\"Text\"] = 1] = \"Text\";\r\n RenderMinimap[RenderMinimap[\"Blocks\"] = 2] = \"Blocks\";\r\n})(RenderMinimap || (RenderMinimap = {}));\r\nexport var ScrollType;\r\n(function (ScrollType) {\r\n ScrollType[ScrollType[\"Smooth\"] = 0] = \"Smooth\";\r\n ScrollType[ScrollType[\"Immediate\"] = 1] = \"Immediate\";\r\n})(ScrollType || (ScrollType = {}));\r\nexport var ScrollbarVisibility;\r\n(function (ScrollbarVisibility) {\r\n ScrollbarVisibility[ScrollbarVisibility[\"Auto\"] = 1] = \"Auto\";\r\n ScrollbarVisibility[ScrollbarVisibility[\"Hidden\"] = 2] = \"Hidden\";\r\n ScrollbarVisibility[ScrollbarVisibility[\"Visible\"] = 3] = \"Visible\";\r\n})(ScrollbarVisibility || (ScrollbarVisibility = {}));\r\n/**\r\n * The direction of a selection.\r\n */\r\nexport var SelectionDirection;\r\n(function (SelectionDirection) {\r\n /**\r\n * The selection starts above where it ends.\r\n */\r\n SelectionDirection[SelectionDirection[\"LTR\"] = 0] = \"LTR\";\r\n /**\r\n * The selection starts below where it ends.\r\n */\r\n SelectionDirection[SelectionDirection[\"RTL\"] = 1] = \"RTL\";\r\n})(SelectionDirection || (SelectionDirection = {}));\r\nexport var SignatureHelpTriggerKind;\r\n(function (SignatureHelpTriggerKind) {\r\n SignatureHelpTriggerKind[SignatureHelpTriggerKind[\"Invoke\"] = 1] = \"Invoke\";\r\n SignatureHelpTriggerKind[SignatureHelpTriggerKind[\"TriggerCharacter\"] = 2] = \"TriggerCharacter\";\r\n SignatureHelpTriggerKind[SignatureHelpTriggerKind[\"ContentChange\"] = 3] = \"ContentChange\";\r\n})(SignatureHelpTriggerKind || (SignatureHelpTriggerKind = {}));\r\n/**\r\n * A symbol kind.\r\n */\r\nexport var SymbolKind;\r\n(function (SymbolKind) {\r\n SymbolKind[SymbolKind[\"File\"] = 0] = \"File\";\r\n SymbolKind[SymbolKind[\"Module\"] = 1] = \"Module\";\r\n SymbolKind[SymbolKind[\"Namespace\"] = 2] = \"Namespace\";\r\n SymbolKind[SymbolKind[\"Package\"] = 3] = \"Package\";\r\n SymbolKind[SymbolKind[\"Class\"] = 4] = \"Class\";\r\n SymbolKind[SymbolKind[\"Method\"] = 5] = \"Method\";\r\n SymbolKind[SymbolKind[\"Property\"] = 6] = \"Property\";\r\n SymbolKind[SymbolKind[\"Field\"] = 7] = \"Field\";\r\n SymbolKind[SymbolKind[\"Constructor\"] = 8] = \"Constructor\";\r\n SymbolKind[SymbolKind[\"Enum\"] = 9] = \"Enum\";\r\n SymbolKind[SymbolKind[\"Interface\"] = 10] = \"Interface\";\r\n SymbolKind[SymbolKind[\"Function\"] = 11] = \"Function\";\r\n SymbolKind[SymbolKind[\"Variable\"] = 12] = \"Variable\";\r\n SymbolKind[SymbolKind[\"Constant\"] = 13] = \"Constant\";\r\n SymbolKind[SymbolKind[\"String\"] = 14] = \"String\";\r\n SymbolKind[SymbolKind[\"Number\"] = 15] = \"Number\";\r\n SymbolKind[SymbolKind[\"Boolean\"] = 16] = \"Boolean\";\r\n SymbolKind[SymbolKind[\"Array\"] = 17] = \"Array\";\r\n SymbolKind[SymbolKind[\"Object\"] = 18] = \"Object\";\r\n SymbolKind[SymbolKind[\"Key\"] = 19] = \"Key\";\r\n SymbolKind[SymbolKind[\"Null\"] = 20] = \"Null\";\r\n SymbolKind[SymbolKind[\"EnumMember\"] = 21] = \"EnumMember\";\r\n SymbolKind[SymbolKind[\"Struct\"] = 22] = \"Struct\";\r\n SymbolKind[SymbolKind[\"Event\"] = 23] = \"Event\";\r\n SymbolKind[SymbolKind[\"Operator\"] = 24] = \"Operator\";\r\n SymbolKind[SymbolKind[\"TypeParameter\"] = 25] = \"TypeParameter\";\r\n})(SymbolKind || (SymbolKind = {}));\r\nexport var SymbolTag;\r\n(function (SymbolTag) {\r\n SymbolTag[SymbolTag[\"Deprecated\"] = 1] = \"Deprecated\";\r\n})(SymbolTag || (SymbolTag = {}));\r\n/**\r\n * The kind of animation in which the editor's cursor should be rendered.\r\n */\r\nexport var TextEditorCursorBlinkingStyle;\r\n(function (TextEditorCursorBlinkingStyle) {\r\n /**\r\n * Hidden\r\n */\r\n TextEditorCursorBlinkingStyle[TextEditorCursorBlinkingStyle[\"Hidden\"] = 0] = \"Hidden\";\r\n /**\r\n * Blinking\r\n */\r\n TextEditorCursorBlinkingStyle[TextEditorCursorBlinkingStyle[\"Blink\"] = 1] = \"Blink\";\r\n /**\r\n * Blinking with smooth fading\r\n */\r\n TextEditorCursorBlinkingStyle[TextEditorCursorBlinkingStyle[\"Smooth\"] = 2] = \"Smooth\";\r\n /**\r\n * Blinking with prolonged filled state and smooth fading\r\n */\r\n TextEditorCursorBlinkingStyle[TextEditorCursorBlinkingStyle[\"Phase\"] = 3] = \"Phase\";\r\n /**\r\n * Expand collapse animation on the y axis\r\n */\r\n TextEditorCursorBlinkingStyle[TextEditorCursorBlinkingStyle[\"Expand\"] = 4] = \"Expand\";\r\n /**\r\n * No-Blinking\r\n */\r\n TextEditorCursorBlinkingStyle[TextEditorCursorBlinkingStyle[\"Solid\"] = 5] = \"Solid\";\r\n})(TextEditorCursorBlinkingStyle || (TextEditorCursorBlinkingStyle = {}));\r\n/**\r\n * The style in which the editor's cursor should be rendered.\r\n */\r\nexport var TextEditorCursorStyle;\r\n(function (TextEditorCursorStyle) {\r\n /**\r\n * As a vertical line (sitting between two characters).\r\n */\r\n TextEditorCursorStyle[TextEditorCursorStyle[\"Line\"] = 1] = \"Line\";\r\n /**\r\n * As a block (sitting on top of a character).\r\n */\r\n TextEditorCursorStyle[TextEditorCursorStyle[\"Block\"] = 2] = \"Block\";\r\n /**\r\n * As a horizontal line (sitting under a character).\r\n */\r\n TextEditorCursorStyle[TextEditorCursorStyle[\"Underline\"] = 3] = \"Underline\";\r\n /**\r\n * As a thin vertical line (sitting between two characters).\r\n */\r\n TextEditorCursorStyle[TextEditorCursorStyle[\"LineThin\"] = 4] = \"LineThin\";\r\n /**\r\n * As an outlined block (sitting on top of a character).\r\n */\r\n TextEditorCursorStyle[TextEditorCursorStyle[\"BlockOutline\"] = 5] = \"BlockOutline\";\r\n /**\r\n * As a thin horizontal line (sitting under a character).\r\n */\r\n TextEditorCursorStyle[TextEditorCursorStyle[\"UnderlineThin\"] = 6] = \"UnderlineThin\";\r\n})(TextEditorCursorStyle || (TextEditorCursorStyle = {}));\r\n/**\r\n * Describes the behavior of decorations when typing/editing near their edges.\r\n * Note: Please do not edit the values, as they very carefully match `DecorationRangeBehavior`\r\n */\r\nexport var TrackedRangeStickiness;\r\n(function (TrackedRangeStickiness) {\r\n TrackedRangeStickiness[TrackedRangeStickiness[\"AlwaysGrowsWhenTypingAtEdges\"] = 0] = \"AlwaysGrowsWhenTypingAtEdges\";\r\n TrackedRangeStickiness[TrackedRangeStickiness[\"NeverGrowsWhenTypingAtEdges\"] = 1] = \"NeverGrowsWhenTypingAtEdges\";\r\n TrackedRangeStickiness[TrackedRangeStickiness[\"GrowsOnlyWhenTypingBefore\"] = 2] = \"GrowsOnlyWhenTypingBefore\";\r\n TrackedRangeStickiness[TrackedRangeStickiness[\"GrowsOnlyWhenTypingAfter\"] = 3] = \"GrowsOnlyWhenTypingAfter\";\r\n})(TrackedRangeStickiness || (TrackedRangeStickiness = {}));\r\n/**\r\n * Describes how to indent wrapped lines.\r\n */\r\nexport var WrappingIndent;\r\n(function (WrappingIndent) {\r\n /**\r\n * No indentation => wrapped lines begin at column 1.\r\n */\r\n WrappingIndent[WrappingIndent[\"None\"] = 0] = \"None\";\r\n /**\r\n * Same => wrapped lines get the same indentation as the parent.\r\n */\r\n WrappingIndent[WrappingIndent[\"Same\"] = 1] = \"Same\";\r\n /**\r\n * Indent => wrapped lines get +1 indentation toward the parent.\r\n */\r\n WrappingIndent[WrappingIndent[\"Indent\"] = 2] = \"Indent\";\r\n /**\r\n * DeepIndent => wrapped lines get +2 indentation toward the parent.\r\n */\r\n WrappingIndent[WrappingIndent[\"DeepIndent\"] = 3] = \"DeepIndent\";\r\n})(WrappingIndent || (WrappingIndent = {}));\r\n", "/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License. See License.txt in the project root for license information.\r\n *--------------------------------------------------------------------------------------------*/\r\nimport { CancellationTokenSource } from '../../../base/common/cancellation.js';\r\nimport { Emitter } from '../../../base/common/event.js';\r\nimport { KeyChord } from '../../../base/common/keyCodes.js';\r\nimport { URI } from '../../../base/common/uri.js';\r\nimport { Position } from '../core/position.js';\r\nimport { Range } from '../core/range.js';\r\nimport { Selection } from '../core/selection.js';\r\nimport { Token } from '../core/token.js';\r\nimport * as standaloneEnums from './standaloneEnums.js';\r\nexport class KeyMod {\r\n static chord(firstPart, secondPart) {\r\n return KeyChord(firstPart, secondPart);\r\n }\r\n}\r\nKeyMod.CtrlCmd = 2048 /* CtrlCmd */;\r\nKeyMod.Shift = 1024 /* Shift */;\r\nKeyMod.Alt = 512 /* Alt */;\r\nKeyMod.WinCtrl = 256 /* WinCtrl */;\r\nexport function createMonacoBaseAPI() {\r\n return {\r\n editor: undefined,\r\n languages: undefined,\r\n CancellationTokenSource: CancellationTokenSource,\r\n Emitter: Emitter,\r\n KeyCode: standaloneEnums.KeyCode,\r\n KeyMod: KeyMod,\r\n Position: Position,\r\n Range: Range,\r\n Selection: Selection,\r\n SelectionDirection: standaloneEnums.SelectionDirection,\r\n MarkerSeverity: standaloneEnums.MarkerSeverity,\r\n MarkerTag: standaloneEnums.MarkerTag,\r\n Uri: URI,\r\n Token: Token\r\n };\r\n}\r\n", "/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License. See License.txt in the project root for license information.\r\n *--------------------------------------------------------------------------------------------*/\r\nimport { VSBuffer } from './buffer.js';\r\nimport { URI } from './uri.js';\r\nexport function parse(text) {\r\n let data = JSON.parse(text);\r\n data = revive(data);\r\n return data;\r\n}\r\nexport function revive(obj, depth = 0) {\r\n if (!obj || depth > 200) {\r\n return obj;\r\n }\r\n if (typeof obj === 'object') {\r\n switch (obj.$mid) {\r\n case 1 /* Uri */: return URI.revive(obj);\r\n case 2 /* Regexp */: return new RegExp(obj.source, obj.flags);\r\n }\r\n if (obj instanceof VSBuffer\r\n || obj instanceof Uint8Array) {\r\n return obj;\r\n }\r\n if (Array.isArray(obj)) {\r\n for (let i = 0; i < obj.length; ++i) {\r\n obj[i] = revive(obj[i], depth + 1);\r\n }\r\n }\r\n else {\r\n // walk object\r\n for (const key in obj) {\r\n if (Object.hasOwnProperty.call(obj, key)) {\r\n obj[key] = revive(obj[key], depth + 1);\r\n }\r\n }\r\n }\r\n }\r\n return obj;\r\n}\r\n", "/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License. See License.txt in the project root for license information.\r\n *--------------------------------------------------------------------------------------------*/\r\nexport var EditorOpenContext;\r\n(function (EditorOpenContext) {\r\n /**\r\n * Default: the editor is opening via a programmatic call\r\n * to the editor service API.\r\n */\r\n EditorOpenContext[EditorOpenContext[\"API\"] = 0] = \"API\";\r\n /**\r\n * Indicates that a user action triggered the opening, e.g.\r\n * via mouse or keyboard use.\r\n */\r\n EditorOpenContext[EditorOpenContext[\"USER\"] = 1] = \"USER\";\r\n})(EditorOpenContext || (EditorOpenContext = {}));\r\n", "/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License. See License.txt in the project root for license information.\r\n *--------------------------------------------------------------------------------------------*/\r\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\r\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n};\r\nimport { Disposable } from '../../../base/common/lifecycle.js';\r\nimport { equalsIgnoreCase, startsWithIgnoreCase } from '../../../base/common/strings.js';\r\nimport { URI } from '../../../base/common/uri.js';\r\nimport { createDecorator } from '../../instantiation/common/instantiation.js';\r\nexport const IOpenerService = createDecorator('openerService');\r\nexport const NullOpenerService = Object.freeze({\r\n _serviceBrand: undefined,\r\n registerOpener() { return Disposable.None; },\r\n registerValidator() { return Disposable.None; },\r\n registerExternalUriResolver() { return Disposable.None; },\r\n setDefaultExternalOpener() { },\r\n registerExternalOpener() { return Disposable.None; },\r\n open() {\r\n return __awaiter(this, void 0, void 0, function* () { return false; });\r\n },\r\n resolveExternalUri(uri) {\r\n return __awaiter(this, void 0, void 0, function* () { return { resolved: uri, dispose() { } }; });\r\n },\r\n});\r\nexport function matchesScheme(target, scheme) {\r\n if (URI.isUri(target)) {\r\n return equalsIgnoreCase(target.scheme, scheme);\r\n }\r\n else {\r\n return startsWithIgnoreCase(target, scheme + ':');\r\n }\r\n}\r\n", "/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License. See License.txt in the project root for license information.\r\n *--------------------------------------------------------------------------------------------*/\r\nvar __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n};\r\nvar __param = (this && this.__param) || function (paramIndex, decorator) {\r\n return function (target, key) { decorator(target, key, paramIndex); }\r\n};\r\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\r\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n};\r\nimport * as dom from '../../../base/browser/dom.js';\r\nimport { CancellationToken } from '../../../base/common/cancellation.js';\r\nimport { LinkedList } from '../../../base/common/linkedList.js';\r\nimport { ResourceMap } from '../../../base/common/map.js';\r\nimport { parse } from '../../../base/common/marshalling.js';\r\nimport { Schemas } from '../../../base/common/network.js';\r\nimport { normalizePath } from '../../../base/common/resources.js';\r\nimport { URI } from '../../../base/common/uri.js';\r\nimport { ICodeEditorService } from './codeEditorService.js';\r\nimport { ICommandService } from '../../../platform/commands/common/commands.js';\r\nimport { EditorOpenContext } from '../../../platform/editor/common/editor.js';\r\nimport { matchesScheme } from '../../../platform/opener/common/opener.js';\r\nlet CommandOpener = class CommandOpener {\r\n constructor(_commandService) {\r\n this._commandService = _commandService;\r\n }\r\n open(target, options) {\r\n return __awaiter(this, void 0, void 0, function* () {\r\n if (!matchesScheme(target, Schemas.command)) {\r\n return false;\r\n }\r\n if (!(options === null || options === void 0 ? void 0 : options.allowCommands)) {\r\n // silently ignore commands when command-links are disabled, also\r\n // surpress other openers by returning TRUE\r\n return true;\r\n }\r\n // run command or bail out if command isn't known\r\n if (typeof target === 'string') {\r\n target = URI.parse(target);\r\n }\r\n // execute as command\r\n let args = [];\r\n try {\r\n args = parse(decodeURIComponent(target.query));\r\n }\r\n catch (_a) {\r\n // ignore and retry\r\n try {\r\n args = parse(target.query);\r\n }\r\n catch (_b) {\r\n // ignore error\r\n }\r\n }\r\n if (!Array.isArray(args)) {\r\n args = [args];\r\n }\r\n yield this._commandService.executeCommand(target.path, ...args);\r\n return true;\r\n });\r\n }\r\n};\r\nCommandOpener = __decorate([\r\n __param(0, ICommandService)\r\n], CommandOpener);\r\nlet EditorOpener = class EditorOpener {\r\n constructor(_editorService) {\r\n this._editorService = _editorService;\r\n }\r\n open(target, options) {\r\n return __awaiter(this, void 0, void 0, function* () {\r\n if (typeof target === 'string') {\r\n target = URI.parse(target);\r\n }\r\n let selection = undefined;\r\n const match = /^L?(\\d+)(?:,(\\d+))?/.exec(target.fragment);\r\n if (match) {\r\n // support file:///some/file.js#73,84\r\n // support file:///some/file.js#L73\r\n selection = {\r\n startLineNumber: parseInt(match[1]),\r\n startColumn: match[2] ? parseInt(match[2]) : 1\r\n };\r\n // remove fragment\r\n target = target.with({ fragment: '' });\r\n }\r\n if (target.scheme === Schemas.file) {\r\n target = normalizePath(target); // workaround for non-normalized paths (https://github.com/microsoft/vscode/issues/12954)\r\n }\r\n yield this._editorService.openCodeEditor({\r\n resource: target,\r\n options: Object.assign({ selection, context: (options === null || options === void 0 ? void 0 : options.fromUserGesture) ? EditorOpenContext.USER : EditorOpenContext.API }, options === null || options === void 0 ? void 0 : options.editorOptions)\r\n }, this._editorService.getFocusedCodeEditor(), options === null || options === void 0 ? void 0 : options.openToSide);\r\n return true;\r\n });\r\n }\r\n};\r\nEditorOpener = __decorate([\r\n __param(0, ICodeEditorService)\r\n], EditorOpener);\r\nlet OpenerService = class OpenerService {\r\n constructor(editorService, commandService) {\r\n this._openers = new LinkedList();\r\n this._validators = new LinkedList();\r\n this._resolvers = new LinkedList();\r\n this._resolvedUriTargets = new ResourceMap(uri => uri.with({ path: null, fragment: null, query: null }).toString());\r\n this._externalOpeners = new LinkedList();\r\n // Default external opener is going through window.open()\r\n this._defaultExternalOpener = {\r\n openExternal: (href) => __awaiter(this, void 0, void 0, function* () {\r\n // ensure to open HTTP/HTTPS links into new windows\r\n // to not trigger a navigation. Any other link is\r\n // safe to be set as HREF to prevent a blank window\r\n // from opening.\r\n if (matchesScheme(href, Schemas.http) || matchesScheme(href, Schemas.https)) {\r\n dom.windowOpenNoOpener(href);\r\n }\r\n else {\r\n window.location.href = href;\r\n }\r\n return true;\r\n })\r\n };\r\n // Default opener: any external, maito, http(s), command, and catch-all-editors\r\n this._openers.push({\r\n open: (target, options) => __awaiter(this, void 0, void 0, function* () {\r\n if ((options === null || options === void 0 ? void 0 : options.openExternal) || matchesScheme(target, Schemas.mailto) || matchesScheme(target, Schemas.http) || matchesScheme(target, Schemas.https)) {\r\n // open externally\r\n yield this._doOpenExternal(target, options);\r\n return true;\r\n }\r\n return false;\r\n })\r\n });\r\n this._openers.push(new CommandOpener(commandService));\r\n this._openers.push(new EditorOpener(editorService));\r\n }\r\n registerOpener(opener) {\r\n const remove = this._openers.unshift(opener);\r\n return { dispose: remove };\r\n }\r\n registerValidator(validator) {\r\n const remove = this._validators.push(validator);\r\n return { dispose: remove };\r\n }\r\n registerExternalUriResolver(resolver) {\r\n const remove = this._resolvers.push(resolver);\r\n return { dispose: remove };\r\n }\r\n setDefaultExternalOpener(externalOpener) {\r\n this._defaultExternalOpener = externalOpener;\r\n }\r\n registerExternalOpener(opener) {\r\n const remove = this._externalOpeners.push(opener);\r\n return { dispose: remove };\r\n }\r\n open(target, options) {\r\n var _a;\r\n return __awaiter(this, void 0, void 0, function* () {\r\n // check with contributed validators\r\n const targetURI = typeof target === 'string' ? URI.parse(target) : target;\r\n // validate against the original URI that this URI resolves to, if one exists\r\n const validationTarget = (_a = this._resolvedUriTargets.get(targetURI)) !== null && _a !== void 0 ? _a : target;\r\n for (const validator of this._validators) {\r\n if (!(yield validator.shouldOpen(validationTarget))) {\r\n return false;\r\n }\r\n }\r\n // check with contributed openers\r\n for (const opener of this._openers) {\r\n const handled = yield opener.open(target, options);\r\n if (handled) {\r\n return true;\r\n }\r\n }\r\n return false;\r\n });\r\n }\r\n resolveExternalUri(resource, options) {\r\n return __awaiter(this, void 0, void 0, function* () {\r\n for (const resolver of this._resolvers) {\r\n try {\r\n const result = yield resolver.resolveExternalUri(resource, options);\r\n if (result) {\r\n if (!this._resolvedUriTargets.has(result.resolved)) {\r\n this._resolvedUriTargets.set(result.resolved, resource);\r\n }\r\n return result;\r\n }\r\n }\r\n catch (_a) {\r\n // noop\r\n }\r\n }\r\n throw new Error('Could not resolve external URI: ' + resource.toString());\r\n });\r\n }\r\n _doOpenExternal(resource, options) {\r\n return __awaiter(this, void 0, void 0, function* () {\r\n //todo@jrieken IExternalUriResolver should support `uri: URI | string`\r\n const uri = typeof resource === 'string' ? URI.parse(resource) : resource;\r\n let externalUri;\r\n try {\r\n externalUri = (yield this.resolveExternalUri(uri, options)).resolved;\r\n }\r\n catch (_a) {\r\n externalUri = uri;\r\n }\r\n let href;\r\n if (typeof resource === 'string' && uri.toString() === externalUri.toString()) {\r\n // open the url-string AS IS\r\n href = resource;\r\n }\r\n else {\r\n // open URI using the toString(noEncode)+encodeURI-trick\r\n href = encodeURI(externalUri.toString(true));\r\n }\r\n if (options === null || options === void 0 ? void 0 : options.allowContributedOpeners) {\r\n const preferredOpenerId = typeof (options === null || options === void 0 ? void 0 : options.allowContributedOpeners) === 'string' ? options === null || options === void 0 ? void 0 : options.allowContributedOpeners : undefined;\r\n for (const opener of this._externalOpeners) {\r\n const didOpen = yield opener.openExternal(href, {\r\n sourceUri: uri,\r\n preferredOpenerId,\r\n }, CancellationToken.None);\r\n if (didOpen) {\r\n return true;\r\n }\r\n }\r\n }\r\n return this._defaultExternalOpener.openExternal(href, { sourceUri: uri }, CancellationToken.None);\r\n });\r\n }\r\n dispose() {\r\n this._validators.clear();\r\n }\r\n};\r\nOpenerService = __decorate([\r\n __param(0, ICodeEditorService),\r\n __param(1, ICommandService)\r\n], OpenerService);\r\nexport { OpenerService };\r\n", "/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License. See License.txt in the project root for license information.\r\n *--------------------------------------------------------------------------------------------*/\r\nimport { isObject, isUndefinedOrNull, isArray } from './types.js';\r\nexport function deepClone(obj) {\r\n if (!obj || typeof obj !== 'object') {\r\n return obj;\r\n }\r\n if (obj instanceof RegExp) {\r\n // See https://github.com/microsoft/TypeScript/issues/10990\r\n return obj;\r\n }\r\n const result = Array.isArray(obj) ? [] : {};\r\n Object.keys(obj).forEach((key) => {\r\n if (obj[key] && typeof obj[key] === 'object') {\r\n result[key] = deepClone(obj[key]);\r\n }\r\n else {\r\n result[key] = obj[key];\r\n }\r\n });\r\n return result;\r\n}\r\nexport function deepFreeze(obj) {\r\n if (!obj || typeof obj !== 'object') {\r\n return obj;\r\n }\r\n const stack = [obj];\r\n while (stack.length > 0) {\r\n const obj = stack.shift();\r\n Object.freeze(obj);\r\n for (const key in obj) {\r\n if (_hasOwnProperty.call(obj, key)) {\r\n const prop = obj[key];\r\n if (typeof prop === 'object' && !Object.isFrozen(prop)) {\r\n stack.push(prop);\r\n }\r\n }\r\n }\r\n }\r\n return obj;\r\n}\r\nconst _hasOwnProperty = Object.prototype.hasOwnProperty;\r\nexport function cloneAndChange(obj, changer) {\r\n return _cloneAndChange(obj, changer, new Set());\r\n}\r\nfunction _cloneAndChange(obj, changer, seen) {\r\n if (isUndefinedOrNull(obj)) {\r\n return obj;\r\n }\r\n const changed = changer(obj);\r\n if (typeof changed !== 'undefined') {\r\n return changed;\r\n }\r\n if (isArray(obj)) {\r\n const r1 = [];\r\n for (const e of obj) {\r\n r1.push(_cloneAndChange(e, changer, seen));\r\n }\r\n return r1;\r\n }\r\n if (isObject(obj)) {\r\n if (seen.has(obj)) {\r\n throw new Error('Cannot clone recursive data-structure');\r\n }\r\n seen.add(obj);\r\n const r2 = {};\r\n for (let i2 in obj) {\r\n if (_hasOwnProperty.call(obj, i2)) {\r\n r2[i2] = _cloneAndChange(obj[i2], changer, seen);\r\n }\r\n }\r\n seen.delete(obj);\r\n return r2;\r\n }\r\n return obj;\r\n}\r\n/**\r\n * Copies all properties of source into destination. The optional parameter \"overwrite\" allows to control\r\n * if existing properties on the destination should be overwritten or not. Defaults to true (overwrite).\r\n */\r\nexport function mixin(destination, source, overwrite = true) {\r\n if (!isObject(destination)) {\r\n return source;\r\n }\r\n if (isObject(source)) {\r\n Object.keys(source).forEach(key => {\r\n if (key in destination) {\r\n if (overwrite) {\r\n if (isObject(destination[key]) && isObject(source[key])) {\r\n mixin(destination[key], source[key], overwrite);\r\n }\r\n else {\r\n destination[key] = source[key];\r\n }\r\n }\r\n }\r\n else {\r\n destination[key] = source[key];\r\n }\r\n });\r\n }\r\n return destination;\r\n}\r\nexport function equals(one, other) {\r\n if (one === other) {\r\n return true;\r\n }\r\n if (one === null || one === undefined || other === null || other === undefined) {\r\n return false;\r\n }\r\n if (typeof one !== typeof other) {\r\n return false;\r\n }\r\n if (typeof one !== 'object') {\r\n return false;\r\n }\r\n if ((Array.isArray(one)) !== (Array.isArray(other))) {\r\n return false;\r\n }\r\n let i;\r\n let key;\r\n if (Array.isArray(one)) {\r\n if (one.length !== other.length) {\r\n return false;\r\n }\r\n for (i = 0; i < one.length; i++) {\r\n if (!equals(one[i], other[i])) {\r\n return false;\r\n }\r\n }\r\n }\r\n else {\r\n const oneKeys = [];\r\n for (key in one) {\r\n oneKeys.push(key);\r\n }\r\n oneKeys.sort();\r\n const otherKeys = [];\r\n for (key in other) {\r\n otherKeys.push(key);\r\n }\r\n otherKeys.sort();\r\n if (!equals(oneKeys, otherKeys)) {\r\n return false;\r\n }\r\n for (i = 0; i < oneKeys.length; i++) {\r\n if (!equals(one[oneKeys[i]], other[oneKeys[i]])) {\r\n return false;\r\n }\r\n }\r\n }\r\n return true;\r\n}\r\nexport function getOrDefault(obj, fn, defaultValue) {\r\n const result = fn(obj);\r\n return typeof result === 'undefined' ? defaultValue : result;\r\n}\r\n", "/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License. See License.txt in the project root for license information.\r\n *--------------------------------------------------------------------------------------------*/\r\nimport * as assert from '../../../base/common/assert.js';\r\nimport { Emitter } from '../../../base/common/event.js';\r\nimport { Disposable } from '../../../base/common/lifecycle.js';\r\nimport * as objects from '../../../base/common/objects.js';\r\nimport { Range } from '../../common/core/range.js';\r\nconst defaultOptions = {\r\n followsCaret: true,\r\n ignoreCharChanges: true,\r\n alwaysRevealFirst: true\r\n};\r\n/**\r\n * Create a new diff navigator for the provided diff editor.\r\n */\r\nexport class DiffNavigator extends Disposable {\r\n constructor(editor, options = {}) {\r\n super();\r\n this._onDidUpdate = this._register(new Emitter());\r\n this._editor = editor;\r\n this._options = objects.mixin(options, defaultOptions, false);\r\n this.disposed = false;\r\n this.nextIdx = -1;\r\n this.ranges = [];\r\n this.ignoreSelectionChange = false;\r\n this.revealFirst = Boolean(this._options.alwaysRevealFirst);\r\n // hook up to diff editor for diff, disposal, and caret move\r\n this._register(this._editor.onDidDispose(() => this.dispose()));\r\n this._register(this._editor.onDidUpdateDiff(() => this._onDiffUpdated()));\r\n if (this._options.followsCaret) {\r\n this._register(this._editor.getModifiedEditor().onDidChangeCursorPosition((e) => {\r\n if (this.ignoreSelectionChange) {\r\n return;\r\n }\r\n this.nextIdx = -1;\r\n }));\r\n }\r\n if (this._options.alwaysRevealFirst) {\r\n this._register(this._editor.getModifiedEditor().onDidChangeModel((e) => {\r\n this.revealFirst = true;\r\n }));\r\n }\r\n // init things\r\n this._init();\r\n }\r\n _init() {\r\n let changes = this._editor.getLineChanges();\r\n if (!changes) {\r\n return;\r\n }\r\n }\r\n _onDiffUpdated() {\r\n this._init();\r\n this._compute(this._editor.getLineChanges());\r\n if (this.revealFirst) {\r\n // Only reveal first on first non-null changes\r\n if (this._editor.getLineChanges() !== null) {\r\n this.revealFirst = false;\r\n this.nextIdx = -1;\r\n this.next(1 /* Immediate */);\r\n }\r\n }\r\n }\r\n _compute(lineChanges) {\r\n // new ranges\r\n this.ranges = [];\r\n if (lineChanges) {\r\n // create ranges from changes\r\n lineChanges.forEach((lineChange) => {\r\n if (!this._options.ignoreCharChanges && lineChange.charChanges) {\r\n lineChange.charChanges.forEach((charChange) => {\r\n this.ranges.push({\r\n rhs: true,\r\n range: new Range(charChange.modifiedStartLineNumber, charChange.modifiedStartColumn, charChange.modifiedEndLineNumber, charChange.modifiedEndColumn)\r\n });\r\n });\r\n }\r\n else {\r\n this.ranges.push({\r\n rhs: true,\r\n range: new Range(lineChange.modifiedStartLineNumber, 1, lineChange.modifiedStartLineNumber, 1)\r\n });\r\n }\r\n });\r\n }\r\n // sort\r\n this.ranges.sort((left, right) => {\r\n if (left.range.getStartPosition().isBeforeOrEqual(right.range.getStartPosition())) {\r\n return -1;\r\n }\r\n else if (right.range.getStartPosition().isBeforeOrEqual(left.range.getStartPosition())) {\r\n return 1;\r\n }\r\n else {\r\n return 0;\r\n }\r\n });\r\n this._onDidUpdate.fire(this);\r\n }\r\n _initIdx(fwd) {\r\n let found = false;\r\n let position = this._editor.getPosition();\r\n if (!position) {\r\n this.nextIdx = 0;\r\n return;\r\n }\r\n for (let i = 0, len = this.ranges.length; i < len && !found; i++) {\r\n let range = this.ranges[i].range;\r\n if (position.isBeforeOrEqual(range.getStartPosition())) {\r\n this.nextIdx = i + (fwd ? 0 : -1);\r\n found = true;\r\n }\r\n }\r\n if (!found) {\r\n // after the last change\r\n this.nextIdx = fwd ? 0 : this.ranges.length - 1;\r\n }\r\n if (this.nextIdx < 0) {\r\n this.nextIdx = this.ranges.length - 1;\r\n }\r\n }\r\n _move(fwd, scrollType) {\r\n assert.ok(!this.disposed, 'Illegal State - diff navigator has been disposed');\r\n if (!this.canNavigate()) {\r\n return;\r\n }\r\n if (this.nextIdx === -1) {\r\n this._initIdx(fwd);\r\n }\r\n else if (fwd) {\r\n this.nextIdx += 1;\r\n if (this.nextIdx >= this.ranges.length) {\r\n this.nextIdx = 0;\r\n }\r\n }\r\n else {\r\n this.nextIdx -= 1;\r\n if (this.nextIdx < 0) {\r\n this.nextIdx = this.ranges.length - 1;\r\n }\r\n }\r\n let info = this.ranges[this.nextIdx];\r\n this.ignoreSelectionChange = true;\r\n try {\r\n let pos = info.range.getStartPosition();\r\n this._editor.setPosition(pos);\r\n this._editor.revealPositionInCenter(pos, scrollType);\r\n }\r\n finally {\r\n this.ignoreSelectionChange = false;\r\n }\r\n }\r\n canNavigate() {\r\n return this.ranges && this.ranges.length > 0;\r\n }\r\n next(scrollType = 0 /* Smooth */) {\r\n this._move(true, scrollType);\r\n }\r\n previous(scrollType = 0 /* Smooth */) {\r\n this._move(false, scrollType);\r\n }\r\n dispose() {\r\n super.dispose();\r\n this.ranges = [];\r\n this.disposed = true;\r\n }\r\n}\r\n", "/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License. See License.txt in the project root for license information.\r\n *--------------------------------------------------------------------------------------------*/\r\nimport { Emitter } from '../../../base/common/event.js';\r\nexport const EditorZoom = new class {\r\n constructor() {\r\n this._zoomLevel = 0;\r\n this._onDidChangeZoomLevel = new Emitter();\r\n this.onDidChangeZoomLevel = this._onDidChangeZoomLevel.event;\r\n }\r\n getZoomLevel() {\r\n return this._zoomLevel;\r\n }\r\n setZoomLevel(zoomLevel) {\r\n zoomLevel = Math.min(Math.max(-5, zoomLevel), 20);\r\n if (this._zoomLevel === zoomLevel) {\r\n return;\r\n }\r\n this._zoomLevel = zoomLevel;\r\n this._onDidChangeZoomLevel.fire(this._zoomLevel);\r\n }\r\n};\r\n", "/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License. See License.txt in the project root for license information.\r\n *--------------------------------------------------------------------------------------------*/\r\nimport * as platform from '../../../base/common/platform.js';\r\nimport { EditorZoom } from './editorZoom.js';\r\n/**\r\n * Determined from empirical observations.\r\n * @internal\r\n */\r\nconst GOLDEN_LINE_HEIGHT_RATIO = platform.isMacintosh ? 1.5 : 1.35;\r\n/**\r\n * @internal\r\n */\r\nconst MINIMUM_LINE_HEIGHT = 8;\r\nexport class BareFontInfo {\r\n /**\r\n * @internal\r\n */\r\n constructor(opts) {\r\n this._bareFontInfoBrand = undefined;\r\n this.zoomLevel = opts.zoomLevel;\r\n this.pixelRatio = opts.pixelRatio;\r\n this.fontFamily = String(opts.fontFamily);\r\n this.fontWeight = String(opts.fontWeight);\r\n this.fontSize = opts.fontSize;\r\n this.fontFeatureSettings = opts.fontFeatureSettings;\r\n this.lineHeight = opts.lineHeight | 0;\r\n this.letterSpacing = opts.letterSpacing;\r\n }\r\n /**\r\n * @internal\r\n */\r\n static createFromValidatedSettings(options, zoomLevel, pixelRatio, ignoreEditorZoom) {\r\n const fontFamily = options.get(40 /* fontFamily */);\r\n const fontWeight = options.get(44 /* fontWeight */);\r\n const fontSize = options.get(43 /* fontSize */);\r\n const fontFeatureSettings = options.get(42 /* fontLigatures */);\r\n const lineHeight = options.get(57 /* lineHeight */);\r\n const letterSpacing = options.get(54 /* letterSpacing */);\r\n return BareFontInfo._create(fontFamily, fontWeight, fontSize, fontFeatureSettings, lineHeight, letterSpacing, zoomLevel, pixelRatio, ignoreEditorZoom);\r\n }\r\n /**\r\n * @internal\r\n */\r\n static _create(fontFamily, fontWeight, fontSize, fontFeatureSettings, lineHeight, letterSpacing, zoomLevel, pixelRatio, ignoreEditorZoom) {\r\n if (lineHeight === 0) {\r\n lineHeight = GOLDEN_LINE_HEIGHT_RATIO * fontSize;\r\n }\r\n else if (lineHeight < MINIMUM_LINE_HEIGHT) {\r\n // Values too small to be line heights in pixels are probably in ems. Accept them gracefully.\r\n lineHeight = lineHeight * fontSize;\r\n }\r\n // Enforce integer, minimum constraints\r\n lineHeight = Math.round(lineHeight);\r\n if (lineHeight < MINIMUM_LINE_HEIGHT) {\r\n lineHeight = MINIMUM_LINE_HEIGHT;\r\n }\r\n const editorZoomLevelMultiplier = 1 + (ignoreEditorZoom ? 0 : EditorZoom.getZoomLevel() * 0.1);\r\n fontSize *= editorZoomLevelMultiplier;\r\n lineHeight *= editorZoomLevelMultiplier;\r\n return new BareFontInfo({\r\n zoomLevel: zoomLevel,\r\n pixelRatio: pixelRatio,\r\n fontFamily: fontFamily,\r\n fontWeight: fontWeight,\r\n fontSize: fontSize,\r\n fontFeatureSettings: fontFeatureSettings,\r\n lineHeight: lineHeight,\r\n letterSpacing: letterSpacing\r\n });\r\n }\r\n /**\r\n * @internal\r\n */\r\n getId() {\r\n return this.zoomLevel + '-' + this.pixelRatio + '-' + this.fontFamily + '-' + this.fontWeight + '-' + this.fontSize + '-' + this.fontFeatureSettings + '-' + this.lineHeight + '-' + this.letterSpacing;\r\n }\r\n /**\r\n * @internal\r\n */\r\n getMassagedFontFamily() {\r\n if (/[,\"']/.test(this.fontFamily)) {\r\n // Looks like the font family might be already escaped\r\n return this.fontFamily;\r\n }\r\n if (/[+ ]/.test(this.fontFamily)) {\r\n // Wrap a font family using + or with quotes\r\n return `\"${this.fontFamily}\"`;\r\n }\r\n return this.fontFamily;\r\n }\r\n}\r\n// change this whenever `FontInfo` members are changed\r\nexport const SERIALIZED_FONT_INFO_VERSION = 1;\r\nexport class FontInfo extends BareFontInfo {\r\n /**\r\n * @internal\r\n */\r\n constructor(opts, isTrusted) {\r\n super(opts);\r\n this._editorStylingBrand = undefined;\r\n this.version = SERIALIZED_FONT_INFO_VERSION;\r\n this.isTrusted = isTrusted;\r\n this.isMonospace = opts.isMonospace;\r\n this.typicalHalfwidthCharacterWidth = opts.typicalHalfwidthCharacterWidth;\r\n this.typicalFullwidthCharacterWidth = opts.typicalFullwidthCharacterWidth;\r\n this.canUseHalfwidthRightwardsArrow = opts.canUseHalfwidthRightwardsArrow;\r\n this.spaceWidth = opts.spaceWidth;\r\n this.middotWidth = opts.middotWidth;\r\n this.wsmiddotWidth = opts.wsmiddotWidth;\r\n this.maxDigitWidth = opts.maxDigitWidth;\r\n }\r\n /**\r\n * @internal\r\n */\r\n equals(other) {\r\n return (this.fontFamily === other.fontFamily\r\n && this.fontWeight === other.fontWeight\r\n && this.fontSize === other.fontSize\r\n && this.fontFeatureSettings === other.fontFeatureSettings\r\n && this.lineHeight === other.lineHeight\r\n && this.letterSpacing === other.letterSpacing\r\n && this.typicalHalfwidthCharacterWidth === other.typicalHalfwidthCharacterWidth\r\n && this.typicalFullwidthCharacterWidth === other.typicalFullwidthCharacterWidth\r\n && this.canUseHalfwidthRightwardsArrow === other.canUseHalfwidthRightwardsArrow\r\n && this.spaceWidth === other.spaceWidth\r\n && this.middotWidth === other.middotWidth\r\n && this.wsmiddotWidth === other.wsmiddotWidth\r\n && this.maxDigitWidth === other.maxDigitWidth);\r\n }\r\n}\r\n", "/**\r\n * @internal\r\n */\r\nexport function isThemeColor(o) {\r\n return o && typeof o.id === 'string';\r\n}\r\n/**\r\n * The type of the `IEditor`.\r\n */\r\nexport const EditorType = {\r\n ICodeEditor: 'vs.editor.ICodeEditor',\r\n IDiffEditor: 'vs.editor.IDiffEditor'\r\n};\r\n", "/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License. See License.txt in the project root for license information.\r\n *--------------------------------------------------------------------------------------------*/\r\nimport { createDecorator } from '../../../platform/instantiation/common/instantiation.js';\r\nexport const ID_EDITOR_WORKER_SERVICE = 'editorWorkerService';\r\nexport const IEditorWorkerService = createDecorator(ID_EDITOR_WORKER_SERVICE);\r\n", "/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License. See License.txt in the project root for license information.\r\n *--------------------------------------------------------------------------------------------*/\r\nimport { createDecorator } from '../../../platform/instantiation/common/instantiation.js';\r\nexport const IModeService = createDecorator('modeService');\r\n", "/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License. See License.txt in the project root for license information.\r\n *--------------------------------------------------------------------------------------------*/\r\nimport { transformErrorForSerialization } from '../errors.js';\r\nimport { Disposable } from '../lifecycle.js';\r\nimport { isWeb } from '../platform.js';\r\nimport * as types from '../types.js';\r\nconst INITIALIZE = '$initialize';\r\nlet webWorkerWarningLogged = false;\r\nexport function logOnceWebWorkerWarning(err) {\r\n if (!isWeb) {\r\n // running tests\r\n return;\r\n }\r\n if (!webWorkerWarningLogged) {\r\n webWorkerWarningLogged = true;\r\n console.warn('Could not create web worker(s). Falling back to loading web worker code in main thread, which might cause UI freezes. Please see https://github.com/microsoft/monaco-editor#faq');\r\n }\r\n console.warn(err.message);\r\n}\r\nclass SimpleWorkerProtocol {\r\n constructor(handler) {\r\n this._workerId = -1;\r\n this._handler = handler;\r\n this._lastSentReq = 0;\r\n this._pendingReplies = Object.create(null);\r\n }\r\n setWorkerId(workerId) {\r\n this._workerId = workerId;\r\n }\r\n sendMessage(method, args) {\r\n let req = String(++this._lastSentReq);\r\n return new Promise((resolve, reject) => {\r\n this._pendingReplies[req] = {\r\n resolve: resolve,\r\n reject: reject\r\n };\r\n this._send({\r\n vsWorker: this._workerId,\r\n req: req,\r\n method: method,\r\n args: args\r\n });\r\n });\r\n }\r\n handleMessage(message) {\r\n if (!message || !message.vsWorker) {\r\n return;\r\n }\r\n if (this._workerId !== -1 && message.vsWorker !== this._workerId) {\r\n return;\r\n }\r\n this._handleMessage(message);\r\n }\r\n _handleMessage(msg) {\r\n if (msg.seq) {\r\n let replyMessage = msg;\r\n if (!this._pendingReplies[replyMessage.seq]) {\r\n console.warn('Got reply to unknown seq');\r\n return;\r\n }\r\n let reply = this._pendingReplies[replyMessage.seq];\r\n delete this._pendingReplies[replyMessage.seq];\r\n if (replyMessage.err) {\r\n let err = replyMessage.err;\r\n if (replyMessage.err.$isError) {\r\n err = new Error();\r\n err.name = replyMessage.err.name;\r\n err.message = replyMessage.err.message;\r\n err.stack = replyMessage.err.stack;\r\n }\r\n reply.reject(err);\r\n return;\r\n }\r\n reply.resolve(replyMessage.res);\r\n return;\r\n }\r\n let requestMessage = msg;\r\n let req = requestMessage.req;\r\n let result = this._handler.handleMessage(requestMessage.method, requestMessage.args);\r\n result.then((r) => {\r\n this._send({\r\n vsWorker: this._workerId,\r\n seq: req,\r\n res: r,\r\n err: undefined\r\n });\r\n }, (e) => {\r\n if (e.detail instanceof Error) {\r\n // Loading errors have a detail property that points to the actual error\r\n e.detail = transformErrorForSerialization(e.detail);\r\n }\r\n this._send({\r\n vsWorker: this._workerId,\r\n seq: req,\r\n res: undefined,\r\n err: transformErrorForSerialization(e)\r\n });\r\n });\r\n }\r\n _send(msg) {\r\n let transfer = [];\r\n if (msg.req) {\r\n const m = msg;\r\n for (let i = 0; i < m.args.length; i++) {\r\n if (m.args[i] instanceof ArrayBuffer) {\r\n transfer.push(m.args[i]);\r\n }\r\n }\r\n }\r\n else {\r\n const m = msg;\r\n if (m.res instanceof ArrayBuffer) {\r\n transfer.push(m.res);\r\n }\r\n }\r\n this._handler.sendMessage(msg, transfer);\r\n }\r\n}\r\n/**\r\n * Main thread side\r\n */\r\nexport class SimpleWorkerClient extends Disposable {\r\n constructor(workerFactory, moduleId, host) {\r\n super();\r\n let lazyProxyReject = null;\r\n this._worker = this._register(workerFactory.create('vs/base/common/worker/simpleWorker', (msg) => {\r\n this._protocol.handleMessage(msg);\r\n }, (err) => {\r\n // in Firefox, web workers fail lazily :(\r\n // we will reject the proxy\r\n if (lazyProxyReject) {\r\n lazyProxyReject(err);\r\n }\r\n }));\r\n this._protocol = new SimpleWorkerProtocol({\r\n sendMessage: (msg, transfer) => {\r\n this._worker.postMessage(msg, transfer);\r\n },\r\n handleMessage: (method, args) => {\r\n if (typeof host[method] !== 'function') {\r\n return Promise.reject(new Error('Missing method ' + method + ' on main thread host.'));\r\n }\r\n try {\r\n return Promise.resolve(host[method].apply(host, args));\r\n }\r\n catch (e) {\r\n return Promise.reject(e);\r\n }\r\n }\r\n });\r\n this._protocol.setWorkerId(this._worker.getId());\r\n // Gather loader configuration\r\n let loaderConfiguration = null;\r\n if (typeof self.require !== 'undefined' && typeof self.require.getConfig === 'function') {\r\n // Get the configuration from the Monaco AMD Loader\r\n loaderConfiguration = self.require.getConfig();\r\n }\r\n else if (typeof self.requirejs !== 'undefined') {\r\n // Get the configuration from requirejs\r\n loaderConfiguration = self.requirejs.s.contexts._.config;\r\n }\r\n const hostMethods = types.getAllMethodNames(host);\r\n // Send initialize message\r\n this._onModuleLoaded = this._protocol.sendMessage(INITIALIZE, [\r\n this._worker.getId(),\r\n JSON.parse(JSON.stringify(loaderConfiguration)),\r\n moduleId,\r\n hostMethods,\r\n ]);\r\n // Create proxy to loaded code\r\n const proxyMethodRequest = (method, args) => {\r\n return this._request(method, args);\r\n };\r\n this._lazyProxy = new Promise((resolve, reject) => {\r\n lazyProxyReject = reject;\r\n this._onModuleLoaded.then((availableMethods) => {\r\n resolve(types.createProxyObject(availableMethods, proxyMethodRequest));\r\n }, (e) => {\r\n reject(e);\r\n this._onError('Worker failed to load ' + moduleId, e);\r\n });\r\n });\r\n }\r\n getProxyObject() {\r\n return this._lazyProxy;\r\n }\r\n _request(method, args) {\r\n return new Promise((resolve, reject) => {\r\n this._onModuleLoaded.then(() => {\r\n this._protocol.sendMessage(method, args).then(resolve, reject);\r\n }, reject);\r\n });\r\n }\r\n _onError(message, error) {\r\n console.error(message);\r\n console.info(error);\r\n }\r\n}\r\n/**\r\n * Worker side\r\n */\r\nexport class SimpleWorkerServer {\r\n constructor(postMessage, requestHandlerFactory) {\r\n this._requestHandlerFactory = requestHandlerFactory;\r\n this._requestHandler = null;\r\n this._protocol = new SimpleWorkerProtocol({\r\n sendMessage: (msg, transfer) => {\r\n postMessage(msg, transfer);\r\n },\r\n handleMessage: (method, args) => this._handleMessage(method, args)\r\n });\r\n }\r\n onmessage(msg) {\r\n this._protocol.handleMessage(msg);\r\n }\r\n _handleMessage(method, args) {\r\n if (method === INITIALIZE) {\r\n return this.initialize(args[0], args[1], args[2], args[3]);\r\n }\r\n if (!this._requestHandler || typeof this._requestHandler[method] !== 'function') {\r\n return Promise.reject(new Error('Missing requestHandler or method: ' + method));\r\n }\r\n try {\r\n return Promise.resolve(this._requestHandler[method].apply(this._requestHandler, args));\r\n }\r\n catch (e) {\r\n return Promise.reject(e);\r\n }\r\n }\r\n initialize(workerId, loaderConfig, moduleId, hostMethods) {\r\n this._protocol.setWorkerId(workerId);\r\n const proxyMethodRequest = (method, args) => {\r\n return this._protocol.sendMessage(method, args);\r\n };\r\n const hostProxy = types.createProxyObject(hostMethods, proxyMethodRequest);\r\n if (this._requestHandlerFactory) {\r\n // static request handler\r\n this._requestHandler = this._requestHandlerFactory(hostProxy);\r\n return Promise.resolve(types.getAllMethodNames(this._requestHandler));\r\n }\r\n if (loaderConfig) {\r\n // Remove 'baseUrl', handling it is beyond scope for now\r\n if (typeof loaderConfig.baseUrl !== 'undefined') {\r\n delete loaderConfig['baseUrl'];\r\n }\r\n if (typeof loaderConfig.paths !== 'undefined') {\r\n if (typeof loaderConfig.paths.vs !== 'undefined') {\r\n delete loaderConfig.paths['vs'];\r\n }\r\n }\r\n if (typeof loaderConfig.trustedTypesPolicy !== undefined) {\r\n // don't use, it has been destroyed during serialize\r\n delete loaderConfig['trustedTypesPolicy'];\r\n }\r\n // Since this is in a web worker, enable catching errors\r\n loaderConfig.catchError = true;\r\n self.require.config(loaderConfig);\r\n }\r\n return new Promise((resolve, reject) => {\r\n // Use the global require to be sure to get the global config\r\n self.require([moduleId], (module) => {\r\n this._requestHandler = module.create(hostProxy);\r\n if (!this._requestHandler) {\r\n reject(new Error(`No RequestHandler!`));\r\n return;\r\n }\r\n resolve(types.getAllMethodNames(this._requestHandler));\r\n }, reject);\r\n });\r\n }\r\n}\r\n/**\r\n * Called on the worker side\r\n */\r\nexport function create(postMessage) {\r\n return new SimpleWorkerServer(postMessage, null);\r\n}\r\n", "/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License. See License.txt in the project root for license information.\r\n *--------------------------------------------------------------------------------------------*/\r\nvar _a;\r\nimport { globals } from '../common/platform.js';\r\nimport { logOnceWebWorkerWarning } from '../common/worker/simpleWorker.js';\r\nconst ttPolicy = (_a = window.trustedTypes) === null || _a === void 0 ? void 0 : _a.createPolicy('defaultWorkerFactory', { createScriptURL: value => value });\r\nfunction getWorker(workerId, label) {\r\n // Option for hosts to overwrite the worker script (used in the standalone editor)\r\n if (globals.MonacoEnvironment) {\r\n if (typeof globals.MonacoEnvironment.getWorker === 'function') {\r\n return globals.MonacoEnvironment.getWorker(workerId, label);\r\n }\r\n if (typeof globals.MonacoEnvironment.getWorkerUrl === 'function') {\r\n const wokerUrl = globals.MonacoEnvironment.getWorkerUrl(workerId, label);\r\n return new Worker(ttPolicy ? ttPolicy.createScriptURL(wokerUrl) : wokerUrl, { name: label });\r\n }\r\n }\r\n // ESM-comment-begin\r\n // \tif (typeof require === 'function') {\r\n // \t\t// check if the JS lives on a different origin\r\n // \t\tconst workerMain = require.toUrl('./' + workerId); // explicitly using require.toUrl(), see https://github.com/microsoft/vscode/issues/107440#issuecomment-698982321\r\n // \t\tconst workerUrl = getWorkerBootstrapUrl(workerMain, label);\r\n // \t\treturn new Worker(ttPolicy ? ttPolicy.createScriptURL(workerUrl) as unknown as string : workerUrl, { name: label });\r\n // \t}\r\n // ESM-comment-end\r\n throw new Error(`You must define a function MonacoEnvironment.getWorkerUrl or MonacoEnvironment.getWorker`);\r\n}\r\n// ESM-comment-begin\r\n// export function getWorkerBootstrapUrl(scriptPath: string, label: string): string {\r\n// \tif (/^((http:)|(https:)|(file:))/.test(scriptPath) && scriptPath.substring(0, self.origin.length) !== self.origin) {\r\n// \t\t// this is the cross-origin case\r\n// \t\t// i.e. the webpage is running at a different origin than where the scripts are loaded from\r\n// \t\tconst myPath = 'vs/base/worker/defaultWorkerFactory.js';\r\n// \t\tconst workerBaseUrl = require.toUrl(myPath).slice(0, -myPath.length); // explicitly using require.toUrl(), see https://github.com/microsoft/vscode/issues/107440#issuecomment-698982321\r\n// \t\tconst js = `/*${label}*/self.MonacoEnvironment={baseUrl: '${workerBaseUrl}'};const ttPolicy = self.trustedTypes?.createPolicy('defaultWorkerFactory', { createScriptURL: value => value });importScripts(ttPolicy?.createScriptURL('${scriptPath}') ?? '${scriptPath}');/*${label}*/`;\r\n// \t\tconst blob = new Blob([js], { type: 'application/javascript' });\r\n// \t\treturn URL.createObjectURL(blob);\r\n// \t}\r\n// \treturn scriptPath + '#' + label;\r\n// }\r\n// ESM-comment-end\r\nfunction isPromiseLike(obj) {\r\n if (typeof obj.then === 'function') {\r\n return true;\r\n }\r\n return false;\r\n}\r\n/**\r\n * A worker that uses HTML5 web workers so that is has\r\n * its own global scope and its own thread.\r\n */\r\nclass WebWorker {\r\n constructor(moduleId, id, label, onMessageCallback, onErrorCallback) {\r\n this.id = id;\r\n const workerOrPromise = getWorker('workerMain.js', label);\r\n if (isPromiseLike(workerOrPromise)) {\r\n this.worker = workerOrPromise;\r\n }\r\n else {\r\n this.worker = Promise.resolve(workerOrPromise);\r\n }\r\n this.postMessage(moduleId, []);\r\n this.worker.then((w) => {\r\n w.onmessage = function (ev) {\r\n onMessageCallback(ev.data);\r\n };\r\n w.onmessageerror = onErrorCallback;\r\n if (typeof w.addEventListener === 'function') {\r\n w.addEventListener('error', onErrorCallback);\r\n }\r\n });\r\n }\r\n getId() {\r\n return this.id;\r\n }\r\n postMessage(message, transfer) {\r\n if (this.worker) {\r\n this.worker.then(w => w.postMessage(message, transfer));\r\n }\r\n }\r\n dispose() {\r\n if (this.worker) {\r\n this.worker.then(w => w.terminate());\r\n }\r\n this.worker = null;\r\n }\r\n}\r\nexport class DefaultWorkerFactory {\r\n constructor(label) {\r\n this._label = label;\r\n this._webWorkerFailedBeforeError = false;\r\n }\r\n create(moduleId, onMessageCallback, onErrorCallback) {\r\n let workerId = (++DefaultWorkerFactory.LAST_WORKER_ID);\r\n if (this._webWorkerFailedBeforeError) {\r\n throw this._webWorkerFailedBeforeError;\r\n }\r\n return new WebWorker(moduleId, workerId, this._label || 'anonymous' + workerId, onMessageCallback, (err) => {\r\n logOnceWebWorkerWarning(err);\r\n this._webWorkerFailedBeforeError = err;\r\n onErrorCallback(err);\r\n });\r\n }\r\n}\r\nDefaultWorkerFactory.LAST_WORKER_ID = 0;\r\n", "/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License. See License.txt in the project root for license information.\r\n *--------------------------------------------------------------------------------------------*/\r\n/**\r\n * Represents information about a specific difference between two sequences.\r\n */\r\nexport class DiffChange {\r\n /**\r\n * Constructs a new DiffChange with the given sequence information\r\n * and content.\r\n */\r\n constructor(originalStart, originalLength, modifiedStart, modifiedLength) {\r\n //Debug.Assert(originalLength > 0 || modifiedLength > 0, \"originalLength and modifiedLength cannot both be <= 0\");\r\n this.originalStart = originalStart;\r\n this.originalLength = originalLength;\r\n this.modifiedStart = modifiedStart;\r\n this.modifiedLength = modifiedLength;\r\n }\r\n /**\r\n * The end point (exclusive) of the change in the original sequence.\r\n */\r\n getOriginalEnd() {\r\n return this.originalStart + this.originalLength;\r\n }\r\n /**\r\n * The end point (exclusive) of the change in the modified sequence.\r\n */\r\n getModifiedEnd() {\r\n return this.modifiedStart + this.modifiedLength;\r\n }\r\n}\r\n", "/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License. See License.txt in the project root for license information.\r\n *--------------------------------------------------------------------------------------------*/\r\nimport { DiffChange } from './diffChange.js';\r\nimport { stringHash } from '../hash.js';\r\nexport class StringDiffSequence {\r\n constructor(source) {\r\n this.source = source;\r\n }\r\n getElements() {\r\n const source = this.source;\r\n const characters = new Int32Array(source.length);\r\n for (let i = 0, len = source.length; i < len; i++) {\r\n characters[i] = source.charCodeAt(i);\r\n }\r\n return characters;\r\n }\r\n}\r\nexport function stringDiff(original, modified, pretty) {\r\n return new LcsDiff(new StringDiffSequence(original), new StringDiffSequence(modified)).ComputeDiff(pretty).changes;\r\n}\r\n//\r\n// The code below has been ported from a C# implementation in VS\r\n//\r\nexport class Debug {\r\n static Assert(condition, message) {\r\n if (!condition) {\r\n throw new Error(message);\r\n }\r\n }\r\n}\r\nexport class MyArray {\r\n /**\r\n * Copies a range of elements from an Array starting at the specified source index and pastes\r\n * them to another Array starting at the specified destination index. The length and the indexes\r\n * are specified as 64-bit integers.\r\n * sourceArray:\r\n *\t\tThe Array that contains the data to copy.\r\n * sourceIndex:\r\n *\t\tA 64-bit integer that represents the index in the sourceArray at which copying begins.\r\n * destinationArray:\r\n *\t\tThe Array that receives the data.\r\n * destinationIndex:\r\n *\t\tA 64-bit integer that represents the index in the destinationArray at which storing begins.\r\n * length:\r\n *\t\tA 64-bit integer that represents the number of elements to copy.\r\n */\r\n static Copy(sourceArray, sourceIndex, destinationArray, destinationIndex, length) {\r\n for (let i = 0; i < length; i++) {\r\n destinationArray[destinationIndex + i] = sourceArray[sourceIndex + i];\r\n }\r\n }\r\n static Copy2(sourceArray, sourceIndex, destinationArray, destinationIndex, length) {\r\n for (let i = 0; i < length; i++) {\r\n destinationArray[destinationIndex + i] = sourceArray[sourceIndex + i];\r\n }\r\n }\r\n}\r\n/**\r\n * A utility class which helps to create the set of DiffChanges from\r\n * a difference operation. This class accepts original DiffElements and\r\n * modified DiffElements that are involved in a particular change. The\r\n * MarktNextChange() method can be called to mark the separation between\r\n * distinct changes. At the end, the Changes property can be called to retrieve\r\n * the constructed changes.\r\n */\r\nclass DiffChangeHelper {\r\n /**\r\n * Constructs a new DiffChangeHelper for the given DiffSequences.\r\n */\r\n constructor() {\r\n this.m_changes = [];\r\n this.m_originalStart = 1073741824 /* MAX_SAFE_SMALL_INTEGER */;\r\n this.m_modifiedStart = 1073741824 /* MAX_SAFE_SMALL_INTEGER */;\r\n this.m_originalCount = 0;\r\n this.m_modifiedCount = 0;\r\n }\r\n /**\r\n * Marks the beginning of the next change in the set of differences.\r\n */\r\n MarkNextChange() {\r\n // Only add to the list if there is something to add\r\n if (this.m_originalCount > 0 || this.m_modifiedCount > 0) {\r\n // Add the new change to our list\r\n this.m_changes.push(new DiffChange(this.m_originalStart, this.m_originalCount, this.m_modifiedStart, this.m_modifiedCount));\r\n }\r\n // Reset for the next change\r\n this.m_originalCount = 0;\r\n this.m_modifiedCount = 0;\r\n this.m_originalStart = 1073741824 /* MAX_SAFE_SMALL_INTEGER */;\r\n this.m_modifiedStart = 1073741824 /* MAX_SAFE_SMALL_INTEGER */;\r\n }\r\n /**\r\n * Adds the original element at the given position to the elements\r\n * affected by the current change. The modified index gives context\r\n * to the change position with respect to the original sequence.\r\n * @param originalIndex The index of the original element to add.\r\n * @param modifiedIndex The index of the modified element that provides corresponding position in the modified sequence.\r\n */\r\n AddOriginalElement(originalIndex, modifiedIndex) {\r\n // The 'true' start index is the smallest of the ones we've seen\r\n this.m_originalStart = Math.min(this.m_originalStart, originalIndex);\r\n this.m_modifiedStart = Math.min(this.m_modifiedStart, modifiedIndex);\r\n this.m_originalCount++;\r\n }\r\n /**\r\n * Adds the modified element at the given position to the elements\r\n * affected by the current change. The original index gives context\r\n * to the change position with respect to the modified sequence.\r\n * @param originalIndex The index of the original element that provides corresponding position in the original sequence.\r\n * @param modifiedIndex The index of the modified element to add.\r\n */\r\n AddModifiedElement(originalIndex, modifiedIndex) {\r\n // The 'true' start index is the smallest of the ones we've seen\r\n this.m_originalStart = Math.min(this.m_originalStart, originalIndex);\r\n this.m_modifiedStart = Math.min(this.m_modifiedStart, modifiedIndex);\r\n this.m_modifiedCount++;\r\n }\r\n /**\r\n * Retrieves all of the changes marked by the class.\r\n */\r\n getChanges() {\r\n if (this.m_originalCount > 0 || this.m_modifiedCount > 0) {\r\n // Finish up on whatever is left\r\n this.MarkNextChange();\r\n }\r\n return this.m_changes;\r\n }\r\n /**\r\n * Retrieves all of the changes marked by the class in the reverse order\r\n */\r\n getReverseChanges() {\r\n if (this.m_originalCount > 0 || this.m_modifiedCount > 0) {\r\n // Finish up on whatever is left\r\n this.MarkNextChange();\r\n }\r\n this.m_changes.reverse();\r\n return this.m_changes;\r\n }\r\n}\r\n/**\r\n * An implementation of the difference algorithm described in\r\n * \"An O(ND) Difference Algorithm and its variations\" by Eugene W. Myers\r\n */\r\nexport class LcsDiff {\r\n /**\r\n * Constructs the DiffFinder\r\n */\r\n constructor(originalSequence, modifiedSequence, continueProcessingPredicate = null) {\r\n this.ContinueProcessingPredicate = continueProcessingPredicate;\r\n this._originalSequence = originalSequence;\r\n this._modifiedSequence = modifiedSequence;\r\n const [originalStringElements, originalElementsOrHash, originalHasStrings] = LcsDiff._getElements(originalSequence);\r\n const [modifiedStringElements, modifiedElementsOrHash, modifiedHasStrings] = LcsDiff._getElements(modifiedSequence);\r\n this._hasStrings = (originalHasStrings && modifiedHasStrings);\r\n this._originalStringElements = originalStringElements;\r\n this._originalElementsOrHash = originalElementsOrHash;\r\n this._modifiedStringElements = modifiedStringElements;\r\n this._modifiedElementsOrHash = modifiedElementsOrHash;\r\n this.m_forwardHistory = [];\r\n this.m_reverseHistory = [];\r\n }\r\n static _isStringArray(arr) {\r\n return (arr.length > 0 && typeof arr[0] === 'string');\r\n }\r\n static _getElements(sequence) {\r\n const elements = sequence.getElements();\r\n if (LcsDiff._isStringArray(elements)) {\r\n const hashes = new Int32Array(elements.length);\r\n for (let i = 0, len = elements.length; i < len; i++) {\r\n hashes[i] = stringHash(elements[i], 0);\r\n }\r\n return [elements, hashes, true];\r\n }\r\n if (elements instanceof Int32Array) {\r\n return [[], elements, false];\r\n }\r\n return [[], new Int32Array(elements), false];\r\n }\r\n ElementsAreEqual(originalIndex, newIndex) {\r\n if (this._originalElementsOrHash[originalIndex] !== this._modifiedElementsOrHash[newIndex]) {\r\n return false;\r\n }\r\n return (this._hasStrings ? this._originalStringElements[originalIndex] === this._modifiedStringElements[newIndex] : true);\r\n }\r\n ElementsAreStrictEqual(originalIndex, newIndex) {\r\n if (!this.ElementsAreEqual(originalIndex, newIndex)) {\r\n return false;\r\n }\r\n const originalElement = LcsDiff._getStrictElement(this._originalSequence, originalIndex);\r\n const modifiedElement = LcsDiff._getStrictElement(this._modifiedSequence, newIndex);\r\n return (originalElement === modifiedElement);\r\n }\r\n static _getStrictElement(sequence, index) {\r\n if (typeof sequence.getStrictElement === 'function') {\r\n return sequence.getStrictElement(index);\r\n }\r\n return null;\r\n }\r\n OriginalElementsAreEqual(index1, index2) {\r\n if (this._originalElementsOrHash[index1] !== this._originalElementsOrHash[index2]) {\r\n return false;\r\n }\r\n return (this._hasStrings ? this._originalStringElements[index1] === this._originalStringElements[index2] : true);\r\n }\r\n ModifiedElementsAreEqual(index1, index2) {\r\n if (this._modifiedElementsOrHash[index1] !== this._modifiedElementsOrHash[index2]) {\r\n return false;\r\n }\r\n return (this._hasStrings ? this._modifiedStringElements[index1] === this._modifiedStringElements[index2] : true);\r\n }\r\n ComputeDiff(pretty) {\r\n return this._ComputeDiff(0, this._originalElementsOrHash.length - 1, 0, this._modifiedElementsOrHash.length - 1, pretty);\r\n }\r\n /**\r\n * Computes the differences between the original and modified input\r\n * sequences on the bounded range.\r\n * @returns An array of the differences between the two input sequences.\r\n */\r\n _ComputeDiff(originalStart, originalEnd, modifiedStart, modifiedEnd, pretty) {\r\n const quitEarlyArr = [false];\r\n let changes = this.ComputeDiffRecursive(originalStart, originalEnd, modifiedStart, modifiedEnd, quitEarlyArr);\r\n if (pretty) {\r\n // We have to clean up the computed diff to be more intuitive\r\n // but it turns out this cannot be done correctly until the entire set\r\n // of diffs have been computed\r\n changes = this.PrettifyChanges(changes);\r\n }\r\n return {\r\n quitEarly: quitEarlyArr[0],\r\n changes: changes\r\n };\r\n }\r\n /**\r\n * Private helper method which computes the differences on the bounded range\r\n * recursively.\r\n * @returns An array of the differences between the two input sequences.\r\n */\r\n ComputeDiffRecursive(originalStart, originalEnd, modifiedStart, modifiedEnd, quitEarlyArr) {\r\n quitEarlyArr[0] = false;\r\n // Find the start of the differences\r\n while (originalStart <= originalEnd && modifiedStart <= modifiedEnd && this.ElementsAreEqual(originalStart, modifiedStart)) {\r\n originalStart++;\r\n modifiedStart++;\r\n }\r\n // Find the end of the differences\r\n while (originalEnd >= originalStart && modifiedEnd >= modifiedStart && this.ElementsAreEqual(originalEnd, modifiedEnd)) {\r\n originalEnd--;\r\n modifiedEnd--;\r\n }\r\n // In the special case where we either have all insertions or all deletions or the sequences are identical\r\n if (originalStart > originalEnd || modifiedStart > modifiedEnd) {\r\n let changes;\r\n if (modifiedStart <= modifiedEnd) {\r\n Debug.Assert(originalStart === originalEnd + 1, 'originalStart should only be one more than originalEnd');\r\n // All insertions\r\n changes = [\r\n new DiffChange(originalStart, 0, modifiedStart, modifiedEnd - modifiedStart + 1)\r\n ];\r\n }\r\n else if (originalStart <= originalEnd) {\r\n Debug.Assert(modifiedStart === modifiedEnd + 1, 'modifiedStart should only be one more than modifiedEnd');\r\n // All deletions\r\n changes = [\r\n new DiffChange(originalStart, originalEnd - originalStart + 1, modifiedStart, 0)\r\n ];\r\n }\r\n else {\r\n Debug.Assert(originalStart === originalEnd + 1, 'originalStart should only be one more than originalEnd');\r\n Debug.Assert(modifiedStart === modifiedEnd + 1, 'modifiedStart should only be one more than modifiedEnd');\r\n // Identical sequences - No differences\r\n changes = [];\r\n }\r\n return changes;\r\n }\r\n // This problem can be solved using the Divide-And-Conquer technique.\r\n const midOriginalArr = [0];\r\n const midModifiedArr = [0];\r\n const result = this.ComputeRecursionPoint(originalStart, originalEnd, modifiedStart, modifiedEnd, midOriginalArr, midModifiedArr, quitEarlyArr);\r\n const midOriginal = midOriginalArr[0];\r\n const midModified = midModifiedArr[0];\r\n if (result !== null) {\r\n // Result is not-null when there was enough memory to compute the changes while\r\n // searching for the recursion point\r\n return result;\r\n }\r\n else if (!quitEarlyArr[0]) {\r\n // We can break the problem down recursively by finding the changes in the\r\n // First Half: (originalStart, modifiedStart) to (midOriginal, midModified)\r\n // Second Half: (midOriginal + 1, minModified + 1) to (originalEnd, modifiedEnd)\r\n // NOTE: ComputeDiff() is inclusive, therefore the second range starts on the next point\r\n const leftChanges = this.ComputeDiffRecursive(originalStart, midOriginal, modifiedStart, midModified, quitEarlyArr);\r\n let rightChanges = [];\r\n if (!quitEarlyArr[0]) {\r\n rightChanges = this.ComputeDiffRecursive(midOriginal + 1, originalEnd, midModified + 1, modifiedEnd, quitEarlyArr);\r\n }\r\n else {\r\n // We did't have time to finish the first half, so we don't have time to compute this half.\r\n // Consider the entire rest of the sequence different.\r\n rightChanges = [\r\n new DiffChange(midOriginal + 1, originalEnd - (midOriginal + 1) + 1, midModified + 1, modifiedEnd - (midModified + 1) + 1)\r\n ];\r\n }\r\n return this.ConcatenateChanges(leftChanges, rightChanges);\r\n }\r\n // If we hit here, we quit early, and so can't return anything meaningful\r\n return [\r\n new DiffChange(originalStart, originalEnd - originalStart + 1, modifiedStart, modifiedEnd - modifiedStart + 1)\r\n ];\r\n }\r\n WALKTRACE(diagonalForwardBase, diagonalForwardStart, diagonalForwardEnd, diagonalForwardOffset, diagonalReverseBase, diagonalReverseStart, diagonalReverseEnd, diagonalReverseOffset, forwardPoints, reversePoints, originalIndex, originalEnd, midOriginalArr, modifiedIndex, modifiedEnd, midModifiedArr, deltaIsEven, quitEarlyArr) {\r\n let forwardChanges = null;\r\n let reverseChanges = null;\r\n // First, walk backward through the forward diagonals history\r\n let changeHelper = new DiffChangeHelper();\r\n let diagonalMin = diagonalForwardStart;\r\n let diagonalMax = diagonalForwardEnd;\r\n let diagonalRelative = (midOriginalArr[0] - midModifiedArr[0]) - diagonalForwardOffset;\r\n let lastOriginalIndex = -1073741824 /* MIN_SAFE_SMALL_INTEGER */;\r\n let historyIndex = this.m_forwardHistory.length - 1;\r\n do {\r\n // Get the diagonal index from the relative diagonal number\r\n const diagonal = diagonalRelative + diagonalForwardBase;\r\n // Figure out where we came from\r\n if (diagonal === diagonalMin || (diagonal < diagonalMax && forwardPoints[diagonal - 1] < forwardPoints[diagonal + 1])) {\r\n // Vertical line (the element is an insert)\r\n originalIndex = forwardPoints[diagonal + 1];\r\n modifiedIndex = originalIndex - diagonalRelative - diagonalForwardOffset;\r\n if (originalIndex < lastOriginalIndex) {\r\n changeHelper.MarkNextChange();\r\n }\r\n lastOriginalIndex = originalIndex;\r\n changeHelper.AddModifiedElement(originalIndex + 1, modifiedIndex);\r\n diagonalRelative = (diagonal + 1) - diagonalForwardBase; //Setup for the next iteration\r\n }\r\n else {\r\n // Horizontal line (the element is a deletion)\r\n originalIndex = forwardPoints[diagonal - 1] + 1;\r\n modifiedIndex = originalIndex - diagonalRelative - diagonalForwardOffset;\r\n if (originalIndex < lastOriginalIndex) {\r\n changeHelper.MarkNextChange();\r\n }\r\n lastOriginalIndex = originalIndex - 1;\r\n changeHelper.AddOriginalElement(originalIndex, modifiedIndex + 1);\r\n diagonalRelative = (diagonal - 1) - diagonalForwardBase; //Setup for the next iteration\r\n }\r\n if (historyIndex >= 0) {\r\n forwardPoints = this.m_forwardHistory[historyIndex];\r\n diagonalForwardBase = forwardPoints[0]; //We stored this in the first spot\r\n diagonalMin = 1;\r\n diagonalMax = forwardPoints.length - 1;\r\n }\r\n } while (--historyIndex >= -1);\r\n // Ironically, we get the forward changes as the reverse of the\r\n // order we added them since we technically added them backwards\r\n forwardChanges = changeHelper.getReverseChanges();\r\n if (quitEarlyArr[0]) {\r\n // TODO: Calculate a partial from the reverse diagonals.\r\n // For now, just assume everything after the midOriginal/midModified point is a diff\r\n let originalStartPoint = midOriginalArr[0] + 1;\r\n let modifiedStartPoint = midModifiedArr[0] + 1;\r\n if (forwardChanges !== null && forwardChanges.length > 0) {\r\n const lastForwardChange = forwardChanges[forwardChanges.length - 1];\r\n originalStartPoint = Math.max(originalStartPoint, lastForwardChange.getOriginalEnd());\r\n modifiedStartPoint = Math.max(modifiedStartPoint, lastForwardChange.getModifiedEnd());\r\n }\r\n reverseChanges = [\r\n new DiffChange(originalStartPoint, originalEnd - originalStartPoint + 1, modifiedStartPoint, modifiedEnd - modifiedStartPoint + 1)\r\n ];\r\n }\r\n else {\r\n // Now walk backward through the reverse diagonals history\r\n changeHelper = new DiffChangeHelper();\r\n diagonalMin = diagonalReverseStart;\r\n diagonalMax = diagonalReverseEnd;\r\n diagonalRelative = (midOriginalArr[0] - midModifiedArr[0]) - diagonalReverseOffset;\r\n lastOriginalIndex = 1073741824 /* MAX_SAFE_SMALL_INTEGER */;\r\n historyIndex = (deltaIsEven) ? this.m_reverseHistory.length - 1 : this.m_reverseHistory.length - 2;\r\n do {\r\n // Get the diagonal index from the relative diagonal number\r\n const diagonal = diagonalRelative + diagonalReverseBase;\r\n // Figure out where we came from\r\n if (diagonal === diagonalMin || (diagonal < diagonalMax && reversePoints[diagonal - 1] >= reversePoints[diagonal + 1])) {\r\n // Horizontal line (the element is a deletion))\r\n originalIndex = reversePoints[diagonal + 1] - 1;\r\n modifiedIndex = originalIndex - diagonalRelative - diagonalReverseOffset;\r\n if (originalIndex > lastOriginalIndex) {\r\n changeHelper.MarkNextChange();\r\n }\r\n lastOriginalIndex = originalIndex + 1;\r\n changeHelper.AddOriginalElement(originalIndex + 1, modifiedIndex + 1);\r\n diagonalRelative = (diagonal + 1) - diagonalReverseBase; //Setup for the next iteration\r\n }\r\n else {\r\n // Vertical line (the element is an insertion)\r\n originalIndex = reversePoints[diagonal - 1];\r\n modifiedIndex = originalIndex - diagonalRelative - diagonalReverseOffset;\r\n if (originalIndex > lastOriginalIndex) {\r\n changeHelper.MarkNextChange();\r\n }\r\n lastOriginalIndex = originalIndex;\r\n changeHelper.AddModifiedElement(originalIndex + 1, modifiedIndex + 1);\r\n diagonalRelative = (diagonal - 1) - diagonalReverseBase; //Setup for the next iteration\r\n }\r\n if (historyIndex >= 0) {\r\n reversePoints = this.m_reverseHistory[historyIndex];\r\n diagonalReverseBase = reversePoints[0]; //We stored this in the first spot\r\n diagonalMin = 1;\r\n diagonalMax = reversePoints.length - 1;\r\n }\r\n } while (--historyIndex >= -1);\r\n // There are cases where the reverse history will find diffs that\r\n // are correct, but not intuitive, so we need shift them.\r\n reverseChanges = changeHelper.getChanges();\r\n }\r\n return this.ConcatenateChanges(forwardChanges, reverseChanges);\r\n }\r\n /**\r\n * Given the range to compute the diff on, this method finds the point:\r\n * (midOriginal, midModified)\r\n * that exists in the middle of the LCS of the two sequences and\r\n * is the point at which the LCS problem may be broken down recursively.\r\n * This method will try to keep the LCS trace in memory. If the LCS recursion\r\n * point is calculated and the full trace is available in memory, then this method\r\n * will return the change list.\r\n * @param originalStart The start bound of the original sequence range\r\n * @param originalEnd The end bound of the original sequence range\r\n * @param modifiedStart The start bound of the modified sequence range\r\n * @param modifiedEnd The end bound of the modified sequence range\r\n * @param midOriginal The middle point of the original sequence range\r\n * @param midModified The middle point of the modified sequence range\r\n * @returns The diff changes, if available, otherwise null\r\n */\r\n ComputeRecursionPoint(originalStart, originalEnd, modifiedStart, modifiedEnd, midOriginalArr, midModifiedArr, quitEarlyArr) {\r\n let originalIndex = 0, modifiedIndex = 0;\r\n let diagonalForwardStart = 0, diagonalForwardEnd = 0;\r\n let diagonalReverseStart = 0, diagonalReverseEnd = 0;\r\n // To traverse the edit graph and produce the proper LCS, our actual\r\n // start position is just outside the given boundary\r\n originalStart--;\r\n modifiedStart--;\r\n // We set these up to make the compiler happy, but they will\r\n // be replaced before we return with the actual recursion point\r\n midOriginalArr[0] = 0;\r\n midModifiedArr[0] = 0;\r\n // Clear out the history\r\n this.m_forwardHistory = [];\r\n this.m_reverseHistory = [];\r\n // Each cell in the two arrays corresponds to a diagonal in the edit graph.\r\n // The integer value in the cell represents the originalIndex of the furthest\r\n // reaching point found so far that ends in that diagonal.\r\n // The modifiedIndex can be computed mathematically from the originalIndex and the diagonal number.\r\n const maxDifferences = (originalEnd - originalStart) + (modifiedEnd - modifiedStart);\r\n const numDiagonals = maxDifferences + 1;\r\n const forwardPoints = new Int32Array(numDiagonals);\r\n const reversePoints = new Int32Array(numDiagonals);\r\n // diagonalForwardBase: Index into forwardPoints of the diagonal which passes through (originalStart, modifiedStart)\r\n // diagonalReverseBase: Index into reversePoints of the diagonal which passes through (originalEnd, modifiedEnd)\r\n const diagonalForwardBase = (modifiedEnd - modifiedStart);\r\n const diagonalReverseBase = (originalEnd - originalStart);\r\n // diagonalForwardOffset: Geometric offset which allows modifiedIndex to be computed from originalIndex and the\r\n // diagonal number (relative to diagonalForwardBase)\r\n // diagonalReverseOffset: Geometric offset which allows modifiedIndex to be computed from originalIndex and the\r\n // diagonal number (relative to diagonalReverseBase)\r\n const diagonalForwardOffset = (originalStart - modifiedStart);\r\n const diagonalReverseOffset = (originalEnd - modifiedEnd);\r\n // delta: The difference between the end diagonal and the start diagonal. This is used to relate diagonal numbers\r\n // relative to the start diagonal with diagonal numbers relative to the end diagonal.\r\n // The Even/Oddn-ness of this delta is important for determining when we should check for overlap\r\n const delta = diagonalReverseBase - diagonalForwardBase;\r\n const deltaIsEven = (delta % 2 === 0);\r\n // Here we set up the start and end points as the furthest points found so far\r\n // in both the forward and reverse directions, respectively\r\n forwardPoints[diagonalForwardBase] = originalStart;\r\n reversePoints[diagonalReverseBase] = originalEnd;\r\n // Remember if we quit early, and thus need to do a best-effort result instead of a real result.\r\n quitEarlyArr[0] = false;\r\n // A couple of points:\r\n // --With this method, we iterate on the number of differences between the two sequences.\r\n // The more differences there actually are, the longer this will take.\r\n // --Also, as the number of differences increases, we have to search on diagonals further\r\n // away from the reference diagonal (which is diagonalForwardBase for forward, diagonalReverseBase for reverse).\r\n // --We extend on even diagonals (relative to the reference diagonal) only when numDifferences\r\n // is even and odd diagonals only when numDifferences is odd.\r\n for (let numDifferences = 1; numDifferences <= (maxDifferences / 2) + 1; numDifferences++) {\r\n let furthestOriginalIndex = 0;\r\n let furthestModifiedIndex = 0;\r\n // Run the algorithm in the forward direction\r\n diagonalForwardStart = this.ClipDiagonalBound(diagonalForwardBase - numDifferences, numDifferences, diagonalForwardBase, numDiagonals);\r\n diagonalForwardEnd = this.ClipDiagonalBound(diagonalForwardBase + numDifferences, numDifferences, diagonalForwardBase, numDiagonals);\r\n for (let diagonal = diagonalForwardStart; diagonal <= diagonalForwardEnd; diagonal += 2) {\r\n // STEP 1: We extend the furthest reaching point in the present diagonal\r\n // by looking at the diagonals above and below and picking the one whose point\r\n // is further away from the start point (originalStart, modifiedStart)\r\n if (diagonal === diagonalForwardStart || (diagonal < diagonalForwardEnd && forwardPoints[diagonal - 1] < forwardPoints[diagonal + 1])) {\r\n originalIndex = forwardPoints[diagonal + 1];\r\n }\r\n else {\r\n originalIndex = forwardPoints[diagonal - 1] + 1;\r\n }\r\n modifiedIndex = originalIndex - (diagonal - diagonalForwardBase) - diagonalForwardOffset;\r\n // Save the current originalIndex so we can test for false overlap in step 3\r\n const tempOriginalIndex = originalIndex;\r\n // STEP 2: We can continue to extend the furthest reaching point in the present diagonal\r\n // so long as the elements are equal.\r\n while (originalIndex < originalEnd && modifiedIndex < modifiedEnd && this.ElementsAreEqual(originalIndex + 1, modifiedIndex + 1)) {\r\n originalIndex++;\r\n modifiedIndex++;\r\n }\r\n forwardPoints[diagonal] = originalIndex;\r\n if (originalIndex + modifiedIndex > furthestOriginalIndex + furthestModifiedIndex) {\r\n furthestOriginalIndex = originalIndex;\r\n furthestModifiedIndex = modifiedIndex;\r\n }\r\n // STEP 3: If delta is odd (overlap first happens on forward when delta is odd)\r\n // and diagonal is in the range of reverse diagonals computed for numDifferences-1\r\n // (the previous iteration; we haven't computed reverse diagonals for numDifferences yet)\r\n // then check for overlap.\r\n if (!deltaIsEven && Math.abs(diagonal - diagonalReverseBase) <= (numDifferences - 1)) {\r\n if (originalIndex >= reversePoints[diagonal]) {\r\n midOriginalArr[0] = originalIndex;\r\n midModifiedArr[0] = modifiedIndex;\r\n if (tempOriginalIndex <= reversePoints[diagonal] && 1447 /* MaxDifferencesHistory */ > 0 && numDifferences <= (1447 /* MaxDifferencesHistory */ + 1)) {\r\n // BINGO! We overlapped, and we have the full trace in memory!\r\n return this.WALKTRACE(diagonalForwardBase, diagonalForwardStart, diagonalForwardEnd, diagonalForwardOffset, diagonalReverseBase, diagonalReverseStart, diagonalReverseEnd, diagonalReverseOffset, forwardPoints, reversePoints, originalIndex, originalEnd, midOriginalArr, modifiedIndex, modifiedEnd, midModifiedArr, deltaIsEven, quitEarlyArr);\r\n }\r\n else {\r\n // Either false overlap, or we didn't have enough memory for the full trace\r\n // Just return the recursion point\r\n return null;\r\n }\r\n }\r\n }\r\n }\r\n // Check to see if we should be quitting early, before moving on to the next iteration.\r\n const matchLengthOfLongest = ((furthestOriginalIndex - originalStart) + (furthestModifiedIndex - modifiedStart) - numDifferences) / 2;\r\n if (this.ContinueProcessingPredicate !== null && !this.ContinueProcessingPredicate(furthestOriginalIndex, matchLengthOfLongest)) {\r\n // We can't finish, so skip ahead to generating a result from what we have.\r\n quitEarlyArr[0] = true;\r\n // Use the furthest distance we got in the forward direction.\r\n midOriginalArr[0] = furthestOriginalIndex;\r\n midModifiedArr[0] = furthestModifiedIndex;\r\n if (matchLengthOfLongest > 0 && 1447 /* MaxDifferencesHistory */ > 0 && numDifferences <= (1447 /* MaxDifferencesHistory */ + 1)) {\r\n // Enough of the history is in memory to walk it backwards\r\n return this.WALKTRACE(diagonalForwardBase, diagonalForwardStart, diagonalForwardEnd, diagonalForwardOffset, diagonalReverseBase, diagonalReverseStart, diagonalReverseEnd, diagonalReverseOffset, forwardPoints, reversePoints, originalIndex, originalEnd, midOriginalArr, modifiedIndex, modifiedEnd, midModifiedArr, deltaIsEven, quitEarlyArr);\r\n }\r\n else {\r\n // We didn't actually remember enough of the history.\r\n //Since we are quiting the diff early, we need to shift back the originalStart and modified start\r\n //back into the boundary limits since we decremented their value above beyond the boundary limit.\r\n originalStart++;\r\n modifiedStart++;\r\n return [\r\n new DiffChange(originalStart, originalEnd - originalStart + 1, modifiedStart, modifiedEnd - modifiedStart + 1)\r\n ];\r\n }\r\n }\r\n // Run the algorithm in the reverse direction\r\n diagonalReverseStart = this.ClipDiagonalBound(diagonalReverseBase - numDifferences, numDifferences, diagonalReverseBase, numDiagonals);\r\n diagonalReverseEnd = this.ClipDiagonalBound(diagonalReverseBase + numDifferences, numDifferences, diagonalReverseBase, numDiagonals);\r\n for (let diagonal = diagonalReverseStart; diagonal <= diagonalReverseEnd; diagonal += 2) {\r\n // STEP 1: We extend the furthest reaching point in the present diagonal\r\n // by looking at the diagonals above and below and picking the one whose point\r\n // is further away from the start point (originalEnd, modifiedEnd)\r\n if (diagonal === diagonalReverseStart || (diagonal < diagonalReverseEnd && reversePoints[diagonal - 1] >= reversePoints[diagonal + 1])) {\r\n originalIndex = reversePoints[diagonal + 1] - 1;\r\n }\r\n else {\r\n originalIndex = reversePoints[diagonal - 1];\r\n }\r\n modifiedIndex = originalIndex - (diagonal - diagonalReverseBase) - diagonalReverseOffset;\r\n // Save the current originalIndex so we can test for false overlap\r\n const tempOriginalIndex = originalIndex;\r\n // STEP 2: We can continue to extend the furthest reaching point in the present diagonal\r\n // as long as the elements are equal.\r\n while (originalIndex > originalStart && modifiedIndex > modifiedStart && this.ElementsAreEqual(originalIndex, modifiedIndex)) {\r\n originalIndex--;\r\n modifiedIndex--;\r\n }\r\n reversePoints[diagonal] = originalIndex;\r\n // STEP 4: If delta is even (overlap first happens on reverse when delta is even)\r\n // and diagonal is in the range of forward diagonals computed for numDifferences\r\n // then check for overlap.\r\n if (deltaIsEven && Math.abs(diagonal - diagonalForwardBase) <= numDifferences) {\r\n if (originalIndex <= forwardPoints[diagonal]) {\r\n midOriginalArr[0] = originalIndex;\r\n midModifiedArr[0] = modifiedIndex;\r\n if (tempOriginalIndex >= forwardPoints[diagonal] && 1447 /* MaxDifferencesHistory */ > 0 && numDifferences <= (1447 /* MaxDifferencesHistory */ + 1)) {\r\n // BINGO! We overlapped, and we have the full trace in memory!\r\n return this.WALKTRACE(diagonalForwardBase, diagonalForwardStart, diagonalForwardEnd, diagonalForwardOffset, diagonalReverseBase, diagonalReverseStart, diagonalReverseEnd, diagonalReverseOffset, forwardPoints, reversePoints, originalIndex, originalEnd, midOriginalArr, modifiedIndex, modifiedEnd, midModifiedArr, deltaIsEven, quitEarlyArr);\r\n }\r\n else {\r\n // Either false overlap, or we didn't have enough memory for the full trace\r\n // Just return the recursion point\r\n return null;\r\n }\r\n }\r\n }\r\n }\r\n // Save current vectors to history before the next iteration\r\n if (numDifferences <= 1447 /* MaxDifferencesHistory */) {\r\n // We are allocating space for one extra int, which we fill with\r\n // the index of the diagonal base index\r\n let temp = new Int32Array(diagonalForwardEnd - diagonalForwardStart + 2);\r\n temp[0] = diagonalForwardBase - diagonalForwardStart + 1;\r\n MyArray.Copy2(forwardPoints, diagonalForwardStart, temp, 1, diagonalForwardEnd - diagonalForwardStart + 1);\r\n this.m_forwardHistory.push(temp);\r\n temp = new Int32Array(diagonalReverseEnd - diagonalReverseStart + 2);\r\n temp[0] = diagonalReverseBase - diagonalReverseStart + 1;\r\n MyArray.Copy2(reversePoints, diagonalReverseStart, temp, 1, diagonalReverseEnd - diagonalReverseStart + 1);\r\n this.m_reverseHistory.push(temp);\r\n }\r\n }\r\n // If we got here, then we have the full trace in history. We just have to convert it to a change list\r\n // NOTE: This part is a bit messy\r\n return this.WALKTRACE(diagonalForwardBase, diagonalForwardStart, diagonalForwardEnd, diagonalForwardOffset, diagonalReverseBase, diagonalReverseStart, diagonalReverseEnd, diagonalReverseOffset, forwardPoints, reversePoints, originalIndex, originalEnd, midOriginalArr, modifiedIndex, modifiedEnd, midModifiedArr, deltaIsEven, quitEarlyArr);\r\n }\r\n /**\r\n * Shifts the given changes to provide a more intuitive diff.\r\n * While the first element in a diff matches the first element after the diff,\r\n * we shift the diff down.\r\n *\r\n * @param changes The list of changes to shift\r\n * @returns The shifted changes\r\n */\r\n PrettifyChanges(changes) {\r\n // Shift all the changes down first\r\n for (let i = 0; i < changes.length; i++) {\r\n const change = changes[i];\r\n const originalStop = (i < changes.length - 1) ? changes[i + 1].originalStart : this._originalElementsOrHash.length;\r\n const modifiedStop = (i < changes.length - 1) ? changes[i + 1].modifiedStart : this._modifiedElementsOrHash.length;\r\n const checkOriginal = change.originalLength > 0;\r\n const checkModified = change.modifiedLength > 0;\r\n while (change.originalStart + change.originalLength < originalStop\r\n && change.modifiedStart + change.modifiedLength < modifiedStop\r\n && (!checkOriginal || this.OriginalElementsAreEqual(change.originalStart, change.originalStart + change.originalLength))\r\n && (!checkModified || this.ModifiedElementsAreEqual(change.modifiedStart, change.modifiedStart + change.modifiedLength))) {\r\n const startStrictEqual = this.ElementsAreStrictEqual(change.originalStart, change.modifiedStart);\r\n const endStrictEqual = this.ElementsAreStrictEqual(change.originalStart + change.originalLength, change.modifiedStart + change.modifiedLength);\r\n if (endStrictEqual && !startStrictEqual) {\r\n // moving the change down would create an equal change, but the elements are not strict equal\r\n break;\r\n }\r\n change.originalStart++;\r\n change.modifiedStart++;\r\n }\r\n let mergedChangeArr = [null];\r\n if (i < changes.length - 1 && this.ChangesOverlap(changes[i], changes[i + 1], mergedChangeArr)) {\r\n changes[i] = mergedChangeArr[0];\r\n changes.splice(i + 1, 1);\r\n i--;\r\n continue;\r\n }\r\n }\r\n // Shift changes back up until we hit empty or whitespace-only lines\r\n for (let i = changes.length - 1; i >= 0; i--) {\r\n const change = changes[i];\r\n let originalStop = 0;\r\n let modifiedStop = 0;\r\n if (i > 0) {\r\n const prevChange = changes[i - 1];\r\n originalStop = prevChange.originalStart + prevChange.originalLength;\r\n modifiedStop = prevChange.modifiedStart + prevChange.modifiedLength;\r\n }\r\n const checkOriginal = change.originalLength > 0;\r\n const checkModified = change.modifiedLength > 0;\r\n let bestDelta = 0;\r\n let bestScore = this._boundaryScore(change.originalStart, change.originalLength, change.modifiedStart, change.modifiedLength);\r\n for (let delta = 1;; delta++) {\r\n const originalStart = change.originalStart - delta;\r\n const modifiedStart = change.modifiedStart - delta;\r\n if (originalStart < originalStop || modifiedStart < modifiedStop) {\r\n break;\r\n }\r\n if (checkOriginal && !this.OriginalElementsAreEqual(originalStart, originalStart + change.originalLength)) {\r\n break;\r\n }\r\n if (checkModified && !this.ModifiedElementsAreEqual(modifiedStart, modifiedStart + change.modifiedLength)) {\r\n break;\r\n }\r\n const touchingPreviousChange = (originalStart === originalStop && modifiedStart === modifiedStop);\r\n const score = ((touchingPreviousChange ? 5 : 0)\r\n + this._boundaryScore(originalStart, change.originalLength, modifiedStart, change.modifiedLength));\r\n if (score > bestScore) {\r\n bestScore = score;\r\n bestDelta = delta;\r\n }\r\n }\r\n change.originalStart -= bestDelta;\r\n change.modifiedStart -= bestDelta;\r\n const mergedChangeArr = [null];\r\n if (i > 0 && this.ChangesOverlap(changes[i - 1], changes[i], mergedChangeArr)) {\r\n changes[i - 1] = mergedChangeArr[0];\r\n changes.splice(i, 1);\r\n i++;\r\n continue;\r\n }\r\n }\r\n // There could be multiple longest common substrings.\r\n // Give preference to the ones containing longer lines\r\n if (this._hasStrings) {\r\n for (let i = 1, len = changes.length; i < len; i++) {\r\n const aChange = changes[i - 1];\r\n const bChange = changes[i];\r\n const matchedLength = bChange.originalStart - aChange.originalStart - aChange.originalLength;\r\n const aOriginalStart = aChange.originalStart;\r\n const bOriginalEnd = bChange.originalStart + bChange.originalLength;\r\n const abOriginalLength = bOriginalEnd - aOriginalStart;\r\n const aModifiedStart = aChange.modifiedStart;\r\n const bModifiedEnd = bChange.modifiedStart + bChange.modifiedLength;\r\n const abModifiedLength = bModifiedEnd - aModifiedStart;\r\n // Avoid wasting a lot of time with these searches\r\n if (matchedLength < 5 && abOriginalLength < 20 && abModifiedLength < 20) {\r\n const t = this._findBetterContiguousSequence(aOriginalStart, abOriginalLength, aModifiedStart, abModifiedLength, matchedLength);\r\n if (t) {\r\n const [originalMatchStart, modifiedMatchStart] = t;\r\n if (originalMatchStart !== aChange.originalStart + aChange.originalLength || modifiedMatchStart !== aChange.modifiedStart + aChange.modifiedLength) {\r\n // switch to another sequence that has a better score\r\n aChange.originalLength = originalMatchStart - aChange.originalStart;\r\n aChange.modifiedLength = modifiedMatchStart - aChange.modifiedStart;\r\n bChange.originalStart = originalMatchStart + matchedLength;\r\n bChange.modifiedStart = modifiedMatchStart + matchedLength;\r\n bChange.originalLength = bOriginalEnd - bChange.originalStart;\r\n bChange.modifiedLength = bModifiedEnd - bChange.modifiedStart;\r\n }\r\n }\r\n }\r\n }\r\n }\r\n return changes;\r\n }\r\n _findBetterContiguousSequence(originalStart, originalLength, modifiedStart, modifiedLength, desiredLength) {\r\n if (originalLength < desiredLength || modifiedLength < desiredLength) {\r\n return null;\r\n }\r\n const originalMax = originalStart + originalLength - desiredLength + 1;\r\n const modifiedMax = modifiedStart + modifiedLength - desiredLength + 1;\r\n let bestScore = 0;\r\n let bestOriginalStart = 0;\r\n let bestModifiedStart = 0;\r\n for (let i = originalStart; i < originalMax; i++) {\r\n for (let j = modifiedStart; j < modifiedMax; j++) {\r\n const score = this._contiguousSequenceScore(i, j, desiredLength);\r\n if (score > 0 && score > bestScore) {\r\n bestScore = score;\r\n bestOriginalStart = i;\r\n bestModifiedStart = j;\r\n }\r\n }\r\n }\r\n if (bestScore > 0) {\r\n return [bestOriginalStart, bestModifiedStart];\r\n }\r\n return null;\r\n }\r\n _contiguousSequenceScore(originalStart, modifiedStart, length) {\r\n let score = 0;\r\n for (let l = 0; l < length; l++) {\r\n if (!this.ElementsAreEqual(originalStart + l, modifiedStart + l)) {\r\n return 0;\r\n }\r\n score += this._originalStringElements[originalStart + l].length;\r\n }\r\n return score;\r\n }\r\n _OriginalIsBoundary(index) {\r\n if (index <= 0 || index >= this._originalElementsOrHash.length - 1) {\r\n return true;\r\n }\r\n return (this._hasStrings && /^\\s*$/.test(this._originalStringElements[index]));\r\n }\r\n _OriginalRegionIsBoundary(originalStart, originalLength) {\r\n if (this._OriginalIsBoundary(originalStart) || this._OriginalIsBoundary(originalStart - 1)) {\r\n return true;\r\n }\r\n if (originalLength > 0) {\r\n const originalEnd = originalStart + originalLength;\r\n if (this._OriginalIsBoundary(originalEnd - 1) || this._OriginalIsBoundary(originalEnd)) {\r\n return true;\r\n }\r\n }\r\n return false;\r\n }\r\n _ModifiedIsBoundary(index) {\r\n if (index <= 0 || index >= this._modifiedElementsOrHash.length - 1) {\r\n return true;\r\n }\r\n return (this._hasStrings && /^\\s*$/.test(this._modifiedStringElements[index]));\r\n }\r\n _ModifiedRegionIsBoundary(modifiedStart, modifiedLength) {\r\n if (this._ModifiedIsBoundary(modifiedStart) || this._ModifiedIsBoundary(modifiedStart - 1)) {\r\n return true;\r\n }\r\n if (modifiedLength > 0) {\r\n const modifiedEnd = modifiedStart + modifiedLength;\r\n if (this._ModifiedIsBoundary(modifiedEnd - 1) || this._ModifiedIsBoundary(modifiedEnd)) {\r\n return true;\r\n }\r\n }\r\n return false;\r\n }\r\n _boundaryScore(originalStart, originalLength, modifiedStart, modifiedLength) {\r\n const originalScore = (this._OriginalRegionIsBoundary(originalStart, originalLength) ? 1 : 0);\r\n const modifiedScore = (this._ModifiedRegionIsBoundary(modifiedStart, modifiedLength) ? 1 : 0);\r\n return (originalScore + modifiedScore);\r\n }\r\n /**\r\n * Concatenates the two input DiffChange lists and returns the resulting\r\n * list.\r\n * @param The left changes\r\n * @param The right changes\r\n * @returns The concatenated list\r\n */\r\n ConcatenateChanges(left, right) {\r\n let mergedChangeArr = [];\r\n if (left.length === 0 || right.length === 0) {\r\n return (right.length > 0) ? right : left;\r\n }\r\n else if (this.ChangesOverlap(left[left.length - 1], right[0], mergedChangeArr)) {\r\n // Since we break the problem down recursively, it is possible that we\r\n // might recurse in the middle of a change thereby splitting it into\r\n // two changes. Here in the combining stage, we detect and fuse those\r\n // changes back together\r\n const result = new Array(left.length + right.length - 1);\r\n MyArray.Copy(left, 0, result, 0, left.length - 1);\r\n result[left.length - 1] = mergedChangeArr[0];\r\n MyArray.Copy(right, 1, result, left.length, right.length - 1);\r\n return result;\r\n }\r\n else {\r\n const result = new Array(left.length + right.length);\r\n MyArray.Copy(left, 0, result, 0, left.length);\r\n MyArray.Copy(right, 0, result, left.length, right.length);\r\n return result;\r\n }\r\n }\r\n /**\r\n * Returns true if the two changes overlap and can be merged into a single\r\n * change\r\n * @param left The left change\r\n * @param right The right change\r\n * @param mergedChange The merged change if the two overlap, null otherwise\r\n * @returns True if the two changes overlap\r\n */\r\n ChangesOverlap(left, right, mergedChangeArr) {\r\n Debug.Assert(left.originalStart <= right.originalStart, 'Left change is not less than or equal to right change');\r\n Debug.Assert(left.modifiedStart <= right.modifiedStart, 'Left change is not less than or equal to right change');\r\n if (left.originalStart + left.originalLength >= right.originalStart || left.modifiedStart + left.modifiedLength >= right.modifiedStart) {\r\n const originalStart = left.originalStart;\r\n let originalLength = left.originalLength;\r\n const modifiedStart = left.modifiedStart;\r\n let modifiedLength = left.modifiedLength;\r\n if (left.originalStart + left.originalLength >= right.originalStart) {\r\n originalLength = right.originalStart + right.originalLength - left.originalStart;\r\n }\r\n if (left.modifiedStart + left.modifiedLength >= right.modifiedStart) {\r\n modifiedLength = right.modifiedStart + right.modifiedLength - left.modifiedStart;\r\n }\r\n mergedChangeArr[0] = new DiffChange(originalStart, originalLength, modifiedStart, modifiedLength);\r\n return true;\r\n }\r\n else {\r\n mergedChangeArr[0] = null;\r\n return false;\r\n }\r\n }\r\n /**\r\n * Helper method used to clip a diagonal index to the range of valid\r\n * diagonals. This also decides whether or not the diagonal index,\r\n * if it exceeds the boundary, should be clipped to the boundary or clipped\r\n * one inside the boundary depending on the Even/Odd status of the boundary\r\n * and numDifferences.\r\n * @param diagonal The index of the diagonal to clip.\r\n * @param numDifferences The current number of differences being iterated upon.\r\n * @param diagonalBaseIndex The base reference diagonal.\r\n * @param numDiagonals The total number of diagonals.\r\n * @returns The clipped diagonal index.\r\n */\r\n ClipDiagonalBound(diagonal, numDifferences, diagonalBaseIndex, numDiagonals) {\r\n if (diagonal >= 0 && diagonal < numDiagonals) {\r\n // Nothing to clip, its in range\r\n return diagonal;\r\n }\r\n // diagonalsBelow: The number of diagonals below the reference diagonal\r\n // diagonalsAbove: The number of diagonals above the reference diagonal\r\n const diagonalsBelow = diagonalBaseIndex;\r\n const diagonalsAbove = numDiagonals - diagonalBaseIndex - 1;\r\n const diffEven = (numDifferences % 2 === 0);\r\n if (diagonal < 0) {\r\n const lowerBoundEven = (diagonalsBelow % 2 === 0);\r\n return (diffEven === lowerBoundEven) ? 0 : 1;\r\n }\r\n else {\r\n const upperBoundEven = (diagonalsAbove % 2 === 0);\r\n return (diffEven === upperBoundEven) ? numDiagonals - 1 : numDiagonals - 2;\r\n }\r\n }\r\n}\r\n", "/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License. See License.txt in the project root for license information.\r\n *--------------------------------------------------------------------------------------------*/\r\nimport { LcsDiff } from '../../../base/common/diff/diff.js';\r\nimport * as strings from '../../../base/common/strings.js';\r\nconst MINIMUM_MATCHING_CHARACTER_LENGTH = 3;\r\nfunction computeDiff(originalSequence, modifiedSequence, continueProcessingPredicate, pretty) {\r\n const diffAlgo = new LcsDiff(originalSequence, modifiedSequence, continueProcessingPredicate);\r\n return diffAlgo.ComputeDiff(pretty);\r\n}\r\nclass LineSequence {\r\n constructor(lines) {\r\n const startColumns = [];\r\n const endColumns = [];\r\n for (let i = 0, length = lines.length; i < length; i++) {\r\n startColumns[i] = getFirstNonBlankColumn(lines[i], 1);\r\n endColumns[i] = getLastNonBlankColumn(lines[i], 1);\r\n }\r\n this.lines = lines;\r\n this._startColumns = startColumns;\r\n this._endColumns = endColumns;\r\n }\r\n getElements() {\r\n const elements = [];\r\n for (let i = 0, len = this.lines.length; i < len; i++) {\r\n elements[i] = this.lines[i].substring(this._startColumns[i] - 1, this._endColumns[i] - 1);\r\n }\r\n return elements;\r\n }\r\n getStrictElement(index) {\r\n return this.lines[index];\r\n }\r\n getStartLineNumber(i) {\r\n return i + 1;\r\n }\r\n getEndLineNumber(i) {\r\n return i + 1;\r\n }\r\n createCharSequence(shouldIgnoreTrimWhitespace, startIndex, endIndex) {\r\n const charCodes = [];\r\n const lineNumbers = [];\r\n const columns = [];\r\n let len = 0;\r\n for (let index = startIndex; index <= endIndex; index++) {\r\n const lineContent = this.lines[index];\r\n const startColumn = (shouldIgnoreTrimWhitespace ? this._startColumns[index] : 1);\r\n const endColumn = (shouldIgnoreTrimWhitespace ? this._endColumns[index] : lineContent.length + 1);\r\n for (let col = startColumn; col < endColumn; col++) {\r\n charCodes[len] = lineContent.charCodeAt(col - 1);\r\n lineNumbers[len] = index + 1;\r\n columns[len] = col;\r\n len++;\r\n }\r\n }\r\n return new CharSequence(charCodes, lineNumbers, columns);\r\n }\r\n}\r\nclass CharSequence {\r\n constructor(charCodes, lineNumbers, columns) {\r\n this._charCodes = charCodes;\r\n this._lineNumbers = lineNumbers;\r\n this._columns = columns;\r\n }\r\n getElements() {\r\n return this._charCodes;\r\n }\r\n getStartLineNumber(i) {\r\n return this._lineNumbers[i];\r\n }\r\n getStartColumn(i) {\r\n return this._columns[i];\r\n }\r\n getEndLineNumber(i) {\r\n return this._lineNumbers[i];\r\n }\r\n getEndColumn(i) {\r\n return this._columns[i] + 1;\r\n }\r\n}\r\nclass CharChange {\r\n constructor(originalStartLineNumber, originalStartColumn, originalEndLineNumber, originalEndColumn, modifiedStartLineNumber, modifiedStartColumn, modifiedEndLineNumber, modifiedEndColumn) {\r\n this.originalStartLineNumber = originalStartLineNumber;\r\n this.originalStartColumn = originalStartColumn;\r\n this.originalEndLineNumber = originalEndLineNumber;\r\n this.originalEndColumn = originalEndColumn;\r\n this.modifiedStartLineNumber = modifiedStartLineNumber;\r\n this.modifiedStartColumn = modifiedStartColumn;\r\n this.modifiedEndLineNumber = modifiedEndLineNumber;\r\n this.modifiedEndColumn = modifiedEndColumn;\r\n }\r\n static createFromDiffChange(diffChange, originalCharSequence, modifiedCharSequence) {\r\n let originalStartLineNumber;\r\n let originalStartColumn;\r\n let originalEndLineNumber;\r\n let originalEndColumn;\r\n let modifiedStartLineNumber;\r\n let modifiedStartColumn;\r\n let modifiedEndLineNumber;\r\n let modifiedEndColumn;\r\n if (diffChange.originalLength === 0) {\r\n originalStartLineNumber = 0;\r\n originalStartColumn = 0;\r\n originalEndLineNumber = 0;\r\n originalEndColumn = 0;\r\n }\r\n else {\r\n originalStartLineNumber = originalCharSequence.getStartLineNumber(diffChange.originalStart);\r\n originalStartColumn = originalCharSequence.getStartColumn(diffChange.originalStart);\r\n originalEndLineNumber = originalCharSequence.getEndLineNumber(diffChange.originalStart + diffChange.originalLength - 1);\r\n originalEndColumn = originalCharSequence.getEndColumn(diffChange.originalStart + diffChange.originalLength - 1);\r\n }\r\n if (diffChange.modifiedLength === 0) {\r\n modifiedStartLineNumber = 0;\r\n modifiedStartColumn = 0;\r\n modifiedEndLineNumber = 0;\r\n modifiedEndColumn = 0;\r\n }\r\n else {\r\n modifiedStartLineNumber = modifiedCharSequence.getStartLineNumber(diffChange.modifiedStart);\r\n modifiedStartColumn = modifiedCharSequence.getStartColumn(diffChange.modifiedStart);\r\n modifiedEndLineNumber = modifiedCharSequence.getEndLineNumber(diffChange.modifiedStart + diffChange.modifiedLength - 1);\r\n modifiedEndColumn = modifiedCharSequence.getEndColumn(diffChange.modifiedStart + diffChange.modifiedLength - 1);\r\n }\r\n return new CharChange(originalStartLineNumber, originalStartColumn, originalEndLineNumber, originalEndColumn, modifiedStartLineNumber, modifiedStartColumn, modifiedEndLineNumber, modifiedEndColumn);\r\n }\r\n}\r\nfunction postProcessCharChanges(rawChanges) {\r\n if (rawChanges.length <= 1) {\r\n return rawChanges;\r\n }\r\n const result = [rawChanges[0]];\r\n let prevChange = result[0];\r\n for (let i = 1, len = rawChanges.length; i < len; i++) {\r\n const currChange = rawChanges[i];\r\n const originalMatchingLength = currChange.originalStart - (prevChange.originalStart + prevChange.originalLength);\r\n const modifiedMatchingLength = currChange.modifiedStart - (prevChange.modifiedStart + prevChange.modifiedLength);\r\n // Both of the above should be equal, but the continueProcessingPredicate may prevent this from being true\r\n const matchingLength = Math.min(originalMatchingLength, modifiedMatchingLength);\r\n if (matchingLength < MINIMUM_MATCHING_CHARACTER_LENGTH) {\r\n // Merge the current change into the previous one\r\n prevChange.originalLength = (currChange.originalStart + currChange.originalLength) - prevChange.originalStart;\r\n prevChange.modifiedLength = (currChange.modifiedStart + currChange.modifiedLength) - prevChange.modifiedStart;\r\n }\r\n else {\r\n // Add the current change\r\n result.push(currChange);\r\n prevChange = currChange;\r\n }\r\n }\r\n return result;\r\n}\r\nclass LineChange {\r\n constructor(originalStartLineNumber, originalEndLineNumber, modifiedStartLineNumber, modifiedEndLineNumber, charChanges) {\r\n this.originalStartLineNumber = originalStartLineNumber;\r\n this.originalEndLineNumber = originalEndLineNumber;\r\n this.modifiedStartLineNumber = modifiedStartLineNumber;\r\n this.modifiedEndLineNumber = modifiedEndLineNumber;\r\n this.charChanges = charChanges;\r\n }\r\n static createFromDiffResult(shouldIgnoreTrimWhitespace, diffChange, originalLineSequence, modifiedLineSequence, continueCharDiff, shouldComputeCharChanges, shouldPostProcessCharChanges) {\r\n let originalStartLineNumber;\r\n let originalEndLineNumber;\r\n let modifiedStartLineNumber;\r\n let modifiedEndLineNumber;\r\n let charChanges = undefined;\r\n if (diffChange.originalLength === 0) {\r\n originalStartLineNumber = originalLineSequence.getStartLineNumber(diffChange.originalStart) - 1;\r\n originalEndLineNumber = 0;\r\n }\r\n else {\r\n originalStartLineNumber = originalLineSequence.getStartLineNumber(diffChange.originalStart);\r\n originalEndLineNumber = originalLineSequence.getEndLineNumber(diffChange.originalStart + diffChange.originalLength - 1);\r\n }\r\n if (diffChange.modifiedLength === 0) {\r\n modifiedStartLineNumber = modifiedLineSequence.getStartLineNumber(diffChange.modifiedStart) - 1;\r\n modifiedEndLineNumber = 0;\r\n }\r\n else {\r\n modifiedStartLineNumber = modifiedLineSequence.getStartLineNumber(diffChange.modifiedStart);\r\n modifiedEndLineNumber = modifiedLineSequence.getEndLineNumber(diffChange.modifiedStart + diffChange.modifiedLength - 1);\r\n }\r\n if (shouldComputeCharChanges && diffChange.originalLength > 0 && diffChange.originalLength < 20 && diffChange.modifiedLength > 0 && diffChange.modifiedLength < 20 && continueCharDiff()) {\r\n // Compute character changes for diff chunks of at most 20 lines...\r\n const originalCharSequence = originalLineSequence.createCharSequence(shouldIgnoreTrimWhitespace, diffChange.originalStart, diffChange.originalStart + diffChange.originalLength - 1);\r\n const modifiedCharSequence = modifiedLineSequence.createCharSequence(shouldIgnoreTrimWhitespace, diffChange.modifiedStart, diffChange.modifiedStart + diffChange.modifiedLength - 1);\r\n let rawChanges = computeDiff(originalCharSequence, modifiedCharSequence, continueCharDiff, true).changes;\r\n if (shouldPostProcessCharChanges) {\r\n rawChanges = postProcessCharChanges(rawChanges);\r\n }\r\n charChanges = [];\r\n for (let i = 0, length = rawChanges.length; i < length; i++) {\r\n charChanges.push(CharChange.createFromDiffChange(rawChanges[i], originalCharSequence, modifiedCharSequence));\r\n }\r\n }\r\n return new LineChange(originalStartLineNumber, originalEndLineNumber, modifiedStartLineNumber, modifiedEndLineNumber, charChanges);\r\n }\r\n}\r\nexport class DiffComputer {\r\n constructor(originalLines, modifiedLines, opts) {\r\n this.shouldComputeCharChanges = opts.shouldComputeCharChanges;\r\n this.shouldPostProcessCharChanges = opts.shouldPostProcessCharChanges;\r\n this.shouldIgnoreTrimWhitespace = opts.shouldIgnoreTrimWhitespace;\r\n this.shouldMakePrettyDiff = opts.shouldMakePrettyDiff;\r\n this.originalLines = originalLines;\r\n this.modifiedLines = modifiedLines;\r\n this.original = new LineSequence(originalLines);\r\n this.modified = new LineSequence(modifiedLines);\r\n this.continueLineDiff = createContinueProcessingPredicate(opts.maxComputationTime);\r\n this.continueCharDiff = createContinueProcessingPredicate(opts.maxComputationTime === 0 ? 0 : Math.min(opts.maxComputationTime, 5000)); // never run after 5s for character changes...\r\n }\r\n computeDiff() {\r\n if (this.original.lines.length === 1 && this.original.lines[0].length === 0) {\r\n // empty original => fast path\r\n if (this.modified.lines.length === 1 && this.modified.lines[0].length === 0) {\r\n return {\r\n quitEarly: false,\r\n changes: []\r\n };\r\n }\r\n return {\r\n quitEarly: false,\r\n changes: [{\r\n originalStartLineNumber: 1,\r\n originalEndLineNumber: 1,\r\n modifiedStartLineNumber: 1,\r\n modifiedEndLineNumber: this.modified.lines.length,\r\n charChanges: [{\r\n modifiedEndColumn: 0,\r\n modifiedEndLineNumber: 0,\r\n modifiedStartColumn: 0,\r\n modifiedStartLineNumber: 0,\r\n originalEndColumn: 0,\r\n originalEndLineNumber: 0,\r\n originalStartColumn: 0,\r\n originalStartLineNumber: 0\r\n }]\r\n }]\r\n };\r\n }\r\n if (this.modified.lines.length === 1 && this.modified.lines[0].length === 0) {\r\n // empty modified => fast path\r\n return {\r\n quitEarly: false,\r\n changes: [{\r\n originalStartLineNumber: 1,\r\n originalEndLineNumber: this.original.lines.length,\r\n modifiedStartLineNumber: 1,\r\n modifiedEndLineNumber: 1,\r\n charChanges: [{\r\n modifiedEndColumn: 0,\r\n modifiedEndLineNumber: 0,\r\n modifiedStartColumn: 0,\r\n modifiedStartLineNumber: 0,\r\n originalEndColumn: 0,\r\n originalEndLineNumber: 0,\r\n originalStartColumn: 0,\r\n originalStartLineNumber: 0\r\n }]\r\n }]\r\n };\r\n }\r\n const diffResult = computeDiff(this.original, this.modified, this.continueLineDiff, this.shouldMakePrettyDiff);\r\n const rawChanges = diffResult.changes;\r\n const quitEarly = diffResult.quitEarly;\r\n // The diff is always computed with ignoring trim whitespace\r\n // This ensures we get the prettiest diff\r\n if (this.shouldIgnoreTrimWhitespace) {\r\n const lineChanges = [];\r\n for (let i = 0, length = rawChanges.length; i < length; i++) {\r\n lineChanges.push(LineChange.createFromDiffResult(this.shouldIgnoreTrimWhitespace, rawChanges[i], this.original, this.modified, this.continueCharDiff, this.shouldComputeCharChanges, this.shouldPostProcessCharChanges));\r\n }\r\n return {\r\n quitEarly: quitEarly,\r\n changes: lineChanges\r\n };\r\n }\r\n // Need to post-process and introduce changes where the trim whitespace is different\r\n // Note that we are looping starting at -1 to also cover the lines before the first change\r\n const result = [];\r\n let originalLineIndex = 0;\r\n let modifiedLineIndex = 0;\r\n for (let i = -1 /* !!!! */, len = rawChanges.length; i < len; i++) {\r\n const nextChange = (i + 1 < len ? rawChanges[i + 1] : null);\r\n const originalStop = (nextChange ? nextChange.originalStart : this.originalLines.length);\r\n const modifiedStop = (nextChange ? nextChange.modifiedStart : this.modifiedLines.length);\r\n while (originalLineIndex < originalStop && modifiedLineIndex < modifiedStop) {\r\n const originalLine = this.originalLines[originalLineIndex];\r\n const modifiedLine = this.modifiedLines[modifiedLineIndex];\r\n if (originalLine !== modifiedLine) {\r\n // These lines differ only in trim whitespace\r\n // Check the leading whitespace\r\n {\r\n let originalStartColumn = getFirstNonBlankColumn(originalLine, 1);\r\n let modifiedStartColumn = getFirstNonBlankColumn(modifiedLine, 1);\r\n while (originalStartColumn > 1 && modifiedStartColumn > 1) {\r\n const originalChar = originalLine.charCodeAt(originalStartColumn - 2);\r\n const modifiedChar = modifiedLine.charCodeAt(modifiedStartColumn - 2);\r\n if (originalChar !== modifiedChar) {\r\n break;\r\n }\r\n originalStartColumn--;\r\n modifiedStartColumn--;\r\n }\r\n if (originalStartColumn > 1 || modifiedStartColumn > 1) {\r\n this._pushTrimWhitespaceCharChange(result, originalLineIndex + 1, 1, originalStartColumn, modifiedLineIndex + 1, 1, modifiedStartColumn);\r\n }\r\n }\r\n // Check the trailing whitespace\r\n {\r\n let originalEndColumn = getLastNonBlankColumn(originalLine, 1);\r\n let modifiedEndColumn = getLastNonBlankColumn(modifiedLine, 1);\r\n const originalMaxColumn = originalLine.length + 1;\r\n const modifiedMaxColumn = modifiedLine.length + 1;\r\n while (originalEndColumn < originalMaxColumn && modifiedEndColumn < modifiedMaxColumn) {\r\n const originalChar = originalLine.charCodeAt(originalEndColumn - 1);\r\n const modifiedChar = originalLine.charCodeAt(modifiedEndColumn - 1);\r\n if (originalChar !== modifiedChar) {\r\n break;\r\n }\r\n originalEndColumn++;\r\n modifiedEndColumn++;\r\n }\r\n if (originalEndColumn < originalMaxColumn || modifiedEndColumn < modifiedMaxColumn) {\r\n this._pushTrimWhitespaceCharChange(result, originalLineIndex + 1, originalEndColumn, originalMaxColumn, modifiedLineIndex + 1, modifiedEndColumn, modifiedMaxColumn);\r\n }\r\n }\r\n }\r\n originalLineIndex++;\r\n modifiedLineIndex++;\r\n }\r\n if (nextChange) {\r\n // Emit the actual change\r\n result.push(LineChange.createFromDiffResult(this.shouldIgnoreTrimWhitespace, nextChange, this.original, this.modified, this.continueCharDiff, this.shouldComputeCharChanges, this.shouldPostProcessCharChanges));\r\n originalLineIndex += nextChange.originalLength;\r\n modifiedLineIndex += nextChange.modifiedLength;\r\n }\r\n }\r\n return {\r\n quitEarly: quitEarly,\r\n changes: result\r\n };\r\n }\r\n _pushTrimWhitespaceCharChange(result, originalLineNumber, originalStartColumn, originalEndColumn, modifiedLineNumber, modifiedStartColumn, modifiedEndColumn) {\r\n if (this._mergeTrimWhitespaceCharChange(result, originalLineNumber, originalStartColumn, originalEndColumn, modifiedLineNumber, modifiedStartColumn, modifiedEndColumn)) {\r\n // Merged into previous\r\n return;\r\n }\r\n let charChanges = undefined;\r\n if (this.shouldComputeCharChanges) {\r\n charChanges = [new CharChange(originalLineNumber, originalStartColumn, originalLineNumber, originalEndColumn, modifiedLineNumber, modifiedStartColumn, modifiedLineNumber, modifiedEndColumn)];\r\n }\r\n result.push(new LineChange(originalLineNumber, originalLineNumber, modifiedLineNumber, modifiedLineNumber, charChanges));\r\n }\r\n _mergeTrimWhitespaceCharChange(result, originalLineNumber, originalStartColumn, originalEndColumn, modifiedLineNumber, modifiedStartColumn, modifiedEndColumn) {\r\n const len = result.length;\r\n if (len === 0) {\r\n return false;\r\n }\r\n const prevChange = result[len - 1];\r\n if (prevChange.originalEndLineNumber === 0 || prevChange.modifiedEndLineNumber === 0) {\r\n // Don't merge with inserts/deletes\r\n return false;\r\n }\r\n if (prevChange.originalEndLineNumber + 1 === originalLineNumber && prevChange.modifiedEndLineNumber + 1 === modifiedLineNumber) {\r\n prevChange.originalEndLineNumber = originalLineNumber;\r\n prevChange.modifiedEndLineNumber = modifiedLineNumber;\r\n if (this.shouldComputeCharChanges && prevChange.charChanges) {\r\n prevChange.charChanges.push(new CharChange(originalLineNumber, originalStartColumn, originalLineNumber, originalEndColumn, modifiedLineNumber, modifiedStartColumn, modifiedLineNumber, modifiedEndColumn));\r\n }\r\n return true;\r\n }\r\n return false;\r\n }\r\n}\r\nfunction getFirstNonBlankColumn(txt, defaultValue) {\r\n const r = strings.firstNonWhitespaceIndex(txt);\r\n if (r === -1) {\r\n return defaultValue;\r\n }\r\n return r + 1;\r\n}\r\nfunction getLastNonBlankColumn(txt, defaultValue) {\r\n const r = strings.lastNonWhitespaceIndex(txt);\r\n if (r === -1) {\r\n return defaultValue;\r\n }\r\n return r + 2;\r\n}\r\nfunction createContinueProcessingPredicate(maximumRuntime) {\r\n if (maximumRuntime === 0) {\r\n return () => true;\r\n }\r\n const startTime = Date.now();\r\n return () => {\r\n return Date.now() - startTime < maximumRuntime;\r\n };\r\n}\r\n", "/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License. See License.txt in the project root for license information.\r\n *--------------------------------------------------------------------------------------------*/\r\nimport { toUint32 } from '../../../base/common/uint.js';\r\nexport class PrefixSumIndexOfResult {\r\n constructor(index, remainder) {\r\n this._prefixSumIndexOfResultBrand = undefined;\r\n this.index = index;\r\n this.remainder = remainder;\r\n }\r\n}\r\nexport class PrefixSumComputer {\r\n constructor(values) {\r\n this.values = values;\r\n this.prefixSum = new Uint32Array(values.length);\r\n this.prefixSumValidIndex = new Int32Array(1);\r\n this.prefixSumValidIndex[0] = -1;\r\n }\r\n insertValues(insertIndex, insertValues) {\r\n insertIndex = toUint32(insertIndex);\r\n const oldValues = this.values;\r\n const oldPrefixSum = this.prefixSum;\r\n const insertValuesLen = insertValues.length;\r\n if (insertValuesLen === 0) {\r\n return false;\r\n }\r\n this.values = new Uint32Array(oldValues.length + insertValuesLen);\r\n this.values.set(oldValues.subarray(0, insertIndex), 0);\r\n this.values.set(oldValues.subarray(insertIndex), insertIndex + insertValuesLen);\r\n this.values.set(insertValues, insertIndex);\r\n if (insertIndex - 1 < this.prefixSumValidIndex[0]) {\r\n this.prefixSumValidIndex[0] = insertIndex - 1;\r\n }\r\n this.prefixSum = new Uint32Array(this.values.length);\r\n if (this.prefixSumValidIndex[0] >= 0) {\r\n this.prefixSum.set(oldPrefixSum.subarray(0, this.prefixSumValidIndex[0] + 1));\r\n }\r\n return true;\r\n }\r\n changeValue(index, value) {\r\n index = toUint32(index);\r\n value = toUint32(value);\r\n if (this.values[index] === value) {\r\n return false;\r\n }\r\n this.values[index] = value;\r\n if (index - 1 < this.prefixSumValidIndex[0]) {\r\n this.prefixSumValidIndex[0] = index - 1;\r\n }\r\n return true;\r\n }\r\n removeValues(startIndex, count) {\r\n startIndex = toUint32(startIndex);\r\n count = toUint32(count);\r\n const oldValues = this.values;\r\n const oldPrefixSum = this.prefixSum;\r\n if (startIndex >= oldValues.length) {\r\n return false;\r\n }\r\n let maxCount = oldValues.length - startIndex;\r\n if (count >= maxCount) {\r\n count = maxCount;\r\n }\r\n if (count === 0) {\r\n return false;\r\n }\r\n this.values = new Uint32Array(oldValues.length - count);\r\n this.values.set(oldValues.subarray(0, startIndex), 0);\r\n this.values.set(oldValues.subarray(startIndex + count), startIndex);\r\n this.prefixSum = new Uint32Array(this.values.length);\r\n if (startIndex - 1 < this.prefixSumValidIndex[0]) {\r\n this.prefixSumValidIndex[0] = startIndex - 1;\r\n }\r\n if (this.prefixSumValidIndex[0] >= 0) {\r\n this.prefixSum.set(oldPrefixSum.subarray(0, this.prefixSumValidIndex[0] + 1));\r\n }\r\n return true;\r\n }\r\n getTotalSum() {\r\n if (this.values.length === 0) {\r\n return 0;\r\n }\r\n return this._getPrefixSum(this.values.length - 1);\r\n }\r\n getPrefixSum(index) {\r\n if (index < 0) {\r\n return 0;\r\n }\r\n index = toUint32(index);\r\n return this._getPrefixSum(index);\r\n }\r\n _getPrefixSum(index) {\r\n if (index <= this.prefixSumValidIndex[0]) {\r\n return this.prefixSum[index];\r\n }\r\n let startIndex = this.prefixSumValidIndex[0] + 1;\r\n if (startIndex === 0) {\r\n this.prefixSum[0] = this.values[0];\r\n startIndex++;\r\n }\r\n if (index >= this.values.length) {\r\n index = this.values.length - 1;\r\n }\r\n for (let i = startIndex; i <= index; i++) {\r\n this.prefixSum[i] = this.prefixSum[i - 1] + this.values[i];\r\n }\r\n this.prefixSumValidIndex[0] = Math.max(this.prefixSumValidIndex[0], index);\r\n return this.prefixSum[index];\r\n }\r\n getIndexOf(sum) {\r\n sum = Math.floor(sum); //@perf\r\n // Compute all sums (to get a fully valid prefixSum)\r\n this.getTotalSum();\r\n let low = 0;\r\n let high = this.values.length - 1;\r\n let mid = 0;\r\n let midStop = 0;\r\n let midStart = 0;\r\n while (low <= high) {\r\n mid = low + ((high - low) / 2) | 0;\r\n midStop = this.prefixSum[mid];\r\n midStart = midStop - this.values[mid];\r\n if (sum < midStart) {\r\n high = mid - 1;\r\n }\r\n else if (sum >= midStop) {\r\n low = mid + 1;\r\n }\r\n else {\r\n break;\r\n }\r\n }\r\n return new PrefixSumIndexOfResult(mid, sum - midStart);\r\n }\r\n}\r\n", "/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License. See License.txt in the project root for license information.\r\n *--------------------------------------------------------------------------------------------*/\r\nimport { splitLines } from '../../../base/common/strings.js';\r\nimport { Position } from '../core/position.js';\r\nimport { PrefixSumComputer } from '../viewModel/prefixSumComputer.js';\r\nexport class MirrorTextModel {\r\n constructor(uri, lines, eol, versionId) {\r\n this._uri = uri;\r\n this._lines = lines;\r\n this._eol = eol;\r\n this._versionId = versionId;\r\n this._lineStarts = null;\r\n this._cachedTextValue = null;\r\n }\r\n dispose() {\r\n this._lines.length = 0;\r\n }\r\n get version() {\r\n return this._versionId;\r\n }\r\n getText() {\r\n if (this._cachedTextValue === null) {\r\n this._cachedTextValue = this._lines.join(this._eol);\r\n }\r\n return this._cachedTextValue;\r\n }\r\n onEvents(e) {\r\n if (e.eol && e.eol !== this._eol) {\r\n this._eol = e.eol;\r\n this._lineStarts = null;\r\n }\r\n // Update my lines\r\n const changes = e.changes;\r\n for (const change of changes) {\r\n this._acceptDeleteRange(change.range);\r\n this._acceptInsertText(new Position(change.range.startLineNumber, change.range.startColumn), change.text);\r\n }\r\n this._versionId = e.versionId;\r\n this._cachedTextValue = null;\r\n }\r\n _ensureLineStarts() {\r\n if (!this._lineStarts) {\r\n const eolLength = this._eol.length;\r\n const linesLength = this._lines.length;\r\n const lineStartValues = new Uint32Array(linesLength);\r\n for (let i = 0; i < linesLength; i++) {\r\n lineStartValues[i] = this._lines[i].length + eolLength;\r\n }\r\n this._lineStarts = new PrefixSumComputer(lineStartValues);\r\n }\r\n }\r\n /**\r\n * All changes to a line's text go through this method\r\n */\r\n _setLineText(lineIndex, newValue) {\r\n this._lines[lineIndex] = newValue;\r\n if (this._lineStarts) {\r\n // update prefix sum\r\n this._lineStarts.changeValue(lineIndex, this._lines[lineIndex].length + this._eol.length);\r\n }\r\n }\r\n _acceptDeleteRange(range) {\r\n if (range.startLineNumber === range.endLineNumber) {\r\n if (range.startColumn === range.endColumn) {\r\n // Nothing to delete\r\n return;\r\n }\r\n // Delete text on the affected line\r\n this._setLineText(range.startLineNumber - 1, this._lines[range.startLineNumber - 1].substring(0, range.startColumn - 1)\r\n + this._lines[range.startLineNumber - 1].substring(range.endColumn - 1));\r\n return;\r\n }\r\n // Take remaining text on last line and append it to remaining text on first line\r\n this._setLineText(range.startLineNumber - 1, this._lines[range.startLineNumber - 1].substring(0, range.startColumn - 1)\r\n + this._lines[range.endLineNumber - 1].substring(range.endColumn - 1));\r\n // Delete middle lines\r\n this._lines.splice(range.startLineNumber, range.endLineNumber - range.startLineNumber);\r\n if (this._lineStarts) {\r\n // update prefix sum\r\n this._lineStarts.removeValues(range.startLineNumber, range.endLineNumber - range.startLineNumber);\r\n }\r\n }\r\n _acceptInsertText(position, insertText) {\r\n if (insertText.length === 0) {\r\n // Nothing to insert\r\n return;\r\n }\r\n let insertLines = splitLines(insertText);\r\n if (insertLines.length === 1) {\r\n // Inserting text on one line\r\n this._setLineText(position.lineNumber - 1, this._lines[position.lineNumber - 1].substring(0, position.column - 1)\r\n + insertLines[0]\r\n + this._lines[position.lineNumber - 1].substring(position.column - 1));\r\n return;\r\n }\r\n // Append overflowing text from first line to the end of text to insert\r\n insertLines[insertLines.length - 1] += this._lines[position.lineNumber - 1].substring(position.column - 1);\r\n // Delete overflowing text from first line and insert text on first line\r\n this._setLineText(position.lineNumber - 1, this._lines[position.lineNumber - 1].substring(0, position.column - 1)\r\n + insertLines[0]);\r\n // Insert new lines & store lengths\r\n let newLengths = new Uint32Array(insertLines.length - 1);\r\n for (let i = 1; i < insertLines.length; i++) {\r\n this._lines.splice(position.lineNumber + i - 1, 0, insertLines[i]);\r\n newLengths[i - 1] = insertLines[i].length + this._eol.length;\r\n }\r\n if (this._lineStarts) {\r\n // update prefix sum\r\n this._lineStarts.insertValues(position.lineNumber, newLengths);\r\n }\r\n }\r\n}\r\n", "/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License. See License.txt in the project root for license information.\r\n *--------------------------------------------------------------------------------------------*/\r\nimport { CharacterClassifier } from '../core/characterClassifier.js';\r\nexport class Uint8Matrix {\r\n constructor(rows, cols, defaultValue) {\r\n const data = new Uint8Array(rows * cols);\r\n for (let i = 0, len = rows * cols; i < len; i++) {\r\n data[i] = defaultValue;\r\n }\r\n this._data = data;\r\n this.rows = rows;\r\n this.cols = cols;\r\n }\r\n get(row, col) {\r\n return this._data[row * this.cols + col];\r\n }\r\n set(row, col, value) {\r\n this._data[row * this.cols + col] = value;\r\n }\r\n}\r\nexport class StateMachine {\r\n constructor(edges) {\r\n let maxCharCode = 0;\r\n let maxState = 0 /* Invalid */;\r\n for (let i = 0, len = edges.length; i < len; i++) {\r\n let [from, chCode, to] = edges[i];\r\n if (chCode > maxCharCode) {\r\n maxCharCode = chCode;\r\n }\r\n if (from > maxState) {\r\n maxState = from;\r\n }\r\n if (to > maxState) {\r\n maxState = to;\r\n }\r\n }\r\n maxCharCode++;\r\n maxState++;\r\n let states = new Uint8Matrix(maxState, maxCharCode, 0 /* Invalid */);\r\n for (let i = 0, len = edges.length; i < len; i++) {\r\n let [from, chCode, to] = edges[i];\r\n states.set(from, chCode, to);\r\n }\r\n this._states = states;\r\n this._maxCharCode = maxCharCode;\r\n }\r\n nextState(currentState, chCode) {\r\n if (chCode < 0 || chCode >= this._maxCharCode) {\r\n return 0 /* Invalid */;\r\n }\r\n return this._states.get(currentState, chCode);\r\n }\r\n}\r\n// State machine for http:// or https:// or file://\r\nlet _stateMachine = null;\r\nfunction getStateMachine() {\r\n if (_stateMachine === null) {\r\n _stateMachine = new StateMachine([\r\n [1 /* Start */, 104 /* h */, 2 /* H */],\r\n [1 /* Start */, 72 /* H */, 2 /* H */],\r\n [1 /* Start */, 102 /* f */, 6 /* F */],\r\n [1 /* Start */, 70 /* F */, 6 /* F */],\r\n [2 /* H */, 116 /* t */, 3 /* HT */],\r\n [2 /* H */, 84 /* T */, 3 /* HT */],\r\n [3 /* HT */, 116 /* t */, 4 /* HTT */],\r\n [3 /* HT */, 84 /* T */, 4 /* HTT */],\r\n [4 /* HTT */, 112 /* p */, 5 /* HTTP */],\r\n [4 /* HTT */, 80 /* P */, 5 /* HTTP */],\r\n [5 /* HTTP */, 115 /* s */, 9 /* BeforeColon */],\r\n [5 /* HTTP */, 83 /* S */, 9 /* BeforeColon */],\r\n [5 /* HTTP */, 58 /* Colon */, 10 /* AfterColon */],\r\n [6 /* F */, 105 /* i */, 7 /* FI */],\r\n [6 /* F */, 73 /* I */, 7 /* FI */],\r\n [7 /* FI */, 108 /* l */, 8 /* FIL */],\r\n [7 /* FI */, 76 /* L */, 8 /* FIL */],\r\n [8 /* FIL */, 101 /* e */, 9 /* BeforeColon */],\r\n [8 /* FIL */, 69 /* E */, 9 /* BeforeColon */],\r\n [9 /* BeforeColon */, 58 /* Colon */, 10 /* AfterColon */],\r\n [10 /* AfterColon */, 47 /* Slash */, 11 /* AlmostThere */],\r\n [11 /* AlmostThere */, 47 /* Slash */, 12 /* End */],\r\n ]);\r\n }\r\n return _stateMachine;\r\n}\r\nlet _classifier = null;\r\nfunction getClassifier() {\r\n if (_classifier === null) {\r\n _classifier = new CharacterClassifier(0 /* None */);\r\n const FORCE_TERMINATION_CHARACTERS = ' \\t<>\\'\\\"\u3001\u3002\uFF61\uFF64\uFF0C\uFF0E\uFF1A\uFF1B\u2018\u3008\u300C\u300E\u3014\uFF08\uFF3B\uFF5B\uFF62\uFF63\uFF5D\uFF3D\uFF09\u3015\u300F\u300D\u3009\u2019\uFF40\uFF5E\u2026';\r\n for (let i = 0; i < FORCE_TERMINATION_CHARACTERS.length; i++) {\r\n _classifier.set(FORCE_TERMINATION_CHARACTERS.charCodeAt(i), 1 /* ForceTermination */);\r\n }\r\n const CANNOT_END_WITH_CHARACTERS = '.,;';\r\n for (let i = 0; i < CANNOT_END_WITH_CHARACTERS.length; i++) {\r\n _classifier.set(CANNOT_END_WITH_CHARACTERS.charCodeAt(i), 2 /* CannotEndIn */);\r\n }\r\n }\r\n return _classifier;\r\n}\r\nexport class LinkComputer {\r\n static _createLink(classifier, line, lineNumber, linkBeginIndex, linkEndIndex) {\r\n // Do not allow to end link in certain characters...\r\n let lastIncludedCharIndex = linkEndIndex - 1;\r\n do {\r\n const chCode = line.charCodeAt(lastIncludedCharIndex);\r\n const chClass = classifier.get(chCode);\r\n if (chClass !== 2 /* CannotEndIn */) {\r\n break;\r\n }\r\n lastIncludedCharIndex--;\r\n } while (lastIncludedCharIndex > linkBeginIndex);\r\n // Handle links enclosed in parens, square brackets and curlys.\r\n if (linkBeginIndex > 0) {\r\n const charCodeBeforeLink = line.charCodeAt(linkBeginIndex - 1);\r\n const lastCharCodeInLink = line.charCodeAt(lastIncludedCharIndex);\r\n if ((charCodeBeforeLink === 40 /* OpenParen */ && lastCharCodeInLink === 41 /* CloseParen */)\r\n || (charCodeBeforeLink === 91 /* OpenSquareBracket */ && lastCharCodeInLink === 93 /* CloseSquareBracket */)\r\n || (charCodeBeforeLink === 123 /* OpenCurlyBrace */ && lastCharCodeInLink === 125 /* CloseCurlyBrace */)) {\r\n // Do not end in ) if ( is before the link start\r\n // Do not end in ] if [ is before the link start\r\n // Do not end in } if { is before the link start\r\n lastIncludedCharIndex--;\r\n }\r\n }\r\n return {\r\n range: {\r\n startLineNumber: lineNumber,\r\n startColumn: linkBeginIndex + 1,\r\n endLineNumber: lineNumber,\r\n endColumn: lastIncludedCharIndex + 2\r\n },\r\n url: line.substring(linkBeginIndex, lastIncludedCharIndex + 1)\r\n };\r\n }\r\n static computeLinks(model, stateMachine = getStateMachine()) {\r\n const classifier = getClassifier();\r\n let result = [];\r\n for (let i = 1, lineCount = model.getLineCount(); i <= lineCount; i++) {\r\n const line = model.getLineContent(i);\r\n const len = line.length;\r\n let j = 0;\r\n let linkBeginIndex = 0;\r\n let linkBeginChCode = 0;\r\n let state = 1 /* Start */;\r\n let hasOpenParens = false;\r\n let hasOpenSquareBracket = false;\r\n let inSquareBrackets = false;\r\n let hasOpenCurlyBracket = false;\r\n while (j < len) {\r\n let resetStateMachine = false;\r\n const chCode = line.charCodeAt(j);\r\n if (state === 13 /* Accept */) {\r\n let chClass;\r\n switch (chCode) {\r\n case 40 /* OpenParen */:\r\n hasOpenParens = true;\r\n chClass = 0 /* None */;\r\n break;\r\n case 41 /* CloseParen */:\r\n chClass = (hasOpenParens ? 0 /* None */ : 1 /* ForceTermination */);\r\n break;\r\n case 91 /* OpenSquareBracket */:\r\n inSquareBrackets = true;\r\n hasOpenSquareBracket = true;\r\n chClass = 0 /* None */;\r\n break;\r\n case 93 /* CloseSquareBracket */:\r\n inSquareBrackets = false;\r\n chClass = (hasOpenSquareBracket ? 0 /* None */ : 1 /* ForceTermination */);\r\n break;\r\n case 123 /* OpenCurlyBrace */:\r\n hasOpenCurlyBracket = true;\r\n chClass = 0 /* None */;\r\n break;\r\n case 125 /* CloseCurlyBrace */:\r\n chClass = (hasOpenCurlyBracket ? 0 /* None */ : 1 /* ForceTermination */);\r\n break;\r\n /* The following three rules make it that ' or \" or ` are allowed inside links if the link began with a different one */\r\n case 39 /* SingleQuote */:\r\n chClass = (linkBeginChCode === 34 /* DoubleQuote */ || linkBeginChCode === 96 /* BackTick */) ? 0 /* None */ : 1 /* ForceTermination */;\r\n break;\r\n case 34 /* DoubleQuote */:\r\n chClass = (linkBeginChCode === 39 /* SingleQuote */ || linkBeginChCode === 96 /* BackTick */) ? 0 /* None */ : 1 /* ForceTermination */;\r\n break;\r\n case 96 /* BackTick */:\r\n chClass = (linkBeginChCode === 39 /* SingleQuote */ || linkBeginChCode === 34 /* DoubleQuote */) ? 0 /* None */ : 1 /* ForceTermination */;\r\n break;\r\n case 42 /* Asterisk */:\r\n // `*` terminates a link if the link began with `*`\r\n chClass = (linkBeginChCode === 42 /* Asterisk */) ? 1 /* ForceTermination */ : 0 /* None */;\r\n break;\r\n case 124 /* Pipe */:\r\n // `|` terminates a link if the link began with `|`\r\n chClass = (linkBeginChCode === 124 /* Pipe */) ? 1 /* ForceTermination */ : 0 /* None */;\r\n break;\r\n case 32 /* Space */:\r\n // ` ` allow space in between [ and ]\r\n chClass = (inSquareBrackets ? 0 /* None */ : 1 /* ForceTermination */);\r\n break;\r\n default:\r\n chClass = classifier.get(chCode);\r\n }\r\n // Check if character terminates link\r\n if (chClass === 1 /* ForceTermination */) {\r\n result.push(LinkComputer._createLink(classifier, line, i, linkBeginIndex, j));\r\n resetStateMachine = true;\r\n }\r\n }\r\n else if (state === 12 /* End */) {\r\n let chClass;\r\n if (chCode === 91 /* OpenSquareBracket */) {\r\n // Allow for the authority part to contain ipv6 addresses which contain [ and ]\r\n hasOpenSquareBracket = true;\r\n chClass = 0 /* None */;\r\n }\r\n else {\r\n chClass = classifier.get(chCode);\r\n }\r\n // Check if character terminates link\r\n if (chClass === 1 /* ForceTermination */) {\r\n resetStateMachine = true;\r\n }\r\n else {\r\n state = 13 /* Accept */;\r\n }\r\n }\r\n else {\r\n state = stateMachine.nextState(state, chCode);\r\n if (state === 0 /* Invalid */) {\r\n resetStateMachine = true;\r\n }\r\n }\r\n if (resetStateMachine) {\r\n state = 1 /* Start */;\r\n hasOpenParens = false;\r\n hasOpenSquareBracket = false;\r\n hasOpenCurlyBracket = false;\r\n // Record where the link started\r\n linkBeginIndex = j + 1;\r\n linkBeginChCode = chCode;\r\n }\r\n j++;\r\n }\r\n if (state === 13 /* Accept */) {\r\n result.push(LinkComputer._createLink(classifier, line, i, linkBeginIndex, len));\r\n }\r\n }\r\n return result;\r\n }\r\n}\r\n/**\r\n * Returns an array of all links contains in the provided\r\n * document. *Note* that this operation is computational\r\n * expensive and should not run in the UI thread.\r\n */\r\nexport function computeLinks(model) {\r\n if (!model || typeof model.getLineCount !== 'function' || typeof model.getLineContent !== 'function') {\r\n // Unknown caller!\r\n return [];\r\n }\r\n return LinkComputer.computeLinks(model);\r\n}\r\n", "/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License. See License.txt in the project root for license information.\r\n *--------------------------------------------------------------------------------------------*/\r\nexport class BasicInplaceReplace {\r\n constructor() {\r\n this._defaultValueSet = [\r\n ['true', 'false'],\r\n ['True', 'False'],\r\n ['Private', 'Public', 'Friend', 'ReadOnly', 'Partial', 'Protected', 'WriteOnly'],\r\n ['public', 'protected', 'private'],\r\n ];\r\n }\r\n navigateValueSet(range1, text1, range2, text2, up) {\r\n if (range1 && text1) {\r\n let result = this.doNavigateValueSet(text1, up);\r\n if (result) {\r\n return {\r\n range: range1,\r\n value: result\r\n };\r\n }\r\n }\r\n if (range2 && text2) {\r\n let result = this.doNavigateValueSet(text2, up);\r\n if (result) {\r\n return {\r\n range: range2,\r\n value: result\r\n };\r\n }\r\n }\r\n return null;\r\n }\r\n doNavigateValueSet(text, up) {\r\n let numberResult = this.numberReplace(text, up);\r\n if (numberResult !== null) {\r\n return numberResult;\r\n }\r\n return this.textReplace(text, up);\r\n }\r\n numberReplace(value, up) {\r\n let precision = Math.pow(10, value.length - (value.lastIndexOf('.') + 1));\r\n let n1 = Number(value);\r\n let n2 = parseFloat(value);\r\n if (!isNaN(n1) && !isNaN(n2) && n1 === n2) {\r\n if (n1 === 0 && !up) {\r\n return null; // don't do negative\r\n //\t\t\t} else if(n1 === 9 && up) {\r\n //\t\t\t\treturn null; // don't insert 10 into a number\r\n }\r\n else {\r\n n1 = Math.floor(n1 * precision);\r\n n1 += up ? precision : -precision;\r\n return String(n1 / precision);\r\n }\r\n }\r\n return null;\r\n }\r\n textReplace(value, up) {\r\n return this.valueSetsReplace(this._defaultValueSet, value, up);\r\n }\r\n valueSetsReplace(valueSets, value, up) {\r\n let result = null;\r\n for (let i = 0, len = valueSets.length; result === null && i < len; i++) {\r\n result = this.valueSetReplace(valueSets[i], value, up);\r\n }\r\n return result;\r\n }\r\n valueSetReplace(valueSet, value, up) {\r\n let idx = valueSet.indexOf(value);\r\n if (idx >= 0) {\r\n idx += up ? +1 : -1;\r\n if (idx < 0) {\r\n idx = valueSet.length - 1;\r\n }\r\n else {\r\n idx %= valueSet.length;\r\n }\r\n return valueSet[idx];\r\n }\r\n return null;\r\n }\r\n}\r\nBasicInplaceReplace.INSTANCE = new BasicInplaceReplace();\r\n", "/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License. See License.txt in the project root for license information.\r\n *--------------------------------------------------------------------------------------------*/\r\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\r\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n};\r\nimport { stringDiff } from '../../../base/common/diff/diff.js';\r\nimport { globals } from '../../../base/common/platform.js';\r\nimport { URI } from '../../../base/common/uri.js';\r\nimport { Position } from '../core/position.js';\r\nimport { Range } from '../core/range.js';\r\nimport { DiffComputer } from '../diff/diffComputer.js';\r\nimport { MirrorTextModel as BaseMirrorModel } from '../model/mirrorTextModel.js';\r\nimport { ensureValidWordDefinition, getWordAtText } from '../model/wordHelper.js';\r\nimport { computeLinks } from '../modes/linkComputer.js';\r\nimport { BasicInplaceReplace } from '../modes/supports/inplaceReplaceSupport.js';\r\nimport { createMonacoBaseAPI } from '../standalone/standaloneBase.js';\r\nimport * as types from '../../../base/common/types.js';\r\nimport { StopWatch } from '../../../base/common/stopwatch.js';\r\n/**\r\n * @internal\r\n */\r\nclass MirrorModel extends BaseMirrorModel {\r\n get uri() {\r\n return this._uri;\r\n }\r\n get eol() {\r\n return this._eol;\r\n }\r\n getValue() {\r\n return this.getText();\r\n }\r\n getLinesContent() {\r\n return this._lines.slice(0);\r\n }\r\n getLineCount() {\r\n return this._lines.length;\r\n }\r\n getLineContent(lineNumber) {\r\n return this._lines[lineNumber - 1];\r\n }\r\n getWordAtPosition(position, wordDefinition) {\r\n let wordAtText = getWordAtText(position.column, ensureValidWordDefinition(wordDefinition), this._lines[position.lineNumber - 1], 0);\r\n if (wordAtText) {\r\n return new Range(position.lineNumber, wordAtText.startColumn, position.lineNumber, wordAtText.endColumn);\r\n }\r\n return null;\r\n }\r\n words(wordDefinition) {\r\n const lines = this._lines;\r\n const wordenize = this._wordenize.bind(this);\r\n let lineNumber = 0;\r\n let lineText = '';\r\n let wordRangesIdx = 0;\r\n let wordRanges = [];\r\n return {\r\n *[Symbol.iterator]() {\r\n while (true) {\r\n if (wordRangesIdx < wordRanges.length) {\r\n const value = lineText.substring(wordRanges[wordRangesIdx].start, wordRanges[wordRangesIdx].end);\r\n wordRangesIdx += 1;\r\n yield value;\r\n }\r\n else {\r\n if (lineNumber < lines.length) {\r\n lineText = lines[lineNumber];\r\n wordRanges = wordenize(lineText, wordDefinition);\r\n wordRangesIdx = 0;\r\n lineNumber += 1;\r\n }\r\n else {\r\n break;\r\n }\r\n }\r\n }\r\n }\r\n };\r\n }\r\n getLineWords(lineNumber, wordDefinition) {\r\n let content = this._lines[lineNumber - 1];\r\n let ranges = this._wordenize(content, wordDefinition);\r\n let words = [];\r\n for (const range of ranges) {\r\n words.push({\r\n word: content.substring(range.start, range.end),\r\n startColumn: range.start + 1,\r\n endColumn: range.end + 1\r\n });\r\n }\r\n return words;\r\n }\r\n _wordenize(content, wordDefinition) {\r\n const result = [];\r\n let match;\r\n wordDefinition.lastIndex = 0; // reset lastIndex just to be sure\r\n while (match = wordDefinition.exec(content)) {\r\n if (match[0].length === 0) {\r\n // it did match the empty string\r\n break;\r\n }\r\n result.push({ start: match.index, end: match.index + match[0].length });\r\n }\r\n return result;\r\n }\r\n getValueInRange(range) {\r\n range = this._validateRange(range);\r\n if (range.startLineNumber === range.endLineNumber) {\r\n return this._lines[range.startLineNumber - 1].substring(range.startColumn - 1, range.endColumn - 1);\r\n }\r\n let lineEnding = this._eol;\r\n let startLineIndex = range.startLineNumber - 1;\r\n let endLineIndex = range.endLineNumber - 1;\r\n let resultLines = [];\r\n resultLines.push(this._lines[startLineIndex].substring(range.startColumn - 1));\r\n for (let i = startLineIndex + 1; i < endLineIndex; i++) {\r\n resultLines.push(this._lines[i]);\r\n }\r\n resultLines.push(this._lines[endLineIndex].substring(0, range.endColumn - 1));\r\n return resultLines.join(lineEnding);\r\n }\r\n offsetAt(position) {\r\n position = this._validatePosition(position);\r\n this._ensureLineStarts();\r\n return this._lineStarts.getPrefixSum(position.lineNumber - 2) + (position.column - 1);\r\n }\r\n positionAt(offset) {\r\n offset = Math.floor(offset);\r\n offset = Math.max(0, offset);\r\n this._ensureLineStarts();\r\n let out = this._lineStarts.getIndexOf(offset);\r\n let lineLength = this._lines[out.index].length;\r\n // Ensure we return a valid position\r\n return {\r\n lineNumber: 1 + out.index,\r\n column: 1 + Math.min(out.remainder, lineLength)\r\n };\r\n }\r\n _validateRange(range) {\r\n const start = this._validatePosition({ lineNumber: range.startLineNumber, column: range.startColumn });\r\n const end = this._validatePosition({ lineNumber: range.endLineNumber, column: range.endColumn });\r\n if (start.lineNumber !== range.startLineNumber\r\n || start.column !== range.startColumn\r\n || end.lineNumber !== range.endLineNumber\r\n || end.column !== range.endColumn) {\r\n return {\r\n startLineNumber: start.lineNumber,\r\n startColumn: start.column,\r\n endLineNumber: end.lineNumber,\r\n endColumn: end.column\r\n };\r\n }\r\n return range;\r\n }\r\n _validatePosition(position) {\r\n if (!Position.isIPosition(position)) {\r\n throw new Error('bad position');\r\n }\r\n let { lineNumber, column } = position;\r\n let hasChanged = false;\r\n if (lineNumber < 1) {\r\n lineNumber = 1;\r\n column = 1;\r\n hasChanged = true;\r\n }\r\n else if (lineNumber > this._lines.length) {\r\n lineNumber = this._lines.length;\r\n column = this._lines[lineNumber - 1].length + 1;\r\n hasChanged = true;\r\n }\r\n else {\r\n let maxCharacter = this._lines[lineNumber - 1].length + 1;\r\n if (column < 1) {\r\n column = 1;\r\n hasChanged = true;\r\n }\r\n else if (column > maxCharacter) {\r\n column = maxCharacter;\r\n hasChanged = true;\r\n }\r\n }\r\n if (!hasChanged) {\r\n return position;\r\n }\r\n else {\r\n return { lineNumber, column };\r\n }\r\n }\r\n}\r\n/**\r\n * @internal\r\n */\r\nexport class EditorSimpleWorker {\r\n constructor(host, foreignModuleFactory) {\r\n this._host = host;\r\n this._models = Object.create(null);\r\n this._foreignModuleFactory = foreignModuleFactory;\r\n this._foreignModule = null;\r\n }\r\n dispose() {\r\n this._models = Object.create(null);\r\n }\r\n _getModel(uri) {\r\n return this._models[uri];\r\n }\r\n _getModels() {\r\n let all = [];\r\n Object.keys(this._models).forEach((key) => all.push(this._models[key]));\r\n return all;\r\n }\r\n acceptNewModel(data) {\r\n this._models[data.url] = new MirrorModel(URI.parse(data.url), data.lines, data.EOL, data.versionId);\r\n }\r\n acceptModelChanged(strURL, e) {\r\n if (!this._models[strURL]) {\r\n return;\r\n }\r\n let model = this._models[strURL];\r\n model.onEvents(e);\r\n }\r\n acceptRemovedModel(strURL) {\r\n if (!this._models[strURL]) {\r\n return;\r\n }\r\n delete this._models[strURL];\r\n }\r\n // ---- BEGIN diff --------------------------------------------------------------------------\r\n computeDiff(originalUrl, modifiedUrl, ignoreTrimWhitespace, maxComputationTime) {\r\n return __awaiter(this, void 0, void 0, function* () {\r\n const original = this._getModel(originalUrl);\r\n const modified = this._getModel(modifiedUrl);\r\n if (!original || !modified) {\r\n return null;\r\n }\r\n const originalLines = original.getLinesContent();\r\n const modifiedLines = modified.getLinesContent();\r\n const diffComputer = new DiffComputer(originalLines, modifiedLines, {\r\n shouldComputeCharChanges: true,\r\n shouldPostProcessCharChanges: true,\r\n shouldIgnoreTrimWhitespace: ignoreTrimWhitespace,\r\n shouldMakePrettyDiff: true,\r\n maxComputationTime: maxComputationTime\r\n });\r\n const diffResult = diffComputer.computeDiff();\r\n const identical = (diffResult.changes.length > 0 ? false : this._modelsAreIdentical(original, modified));\r\n return {\r\n quitEarly: diffResult.quitEarly,\r\n identical: identical,\r\n changes: diffResult.changes\r\n };\r\n });\r\n }\r\n _modelsAreIdentical(original, modified) {\r\n const originalLineCount = original.getLineCount();\r\n const modifiedLineCount = modified.getLineCount();\r\n if (originalLineCount !== modifiedLineCount) {\r\n return false;\r\n }\r\n for (let line = 1; line <= originalLineCount; line++) {\r\n const originalLine = original.getLineContent(line);\r\n const modifiedLine = modified.getLineContent(line);\r\n if (originalLine !== modifiedLine) {\r\n return false;\r\n }\r\n }\r\n return true;\r\n }\r\n computeMoreMinimalEdits(modelUrl, edits) {\r\n return __awaiter(this, void 0, void 0, function* () {\r\n const model = this._getModel(modelUrl);\r\n if (!model) {\r\n return edits;\r\n }\r\n const result = [];\r\n let lastEol = undefined;\r\n edits = edits.slice(0).sort((a, b) => {\r\n if (a.range && b.range) {\r\n return Range.compareRangesUsingStarts(a.range, b.range);\r\n }\r\n // eol only changes should go to the end\r\n let aRng = a.range ? 0 : 1;\r\n let bRng = b.range ? 0 : 1;\r\n return aRng - bRng;\r\n });\r\n for (let { range, text, eol } of edits) {\r\n if (typeof eol === 'number') {\r\n lastEol = eol;\r\n }\r\n if (Range.isEmpty(range) && !text) {\r\n // empty change\r\n continue;\r\n }\r\n const original = model.getValueInRange(range);\r\n text = text.replace(/\\r\\n|\\n|\\r/g, model.eol);\r\n if (original === text) {\r\n // noop\r\n continue;\r\n }\r\n // make sure diff won't take too long\r\n if (Math.max(text.length, original.length) > EditorSimpleWorker._diffLimit) {\r\n result.push({ range, text });\r\n continue;\r\n }\r\n // compute diff between original and edit.text\r\n const changes = stringDiff(original, text, false);\r\n const editOffset = model.offsetAt(Range.lift(range).getStartPosition());\r\n for (const change of changes) {\r\n const start = model.positionAt(editOffset + change.originalStart);\r\n const end = model.positionAt(editOffset + change.originalStart + change.originalLength);\r\n const newEdit = {\r\n text: text.substr(change.modifiedStart, change.modifiedLength),\r\n range: { startLineNumber: start.lineNumber, startColumn: start.column, endLineNumber: end.lineNumber, endColumn: end.column }\r\n };\r\n if (model.getValueInRange(newEdit.range) !== newEdit.text) {\r\n result.push(newEdit);\r\n }\r\n }\r\n }\r\n if (typeof lastEol === 'number') {\r\n result.push({ eol: lastEol, text: '', range: { startLineNumber: 0, startColumn: 0, endLineNumber: 0, endColumn: 0 } });\r\n }\r\n return result;\r\n });\r\n }\r\n // ---- END minimal edits ---------------------------------------------------------------\r\n computeLinks(modelUrl) {\r\n return __awaiter(this, void 0, void 0, function* () {\r\n let model = this._getModel(modelUrl);\r\n if (!model) {\r\n return null;\r\n }\r\n return computeLinks(model);\r\n });\r\n }\r\n textualSuggest(modelUrls, leadingWord, wordDef, wordDefFlags) {\r\n return __awaiter(this, void 0, void 0, function* () {\r\n const sw = new StopWatch(true);\r\n const wordDefRegExp = new RegExp(wordDef, wordDefFlags);\r\n const seen = new Set();\r\n outer: for (let url of modelUrls) {\r\n const model = this._getModel(url);\r\n if (!model) {\r\n continue;\r\n }\r\n for (let word of model.words(wordDefRegExp)) {\r\n if (word === leadingWord || !isNaN(Number(word))) {\r\n continue;\r\n }\r\n seen.add(word);\r\n if (seen.size > EditorSimpleWorker._suggestionsLimit) {\r\n break outer;\r\n }\r\n }\r\n }\r\n return { words: Array.from(seen), duration: sw.elapsed() };\r\n });\r\n }\r\n // ---- END suggest --------------------------------------------------------------------------\r\n //#region -- word ranges --\r\n computeWordRanges(modelUrl, range, wordDef, wordDefFlags) {\r\n return __awaiter(this, void 0, void 0, function* () {\r\n let model = this._getModel(modelUrl);\r\n if (!model) {\r\n return Object.create(null);\r\n }\r\n const wordDefRegExp = new RegExp(wordDef, wordDefFlags);\r\n const result = Object.create(null);\r\n for (let line = range.startLineNumber; line < range.endLineNumber; line++) {\r\n let words = model.getLineWords(line, wordDefRegExp);\r\n for (const word of words) {\r\n if (!isNaN(Number(word.word))) {\r\n continue;\r\n }\r\n let array = result[word.word];\r\n if (!array) {\r\n array = [];\r\n result[word.word] = array;\r\n }\r\n array.push({\r\n startLineNumber: line,\r\n startColumn: word.startColumn,\r\n endLineNumber: line,\r\n endColumn: word.endColumn\r\n });\r\n }\r\n }\r\n return result;\r\n });\r\n }\r\n //#endregion\r\n navigateValueSet(modelUrl, range, up, wordDef, wordDefFlags) {\r\n return __awaiter(this, void 0, void 0, function* () {\r\n let model = this._getModel(modelUrl);\r\n if (!model) {\r\n return null;\r\n }\r\n let wordDefRegExp = new RegExp(wordDef, wordDefFlags);\r\n if (range.startColumn === range.endColumn) {\r\n range = {\r\n startLineNumber: range.startLineNumber,\r\n startColumn: range.startColumn,\r\n endLineNumber: range.endLineNumber,\r\n endColumn: range.endColumn + 1\r\n };\r\n }\r\n let selectionText = model.getValueInRange(range);\r\n let wordRange = model.getWordAtPosition({ lineNumber: range.startLineNumber, column: range.startColumn }, wordDefRegExp);\r\n if (!wordRange) {\r\n return null;\r\n }\r\n let word = model.getValueInRange(wordRange);\r\n let result = BasicInplaceReplace.INSTANCE.navigateValueSet(range, selectionText, wordRange, word, up);\r\n return result;\r\n });\r\n }\r\n // ---- BEGIN foreign module support --------------------------------------------------------------------------\r\n loadForeignModule(moduleId, createData, foreignHostMethods) {\r\n const proxyMethodRequest = (method, args) => {\r\n return this._host.fhr(method, args);\r\n };\r\n const foreignHost = types.createProxyObject(foreignHostMethods, proxyMethodRequest);\r\n let ctx = {\r\n host: foreignHost,\r\n getMirrorModels: () => {\r\n return this._getModels();\r\n }\r\n };\r\n if (this._foreignModuleFactory) {\r\n this._foreignModule = this._foreignModuleFactory(ctx, createData);\r\n // static foreing module\r\n return Promise.resolve(types.getAllMethodNames(this._foreignModule));\r\n }\r\n // ESM-comment-begin\r\n // \t\treturn new Promise((resolve, reject) => {\r\n // \t\t\trequire([moduleId], (foreignModule: { create: IForeignModuleFactory }) => {\r\n // \t\t\t\tthis._foreignModule = foreignModule.create(ctx, createData);\r\n // \r\n // \t\t\t\tresolve(types.getAllMethodNames(this._foreignModule));\r\n // \r\n // \t\t\t}, reject);\r\n // \t\t});\r\n // ESM-comment-end\r\n // ESM-uncomment-begin\r\n return Promise.reject(new Error(`Unexpected usage`));\r\n // ESM-uncomment-end\r\n }\r\n // foreign method request\r\n fmr(method, args) {\r\n if (!this._foreignModule || typeof this._foreignModule[method] !== 'function') {\r\n return Promise.reject(new Error('Missing requestHandler or method: ' + method));\r\n }\r\n try {\r\n return Promise.resolve(this._foreignModule[method].apply(this._foreignModule, args));\r\n }\r\n catch (e) {\r\n return Promise.reject(e);\r\n }\r\n }\r\n}\r\n// ---- END diff --------------------------------------------------------------------------\r\n// ---- BEGIN minimal edits ---------------------------------------------------------------\r\nEditorSimpleWorker._diffLimit = 100000;\r\n// ---- BEGIN suggest --------------------------------------------------------------------------\r\nEditorSimpleWorker._suggestionsLimit = 10000;\r\n/**\r\n * Called on the worker side\r\n * @internal\r\n */\r\nexport function create(host) {\r\n return new EditorSimpleWorker(host, null);\r\n}\r\nif (typeof importScripts === 'function') {\r\n // Running in a web worker\r\n globals.monaco = createMonacoBaseAPI();\r\n}\r\n", "import { createDecorator } from '../../../platform/instantiation/common/instantiation.js';\r\nexport const ITextResourceConfigurationService = createDecorator('textResourceConfigurationService');\r\nexport const ITextResourcePropertiesService = createDecorator('textResourcePropertiesService');\r\n", "/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License. See License.txt in the project root for license information.\r\n *--------------------------------------------------------------------------------------------*/\r\nvar __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n};\r\nvar __param = (this && this.__param) || function (paramIndex, decorator) {\r\n return function (target, key) { decorator(target, key, paramIndex); }\r\n};\r\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\r\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n};\r\nimport { IntervalTimer, timeout } from '../../../base/common/async.js';\r\nimport { Disposable, dispose, toDisposable, DisposableStore } from '../../../base/common/lifecycle.js';\r\nimport { SimpleWorkerClient, logOnceWebWorkerWarning } from '../../../base/common/worker/simpleWorker.js';\r\nimport { DefaultWorkerFactory } from '../../../base/worker/defaultWorkerFactory.js';\r\nimport { Range } from '../core/range.js';\r\nimport * as modes from '../modes.js';\r\nimport { LanguageConfigurationRegistry } from '../modes/languageConfigurationRegistry.js';\r\nimport { EditorSimpleWorker } from './editorSimpleWorker.js';\r\nimport { IModelService } from './modelService.js';\r\nimport { ITextResourceConfigurationService } from './textResourceConfigurationService.js';\r\nimport { regExpFlags } from '../../../base/common/strings.js';\r\nimport { isNonEmptyArray } from '../../../base/common/arrays.js';\r\nimport { ILogService } from '../../../platform/log/common/log.js';\r\nimport { StopWatch } from '../../../base/common/stopwatch.js';\r\nimport { canceled } from '../../../base/common/errors.js';\r\n/**\r\n * Stop syncing a model to the worker if it was not needed for 1 min.\r\n */\r\nconst STOP_SYNC_MODEL_DELTA_TIME_MS = 60 * 1000;\r\n/**\r\n * Stop the worker if it was not needed for 5 min.\r\n */\r\nconst STOP_WORKER_DELTA_TIME_MS = 5 * 60 * 1000;\r\nfunction canSyncModel(modelService, resource) {\r\n let model = modelService.getModel(resource);\r\n if (!model) {\r\n return false;\r\n }\r\n if (model.isTooLargeForSyncing()) {\r\n return false;\r\n }\r\n return true;\r\n}\r\nlet EditorWorkerServiceImpl = class EditorWorkerServiceImpl extends Disposable {\r\n constructor(modelService, configurationService, logService) {\r\n super();\r\n this._modelService = modelService;\r\n this._workerManager = this._register(new WorkerManager(this._modelService));\r\n this._logService = logService;\r\n // register default link-provider and default completions-provider\r\n this._register(modes.LinkProviderRegistry.register('*', {\r\n provideLinks: (model, token) => {\r\n if (!canSyncModel(this._modelService, model.uri)) {\r\n return Promise.resolve({ links: [] }); // File too large\r\n }\r\n return this._workerManager.withWorker().then(client => client.computeLinks(model.uri)).then(links => {\r\n return links && { links };\r\n });\r\n }\r\n }));\r\n this._register(modes.CompletionProviderRegistry.register('*', new WordBasedCompletionItemProvider(this._workerManager, configurationService, this._modelService)));\r\n }\r\n dispose() {\r\n super.dispose();\r\n }\r\n canComputeDiff(original, modified) {\r\n return (canSyncModel(this._modelService, original) && canSyncModel(this._modelService, modified));\r\n }\r\n computeDiff(original, modified, ignoreTrimWhitespace, maxComputationTime) {\r\n return this._workerManager.withWorker().then(client => client.computeDiff(original, modified, ignoreTrimWhitespace, maxComputationTime));\r\n }\r\n computeMoreMinimalEdits(resource, edits) {\r\n if (isNonEmptyArray(edits)) {\r\n if (!canSyncModel(this._modelService, resource)) {\r\n return Promise.resolve(edits); // File too large\r\n }\r\n const sw = StopWatch.create(true);\r\n const result = this._workerManager.withWorker().then(client => client.computeMoreMinimalEdits(resource, edits));\r\n result.finally(() => this._logService.trace('FORMAT#computeMoreMinimalEdits', resource.toString(true), sw.elapsed()));\r\n return Promise.race([result, timeout(1000).then(() => edits)]);\r\n }\r\n else {\r\n return Promise.resolve(undefined);\r\n }\r\n }\r\n canNavigateValueSet(resource) {\r\n return (canSyncModel(this._modelService, resource));\r\n }\r\n navigateValueSet(resource, range, up) {\r\n return this._workerManager.withWorker().then(client => client.navigateValueSet(resource, range, up));\r\n }\r\n canComputeWordRanges(resource) {\r\n return canSyncModel(this._modelService, resource);\r\n }\r\n computeWordRanges(resource, range) {\r\n return this._workerManager.withWorker().then(client => client.computeWordRanges(resource, range));\r\n }\r\n};\r\nEditorWorkerServiceImpl = __decorate([\r\n __param(0, IModelService),\r\n __param(1, ITextResourceConfigurationService),\r\n __param(2, ILogService)\r\n], EditorWorkerServiceImpl);\r\nexport { EditorWorkerServiceImpl };\r\nclass WordBasedCompletionItemProvider {\r\n constructor(workerManager, configurationService, modelService) {\r\n this._debugDisplayName = 'wordbasedCompletions';\r\n this._workerManager = workerManager;\r\n this._configurationService = configurationService;\r\n this._modelService = modelService;\r\n }\r\n provideCompletionItems(model, position) {\r\n return __awaiter(this, void 0, void 0, function* () {\r\n const config = this._configurationService.getValue(model.uri, position, 'editor');\r\n if (!config.wordBasedSuggestions) {\r\n return undefined;\r\n }\r\n const models = [];\r\n if (config.wordBasedSuggestionsMode === 'currentDocument') {\r\n // only current file and only if not too large\r\n if (canSyncModel(this._modelService, model.uri)) {\r\n models.push(model.uri);\r\n }\r\n }\r\n else {\r\n // either all files or files of same language\r\n for (const candidate of this._modelService.getModels()) {\r\n if (!canSyncModel(this._modelService, candidate.uri)) {\r\n continue;\r\n }\r\n if (candidate === model) {\r\n models.unshift(candidate.uri);\r\n }\r\n else if (config.wordBasedSuggestionsMode === 'allDocuments' || candidate.getLanguageIdentifier().id === model.getLanguageIdentifier().id) {\r\n models.push(candidate.uri);\r\n }\r\n }\r\n }\r\n if (models.length === 0) {\r\n return undefined; // File too large, no other files\r\n }\r\n const wordDefRegExp = LanguageConfigurationRegistry.getWordDefinition(model.getLanguageIdentifier().id);\r\n const word = model.getWordAtPosition(position);\r\n const replace = !word ? Range.fromPositions(position) : new Range(position.lineNumber, word.startColumn, position.lineNumber, word.endColumn);\r\n const insert = replace.setEndPosition(position.lineNumber, position.column);\r\n const client = yield this._workerManager.withWorker();\r\n const data = yield client.textualSuggest(models, word === null || word === void 0 ? void 0 : word.word, wordDefRegExp);\r\n if (!data) {\r\n return undefined;\r\n }\r\n return {\r\n duration: data.duration,\r\n suggestions: data.words.map((word) => {\r\n return {\r\n kind: 18 /* Text */,\r\n label: word,\r\n insertText: word,\r\n range: { insert, replace }\r\n };\r\n }),\r\n };\r\n });\r\n }\r\n}\r\nclass WorkerManager extends Disposable {\r\n constructor(modelService) {\r\n super();\r\n this._modelService = modelService;\r\n this._editorWorkerClient = null;\r\n this._lastWorkerUsedTime = (new Date()).getTime();\r\n let stopWorkerInterval = this._register(new IntervalTimer());\r\n stopWorkerInterval.cancelAndSet(() => this._checkStopIdleWorker(), Math.round(STOP_WORKER_DELTA_TIME_MS / 2));\r\n this._register(this._modelService.onModelRemoved(_ => this._checkStopEmptyWorker()));\r\n }\r\n dispose() {\r\n if (this._editorWorkerClient) {\r\n this._editorWorkerClient.dispose();\r\n this._editorWorkerClient = null;\r\n }\r\n super.dispose();\r\n }\r\n /**\r\n * Check if the model service has no more models and stop the worker if that is the case.\r\n */\r\n _checkStopEmptyWorker() {\r\n if (!this._editorWorkerClient) {\r\n return;\r\n }\r\n let models = this._modelService.getModels();\r\n if (models.length === 0) {\r\n // There are no more models => nothing possible for me to do\r\n this._editorWorkerClient.dispose();\r\n this._editorWorkerClient = null;\r\n }\r\n }\r\n /**\r\n * Check if the worker has been idle for a while and then stop it.\r\n */\r\n _checkStopIdleWorker() {\r\n if (!this._editorWorkerClient) {\r\n return;\r\n }\r\n let timeSinceLastWorkerUsedTime = (new Date()).getTime() - this._lastWorkerUsedTime;\r\n if (timeSinceLastWorkerUsedTime > STOP_WORKER_DELTA_TIME_MS) {\r\n this._editorWorkerClient.dispose();\r\n this._editorWorkerClient = null;\r\n }\r\n }\r\n withWorker() {\r\n this._lastWorkerUsedTime = (new Date()).getTime();\r\n if (!this._editorWorkerClient) {\r\n this._editorWorkerClient = new EditorWorkerClient(this._modelService, false, 'editorWorkerService');\r\n }\r\n return Promise.resolve(this._editorWorkerClient);\r\n }\r\n}\r\nclass EditorModelManager extends Disposable {\r\n constructor(proxy, modelService, keepIdleModels) {\r\n super();\r\n this._syncedModels = Object.create(null);\r\n this._syncedModelsLastUsedTime = Object.create(null);\r\n this._proxy = proxy;\r\n this._modelService = modelService;\r\n if (!keepIdleModels) {\r\n let timer = new IntervalTimer();\r\n timer.cancelAndSet(() => this._checkStopModelSync(), Math.round(STOP_SYNC_MODEL_DELTA_TIME_MS / 2));\r\n this._register(timer);\r\n }\r\n }\r\n dispose() {\r\n for (let modelUrl in this._syncedModels) {\r\n dispose(this._syncedModels[modelUrl]);\r\n }\r\n this._syncedModels = Object.create(null);\r\n this._syncedModelsLastUsedTime = Object.create(null);\r\n super.dispose();\r\n }\r\n ensureSyncedResources(resources) {\r\n for (const resource of resources) {\r\n let resourceStr = resource.toString();\r\n if (!this._syncedModels[resourceStr]) {\r\n this._beginModelSync(resource);\r\n }\r\n if (this._syncedModels[resourceStr]) {\r\n this._syncedModelsLastUsedTime[resourceStr] = (new Date()).getTime();\r\n }\r\n }\r\n }\r\n _checkStopModelSync() {\r\n let currentTime = (new Date()).getTime();\r\n let toRemove = [];\r\n for (let modelUrl in this._syncedModelsLastUsedTime) {\r\n let elapsedTime = currentTime - this._syncedModelsLastUsedTime[modelUrl];\r\n if (elapsedTime > STOP_SYNC_MODEL_DELTA_TIME_MS) {\r\n toRemove.push(modelUrl);\r\n }\r\n }\r\n for (const e of toRemove) {\r\n this._stopModelSync(e);\r\n }\r\n }\r\n _beginModelSync(resource) {\r\n let model = this._modelService.getModel(resource);\r\n if (!model) {\r\n return;\r\n }\r\n if (model.isTooLargeForSyncing()) {\r\n return;\r\n }\r\n let modelUrl = resource.toString();\r\n this._proxy.acceptNewModel({\r\n url: model.uri.toString(),\r\n lines: model.getLinesContent(),\r\n EOL: model.getEOL(),\r\n versionId: model.getVersionId()\r\n });\r\n const toDispose = new DisposableStore();\r\n toDispose.add(model.onDidChangeContent((e) => {\r\n this._proxy.acceptModelChanged(modelUrl.toString(), e);\r\n }));\r\n toDispose.add(model.onWillDispose(() => {\r\n this._stopModelSync(modelUrl);\r\n }));\r\n toDispose.add(toDisposable(() => {\r\n this._proxy.acceptRemovedModel(modelUrl);\r\n }));\r\n this._syncedModels[modelUrl] = toDispose;\r\n }\r\n _stopModelSync(modelUrl) {\r\n let toDispose = this._syncedModels[modelUrl];\r\n delete this._syncedModels[modelUrl];\r\n delete this._syncedModelsLastUsedTime[modelUrl];\r\n dispose(toDispose);\r\n }\r\n}\r\nclass SynchronousWorkerClient {\r\n constructor(instance) {\r\n this._instance = instance;\r\n this._proxyObj = Promise.resolve(this._instance);\r\n }\r\n dispose() {\r\n this._instance.dispose();\r\n }\r\n getProxyObject() {\r\n return this._proxyObj;\r\n }\r\n}\r\nexport class EditorWorkerHost {\r\n constructor(workerClient) {\r\n this._workerClient = workerClient;\r\n }\r\n // foreign host request\r\n fhr(method, args) {\r\n return this._workerClient.fhr(method, args);\r\n }\r\n}\r\nexport class EditorWorkerClient extends Disposable {\r\n constructor(modelService, keepIdleModels, label) {\r\n super();\r\n this._disposed = false;\r\n this._modelService = modelService;\r\n this._keepIdleModels = keepIdleModels;\r\n this._workerFactory = new DefaultWorkerFactory(label);\r\n this._worker = null;\r\n this._modelManager = null;\r\n }\r\n // foreign host request\r\n fhr(method, args) {\r\n throw new Error(`Not implemented!`);\r\n }\r\n _getOrCreateWorker() {\r\n if (!this._worker) {\r\n try {\r\n this._worker = this._register(new SimpleWorkerClient(this._workerFactory, 'vs/editor/common/services/editorSimpleWorker', new EditorWorkerHost(this)));\r\n }\r\n catch (err) {\r\n logOnceWebWorkerWarning(err);\r\n this._worker = new SynchronousWorkerClient(new EditorSimpleWorker(new EditorWorkerHost(this), null));\r\n }\r\n }\r\n return this._worker;\r\n }\r\n _getProxy() {\r\n return this._getOrCreateWorker().getProxyObject().then(undefined, (err) => {\r\n logOnceWebWorkerWarning(err);\r\n this._worker = new SynchronousWorkerClient(new EditorSimpleWorker(new EditorWorkerHost(this), null));\r\n return this._getOrCreateWorker().getProxyObject();\r\n });\r\n }\r\n _getOrCreateModelManager(proxy) {\r\n if (!this._modelManager) {\r\n this._modelManager = this._register(new EditorModelManager(proxy, this._modelService, this._keepIdleModels));\r\n }\r\n return this._modelManager;\r\n }\r\n _withSyncedResources(resources) {\r\n if (this._disposed) {\r\n return Promise.reject(canceled());\r\n }\r\n return this._getProxy().then((proxy) => {\r\n this._getOrCreateModelManager(proxy).ensureSyncedResources(resources);\r\n return proxy;\r\n });\r\n }\r\n computeDiff(original, modified, ignoreTrimWhitespace, maxComputationTime) {\r\n return this._withSyncedResources([original, modified]).then(proxy => {\r\n return proxy.computeDiff(original.toString(), modified.toString(), ignoreTrimWhitespace, maxComputationTime);\r\n });\r\n }\r\n computeMoreMinimalEdits(resource, edits) {\r\n return this._withSyncedResources([resource]).then(proxy => {\r\n return proxy.computeMoreMinimalEdits(resource.toString(), edits);\r\n });\r\n }\r\n computeLinks(resource) {\r\n return this._withSyncedResources([resource]).then(proxy => {\r\n return proxy.computeLinks(resource.toString());\r\n });\r\n }\r\n textualSuggest(resources, leadingWord, wordDefRegExp) {\r\n return __awaiter(this, void 0, void 0, function* () {\r\n const proxy = yield this._withSyncedResources(resources);\r\n const wordDef = wordDefRegExp.source;\r\n const wordDefFlags = regExpFlags(wordDefRegExp);\r\n return proxy.textualSuggest(resources.map(r => r.toString()), leadingWord, wordDef, wordDefFlags);\r\n });\r\n }\r\n computeWordRanges(resource, range) {\r\n return this._withSyncedResources([resource]).then(proxy => {\r\n let model = this._modelService.getModel(resource);\r\n if (!model) {\r\n return Promise.resolve(null);\r\n }\r\n let wordDefRegExp = LanguageConfigurationRegistry.getWordDefinition(model.getLanguageIdentifier().id);\r\n let wordDef = wordDefRegExp.source;\r\n let wordDefFlags = regExpFlags(wordDefRegExp);\r\n return proxy.computeWordRanges(resource.toString(), range, wordDef, wordDefFlags);\r\n });\r\n }\r\n navigateValueSet(resource, range, up) {\r\n return this._withSyncedResources([resource]).then(proxy => {\r\n let model = this._modelService.getModel(resource);\r\n if (!model) {\r\n return null;\r\n }\r\n let wordDefRegExp = LanguageConfigurationRegistry.getWordDefinition(model.getLanguageIdentifier().id);\r\n let wordDef = wordDefRegExp.source;\r\n let wordDefFlags = regExpFlags(wordDefRegExp);\r\n return proxy.navigateValueSet(resource.toString(), range, up, wordDef, wordDefFlags);\r\n });\r\n }\r\n dispose() {\r\n super.dispose();\r\n this._disposed = true;\r\n }\r\n}\r\n", "/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License. See License.txt in the project root for license information.\r\n *--------------------------------------------------------------------------------------------*/\r\nimport { EditorWorkerClient } from './editorWorkerServiceImpl.js';\r\nimport * as types from '../../../base/common/types.js';\r\n/**\r\n * Create a new web worker that has model syncing capabilities built in.\r\n * Specify an AMD module to load that will `create` an object that will be proxied.\r\n */\r\nexport function createWebWorker(modelService, opts) {\r\n return new MonacoWebWorkerImpl(modelService, opts);\r\n}\r\nclass MonacoWebWorkerImpl extends EditorWorkerClient {\r\n constructor(modelService, opts) {\r\n super(modelService, opts.keepIdleModels || false, opts.label);\r\n this._foreignModuleId = opts.moduleId;\r\n this._foreignModuleCreateData = opts.createData || null;\r\n this._foreignModuleHost = opts.host || null;\r\n this._foreignProxy = null;\r\n }\r\n // foreign host request\r\n fhr(method, args) {\r\n if (!this._foreignModuleHost || typeof this._foreignModuleHost[method] !== 'function') {\r\n return Promise.reject(new Error('Missing method ' + method + ' or missing main thread foreign host.'));\r\n }\r\n try {\r\n return Promise.resolve(this._foreignModuleHost[method].apply(this._foreignModuleHost, args));\r\n }\r\n catch (e) {\r\n return Promise.reject(e);\r\n }\r\n }\r\n _getForeignProxy() {\r\n if (!this._foreignProxy) {\r\n this._foreignProxy = this._getProxy().then((proxy) => {\r\n const foreignHostMethods = this._foreignModuleHost ? types.getAllMethodNames(this._foreignModuleHost) : [];\r\n return proxy.loadForeignModule(this._foreignModuleId, this._foreignModuleCreateData, foreignHostMethods).then((foreignMethods) => {\r\n this._foreignModuleCreateData = null;\r\n const proxyMethodRequest = (method, args) => {\r\n return proxy.fmr(method, args);\r\n };\r\n const createProxyMethod = (method, proxyMethodRequest) => {\r\n return function () {\r\n const args = Array.prototype.slice.call(arguments, 0);\r\n return proxyMethodRequest(method, args);\r\n };\r\n };\r\n let foreignProxy = {};\r\n for (const foreignMethod of foreignMethods) {\r\n foreignProxy[foreignMethod] = createProxyMethod(foreignMethod, proxyMethodRequest);\r\n }\r\n return foreignProxy;\r\n });\r\n });\r\n }\r\n return this._foreignProxy;\r\n }\r\n getProxy() {\r\n return this._getForeignProxy();\r\n }\r\n withSyncedResources(resources) {\r\n return this._withSyncedResources(resources).then(_ => this.getProxy());\r\n }\r\n}\r\n", "/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License. See License.txt in the project root for license information.\r\n *--------------------------------------------------------------------------------------------*/\r\nimport * as strings from '../../../base/common/strings.js';\r\nexport class LineDecoration {\r\n constructor(startColumn, endColumn, className, type) {\r\n this.startColumn = startColumn;\r\n this.endColumn = endColumn;\r\n this.className = className;\r\n this.type = type;\r\n this._lineDecorationBrand = undefined;\r\n }\r\n static _equals(a, b) {\r\n return (a.startColumn === b.startColumn\r\n && a.endColumn === b.endColumn\r\n && a.className === b.className\r\n && a.type === b.type);\r\n }\r\n static equalsArr(a, b) {\r\n const aLen = a.length;\r\n const bLen = b.length;\r\n if (aLen !== bLen) {\r\n return false;\r\n }\r\n for (let i = 0; i < aLen; i++) {\r\n if (!LineDecoration._equals(a[i], b[i])) {\r\n return false;\r\n }\r\n }\r\n return true;\r\n }\r\n static extractWrapped(arr, startOffset, endOffset) {\r\n if (arr.length === 0) {\r\n return arr;\r\n }\r\n const startColumn = startOffset + 1;\r\n const endColumn = endOffset + 1;\r\n const lineLength = endOffset - startOffset;\r\n const r = [];\r\n let rLength = 0;\r\n for (const dec of arr) {\r\n if (dec.endColumn <= startColumn || dec.startColumn >= endColumn) {\r\n continue;\r\n }\r\n r[rLength++] = new LineDecoration(Math.max(1, dec.startColumn - startColumn + 1), Math.min(lineLength + 1, dec.endColumn - startColumn + 1), dec.className, dec.type);\r\n }\r\n return r;\r\n }\r\n static filter(lineDecorations, lineNumber, minLineColumn, maxLineColumn) {\r\n if (lineDecorations.length === 0) {\r\n return [];\r\n }\r\n let result = [], resultLen = 0;\r\n for (let i = 0, len = lineDecorations.length; i < len; i++) {\r\n const d = lineDecorations[i];\r\n const range = d.range;\r\n if (range.endLineNumber < lineNumber || range.startLineNumber > lineNumber) {\r\n // Ignore decorations that sit outside this line\r\n continue;\r\n }\r\n if (range.isEmpty() && (d.type === 0 /* Regular */ || d.type === 3 /* RegularAffectingLetterSpacing */)) {\r\n // Ignore empty range decorations\r\n continue;\r\n }\r\n const startColumn = (range.startLineNumber === lineNumber ? range.startColumn : minLineColumn);\r\n const endColumn = (range.endLineNumber === lineNumber ? range.endColumn : maxLineColumn);\r\n result[resultLen++] = new LineDecoration(startColumn, endColumn, d.inlineClassName, d.type);\r\n }\r\n return result;\r\n }\r\n static _typeCompare(a, b) {\r\n const ORDER = [2, 0, 1, 3];\r\n return ORDER[a] - ORDER[b];\r\n }\r\n static compare(a, b) {\r\n if (a.startColumn !== b.startColumn) {\r\n return a.startColumn - b.startColumn;\r\n }\r\n if (a.endColumn !== b.endColumn) {\r\n return a.endColumn - b.endColumn;\r\n }\r\n const typeCmp = LineDecoration._typeCompare(a.type, b.type);\r\n if (typeCmp !== 0) {\r\n return typeCmp;\r\n }\r\n if (a.className !== b.className) {\r\n return a.className < b.className ? -1 : 1;\r\n }\r\n return 0;\r\n }\r\n}\r\nexport class DecorationSegment {\r\n constructor(startOffset, endOffset, className, metadata) {\r\n this.startOffset = startOffset;\r\n this.endOffset = endOffset;\r\n this.className = className;\r\n this.metadata = metadata;\r\n }\r\n}\r\nclass Stack {\r\n constructor() {\r\n this.stopOffsets = [];\r\n this.classNames = [];\r\n this.metadata = [];\r\n this.count = 0;\r\n }\r\n static _metadata(metadata) {\r\n let result = 0;\r\n for (let i = 0, len = metadata.length; i < len; i++) {\r\n result |= metadata[i];\r\n }\r\n return result;\r\n }\r\n consumeLowerThan(maxStopOffset, nextStartOffset, result) {\r\n while (this.count > 0 && this.stopOffsets[0] < maxStopOffset) {\r\n let i = 0;\r\n // Take all equal stopping offsets\r\n while (i + 1 < this.count && this.stopOffsets[i] === this.stopOffsets[i + 1]) {\r\n i++;\r\n }\r\n // Basically we are consuming the first i + 1 elements of the stack\r\n result.push(new DecorationSegment(nextStartOffset, this.stopOffsets[i], this.classNames.join(' '), Stack._metadata(this.metadata)));\r\n nextStartOffset = this.stopOffsets[i] + 1;\r\n // Consume them\r\n this.stopOffsets.splice(0, i + 1);\r\n this.classNames.splice(0, i + 1);\r\n this.metadata.splice(0, i + 1);\r\n this.count -= (i + 1);\r\n }\r\n if (this.count > 0 && nextStartOffset < maxStopOffset) {\r\n result.push(new DecorationSegment(nextStartOffset, maxStopOffset - 1, this.classNames.join(' '), Stack._metadata(this.metadata)));\r\n nextStartOffset = maxStopOffset;\r\n }\r\n return nextStartOffset;\r\n }\r\n insert(stopOffset, className, metadata) {\r\n if (this.count === 0 || this.stopOffsets[this.count - 1] <= stopOffset) {\r\n // Insert at the end\r\n this.stopOffsets.push(stopOffset);\r\n this.classNames.push(className);\r\n this.metadata.push(metadata);\r\n }\r\n else {\r\n // Find the insertion position for `stopOffset`\r\n for (let i = 0; i < this.count; i++) {\r\n if (this.stopOffsets[i] >= stopOffset) {\r\n this.stopOffsets.splice(i, 0, stopOffset);\r\n this.classNames.splice(i, 0, className);\r\n this.metadata.splice(i, 0, metadata);\r\n break;\r\n }\r\n }\r\n }\r\n this.count++;\r\n return;\r\n }\r\n}\r\nexport class LineDecorationsNormalizer {\r\n /**\r\n * Normalize line decorations. Overlapping decorations will generate multiple segments\r\n */\r\n static normalize(lineContent, lineDecorations) {\r\n if (lineDecorations.length === 0) {\r\n return [];\r\n }\r\n let result = [];\r\n const stack = new Stack();\r\n let nextStartOffset = 0;\r\n for (let i = 0, len = lineDecorations.length; i < len; i++) {\r\n const d = lineDecorations[i];\r\n let startColumn = d.startColumn;\r\n let endColumn = d.endColumn;\r\n const className = d.className;\r\n const metadata = (d.type === 1 /* Before */\r\n ? 2 /* PSEUDO_BEFORE */\r\n : d.type === 2 /* After */\r\n ? 4 /* PSEUDO_AFTER */\r\n : 0);\r\n // If the position would end up in the middle of a high-low surrogate pair, we move it to before the pair\r\n if (startColumn > 1) {\r\n const charCodeBefore = lineContent.charCodeAt(startColumn - 2);\r\n if (strings.isHighSurrogate(charCodeBefore)) {\r\n startColumn--;\r\n }\r\n }\r\n if (endColumn > 1) {\r\n const charCodeBefore = lineContent.charCodeAt(endColumn - 2);\r\n if (strings.isHighSurrogate(charCodeBefore)) {\r\n endColumn--;\r\n }\r\n }\r\n const currentStartOffset = startColumn - 1;\r\n const currentEndOffset = endColumn - 2;\r\n nextStartOffset = stack.consumeLowerThan(currentStartOffset, nextStartOffset, result);\r\n if (stack.count === 0) {\r\n nextStartOffset = currentStartOffset;\r\n }\r\n stack.insert(currentEndOffset, className, metadata);\r\n }\r\n stack.consumeLowerThan(1073741824 /* MAX_SAFE_SMALL_INTEGER */, nextStartOffset, result);\r\n return result;\r\n }\r\n}\r\n", "/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License. See License.txt in the project root for license information.\r\n *--------------------------------------------------------------------------------------------*/\r\nimport * as strings from '../../../base/common/strings.js';\r\nimport { createStringBuilder } from '../core/stringBuilder.js';\r\nimport { LineDecoration, LineDecorationsNormalizer } from './lineDecorations.js';\r\nclass LinePart {\r\n constructor(endIndex, type, metadata) {\r\n this._linePartBrand = undefined;\r\n this.endIndex = endIndex;\r\n this.type = type;\r\n this.metadata = metadata;\r\n }\r\n isWhitespace() {\r\n return (this.metadata & 1 /* IS_WHITESPACE_MASK */ ? true : false);\r\n }\r\n isPseudoAfter() {\r\n return (this.metadata & 4 /* PSEUDO_AFTER_MASK */ ? true : false);\r\n }\r\n}\r\nexport class LineRange {\r\n constructor(startIndex, endIndex) {\r\n this.startOffset = startIndex;\r\n this.endOffset = endIndex;\r\n }\r\n equals(otherLineRange) {\r\n return this.startOffset === otherLineRange.startOffset\r\n && this.endOffset === otherLineRange.endOffset;\r\n }\r\n}\r\nexport class RenderLineInput {\r\n constructor(useMonospaceOptimizations, canUseHalfwidthRightwardsArrow, lineContent, continuesWithWrappedLine, isBasicASCII, containsRTL, fauxIndentLength, lineTokens, lineDecorations, tabSize, startVisibleColumn, spaceWidth, middotWidth, wsmiddotWidth, stopRenderingLineAfter, renderWhitespace, renderControlCharacters, fontLigatures, selectionsOnLine) {\r\n this.useMonospaceOptimizations = useMonospaceOptimizations;\r\n this.canUseHalfwidthRightwardsArrow = canUseHalfwidthRightwardsArrow;\r\n this.lineContent = lineContent;\r\n this.continuesWithWrappedLine = continuesWithWrappedLine;\r\n this.isBasicASCII = isBasicASCII;\r\n this.containsRTL = containsRTL;\r\n this.fauxIndentLength = fauxIndentLength;\r\n this.lineTokens = lineTokens;\r\n this.lineDecorations = lineDecorations.sort(LineDecoration.compare);\r\n this.tabSize = tabSize;\r\n this.startVisibleColumn = startVisibleColumn;\r\n this.spaceWidth = spaceWidth;\r\n this.stopRenderingLineAfter = stopRenderingLineAfter;\r\n this.renderWhitespace = (renderWhitespace === 'all'\r\n ? 4 /* All */\r\n : renderWhitespace === 'boundary'\r\n ? 1 /* Boundary */\r\n : renderWhitespace === 'selection'\r\n ? 2 /* Selection */\r\n : renderWhitespace === 'trailing'\r\n ? 3 /* Trailing */\r\n : 0 /* None */);\r\n this.renderControlCharacters = renderControlCharacters;\r\n this.fontLigatures = fontLigatures;\r\n this.selectionsOnLine = selectionsOnLine && selectionsOnLine.sort((a, b) => a.startOffset < b.startOffset ? -1 : 1);\r\n const wsmiddotDiff = Math.abs(wsmiddotWidth - spaceWidth);\r\n const middotDiff = Math.abs(middotWidth - spaceWidth);\r\n if (wsmiddotDiff < middotDiff) {\r\n this.renderSpaceWidth = wsmiddotWidth;\r\n this.renderSpaceCharCode = 0x2E31; // U+2E31 - WORD SEPARATOR MIDDLE DOT\r\n }\r\n else {\r\n this.renderSpaceWidth = middotWidth;\r\n this.renderSpaceCharCode = 0xB7; // U+00B7 - MIDDLE DOT\r\n }\r\n }\r\n sameSelection(otherSelections) {\r\n if (this.selectionsOnLine === null) {\r\n return otherSelections === null;\r\n }\r\n if (otherSelections === null) {\r\n return false;\r\n }\r\n if (otherSelections.length !== this.selectionsOnLine.length) {\r\n return false;\r\n }\r\n for (let i = 0; i < this.selectionsOnLine.length; i++) {\r\n if (!this.selectionsOnLine[i].equals(otherSelections[i])) {\r\n return false;\r\n }\r\n }\r\n return true;\r\n }\r\n equals(other) {\r\n return (this.useMonospaceOptimizations === other.useMonospaceOptimizations\r\n && this.canUseHalfwidthRightwardsArrow === other.canUseHalfwidthRightwardsArrow\r\n && this.lineContent === other.lineContent\r\n && this.continuesWithWrappedLine === other.continuesWithWrappedLine\r\n && this.isBasicASCII === other.isBasicASCII\r\n && this.containsRTL === other.containsRTL\r\n && this.fauxIndentLength === other.fauxIndentLength\r\n && this.tabSize === other.tabSize\r\n && this.startVisibleColumn === other.startVisibleColumn\r\n && this.spaceWidth === other.spaceWidth\r\n && this.renderSpaceWidth === other.renderSpaceWidth\r\n && this.renderSpaceCharCode === other.renderSpaceCharCode\r\n && this.stopRenderingLineAfter === other.stopRenderingLineAfter\r\n && this.renderWhitespace === other.renderWhitespace\r\n && this.renderControlCharacters === other.renderControlCharacters\r\n && this.fontLigatures === other.fontLigatures\r\n && LineDecoration.equalsArr(this.lineDecorations, other.lineDecorations)\r\n && this.lineTokens.equals(other.lineTokens)\r\n && this.sameSelection(other.selectionsOnLine));\r\n }\r\n}\r\nexport class DomPosition {\r\n constructor(partIndex, charIndex) {\r\n this.partIndex = partIndex;\r\n this.charIndex = charIndex;\r\n }\r\n}\r\n/**\r\n * Provides a both direction mapping between a line's character and its rendered position.\r\n */\r\nexport class CharacterMapping {\r\n constructor(length, partCount) {\r\n this.length = length;\r\n this._data = new Uint32Array(this.length);\r\n this._absoluteOffsets = new Uint32Array(this.length);\r\n }\r\n static getPartIndex(partData) {\r\n return (partData & 4294901760 /* PART_INDEX_MASK */) >>> 16 /* PART_INDEX_OFFSET */;\r\n }\r\n static getCharIndex(partData) {\r\n return (partData & 65535 /* CHAR_INDEX_MASK */) >>> 0 /* CHAR_INDEX_OFFSET */;\r\n }\r\n setColumnInfo(column, partIndex, charIndex, partAbsoluteOffset) {\r\n const partData = ((partIndex << 16 /* PART_INDEX_OFFSET */)\r\n | (charIndex << 0 /* CHAR_INDEX_OFFSET */)) >>> 0;\r\n this._data[column - 1] = partData;\r\n this._absoluteOffsets[column - 1] = partAbsoluteOffset + charIndex;\r\n }\r\n getAbsoluteOffset(column) {\r\n if (this._absoluteOffsets.length === 0) {\r\n // No characters on this line\r\n return 0;\r\n }\r\n return this._absoluteOffsets[column - 1];\r\n }\r\n charOffsetToPartData(charOffset) {\r\n if (this.length === 0) {\r\n return 0;\r\n }\r\n if (charOffset < 0) {\r\n return this._data[0];\r\n }\r\n if (charOffset >= this.length) {\r\n return this._data[this.length - 1];\r\n }\r\n return this._data[charOffset];\r\n }\r\n getDomPosition(column) {\r\n const partData = this.charOffsetToPartData(column - 1);\r\n const partIndex = CharacterMapping.getPartIndex(partData);\r\n const charIndex = CharacterMapping.getCharIndex(partData);\r\n return new DomPosition(partIndex, charIndex);\r\n }\r\n getColumn(domPosition, partLength) {\r\n const charOffset = this.partDataToCharOffset(domPosition.partIndex, partLength, domPosition.charIndex);\r\n return charOffset + 1;\r\n }\r\n partDataToCharOffset(partIndex, partLength, charIndex) {\r\n if (this.length === 0) {\r\n return 0;\r\n }\r\n let searchEntry = ((partIndex << 16 /* PART_INDEX_OFFSET */)\r\n | (charIndex << 0 /* CHAR_INDEX_OFFSET */)) >>> 0;\r\n let min = 0;\r\n let max = this.length - 1;\r\n while (min + 1 < max) {\r\n let mid = ((min + max) >>> 1);\r\n let midEntry = this._data[mid];\r\n if (midEntry === searchEntry) {\r\n return mid;\r\n }\r\n else if (midEntry > searchEntry) {\r\n max = mid;\r\n }\r\n else {\r\n min = mid;\r\n }\r\n }\r\n if (min === max) {\r\n return min;\r\n }\r\n let minEntry = this._data[min];\r\n let maxEntry = this._data[max];\r\n if (minEntry === searchEntry) {\r\n return min;\r\n }\r\n if (maxEntry === searchEntry) {\r\n return max;\r\n }\r\n let minPartIndex = CharacterMapping.getPartIndex(minEntry);\r\n let minCharIndex = CharacterMapping.getCharIndex(minEntry);\r\n let maxPartIndex = CharacterMapping.getPartIndex(maxEntry);\r\n let maxCharIndex;\r\n if (minPartIndex !== maxPartIndex) {\r\n // sitting between parts\r\n maxCharIndex = partLength;\r\n }\r\n else {\r\n maxCharIndex = CharacterMapping.getCharIndex(maxEntry);\r\n }\r\n let minEntryDistance = charIndex - minCharIndex;\r\n let maxEntryDistance = maxCharIndex - charIndex;\r\n if (minEntryDistance <= maxEntryDistance) {\r\n return min;\r\n }\r\n return max;\r\n }\r\n}\r\nexport class RenderLineOutput {\r\n constructor(characterMapping, containsRTL, containsForeignElements) {\r\n this._renderLineOutputBrand = undefined;\r\n this.characterMapping = characterMapping;\r\n this.containsRTL = containsRTL;\r\n this.containsForeignElements = containsForeignElements;\r\n }\r\n}\r\nexport function renderViewLine(input, sb) {\r\n if (input.lineContent.length === 0) {\r\n if (input.lineDecorations.length > 0) {\r\n // This line is empty, but it contains inline decorations\r\n sb.appendASCIIString(``);\r\n let beforeCount = 0;\r\n let afterCount = 0;\r\n let containsForeignElements = 0 /* None */;\r\n for (const lineDecoration of input.lineDecorations) {\r\n if (lineDecoration.type === 1 /* Before */ || lineDecoration.type === 2 /* After */) {\r\n sb.appendASCIIString(``);\r\n if (lineDecoration.type === 1 /* Before */) {\r\n containsForeignElements |= 1 /* Before */;\r\n beforeCount++;\r\n }\r\n if (lineDecoration.type === 2 /* After */) {\r\n containsForeignElements |= 2 /* After */;\r\n afterCount++;\r\n }\r\n }\r\n }\r\n sb.appendASCIIString(``);\r\n const characterMapping = new CharacterMapping(1, beforeCount + afterCount);\r\n characterMapping.setColumnInfo(1, beforeCount, 0, 0);\r\n return new RenderLineOutput(characterMapping, false, containsForeignElements);\r\n }\r\n // completely empty line\r\n sb.appendASCIIString('');\r\n return new RenderLineOutput(new CharacterMapping(0, 0), false, 0 /* None */);\r\n }\r\n return _renderLine(resolveRenderLineInput(input), sb);\r\n}\r\nexport class RenderLineOutput2 {\r\n constructor(characterMapping, html, containsRTL, containsForeignElements) {\r\n this.characterMapping = characterMapping;\r\n this.html = html;\r\n this.containsRTL = containsRTL;\r\n this.containsForeignElements = containsForeignElements;\r\n }\r\n}\r\nexport function renderViewLine2(input) {\r\n let sb = createStringBuilder(10000);\r\n let out = renderViewLine(input, sb);\r\n return new RenderLineOutput2(out.characterMapping, sb.build(), out.containsRTL, out.containsForeignElements);\r\n}\r\nclass ResolvedRenderLineInput {\r\n constructor(fontIsMonospace, canUseHalfwidthRightwardsArrow, lineContent, len, isOverflowing, parts, containsForeignElements, fauxIndentLength, tabSize, startVisibleColumn, containsRTL, spaceWidth, renderSpaceCharCode, renderWhitespace, renderControlCharacters) {\r\n this.fontIsMonospace = fontIsMonospace;\r\n this.canUseHalfwidthRightwardsArrow = canUseHalfwidthRightwardsArrow;\r\n this.lineContent = lineContent;\r\n this.len = len;\r\n this.isOverflowing = isOverflowing;\r\n this.parts = parts;\r\n this.containsForeignElements = containsForeignElements;\r\n this.fauxIndentLength = fauxIndentLength;\r\n this.tabSize = tabSize;\r\n this.startVisibleColumn = startVisibleColumn;\r\n this.containsRTL = containsRTL;\r\n this.spaceWidth = spaceWidth;\r\n this.renderSpaceCharCode = renderSpaceCharCode;\r\n this.renderWhitespace = renderWhitespace;\r\n this.renderControlCharacters = renderControlCharacters;\r\n //\r\n }\r\n}\r\nfunction resolveRenderLineInput(input) {\r\n const lineContent = input.lineContent;\r\n let isOverflowing;\r\n let len;\r\n if (input.stopRenderingLineAfter !== -1 && input.stopRenderingLineAfter < lineContent.length) {\r\n isOverflowing = true;\r\n len = input.stopRenderingLineAfter;\r\n }\r\n else {\r\n isOverflowing = false;\r\n len = lineContent.length;\r\n }\r\n let tokens = transformAndRemoveOverflowing(input.lineTokens, input.fauxIndentLength, len);\r\n if (input.renderWhitespace === 4 /* All */ ||\r\n input.renderWhitespace === 1 /* Boundary */ ||\r\n (input.renderWhitespace === 2 /* Selection */ && !!input.selectionsOnLine) ||\r\n input.renderWhitespace === 3 /* Trailing */) {\r\n tokens = _applyRenderWhitespace(input, lineContent, len, tokens);\r\n }\r\n let containsForeignElements = 0 /* None */;\r\n if (input.lineDecorations.length > 0) {\r\n for (let i = 0, len = input.lineDecorations.length; i < len; i++) {\r\n const lineDecoration = input.lineDecorations[i];\r\n if (lineDecoration.type === 3 /* RegularAffectingLetterSpacing */) {\r\n // Pretend there are foreign elements... although not 100% accurate.\r\n containsForeignElements |= 1 /* Before */;\r\n }\r\n else if (lineDecoration.type === 1 /* Before */) {\r\n containsForeignElements |= 1 /* Before */;\r\n }\r\n else if (lineDecoration.type === 2 /* After */) {\r\n containsForeignElements |= 2 /* After */;\r\n }\r\n }\r\n tokens = _applyInlineDecorations(lineContent, len, tokens, input.lineDecorations);\r\n }\r\n if (!input.containsRTL) {\r\n // We can never split RTL text, as it ruins the rendering\r\n tokens = splitLargeTokens(lineContent, tokens, !input.isBasicASCII || input.fontLigatures);\r\n }\r\n return new ResolvedRenderLineInput(input.useMonospaceOptimizations, input.canUseHalfwidthRightwardsArrow, lineContent, len, isOverflowing, tokens, containsForeignElements, input.fauxIndentLength, input.tabSize, input.startVisibleColumn, input.containsRTL, input.spaceWidth, input.renderSpaceCharCode, input.renderWhitespace, input.renderControlCharacters);\r\n}\r\n/**\r\n * In the rendering phase, characters are always looped until token.endIndex.\r\n * Ensure that all tokens end before `len` and the last one ends precisely at `len`.\r\n */\r\nfunction transformAndRemoveOverflowing(tokens, fauxIndentLength, len) {\r\n let result = [], resultLen = 0;\r\n // The faux indent part of the line should have no token type\r\n if (fauxIndentLength > 0) {\r\n result[resultLen++] = new LinePart(fauxIndentLength, '', 0);\r\n }\r\n for (let tokenIndex = 0, tokensLen = tokens.getCount(); tokenIndex < tokensLen; tokenIndex++) {\r\n const endIndex = tokens.getEndOffset(tokenIndex);\r\n if (endIndex <= fauxIndentLength) {\r\n // The faux indent part of the line should have no token type\r\n continue;\r\n }\r\n const type = tokens.getClassName(tokenIndex);\r\n if (endIndex >= len) {\r\n result[resultLen++] = new LinePart(len, type, 0);\r\n break;\r\n }\r\n result[resultLen++] = new LinePart(endIndex, type, 0);\r\n }\r\n return result;\r\n}\r\n/**\r\n * See https://github.com/microsoft/vscode/issues/6885.\r\n * It appears that having very large spans causes very slow reading of character positions.\r\n * So here we try to avoid that.\r\n */\r\nfunction splitLargeTokens(lineContent, tokens, onlyAtSpaces) {\r\n let lastTokenEndIndex = 0;\r\n let result = [], resultLen = 0;\r\n if (onlyAtSpaces) {\r\n // Split only at spaces => we need to walk each character\r\n for (let i = 0, len = tokens.length; i < len; i++) {\r\n const token = tokens[i];\r\n const tokenEndIndex = token.endIndex;\r\n if (lastTokenEndIndex + 50 /* LongToken */ < tokenEndIndex) {\r\n const tokenType = token.type;\r\n const tokenMetadata = token.metadata;\r\n let lastSpaceOffset = -1;\r\n let currTokenStart = lastTokenEndIndex;\r\n for (let j = lastTokenEndIndex; j < tokenEndIndex; j++) {\r\n if (lineContent.charCodeAt(j) === 32 /* Space */) {\r\n lastSpaceOffset = j;\r\n }\r\n if (lastSpaceOffset !== -1 && j - currTokenStart >= 50 /* LongToken */) {\r\n // Split at `lastSpaceOffset` + 1\r\n result[resultLen++] = new LinePart(lastSpaceOffset + 1, tokenType, tokenMetadata);\r\n currTokenStart = lastSpaceOffset + 1;\r\n lastSpaceOffset = -1;\r\n }\r\n }\r\n if (currTokenStart !== tokenEndIndex) {\r\n result[resultLen++] = new LinePart(tokenEndIndex, tokenType, tokenMetadata);\r\n }\r\n }\r\n else {\r\n result[resultLen++] = token;\r\n }\r\n lastTokenEndIndex = tokenEndIndex;\r\n }\r\n }\r\n else {\r\n // Split anywhere => we don't need to walk each character\r\n for (let i = 0, len = tokens.length; i < len; i++) {\r\n const token = tokens[i];\r\n const tokenEndIndex = token.endIndex;\r\n let diff = (tokenEndIndex - lastTokenEndIndex);\r\n if (diff > 50 /* LongToken */) {\r\n const tokenType = token.type;\r\n const tokenMetadata = token.metadata;\r\n const piecesCount = Math.ceil(diff / 50 /* LongToken */);\r\n for (let j = 1; j < piecesCount; j++) {\r\n let pieceEndIndex = lastTokenEndIndex + (j * 50 /* LongToken */);\r\n result[resultLen++] = new LinePart(pieceEndIndex, tokenType, tokenMetadata);\r\n }\r\n result[resultLen++] = new LinePart(tokenEndIndex, tokenType, tokenMetadata);\r\n }\r\n else {\r\n result[resultLen++] = token;\r\n }\r\n lastTokenEndIndex = tokenEndIndex;\r\n }\r\n }\r\n return result;\r\n}\r\n/**\r\n * Whitespace is rendered by \"replacing\" tokens with a special-purpose `mtkw` type that is later recognized in the rendering phase.\r\n * Moreover, a token is created for every visual indent because on some fonts the glyphs used for rendering whitespace (→ or ·) do not have the same width as  .\r\n * The rendering phase will generate `style=\"width:...\"` for these tokens.\r\n */\r\nfunction _applyRenderWhitespace(input, lineContent, len, tokens) {\r\n const continuesWithWrappedLine = input.continuesWithWrappedLine;\r\n const fauxIndentLength = input.fauxIndentLength;\r\n const tabSize = input.tabSize;\r\n const startVisibleColumn = input.startVisibleColumn;\r\n const useMonospaceOptimizations = input.useMonospaceOptimizations;\r\n const selections = input.selectionsOnLine;\r\n const onlyBoundary = (input.renderWhitespace === 1 /* Boundary */);\r\n const onlyTrailing = (input.renderWhitespace === 3 /* Trailing */);\r\n const generateLinePartForEachWhitespace = (input.renderSpaceWidth !== input.spaceWidth);\r\n let result = [], resultLen = 0;\r\n let tokenIndex = 0;\r\n let tokenType = tokens[tokenIndex].type;\r\n let tokenEndIndex = tokens[tokenIndex].endIndex;\r\n const tokensLength = tokens.length;\r\n let lineIsEmptyOrWhitespace = false;\r\n let firstNonWhitespaceIndex = strings.firstNonWhitespaceIndex(lineContent);\r\n let lastNonWhitespaceIndex;\r\n if (firstNonWhitespaceIndex === -1) {\r\n lineIsEmptyOrWhitespace = true;\r\n firstNonWhitespaceIndex = len;\r\n lastNonWhitespaceIndex = len;\r\n }\r\n else {\r\n lastNonWhitespaceIndex = strings.lastNonWhitespaceIndex(lineContent);\r\n }\r\n let wasInWhitespace = false;\r\n let currentSelectionIndex = 0;\r\n let currentSelection = selections && selections[currentSelectionIndex];\r\n let tmpIndent = startVisibleColumn % tabSize;\r\n for (let charIndex = fauxIndentLength; charIndex < len; charIndex++) {\r\n const chCode = lineContent.charCodeAt(charIndex);\r\n if (currentSelection && charIndex >= currentSelection.endOffset) {\r\n currentSelectionIndex++;\r\n currentSelection = selections && selections[currentSelectionIndex];\r\n }\r\n let isInWhitespace;\r\n if (charIndex < firstNonWhitespaceIndex || charIndex > lastNonWhitespaceIndex) {\r\n // in leading or trailing whitespace\r\n isInWhitespace = true;\r\n }\r\n else if (chCode === 9 /* Tab */) {\r\n // a tab character is rendered both in all and boundary cases\r\n isInWhitespace = true;\r\n }\r\n else if (chCode === 32 /* Space */) {\r\n // hit a space character\r\n if (onlyBoundary) {\r\n // rendering only boundary whitespace\r\n if (wasInWhitespace) {\r\n isInWhitespace = true;\r\n }\r\n else {\r\n const nextChCode = (charIndex + 1 < len ? lineContent.charCodeAt(charIndex + 1) : 0 /* Null */);\r\n isInWhitespace = (nextChCode === 32 /* Space */ || nextChCode === 9 /* Tab */);\r\n }\r\n }\r\n else {\r\n isInWhitespace = true;\r\n }\r\n }\r\n else {\r\n isInWhitespace = false;\r\n }\r\n // If rendering whitespace on selection, check that the charIndex falls within a selection\r\n if (isInWhitespace && selections) {\r\n isInWhitespace = !!currentSelection && currentSelection.startOffset <= charIndex && currentSelection.endOffset > charIndex;\r\n }\r\n // If rendering only trailing whitespace, check that the charIndex points to trailing whitespace.\r\n if (isInWhitespace && onlyTrailing) {\r\n isInWhitespace = lineIsEmptyOrWhitespace || charIndex > lastNonWhitespaceIndex;\r\n }\r\n if (wasInWhitespace) {\r\n // was in whitespace token\r\n if (!isInWhitespace || (!useMonospaceOptimizations && tmpIndent >= tabSize)) {\r\n // leaving whitespace token or entering a new indent\r\n if (generateLinePartForEachWhitespace) {\r\n const lastEndIndex = (resultLen > 0 ? result[resultLen - 1].endIndex : fauxIndentLength);\r\n for (let i = lastEndIndex + 1; i <= charIndex; i++) {\r\n result[resultLen++] = new LinePart(i, 'mtkw', 1 /* IS_WHITESPACE */);\r\n }\r\n }\r\n else {\r\n result[resultLen++] = new LinePart(charIndex, 'mtkw', 1 /* IS_WHITESPACE */);\r\n }\r\n tmpIndent = tmpIndent % tabSize;\r\n }\r\n }\r\n else {\r\n // was in regular token\r\n if (charIndex === tokenEndIndex || (isInWhitespace && charIndex > fauxIndentLength)) {\r\n result[resultLen++] = new LinePart(charIndex, tokenType, 0);\r\n tmpIndent = tmpIndent % tabSize;\r\n }\r\n }\r\n if (chCode === 9 /* Tab */) {\r\n tmpIndent = tabSize;\r\n }\r\n else if (strings.isFullWidthCharacter(chCode)) {\r\n tmpIndent += 2;\r\n }\r\n else {\r\n tmpIndent++;\r\n }\r\n wasInWhitespace = isInWhitespace;\r\n while (charIndex === tokenEndIndex) {\r\n tokenIndex++;\r\n if (tokenIndex < tokensLength) {\r\n tokenType = tokens[tokenIndex].type;\r\n tokenEndIndex = tokens[tokenIndex].endIndex;\r\n }\r\n else {\r\n break;\r\n }\r\n }\r\n }\r\n let generateWhitespace = false;\r\n if (wasInWhitespace) {\r\n // was in whitespace token\r\n if (continuesWithWrappedLine && onlyBoundary) {\r\n let lastCharCode = (len > 0 ? lineContent.charCodeAt(len - 1) : 0 /* Null */);\r\n let prevCharCode = (len > 1 ? lineContent.charCodeAt(len - 2) : 0 /* Null */);\r\n let isSingleTrailingSpace = (lastCharCode === 32 /* Space */ && (prevCharCode !== 32 /* Space */ && prevCharCode !== 9 /* Tab */));\r\n if (!isSingleTrailingSpace) {\r\n generateWhitespace = true;\r\n }\r\n }\r\n else {\r\n generateWhitespace = true;\r\n }\r\n }\r\n if (generateWhitespace) {\r\n if (generateLinePartForEachWhitespace) {\r\n const lastEndIndex = (resultLen > 0 ? result[resultLen - 1].endIndex : fauxIndentLength);\r\n for (let i = lastEndIndex + 1; i <= len; i++) {\r\n result[resultLen++] = new LinePart(i, 'mtkw', 1 /* IS_WHITESPACE */);\r\n }\r\n }\r\n else {\r\n result[resultLen++] = new LinePart(len, 'mtkw', 1 /* IS_WHITESPACE */);\r\n }\r\n }\r\n else {\r\n result[resultLen++] = new LinePart(len, tokenType, 0);\r\n }\r\n return result;\r\n}\r\n/**\r\n * Inline decorations are \"merged\" on top of tokens.\r\n * Special care must be taken when multiple inline decorations are at play and they overlap.\r\n */\r\nfunction _applyInlineDecorations(lineContent, len, tokens, _lineDecorations) {\r\n _lineDecorations.sort(LineDecoration.compare);\r\n const lineDecorations = LineDecorationsNormalizer.normalize(lineContent, _lineDecorations);\r\n const lineDecorationsLen = lineDecorations.length;\r\n let lineDecorationIndex = 0;\r\n let result = [], resultLen = 0, lastResultEndIndex = 0;\r\n for (let tokenIndex = 0, len = tokens.length; tokenIndex < len; tokenIndex++) {\r\n const token = tokens[tokenIndex];\r\n const tokenEndIndex = token.endIndex;\r\n const tokenType = token.type;\r\n const tokenMetadata = token.metadata;\r\n while (lineDecorationIndex < lineDecorationsLen && lineDecorations[lineDecorationIndex].startOffset < tokenEndIndex) {\r\n const lineDecoration = lineDecorations[lineDecorationIndex];\r\n if (lineDecoration.startOffset > lastResultEndIndex) {\r\n lastResultEndIndex = lineDecoration.startOffset;\r\n result[resultLen++] = new LinePart(lastResultEndIndex, tokenType, tokenMetadata);\r\n }\r\n if (lineDecoration.endOffset + 1 <= tokenEndIndex) {\r\n // This line decoration ends before this token ends\r\n lastResultEndIndex = lineDecoration.endOffset + 1;\r\n result[resultLen++] = new LinePart(lastResultEndIndex, tokenType + ' ' + lineDecoration.className, tokenMetadata | lineDecoration.metadata);\r\n lineDecorationIndex++;\r\n }\r\n else {\r\n // This line decoration continues on to the next token\r\n lastResultEndIndex = tokenEndIndex;\r\n result[resultLen++] = new LinePart(lastResultEndIndex, tokenType + ' ' + lineDecoration.className, tokenMetadata | lineDecoration.metadata);\r\n break;\r\n }\r\n }\r\n if (tokenEndIndex > lastResultEndIndex) {\r\n lastResultEndIndex = tokenEndIndex;\r\n result[resultLen++] = new LinePart(lastResultEndIndex, tokenType, tokenMetadata);\r\n }\r\n }\r\n const lastTokenEndIndex = tokens[tokens.length - 1].endIndex;\r\n if (lineDecorationIndex < lineDecorationsLen && lineDecorations[lineDecorationIndex].startOffset === lastTokenEndIndex) {\r\n while (lineDecorationIndex < lineDecorationsLen && lineDecorations[lineDecorationIndex].startOffset === lastTokenEndIndex) {\r\n const lineDecoration = lineDecorations[lineDecorationIndex];\r\n result[resultLen++] = new LinePart(lastResultEndIndex, lineDecoration.className, lineDecoration.metadata);\r\n lineDecorationIndex++;\r\n }\r\n }\r\n return result;\r\n}\r\n/**\r\n * This function is on purpose not split up into multiple functions to allow runtime type inference (i.e. performance reasons).\r\n * Notice how all the needed data is fully resolved and passed in (i.e. no other calls).\r\n */\r\nfunction _renderLine(input, sb) {\r\n const fontIsMonospace = input.fontIsMonospace;\r\n const canUseHalfwidthRightwardsArrow = input.canUseHalfwidthRightwardsArrow;\r\n const containsForeignElements = input.containsForeignElements;\r\n const lineContent = input.lineContent;\r\n const len = input.len;\r\n const isOverflowing = input.isOverflowing;\r\n const parts = input.parts;\r\n const fauxIndentLength = input.fauxIndentLength;\r\n const tabSize = input.tabSize;\r\n const startVisibleColumn = input.startVisibleColumn;\r\n const containsRTL = input.containsRTL;\r\n const spaceWidth = input.spaceWidth;\r\n const renderSpaceCharCode = input.renderSpaceCharCode;\r\n const renderWhitespace = input.renderWhitespace;\r\n const renderControlCharacters = input.renderControlCharacters;\r\n const characterMapping = new CharacterMapping(len + 1, parts.length);\r\n let lastCharacterMappingDefined = false;\r\n let charIndex = 0;\r\n let visibleColumn = startVisibleColumn;\r\n let charOffsetInPart = 0;\r\n let partDisplacement = 0;\r\n let prevPartContentCnt = 0;\r\n let partAbsoluteOffset = 0;\r\n if (containsRTL) {\r\n sb.appendASCIIString('');\r\n }\r\n else {\r\n sb.appendASCIIString('');\r\n }\r\n for (let partIndex = 0, tokensLen = parts.length; partIndex < tokensLen; partIndex++) {\r\n partAbsoluteOffset += prevPartContentCnt;\r\n const part = parts[partIndex];\r\n const partEndIndex = part.endIndex;\r\n const partType = part.type;\r\n const partRendersWhitespace = (renderWhitespace !== 0 /* None */ && part.isWhitespace());\r\n const partRendersWhitespaceWithWidth = partRendersWhitespace && !fontIsMonospace && (partType === 'mtkw' /*only whitespace*/ || !containsForeignElements);\r\n const partIsEmptyAndHasPseudoAfter = (charIndex === partEndIndex && part.isPseudoAfter());\r\n charOffsetInPart = 0;\r\n sb.appendASCIIString('= fauxIndentLength) {\r\n _visibleColumn += charWidth;\r\n }\r\n }\r\n }\r\n if (partRendersWhitespaceWithWidth) {\r\n sb.appendASCIIString(' style=\"width:');\r\n sb.appendASCIIString(String(spaceWidth * partContentCnt));\r\n sb.appendASCIIString('px\"');\r\n }\r\n sb.appendASCII(62 /* GreaterThan */);\r\n for (; charIndex < partEndIndex; charIndex++) {\r\n characterMapping.setColumnInfo(charIndex + 1, partIndex - partDisplacement, charOffsetInPart, partAbsoluteOffset);\r\n partDisplacement = 0;\r\n const charCode = lineContent.charCodeAt(charIndex);\r\n let charWidth;\r\n if (charCode === 9 /* Tab */) {\r\n charWidth = (tabSize - (visibleColumn % tabSize)) | 0;\r\n if (!canUseHalfwidthRightwardsArrow || charWidth > 1) {\r\n sb.write1(0x2192); // RIGHTWARDS ARROW\r\n }\r\n else {\r\n sb.write1(0xFFEB); // HALFWIDTH RIGHTWARDS ARROW\r\n }\r\n for (let space = 2; space <= charWidth; space++) {\r\n sb.write1(0xA0); //  \r\n }\r\n }\r\n else { // must be CharCode.Space\r\n charWidth = 1;\r\n sb.write1(renderSpaceCharCode); // · or word separator middle dot\r\n }\r\n charOffsetInPart += charWidth;\r\n if (charIndex >= fauxIndentLength) {\r\n visibleColumn += charWidth;\r\n }\r\n }\r\n prevPartContentCnt = partContentCnt;\r\n }\r\n else {\r\n let partContentCnt = 0;\r\n sb.appendASCII(62 /* GreaterThan */);\r\n for (; charIndex < partEndIndex; charIndex++) {\r\n characterMapping.setColumnInfo(charIndex + 1, partIndex - partDisplacement, charOffsetInPart, partAbsoluteOffset);\r\n partDisplacement = 0;\r\n const charCode = lineContent.charCodeAt(charIndex);\r\n let producedCharacters = 1;\r\n let charWidth = 1;\r\n switch (charCode) {\r\n case 9 /* Tab */:\r\n producedCharacters = (tabSize - (visibleColumn % tabSize));\r\n charWidth = producedCharacters;\r\n for (let space = 1; space <= producedCharacters; space++) {\r\n sb.write1(0xA0); //  \r\n }\r\n break;\r\n case 32 /* Space */:\r\n sb.write1(0xA0); //  \r\n break;\r\n case 60 /* LessThan */:\r\n sb.appendASCIIString('<');\r\n break;\r\n case 62 /* GreaterThan */:\r\n sb.appendASCIIString('>');\r\n break;\r\n case 38 /* Ampersand */:\r\n sb.appendASCIIString('&');\r\n break;\r\n case 0 /* Null */:\r\n if (renderControlCharacters) {\r\n // See https://unicode-table.com/en/blocks/control-pictures/\r\n sb.write1(9216);\r\n }\r\n else {\r\n sb.appendASCIIString('�');\r\n }\r\n break;\r\n case 65279 /* UTF8_BOM */:\r\n case 8232 /* LINE_SEPARATOR */:\r\n case 8233 /* PARAGRAPH_SEPARATOR */:\r\n case 133 /* NEXT_LINE */:\r\n sb.write1(0xFFFD);\r\n break;\r\n default:\r\n if (strings.isFullWidthCharacter(charCode)) {\r\n charWidth++;\r\n }\r\n // See https://unicode-table.com/en/blocks/control-pictures/\r\n if (renderControlCharacters && charCode < 32) {\r\n sb.write1(9216 + charCode);\r\n }\r\n else if (renderControlCharacters && charCode === 127) {\r\n // DEL\r\n sb.write1(9249);\r\n }\r\n else {\r\n sb.write1(charCode);\r\n }\r\n }\r\n charOffsetInPart += producedCharacters;\r\n partContentCnt += producedCharacters;\r\n if (charIndex >= fauxIndentLength) {\r\n visibleColumn += charWidth;\r\n }\r\n }\r\n prevPartContentCnt = partContentCnt;\r\n }\r\n if (partIsEmptyAndHasPseudoAfter) {\r\n partDisplacement++;\r\n }\r\n else {\r\n partDisplacement = 0;\r\n }\r\n if (charIndex >= len && !lastCharacterMappingDefined && part.isPseudoAfter()) {\r\n lastCharacterMappingDefined = true;\r\n characterMapping.setColumnInfo(charIndex + 1, partIndex, charOffsetInPart, partAbsoluteOffset);\r\n }\r\n sb.appendASCIIString('');\r\n }\r\n if (!lastCharacterMappingDefined) {\r\n // When getting client rects for the last character, we will position the\r\n // text range at the end of the span, insteaf of at the beginning of next span\r\n characterMapping.setColumnInfo(len + 1, parts.length - 1, charOffsetInPart, partAbsoluteOffset);\r\n }\r\n if (isOverflowing) {\r\n sb.appendASCIIString('…');\r\n }\r\n sb.appendASCIIString('');\r\n return new RenderLineOutput(characterMapping, containsRTL, containsForeignElements);\r\n}\r\n", "/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License. See License.txt in the project root for license information.\r\n *--------------------------------------------------------------------------------------------*/\r\nimport * as strings from '../../../base/common/strings.js';\r\nimport { Position } from '../core/position.js';\r\nimport { Range } from '../core/range.js';\r\nexport class Viewport {\r\n constructor(top, left, width, height) {\r\n this._viewportBrand = undefined;\r\n this.top = top | 0;\r\n this.left = left | 0;\r\n this.width = width | 0;\r\n this.height = height | 0;\r\n }\r\n}\r\nexport class OutputPosition {\r\n constructor(outputLineIndex, outputOffset) {\r\n this.outputLineIndex = outputLineIndex;\r\n this.outputOffset = outputOffset;\r\n }\r\n toString() {\r\n return `${this.outputLineIndex}:${this.outputOffset}`;\r\n }\r\n toPosition(baseLineNumber, wrappedTextIndentLength) {\r\n const delta = (this.outputLineIndex > 0 ? wrappedTextIndentLength : 0);\r\n return new Position(baseLineNumber + this.outputLineIndex, delta + this.outputOffset + 1);\r\n }\r\n}\r\nexport class LineBreakData {\r\n constructor(breakOffsets, breakOffsetsVisibleColumn, wrappedTextIndentLength, injectionOffsets, injectionOptions) {\r\n this.breakOffsets = breakOffsets;\r\n this.breakOffsetsVisibleColumn = breakOffsetsVisibleColumn;\r\n this.wrappedTextIndentLength = wrappedTextIndentLength;\r\n this.injectionOffsets = injectionOffsets;\r\n this.injectionOptions = injectionOptions;\r\n }\r\n getInputOffsetOfOutputPosition(outputLineIndex, outputOffset) {\r\n let inputOffset = 0;\r\n if (outputLineIndex === 0) {\r\n inputOffset = outputOffset;\r\n }\r\n else {\r\n inputOffset = this.breakOffsets[outputLineIndex - 1] + outputOffset;\r\n }\r\n if (this.injectionOffsets !== null) {\r\n for (let i = 0; i < this.injectionOffsets.length; i++) {\r\n if (inputOffset > this.injectionOffsets[i]) {\r\n if (inputOffset < this.injectionOffsets[i] + this.injectionOptions[i].content.length) {\r\n // `inputOffset` is within injected text\r\n inputOffset = this.injectionOffsets[i];\r\n }\r\n else {\r\n inputOffset -= this.injectionOptions[i].content.length;\r\n }\r\n }\r\n else {\r\n break;\r\n }\r\n }\r\n }\r\n return inputOffset;\r\n }\r\n getOutputPositionOfInputOffset(inputOffset, affinity = 2 /* None */) {\r\n let delta = 0;\r\n if (this.injectionOffsets !== null) {\r\n for (let i = 0; i < this.injectionOffsets.length; i++) {\r\n if (inputOffset < this.injectionOffsets[i]) {\r\n break;\r\n }\r\n if (affinity !== 1 /* Right */ && inputOffset === this.injectionOffsets[i]) {\r\n break;\r\n }\r\n delta += this.injectionOptions[i].content.length;\r\n }\r\n }\r\n inputOffset += delta;\r\n return this.getOutputPositionOfOffsetInUnwrappedLine(inputOffset, affinity);\r\n }\r\n getOutputPositionOfOffsetInUnwrappedLine(inputOffset, affinity = 2 /* None */) {\r\n let low = 0;\r\n let high = this.breakOffsets.length - 1;\r\n let mid = 0;\r\n let midStart = 0;\r\n while (low <= high) {\r\n mid = low + ((high - low) / 2) | 0;\r\n const midStop = this.breakOffsets[mid];\r\n midStart = mid > 0 ? this.breakOffsets[mid - 1] : 0;\r\n if (affinity === 0 /* Left */) {\r\n if (inputOffset <= midStart) {\r\n high = mid - 1;\r\n }\r\n else if (inputOffset > midStop) {\r\n low = mid + 1;\r\n }\r\n else {\r\n break;\r\n }\r\n }\r\n else {\r\n if (inputOffset < midStart) {\r\n high = mid - 1;\r\n }\r\n else if (inputOffset >= midStop) {\r\n low = mid + 1;\r\n }\r\n else {\r\n break;\r\n }\r\n }\r\n }\r\n return new OutputPosition(mid, inputOffset - midStart);\r\n }\r\n outputPositionToOffsetInUnwrappedLine(outputLineIndex, outputOffset) {\r\n let result = (outputLineIndex > 0 ? this.breakOffsets[outputLineIndex - 1] : 0) + outputOffset;\r\n if (outputLineIndex > 0) {\r\n result -= this.wrappedTextIndentLength;\r\n }\r\n return result;\r\n }\r\n normalizeOffsetAroundInjections(offsetInUnwrappedLine, affinity) {\r\n const injectedText = this.getInjectedTextAtOffset(offsetInUnwrappedLine);\r\n if (!injectedText) {\r\n return offsetInUnwrappedLine;\r\n }\r\n if (affinity === 2 /* None */) {\r\n if (offsetInUnwrappedLine === injectedText.offsetInUnwrappedLine + injectedText.length) {\r\n // go to the end of this injected text\r\n return injectedText.offsetInUnwrappedLine + injectedText.length;\r\n }\r\n else {\r\n // go to the start of this injected text\r\n return injectedText.offsetInUnwrappedLine;\r\n }\r\n }\r\n if (affinity === 1 /* Right */) {\r\n let result = injectedText.offsetInUnwrappedLine + injectedText.length;\r\n let index = injectedText.injectedTextIndex;\r\n // traverse all injected text that touch eachother\r\n while (index + 1 < this.injectionOffsets.length && this.injectionOffsets[index + 1] === this.injectionOffsets[index]) {\r\n result += this.injectionOptions[index + 1].content.length;\r\n index++;\r\n }\r\n return result;\r\n }\r\n // affinity is left\r\n let result = injectedText.offsetInUnwrappedLine;\r\n let index = injectedText.injectedTextIndex;\r\n // traverse all injected text that touch eachother\r\n while (index - 1 >= 0 && this.injectionOffsets[index - 1] === this.injectionOffsets[index]) {\r\n result -= this.injectionOptions[index - 1].content.length;\r\n index++;\r\n }\r\n return result;\r\n }\r\n getInjectedText(outputLineIndex, outputOffset) {\r\n const offset = this.outputPositionToOffsetInUnwrappedLine(outputLineIndex, outputOffset);\r\n const injectedText = this.getInjectedTextAtOffset(offset);\r\n if (!injectedText) {\r\n return null;\r\n }\r\n return {\r\n options: this.injectionOptions[injectedText.injectedTextIndex]\r\n };\r\n }\r\n getInjectedTextAtOffset(offsetInUnwrappedLine) {\r\n const injectionOffsets = this.injectionOffsets;\r\n const injectionOptions = this.injectionOptions;\r\n if (injectionOffsets !== null) {\r\n let totalInjectedTextLengthBefore = 0;\r\n for (let i = 0; i < injectionOffsets.length; i++) {\r\n const length = injectionOptions[i].content.length;\r\n const injectedTextStartOffsetInUnwrappedLine = injectionOffsets[i] + totalInjectedTextLengthBefore;\r\n const injectedTextEndOffsetInUnwrappedLine = injectionOffsets[i] + totalInjectedTextLengthBefore + length;\r\n if (injectedTextStartOffsetInUnwrappedLine > offsetInUnwrappedLine) {\r\n // Injected text starts later.\r\n break; // All later injected texts have an even larger offset.\r\n }\r\n if (offsetInUnwrappedLine <= injectedTextEndOffsetInUnwrappedLine) {\r\n // Injected text ends after or with the given position (but also starts with or before it).\r\n return {\r\n injectedTextIndex: i,\r\n offsetInUnwrappedLine: injectedTextStartOffsetInUnwrappedLine,\r\n length\r\n };\r\n }\r\n totalInjectedTextLengthBefore += length;\r\n }\r\n }\r\n return undefined;\r\n }\r\n}\r\nexport class InjectedText {\r\n constructor(options) {\r\n this.options = options;\r\n }\r\n}\r\nexport class MinimapLinesRenderingData {\r\n constructor(tabSize, data) {\r\n this.tabSize = tabSize;\r\n this.data = data;\r\n }\r\n}\r\nexport class ViewLineData {\r\n constructor(content, continuesWithWrappedLine, minColumn, maxColumn, startVisibleColumn, tokens, inlineDecorations) {\r\n this._viewLineDataBrand = undefined;\r\n this.content = content;\r\n this.continuesWithWrappedLine = continuesWithWrappedLine;\r\n this.minColumn = minColumn;\r\n this.maxColumn = maxColumn;\r\n this.startVisibleColumn = startVisibleColumn;\r\n this.tokens = tokens;\r\n this.inlineDecorations = inlineDecorations;\r\n }\r\n}\r\nexport class ViewLineRenderingData {\r\n constructor(minColumn, maxColumn, content, continuesWithWrappedLine, mightContainRTL, mightContainNonBasicASCII, tokens, inlineDecorations, tabSize, startVisibleColumn) {\r\n this.minColumn = minColumn;\r\n this.maxColumn = maxColumn;\r\n this.content = content;\r\n this.continuesWithWrappedLine = continuesWithWrappedLine;\r\n this.isBasicASCII = ViewLineRenderingData.isBasicASCII(content, mightContainNonBasicASCII);\r\n this.containsRTL = ViewLineRenderingData.containsRTL(content, this.isBasicASCII, mightContainRTL);\r\n this.tokens = tokens;\r\n this.inlineDecorations = inlineDecorations;\r\n this.tabSize = tabSize;\r\n this.startVisibleColumn = startVisibleColumn;\r\n }\r\n static isBasicASCII(lineContent, mightContainNonBasicASCII) {\r\n if (mightContainNonBasicASCII) {\r\n return strings.isBasicASCII(lineContent);\r\n }\r\n return true;\r\n }\r\n static containsRTL(lineContent, isBasicASCII, mightContainRTL) {\r\n if (!isBasicASCII && mightContainRTL) {\r\n return strings.containsRTL(lineContent);\r\n }\r\n return false;\r\n }\r\n}\r\nexport class InlineDecoration {\r\n constructor(range, inlineClassName, type) {\r\n this.range = range;\r\n this.inlineClassName = inlineClassName;\r\n this.type = type;\r\n }\r\n}\r\nexport class SingleLineInlineDecoration {\r\n constructor(startOffset, endOffset, inlineClassName, inlineClassNameAffectsLetterSpacing) {\r\n this.startOffset = startOffset;\r\n this.endOffset = endOffset;\r\n this.inlineClassName = inlineClassName;\r\n this.inlineClassNameAffectsLetterSpacing = inlineClassNameAffectsLetterSpacing;\r\n }\r\n toInlineDecoration(lineNumber) {\r\n return new InlineDecoration(new Range(lineNumber, this.startOffset + 1, lineNumber, this.endOffset + 1), this.inlineClassName, this.inlineClassNameAffectsLetterSpacing ? 3 /* RegularAffectingLetterSpacing */ : 0 /* Regular */);\r\n }\r\n}\r\nexport class ViewModelDecoration {\r\n constructor(range, options) {\r\n this._viewModelDecorationBrand = undefined;\r\n this.range = range;\r\n this.options = options;\r\n }\r\n}\r\n", "/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License. See License.txt in the project root for license information.\r\n *--------------------------------------------------------------------------------------------*/\r\nexport function isFuzzyActionArr(what) {\r\n return (Array.isArray(what));\r\n}\r\nexport function isFuzzyAction(what) {\r\n return !isFuzzyActionArr(what);\r\n}\r\nexport function isString(what) {\r\n return (typeof what === 'string');\r\n}\r\nexport function isIAction(what) {\r\n return !isString(what);\r\n}\r\n// Small helper functions\r\n/**\r\n * Is a string null, undefined, or empty?\r\n */\r\nexport function empty(s) {\r\n return (s ? false : true);\r\n}\r\n/**\r\n * Puts a string to lower case if 'ignoreCase' is set.\r\n */\r\nexport function fixCase(lexer, str) {\r\n return (lexer.ignoreCase && str ? str.toLowerCase() : str);\r\n}\r\n/**\r\n * Ensures there are no bad characters in a CSS token class.\r\n */\r\nexport function sanitize(s) {\r\n return s.replace(/[&<>'\"_]/g, '-'); // used on all output token CSS classes\r\n}\r\n// Logging\r\n/**\r\n * Logs a message.\r\n */\r\nexport function log(lexer, msg) {\r\n console.log(`${lexer.languageId}: ${msg}`);\r\n}\r\n// Throwing errors\r\nexport function createError(lexer, msg) {\r\n return new Error(`${lexer.languageId}: ${msg}`);\r\n}\r\n// Helper functions for rule finding and substitution\r\n/**\r\n * substituteMatches is used on lexer strings and can substitutes predefined patterns:\r\n * \t\t$$ => $\r\n * \t\t$# => id\r\n * \t\t$n => matched entry n\r\n * \t\t@attr => contents of lexer[attr]\r\n *\r\n * See documentation for more info\r\n */\r\nexport function substituteMatches(lexer, str, id, matches, state) {\r\n const re = /\\$((\\$)|(#)|(\\d\\d?)|[sS](\\d\\d?)|@(\\w+))/g;\r\n let stateMatches = null;\r\n return str.replace(re, function (full, sub, dollar, hash, n, s, attr, ofs, total) {\r\n if (!empty(dollar)) {\r\n return '$'; // $$\r\n }\r\n if (!empty(hash)) {\r\n return fixCase(lexer, id); // default $#\r\n }\r\n if (!empty(n) && n < matches.length) {\r\n return fixCase(lexer, matches[n]); // $n\r\n }\r\n if (!empty(attr) && lexer && typeof (lexer[attr]) === 'string') {\r\n return lexer[attr]; //@attribute\r\n }\r\n if (stateMatches === null) { // split state on demand\r\n stateMatches = state.split('.');\r\n stateMatches.unshift(state);\r\n }\r\n if (!empty(s) && s < stateMatches.length) {\r\n return fixCase(lexer, stateMatches[s]); //$Sn\r\n }\r\n return '';\r\n });\r\n}\r\n/**\r\n * Find the tokenizer rules for a specific state (i.e. next action)\r\n */\r\nexport function findRules(lexer, inState) {\r\n let state = inState;\r\n while (state && state.length > 0) {\r\n const rules = lexer.tokenizer[state];\r\n if (rules) {\r\n return rules;\r\n }\r\n const idx = state.lastIndexOf('.');\r\n if (idx < 0) {\r\n state = null; // no further parent\r\n }\r\n else {\r\n state = state.substr(0, idx);\r\n }\r\n }\r\n return null;\r\n}\r\n/**\r\n * Is a certain state defined? In contrast to 'findRules' this works on a ILexerMin.\r\n * This is used during compilation where we may know the defined states\r\n * but not yet whether the corresponding rules are correct.\r\n */\r\nexport function stateExists(lexer, inState) {\r\n let state = inState;\r\n while (state && state.length > 0) {\r\n const exist = lexer.stateNames[state];\r\n if (exist) {\r\n return true;\r\n }\r\n const idx = state.lastIndexOf('.');\r\n if (idx < 0) {\r\n state = null; // no further parent\r\n }\r\n else {\r\n state = state.substr(0, idx);\r\n }\r\n }\r\n return false;\r\n}\r\n", "/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License. See License.txt in the project root for license information.\r\n *--------------------------------------------------------------------------------------------*/\r\nimport { Token, TokenizationResult, TokenizationResult2 } from '../../../common/core/token.js';\r\nimport * as modes from '../../../common/modes.js';\r\nimport { NULL_MODE_ID, NULL_STATE } from '../../../common/modes/nullMode.js';\r\nimport * as monarchCommon from './monarchCommon.js';\r\nconst CACHE_STACK_DEPTH = 5;\r\n/**\r\n * Reuse the same stack elements up to a certain depth.\r\n */\r\nclass MonarchStackElementFactory {\r\n constructor(maxCacheDepth) {\r\n this._maxCacheDepth = maxCacheDepth;\r\n this._entries = Object.create(null);\r\n }\r\n static create(parent, state) {\r\n return this._INSTANCE.create(parent, state);\r\n }\r\n create(parent, state) {\r\n if (parent !== null && parent.depth >= this._maxCacheDepth) {\r\n // no caching above a certain depth\r\n return new MonarchStackElement(parent, state);\r\n }\r\n let stackElementId = MonarchStackElement.getStackElementId(parent);\r\n if (stackElementId.length > 0) {\r\n stackElementId += '|';\r\n }\r\n stackElementId += state;\r\n let result = this._entries[stackElementId];\r\n if (result) {\r\n return result;\r\n }\r\n result = new MonarchStackElement(parent, state);\r\n this._entries[stackElementId] = result;\r\n return result;\r\n }\r\n}\r\nMonarchStackElementFactory._INSTANCE = new MonarchStackElementFactory(CACHE_STACK_DEPTH);\r\nclass MonarchStackElement {\r\n constructor(parent, state) {\r\n this.parent = parent;\r\n this.state = state;\r\n this.depth = (this.parent ? this.parent.depth : 0) + 1;\r\n }\r\n static getStackElementId(element) {\r\n let result = '';\r\n while (element !== null) {\r\n if (result.length > 0) {\r\n result += '|';\r\n }\r\n result += element.state;\r\n element = element.parent;\r\n }\r\n return result;\r\n }\r\n static _equals(a, b) {\r\n while (a !== null && b !== null) {\r\n if (a === b) {\r\n return true;\r\n }\r\n if (a.state !== b.state) {\r\n return false;\r\n }\r\n a = a.parent;\r\n b = b.parent;\r\n }\r\n if (a === null && b === null) {\r\n return true;\r\n }\r\n return false;\r\n }\r\n equals(other) {\r\n return MonarchStackElement._equals(this, other);\r\n }\r\n push(state) {\r\n return MonarchStackElementFactory.create(this, state);\r\n }\r\n pop() {\r\n return this.parent;\r\n }\r\n popall() {\r\n let result = this;\r\n while (result.parent) {\r\n result = result.parent;\r\n }\r\n return result;\r\n }\r\n switchTo(state) {\r\n return MonarchStackElementFactory.create(this.parent, state);\r\n }\r\n}\r\nclass EmbeddedModeData {\r\n constructor(modeId, state) {\r\n this.modeId = modeId;\r\n this.state = state;\r\n }\r\n equals(other) {\r\n return (this.modeId === other.modeId\r\n && this.state.equals(other.state));\r\n }\r\n clone() {\r\n let stateClone = this.state.clone();\r\n // save an object\r\n if (stateClone === this.state) {\r\n return this;\r\n }\r\n return new EmbeddedModeData(this.modeId, this.state);\r\n }\r\n}\r\n/**\r\n * Reuse the same line states up to a certain depth.\r\n */\r\nclass MonarchLineStateFactory {\r\n constructor(maxCacheDepth) {\r\n this._maxCacheDepth = maxCacheDepth;\r\n this._entries = Object.create(null);\r\n }\r\n static create(stack, embeddedModeData) {\r\n return this._INSTANCE.create(stack, embeddedModeData);\r\n }\r\n create(stack, embeddedModeData) {\r\n if (embeddedModeData !== null) {\r\n // no caching when embedding\r\n return new MonarchLineState(stack, embeddedModeData);\r\n }\r\n if (stack !== null && stack.depth >= this._maxCacheDepth) {\r\n // no caching above a certain depth\r\n return new MonarchLineState(stack, embeddedModeData);\r\n }\r\n let stackElementId = MonarchStackElement.getStackElementId(stack);\r\n let result = this._entries[stackElementId];\r\n if (result) {\r\n return result;\r\n }\r\n result = new MonarchLineState(stack, null);\r\n this._entries[stackElementId] = result;\r\n return result;\r\n }\r\n}\r\nMonarchLineStateFactory._INSTANCE = new MonarchLineStateFactory(CACHE_STACK_DEPTH);\r\nclass MonarchLineState {\r\n constructor(stack, embeddedModeData) {\r\n this.stack = stack;\r\n this.embeddedModeData = embeddedModeData;\r\n }\r\n clone() {\r\n let embeddedModeDataClone = this.embeddedModeData ? this.embeddedModeData.clone() : null;\r\n // save an object\r\n if (embeddedModeDataClone === this.embeddedModeData) {\r\n return this;\r\n }\r\n return MonarchLineStateFactory.create(this.stack, this.embeddedModeData);\r\n }\r\n equals(other) {\r\n if (!(other instanceof MonarchLineState)) {\r\n return false;\r\n }\r\n if (!this.stack.equals(other.stack)) {\r\n return false;\r\n }\r\n if (this.embeddedModeData === null && other.embeddedModeData === null) {\r\n return true;\r\n }\r\n if (this.embeddedModeData === null || other.embeddedModeData === null) {\r\n return false;\r\n }\r\n return this.embeddedModeData.equals(other.embeddedModeData);\r\n }\r\n}\r\nclass MonarchClassicTokensCollector {\r\n constructor() {\r\n this._tokens = [];\r\n this._language = null;\r\n this._lastTokenType = null;\r\n this._lastTokenLanguage = null;\r\n }\r\n enterMode(startOffset, modeId) {\r\n this._language = modeId;\r\n }\r\n emit(startOffset, type) {\r\n if (this._lastTokenType === type && this._lastTokenLanguage === this._language) {\r\n return;\r\n }\r\n this._lastTokenType = type;\r\n this._lastTokenLanguage = this._language;\r\n this._tokens.push(new Token(startOffset, type, this._language));\r\n }\r\n nestedModeTokenize(embeddedModeLine, hasEOL, embeddedModeData, offsetDelta) {\r\n const nestedModeId = embeddedModeData.modeId;\r\n const embeddedModeState = embeddedModeData.state;\r\n const nestedModeTokenizationSupport = modes.TokenizationRegistry.get(nestedModeId);\r\n if (!nestedModeTokenizationSupport) {\r\n this.enterMode(offsetDelta, nestedModeId);\r\n this.emit(offsetDelta, '');\r\n return embeddedModeState;\r\n }\r\n let nestedResult = nestedModeTokenizationSupport.tokenize(embeddedModeLine, hasEOL, embeddedModeState, offsetDelta);\r\n this._tokens = this._tokens.concat(nestedResult.tokens);\r\n this._lastTokenType = null;\r\n this._lastTokenLanguage = null;\r\n this._language = null;\r\n return nestedResult.endState;\r\n }\r\n finalize(endState) {\r\n return new TokenizationResult(this._tokens, endState);\r\n }\r\n}\r\nclass MonarchModernTokensCollector {\r\n constructor(modeService, theme) {\r\n this._modeService = modeService;\r\n this._theme = theme;\r\n this._prependTokens = null;\r\n this._tokens = [];\r\n this._currentLanguageId = 0 /* Null */;\r\n this._lastTokenMetadata = 0;\r\n }\r\n enterMode(startOffset, modeId) {\r\n this._currentLanguageId = this._modeService.getLanguageIdentifier(modeId).id;\r\n }\r\n emit(startOffset, type) {\r\n let metadata = this._theme.match(this._currentLanguageId, type);\r\n if (this._lastTokenMetadata === metadata) {\r\n return;\r\n }\r\n this._lastTokenMetadata = metadata;\r\n this._tokens.push(startOffset);\r\n this._tokens.push(metadata);\r\n }\r\n static _merge(a, b, c) {\r\n let aLen = (a !== null ? a.length : 0);\r\n let bLen = b.length;\r\n let cLen = (c !== null ? c.length : 0);\r\n if (aLen === 0 && bLen === 0 && cLen === 0) {\r\n return new Uint32Array(0);\r\n }\r\n if (aLen === 0 && bLen === 0) {\r\n return c;\r\n }\r\n if (bLen === 0 && cLen === 0) {\r\n return a;\r\n }\r\n let result = new Uint32Array(aLen + bLen + cLen);\r\n if (a !== null) {\r\n result.set(a);\r\n }\r\n for (let i = 0; i < bLen; i++) {\r\n result[aLen + i] = b[i];\r\n }\r\n if (c !== null) {\r\n result.set(c, aLen + bLen);\r\n }\r\n return result;\r\n }\r\n nestedModeTokenize(embeddedModeLine, hasEOL, embeddedModeData, offsetDelta) {\r\n const nestedModeId = embeddedModeData.modeId;\r\n const embeddedModeState = embeddedModeData.state;\r\n const nestedModeTokenizationSupport = modes.TokenizationRegistry.get(nestedModeId);\r\n if (!nestedModeTokenizationSupport) {\r\n this.enterMode(offsetDelta, nestedModeId);\r\n this.emit(offsetDelta, '');\r\n return embeddedModeState;\r\n }\r\n let nestedResult = nestedModeTokenizationSupport.tokenize2(embeddedModeLine, hasEOL, embeddedModeState, offsetDelta);\r\n this._prependTokens = MonarchModernTokensCollector._merge(this._prependTokens, this._tokens, nestedResult.tokens);\r\n this._tokens = [];\r\n this._currentLanguageId = 0;\r\n this._lastTokenMetadata = 0;\r\n return nestedResult.endState;\r\n }\r\n finalize(endState) {\r\n return new TokenizationResult2(MonarchModernTokensCollector._merge(this._prependTokens, this._tokens, null), endState);\r\n }\r\n}\r\nexport class MonarchTokenizer {\r\n constructor(modeService, standaloneThemeService, modeId, lexer) {\r\n this._modeService = modeService;\r\n this._standaloneThemeService = standaloneThemeService;\r\n this._modeId = modeId;\r\n this._lexer = lexer;\r\n this._embeddedModes = Object.create(null);\r\n this.embeddedLoaded = Promise.resolve(undefined);\r\n // Set up listening for embedded modes\r\n let emitting = false;\r\n this._tokenizationRegistryListener = modes.TokenizationRegistry.onDidChange((e) => {\r\n if (emitting) {\r\n return;\r\n }\r\n let isOneOfMyEmbeddedModes = false;\r\n for (let i = 0, len = e.changedLanguages.length; i < len; i++) {\r\n let language = e.changedLanguages[i];\r\n if (this._embeddedModes[language]) {\r\n isOneOfMyEmbeddedModes = true;\r\n break;\r\n }\r\n }\r\n if (isOneOfMyEmbeddedModes) {\r\n emitting = true;\r\n modes.TokenizationRegistry.fire([this._modeId]);\r\n emitting = false;\r\n }\r\n });\r\n }\r\n dispose() {\r\n this._tokenizationRegistryListener.dispose();\r\n }\r\n getLoadStatus() {\r\n let promises = [];\r\n for (let nestedModeId in this._embeddedModes) {\r\n const tokenizationSupport = modes.TokenizationRegistry.get(nestedModeId);\r\n if (tokenizationSupport) {\r\n // The nested mode is already loaded\r\n if (tokenizationSupport instanceof MonarchTokenizer) {\r\n const nestedModeStatus = tokenizationSupport.getLoadStatus();\r\n if (nestedModeStatus.loaded === false) {\r\n promises.push(nestedModeStatus.promise);\r\n }\r\n }\r\n continue;\r\n }\r\n const tokenizationSupportPromise = modes.TokenizationRegistry.getPromise(nestedModeId);\r\n if (tokenizationSupportPromise) {\r\n // The nested mode is in the process of being loaded\r\n promises.push(tokenizationSupportPromise);\r\n }\r\n }\r\n if (promises.length === 0) {\r\n return {\r\n loaded: true\r\n };\r\n }\r\n return {\r\n loaded: false,\r\n promise: Promise.all(promises).then(_ => undefined)\r\n };\r\n }\r\n getInitialState() {\r\n let rootState = MonarchStackElementFactory.create(null, this._lexer.start);\r\n return MonarchLineStateFactory.create(rootState, null);\r\n }\r\n tokenize(line, hasEOL, lineState, offsetDelta) {\r\n let tokensCollector = new MonarchClassicTokensCollector();\r\n let endLineState = this._tokenize(line, hasEOL, lineState, offsetDelta, tokensCollector);\r\n return tokensCollector.finalize(endLineState);\r\n }\r\n tokenize2(line, hasEOL, lineState, offsetDelta) {\r\n let tokensCollector = new MonarchModernTokensCollector(this._modeService, this._standaloneThemeService.getColorTheme().tokenTheme);\r\n let endLineState = this._tokenize(line, hasEOL, lineState, offsetDelta, tokensCollector);\r\n return tokensCollector.finalize(endLineState);\r\n }\r\n _tokenize(line, hasEOL, lineState, offsetDelta, collector) {\r\n if (lineState.embeddedModeData) {\r\n return this._nestedTokenize(line, hasEOL, lineState, offsetDelta, collector);\r\n }\r\n else {\r\n return this._myTokenize(line, hasEOL, lineState, offsetDelta, collector);\r\n }\r\n }\r\n _findLeavingNestedModeOffset(line, state) {\r\n let rules = this._lexer.tokenizer[state.stack.state];\r\n if (!rules) {\r\n rules = monarchCommon.findRules(this._lexer, state.stack.state); // do parent matching\r\n if (!rules) {\r\n throw monarchCommon.createError(this._lexer, 'tokenizer state is not defined: ' + state.stack.state);\r\n }\r\n }\r\n let popOffset = -1;\r\n let hasEmbeddedPopRule = false;\r\n for (const rule of rules) {\r\n if (!monarchCommon.isIAction(rule.action) || rule.action.nextEmbedded !== '@pop') {\r\n continue;\r\n }\r\n hasEmbeddedPopRule = true;\r\n let regex = rule.regex;\r\n let regexSource = rule.regex.source;\r\n if (regexSource.substr(0, 4) === '^(?:' && regexSource.substr(regexSource.length - 1, 1) === ')') {\r\n let flags = (regex.ignoreCase ? 'i' : '') + (regex.unicode ? 'u' : '');\r\n regex = new RegExp(regexSource.substr(4, regexSource.length - 5), flags);\r\n }\r\n let result = line.search(regex);\r\n if (result === -1 || (result !== 0 && rule.matchOnlyAtLineStart)) {\r\n continue;\r\n }\r\n if (popOffset === -1 || result < popOffset) {\r\n popOffset = result;\r\n }\r\n }\r\n if (!hasEmbeddedPopRule) {\r\n throw monarchCommon.createError(this._lexer, 'no rule containing nextEmbedded: \"@pop\" in tokenizer embedded state: ' + state.stack.state);\r\n }\r\n return popOffset;\r\n }\r\n _nestedTokenize(line, hasEOL, lineState, offsetDelta, tokensCollector) {\r\n let popOffset = this._findLeavingNestedModeOffset(line, lineState);\r\n if (popOffset === -1) {\r\n // tokenization will not leave nested mode\r\n let nestedEndState = tokensCollector.nestedModeTokenize(line, hasEOL, lineState.embeddedModeData, offsetDelta);\r\n return MonarchLineStateFactory.create(lineState.stack, new EmbeddedModeData(lineState.embeddedModeData.modeId, nestedEndState));\r\n }\r\n let nestedModeLine = line.substring(0, popOffset);\r\n if (nestedModeLine.length > 0) {\r\n // tokenize with the nested mode\r\n tokensCollector.nestedModeTokenize(nestedModeLine, false, lineState.embeddedModeData, offsetDelta);\r\n }\r\n let restOfTheLine = line.substring(popOffset);\r\n return this._myTokenize(restOfTheLine, hasEOL, lineState, offsetDelta + popOffset, tokensCollector);\r\n }\r\n _safeRuleName(rule) {\r\n if (rule) {\r\n return rule.name;\r\n }\r\n return '(unknown)';\r\n }\r\n _myTokenize(lineWithoutLF, hasEOL, lineState, offsetDelta, tokensCollector) {\r\n tokensCollector.enterMode(offsetDelta, this._modeId);\r\n const lineWithoutLFLength = lineWithoutLF.length;\r\n const line = (hasEOL && this._lexer.includeLF ? lineWithoutLF + '\\n' : lineWithoutLF);\r\n const lineLength = line.length;\r\n let embeddedModeData = lineState.embeddedModeData;\r\n let stack = lineState.stack;\r\n let pos = 0;\r\n let groupMatching = null;\r\n // See https://github.com/microsoft/monaco-editor/issues/1235\r\n // Evaluate rules at least once for an empty line\r\n let forceEvaluation = true;\r\n while (forceEvaluation || pos < lineLength) {\r\n const pos0 = pos;\r\n const stackLen0 = stack.depth;\r\n const groupLen0 = groupMatching ? groupMatching.groups.length : 0;\r\n const state = stack.state;\r\n let matches = null;\r\n let matched = null;\r\n let action = null;\r\n let rule = null;\r\n let enteringEmbeddedMode = null;\r\n // check if we need to process group matches first\r\n if (groupMatching) {\r\n matches = groupMatching.matches;\r\n const groupEntry = groupMatching.groups.shift();\r\n matched = groupEntry.matched;\r\n action = groupEntry.action;\r\n rule = groupMatching.rule;\r\n // cleanup if necessary\r\n if (groupMatching.groups.length === 0) {\r\n groupMatching = null;\r\n }\r\n }\r\n else {\r\n // otherwise we match on the token stream\r\n if (!forceEvaluation && pos >= lineLength) {\r\n // nothing to do\r\n break;\r\n }\r\n forceEvaluation = false;\r\n // get the rules for this state\r\n let rules = this._lexer.tokenizer[state];\r\n if (!rules) {\r\n rules = monarchCommon.findRules(this._lexer, state); // do parent matching\r\n if (!rules) {\r\n throw monarchCommon.createError(this._lexer, 'tokenizer state is not defined: ' + state);\r\n }\r\n }\r\n // try each rule until we match\r\n let restOfLine = line.substr(pos);\r\n for (const rule of rules) {\r\n if (pos === 0 || !rule.matchOnlyAtLineStart) {\r\n matches = restOfLine.match(rule.regex);\r\n if (matches) {\r\n matched = matches[0];\r\n action = rule.action;\r\n break;\r\n }\r\n }\r\n }\r\n }\r\n // We matched 'rule' with 'matches' and 'action'\r\n if (!matches) {\r\n matches = [''];\r\n matched = '';\r\n }\r\n if (!action) {\r\n // bad: we didn't match anything, and there is no action to take\r\n // we need to advance the stream or we get progress trouble\r\n if (pos < lineLength) {\r\n matches = [line.charAt(pos)];\r\n matched = matches[0];\r\n }\r\n action = this._lexer.defaultToken;\r\n }\r\n if (matched === null) {\r\n // should never happen, needed for strict null checking\r\n break;\r\n }\r\n // advance stream\r\n pos += matched.length;\r\n // maybe call action function (used for 'cases')\r\n while (monarchCommon.isFuzzyAction(action) && monarchCommon.isIAction(action) && action.test) {\r\n action = action.test(matched, matches, state, pos === lineLength);\r\n }\r\n let result = null;\r\n // set the result: either a string or an array of actions\r\n if (typeof action === 'string' || Array.isArray(action)) {\r\n result = action;\r\n }\r\n else if (action.group) {\r\n result = action.group;\r\n }\r\n else if (action.token !== null && action.token !== undefined) {\r\n // do $n replacements?\r\n if (action.tokenSubst) {\r\n result = monarchCommon.substituteMatches(this._lexer, action.token, matched, matches, state);\r\n }\r\n else {\r\n result = action.token;\r\n }\r\n // enter embedded mode?\r\n if (action.nextEmbedded) {\r\n if (action.nextEmbedded === '@pop') {\r\n if (!embeddedModeData) {\r\n throw monarchCommon.createError(this._lexer, 'cannot pop embedded mode if not inside one');\r\n }\r\n embeddedModeData = null;\r\n }\r\n else if (embeddedModeData) {\r\n throw monarchCommon.createError(this._lexer, 'cannot enter embedded mode from within an embedded mode');\r\n }\r\n else {\r\n enteringEmbeddedMode = monarchCommon.substituteMatches(this._lexer, action.nextEmbedded, matched, matches, state);\r\n }\r\n }\r\n // state transformations\r\n if (action.goBack) { // back up the stream..\r\n pos = Math.max(0, pos - action.goBack);\r\n }\r\n if (action.switchTo && typeof action.switchTo === 'string') {\r\n let nextState = monarchCommon.substituteMatches(this._lexer, action.switchTo, matched, matches, state); // switch state without a push...\r\n if (nextState[0] === '@') {\r\n nextState = nextState.substr(1); // peel off starting '@'\r\n }\r\n if (!monarchCommon.findRules(this._lexer, nextState)) {\r\n throw monarchCommon.createError(this._lexer, 'trying to switch to a state \\'' + nextState + '\\' that is undefined in rule: ' + this._safeRuleName(rule));\r\n }\r\n else {\r\n stack = stack.switchTo(nextState);\r\n }\r\n }\r\n else if (action.transform && typeof action.transform === 'function') {\r\n throw monarchCommon.createError(this._lexer, 'action.transform not supported');\r\n }\r\n else if (action.next) {\r\n if (action.next === '@push') {\r\n if (stack.depth >= this._lexer.maxStack) {\r\n throw monarchCommon.createError(this._lexer, 'maximum tokenizer stack size reached: [' +\r\n stack.state + ',' + stack.parent.state + ',...]');\r\n }\r\n else {\r\n stack = stack.push(state);\r\n }\r\n }\r\n else if (action.next === '@pop') {\r\n if (stack.depth <= 1) {\r\n throw monarchCommon.createError(this._lexer, 'trying to pop an empty stack in rule: ' + this._safeRuleName(rule));\r\n }\r\n else {\r\n stack = stack.pop();\r\n }\r\n }\r\n else if (action.next === '@popall') {\r\n stack = stack.popall();\r\n }\r\n else {\r\n let nextState = monarchCommon.substituteMatches(this._lexer, action.next, matched, matches, state);\r\n if (nextState[0] === '@') {\r\n nextState = nextState.substr(1); // peel off starting '@'\r\n }\r\n if (!monarchCommon.findRules(this._lexer, nextState)) {\r\n throw monarchCommon.createError(this._lexer, 'trying to set a next state \\'' + nextState + '\\' that is undefined in rule: ' + this._safeRuleName(rule));\r\n }\r\n else {\r\n stack = stack.push(nextState);\r\n }\r\n }\r\n }\r\n if (action.log && typeof (action.log) === 'string') {\r\n monarchCommon.log(this._lexer, this._lexer.languageId + ': ' + monarchCommon.substituteMatches(this._lexer, action.log, matched, matches, state));\r\n }\r\n }\r\n // check result\r\n if (result === null) {\r\n throw monarchCommon.createError(this._lexer, 'lexer rule has no well-defined action in rule: ' + this._safeRuleName(rule));\r\n }\r\n const computeNewStateForEmbeddedMode = (enteringEmbeddedMode) => {\r\n // substitute language alias to known modes to support syntax highlighting\r\n let enteringEmbeddedModeId = this._modeService.getModeIdForLanguageName(enteringEmbeddedMode);\r\n if (enteringEmbeddedModeId) {\r\n enteringEmbeddedMode = enteringEmbeddedModeId;\r\n }\r\n const embeddedModeData = this._getNestedEmbeddedModeData(enteringEmbeddedMode);\r\n if (pos < lineLength) {\r\n // there is content from the embedded mode on this line\r\n const restOfLine = lineWithoutLF.substr(pos);\r\n return this._nestedTokenize(restOfLine, hasEOL, MonarchLineStateFactory.create(stack, embeddedModeData), offsetDelta + pos, tokensCollector);\r\n }\r\n else {\r\n return MonarchLineStateFactory.create(stack, embeddedModeData);\r\n }\r\n };\r\n // is the result a group match?\r\n if (Array.isArray(result)) {\r\n if (groupMatching && groupMatching.groups.length > 0) {\r\n throw monarchCommon.createError(this._lexer, 'groups cannot be nested: ' + this._safeRuleName(rule));\r\n }\r\n if (matches.length !== result.length + 1) {\r\n throw monarchCommon.createError(this._lexer, 'matched number of groups does not match the number of actions in rule: ' + this._safeRuleName(rule));\r\n }\r\n let totalLen = 0;\r\n for (let i = 1; i < matches.length; i++) {\r\n totalLen += matches[i].length;\r\n }\r\n if (totalLen !== matched.length) {\r\n throw monarchCommon.createError(this._lexer, 'with groups, all characters should be matched in consecutive groups in rule: ' + this._safeRuleName(rule));\r\n }\r\n groupMatching = {\r\n rule: rule,\r\n matches: matches,\r\n groups: []\r\n };\r\n for (let i = 0; i < result.length; i++) {\r\n groupMatching.groups[i] = {\r\n action: result[i],\r\n matched: matches[i + 1]\r\n };\r\n }\r\n pos -= matched.length;\r\n // call recursively to initiate first result match\r\n continue;\r\n }\r\n else {\r\n // regular result\r\n // check for '@rematch'\r\n if (result === '@rematch') {\r\n pos -= matched.length;\r\n matched = ''; // better set the next state too..\r\n matches = null;\r\n result = '';\r\n // Even though `@rematch` was specified, if `nextEmbedded` also specified,\r\n // a state transition should occur.\r\n if (enteringEmbeddedMode !== null) {\r\n return computeNewStateForEmbeddedMode(enteringEmbeddedMode);\r\n }\r\n }\r\n // check progress\r\n if (matched.length === 0) {\r\n if (lineLength === 0 || stackLen0 !== stack.depth || state !== stack.state || (!groupMatching ? 0 : groupMatching.groups.length) !== groupLen0) {\r\n continue;\r\n }\r\n else {\r\n throw monarchCommon.createError(this._lexer, 'no progress in tokenizer in rule: ' + this._safeRuleName(rule));\r\n }\r\n }\r\n // return the result (and check for brace matching)\r\n // todo: for efficiency we could pre-sanitize tokenPostfix and substitutions\r\n let tokenType = null;\r\n if (monarchCommon.isString(result) && result.indexOf('@brackets') === 0) {\r\n let rest = result.substr('@brackets'.length);\r\n let bracket = findBracket(this._lexer, matched);\r\n if (!bracket) {\r\n throw monarchCommon.createError(this._lexer, '@brackets token returned but no bracket defined as: ' + matched);\r\n }\r\n tokenType = monarchCommon.sanitize(bracket.token + rest);\r\n }\r\n else {\r\n let token = (result === '' ? '' : result + this._lexer.tokenPostfix);\r\n tokenType = monarchCommon.sanitize(token);\r\n }\r\n if (pos0 < lineWithoutLFLength) {\r\n tokensCollector.emit(pos0 + offsetDelta, tokenType);\r\n }\r\n }\r\n if (enteringEmbeddedMode !== null) {\r\n return computeNewStateForEmbeddedMode(enteringEmbeddedMode);\r\n }\r\n }\r\n return MonarchLineStateFactory.create(stack, embeddedModeData);\r\n }\r\n _getNestedEmbeddedModeData(mimetypeOrModeId) {\r\n let nestedModeId = this._locateMode(mimetypeOrModeId);\r\n if (nestedModeId) {\r\n let tokenizationSupport = modes.TokenizationRegistry.get(nestedModeId);\r\n if (tokenizationSupport) {\r\n return new EmbeddedModeData(nestedModeId, tokenizationSupport.getInitialState());\r\n }\r\n }\r\n return new EmbeddedModeData(nestedModeId || NULL_MODE_ID, NULL_STATE);\r\n }\r\n _locateMode(mimetypeOrModeId) {\r\n if (!mimetypeOrModeId || !this._modeService.isRegisteredMode(mimetypeOrModeId)) {\r\n return null;\r\n }\r\n if (mimetypeOrModeId === this._modeId) {\r\n // embedding myself...\r\n return mimetypeOrModeId;\r\n }\r\n let modeId = this._modeService.getModeId(mimetypeOrModeId);\r\n if (modeId) {\r\n // Fire mode loading event\r\n this._modeService.triggerMode(modeId);\r\n this._embeddedModes[modeId] = true;\r\n }\r\n return modeId;\r\n }\r\n}\r\n/**\r\n * Searches for a bracket in the 'brackets' attribute that matches the input.\r\n */\r\nfunction findBracket(lexer, matched) {\r\n if (!matched) {\r\n return null;\r\n }\r\n matched = monarchCommon.fixCase(lexer, matched);\r\n let brackets = lexer.brackets;\r\n for (const bracket of brackets) {\r\n if (bracket.open === matched) {\r\n return { token: bracket.token, bracketType: 1 /* Open */ };\r\n }\r\n else if (bracket.close === matched) {\r\n return { token: bracket.token, bracketType: -1 /* Close */ };\r\n }\r\n }\r\n return null;\r\n}\r\nexport function createTokenizationSupport(modeService, standaloneThemeService, modeId, lexer) {\r\n return new MonarchTokenizer(modeService, standaloneThemeService, modeId, lexer);\r\n}\r\n", "/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License. See License.txt in the project root for license information.\r\n *--------------------------------------------------------------------------------------------*/\r\nvar _a;\r\nimport { TimeoutTimer } from '../../../base/common/async.js';\r\nimport * as strings from '../../../base/common/strings.js';\r\nimport { LineTokens } from '../../common/core/lineTokens.js';\r\nimport { TokenizationRegistry } from '../../common/modes.js';\r\nimport { RenderLineInput, renderViewLine2 as renderViewLine } from '../../common/viewLayout/viewLineRenderer.js';\r\nimport { ViewLineRenderingData } from '../../common/viewModel/viewModel.js';\r\nimport { MonarchTokenizer } from '../common/monarch/monarchLexer.js';\r\nconst ttPolicy = (_a = window.trustedTypes) === null || _a === void 0 ? void 0 : _a.createPolicy('standaloneColorizer', { createHTML: value => value });\r\nexport class Colorizer {\r\n static colorizeElement(themeService, modeService, domNode, options) {\r\n options = options || {};\r\n let theme = options.theme || 'vs';\r\n let mimeType = options.mimeType || domNode.getAttribute('lang') || domNode.getAttribute('data-lang');\r\n if (!mimeType) {\r\n console.error('Mode not detected');\r\n return Promise.resolve();\r\n }\r\n themeService.setTheme(theme);\r\n let text = domNode.firstChild ? domNode.firstChild.nodeValue : '';\r\n domNode.className += ' ' + theme;\r\n let render = (str) => {\r\n var _a;\r\n const trustedhtml = (_a = ttPolicy === null || ttPolicy === void 0 ? void 0 : ttPolicy.createHTML(str)) !== null && _a !== void 0 ? _a : str;\r\n domNode.innerHTML = trustedhtml;\r\n };\r\n return this.colorize(modeService, text || '', mimeType, options).then(render, (err) => console.error(err));\r\n }\r\n static colorize(modeService, text, mimeType, options) {\r\n let tabSize = 4;\r\n if (options && typeof options.tabSize === 'number') {\r\n tabSize = options.tabSize;\r\n }\r\n if (strings.startsWithUTF8BOM(text)) {\r\n text = text.substr(1);\r\n }\r\n let lines = strings.splitLines(text);\r\n let language = modeService.getModeId(mimeType);\r\n if (!language) {\r\n return Promise.resolve(_fakeColorize(lines, tabSize));\r\n }\r\n // Send out the event to create the mode\r\n modeService.triggerMode(language);\r\n const tokenizationSupport = TokenizationRegistry.get(language);\r\n if (tokenizationSupport) {\r\n return _colorize(lines, tabSize, tokenizationSupport);\r\n }\r\n const tokenizationSupportPromise = TokenizationRegistry.getPromise(language);\r\n if (tokenizationSupportPromise) {\r\n // A tokenizer will be registered soon\r\n return new Promise((resolve, reject) => {\r\n tokenizationSupportPromise.then(tokenizationSupport => {\r\n _colorize(lines, tabSize, tokenizationSupport).then(resolve, reject);\r\n }, reject);\r\n });\r\n }\r\n return new Promise((resolve, reject) => {\r\n let listener = null;\r\n let timeout = null;\r\n const execute = () => {\r\n if (listener) {\r\n listener.dispose();\r\n listener = null;\r\n }\r\n if (timeout) {\r\n timeout.dispose();\r\n timeout = null;\r\n }\r\n const tokenizationSupport = TokenizationRegistry.get(language);\r\n if (tokenizationSupport) {\r\n _colorize(lines, tabSize, tokenizationSupport).then(resolve, reject);\r\n return;\r\n }\r\n resolve(_fakeColorize(lines, tabSize));\r\n };\r\n // wait 500ms for mode to load, then give up\r\n timeout = new TimeoutTimer();\r\n timeout.cancelAndSet(execute, 500);\r\n listener = TokenizationRegistry.onDidChange((e) => {\r\n if (e.changedLanguages.indexOf(language) >= 0) {\r\n execute();\r\n }\r\n });\r\n });\r\n }\r\n static colorizeLine(line, mightContainNonBasicASCII, mightContainRTL, tokens, tabSize = 4) {\r\n const isBasicASCII = ViewLineRenderingData.isBasicASCII(line, mightContainNonBasicASCII);\r\n const containsRTL = ViewLineRenderingData.containsRTL(line, isBasicASCII, mightContainRTL);\r\n let renderResult = renderViewLine(new RenderLineInput(false, true, line, false, isBasicASCII, containsRTL, 0, tokens, [], tabSize, 0, 0, 0, 0, -1, 'none', false, false, null));\r\n return renderResult.html;\r\n }\r\n static colorizeModelLine(model, lineNumber, tabSize = 4) {\r\n let content = model.getLineContent(lineNumber);\r\n model.forceTokenization(lineNumber);\r\n let tokens = model.getLineTokens(lineNumber);\r\n let inflatedTokens = tokens.inflate();\r\n return this.colorizeLine(content, model.mightContainNonBasicASCII(), model.mightContainRTL(), inflatedTokens, tabSize);\r\n }\r\n}\r\nfunction _colorize(lines, tabSize, tokenizationSupport) {\r\n return new Promise((c, e) => {\r\n const execute = () => {\r\n const result = _actualColorize(lines, tabSize, tokenizationSupport);\r\n if (tokenizationSupport instanceof MonarchTokenizer) {\r\n const status = tokenizationSupport.getLoadStatus();\r\n if (status.loaded === false) {\r\n status.promise.then(execute, e);\r\n return;\r\n }\r\n }\r\n c(result);\r\n };\r\n execute();\r\n });\r\n}\r\nfunction _fakeColorize(lines, tabSize) {\r\n let html = [];\r\n const defaultMetadata = ((0 /* None */ << 11 /* FONT_STYLE_OFFSET */)\r\n | (1 /* DefaultForeground */ << 14 /* FOREGROUND_OFFSET */)\r\n | (2 /* DefaultBackground */ << 23 /* BACKGROUND_OFFSET */)) >>> 0;\r\n const tokens = new Uint32Array(2);\r\n tokens[0] = 0;\r\n tokens[1] = defaultMetadata;\r\n for (let i = 0, length = lines.length; i < length; i++) {\r\n let line = lines[i];\r\n tokens[0] = line.length;\r\n const lineTokens = new LineTokens(tokens, line);\r\n const isBasicASCII = ViewLineRenderingData.isBasicASCII(line, /* check for basic ASCII */ true);\r\n const containsRTL = ViewLineRenderingData.containsRTL(line, isBasicASCII, /* check for RTL */ true);\r\n let renderResult = renderViewLine(new RenderLineInput(false, true, line, false, isBasicASCII, containsRTL, 0, lineTokens, [], tabSize, 0, 0, 0, 0, -1, 'none', false, false, null));\r\n html = html.concat(renderResult.html);\r\n html.push('
');\r\n }\r\n return html.join('');\r\n}\r\nfunction _actualColorize(lines, tabSize, tokenizationSupport) {\r\n let html = [];\r\n let state = tokenizationSupport.getInitialState();\r\n for (let i = 0, length = lines.length; i < length; i++) {\r\n let line = lines[i];\r\n let tokenizeResult = tokenizationSupport.tokenize2(line, true, state, 0);\r\n LineTokens.convertToEndOffset(tokenizeResult.tokens, line.length);\r\n let lineTokens = new LineTokens(tokenizeResult.tokens, line);\r\n const isBasicASCII = ViewLineRenderingData.isBasicASCII(line, /* check for basic ASCII */ true);\r\n const containsRTL = ViewLineRenderingData.containsRTL(line, isBasicASCII, /* check for RTL */ true);\r\n let renderResult = renderViewLine(new RenderLineInput(false, true, line, false, isBasicASCII, containsRTL, 0, lineTokens.inflate(), [], tabSize, 0, 0, 0, 0, -1, 'none', false, false, null));\r\n html = html.concat(renderResult.html);\r\n html.push('
');\r\n state = tokenizeResult.endState;\r\n }\r\n return html.join('');\r\n}\r\n", "/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License. See License.txt in the project root for license information.\r\n *--------------------------------------------------------------------------------------------*/\r\nimport * as strings from './strings.js';\r\nvar Severity;\r\n(function (Severity) {\r\n Severity[Severity[\"Ignore\"] = 0] = \"Ignore\";\r\n Severity[Severity[\"Info\"] = 1] = \"Info\";\r\n Severity[Severity[\"Warning\"] = 2] = \"Warning\";\r\n Severity[Severity[\"Error\"] = 3] = \"Error\";\r\n})(Severity || (Severity = {}));\r\n(function (Severity) {\r\n const _error = 'error';\r\n const _warning = 'warning';\r\n const _warn = 'warn';\r\n const _info = 'info';\r\n const _ignore = 'ignore';\r\n /**\r\n * Parses 'error', 'warning', 'warn', 'info' in call casings\r\n * and falls back to ignore.\r\n */\r\n function fromValue(value) {\r\n if (!value) {\r\n return Severity.Ignore;\r\n }\r\n if (strings.equalsIgnoreCase(_error, value)) {\r\n return Severity.Error;\r\n }\r\n if (strings.equalsIgnoreCase(_warning, value) || strings.equalsIgnoreCase(_warn, value)) {\r\n return Severity.Warning;\r\n }\r\n if (strings.equalsIgnoreCase(_info, value)) {\r\n return Severity.Info;\r\n }\r\n return Severity.Ignore;\r\n }\r\n Severity.fromValue = fromValue;\r\n function toString(severity) {\r\n switch (severity) {\r\n case Severity.Error: return _error;\r\n case Severity.Warning: return _warning;\r\n case Severity.Info: return _info;\r\n default: return _ignore;\r\n }\r\n }\r\n Severity.toString = toString;\r\n})(Severity || (Severity = {}));\r\nexport default Severity;\r\n", "/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License. See License.txt in the project root for license information.\r\n *--------------------------------------------------------------------------------------------*/\r\nimport * as editorCommon from '../common/editorCommon.js';\r\n/**\r\n *@internal\r\n */\r\nexport function isCodeEditor(thing) {\r\n if (thing && typeof thing.getEditorType === 'function') {\r\n return thing.getEditorType() === editorCommon.EditorType.ICodeEditor;\r\n }\r\n else {\r\n return false;\r\n }\r\n}\r\n/**\r\n *@internal\r\n */\r\nexport function isDiffEditor(thing) {\r\n if (thing && typeof thing.getEditorType === 'function') {\r\n return thing.getEditorType() === editorCommon.EditorType.IDiffEditor;\r\n }\r\n else {\r\n return false;\r\n }\r\n}\r\n/**\r\n *@internal\r\n */\r\nexport function getCodeEditor(thing) {\r\n if (isCodeEditor(thing)) {\r\n return thing;\r\n }\r\n if (isDiffEditor(thing)) {\r\n return thing.getModifiedEditor();\r\n }\r\n return null;\r\n}\r\n", "/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License. See License.txt in the project root for license information.\r\n *--------------------------------------------------------------------------------------------*/\r\nimport { createDecorator } from '../../../platform/instantiation/common/instantiation.js';\r\nimport { URI } from '../../../base/common/uri.js';\r\nimport { isObject } from '../../../base/common/types.js';\r\nexport const IBulkEditService = createDecorator('IWorkspaceEditService');\r\nfunction isWorkspaceFileEdit(thing) {\r\n return isObject(thing) && (Boolean(thing.newUri) || Boolean(thing.oldUri));\r\n}\r\nfunction isWorkspaceTextEdit(thing) {\r\n return isObject(thing) && URI.isUri(thing.resource) && isObject(thing.edit);\r\n}\r\nexport class ResourceEdit {\r\n constructor(metadata) {\r\n this.metadata = metadata;\r\n }\r\n static convert(edit) {\r\n return edit.edits.map(edit => {\r\n if (isWorkspaceTextEdit(edit)) {\r\n return new ResourceTextEdit(edit.resource, edit.edit, edit.modelVersionId, edit.metadata);\r\n }\r\n if (isWorkspaceFileEdit(edit)) {\r\n return new ResourceFileEdit(edit.oldUri, edit.newUri, edit.options, edit.metadata);\r\n }\r\n throw new Error('Unsupported edit');\r\n });\r\n }\r\n}\r\nexport class ResourceTextEdit extends ResourceEdit {\r\n constructor(resource, textEdit, versionId, metadata) {\r\n super(metadata);\r\n this.resource = resource;\r\n this.textEdit = textEdit;\r\n this.versionId = versionId;\r\n }\r\n}\r\nexport class ResourceFileEdit extends ResourceEdit {\r\n constructor(oldResource, newResource, options, metadata) {\r\n super(metadata);\r\n this.oldResource = oldResource;\r\n this.newResource = newResource;\r\n this.options = options;\r\n }\r\n}\r\n", "/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License. See License.txt in the project root for license information.\r\n *--------------------------------------------------------------------------------------------*/\r\nimport * as platform from '../../registry/common/platform.js';\r\nimport { Emitter } from '../../../base/common/event.js';\r\nexport const Extensions = {\r\n JSONContribution: 'base.contributions.json'\r\n};\r\nfunction normalizeId(id) {\r\n if (id.length > 0 && id.charAt(id.length - 1) === '#') {\r\n return id.substring(0, id.length - 1);\r\n }\r\n return id;\r\n}\r\nclass JSONContributionRegistry {\r\n constructor() {\r\n this._onDidChangeSchema = new Emitter();\r\n this.schemasById = {};\r\n }\r\n registerSchema(uri, unresolvedSchemaContent) {\r\n this.schemasById[normalizeId(uri)] = unresolvedSchemaContent;\r\n this._onDidChangeSchema.fire(uri);\r\n }\r\n notifySchemaChanged(uri) {\r\n this._onDidChangeSchema.fire(uri);\r\n }\r\n}\r\nconst jsonContributionRegistry = new JSONContributionRegistry();\r\nplatform.Registry.add(Extensions.JSONContribution, jsonContributionRegistry);\r\n", "/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License. See License.txt in the project root for license information.\r\n *--------------------------------------------------------------------------------------------*/\r\nimport * as nls from '../../../nls.js';\r\nimport { Emitter } from '../../../base/common/event.js';\r\nimport { Registry } from '../../registry/common/platform.js';\r\nimport * as types from '../../../base/common/types.js';\r\nimport { Extensions as JSONExtensions } from '../../jsonschemas/common/jsonContributionRegistry.js';\r\nexport const Extensions = {\r\n Configuration: 'base.contributions.configuration'\r\n};\r\nexport const allSettings = { properties: {}, patternProperties: {} };\r\nexport const applicationSettings = { properties: {}, patternProperties: {} };\r\nexport const machineSettings = { properties: {}, patternProperties: {} };\r\nexport const machineOverridableSettings = { properties: {}, patternProperties: {} };\r\nexport const windowSettings = { properties: {}, patternProperties: {} };\r\nexport const resourceSettings = { properties: {}, patternProperties: {} };\r\nexport const resourceLanguageSettingsSchemaId = 'vscode://schemas/settings/resourceLanguage';\r\nconst contributionRegistry = Registry.as(JSONExtensions.JSONContribution);\r\nclass ConfigurationRegistry {\r\n constructor() {\r\n this.overrideIdentifiers = new Set();\r\n this._onDidSchemaChange = new Emitter();\r\n this._onDidUpdateConfiguration = new Emitter();\r\n this.defaultValues = {};\r\n this.defaultLanguageConfigurationOverridesNode = {\r\n id: 'defaultOverrides',\r\n title: nls.localize('defaultLanguageConfigurationOverrides.title', \"Default Language Configuration Overrides\"),\r\n properties: {}\r\n };\r\n this.configurationContributors = [this.defaultLanguageConfigurationOverridesNode];\r\n this.resourceLanguageSettingsSchema = { properties: {}, patternProperties: {}, additionalProperties: false, errorMessage: 'Unknown editor configuration setting', allowTrailingCommas: true, allowComments: true };\r\n this.configurationProperties = {};\r\n this.excludedConfigurationProperties = {};\r\n contributionRegistry.registerSchema(resourceLanguageSettingsSchemaId, this.resourceLanguageSettingsSchema);\r\n }\r\n registerConfiguration(configuration, validate = true) {\r\n this.registerConfigurations([configuration], validate);\r\n }\r\n registerConfigurations(configurations, validate = true) {\r\n const properties = [];\r\n configurations.forEach(configuration => {\r\n properties.push(...this.validateAndRegisterProperties(configuration, validate, configuration.extensionInfo)); // fills in defaults\r\n this.configurationContributors.push(configuration);\r\n this.registerJSONConfiguration(configuration);\r\n });\r\n contributionRegistry.registerSchema(resourceLanguageSettingsSchemaId, this.resourceLanguageSettingsSchema);\r\n this._onDidSchemaChange.fire();\r\n this._onDidUpdateConfiguration.fire(properties);\r\n }\r\n registerOverrideIdentifiers(overrideIdentifiers) {\r\n for (const overrideIdentifier of overrideIdentifiers) {\r\n this.overrideIdentifiers.add(overrideIdentifier);\r\n }\r\n this.updateOverridePropertyPatternKey();\r\n }\r\n validateAndRegisterProperties(configuration, validate = true, extensionInfo, scope = 3 /* WINDOW */) {\r\n var _a;\r\n scope = types.isUndefinedOrNull(configuration.scope) ? scope : configuration.scope;\r\n let propertyKeys = [];\r\n let properties = configuration.properties;\r\n if (properties) {\r\n for (let key in properties) {\r\n if (validate && validateProperty(key)) {\r\n delete properties[key];\r\n continue;\r\n }\r\n const property = properties[key];\r\n // update default value\r\n this.updatePropertyDefaultValue(key, property);\r\n // update scope\r\n if (OVERRIDE_PROPERTY_PATTERN.test(key)) {\r\n property.scope = undefined; // No scope for overridable properties `[${identifier}]`\r\n }\r\n else {\r\n property.scope = types.isUndefinedOrNull(property.scope) ? scope : property.scope;\r\n property.restricted = types.isUndefinedOrNull(property.restricted) ? !!((_a = extensionInfo === null || extensionInfo === void 0 ? void 0 : extensionInfo.restrictedConfigurations) === null || _a === void 0 ? void 0 : _a.includes(key)) : property.restricted;\r\n }\r\n // Add to properties maps\r\n // Property is included by default if 'included' is unspecified\r\n if (properties[key].hasOwnProperty('included') && !properties[key].included) {\r\n this.excludedConfigurationProperties[key] = properties[key];\r\n delete properties[key];\r\n continue;\r\n }\r\n else {\r\n this.configurationProperties[key] = properties[key];\r\n }\r\n if (!properties[key].deprecationMessage && properties[key].markdownDeprecationMessage) {\r\n // If not set, default deprecationMessage to the markdown source\r\n properties[key].deprecationMessage = properties[key].markdownDeprecationMessage;\r\n }\r\n propertyKeys.push(key);\r\n }\r\n }\r\n let subNodes = configuration.allOf;\r\n if (subNodes) {\r\n for (let node of subNodes) {\r\n propertyKeys.push(...this.validateAndRegisterProperties(node, validate, extensionInfo, scope));\r\n }\r\n }\r\n return propertyKeys;\r\n }\r\n getConfigurationProperties() {\r\n return this.configurationProperties;\r\n }\r\n registerJSONConfiguration(configuration) {\r\n const register = (configuration) => {\r\n let properties = configuration.properties;\r\n if (properties) {\r\n for (const key in properties) {\r\n this.updateSchema(key, properties[key]);\r\n }\r\n }\r\n let subNodes = configuration.allOf;\r\n if (subNodes) {\r\n subNodes.forEach(register);\r\n }\r\n };\r\n register(configuration);\r\n }\r\n updateSchema(key, property) {\r\n allSettings.properties[key] = property;\r\n switch (property.scope) {\r\n case 1 /* APPLICATION */:\r\n applicationSettings.properties[key] = property;\r\n break;\r\n case 2 /* MACHINE */:\r\n machineSettings.properties[key] = property;\r\n break;\r\n case 6 /* MACHINE_OVERRIDABLE */:\r\n machineOverridableSettings.properties[key] = property;\r\n break;\r\n case 3 /* WINDOW */:\r\n windowSettings.properties[key] = property;\r\n break;\r\n case 4 /* RESOURCE */:\r\n resourceSettings.properties[key] = property;\r\n break;\r\n case 5 /* LANGUAGE_OVERRIDABLE */:\r\n resourceSettings.properties[key] = property;\r\n this.resourceLanguageSettingsSchema.properties[key] = property;\r\n break;\r\n }\r\n }\r\n updateOverridePropertyPatternKey() {\r\n for (const overrideIdentifier of this.overrideIdentifiers.values()) {\r\n const overrideIdentifierProperty = `[${overrideIdentifier}]`;\r\n const resourceLanguagePropertiesSchema = {\r\n type: 'object',\r\n description: nls.localize('overrideSettings.defaultDescription', \"Configure editor settings to be overridden for a language.\"),\r\n errorMessage: nls.localize('overrideSettings.errorMessage', \"This setting does not support per-language configuration.\"),\r\n $ref: resourceLanguageSettingsSchemaId,\r\n };\r\n this.updatePropertyDefaultValue(overrideIdentifierProperty, resourceLanguagePropertiesSchema);\r\n allSettings.properties[overrideIdentifierProperty] = resourceLanguagePropertiesSchema;\r\n applicationSettings.properties[overrideIdentifierProperty] = resourceLanguagePropertiesSchema;\r\n machineSettings.properties[overrideIdentifierProperty] = resourceLanguagePropertiesSchema;\r\n machineOverridableSettings.properties[overrideIdentifierProperty] = resourceLanguagePropertiesSchema;\r\n windowSettings.properties[overrideIdentifierProperty] = resourceLanguagePropertiesSchema;\r\n resourceSettings.properties[overrideIdentifierProperty] = resourceLanguagePropertiesSchema;\r\n }\r\n this._onDidSchemaChange.fire();\r\n }\r\n updatePropertyDefaultValue(key, property) {\r\n let defaultValue = this.defaultValues[key];\r\n if (types.isUndefined(defaultValue)) {\r\n defaultValue = property.default;\r\n }\r\n if (types.isUndefined(defaultValue)) {\r\n defaultValue = getDefaultValue(property.type);\r\n }\r\n property.default = defaultValue;\r\n }\r\n}\r\nconst OVERRIDE_PROPERTY = '\\\\[.*\\\\]$';\r\nexport const OVERRIDE_PROPERTY_PATTERN = new RegExp(OVERRIDE_PROPERTY);\r\nexport function overrideIdentifierFromKey(key) {\r\n return key.substring(1, key.length - 1);\r\n}\r\nexport function getDefaultValue(type) {\r\n const t = Array.isArray(type) ? type[0] : type;\r\n switch (t) {\r\n case 'boolean':\r\n return false;\r\n case 'integer':\r\n case 'number':\r\n return 0;\r\n case 'string':\r\n return '';\r\n case 'array':\r\n return [];\r\n case 'object':\r\n return {};\r\n default:\r\n return null;\r\n }\r\n}\r\nconst configurationRegistry = new ConfigurationRegistry();\r\nRegistry.add(Extensions.Configuration, configurationRegistry);\r\nexport function validateProperty(property) {\r\n if (!property.trim()) {\r\n return nls.localize('config.property.empty', \"Cannot register an empty property\");\r\n }\r\n if (OVERRIDE_PROPERTY_PATTERN.test(property)) {\r\n return nls.localize('config.property.languageDefault', \"Cannot register '{0}'. This matches property pattern '\\\\\\\\[.*\\\\\\\\]$' for describing language specific editor settings. Use 'configurationDefaults' contribution.\", property);\r\n }\r\n if (configurationRegistry.getConfigurationProperties()[property] !== undefined) {\r\n return nls.localize('config.property.duplicate', \"Cannot register '{0}'. This property is already registered.\", property);\r\n }\r\n return null;\r\n}\r\n", "/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License. See License.txt in the project root for license information.\r\n *--------------------------------------------------------------------------------------------*/\r\nconst hasOwnProperty = Object.prototype.hasOwnProperty;\r\n/**\r\n * Iterates over each entry in the provided dictionary. The iterator allows\r\n * to remove elements and will stop when the callback returns {{false}}.\r\n */\r\nexport function forEach(from, callback) {\r\n for (let key in from) {\r\n if (hasOwnProperty.call(from, key)) {\r\n const result = callback({ key: key, value: from[key] }, function () {\r\n delete from[key];\r\n });\r\n if (result === false) {\r\n return;\r\n }\r\n }\r\n }\r\n}\r\nexport class SetMap {\r\n constructor() {\r\n this.map = new Map();\r\n }\r\n add(key, value) {\r\n let values = this.map.get(key);\r\n if (!values) {\r\n values = new Set();\r\n this.map.set(key, values);\r\n }\r\n values.add(value);\r\n }\r\n delete(key, value) {\r\n const values = this.map.get(key);\r\n if (!values) {\r\n return;\r\n }\r\n values.delete(value);\r\n if (values.size === 0) {\r\n this.map.delete(key);\r\n }\r\n }\r\n forEach(key, fn) {\r\n const values = this.map.get(key);\r\n if (!values) {\r\n return;\r\n }\r\n values.forEach(fn);\r\n }\r\n}\r\n", "/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License. See License.txt in the project root for license information.\r\n *--------------------------------------------------------------------------------------------*/\r\nimport * as nls from '../../../nls.js';\r\nimport { Emitter } from '../../../base/common/event.js';\r\nimport { Disposable } from '../../../base/common/lifecycle.js';\r\nimport * as objects from '../../../base/common/objects.js';\r\nimport * as arrays from '../../../base/common/arrays.js';\r\nimport { editorOptionsRegistry, ValidatedEditorOptions, ConfigurationChangedEvent, EDITOR_MODEL_DEFAULTS, ComputeOptionsMemory } from './editorOptions.js';\r\nimport { EditorZoom } from './editorZoom.js';\r\nimport { BareFontInfo } from './fontInfo.js';\r\nimport { Extensions } from '../../../platform/configuration/common/configurationRegistry.js';\r\nimport { Registry } from '../../../platform/registry/common/platform.js';\r\nimport { forEach } from '../../../base/common/collections.js';\r\nexport const TabFocus = new class {\r\n constructor() {\r\n this._tabFocus = false;\r\n this._onDidChangeTabFocus = new Emitter();\r\n this.onDidChangeTabFocus = this._onDidChangeTabFocus.event;\r\n }\r\n getTabFocusMode() {\r\n return this._tabFocus;\r\n }\r\n setTabFocusMode(tabFocusMode) {\r\n if (this._tabFocus === tabFocusMode) {\r\n return;\r\n }\r\n this._tabFocus = tabFocusMode;\r\n this._onDidChangeTabFocus.fire(this._tabFocus);\r\n }\r\n};\r\nconst hasOwnProperty = Object.hasOwnProperty;\r\nexport class ComputedEditorOptions {\r\n constructor() {\r\n this._values = [];\r\n }\r\n _read(id) {\r\n return this._values[id];\r\n }\r\n get(id) {\r\n return this._values[id];\r\n }\r\n _write(id, value) {\r\n this._values[id] = value;\r\n }\r\n}\r\nclass RawEditorOptions {\r\n constructor() {\r\n this._values = [];\r\n }\r\n _read(id) {\r\n return this._values[id];\r\n }\r\n _write(id, value) {\r\n this._values[id] = value;\r\n }\r\n}\r\nclass EditorConfiguration2 {\r\n static readOptions(_options) {\r\n const options = _options;\r\n const result = new RawEditorOptions();\r\n for (const editorOption of editorOptionsRegistry) {\r\n const value = (editorOption.name === '_never_' ? undefined : options[editorOption.name]);\r\n result._write(editorOption.id, value);\r\n }\r\n return result;\r\n }\r\n static validateOptions(options) {\r\n const result = new ValidatedEditorOptions();\r\n for (const editorOption of editorOptionsRegistry) {\r\n result._write(editorOption.id, editorOption.validate(options._read(editorOption.id)));\r\n }\r\n return result;\r\n }\r\n static computeOptions(options, env) {\r\n const result = new ComputedEditorOptions();\r\n for (const editorOption of editorOptionsRegistry) {\r\n result._write(editorOption.id, editorOption.compute(env, result, options._read(editorOption.id)));\r\n }\r\n return result;\r\n }\r\n static _deepEquals(a, b) {\r\n if (typeof a !== 'object' || typeof b !== 'object') {\r\n return (a === b);\r\n }\r\n if (Array.isArray(a) || Array.isArray(b)) {\r\n return (Array.isArray(a) && Array.isArray(b) ? arrays.equals(a, b) : false);\r\n }\r\n for (let key in a) {\r\n if (!EditorConfiguration2._deepEquals(a[key], b[key])) {\r\n return false;\r\n }\r\n }\r\n return true;\r\n }\r\n static checkEquals(a, b) {\r\n const result = [];\r\n let somethingChanged = false;\r\n for (const editorOption of editorOptionsRegistry) {\r\n const changed = !EditorConfiguration2._deepEquals(a._read(editorOption.id), b._read(editorOption.id));\r\n result[editorOption.id] = changed;\r\n if (changed) {\r\n somethingChanged = true;\r\n }\r\n }\r\n return (somethingChanged ? new ConfigurationChangedEvent(result) : null);\r\n }\r\n}\r\n/**\r\n * Compatibility with old options\r\n */\r\nfunction migrateOptions(options) {\r\n const wordWrap = options.wordWrap;\r\n if (wordWrap === true) {\r\n options.wordWrap = 'on';\r\n }\r\n else if (wordWrap === false) {\r\n options.wordWrap = 'off';\r\n }\r\n const lineNumbers = options.lineNumbers;\r\n if (lineNumbers === true) {\r\n options.lineNumbers = 'on';\r\n }\r\n else if (lineNumbers === false) {\r\n options.lineNumbers = 'off';\r\n }\r\n const autoClosingBrackets = options.autoClosingBrackets;\r\n if (autoClosingBrackets === false) {\r\n options.autoClosingBrackets = 'never';\r\n options.autoClosingQuotes = 'never';\r\n options.autoSurround = 'never';\r\n }\r\n const cursorBlinking = options.cursorBlinking;\r\n if (cursorBlinking === 'visible') {\r\n options.cursorBlinking = 'solid';\r\n }\r\n const renderWhitespace = options.renderWhitespace;\r\n if (renderWhitespace === true) {\r\n options.renderWhitespace = 'boundary';\r\n }\r\n else if (renderWhitespace === false) {\r\n options.renderWhitespace = 'none';\r\n }\r\n const renderLineHighlight = options.renderLineHighlight;\r\n if (renderLineHighlight === true) {\r\n options.renderLineHighlight = 'line';\r\n }\r\n else if (renderLineHighlight === false) {\r\n options.renderLineHighlight = 'none';\r\n }\r\n const acceptSuggestionOnEnter = options.acceptSuggestionOnEnter;\r\n if (acceptSuggestionOnEnter === true) {\r\n options.acceptSuggestionOnEnter = 'on';\r\n }\r\n else if (acceptSuggestionOnEnter === false) {\r\n options.acceptSuggestionOnEnter = 'off';\r\n }\r\n const tabCompletion = options.tabCompletion;\r\n if (tabCompletion === false) {\r\n options.tabCompletion = 'off';\r\n }\r\n else if (tabCompletion === true) {\r\n options.tabCompletion = 'onlySnippets';\r\n }\r\n const suggest = options.suggest;\r\n if (suggest && typeof suggest.filteredTypes === 'object' && suggest.filteredTypes) {\r\n const mapping = {};\r\n mapping['method'] = 'showMethods';\r\n mapping['function'] = 'showFunctions';\r\n mapping['constructor'] = 'showConstructors';\r\n mapping['deprecated'] = 'showDeprecated';\r\n mapping['field'] = 'showFields';\r\n mapping['variable'] = 'showVariables';\r\n mapping['class'] = 'showClasses';\r\n mapping['struct'] = 'showStructs';\r\n mapping['interface'] = 'showInterfaces';\r\n mapping['module'] = 'showModules';\r\n mapping['property'] = 'showProperties';\r\n mapping['event'] = 'showEvents';\r\n mapping['operator'] = 'showOperators';\r\n mapping['unit'] = 'showUnits';\r\n mapping['value'] = 'showValues';\r\n mapping['constant'] = 'showConstants';\r\n mapping['enum'] = 'showEnums';\r\n mapping['enumMember'] = 'showEnumMembers';\r\n mapping['keyword'] = 'showKeywords';\r\n mapping['text'] = 'showWords';\r\n mapping['color'] = 'showColors';\r\n mapping['file'] = 'showFiles';\r\n mapping['reference'] = 'showReferences';\r\n mapping['folder'] = 'showFolders';\r\n mapping['typeParameter'] = 'showTypeParameters';\r\n mapping['snippet'] = 'showSnippets';\r\n forEach(mapping, entry => {\r\n const value = suggest.filteredTypes[entry.key];\r\n if (value === false) {\r\n suggest[entry.value] = value;\r\n }\r\n });\r\n // delete (suggest).filteredTypes;\r\n }\r\n const hover = options.hover;\r\n if (hover === true) {\r\n options.hover = {\r\n enabled: true\r\n };\r\n }\r\n else if (hover === false) {\r\n options.hover = {\r\n enabled: false\r\n };\r\n }\r\n const parameterHints = options.parameterHints;\r\n if (parameterHints === true) {\r\n options.parameterHints = {\r\n enabled: true\r\n };\r\n }\r\n else if (parameterHints === false) {\r\n options.parameterHints = {\r\n enabled: false\r\n };\r\n }\r\n const autoIndent = options.autoIndent;\r\n if (autoIndent === true) {\r\n options.autoIndent = 'full';\r\n }\r\n else if (autoIndent === false) {\r\n options.autoIndent = 'advanced';\r\n }\r\n const matchBrackets = options.matchBrackets;\r\n if (matchBrackets === true) {\r\n options.matchBrackets = 'always';\r\n }\r\n else if (matchBrackets === false) {\r\n options.matchBrackets = 'never';\r\n }\r\n}\r\nfunction deepCloneAndMigrateOptions(_options) {\r\n const options = objects.deepClone(_options);\r\n migrateOptions(options);\r\n return options;\r\n}\r\nexport class CommonEditorConfiguration extends Disposable {\r\n constructor(isSimpleWidget, _options) {\r\n super();\r\n this._onDidChange = this._register(new Emitter());\r\n this.onDidChange = this._onDidChange.event;\r\n this._onDidChangeFast = this._register(new Emitter());\r\n this.onDidChangeFast = this._onDidChangeFast.event;\r\n this.isSimpleWidget = isSimpleWidget;\r\n this._isDominatedByLongLines = false;\r\n this._computeOptionsMemory = new ComputeOptionsMemory();\r\n this._viewLineCount = 1;\r\n this._lineNumbersDigitCount = 1;\r\n this._rawOptions = deepCloneAndMigrateOptions(_options);\r\n this._readOptions = EditorConfiguration2.readOptions(this._rawOptions);\r\n this._validatedOptions = EditorConfiguration2.validateOptions(this._readOptions);\r\n this._register(EditorZoom.onDidChangeZoomLevel(_ => this._recomputeOptions()));\r\n this._register(TabFocus.onDidChangeTabFocus(_ => this._recomputeOptions()));\r\n }\r\n observeReferenceElement(dimension) {\r\n }\r\n updatePixelRatio() {\r\n }\r\n _recomputeOptions() {\r\n const oldOptions = this.options;\r\n const newOptions = this._computeInternalOptions();\r\n if (!oldOptions) {\r\n this.options = newOptions;\r\n }\r\n else {\r\n const changeEvent = EditorConfiguration2.checkEquals(oldOptions, newOptions);\r\n if (changeEvent === null) {\r\n // nothing changed!\r\n return;\r\n }\r\n this.options = newOptions;\r\n this._onDidChangeFast.fire(changeEvent);\r\n this._onDidChange.fire(changeEvent);\r\n }\r\n }\r\n getRawOptions() {\r\n return this._rawOptions;\r\n }\r\n _computeInternalOptions() {\r\n const partialEnv = this._getEnvConfiguration();\r\n const bareFontInfo = BareFontInfo.createFromValidatedSettings(this._validatedOptions, partialEnv.zoomLevel, partialEnv.pixelRatio, this.isSimpleWidget);\r\n const env = {\r\n memory: this._computeOptionsMemory,\r\n outerWidth: partialEnv.outerWidth,\r\n outerHeight: partialEnv.outerHeight,\r\n fontInfo: this.readConfiguration(bareFontInfo),\r\n extraEditorClassName: partialEnv.extraEditorClassName,\r\n isDominatedByLongLines: this._isDominatedByLongLines,\r\n viewLineCount: this._viewLineCount,\r\n lineNumbersDigitCount: this._lineNumbersDigitCount,\r\n emptySelectionClipboard: partialEnv.emptySelectionClipboard,\r\n pixelRatio: partialEnv.pixelRatio,\r\n tabFocusMode: TabFocus.getTabFocusMode(),\r\n accessibilitySupport: partialEnv.accessibilitySupport\r\n };\r\n return EditorConfiguration2.computeOptions(this._validatedOptions, env);\r\n }\r\n static _subsetEquals(base, subset) {\r\n for (const key in subset) {\r\n if (hasOwnProperty.call(subset, key)) {\r\n const subsetValue = subset[key];\r\n const baseValue = base[key];\r\n if (baseValue === subsetValue) {\r\n continue;\r\n }\r\n if (Array.isArray(baseValue) && Array.isArray(subsetValue)) {\r\n if (!arrays.equals(baseValue, subsetValue)) {\r\n return false;\r\n }\r\n continue;\r\n }\r\n if (baseValue && typeof baseValue === 'object' && subsetValue && typeof subsetValue === 'object') {\r\n if (!this._subsetEquals(baseValue, subsetValue)) {\r\n return false;\r\n }\r\n continue;\r\n }\r\n return false;\r\n }\r\n }\r\n return true;\r\n }\r\n updateOptions(_newOptions) {\r\n if (typeof _newOptions === 'undefined') {\r\n return;\r\n }\r\n const newOptions = deepCloneAndMigrateOptions(_newOptions);\r\n if (CommonEditorConfiguration._subsetEquals(this._rawOptions, newOptions)) {\r\n return;\r\n }\r\n this._rawOptions = objects.mixin(this._rawOptions, newOptions || {});\r\n this._readOptions = EditorConfiguration2.readOptions(this._rawOptions);\r\n this._validatedOptions = EditorConfiguration2.validateOptions(this._readOptions);\r\n this._recomputeOptions();\r\n }\r\n setIsDominatedByLongLines(isDominatedByLongLines) {\r\n this._isDominatedByLongLines = isDominatedByLongLines;\r\n this._recomputeOptions();\r\n }\r\n setMaxLineNumber(maxLineNumber) {\r\n const lineNumbersDigitCount = CommonEditorConfiguration._digitCount(maxLineNumber);\r\n if (this._lineNumbersDigitCount === lineNumbersDigitCount) {\r\n return;\r\n }\r\n this._lineNumbersDigitCount = lineNumbersDigitCount;\r\n this._recomputeOptions();\r\n }\r\n setViewLineCount(viewLineCount) {\r\n if (this._viewLineCount === viewLineCount) {\r\n return;\r\n }\r\n this._viewLineCount = viewLineCount;\r\n this._recomputeOptions();\r\n }\r\n static _digitCount(n) {\r\n let r = 0;\r\n while (n) {\r\n n = Math.floor(n / 10);\r\n r++;\r\n }\r\n return r ? r : 1;\r\n }\r\n}\r\nexport const editorConfigurationBaseNode = Object.freeze({\r\n id: 'editor',\r\n order: 5,\r\n type: 'object',\r\n title: nls.localize('editorConfigurationTitle', \"Editor\"),\r\n scope: 5 /* LANGUAGE_OVERRIDABLE */,\r\n});\r\nconst configurationRegistry = Registry.as(Extensions.Configuration);\r\nconst editorConfiguration = Object.assign(Object.assign({}, editorConfigurationBaseNode), { properties: {\r\n 'editor.tabSize': {\r\n type: 'number',\r\n default: EDITOR_MODEL_DEFAULTS.tabSize,\r\n minimum: 1,\r\n markdownDescription: nls.localize('tabSize', \"The number of spaces a tab is equal to. This setting is overridden based on the file contents when `#editor.detectIndentation#` is on.\")\r\n },\r\n // 'editor.indentSize': {\r\n // \t'anyOf': [\r\n // \t\t{\r\n // \t\t\ttype: 'string',\r\n // \t\t\tenum: ['tabSize']\r\n // \t\t},\r\n // \t\t{\r\n // \t\t\ttype: 'number',\r\n // \t\t\tminimum: 1\r\n // \t\t}\r\n // \t],\r\n // \tdefault: 'tabSize',\r\n // \tmarkdownDescription: nls.localize('indentSize', \"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.\")\r\n // },\r\n 'editor.insertSpaces': {\r\n type: 'boolean',\r\n default: EDITOR_MODEL_DEFAULTS.insertSpaces,\r\n markdownDescription: nls.localize('insertSpaces', \"Insert spaces when pressing `Tab`. This setting is overridden based on the file contents when `#editor.detectIndentation#` is on.\")\r\n },\r\n 'editor.detectIndentation': {\r\n type: 'boolean',\r\n default: EDITOR_MODEL_DEFAULTS.detectIndentation,\r\n markdownDescription: nls.localize('detectIndentation', \"Controls whether `#editor.tabSize#` and `#editor.insertSpaces#` will be automatically detected when a file is opened based on the file contents.\")\r\n },\r\n 'editor.trimAutoWhitespace': {\r\n type: 'boolean',\r\n default: EDITOR_MODEL_DEFAULTS.trimAutoWhitespace,\r\n description: nls.localize('trimAutoWhitespace', \"Remove trailing auto inserted whitespace.\")\r\n },\r\n 'editor.largeFileOptimizations': {\r\n type: 'boolean',\r\n default: EDITOR_MODEL_DEFAULTS.largeFileOptimizations,\r\n description: nls.localize('largeFileOptimizations', \"Special handling for large files to disable certain memory intensive features.\")\r\n },\r\n 'editor.wordBasedSuggestions': {\r\n type: 'boolean',\r\n default: true,\r\n description: nls.localize('wordBasedSuggestions', \"Controls whether completions should be computed based on words in the document.\")\r\n },\r\n 'editor.wordBasedSuggestionsMode': {\r\n enum: ['currentDocument', 'matchingDocuments', 'allDocuments'],\r\n default: 'matchingDocuments',\r\n enumDescriptions: [\r\n nls.localize('wordBasedSuggestionsMode.currentDocument', 'Only suggest words from the active document.'),\r\n nls.localize('wordBasedSuggestionsMode.matchingDocuments', 'Suggest words from all open documents of the same language.'),\r\n nls.localize('wordBasedSuggestionsMode.allDocuments', 'Suggest words from all open documents.')\r\n ],\r\n description: nls.localize('wordBasedSuggestionsMode', \"Controls from which documents word based completions are computed.\")\r\n },\r\n 'editor.semanticHighlighting.enabled': {\r\n enum: [true, false, 'configuredByTheme'],\r\n enumDescriptions: [\r\n nls.localize('semanticHighlighting.true', 'Semantic highlighting enabled for all color themes.'),\r\n nls.localize('semanticHighlighting.false', 'Semantic highlighting disabled for all color themes.'),\r\n nls.localize('semanticHighlighting.configuredByTheme', 'Semantic highlighting is configured by the current color theme\\'s `semanticHighlighting` setting.')\r\n ],\r\n default: 'configuredByTheme',\r\n description: nls.localize('semanticHighlighting.enabled', \"Controls whether the semanticHighlighting is shown for the languages that support it.\")\r\n },\r\n 'editor.stablePeek': {\r\n type: 'boolean',\r\n default: false,\r\n markdownDescription: nls.localize('stablePeek', \"Keep peek editors open even when double clicking their content or when hitting `Escape`.\")\r\n },\r\n 'editor.maxTokenizationLineLength': {\r\n type: 'integer',\r\n default: 20000,\r\n description: nls.localize('maxTokenizationLineLength', \"Lines above this length will not be tokenized for performance reasons\")\r\n },\r\n 'diffEditor.maxComputationTime': {\r\n type: 'number',\r\n default: 5000,\r\n description: nls.localize('maxComputationTime', \"Timeout in milliseconds after which diff computation is cancelled. Use 0 for no timeout.\")\r\n },\r\n 'diffEditor.renderSideBySide': {\r\n type: 'boolean',\r\n default: true,\r\n description: nls.localize('sideBySide', \"Controls whether the diff editor shows the diff side by side or inline.\")\r\n },\r\n 'diffEditor.ignoreTrimWhitespace': {\r\n type: 'boolean',\r\n default: true,\r\n description: nls.localize('ignoreTrimWhitespace', \"When enabled, the diff editor ignores changes in leading or trailing whitespace.\")\r\n },\r\n 'diffEditor.renderIndicators': {\r\n type: 'boolean',\r\n default: true,\r\n description: nls.localize('renderIndicators', \"Controls whether the diff editor shows +/- indicators for added/removed changes.\")\r\n },\r\n 'diffEditor.codeLens': {\r\n type: 'boolean',\r\n default: false,\r\n description: nls.localize('codeLens', \"Controls whether the editor shows CodeLens.\")\r\n },\r\n 'diffEditor.wordWrap': {\r\n type: 'string',\r\n enum: ['off', 'on', 'inherit'],\r\n default: 'inherit',\r\n markdownEnumDescriptions: [\r\n nls.localize('wordWrap.off', \"Lines will never wrap.\"),\r\n nls.localize('wordWrap.on', \"Lines will wrap at the viewport width.\"),\r\n nls.localize('wordWrap.inherit', \"Lines will wrap according to the `#editor.wordWrap#` setting.\"),\r\n ]\r\n }\r\n } });\r\nfunction isConfigurationPropertySchema(x) {\r\n return (typeof x.type !== 'undefined' || typeof x.anyOf !== 'undefined');\r\n}\r\n// Add properties from the Editor Option Registry\r\nfor (const editorOption of editorOptionsRegistry) {\r\n const schema = editorOption.schema;\r\n if (typeof schema !== 'undefined') {\r\n if (isConfigurationPropertySchema(schema)) {\r\n // This is a single schema contribution\r\n editorConfiguration.properties[`editor.${editorOption.name}`] = schema;\r\n }\r\n else {\r\n for (let key in schema) {\r\n if (hasOwnProperty.call(schema, key)) {\r\n editorConfiguration.properties[key] = schema[key];\r\n }\r\n }\r\n }\r\n }\r\n}\r\nlet cachedEditorConfigurationKeys = null;\r\nfunction getEditorConfigurationKeys() {\r\n if (cachedEditorConfigurationKeys === null) {\r\n cachedEditorConfigurationKeys = Object.create(null);\r\n Object.keys(editorConfiguration.properties).forEach((prop) => {\r\n cachedEditorConfigurationKeys[prop] = true;\r\n });\r\n }\r\n return cachedEditorConfigurationKeys;\r\n}\r\nexport function isEditorConfigurationKey(key) {\r\n const editorConfigurationKeys = getEditorConfigurationKeys();\r\n return (editorConfigurationKeys[`editor.${key}`] || false);\r\n}\r\nexport function isDiffEditorConfigurationKey(key) {\r\n const editorConfigurationKeys = getEditorConfigurationKeys();\r\n return (editorConfigurationKeys[`diffEditor.${key}`] || false);\r\n}\r\nconfigurationRegistry.registerConfiguration(editorConfiguration);\r\n", "/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License. See License.txt in the project root for license information.\r\n *--------------------------------------------------------------------------------------------*/\r\nimport { Range } from './range.js';\r\nexport class EditOperation {\r\n static insert(position, text) {\r\n return {\r\n range: new Range(position.lineNumber, position.column, position.lineNumber, position.column),\r\n text: text,\r\n forceMoveMarkers: true\r\n };\r\n }\r\n static delete(range) {\r\n return {\r\n range: range,\r\n text: null\r\n };\r\n }\r\n static replace(range, text) {\r\n return {\r\n range: range,\r\n text: text\r\n };\r\n }\r\n static replaceMove(range, text) {\r\n return {\r\n range: range,\r\n text: text,\r\n forceMoveMarkers: true\r\n };\r\n }\r\n}\r\n", "import { Registry } from '../../registry/common/platform.js';\r\nimport { createDecorator } from '../../instantiation/common/instantiation.js';\r\nimport { Extensions } from './configurationRegistry.js';\r\nexport const IConfigurationService = createDecorator('configurationService');\r\nexport function toValuesTree(properties, conflictReporter) {\r\n const root = Object.create(null);\r\n for (let key in properties) {\r\n addToValueTree(root, key, properties[key], conflictReporter);\r\n }\r\n return root;\r\n}\r\nexport function addToValueTree(settingsTreeRoot, key, value, conflictReporter) {\r\n const segments = key.split('.');\r\n const last = segments.pop();\r\n let curr = settingsTreeRoot;\r\n for (let i = 0; i < segments.length; i++) {\r\n let s = segments[i];\r\n let obj = curr[s];\r\n switch (typeof obj) {\r\n case 'undefined':\r\n obj = curr[s] = Object.create(null);\r\n break;\r\n case 'object':\r\n break;\r\n default:\r\n conflictReporter(`Ignoring ${key} as ${segments.slice(0, i + 1).join('.')} is ${JSON.stringify(obj)}`);\r\n return;\r\n }\r\n curr = obj;\r\n }\r\n if (typeof curr === 'object' && curr !== null) {\r\n try {\r\n curr[last] = value; // workaround https://github.com/microsoft/vscode/issues/13606\r\n }\r\n catch (e) {\r\n conflictReporter(`Ignoring ${key} as ${segments.join('.')} is ${JSON.stringify(curr)}`);\r\n }\r\n }\r\n else {\r\n conflictReporter(`Ignoring ${key} as ${segments.join('.')} is ${JSON.stringify(curr)}`);\r\n }\r\n}\r\nexport function removeFromValueTree(valueTree, key) {\r\n const segments = key.split('.');\r\n doRemoveFromValueTree(valueTree, segments);\r\n}\r\nfunction doRemoveFromValueTree(valueTree, segments) {\r\n const first = segments.shift();\r\n if (segments.length === 0) {\r\n // Reached last segment\r\n delete valueTree[first];\r\n return;\r\n }\r\n if (Object.keys(valueTree).indexOf(first) !== -1) {\r\n const value = valueTree[first];\r\n if (typeof value === 'object' && !Array.isArray(value)) {\r\n doRemoveFromValueTree(value, segments);\r\n if (Object.keys(value).length === 0) {\r\n delete valueTree[first];\r\n }\r\n }\r\n }\r\n}\r\n/**\r\n * A helper function to get the configuration value with a specific settings path (e.g. config.some.setting)\r\n */\r\nexport function getConfigurationValue(config, settingPath, defaultValue) {\r\n function accessSetting(config, path) {\r\n let current = config;\r\n for (const component of path) {\r\n if (typeof current !== 'object' || current === null) {\r\n return undefined;\r\n }\r\n current = current[component];\r\n }\r\n return current;\r\n }\r\n const path = settingPath.split('.');\r\n const result = accessSetting(config, path);\r\n return typeof result === 'undefined' ? defaultValue : result;\r\n}\r\nexport function getConfigurationKeys() {\r\n const properties = Registry.as(Extensions.Configuration).getConfigurationProperties();\r\n return Object.keys(properties);\r\n}\r\nexport function getDefaultValues() {\r\n const valueTreeRoot = Object.create(null);\r\n const properties = Registry.as(Extensions.Configuration).getConfigurationProperties();\r\n for (let key in properties) {\r\n let value = properties[key].default;\r\n addToValueTree(valueTreeRoot, key, value, message => console.error(`Conflict in default settings: ${message}`));\r\n }\r\n return valueTreeRoot;\r\n}\r\n", "import { ResourceMap } from '../../../base/common/map.js';\r\nimport * as arrays from '../../../base/common/arrays.js';\r\nimport * as types from '../../../base/common/types.js';\r\nimport * as objects from '../../../base/common/objects.js';\r\nimport { URI } from '../../../base/common/uri.js';\r\nimport { OVERRIDE_PROPERTY_PATTERN, overrideIdentifierFromKey } from './configurationRegistry.js';\r\nimport { addToValueTree, toValuesTree, getConfigurationValue, getDefaultValues, getConfigurationKeys, removeFromValueTree } from './configuration.js';\r\nexport class ConfigurationModel {\r\n constructor(_contents = {}, _keys = [], _overrides = []) {\r\n this._contents = _contents;\r\n this._keys = _keys;\r\n this._overrides = _overrides;\r\n this.isFrozen = false;\r\n }\r\n get contents() {\r\n return this.checkAndFreeze(this._contents);\r\n }\r\n get overrides() {\r\n return this.checkAndFreeze(this._overrides);\r\n }\r\n get keys() {\r\n return this.checkAndFreeze(this._keys);\r\n }\r\n isEmpty() {\r\n return this._keys.length === 0 && Object.keys(this._contents).length === 0 && this._overrides.length === 0;\r\n }\r\n getValue(section) {\r\n return section ? getConfigurationValue(this.contents, section) : this.contents;\r\n }\r\n override(identifier) {\r\n const overrideContents = this.getContentsForOverrideIdentifer(identifier);\r\n if (!overrideContents || typeof overrideContents !== 'object' || !Object.keys(overrideContents).length) {\r\n // If there are no valid overrides, return self\r\n return this;\r\n }\r\n let contents = {};\r\n for (const key of arrays.distinct([...Object.keys(this.contents), ...Object.keys(overrideContents)])) {\r\n let contentsForKey = this.contents[key];\r\n let overrideContentsForKey = overrideContents[key];\r\n // If there are override contents for the key, clone and merge otherwise use base contents\r\n if (overrideContentsForKey) {\r\n // Clone and merge only if base contents and override contents are of type object otherwise just override\r\n if (typeof contentsForKey === 'object' && typeof overrideContentsForKey === 'object') {\r\n contentsForKey = objects.deepClone(contentsForKey);\r\n this.mergeContents(contentsForKey, overrideContentsForKey);\r\n }\r\n else {\r\n contentsForKey = overrideContentsForKey;\r\n }\r\n }\r\n contents[key] = contentsForKey;\r\n }\r\n return new ConfigurationModel(contents, this.keys, this.overrides);\r\n }\r\n merge(...others) {\r\n const contents = objects.deepClone(this.contents);\r\n const overrides = objects.deepClone(this.overrides);\r\n const keys = [...this.keys];\r\n for (const other of others) {\r\n this.mergeContents(contents, other.contents);\r\n for (const otherOverride of other.overrides) {\r\n const [override] = overrides.filter(o => arrays.equals(o.identifiers, otherOverride.identifiers));\r\n if (override) {\r\n this.mergeContents(override.contents, otherOverride.contents);\r\n }\r\n else {\r\n overrides.push(objects.deepClone(otherOverride));\r\n }\r\n }\r\n for (const key of other.keys) {\r\n if (keys.indexOf(key) === -1) {\r\n keys.push(key);\r\n }\r\n }\r\n }\r\n return new ConfigurationModel(contents, keys, overrides);\r\n }\r\n freeze() {\r\n this.isFrozen = true;\r\n return this;\r\n }\r\n mergeContents(source, target) {\r\n for (const key of Object.keys(target)) {\r\n if (key in source) {\r\n if (types.isObject(source[key]) && types.isObject(target[key])) {\r\n this.mergeContents(source[key], target[key]);\r\n continue;\r\n }\r\n }\r\n source[key] = objects.deepClone(target[key]);\r\n }\r\n }\r\n checkAndFreeze(data) {\r\n if (this.isFrozen && !Object.isFrozen(data)) {\r\n return objects.deepFreeze(data);\r\n }\r\n return data;\r\n }\r\n getContentsForOverrideIdentifer(identifier) {\r\n for (const override of this.overrides) {\r\n if (override.identifiers.indexOf(identifier) !== -1) {\r\n return override.contents;\r\n }\r\n }\r\n return null;\r\n }\r\n toJSON() {\r\n return {\r\n contents: this.contents,\r\n overrides: this.overrides,\r\n keys: this.keys\r\n };\r\n }\r\n // Update methods\r\n setValue(key, value) {\r\n this.addKey(key);\r\n addToValueTree(this.contents, key, value, e => { throw new Error(e); });\r\n }\r\n removeValue(key) {\r\n if (this.removeKey(key)) {\r\n removeFromValueTree(this.contents, key);\r\n }\r\n }\r\n addKey(key) {\r\n let index = this.keys.length;\r\n for (let i = 0; i < index; i++) {\r\n if (key.indexOf(this.keys[i]) === 0) {\r\n index = i;\r\n }\r\n }\r\n this.keys.splice(index, 1, key);\r\n }\r\n removeKey(key) {\r\n let index = this.keys.indexOf(key);\r\n if (index !== -1) {\r\n this.keys.splice(index, 1);\r\n return true;\r\n }\r\n return false;\r\n }\r\n}\r\nexport class DefaultConfigurationModel extends ConfigurationModel {\r\n constructor() {\r\n const contents = getDefaultValues();\r\n const keys = getConfigurationKeys();\r\n const overrides = [];\r\n for (const key of Object.keys(contents)) {\r\n if (OVERRIDE_PROPERTY_PATTERN.test(key)) {\r\n overrides.push({\r\n identifiers: [overrideIdentifierFromKey(key).trim()],\r\n keys: Object.keys(contents[key]),\r\n contents: toValuesTree(contents[key], message => console.error(`Conflict in default settings file: ${message}`)),\r\n });\r\n }\r\n }\r\n super(contents, keys, overrides);\r\n }\r\n}\r\nexport class Configuration {\r\n constructor(_defaultConfiguration, _localUserConfiguration, _remoteUserConfiguration = new ConfigurationModel(), _workspaceConfiguration = new ConfigurationModel(), _folderConfigurations = new ResourceMap(), _memoryConfiguration = new ConfigurationModel(), _memoryConfigurationByResource = new ResourceMap(), _freeze = true) {\r\n this._defaultConfiguration = _defaultConfiguration;\r\n this._localUserConfiguration = _localUserConfiguration;\r\n this._remoteUserConfiguration = _remoteUserConfiguration;\r\n this._workspaceConfiguration = _workspaceConfiguration;\r\n this._folderConfigurations = _folderConfigurations;\r\n this._memoryConfiguration = _memoryConfiguration;\r\n this._memoryConfigurationByResource = _memoryConfigurationByResource;\r\n this._freeze = _freeze;\r\n this._workspaceConsolidatedConfiguration = null;\r\n this._foldersConsolidatedConfigurations = new ResourceMap();\r\n this._userConfiguration = null;\r\n }\r\n getValue(section, overrides, workspace) {\r\n const consolidateConfigurationModel = this.getConsolidateConfigurationModel(overrides, workspace);\r\n return consolidateConfigurationModel.getValue(section);\r\n }\r\n updateValue(key, value, overrides = {}) {\r\n let memoryConfiguration;\r\n if (overrides.resource) {\r\n memoryConfiguration = this._memoryConfigurationByResource.get(overrides.resource);\r\n if (!memoryConfiguration) {\r\n memoryConfiguration = new ConfigurationModel();\r\n this._memoryConfigurationByResource.set(overrides.resource, memoryConfiguration);\r\n }\r\n }\r\n else {\r\n memoryConfiguration = this._memoryConfiguration;\r\n }\r\n if (value === undefined) {\r\n memoryConfiguration.removeValue(key);\r\n }\r\n else {\r\n memoryConfiguration.setValue(key, value);\r\n }\r\n if (!overrides.resource) {\r\n this._workspaceConsolidatedConfiguration = null;\r\n }\r\n }\r\n get userConfiguration() {\r\n if (!this._userConfiguration) {\r\n this._userConfiguration = this._remoteUserConfiguration.isEmpty() ? this._localUserConfiguration : this._localUserConfiguration.merge(this._remoteUserConfiguration);\r\n if (this._freeze) {\r\n this._userConfiguration.freeze();\r\n }\r\n }\r\n return this._userConfiguration;\r\n }\r\n getConsolidateConfigurationModel(overrides, workspace) {\r\n let configurationModel = this.getConsolidatedConfigurationModelForResource(overrides, workspace);\r\n return overrides.overrideIdentifier ? configurationModel.override(overrides.overrideIdentifier) : configurationModel;\r\n }\r\n getConsolidatedConfigurationModelForResource({ resource }, workspace) {\r\n let consolidateConfiguration = this.getWorkspaceConsolidatedConfiguration();\r\n if (workspace && resource) {\r\n const root = workspace.getFolder(resource);\r\n if (root) {\r\n consolidateConfiguration = this.getFolderConsolidatedConfiguration(root.uri) || consolidateConfiguration;\r\n }\r\n const memoryConfigurationForResource = this._memoryConfigurationByResource.get(resource);\r\n if (memoryConfigurationForResource) {\r\n consolidateConfiguration = consolidateConfiguration.merge(memoryConfigurationForResource);\r\n }\r\n }\r\n return consolidateConfiguration;\r\n }\r\n getWorkspaceConsolidatedConfiguration() {\r\n if (!this._workspaceConsolidatedConfiguration) {\r\n this._workspaceConsolidatedConfiguration = this._defaultConfiguration.merge(this.userConfiguration, this._workspaceConfiguration, this._memoryConfiguration);\r\n if (this._freeze) {\r\n this._workspaceConfiguration = this._workspaceConfiguration.freeze();\r\n }\r\n }\r\n return this._workspaceConsolidatedConfiguration;\r\n }\r\n getFolderConsolidatedConfiguration(folder) {\r\n let folderConsolidatedConfiguration = this._foldersConsolidatedConfigurations.get(folder);\r\n if (!folderConsolidatedConfiguration) {\r\n const workspaceConsolidateConfiguration = this.getWorkspaceConsolidatedConfiguration();\r\n const folderConfiguration = this._folderConfigurations.get(folder);\r\n if (folderConfiguration) {\r\n folderConsolidatedConfiguration = workspaceConsolidateConfiguration.merge(folderConfiguration);\r\n if (this._freeze) {\r\n folderConsolidatedConfiguration = folderConsolidatedConfiguration.freeze();\r\n }\r\n this._foldersConsolidatedConfigurations.set(folder, folderConsolidatedConfiguration);\r\n }\r\n else {\r\n folderConsolidatedConfiguration = workspaceConsolidateConfiguration;\r\n }\r\n }\r\n return folderConsolidatedConfiguration;\r\n }\r\n toData() {\r\n return {\r\n defaults: {\r\n contents: this._defaultConfiguration.contents,\r\n overrides: this._defaultConfiguration.overrides,\r\n keys: this._defaultConfiguration.keys\r\n },\r\n user: {\r\n contents: this.userConfiguration.contents,\r\n overrides: this.userConfiguration.overrides,\r\n keys: this.userConfiguration.keys\r\n },\r\n workspace: {\r\n contents: this._workspaceConfiguration.contents,\r\n overrides: this._workspaceConfiguration.overrides,\r\n keys: this._workspaceConfiguration.keys\r\n },\r\n folders: [...this._folderConfigurations.keys()].reduce((result, folder) => {\r\n const { contents, overrides, keys } = this._folderConfigurations.get(folder);\r\n result.push([folder, { contents, overrides, keys }]);\r\n return result;\r\n }, [])\r\n };\r\n }\r\n static parse(data) {\r\n const defaultConfiguration = this.parseConfigurationModel(data.defaults);\r\n const userConfiguration = this.parseConfigurationModel(data.user);\r\n const workspaceConfiguration = this.parseConfigurationModel(data.workspace);\r\n const folders = data.folders.reduce((result, value) => {\r\n result.set(URI.revive(value[0]), this.parseConfigurationModel(value[1]));\r\n return result;\r\n }, new ResourceMap());\r\n return new Configuration(defaultConfiguration, userConfiguration, new ConfigurationModel(), workspaceConfiguration, folders, new ConfigurationModel(), new ResourceMap(), false);\r\n }\r\n static parseConfigurationModel(model) {\r\n return new ConfigurationModel(model.contents, model.keys, model.overrides).freeze();\r\n }\r\n}\r\nexport class ConfigurationChangeEvent {\r\n constructor(change, previous, currentConfiguraiton, currentWorkspace) {\r\n this.change = change;\r\n this.previous = previous;\r\n this.currentConfiguraiton = currentConfiguraiton;\r\n this.currentWorkspace = currentWorkspace;\r\n this._previousConfiguration = undefined;\r\n const keysSet = new Set();\r\n change.keys.forEach(key => keysSet.add(key));\r\n change.overrides.forEach(([, keys]) => keys.forEach(key => keysSet.add(key)));\r\n this.affectedKeys = [...keysSet.values()];\r\n const configurationModel = new ConfigurationModel();\r\n this.affectedKeys.forEach(key => configurationModel.setValue(key, {}));\r\n this.affectedKeysTree = configurationModel.contents;\r\n }\r\n get previousConfiguration() {\r\n if (!this._previousConfiguration && this.previous) {\r\n this._previousConfiguration = Configuration.parse(this.previous.data);\r\n }\r\n return this._previousConfiguration;\r\n }\r\n affectsConfiguration(section, overrides) {\r\n var _a;\r\n if (this.doesAffectedKeysTreeContains(this.affectedKeysTree, section)) {\r\n if (overrides) {\r\n const value1 = this.previousConfiguration ? this.previousConfiguration.getValue(section, overrides, (_a = this.previous) === null || _a === void 0 ? void 0 : _a.workspace) : undefined;\r\n const value2 = this.currentConfiguraiton.getValue(section, overrides, this.currentWorkspace);\r\n return !objects.equals(value1, value2);\r\n }\r\n return true;\r\n }\r\n return false;\r\n }\r\n doesAffectedKeysTreeContains(affectedKeysTree, section) {\r\n let requestedTree = toValuesTree({ [section]: true }, () => { });\r\n let key;\r\n while (typeof requestedTree === 'object' && (key = Object.keys(requestedTree)[0])) { // Only one key should present, since we added only one property\r\n affectedKeysTree = affectedKeysTree[key];\r\n if (!affectedKeysTree) {\r\n return false; // Requested tree is not found\r\n }\r\n requestedTree = requestedTree[key];\r\n }\r\n return true;\r\n }\r\n}\r\n", "/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License. See License.txt in the project root for license information.\r\n *--------------------------------------------------------------------------------------------*/\r\nimport * as nls from '../../../nls.js';\r\nimport { IntervalTimer, TimeoutTimer } from '../../../base/common/async.js';\r\nimport { Emitter, Event } from '../../../base/common/event.js';\r\nimport { Disposable } from '../../../base/common/lifecycle.js';\r\nexport class AbstractKeybindingService extends Disposable {\r\n constructor(_contextKeyService, _commandService, _telemetryService, _notificationService, _logService) {\r\n super();\r\n this._contextKeyService = _contextKeyService;\r\n this._commandService = _commandService;\r\n this._telemetryService = _telemetryService;\r\n this._notificationService = _notificationService;\r\n this._logService = _logService;\r\n this._onDidUpdateKeybindings = this._register(new Emitter());\r\n this._currentChord = null;\r\n this._currentChordChecker = new IntervalTimer();\r\n this._currentChordStatusMessage = null;\r\n this._currentSingleModifier = null;\r\n this._currentSingleModifierClearTimeout = new TimeoutTimer();\r\n this._logging = false;\r\n }\r\n get onDidUpdateKeybindings() {\r\n return this._onDidUpdateKeybindings ? this._onDidUpdateKeybindings.event : Event.None; // Sinon stubbing walks properties on prototype\r\n }\r\n dispose() {\r\n super.dispose();\r\n }\r\n _log(str) {\r\n if (this._logging) {\r\n this._logService.info(`[KeybindingService]: ${str}`);\r\n }\r\n }\r\n getKeybindings() {\r\n return this._getResolver().getKeybindings();\r\n }\r\n lookupKeybinding(commandId, context) {\r\n const result = this._getResolver().lookupPrimaryKeybinding(commandId, context || this._contextKeyService);\r\n if (!result) {\r\n return undefined;\r\n }\r\n return result.resolvedKeybinding;\r\n }\r\n dispatchEvent(e, target) {\r\n return this._dispatch(e, target);\r\n }\r\n softDispatch(e, target) {\r\n const keybinding = this.resolveKeyboardEvent(e);\r\n if (keybinding.isChord()) {\r\n console.warn('Unexpected keyboard event mapped to a chord');\r\n return null;\r\n }\r\n const [firstPart,] = keybinding.getDispatchParts();\r\n if (firstPart === null) {\r\n // cannot be dispatched, probably only modifier keys\r\n return null;\r\n }\r\n const contextValue = this._contextKeyService.getContext(target);\r\n const currentChord = this._currentChord ? this._currentChord.keypress : null;\r\n return this._getResolver().resolve(contextValue, currentChord, firstPart);\r\n }\r\n _enterChordMode(firstPart, keypressLabel) {\r\n this._currentChord = {\r\n keypress: firstPart,\r\n label: keypressLabel\r\n };\r\n this._currentChordStatusMessage = this._notificationService.status(nls.localize('first.chord', \"({0}) was pressed. Waiting for second key of chord...\", keypressLabel));\r\n const chordEnterTime = Date.now();\r\n this._currentChordChecker.cancelAndSet(() => {\r\n if (!this._documentHasFocus()) {\r\n // Focus has been lost => leave chord mode\r\n this._leaveChordMode();\r\n return;\r\n }\r\n if (Date.now() - chordEnterTime > 5000) {\r\n // 5 seconds elapsed => leave chord mode\r\n this._leaveChordMode();\r\n }\r\n }, 500);\r\n }\r\n _leaveChordMode() {\r\n if (this._currentChordStatusMessage) {\r\n this._currentChordStatusMessage.dispose();\r\n this._currentChordStatusMessage = null;\r\n }\r\n this._currentChordChecker.cancel();\r\n this._currentChord = null;\r\n }\r\n _dispatch(e, target) {\r\n return this._doDispatch(this.resolveKeyboardEvent(e), target, /*isSingleModiferChord*/ false);\r\n }\r\n _singleModifierDispatch(e, target) {\r\n const keybinding = this.resolveKeyboardEvent(e);\r\n const [singleModifier,] = keybinding.getSingleModifierDispatchParts();\r\n if (singleModifier !== null && this._currentSingleModifier === null) {\r\n // we have a valid `singleModifier`, store it for the next keyup, but clear it in 300ms\r\n this._log(`+ Storing single modifier for possible chord ${singleModifier}.`);\r\n this._currentSingleModifier = singleModifier;\r\n this._currentSingleModifierClearTimeout.cancelAndSet(() => {\r\n this._log(`+ Clearing single modifier due to 300ms elapsed.`);\r\n this._currentSingleModifier = null;\r\n }, 300);\r\n return false;\r\n }\r\n if (singleModifier !== null && singleModifier === this._currentSingleModifier) {\r\n // bingo!\r\n this._log(`/ Dispatching single modifier chord ${singleModifier} ${singleModifier}`);\r\n this._currentSingleModifierClearTimeout.cancel();\r\n this._currentSingleModifier = null;\r\n return this._doDispatch(keybinding, target, /*isSingleModiferChord*/ true);\r\n }\r\n this._currentSingleModifierClearTimeout.cancel();\r\n this._currentSingleModifier = null;\r\n return false;\r\n }\r\n _doDispatch(keybinding, target, isSingleModiferChord = false) {\r\n let shouldPreventDefault = false;\r\n if (keybinding.isChord()) {\r\n console.warn('Unexpected keyboard event mapped to a chord');\r\n return false;\r\n }\r\n let firstPart = null; // the first keybinding i.e. Ctrl+K\r\n let currentChord = null; // the \"second\" keybinding i.e. Ctrl+K \"Ctrl+D\"\r\n if (isSingleModiferChord) {\r\n const [dispatchKeyname,] = keybinding.getSingleModifierDispatchParts();\r\n firstPart = dispatchKeyname;\r\n currentChord = dispatchKeyname;\r\n }\r\n else {\r\n [firstPart,] = keybinding.getDispatchParts();\r\n currentChord = this._currentChord ? this._currentChord.keypress : null;\r\n }\r\n if (firstPart === null) {\r\n this._log(`\\\\ Keyboard event cannot be dispatched in keydown phase.`);\r\n // cannot be dispatched, probably only modifier keys\r\n return shouldPreventDefault;\r\n }\r\n const contextValue = this._contextKeyService.getContext(target);\r\n const keypressLabel = keybinding.getLabel();\r\n const resolveResult = this._getResolver().resolve(contextValue, currentChord, firstPart);\r\n this._logService.trace('KeybindingService#dispatch', keypressLabel, resolveResult === null || resolveResult === void 0 ? void 0 : resolveResult.commandId);\r\n if (resolveResult && resolveResult.enterChord) {\r\n shouldPreventDefault = true;\r\n this._enterChordMode(firstPart, keypressLabel);\r\n return shouldPreventDefault;\r\n }\r\n if (this._currentChord) {\r\n if (!resolveResult || !resolveResult.commandId) {\r\n this._notificationService.status(nls.localize('missing.chord', \"The key combination ({0}, {1}) is not a command.\", this._currentChord.label, keypressLabel), { hideAfter: 10 * 1000 /* 10s */ });\r\n shouldPreventDefault = true;\r\n }\r\n }\r\n this._leaveChordMode();\r\n if (resolveResult && resolveResult.commandId) {\r\n if (!resolveResult.bubble) {\r\n shouldPreventDefault = true;\r\n }\r\n if (typeof resolveResult.commandArgs === 'undefined') {\r\n this._commandService.executeCommand(resolveResult.commandId).then(undefined, err => this._notificationService.warn(err));\r\n }\r\n else {\r\n this._commandService.executeCommand(resolveResult.commandId, resolveResult.commandArgs).then(undefined, err => this._notificationService.warn(err));\r\n }\r\n this._telemetryService.publicLog2('workbenchActionExecuted', { id: resolveResult.commandId, from: 'keybinding' });\r\n }\r\n return shouldPreventDefault;\r\n }\r\n mightProducePrintableCharacter(event) {\r\n if (event.ctrlKey || event.metaKey) {\r\n // ignore ctrl/cmd-combination but not shift/alt-combinatios\r\n return false;\r\n }\r\n // weak check for certain ranges. this is properly implemented in a subclass\r\n // with access to the KeyboardMapperFactory.\r\n if ((event.keyCode >= 31 /* KEY_A */ && event.keyCode <= 56 /* KEY_Z */)\r\n || (event.keyCode >= 21 /* KEY_0 */ && event.keyCode <= 30 /* KEY_9 */)) {\r\n return true;\r\n }\r\n return false;\r\n }\r\n}\r\n", "/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License. See License.txt in the project root for license information.\r\n *--------------------------------------------------------------------------------------------*/\r\nexport class KeybindingResolver {\r\n constructor(defaultKeybindings, overrides, log) {\r\n this._log = log;\r\n this._defaultKeybindings = defaultKeybindings;\r\n this._defaultBoundCommands = new Map();\r\n for (let i = 0, len = defaultKeybindings.length; i < len; i++) {\r\n const command = defaultKeybindings[i].command;\r\n if (command) {\r\n this._defaultBoundCommands.set(command, true);\r\n }\r\n }\r\n this._map = new Map();\r\n this._lookupMap = new Map();\r\n this._keybindings = KeybindingResolver.combine(defaultKeybindings, overrides);\r\n for (let i = 0, len = this._keybindings.length; i < len; i++) {\r\n let k = this._keybindings[i];\r\n if (k.keypressParts.length === 0) {\r\n // unbound\r\n continue;\r\n }\r\n if (k.when && k.when.type === 0 /* False */) {\r\n // when condition is false\r\n continue;\r\n }\r\n // TODO@chords\r\n this._addKeyPress(k.keypressParts[0], k);\r\n }\r\n }\r\n static _isTargetedForRemoval(defaultKb, keypressFirstPart, keypressChordPart, command, when) {\r\n if (defaultKb.command !== command) {\r\n return false;\r\n }\r\n // TODO@chords\r\n if (keypressFirstPart && defaultKb.keypressParts[0] !== keypressFirstPart) {\r\n return false;\r\n }\r\n // TODO@chords\r\n if (keypressChordPart && defaultKb.keypressParts[1] !== keypressChordPart) {\r\n return false;\r\n }\r\n if (when) {\r\n if (!defaultKb.when) {\r\n return false;\r\n }\r\n if (!when.equals(defaultKb.when)) {\r\n return false;\r\n }\r\n }\r\n return true;\r\n }\r\n /**\r\n * Looks for rules containing -command in `overrides` and removes them directly from `defaults`.\r\n */\r\n static combine(defaults, rawOverrides) {\r\n defaults = defaults.slice(0);\r\n let overrides = [];\r\n for (const override of rawOverrides) {\r\n if (!override.command || override.command.length === 0 || override.command.charAt(0) !== '-') {\r\n overrides.push(override);\r\n continue;\r\n }\r\n const command = override.command.substr(1);\r\n // TODO@chords\r\n const keypressFirstPart = override.keypressParts[0];\r\n const keypressChordPart = override.keypressParts[1];\r\n const when = override.when;\r\n for (let j = defaults.length - 1; j >= 0; j--) {\r\n if (this._isTargetedForRemoval(defaults[j], keypressFirstPart, keypressChordPart, command, when)) {\r\n defaults.splice(j, 1);\r\n }\r\n }\r\n }\r\n return defaults.concat(overrides);\r\n }\r\n _addKeyPress(keypress, item) {\r\n const conflicts = this._map.get(keypress);\r\n if (typeof conflicts === 'undefined') {\r\n // There is no conflict so far\r\n this._map.set(keypress, [item]);\r\n this._addToLookupMap(item);\r\n return;\r\n }\r\n for (let i = conflicts.length - 1; i >= 0; i--) {\r\n let conflict = conflicts[i];\r\n if (conflict.command === item.command) {\r\n continue;\r\n }\r\n const conflictIsChord = (conflict.keypressParts.length > 1);\r\n const itemIsChord = (item.keypressParts.length > 1);\r\n // TODO@chords\r\n if (conflictIsChord && itemIsChord && conflict.keypressParts[1] !== item.keypressParts[1]) {\r\n // The conflict only shares the chord start with this command\r\n continue;\r\n }\r\n if (KeybindingResolver.whenIsEntirelyIncluded(conflict.when, item.when)) {\r\n // `item` completely overwrites `conflict`\r\n // Remove conflict from the lookupMap\r\n this._removeFromLookupMap(conflict);\r\n }\r\n }\r\n conflicts.push(item);\r\n this._addToLookupMap(item);\r\n }\r\n _addToLookupMap(item) {\r\n if (!item.command) {\r\n return;\r\n }\r\n let arr = this._lookupMap.get(item.command);\r\n if (typeof arr === 'undefined') {\r\n arr = [item];\r\n this._lookupMap.set(item.command, arr);\r\n }\r\n else {\r\n arr.push(item);\r\n }\r\n }\r\n _removeFromLookupMap(item) {\r\n if (!item.command) {\r\n return;\r\n }\r\n let arr = this._lookupMap.get(item.command);\r\n if (typeof arr === 'undefined') {\r\n return;\r\n }\r\n for (let i = 0, len = arr.length; i < len; i++) {\r\n if (arr[i] === item) {\r\n arr.splice(i, 1);\r\n return;\r\n }\r\n }\r\n }\r\n /**\r\n * Returns true if it is provable `a` implies `b`.\r\n */\r\n static whenIsEntirelyIncluded(a, b) {\r\n if (!b || b.type === 1 /* True */) {\r\n return true;\r\n }\r\n if (!a || a.type === 1 /* True */) {\r\n return false;\r\n }\r\n return this._implies(a, b);\r\n }\r\n /**\r\n * Returns true if it is provable `p` implies `q`.\r\n */\r\n static _implies(p, q) {\r\n const notP = p.negate();\r\n const terminals = (node) => {\r\n if (node.type === 9 /* Or */) {\r\n return node.expr;\r\n }\r\n return [node];\r\n };\r\n let expr = terminals(notP).concat(terminals(q));\r\n for (let i = 0; i < expr.length; i++) {\r\n const a = expr[i];\r\n const notA = a.negate();\r\n for (let j = i + 1; j < expr.length; j++) {\r\n const b = expr[j];\r\n if (notA.equals(b)) {\r\n return true;\r\n }\r\n }\r\n }\r\n return false;\r\n }\r\n getKeybindings() {\r\n return this._keybindings;\r\n }\r\n lookupPrimaryKeybinding(commandId, context) {\r\n const items = this._lookupMap.get(commandId);\r\n if (typeof items === 'undefined' || items.length === 0) {\r\n return null;\r\n }\r\n if (items.length === 1) {\r\n return items[0];\r\n }\r\n for (let i = items.length - 1; i >= 0; i--) {\r\n const item = items[i];\r\n if (context.contextMatchesRules(item.when)) {\r\n return item;\r\n }\r\n }\r\n return items[items.length - 1];\r\n }\r\n resolve(context, currentChord, keypress) {\r\n this._log(`| Resolving ${keypress}${currentChord ? ` chorded from ${currentChord}` : ``}`);\r\n let lookupMap = null;\r\n if (currentChord !== null) {\r\n // Fetch all chord bindings for `currentChord`\r\n const candidates = this._map.get(currentChord);\r\n if (typeof candidates === 'undefined') {\r\n // No chords starting with `currentChord`\r\n this._log(`\\\\ No keybinding entries.`);\r\n return null;\r\n }\r\n lookupMap = [];\r\n for (let i = 0, len = candidates.length; i < len; i++) {\r\n let candidate = candidates[i];\r\n // TODO@chords\r\n if (candidate.keypressParts[1] === keypress) {\r\n lookupMap.push(candidate);\r\n }\r\n }\r\n }\r\n else {\r\n const candidates = this._map.get(keypress);\r\n if (typeof candidates === 'undefined') {\r\n // No bindings with `keypress`\r\n this._log(`\\\\ No keybinding entries.`);\r\n return null;\r\n }\r\n lookupMap = candidates;\r\n }\r\n let result = this._findCommand(context, lookupMap);\r\n if (!result) {\r\n this._log(`\\\\ From ${lookupMap.length} keybinding entries, no when clauses matched the context.`);\r\n return null;\r\n }\r\n // TODO@chords\r\n if (currentChord === null && result.keypressParts.length > 1 && result.keypressParts[1] !== null) {\r\n this._log(`\\\\ From ${lookupMap.length} keybinding entries, matched chord, when: ${printWhenExplanation(result.when)}, source: ${printSourceExplanation(result)}.`);\r\n return {\r\n enterChord: true,\r\n leaveChord: false,\r\n commandId: null,\r\n commandArgs: null,\r\n bubble: false\r\n };\r\n }\r\n this._log(`\\\\ From ${lookupMap.length} keybinding entries, matched ${result.command}, when: ${printWhenExplanation(result.when)}, source: ${printSourceExplanation(result)}.`);\r\n return {\r\n enterChord: false,\r\n leaveChord: result.keypressParts.length > 1,\r\n commandId: result.command,\r\n commandArgs: result.commandArgs,\r\n bubble: result.bubble\r\n };\r\n }\r\n _findCommand(context, matches) {\r\n for (let i = matches.length - 1; i >= 0; i--) {\r\n let k = matches[i];\r\n if (!KeybindingResolver.contextMatchesRules(context, k.when)) {\r\n continue;\r\n }\r\n return k;\r\n }\r\n return null;\r\n }\r\n static contextMatchesRules(context, rules) {\r\n if (!rules) {\r\n return true;\r\n }\r\n return rules.evaluate(context);\r\n }\r\n}\r\nfunction printWhenExplanation(when) {\r\n if (!when) {\r\n return `no when condition`;\r\n }\r\n return `${when.serialize()}`;\r\n}\r\nfunction printSourceExplanation(kb) {\r\n return (kb.extensionId\r\n ? (kb.isBuiltinExtension ? `built-in extension ${kb.extensionId}` : `user extension ${kb.extensionId}`)\r\n : (kb.isDefault ? `built-in` : `user`));\r\n}\r\n", "/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License. See License.txt in the project root for license information.\r\n *--------------------------------------------------------------------------------------------*/\r\nexport class ResolvedKeybindingItem {\r\n constructor(resolvedKeybinding, command, commandArgs, when, isDefault, extensionId, isBuiltinExtension) {\r\n this._resolvedKeybindingItemBrand = undefined;\r\n this.resolvedKeybinding = resolvedKeybinding;\r\n this.keypressParts = resolvedKeybinding ? removeElementsAfterNulls(resolvedKeybinding.getDispatchParts()) : [];\r\n if (resolvedKeybinding && this.keypressParts.length === 0) {\r\n // handle possible single modifier chord keybindings\r\n this.keypressParts = removeElementsAfterNulls(resolvedKeybinding.getSingleModifierDispatchParts());\r\n }\r\n this.bubble = (command ? command.charCodeAt(0) === 94 /* Caret */ : false);\r\n this.command = this.bubble ? command.substr(1) : command;\r\n this.commandArgs = commandArgs;\r\n this.when = when;\r\n this.isDefault = isDefault;\r\n this.extensionId = extensionId;\r\n this.isBuiltinExtension = isBuiltinExtension;\r\n }\r\n}\r\nexport function removeElementsAfterNulls(arr) {\r\n let result = [];\r\n for (let i = 0, len = arr.length; i < len; i++) {\r\n const element = arr[i];\r\n if (!element) {\r\n // stop processing at first encountered null\r\n return result;\r\n }\r\n result.push(element);\r\n }\r\n return result;\r\n}\r\n", "/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License. See License.txt in the project root for license information.\r\n *--------------------------------------------------------------------------------------------*/\r\nimport * as nls from '../../nls.js';\r\nexport class ModifierLabelProvider {\r\n constructor(mac, windows, linux = windows) {\r\n this.modifierLabels = [null]; // index 0 will never me accessed.\r\n this.modifierLabels[2 /* Macintosh */] = mac;\r\n this.modifierLabels[1 /* Windows */] = windows;\r\n this.modifierLabels[3 /* Linux */] = linux;\r\n }\r\n toLabel(OS, parts, keyLabelProvider) {\r\n if (parts.length === 0) {\r\n return null;\r\n }\r\n const result = [];\r\n for (let i = 0, len = parts.length; i < len; i++) {\r\n const part = parts[i];\r\n const keyLabel = keyLabelProvider(part);\r\n if (keyLabel === null) {\r\n // this keybinding cannot be expressed...\r\n return null;\r\n }\r\n result[i] = _simpleAsString(part, keyLabel, this.modifierLabels[OS]);\r\n }\r\n return result.join(' ');\r\n }\r\n}\r\n/**\r\n * A label provider that prints modifiers in a suitable format for displaying in the UI.\r\n */\r\nexport const UILabelProvider = new ModifierLabelProvider({\r\n ctrlKey: '\u2303',\r\n shiftKey: '\u21E7',\r\n altKey: '\u2325',\r\n metaKey: '\u2318',\r\n separator: '',\r\n}, {\r\n ctrlKey: nls.localize({ key: 'ctrlKey', comment: ['This is the short form for the Control key on the keyboard'] }, \"Ctrl\"),\r\n shiftKey: nls.localize({ key: 'shiftKey', comment: ['This is the short form for the Shift key on the keyboard'] }, \"Shift\"),\r\n altKey: nls.localize({ key: 'altKey', comment: ['This is the short form for the Alt key on the keyboard'] }, \"Alt\"),\r\n metaKey: nls.localize({ key: 'windowsKey', comment: ['This is the short form for the Windows key on the keyboard'] }, \"Windows\"),\r\n separator: '+',\r\n}, {\r\n ctrlKey: nls.localize({ key: 'ctrlKey', comment: ['This is the short form for the Control key on the keyboard'] }, \"Ctrl\"),\r\n shiftKey: nls.localize({ key: 'shiftKey', comment: ['This is the short form for the Shift key on the keyboard'] }, \"Shift\"),\r\n altKey: nls.localize({ key: 'altKey', comment: ['This is the short form for the Alt key on the keyboard'] }, \"Alt\"),\r\n metaKey: nls.localize({ key: 'superKey', comment: ['This is the short form for the Super key on the keyboard'] }, \"Super\"),\r\n separator: '+',\r\n});\r\n/**\r\n * A label provider that prints modifiers in a suitable format for ARIA.\r\n */\r\nexport const AriaLabelProvider = new ModifierLabelProvider({\r\n ctrlKey: nls.localize({ key: 'ctrlKey.long', comment: ['This is the long form for the Control key on the keyboard'] }, \"Control\"),\r\n shiftKey: nls.localize({ key: 'shiftKey.long', comment: ['This is the long form for the Shift key on the keyboard'] }, \"Shift\"),\r\n altKey: nls.localize({ key: 'altKey.long', comment: ['This is the long form for the Alt key on the keyboard'] }, \"Alt\"),\r\n metaKey: nls.localize({ key: 'cmdKey.long', comment: ['This is the long form for the Command key on the keyboard'] }, \"Command\"),\r\n separator: '+',\r\n}, {\r\n ctrlKey: nls.localize({ key: 'ctrlKey.long', comment: ['This is the long form for the Control key on the keyboard'] }, \"Control\"),\r\n shiftKey: nls.localize({ key: 'shiftKey.long', comment: ['This is the long form for the Shift key on the keyboard'] }, \"Shift\"),\r\n altKey: nls.localize({ key: 'altKey.long', comment: ['This is the long form for the Alt key on the keyboard'] }, \"Alt\"),\r\n metaKey: nls.localize({ key: 'windowsKey.long', comment: ['This is the long form for the Windows key on the keyboard'] }, \"Windows\"),\r\n separator: '+',\r\n}, {\r\n ctrlKey: nls.localize({ key: 'ctrlKey.long', comment: ['This is the long form for the Control key on the keyboard'] }, \"Control\"),\r\n shiftKey: nls.localize({ key: 'shiftKey.long', comment: ['This is the long form for the Shift key on the keyboard'] }, \"Shift\"),\r\n altKey: nls.localize({ key: 'altKey.long', comment: ['This is the long form for the Alt key on the keyboard'] }, \"Alt\"),\r\n metaKey: nls.localize({ key: 'superKey.long', comment: ['This is the long form for the Super key on the keyboard'] }, \"Super\"),\r\n separator: '+',\r\n});\r\nfunction _simpleAsString(modifiers, key, labels) {\r\n if (key === null) {\r\n return '';\r\n }\r\n const result = [];\r\n // translate modifier keys: Ctrl-Shift-Alt-Meta\r\n if (modifiers.ctrlKey) {\r\n result.push(labels.ctrlKey);\r\n }\r\n if (modifiers.shiftKey) {\r\n result.push(labels.shiftKey);\r\n }\r\n if (modifiers.altKey) {\r\n result.push(labels.altKey);\r\n }\r\n if (modifiers.metaKey) {\r\n result.push(labels.metaKey);\r\n }\r\n // the actual key\r\n if (key !== '') {\r\n result.push(key);\r\n }\r\n return result.join(labels.separator);\r\n}\r\n", "/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License. See License.txt in the project root for license information.\r\n *--------------------------------------------------------------------------------------------*/\r\nimport { illegalArgument } from '../../../base/common/errors.js';\r\nimport { UILabelProvider, AriaLabelProvider } from '../../../base/common/keybindingLabels.js';\r\nimport { ResolvedKeybinding, ResolvedKeybindingPart } from '../../../base/common/keyCodes.js';\r\nexport class BaseResolvedKeybinding extends ResolvedKeybinding {\r\n constructor(os, parts) {\r\n super();\r\n if (parts.length === 0) {\r\n throw illegalArgument(`parts`);\r\n }\r\n this._os = os;\r\n this._parts = parts;\r\n }\r\n getLabel() {\r\n return UILabelProvider.toLabel(this._os, this._parts, (keybinding) => this._getLabel(keybinding));\r\n }\r\n getAriaLabel() {\r\n return AriaLabelProvider.toLabel(this._os, this._parts, (keybinding) => this._getAriaLabel(keybinding));\r\n }\r\n isChord() {\r\n return (this._parts.length > 1);\r\n }\r\n getParts() {\r\n return this._parts.map((keybinding) => this._getPart(keybinding));\r\n }\r\n _getPart(keybinding) {\r\n return new ResolvedKeybindingPart(keybinding.ctrlKey, keybinding.shiftKey, keybinding.altKey, keybinding.metaKey, this._getLabel(keybinding), this._getAriaLabel(keybinding));\r\n }\r\n getDispatchParts() {\r\n return this._parts.map((keybinding) => this._getDispatchPart(keybinding));\r\n }\r\n getSingleModifierDispatchParts() {\r\n return this._parts.map((keybinding) => this._getSingleModifierDispatchPart(keybinding));\r\n }\r\n}\r\n", "/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License. See License.txt in the project root for license information.\r\n *--------------------------------------------------------------------------------------------*/\r\nimport { KeyCodeUtils } from '../../../base/common/keyCodes.js';\r\nimport { BaseResolvedKeybinding } from './baseResolvedKeybinding.js';\r\n/**\r\n * Do not instantiate. Use KeybindingService to get a ResolvedKeybinding seeded with information about the current kb layout.\r\n */\r\nexport class USLayoutResolvedKeybinding extends BaseResolvedKeybinding {\r\n constructor(actual, os) {\r\n super(os, actual.parts);\r\n }\r\n _keyCodeToUILabel(keyCode) {\r\n if (this._os === 2 /* Macintosh */) {\r\n switch (keyCode) {\r\n case 15 /* LeftArrow */:\r\n return '\u2190';\r\n case 16 /* UpArrow */:\r\n return '\u2191';\r\n case 17 /* RightArrow */:\r\n return '\u2192';\r\n case 18 /* DownArrow */:\r\n return '\u2193';\r\n }\r\n }\r\n return KeyCodeUtils.toString(keyCode);\r\n }\r\n _getLabel(keybinding) {\r\n if (keybinding.isDuplicateModifierCase()) {\r\n return '';\r\n }\r\n return this._keyCodeToUILabel(keybinding.keyCode);\r\n }\r\n _getAriaLabel(keybinding) {\r\n if (keybinding.isDuplicateModifierCase()) {\r\n return '';\r\n }\r\n return KeyCodeUtils.toString(keybinding.keyCode);\r\n }\r\n _getDispatchPart(keybinding) {\r\n return USLayoutResolvedKeybinding.getDispatchStr(keybinding);\r\n }\r\n static getDispatchStr(keybinding) {\r\n if (keybinding.isModifierKey()) {\r\n return null;\r\n }\r\n let result = '';\r\n if (keybinding.ctrlKey) {\r\n result += 'ctrl+';\r\n }\r\n if (keybinding.shiftKey) {\r\n result += 'shift+';\r\n }\r\n if (keybinding.altKey) {\r\n result += 'alt+';\r\n }\r\n if (keybinding.metaKey) {\r\n result += 'meta+';\r\n }\r\n result += KeyCodeUtils.toString(keybinding.keyCode);\r\n return result;\r\n }\r\n _getSingleModifierDispatchPart(keybinding) {\r\n if (keybinding.keyCode === 5 /* Ctrl */ && !keybinding.shiftKey && !keybinding.altKey && !keybinding.metaKey) {\r\n return 'ctrl';\r\n }\r\n if (keybinding.keyCode === 4 /* Shift */ && !keybinding.ctrlKey && !keybinding.altKey && !keybinding.metaKey) {\r\n return 'shift';\r\n }\r\n if (keybinding.keyCode === 6 /* Alt */ && !keybinding.ctrlKey && !keybinding.shiftKey && !keybinding.metaKey) {\r\n return 'alt';\r\n }\r\n if (keybinding.keyCode === 57 /* Meta */ && !keybinding.ctrlKey && !keybinding.shiftKey && !keybinding.altKey) {\r\n return 'meta';\r\n }\r\n return null;\r\n }\r\n}\r\n", "/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License. See License.txt in the project root for license information.\r\n *--------------------------------------------------------------------------------------------*/\r\nimport BaseSeverity from '../../../base/common/severity.js';\r\nimport { createDecorator } from '../../instantiation/common/instantiation.js';\r\nexport var Severity = BaseSeverity;\r\nexport const INotificationService = createDecorator('notificationService');\r\nexport class NoOpNotification {\r\n}\r\n", "/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License. See License.txt in the project root for license information.\r\n *--------------------------------------------------------------------------------------------*/\r\nimport { createDecorator } from '../../instantiation/common/instantiation.js';\r\nimport { TernarySearchTree } from '../../../base/common/map.js';\r\nexport const IWorkspaceContextService = createDecorator('contextService');\r\nexport class Workspace {\r\n constructor(_id, folders, _configuration, _ignorePathCasing) {\r\n this._id = _id;\r\n this._configuration = _configuration;\r\n this._ignorePathCasing = _ignorePathCasing;\r\n this._foldersMap = TernarySearchTree.forUris(this._ignorePathCasing);\r\n this.folders = folders;\r\n }\r\n get folders() {\r\n return this._folders;\r\n }\r\n set folders(folders) {\r\n this._folders = folders;\r\n this.updateFoldersMap();\r\n }\r\n get id() {\r\n return this._id;\r\n }\r\n get configuration() {\r\n return this._configuration;\r\n }\r\n set configuration(configuration) {\r\n this._configuration = configuration;\r\n }\r\n getFolder(resource) {\r\n if (!resource) {\r\n return null;\r\n }\r\n return this._foldersMap.findSubstr(resource.with({\r\n scheme: resource.scheme,\r\n authority: resource.authority,\r\n path: resource.path\r\n })) || null;\r\n }\r\n updateFoldersMap() {\r\n this._foldersMap = TernarySearchTree.forUris(this._ignorePathCasing);\r\n for (const folder of this.folders) {\r\n this._foldersMap.set(folder.uri, folder);\r\n }\r\n }\r\n toJSON() {\r\n return { id: this.id, folders: this.folders, configuration: this.configuration };\r\n }\r\n}\r\nexport class WorkspaceFolder {\r\n constructor(data, raw) {\r\n this.raw = raw;\r\n this.uri = data.uri;\r\n this.index = data.index;\r\n this.name = data.name;\r\n }\r\n toJSON() {\r\n return { uri: this.uri, name: this.name, index: this.index };\r\n }\r\n}\r\n", "/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License. See License.txt in the project root for license information.\r\n *--------------------------------------------------------------------------------------------*/\r\nimport * as nls from '../../nls.js';\r\nexport var AccessibilityHelpNLS;\r\n(function (AccessibilityHelpNLS) {\r\n AccessibilityHelpNLS.noSelection = nls.localize(\"noSelection\", \"No selection\");\r\n AccessibilityHelpNLS.singleSelectionRange = nls.localize(\"singleSelectionRange\", \"Line {0}, Column {1} ({2} selected)\");\r\n AccessibilityHelpNLS.singleSelection = nls.localize(\"singleSelection\", \"Line {0}, Column {1}\");\r\n AccessibilityHelpNLS.multiSelectionRange = nls.localize(\"multiSelectionRange\", \"{0} selections ({1} characters selected)\");\r\n AccessibilityHelpNLS.multiSelection = nls.localize(\"multiSelection\", \"{0} selections\");\r\n AccessibilityHelpNLS.emergencyConfOn = nls.localize(\"emergencyConfOn\", \"Now changing the setting `accessibilitySupport` to 'on'.\");\r\n AccessibilityHelpNLS.openingDocs = nls.localize(\"openingDocs\", \"Now opening the Editor Accessibility documentation page.\");\r\n AccessibilityHelpNLS.readonlyDiffEditor = nls.localize(\"readonlyDiffEditor\", \" in a read-only pane of a diff editor.\");\r\n AccessibilityHelpNLS.editableDiffEditor = nls.localize(\"editableDiffEditor\", \" in a pane of a diff editor.\");\r\n AccessibilityHelpNLS.readonlyEditor = nls.localize(\"readonlyEditor\", \" in a read-only code editor\");\r\n AccessibilityHelpNLS.editableEditor = nls.localize(\"editableEditor\", \" in a code editor\");\r\n AccessibilityHelpNLS.changeConfigToOnMac = nls.localize(\"changeConfigToOnMac\", \"To configure the editor to be optimized for usage with a Screen Reader press Command+E now.\");\r\n AccessibilityHelpNLS.changeConfigToOnWinLinux = nls.localize(\"changeConfigToOnWinLinux\", \"To configure the editor to be optimized for usage with a Screen Reader press Control+E now.\");\r\n AccessibilityHelpNLS.auto_on = nls.localize(\"auto_on\", \"The editor is configured to be optimized for usage with a Screen Reader.\");\r\n AccessibilityHelpNLS.auto_off = nls.localize(\"auto_off\", \"The editor is configured to never be optimized for usage with a Screen Reader, which is not the case at this time.\");\r\n AccessibilityHelpNLS.tabFocusModeOnMsg = nls.localize(\"tabFocusModeOnMsg\", \"Pressing Tab in the current editor will move focus to the next focusable element. Toggle this behavior by pressing {0}.\");\r\n AccessibilityHelpNLS.tabFocusModeOnMsgNoKb = nls.localize(\"tabFocusModeOnMsgNoKb\", \"Pressing Tab in the current editor will move focus to the next focusable element. The command {0} is currently not triggerable by a keybinding.\");\r\n AccessibilityHelpNLS.tabFocusModeOffMsg = nls.localize(\"tabFocusModeOffMsg\", \"Pressing Tab in the current editor will insert the tab character. Toggle this behavior by pressing {0}.\");\r\n AccessibilityHelpNLS.tabFocusModeOffMsgNoKb = nls.localize(\"tabFocusModeOffMsgNoKb\", \"Pressing Tab in the current editor will insert the tab character. The command {0} is currently not triggerable by a keybinding.\");\r\n AccessibilityHelpNLS.openDocMac = nls.localize(\"openDocMac\", \"Press Command+H now to open a browser window with more information related to editor accessibility.\");\r\n AccessibilityHelpNLS.openDocWinLinux = nls.localize(\"openDocWinLinux\", \"Press Control+H now to open a browser window with more information related to editor accessibility.\");\r\n AccessibilityHelpNLS.outroMsg = nls.localize(\"outroMsg\", \"You can dismiss this tooltip and return to the editor by pressing Escape or Shift+Escape.\");\r\n AccessibilityHelpNLS.showAccessibilityHelpAction = nls.localize(\"showAccessibilityHelpAction\", \"Show Accessibility Help\");\r\n})(AccessibilityHelpNLS || (AccessibilityHelpNLS = {}));\r\nexport var InspectTokensNLS;\r\n(function (InspectTokensNLS) {\r\n InspectTokensNLS.inspectTokensAction = nls.localize('inspectTokens', \"Developer: Inspect Tokens\");\r\n})(InspectTokensNLS || (InspectTokensNLS = {}));\r\nexport var GoToLineNLS;\r\n(function (GoToLineNLS) {\r\n GoToLineNLS.gotoLineActionLabel = nls.localize('gotoLineActionLabel', \"Go to Line/Column...\");\r\n})(GoToLineNLS || (GoToLineNLS = {}));\r\nexport var QuickHelpNLS;\r\n(function (QuickHelpNLS) {\r\n QuickHelpNLS.helpQuickAccessActionLabel = nls.localize('helpQuickAccess', \"Show all Quick Access Providers\");\r\n})(QuickHelpNLS || (QuickHelpNLS = {}));\r\nexport var QuickCommandNLS;\r\n(function (QuickCommandNLS) {\r\n QuickCommandNLS.quickCommandActionLabel = nls.localize('quickCommandActionLabel', \"Command Palette\");\r\n QuickCommandNLS.quickCommandHelp = nls.localize('quickCommandActionHelp', \"Show And Run Commands\");\r\n})(QuickCommandNLS || (QuickCommandNLS = {}));\r\nexport var QuickOutlineNLS;\r\n(function (QuickOutlineNLS) {\r\n QuickOutlineNLS.quickOutlineActionLabel = nls.localize('quickOutlineActionLabel', \"Go to Symbol...\");\r\n QuickOutlineNLS.quickOutlineByCategoryActionLabel = nls.localize('quickOutlineByCategoryActionLabel', \"Go to Symbol by Category...\");\r\n})(QuickOutlineNLS || (QuickOutlineNLS = {}));\r\nexport var StandaloneCodeEditorNLS;\r\n(function (StandaloneCodeEditorNLS) {\r\n StandaloneCodeEditorNLS.editorViewAccessibleLabel = nls.localize('editorViewAccessibleLabel', \"Editor content\");\r\n StandaloneCodeEditorNLS.accessibilityHelpMessage = nls.localize('accessibilityHelpMessage', \"Press Alt+F1 for Accessibility Options.\");\r\n})(StandaloneCodeEditorNLS || (StandaloneCodeEditorNLS = {}));\r\nexport var ToggleHighContrastNLS;\r\n(function (ToggleHighContrastNLS) {\r\n ToggleHighContrastNLS.toggleHighContrast = nls.localize('toggleHighContrast', \"Toggle High Contrast Theme\");\r\n})(ToggleHighContrastNLS || (ToggleHighContrastNLS = {}));\r\nexport var SimpleServicesNLS;\r\n(function (SimpleServicesNLS) {\r\n SimpleServicesNLS.bulkEditServiceSummary = nls.localize('bulkEditServiceSummary', \"Made {0} edits in {1} files\");\r\n})(SimpleServicesNLS || (SimpleServicesNLS = {}));\r\n", "/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License. See License.txt in the project root for license information.\r\n *--------------------------------------------------------------------------------------------*/\r\nvar __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n};\r\nvar __param = (this && this.__param) || function (paramIndex, decorator) {\r\n return function (target, key) { decorator(target, key, paramIndex); }\r\n};\r\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\r\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n};\r\nimport * as strings from '../../../base/common/strings.js';\r\nimport * as dom from '../../../base/browser/dom.js';\r\nimport { StandardKeyboardEvent } from '../../../base/browser/keyboardEvent.js';\r\nimport { Emitter, Event } from '../../../base/common/event.js';\r\nimport { SimpleKeybinding, createKeybinding } from '../../../base/common/keyCodes.js';\r\nimport { ImmortalReference, toDisposable, DisposableStore, Disposable } from '../../../base/common/lifecycle.js';\r\nimport { OS, isLinux, isMacintosh } from '../../../base/common/platform.js';\r\nimport Severity from '../../../base/common/severity.js';\r\nimport { URI } from '../../../base/common/uri.js';\r\nimport { isCodeEditor } from '../../browser/editorBrowser.js';\r\nimport { ResourceTextEdit } from '../../browser/services/bulkEditService.js';\r\nimport { isDiffEditorConfigurationKey, isEditorConfigurationKey } from '../../common/config/commonEditorConfig.js';\r\nimport { EditOperation } from '../../common/core/editOperation.js';\r\nimport { Position as Pos } from '../../common/core/position.js';\r\nimport { Range } from '../../common/core/range.js';\r\nimport { IModelService } from '../../common/services/modelService.js';\r\nimport { CommandsRegistry } from '../../../platform/commands/common/commands.js';\r\nimport { IConfigurationService } from '../../../platform/configuration/common/configuration.js';\r\nimport { Configuration, ConfigurationModel, DefaultConfigurationModel, ConfigurationChangeEvent } from '../../../platform/configuration/common/configurationModels.js';\r\nimport { AbstractKeybindingService } from '../../../platform/keybinding/common/abstractKeybindingService.js';\r\nimport { KeybindingResolver } from '../../../platform/keybinding/common/keybindingResolver.js';\r\nimport { KeybindingsRegistry } from '../../../platform/keybinding/common/keybindingsRegistry.js';\r\nimport { ResolvedKeybindingItem } from '../../../platform/keybinding/common/resolvedKeybindingItem.js';\r\nimport { USLayoutResolvedKeybinding } from '../../../platform/keybinding/common/usLayoutResolvedKeybinding.js';\r\nimport { NoOpNotification } from '../../../platform/notification/common/notification.js';\r\nimport { WorkspaceFolder } from '../../../platform/workspace/common/workspace.js';\r\nimport { SimpleServicesNLS } from '../../common/standaloneStrings.js';\r\nexport class SimpleModel {\r\n constructor(model) {\r\n this.disposed = false;\r\n this.model = model;\r\n this._onWillDispose = new Emitter();\r\n }\r\n get textEditorModel() {\r\n return this.model;\r\n }\r\n dispose() {\r\n this.disposed = true;\r\n this._onWillDispose.fire();\r\n }\r\n}\r\nfunction withTypedEditor(widget, codeEditorCallback, diffEditorCallback) {\r\n if (isCodeEditor(widget)) {\r\n // Single Editor\r\n return codeEditorCallback(widget);\r\n }\r\n else {\r\n // Diff Editor\r\n return diffEditorCallback(widget);\r\n }\r\n}\r\nlet SimpleEditorModelResolverService = class SimpleEditorModelResolverService {\r\n constructor(modelService) {\r\n this.modelService = modelService;\r\n }\r\n setEditor(editor) {\r\n this.editor = editor;\r\n }\r\n createModelReference(resource) {\r\n let model = null;\r\n if (this.editor) {\r\n model = withTypedEditor(this.editor, (editor) => this.findModel(editor, resource), (diffEditor) => this.findModel(diffEditor.getOriginalEditor(), resource) || this.findModel(diffEditor.getModifiedEditor(), resource));\r\n }\r\n if (!model) {\r\n return Promise.reject(new Error(`Model not found`));\r\n }\r\n return Promise.resolve(new ImmortalReference(new SimpleModel(model)));\r\n }\r\n findModel(editor, resource) {\r\n let model = this.modelService.getModel(resource);\r\n if (model && model.uri.toString() !== resource.toString()) {\r\n return null;\r\n }\r\n return model;\r\n }\r\n};\r\nSimpleEditorModelResolverService = __decorate([\r\n __param(0, IModelService)\r\n], SimpleEditorModelResolverService);\r\nexport { SimpleEditorModelResolverService };\r\nexport class SimpleEditorProgressService {\r\n show() {\r\n return SimpleEditorProgressService.NULL_PROGRESS_RUNNER;\r\n }\r\n showWhile(promise, delay) {\r\n return __awaiter(this, void 0, void 0, function* () {\r\n yield promise;\r\n });\r\n }\r\n}\r\nSimpleEditorProgressService.NULL_PROGRESS_RUNNER = {\r\n done: () => { },\r\n total: () => { },\r\n worked: () => { }\r\n};\r\nexport class SimpleDialogService {\r\n confirm(confirmation) {\r\n return this.doConfirm(confirmation).then(confirmed => {\r\n return {\r\n confirmed,\r\n checkboxChecked: false // unsupported\r\n };\r\n });\r\n }\r\n doConfirm(confirmation) {\r\n let messageText = confirmation.message;\r\n if (confirmation.detail) {\r\n messageText = messageText + '\\n\\n' + confirmation.detail;\r\n }\r\n return Promise.resolve(window.confirm(messageText));\r\n }\r\n show(severity, message, buttons, options) {\r\n return Promise.resolve({ choice: 0 });\r\n }\r\n}\r\nexport class SimpleNotificationService {\r\n info(message) {\r\n return this.notify({ severity: Severity.Info, message });\r\n }\r\n warn(message) {\r\n return this.notify({ severity: Severity.Warning, message });\r\n }\r\n error(error) {\r\n return this.notify({ severity: Severity.Error, message: error });\r\n }\r\n notify(notification) {\r\n switch (notification.severity) {\r\n case Severity.Error:\r\n console.error(notification.message);\r\n break;\r\n case Severity.Warning:\r\n console.warn(notification.message);\r\n break;\r\n default:\r\n console.log(notification.message);\r\n break;\r\n }\r\n return SimpleNotificationService.NO_OP;\r\n }\r\n status(message, options) {\r\n return Disposable.None;\r\n }\r\n}\r\nSimpleNotificationService.NO_OP = new NoOpNotification();\r\nexport class StandaloneCommandService {\r\n constructor(instantiationService) {\r\n this._onWillExecuteCommand = new Emitter();\r\n this._onDidExecuteCommand = new Emitter();\r\n this.onDidExecuteCommand = this._onDidExecuteCommand.event;\r\n this._instantiationService = instantiationService;\r\n }\r\n executeCommand(id, ...args) {\r\n const command = CommandsRegistry.getCommand(id);\r\n if (!command) {\r\n return Promise.reject(new Error(`command '${id}' not found`));\r\n }\r\n try {\r\n this._onWillExecuteCommand.fire({ commandId: id, args });\r\n const result = this._instantiationService.invokeFunction.apply(this._instantiationService, [command.handler, ...args]);\r\n this._onDidExecuteCommand.fire({ commandId: id, args });\r\n return Promise.resolve(result);\r\n }\r\n catch (err) {\r\n return Promise.reject(err);\r\n }\r\n }\r\n}\r\nexport class StandaloneKeybindingService extends AbstractKeybindingService {\r\n constructor(contextKeyService, commandService, telemetryService, notificationService, logService, domNode) {\r\n super(contextKeyService, commandService, telemetryService, notificationService, logService);\r\n this._cachedResolver = null;\r\n this._dynamicKeybindings = [];\r\n // for standard keybindings\r\n this._register(dom.addDisposableListener(domNode, dom.EventType.KEY_DOWN, (e) => {\r\n const keyEvent = new StandardKeyboardEvent(e);\r\n const shouldPreventDefault = this._dispatch(keyEvent, keyEvent.target);\r\n if (shouldPreventDefault) {\r\n keyEvent.preventDefault();\r\n keyEvent.stopPropagation();\r\n }\r\n }));\r\n // for single modifier chord keybindings (e.g. shift shift)\r\n this._register(dom.addDisposableListener(window, dom.EventType.KEY_UP, (e) => {\r\n const keyEvent = new StandardKeyboardEvent(e);\r\n const shouldPreventDefault = this._singleModifierDispatch(keyEvent, keyEvent.target);\r\n if (shouldPreventDefault) {\r\n keyEvent.preventDefault();\r\n }\r\n }));\r\n }\r\n addDynamicKeybinding(commandId, _keybinding, handler, when) {\r\n const keybinding = createKeybinding(_keybinding, OS);\r\n const toDispose = new DisposableStore();\r\n if (keybinding) {\r\n this._dynamicKeybindings.push({\r\n keybinding: keybinding,\r\n command: commandId,\r\n when: when,\r\n weight1: 1000,\r\n weight2: 0,\r\n extensionId: null,\r\n isBuiltinExtension: false\r\n });\r\n toDispose.add(toDisposable(() => {\r\n for (let i = 0; i < this._dynamicKeybindings.length; i++) {\r\n let kb = this._dynamicKeybindings[i];\r\n if (kb.command === commandId) {\r\n this._dynamicKeybindings.splice(i, 1);\r\n this.updateResolver({ source: 1 /* Default */ });\r\n return;\r\n }\r\n }\r\n }));\r\n }\r\n toDispose.add(CommandsRegistry.registerCommand(commandId, handler));\r\n this.updateResolver({ source: 1 /* Default */ });\r\n return toDispose;\r\n }\r\n updateResolver(event) {\r\n this._cachedResolver = null;\r\n this._onDidUpdateKeybindings.fire(event);\r\n }\r\n _getResolver() {\r\n if (!this._cachedResolver) {\r\n const defaults = this._toNormalizedKeybindingItems(KeybindingsRegistry.getDefaultKeybindings(), true);\r\n const overrides = this._toNormalizedKeybindingItems(this._dynamicKeybindings, false);\r\n this._cachedResolver = new KeybindingResolver(defaults, overrides, (str) => this._log(str));\r\n }\r\n return this._cachedResolver;\r\n }\r\n _documentHasFocus() {\r\n return document.hasFocus();\r\n }\r\n _toNormalizedKeybindingItems(items, isDefault) {\r\n let result = [], resultLen = 0;\r\n for (const item of items) {\r\n const when = item.when || undefined;\r\n const keybinding = item.keybinding;\r\n if (!keybinding) {\r\n // This might be a removal keybinding item in user settings => accept it\r\n result[resultLen++] = new ResolvedKeybindingItem(undefined, item.command, item.commandArgs, when, isDefault, null, false);\r\n }\r\n else {\r\n const resolvedKeybindings = this.resolveKeybinding(keybinding);\r\n for (const resolvedKeybinding of resolvedKeybindings) {\r\n result[resultLen++] = new ResolvedKeybindingItem(resolvedKeybinding, item.command, item.commandArgs, when, isDefault, null, false);\r\n }\r\n }\r\n }\r\n return result;\r\n }\r\n resolveKeybinding(keybinding) {\r\n return [new USLayoutResolvedKeybinding(keybinding, OS)];\r\n }\r\n resolveKeyboardEvent(keyboardEvent) {\r\n let keybinding = new SimpleKeybinding(keyboardEvent.ctrlKey, keyboardEvent.shiftKey, keyboardEvent.altKey, keyboardEvent.metaKey, keyboardEvent.keyCode).toChord();\r\n return new USLayoutResolvedKeybinding(keybinding, OS);\r\n }\r\n}\r\nfunction isConfigurationOverrides(thing) {\r\n return thing\r\n && typeof thing === 'object'\r\n && (!thing.overrideIdentifier || typeof thing.overrideIdentifier === 'string')\r\n && (!thing.resource || thing.resource instanceof URI);\r\n}\r\nexport class SimpleConfigurationService {\r\n constructor() {\r\n this._onDidChangeConfiguration = new Emitter();\r\n this.onDidChangeConfiguration = this._onDidChangeConfiguration.event;\r\n this._configuration = new Configuration(new DefaultConfigurationModel(), new ConfigurationModel());\r\n }\r\n getValue(arg1, arg2) {\r\n const section = typeof arg1 === 'string' ? arg1 : undefined;\r\n const overrides = isConfigurationOverrides(arg1) ? arg1 : isConfigurationOverrides(arg2) ? arg2 : {};\r\n return this._configuration.getValue(section, overrides, undefined);\r\n }\r\n updateValues(values) {\r\n const previous = { data: this._configuration.toData() };\r\n let changedKeys = [];\r\n for (const entry of values) {\r\n const [key, value] = entry;\r\n if (this.getValue(key) === value) {\r\n continue;\r\n }\r\n this._configuration.updateValue(key, value);\r\n changedKeys.push(key);\r\n }\r\n if (changedKeys.length > 0) {\r\n const configurationChangeEvent = new ConfigurationChangeEvent({ keys: changedKeys, overrides: [] }, previous, this._configuration);\r\n configurationChangeEvent.source = 7 /* MEMORY */;\r\n configurationChangeEvent.sourceConfig = null;\r\n this._onDidChangeConfiguration.fire(configurationChangeEvent);\r\n }\r\n return Promise.resolve();\r\n }\r\n}\r\nexport class SimpleResourceConfigurationService {\r\n constructor(configurationService) {\r\n this.configurationService = configurationService;\r\n this._onDidChangeConfiguration = new Emitter();\r\n this.configurationService.onDidChangeConfiguration((e) => {\r\n this._onDidChangeConfiguration.fire({ affectedKeys: e.affectedKeys, affectsConfiguration: (resource, configuration) => e.affectsConfiguration(configuration) });\r\n });\r\n }\r\n getValue(resource, arg2, arg3) {\r\n const position = Pos.isIPosition(arg2) ? arg2 : null;\r\n const section = position ? (typeof arg3 === 'string' ? arg3 : undefined) : (typeof arg2 === 'string' ? arg2 : undefined);\r\n if (typeof section === 'undefined') {\r\n return this.configurationService.getValue();\r\n }\r\n return this.configurationService.getValue(section);\r\n }\r\n}\r\nlet SimpleResourcePropertiesService = class SimpleResourcePropertiesService {\r\n constructor(configurationService) {\r\n this.configurationService = configurationService;\r\n }\r\n getEOL(resource, language) {\r\n const eol = this.configurationService.getValue('files.eol', { overrideIdentifier: language, resource });\r\n if (eol && typeof eol === 'string' && eol !== 'auto') {\r\n return eol;\r\n }\r\n return (isLinux || isMacintosh) ? '\\n' : '\\r\\n';\r\n }\r\n};\r\nSimpleResourcePropertiesService = __decorate([\r\n __param(0, IConfigurationService)\r\n], SimpleResourcePropertiesService);\r\nexport { SimpleResourcePropertiesService };\r\nexport class StandaloneTelemetryService {\r\n publicLog(eventName, data) {\r\n return Promise.resolve(undefined);\r\n }\r\n publicLog2(eventName, data) {\r\n return this.publicLog(eventName, data);\r\n }\r\n}\r\nexport class SimpleWorkspaceContextService {\r\n constructor() {\r\n const resource = URI.from({ scheme: SimpleWorkspaceContextService.SCHEME, authority: 'model', path: '/' });\r\n this.workspace = { id: '4064f6ec-cb38-4ad0-af64-ee6467e63c82', folders: [new WorkspaceFolder({ uri: resource, name: '', index: 0 })] };\r\n }\r\n getWorkspace() {\r\n return this.workspace;\r\n }\r\n}\r\nSimpleWorkspaceContextService.SCHEME = 'inmemory';\r\nexport function updateConfigurationService(configurationService, source, isDiffEditor) {\r\n if (!source) {\r\n return;\r\n }\r\n if (!(configurationService instanceof SimpleConfigurationService)) {\r\n return;\r\n }\r\n let toUpdate = [];\r\n Object.keys(source).forEach((key) => {\r\n if (isEditorConfigurationKey(key)) {\r\n toUpdate.push([`editor.${key}`, source[key]]);\r\n }\r\n if (isDiffEditor && isDiffEditorConfigurationKey(key)) {\r\n toUpdate.push([`diffEditor.${key}`, source[key]]);\r\n }\r\n });\r\n if (toUpdate.length > 0) {\r\n configurationService.updateValues(toUpdate);\r\n }\r\n}\r\nexport class SimpleBulkEditService {\r\n constructor(_modelService) {\r\n this._modelService = _modelService;\r\n //\r\n }\r\n hasPreviewHandler() {\r\n return false;\r\n }\r\n apply(edits, _options) {\r\n return __awaiter(this, void 0, void 0, function* () {\r\n const textEdits = new Map();\r\n for (let edit of edits) {\r\n if (!(edit instanceof ResourceTextEdit)) {\r\n throw new Error('bad edit - only text edits are supported');\r\n }\r\n const model = this._modelService.getModel(edit.resource);\r\n if (!model) {\r\n throw new Error('bad edit - model not found');\r\n }\r\n if (typeof edit.versionId === 'number' && model.getVersionId() !== edit.versionId) {\r\n throw new Error('bad state - model changed in the meantime');\r\n }\r\n let array = textEdits.get(model);\r\n if (!array) {\r\n array = [];\r\n textEdits.set(model, array);\r\n }\r\n array.push(EditOperation.replaceMove(Range.lift(edit.textEdit.range), edit.textEdit.text));\r\n }\r\n let totalEdits = 0;\r\n let totalFiles = 0;\r\n for (const [model, edits] of textEdits) {\r\n model.pushStackElement();\r\n model.pushEditOperations([], edits, () => []);\r\n model.pushStackElement();\r\n totalFiles += 1;\r\n totalEdits += edits.length;\r\n }\r\n return {\r\n ariaSummary: strings.format(SimpleServicesNLS.bulkEditServiceSummary, totalEdits, totalFiles)\r\n };\r\n });\r\n }\r\n}\r\nexport class SimpleUriLabelService {\r\n getUriLabel(resource, options) {\r\n if (resource.scheme === 'file') {\r\n return resource.fsPath;\r\n }\r\n return resource.path;\r\n }\r\n}\r\nexport class SimpleLayoutService {\r\n constructor(_codeEditorService, _container) {\r\n this._codeEditorService = _codeEditorService;\r\n this._container = _container;\r\n this.onDidLayout = Event.None;\r\n }\r\n get dimension() {\r\n if (!this._dimension) {\r\n this._dimension = dom.getClientArea(window.document.body);\r\n }\r\n return this._dimension;\r\n }\r\n get container() {\r\n return this._container;\r\n }\r\n focus() {\r\n var _a;\r\n (_a = this._codeEditorService.getFocusedCodeEditor()) === null || _a === void 0 ? void 0 : _a.focus();\r\n }\r\n}\r\n", "/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License. See License.txt in the project root for license information.\r\n *--------------------------------------------------------------------------------------------*/\r\nimport { createDecorator } from '../../../platform/instantiation/common/instantiation.js';\r\nexport const IMarkerDecorationsService = createDecorator('markerDecorationsService');\r\n", "/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License. See License.txt in the project root for license information.\r\n *--------------------------------------------------------------------------------------------*/\r\nvar __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n};\r\nvar __param = (this && this.__param) || function (paramIndex, decorator) {\r\n return function (target, key) { decorator(target, key, paramIndex); }\r\n};\r\nimport { IMarkerDecorationsService } from '../../common/services/markersDecorationService.js';\r\nimport { registerEditorContribution } from '../editorExtensions.js';\r\nlet MarkerDecorationsContribution = class MarkerDecorationsContribution {\r\n constructor(_editor, _markerDecorationsService) {\r\n // Doesn't do anything, just requires `IMarkerDecorationsService` to make sure it gets instantiated\r\n }\r\n dispose() {\r\n }\r\n};\r\nMarkerDecorationsContribution.ID = 'editor.contrib.markerDecorations';\r\nMarkerDecorationsContribution = __decorate([\r\n __param(1, IMarkerDecorationsService)\r\n], MarkerDecorationsContribution);\r\nexport { MarkerDecorationsContribution };\r\nregisterEditorContribution(MarkerDecorationsContribution.ID, MarkerDecorationsContribution);\r\n", "/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License. See License.txt in the project root for license information.\r\n *--------------------------------------------------------------------------------------------*/\r\nexport class CharWidthRequest {\r\n constructor(chr, type) {\r\n this.chr = chr;\r\n this.type = type;\r\n this.width = 0;\r\n }\r\n fulfill(width) {\r\n this.width = width;\r\n }\r\n}\r\nclass DomCharWidthReader {\r\n constructor(bareFontInfo, requests) {\r\n this._bareFontInfo = bareFontInfo;\r\n this._requests = requests;\r\n this._container = null;\r\n this._testElements = null;\r\n }\r\n read() {\r\n // Create a test container with all these test elements\r\n this._createDomElements();\r\n // Add the container to the DOM\r\n document.body.appendChild(this._container);\r\n // Read character widths\r\n this._readFromDomElements();\r\n // Remove the container from the DOM\r\n document.body.removeChild(this._container);\r\n this._container = null;\r\n this._testElements = null;\r\n }\r\n _createDomElements() {\r\n const container = document.createElement('div');\r\n container.style.position = 'absolute';\r\n container.style.top = '-50000px';\r\n container.style.width = '50000px';\r\n const regularDomNode = document.createElement('div');\r\n regularDomNode.style.fontFamily = this._bareFontInfo.getMassagedFontFamily();\r\n regularDomNode.style.fontWeight = this._bareFontInfo.fontWeight;\r\n regularDomNode.style.fontSize = this._bareFontInfo.fontSize + 'px';\r\n regularDomNode.style.fontFeatureSettings = this._bareFontInfo.fontFeatureSettings;\r\n regularDomNode.style.lineHeight = this._bareFontInfo.lineHeight + 'px';\r\n regularDomNode.style.letterSpacing = this._bareFontInfo.letterSpacing + 'px';\r\n container.appendChild(regularDomNode);\r\n const boldDomNode = document.createElement('div');\r\n boldDomNode.style.fontFamily = this._bareFontInfo.getMassagedFontFamily();\r\n boldDomNode.style.fontWeight = 'bold';\r\n boldDomNode.style.fontSize = this._bareFontInfo.fontSize + 'px';\r\n boldDomNode.style.fontFeatureSettings = this._bareFontInfo.fontFeatureSettings;\r\n boldDomNode.style.lineHeight = this._bareFontInfo.lineHeight + 'px';\r\n boldDomNode.style.letterSpacing = this._bareFontInfo.letterSpacing + 'px';\r\n container.appendChild(boldDomNode);\r\n const italicDomNode = document.createElement('div');\r\n italicDomNode.style.fontFamily = this._bareFontInfo.getMassagedFontFamily();\r\n italicDomNode.style.fontWeight = this._bareFontInfo.fontWeight;\r\n italicDomNode.style.fontSize = this._bareFontInfo.fontSize + 'px';\r\n italicDomNode.style.fontFeatureSettings = this._bareFontInfo.fontFeatureSettings;\r\n italicDomNode.style.lineHeight = this._bareFontInfo.lineHeight + 'px';\r\n italicDomNode.style.letterSpacing = this._bareFontInfo.letterSpacing + 'px';\r\n italicDomNode.style.fontStyle = 'italic';\r\n container.appendChild(italicDomNode);\r\n const testElements = [];\r\n for (const request of this._requests) {\r\n let parent;\r\n if (request.type === 0 /* Regular */) {\r\n parent = regularDomNode;\r\n }\r\n if (request.type === 2 /* Bold */) {\r\n parent = boldDomNode;\r\n }\r\n if (request.type === 1 /* Italic */) {\r\n parent = italicDomNode;\r\n }\r\n parent.appendChild(document.createElement('br'));\r\n const testElement = document.createElement('span');\r\n DomCharWidthReader._render(testElement, request);\r\n parent.appendChild(testElement);\r\n testElements.push(testElement);\r\n }\r\n this._container = container;\r\n this._testElements = testElements;\r\n }\r\n static _render(testElement, request) {\r\n if (request.chr === ' ') {\r\n let htmlString = '\\u00a0';\r\n // Repeat character 256 (2^8) times\r\n for (let i = 0; i < 8; i++) {\r\n htmlString += htmlString;\r\n }\r\n testElement.innerText = htmlString;\r\n }\r\n else {\r\n let testString = request.chr;\r\n // Repeat character 256 (2^8) times\r\n for (let i = 0; i < 8; i++) {\r\n testString += testString;\r\n }\r\n testElement.textContent = testString;\r\n }\r\n }\r\n _readFromDomElements() {\r\n for (let i = 0, len = this._requests.length; i < len; i++) {\r\n const request = this._requests[i];\r\n const testElement = this._testElements[i];\r\n request.fulfill(testElement.offsetWidth / 256);\r\n }\r\n }\r\n}\r\nexport function readCharWidths(bareFontInfo, requests) {\r\n const reader = new DomCharWidthReader(bareFontInfo, requests);\r\n reader.read();\r\n}\r\n", "/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License. See License.txt in the project root for license information.\r\n *--------------------------------------------------------------------------------------------*/\r\nimport { Disposable } from '../../../base/common/lifecycle.js';\r\nexport class ElementSizeObserver extends Disposable {\r\n constructor(referenceDomElement, dimension, changeCallback) {\r\n super();\r\n this.referenceDomElement = referenceDomElement;\r\n this.changeCallback = changeCallback;\r\n this.width = -1;\r\n this.height = -1;\r\n this.resizeObserver = null;\r\n this.measureReferenceDomElementToken = -1;\r\n this.measureReferenceDomElement(false, dimension);\r\n }\r\n dispose() {\r\n this.stopObserving();\r\n super.dispose();\r\n }\r\n getWidth() {\r\n return this.width;\r\n }\r\n getHeight() {\r\n return this.height;\r\n }\r\n startObserving() {\r\n if (typeof ResizeObserver !== 'undefined') {\r\n if (!this.resizeObserver && this.referenceDomElement) {\r\n this.resizeObserver = new ResizeObserver((entries) => {\r\n if (entries && entries[0] && entries[0].contentRect) {\r\n this.observe({ width: entries[0].contentRect.width, height: entries[0].contentRect.height });\r\n }\r\n else {\r\n this.observe();\r\n }\r\n });\r\n this.resizeObserver.observe(this.referenceDomElement);\r\n }\r\n }\r\n else {\r\n if (this.measureReferenceDomElementToken === -1) {\r\n // setInterval type defaults to NodeJS.Timeout instead of number, so specify it as a number\r\n this.measureReferenceDomElementToken = setInterval(() => this.observe(), 100);\r\n }\r\n }\r\n }\r\n stopObserving() {\r\n if (this.resizeObserver) {\r\n this.resizeObserver.disconnect();\r\n this.resizeObserver = null;\r\n }\r\n if (this.measureReferenceDomElementToken !== -1) {\r\n clearInterval(this.measureReferenceDomElementToken);\r\n this.measureReferenceDomElementToken = -1;\r\n }\r\n }\r\n observe(dimension) {\r\n this.measureReferenceDomElement(true, dimension);\r\n }\r\n measureReferenceDomElement(callChangeCallback, dimension) {\r\n let observedWidth = 0;\r\n let observedHeight = 0;\r\n if (dimension) {\r\n observedWidth = dimension.width;\r\n observedHeight = dimension.height;\r\n }\r\n else if (this.referenceDomElement) {\r\n observedWidth = this.referenceDomElement.clientWidth;\r\n observedHeight = this.referenceDomElement.clientHeight;\r\n }\r\n observedWidth = Math.max(5, observedWidth);\r\n observedHeight = Math.max(5, observedHeight);\r\n if (this.width !== observedWidth || this.height !== observedHeight) {\r\n this.width = observedWidth;\r\n this.height = observedHeight;\r\n if (callChangeCallback) {\r\n this.changeCallback();\r\n }\r\n }\r\n }\r\n}\r\n", "/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License. See License.txt in the project root for license information.\r\n *--------------------------------------------------------------------------------------------*/\r\nimport * as browser from '../../../base/browser/browser.js';\r\nimport { Emitter } from '../../../base/common/event.js';\r\nimport { Disposable } from '../../../base/common/lifecycle.js';\r\nimport * as platform from '../../../base/common/platform.js';\r\nimport { CharWidthRequest, readCharWidths } from './charWidthReader.js';\r\nimport { ElementSizeObserver } from './elementSizeObserver.js';\r\nimport { CommonEditorConfiguration } from '../../common/config/commonEditorConfig.js';\r\nimport { EditorFontLigatures } from '../../common/config/editorOptions.js';\r\nimport { FontInfo } from '../../common/config/fontInfo.js';\r\nclass CSSBasedConfigurationCache {\r\n constructor() {\r\n this._keys = Object.create(null);\r\n this._values = Object.create(null);\r\n }\r\n has(item) {\r\n const itemId = item.getId();\r\n return !!this._values[itemId];\r\n }\r\n get(item) {\r\n const itemId = item.getId();\r\n return this._values[itemId];\r\n }\r\n put(item, value) {\r\n const itemId = item.getId();\r\n this._keys[itemId] = item;\r\n this._values[itemId] = value;\r\n }\r\n remove(item) {\r\n const itemId = item.getId();\r\n delete this._keys[itemId];\r\n delete this._values[itemId];\r\n }\r\n getValues() {\r\n return Object.keys(this._keys).map(id => this._values[id]);\r\n }\r\n}\r\nexport function clearAllFontInfos() {\r\n CSSBasedConfiguration.INSTANCE.clearCache();\r\n}\r\nclass CSSBasedConfiguration extends Disposable {\r\n constructor() {\r\n super();\r\n this._onDidChange = this._register(new Emitter());\r\n this.onDidChange = this._onDidChange.event;\r\n this._cache = new CSSBasedConfigurationCache();\r\n this._evictUntrustedReadingsTimeout = -1;\r\n }\r\n dispose() {\r\n if (this._evictUntrustedReadingsTimeout !== -1) {\r\n clearTimeout(this._evictUntrustedReadingsTimeout);\r\n this._evictUntrustedReadingsTimeout = -1;\r\n }\r\n super.dispose();\r\n }\r\n clearCache() {\r\n this._cache = new CSSBasedConfigurationCache();\r\n this._onDidChange.fire();\r\n }\r\n _writeToCache(item, value) {\r\n this._cache.put(item, value);\r\n if (!value.isTrusted && this._evictUntrustedReadingsTimeout === -1) {\r\n // Try reading again after some time\r\n this._evictUntrustedReadingsTimeout = setTimeout(() => {\r\n this._evictUntrustedReadingsTimeout = -1;\r\n this._evictUntrustedReadings();\r\n }, 5000);\r\n }\r\n }\r\n _evictUntrustedReadings() {\r\n const values = this._cache.getValues();\r\n let somethingRemoved = false;\r\n for (const item of values) {\r\n if (!item.isTrusted) {\r\n somethingRemoved = true;\r\n this._cache.remove(item);\r\n }\r\n }\r\n if (somethingRemoved) {\r\n this._onDidChange.fire();\r\n }\r\n }\r\n readConfiguration(bareFontInfo) {\r\n if (!this._cache.has(bareFontInfo)) {\r\n let readConfig = CSSBasedConfiguration._actualReadConfiguration(bareFontInfo);\r\n if (readConfig.typicalHalfwidthCharacterWidth <= 2 || readConfig.typicalFullwidthCharacterWidth <= 2 || readConfig.spaceWidth <= 2 || readConfig.maxDigitWidth <= 2) {\r\n // Hey, it's Bug 14341 ... we couldn't read\r\n readConfig = new FontInfo({\r\n zoomLevel: browser.getZoomLevel(),\r\n pixelRatio: browser.getPixelRatio(),\r\n fontFamily: readConfig.fontFamily,\r\n fontWeight: readConfig.fontWeight,\r\n fontSize: readConfig.fontSize,\r\n fontFeatureSettings: readConfig.fontFeatureSettings,\r\n lineHeight: readConfig.lineHeight,\r\n letterSpacing: readConfig.letterSpacing,\r\n isMonospace: readConfig.isMonospace,\r\n typicalHalfwidthCharacterWidth: Math.max(readConfig.typicalHalfwidthCharacterWidth, 5),\r\n typicalFullwidthCharacterWidth: Math.max(readConfig.typicalFullwidthCharacterWidth, 5),\r\n canUseHalfwidthRightwardsArrow: readConfig.canUseHalfwidthRightwardsArrow,\r\n spaceWidth: Math.max(readConfig.spaceWidth, 5),\r\n middotWidth: Math.max(readConfig.middotWidth, 5),\r\n wsmiddotWidth: Math.max(readConfig.wsmiddotWidth, 5),\r\n maxDigitWidth: Math.max(readConfig.maxDigitWidth, 5),\r\n }, false);\r\n }\r\n this._writeToCache(bareFontInfo, readConfig);\r\n }\r\n return this._cache.get(bareFontInfo);\r\n }\r\n static createRequest(chr, type, all, monospace) {\r\n const result = new CharWidthRequest(chr, type);\r\n all.push(result);\r\n if (monospace) {\r\n monospace.push(result);\r\n }\r\n return result;\r\n }\r\n static _actualReadConfiguration(bareFontInfo) {\r\n const all = [];\r\n const monospace = [];\r\n const typicalHalfwidthCharacter = this.createRequest('n', 0 /* Regular */, all, monospace);\r\n const typicalFullwidthCharacter = this.createRequest('\\uff4d', 0 /* Regular */, all, null);\r\n const space = this.createRequest(' ', 0 /* Regular */, all, monospace);\r\n const digit0 = this.createRequest('0', 0 /* Regular */, all, monospace);\r\n const digit1 = this.createRequest('1', 0 /* Regular */, all, monospace);\r\n const digit2 = this.createRequest('2', 0 /* Regular */, all, monospace);\r\n const digit3 = this.createRequest('3', 0 /* Regular */, all, monospace);\r\n const digit4 = this.createRequest('4', 0 /* Regular */, all, monospace);\r\n const digit5 = this.createRequest('5', 0 /* Regular */, all, monospace);\r\n const digit6 = this.createRequest('6', 0 /* Regular */, all, monospace);\r\n const digit7 = this.createRequest('7', 0 /* Regular */, all, monospace);\r\n const digit8 = this.createRequest('8', 0 /* Regular */, all, monospace);\r\n const digit9 = this.createRequest('9', 0 /* Regular */, all, monospace);\r\n // monospace test: used for whitespace rendering\r\n const rightwardsArrow = this.createRequest('\u2192', 0 /* Regular */, all, monospace);\r\n const halfwidthRightwardsArrow = this.createRequest('\uFFEB', 0 /* Regular */, all, null);\r\n // U+00B7 - MIDDLE DOT\r\n const middot = this.createRequest('\u00B7', 0 /* Regular */, all, monospace);\r\n // U+2E31 - WORD SEPARATOR MIDDLE DOT\r\n const wsmiddotWidth = this.createRequest(String.fromCharCode(0x2E31), 0 /* Regular */, all, null);\r\n // monospace test: some characters\r\n this.createRequest('|', 0 /* Regular */, all, monospace);\r\n this.createRequest('/', 0 /* Regular */, all, monospace);\r\n this.createRequest('-', 0 /* Regular */, all, monospace);\r\n this.createRequest('_', 0 /* Regular */, all, monospace);\r\n this.createRequest('i', 0 /* Regular */, all, monospace);\r\n this.createRequest('l', 0 /* Regular */, all, monospace);\r\n this.createRequest('m', 0 /* Regular */, all, monospace);\r\n // monospace italic test\r\n this.createRequest('|', 1 /* Italic */, all, monospace);\r\n this.createRequest('_', 1 /* Italic */, all, monospace);\r\n this.createRequest('i', 1 /* Italic */, all, monospace);\r\n this.createRequest('l', 1 /* Italic */, all, monospace);\r\n this.createRequest('m', 1 /* Italic */, all, monospace);\r\n this.createRequest('n', 1 /* Italic */, all, monospace);\r\n // monospace bold test\r\n this.createRequest('|', 2 /* Bold */, all, monospace);\r\n this.createRequest('_', 2 /* Bold */, all, monospace);\r\n this.createRequest('i', 2 /* Bold */, all, monospace);\r\n this.createRequest('l', 2 /* Bold */, all, monospace);\r\n this.createRequest('m', 2 /* Bold */, all, monospace);\r\n this.createRequest('n', 2 /* Bold */, all, monospace);\r\n readCharWidths(bareFontInfo, all);\r\n const maxDigitWidth = Math.max(digit0.width, digit1.width, digit2.width, digit3.width, digit4.width, digit5.width, digit6.width, digit7.width, digit8.width, digit9.width);\r\n let isMonospace = (bareFontInfo.fontFeatureSettings === EditorFontLigatures.OFF);\r\n const referenceWidth = monospace[0].width;\r\n for (let i = 1, len = monospace.length; isMonospace && i < len; i++) {\r\n const diff = referenceWidth - monospace[i].width;\r\n if (diff < -0.001 || diff > 0.001) {\r\n isMonospace = false;\r\n break;\r\n }\r\n }\r\n let canUseHalfwidthRightwardsArrow = true;\r\n if (isMonospace && halfwidthRightwardsArrow.width !== referenceWidth) {\r\n // using a halfwidth rightwards arrow would break monospace...\r\n canUseHalfwidthRightwardsArrow = false;\r\n }\r\n if (halfwidthRightwardsArrow.width > rightwardsArrow.width) {\r\n // using a halfwidth rightwards arrow would paint a larger arrow than a regular rightwards arrow\r\n canUseHalfwidthRightwardsArrow = false;\r\n }\r\n // let's trust the zoom level only 2s after it was changed.\r\n const canTrustBrowserZoomLevel = (browser.getTimeSinceLastZoomLevelChanged() > 2000);\r\n return new FontInfo({\r\n zoomLevel: browser.getZoomLevel(),\r\n pixelRatio: browser.getPixelRatio(),\r\n fontFamily: bareFontInfo.fontFamily,\r\n fontWeight: bareFontInfo.fontWeight,\r\n fontSize: bareFontInfo.fontSize,\r\n fontFeatureSettings: bareFontInfo.fontFeatureSettings,\r\n lineHeight: bareFontInfo.lineHeight,\r\n letterSpacing: bareFontInfo.letterSpacing,\r\n isMonospace: isMonospace,\r\n typicalHalfwidthCharacterWidth: typicalHalfwidthCharacter.width,\r\n typicalFullwidthCharacterWidth: typicalFullwidthCharacter.width,\r\n canUseHalfwidthRightwardsArrow: canUseHalfwidthRightwardsArrow,\r\n spaceWidth: space.width,\r\n middotWidth: middot.width,\r\n wsmiddotWidth: wsmiddotWidth.width,\r\n maxDigitWidth: maxDigitWidth\r\n }, canTrustBrowserZoomLevel);\r\n }\r\n}\r\nCSSBasedConfiguration.INSTANCE = new CSSBasedConfiguration();\r\nexport class Configuration extends CommonEditorConfiguration {\r\n constructor(isSimpleWidget, options, referenceDomElement = null, accessibilityService) {\r\n super(isSimpleWidget, options);\r\n this.accessibilityService = accessibilityService;\r\n this._elementSizeObserver = this._register(new ElementSizeObserver(referenceDomElement, options.dimension, () => this._recomputeOptions()));\r\n this._register(CSSBasedConfiguration.INSTANCE.onDidChange(() => this._recomputeOptions()));\r\n if (this._validatedOptions.get(10 /* automaticLayout */)) {\r\n this._elementSizeObserver.startObserving();\r\n }\r\n this._register(browser.onDidChangeZoomLevel(_ => this._recomputeOptions()));\r\n this._register(this.accessibilityService.onDidChangeScreenReaderOptimized(() => this._recomputeOptions()));\r\n this._recomputeOptions();\r\n }\r\n static applyFontInfoSlow(domNode, fontInfo) {\r\n domNode.style.fontFamily = fontInfo.getMassagedFontFamily();\r\n domNode.style.fontWeight = fontInfo.fontWeight;\r\n domNode.style.fontSize = fontInfo.fontSize + 'px';\r\n domNode.style.fontFeatureSettings = fontInfo.fontFeatureSettings;\r\n domNode.style.lineHeight = fontInfo.lineHeight + 'px';\r\n domNode.style.letterSpacing = fontInfo.letterSpacing + 'px';\r\n }\r\n static applyFontInfo(domNode, fontInfo) {\r\n domNode.setFontFamily(fontInfo.getMassagedFontFamily());\r\n domNode.setFontWeight(fontInfo.fontWeight);\r\n domNode.setFontSize(fontInfo.fontSize);\r\n domNode.setFontFeatureSettings(fontInfo.fontFeatureSettings);\r\n domNode.setLineHeight(fontInfo.lineHeight);\r\n domNode.setLetterSpacing(fontInfo.letterSpacing);\r\n }\r\n observeReferenceElement(dimension) {\r\n this._elementSizeObserver.observe(dimension);\r\n }\r\n updatePixelRatio() {\r\n this._recomputeOptions();\r\n }\r\n static _getExtraEditorClassName() {\r\n let extra = '';\r\n if (!browser.isSafari && !browser.isWebkitWebView) {\r\n // Use user-select: none in all browsers except Safari and native macOS WebView\r\n extra += 'no-user-select ';\r\n }\r\n if (browser.isSafari) {\r\n // See https://github.com/microsoft/vscode/issues/108822\r\n extra += 'no-minimap-shadow ';\r\n }\r\n if (platform.isMacintosh) {\r\n extra += 'mac ';\r\n }\r\n return extra;\r\n }\r\n _getEnvConfiguration() {\r\n return {\r\n extraEditorClassName: Configuration._getExtraEditorClassName(),\r\n outerWidth: this._elementSizeObserver.getWidth(),\r\n outerHeight: this._elementSizeObserver.getHeight(),\r\n emptySelectionClipboard: browser.isWebKit || browser.isFirefox,\r\n pixelRatio: browser.getPixelRatio(),\r\n zoomLevel: browser.getZoomLevel(),\r\n accessibilitySupport: (this.accessibilityService.isScreenReaderOptimized()\r\n ? 2 /* Enabled */\r\n : this.accessibilityService.getAccessibilitySupport())\r\n };\r\n }\r\n readConfiguration(bareFontInfo) {\r\n return CSSBasedConfiguration.INSTANCE.readConfiguration(bareFontInfo);\r\n }\r\n}\r\n", "/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License. See License.txt in the project root for license information.\r\n *--------------------------------------------------------------------------------------------*/\r\nexport class FastDomNode {\r\n constructor(domNode) {\r\n this.domNode = domNode;\r\n this._maxWidth = -1;\r\n this._width = -1;\r\n this._height = -1;\r\n this._top = -1;\r\n this._left = -1;\r\n this._bottom = -1;\r\n this._right = -1;\r\n this._fontFamily = '';\r\n this._fontWeight = '';\r\n this._fontSize = -1;\r\n this._fontFeatureSettings = '';\r\n this._lineHeight = -1;\r\n this._letterSpacing = -100;\r\n this._className = '';\r\n this._display = '';\r\n this._position = '';\r\n this._visibility = '';\r\n this._backgroundColor = '';\r\n this._layerHint = false;\r\n this._contain = 'none';\r\n this._boxShadow = '';\r\n }\r\n setMaxWidth(maxWidth) {\r\n if (this._maxWidth === maxWidth) {\r\n return;\r\n }\r\n this._maxWidth = maxWidth;\r\n this.domNode.style.maxWidth = this._maxWidth + 'px';\r\n }\r\n setWidth(width) {\r\n if (this._width === width) {\r\n return;\r\n }\r\n this._width = width;\r\n this.domNode.style.width = this._width + 'px';\r\n }\r\n setHeight(height) {\r\n if (this._height === height) {\r\n return;\r\n }\r\n this._height = height;\r\n this.domNode.style.height = this._height + 'px';\r\n }\r\n setTop(top) {\r\n if (this._top === top) {\r\n return;\r\n }\r\n this._top = top;\r\n this.domNode.style.top = this._top + 'px';\r\n }\r\n unsetTop() {\r\n if (this._top === -1) {\r\n return;\r\n }\r\n this._top = -1;\r\n this.domNode.style.top = '';\r\n }\r\n setLeft(left) {\r\n if (this._left === left) {\r\n return;\r\n }\r\n this._left = left;\r\n this.domNode.style.left = this._left + 'px';\r\n }\r\n setBottom(bottom) {\r\n if (this._bottom === bottom) {\r\n return;\r\n }\r\n this._bottom = bottom;\r\n this.domNode.style.bottom = this._bottom + 'px';\r\n }\r\n setRight(right) {\r\n if (this._right === right) {\r\n return;\r\n }\r\n this._right = right;\r\n this.domNode.style.right = this._right + 'px';\r\n }\r\n setFontFamily(fontFamily) {\r\n if (this._fontFamily === fontFamily) {\r\n return;\r\n }\r\n this._fontFamily = fontFamily;\r\n this.domNode.style.fontFamily = this._fontFamily;\r\n }\r\n setFontWeight(fontWeight) {\r\n if (this._fontWeight === fontWeight) {\r\n return;\r\n }\r\n this._fontWeight = fontWeight;\r\n this.domNode.style.fontWeight = this._fontWeight;\r\n }\r\n setFontSize(fontSize) {\r\n if (this._fontSize === fontSize) {\r\n return;\r\n }\r\n this._fontSize = fontSize;\r\n this.domNode.style.fontSize = this._fontSize + 'px';\r\n }\r\n setFontFeatureSettings(fontFeatureSettings) {\r\n if (this._fontFeatureSettings === fontFeatureSettings) {\r\n return;\r\n }\r\n this._fontFeatureSettings = fontFeatureSettings;\r\n this.domNode.style.fontFeatureSettings = this._fontFeatureSettings;\r\n }\r\n setLineHeight(lineHeight) {\r\n if (this._lineHeight === lineHeight) {\r\n return;\r\n }\r\n this._lineHeight = lineHeight;\r\n this.domNode.style.lineHeight = this._lineHeight + 'px';\r\n }\r\n setLetterSpacing(letterSpacing) {\r\n if (this._letterSpacing === letterSpacing) {\r\n return;\r\n }\r\n this._letterSpacing = letterSpacing;\r\n this.domNode.style.letterSpacing = this._letterSpacing + 'px';\r\n }\r\n setClassName(className) {\r\n if (this._className === className) {\r\n return;\r\n }\r\n this._className = className;\r\n this.domNode.className = this._className;\r\n }\r\n toggleClassName(className, shouldHaveIt) {\r\n this.domNode.classList.toggle(className, shouldHaveIt);\r\n this._className = this.domNode.className;\r\n }\r\n setDisplay(display) {\r\n if (this._display === display) {\r\n return;\r\n }\r\n this._display = display;\r\n this.domNode.style.display = this._display;\r\n }\r\n setPosition(position) {\r\n if (this._position === position) {\r\n return;\r\n }\r\n this._position = position;\r\n this.domNode.style.position = this._position;\r\n }\r\n setVisibility(visibility) {\r\n if (this._visibility === visibility) {\r\n return;\r\n }\r\n this._visibility = visibility;\r\n this.domNode.style.visibility = this._visibility;\r\n }\r\n setBackgroundColor(backgroundColor) {\r\n if (this._backgroundColor === backgroundColor) {\r\n return;\r\n }\r\n this._backgroundColor = backgroundColor;\r\n this.domNode.style.backgroundColor = this._backgroundColor;\r\n }\r\n setLayerHinting(layerHint) {\r\n if (this._layerHint === layerHint) {\r\n return;\r\n }\r\n this._layerHint = layerHint;\r\n this.domNode.style.transform = this._layerHint ? 'translate3d(0px, 0px, 0px)' : '';\r\n }\r\n setBoxShadow(boxShadow) {\r\n if (this._boxShadow === boxShadow) {\r\n return;\r\n }\r\n this._boxShadow = boxShadow;\r\n this.domNode.style.boxShadow = boxShadow;\r\n }\r\n setContain(contain) {\r\n if (this._contain === contain) {\r\n return;\r\n }\r\n this._contain = contain;\r\n this.domNode.style.contain = this._contain;\r\n }\r\n setAttribute(name, value) {\r\n this.domNode.setAttribute(name, value);\r\n }\r\n removeAttribute(name) {\r\n this.domNode.removeAttribute(name);\r\n }\r\n appendChild(child) {\r\n this.domNode.appendChild(child.domNode);\r\n }\r\n removeChild(child) {\r\n this.domNode.removeChild(child.domNode);\r\n }\r\n}\r\nexport function createFastDomNode(domNode) {\r\n return new FastDomNode(domNode);\r\n}\r\n", "export function memoize(_target, key, descriptor) {\r\n let fnKey = null;\r\n let fn = null;\r\n if (typeof descriptor.value === 'function') {\r\n fnKey = 'value';\r\n fn = descriptor.value;\r\n if (fn.length !== 0) {\r\n console.warn('Memoize should only be used in functions with zero parameters');\r\n }\r\n }\r\n else if (typeof descriptor.get === 'function') {\r\n fnKey = 'get';\r\n fn = descriptor.get;\r\n }\r\n if (!fn) {\r\n throw new Error('not supported');\r\n }\r\n const memoizeKey = `$memoize$${key}`;\r\n descriptor[fnKey] = function (...args) {\r\n if (!this.hasOwnProperty(memoizeKey)) {\r\n Object.defineProperty(this, memoizeKey, {\r\n configurable: false,\r\n enumerable: false,\r\n writable: false,\r\n value: fn.apply(this, args)\r\n });\r\n }\r\n return this[memoizeKey];\r\n };\r\n}\r\n", "/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License. See License.txt in the project root for license information.\r\n *--------------------------------------------------------------------------------------------*/\r\nvar __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n};\r\nimport * as arrays from '../common/arrays.js';\r\nimport { Disposable } from '../common/lifecycle.js';\r\nimport * as DomUtils from './dom.js';\r\nimport { memoize } from '../common/decorators.js';\r\nexport var EventType;\r\n(function (EventType) {\r\n EventType.Tap = '-monaco-gesturetap';\r\n EventType.Change = '-monaco-gesturechange';\r\n EventType.Start = '-monaco-gesturestart';\r\n EventType.End = '-monaco-gesturesend';\r\n EventType.Contextmenu = '-monaco-gesturecontextmenu';\r\n})(EventType || (EventType = {}));\r\nexport class Gesture extends Disposable {\r\n constructor() {\r\n super();\r\n this.dispatched = false;\r\n this.activeTouches = {};\r\n this.handle = null;\r\n this.targets = [];\r\n this.ignoreTargets = [];\r\n this._lastSetTapCountTime = 0;\r\n this._register(DomUtils.addDisposableListener(document, 'touchstart', (e) => this.onTouchStart(e), { passive: false }));\r\n this._register(DomUtils.addDisposableListener(document, 'touchend', (e) => this.onTouchEnd(e)));\r\n this._register(DomUtils.addDisposableListener(document, 'touchmove', (e) => this.onTouchMove(e), { passive: false }));\r\n }\r\n static addTarget(element) {\r\n if (!Gesture.isTouchDevice()) {\r\n return Disposable.None;\r\n }\r\n if (!Gesture.INSTANCE) {\r\n Gesture.INSTANCE = new Gesture();\r\n }\r\n Gesture.INSTANCE.targets.push(element);\r\n return {\r\n dispose: () => {\r\n Gesture.INSTANCE.targets = Gesture.INSTANCE.targets.filter(t => t !== element);\r\n }\r\n };\r\n }\r\n static ignoreTarget(element) {\r\n if (!Gesture.isTouchDevice()) {\r\n return Disposable.None;\r\n }\r\n if (!Gesture.INSTANCE) {\r\n Gesture.INSTANCE = new Gesture();\r\n }\r\n Gesture.INSTANCE.ignoreTargets.push(element);\r\n return {\r\n dispose: () => {\r\n Gesture.INSTANCE.ignoreTargets = Gesture.INSTANCE.ignoreTargets.filter(t => t !== element);\r\n }\r\n };\r\n }\r\n static isTouchDevice() {\r\n // `'ontouchstart' in window` always evaluates to true with typescript's modern typings. This causes `window` to be\r\n // `never` later in `window.navigator`. That's why we need the explicit `window as Window` cast\r\n return 'ontouchstart' in window || navigator.maxTouchPoints > 0;\r\n }\r\n dispose() {\r\n if (this.handle) {\r\n this.handle.dispose();\r\n this.handle = null;\r\n }\r\n super.dispose();\r\n }\r\n onTouchStart(e) {\r\n let timestamp = Date.now(); // use Date.now() because on FF e.timeStamp is not epoch based.\r\n if (this.handle) {\r\n this.handle.dispose();\r\n this.handle = null;\r\n }\r\n for (let i = 0, len = e.targetTouches.length; i < len; i++) {\r\n let touch = e.targetTouches.item(i);\r\n this.activeTouches[touch.identifier] = {\r\n id: touch.identifier,\r\n initialTarget: touch.target,\r\n initialTimeStamp: timestamp,\r\n initialPageX: touch.pageX,\r\n initialPageY: touch.pageY,\r\n rollingTimestamps: [timestamp],\r\n rollingPageX: [touch.pageX],\r\n rollingPageY: [touch.pageY]\r\n };\r\n let evt = this.newGestureEvent(EventType.Start, touch.target);\r\n evt.pageX = touch.pageX;\r\n evt.pageY = touch.pageY;\r\n this.dispatchEvent(evt);\r\n }\r\n if (this.dispatched) {\r\n e.preventDefault();\r\n e.stopPropagation();\r\n this.dispatched = false;\r\n }\r\n }\r\n onTouchEnd(e) {\r\n let timestamp = Date.now(); // use Date.now() because on FF e.timeStamp is not epoch based.\r\n let activeTouchCount = Object.keys(this.activeTouches).length;\r\n for (let i = 0, len = e.changedTouches.length; i < len; i++) {\r\n let touch = e.changedTouches.item(i);\r\n if (!this.activeTouches.hasOwnProperty(String(touch.identifier))) {\r\n console.warn('move of an UNKNOWN touch', touch);\r\n continue;\r\n }\r\n let data = this.activeTouches[touch.identifier], holdTime = Date.now() - data.initialTimeStamp;\r\n if (holdTime < Gesture.HOLD_DELAY\r\n && Math.abs(data.initialPageX - arrays.tail(data.rollingPageX)) < 30\r\n && Math.abs(data.initialPageY - arrays.tail(data.rollingPageY)) < 30) {\r\n let evt = this.newGestureEvent(EventType.Tap, data.initialTarget);\r\n evt.pageX = arrays.tail(data.rollingPageX);\r\n evt.pageY = arrays.tail(data.rollingPageY);\r\n this.dispatchEvent(evt);\r\n }\r\n else if (holdTime >= Gesture.HOLD_DELAY\r\n && Math.abs(data.initialPageX - arrays.tail(data.rollingPageX)) < 30\r\n && Math.abs(data.initialPageY - arrays.tail(data.rollingPageY)) < 30) {\r\n let evt = this.newGestureEvent(EventType.Contextmenu, data.initialTarget);\r\n evt.pageX = arrays.tail(data.rollingPageX);\r\n evt.pageY = arrays.tail(data.rollingPageY);\r\n this.dispatchEvent(evt);\r\n }\r\n else if (activeTouchCount === 1) {\r\n let finalX = arrays.tail(data.rollingPageX);\r\n let finalY = arrays.tail(data.rollingPageY);\r\n let deltaT = arrays.tail(data.rollingTimestamps) - data.rollingTimestamps[0];\r\n let deltaX = finalX - data.rollingPageX[0];\r\n let deltaY = finalY - data.rollingPageY[0];\r\n // We need to get all the dispatch targets on the start of the inertia event\r\n const dispatchTo = this.targets.filter(t => data.initialTarget instanceof Node && t.contains(data.initialTarget));\r\n this.inertia(dispatchTo, timestamp, // time now\r\n Math.abs(deltaX) / deltaT, // speed\r\n deltaX > 0 ? 1 : -1, // x direction\r\n finalX, // x now\r\n Math.abs(deltaY) / deltaT, // y speed\r\n deltaY > 0 ? 1 : -1, // y direction\r\n finalY // y now\r\n );\r\n }\r\n this.dispatchEvent(this.newGestureEvent(EventType.End, data.initialTarget));\r\n // forget about this touch\r\n delete this.activeTouches[touch.identifier];\r\n }\r\n if (this.dispatched) {\r\n e.preventDefault();\r\n e.stopPropagation();\r\n this.dispatched = false;\r\n }\r\n }\r\n newGestureEvent(type, initialTarget) {\r\n let event = document.createEvent('CustomEvent');\r\n event.initEvent(type, false, true);\r\n event.initialTarget = initialTarget;\r\n event.tapCount = 0;\r\n return event;\r\n }\r\n dispatchEvent(event) {\r\n if (event.type === EventType.Tap) {\r\n const currentTime = (new Date()).getTime();\r\n let setTapCount = 0;\r\n if (currentTime - this._lastSetTapCountTime > Gesture.CLEAR_TAP_COUNT_TIME) {\r\n setTapCount = 1;\r\n }\r\n else {\r\n setTapCount = 2;\r\n }\r\n this._lastSetTapCountTime = currentTime;\r\n event.tapCount = setTapCount;\r\n }\r\n else if (event.type === EventType.Change || event.type === EventType.Contextmenu) {\r\n // tap is canceled by scrolling or context menu\r\n this._lastSetTapCountTime = 0;\r\n }\r\n for (let i = 0; i < this.ignoreTargets.length; i++) {\r\n if (event.initialTarget instanceof Node && this.ignoreTargets[i].contains(event.initialTarget)) {\r\n return;\r\n }\r\n }\r\n this.targets.forEach(target => {\r\n if (event.initialTarget instanceof Node && target.contains(event.initialTarget)) {\r\n target.dispatchEvent(event);\r\n this.dispatched = true;\r\n }\r\n });\r\n }\r\n inertia(dispatchTo, t1, vX, dirX, x, vY, dirY, y) {\r\n this.handle = DomUtils.scheduleAtNextAnimationFrame(() => {\r\n let now = Date.now();\r\n // velocity: old speed + accel_over_time\r\n let deltaT = now - t1, delta_pos_x = 0, delta_pos_y = 0, stopped = true;\r\n vX += Gesture.SCROLL_FRICTION * deltaT;\r\n vY += Gesture.SCROLL_FRICTION * deltaT;\r\n if (vX > 0) {\r\n stopped = false;\r\n delta_pos_x = dirX * vX * deltaT;\r\n }\r\n if (vY > 0) {\r\n stopped = false;\r\n delta_pos_y = dirY * vY * deltaT;\r\n }\r\n // dispatch translation event\r\n let evt = this.newGestureEvent(EventType.Change);\r\n evt.translationX = delta_pos_x;\r\n evt.translationY = delta_pos_y;\r\n dispatchTo.forEach(d => d.dispatchEvent(evt));\r\n if (!stopped) {\r\n this.inertia(dispatchTo, now, vX, dirX, x + delta_pos_x, vY, dirY, y + delta_pos_y);\r\n }\r\n });\r\n }\r\n onTouchMove(e) {\r\n let timestamp = Date.now(); // use Date.now() because on FF e.timeStamp is not epoch based.\r\n for (let i = 0, len = e.changedTouches.length; i < len; i++) {\r\n let touch = e.changedTouches.item(i);\r\n if (!this.activeTouches.hasOwnProperty(String(touch.identifier))) {\r\n console.warn('end of an UNKNOWN touch', touch);\r\n continue;\r\n }\r\n let data = this.activeTouches[touch.identifier];\r\n let evt = this.newGestureEvent(EventType.Change, data.initialTarget);\r\n evt.translationX = touch.pageX - arrays.tail(data.rollingPageX);\r\n evt.translationY = touch.pageY - arrays.tail(data.rollingPageY);\r\n evt.pageX = touch.pageX;\r\n evt.pageY = touch.pageY;\r\n this.dispatchEvent(evt);\r\n // only keep a few data points, to average the final speed\r\n if (data.rollingPageX.length > 3) {\r\n data.rollingPageX.shift();\r\n data.rollingPageY.shift();\r\n data.rollingTimestamps.shift();\r\n }\r\n data.rollingPageX.push(touch.pageX);\r\n data.rollingPageY.push(touch.pageY);\r\n data.rollingTimestamps.push(timestamp);\r\n }\r\n if (this.dispatched) {\r\n e.preventDefault();\r\n e.stopPropagation();\r\n this.dispatched = false;\r\n }\r\n }\r\n}\r\nGesture.SCROLL_FRICTION = -0.005;\r\nGesture.HOLD_DELAY = 700;\r\nGesture.CLEAR_TAP_COUNT_TIME = 400; // ms\r\n__decorate([\r\n memoize\r\n], Gesture, \"isTouchDevice\", null);\r\n", "/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License. See License.txt in the project root for license information.\r\n *--------------------------------------------------------------------------------------------*/\r\nimport * as dom from './dom.js';\r\nimport { IframeUtils } from './iframe.js';\r\nimport { StandardMouseEvent } from './mouseEvent.js';\r\nimport { DisposableStore } from '../common/lifecycle.js';\r\nimport { isIOS } from '../common/platform.js';\r\nexport function standardMouseMoveMerger(lastEvent, currentEvent) {\r\n let ev = new StandardMouseEvent(currentEvent);\r\n ev.preventDefault();\r\n return {\r\n leftButton: ev.leftButton,\r\n buttons: ev.buttons,\r\n posx: ev.posx,\r\n posy: ev.posy\r\n };\r\n}\r\nexport class GlobalMouseMoveMonitor {\r\n constructor() {\r\n this._hooks = new DisposableStore();\r\n this._mouseMoveEventMerger = null;\r\n this._mouseMoveCallback = null;\r\n this._onStopCallback = null;\r\n }\r\n dispose() {\r\n this.stopMonitoring(false);\r\n this._hooks.dispose();\r\n }\r\n stopMonitoring(invokeStopCallback, browserEvent) {\r\n if (!this.isMonitoring()) {\r\n // Not monitoring\r\n return;\r\n }\r\n // Unhook\r\n this._hooks.clear();\r\n this._mouseMoveEventMerger = null;\r\n this._mouseMoveCallback = null;\r\n const onStopCallback = this._onStopCallback;\r\n this._onStopCallback = null;\r\n if (invokeStopCallback && onStopCallback) {\r\n onStopCallback(browserEvent);\r\n }\r\n }\r\n isMonitoring() {\r\n return !!this._mouseMoveEventMerger;\r\n }\r\n startMonitoring(initialElement, initialButtons, mouseMoveEventMerger, mouseMoveCallback, onStopCallback) {\r\n if (this.isMonitoring()) {\r\n // I am already hooked\r\n return;\r\n }\r\n this._mouseMoveEventMerger = mouseMoveEventMerger;\r\n this._mouseMoveCallback = mouseMoveCallback;\r\n this._onStopCallback = onStopCallback;\r\n const windowChain = IframeUtils.getSameOriginWindowChain();\r\n const mouseMove = isIOS ? 'pointermove' : 'mousemove'; // Safari sends wrong event, workaround for #122653\r\n const mouseUp = 'mouseup';\r\n const listenTo = windowChain.map(element => element.window.document);\r\n const shadowRoot = dom.getShadowRoot(initialElement);\r\n if (shadowRoot) {\r\n listenTo.unshift(shadowRoot);\r\n }\r\n for (const element of listenTo) {\r\n this._hooks.add(dom.addDisposableThrottledListener(element, mouseMove, (data) => {\r\n if (data.buttons !== initialButtons) {\r\n // Buttons state has changed in the meantime\r\n this.stopMonitoring(true);\r\n return;\r\n }\r\n this._mouseMoveCallback(data);\r\n }, (lastEvent, currentEvent) => this._mouseMoveEventMerger(lastEvent, currentEvent)));\r\n this._hooks.add(dom.addDisposableListener(element, mouseUp, (e) => this.stopMonitoring(true)));\r\n }\r\n if (IframeUtils.hasDifferentOriginAncestor()) {\r\n let lastSameOriginAncestor = windowChain[windowChain.length - 1];\r\n // We might miss a mouse up if it happens outside the iframe\r\n // This one is for Chrome\r\n this._hooks.add(dom.addDisposableListener(lastSameOriginAncestor.window.document, 'mouseout', (browserEvent) => {\r\n let e = new StandardMouseEvent(browserEvent);\r\n if (e.target.tagName.toLowerCase() === 'html') {\r\n this.stopMonitoring(true);\r\n }\r\n }));\r\n // This one is for FF\r\n this._hooks.add(dom.addDisposableListener(lastSameOriginAncestor.window.document, 'mouseover', (browserEvent) => {\r\n let e = new StandardMouseEvent(browserEvent);\r\n if (e.target.tagName.toLowerCase() === 'html') {\r\n this.stopMonitoring(true);\r\n }\r\n }));\r\n // This one is for IE\r\n this._hooks.add(dom.addDisposableListener(lastSameOriginAncestor.window.document.body, 'mouseleave', (browserEvent) => {\r\n this.stopMonitoring(true);\r\n }));\r\n }\r\n }\r\n}\r\n", "/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License. See License.txt in the project root for license information.\r\n *--------------------------------------------------------------------------------------------*/\r\nimport * as dom from '../../base/browser/dom.js';\r\nimport { GlobalMouseMoveMonitor } from '../../base/browser/globalMouseMoveMonitor.js';\r\nimport { StandardMouseEvent } from '../../base/browser/mouseEvent.js';\r\nimport { Disposable } from '../../base/common/lifecycle.js';\r\n/**\r\n * Coordinates relative to the whole document (e.g. mouse event's pageX and pageY)\r\n */\r\nexport class PageCoordinates {\r\n constructor(x, y) {\r\n this.x = x;\r\n this.y = y;\r\n this._pageCoordinatesBrand = undefined;\r\n }\r\n toClientCoordinates() {\r\n return new ClientCoordinates(this.x - dom.StandardWindow.scrollX, this.y - dom.StandardWindow.scrollY);\r\n }\r\n}\r\n/**\r\n * Coordinates within the application's client area (i.e. origin is document's scroll position).\r\n *\r\n * For example, clicking in the top-left corner of the client area will\r\n * always result in a mouse event with a client.x value of 0, regardless\r\n * of whether the page is scrolled horizontally.\r\n */\r\nexport class ClientCoordinates {\r\n constructor(clientX, clientY) {\r\n this.clientX = clientX;\r\n this.clientY = clientY;\r\n this._clientCoordinatesBrand = undefined;\r\n }\r\n toPageCoordinates() {\r\n return new PageCoordinates(this.clientX + dom.StandardWindow.scrollX, this.clientY + dom.StandardWindow.scrollY);\r\n }\r\n}\r\n/**\r\n * The position of the editor in the page.\r\n */\r\nexport class EditorPagePosition {\r\n constructor(x, y, width, height) {\r\n this.x = x;\r\n this.y = y;\r\n this.width = width;\r\n this.height = height;\r\n this._editorPagePositionBrand = undefined;\r\n }\r\n}\r\nexport function createEditorPagePosition(editorViewDomNode) {\r\n const editorPos = dom.getDomNodePagePosition(editorViewDomNode);\r\n return new EditorPagePosition(editorPos.left, editorPos.top, editorPos.width, editorPos.height);\r\n}\r\nexport class EditorMouseEvent extends StandardMouseEvent {\r\n constructor(e, editorViewDomNode) {\r\n super(e);\r\n this._editorMouseEventBrand = undefined;\r\n this.pos = new PageCoordinates(this.posx, this.posy);\r\n this.editorPos = createEditorPagePosition(editorViewDomNode);\r\n }\r\n}\r\nexport class EditorMouseEventFactory {\r\n constructor(editorViewDomNode) {\r\n this._editorViewDomNode = editorViewDomNode;\r\n }\r\n _create(e) {\r\n return new EditorMouseEvent(e, this._editorViewDomNode);\r\n }\r\n onContextMenu(target, callback) {\r\n return dom.addDisposableListener(target, 'contextmenu', (e) => {\r\n callback(this._create(e));\r\n });\r\n }\r\n onMouseUp(target, callback) {\r\n return dom.addDisposableListener(target, 'mouseup', (e) => {\r\n callback(this._create(e));\r\n });\r\n }\r\n onMouseDown(target, callback) {\r\n return dom.addDisposableListener(target, 'mousedown', (e) => {\r\n callback(this._create(e));\r\n });\r\n }\r\n onMouseLeave(target, callback) {\r\n return dom.addDisposableNonBubblingMouseOutListener(target, (e) => {\r\n callback(this._create(e));\r\n });\r\n }\r\n onMouseMoveThrottled(target, callback, merger, minimumTimeMs) {\r\n const myMerger = (lastEvent, currentEvent) => {\r\n return merger(lastEvent, this._create(currentEvent));\r\n };\r\n return dom.addDisposableThrottledListener(target, 'mousemove', callback, myMerger, minimumTimeMs);\r\n }\r\n}\r\nexport class EditorPointerEventFactory {\r\n constructor(editorViewDomNode) {\r\n this._editorViewDomNode = editorViewDomNode;\r\n }\r\n _create(e) {\r\n return new EditorMouseEvent(e, this._editorViewDomNode);\r\n }\r\n onPointerUp(target, callback) {\r\n return dom.addDisposableListener(target, 'pointerup', (e) => {\r\n callback(this._create(e));\r\n });\r\n }\r\n onPointerDown(target, callback) {\r\n return dom.addDisposableListener(target, 'pointerdown', (e) => {\r\n callback(this._create(e));\r\n });\r\n }\r\n onPointerLeave(target, callback) {\r\n return dom.addDisposableNonBubblingPointerOutListener(target, (e) => {\r\n callback(this._create(e));\r\n });\r\n }\r\n onPointerMoveThrottled(target, callback, merger, minimumTimeMs) {\r\n const myMerger = (lastEvent, currentEvent) => {\r\n return merger(lastEvent, this._create(currentEvent));\r\n };\r\n return dom.addDisposableThrottledListener(target, 'pointermove', callback, myMerger, minimumTimeMs);\r\n }\r\n}\r\nexport class GlobalEditorMouseMoveMonitor extends Disposable {\r\n constructor(editorViewDomNode) {\r\n super();\r\n this._editorViewDomNode = editorViewDomNode;\r\n this._globalMouseMoveMonitor = this._register(new GlobalMouseMoveMonitor());\r\n this._keydownListener = null;\r\n }\r\n startMonitoring(initialElement, initialButtons, merger, mouseMoveCallback, onStopCallback) {\r\n // Add a <> keydown event listener that will cancel the monitoring\r\n // if something other than a modifier key is pressed\r\n this._keydownListener = dom.addStandardDisposableListener(document, 'keydown', (e) => {\r\n const kb = e.toKeybinding();\r\n if (kb.isModifierKey()) {\r\n // Allow modifier keys\r\n return;\r\n }\r\n this._globalMouseMoveMonitor.stopMonitoring(true, e.browserEvent);\r\n }, true);\r\n const myMerger = (lastEvent, currentEvent) => {\r\n return merger(lastEvent, new EditorMouseEvent(currentEvent, this._editorViewDomNode));\r\n };\r\n this._globalMouseMoveMonitor.startMonitoring(initialElement, initialButtons, myMerger, mouseMoveCallback, (e) => {\r\n this._keydownListener.dispose();\r\n onStopCallback(e);\r\n });\r\n }\r\n stopMonitoring() {\r\n this._globalMouseMoveMonitor.stopMonitoring(true);\r\n }\r\n}\r\n", "/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License. See License.txt in the project root for license information.\r\n *--------------------------------------------------------------------------------------------*/\r\nimport { Disposable } from '../../../base/common/lifecycle.js';\r\nexport class ViewEventHandler extends Disposable {\r\n constructor() {\r\n super();\r\n this._shouldRender = true;\r\n }\r\n shouldRender() {\r\n return this._shouldRender;\r\n }\r\n forceShouldRender() {\r\n this._shouldRender = true;\r\n }\r\n setShouldRender() {\r\n this._shouldRender = true;\r\n }\r\n onDidRender() {\r\n this._shouldRender = false;\r\n }\r\n // --- begin event handlers\r\n onCompositionStart(e) {\r\n return false;\r\n }\r\n onCompositionEnd(e) {\r\n return false;\r\n }\r\n onConfigurationChanged(e) {\r\n return false;\r\n }\r\n onCursorStateChanged(e) {\r\n return false;\r\n }\r\n onDecorationsChanged(e) {\r\n return false;\r\n }\r\n onFlushed(e) {\r\n return false;\r\n }\r\n onFocusChanged(e) {\r\n return false;\r\n }\r\n onLanguageConfigurationChanged(e) {\r\n return false;\r\n }\r\n onLineMappingChanged(e) {\r\n return false;\r\n }\r\n onLinesChanged(e) {\r\n return false;\r\n }\r\n onLinesDeleted(e) {\r\n return false;\r\n }\r\n onLinesInserted(e) {\r\n return false;\r\n }\r\n onRevealRangeRequest(e) {\r\n return false;\r\n }\r\n onScrollChanged(e) {\r\n return false;\r\n }\r\n onThemeChanged(e) {\r\n return false;\r\n }\r\n onTokensChanged(e) {\r\n return false;\r\n }\r\n onTokensColorsChanged(e) {\r\n return false;\r\n }\r\n onZonesChanged(e) {\r\n return false;\r\n }\r\n // --- end event handlers\r\n handleEvents(events) {\r\n let shouldRender = false;\r\n for (let i = 0, len = events.length; i < len; i++) {\r\n let e = events[i];\r\n switch (e.type) {\r\n case 0 /* ViewCompositionStart */:\r\n if (this.onCompositionStart(e)) {\r\n shouldRender = true;\r\n }\r\n break;\r\n case 1 /* ViewCompositionEnd */:\r\n if (this.onCompositionEnd(e)) {\r\n shouldRender = true;\r\n }\r\n break;\r\n case 2 /* ViewConfigurationChanged */:\r\n if (this.onConfigurationChanged(e)) {\r\n shouldRender = true;\r\n }\r\n break;\r\n case 3 /* ViewCursorStateChanged */:\r\n if (this.onCursorStateChanged(e)) {\r\n shouldRender = true;\r\n }\r\n break;\r\n case 4 /* ViewDecorationsChanged */:\r\n if (this.onDecorationsChanged(e)) {\r\n shouldRender = true;\r\n }\r\n break;\r\n case 5 /* ViewFlushed */:\r\n if (this.onFlushed(e)) {\r\n shouldRender = true;\r\n }\r\n break;\r\n case 6 /* ViewFocusChanged */:\r\n if (this.onFocusChanged(e)) {\r\n shouldRender = true;\r\n }\r\n break;\r\n case 7 /* ViewLanguageConfigurationChanged */:\r\n if (this.onLanguageConfigurationChanged(e)) {\r\n shouldRender = true;\r\n }\r\n break;\r\n case 8 /* ViewLineMappingChanged */:\r\n if (this.onLineMappingChanged(e)) {\r\n shouldRender = true;\r\n }\r\n break;\r\n case 9 /* ViewLinesChanged */:\r\n if (this.onLinesChanged(e)) {\r\n shouldRender = true;\r\n }\r\n break;\r\n case 10 /* ViewLinesDeleted */:\r\n if (this.onLinesDeleted(e)) {\r\n shouldRender = true;\r\n }\r\n break;\r\n case 11 /* ViewLinesInserted */:\r\n if (this.onLinesInserted(e)) {\r\n shouldRender = true;\r\n }\r\n break;\r\n case 12 /* ViewRevealRangeRequest */:\r\n if (this.onRevealRangeRequest(e)) {\r\n shouldRender = true;\r\n }\r\n break;\r\n case 13 /* ViewScrollChanged */:\r\n if (this.onScrollChanged(e)) {\r\n shouldRender = true;\r\n }\r\n break;\r\n case 15 /* ViewTokensChanged */:\r\n if (this.onTokensChanged(e)) {\r\n shouldRender = true;\r\n }\r\n break;\r\n case 14 /* ViewThemeChanged */:\r\n if (this.onThemeChanged(e)) {\r\n shouldRender = true;\r\n }\r\n break;\r\n case 16 /* ViewTokensColorsChanged */:\r\n if (this.onTokensColorsChanged(e)) {\r\n shouldRender = true;\r\n }\r\n break;\r\n case 17 /* ViewZonesChanged */:\r\n if (this.onZonesChanged(e)) {\r\n shouldRender = true;\r\n }\r\n break;\r\n default:\r\n console.info('View received unknown event: ');\r\n console.info(e);\r\n }\r\n }\r\n if (shouldRender) {\r\n this._shouldRender = true;\r\n }\r\n }\r\n}\r\n", "/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License. See License.txt in the project root for license information.\r\n *--------------------------------------------------------------------------------------------*/\r\nimport { FastDomNode } from '../../../base/browser/fastDomNode.js';\r\nimport { ViewEventHandler } from '../../common/viewModel/viewEventHandler.js';\r\nexport class ViewPart extends ViewEventHandler {\r\n constructor(context) {\r\n super();\r\n this._context = context;\r\n this._context.addEventHandler(this);\r\n }\r\n dispose() {\r\n this._context.removeEventHandler(this);\r\n super.dispose();\r\n }\r\n}\r\nexport class PartFingerprints {\r\n static write(target, partId) {\r\n if (target instanceof FastDomNode) {\r\n target.setAttribute('data-mprt', String(partId));\r\n }\r\n else {\r\n target.setAttribute('data-mprt', String(partId));\r\n }\r\n }\r\n static read(target) {\r\n const r = target.getAttribute('data-mprt');\r\n if (r === null) {\r\n return 0 /* None */;\r\n }\r\n return parseInt(r, 10);\r\n }\r\n static collect(child, stopAt) {\r\n let result = [], resultLen = 0;\r\n while (child && child !== document.body) {\r\n if (child === stopAt) {\r\n break;\r\n }\r\n if (child.nodeType === child.ELEMENT_NODE) {\r\n result[resultLen++] = this.read(child);\r\n }\r\n child = child.parentElement;\r\n }\r\n const r = new Uint8Array(resultLen);\r\n for (let i = 0; i < resultLen; i++) {\r\n r[i] = result[resultLen - i - 1];\r\n }\r\n return r;\r\n }\r\n}\r\n", "/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License. See License.txt in the project root for license information.\r\n *--------------------------------------------------------------------------------------------*/\r\nexport class RestrictedRenderingContext {\r\n constructor(viewLayout, viewportData) {\r\n this._restrictedRenderingContextBrand = undefined;\r\n this._viewLayout = viewLayout;\r\n this.viewportData = viewportData;\r\n this.scrollWidth = this._viewLayout.getScrollWidth();\r\n this.scrollHeight = this._viewLayout.getScrollHeight();\r\n this.visibleRange = this.viewportData.visibleRange;\r\n this.bigNumbersDelta = this.viewportData.bigNumbersDelta;\r\n const vInfo = this._viewLayout.getCurrentViewport();\r\n this.scrollTop = vInfo.top;\r\n this.scrollLeft = vInfo.left;\r\n this.viewportWidth = vInfo.width;\r\n this.viewportHeight = vInfo.height;\r\n }\r\n getScrolledTopFromAbsoluteTop(absoluteTop) {\r\n return absoluteTop - this.scrollTop;\r\n }\r\n getVerticalOffsetForLineNumber(lineNumber) {\r\n return this._viewLayout.getVerticalOffsetForLineNumber(lineNumber);\r\n }\r\n getDecorationsInViewport() {\r\n return this.viewportData.getDecorationsInViewport();\r\n }\r\n}\r\nexport class RenderingContext extends RestrictedRenderingContext {\r\n constructor(viewLayout, viewportData, viewLines) {\r\n super(viewLayout, viewportData);\r\n this._renderingContextBrand = undefined;\r\n this._viewLines = viewLines;\r\n }\r\n linesVisibleRangesForRange(range, includeNewLines) {\r\n return this._viewLines.linesVisibleRangesForRange(range, includeNewLines);\r\n }\r\n visibleRangeForPosition(position) {\r\n return this._viewLines.visibleRangeForPosition(position);\r\n }\r\n}\r\nexport class LineVisibleRanges {\r\n constructor(outsideRenderedLine, lineNumber, ranges) {\r\n this.outsideRenderedLine = outsideRenderedLine;\r\n this.lineNumber = lineNumber;\r\n this.ranges = ranges;\r\n }\r\n}\r\nexport class HorizontalRange {\r\n constructor(left, width) {\r\n this.left = Math.round(left);\r\n this.width = Math.round(width);\r\n }\r\n toString() {\r\n return `[${this.left},${this.width}]`;\r\n }\r\n}\r\nexport class HorizontalPosition {\r\n constructor(outsideRenderedLine, left) {\r\n this.outsideRenderedLine = outsideRenderedLine;\r\n this.left = Math.round(left);\r\n }\r\n}\r\nexport class VisibleRanges {\r\n constructor(outsideRenderedLine, ranges) {\r\n this.outsideRenderedLine = outsideRenderedLine;\r\n this.ranges = ranges;\r\n }\r\n}\r\n", "/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License. See License.txt in the project root for license information.\r\n *--------------------------------------------------------------------------------------------*/\r\nimport { HorizontalRange } from '../../../common/view/renderingContext.js';\r\nclass FloatHorizontalRange {\r\n constructor(left, width) {\r\n this._floatHorizontalRangeBrand = undefined;\r\n this.left = left;\r\n this.width = width;\r\n }\r\n toString() {\r\n return `[${this.left},${this.width}]`;\r\n }\r\n static compare(a, b) {\r\n return a.left - b.left;\r\n }\r\n}\r\nexport class RangeUtil {\r\n static _createRange() {\r\n if (!this._handyReadyRange) {\r\n this._handyReadyRange = document.createRange();\r\n }\r\n return this._handyReadyRange;\r\n }\r\n static _detachRange(range, endNode) {\r\n // Move range out of the span node, IE doesn't like having many ranges in\r\n // the same spot and will act badly for lines containing dashes ('-')\r\n range.selectNodeContents(endNode);\r\n }\r\n static _readClientRects(startElement, startOffset, endElement, endOffset, endNode) {\r\n const range = this._createRange();\r\n try {\r\n range.setStart(startElement, startOffset);\r\n range.setEnd(endElement, endOffset);\r\n return range.getClientRects();\r\n }\r\n catch (e) {\r\n // This is life ...\r\n return null;\r\n }\r\n finally {\r\n this._detachRange(range, endNode);\r\n }\r\n }\r\n static _mergeAdjacentRanges(ranges) {\r\n if (ranges.length === 1) {\r\n // There is nothing to merge\r\n return [new HorizontalRange(ranges[0].left, ranges[0].width)];\r\n }\r\n ranges.sort(FloatHorizontalRange.compare);\r\n let result = [], resultLen = 0;\r\n let prevLeft = ranges[0].left;\r\n let prevWidth = ranges[0].width;\r\n for (let i = 1, len = ranges.length; i < len; i++) {\r\n const range = ranges[i];\r\n const myLeft = range.left;\r\n const myWidth = range.width;\r\n if (prevLeft + prevWidth + 0.9 /* account for browser's rounding errors*/ >= myLeft) {\r\n prevWidth = Math.max(prevWidth, myLeft + myWidth - prevLeft);\r\n }\r\n else {\r\n result[resultLen++] = new HorizontalRange(prevLeft, prevWidth);\r\n prevLeft = myLeft;\r\n prevWidth = myWidth;\r\n }\r\n }\r\n result[resultLen++] = new HorizontalRange(prevLeft, prevWidth);\r\n return result;\r\n }\r\n static _createHorizontalRangesFromClientRects(clientRects, clientRectDeltaLeft) {\r\n if (!clientRects || clientRects.length === 0) {\r\n return null;\r\n }\r\n // We go through FloatHorizontalRange because it has been observed in bi-di text\r\n // that the clientRects are not coming in sorted from the browser\r\n const result = [];\r\n for (let i = 0, len = clientRects.length; i < len; i++) {\r\n const clientRect = clientRects[i];\r\n result[i] = new FloatHorizontalRange(Math.max(0, clientRect.left - clientRectDeltaLeft), clientRect.width);\r\n }\r\n return this._mergeAdjacentRanges(result);\r\n }\r\n static readHorizontalRanges(domNode, startChildIndex, startOffset, endChildIndex, endOffset, clientRectDeltaLeft, endNode) {\r\n // Panic check\r\n const min = 0;\r\n const max = domNode.children.length - 1;\r\n if (min > max) {\r\n return null;\r\n }\r\n startChildIndex = Math.min(max, Math.max(min, startChildIndex));\r\n endChildIndex = Math.min(max, Math.max(min, endChildIndex));\r\n if (startChildIndex === endChildIndex && startOffset === endOffset && startOffset === 0 && !domNode.children[startChildIndex].firstChild) {\r\n // We must find the position at the beginning of a \r\n // To cover cases of empty s, avoid using a range and use the 's bounding box\r\n const clientRects = domNode.children[startChildIndex].getClientRects();\r\n return this._createHorizontalRangesFromClientRects(clientRects, clientRectDeltaLeft);\r\n }\r\n // If crossing over to a span only to select offset 0, then use the previous span's maximum offset\r\n // Chrome is buggy and doesn't handle 0 offsets well sometimes.\r\n if (startChildIndex !== endChildIndex) {\r\n if (endChildIndex > 0 && endOffset === 0) {\r\n endChildIndex--;\r\n endOffset = 1073741824 /* MAX_SAFE_SMALL_INTEGER */;\r\n }\r\n }\r\n let startElement = domNode.children[startChildIndex].firstChild;\r\n let endElement = domNode.children[endChildIndex].firstChild;\r\n if (!startElement || !endElement) {\r\n // When having an empty (without any text content), try to move to the previous \r\n if (!startElement && startOffset === 0 && startChildIndex > 0) {\r\n startElement = domNode.children[startChildIndex - 1].firstChild;\r\n startOffset = 1073741824 /* MAX_SAFE_SMALL_INTEGER */;\r\n }\r\n if (!endElement && endOffset === 0 && endChildIndex > 0) {\r\n endElement = domNode.children[endChildIndex - 1].firstChild;\r\n endOffset = 1073741824 /* MAX_SAFE_SMALL_INTEGER */;\r\n }\r\n }\r\n if (!startElement || !endElement) {\r\n return null;\r\n }\r\n startOffset = Math.min(startElement.textContent.length, Math.max(0, startOffset));\r\n endOffset = Math.min(endElement.textContent.length, Math.max(0, endOffset));\r\n const clientRects = this._readClientRects(startElement, startOffset, endElement, endOffset, endNode);\r\n return this._createHorizontalRangesFromClientRects(clientRects, clientRectDeltaLeft);\r\n }\r\n}\r\n", "/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License. See License.txt in the project root for license information.\r\n *--------------------------------------------------------------------------------------------*/\r\nimport * as browser from '../../../../base/browser/browser.js';\r\nimport { createFastDomNode } from '../../../../base/browser/fastDomNode.js';\r\nimport * as platform from '../../../../base/common/platform.js';\r\nimport { RangeUtil } from './rangeUtil.js';\r\nimport { HorizontalRange, VisibleRanges } from '../../../common/view/renderingContext.js';\r\nimport { LineDecoration } from '../../../common/viewLayout/lineDecorations.js';\r\nimport { RenderLineInput, renderViewLine, LineRange, DomPosition } from '../../../common/viewLayout/viewLineRenderer.js';\r\nimport { ColorScheme } from '../../../../platform/theme/common/theme.js';\r\nimport { EditorFontLigatures } from '../../../common/config/editorOptions.js';\r\nconst canUseFastRenderedViewLine = (function () {\r\n if (platform.isNative) {\r\n // In VSCode we know very well when the zoom level changes\r\n return true;\r\n }\r\n if (platform.isLinux || browser.isFirefox || browser.isSafari) {\r\n // On Linux, it appears that zooming affects char widths (in pixels), which is unexpected.\r\n // --\r\n // Even though we read character widths correctly, having read them at a specific zoom level\r\n // does not mean they are the same at the current zoom level.\r\n // --\r\n // This could be improved if we ever figure out how to get an event when browsers zoom,\r\n // but until then we have to stick with reading client rects.\r\n // --\r\n // The same has been observed with Firefox on Windows7\r\n // --\r\n // The same has been oversved with Safari\r\n return false;\r\n }\r\n return true;\r\n})();\r\nlet monospaceAssumptionsAreValid = true;\r\nexport class DomReadingContext {\r\n constructor(domNode, endNode) {\r\n this._domNode = domNode;\r\n this._clientRectDeltaLeft = 0;\r\n this._clientRectDeltaLeftRead = false;\r\n this.endNode = endNode;\r\n }\r\n get clientRectDeltaLeft() {\r\n if (!this._clientRectDeltaLeftRead) {\r\n this._clientRectDeltaLeftRead = true;\r\n this._clientRectDeltaLeft = this._domNode.getBoundingClientRect().left;\r\n }\r\n return this._clientRectDeltaLeft;\r\n }\r\n}\r\nexport class ViewLineOptions {\r\n constructor(config, themeType) {\r\n this.themeType = themeType;\r\n const options = config.options;\r\n const fontInfo = options.get(41 /* fontInfo */);\r\n this.renderWhitespace = options.get(87 /* renderWhitespace */);\r\n this.renderControlCharacters = options.get(81 /* renderControlCharacters */);\r\n this.spaceWidth = fontInfo.spaceWidth;\r\n this.middotWidth = fontInfo.middotWidth;\r\n this.wsmiddotWidth = fontInfo.wsmiddotWidth;\r\n this.useMonospaceOptimizations = (fontInfo.isMonospace\r\n && !options.get(27 /* disableMonospaceOptimizations */));\r\n this.canUseHalfwidthRightwardsArrow = fontInfo.canUseHalfwidthRightwardsArrow;\r\n this.lineHeight = options.get(57 /* lineHeight */);\r\n this.stopRenderingLineAfter = options.get(104 /* stopRenderingLineAfter */);\r\n this.fontLigatures = options.get(42 /* fontLigatures */);\r\n }\r\n equals(other) {\r\n return (this.themeType === other.themeType\r\n && this.renderWhitespace === other.renderWhitespace\r\n && this.renderControlCharacters === other.renderControlCharacters\r\n && this.spaceWidth === other.spaceWidth\r\n && this.middotWidth === other.middotWidth\r\n && this.wsmiddotWidth === other.wsmiddotWidth\r\n && this.useMonospaceOptimizations === other.useMonospaceOptimizations\r\n && this.canUseHalfwidthRightwardsArrow === other.canUseHalfwidthRightwardsArrow\r\n && this.lineHeight === other.lineHeight\r\n && this.stopRenderingLineAfter === other.stopRenderingLineAfter\r\n && this.fontLigatures === other.fontLigatures);\r\n }\r\n}\r\nexport class ViewLine {\r\n constructor(options) {\r\n this._options = options;\r\n this._isMaybeInvalid = true;\r\n this._renderedViewLine = null;\r\n }\r\n // --- begin IVisibleLineData\r\n getDomNode() {\r\n if (this._renderedViewLine && this._renderedViewLine.domNode) {\r\n return this._renderedViewLine.domNode.domNode;\r\n }\r\n return null;\r\n }\r\n setDomNode(domNode) {\r\n if (this._renderedViewLine) {\r\n this._renderedViewLine.domNode = createFastDomNode(domNode);\r\n }\r\n else {\r\n throw new Error('I have no rendered view line to set the dom node to...');\r\n }\r\n }\r\n onContentChanged() {\r\n this._isMaybeInvalid = true;\r\n }\r\n onTokensChanged() {\r\n this._isMaybeInvalid = true;\r\n }\r\n onDecorationsChanged() {\r\n this._isMaybeInvalid = true;\r\n }\r\n onOptionsChanged(newOptions) {\r\n this._isMaybeInvalid = true;\r\n this._options = newOptions;\r\n }\r\n onSelectionChanged() {\r\n if (this._options.themeType === ColorScheme.HIGH_CONTRAST || this._options.renderWhitespace === 'selection') {\r\n this._isMaybeInvalid = true;\r\n return true;\r\n }\r\n return false;\r\n }\r\n renderLine(lineNumber, deltaTop, viewportData, sb) {\r\n if (this._isMaybeInvalid === false) {\r\n // it appears that nothing relevant has changed\r\n return false;\r\n }\r\n this._isMaybeInvalid = false;\r\n const lineData = viewportData.getViewLineRenderingData(lineNumber);\r\n const options = this._options;\r\n const actualInlineDecorations = LineDecoration.filter(lineData.inlineDecorations, lineNumber, lineData.minColumn, lineData.maxColumn);\r\n // Only send selection information when needed for rendering whitespace\r\n let selectionsOnLine = null;\r\n if (options.themeType === ColorScheme.HIGH_CONTRAST || this._options.renderWhitespace === 'selection') {\r\n const selections = viewportData.selections;\r\n for (const selection of selections) {\r\n if (selection.endLineNumber < lineNumber || selection.startLineNumber > lineNumber) {\r\n // Selection does not intersect line\r\n continue;\r\n }\r\n const startColumn = (selection.startLineNumber === lineNumber ? selection.startColumn : lineData.minColumn);\r\n const endColumn = (selection.endLineNumber === lineNumber ? selection.endColumn : lineData.maxColumn);\r\n if (startColumn < endColumn) {\r\n if (options.themeType === ColorScheme.HIGH_CONTRAST || this._options.renderWhitespace !== 'selection') {\r\n actualInlineDecorations.push(new LineDecoration(startColumn, endColumn, 'inline-selected-text', 0 /* Regular */));\r\n }\r\n else {\r\n if (!selectionsOnLine) {\r\n selectionsOnLine = [];\r\n }\r\n selectionsOnLine.push(new LineRange(startColumn - 1, endColumn - 1));\r\n }\r\n }\r\n }\r\n }\r\n const renderLineInput = new RenderLineInput(options.useMonospaceOptimizations, options.canUseHalfwidthRightwardsArrow, lineData.content, lineData.continuesWithWrappedLine, lineData.isBasicASCII, lineData.containsRTL, lineData.minColumn - 1, lineData.tokens, actualInlineDecorations, lineData.tabSize, lineData.startVisibleColumn, options.spaceWidth, options.middotWidth, options.wsmiddotWidth, options.stopRenderingLineAfter, options.renderWhitespace, options.renderControlCharacters, options.fontLigatures !== EditorFontLigatures.OFF, selectionsOnLine);\r\n if (this._renderedViewLine && this._renderedViewLine.input.equals(renderLineInput)) {\r\n // no need to do anything, we have the same render input\r\n return false;\r\n }\r\n sb.appendASCIIString('
');\r\n const output = renderViewLine(renderLineInput, sb);\r\n sb.appendASCIIString('
');\r\n let renderedViewLine = null;\r\n if (monospaceAssumptionsAreValid && canUseFastRenderedViewLine && lineData.isBasicASCII && options.useMonospaceOptimizations && output.containsForeignElements === 0 /* None */) {\r\n if (lineData.content.length < 300 && renderLineInput.lineTokens.getCount() < 100) {\r\n // Browser rounding errors have been observed in Chrome and IE, so using the fast\r\n // view line only for short lines. Please test before removing the length check...\r\n // ---\r\n // Another rounding error has been observed on Linux in VSCode, where width\r\n // rounding errors add up to an observable large number...\r\n // ---\r\n // Also see another example of rounding errors on Windows in\r\n // https://github.com/microsoft/vscode/issues/33178\r\n renderedViewLine = new FastRenderedViewLine(this._renderedViewLine ? this._renderedViewLine.domNode : null, renderLineInput, output.characterMapping);\r\n }\r\n }\r\n if (!renderedViewLine) {\r\n renderedViewLine = createRenderedLine(this._renderedViewLine ? this._renderedViewLine.domNode : null, renderLineInput, output.characterMapping, output.containsRTL, output.containsForeignElements);\r\n }\r\n this._renderedViewLine = renderedViewLine;\r\n return true;\r\n }\r\n layoutLine(lineNumber, deltaTop) {\r\n if (this._renderedViewLine && this._renderedViewLine.domNode) {\r\n this._renderedViewLine.domNode.setTop(deltaTop);\r\n this._renderedViewLine.domNode.setHeight(this._options.lineHeight);\r\n }\r\n }\r\n // --- end IVisibleLineData\r\n getWidth() {\r\n if (!this._renderedViewLine) {\r\n return 0;\r\n }\r\n return this._renderedViewLine.getWidth();\r\n }\r\n getWidthIsFast() {\r\n if (!this._renderedViewLine) {\r\n return true;\r\n }\r\n return this._renderedViewLine.getWidthIsFast();\r\n }\r\n needsMonospaceFontCheck() {\r\n if (!this._renderedViewLine) {\r\n return false;\r\n }\r\n return (this._renderedViewLine instanceof FastRenderedViewLine);\r\n }\r\n monospaceAssumptionsAreValid() {\r\n if (!this._renderedViewLine) {\r\n return monospaceAssumptionsAreValid;\r\n }\r\n if (this._renderedViewLine instanceof FastRenderedViewLine) {\r\n return this._renderedViewLine.monospaceAssumptionsAreValid();\r\n }\r\n return monospaceAssumptionsAreValid;\r\n }\r\n onMonospaceAssumptionsInvalidated() {\r\n if (this._renderedViewLine && this._renderedViewLine instanceof FastRenderedViewLine) {\r\n this._renderedViewLine = this._renderedViewLine.toSlowRenderedLine();\r\n }\r\n }\r\n getVisibleRangesForRange(startColumn, endColumn, context) {\r\n if (!this._renderedViewLine) {\r\n return null;\r\n }\r\n startColumn = startColumn | 0; // @perf\r\n endColumn = endColumn | 0; // @perf\r\n startColumn = Math.min(this._renderedViewLine.input.lineContent.length + 1, Math.max(1, startColumn));\r\n endColumn = Math.min(this._renderedViewLine.input.lineContent.length + 1, Math.max(1, endColumn));\r\n const stopRenderingLineAfter = this._renderedViewLine.input.stopRenderingLineAfter | 0; // @perf\r\n let outsideRenderedLine = false;\r\n if (stopRenderingLineAfter !== -1 && startColumn > stopRenderingLineAfter + 1 && endColumn > stopRenderingLineAfter + 1) {\r\n // This range is obviously not visible\r\n outsideRenderedLine = true;\r\n }\r\n if (stopRenderingLineAfter !== -1 && startColumn > stopRenderingLineAfter + 1) {\r\n startColumn = stopRenderingLineAfter + 1;\r\n }\r\n if (stopRenderingLineAfter !== -1 && endColumn > stopRenderingLineAfter + 1) {\r\n endColumn = stopRenderingLineAfter + 1;\r\n }\r\n const horizontalRanges = this._renderedViewLine.getVisibleRangesForRange(startColumn, endColumn, context);\r\n if (horizontalRanges && horizontalRanges.length > 0) {\r\n return new VisibleRanges(outsideRenderedLine, horizontalRanges);\r\n }\r\n return null;\r\n }\r\n getColumnOfNodeOffset(lineNumber, spanNode, offset) {\r\n if (!this._renderedViewLine) {\r\n return 1;\r\n }\r\n return this._renderedViewLine.getColumnOfNodeOffset(lineNumber, spanNode, offset);\r\n }\r\n}\r\nViewLine.CLASS_NAME = 'view-line';\r\n/**\r\n * A rendered line which is guaranteed to contain only regular ASCII and is rendered with a monospace font.\r\n */\r\nclass FastRenderedViewLine {\r\n constructor(domNode, renderLineInput, characterMapping) {\r\n this.domNode = domNode;\r\n this.input = renderLineInput;\r\n this._characterMapping = characterMapping;\r\n this._charWidth = renderLineInput.spaceWidth;\r\n }\r\n getWidth() {\r\n return this._getCharPosition(this._characterMapping.length);\r\n }\r\n getWidthIsFast() {\r\n return true;\r\n }\r\n monospaceAssumptionsAreValid() {\r\n if (!this.domNode) {\r\n return monospaceAssumptionsAreValid;\r\n }\r\n const expectedWidth = this.getWidth();\r\n const actualWidth = this.domNode.domNode.firstChild.offsetWidth;\r\n if (Math.abs(expectedWidth - actualWidth) >= 2) {\r\n // more than 2px off\r\n console.warn(`monospace assumptions have been violated, therefore disabling monospace optimizations!`);\r\n monospaceAssumptionsAreValid = false;\r\n }\r\n return monospaceAssumptionsAreValid;\r\n }\r\n toSlowRenderedLine() {\r\n return createRenderedLine(this.domNode, this.input, this._characterMapping, false, 0 /* None */);\r\n }\r\n getVisibleRangesForRange(startColumn, endColumn, context) {\r\n const startPosition = this._getCharPosition(startColumn);\r\n const endPosition = this._getCharPosition(endColumn);\r\n return [new HorizontalRange(startPosition, endPosition - startPosition)];\r\n }\r\n _getCharPosition(column) {\r\n const charOffset = this._characterMapping.getAbsoluteOffset(column);\r\n return Math.round(this._charWidth * charOffset);\r\n }\r\n getColumnOfNodeOffset(lineNumber, spanNode, offset) {\r\n const spanNodeTextContentLength = spanNode.textContent.length;\r\n let spanIndex = -1;\r\n while (spanNode) {\r\n spanNode = spanNode.previousSibling;\r\n spanIndex++;\r\n }\r\n return this._characterMapping.getColumn(new DomPosition(spanIndex, offset), spanNodeTextContentLength);\r\n }\r\n}\r\n/**\r\n * Every time we render a line, we save what we have rendered in an instance of this class.\r\n */\r\nclass RenderedViewLine {\r\n constructor(domNode, renderLineInput, characterMapping, containsRTL, containsForeignElements) {\r\n this.domNode = domNode;\r\n this.input = renderLineInput;\r\n this._characterMapping = characterMapping;\r\n this._isWhitespaceOnly = /^\\s*$/.test(renderLineInput.lineContent);\r\n this._containsForeignElements = containsForeignElements;\r\n this._cachedWidth = -1;\r\n this._pixelOffsetCache = null;\r\n if (!containsRTL || this._characterMapping.length === 0 /* the line is empty */) {\r\n this._pixelOffsetCache = new Int32Array(Math.max(2, this._characterMapping.length + 1));\r\n for (let column = 0, len = this._characterMapping.length; column <= len; column++) {\r\n this._pixelOffsetCache[column] = -1;\r\n }\r\n }\r\n }\r\n // --- Reading from the DOM methods\r\n _getReadingTarget(myDomNode) {\r\n return myDomNode.domNode.firstChild;\r\n }\r\n /**\r\n * Width of the line in pixels\r\n */\r\n getWidth() {\r\n if (!this.domNode) {\r\n return 0;\r\n }\r\n if (this._cachedWidth === -1) {\r\n this._cachedWidth = this._getReadingTarget(this.domNode).offsetWidth;\r\n }\r\n return this._cachedWidth;\r\n }\r\n getWidthIsFast() {\r\n if (this._cachedWidth === -1) {\r\n return false;\r\n }\r\n return true;\r\n }\r\n /**\r\n * Visible ranges for a model range\r\n */\r\n getVisibleRangesForRange(startColumn, endColumn, context) {\r\n if (!this.domNode) {\r\n return null;\r\n }\r\n if (this._pixelOffsetCache !== null) {\r\n // the text is LTR\r\n const startOffset = this._readPixelOffset(this.domNode, startColumn, context);\r\n if (startOffset === -1) {\r\n return null;\r\n }\r\n const endOffset = this._readPixelOffset(this.domNode, endColumn, context);\r\n if (endOffset === -1) {\r\n return null;\r\n }\r\n return [new HorizontalRange(startOffset, endOffset - startOffset)];\r\n }\r\n return this._readVisibleRangesForRange(this.domNode, startColumn, endColumn, context);\r\n }\r\n _readVisibleRangesForRange(domNode, startColumn, endColumn, context) {\r\n if (startColumn === endColumn) {\r\n const pixelOffset = this._readPixelOffset(domNode, startColumn, context);\r\n if (pixelOffset === -1) {\r\n return null;\r\n }\r\n else {\r\n return [new HorizontalRange(pixelOffset, 0)];\r\n }\r\n }\r\n else {\r\n return this._readRawVisibleRangesForRange(domNode, startColumn, endColumn, context);\r\n }\r\n }\r\n _readPixelOffset(domNode, column, context) {\r\n if (this._characterMapping.length === 0) {\r\n // This line has no content\r\n if (this._containsForeignElements === 0 /* None */) {\r\n // We can assume the line is really empty\r\n return 0;\r\n }\r\n if (this._containsForeignElements === 2 /* After */) {\r\n // We have foreign elements after the (empty) line\r\n return 0;\r\n }\r\n if (this._containsForeignElements === 1 /* Before */) {\r\n // We have foreign elements before the (empty) line\r\n return this.getWidth();\r\n }\r\n // We have foreign elements before & after the (empty) line\r\n const readingTarget = this._getReadingTarget(domNode);\r\n if (readingTarget.firstChild) {\r\n return readingTarget.firstChild.offsetWidth;\r\n }\r\n else {\r\n return 0;\r\n }\r\n }\r\n if (this._pixelOffsetCache !== null) {\r\n // the text is LTR\r\n const cachedPixelOffset = this._pixelOffsetCache[column];\r\n if (cachedPixelOffset !== -1) {\r\n return cachedPixelOffset;\r\n }\r\n const result = this._actualReadPixelOffset(domNode, column, context);\r\n this._pixelOffsetCache[column] = result;\r\n return result;\r\n }\r\n return this._actualReadPixelOffset(domNode, column, context);\r\n }\r\n _actualReadPixelOffset(domNode, column, context) {\r\n if (this._characterMapping.length === 0) {\r\n // This line has no content\r\n const r = RangeUtil.readHorizontalRanges(this._getReadingTarget(domNode), 0, 0, 0, 0, context.clientRectDeltaLeft, context.endNode);\r\n if (!r || r.length === 0) {\r\n return -1;\r\n }\r\n return r[0].left;\r\n }\r\n if (column === this._characterMapping.length && this._isWhitespaceOnly && this._containsForeignElements === 0 /* None */) {\r\n // This branch helps in the case of whitespace only lines which have a width set\r\n return this.getWidth();\r\n }\r\n const domPosition = this._characterMapping.getDomPosition(column);\r\n const r = RangeUtil.readHorizontalRanges(this._getReadingTarget(domNode), domPosition.partIndex, domPosition.charIndex, domPosition.partIndex, domPosition.charIndex, context.clientRectDeltaLeft, context.endNode);\r\n if (!r || r.length === 0) {\r\n return -1;\r\n }\r\n const result = r[0].left;\r\n if (this.input.isBasicASCII) {\r\n const charOffset = this._characterMapping.getAbsoluteOffset(column);\r\n const expectedResult = Math.round(this.input.spaceWidth * charOffset);\r\n if (Math.abs(expectedResult - result) <= 1) {\r\n return expectedResult;\r\n }\r\n }\r\n return result;\r\n }\r\n _readRawVisibleRangesForRange(domNode, startColumn, endColumn, context) {\r\n if (startColumn === 1 && endColumn === this._characterMapping.length) {\r\n // This branch helps IE with bidi text & gives a performance boost to other browsers when reading visible ranges for an entire line\r\n return [new HorizontalRange(0, this.getWidth())];\r\n }\r\n const startDomPosition = this._characterMapping.getDomPosition(startColumn);\r\n const endDomPosition = this._characterMapping.getDomPosition(endColumn);\r\n return RangeUtil.readHorizontalRanges(this._getReadingTarget(domNode), startDomPosition.partIndex, startDomPosition.charIndex, endDomPosition.partIndex, endDomPosition.charIndex, context.clientRectDeltaLeft, context.endNode);\r\n }\r\n /**\r\n * Returns the column for the text found at a specific offset inside a rendered dom node\r\n */\r\n getColumnOfNodeOffset(lineNumber, spanNode, offset) {\r\n const spanNodeTextContentLength = spanNode.textContent.length;\r\n let spanIndex = -1;\r\n while (spanNode) {\r\n spanNode = spanNode.previousSibling;\r\n spanIndex++;\r\n }\r\n return this._characterMapping.getColumn(new DomPosition(spanIndex, offset), spanNodeTextContentLength);\r\n }\r\n}\r\nclass WebKitRenderedViewLine extends RenderedViewLine {\r\n _readVisibleRangesForRange(domNode, startColumn, endColumn, context) {\r\n const output = super._readVisibleRangesForRange(domNode, startColumn, endColumn, context);\r\n if (!output || output.length === 0 || startColumn === endColumn || (startColumn === 1 && endColumn === this._characterMapping.length)) {\r\n return output;\r\n }\r\n // WebKit is buggy and returns an expanded range (to contain words in some cases)\r\n // The last client rect is enlarged (I think)\r\n if (!this.input.containsRTL) {\r\n // This is an attempt to patch things up\r\n // Find position of last column\r\n const endPixelOffset = this._readPixelOffset(domNode, endColumn, context);\r\n if (endPixelOffset !== -1) {\r\n const lastRange = output[output.length - 1];\r\n if (lastRange.left < endPixelOffset) {\r\n // Trim down the width of the last visible range to not go after the last column's position\r\n lastRange.width = endPixelOffset - lastRange.left;\r\n }\r\n }\r\n }\r\n return output;\r\n }\r\n}\r\nconst createRenderedLine = (function () {\r\n if (browser.isWebKit) {\r\n return createWebKitRenderedLine;\r\n }\r\n return createNormalRenderedLine;\r\n})();\r\nfunction createWebKitRenderedLine(domNode, renderLineInput, characterMapping, containsRTL, containsForeignElements) {\r\n return new WebKitRenderedViewLine(domNode, renderLineInput, characterMapping, containsRTL, containsForeignElements);\r\n}\r\nfunction createNormalRenderedLine(domNode, renderLineInput, characterMapping, containsRTL, containsForeignElements) {\r\n return new RenderedViewLine(domNode, renderLineInput, characterMapping, containsRTL, containsForeignElements);\r\n}\r\n", "/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License. See License.txt in the project root for license information.\r\n *--------------------------------------------------------------------------------------------*/\r\nimport { PageCoordinates } from '../editorDom.js';\r\nimport { PartFingerprints } from '../view/viewPart.js';\r\nimport { ViewLine } from '../viewParts/lines/viewLine.js';\r\nimport { Position } from '../../common/core/position.js';\r\nimport { Range as EditorRange } from '../../common/core/range.js';\r\nimport { CursorColumns } from '../../common/controller/cursorCommon.js';\r\nimport * as dom from '../../../base/browser/dom.js';\r\nimport { AtomicTabMoveOperations } from '../../common/controller/cursorAtomicMoveOperations.js';\r\nclass UnknownHitTestResult {\r\n constructor(hitTarget = null) {\r\n this.hitTarget = hitTarget;\r\n this.type = 0 /* Unknown */;\r\n }\r\n}\r\nclass ContentHitTestResult {\r\n constructor(position, spanNode, injectedText) {\r\n this.position = position;\r\n this.spanNode = spanNode;\r\n this.injectedText = injectedText;\r\n this.type = 1 /* Content */;\r\n }\r\n}\r\nvar HitTestResult;\r\n(function (HitTestResult) {\r\n function createFromDOMInfo(ctx, spanNode, offset) {\r\n const position = ctx.getPositionFromDOMInfo(spanNode, offset);\r\n if (position) {\r\n return new ContentHitTestResult(position, spanNode, null);\r\n }\r\n return new UnknownHitTestResult(spanNode);\r\n }\r\n HitTestResult.createFromDOMInfo = createFromDOMInfo;\r\n})(HitTestResult || (HitTestResult = {}));\r\nexport class PointerHandlerLastRenderData {\r\n constructor(lastViewCursorsRenderData, lastTextareaPosition) {\r\n this.lastViewCursorsRenderData = lastViewCursorsRenderData;\r\n this.lastTextareaPosition = lastTextareaPosition;\r\n }\r\n}\r\nexport class MouseTarget {\r\n constructor(element, type, mouseColumn = 0, position = null, range = null, detail = null) {\r\n this.element = element;\r\n this.type = type;\r\n this.mouseColumn = mouseColumn;\r\n this.position = position;\r\n if (!range && position) {\r\n range = new EditorRange(position.lineNumber, position.column, position.lineNumber, position.column);\r\n }\r\n this.range = range;\r\n this.detail = detail;\r\n }\r\n static _typeToString(type) {\r\n if (type === 1 /* TEXTAREA */) {\r\n return 'TEXTAREA';\r\n }\r\n if (type === 2 /* GUTTER_GLYPH_MARGIN */) {\r\n return 'GUTTER_GLYPH_MARGIN';\r\n }\r\n if (type === 3 /* GUTTER_LINE_NUMBERS */) {\r\n return 'GUTTER_LINE_NUMBERS';\r\n }\r\n if (type === 4 /* GUTTER_LINE_DECORATIONS */) {\r\n return 'GUTTER_LINE_DECORATIONS';\r\n }\r\n if (type === 5 /* GUTTER_VIEW_ZONE */) {\r\n return 'GUTTER_VIEW_ZONE';\r\n }\r\n if (type === 6 /* CONTENT_TEXT */) {\r\n return 'CONTENT_TEXT';\r\n }\r\n if (type === 7 /* CONTENT_EMPTY */) {\r\n return 'CONTENT_EMPTY';\r\n }\r\n if (type === 8 /* CONTENT_VIEW_ZONE */) {\r\n return 'CONTENT_VIEW_ZONE';\r\n }\r\n if (type === 9 /* CONTENT_WIDGET */) {\r\n return 'CONTENT_WIDGET';\r\n }\r\n if (type === 10 /* OVERVIEW_RULER */) {\r\n return 'OVERVIEW_RULER';\r\n }\r\n if (type === 11 /* SCROLLBAR */) {\r\n return 'SCROLLBAR';\r\n }\r\n if (type === 12 /* OVERLAY_WIDGET */) {\r\n return 'OVERLAY_WIDGET';\r\n }\r\n return 'UNKNOWN';\r\n }\r\n static toString(target) {\r\n return this._typeToString(target.type) + ': ' + target.position + ' - ' + target.range + ' - ' + target.detail;\r\n }\r\n toString() {\r\n return MouseTarget.toString(this);\r\n }\r\n}\r\nclass ElementPath {\r\n static isTextArea(path) {\r\n return (path.length === 2\r\n && path[0] === 3 /* OverflowGuard */\r\n && path[1] === 6 /* TextArea */);\r\n }\r\n static isChildOfViewLines(path) {\r\n return (path.length >= 4\r\n && path[0] === 3 /* OverflowGuard */\r\n && path[3] === 7 /* ViewLines */);\r\n }\r\n static isStrictChildOfViewLines(path) {\r\n return (path.length > 4\r\n && path[0] === 3 /* OverflowGuard */\r\n && path[3] === 7 /* ViewLines */);\r\n }\r\n static isChildOfScrollableElement(path) {\r\n return (path.length >= 2\r\n && path[0] === 3 /* OverflowGuard */\r\n && path[1] === 5 /* ScrollableElement */);\r\n }\r\n static isChildOfMinimap(path) {\r\n return (path.length >= 2\r\n && path[0] === 3 /* OverflowGuard */\r\n && path[1] === 8 /* Minimap */);\r\n }\r\n static isChildOfContentWidgets(path) {\r\n return (path.length >= 4\r\n && path[0] === 3 /* OverflowGuard */\r\n && path[3] === 1 /* ContentWidgets */);\r\n }\r\n static isChildOfOverflowingContentWidgets(path) {\r\n return (path.length >= 1\r\n && path[0] === 2 /* OverflowingContentWidgets */);\r\n }\r\n static isChildOfOverlayWidgets(path) {\r\n return (path.length >= 2\r\n && path[0] === 3 /* OverflowGuard */\r\n && path[1] === 4 /* OverlayWidgets */);\r\n }\r\n}\r\nexport class HitTestContext {\r\n constructor(context, viewHelper, lastRenderData) {\r\n this.model = context.model;\r\n const options = context.configuration.options;\r\n this.layoutInfo = options.get(129 /* layoutInfo */);\r\n this.viewDomNode = viewHelper.viewDomNode;\r\n this.lineHeight = options.get(57 /* lineHeight */);\r\n this.stickyTabStops = options.get(103 /* stickyTabStops */);\r\n this.typicalHalfwidthCharacterWidth = options.get(41 /* fontInfo */).typicalHalfwidthCharacterWidth;\r\n this.lastRenderData = lastRenderData;\r\n this._context = context;\r\n this._viewHelper = viewHelper;\r\n }\r\n getZoneAtCoord(mouseVerticalOffset) {\r\n return HitTestContext.getZoneAtCoord(this._context, mouseVerticalOffset);\r\n }\r\n static getZoneAtCoord(context, mouseVerticalOffset) {\r\n // The target is either a view zone or the empty space after the last view-line\r\n const viewZoneWhitespace = context.viewLayout.getWhitespaceAtVerticalOffset(mouseVerticalOffset);\r\n if (viewZoneWhitespace) {\r\n const viewZoneMiddle = viewZoneWhitespace.verticalOffset + viewZoneWhitespace.height / 2;\r\n const lineCount = context.model.getLineCount();\r\n let positionBefore = null;\r\n let position;\r\n let positionAfter = null;\r\n if (viewZoneWhitespace.afterLineNumber !== lineCount) {\r\n // There are more lines after this view zone\r\n positionAfter = new Position(viewZoneWhitespace.afterLineNumber + 1, 1);\r\n }\r\n if (viewZoneWhitespace.afterLineNumber > 0) {\r\n // There are more lines above this view zone\r\n positionBefore = new Position(viewZoneWhitespace.afterLineNumber, context.model.getLineMaxColumn(viewZoneWhitespace.afterLineNumber));\r\n }\r\n if (positionAfter === null) {\r\n position = positionBefore;\r\n }\r\n else if (positionBefore === null) {\r\n position = positionAfter;\r\n }\r\n else if (mouseVerticalOffset < viewZoneMiddle) {\r\n position = positionBefore;\r\n }\r\n else {\r\n position = positionAfter;\r\n }\r\n return {\r\n viewZoneId: viewZoneWhitespace.id,\r\n afterLineNumber: viewZoneWhitespace.afterLineNumber,\r\n positionBefore: positionBefore,\r\n positionAfter: positionAfter,\r\n position: position\r\n };\r\n }\r\n return null;\r\n }\r\n getFullLineRangeAtCoord(mouseVerticalOffset) {\r\n if (this._context.viewLayout.isAfterLines(mouseVerticalOffset)) {\r\n // Below the last line\r\n const lineNumber = this._context.model.getLineCount();\r\n const maxLineColumn = this._context.model.getLineMaxColumn(lineNumber);\r\n return {\r\n range: new EditorRange(lineNumber, maxLineColumn, lineNumber, maxLineColumn),\r\n isAfterLines: true\r\n };\r\n }\r\n const lineNumber = this._context.viewLayout.getLineNumberAtVerticalOffset(mouseVerticalOffset);\r\n const maxLineColumn = this._context.model.getLineMaxColumn(lineNumber);\r\n return {\r\n range: new EditorRange(lineNumber, 1, lineNumber, maxLineColumn),\r\n isAfterLines: false\r\n };\r\n }\r\n getLineNumberAtVerticalOffset(mouseVerticalOffset) {\r\n return this._context.viewLayout.getLineNumberAtVerticalOffset(mouseVerticalOffset);\r\n }\r\n isAfterLines(mouseVerticalOffset) {\r\n return this._context.viewLayout.isAfterLines(mouseVerticalOffset);\r\n }\r\n isInTopPadding(mouseVerticalOffset) {\r\n return this._context.viewLayout.isInTopPadding(mouseVerticalOffset);\r\n }\r\n isInBottomPadding(mouseVerticalOffset) {\r\n return this._context.viewLayout.isInBottomPadding(mouseVerticalOffset);\r\n }\r\n getVerticalOffsetForLineNumber(lineNumber) {\r\n return this._context.viewLayout.getVerticalOffsetForLineNumber(lineNumber);\r\n }\r\n findAttribute(element, attr) {\r\n return HitTestContext._findAttribute(element, attr, this._viewHelper.viewDomNode);\r\n }\r\n static _findAttribute(element, attr, stopAt) {\r\n while (element && element !== document.body) {\r\n if (element.hasAttribute && element.hasAttribute(attr)) {\r\n return element.getAttribute(attr);\r\n }\r\n if (element === stopAt) {\r\n return null;\r\n }\r\n element = element.parentNode;\r\n }\r\n return null;\r\n }\r\n getLineWidth(lineNumber) {\r\n return this._viewHelper.getLineWidth(lineNumber);\r\n }\r\n visibleRangeForPosition(lineNumber, column) {\r\n return this._viewHelper.visibleRangeForPosition(lineNumber, column);\r\n }\r\n getPositionFromDOMInfo(spanNode, offset) {\r\n return this._viewHelper.getPositionFromDOMInfo(spanNode, offset);\r\n }\r\n getCurrentScrollTop() {\r\n return this._context.viewLayout.getCurrentScrollTop();\r\n }\r\n getCurrentScrollLeft() {\r\n return this._context.viewLayout.getCurrentScrollLeft();\r\n }\r\n}\r\nclass BareHitTestRequest {\r\n constructor(ctx, editorPos, pos) {\r\n this.editorPos = editorPos;\r\n this.pos = pos;\r\n this.mouseVerticalOffset = Math.max(0, ctx.getCurrentScrollTop() + pos.y - editorPos.y);\r\n this.mouseContentHorizontalOffset = ctx.getCurrentScrollLeft() + pos.x - editorPos.x - ctx.layoutInfo.contentLeft;\r\n this.isInMarginArea = (pos.x - editorPos.x < ctx.layoutInfo.contentLeft && pos.x - editorPos.x >= ctx.layoutInfo.glyphMarginLeft);\r\n this.isInContentArea = !this.isInMarginArea;\r\n this.mouseColumn = Math.max(0, MouseTargetFactory._getMouseColumn(this.mouseContentHorizontalOffset, ctx.typicalHalfwidthCharacterWidth));\r\n }\r\n}\r\nclass HitTestRequest extends BareHitTestRequest {\r\n constructor(ctx, editorPos, pos, target) {\r\n super(ctx, editorPos, pos);\r\n this._ctx = ctx;\r\n if (target) {\r\n this.target = target;\r\n this.targetPath = PartFingerprints.collect(target, ctx.viewDomNode);\r\n }\r\n else {\r\n this.target = null;\r\n this.targetPath = new Uint8Array(0);\r\n }\r\n }\r\n toString() {\r\n return `pos(${this.pos.x},${this.pos.y}), editorPos(${this.editorPos.x},${this.editorPos.y}), mouseVerticalOffset: ${this.mouseVerticalOffset}, mouseContentHorizontalOffset: ${this.mouseContentHorizontalOffset}\\n\\ttarget: ${this.target ? this.target.outerHTML : null}`;\r\n }\r\n // public fulfill(type: MouseTargetType.OVERVIEW_RULER, position?: Position | null, range?: EditorRange | null, detail?: any): MouseTarget;\r\n // public fulfill(type: MouseTargetType.OUTSIDE_EDITOR, position?: Position | null, range?: EditorRange | null, detail?: any): MouseTarget;\r\n fulfill(type, position = null, range = null, detail = null) {\r\n let mouseColumn = this.mouseColumn;\r\n if (position && position.column < this._ctx.model.getLineMaxColumn(position.lineNumber)) {\r\n // Most likely, the line contains foreign decorations...\r\n mouseColumn = CursorColumns.visibleColumnFromColumn(this._ctx.model.getLineContent(position.lineNumber), position.column, this._ctx.model.getTextModelOptions().tabSize) + 1;\r\n }\r\n return new MouseTarget(this.target, type, mouseColumn, position, range, detail);\r\n }\r\n withTarget(target) {\r\n return new HitTestRequest(this._ctx, this.editorPos, this.pos, target);\r\n }\r\n}\r\nconst EMPTY_CONTENT_AFTER_LINES = { isAfterLines: true };\r\nfunction createEmptyContentDataInLines(horizontalDistanceToText) {\r\n return {\r\n isAfterLines: false,\r\n horizontalDistanceToText: horizontalDistanceToText\r\n };\r\n}\r\nexport class MouseTargetFactory {\r\n constructor(context, viewHelper) {\r\n this._context = context;\r\n this._viewHelper = viewHelper;\r\n }\r\n mouseTargetIsWidget(e) {\r\n const t = e.target;\r\n const path = PartFingerprints.collect(t, this._viewHelper.viewDomNode);\r\n // Is it a content widget?\r\n if (ElementPath.isChildOfContentWidgets(path) || ElementPath.isChildOfOverflowingContentWidgets(path)) {\r\n return true;\r\n }\r\n // Is it an overlay widget?\r\n if (ElementPath.isChildOfOverlayWidgets(path)) {\r\n return true;\r\n }\r\n return false;\r\n }\r\n createMouseTarget(lastRenderData, editorPos, pos, target) {\r\n const ctx = new HitTestContext(this._context, this._viewHelper, lastRenderData);\r\n const request = new HitTestRequest(ctx, editorPos, pos, target);\r\n try {\r\n const r = MouseTargetFactory._createMouseTarget(ctx, request, false);\r\n // console.log(r.toString());\r\n return r;\r\n }\r\n catch (err) {\r\n // console.log(err);\r\n return request.fulfill(0 /* UNKNOWN */);\r\n }\r\n }\r\n static _createMouseTarget(ctx, request, domHitTestExecuted) {\r\n // console.log(`${domHitTestExecuted ? '=>' : ''}CAME IN REQUEST: ${request}`);\r\n // First ensure the request has a target\r\n if (request.target === null) {\r\n if (domHitTestExecuted) {\r\n // Still no target... and we have already executed hit test...\r\n return request.fulfill(0 /* UNKNOWN */);\r\n }\r\n const hitTestResult = MouseTargetFactory._doHitTest(ctx, request);\r\n if (hitTestResult.type === 1 /* Content */) {\r\n return MouseTargetFactory.createMouseTargetFromHitTestPosition(ctx, request, hitTestResult.spanNode, hitTestResult.position, hitTestResult.injectedText);\r\n }\r\n return this._createMouseTarget(ctx, request.withTarget(hitTestResult.hitTarget), true);\r\n }\r\n // we know for a fact that request.target is not null\r\n const resolvedRequest = request;\r\n let result = null;\r\n result = result || MouseTargetFactory._hitTestContentWidget(ctx, resolvedRequest);\r\n result = result || MouseTargetFactory._hitTestOverlayWidget(ctx, resolvedRequest);\r\n result = result || MouseTargetFactory._hitTestMinimap(ctx, resolvedRequest);\r\n result = result || MouseTargetFactory._hitTestScrollbarSlider(ctx, resolvedRequest);\r\n result = result || MouseTargetFactory._hitTestViewZone(ctx, resolvedRequest);\r\n result = result || MouseTargetFactory._hitTestMargin(ctx, resolvedRequest);\r\n result = result || MouseTargetFactory._hitTestViewCursor(ctx, resolvedRequest);\r\n result = result || MouseTargetFactory._hitTestTextArea(ctx, resolvedRequest);\r\n result = result || MouseTargetFactory._hitTestViewLines(ctx, resolvedRequest, domHitTestExecuted);\r\n result = result || MouseTargetFactory._hitTestScrollbar(ctx, resolvedRequest);\r\n return (result || request.fulfill(0 /* UNKNOWN */));\r\n }\r\n static _hitTestContentWidget(ctx, request) {\r\n // Is it a content widget?\r\n if (ElementPath.isChildOfContentWidgets(request.targetPath) || ElementPath.isChildOfOverflowingContentWidgets(request.targetPath)) {\r\n const widgetId = ctx.findAttribute(request.target, 'widgetId');\r\n if (widgetId) {\r\n return request.fulfill(9 /* CONTENT_WIDGET */, null, null, widgetId);\r\n }\r\n else {\r\n return request.fulfill(0 /* UNKNOWN */);\r\n }\r\n }\r\n return null;\r\n }\r\n static _hitTestOverlayWidget(ctx, request) {\r\n // Is it an overlay widget?\r\n if (ElementPath.isChildOfOverlayWidgets(request.targetPath)) {\r\n const widgetId = ctx.findAttribute(request.target, 'widgetId');\r\n if (widgetId) {\r\n return request.fulfill(12 /* OVERLAY_WIDGET */, null, null, widgetId);\r\n }\r\n else {\r\n return request.fulfill(0 /* UNKNOWN */);\r\n }\r\n }\r\n return null;\r\n }\r\n static _hitTestViewCursor(ctx, request) {\r\n if (request.target) {\r\n // Check if we've hit a painted cursor\r\n const lastViewCursorsRenderData = ctx.lastRenderData.lastViewCursorsRenderData;\r\n for (const d of lastViewCursorsRenderData) {\r\n if (request.target === d.domNode) {\r\n return request.fulfill(6 /* CONTENT_TEXT */, d.position, null, { mightBeForeignElement: false });\r\n }\r\n }\r\n }\r\n if (request.isInContentArea) {\r\n // Edge has a bug when hit-testing the exact position of a cursor,\r\n // instead of returning the correct dom node, it returns the\r\n // first or last rendered view line dom node, therefore help it out\r\n // and first check if we are on top of a cursor\r\n const lastViewCursorsRenderData = ctx.lastRenderData.lastViewCursorsRenderData;\r\n const mouseContentHorizontalOffset = request.mouseContentHorizontalOffset;\r\n const mouseVerticalOffset = request.mouseVerticalOffset;\r\n for (const d of lastViewCursorsRenderData) {\r\n if (mouseContentHorizontalOffset < d.contentLeft) {\r\n // mouse position is to the left of the cursor\r\n continue;\r\n }\r\n if (mouseContentHorizontalOffset > d.contentLeft + d.width) {\r\n // mouse position is to the right of the cursor\r\n continue;\r\n }\r\n const cursorVerticalOffset = ctx.getVerticalOffsetForLineNumber(d.position.lineNumber);\r\n if (cursorVerticalOffset <= mouseVerticalOffset\r\n && mouseVerticalOffset <= cursorVerticalOffset + d.height) {\r\n return request.fulfill(6 /* CONTENT_TEXT */, d.position, null, { mightBeForeignElement: false });\r\n }\r\n }\r\n }\r\n return null;\r\n }\r\n static _hitTestViewZone(ctx, request) {\r\n const viewZoneData = ctx.getZoneAtCoord(request.mouseVerticalOffset);\r\n if (viewZoneData) {\r\n const mouseTargetType = (request.isInContentArea ? 8 /* CONTENT_VIEW_ZONE */ : 5 /* GUTTER_VIEW_ZONE */);\r\n return request.fulfill(mouseTargetType, viewZoneData.position, null, viewZoneData);\r\n }\r\n return null;\r\n }\r\n static _hitTestTextArea(ctx, request) {\r\n // Is it the textarea?\r\n if (ElementPath.isTextArea(request.targetPath)) {\r\n if (ctx.lastRenderData.lastTextareaPosition) {\r\n return request.fulfill(6 /* CONTENT_TEXT */, ctx.lastRenderData.lastTextareaPosition, null, { mightBeForeignElement: false });\r\n }\r\n return request.fulfill(1 /* TEXTAREA */, ctx.lastRenderData.lastTextareaPosition);\r\n }\r\n return null;\r\n }\r\n static _hitTestMargin(ctx, request) {\r\n if (request.isInMarginArea) {\r\n const res = ctx.getFullLineRangeAtCoord(request.mouseVerticalOffset);\r\n const pos = res.range.getStartPosition();\r\n let offset = Math.abs(request.pos.x - request.editorPos.x);\r\n const detail = {\r\n isAfterLines: res.isAfterLines,\r\n glyphMarginLeft: ctx.layoutInfo.glyphMarginLeft,\r\n glyphMarginWidth: ctx.layoutInfo.glyphMarginWidth,\r\n lineNumbersWidth: ctx.layoutInfo.lineNumbersWidth,\r\n offsetX: offset\r\n };\r\n offset -= ctx.layoutInfo.glyphMarginLeft;\r\n if (offset <= ctx.layoutInfo.glyphMarginWidth) {\r\n // On the glyph margin\r\n return request.fulfill(2 /* GUTTER_GLYPH_MARGIN */, pos, res.range, detail);\r\n }\r\n offset -= ctx.layoutInfo.glyphMarginWidth;\r\n if (offset <= ctx.layoutInfo.lineNumbersWidth) {\r\n // On the line numbers\r\n return request.fulfill(3 /* GUTTER_LINE_NUMBERS */, pos, res.range, detail);\r\n }\r\n offset -= ctx.layoutInfo.lineNumbersWidth;\r\n // On the line decorations\r\n return request.fulfill(4 /* GUTTER_LINE_DECORATIONS */, pos, res.range, detail);\r\n }\r\n return null;\r\n }\r\n static _hitTestViewLines(ctx, request, domHitTestExecuted) {\r\n if (!ElementPath.isChildOfViewLines(request.targetPath)) {\r\n return null;\r\n }\r\n if (ctx.isInTopPadding(request.mouseVerticalOffset)) {\r\n return request.fulfill(7 /* CONTENT_EMPTY */, new Position(1, 1), null, EMPTY_CONTENT_AFTER_LINES);\r\n }\r\n // Check if it is below any lines and any view zones\r\n if (ctx.isAfterLines(request.mouseVerticalOffset) || ctx.isInBottomPadding(request.mouseVerticalOffset)) {\r\n // This most likely indicates it happened after the last view-line\r\n const lineCount = ctx.model.getLineCount();\r\n const maxLineColumn = ctx.model.getLineMaxColumn(lineCount);\r\n return request.fulfill(7 /* CONTENT_EMPTY */, new Position(lineCount, maxLineColumn), null, EMPTY_CONTENT_AFTER_LINES);\r\n }\r\n if (domHitTestExecuted) {\r\n // Check if we are hitting a view-line (can happen in the case of inline decorations on empty lines)\r\n // See https://github.com/microsoft/vscode/issues/46942\r\n if (ElementPath.isStrictChildOfViewLines(request.targetPath)) {\r\n const lineNumber = ctx.getLineNumberAtVerticalOffset(request.mouseVerticalOffset);\r\n if (ctx.model.getLineLength(lineNumber) === 0) {\r\n const lineWidth = ctx.getLineWidth(lineNumber);\r\n const detail = createEmptyContentDataInLines(request.mouseContentHorizontalOffset - lineWidth);\r\n return request.fulfill(7 /* CONTENT_EMPTY */, new Position(lineNumber, 1), null, detail);\r\n }\r\n const lineWidth = ctx.getLineWidth(lineNumber);\r\n if (request.mouseContentHorizontalOffset >= lineWidth) {\r\n const detail = createEmptyContentDataInLines(request.mouseContentHorizontalOffset - lineWidth);\r\n const pos = new Position(lineNumber, ctx.model.getLineMaxColumn(lineNumber));\r\n return request.fulfill(7 /* CONTENT_EMPTY */, pos, null, detail);\r\n }\r\n }\r\n // We have already executed hit test...\r\n return request.fulfill(0 /* UNKNOWN */);\r\n }\r\n const hitTestResult = MouseTargetFactory._doHitTest(ctx, request);\r\n if (hitTestResult.type === 1 /* Content */) {\r\n return MouseTargetFactory.createMouseTargetFromHitTestPosition(ctx, request, hitTestResult.spanNode, hitTestResult.position, hitTestResult.injectedText);\r\n }\r\n return this._createMouseTarget(ctx, request.withTarget(hitTestResult.hitTarget), true);\r\n }\r\n static _hitTestMinimap(ctx, request) {\r\n if (ElementPath.isChildOfMinimap(request.targetPath)) {\r\n const possibleLineNumber = ctx.getLineNumberAtVerticalOffset(request.mouseVerticalOffset);\r\n const maxColumn = ctx.model.getLineMaxColumn(possibleLineNumber);\r\n return request.fulfill(11 /* SCROLLBAR */, new Position(possibleLineNumber, maxColumn));\r\n }\r\n return null;\r\n }\r\n static _hitTestScrollbarSlider(ctx, request) {\r\n if (ElementPath.isChildOfScrollableElement(request.targetPath)) {\r\n if (request.target && request.target.nodeType === 1) {\r\n const className = request.target.className;\r\n if (className && /\\b(slider|scrollbar)\\b/.test(className)) {\r\n const possibleLineNumber = ctx.getLineNumberAtVerticalOffset(request.mouseVerticalOffset);\r\n const maxColumn = ctx.model.getLineMaxColumn(possibleLineNumber);\r\n return request.fulfill(11 /* SCROLLBAR */, new Position(possibleLineNumber, maxColumn));\r\n }\r\n }\r\n }\r\n return null;\r\n }\r\n static _hitTestScrollbar(ctx, request) {\r\n // Is it the overview ruler?\r\n // Is it a child of the scrollable element?\r\n if (ElementPath.isChildOfScrollableElement(request.targetPath)) {\r\n const possibleLineNumber = ctx.getLineNumberAtVerticalOffset(request.mouseVerticalOffset);\r\n const maxColumn = ctx.model.getLineMaxColumn(possibleLineNumber);\r\n return request.fulfill(11 /* SCROLLBAR */, new Position(possibleLineNumber, maxColumn));\r\n }\r\n return null;\r\n }\r\n getMouseColumn(editorPos, pos) {\r\n const options = this._context.configuration.options;\r\n const layoutInfo = options.get(129 /* layoutInfo */);\r\n const mouseContentHorizontalOffset = this._context.viewLayout.getCurrentScrollLeft() + pos.x - editorPos.x - layoutInfo.contentLeft;\r\n return MouseTargetFactory._getMouseColumn(mouseContentHorizontalOffset, options.get(41 /* fontInfo */).typicalHalfwidthCharacterWidth);\r\n }\r\n static _getMouseColumn(mouseContentHorizontalOffset, typicalHalfwidthCharacterWidth) {\r\n if (mouseContentHorizontalOffset < 0) {\r\n return 1;\r\n }\r\n const chars = Math.round(mouseContentHorizontalOffset / typicalHalfwidthCharacterWidth);\r\n return (chars + 1);\r\n }\r\n static createMouseTargetFromHitTestPosition(ctx, request, spanNode, pos, injectedText) {\r\n const lineNumber = pos.lineNumber;\r\n const column = pos.column;\r\n const lineWidth = ctx.getLineWidth(lineNumber);\r\n if (request.mouseContentHorizontalOffset > lineWidth) {\r\n const detail = createEmptyContentDataInLines(request.mouseContentHorizontalOffset - lineWidth);\r\n return request.fulfill(7 /* CONTENT_EMPTY */, pos, null, detail);\r\n }\r\n const visibleRange = ctx.visibleRangeForPosition(lineNumber, column);\r\n if (!visibleRange) {\r\n return request.fulfill(0 /* UNKNOWN */, pos);\r\n }\r\n const columnHorizontalOffset = visibleRange.left;\r\n if (request.mouseContentHorizontalOffset === columnHorizontalOffset) {\r\n return request.fulfill(6 /* CONTENT_TEXT */, pos, null, { mightBeForeignElement: !!injectedText });\r\n }\r\n const points = [];\r\n points.push({ offset: visibleRange.left, column: column });\r\n if (column > 1) {\r\n const visibleRange = ctx.visibleRangeForPosition(lineNumber, column - 1);\r\n if (visibleRange) {\r\n points.push({ offset: visibleRange.left, column: column - 1 });\r\n }\r\n }\r\n const lineMaxColumn = ctx.model.getLineMaxColumn(lineNumber);\r\n if (column < lineMaxColumn) {\r\n const visibleRange = ctx.visibleRangeForPosition(lineNumber, column + 1);\r\n if (visibleRange) {\r\n points.push({ offset: visibleRange.left, column: column + 1 });\r\n }\r\n }\r\n points.sort((a, b) => a.offset - b.offset);\r\n const mouseCoordinates = request.pos.toClientCoordinates();\r\n const spanNodeClientRect = spanNode.getBoundingClientRect();\r\n const mouseIsOverSpanNode = (spanNodeClientRect.left <= mouseCoordinates.clientX && mouseCoordinates.clientX <= spanNodeClientRect.right);\r\n for (let i = 1; i < points.length; i++) {\r\n const prev = points[i - 1];\r\n const curr = points[i];\r\n if (prev.offset <= request.mouseContentHorizontalOffset && request.mouseContentHorizontalOffset <= curr.offset) {\r\n const rng = new EditorRange(lineNumber, prev.column, lineNumber, curr.column);\r\n return request.fulfill(6 /* CONTENT_TEXT */, pos, rng, { mightBeForeignElement: !mouseIsOverSpanNode || !!injectedText });\r\n }\r\n }\r\n return request.fulfill(6 /* CONTENT_TEXT */, pos, null, { mightBeForeignElement: !mouseIsOverSpanNode || !!injectedText });\r\n }\r\n /**\r\n * Most probably WebKit browsers and Edge\r\n */\r\n static _doHitTestWithCaretRangeFromPoint(ctx, request) {\r\n // In Chrome, especially on Linux it is possible to click between lines,\r\n // so try to adjust the `hity` below so that it lands in the center of a line\r\n const lineNumber = ctx.getLineNumberAtVerticalOffset(request.mouseVerticalOffset);\r\n const lineVerticalOffset = ctx.getVerticalOffsetForLineNumber(lineNumber);\r\n const lineCenteredVerticalOffset = lineVerticalOffset + Math.floor(ctx.lineHeight / 2);\r\n let adjustedPageY = request.pos.y + (lineCenteredVerticalOffset - request.mouseVerticalOffset);\r\n if (adjustedPageY <= request.editorPos.y) {\r\n adjustedPageY = request.editorPos.y + 1;\r\n }\r\n if (adjustedPageY >= request.editorPos.y + ctx.layoutInfo.height) {\r\n adjustedPageY = request.editorPos.y + ctx.layoutInfo.height - 1;\r\n }\r\n const adjustedPage = new PageCoordinates(request.pos.x, adjustedPageY);\r\n const r = this._actualDoHitTestWithCaretRangeFromPoint(ctx, adjustedPage.toClientCoordinates());\r\n if (r.type === 1 /* Content */) {\r\n return r;\r\n }\r\n // Also try to hit test without the adjustment (for the edge cases that we are near the top or bottom)\r\n return this._actualDoHitTestWithCaretRangeFromPoint(ctx, request.pos.toClientCoordinates());\r\n }\r\n static _actualDoHitTestWithCaretRangeFromPoint(ctx, coords) {\r\n const shadowRoot = dom.getShadowRoot(ctx.viewDomNode);\r\n let range;\r\n if (shadowRoot) {\r\n if (typeof shadowRoot.caretRangeFromPoint === 'undefined') {\r\n range = shadowCaretRangeFromPoint(shadowRoot, coords.clientX, coords.clientY);\r\n }\r\n else {\r\n range = shadowRoot.caretRangeFromPoint(coords.clientX, coords.clientY);\r\n }\r\n }\r\n else {\r\n range = document.caretRangeFromPoint(coords.clientX, coords.clientY);\r\n }\r\n if (!range || !range.startContainer) {\r\n return new UnknownHitTestResult();\r\n }\r\n // Chrome always hits a TEXT_NODE, while Edge sometimes hits a token span\r\n const startContainer = range.startContainer;\r\n if (startContainer.nodeType === startContainer.TEXT_NODE) {\r\n // startContainer is expected to be the token text\r\n const parent1 = startContainer.parentNode; // expected to be the token span\r\n const parent2 = parent1 ? parent1.parentNode : null; // expected to be the view line container span\r\n const parent3 = parent2 ? parent2.parentNode : null; // expected to be the view line div\r\n const parent3ClassName = parent3 && parent3.nodeType === parent3.ELEMENT_NODE ? parent3.className : null;\r\n if (parent3ClassName === ViewLine.CLASS_NAME) {\r\n return HitTestResult.createFromDOMInfo(ctx, parent1, range.startOffset);\r\n }\r\n else {\r\n return new UnknownHitTestResult(startContainer.parentNode);\r\n }\r\n }\r\n else if (startContainer.nodeType === startContainer.ELEMENT_NODE) {\r\n // startContainer is expected to be the token span\r\n const parent1 = startContainer.parentNode; // expected to be the view line container span\r\n const parent2 = parent1 ? parent1.parentNode : null; // expected to be the view line div\r\n const parent2ClassName = parent2 && parent2.nodeType === parent2.ELEMENT_NODE ? parent2.className : null;\r\n if (parent2ClassName === ViewLine.CLASS_NAME) {\r\n return HitTestResult.createFromDOMInfo(ctx, startContainer, startContainer.textContent.length);\r\n }\r\n else {\r\n return new UnknownHitTestResult(startContainer);\r\n }\r\n }\r\n return new UnknownHitTestResult();\r\n }\r\n /**\r\n * Most probably Gecko\r\n */\r\n static _doHitTestWithCaretPositionFromPoint(ctx, coords) {\r\n const hitResult = document.caretPositionFromPoint(coords.clientX, coords.clientY);\r\n if (hitResult.offsetNode.nodeType === hitResult.offsetNode.TEXT_NODE) {\r\n // offsetNode is expected to be the token text\r\n const parent1 = hitResult.offsetNode.parentNode; // expected to be the token span\r\n const parent2 = parent1 ? parent1.parentNode : null; // expected to be the view line container span\r\n const parent3 = parent2 ? parent2.parentNode : null; // expected to be the view line div\r\n const parent3ClassName = parent3 && parent3.nodeType === parent3.ELEMENT_NODE ? parent3.className : null;\r\n if (parent3ClassName === ViewLine.CLASS_NAME) {\r\n return HitTestResult.createFromDOMInfo(ctx, hitResult.offsetNode.parentNode, hitResult.offset);\r\n }\r\n else {\r\n return new UnknownHitTestResult(hitResult.offsetNode.parentNode);\r\n }\r\n }\r\n // For inline decorations, Gecko sometimes returns the `` of the line and the offset is the `` with the inline decoration\r\n // Some other times, it returns the `` with the inline decoration\r\n if (hitResult.offsetNode.nodeType === hitResult.offsetNode.ELEMENT_NODE) {\r\n const parent1 = hitResult.offsetNode.parentNode;\r\n const parent1ClassName = parent1 && parent1.nodeType === parent1.ELEMENT_NODE ? parent1.className : null;\r\n const parent2 = parent1 ? parent1.parentNode : null;\r\n const parent2ClassName = parent2 && parent2.nodeType === parent2.ELEMENT_NODE ? parent2.className : null;\r\n if (parent1ClassName === ViewLine.CLASS_NAME) {\r\n // it returned the `` of the line and the offset is the `` with the inline decoration\r\n const tokenSpan = hitResult.offsetNode.childNodes[Math.min(hitResult.offset, hitResult.offsetNode.childNodes.length - 1)];\r\n if (tokenSpan) {\r\n return HitTestResult.createFromDOMInfo(ctx, tokenSpan, 0);\r\n }\r\n }\r\n else if (parent2ClassName === ViewLine.CLASS_NAME) {\r\n // it returned the `` with the inline decoration\r\n return HitTestResult.createFromDOMInfo(ctx, hitResult.offsetNode, 0);\r\n }\r\n }\r\n return new UnknownHitTestResult(hitResult.offsetNode);\r\n }\r\n static _snapToSoftTabBoundary(position, viewModel) {\r\n const lineContent = viewModel.getLineContent(position.lineNumber);\r\n const { tabSize } = viewModel.getTextModelOptions();\r\n const newPosition = AtomicTabMoveOperations.atomicPosition(lineContent, position.column - 1, tabSize, 2 /* Nearest */);\r\n if (newPosition !== -1) {\r\n return new Position(position.lineNumber, newPosition + 1);\r\n }\r\n return position;\r\n }\r\n static _doHitTest(ctx, request) {\r\n let result = new UnknownHitTestResult();\r\n if (typeof document.caretRangeFromPoint === 'function') {\r\n result = this._doHitTestWithCaretRangeFromPoint(ctx, request);\r\n }\r\n else if (document.caretPositionFromPoint) {\r\n result = this._doHitTestWithCaretPositionFromPoint(ctx, request.pos.toClientCoordinates());\r\n }\r\n if (result.type === 1 /* Content */) {\r\n const injectedText = ctx.model.getInjectedTextAt(result.position);\r\n const normalizedPosition = ctx.model.normalizePosition(result.position, 2 /* None */);\r\n if (injectedText || !normalizedPosition.equals(result.position)) {\r\n result = new ContentHitTestResult(normalizedPosition, result.spanNode, injectedText);\r\n }\r\n }\r\n // Snap to the nearest soft tab boundary if atomic soft tabs are enabled.\r\n if (result.type === 1 /* Content */ && ctx.stickyTabStops) {\r\n result = new ContentHitTestResult(this._snapToSoftTabBoundary(result.position, ctx.model), result.spanNode, result.injectedText);\r\n }\r\n return result;\r\n }\r\n}\r\nexport function shadowCaretRangeFromPoint(shadowRoot, x, y) {\r\n const range = document.createRange();\r\n // Get the element under the point\r\n let el = shadowRoot.elementFromPoint(x, y);\r\n if (el !== null) {\r\n // Get the last child of the element until its firstChild is a text node\r\n // This assumes that the pointer is on the right of the line, out of the tokens\r\n // and that we want to get the offset of the last token of the line\r\n while (el && el.firstChild && el.firstChild.nodeType !== el.firstChild.TEXT_NODE && el.lastChild && el.lastChild.firstChild) {\r\n el = el.lastChild;\r\n }\r\n // Grab its rect\r\n const rect = el.getBoundingClientRect();\r\n // And its font\r\n const font = window.getComputedStyle(el, null).getPropertyValue('font');\r\n // And also its txt content\r\n const text = el.innerText;\r\n // Position the pixel cursor at the left of the element\r\n let pixelCursor = rect.left;\r\n let offset = 0;\r\n let step;\r\n // If the point is on the right of the box put the cursor after the last character\r\n if (x > rect.left + rect.width) {\r\n offset = text.length;\r\n }\r\n else {\r\n const charWidthReader = CharWidthReader.getInstance();\r\n // Goes through all the characters of the innerText, and checks if the x of the point\r\n // belongs to the character.\r\n for (let i = 0; i < text.length + 1; i++) {\r\n // The step is half the width of the character\r\n step = charWidthReader.getCharWidth(text.charAt(i), font) / 2;\r\n // Move to the center of the character\r\n pixelCursor += step;\r\n // If the x of the point is smaller that the position of the cursor, the point is over that character\r\n if (x < pixelCursor) {\r\n offset = i;\r\n break;\r\n }\r\n // Move between the current character and the next\r\n pixelCursor += step;\r\n }\r\n }\r\n // Creates a range with the text node of the element and set the offset found\r\n range.setStart(el.firstChild, offset);\r\n range.setEnd(el.firstChild, offset);\r\n }\r\n return range;\r\n}\r\nclass CharWidthReader {\r\n constructor() {\r\n this._cache = {};\r\n this._canvas = document.createElement('canvas');\r\n }\r\n static getInstance() {\r\n if (!CharWidthReader._INSTANCE) {\r\n CharWidthReader._INSTANCE = new CharWidthReader();\r\n }\r\n return CharWidthReader._INSTANCE;\r\n }\r\n getCharWidth(char, font) {\r\n const cacheKey = char + font;\r\n if (this._cache[cacheKey]) {\r\n return this._cache[cacheKey];\r\n }\r\n const context = this._canvas.getContext('2d');\r\n context.font = font;\r\n const metrics = context.measureText(char);\r\n const width = metrics.width;\r\n this._cache[cacheKey] = width;\r\n return width;\r\n }\r\n}\r\nCharWidthReader._INSTANCE = null;\r\n", "/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License. See License.txt in the project root for license information.\r\n *--------------------------------------------------------------------------------------------*/\r\nimport * as dom from '../../../base/browser/dom.js';\r\nimport { StandardWheelEvent } from '../../../base/browser/mouseEvent.js';\r\nimport { TimeoutTimer } from '../../../base/common/async.js';\r\nimport { Disposable } from '../../../base/common/lifecycle.js';\r\nimport * as platform from '../../../base/common/platform.js';\r\nimport { HitTestContext, MouseTarget, MouseTargetFactory } from './mouseTarget.js';\r\nimport { ClientCoordinates, EditorMouseEventFactory, GlobalEditorMouseMoveMonitor, createEditorPagePosition } from '../editorDom.js';\r\nimport { EditorZoom } from '../../common/config/editorZoom.js';\r\nimport { Position } from '../../common/core/position.js';\r\nimport { Selection } from '../../common/core/selection.js';\r\nimport { ViewEventHandler } from '../../common/viewModel/viewEventHandler.js';\r\n/**\r\n * Merges mouse events when mouse move events are throttled\r\n */\r\nexport function createMouseMoveEventMerger(mouseTargetFactory) {\r\n return function (lastEvent, currentEvent) {\r\n let targetIsWidget = false;\r\n if (mouseTargetFactory) {\r\n targetIsWidget = mouseTargetFactory.mouseTargetIsWidget(currentEvent);\r\n }\r\n if (!targetIsWidget) {\r\n currentEvent.preventDefault();\r\n }\r\n return currentEvent;\r\n };\r\n}\r\nexport class MouseHandler extends ViewEventHandler {\r\n constructor(context, viewController, viewHelper) {\r\n super();\r\n this._context = context;\r\n this.viewController = viewController;\r\n this.viewHelper = viewHelper;\r\n this.mouseTargetFactory = new MouseTargetFactory(this._context, viewHelper);\r\n this._mouseDownOperation = this._register(new MouseDownOperation(this._context, this.viewController, this.viewHelper, (e, testEventTarget) => this._createMouseTarget(e, testEventTarget), (e) => this._getMouseColumn(e)));\r\n this.lastMouseLeaveTime = -1;\r\n this._height = this._context.configuration.options.get(129 /* layoutInfo */).height;\r\n const mouseEvents = new EditorMouseEventFactory(this.viewHelper.viewDomNode);\r\n this._register(mouseEvents.onContextMenu(this.viewHelper.viewDomNode, (e) => this._onContextMenu(e, true)));\r\n this._register(mouseEvents.onMouseMoveThrottled(this.viewHelper.viewDomNode, (e) => this._onMouseMove(e), createMouseMoveEventMerger(this.mouseTargetFactory), MouseHandler.MOUSE_MOVE_MINIMUM_TIME));\r\n this._register(mouseEvents.onMouseUp(this.viewHelper.viewDomNode, (e) => this._onMouseUp(e)));\r\n this._register(mouseEvents.onMouseLeave(this.viewHelper.viewDomNode, (e) => this._onMouseLeave(e)));\r\n this._register(mouseEvents.onMouseDown(this.viewHelper.viewDomNode, (e) => this._onMouseDown(e)));\r\n const onMouseWheel = (browserEvent) => {\r\n this.viewController.emitMouseWheel(browserEvent);\r\n if (!this._context.configuration.options.get(66 /* mouseWheelZoom */)) {\r\n return;\r\n }\r\n const e = new StandardWheelEvent(browserEvent);\r\n const doMouseWheelZoom = (platform.isMacintosh\r\n // on macOS we support cmd + two fingers scroll (`metaKey` set)\r\n // and also the two fingers pinch gesture (`ctrKey` set)\r\n ? ((browserEvent.metaKey || browserEvent.ctrlKey) && !browserEvent.shiftKey && !browserEvent.altKey)\r\n : (browserEvent.ctrlKey && !browserEvent.metaKey && !browserEvent.shiftKey && !browserEvent.altKey));\r\n if (doMouseWheelZoom) {\r\n const zoomLevel = EditorZoom.getZoomLevel();\r\n const delta = e.deltaY > 0 ? 1 : -1;\r\n EditorZoom.setZoomLevel(zoomLevel + delta);\r\n e.preventDefault();\r\n e.stopPropagation();\r\n }\r\n };\r\n this._register(dom.addDisposableListener(this.viewHelper.viewDomNode, dom.EventType.MOUSE_WHEEL, onMouseWheel, { capture: true, passive: false }));\r\n this._context.addEventHandler(this);\r\n }\r\n dispose() {\r\n this._context.removeEventHandler(this);\r\n super.dispose();\r\n }\r\n // --- begin event handlers\r\n onConfigurationChanged(e) {\r\n if (e.hasChanged(129 /* layoutInfo */)) {\r\n // layout change\r\n const height = this._context.configuration.options.get(129 /* layoutInfo */).height;\r\n if (this._height !== height) {\r\n this._height = height;\r\n this._mouseDownOperation.onHeightChanged();\r\n }\r\n }\r\n return false;\r\n }\r\n onCursorStateChanged(e) {\r\n this._mouseDownOperation.onCursorStateChanged(e);\r\n return false;\r\n }\r\n onFocusChanged(e) {\r\n return false;\r\n }\r\n onScrollChanged(e) {\r\n this._mouseDownOperation.onScrollChanged();\r\n return false;\r\n }\r\n // --- end event handlers\r\n getTargetAtClientPoint(clientX, clientY) {\r\n const clientPos = new ClientCoordinates(clientX, clientY);\r\n const pos = clientPos.toPageCoordinates();\r\n const editorPos = createEditorPagePosition(this.viewHelper.viewDomNode);\r\n if (pos.y < editorPos.y || pos.y > editorPos.y + editorPos.height || pos.x < editorPos.x || pos.x > editorPos.x + editorPos.width) {\r\n return null;\r\n }\r\n return this.mouseTargetFactory.createMouseTarget(this.viewHelper.getLastRenderData(), editorPos, pos, null);\r\n }\r\n _createMouseTarget(e, testEventTarget) {\r\n return this.mouseTargetFactory.createMouseTarget(this.viewHelper.getLastRenderData(), e.editorPos, e.pos, testEventTarget ? e.target : null);\r\n }\r\n _getMouseColumn(e) {\r\n return this.mouseTargetFactory.getMouseColumn(e.editorPos, e.pos);\r\n }\r\n _onContextMenu(e, testEventTarget) {\r\n this.viewController.emitContextMenu({\r\n event: e,\r\n target: this._createMouseTarget(e, testEventTarget)\r\n });\r\n }\r\n _onMouseMove(e) {\r\n if (this._mouseDownOperation.isActive()) {\r\n // In selection/drag operation\r\n return;\r\n }\r\n const actualMouseMoveTime = e.timestamp;\r\n if (actualMouseMoveTime < this.lastMouseLeaveTime) {\r\n // Due to throttling, this event occurred before the mouse left the editor, therefore ignore it.\r\n return;\r\n }\r\n this.viewController.emitMouseMove({\r\n event: e,\r\n target: this._createMouseTarget(e, true)\r\n });\r\n }\r\n _onMouseLeave(e) {\r\n this.lastMouseLeaveTime = (new Date()).getTime();\r\n this.viewController.emitMouseLeave({\r\n event: e,\r\n target: null\r\n });\r\n }\r\n _onMouseUp(e) {\r\n this.viewController.emitMouseUp({\r\n event: e,\r\n target: this._createMouseTarget(e, true)\r\n });\r\n }\r\n _onMouseDown(e) {\r\n const t = this._createMouseTarget(e, true);\r\n const targetIsContent = (t.type === 6 /* CONTENT_TEXT */ || t.type === 7 /* CONTENT_EMPTY */);\r\n const targetIsGutter = (t.type === 2 /* GUTTER_GLYPH_MARGIN */ || t.type === 3 /* GUTTER_LINE_NUMBERS */ || t.type === 4 /* GUTTER_LINE_DECORATIONS */);\r\n const targetIsLineNumbers = (t.type === 3 /* GUTTER_LINE_NUMBERS */);\r\n const selectOnLineNumbers = this._context.configuration.options.get(97 /* selectOnLineNumbers */);\r\n const targetIsViewZone = (t.type === 8 /* CONTENT_VIEW_ZONE */ || t.type === 5 /* GUTTER_VIEW_ZONE */);\r\n const targetIsWidget = (t.type === 9 /* CONTENT_WIDGET */);\r\n let shouldHandle = e.leftButton || e.middleButton;\r\n if (platform.isMacintosh && e.leftButton && e.ctrlKey) {\r\n shouldHandle = false;\r\n }\r\n const focus = () => {\r\n e.preventDefault();\r\n this.viewHelper.focusTextArea();\r\n };\r\n if (shouldHandle && (targetIsContent || (targetIsLineNumbers && selectOnLineNumbers))) {\r\n focus();\r\n this._mouseDownOperation.start(t.type, e);\r\n }\r\n else if (targetIsGutter) {\r\n // Do not steal focus\r\n e.preventDefault();\r\n }\r\n else if (targetIsViewZone) {\r\n const viewZoneData = t.detail;\r\n if (this.viewHelper.shouldSuppressMouseDownOnViewZone(viewZoneData.viewZoneId)) {\r\n focus();\r\n this._mouseDownOperation.start(t.type, e);\r\n e.preventDefault();\r\n }\r\n }\r\n else if (targetIsWidget && this.viewHelper.shouldSuppressMouseDownOnWidget(t.detail)) {\r\n focus();\r\n e.preventDefault();\r\n }\r\n this.viewController.emitMouseDown({\r\n event: e,\r\n target: t\r\n });\r\n }\r\n}\r\nMouseHandler.MOUSE_MOVE_MINIMUM_TIME = 100; // ms\r\nclass MouseDownOperation extends Disposable {\r\n constructor(context, viewController, viewHelper, createMouseTarget, getMouseColumn) {\r\n super();\r\n this._context = context;\r\n this._viewController = viewController;\r\n this._viewHelper = viewHelper;\r\n this._createMouseTarget = createMouseTarget;\r\n this._getMouseColumn = getMouseColumn;\r\n this._mouseMoveMonitor = this._register(new GlobalEditorMouseMoveMonitor(this._viewHelper.viewDomNode));\r\n this._onScrollTimeout = this._register(new TimeoutTimer());\r\n this._mouseState = new MouseDownState();\r\n this._currentSelection = new Selection(1, 1, 1, 1);\r\n this._isActive = false;\r\n this._lastMouseEvent = null;\r\n }\r\n dispose() {\r\n super.dispose();\r\n }\r\n isActive() {\r\n return this._isActive;\r\n }\r\n _onMouseDownThenMove(e) {\r\n this._lastMouseEvent = e;\r\n this._mouseState.setModifiers(e);\r\n const position = this._findMousePosition(e, true);\r\n if (!position) {\r\n // Ignoring because position is unknown\r\n return;\r\n }\r\n if (this._mouseState.isDragAndDrop) {\r\n this._viewController.emitMouseDrag({\r\n event: e,\r\n target: position\r\n });\r\n }\r\n else {\r\n this._dispatchMouse(position, true);\r\n }\r\n }\r\n start(targetType, e) {\r\n this._lastMouseEvent = e;\r\n this._mouseState.setStartedOnLineNumbers(targetType === 3 /* GUTTER_LINE_NUMBERS */);\r\n this._mouseState.setStartButtons(e);\r\n this._mouseState.setModifiers(e);\r\n const position = this._findMousePosition(e, true);\r\n if (!position || !position.position) {\r\n // Ignoring because position is unknown\r\n return;\r\n }\r\n this._mouseState.trySetCount(e.detail, position.position);\r\n // Overwrite the detail of the MouseEvent, as it will be sent out in an event and contributions might rely on it.\r\n e.detail = this._mouseState.count;\r\n const options = this._context.configuration.options;\r\n if (!options.get(79 /* readOnly */)\r\n && options.get(29 /* dragAndDrop */)\r\n && !options.get(16 /* columnSelection */)\r\n && !this._mouseState.altKey // we don't support multiple mouse\r\n && e.detail < 2 // only single click on a selection can work\r\n && !this._isActive // the mouse is not down yet\r\n && !this._currentSelection.isEmpty() // we don't drag single cursor\r\n && (position.type === 6 /* CONTENT_TEXT */) // single click on text\r\n && position.position && this._currentSelection.containsPosition(position.position) // single click on a selection\r\n ) {\r\n this._mouseState.isDragAndDrop = true;\r\n this._isActive = true;\r\n this._mouseMoveMonitor.startMonitoring(e.target, e.buttons, createMouseMoveEventMerger(null), (e) => this._onMouseDownThenMove(e), (browserEvent) => {\r\n const position = this._findMousePosition(this._lastMouseEvent, true);\r\n if (browserEvent && browserEvent instanceof KeyboardEvent) {\r\n // cancel\r\n this._viewController.emitMouseDropCanceled();\r\n }\r\n else {\r\n this._viewController.emitMouseDrop({\r\n event: this._lastMouseEvent,\r\n target: (position ? this._createMouseTarget(this._lastMouseEvent, true) : null) // Ignoring because position is unknown, e.g., Content View Zone\r\n });\r\n }\r\n this._stop();\r\n });\r\n return;\r\n }\r\n this._mouseState.isDragAndDrop = false;\r\n this._dispatchMouse(position, e.shiftKey);\r\n if (!this._isActive) {\r\n this._isActive = true;\r\n this._mouseMoveMonitor.startMonitoring(e.target, e.buttons, createMouseMoveEventMerger(null), (e) => this._onMouseDownThenMove(e), () => this._stop());\r\n }\r\n }\r\n _stop() {\r\n this._isActive = false;\r\n this._onScrollTimeout.cancel();\r\n }\r\n onHeightChanged() {\r\n this._mouseMoveMonitor.stopMonitoring();\r\n }\r\n onScrollChanged() {\r\n if (!this._isActive) {\r\n return;\r\n }\r\n this._onScrollTimeout.setIfNotSet(() => {\r\n if (!this._lastMouseEvent) {\r\n return;\r\n }\r\n const position = this._findMousePosition(this._lastMouseEvent, false);\r\n if (!position) {\r\n // Ignoring because position is unknown\r\n return;\r\n }\r\n if (this._mouseState.isDragAndDrop) {\r\n // Ignoring because users are dragging the text\r\n return;\r\n }\r\n this._dispatchMouse(position, true);\r\n }, 10);\r\n }\r\n onCursorStateChanged(e) {\r\n this._currentSelection = e.selections[0];\r\n }\r\n _getPositionOutsideEditor(e) {\r\n const editorContent = e.editorPos;\r\n const model = this._context.model;\r\n const viewLayout = this._context.viewLayout;\r\n const mouseColumn = this._getMouseColumn(e);\r\n if (e.posy < editorContent.y) {\r\n const verticalOffset = Math.max(viewLayout.getCurrentScrollTop() - (editorContent.y - e.posy), 0);\r\n const viewZoneData = HitTestContext.getZoneAtCoord(this._context, verticalOffset);\r\n if (viewZoneData) {\r\n const newPosition = this._helpPositionJumpOverViewZone(viewZoneData);\r\n if (newPosition) {\r\n return new MouseTarget(null, 13 /* OUTSIDE_EDITOR */, mouseColumn, newPosition);\r\n }\r\n }\r\n const aboveLineNumber = viewLayout.getLineNumberAtVerticalOffset(verticalOffset);\r\n return new MouseTarget(null, 13 /* OUTSIDE_EDITOR */, mouseColumn, new Position(aboveLineNumber, 1));\r\n }\r\n if (e.posy > editorContent.y + editorContent.height) {\r\n const verticalOffset = viewLayout.getCurrentScrollTop() + (e.posy - editorContent.y);\r\n const viewZoneData = HitTestContext.getZoneAtCoord(this._context, verticalOffset);\r\n if (viewZoneData) {\r\n const newPosition = this._helpPositionJumpOverViewZone(viewZoneData);\r\n if (newPosition) {\r\n return new MouseTarget(null, 13 /* OUTSIDE_EDITOR */, mouseColumn, newPosition);\r\n }\r\n }\r\n const belowLineNumber = viewLayout.getLineNumberAtVerticalOffset(verticalOffset);\r\n return new MouseTarget(null, 13 /* OUTSIDE_EDITOR */, mouseColumn, new Position(belowLineNumber, model.getLineMaxColumn(belowLineNumber)));\r\n }\r\n const possibleLineNumber = viewLayout.getLineNumberAtVerticalOffset(viewLayout.getCurrentScrollTop() + (e.posy - editorContent.y));\r\n if (e.posx < editorContent.x) {\r\n return new MouseTarget(null, 13 /* OUTSIDE_EDITOR */, mouseColumn, new Position(possibleLineNumber, 1));\r\n }\r\n if (e.posx > editorContent.x + editorContent.width) {\r\n return new MouseTarget(null, 13 /* OUTSIDE_EDITOR */, mouseColumn, new Position(possibleLineNumber, model.getLineMaxColumn(possibleLineNumber)));\r\n }\r\n return null;\r\n }\r\n _findMousePosition(e, testEventTarget) {\r\n const positionOutsideEditor = this._getPositionOutsideEditor(e);\r\n if (positionOutsideEditor) {\r\n return positionOutsideEditor;\r\n }\r\n const t = this._createMouseTarget(e, testEventTarget);\r\n const hintedPosition = t.position;\r\n if (!hintedPosition) {\r\n return null;\r\n }\r\n if (t.type === 8 /* CONTENT_VIEW_ZONE */ || t.type === 5 /* GUTTER_VIEW_ZONE */) {\r\n const newPosition = this._helpPositionJumpOverViewZone(t.detail);\r\n if (newPosition) {\r\n return new MouseTarget(t.element, t.type, t.mouseColumn, newPosition, null, t.detail);\r\n }\r\n }\r\n return t;\r\n }\r\n _helpPositionJumpOverViewZone(viewZoneData) {\r\n // Force position on view zones to go above or below depending on where selection started from\r\n const selectionStart = new Position(this._currentSelection.selectionStartLineNumber, this._currentSelection.selectionStartColumn);\r\n const positionBefore = viewZoneData.positionBefore;\r\n const positionAfter = viewZoneData.positionAfter;\r\n if (positionBefore && positionAfter) {\r\n if (positionBefore.isBefore(selectionStart)) {\r\n return positionBefore;\r\n }\r\n else {\r\n return positionAfter;\r\n }\r\n }\r\n return null;\r\n }\r\n _dispatchMouse(position, inSelectionMode) {\r\n if (!position.position) {\r\n return;\r\n }\r\n this._viewController.dispatchMouse({\r\n position: position.position,\r\n mouseColumn: position.mouseColumn,\r\n startedOnLineNumbers: this._mouseState.startedOnLineNumbers,\r\n inSelectionMode: inSelectionMode,\r\n mouseDownCount: this._mouseState.count,\r\n altKey: this._mouseState.altKey,\r\n ctrlKey: this._mouseState.ctrlKey,\r\n metaKey: this._mouseState.metaKey,\r\n shiftKey: this._mouseState.shiftKey,\r\n leftButton: this._mouseState.leftButton,\r\n middleButton: this._mouseState.middleButton,\r\n });\r\n }\r\n}\r\nclass MouseDownState {\r\n constructor() {\r\n this._altKey = false;\r\n this._ctrlKey = false;\r\n this._metaKey = false;\r\n this._shiftKey = false;\r\n this._leftButton = false;\r\n this._middleButton = false;\r\n this._startedOnLineNumbers = false;\r\n this._lastMouseDownPosition = null;\r\n this._lastMouseDownPositionEqualCount = 0;\r\n this._lastMouseDownCount = 0;\r\n this._lastSetMouseDownCountTime = 0;\r\n this.isDragAndDrop = false;\r\n }\r\n get altKey() { return this._altKey; }\r\n get ctrlKey() { return this._ctrlKey; }\r\n get metaKey() { return this._metaKey; }\r\n get shiftKey() { return this._shiftKey; }\r\n get leftButton() { return this._leftButton; }\r\n get middleButton() { return this._middleButton; }\r\n get startedOnLineNumbers() { return this._startedOnLineNumbers; }\r\n get count() {\r\n return this._lastMouseDownCount;\r\n }\r\n setModifiers(source) {\r\n this._altKey = source.altKey;\r\n this._ctrlKey = source.ctrlKey;\r\n this._metaKey = source.metaKey;\r\n this._shiftKey = source.shiftKey;\r\n }\r\n setStartButtons(source) {\r\n this._leftButton = source.leftButton;\r\n this._middleButton = source.middleButton;\r\n }\r\n setStartedOnLineNumbers(startedOnLineNumbers) {\r\n this._startedOnLineNumbers = startedOnLineNumbers;\r\n }\r\n trySetCount(setMouseDownCount, newMouseDownPosition) {\r\n // a. Invalidate multiple clicking if too much time has passed (will be hit by IE because the detail field of mouse events contains garbage in IE10)\r\n const currentTime = (new Date()).getTime();\r\n if (currentTime - this._lastSetMouseDownCountTime > MouseDownState.CLEAR_MOUSE_DOWN_COUNT_TIME) {\r\n setMouseDownCount = 1;\r\n }\r\n this._lastSetMouseDownCountTime = currentTime;\r\n // b. Ensure that we don't jump from single click to triple click in one go (will be hit by IE because the detail field of mouse events contains garbage in IE10)\r\n if (setMouseDownCount > this._lastMouseDownCount + 1) {\r\n setMouseDownCount = this._lastMouseDownCount + 1;\r\n }\r\n // c. Invalidate multiple clicking if the logical position is different\r\n if (this._lastMouseDownPosition && this._lastMouseDownPosition.equals(newMouseDownPosition)) {\r\n this._lastMouseDownPositionEqualCount++;\r\n }\r\n else {\r\n this._lastMouseDownPositionEqualCount = 1;\r\n }\r\n this._lastMouseDownPosition = newMouseDownPosition;\r\n // Finally set the lastMouseDownCount\r\n this._lastMouseDownCount = Math.min(setMouseDownCount, this._lastMouseDownPositionEqualCount);\r\n }\r\n}\r\nMouseDownState.CLEAR_MOUSE_DOWN_COUNT_TIME = 400; // ms\r\n", "/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License. See License.txt in the project root for license information.\r\n *--------------------------------------------------------------------------------------------*/\r\nimport { basename, posix } from './path.js';\r\nimport { startsWithUTF8BOM } from './strings.js';\r\nimport { match } from './glob.js';\r\nimport { Schemas } from './network.js';\r\nimport { DataUri } from './resources.js';\r\nexport var Mimes;\r\n(function (Mimes) {\r\n Mimes.text = 'text/plain';\r\n Mimes.binary = 'application/octet-stream';\r\n Mimes.unknown = 'application/unknown';\r\n Mimes.markdown = 'text/markdown';\r\n})(Mimes || (Mimes = {}));\r\nlet registeredAssociations = [];\r\nlet nonUserRegisteredAssociations = [];\r\nlet userRegisteredAssociations = [];\r\n/**\r\n * Associate a text mime to the registry.\r\n */\r\nexport function registerTextMime(association, warnOnOverwrite = false) {\r\n // Register\r\n const associationItem = toTextMimeAssociationItem(association);\r\n registeredAssociations.push(associationItem);\r\n if (!associationItem.userConfigured) {\r\n nonUserRegisteredAssociations.push(associationItem);\r\n }\r\n else {\r\n userRegisteredAssociations.push(associationItem);\r\n }\r\n // Check for conflicts unless this is a user configured association\r\n if (warnOnOverwrite && !associationItem.userConfigured) {\r\n registeredAssociations.forEach(a => {\r\n if (a.mime === associationItem.mime || a.userConfigured) {\r\n return; // same mime or userConfigured is ok\r\n }\r\n if (associationItem.extension && a.extension === associationItem.extension) {\r\n console.warn(`Overwriting extension <<${associationItem.extension}>> to now point to mime <<${associationItem.mime}>>`);\r\n }\r\n if (associationItem.filename && a.filename === associationItem.filename) {\r\n console.warn(`Overwriting filename <<${associationItem.filename}>> to now point to mime <<${associationItem.mime}>>`);\r\n }\r\n if (associationItem.filepattern && a.filepattern === associationItem.filepattern) {\r\n console.warn(`Overwriting filepattern <<${associationItem.filepattern}>> to now point to mime <<${associationItem.mime}>>`);\r\n }\r\n if (associationItem.firstline && a.firstline === associationItem.firstline) {\r\n console.warn(`Overwriting firstline <<${associationItem.firstline}>> to now point to mime <<${associationItem.mime}>>`);\r\n }\r\n });\r\n }\r\n}\r\nfunction toTextMimeAssociationItem(association) {\r\n return {\r\n id: association.id,\r\n mime: association.mime,\r\n filename: association.filename,\r\n extension: association.extension,\r\n filepattern: association.filepattern,\r\n firstline: association.firstline,\r\n userConfigured: association.userConfigured,\r\n filenameLowercase: association.filename ? association.filename.toLowerCase() : undefined,\r\n extensionLowercase: association.extension ? association.extension.toLowerCase() : undefined,\r\n filepatternLowercase: association.filepattern ? association.filepattern.toLowerCase() : undefined,\r\n filepatternOnPath: association.filepattern ? association.filepattern.indexOf(posix.sep) >= 0 : false\r\n };\r\n}\r\n/**\r\n * Given a file, return the best matching mime type for it\r\n */\r\nexport function guessMimeTypes(resource, firstLine) {\r\n let path;\r\n if (resource) {\r\n switch (resource.scheme) {\r\n case Schemas.file:\r\n path = resource.fsPath;\r\n break;\r\n case Schemas.data:\r\n const metadata = DataUri.parseMetaData(resource);\r\n path = metadata.get(DataUri.META_DATA_LABEL);\r\n break;\r\n default:\r\n path = resource.path;\r\n }\r\n }\r\n if (!path) {\r\n return [Mimes.unknown];\r\n }\r\n path = path.toLowerCase();\r\n const filename = basename(path);\r\n // 1.) User configured mappings have highest priority\r\n const configuredMime = guessMimeTypeByPath(path, filename, userRegisteredAssociations);\r\n if (configuredMime) {\r\n return [configuredMime, Mimes.text];\r\n }\r\n // 2.) Registered mappings have middle priority\r\n const registeredMime = guessMimeTypeByPath(path, filename, nonUserRegisteredAssociations);\r\n if (registeredMime) {\r\n return [registeredMime, Mimes.text];\r\n }\r\n // 3.) Firstline has lowest priority\r\n if (firstLine) {\r\n const firstlineMime = guessMimeTypeByFirstline(firstLine);\r\n if (firstlineMime) {\r\n return [firstlineMime, Mimes.text];\r\n }\r\n }\r\n return [Mimes.unknown];\r\n}\r\nfunction guessMimeTypeByPath(path, filename, associations) {\r\n let filenameMatch = null;\r\n let patternMatch = null;\r\n let extensionMatch = null;\r\n // We want to prioritize associations based on the order they are registered so that the last registered\r\n // association wins over all other. This is for https://github.com/microsoft/vscode/issues/20074\r\n for (let i = associations.length - 1; i >= 0; i--) {\r\n const association = associations[i];\r\n // First exact name match\r\n if (filename === association.filenameLowercase) {\r\n filenameMatch = association;\r\n break; // take it!\r\n }\r\n // Longest pattern match\r\n if (association.filepattern) {\r\n if (!patternMatch || association.filepattern.length > patternMatch.filepattern.length) {\r\n const target = association.filepatternOnPath ? path : filename; // match on full path if pattern contains path separator\r\n if (match(association.filepatternLowercase, target)) {\r\n patternMatch = association;\r\n }\r\n }\r\n }\r\n // Longest extension match\r\n if (association.extension) {\r\n if (!extensionMatch || association.extension.length > extensionMatch.extension.length) {\r\n if (filename.endsWith(association.extensionLowercase)) {\r\n extensionMatch = association;\r\n }\r\n }\r\n }\r\n }\r\n // 1.) Exact name match has second highest prio\r\n if (filenameMatch) {\r\n return filenameMatch.mime;\r\n }\r\n // 2.) Match on pattern\r\n if (patternMatch) {\r\n return patternMatch.mime;\r\n }\r\n // 3.) Match on extension comes next\r\n if (extensionMatch) {\r\n return extensionMatch.mime;\r\n }\r\n return null;\r\n}\r\nfunction guessMimeTypeByFirstline(firstLine) {\r\n if (startsWithUTF8BOM(firstLine)) {\r\n firstLine = firstLine.substr(1);\r\n }\r\n if (firstLine.length > 0) {\r\n // We want to prioritize associations based on the order they are registered so that the last registered\r\n // association wins over all other. This is for https://github.com/microsoft/vscode/issues/20074\r\n for (let i = registeredAssociations.length - 1; i >= 0; i--) {\r\n const association = registeredAssociations[i];\r\n if (!association.firstline) {\r\n continue;\r\n }\r\n const matches = firstLine.match(association.firstline);\r\n if (matches && matches.length > 0) {\r\n return association.mime;\r\n }\r\n }\r\n }\r\n return null;\r\n}\r\n", "/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License. See License.txt in the project root for license information.\r\n *--------------------------------------------------------------------------------------------*/\r\nimport * as strings from '../../../base/common/strings.js';\r\nimport { Position } from '../../common/core/position.js';\r\nimport { Range } from '../../common/core/range.js';\r\nexport const _debugComposition = false;\r\nexport class TextAreaState {\r\n constructor(value, selectionStart, selectionEnd, selectionStartPosition, selectionEndPosition) {\r\n this.value = value;\r\n this.selectionStart = selectionStart;\r\n this.selectionEnd = selectionEnd;\r\n this.selectionStartPosition = selectionStartPosition;\r\n this.selectionEndPosition = selectionEndPosition;\r\n }\r\n toString() {\r\n return '[ <' + this.value + '>, selectionStart: ' + this.selectionStart + ', selectionEnd: ' + this.selectionEnd + ']';\r\n }\r\n static readFromTextArea(textArea) {\r\n return new TextAreaState(textArea.getValue(), textArea.getSelectionStart(), textArea.getSelectionEnd(), null, null);\r\n }\r\n collapseSelection() {\r\n return new TextAreaState(this.value, this.value.length, this.value.length, null, null);\r\n }\r\n writeToTextArea(reason, textArea, select) {\r\n if (_debugComposition) {\r\n console.log('writeToTextArea ' + reason + ': ' + this.toString());\r\n }\r\n textArea.setValue(reason, this.value);\r\n if (select) {\r\n textArea.setSelectionRange(reason, this.selectionStart, this.selectionEnd);\r\n }\r\n }\r\n deduceEditorPosition(offset) {\r\n if (offset <= this.selectionStart) {\r\n const str = this.value.substring(offset, this.selectionStart);\r\n return this._finishDeduceEditorPosition(this.selectionStartPosition, str, -1);\r\n }\r\n if (offset >= this.selectionEnd) {\r\n const str = this.value.substring(this.selectionEnd, offset);\r\n return this._finishDeduceEditorPosition(this.selectionEndPosition, str, 1);\r\n }\r\n const str1 = this.value.substring(this.selectionStart, offset);\r\n if (str1.indexOf(String.fromCharCode(8230)) === -1) {\r\n return this._finishDeduceEditorPosition(this.selectionStartPosition, str1, 1);\r\n }\r\n const str2 = this.value.substring(offset, this.selectionEnd);\r\n return this._finishDeduceEditorPosition(this.selectionEndPosition, str2, -1);\r\n }\r\n _finishDeduceEditorPosition(anchor, deltaText, signum) {\r\n let lineFeedCnt = 0;\r\n let lastLineFeedIndex = -1;\r\n while ((lastLineFeedIndex = deltaText.indexOf('\\n', lastLineFeedIndex + 1)) !== -1) {\r\n lineFeedCnt++;\r\n }\r\n return [anchor, signum * deltaText.length, lineFeedCnt];\r\n }\r\n static selectedText(text) {\r\n return new TextAreaState(text, 0, text.length, null, null);\r\n }\r\n static deduceInput(previousState, currentState, couldBeEmojiInput) {\r\n if (!previousState) {\r\n // This is the EMPTY state\r\n return {\r\n text: '',\r\n replacePrevCharCnt: 0,\r\n replaceNextCharCnt: 0,\r\n positionDelta: 0\r\n };\r\n }\r\n if (_debugComposition) {\r\n console.log('------------------------deduceInput');\r\n console.log('PREVIOUS STATE: ' + previousState.toString());\r\n console.log('CURRENT STATE: ' + currentState.toString());\r\n }\r\n let previousValue = previousState.value;\r\n let previousSelectionStart = previousState.selectionStart;\r\n let previousSelectionEnd = previousState.selectionEnd;\r\n let currentValue = currentState.value;\r\n let currentSelectionStart = currentState.selectionStart;\r\n let currentSelectionEnd = currentState.selectionEnd;\r\n // Strip the previous suffix from the value (without interfering with the current selection)\r\n const previousSuffix = previousValue.substring(previousSelectionEnd);\r\n const currentSuffix = currentValue.substring(currentSelectionEnd);\r\n const suffixLength = strings.commonSuffixLength(previousSuffix, currentSuffix);\r\n currentValue = currentValue.substring(0, currentValue.length - suffixLength);\r\n previousValue = previousValue.substring(0, previousValue.length - suffixLength);\r\n const previousPrefix = previousValue.substring(0, previousSelectionStart);\r\n const currentPrefix = currentValue.substring(0, currentSelectionStart);\r\n const prefixLength = strings.commonPrefixLength(previousPrefix, currentPrefix);\r\n currentValue = currentValue.substring(prefixLength);\r\n previousValue = previousValue.substring(prefixLength);\r\n currentSelectionStart -= prefixLength;\r\n previousSelectionStart -= prefixLength;\r\n currentSelectionEnd -= prefixLength;\r\n previousSelectionEnd -= prefixLength;\r\n if (_debugComposition) {\r\n console.log('AFTER DIFFING PREVIOUS STATE: <' + previousValue + '>, selectionStart: ' + previousSelectionStart + ', selectionEnd: ' + previousSelectionEnd);\r\n console.log('AFTER DIFFING CURRENT STATE: <' + currentValue + '>, selectionStart: ' + currentSelectionStart + ', selectionEnd: ' + currentSelectionEnd);\r\n }\r\n if (couldBeEmojiInput && currentSelectionStart === currentSelectionEnd && previousValue.length > 0) {\r\n // on OSX, emojis from the emoji picker are inserted at random locations\r\n // the only hints we can use is that the selection is immediately after the inserted emoji\r\n // and that none of the old text has been deleted\r\n let potentialEmojiInput = null;\r\n if (currentSelectionStart === currentValue.length) {\r\n // emoji potentially inserted \"somewhere\" after the previous selection => it should appear at the end of `currentValue`\r\n if (currentValue.startsWith(previousValue)) {\r\n // only if all of the old text is accounted for\r\n potentialEmojiInput = currentValue.substring(previousValue.length);\r\n }\r\n }\r\n else {\r\n // emoji potentially inserted \"somewhere\" before the previous selection => it should appear at the start of `currentValue`\r\n if (currentValue.endsWith(previousValue)) {\r\n // only if all of the old text is accounted for\r\n potentialEmojiInput = currentValue.substring(0, currentValue.length - previousValue.length);\r\n }\r\n }\r\n if (potentialEmojiInput !== null && potentialEmojiInput.length > 0) {\r\n // now we check that this is indeed an emoji\r\n // emojis can grow quite long, so a length check is of no help\r\n // e.g. 1F3F4 E0067 E0062 E0065 E006E E0067 E007F ; fully-qualified # \uD83C\uDFF4\uDB40\uDC67\uDB40\uDC62\uDB40\uDC65\uDB40\uDC6E\uDB40\uDC67\uDB40\uDC7F England\r\n // Oftentimes, emojis use Variation Selector-16 (U+FE0F), so that is a good hint\r\n // http://emojipedia.org/variation-selector-16/\r\n // > An invisible codepoint which specifies that the preceding character\r\n // > should be displayed with emoji presentation. Only required if the\r\n // > preceding character defaults to text presentation.\r\n if (/\\uFE0F/.test(potentialEmojiInput) || strings.containsEmoji(potentialEmojiInput)) {\r\n return {\r\n text: potentialEmojiInput,\r\n replacePrevCharCnt: 0,\r\n replaceNextCharCnt: 0,\r\n positionDelta: 0\r\n };\r\n }\r\n }\r\n }\r\n if (currentSelectionStart === currentSelectionEnd) {\r\n // composition accept case (noticed in FF + Japanese)\r\n // [blahblah] => blahblah|\r\n if (previousValue === currentValue\r\n && previousSelectionStart === 0\r\n && previousSelectionEnd === previousValue.length\r\n && currentSelectionStart === currentValue.length\r\n && currentValue.indexOf('\\n') === -1) {\r\n if (strings.containsFullWidthCharacter(currentValue)) {\r\n return {\r\n text: '',\r\n replacePrevCharCnt: 0,\r\n replaceNextCharCnt: 0,\r\n positionDelta: 0\r\n };\r\n }\r\n }\r\n // no current selection\r\n const replacePreviousCharacters = (previousPrefix.length - prefixLength);\r\n if (_debugComposition) {\r\n console.log('REMOVE PREVIOUS: ' + (previousPrefix.length - prefixLength) + ' chars');\r\n }\r\n return {\r\n text: currentValue,\r\n replacePrevCharCnt: replacePreviousCharacters,\r\n replaceNextCharCnt: 0,\r\n positionDelta: 0\r\n };\r\n }\r\n // there is a current selection => composition case\r\n const replacePreviousCharacters = previousSelectionEnd - previousSelectionStart;\r\n return {\r\n text: currentValue,\r\n replacePrevCharCnt: replacePreviousCharacters,\r\n replaceNextCharCnt: 0,\r\n positionDelta: 0\r\n };\r\n }\r\n static deduceAndroidCompositionInput(previousState, currentState) {\r\n if (!previousState) {\r\n // This is the EMPTY state\r\n return {\r\n text: '',\r\n replacePrevCharCnt: 0,\r\n replaceNextCharCnt: 0,\r\n positionDelta: 0\r\n };\r\n }\r\n if (_debugComposition) {\r\n console.log('------------------------deduceAndroidCompositionInput');\r\n console.log('PREVIOUS STATE: ' + previousState.toString());\r\n console.log('CURRENT STATE: ' + currentState.toString());\r\n }\r\n if (previousState.value === currentState.value) {\r\n return {\r\n text: '',\r\n replacePrevCharCnt: 0,\r\n replaceNextCharCnt: 0,\r\n positionDelta: currentState.selectionEnd - previousState.selectionEnd\r\n };\r\n }\r\n const prefixLength = Math.min(strings.commonPrefixLength(previousState.value, currentState.value), previousState.selectionEnd);\r\n const suffixLength = Math.min(strings.commonSuffixLength(previousState.value, currentState.value), previousState.value.length - previousState.selectionEnd);\r\n const previousValue = previousState.value.substring(prefixLength, previousState.value.length - suffixLength);\r\n const currentValue = currentState.value.substring(prefixLength, currentState.value.length - suffixLength);\r\n const previousSelectionStart = previousState.selectionStart - prefixLength;\r\n const previousSelectionEnd = previousState.selectionEnd - prefixLength;\r\n const currentSelectionStart = currentState.selectionStart - prefixLength;\r\n const currentSelectionEnd = currentState.selectionEnd - prefixLength;\r\n if (_debugComposition) {\r\n console.log('AFTER DIFFING PREVIOUS STATE: <' + previousValue + '>, selectionStart: ' + previousSelectionStart + ', selectionEnd: ' + previousSelectionEnd);\r\n console.log('AFTER DIFFING CURRENT STATE: <' + currentValue + '>, selectionStart: ' + currentSelectionStart + ', selectionEnd: ' + currentSelectionEnd);\r\n }\r\n return {\r\n text: currentValue,\r\n replacePrevCharCnt: previousSelectionEnd,\r\n replaceNextCharCnt: previousValue.length - previousSelectionEnd,\r\n positionDelta: currentSelectionEnd - currentValue.length\r\n };\r\n }\r\n}\r\nTextAreaState.EMPTY = new TextAreaState('', 0, 0, null, null);\r\nexport class PagedScreenReaderStrategy {\r\n static _getPageOfLine(lineNumber, linesPerPage) {\r\n return Math.floor((lineNumber - 1) / linesPerPage);\r\n }\r\n static _getRangeForPage(page, linesPerPage) {\r\n const offset = page * linesPerPage;\r\n const startLineNumber = offset + 1;\r\n const endLineNumber = offset + linesPerPage;\r\n return new Range(startLineNumber, 1, endLineNumber + 1, 1);\r\n }\r\n static fromEditorSelection(previousState, model, selection, linesPerPage, trimLongText) {\r\n const selectionStartPage = PagedScreenReaderStrategy._getPageOfLine(selection.startLineNumber, linesPerPage);\r\n const selectionStartPageRange = PagedScreenReaderStrategy._getRangeForPage(selectionStartPage, linesPerPage);\r\n const selectionEndPage = PagedScreenReaderStrategy._getPageOfLine(selection.endLineNumber, linesPerPage);\r\n const selectionEndPageRange = PagedScreenReaderStrategy._getRangeForPage(selectionEndPage, linesPerPage);\r\n const pretextRange = selectionStartPageRange.intersectRanges(new Range(1, 1, selection.startLineNumber, selection.startColumn));\r\n let pretext = model.getValueInRange(pretextRange, 1 /* LF */);\r\n const lastLine = model.getLineCount();\r\n const lastLineMaxColumn = model.getLineMaxColumn(lastLine);\r\n const posttextRange = selectionEndPageRange.intersectRanges(new Range(selection.endLineNumber, selection.endColumn, lastLine, lastLineMaxColumn));\r\n let posttext = model.getValueInRange(posttextRange, 1 /* LF */);\r\n let text;\r\n if (selectionStartPage === selectionEndPage || selectionStartPage + 1 === selectionEndPage) {\r\n // take full selection\r\n text = model.getValueInRange(selection, 1 /* LF */);\r\n }\r\n else {\r\n const selectionRange1 = selectionStartPageRange.intersectRanges(selection);\r\n const selectionRange2 = selectionEndPageRange.intersectRanges(selection);\r\n text = (model.getValueInRange(selectionRange1, 1 /* LF */)\r\n + String.fromCharCode(8230)\r\n + model.getValueInRange(selectionRange2, 1 /* LF */));\r\n }\r\n // Chromium handles very poorly text even of a few thousand chars\r\n // Cut text to avoid stalling the entire UI\r\n if (trimLongText) {\r\n const LIMIT_CHARS = 500;\r\n if (pretext.length > LIMIT_CHARS) {\r\n pretext = pretext.substring(pretext.length - LIMIT_CHARS, pretext.length);\r\n }\r\n if (posttext.length > LIMIT_CHARS) {\r\n posttext = posttext.substring(0, LIMIT_CHARS);\r\n }\r\n if (text.length > 2 * LIMIT_CHARS) {\r\n text = text.substring(0, LIMIT_CHARS) + String.fromCharCode(8230) + text.substring(text.length - LIMIT_CHARS, text.length);\r\n }\r\n }\r\n return new TextAreaState(pretext + text + posttext, pretext.length, pretext.length + text.length, new Position(selection.startLineNumber, selection.startColumn), new Position(selection.endLineNumber, selection.endColumn));\r\n }\r\n}\r\n", "/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License. See License.txt in the project root for license information.\r\n *--------------------------------------------------------------------------------------------*/\r\nimport * as browser from '../../../base/browser/browser.js';\r\nimport * as dom from '../../../base/browser/dom.js';\r\nimport { RunOnceScheduler } from '../../../base/common/async.js';\r\nimport { Emitter } from '../../../base/common/event.js';\r\nimport { Disposable } from '../../../base/common/lifecycle.js';\r\nimport { Mimes } from '../../../base/common/mime.js';\r\nimport * as platform from '../../../base/common/platform.js';\r\nimport * as strings from '../../../base/common/strings.js';\r\nimport { TextAreaState, _debugComposition } from './textAreaState.js';\r\nimport { Position } from '../../common/core/position.js';\r\nimport { Selection } from '../../common/core/selection.js';\r\nexport var TextAreaSyntethicEvents;\r\n(function (TextAreaSyntethicEvents) {\r\n TextAreaSyntethicEvents.Tap = '-monaco-textarea-synthetic-tap';\r\n})(TextAreaSyntethicEvents || (TextAreaSyntethicEvents = {}));\r\nexport const CopyOptions = {\r\n forceCopyWithSyntaxHighlighting: false\r\n};\r\n/**\r\n * Every time we write to the clipboard, we record a bit of extra metadata here.\r\n * Every time we read from the cipboard, if the text matches our last written text,\r\n * we can fetch the previous metadata.\r\n */\r\nexport class InMemoryClipboardMetadataManager {\r\n constructor() {\r\n this._lastState = null;\r\n }\r\n set(lastCopiedValue, data) {\r\n this._lastState = { lastCopiedValue, data };\r\n }\r\n get(pastedText) {\r\n if (this._lastState && this._lastState.lastCopiedValue === pastedText) {\r\n // match!\r\n return this._lastState.data;\r\n }\r\n this._lastState = null;\r\n return null;\r\n }\r\n}\r\nInMemoryClipboardMetadataManager.INSTANCE = new InMemoryClipboardMetadataManager();\r\n/**\r\n * Writes screen reader content to the textarea and is able to analyze its input events to generate:\r\n * - onCut\r\n * - onPaste\r\n * - onType\r\n *\r\n * Composition events are generated for presentation purposes (composition input is reflected in onType).\r\n */\r\nexport class TextAreaInput extends Disposable {\r\n constructor(host, textArea) {\r\n super();\r\n this.textArea = textArea;\r\n this._onFocus = this._register(new Emitter());\r\n this.onFocus = this._onFocus.event;\r\n this._onBlur = this._register(new Emitter());\r\n this.onBlur = this._onBlur.event;\r\n this._onKeyDown = this._register(new Emitter());\r\n this.onKeyDown = this._onKeyDown.event;\r\n this._onKeyUp = this._register(new Emitter());\r\n this.onKeyUp = this._onKeyUp.event;\r\n this._onCut = this._register(new Emitter());\r\n this.onCut = this._onCut.event;\r\n this._onPaste = this._register(new Emitter());\r\n this.onPaste = this._onPaste.event;\r\n this._onType = this._register(new Emitter());\r\n this.onType = this._onType.event;\r\n this._onCompositionStart = this._register(new Emitter());\r\n this.onCompositionStart = this._onCompositionStart.event;\r\n this._onCompositionUpdate = this._register(new Emitter());\r\n this.onCompositionUpdate = this._onCompositionUpdate.event;\r\n this._onCompositionEnd = this._register(new Emitter());\r\n this.onCompositionEnd = this._onCompositionEnd.event;\r\n this._onSelectionChangeRequest = this._register(new Emitter());\r\n this.onSelectionChangeRequest = this._onSelectionChangeRequest.event;\r\n this._host = host;\r\n this._textArea = this._register(new TextAreaWrapper(textArea));\r\n this._asyncTriggerCut = this._register(new RunOnceScheduler(() => this._onCut.fire(), 0));\r\n this._asyncFocusGainWriteScreenReaderContent = this._register(new RunOnceScheduler(() => this.writeScreenReaderContent('asyncFocusGain'), 0));\r\n this._textAreaState = TextAreaState.EMPTY;\r\n this._selectionChangeListener = null;\r\n this.writeScreenReaderContent('ctor');\r\n this._hasFocus = false;\r\n this._isDoingComposition = false;\r\n this._nextCommand = 0 /* Type */;\r\n let lastKeyDown = null;\r\n this._register(dom.addStandardDisposableListener(textArea.domNode, 'keydown', (e) => {\r\n if (e.keyCode === 109 /* KEY_IN_COMPOSITION */\r\n || (this._isDoingComposition && e.keyCode === 1 /* Backspace */)) {\r\n // Stop propagation for keyDown events if the IME is processing key input\r\n e.stopPropagation();\r\n }\r\n if (e.equals(9 /* Escape */)) {\r\n // Prevent default always for `Esc`, otherwise it will generate a keypress\r\n // See https://msdn.microsoft.com/en-us/library/ie/ms536939(v=vs.85).aspx\r\n e.preventDefault();\r\n }\r\n lastKeyDown = e;\r\n this._onKeyDown.fire(e);\r\n }));\r\n this._register(dom.addStandardDisposableListener(textArea.domNode, 'keyup', (e) => {\r\n this._onKeyUp.fire(e);\r\n }));\r\n this._register(dom.addDisposableListener(textArea.domNode, 'compositionstart', (e) => {\r\n if (_debugComposition) {\r\n console.log(`[compositionstart]`, e);\r\n }\r\n if (this._isDoingComposition) {\r\n return;\r\n }\r\n this._isDoingComposition = true;\r\n if (platform.isMacintosh\r\n && this._textAreaState.selectionStart === this._textAreaState.selectionEnd\r\n && this._textAreaState.selectionStart > 0\r\n && this._textAreaState.value.substr(this._textAreaState.selectionStart - 1, 1) === e.data) {\r\n const isArrowKey = (lastKeyDown && lastKeyDown.equals(109 /* KEY_IN_COMPOSITION */)\r\n && (lastKeyDown.code === 'ArrowRight' || lastKeyDown.code === 'ArrowLeft'));\r\n if (isArrowKey || browser.isFirefox) {\r\n // Handling long press case on Chromium/Safari macOS + arrow key => pretend the character was selected\r\n // or long press case on Firefox on macOS\r\n if (_debugComposition) {\r\n console.log(`[compositionstart] Handling long press case on macOS + arrow key or Firefox`, e);\r\n }\r\n this._textAreaState = new TextAreaState(this._textAreaState.value, this._textAreaState.selectionStart - 1, this._textAreaState.selectionEnd, this._textAreaState.selectionStartPosition ? new Position(this._textAreaState.selectionStartPosition.lineNumber, this._textAreaState.selectionStartPosition.column - 1) : null, this._textAreaState.selectionEndPosition);\r\n this._onCompositionStart.fire({ revealDeltaColumns: -1 });\r\n return;\r\n }\r\n }\r\n if (browser.isAndroid) {\r\n // when tapping on the editor, Android enters composition mode to edit the current word\r\n // so we cannot clear the textarea on Android and we must pretend the current word was selected\r\n this._onCompositionStart.fire({ revealDeltaColumns: -this._textAreaState.selectionStart });\r\n return;\r\n }\r\n this._setAndWriteTextAreaState('compositionstart', TextAreaState.EMPTY);\r\n this._onCompositionStart.fire({ revealDeltaColumns: 0 });\r\n }));\r\n /**\r\n * Deduce the typed input from a text area's value and the last observed state.\r\n */\r\n const deduceInputFromTextAreaValue = (couldBeEmojiInput) => {\r\n const oldState = this._textAreaState;\r\n const newState = TextAreaState.readFromTextArea(this._textArea);\r\n return [newState, TextAreaState.deduceInput(oldState, newState, couldBeEmojiInput)];\r\n };\r\n const deduceAndroidCompositionInput = () => {\r\n const oldState = this._textAreaState;\r\n const newState = TextAreaState.readFromTextArea(this._textArea);\r\n return [newState, TextAreaState.deduceAndroidCompositionInput(oldState, newState)];\r\n };\r\n /**\r\n * Deduce the composition input from a string.\r\n */\r\n const deduceComposition = (text) => {\r\n const oldState = this._textAreaState;\r\n const newState = TextAreaState.selectedText(text);\r\n const typeInput = {\r\n text: newState.value,\r\n replacePrevCharCnt: oldState.selectionEnd - oldState.selectionStart,\r\n replaceNextCharCnt: 0,\r\n positionDelta: 0\r\n };\r\n return [newState, typeInput];\r\n };\r\n this._register(dom.addDisposableListener(textArea.domNode, 'compositionupdate', (e) => {\r\n if (_debugComposition) {\r\n console.log(`[compositionupdate]`, e);\r\n }\r\n if (browser.isAndroid) {\r\n // On Android, the data sent with the composition update event is unusable.\r\n // For example, if the cursor is in the middle of a word like Mic|osoft\r\n // and Microsoft is chosen from the keyboard's suggestions, the e.data will contain \"Microsoft\".\r\n // This is not really usable because it doesn't tell us where the edit began and where it ended.\r\n const [newState, typeInput] = deduceAndroidCompositionInput();\r\n this._textAreaState = newState;\r\n this._onType.fire(typeInput);\r\n this._onCompositionUpdate.fire(e);\r\n return;\r\n }\r\n const [newState, typeInput] = deduceComposition(e.data || '');\r\n this._textAreaState = newState;\r\n this._onType.fire(typeInput);\r\n this._onCompositionUpdate.fire(e);\r\n }));\r\n this._register(dom.addDisposableListener(textArea.domNode, 'compositionend', (e) => {\r\n if (_debugComposition) {\r\n console.log(`[compositionend]`, e);\r\n }\r\n // https://github.com/microsoft/monaco-editor/issues/1663\r\n // On iOS 13.2, Chinese system IME randomly trigger an additional compositionend event with empty data\r\n if (!this._isDoingComposition) {\r\n return;\r\n }\r\n this._isDoingComposition = false;\r\n if (browser.isAndroid) {\r\n // On Android, the data sent with the composition update event is unusable.\r\n // For example, if the cursor is in the middle of a word like Mic|osoft\r\n // and Microsoft is chosen from the keyboard's suggestions, the e.data will contain \"Microsoft\".\r\n // This is not really usable because it doesn't tell us where the edit began and where it ended.\r\n const [newState, typeInput] = deduceAndroidCompositionInput();\r\n this._textAreaState = newState;\r\n this._onType.fire(typeInput);\r\n this._onCompositionEnd.fire();\r\n return;\r\n }\r\n const [newState, typeInput] = deduceComposition(e.data || '');\r\n this._textAreaState = newState;\r\n this._onType.fire(typeInput);\r\n // isChrome: the textarea is not updated correctly when composition ends\r\n // isFirefox: the textarea is not updated correctly after inserting emojis\r\n // => we cannot assume the text at the end consists only of the composited text\r\n if (browser.isChrome || browser.isFirefox) {\r\n this._textAreaState = TextAreaState.readFromTextArea(this._textArea);\r\n }\r\n this._onCompositionEnd.fire();\r\n }));\r\n this._register(dom.addDisposableListener(textArea.domNode, 'input', () => {\r\n // Pretend here we touched the text area, as the `input` event will most likely\r\n // result in a `selectionchange` event which we want to ignore\r\n this._textArea.setIgnoreSelectionChangeTime('received input event');\r\n if (this._isDoingComposition) {\r\n return;\r\n }\r\n const [newState, typeInput] = deduceInputFromTextAreaValue(/*couldBeEmojiInput*/ platform.isMacintosh);\r\n if (typeInput.replacePrevCharCnt === 0 && typeInput.text.length === 1 && strings.isHighSurrogate(typeInput.text.charCodeAt(0))) {\r\n // Ignore invalid input but keep it around for next time\r\n return;\r\n }\r\n this._textAreaState = newState;\r\n if (this._nextCommand === 0 /* Type */) {\r\n if (typeInput.text !== '' || typeInput.replacePrevCharCnt !== 0) {\r\n this._onType.fire(typeInput);\r\n }\r\n }\r\n else {\r\n if (typeInput.text !== '' || typeInput.replacePrevCharCnt !== 0) {\r\n this._firePaste(typeInput.text, null);\r\n }\r\n this._nextCommand = 0 /* Type */;\r\n }\r\n }));\r\n // --- Clipboard operations\r\n this._register(dom.addDisposableListener(textArea.domNode, 'cut', (e) => {\r\n // Pretend here we touched the text area, as the `cut` event will most likely\r\n // result in a `selectionchange` event which we want to ignore\r\n this._textArea.setIgnoreSelectionChangeTime('received cut event');\r\n this._ensureClipboardGetsEditorSelection(e);\r\n this._asyncTriggerCut.schedule();\r\n }));\r\n this._register(dom.addDisposableListener(textArea.domNode, 'copy', (e) => {\r\n this._ensureClipboardGetsEditorSelection(e);\r\n }));\r\n this._register(dom.addDisposableListener(textArea.domNode, 'paste', (e) => {\r\n // Pretend here we touched the text area, as the `paste` event will most likely\r\n // result in a `selectionchange` event which we want to ignore\r\n this._textArea.setIgnoreSelectionChangeTime('received paste event');\r\n if (ClipboardEventUtils.canUseTextData(e)) {\r\n const [pastePlainText, metadata] = ClipboardEventUtils.getTextData(e);\r\n if (pastePlainText !== '') {\r\n this._firePaste(pastePlainText, metadata);\r\n }\r\n }\r\n else {\r\n if (this._textArea.getSelectionStart() !== this._textArea.getSelectionEnd()) {\r\n // Clean up the textarea, to get a clean paste\r\n this._setAndWriteTextAreaState('paste', TextAreaState.EMPTY);\r\n }\r\n this._nextCommand = 1 /* Paste */;\r\n }\r\n }));\r\n this._register(dom.addDisposableListener(textArea.domNode, 'focus', () => {\r\n const hadFocus = this._hasFocus;\r\n this._setHasFocus(true);\r\n if (browser.isSafari && !hadFocus && this._hasFocus) {\r\n // When \"tabbing into\" the textarea, immediately after dispatching the 'focus' event,\r\n // Safari will always move the selection at offset 0 in the textarea\r\n this._asyncFocusGainWriteScreenReaderContent.schedule();\r\n }\r\n }));\r\n this._register(dom.addDisposableListener(textArea.domNode, 'blur', () => {\r\n if (this._isDoingComposition) {\r\n // See https://github.com/microsoft/vscode/issues/112621\r\n // where compositionend is not triggered when the editor\r\n // is taken off-dom during a composition\r\n // Clear the flag to be able to write to the textarea\r\n this._isDoingComposition = false;\r\n // Clear the textarea to avoid an unwanted cursor type\r\n this.writeScreenReaderContent('blurWithoutCompositionEnd');\r\n // Fire artificial composition end\r\n this._onCompositionEnd.fire();\r\n }\r\n this._setHasFocus(false);\r\n }));\r\n this._register(dom.addDisposableListener(textArea.domNode, TextAreaSyntethicEvents.Tap, () => {\r\n if (browser.isAndroid && this._isDoingComposition) {\r\n // on Android, tapping does not cancel the current composition, so the\r\n // textarea is stuck showing the old composition\r\n // Clear the flag to be able to write to the textarea\r\n this._isDoingComposition = false;\r\n // Clear the textarea to avoid an unwanted cursor type\r\n this.writeScreenReaderContent('tapWithoutCompositionEnd');\r\n // Fire artificial composition end\r\n this._onCompositionEnd.fire();\r\n }\r\n }));\r\n }\r\n _installSelectionChangeListener() {\r\n // See https://github.com/microsoft/vscode/issues/27216 and https://github.com/microsoft/vscode/issues/98256\r\n // When using a Braille display, it is possible for users to reposition the\r\n // system caret. This is reflected in Chrome as a `selectionchange` event.\r\n //\r\n // The `selectionchange` event appears to be emitted under numerous other circumstances,\r\n // so it is quite a challenge to distinguish a `selectionchange` coming in from a user\r\n // using a Braille display from all the other cases.\r\n //\r\n // The problems with the `selectionchange` event are:\r\n // * the event is emitted when the textarea is focused programmatically -- textarea.focus()\r\n // * the event is emitted when the selection is changed in the textarea programmatically -- textarea.setSelectionRange(...)\r\n // * the event is emitted when the value of the textarea is changed programmatically -- textarea.value = '...'\r\n // * the event is emitted when tabbing into the textarea\r\n // * the event is emitted asynchronously (sometimes with a delay as high as a few tens of ms)\r\n // * the event sometimes comes in bursts for a single logical textarea operation\r\n // `selectionchange` events often come multiple times for a single logical change\r\n // so throttle multiple `selectionchange` events that burst in a short period of time.\r\n let previousSelectionChangeEventTime = 0;\r\n return dom.addDisposableListener(document, 'selectionchange', (e) => {\r\n if (!this._hasFocus) {\r\n return;\r\n }\r\n if (this._isDoingComposition) {\r\n return;\r\n }\r\n if (!browser.isChrome) {\r\n // Support only for Chrome until testing happens on other browsers\r\n return;\r\n }\r\n const now = Date.now();\r\n const delta1 = now - previousSelectionChangeEventTime;\r\n previousSelectionChangeEventTime = now;\r\n if (delta1 < 5) {\r\n // received another `selectionchange` event within 5ms of the previous `selectionchange` event\r\n // => ignore it\r\n return;\r\n }\r\n const delta2 = now - this._textArea.getIgnoreSelectionChangeTime();\r\n this._textArea.resetSelectionChangeTime();\r\n if (delta2 < 100) {\r\n // received a `selectionchange` event within 100ms since we touched the textarea\r\n // => ignore it, since we caused it\r\n return;\r\n }\r\n if (!this._textAreaState.selectionStartPosition || !this._textAreaState.selectionEndPosition) {\r\n // Cannot correlate a position in the textarea with a position in the editor...\r\n return;\r\n }\r\n const newValue = this._textArea.getValue();\r\n if (this._textAreaState.value !== newValue) {\r\n // Cannot correlate a position in the textarea with a position in the editor...\r\n return;\r\n }\r\n const newSelectionStart = this._textArea.getSelectionStart();\r\n const newSelectionEnd = this._textArea.getSelectionEnd();\r\n if (this._textAreaState.selectionStart === newSelectionStart && this._textAreaState.selectionEnd === newSelectionEnd) {\r\n // Nothing to do...\r\n return;\r\n }\r\n const _newSelectionStartPosition = this._textAreaState.deduceEditorPosition(newSelectionStart);\r\n const newSelectionStartPosition = this._host.deduceModelPosition(_newSelectionStartPosition[0], _newSelectionStartPosition[1], _newSelectionStartPosition[2]);\r\n const _newSelectionEndPosition = this._textAreaState.deduceEditorPosition(newSelectionEnd);\r\n const newSelectionEndPosition = this._host.deduceModelPosition(_newSelectionEndPosition[0], _newSelectionEndPosition[1], _newSelectionEndPosition[2]);\r\n const newSelection = new Selection(newSelectionStartPosition.lineNumber, newSelectionStartPosition.column, newSelectionEndPosition.lineNumber, newSelectionEndPosition.column);\r\n this._onSelectionChangeRequest.fire(newSelection);\r\n });\r\n }\r\n dispose() {\r\n super.dispose();\r\n if (this._selectionChangeListener) {\r\n this._selectionChangeListener.dispose();\r\n this._selectionChangeListener = null;\r\n }\r\n }\r\n focusTextArea() {\r\n // Setting this._hasFocus and writing the screen reader content\r\n // will result in a focus() and setSelectionRange() in the textarea\r\n this._setHasFocus(true);\r\n // If the editor is off DOM, focus cannot be really set, so let's double check that we have managed to set the focus\r\n this.refreshFocusState();\r\n }\r\n isFocused() {\r\n return this._hasFocus;\r\n }\r\n refreshFocusState() {\r\n const shadowRoot = dom.getShadowRoot(this.textArea.domNode);\r\n if (shadowRoot) {\r\n this._setHasFocus(shadowRoot.activeElement === this.textArea.domNode);\r\n }\r\n else if (dom.isInDOM(this.textArea.domNode)) {\r\n this._setHasFocus(document.activeElement === this.textArea.domNode);\r\n }\r\n else {\r\n this._setHasFocus(false);\r\n }\r\n }\r\n _setHasFocus(newHasFocus) {\r\n if (this._hasFocus === newHasFocus) {\r\n // no change\r\n return;\r\n }\r\n this._hasFocus = newHasFocus;\r\n if (this._selectionChangeListener) {\r\n this._selectionChangeListener.dispose();\r\n this._selectionChangeListener = null;\r\n }\r\n if (this._hasFocus) {\r\n this._selectionChangeListener = this._installSelectionChangeListener();\r\n }\r\n if (this._hasFocus) {\r\n this.writeScreenReaderContent('focusgain');\r\n }\r\n if (this._hasFocus) {\r\n this._onFocus.fire();\r\n }\r\n else {\r\n this._onBlur.fire();\r\n }\r\n }\r\n _setAndWriteTextAreaState(reason, textAreaState) {\r\n if (!this._hasFocus) {\r\n textAreaState = textAreaState.collapseSelection();\r\n }\r\n textAreaState.writeToTextArea(reason, this._textArea, this._hasFocus);\r\n this._textAreaState = textAreaState;\r\n }\r\n writeScreenReaderContent(reason) {\r\n if (this._isDoingComposition) {\r\n // Do not write to the text area when doing composition\r\n return;\r\n }\r\n this._setAndWriteTextAreaState(reason, this._host.getScreenReaderContent(this._textAreaState));\r\n }\r\n _ensureClipboardGetsEditorSelection(e) {\r\n const dataToCopy = this._host.getDataToCopy(ClipboardEventUtils.canUseTextData(e));\r\n const storedMetadata = {\r\n version: 1,\r\n isFromEmptySelection: dataToCopy.isFromEmptySelection,\r\n multicursorText: dataToCopy.multicursorText,\r\n mode: dataToCopy.mode\r\n };\r\n InMemoryClipboardMetadataManager.INSTANCE.set(\r\n // When writing \"LINE\\r\\n\" to the clipboard and then pasting,\r\n // Firefox pastes \"LINE\\n\", so let's work around this quirk\r\n (browser.isFirefox ? dataToCopy.text.replace(/\\r\\n/g, '\\n') : dataToCopy.text), storedMetadata);\r\n if (!ClipboardEventUtils.canUseTextData(e)) {\r\n // Looks like an old browser. The strategy is to place the text\r\n // we'd like to be copied to the clipboard in the textarea and select it.\r\n this._setAndWriteTextAreaState('copy or cut', TextAreaState.selectedText(dataToCopy.text));\r\n return;\r\n }\r\n ClipboardEventUtils.setTextData(e, dataToCopy.text, dataToCopy.html, storedMetadata);\r\n }\r\n _firePaste(text, metadata) {\r\n if (!metadata) {\r\n // try the in-memory store\r\n metadata = InMemoryClipboardMetadataManager.INSTANCE.get(text);\r\n }\r\n this._onPaste.fire({\r\n text: text,\r\n metadata: metadata\r\n });\r\n }\r\n}\r\nclass ClipboardEventUtils {\r\n static canUseTextData(e) {\r\n if (e.clipboardData) {\r\n return true;\r\n }\r\n if (window.clipboardData) {\r\n return true;\r\n }\r\n return false;\r\n }\r\n static getTextData(e) {\r\n if (e.clipboardData) {\r\n e.preventDefault();\r\n const text = e.clipboardData.getData(Mimes.text);\r\n let metadata = null;\r\n const rawmetadata = e.clipboardData.getData('vscode-editor-data');\r\n if (typeof rawmetadata === 'string') {\r\n try {\r\n metadata = JSON.parse(rawmetadata);\r\n if (metadata.version !== 1) {\r\n metadata = null;\r\n }\r\n }\r\n catch (err) {\r\n // no problem!\r\n }\r\n }\r\n return [text, metadata];\r\n }\r\n if (window.clipboardData) {\r\n e.preventDefault();\r\n const text = window.clipboardData.getData('Text');\r\n return [text, null];\r\n }\r\n throw new Error('ClipboardEventUtils.getTextData: Cannot use text data!');\r\n }\r\n static setTextData(e, text, html, metadata) {\r\n if (e.clipboardData) {\r\n e.clipboardData.setData(Mimes.text, text);\r\n if (typeof html === 'string') {\r\n e.clipboardData.setData('text/html', html);\r\n }\r\n e.clipboardData.setData('vscode-editor-data', JSON.stringify(metadata));\r\n e.preventDefault();\r\n return;\r\n }\r\n if (window.clipboardData) {\r\n window.clipboardData.setData('Text', text);\r\n e.preventDefault();\r\n return;\r\n }\r\n throw new Error('ClipboardEventUtils.setTextData: Cannot use text data!');\r\n }\r\n}\r\nclass TextAreaWrapper extends Disposable {\r\n constructor(_textArea) {\r\n super();\r\n this._actual = _textArea;\r\n this._ignoreSelectionChangeTime = 0;\r\n }\r\n setIgnoreSelectionChangeTime(reason) {\r\n this._ignoreSelectionChangeTime = Date.now();\r\n }\r\n getIgnoreSelectionChangeTime() {\r\n return this._ignoreSelectionChangeTime;\r\n }\r\n resetSelectionChangeTime() {\r\n this._ignoreSelectionChangeTime = 0;\r\n }\r\n getValue() {\r\n // console.log('current value: ' + this._textArea.value);\r\n return this._actual.domNode.value;\r\n }\r\n setValue(reason, value) {\r\n const textArea = this._actual.domNode;\r\n if (textArea.value === value) {\r\n // No change\r\n return;\r\n }\r\n // console.log('reason: ' + reason + ', current value: ' + textArea.value + ' => new value: ' + value);\r\n this.setIgnoreSelectionChangeTime('setValue');\r\n textArea.value = value;\r\n }\r\n getSelectionStart() {\r\n return this._actual.domNode.selectionDirection === 'backward' ? this._actual.domNode.selectionEnd : this._actual.domNode.selectionStart;\r\n }\r\n getSelectionEnd() {\r\n return this._actual.domNode.selectionDirection === 'backward' ? this._actual.domNode.selectionStart : this._actual.domNode.selectionEnd;\r\n }\r\n setSelectionRange(reason, selectionStart, selectionEnd) {\r\n const textArea = this._actual.domNode;\r\n let activeElement = null;\r\n const shadowRoot = dom.getShadowRoot(textArea);\r\n if (shadowRoot) {\r\n activeElement = shadowRoot.activeElement;\r\n }\r\n else {\r\n activeElement = document.activeElement;\r\n }\r\n const currentIsFocused = (activeElement === textArea);\r\n const currentSelectionStart = textArea.selectionStart;\r\n const currentSelectionEnd = textArea.selectionEnd;\r\n if (currentIsFocused && currentSelectionStart === selectionStart && currentSelectionEnd === selectionEnd) {\r\n // No change\r\n // Firefox iframe bug https://github.com/microsoft/monaco-editor/issues/643#issuecomment-367871377\r\n if (browser.isFirefox && window.parent !== window) {\r\n textArea.focus();\r\n }\r\n return;\r\n }\r\n // console.log('reason: ' + reason + ', setSelectionRange: ' + selectionStart + ' -> ' + selectionEnd);\r\n if (currentIsFocused) {\r\n // No need to focus, only need to change the selection range\r\n this.setIgnoreSelectionChangeTime('setSelectionRange');\r\n textArea.setSelectionRange(selectionStart, selectionEnd);\r\n if (browser.isFirefox && window.parent !== window) {\r\n textArea.focus();\r\n }\r\n return;\r\n }\r\n // If the focus is outside the textarea, browsers will try really hard to reveal the textarea.\r\n // Here, we try to undo the browser's desperate reveal.\r\n try {\r\n const scrollState = dom.saveParentsScrollTop(textArea);\r\n this.setIgnoreSelectionChangeTime('setSelectionRange');\r\n textArea.focus();\r\n textArea.setSelectionRange(selectionStart, selectionEnd);\r\n dom.restoreParentsScrollTop(textArea, scrollState);\r\n }\r\n catch (e) {\r\n // Sometimes IE throws when setting selection (e.g. textarea is off-DOM)\r\n }\r\n }\r\n}\r\n", "/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License. See License.txt in the project root for license information.\r\n *--------------------------------------------------------------------------------------------*/\r\nimport * as dom from '../../../base/browser/dom.js';\r\nimport * as platform from '../../../base/common/platform.js';\r\nimport { EventType, Gesture } from '../../../base/browser/touch.js';\r\nimport { Disposable } from '../../../base/common/lifecycle.js';\r\nimport { MouseHandler, createMouseMoveEventMerger } from './mouseHandler.js';\r\nimport { EditorMouseEvent, EditorPointerEventFactory } from '../editorDom.js';\r\nimport { BrowserFeatures } from '../../../base/browser/canIUse.js';\r\nimport { TextAreaSyntethicEvents } from './textAreaInput.js';\r\n/**\r\n * Currently only tested on iOS 13/ iPadOS.\r\n */\r\nexport class PointerEventHandler extends MouseHandler {\r\n constructor(context, viewController, viewHelper) {\r\n super(context, viewController, viewHelper);\r\n this._register(Gesture.addTarget(this.viewHelper.linesContentDomNode));\r\n this._register(dom.addDisposableListener(this.viewHelper.linesContentDomNode, EventType.Tap, (e) => this.onTap(e)));\r\n this._register(dom.addDisposableListener(this.viewHelper.linesContentDomNode, EventType.Change, (e) => this.onChange(e)));\r\n this._register(dom.addDisposableListener(this.viewHelper.linesContentDomNode, EventType.Contextmenu, (e) => this._onContextMenu(new EditorMouseEvent(e, this.viewHelper.viewDomNode), false)));\r\n this._lastPointerType = 'mouse';\r\n this._register(dom.addDisposableListener(this.viewHelper.linesContentDomNode, 'pointerdown', (e) => {\r\n const pointerType = e.pointerType;\r\n if (pointerType === 'mouse') {\r\n this._lastPointerType = 'mouse';\r\n return;\r\n }\r\n else if (pointerType === 'touch') {\r\n this._lastPointerType = 'touch';\r\n }\r\n else {\r\n this._lastPointerType = 'pen';\r\n }\r\n }));\r\n // PonterEvents\r\n const pointerEvents = new EditorPointerEventFactory(this.viewHelper.viewDomNode);\r\n this._register(pointerEvents.onPointerMoveThrottled(this.viewHelper.viewDomNode, (e) => this._onMouseMove(e), createMouseMoveEventMerger(this.mouseTargetFactory), MouseHandler.MOUSE_MOVE_MINIMUM_TIME));\r\n this._register(pointerEvents.onPointerUp(this.viewHelper.viewDomNode, (e) => this._onMouseUp(e)));\r\n this._register(pointerEvents.onPointerLeave(this.viewHelper.viewDomNode, (e) => this._onMouseLeave(e)));\r\n this._register(pointerEvents.onPointerDown(this.viewHelper.viewDomNode, (e) => this._onMouseDown(e)));\r\n }\r\n onTap(event) {\r\n if (!event.initialTarget || !this.viewHelper.linesContentDomNode.contains(event.initialTarget)) {\r\n return;\r\n }\r\n event.preventDefault();\r\n this.viewHelper.focusTextArea();\r\n const target = this._createMouseTarget(new EditorMouseEvent(event, this.viewHelper.viewDomNode), false);\r\n if (target.position) {\r\n // this.viewController.moveTo(target.position);\r\n this.viewController.dispatchMouse({\r\n position: target.position,\r\n mouseColumn: target.position.column,\r\n startedOnLineNumbers: false,\r\n mouseDownCount: event.tapCount,\r\n inSelectionMode: false,\r\n altKey: false,\r\n ctrlKey: false,\r\n metaKey: false,\r\n shiftKey: false,\r\n leftButton: false,\r\n middleButton: false,\r\n });\r\n }\r\n }\r\n onChange(e) {\r\n if (this._lastPointerType === 'touch') {\r\n this._context.model.deltaScrollNow(-e.translationX, -e.translationY);\r\n }\r\n }\r\n _onMouseDown(e) {\r\n if (e.browserEvent.pointerType === 'touch') {\r\n return;\r\n }\r\n super._onMouseDown(e);\r\n }\r\n}\r\nclass TouchHandler extends MouseHandler {\r\n constructor(context, viewController, viewHelper) {\r\n super(context, viewController, viewHelper);\r\n this._register(Gesture.addTarget(this.viewHelper.linesContentDomNode));\r\n this._register(dom.addDisposableListener(this.viewHelper.linesContentDomNode, EventType.Tap, (e) => this.onTap(e)));\r\n this._register(dom.addDisposableListener(this.viewHelper.linesContentDomNode, EventType.Change, (e) => this.onChange(e)));\r\n this._register(dom.addDisposableListener(this.viewHelper.linesContentDomNode, EventType.Contextmenu, (e) => this._onContextMenu(new EditorMouseEvent(e, this.viewHelper.viewDomNode), false)));\r\n }\r\n onTap(event) {\r\n event.preventDefault();\r\n this.viewHelper.focusTextArea();\r\n const target = this._createMouseTarget(new EditorMouseEvent(event, this.viewHelper.viewDomNode), false);\r\n if (target.position) {\r\n // Send the tap event also to the