├── resources
├── extensionIcon.png
└── logo.svg
├── .vscode
├── extensions.json
├── settings.json
├── tasks.json
└── launch.json
├── .vscodeignore
├── CHANGELOG.md
├── tsconfig.json
├── .eslintrc.json
├── LICENSE
├── README.md
├── media
├── css
│ ├── highligh.style.css
│ └── leftSideStyle.css
├── main.js
└── scripts
│ ├── marked.min.js
│ └── highlight.min.js
├── webpack.config.js
├── .gitignore
├── src
├── auth.ts
└── extension.ts
├── vsc-extension-quickstart.md
└── package.json
/resources/extensionIcon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Meteo-Pig/CursorCode/HEAD/resources/extensionIcon.png
--------------------------------------------------------------------------------
/.vscode/extensions.json:
--------------------------------------------------------------------------------
1 | {
2 | // See http://go.microsoft.com/fwlink/?LinkId=827846
3 | // for the documentation about the extensions.json format
4 | "recommendations": ["dbaeumer.vscode-eslint", "amodio.tsl-problem-matcher"]
5 | }
6 |
--------------------------------------------------------------------------------
/.vscodeignore:
--------------------------------------------------------------------------------
1 | .vscode/**
2 | .vscode-test/**
3 | out/**
4 | node_modules/**
5 | src/**
6 | .gitignore
7 | .yarnrc
8 | webpack.config.js
9 | vsc-extension-quickstart.md
10 | **/tsconfig.json
11 | **/.eslintrc.json
12 | **/*.map
13 | **/*.ts
14 |
--------------------------------------------------------------------------------
/CHANGELOG.md:
--------------------------------------------------------------------------------
1 | ## [0.0.8]
2 |
3 | - 优化代码继续编写功能(选中需要继续编写的代码,Ctrl+Alt+Y输入继续即可)
4 |
5 | ## [0.0.7]
6 |
7 | - 优化对话中代码显示效果
8 | - 优化部分功能
9 |
10 | ## [0.0.6]
11 |
12 | - 增加快捷键:```Ctrl+Alt+Y```呼出代码输入框
13 | - 增加快捷键:```Ctrl+Alt+U```呼出对话输入框
14 | - 优化对话中代码一键插入功能,添加一键复制
15 | - 优化反馈提示
16 |
17 |
--------------------------------------------------------------------------------
/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "module": "commonjs",
4 | "target": "ES2020",
5 | "lib": [
6 | "ES2020"
7 | ],
8 | "sourceMap": true,
9 | "rootDir": "src",
10 | "strict": true /* enable all strict type-checking options */
11 | /* Additional Checks */
12 | // "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */
13 | // "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */
14 | // "noUnusedParameters": true, /* Report errors on unused parameters. */
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/.eslintrc.json:
--------------------------------------------------------------------------------
1 | {
2 | "root": true,
3 | "parser": "@typescript-eslint/parser",
4 | "parserOptions": {
5 | "ecmaVersion": 6,
6 | "sourceType": "module"
7 | },
8 | "plugins": [
9 | "@typescript-eslint"
10 | ],
11 | "rules": {
12 | "@typescript-eslint/naming-convention": "warn",
13 | "@typescript-eslint/semi": "warn",
14 | "curly": "warn",
15 | "eqeqeq": "warn",
16 | "no-throw-literal": "warn",
17 | "semi": "off"
18 | },
19 | "ignorePatterns": [
20 | "out",
21 | "dist",
22 | "**/*.d.ts"
23 | ]
24 | }
25 |
--------------------------------------------------------------------------------
/.vscode/settings.json:
--------------------------------------------------------------------------------
1 | // Place your settings in this file to overwrite default and user settings.
2 | {
3 | "files.exclude": {
4 | "out": false, // set this to true to hide the "out" folder with the compiled JS files
5 | "dist": false // set this to true to hide the "dist" folder with the compiled JS files
6 | },
7 | "search.exclude": {
8 | "out": true, // set this to false to include "out" folder in search results
9 | "dist": true // set this to false to include "dist" folder in search results
10 | },
11 | // Turn off tsc task auto detection since we have the necessary tasks as npm scripts
12 | "typescript.tsc.autoDetect": "off"
13 | }
--------------------------------------------------------------------------------
/resources/logo.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/.vscode/tasks.json:
--------------------------------------------------------------------------------
1 | // See https://go.microsoft.com/fwlink/?LinkId=733558
2 | // for the documentation about the tasks.json format
3 | {
4 | "version": "2.0.0",
5 | "tasks": [
6 | {
7 | "type": "npm",
8 | "script": "watch",
9 | "problemMatcher": "$ts-webpack-watch",
10 | "isBackground": true,
11 | "presentation": {
12 | "reveal": "never",
13 | "group": "watchers"
14 | },
15 | "group": {
16 | "kind": "build",
17 | "isDefault": true
18 | }
19 | },
20 | {
21 | "type": "npm",
22 | "script": "watch-tests",
23 | "problemMatcher": "$tsc-watch",
24 | "isBackground": true,
25 | "presentation": {
26 | "reveal": "never",
27 | "group": "watchers"
28 | },
29 | "group": "build"
30 | },
31 | {
32 | "label": "tasks: watch-tests",
33 | "dependsOn": [
34 | "npm: watch",
35 | "npm: watch-tests"
36 | ],
37 | "problemMatcher": []
38 | }
39 | ]
40 | }
41 |
--------------------------------------------------------------------------------
/.vscode/launch.json:
--------------------------------------------------------------------------------
1 | // A launch configuration that compiles the extension and then opens it inside a new window
2 | // Use IntelliSense to learn about possible attributes.
3 | // Hover to view descriptions of existing attributes.
4 | // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
5 | {
6 | "version": "0.2.0",
7 | "configurations": [
8 | {
9 | "name": "Run Extension",
10 | "type": "extensionHost",
11 | "request": "launch",
12 | "args": [
13 | "--extensionDevelopmentPath=${workspaceFolder}"
14 | ],
15 | "outFiles": [
16 | "${workspaceFolder}/dist/**/*.js"
17 | ],
18 | "preLaunchTask": "${defaultBuildTask}"
19 | },
20 | {
21 | "name": "Extension Tests",
22 | "type": "extensionHost",
23 | "request": "launch",
24 | "args": [
25 | "--extensionDevelopmentPath=${workspaceFolder}",
26 | "--extensionTestsPath=${workspaceFolder}/out/test/suite/index"
27 | ],
28 | "outFiles": [
29 | "${workspaceFolder}/out/**/*.js",
30 | "${workspaceFolder}/dist/**/*.js"
31 | ],
32 | "preLaunchTask": "tasks: watch-tests"
33 | }
34 | ]
35 | }
36 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2023 Meteo-Pig
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 |
2 |
A Visual Studio Code - CursorCode
3 | Write, edit, and chat about your code with a powerful AI
4 | 一个基于Cursor API的GPT智能AI代码助手
5 |
6 | # 主要功能
7 |
8 | - 📃智能对话:可以在侧边栏直接与机器人对话
9 | - 🔥代码生成:在代码中输入需求来生成代码
10 | - 📝代码优化:在代码中输入需求对代码进行优化
11 | - ⌨️快速插入:在对话框中生成的代码,可直接点击快速插入到代码框对应的光标处
12 | - 🔑快捷键:```Ctrl+Alt+Y```呼出代码生成,```Ctrl+Alt+U```呼出对话
13 |
14 | # 开始使用
15 |
16 | 1. 在[vscode扩展商店](https://marketplace.visualstudio.com/items?itemName=meteorstudio.cursorcode)中搜索**CursorCode**进行安装
17 |
18 | 2. 在左侧选中Cursor光标图标进入对话框页面
19 | 3. 可以直接输入问题,也可以在代码框中选中代码进行询问
20 | 4. 在代码框中右击代码,或者在空白处右击,在弹出菜单中点击**CursorCode**,在弹出的输入框中输入需求(生成/优化代码)
21 |
22 | > 注意:询问前请先在代码框中点击,让光标保持在某一处(为了让AI更好的理解代码上下文)
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 | # 视频教程
33 |
34 | [https://www.bilibili.com/video/BV1iv4y1G7Js/](https://www.bilibili.com/video/BV1iv4y1G7Js/)
35 |
36 | # 友情链接
37 |
38 | [Github](https://github.com/Meteo-Pig/CursorCode) [Cursor](https://www.cursor.so/)
--------------------------------------------------------------------------------
/media/css/highligh.style.css:
--------------------------------------------------------------------------------
1 | /*
2 | Atom One Dark by Daniel Gamage
3 | Original One Dark Syntax theme from https://github.com/atom/one-dark-syntax
4 | base: #282c34
5 | mono-1: #abb2bf
6 | mono-2: #818896
7 | mono-3: #5c6370
8 | hue-1: #56b6c2
9 | hue-2: #61aeee
10 | hue-3: #c678dd
11 | hue-4: #98c379
12 | hue-5: #e06c75
13 | hue-5-2: #be5046
14 | hue-6: #d19a66
15 | hue-6-2: #e6c07b
16 | */
17 |
18 | .hljs {
19 | color: #abb2bf;
20 | background: #282c34;
21 | }
22 |
23 | .hljs-comment,
24 | .hljs-quote {
25 | color: #5c6370;
26 | font-style: italic;
27 | }
28 |
29 | .hljs-doctag,
30 | .hljs-keyword,
31 | .hljs-formula {
32 | color: #c678dd;
33 | }
34 |
35 | .hljs-section,
36 | .hljs-name,
37 | .hljs-selector-tag,
38 | .hljs-deletion,
39 | .hljs-subst {
40 | color: #e06c75;
41 | }
42 |
43 | .hljs-literal {
44 | color: #56b6c2;
45 | }
46 |
47 | .hljs-string,
48 | .hljs-regexp,
49 | .hljs-addition,
50 | .hljs-attribute,
51 | .hljs-meta .hljs-string {
52 | color: #98c379;
53 | }
54 |
55 | .hljs-attr,
56 | .hljs-variable,
57 | .hljs-template-variable,
58 | .hljs-type,
59 | .hljs-selector-class,
60 | .hljs-selector-attr,
61 | .hljs-selector-pseudo,
62 | .hljs-number {
63 | color: #d19a66;
64 | }
65 |
66 | .hljs-symbol,
67 | .hljs-bullet,
68 | .hljs-link,
69 | .hljs-meta,
70 | .hljs-selector-id,
71 | .hljs-title {
72 | color: #61aeee;
73 | }
74 |
75 | .hljs-built_in,
76 | .hljs-title.class_,
77 | .hljs-class .hljs-title {
78 | color: #e6c07b;
79 | }
80 |
81 | .hljs-emphasis {
82 | font-style: italic;
83 | }
84 |
85 | .hljs-strong {
86 | font-weight: bold;
87 | }
88 |
89 | .hljs-link {
90 | text-decoration: underline;
91 | }
--------------------------------------------------------------------------------
/webpack.config.js:
--------------------------------------------------------------------------------
1 | //@ts-check
2 |
3 | 'use strict';
4 |
5 | const path = require('path');
6 |
7 | //@ts-check
8 | /** @typedef {import('webpack').Configuration} WebpackConfig **/
9 |
10 | /** @type WebpackConfig */
11 | const extensionConfig = {
12 | target: 'node', // VS Code extensions run in a Node.js-context 📖 -> https://webpack.js.org/configuration/node/
13 | mode: 'none', // this leaves the source code as close as possible to the original (when packaging we set this to 'production')
14 |
15 | entry: './src/extension.ts', // the entry point of this extension, 📖 -> https://webpack.js.org/configuration/entry-context/
16 | output: {
17 | // the bundle is stored in the 'dist' folder (check package.json), 📖 -> https://webpack.js.org/configuration/output/
18 | path: path.resolve(__dirname, 'dist'),
19 | filename: 'extension.js',
20 | libraryTarget: 'commonjs2'
21 | },
22 | externals: {
23 | vscode: 'commonjs vscode' // the vscode-module is created on-the-fly and must be excluded. Add other modules that cannot be webpack'ed, 📖 -> https://webpack.js.org/configuration/externals/
24 | // modules added here also need to be added in the .vscodeignore file
25 | },
26 | resolve: {
27 | // support reading TypeScript and JavaScript files, 📖 -> https://github.com/TypeStrong/ts-loader
28 | extensions: ['.ts', '.js']
29 | },
30 | module: {
31 | rules: [
32 | {
33 | test: /\.ts$/,
34 | exclude: /node_modules/,
35 | use: [
36 | {
37 | loader: 'ts-loader'
38 | }
39 | ]
40 | }
41 | ]
42 | },
43 | devtool: 'nosources-source-map',
44 | infrastructureLogging: {
45 | level: "log", // enables logging required for problem matchers
46 | },
47 | };
48 | module.exports = [ extensionConfig ];
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Logs
2 | logs
3 | *.log
4 | npm-debug.log*
5 | yarn-debug.log*
6 | yarn-error.log*
7 | lerna-debug.log*
8 |
9 | # Diagnostic reports (https://nodejs.org/api/report.html)
10 | report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
11 |
12 | # Runtime data
13 | pids
14 | *.pid
15 | *.seed
16 | *.pid.lock
17 |
18 | # Directory for instrumented libs generated by jscoverage/JSCover
19 | lib-cov
20 |
21 | # Coverage directory used by tools like istanbul
22 | coverage
23 | *.lcov
24 |
25 | # nyc test coverage
26 | .nyc_output
27 |
28 | # Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
29 | .grunt
30 |
31 | # Bower dependency directory (https://bower.io/)
32 | bower_components
33 |
34 | # node-waf configuration
35 | .lock-wscript
36 |
37 | # Compiled binary addons (https://nodejs.org/api/addons.html)
38 | build/Release
39 |
40 | # Dependency directories
41 | node_modules/
42 | jspm_packages/
43 |
44 | # TypeScript v1 declaration files
45 | typings/
46 |
47 | # TypeScript cache
48 | *.tsbuildinfo
49 |
50 | # Optional npm cache directory
51 | .npm
52 |
53 | # Optional eslint cache
54 | .eslintcache
55 |
56 | # Microbundle cache
57 | .rpt2_cache/
58 | .rts2_cache_cjs/
59 | .rts2_cache_es/
60 | .rts2_cache_umd/
61 |
62 | # Optional REPL history
63 | .node_repl_history
64 |
65 | # Output of 'npm pack'
66 | *.tgz
67 |
68 | # Yarn Integrity file
69 | .yarn-integrity
70 |
71 | # dotenv environment variables file
72 | .env
73 | .env.test
74 |
75 | # parcel-bundler cache (https://parceljs.org/)
76 | .cache
77 |
78 | # Next.js build output
79 | .next
80 |
81 | # Nuxt.js build / generate output
82 | .nuxt
83 | dist
84 |
85 | # Gatsby files
86 | .cache/
87 | # Comment in the public line in if your project uses Gatsby and *not* Next.js
88 | # https://nextjs.org/blog/next-9-1#public-directory-support
89 | # public
90 |
91 | # vuepress build output
92 | .vuepress/dist
93 |
94 | # Serverless directories
95 | .serverless/
96 |
97 | # FuseBox cache
98 | .fusebox/
99 |
100 | # DynamoDB Local files
101 | .dynamodb/
102 |
103 | # TernJS port file
104 | .tern-port
105 |
106 | *.vsix
107 |
108 | src/test
109 |
110 | .vscode
111 |
112 | out
--------------------------------------------------------------------------------
/src/auth.ts:
--------------------------------------------------------------------------------
1 |
2 | import crypto = require('crypto');
3 | import { exec } from 'child_process';
4 | import { v4 as uuidv4 } from 'uuid';
5 | const axios = require("axios").default;
6 |
7 | import * as vscode from "vscode";
8 |
9 | const m = "https://cursor.so"
10 | , v = "https://aicursor.com"
11 | , w = "KbZUR41cY7W6zRSdpSUJ7I7mLYBKOCmB"
12 | , s = "cursor.us.auth0.com"
13 | , a = `${m}/api`
14 | , i = `${m}/loginDeepControl`
15 | , g = `${m}/pricing?fromControl=true`
16 | , c = `${m}/settings`
17 | , d = `${v}/auth/poll`;
18 |
19 | function base64URLEncode(str: Buffer) {
20 | return str
21 | .toString('base64')
22 | .replace(/\+/g, '-')
23 | .replace(/\//g, '_')
24 | .replace(/=/g, '');
25 | }
26 | function sha256(buffer: Buffer) {
27 | return crypto.createHash('sha256').update(buffer).digest();
28 | }
29 |
30 | export async function loginCursor() {
31 | let uuid = uuidv4();
32 | let verifier = base64URLEncode(crypto.randomBytes(32));
33 | let challenge = base64URLEncode(sha256(Buffer.from(verifier)));
34 | // console.log({
35 | // challenge,
36 | // verifier,
37 | // uuid
38 | // });
39 |
40 | let cmd = ''
41 | let url = `${i}?challenge=${challenge}&uuid=${uuid}`
42 | // if (process.platform === 'darwin') {
43 | // cmd = `open "${url}"` // macOS
44 | // } else if (process.platform === 'win32') {
45 | // cmd = `start "" "${url}"` // Windows
46 | // } else {
47 | // cmd = `xdg-open "${url}"` // Linux
48 | // }
49 | // exec(cmd);
50 | vscode.commands.executeCommand('vscode.open', vscode.Uri.parse(url));
51 |
52 | return await new Promise(resolve => {
53 | const timer = setInterval(async () => {
54 | const t = await axios.get(`${d}?uuid=${uuid}&verifier=${verifier}`)
55 | const data = t.data;
56 | // console.log(data);
57 | if (data) {
58 | clearInterval(timer);
59 | resolve(data);
60 | }
61 | }, 2 * 1e3);
62 | });
63 |
64 | // const timer = setInterval(async () => {
65 |
66 | // const t = await axios.get(`${d}?uuid=${uuid}&verifier=${verifier}`)
67 | // const data = t.data;
68 | // console.log(data);
69 | // if (data) {
70 | // clearInterval(timer);
71 | // return data;
72 | // }
73 | // }, 2 * 1e3);
74 | }
75 | // login();
--------------------------------------------------------------------------------
/vsc-extension-quickstart.md:
--------------------------------------------------------------------------------
1 | # Welcome to your VS Code Extension
2 |
3 | ## What's in the folder
4 |
5 | * This folder contains all of the files necessary for your extension.
6 | * `package.json` - this is the manifest file in which you declare your extension and command.
7 | * The sample plugin registers a command and defines its title and command name. With this information VS Code can show the command in the command palette. It doesn’t yet need to load the plugin.
8 | * `src/extension.ts` - this is the main file where you will provide the implementation of your command.
9 | * The file exports one function, `activate`, which is called the very first time your extension is activated (in this case by executing the command). Inside the `activate` function we call `registerCommand`.
10 | * We pass the function containing the implementation of the command as the second parameter to `registerCommand`.
11 |
12 | ## Setup
13 |
14 | * install the recommended extensions (amodio.tsl-problem-matcher and dbaeumer.vscode-eslint)
15 |
16 |
17 | ## Get up and running straight away
18 |
19 | * Press `F5` to open a new window with your extension loaded.
20 | * Run your command from the command palette by pressing (`Ctrl+Shift+P` or `Cmd+Shift+P` on Mac) and typing `Hello World`.
21 | * Set breakpoints in your code inside `src/extension.ts` to debug your extension.
22 | * Find output from your extension in the debug console.
23 |
24 | ## Make changes
25 |
26 | * You can relaunch the extension from the debug toolbar after changing code in `src/extension.ts`.
27 | * You can also reload (`Ctrl+R` or `Cmd+R` on Mac) the VS Code window with your extension to load your changes.
28 |
29 |
30 | ## Explore the API
31 |
32 | * You can open the full set of our API when you open the file `node_modules/@types/vscode/index.d.ts`.
33 |
34 | ## Run tests
35 |
36 | * Open the debug viewlet (`Ctrl+Shift+D` or `Cmd+Shift+D` on Mac) and from the launch configuration dropdown pick `Extension Tests`.
37 | * Press `F5` to run the tests in a new window with your extension loaded.
38 | * See the output of the test result in the debug console.
39 | * Make changes to `src/test/suite/extension.test.ts` or create new test files inside the `test/suite` folder.
40 | * The provided test runner will only consider files matching the name pattern `**.test.ts`.
41 | * You can create folders inside the `test` folder to structure your tests any way you want.
42 |
43 | ## Go further
44 |
45 | * Reduce the extension size and improve the startup time by [bundling your extension](https://code.visualstudio.com/api/working-with-extensions/bundling-extension).
46 | * [Publish your extension](https://code.visualstudio.com/api/working-with-extensions/publishing-extension) on the VS Code extension marketplace.
47 | * Automate builds by setting up [Continuous Integration](https://code.visualstudio.com/api/working-with-extensions/continuous-integration).
48 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "cursorcode",
3 | "displayName": "CursorCode(Cursor for VSCode)",
4 | "description": "a free AI coder with GPT",
5 | "version": "0.1.1",
6 | "publisher": "meteorstudio",
7 | "icon": "resources/extensionIcon.png",
8 | "license": "MIT",
9 | "repository": {
10 | "url": "https://github.com/Meteo-Pig/CursorCode"
11 | },
12 | "engines": {
13 | "vscode": "^1.76.0"
14 | },
15 | "categories": [
16 | "Other"
17 | ],
18 | "activationEvents": [],
19 | "main": "./dist/extension.js",
20 | "contributes": {
21 | "commands": [
22 | {
23 | "command": "cursorcode.generation",
24 | "title": "CursorCode"
25 | },
26 | {
27 | "command": "cursorcode.conversation",
28 | "title": "CursorCodeConversation"
29 | }
30 | ],
31 | "keybindings": [
32 | {
33 | "command": "cursorcode.generation",
34 | "key": "ctrl+alt+y",
35 | "mac": "cmd+alt+y",
36 | "when": "editorTextFocus"
37 | },
38 | {
39 | "command": "cursorcode.conversation",
40 | "key": "ctrl+alt+u",
41 | "mac": "cmd+alt+u",
42 | "when": "editorTextFocus"
43 | }
44 | ],
45 | "menus": {
46 | "editor/context": [
47 | {
48 | "when": "editorTextFocus",
49 | "command": "cursorcode.generation",
50 | "group": "cursor-menu"
51 | }
52 | ]
53 | },
54 | "viewsContainers": {
55 | "activitybar": [
56 | {
57 | "id": "cursorcode",
58 | "title": "CursorCode",
59 | "icon": "resources/logo.svg"
60 | }
61 | ]
62 | },
63 | "views": {
64 | "cursorcode": [
65 | {
66 | "type": "webview",
67 | "id": "cursorcode.chatView",
68 | "name": "CursorCode"
69 | }
70 | ]
71 | },
72 | "configuration": {
73 | "title": "CursorCodeConfig",
74 | "properties": {
75 | "cursorcode.accessToken": {
76 | "type": "string",
77 | "default": "",
78 | "description": "登录令牌"
79 | }
80 | }
81 | }
82 | },
83 | "scripts": {
84 | "vscode:prepublish": "npm run package",
85 | "compile": "webpack",
86 | "watch": "webpack --watch",
87 | "package": "webpack --mode production --devtool hidden-source-map",
88 | "compile-tests": "tsc -p . --outDir out",
89 | "watch-tests": "tsc -p . -w --outDir out",
90 | "pretest": "npm run compile-tests && npm run compile && npm run lint",
91 | "lint": "eslint src --ext ts",
92 | "test": "node ./out/test/runTest.js"
93 | },
94 | "devDependencies": {
95 | "@types/glob": "^8.1.0",
96 | "@types/mocha": "^10.0.1",
97 | "@types/node": "16.x",
98 | "@types/vscode": "^1.76.0",
99 | "@typescript-eslint/eslint-plugin": "^5.53.0",
100 | "@typescript-eslint/parser": "^5.53.0",
101 | "@vscode/test-electron": "^2.2.3",
102 | "eslint": "^8.34.0",
103 | "glob": "^8.1.0",
104 | "mocha": "^10.2.0",
105 | "ts-loader": "^9.4.2",
106 | "typescript": "^4.9.5",
107 | "webpack": "^5.75.0",
108 | "webpack-cli": "^5.0.1"
109 | },
110 | "dependencies": {
111 | "@types/uuid": "^9.0.1",
112 | "axios": "^1.3.4",
113 | "uuid": "^9.0.0"
114 | }
115 | }
116 |
--------------------------------------------------------------------------------
/media/css/leftSideStyle.css:
--------------------------------------------------------------------------------
1 | .code {
2 | white-space: pre;
3 | }
4 |
5 | input {
6 | background: var(--vscode-input-background);
7 | /* border-color: var(--vscode-input-border); */
8 | }
9 |
10 |
11 | /* #chat-box {
12 | margin-bottom: 80px;
13 | } */
14 |
15 | #prompt-input {
16 | padding: 6px;
17 | height: 32px;
18 | margin-top: 5px;
19 | margin-bottom: 1px;
20 | border: 1px solid var(--vscode-focusBorder);
21 | border-radius: 6px;
22 | /* border-color: var(--vscode-focusBorder); */
23 | }
24 |
25 | #prompt-input::placeholder {
26 | color: var(--vscode-input-placeholderForeground);
27 | }
28 |
29 | #bottom-box {
30 | position: fixed;
31 | width: 96%;
32 | right: 2%;
33 | bottom: 0px;
34 | margin-top: 10px;
35 | display: flex;
36 | flex-direction: column;
37 | justify-content: center;
38 | }
39 |
40 | /* 定义动画 */
41 | @keyframes fadeIn {
42 | from {
43 | opacity: 0;
44 | }
45 |
46 | to {
47 | opacity: 1;
48 | }
49 | }
50 |
51 | .chat-answer {
52 | padding: 10px 10px 10px 10px;
53 | background-color: var(--vscode-input-background);
54 | animation: fadeIn 1s;
55 | }
56 |
57 | .chat-question {
58 | margin-top: 10px;
59 | margin-bottom: 10px;
60 | border-left: 4px solid var(--vscode-focusBorder);
61 | padding: 10px 10px 10px 10px;
62 | animation: fadeIn 1s;
63 | }
64 |
65 | pre {
66 | margin-top: 0.5rem !important;
67 | margin-bottom: 0.5rem !important;
68 | }
69 |
70 | pre code {
71 | display: block;
72 | padding: 0.5rem;
73 | overflow-x: scroll;
74 | }
75 |
76 | code {
77 | display: inline;
78 | padding: 2px 4px 4px 2px;
79 | background-color: var(--vscode-editorWidget-background);
80 | }
81 |
82 | .code-tool {
83 | display: flex;
84 | justify-content: end;
85 | padding: 4px 6px 0px 0px;
86 | gap: 10px;
87 | background-color: var(--vscode-editorWidget-background);
88 | }
89 |
90 | .code-tool a {
91 | font-size: 0.8rem;
92 | color: var(--vscode-textLink-foreground);
93 | font-family: var(--vscode-font-family);
94 | font-weight: var(--vscode-font-weight);
95 | }
96 |
97 | .code-tool a:hover {
98 | color: var(--vscode-textLink-activeForeground);
99 | }
100 | .code-tool a:active {
101 | border: none;
102 | }
103 |
104 | .code-tool a:focus {
105 | border: none;
106 | }
107 |
108 | #read-box p {
109 | margin-bottom: 10px;
110 | }
111 |
112 | .response-box {
113 | width: 100%;
114 | display: flex;
115 | justify-content: center;
116 | }
117 |
118 | #stop-response {
119 | display: none;
120 | width: 80px;
121 | padding: 2px 6px 2px 6px;
122 | color: var(--vscode-focusBorder);
123 | border: 1px solid var(--vscode-focusBorder);
124 | border-radius: 6px;
125 | margin-top: 10px;
126 | }
127 |
128 | #stop-response:hover {
129 | color: var(--vscode-errorForeground);
130 | border: 1px solid var(--vscode-errorForeground);
131 | }
132 |
133 | #clear-msg {
134 | color: var(--vscode-focusBorder);
135 | margin-bottom: 5px;
136 | }
137 |
138 | #clear-msg:hover {
139 | color: var(--vscode-errorForeground);
140 | }
141 |
142 | #login-btn {
143 | padding: 4px;
144 | border-radius: 4px;
145 | color: var(--vscode-focusBorder);
146 | border: 1px solid var(--vscode-focusBorder);
147 | }
--------------------------------------------------------------------------------
/media/main.js:
--------------------------------------------------------------------------------
1 | // @ts-ignore
2 |
3 | // This script will be run within the webview itself
4 | // It cannot access the main VS Code APIs directly.
5 | (function () {
6 | const vscode = acquireVsCodeApi();
7 |
8 | marked.setOptions({
9 | renderer: new marked.Renderer(),
10 | gfm: true,
11 | tables: true,
12 | breaks: false,
13 | pedantic: false,
14 | sanitize: false,
15 | smartLists: true,
16 | smartypants: false,
17 | highlight: function (code, lang) {
18 | //使用 highlight 插件解析文档中代码部分
19 | return hljs.highlightAuto(code, [lang]).value;
20 | }
21 | });
22 |
23 | // let ele_read = document.getElementById('read-box');
24 | // console.log(readMeContent)
25 | // let text = marked.parse(readMeContent);
26 | // ele_read.innerHTML = text;
27 |
28 | let receiveData = {
29 | msgType: 'freeform',
30 | fileName: 'js'
31 | }
32 |
33 | // Handle messages sent from the extension to the webview
34 | window.addEventListener("message", (event) => {
35 | const message = event.data;
36 | switch (message.type) {
37 | case "addQuestion": {
38 | receiveData = message;
39 | addQuestion(message.value)
40 | break;
41 | }
42 | case "addAnswer": {
43 | addAnswer(message.value)
44 | break;
45 | }
46 | case "showInput": {
47 | showInput(true, message.value)
48 | break;
49 | }
50 | }
51 | });
52 |
53 | let stopBtn = document.getElementById('stop-response');
54 | let clearBtn = document.getElementById('clear-msg');
55 | let loginBtn = document.getElementById('login-btn');
56 |
57 | stopBtn.addEventListener('click', function (e) {
58 | showInput(true, "已经结束响应,请开始新的问答...")
59 | })
60 |
61 | clearBtn.addEventListener('click', function (e) {
62 | vscode.postMessage({
63 | type: 'clear'
64 | });
65 | document.getElementById("chat-box").innerHTML = '';
66 | })
67 |
68 | loginBtn.addEventListener('click', function (e) {
69 | vscode.postMessage({
70 | type: 'loginCursor'
71 | });
72 | })
73 |
74 | function showInput(type, msg) {
75 | let box = document.getElementById('bottom-box');
76 | let input = document.getElementById('prompt-input');
77 | if (type) {
78 | if (msg) {
79 | let ele_div = document.querySelector('.chat-answer:last-child');
80 | ele_div.innerText = msg;
81 | }
82 | box.style.pointerEvents = 'all';
83 | stopBtn.style.display = 'none';
84 | } else {
85 | box.style.pointerEvents = 'none';
86 | input.value = '';
87 | input.blur();
88 | stopBtn.style.display = 'block';
89 | }
90 | }
91 |
92 | function createElement(className) {
93 | let ele_div = document.createElement('div');
94 | ele_div.className = className;
95 | document.getElementById("chat-box").appendChild(ele_div)
96 | return ele_div;
97 | }
98 |
99 | function addQuestion(message) {
100 | showInput(false)
101 | let ele_div = createElement('chat-question')
102 | ele_div.innerText = message;
103 | let ele_div_answer = createElement('chat-answer')
104 | ele_div_answer.innerText = '正在思考中...';
105 | window.scrollTo(0, document.body.scrollHeight);
106 | }
107 |
108 | function addAnswer(content) {
109 | // 如果是停止响应,不再添加内容
110 | if (stopBtn.style.display == 'none') {
111 | return;
112 | }
113 |
114 | if (receiveData.msgType != 'freeform') {
115 | const fileSplit = receiveData.fileName.split('.')
116 | const lang = fileSplit[fileSplit.length - 1]
117 | content = '```' + lang + '\n' + content + '\n```'
118 | }
119 |
120 | html = marked.parse(content);
121 | ele_div = document.querySelector('.chat-answer:last-child')
122 | ele_div.innerHTML = html
123 |
124 | preBlocks = ele_div.querySelectorAll('pre')
125 |
126 | preBlocks.forEach(preTag => {
127 | preTag.insertAdjacentHTML('afterbegin',
128 | ``
132 | );
133 | let copyBtn = preTag.querySelector('.copy-btn');
134 | let insertBtn = preTag.querySelector('.insert-btn');
135 | let codeText = preTag.querySelector('code').innerText;
136 | copyBtn.addEventListener('click', function (e) {
137 | e.preventDefault();
138 | navigator.clipboard.writeText(codeText);
139 | })
140 | insertBtn.addEventListener('click', function (e) {
141 | e.preventDefault();
142 | vscode.postMessage({
143 | type: 'codeSelected',
144 | value: codeText
145 | });
146 | })
147 | });
148 |
149 | window.scrollTo(0, document.body.scrollHeight);
150 |
151 | }
152 |
153 | // Listen for keyup events on the prompt input element
154 | document.getElementById('prompt-input').addEventListener('keyup', function (e) {
155 | // If the key that was pressed was the Enter key
156 | if (e.keyCode === 13) {
157 | vscode.postMessage({
158 | type: 'prompt',
159 | value: this.value
160 | });
161 | }
162 | });
163 | })();
--------------------------------------------------------------------------------
/src/extension.ts:
--------------------------------------------------------------------------------
1 | // The module 'vscode' contains the VS Code extensibility API
2 | // Import the module and reference it with the alias vscode in your code below
3 | import * as vscode from "vscode";
4 | const axios = require("axios").default;
5 | const path = require("path");
6 | const fs = require("fs");
7 | import { v4 as uuidv4 } from "uuid";
8 |
9 | import { loginCursor } from "./auth";
10 |
11 | type ResponseType =
12 | | "idk"
13 | | "freeform"
14 | | "generate"
15 | | "edit"
16 | | "chat_edit"
17 | | "lsp_edit";
18 |
19 | interface CodeBlock {
20 | fileId: number;
21 | text: string;
22 | startLine: number;
23 | endLine: number;
24 | }
25 |
26 | type CodeSymbolType = "import" | "function" | "class" | "variable";
27 | interface CodeSymbol {
28 | fileName: string;
29 | name: string;
30 | type: CodeSymbolType;
31 | }
32 |
33 | interface UserMessage {
34 | sender: "user";
35 | conversationId: string;
36 | message: string;
37 | msgType: ResponseType;
38 | sentAt: number;
39 | currentFile: string | null;
40 | precedingCode: string | null;
41 | procedingCode: string | null;
42 | currentSelection: string | null;
43 | // Other pieces of info encoded
44 | otherCodeBlocks: CodeBlock[];
45 | codeSymbols: CodeSymbol[];
46 | selection: { from: number; to: number } | null;
47 | maxOrigLine?: number;
48 | }
49 |
50 | type BotMessageType =
51 | | "edit"
52 | | "continue"
53 | | "markdown"
54 | | "multifile"
55 | | "location"
56 | | "interrupt"
57 | | "chat_edit"
58 | | "lsp_edit";
59 |
60 | interface BotMessage {
61 | sender: "bot";
62 | sentAt: number;
63 | type: BotMessageType;
64 | conversationId: string;
65 | message: string;
66 | currentFile: string | null;
67 | lastToken: string;
68 | finished: boolean;
69 | interrupted: boolean;
70 | rejected?: boolean;
71 | hitTokenLimit?: boolean;
72 | maxOrigLine?: number;
73 | useDiagnostics?: boolean | number;
74 | }
75 |
76 | // This method is called when your extension is activated
77 | // Your extension is activated the very first time the command is executed
78 | export function activate(context: vscode.ExtensionContext) {
79 | // Use the console to output diagnostic information (console.log) and errors (console.error)
80 | // This line of code will only be executed once when your extension is activated
81 | console.log('Congratulations, your extension "cursorcode" is now active!');
82 |
83 | // The command has been defined in the package.json file
84 | // Now provide the implementation of the command with registerCommand
85 | // The commandId parameter must match the command field in package.json
86 |
87 | const provider = new CursorWebviewViewProvider(
88 | context.extensionUri,
89 | context.extensionPath
90 | );
91 |
92 | const curosrDispose = vscode.window.registerWebviewViewProvider(
93 | "cursorcode.chatView",
94 | provider,
95 | {
96 | webviewOptions: { retainContextWhenHidden: true },
97 | }
98 | );
99 |
100 | const generationDispose = vscode.commands.registerTextEditorCommand(
101 | "cursorcode.generation",
102 | (editor: vscode.TextEditor) => {
103 | // console.log(editor);
104 | vscode.window
105 | .showInputBox({
106 | prompt: "主人,您有何吩咐?",
107 | placeHolder: "请帮我生成/优化/审查...",
108 | })
109 | .then((value) => {
110 | const selected = editor.document.getText(editor.selection);
111 | if (selected) {
112 | provider.msgType = "edit";
113 | } else {
114 | provider.msgType = "generate";
115 | }
116 | if (value) {
117 | provider.message = value!;
118 | provider.conversation();
119 | // console.log(value);
120 | }
121 | });
122 | }
123 | );
124 |
125 | const conversationDispose = vscode.commands.registerTextEditorCommand(
126 | "cursorcode.conversation",
127 | (editor: vscode.TextEditor) => {
128 | // console.log(editor);
129 | vscode.window
130 | .showInputBox({
131 | prompt: "主人,您有什么问题吗?",
132 | placeHolder: "帮我解释一下这段代码...",
133 | })
134 | .then((value) => {
135 | provider.msgType = "freeform";
136 | if (value) {
137 | provider.message = value!;
138 | provider.conversation();
139 | // console.log(value);
140 | }
141 | });
142 | }
143 | );
144 |
145 | context.subscriptions.push(
146 | generationDispose,
147 | curosrDispose,
148 | conversationDispose
149 | );
150 | }
151 |
152 | class CursorWebviewViewProvider implements vscode.WebviewViewProvider {
153 | private _view?: vscode.WebviewView;
154 |
155 | private url: string = "https://aicursor.com";
156 | public message: string = "";
157 | public msgType: ResponseType = "freeform";
158 | private contextType: string = 'copilot';
159 |
160 | private accessToken: string = '';
161 |
162 | public pasteOnClick: boolean = true;
163 | public keepConversation: boolean = true;
164 |
165 | public userMessages: UserMessage[] = [];
166 | public botMessages: BotMessage[] = [];
167 | public conversationId: string = "";
168 |
169 | constructor(
170 | private readonly _extensionUri: vscode.Uri,
171 | private readonly extensionPath: string
172 | ) {
173 | // 获取配置项
174 | const config = vscode.workspace.getConfiguration('cursorcode');
175 | // 获取配置项中的文本
176 | const cursorToken:string = config.get('accessToken') as string;
177 | // 显示文本
178 | this.accessToken = cursorToken;
179 | // console.log(cursorToken)
180 | }
181 |
182 | public resolveWebviewView(
183 | webviewView: vscode.WebviewView,
184 | context: vscode.WebviewViewResolveContext,
185 | _token: vscode.CancellationToken
186 | ) {
187 | this._view = webviewView;
188 |
189 | // set options for the webview
190 | webviewView.webview.options = {
191 | // Allow scripts in the webview
192 | enableScripts: true,
193 | localResourceRoots: [this._extensionUri],
194 | };
195 |
196 | // set the HTML for the webview
197 | webviewView.webview.html = this._getHtmlForWebview(webviewView.webview);
198 |
199 | // add an event listener for messages received by the webview
200 | webviewView.webview.onDidReceiveMessage(async (data) => {
201 | switch (data.type) {
202 | case "codeSelected": {
203 | // do nothing if the pasteOnClick option is disabled
204 | if (!this.pasteOnClick) {
205 | break;
206 | }
207 |
208 | let code = data.value;
209 | code = code.replace(/([^\\])(\$)([^{0-9])/g, "$1\\$$$3");
210 |
211 | // insert the code as a snippet into the active text editor
212 | vscode.window.activeTextEditor?.insertSnippet(
213 | new vscode.SnippetString(code)
214 | );
215 | break;
216 | }
217 | case "prompt": {
218 | this.msgType = "freeform";
219 | this.message = data.value;
220 | this.conversation();
221 | break
222 | }
223 | case "clear": {
224 | this.userMessages = [];
225 | this.botMessages = [];
226 | this.conversationId = "";
227 | break
228 | }
229 | case "loginCursor": {
230 | const loginData: any = await loginCursor()
231 | if(loginData){
232 | this.accessToken = loginData.accessToken;
233 | // 获取配置项
234 | const config = vscode.workspace.getConfiguration('cursorcode');
235 | // 将文本保存到配置项里面
236 | config.update('accessToken', loginData.accessToken, vscode.ConfigurationTarget.Global);
237 | config.update('refreshToken', loginData.refreshToken, vscode.ConfigurationTarget.Global);
238 | config.update('challenge', loginData.challenge, vscode.ConfigurationTarget.Global);
239 | vscode.window.showInformationMessage("登录成功");
240 | }else {
241 | vscode.window.showInformationMessage("登录失败");
242 | }
243 | break
244 | }
245 | }
246 | });
247 | }
248 |
249 | /**
250 | * 获取请求体数据
251 | * @returns 请求体数据
252 | */
253 | public getPayload() {
254 | const editor = vscode.window.activeTextEditor!;
255 | if (!editor) {
256 | vscode.window.showWarningMessage(
257 | "CursorCode:对话前请先打开一个代码文件!"
258 | );
259 | return false;
260 | }
261 | const selection = editor.selection;
262 |
263 | // Split the `precedingCode` into chunks of 20 line blocks called `precedingCodeBlocks`
264 | const blockSize = 20;
265 |
266 | let precedingCodeBlocks = [];
267 | // 获取选中代码的上文代码
268 | const precedingCode = editor.document.getText(
269 | new vscode.Range(new vscode.Position(0, 0), selection.start)
270 | );
271 | if (precedingCode) {
272 | let precedingCodeLines = precedingCode.split("\n");
273 | for (let i = 0; i < precedingCodeLines.length; i += blockSize) {
274 | let block = precedingCodeLines.slice(i, i + blockSize);
275 | precedingCodeBlocks.push(block.join("\n"));
276 | }
277 | }
278 |
279 | // Split the `procedingCodeBlocks` into chunks of 20 line blocks called `procedingCodeBlocks`
280 | let procedingCodeBlocks = [];
281 | const endLine = editor.document.lineCount - 1;
282 | const endLineLen = editor.document.lineAt(new vscode.Position(endLine, 0))
283 | .text.length;
284 | // 获取选中代码的下文代码
285 | const procedingCode = editor?.document.getText(
286 | new vscode.Range(selection.end, new vscode.Position(endLine, endLineLen))
287 | );
288 | if (procedingCode) {
289 | let procedingCodeLines = procedingCode.split("\n");
290 | for (let i = 0; i < procedingCodeLines.length; i += blockSize) {
291 | let block = procedingCodeLines.slice(i, i + blockSize);
292 | procedingCodeBlocks.push(block.join("\n"));
293 | }
294 | }
295 |
296 | const filePath = editor.document.fileName;
297 | const rootPath = path.dirname(filePath);
298 |
299 | const userRequest = {
300 | // Core request
301 | message: this.message,
302 | // Context of the current file
303 | currentRootPath: rootPath,
304 | currentFileName: filePath,
305 | currentFileContents: editor.document.getText(),
306 | // Context surrounding the cursor position
307 | precedingCode: precedingCodeBlocks,
308 | currentSelection:
309 | editor.document.getText(selection) == ""
310 | ? null
311 | : editor.document.getText(selection) ?? null,
312 | suffixCode: procedingCodeBlocks,
313 | // Get Copilot values
314 | copilotCodeBlocks: [],
315 | // Get user defined values
316 | customCodeBlocks: [],
317 | codeBlockIdentifiers: [],
318 | msgType: this.msgType,
319 | // Messy, but needed for the single lsp stuff to work
320 | maxOrigLine: null,
321 | diagnostics: null,
322 | };
323 | const userMessages = [
324 | ...this.userMessages
325 | .filter((um: any) => um.conversationId == this.conversationId)
326 | .slice(0, -1),
327 | ];
328 | const botMessages = [
329 | ...this.botMessages.filter(
330 | (bm: any) => bm.conversationId == this.conversationId
331 | ),
332 | ];
333 | const data = {
334 | userRequest,
335 | userMessages: this.msgType === "freeform" ? userMessages : [],
336 |
337 | botMessages: this.msgType === "freeform" ? botMessages : [],
338 | //useFour: state.settingsState.settings.useFour === 'enabled',
339 | contextType: this.contextType,
340 |
341 | rootPath: rootPath,
342 |
343 | // apiKey: null
344 | };
345 |
346 | // console.log(data);
347 | return data;
348 | }
349 |
350 | public async conversation() {
351 | const payload = this.getPayload();
352 | if (!payload) {
353 | return;
354 | }
355 |
356 | // focus gpt activity from activity bar
357 | if (!this._view) {
358 | await vscode.commands.executeCommand("cursorcode.chatView.focus");
359 | } else {
360 | this._view?.show?.(true);
361 | }
362 |
363 | this._view?.webview.postMessage({
364 | type: "addQuestion",
365 | value: this.message,
366 | msgType: this.msgType,
367 | fileName: vscode.window.activeTextEditor?.document.fileName,
368 | });
369 |
370 | var reqData = {
371 | method: "POST",
372 | url: this.url + "/conversation",
373 | headers: {
374 | "accept-language": "zh-CN",
375 | "content-type": "application/json",
376 | // authorization: '',
377 | "user-agent":
378 | "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Cursor/0.2.0 Chrome/108.0.5359.62 Electron/22.0.0 Safari/537.36",
379 | Authorization: "Bearer " + this.accessToken,
380 | },
381 | data: payload,
382 | responseType: "stream",
383 | };
384 | let response;
385 | try {
386 | response = await axios.request(reqData);
387 | } catch (e: any) {
388 | if (e.response.status==401) {
389 | this._view?.webview.postMessage({
390 | type: "showInput",
391 | value: "请先点击上方的登录按钮进行登录后使用",
392 | });
393 | return;
394 | }
395 | // this._view?.webview.postMessage({
396 | // type: "showInput",
397 | // value: "使用超出上限,请重试,如果还是不行,请稍等几分钟重试...",
398 | // });
399 | this._view?.webview.postMessage({
400 | type: "showInput",
401 | value: "出错啦," + e.response.statusText,
402 | });
403 | return;
404 | }
405 | const stream = response.data;
406 | this.streamSource(stream);
407 | }
408 |
409 | public async continue(answer: string) {
410 | const payload = this.getPayload();
411 | if (!payload) {
412 | return;
413 | }
414 |
415 | const newBotMessage: BotMessage = {
416 | sender: "bot",
417 | sentAt: Date.now(),
418 | type: "edit",
419 | conversationId: uuidv4(),
420 | lastToken: "",
421 | message: answer,
422 | finished: false,
423 | currentFile: payload.userRequest.currentFileName,
424 | interrupted: true,
425 | // hitTokenLimit: true,
426 | // maxOrigLine: vscode.window.activeTextEditor?.document.lineCount! - 1,
427 | };
428 | payload.botMessages.push(newBotMessage);
429 |
430 | // console.log(payload);
431 |
432 | // focus gpt activity from activity bar
433 | if (!this._view) {
434 | await vscode.commands.executeCommand("cursorcode.chatView.focus");
435 | } else {
436 | this._view?.show?.(true);
437 | }
438 |
439 | this._view?.webview.postMessage({
440 | type: "addQuestion",
441 | value: this.message,
442 | msgType: this.msgType,
443 | fileName: vscode.window.activeTextEditor?.document.fileName,
444 | });
445 |
446 | var reqData = {
447 | method: "POST",
448 | url: this.url + "/continue/",
449 | headers: {
450 | "accept-language": "zh-CN",
451 | "content-type": "application/json",
452 | "user-agent":
453 | "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Cursor/0.1.0 Chrome/108.0.5359.62 Electron/22.0.0 Safari/537.36",
454 | },
455 | data: payload,
456 | responseType: "stream",
457 | };
458 | let response;
459 | try {
460 | response = await axios.request(reqData);
461 | } catch (e) {
462 | console.log(response);
463 | console.log(e);
464 | this._view?.webview.postMessage({
465 | type: "showInput",
466 | value: "使用超出上限,请重试,如果还是不行,请稍等几分钟重试...",
467 | });
468 | return;
469 | }
470 | const stream = response.data;
471 | this.streamSource(stream, true);
472 | }
473 |
474 | /**
475 | * 解析stream
476 | * @param stream 数据流
477 | */
478 | private streamSource(stream: any, isContinue: boolean = false) {
479 | //解析stream
480 | let isMsg = isContinue;
481 | let content = "";
482 | let newContent = "";
483 | let isInterrupt = false;
484 | stream.on("data", (data: any) => {
485 | data = data.toString();
486 | // console.log(data);
487 | const lines = data.split("\n");
488 | // 在编辑器光标处插入代码
489 | for (let line of lines) {
490 | if (line.startsWith("data: ")) {
491 | let jsonString = line.slice(6);
492 | // console.log(jsonString);
493 | if (jsonString == "[DONE]") {
494 | this._view?.webview.postMessage({
495 | type: "showInput",
496 | value: null,
497 | });
498 | return console.log("done");
499 | }
500 | if (jsonString.indexOf("BEGIN_message") != -1) {
501 | jsonString = jsonString.split("|>")[1] ?? "";
502 | isMsg = true;
503 | }
504 | if (jsonString.indexOf("END_message") != -1) {
505 | jsonString = jsonString.split("<|")[0];
506 | // 对话式才计如上下文
507 | if (this.msgType == "freeform") {
508 | this.manufacturedConversation(this.message, content);
509 | }
510 | isMsg = false;
511 | }
512 | if (jsonString.indexOf("<|END_interrupt|>") != -1) {
513 | jsonString = jsonString.replace("<|END_interrupt|>", "");
514 | isInterrupt = true;
515 | }
516 |
517 | if (isMsg) {
518 | try {
519 | if (jsonString != '"') {
520 | content += JSON.parse(jsonString);
521 | } else {
522 | continue;
523 | }
524 | } catch (e) {
525 | console.log("出错了", jsonString);
526 | this._view?.webview.postMessage({
527 | type: "showInput",
528 | value: "出错啦,请重试...",
529 | });
530 | return;
531 | }
532 |
533 | // Replace all occurrences of "/path/to/file.extension\n" with "file.extension\n"
534 | const replacePathWithFilename = (text: string) => {
535 | return text.replace(/```\w:.*?\.(\w+)/g, "```$1\n");
536 | };
537 |
538 | const replaceRN = (text: string) => {
539 | return text.replace("\r\n", "\n");
540 | };
541 |
542 | // console.log(replacePathWithFilename(content))
543 | newContent = replacePathWithFilename(replaceRN(content));
544 |
545 | this._view?.webview.postMessage({
546 | type: "addAnswer",
547 | value: newContent,
548 | });
549 | }
550 | }
551 | }
552 | });
553 |
554 | stream.on("end", () => {
555 | // if (content.length < 5) {
556 | // this._view?.webview.postMessage({
557 | // type: "showInput",
558 | // value: "出错啦,请重试...",
559 | // });
560 | // console.error("异常断开");
561 | // return;
562 | // }
563 | if(isInterrupt) {
564 | // console.log(newContent)
565 | // this.continue(newContent);
566 | return;
567 | }
568 | });
569 |
570 | stream.on("error", (err: any) => {
571 | this._view?.webview.postMessage({
572 | type: "showInput",
573 | value: "出错啦,请重试...",
574 | });
575 | console.error("异常断开");
576 | return;
577 | });
578 | }
579 |
580 | public manufacturedConversation(question: any, answer: string) {
581 | if (this.conversationId == "") {
582 | this.conversationId = uuidv4();
583 | }
584 |
585 | const editor = vscode.window.activeTextEditor!;
586 | const selection = editor.selection;
587 |
588 | // 获取选中代码的上文代码
589 | const precedingCode = editor.document.getText(
590 | new vscode.Range(new vscode.Position(0, 0), selection.start)
591 | );
592 | const endLine = editor.document.lineCount - 1;
593 | const endLineLen = editor.document.lineAt(new vscode.Position(endLine, 0))
594 | .text.length;
595 | // 获取选中代码的下文代码
596 | const procedingCode = editor?.document.getText(
597 | new vscode.Range(selection.end, new vscode.Position(endLine, endLineLen))
598 | );
599 |
600 | const newUserMessage: UserMessage = {
601 | sender: "user",
602 | sentAt: Date.now(),
603 | message: question,
604 | conversationId: this.conversationId,
605 | otherCodeBlocks: [],
606 | codeSymbols: [],
607 | currentFile: editor.document.fileName ?? null,
608 | precedingCode: precedingCode ?? null,
609 | procedingCode: procedingCode ?? null,
610 | currentSelection: editor.document.getText(editor.selection) ?? null,
611 | // maxOrigLine: null,
612 | selection: null,
613 | msgType: "freeform",
614 | };
615 |
616 | this.userMessages.push(newUserMessage);
617 |
618 | const newBotMessage: BotMessage = {
619 | sender: "bot",
620 | sentAt: Date.now(),
621 | type: "markdown",
622 | conversationId: this.conversationId,
623 | lastToken: "",
624 | message: answer,
625 | finished: true,
626 | currentFile: null,
627 | interrupted: false,
628 | // maxOrigLine: null,
629 | };
630 |
631 | this.botMessages.push(newBotMessage);
632 | // Ready for another message in this conversation
633 | // chatState.draftMessages[newConversationId] = {
634 | // ...newUserMessage,
635 | // message: "",
636 | // };
637 | }
638 |
639 | private _getHtmlForWebview(webview: vscode.Webview) {
640 | const scriptUri = webview.asWebviewUri(
641 | vscode.Uri.joinPath(this._extensionUri, "media", "main.js")
642 | );
643 | const tailwindUri = webview.asWebviewUri(
644 | vscode.Uri.joinPath(
645 | this._extensionUri,
646 | "media",
647 | "scripts",
648 | "tailwind.min.js"
649 | )
650 | );
651 | const markeddUri = webview.asWebviewUri(
652 | vscode.Uri.joinPath(
653 | this._extensionUri,
654 | "media",
655 | "scripts",
656 | "marked.min.js"
657 | )
658 | );
659 | const highlightUri = webview.asWebviewUri(
660 | vscode.Uri.joinPath(
661 | this._extensionUri,
662 | "media",
663 | "scripts",
664 | "highlight.min.js"
665 | )
666 | );
667 | const highlighDefualtUri = webview.asWebviewUri(
668 | vscode.Uri.joinPath(
669 | this._extensionUri,
670 | "media",
671 | "css",
672 | "highligh.style.css"
673 | )
674 | );
675 | const leftSideStyleUri = webview.asWebviewUri(
676 | vscode.Uri.joinPath(
677 | this._extensionUri,
678 | "media",
679 | "css",
680 | "leftSideStyle.css"
681 | )
682 | );
683 |
684 | // const filePath = path.join(this.extensionPath, 'resources', 'read.md');
685 | // const readMe = fs.readFileSync(filePath, 'utf8');
686 | // console.log(readMe)
687 |
688 | return `
689 |
690 |
691 |
692 |
693 |
694 |
695 |
696 |
697 |
698 |
699 |
700 |
701 |
702 |
欢迎使用CursorCode
703 |
对话会话:在下方输入框中输入问题
704 |
代码生成:右键代码框,在菜单中点击CourseCode选项输入需求
705 |
代码优化:在代码框中选中代码,右键在菜单中点击CourseCode选项,在上方弹出的输入框中输入需求
706 |
代码优化:在代码框中选中代码,在下方输入框中输入需求
707 |
快捷键一:在代码框中按下Ctrl+Alt+Y弹出代码生成/优化命令框
708 |
快捷键二:在代码框中按下Ctrl+Alt+U弹出对话消息发送框
709 |
Tips:如果出现空白,没有回答内容的情况,请直接点击停止响应
710 |
Github:https://github.com/Meteo-Pig/CursorCode
711 |
712 |
713 |
714 | 请输入你的问题:
715 |
716 |
717 |
718 |
719 |
720 |
721 |
722 |
723 |
724 | `;
725 | }
726 | }
727 |
728 | // This method is called when your extension is deactivated
729 | export function deactivate() {}
730 |
--------------------------------------------------------------------------------
/media/scripts/marked.min.js:
--------------------------------------------------------------------------------
1 | /**
2 | * marked v4.3.0 - a markdown parser
3 | * Copyright (c) 2011-2023, Christopher Jeffrey. (MIT Licensed)
4 | * https://github.com/markedjs/marked
5 | */
6 | !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).marked={})}(this,function(r){"use strict";function i(e,t){for(var u=0;ue.length)&&(t=e.length);for(var u=0,n=new Array(t);u=e.length?{done:!0}:{done:!1,value:e[u++]}};throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function e(){return{async:!1,baseUrl:null,breaks:!1,extensions:null,gfm:!0,headerIds:!0,headerPrefix:"",highlight:null,hooks:null,langPrefix:"language-",mangle:!0,pedantic:!1,renderer:null,sanitize:!1,sanitizer:null,silent:!1,smartypants:!1,tokenizer:null,walkTokens:null,xhtml:!1}}r.defaults=e();function u(e){return t[e]}var n=/[&<>"']/,l=new RegExp(n.source,"g"),o=/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,a=new RegExp(o.source,"g"),t={"&":"&","<":"<",">":">",'"':""","'":"'"};function A(e,t){if(t){if(n.test(e))return e.replace(l,u)}else if(o.test(e))return e.replace(a,u);return e}var c=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/gi;function x(e){return e.replace(c,function(e,t){return"colon"===(t=t.toLowerCase())?":":"#"===t.charAt(0)?"x"===t.charAt(1)?String.fromCharCode(parseInt(t.substring(2),16)):String.fromCharCode(+t.substring(1)):""})}var h=/(^|[^\[])\^/g;function p(u,e){u="string"==typeof u?u:u.source,e=e||"";var n={replace:function(e,t){return t=(t=t.source||t).replace(h,"$1"),u=u.replace(e,t),n},getRegex:function(){return new RegExp(u,e)}};return n}var Z=/[^\w:]/g,O=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function f(e,t,u){if(e){try{n=decodeURIComponent(x(u)).replace(Z,"").toLowerCase()}catch(e){return null}if(0===n.indexOf("javascript:")||0===n.indexOf("vbscript:")||0===n.indexOf("data:"))return null}var n;t&&!O.test(u)&&(e=u,g[" "+(n=t)]||(q.test(n)?g[" "+n]=n+"/":g[" "+n]=C(n,"/",!0)),t=-1===(n=g[" "+n]).indexOf(":"),u="//"===e.substring(0,2)?t?e:n.replace(j,"$1")+e:"/"===e.charAt(0)?t?e:n.replace(P,"$1")+e:n+e);try{u=encodeURI(u).replace(/%25/g,"%")}catch(e){return null}return u}var g={},q=/^[^:]+:\/*[^/]*$/,j=/^([^:]+:)[\s\S]*$/,P=/^([^:]+:\/*[^/]*)[\s\S]*$/;var k={exec:function(){}};function d(e,t){var u=e.replace(/\|/g,function(e,t,u){for(var n=!1,r=t;0<=--r&&"\\"===u[r];)n=!n;return n?"|":" |"}).split(/ \|/),n=0;if(u[0].trim()||u.shift(),0t)u.splice(t);else for(;u.length>=1,e+=e;return u+e}function m(e,t,u,n){var r=t.href,t=t.title?A(t.title):null,i=e[1].replace(/\\([\[\]])/g,"$1");return"!"!==e[0].charAt(0)?(n.state.inLink=!0,e={type:"link",raw:u,href:r,title:t,text:i,tokens:n.inlineTokens(i)},n.state.inLink=!1,e):{type:"image",raw:u,href:r,title:t,text:A(i)}}var b=function(){function e(e){this.options=e||r.defaults}var t=e.prototype;return t.space=function(e){e=this.rules.block.newline.exec(e);if(e&&0=r.length?e.slice(r.length):e}).join("\n")),{type:"code",raw:t,lang:e[2]&&e[2].trim().replace(this.rules.inline._escapes,"$1"),text:u}},t.heading=function(e){var t,u,e=this.rules.block.heading.exec(e);if(e)return t=e[2].trim(),/#$/.test(t)&&(u=C(t,"#"),!this.options.pedantic&&u&&!/ $/.test(u)||(t=u.trim())),{type:"heading",raw:e[0],depth:e[1].length,text:t,tokens:this.lexer.inline(t)}},t.hr=function(e){e=this.rules.block.hr.exec(e);if(e)return{type:"hr",raw:e[0]}},t.blockquote=function(e){var t,u,n,e=this.rules.block.blockquote.exec(e);if(e)return t=e[0].replace(/^ *>[ \t]?/gm,""),u=this.lexer.state.top,this.lexer.state.top=!0,n=this.lexer.blockTokens(t),this.lexer.state.top=u,{type:"blockquote",raw:e[0],tokens:n,text:t}},t.list=function(e){var t=this.rules.block.list.exec(e);if(t){var u,n,r,i,s,l,o,a,D,c,h,p=1<(g=t[1].trim()).length,f={type:"list",raw:"",ordered:p,start:p?+g.slice(0,-1):"",loose:!1,items:[]},g=p?"\\d{1,9}\\"+g.slice(-1):"\\"+g;this.options.pedantic&&(g=p?g:"[*+-]");for(var F=new RegExp("^( {0,3}"+g+")((?:[\t ][^\\n]*)?(?:\\n|$))");e&&(h=!1,t=F.exec(e))&&!this.rules.block.hr.test(e);){if(u=t[0],e=e.substring(u.length),o=t[2].split("\n",1)[0].replace(/^\t+/,function(e){return" ".repeat(3*e.length)}),a=e.split("\n",1)[0],this.options.pedantic?(i=2,c=o.trimLeft()):(i=t[2].search(/[^ ]/),c=o.slice(i=4=i||!a.trim())c+="\n"+a.slice(i);else{if(s)break;if(4<=o.search(/[^ ]/))break;if(d.test(o))break;if(C.test(o))break;if(k.test(o))break;c+="\n"+a}s||a.trim()||(s=!0),u+=D+"\n",e=e.substring(D.length+1),o=a.slice(i)}f.loose||(l?f.loose=!0:/\n *\n *$/.test(u)&&(l=!0)),this.options.gfm&&(n=/^\[[ xX]\] /.exec(c))&&(r="[ ] "!==n[0],c=c.replace(/^\[[ xX]\] +/,"")),f.items.push({type:"list_item",raw:u,task:!!n,checked:r,loose:!1,text:c}),f.raw+=u}f.items[f.items.length-1].raw=u.trimRight(),f.items[f.items.length-1].text=c.trimRight(),f.raw=f.raw.trimRight();for(var E,x=f.items.length,m=0;m$/,"$1").replace(this.rules.inline._escapes,"$1"):"",n=e[3]&&e[3].substring(1,e[3].length-1).replace(this.rules.inline._escapes,"$1"),{type:"def",tag:t,raw:e[0],href:u,title:n}},t.table=function(e){e=this.rules.block.table.exec(e);if(e){var t={type:"table",header:d(e[1]).map(function(e){return{text:e}}),align:e[2].replace(/^ *|\| *$/g,"").split(/ *\| */),rows:e[3]&&e[3].trim()?e[3].replace(/\n[ \t]*$/,"").split("\n"):[]};if(t.header.length===t.align.length){t.raw=e[0];for(var u,n,r,i=t.align.length,s=0;s/i.test(e[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&/^<(pre|code|kbd|script)(\s|>)/i.test(e[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(e[0])&&(this.lexer.state.inRawBlock=!1),{type:this.options.sanitize?"text":"html",raw:e[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(e[0]):A(e[0]):e[0]}},t.link=function(e){e=this.rules.inline.link.exec(e);if(e){var t=e[2].trim();if(!this.options.pedantic&&/^$/.test(t))return;var u=C(t.slice(0,-1),"\\");if((t.length-u.length)%2==0)return}else{u=function(e,t){if(-1!==e.indexOf(t[1]))for(var u=e.length,n=0,r=0;r$/.test(t)?u.slice(1):u.slice(1,-1):u)&&u.replace(this.rules.inline._escapes,"$1"),title:r&&r.replace(this.rules.inline._escapes,"$1")},e[0],this.lexer)}},t.reflink=function(e,t){var u;if(u=(u=this.rules.inline.reflink.exec(e))||this.rules.inline.nolink.exec(e))return(e=t[(e=(u[2]||u[1]).replace(/\s+/g," ")).toLowerCase()])?m(u,e,u[0],this.lexer):{type:"text",raw:t=u[0].charAt(0),text:t}},t.emStrong=function(e,t,u){void 0===u&&(u="");var n=this.rules.inline.emStrong.lDelim.exec(e);if(n&&(!n[3]||!u.match(/(?:[0-9A-Za-z\xAA\xB2\xB3\xB5\xB9\xBA\xBC-\xBE\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0560-\u0588\u05D0-\u05EA\u05EF-\u05F2\u0620-\u064A\u0660-\u0669\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07C0-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u0870-\u0887\u0889-\u088E\u08A0-\u08C9\u0904-\u0939\u093D\u0950\u0958-\u0961\u0966-\u096F\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09E6-\u09F1\u09F4-\u09F9\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A66-\u0A6F\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AE6-\u0AEF\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B66-\u0B6F\u0B71-\u0B77\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0BE6-\u0BF2\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C5D\u0C60\u0C61\u0C66-\u0C6F\u0C78-\u0C7E\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDD\u0CDE\u0CE0\u0CE1\u0CE6-\u0CEF\u0CF1\u0CF2\u0D04-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D58-\u0D61\u0D66-\u0D78\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DE6-\u0DEF\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E86-\u0E8A\u0E8C-\u0EA3\u0EA5\u0EA7-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F20-\u0F33\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F-\u1049\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u1090-\u1099\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1369-\u137C\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u1711\u171F-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u17E0-\u17E9\u17F0-\u17F9\u1810-\u1819\u1820-\u1878\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19DA\u1A00-\u1A16\u1A20-\u1A54\u1A80-\u1A89\u1A90-\u1A99\u1AA7\u1B05-\u1B33\u1B45-\u1B4C\u1B50-\u1B59\u1B83-\u1BA0\u1BAE-\u1BE5\u1C00-\u1C23\u1C40-\u1C49\u1C4D-\u1C7D\u1C80-\u1C88\u1C90-\u1CBA\u1CBD-\u1CBF\u1CE9-\u1CEC\u1CEE-\u1CF3\u1CF5\u1CF6\u1CFA\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2070\u2071\u2074-\u2079\u207F-\u2089\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2150-\u2189\u2460-\u249B\u24EA-\u24FF\u2776-\u2793\u2C00-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2CFD\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312F\u3131-\u318E\u3192-\u3195\u31A0-\u31BF\u31F0-\u31FF\u3220-\u3229\u3248-\u324F\u3251-\u325F\u3280-\u3289\u32B1-\u32BF\u3400-\u4DBF\u4E00-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7CA\uA7D0\uA7D1\uA7D3\uA7D5-\uA7D9\uA7F2-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA830-\uA835\uA840-\uA873\uA882-\uA8B3\uA8D0-\uA8D9\uA8F2-\uA8F7\uA8FB\uA8FD\uA8FE\uA900-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF-\uA9D9\uA9E0-\uA9E4\uA9E6-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA50-\uAA59\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB69\uAB70-\uABE2\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD07-\uDD33\uDD40-\uDD78\uDD8A\uDD8B\uDE80-\uDE9C\uDEA0-\uDED0\uDEE1-\uDEFB\uDF00-\uDF23\uDF2D-\uDF4A\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCA0-\uDCA9\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDD70-\uDD7A\uDD7C-\uDD8A\uDD8C-\uDD92\uDD94\uDD95\uDD97-\uDDA1\uDDA3-\uDDB1\uDDB3-\uDDB9\uDDBB\uDDBC\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67\uDF80-\uDF85\uDF87-\uDFB0\uDFB2-\uDFBA]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC58-\uDC76\uDC79-\uDC9E\uDCA7-\uDCAF\uDCE0-\uDCF2\uDCF4\uDCF5\uDCFB-\uDD1B\uDD20-\uDD39\uDD80-\uDDB7\uDDBC-\uDDCF\uDDD2-\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE35\uDE40-\uDE48\uDE60-\uDE7E\uDE80-\uDE9F\uDEC0-\uDEC7\uDEC9-\uDEE4\uDEEB-\uDEEF\uDF00-\uDF35\uDF40-\uDF55\uDF58-\uDF72\uDF78-\uDF91\uDFA9-\uDFAF]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2\uDCFA-\uDD23\uDD30-\uDD39\uDE60-\uDE7E\uDE80-\uDEA9\uDEB0\uDEB1\uDF00-\uDF27\uDF30-\uDF45\uDF51-\uDF54\uDF70-\uDF81\uDFB0-\uDFCB\uDFE0-\uDFF6]|\uD804[\uDC03-\uDC37\uDC52-\uDC6F\uDC71\uDC72\uDC75\uDC83-\uDCAF\uDCD0-\uDCE8\uDCF0-\uDCF9\uDD03-\uDD26\uDD36-\uDD3F\uDD44\uDD47\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDD0-\uDDDA\uDDDC\uDDE1-\uDDF4\uDE00-\uDE11\uDE13-\uDE2B\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDEF0-\uDEF9\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC50-\uDC59\uDC5F-\uDC61\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDCD0-\uDCD9\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE50-\uDE59\uDE80-\uDEAA\uDEB8\uDEC0-\uDEC9\uDF00-\uDF1A\uDF30-\uDF3B\uDF40-\uDF46]|\uD806[\uDC00-\uDC2B\uDCA0-\uDCF2\uDCFF-\uDD06\uDD09\uDD0C-\uDD13\uDD15\uDD16\uDD18-\uDD2F\uDD3F\uDD41\uDD50-\uDD59\uDDA0-\uDDA7\uDDAA-\uDDD0\uDDE1\uDDE3\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE89\uDE9D\uDEB0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC50-\uDC6C\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46\uDD50-\uDD59\uDD60-\uDD65\uDD67\uDD68\uDD6A-\uDD89\uDD98\uDDA0-\uDDA9\uDEE0-\uDEF2\uDFB0\uDFC0-\uDFD4]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|\uD80B[\uDF90-\uDFF0]|[\uD80C\uD81C-\uD820\uD822\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879\uD880-\uD883][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE60-\uDE69\uDE70-\uDEBE\uDEC0-\uDEC9\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF50-\uDF59\uDF5B-\uDF61\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDE40-\uDE96\uDF00-\uDF4A\uDF50\uDF93-\uDF9F\uDFE0\uDFE1\uDFE3]|\uD821[\uDC00-\uDFF7]|\uD823[\uDC00-\uDCD5\uDD00-\uDD08]|\uD82B[\uDFF0-\uDFF3\uDFF5-\uDFFB\uDFFD\uDFFE]|\uD82C[\uDC00-\uDD22\uDD50-\uDD52\uDD64-\uDD67\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD834[\uDEE0-\uDEF3\uDF60-\uDF78]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB\uDFCE-\uDFFF]|\uD837[\uDF00-\uDF1E]|\uD838[\uDD00-\uDD2C\uDD37-\uDD3D\uDD40-\uDD49\uDD4E\uDE90-\uDEAD\uDEC0-\uDEEB\uDEF0-\uDEF9]|\uD839[\uDFE0-\uDFE6\uDFE8-\uDFEB\uDFED\uDFEE\uDFF0-\uDFFE]|\uD83A[\uDC00-\uDCC4\uDCC7-\uDCCF\uDD00-\uDD43\uDD4B\uDD50-\uDD59]|\uD83B[\uDC71-\uDCAB\uDCAD-\uDCAF\uDCB1-\uDCB4\uDD01-\uDD2D\uDD2F-\uDD3D\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD83C[\uDD00-\uDD0C]|\uD83E[\uDFF0-\uDFF9]|\uD869[\uDC00-\uDEDF\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF38\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]|\uD884[\uDC00-\uDF4A])/))){var r=n[1]||n[2]||"";if(!r||""===u||this.rules.inline.punctuation.exec(u)){var i=n[0].length-1,s=i,l=0,o="*"===n[0][0]?this.rules.inline.emStrong.rDelimAst:this.rules.inline.emStrong.rDelimUnd;for(o.lastIndex=0,t=t.slice(-1*e.length+i);null!=(n=o.exec(t));){var a,D=n[1]||n[2]||n[3]||n[4]||n[5]||n[6];if(D)if(a=D.length,n[3]||n[4])s+=a;else if((n[5]||n[6])&&i%3&&!((i+a)%3))l+=a;else if(!(0<(s-=a)))return a=Math.min(a,a+s+l),D=e.slice(0,i+n.index+(n[0].length-D.length)+a),Math.min(i,a)%2?(a=D.slice(1,-1),{type:"em",raw:D,text:a,tokens:this.lexer.inlineTokens(a)}):(a=D.slice(2,-2),{type:"strong",raw:D,text:a,tokens:this.lexer.inlineTokens(a)})}}}},t.codespan=function(e){var t,u,n,e=this.rules.inline.code.exec(e);if(e)return n=e[2].replace(/\n/g," "),t=/[^ ]/.test(n),u=/^ /.test(n)&&/ $/.test(n),n=A(n=t&&u?n.substring(1,n.length-1):n,!0),{type:"codespan",raw:e[0],text:n}},t.br=function(e){e=this.rules.inline.br.exec(e);if(e)return{type:"br",raw:e[0]}},t.del=function(e){e=this.rules.inline.del.exec(e);if(e)return{type:"del",raw:e[0],text:e[2],tokens:this.lexer.inlineTokens(e[2])}},t.autolink=function(e,t){var u,e=this.rules.inline.autolink.exec(e);if(e)return t="@"===e[2]?"mailto:"+(u=A(this.options.mangle?t(e[1]):e[1])):u=A(e[1]),{type:"link",raw:e[0],text:u,href:t,tokens:[{type:"text",raw:u,text:u}]}},t.url=function(e,t){var u,n,r,i;if(u=this.rules.inline.url.exec(e)){if("@"===u[2])r="mailto:"+(n=A(this.options.mangle?t(u[0]):u[0]));else{for(;i=u[0],u[0]=this.rules.inline._backpedal.exec(u[0])[0],i!==u[0];);n=A(u[0]),r="www."===u[1]?"http://"+u[0]:u[0]}return{type:"link",raw:u[0],text:n,href:r,tokens:[{type:"text",raw:n,text:n}]}}},t.inlineText=function(e,t){e=this.rules.inline.text.exec(e);if(e)return t=this.lexer.state.inRawBlock?this.options.sanitize?this.options.sanitizer?this.options.sanitizer(e[0]):A(e[0]):e[0]:A(this.options.smartypants?t(e[0]):e[0]),{type:"text",raw:e[0],text:t}},e}(),B={newline:/^(?: *(?:\n|$))+/,code:/^( {4}[^\n]+(?:\n(?: *(?:\n|$))*)?)+/,fences:/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,hr:/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,heading:/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,blockquote:/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/,list:/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/,html:"^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|\\n*|$)|\\n*|$)|?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n *)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$)|(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$))",def:/^ {0,3}\[(label)\]: *(?:\n *)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n *)?| *\n *)(title))? *(?:\n+|$)/,table:k,lheading:/^((?:.|\n(?!\n))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,_paragraph:/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,text:/^[^\n]+/,_label:/(?!\s*\])(?:\\.|[^\[\]\\])+/,_title:/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/},w=(B.def=p(B.def).replace("label",B._label).replace("title",B._title).getRegex(),B.bullet=/(?:[*+-]|\d{1,9}[.)])/,B.listItemStart=p(/^( *)(bull) */).replace("bull",B.bullet).getRegex(),B.list=p(B.list).replace(/bull/g,B.bullet).replace("hr","\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))").replace("def","\\n+(?="+B.def.source+")").getRegex(),B._tag="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|section|source|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",B._comment=/|$)/,B.html=p(B.html,"i").replace("comment",B._comment).replace("tag",B._tag).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),B.paragraph=p(B._paragraph).replace("hr",B.hr).replace("heading"," {0,3}#{1,6} ").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",B._tag).getRegex(),B.blockquote=p(B.blockquote).replace("paragraph",B.paragraph).getRegex(),B.normal=F({},B),B.gfm=F({},B.normal,{table:"^ *([^\\n ].*\\|.*)\\n {0,3}(?:\\| *)?(:?-+:? *(?:\\| *:?-+:? *)*)(?:\\| *)?(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)"}),B.gfm.table=p(B.gfm.table).replace("hr",B.hr).replace("heading"," {0,3}#{1,6} ").replace("blockquote"," {0,3}>").replace("code"," {4}[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",B._tag).getRegex(),B.gfm.paragraph=p(B._paragraph).replace("hr",B.hr).replace("heading"," {0,3}#{1,6} ").replace("|lheading","").replace("table",B.gfm.table).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",B._tag).getRegex(),B.pedantic=F({},B.normal,{html:p("^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?\\1> *(?:\\n{2,}|\\s*$)|\\s]*)*?/?> *(?:\\n{2,}|\\s*$))").replace("comment",B._comment).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:k,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:p(B.normal._paragraph).replace("hr",B.hr).replace("heading"," *#{1,6} *[^\n]").replace("lheading",B.lheading).replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").getRegex()}),{escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,autolink:/^<(scheme:[^\s\x00-\x1f<>]*|email)>/,url:k,tag:"^comment|^[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^|^",link:/^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/,reflink:/^!?\[(label)\]\[(ref)\]/,nolink:/^!?\[(ref)\](?:\[\])?/,reflinkSearch:"reflink|nolink(?!\\()",emStrong:{lDelim:/^(?:\*+(?:([punct_])|[^\s*]))|^_+(?:([punct*])|([^\s_]))/,rDelimAst:/^(?:[^_*\\]|\\.)*?\_\_(?:[^_*\\]|\\.)*?\*(?:[^_*\\]|\\.)*?(?=\_\_)|(?:[^*\\]|\\.)+(?=[^*])|[punct_](\*+)(?=[\s]|$)|(?:[^punct*_\s\\]|\\.)(\*+)(?=[punct_\s]|$)|[punct_\s](\*+)(?=[^punct*_\s])|[\s](\*+)(?=[punct_])|[punct_](\*+)(?=[punct_])|(?:[^punct*_\s\\]|\\.)(\*+)(?=[^punct*_\s])/,rDelimUnd:/^(?:[^_*\\]|\\.)*?\*\*(?:[^_*\\]|\\.)*?\_(?:[^_*\\]|\\.)*?(?=\*\*)|(?:[^_\\]|\\.)+(?=[^_])|[punct*](\_+)(?=[\s]|$)|(?:[^punct*_\s\\]|\\.)(\_+)(?=[punct*\s]|$)|[punct*\s](\_+)(?=[^punct*_\s])|[\s](\_+)(?=[punct*])|[punct*](\_+)(?=[punct*])/},code:/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,br:/^( {2,}|\\)\n(?!\s*$)/,del:k,text:/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\?@\\[\\]`^{|}~",w.punctuation=p(w.punctuation).replace(/punctuation/g,w._punctuation).getRegex(),w.blockSkip=/\[[^\]]*?\]\([^\)]*?\)|`[^`]*?`|<[^>]*?>/g,w.escapedEmSt=/(?:^|[^\\])(?:\\\\)*\\[*_]/g,w._comment=p(B._comment).replace("(?:--\x3e|$)","--\x3e").getRegex(),w.emStrong.lDelim=p(w.emStrong.lDelim).replace(/punct/g,w._punctuation).getRegex(),w.emStrong.rDelimAst=p(w.emStrong.rDelimAst,"g").replace(/punct/g,w._punctuation).getRegex(),w.emStrong.rDelimUnd=p(w.emStrong.rDelimUnd,"g").replace(/punct/g,w._punctuation).getRegex(),w._escapes=/\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g,w._scheme=/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/,w._email=/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/,w.autolink=p(w.autolink).replace("scheme",w._scheme).replace("email",w._email).getRegex(),w._attribute=/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/,w.tag=p(w.tag).replace("comment",w._comment).replace("attribute",w._attribute).getRegex(),w._label=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,w._href=/<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/,w._title=/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/,w.link=p(w.link).replace("label",w._label).replace("href",w._href).replace("title",w._title).getRegex(),w.reflink=p(w.reflink).replace("label",w._label).replace("ref",B._label).getRegex(),w.nolink=p(w.nolink).replace("ref",B._label).getRegex(),w.reflinkSearch=p(w.reflinkSearch,"g").replace("reflink",w.reflink).replace("nolink",w.nolink).getRegex(),w.normal=F({},w),w.pedantic=F({},w.normal,{strong:{start:/^__|\*\*/,middle:/^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/,endAst:/\*\*(?!\*)/g,endUnd:/__(?!_)/g},em:{start:/^_|\*/,middle:/^()\*(?=\S)([\s\S]*?\S)\*(?!\*)|^_(?=\S)([\s\S]*?\S)_(?!_)/,endAst:/\*(?!\*)/g,endUnd:/_(?!_)/g},link:p(/^!?\[(label)\]\((.*?)\)/).replace("label",w._label).getRegex(),reflink:p(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",w._label).getRegex()}),w.gfm=F({},w.normal,{escape:p(w.escape).replace("])","~|])").getRegex(),_extended_email:/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/,url:/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])([\s\S]*?[^\s~])\1(?=[^~]|$)/,text:/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\'+(u?e:A(e,!0))+"\n":""+(u?e:A(e,!0))+"
\n"},t.blockquote=function(e){return"\n"+e+"
\n"},t.html=function(e){return e},t.heading=function(e,t,u,n){return this.options.headerIds?"\n":""+e+"\n"},t.hr=function(){return this.options.xhtml?"
\n":"
\n"},t.list=function(e,t,u){var n=t?"ol":"ul";return"<"+n+(t&&1!==u?' start="'+u+'"':"")+">\n"+e+""+n+">\n"},t.listitem=function(e){return""+e+"\n"},t.checkbox=function(e){return" "},t.paragraph=function(e){return""+e+"
\n"},t.table=function(e,t){return"\n\n"+e+"\n"+(t=t&&""+t+"")+"
\n"},t.tablerow=function(e){return"\n"+e+"
\n"},t.tablecell=function(e,t){var u=t.header?"th":"td";return(t.align?"<"+u+' align="'+t.align+'">':"<"+u+">")+e+""+u+">\n"},t.strong=function(e){return""+e+""},t.em=function(e){return""+e+""},t.codespan=function(e){return""+e+""},t.br=function(){return this.options.xhtml?"
":"
"},t.del=function(e){return""+e+""},t.link=function(e,t,u){return null===(e=f(this.options.sanitize,this.options.baseUrl,e))?u:(e='"+u+"")},t.image=function(e,t,u){return null===(e=f(this.options.sanitize,this.options.baseUrl,e))?u:(e='
":">"))},t.text=function(e){return e},e}(),z=function(){function e(){}var t=e.prototype;return t.strong=function(e){return e},t.em=function(e){return e},t.codespan=function(e){return e},t.del=function(e){return e},t.html=function(e){return e},t.text=function(e){return e},t.link=function(e,t,u){return""+u},t.image=function(e,t,u){return""+u},t.br=function(){return""},e}(),$=function(){function e(){this.seen={}}var t=e.prototype;return t.serialize=function(e){return e.toLowerCase().trim().replace(/<[!\/a-z].*?>/gi,"").replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g,"").replace(/\s/g,"-")},t.getNextSafeSlug=function(e,t){var u=e,n=0;if(this.seen.hasOwnProperty(u))for(n=this.seen[e];u=e+"-"+ ++n,this.seen.hasOwnProperty(u););return t||(this.seen[e]=n,this.seen[u]=0),u},t.slug=function(e,t){void 0===t&&(t={});e=this.serialize(e);return this.getNextSafeSlug(e,t.dryrun)},e}(),S=function(){function u(e){this.options=e||r.defaults,this.options.renderer=this.options.renderer||new _,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new z,this.slugger=new $}u.parse=function(e,t){return new u(t).parse(e)},u.parseInline=function(e,t){return new u(t).parseInline(e)};var e=u.prototype;return e.parse=function(e,t){void 0===t&&(t=!0);for(var u,n,r,i,s,l,o,a,D,c,h,p,f,g,F,A,k="",d=e.length,C=0;C",i?Promise.resolve(t):s?void s(null,t):t;if(i)return Promise.reject(e);if(!s)throw e;s(e)});if(null==e)return l(new Error("marked(): input parameter is undefined or null"));if("string"!=typeof e)return l(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(e)+", string expected"));if((t=u)&&t.sanitize&&!t.silent&&console.warn("marked(): sanitize and sanitizer parameters are deprecated since version 0.7.0, should not be used and will be removed in the future. Read more here: https://marked.js.org/#/USING_ADVANCED.md#options"),u.hooks&&(u.hooks.options=u),n){var o,a=u.highlight;try{u.hooks&&(e=u.hooks.preprocess(e)),o=f(e,u)}catch(e){return l(e)}var D,c=function(t){var e;if(!t)try{u.walkTokens&&I.walkTokens(o,u.walkTokens),e=g(o,u),u.hooks&&(e=u.hooks.postprocess(e))}catch(e){t=e}return u.highlight=a,t?l(t):n(null,e)};return!a||a.length<3?c():(delete u.highlight,o.length?(D=0,I.walkTokens(o,function(u){"code"===u.type&&(D++,setTimeout(function(){a(u.text,u.lang,function(e,t){if(e)return c(e);null!=t&&t!==u.text&&(u.text=t,u.escaped=!0),0===--D&&c()})},0))}),void(0===D&&c())):c())}if(u.async)return Promise.resolve(u.hooks?u.hooks.preprocess(e):e).then(function(e){return f(e,u)}).then(function(e){return u.walkTokens?Promise.all(I.walkTokens(e,u.walkTokens)).then(function(){return e}):e}).then(function(e){return g(e,u)}).then(function(e){return u.hooks?u.hooks.postprocess(e):e}).catch(l);try{u.hooks&&(e=u.hooks.preprocess(e));var h=f(e,u),p=(u.walkTokens&&I.walkTokens(h,u.walkTokens),g(h,u));return p=u.hooks?u.hooks.postprocess(p):p}catch(e){return l(e)}}}function I(e,t,u){return R(v.lex,S.parse)(e,t,u)}T.passThroughHooks=new Set(["preprocess","postprocess"]),I.options=I.setOptions=function(e){return I.defaults=F({},I.defaults,e),e=I.defaults,r.defaults=e,I},I.getDefaults=e,I.defaults=r.defaults,I.use=function(){for(var D=I.defaults.extensions||{renderers:{},childTokens:{}},e=arguments.length,t=new Array(e),u=0;u{
8 | throw Error("map is read-only")}:e instanceof Set&&(e.add=e.clear=e.delete=()=>{
9 | throw Error("set is read-only")
10 | }),Object.freeze(e),Object.getOwnPropertyNames(e).forEach((t=>{var a=e[t]
11 | ;"object"!=typeof a||Object.isFrozen(a)||n(a)})),e}
12 | e.exports=n,e.exports.default=n;class t{constructor(e){
13 | void 0===e.data&&(e.data={}),this.data=e.data,this.isMatchIgnored=!1}
14 | ignoreMatch(){this.isMatchIgnored=!0}}function a(e){
15 | return e.replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'")
16 | }function i(e,...n){const t=Object.create(null);for(const n in e)t[n]=e[n]
17 | ;return n.forEach((e=>{for(const n in e)t[n]=e[n]})),t}
18 | const r=e=>!!e.scope||e.sublanguage&&e.language;class s{constructor(e,n){
19 | this.buffer="",this.classPrefix=n.classPrefix,e.walk(this)}addText(e){
20 | this.buffer+=a(e)}openNode(e){if(!r(e))return;let n=""
21 | ;n=e.sublanguage?"language-"+e.language:((e,{prefix:n})=>{if(e.includes(".")){
22 | const t=e.split(".")
23 | ;return[`${n}${t.shift()}`,...t.map(((e,n)=>`${e}${"_".repeat(n+1)}`))].join(" ")
24 | }return`${n}${e}`})(e.scope,{prefix:this.classPrefix}),this.span(n)}
25 | closeNode(e){r(e)&&(this.buffer+="")}value(){return this.buffer}span(e){
26 | this.buffer+=``}}const o=(e={})=>{const n={children:[]}
27 | ;return Object.assign(n,e),n};class l{constructor(){
28 | this.rootNode=o(),this.stack=[this.rootNode]}get top(){
29 | return this.stack[this.stack.length-1]}get root(){return this.rootNode}add(e){
30 | this.top.children.push(e)}openNode(e){const n=o({scope:e})
31 | ;this.add(n),this.stack.push(n)}closeNode(){
32 | if(this.stack.length>1)return this.stack.pop()}closeAllNodes(){
33 | for(;this.closeNode(););}toJSON(){return JSON.stringify(this.rootNode,null,4)}
34 | walk(e){return this.constructor._walk(e,this.rootNode)}static _walk(e,n){
35 | return"string"==typeof n?e.addText(n):n.children&&(e.openNode(n),
36 | n.children.forEach((n=>this._walk(e,n))),e.closeNode(n)),e}static _collapse(e){
37 | "string"!=typeof e&&e.children&&(e.children.every((e=>"string"==typeof e))?e.children=[e.children.join("")]:e.children.forEach((e=>{
38 | l._collapse(e)})))}}class c extends l{constructor(e){super(),this.options=e}
39 | addKeyword(e,n){""!==e&&(this.openNode(n),this.addText(e),this.closeNode())}
40 | addText(e){""!==e&&this.add(e)}addSublanguage(e,n){const t=e.root
41 | ;t.sublanguage=!0,t.language=n,this.add(t)}toHTML(){
42 | return new s(this,this.options).value()}finalize(){return!0}}function d(e){
43 | return e?"string"==typeof e?e:e.source:null}function g(e){return m("(?=",e,")")}
44 | function u(e){return m("(?:",e,")*")}function b(e){return m("(?:",e,")?")}
45 | function m(...e){return e.map((e=>d(e))).join("")}function p(...e){const n=(e=>{
46 | const n=e[e.length-1]
47 | ;return"object"==typeof n&&n.constructor===Object?(e.splice(e.length-1,1),n):{}
48 | })(e);return"("+(n.capture?"":"?:")+e.map((e=>d(e))).join("|")+")"}
49 | function _(e){return RegExp(e.toString()+"|").exec("").length-1}
50 | const h=/\[(?:[^\\\]]|\\.)*\]|\(\??|\\([1-9][0-9]*)|\\./
51 | ;function f(e,{joinWith:n}){let t=0;return e.map((e=>{t+=1;const n=t
52 | ;let a=d(e),i="";for(;a.length>0;){const e=h.exec(a);if(!e){i+=a;break}
53 | i+=a.substring(0,e.index),
54 | a=a.substring(e.index+e[0].length),"\\"===e[0][0]&&e[1]?i+="\\"+(Number(e[1])+n):(i+=e[0],
55 | "("===e[0]&&t++)}return i})).map((e=>`(${e})`)).join(n)}
56 | const E="[a-zA-Z]\\w*",y="[a-zA-Z_]\\w*",w="\\b\\d+(\\.\\d+)?",N="(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",v="\\b(0b[01]+)",O={
57 | begin:"\\\\[\\s\\S]",relevance:0},k={scope:"string",begin:"'",end:"'",
58 | illegal:"\\n",contains:[O]},x={scope:"string",begin:'"',end:'"',illegal:"\\n",
59 | contains:[O]},M=(e,n,t={})=>{const a=i({scope:"comment",begin:e,end:n,
60 | contains:[]},t);a.contains.push({scope:"doctag",
61 | begin:"[ ]*(?=(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):)",
62 | end:/(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):/,excludeBegin:!0,relevance:0})
63 | ;const r=p("I","a","is","so","us","to","at","if","in","it","on",/[A-Za-z]+['](d|ve|re|ll|t|s|n)/,/[A-Za-z]+[-][a-z]+/,/[A-Za-z][a-z]{2,}/)
64 | ;return a.contains.push({begin:m(/[ ]+/,"(",r,/[.]?[:]?([.][ ]|[ ])/,"){3}")}),a
65 | },S=M("//","$"),A=M("/\\*","\\*/"),C=M("#","$");var T=Object.freeze({
66 | __proto__:null,MATCH_NOTHING_RE:/\b\B/,IDENT_RE:E,UNDERSCORE_IDENT_RE:y,
67 | NUMBER_RE:w,C_NUMBER_RE:N,BINARY_NUMBER_RE:v,
68 | RE_STARTERS_RE:"!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~",
69 | SHEBANG:(e={})=>{const n=/^#![ ]*\//
70 | ;return e.binary&&(e.begin=m(n,/.*\b/,e.binary,/\b.*/)),i({scope:"meta",begin:n,
71 | end:/$/,relevance:0,"on:begin":(e,n)=>{0!==e.index&&n.ignoreMatch()}},e)},
72 | BACKSLASH_ESCAPE:O,APOS_STRING_MODE:k,QUOTE_STRING_MODE:x,PHRASAL_WORDS_MODE:{
73 | begin:/\b(a|an|the|are|I'm|isn't|don't|doesn't|won't|but|just|should|pretty|simply|enough|gonna|going|wtf|so|such|will|you|your|they|like|more)\b/
74 | },COMMENT:M,C_LINE_COMMENT_MODE:S,C_BLOCK_COMMENT_MODE:A,HASH_COMMENT_MODE:C,
75 | NUMBER_MODE:{scope:"number",begin:w,relevance:0},C_NUMBER_MODE:{scope:"number",
76 | begin:N,relevance:0},BINARY_NUMBER_MODE:{scope:"number",begin:v,relevance:0},
77 | REGEXP_MODE:{begin:/(?=\/[^/\n]*\/)/,contains:[{scope:"regexp",begin:/\//,
78 | end:/\/[gimuy]*/,illegal:/\n/,contains:[O,{begin:/\[/,end:/\]/,relevance:0,
79 | contains:[O]}]}]},TITLE_MODE:{scope:"title",begin:E,relevance:0},
80 | UNDERSCORE_TITLE_MODE:{scope:"title",begin:y,relevance:0},METHOD_GUARD:{
81 | begin:"\\.\\s*[a-zA-Z_]\\w*",relevance:0},END_SAME_AS_BEGIN:e=>Object.assign(e,{
82 | "on:begin":(e,n)=>{n.data._beginMatch=e[1]},"on:end":(e,n)=>{
83 | n.data._beginMatch!==e[1]&&n.ignoreMatch()}})});function R(e,n){
84 | "."===e.input[e.index-1]&&n.ignoreMatch()}function D(e,n){
85 | void 0!==e.className&&(e.scope=e.className,delete e.className)}function I(e,n){
86 | n&&e.beginKeywords&&(e.begin="\\b("+e.beginKeywords.split(" ").join("|")+")(?!\\.)(?=\\b|\\s)",
87 | e.__beforeBegin=R,e.keywords=e.keywords||e.beginKeywords,delete e.beginKeywords,
88 | void 0===e.relevance&&(e.relevance=0))}function L(e,n){
89 | Array.isArray(e.illegal)&&(e.illegal=p(...e.illegal))}function B(e,n){
90 | if(e.match){
91 | if(e.begin||e.end)throw Error("begin & end are not supported with match")
92 | ;e.begin=e.match,delete e.match}}function $(e,n){
93 | void 0===e.relevance&&(e.relevance=1)}const z=(e,n)=>{if(!e.beforeMatch)return
94 | ;if(e.starts)throw Error("beforeMatch cannot be used with starts")
95 | ;const t=Object.assign({},e);Object.keys(e).forEach((n=>{delete e[n]
96 | })),e.keywords=t.keywords,e.begin=m(t.beforeMatch,g(t.begin)),e.starts={
97 | relevance:0,contains:[Object.assign(t,{endsParent:!0})]
98 | },e.relevance=0,delete t.beforeMatch
99 | },F=["of","and","for","in","not","or","if","then","parent","list","value"]
100 | ;function U(e,n,t="keyword"){const a=Object.create(null)
101 | ;return"string"==typeof e?i(t,e.split(" ")):Array.isArray(e)?i(t,e):Object.keys(e).forEach((t=>{
102 | Object.assign(a,U(e[t],n,t))})),a;function i(e,t){
103 | n&&(t=t.map((e=>e.toLowerCase()))),t.forEach((n=>{const t=n.split("|")
104 | ;a[t[0]]=[e,j(t[0],t[1])]}))}}function j(e,n){
105 | return n?Number(n):(e=>F.includes(e.toLowerCase()))(e)?0:1}const P={},K=e=>{
106 | console.error(e)},H=(e,...n)=>{console.log("WARN: "+e,...n)},q=(e,n)=>{
107 | P[`${e}/${n}`]||(console.log(`Deprecated as of ${e}. ${n}`),P[`${e}/${n}`]=!0)
108 | },Z=Error();function G(e,n,{key:t}){let a=0;const i=e[t],r={},s={}
109 | ;for(let e=1;e<=n.length;e++)s[e+a]=i[e],r[e+a]=!0,a+=_(n[e-1])
110 | ;e[t]=s,e[t]._emit=r,e[t]._multi=!0}function W(e){(e=>{
111 | e.scope&&"object"==typeof e.scope&&null!==e.scope&&(e.beginScope=e.scope,
112 | delete e.scope)})(e),"string"==typeof e.beginScope&&(e.beginScope={
113 | _wrap:e.beginScope}),"string"==typeof e.endScope&&(e.endScope={_wrap:e.endScope
114 | }),(e=>{if(Array.isArray(e.begin)){
115 | if(e.skip||e.excludeBegin||e.returnBegin)throw K("skip, excludeBegin, returnBegin not compatible with beginScope: {}"),
116 | Z
117 | ;if("object"!=typeof e.beginScope||null===e.beginScope)throw K("beginScope must be object"),
118 | Z;G(e,e.begin,{key:"beginScope"}),e.begin=f(e.begin,{joinWith:""})}})(e),(e=>{
119 | if(Array.isArray(e.end)){
120 | if(e.skip||e.excludeEnd||e.returnEnd)throw K("skip, excludeEnd, returnEnd not compatible with endScope: {}"),
121 | Z
122 | ;if("object"!=typeof e.endScope||null===e.endScope)throw K("endScope must be object"),
123 | Z;G(e,e.end,{key:"endScope"}),e.end=f(e.end,{joinWith:""})}})(e)}function Q(e){
124 | function n(n,t){
125 | return RegExp(d(n),"m"+(e.case_insensitive?"i":"")+(e.unicodeRegex?"u":"")+(t?"g":""))
126 | }class t{constructor(){
127 | this.matchIndexes={},this.regexes=[],this.matchAt=1,this.position=0}
128 | addRule(e,n){
129 | n.position=this.position++,this.matchIndexes[this.matchAt]=n,this.regexes.push([n,e]),
130 | this.matchAt+=_(e)+1}compile(){0===this.regexes.length&&(this.exec=()=>null)
131 | ;const e=this.regexes.map((e=>e[1]));this.matcherRe=n(f(e,{joinWith:"|"
132 | }),!0),this.lastIndex=0}exec(e){this.matcherRe.lastIndex=this.lastIndex
133 | ;const n=this.matcherRe.exec(e);if(!n)return null
134 | ;const t=n.findIndex(((e,n)=>n>0&&void 0!==e)),a=this.matchIndexes[t]
135 | ;return n.splice(0,t),Object.assign(n,a)}}class a{constructor(){
136 | this.rules=[],this.multiRegexes=[],
137 | this.count=0,this.lastIndex=0,this.regexIndex=0}getMatcher(e){
138 | if(this.multiRegexes[e])return this.multiRegexes[e];const n=new t
139 | ;return this.rules.slice(e).forEach((([e,t])=>n.addRule(e,t))),
140 | n.compile(),this.multiRegexes[e]=n,n}resumingScanAtSamePosition(){
141 | return 0!==this.regexIndex}considerAll(){this.regexIndex=0}addRule(e,n){
142 | this.rules.push([e,n]),"begin"===n.type&&this.count++}exec(e){
143 | const n=this.getMatcher(this.regexIndex);n.lastIndex=this.lastIndex
144 | ;let t=n.exec(e)
145 | ;if(this.resumingScanAtSamePosition())if(t&&t.index===this.lastIndex);else{
146 | const n=this.getMatcher(0);n.lastIndex=this.lastIndex+1,t=n.exec(e)}
147 | return t&&(this.regexIndex+=t.position+1,
148 | this.regexIndex===this.count&&this.considerAll()),t}}
149 | if(e.compilerExtensions||(e.compilerExtensions=[]),
150 | e.contains&&e.contains.includes("self"))throw Error("ERR: contains `self` is not supported at the top-level of a language. See documentation.")
151 | ;return e.classNameAliases=i(e.classNameAliases||{}),function t(r,s){const o=r
152 | ;if(r.isCompiled)return o
153 | ;[D,B,W,z].forEach((e=>e(r,s))),e.compilerExtensions.forEach((e=>e(r,s))),
154 | r.__beforeBegin=null,[I,L,$].forEach((e=>e(r,s))),r.isCompiled=!0;let l=null
155 | ;return"object"==typeof r.keywords&&r.keywords.$pattern&&(r.keywords=Object.assign({},r.keywords),
156 | l=r.keywords.$pattern,
157 | delete r.keywords.$pattern),l=l||/\w+/,r.keywords&&(r.keywords=U(r.keywords,e.case_insensitive)),
158 | o.keywordPatternRe=n(l,!0),
159 | s&&(r.begin||(r.begin=/\B|\b/),o.beginRe=n(o.begin),r.end||r.endsWithParent||(r.end=/\B|\b/),
160 | r.end&&(o.endRe=n(o.end)),
161 | o.terminatorEnd=d(o.end)||"",r.endsWithParent&&s.terminatorEnd&&(o.terminatorEnd+=(r.end?"|":"")+s.terminatorEnd)),
162 | r.illegal&&(o.illegalRe=n(r.illegal)),
163 | r.contains||(r.contains=[]),r.contains=[].concat(...r.contains.map((e=>(e=>(e.variants&&!e.cachedVariants&&(e.cachedVariants=e.variants.map((n=>i(e,{
164 | variants:null},n)))),e.cachedVariants?e.cachedVariants:X(e)?i(e,{
165 | starts:e.starts?i(e.starts):null
166 | }):Object.isFrozen(e)?i(e):e))("self"===e?r:e)))),r.contains.forEach((e=>{t(e,o)
167 | })),r.starts&&t(r.starts,s),o.matcher=(e=>{const n=new a
168 | ;return e.contains.forEach((e=>n.addRule(e.begin,{rule:e,type:"begin"
169 | }))),e.terminatorEnd&&n.addRule(e.terminatorEnd,{type:"end"
170 | }),e.illegal&&n.addRule(e.illegal,{type:"illegal"}),n})(o),o}(e)}function X(e){
171 | return!!e&&(e.endsWithParent||X(e.starts))}class V extends Error{
172 | constructor(e,n){super(e),this.name="HTMLInjectionError",this.html=n}}
173 | const J=a,Y=i,ee=Symbol("nomatch");var ne=(n=>{
174 | const a=Object.create(null),i=Object.create(null),r=[];let s=!0
175 | ;const o="Could not find the language '{}', did you forget to load/include a language module?",l={
176 | disableAutodetect:!0,name:"Plain text",contains:[]};let d={
177 | ignoreUnescapedHTML:!1,throwUnescapedHTML:!1,noHighlightRe:/^(no-?highlight)$/i,
178 | languageDetectRe:/\blang(?:uage)?-([\w-]+)\b/i,classPrefix:"hljs-",
179 | cssSelector:"pre code",languages:null,__emitter:c};function _(e){
180 | return d.noHighlightRe.test(e)}function h(e,n,t){let a="",i=""
181 | ;"object"==typeof n?(a=e,
182 | t=n.ignoreIllegals,i=n.language):(q("10.7.0","highlight(lang, code, ...args) has been deprecated."),
183 | q("10.7.0","Please use highlight(code, options) instead.\nhttps://github.com/highlightjs/highlight.js/issues/2277"),
184 | i=e,a=n),void 0===t&&(t=!0);const r={code:a,language:i};x("before:highlight",r)
185 | ;const s=r.result?r.result:f(r.language,r.code,t)
186 | ;return s.code=r.code,x("after:highlight",s),s}function f(e,n,i,r){
187 | const l=Object.create(null);function c(){if(!k.keywords)return void M.addText(S)
188 | ;let e=0;k.keywordPatternRe.lastIndex=0;let n=k.keywordPatternRe.exec(S),t=""
189 | ;for(;n;){t+=S.substring(e,n.index)
190 | ;const i=w.case_insensitive?n[0].toLowerCase():n[0],r=(a=i,k.keywords[a]);if(r){
191 | const[e,a]=r
192 | ;if(M.addText(t),t="",l[i]=(l[i]||0)+1,l[i]<=7&&(A+=a),e.startsWith("_"))t+=n[0];else{
193 | const t=w.classNameAliases[e]||e;M.addKeyword(n[0],t)}}else t+=n[0]
194 | ;e=k.keywordPatternRe.lastIndex,n=k.keywordPatternRe.exec(S)}var a
195 | ;t+=S.substring(e),M.addText(t)}function g(){null!=k.subLanguage?(()=>{
196 | if(""===S)return;let e=null;if("string"==typeof k.subLanguage){
197 | if(!a[k.subLanguage])return void M.addText(S)
198 | ;e=f(k.subLanguage,S,!0,x[k.subLanguage]),x[k.subLanguage]=e._top
199 | }else e=E(S,k.subLanguage.length?k.subLanguage:null)
200 | ;k.relevance>0&&(A+=e.relevance),M.addSublanguage(e._emitter,e.language)
201 | })():c(),S=""}function u(e,n){let t=1;const a=n.length-1;for(;t<=a;){
202 | if(!e._emit[t]){t++;continue}const a=w.classNameAliases[e[t]]||e[t],i=n[t]
203 | ;a?M.addKeyword(i,a):(S=i,c(),S=""),t++}}function b(e,n){
204 | return e.scope&&"string"==typeof e.scope&&M.openNode(w.classNameAliases[e.scope]||e.scope),
205 | e.beginScope&&(e.beginScope._wrap?(M.addKeyword(S,w.classNameAliases[e.beginScope._wrap]||e.beginScope._wrap),
206 | S=""):e.beginScope._multi&&(u(e.beginScope,n),S="")),k=Object.create(e,{parent:{
207 | value:k}}),k}function m(e,n,a){let i=((e,n)=>{const t=e&&e.exec(n)
208 | ;return t&&0===t.index})(e.endRe,a);if(i){if(e["on:end"]){const a=new t(e)
209 | ;e["on:end"](n,a),a.isMatchIgnored&&(i=!1)}if(i){
210 | for(;e.endsParent&&e.parent;)e=e.parent;return e}}
211 | if(e.endsWithParent)return m(e.parent,n,a)}function p(e){
212 | return 0===k.matcher.regexIndex?(S+=e[0],1):(R=!0,0)}function _(e){
213 | const t=e[0],a=n.substring(e.index),i=m(k,e,a);if(!i)return ee;const r=k
214 | ;k.endScope&&k.endScope._wrap?(g(),
215 | M.addKeyword(t,k.endScope._wrap)):k.endScope&&k.endScope._multi?(g(),
216 | u(k.endScope,e)):r.skip?S+=t:(r.returnEnd||r.excludeEnd||(S+=t),
217 | g(),r.excludeEnd&&(S=t));do{
218 | k.scope&&M.closeNode(),k.skip||k.subLanguage||(A+=k.relevance),k=k.parent
219 | }while(k!==i.parent);return i.starts&&b(i.starts,e),r.returnEnd?0:t.length}
220 | let h={};function y(a,r){const o=r&&r[0];if(S+=a,null==o)return g(),0
221 | ;if("begin"===h.type&&"end"===r.type&&h.index===r.index&&""===o){
222 | if(S+=n.slice(r.index,r.index+1),!s){const n=Error(`0 width match regex (${e})`)
223 | ;throw n.languageName=e,n.badRule=h.rule,n}return 1}
224 | if(h=r,"begin"===r.type)return(e=>{
225 | const n=e[0],a=e.rule,i=new t(a),r=[a.__beforeBegin,a["on:begin"]]
226 | ;for(const t of r)if(t&&(t(e,i),i.isMatchIgnored))return p(n)
227 | ;return a.skip?S+=n:(a.excludeBegin&&(S+=n),
228 | g(),a.returnBegin||a.excludeBegin||(S=n)),b(a,e),a.returnBegin?0:n.length})(r)
229 | ;if("illegal"===r.type&&!i){
230 | const e=Error('Illegal lexeme "'+o+'" for mode "'+(k.scope||"")+'"')
231 | ;throw e.mode=k,e}if("end"===r.type){const e=_(r);if(e!==ee)return e}
232 | if("illegal"===r.type&&""===o)return 1
233 | ;if(T>1e5&&T>3*r.index)throw Error("potential infinite loop, way more iterations than matches")
234 | ;return S+=o,o.length}const w=v(e)
235 | ;if(!w)throw K(o.replace("{}",e)),Error('Unknown language: "'+e+'"')
236 | ;const N=Q(w);let O="",k=r||N;const x={},M=new d.__emitter(d);(()=>{const e=[]
237 | ;for(let n=k;n!==w;n=n.parent)n.scope&&e.unshift(n.scope)
238 | ;e.forEach((e=>M.openNode(e)))})();let S="",A=0,C=0,T=0,R=!1;try{
239 | for(k.matcher.considerAll();;){
240 | T++,R?R=!1:k.matcher.considerAll(),k.matcher.lastIndex=C
241 | ;const e=k.matcher.exec(n);if(!e)break;const t=y(n.substring(C,e.index),e)
242 | ;C=e.index+t}
243 | return y(n.substring(C)),M.closeAllNodes(),M.finalize(),O=M.toHTML(),{
244 | language:e,value:O,relevance:A,illegal:!1,_emitter:M,_top:k}}catch(t){
245 | if(t.message&&t.message.includes("Illegal"))return{language:e,value:J(n),
246 | illegal:!0,relevance:0,_illegalBy:{message:t.message,index:C,
247 | context:n.slice(C-100,C+100),mode:t.mode,resultSoFar:O},_emitter:M};if(s)return{
248 | language:e,value:J(n),illegal:!1,relevance:0,errorRaised:t,_emitter:M,_top:k}
249 | ;throw t}}function E(e,n){n=n||d.languages||Object.keys(a);const t=(e=>{
250 | const n={value:J(e),illegal:!1,relevance:0,_top:l,_emitter:new d.__emitter(d)}
251 | ;return n._emitter.addText(e),n})(e),i=n.filter(v).filter(k).map((n=>f(n,e,!1)))
252 | ;i.unshift(t);const r=i.sort(((e,n)=>{
253 | if(e.relevance!==n.relevance)return n.relevance-e.relevance
254 | ;if(e.language&&n.language){if(v(e.language).supersetOf===n.language)return 1
255 | ;if(v(n.language).supersetOf===e.language)return-1}return 0})),[s,o]=r,c=s
256 | ;return c.secondBest=o,c}function y(e){let n=null;const t=(e=>{
257 | let n=e.className+" ";n+=e.parentNode?e.parentNode.className:""
258 | ;const t=d.languageDetectRe.exec(n);if(t){const n=v(t[1])
259 | ;return n||(H(o.replace("{}",t[1])),
260 | H("Falling back to no-highlight mode for this block.",e)),n?t[1]:"no-highlight"}
261 | return n.split(/\s+/).find((e=>_(e)||v(e)))})(e);if(_(t))return
262 | ;if(x("before:highlightElement",{el:e,language:t
263 | }),e.children.length>0&&(d.ignoreUnescapedHTML||(console.warn("One of your code blocks includes unescaped HTML. This is a potentially serious security risk."),
264 | console.warn("https://github.com/highlightjs/highlight.js/wiki/security"),
265 | console.warn("The element with unescaped HTML:"),
266 | console.warn(e)),d.throwUnescapedHTML))throw new V("One of your code blocks includes unescaped HTML.",e.innerHTML)
267 | ;n=e;const a=n.textContent,r=t?h(a,{language:t,ignoreIllegals:!0}):E(a)
268 | ;e.innerHTML=r.value,((e,n,t)=>{const a=n&&i[n]||t
269 | ;e.classList.add("hljs"),e.classList.add("language-"+a)
270 | })(e,t,r.language),e.result={language:r.language,re:r.relevance,
271 | relevance:r.relevance},r.secondBest&&(e.secondBest={
272 | language:r.secondBest.language,relevance:r.secondBest.relevance
273 | }),x("after:highlightElement",{el:e,result:r,text:a})}let w=!1;function N(){
274 | "loading"!==document.readyState?document.querySelectorAll(d.cssSelector).forEach(y):w=!0
275 | }function v(e){return e=(e||"").toLowerCase(),a[e]||a[i[e]]}
276 | function O(e,{languageName:n}){"string"==typeof e&&(e=[e]),e.forEach((e=>{
277 | i[e.toLowerCase()]=n}))}function k(e){const n=v(e)
278 | ;return n&&!n.disableAutodetect}function x(e,n){const t=e;r.forEach((e=>{
279 | e[t]&&e[t](n)}))}
280 | "undefined"!=typeof window&&window.addEventListener&&window.addEventListener("DOMContentLoaded",(()=>{
281 | w&&N()}),!1),Object.assign(n,{highlight:h,highlightAuto:E,highlightAll:N,
282 | highlightElement:y,
283 | highlightBlock:e=>(q("10.7.0","highlightBlock will be removed entirely in v12.0"),
284 | q("10.7.0","Please use highlightElement now."),y(e)),configure:e=>{d=Y(d,e)},
285 | initHighlighting:()=>{
286 | N(),q("10.6.0","initHighlighting() deprecated. Use highlightAll() now.")},
287 | initHighlightingOnLoad:()=>{
288 | N(),q("10.6.0","initHighlightingOnLoad() deprecated. Use highlightAll() now.")
289 | },registerLanguage:(e,t)=>{let i=null;try{i=t(n)}catch(n){
290 | if(K("Language definition for '{}' could not be registered.".replace("{}",e)),
291 | !s)throw n;K(n),i=l}
292 | i.name||(i.name=e),a[e]=i,i.rawDefinition=t.bind(null,n),i.aliases&&O(i.aliases,{
293 | languageName:e})},unregisterLanguage:e=>{delete a[e]
294 | ;for(const n of Object.keys(i))i[n]===e&&delete i[n]},
295 | listLanguages:()=>Object.keys(a),getLanguage:v,registerAliases:O,
296 | autoDetection:k,inherit:Y,addPlugin:e=>{(e=>{
297 | e["before:highlightBlock"]&&!e["before:highlightElement"]&&(e["before:highlightElement"]=n=>{
298 | e["before:highlightBlock"](Object.assign({block:n.el},n))
299 | }),e["after:highlightBlock"]&&!e["after:highlightElement"]&&(e["after:highlightElement"]=n=>{
300 | e["after:highlightBlock"](Object.assign({block:n.el},n))})})(e),r.push(e)}
301 | }),n.debugMode=()=>{s=!1},n.safeMode=()=>{s=!0
302 | },n.versionString="11.6.0",n.regex={concat:m,lookahead:g,either:p,optional:b,
303 | anyNumberOfTimes:u};for(const n in T)"object"==typeof T[n]&&e.exports(T[n])
304 | ;return Object.assign(n,T),n})({});const te=e=>({IMPORTANT:{scope:"meta",
305 | begin:"!important"},BLOCK_COMMENT:e.C_BLOCK_COMMENT_MODE,HEXCOLOR:{
306 | scope:"number",begin:/#(([0-9a-fA-F]{3,4})|(([0-9a-fA-F]{2}){3,4}))\b/},
307 | FUNCTION_DISPATCH:{className:"built_in",begin:/[\w-]+(?=\()/},
308 | ATTRIBUTE_SELECTOR_MODE:{scope:"selector-attr",begin:/\[/,end:/\]/,illegal:"$",
309 | contains:[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]},CSS_NUMBER_MODE:{
310 | scope:"number",
311 | begin:e.NUMBER_RE+"(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?",
312 | relevance:0},CSS_VARIABLE:{className:"attr",begin:/--[A-Za-z][A-Za-z0-9_-]*/}
313 | }),ae=["a","abbr","address","article","aside","audio","b","blockquote","body","button","canvas","caption","cite","code","dd","del","details","dfn","div","dl","dt","em","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","html","i","iframe","img","input","ins","kbd","label","legend","li","main","mark","menu","nav","object","ol","p","q","quote","samp","section","span","strong","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","ul","var","video"],ie=["any-hover","any-pointer","aspect-ratio","color","color-gamut","color-index","device-aspect-ratio","device-height","device-width","display-mode","forced-colors","grid","height","hover","inverted-colors","monochrome","orientation","overflow-block","overflow-inline","pointer","prefers-color-scheme","prefers-contrast","prefers-reduced-motion","prefers-reduced-transparency","resolution","scan","scripting","update","width","min-width","max-width","min-height","max-height"],re=["active","any-link","blank","checked","current","default","defined","dir","disabled","drop","empty","enabled","first","first-child","first-of-type","fullscreen","future","focus","focus-visible","focus-within","has","host","host-context","hover","indeterminate","in-range","invalid","is","lang","last-child","last-of-type","left","link","local-link","not","nth-child","nth-col","nth-last-child","nth-last-col","nth-last-of-type","nth-of-type","only-child","only-of-type","optional","out-of-range","past","placeholder-shown","read-only","read-write","required","right","root","scope","target","target-within","user-invalid","valid","visited","where"],se=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"],oe=["align-content","align-items","align-self","all","animation","animation-delay","animation-direction","animation-duration","animation-fill-mode","animation-iteration-count","animation-name","animation-play-state","animation-timing-function","backface-visibility","background","background-attachment","background-blend-mode","background-clip","background-color","background-image","background-origin","background-position","background-repeat","background-size","block-size","border","border-block","border-block-color","border-block-end","border-block-end-color","border-block-end-style","border-block-end-width","border-block-start","border-block-start-color","border-block-start-style","border-block-start-width","border-block-style","border-block-width","border-bottom","border-bottom-color","border-bottom-left-radius","border-bottom-right-radius","border-bottom-style","border-bottom-width","border-collapse","border-color","border-image","border-image-outset","border-image-repeat","border-image-slice","border-image-source","border-image-width","border-inline","border-inline-color","border-inline-end","border-inline-end-color","border-inline-end-style","border-inline-end-width","border-inline-start","border-inline-start-color","border-inline-start-style","border-inline-start-width","border-inline-style","border-inline-width","border-left","border-left-color","border-left-style","border-left-width","border-radius","border-right","border-right-color","border-right-style","border-right-width","border-spacing","border-style","border-top","border-top-color","border-top-left-radius","border-top-right-radius","border-top-style","border-top-width","border-width","bottom","box-decoration-break","box-shadow","box-sizing","break-after","break-before","break-inside","caption-side","caret-color","clear","clip","clip-path","clip-rule","color","column-count","column-fill","column-gap","column-rule","column-rule-color","column-rule-style","column-rule-width","column-span","column-width","columns","contain","content","content-visibility","counter-increment","counter-reset","cue","cue-after","cue-before","cursor","direction","display","empty-cells","filter","flex","flex-basis","flex-direction","flex-flow","flex-grow","flex-shrink","flex-wrap","float","flow","font","font-display","font-family","font-feature-settings","font-kerning","font-language-override","font-size","font-size-adjust","font-smoothing","font-stretch","font-style","font-synthesis","font-variant","font-variant-caps","font-variant-east-asian","font-variant-ligatures","font-variant-numeric","font-variant-position","font-variation-settings","font-weight","gap","glyph-orientation-vertical","grid","grid-area","grid-auto-columns","grid-auto-flow","grid-auto-rows","grid-column","grid-column-end","grid-column-start","grid-gap","grid-row","grid-row-end","grid-row-start","grid-template","grid-template-areas","grid-template-columns","grid-template-rows","hanging-punctuation","height","hyphens","icon","image-orientation","image-rendering","image-resolution","ime-mode","inline-size","isolation","justify-content","left","letter-spacing","line-break","line-height","list-style","list-style-image","list-style-position","list-style-type","margin","margin-block","margin-block-end","margin-block-start","margin-bottom","margin-inline","margin-inline-end","margin-inline-start","margin-left","margin-right","margin-top","marks","mask","mask-border","mask-border-mode","mask-border-outset","mask-border-repeat","mask-border-slice","mask-border-source","mask-border-width","mask-clip","mask-composite","mask-image","mask-mode","mask-origin","mask-position","mask-repeat","mask-size","mask-type","max-block-size","max-height","max-inline-size","max-width","min-block-size","min-height","min-inline-size","min-width","mix-blend-mode","nav-down","nav-index","nav-left","nav-right","nav-up","none","normal","object-fit","object-position","opacity","order","orphans","outline","outline-color","outline-offset","outline-style","outline-width","overflow","overflow-wrap","overflow-x","overflow-y","padding","padding-block","padding-block-end","padding-block-start","padding-bottom","padding-inline","padding-inline-end","padding-inline-start","padding-left","padding-right","padding-top","page-break-after","page-break-before","page-break-inside","pause","pause-after","pause-before","perspective","perspective-origin","pointer-events","position","quotes","resize","rest","rest-after","rest-before","right","row-gap","scroll-margin","scroll-margin-block","scroll-margin-block-end","scroll-margin-block-start","scroll-margin-bottom","scroll-margin-inline","scroll-margin-inline-end","scroll-margin-inline-start","scroll-margin-left","scroll-margin-right","scroll-margin-top","scroll-padding","scroll-padding-block","scroll-padding-block-end","scroll-padding-block-start","scroll-padding-bottom","scroll-padding-inline","scroll-padding-inline-end","scroll-padding-inline-start","scroll-padding-left","scroll-padding-right","scroll-padding-top","scroll-snap-align","scroll-snap-stop","scroll-snap-type","scrollbar-color","scrollbar-gutter","scrollbar-width","shape-image-threshold","shape-margin","shape-outside","speak","speak-as","src","tab-size","table-layout","text-align","text-align-all","text-align-last","text-combine-upright","text-decoration","text-decoration-color","text-decoration-line","text-decoration-style","text-emphasis","text-emphasis-color","text-emphasis-position","text-emphasis-style","text-indent","text-justify","text-orientation","text-overflow","text-rendering","text-shadow","text-transform","text-underline-position","top","transform","transform-box","transform-origin","transform-style","transition","transition-delay","transition-duration","transition-property","transition-timing-function","unicode-bidi","vertical-align","visibility","voice-balance","voice-duration","voice-family","voice-pitch","voice-range","voice-rate","voice-stress","voice-volume","white-space","widows","width","will-change","word-break","word-spacing","word-wrap","writing-mode","z-index"].reverse(),le=re.concat(se)
314 | ;var ce="\\.([0-9](_*[0-9])*)",de="[0-9a-fA-F](_*[0-9a-fA-F])*",ge={
315 | className:"number",variants:[{
316 | begin:`(\\b([0-9](_*[0-9])*)((${ce})|\\.)?|(${ce}))[eE][+-]?([0-9](_*[0-9])*)[fFdD]?\\b`
317 | },{begin:`\\b([0-9](_*[0-9])*)((${ce})[fFdD]?\\b|\\.([fFdD]\\b)?)`},{
318 | begin:`(${ce})[fFdD]?\\b`},{begin:"\\b([0-9](_*[0-9])*)[fFdD]\\b"},{
319 | begin:`\\b0[xX]((${de})\\.?|(${de})?\\.(${de}))[pP][+-]?([0-9](_*[0-9])*)[fFdD]?\\b`
320 | },{begin:"\\b(0|[1-9](_*[0-9])*)[lL]?\\b"},{begin:`\\b0[xX](${de})[lL]?\\b`},{
321 | begin:"\\b0(_*[0-7])*[lL]?\\b"},{begin:"\\b0[bB][01](_*[01])*[lL]?\\b"}],
322 | relevance:0};function ue(e,n,t){return-1===t?"":e.replace(n,(a=>ue(e,n,t-1)))}
323 | const be="[A-Za-z$_][0-9A-Za-z$_]*",me=["as","in","of","if","for","while","finally","var","new","function","do","return","void","else","break","catch","instanceof","with","throw","case","default","try","switch","continue","typeof","delete","let","yield","const","class","debugger","async","await","static","import","from","export","extends"],pe=["true","false","null","undefined","NaN","Infinity"],_e=["Object","Function","Boolean","Symbol","Math","Date","Number","BigInt","String","RegExp","Array","Float32Array","Float64Array","Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Int32Array","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array","Set","Map","WeakSet","WeakMap","ArrayBuffer","SharedArrayBuffer","Atomics","DataView","JSON","Promise","Generator","GeneratorFunction","AsyncFunction","Reflect","Proxy","Intl","WebAssembly"],he=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],fe=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],Ee=["arguments","this","super","console","window","document","localStorage","module","global"],ye=[].concat(fe,_e,he)
324 | ;function we(e){const n=e.regex,t=be,a={begin:/<[A-Za-z0-9\\._:-]+/,
325 | end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(e,n)=>{
326 | const t=e[0].length+e.index,a=e.input[t]
327 | ;if("<"===a||","===a)return void n.ignoreMatch();let i
328 | ;">"===a&&(((e,{after:n})=>{const t=""+e[0].slice(1)
329 | ;return-1!==e.input.indexOf(t,n)})(e,{after:t
330 | })||n.ignoreMatch()),(i=e.input.substring(t).match(/^\s+extends\s+/))&&0===i.index&&n.ignoreMatch()
331 | }},i={$pattern:be,keyword:me,literal:pe,built_in:ye,"variable.language":Ee
332 | },r="\\.([0-9](_?[0-9])*)",s="0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",o={
333 | className:"number",variants:[{
334 | begin:`(\\b(${s})((${r})|\\.)?|(${r}))[eE][+-]?([0-9](_?[0-9])*)\\b`},{
335 | begin:`\\b(${s})\\b((${r})\\b|\\.)?|(${r})\\b`},{
336 | begin:"\\b(0|[1-9](_?[0-9])*)n\\b"},{
337 | begin:"\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*n?\\b"},{
338 | begin:"\\b0[bB][0-1](_?[0-1])*n?\\b"},{begin:"\\b0[oO][0-7](_?[0-7])*n?\\b"},{
339 | begin:"\\b0[0-7]+n?\\b"}],relevance:0},l={className:"subst",begin:"\\$\\{",
340 | end:"\\}",keywords:i,contains:[]},c={begin:"html`",end:"",starts:{end:"`",
341 | returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,l],subLanguage:"xml"}},d={
342 | begin:"css`",end:"",starts:{end:"`",returnEnd:!1,
343 | contains:[e.BACKSLASH_ESCAPE,l],subLanguage:"css"}},g={className:"string",
344 | begin:"`",end:"`",contains:[e.BACKSLASH_ESCAPE,l]},u={className:"comment",
345 | variants:[e.COMMENT(/\/\*\*(?!\/)/,"\\*/",{relevance:0,contains:[{
346 | begin:"(?=@[A-Za-z]+)",relevance:0,contains:[{className:"doctag",
347 | begin:"@[A-Za-z]+"},{className:"type",begin:"\\{",end:"\\}",excludeEnd:!0,
348 | excludeBegin:!0,relevance:0},{className:"variable",begin:t+"(?=\\s*(-)|$)",
349 | endsParent:!0,relevance:0},{begin:/(?=[^\n])\s/,relevance:0}]}]
350 | }),e.C_BLOCK_COMMENT_MODE,e.C_LINE_COMMENT_MODE]
351 | },b=[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,c,d,g,o];l.contains=b.concat({
352 | begin:/\{/,end:/\}/,keywords:i,contains:["self"].concat(b)})
353 | ;const m=[].concat(u,l.contains),p=m.concat([{begin:/\(/,end:/\)/,keywords:i,
354 | contains:["self"].concat(m)}]),_={className:"params",begin:/\(/,end:/\)/,
355 | excludeBegin:!0,excludeEnd:!0,keywords:i,contains:p},h={variants:[{
356 | match:[/class/,/\s+/,t,/\s+/,/extends/,/\s+/,n.concat(t,"(",n.concat(/\./,t),")*")],
357 | scope:{1:"keyword",3:"title.class",5:"keyword",7:"title.class.inherited"}},{
358 | match:[/class/,/\s+/,t],scope:{1:"keyword",3:"title.class"}}]},f={relevance:0,
359 | match:n.either(/\bJSON/,/\b[A-Z][a-z]+([A-Z][a-z]*|\d)*/,/\b[A-Z]{2,}([A-Z][a-z]+|\d)+([A-Z][a-z]*)*/,/\b[A-Z]{2,}[a-z]+([A-Z][a-z]+|\d)*([A-Z][a-z]*)*/),
360 | className:"title.class",keywords:{_:[..._e,...he]}},E={variants:[{
361 | match:[/function/,/\s+/,t,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],
362 | className:{1:"keyword",3:"title.function"},label:"func.def",contains:[_],
363 | illegal:/%/},y={
364 | match:n.concat(/\b/,(w=[...fe,"super"],n.concat("(?!",w.join("|"),")")),t,n.lookahead(/\(/)),
365 | className:"title.function",relevance:0};var w;const N={
366 | begin:n.concat(/\./,n.lookahead(n.concat(t,/(?![0-9A-Za-z$_(])/))),end:t,
367 | excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},v={
368 | match:[/get|set/,/\s+/,t,/(?=\()/],className:{1:"keyword",3:"title.function"},
369 | contains:[{begin:/\(\)/},_]
370 | },O="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+e.UNDERSCORE_IDENT_RE+")\\s*=>",k={
371 | match:[/const|var|let/,/\s+/,t,/\s*/,/=\s*/,/(async\s*)?/,n.lookahead(O)],
372 | keywords:"async",className:{1:"keyword",3:"title.function"},contains:[_]}
373 | ;return{name:"Javascript",aliases:["js","jsx","mjs","cjs"],keywords:i,exports:{
374 | PARAMS_CONTAINS:p,CLASS_REFERENCE:f},illegal:/#(?![$_A-z])/,
375 | contains:[e.SHEBANG({label:"shebang",binary:"node",relevance:5}),{
376 | label:"use_strict",className:"meta",relevance:10,
377 | begin:/^\s*['"]use (strict|asm)['"]/
378 | },e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,c,d,g,u,o,f,{className:"attr",
379 | begin:t+n.lookahead(":"),relevance:0},k,{
380 | begin:"("+e.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",
381 | keywords:"return throw case",relevance:0,contains:[u,e.REGEXP_MODE,{
382 | className:"function",begin:O,returnBegin:!0,end:"\\s*=>",contains:[{
383 | className:"params",variants:[{begin:e.UNDERSCORE_IDENT_RE,relevance:0},{
384 | className:null,begin:/\(\s*\)/,skip:!0},{begin:/\(/,end:/\)/,excludeBegin:!0,
385 | excludeEnd:!0,keywords:i,contains:p}]}]},{begin:/,/,relevance:0},{match:/\s+/,
386 | relevance:0},{variants:[{begin:"<>",end:">"},{
387 | match:/<[A-Za-z0-9\\._:-]+\s*\/>/},{begin:a.begin,
388 | "on:begin":a.isTrulyOpeningTag,end:a.end}],subLanguage:"xml",contains:[{
389 | begin:a.begin,end:a.end,skip:!0,contains:["self"]}]}]},E,{
390 | beginKeywords:"while if switch catch for"},{
391 | begin:"\\b(?!function)"+e.UNDERSCORE_IDENT_RE+"\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{",
392 | returnBegin:!0,label:"func.def",contains:[_,e.inherit(e.TITLE_MODE,{begin:t,
393 | className:"title.function"})]},{match:/\.\.\./,relevance:0},N,{match:"\\$"+t,
394 | relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},
395 | contains:[_]},y,{relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,
396 | className:"variable.constant"},h,v,{match:/\$[(.]/}]}}
397 | const Ne=e=>m(/\b/,e,/\w$/.test(e)?/\b/:/\B/),ve=["Protocol","Type"].map(Ne),Oe=["init","self"].map(Ne),ke=["Any","Self"],xe=["actor","any","associatedtype","async","await",/as\?/,/as!/,"as","break","case","catch","class","continue","convenience","default","defer","deinit","didSet","distributed","do","dynamic","else","enum","extension","fallthrough",/fileprivate\(set\)/,"fileprivate","final","for","func","get","guard","if","import","indirect","infix",/init\?/,/init!/,"inout",/internal\(set\)/,"internal","in","is","isolated","nonisolated","lazy","let","mutating","nonmutating",/open\(set\)/,"open","operator","optional","override","postfix","precedencegroup","prefix",/private\(set\)/,"private","protocol",/public\(set\)/,"public","repeat","required","rethrows","return","set","some","static","struct","subscript","super","switch","throws","throw",/try\?/,/try!/,"try","typealias",/unowned\(safe\)/,/unowned\(unsafe\)/,"unowned","var","weak","where","while","willSet"],Me=["false","nil","true"],Se=["assignment","associativity","higherThan","left","lowerThan","none","right"],Ae=["#colorLiteral","#column","#dsohandle","#else","#elseif","#endif","#error","#file","#fileID","#fileLiteral","#filePath","#function","#if","#imageLiteral","#keyPath","#line","#selector","#sourceLocation","#warn_unqualified_access","#warning"],Ce=["abs","all","any","assert","assertionFailure","debugPrint","dump","fatalError","getVaList","isKnownUniquelyReferenced","max","min","numericCast","pointwiseMax","pointwiseMin","precondition","preconditionFailure","print","readLine","repeatElement","sequence","stride","swap","swift_unboxFromSwiftValueWithType","transcode","type","unsafeBitCast","unsafeDowncast","withExtendedLifetime","withUnsafeMutablePointer","withUnsafePointer","withVaList","withoutActuallyEscaping","zip"],Te=p(/[/=\-+!*%<>&|^~?]/,/[\u00A1-\u00A7]/,/[\u00A9\u00AB]/,/[\u00AC\u00AE]/,/[\u00B0\u00B1]/,/[\u00B6\u00BB\u00BF\u00D7\u00F7]/,/[\u2016-\u2017]/,/[\u2020-\u2027]/,/[\u2030-\u203E]/,/[\u2041-\u2053]/,/[\u2055-\u205E]/,/[\u2190-\u23FF]/,/[\u2500-\u2775]/,/[\u2794-\u2BFF]/,/[\u2E00-\u2E7F]/,/[\u3001-\u3003]/,/[\u3008-\u3020]/,/[\u3030]/),Re=p(Te,/[\u0300-\u036F]/,/[\u1DC0-\u1DFF]/,/[\u20D0-\u20FF]/,/[\uFE00-\uFE0F]/,/[\uFE20-\uFE2F]/),De=m(Te,Re,"*"),Ie=p(/[a-zA-Z_]/,/[\u00A8\u00AA\u00AD\u00AF\u00B2-\u00B5\u00B7-\u00BA]/,/[\u00BC-\u00BE\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u00FF]/,/[\u0100-\u02FF\u0370-\u167F\u1681-\u180D\u180F-\u1DBF]/,/[\u1E00-\u1FFF]/,/[\u200B-\u200D\u202A-\u202E\u203F-\u2040\u2054\u2060-\u206F]/,/[\u2070-\u20CF\u2100-\u218F\u2460-\u24FF\u2776-\u2793]/,/[\u2C00-\u2DFF\u2E80-\u2FFF]/,/[\u3004-\u3007\u3021-\u302F\u3031-\u303F\u3040-\uD7FF]/,/[\uF900-\uFD3D\uFD40-\uFDCF\uFDF0-\uFE1F\uFE30-\uFE44]/,/[\uFE47-\uFEFE\uFF00-\uFFFD]/),Le=p(Ie,/\d/,/[\u0300-\u036F\u1DC0-\u1DFF\u20D0-\u20FF\uFE20-\uFE2F]/),Be=m(Ie,Le,"*"),$e=m(/[A-Z]/,Le,"*"),ze=["autoclosure",m(/convention\(/,p("swift","block","c"),/\)/),"discardableResult","dynamicCallable","dynamicMemberLookup","escaping","frozen","GKInspectable","IBAction","IBDesignable","IBInspectable","IBOutlet","IBSegueAction","inlinable","main","nonobjc","NSApplicationMain","NSCopying","NSManaged",m(/objc\(/,Be,/\)/),"objc","objcMembers","propertyWrapper","requires_stored_property_inits","resultBuilder","testable","UIApplicationMain","unknown","usableFromInline"],Fe=["iOS","iOSApplicationExtension","macOS","macOSApplicationExtension","macCatalyst","macCatalystApplicationExtension","watchOS","watchOSApplicationExtension","tvOS","tvOSApplicationExtension","swift"]
398 | ;var Ue=Object.freeze({__proto__:null,grmr_bash:e=>{const n=e.regex,t={},a={
399 | begin:/\$\{/,end:/\}/,contains:["self",{begin:/:-/,contains:[t]}]}
400 | ;Object.assign(t,{className:"variable",variants:[{
401 | begin:n.concat(/\$[\w\d#@][\w\d_]*/,"(?![\\w\\d])(?![$])")},a]});const i={
402 | className:"subst",begin:/\$\(/,end:/\)/,contains:[e.BACKSLASH_ESCAPE]},r={
403 | begin:/<<-?\s*(?=\w+)/,starts:{contains:[e.END_SAME_AS_BEGIN({begin:/(\w+)/,
404 | end:/(\w+)/,className:"string"})]}},s={className:"string",begin:/"/,end:/"/,
405 | contains:[e.BACKSLASH_ESCAPE,t,i]};i.contains.push(s);const o={begin:/\$\(\(/,
406 | end:/\)\)/,contains:[{begin:/\d+#[0-9a-f]+/,className:"number"},e.NUMBER_MODE,t]
407 | },l=e.SHEBANG({binary:"(fish|bash|zsh|sh|csh|ksh|tcsh|dash|scsh)",relevance:10
408 | }),c={className:"function",begin:/\w[\w\d_]*\s*\(\s*\)\s*\{/,returnBegin:!0,
409 | contains:[e.inherit(e.TITLE_MODE,{begin:/\w[\w\d_]*/})],relevance:0};return{
410 | name:"Bash",aliases:["sh"],keywords:{$pattern:/\b[a-z][a-z0-9._-]+\b/,
411 | keyword:["if","then","else","elif","fi","for","while","in","do","done","case","esac","function"],
412 | literal:["true","false"],
413 | built_in:["break","cd","continue","eval","exec","exit","export","getopts","hash","pwd","readonly","return","shift","test","times","trap","umask","unset","alias","bind","builtin","caller","command","declare","echo","enable","help","let","local","logout","mapfile","printf","read","readarray","source","type","typeset","ulimit","unalias","set","shopt","autoload","bg","bindkey","bye","cap","chdir","clone","comparguments","compcall","compctl","compdescribe","compfiles","compgroups","compquote","comptags","comptry","compvalues","dirs","disable","disown","echotc","echoti","emulate","fc","fg","float","functions","getcap","getln","history","integer","jobs","kill","limit","log","noglob","popd","print","pushd","pushln","rehash","sched","setcap","setopt","stat","suspend","ttyctl","unfunction","unhash","unlimit","unsetopt","vared","wait","whence","where","which","zcompile","zformat","zftp","zle","zmodload","zparseopts","zprof","zpty","zregexparse","zsocket","zstyle","ztcp","chcon","chgrp","chown","chmod","cp","dd","df","dir","dircolors","ln","ls","mkdir","mkfifo","mknod","mktemp","mv","realpath","rm","rmdir","shred","sync","touch","truncate","vdir","b2sum","base32","base64","cat","cksum","comm","csplit","cut","expand","fmt","fold","head","join","md5sum","nl","numfmt","od","paste","ptx","pr","sha1sum","sha224sum","sha256sum","sha384sum","sha512sum","shuf","sort","split","sum","tac","tail","tr","tsort","unexpand","uniq","wc","arch","basename","chroot","date","dirname","du","echo","env","expr","factor","groups","hostid","id","link","logname","nice","nohup","nproc","pathchk","pinky","printenv","printf","pwd","readlink","runcon","seq","sleep","stat","stdbuf","stty","tee","test","timeout","tty","uname","unlink","uptime","users","who","whoami","yes"]
414 | },contains:[l,e.SHEBANG(),c,o,e.HASH_COMMENT_MODE,r,{match:/(\/[a-z._-]+)+/},s,{
415 | className:"",begin:/\\"/},{className:"string",begin:/'/,end:/'/},t]}},
416 | grmr_c:e=>{const n=e.regex,t=e.COMMENT("//","$",{contains:[{begin:/\\\n/}]
417 | }),a="[a-zA-Z_]\\w*::",i="(decltype\\(auto\\)|"+n.optional(a)+"[a-zA-Z_]\\w*"+n.optional("<[^<>]+>")+")",r={
418 | className:"type",variants:[{begin:"\\b[a-z\\d_]*_t\\b"},{
419 | match:/\batomic_[a-z]{3,6}\b/}]},s={className:"string",variants:[{
420 | begin:'(u8?|U|L)?"',end:'"',illegal:"\\n",contains:[e.BACKSLASH_ESCAPE]},{
421 | begin:"(u8?|U|L)?'(\\\\(x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4,8}|[0-7]{3}|\\S)|.)",
422 | end:"'",illegal:"."},e.END_SAME_AS_BEGIN({
423 | begin:/(?:u8?|U|L)?R"([^()\\ ]{0,16})\(/,end:/\)([^()\\ ]{0,16})"/})]},o={
424 | className:"number",variants:[{begin:"\\b(0b[01']+)"},{
425 | begin:"(-?)\\b([\\d']+(\\.[\\d']*)?|\\.[\\d']+)((ll|LL|l|L)(u|U)?|(u|U)(ll|LL|l|L)?|f|F|b|B)"
426 | },{
427 | begin:"(-?)(\\b0[xX][a-fA-F0-9']+|(\\b[\\d']+(\\.[\\d']*)?|\\.[\\d']+)([eE][-+]?[\\d']+)?)"
428 | }],relevance:0},l={className:"meta",begin:/#\s*[a-z]+\b/,end:/$/,keywords:{
429 | keyword:"if else elif endif define undef warning error line pragma _Pragma ifdef ifndef include"
430 | },contains:[{begin:/\\\n/,relevance:0},e.inherit(s,{className:"string"}),{
431 | className:"string",begin:/<.*?>/},t,e.C_BLOCK_COMMENT_MODE]},c={
432 | className:"title",begin:n.optional(a)+e.IDENT_RE,relevance:0
433 | },d=n.optional(a)+e.IDENT_RE+"\\s*\\(",g={
434 | keyword:["asm","auto","break","case","continue","default","do","else","enum","extern","for","fortran","goto","if","inline","register","restrict","return","sizeof","struct","switch","typedef","union","volatile","while","_Alignas","_Alignof","_Atomic","_Generic","_Noreturn","_Static_assert","_Thread_local","alignas","alignof","noreturn","static_assert","thread_local","_Pragma"],
435 | type:["float","double","signed","unsigned","int","short","long","char","void","_Bool","_Complex","_Imaginary","_Decimal32","_Decimal64","_Decimal128","const","static","complex","bool","imaginary"],
436 | literal:"true false NULL",
437 | built_in:"std string wstring cin cout cerr clog stdin stdout stderr stringstream istringstream ostringstream auto_ptr deque list queue stack vector map set pair bitset multiset multimap unordered_set unordered_map unordered_multiset unordered_multimap priority_queue make_pair array shared_ptr abort terminate abs acos asin atan2 atan calloc ceil cosh cos exit exp fabs floor fmod fprintf fputs free frexp fscanf future isalnum isalpha iscntrl isdigit isgraph islower isprint ispunct isspace isupper isxdigit tolower toupper labs ldexp log10 log malloc realloc memchr memcmp memcpy memset modf pow printf putchar puts scanf sinh sin snprintf sprintf sqrt sscanf strcat strchr strcmp strcpy strcspn strlen strncat strncmp strncpy strpbrk strrchr strspn strstr tanh tan vfprintf vprintf vsprintf endl initializer_list unique_ptr"
438 | },u=[l,r,t,e.C_BLOCK_COMMENT_MODE,o,s],b={variants:[{begin:/=/,end:/;/},{
439 | begin:/\(/,end:/\)/},{beginKeywords:"new throw return else",end:/;/}],
440 | keywords:g,contains:u.concat([{begin:/\(/,end:/\)/,keywords:g,
441 | contains:u.concat(["self"]),relevance:0}]),relevance:0},m={
442 | begin:"("+i+"[\\*&\\s]+)+"+d,returnBegin:!0,end:/[{;=]/,excludeEnd:!0,
443 | keywords:g,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:"decltype\\(auto\\)",
444 | keywords:g,relevance:0},{begin:d,returnBegin:!0,contains:[e.inherit(c,{
445 | className:"title.function"})],relevance:0},{relevance:0,match:/,/},{
446 | className:"params",begin:/\(/,end:/\)/,keywords:g,relevance:0,
447 | contains:[t,e.C_BLOCK_COMMENT_MODE,s,o,r,{begin:/\(/,end:/\)/,keywords:g,
448 | relevance:0,contains:["self",t,e.C_BLOCK_COMMENT_MODE,s,o,r]}]
449 | },r,t,e.C_BLOCK_COMMENT_MODE,l]};return{name:"C",aliases:["h"],keywords:g,
450 | disableAutodetect:!0,illegal:"",contains:[].concat(b,m,u,[l,{
451 | begin:e.IDENT_RE+"::",keywords:g},{className:"class",
452 | beginKeywords:"enum class struct union",end:/[{;:<>=]/,contains:[{
453 | beginKeywords:"final class struct"},e.TITLE_MODE]}]),exports:{preprocessor:l,
454 | strings:s,keywords:g}}},grmr_cpp:e=>{const n=e.regex,t=e.COMMENT("//","$",{
455 | contains:[{begin:/\\\n/}]
456 | }),a="[a-zA-Z_]\\w*::",i="(?!struct)(decltype\\(auto\\)|"+n.optional(a)+"[a-zA-Z_]\\w*"+n.optional("<[^<>]+>")+")",r={
457 | className:"type",begin:"\\b[a-z\\d_]*_t\\b"},s={className:"string",variants:[{
458 | begin:'(u8?|U|L)?"',end:'"',illegal:"\\n",contains:[e.BACKSLASH_ESCAPE]},{
459 | begin:"(u8?|U|L)?'(\\\\(x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4,8}|[0-7]{3}|\\S)|.)",
460 | end:"'",illegal:"."},e.END_SAME_AS_BEGIN({
461 | begin:/(?:u8?|U|L)?R"([^()\\ ]{0,16})\(/,end:/\)([^()\\ ]{0,16})"/})]},o={
462 | className:"number",variants:[{begin:"\\b(0b[01']+)"},{
463 | begin:"(-?)\\b([\\d']+(\\.[\\d']*)?|\\.[\\d']+)((ll|LL|l|L)(u|U)?|(u|U)(ll|LL|l|L)?|f|F|b|B)"
464 | },{
465 | begin:"(-?)(\\b0[xX][a-fA-F0-9']+|(\\b[\\d']+(\\.[\\d']*)?|\\.[\\d']+)([eE][-+]?[\\d']+)?)"
466 | }],relevance:0},l={className:"meta",begin:/#\s*[a-z]+\b/,end:/$/,keywords:{
467 | keyword:"if else elif endif define undef warning error line pragma _Pragma ifdef ifndef include"
468 | },contains:[{begin:/\\\n/,relevance:0},e.inherit(s,{className:"string"}),{
469 | className:"string",begin:/<.*?>/},t,e.C_BLOCK_COMMENT_MODE]},c={
470 | className:"title",begin:n.optional(a)+e.IDENT_RE,relevance:0
471 | },d=n.optional(a)+e.IDENT_RE+"\\s*\\(",g={
472 | type:["bool","char","char16_t","char32_t","char8_t","double","float","int","long","short","void","wchar_t","unsigned","signed","const","static"],
473 | keyword:["alignas","alignof","and","and_eq","asm","atomic_cancel","atomic_commit","atomic_noexcept","auto","bitand","bitor","break","case","catch","class","co_await","co_return","co_yield","compl","concept","const_cast|10","consteval","constexpr","constinit","continue","decltype","default","delete","do","dynamic_cast|10","else","enum","explicit","export","extern","false","final","for","friend","goto","if","import","inline","module","mutable","namespace","new","noexcept","not","not_eq","nullptr","operator","or","or_eq","override","private","protected","public","reflexpr","register","reinterpret_cast|10","requires","return","sizeof","static_assert","static_cast|10","struct","switch","synchronized","template","this","thread_local","throw","transaction_safe","transaction_safe_dynamic","true","try","typedef","typeid","typename","union","using","virtual","volatile","while","xor","xor_eq"],
474 | literal:["NULL","false","nullopt","nullptr","true"],built_in:["_Pragma"],
475 | _type_hints:["any","auto_ptr","barrier","binary_semaphore","bitset","complex","condition_variable","condition_variable_any","counting_semaphore","deque","false_type","future","imaginary","initializer_list","istringstream","jthread","latch","lock_guard","multimap","multiset","mutex","optional","ostringstream","packaged_task","pair","promise","priority_queue","queue","recursive_mutex","recursive_timed_mutex","scoped_lock","set","shared_future","shared_lock","shared_mutex","shared_timed_mutex","shared_ptr","stack","string_view","stringstream","timed_mutex","thread","true_type","tuple","unique_lock","unique_ptr","unordered_map","unordered_multimap","unordered_multiset","unordered_set","variant","vector","weak_ptr","wstring","wstring_view"]
476 | },u={className:"function.dispatch",relevance:0,keywords:{
477 | _hint:["abort","abs","acos","apply","as_const","asin","atan","atan2","calloc","ceil","cerr","cin","clog","cos","cosh","cout","declval","endl","exchange","exit","exp","fabs","floor","fmod","forward","fprintf","fputs","free","frexp","fscanf","future","invoke","isalnum","isalpha","iscntrl","isdigit","isgraph","islower","isprint","ispunct","isspace","isupper","isxdigit","labs","launder","ldexp","log","log10","make_pair","make_shared","make_shared_for_overwrite","make_tuple","make_unique","malloc","memchr","memcmp","memcpy","memset","modf","move","pow","printf","putchar","puts","realloc","scanf","sin","sinh","snprintf","sprintf","sqrt","sscanf","std","stderr","stdin","stdout","strcat","strchr","strcmp","strcpy","strcspn","strlen","strncat","strncmp","strncpy","strpbrk","strrchr","strspn","strstr","swap","tan","tanh","terminate","to_underlying","tolower","toupper","vfprintf","visit","vprintf","vsprintf"]
478 | },
479 | begin:n.concat(/\b/,/(?!decltype)/,/(?!if)/,/(?!for)/,/(?!switch)/,/(?!while)/,e.IDENT_RE,n.lookahead(/(<[^<>]+>|)\s*\(/))
480 | },b=[u,l,r,t,e.C_BLOCK_COMMENT_MODE,o,s],m={variants:[{begin:/=/,end:/;/},{
481 | begin:/\(/,end:/\)/},{beginKeywords:"new throw return else",end:/;/}],
482 | keywords:g,contains:b.concat([{begin:/\(/,end:/\)/,keywords:g,
483 | contains:b.concat(["self"]),relevance:0}]),relevance:0},p={className:"function",
484 | begin:"("+i+"[\\*&\\s]+)+"+d,returnBegin:!0,end:/[{;=]/,excludeEnd:!0,
485 | keywords:g,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:"decltype\\(auto\\)",
486 | keywords:g,relevance:0},{begin:d,returnBegin:!0,contains:[c],relevance:0},{
487 | begin:/::/,relevance:0},{begin:/:/,endsWithParent:!0,contains:[s,o]},{
488 | relevance:0,match:/,/},{className:"params",begin:/\(/,end:/\)/,keywords:g,
489 | relevance:0,contains:[t,e.C_BLOCK_COMMENT_MODE,s,o,r,{begin:/\(/,end:/\)/,
490 | keywords:g,relevance:0,contains:["self",t,e.C_BLOCK_COMMENT_MODE,s,o,r]}]
491 | },r,t,e.C_BLOCK_COMMENT_MODE,l]};return{name:"C++",
492 | aliases:["cc","c++","h++","hpp","hh","hxx","cxx"],keywords:g,illegal:"",
493 | classNameAliases:{"function.dispatch":"built_in"},
494 | contains:[].concat(m,p,u,b,[l,{
495 | begin:"\\b(deque|list|queue|priority_queue|pair|stack|vector|map|set|bitset|multiset|multimap|unordered_map|unordered_set|unordered_multiset|unordered_multimap|array|tuple|optional|variant|function)\\s*<(?!<)",
496 | end:">",keywords:g,contains:["self",r]},{begin:e.IDENT_RE+"::",keywords:g},{
497 | match:[/\b(?:enum(?:\s+(?:class|struct))?|class|struct|union)/,/\s+/,/\w+/],
498 | className:{1:"keyword",3:"title.class"}}])}},grmr_csharp:e=>{const n={
499 | keyword:["abstract","as","base","break","case","catch","class","const","continue","do","else","event","explicit","extern","finally","fixed","for","foreach","goto","if","implicit","in","interface","internal","is","lock","namespace","new","operator","out","override","params","private","protected","public","readonly","record","ref","return","scoped","sealed","sizeof","stackalloc","static","struct","switch","this","throw","try","typeof","unchecked","unsafe","using","virtual","void","volatile","while"].concat(["add","alias","and","ascending","async","await","by","descending","equals","from","get","global","group","init","into","join","let","nameof","not","notnull","on","or","orderby","partial","remove","select","set","unmanaged","value|0","var","when","where","with","yield"]),
500 | built_in:["bool","byte","char","decimal","delegate","double","dynamic","enum","float","int","long","nint","nuint","object","sbyte","short","string","ulong","uint","ushort"],
501 | literal:["default","false","null","true"]},t=e.inherit(e.TITLE_MODE,{
502 | begin:"[a-zA-Z](\\.?\\w)*"}),a={className:"number",variants:[{
503 | begin:"\\b(0b[01']+)"},{
504 | begin:"(-?)\\b([\\d']+(\\.[\\d']*)?|\\.[\\d']+)(u|U|l|L|ul|UL|f|F|b|B)"},{
505 | begin:"(-?)(\\b0[xX][a-fA-F0-9']+|(\\b[\\d']+(\\.[\\d']*)?|\\.[\\d']+)([eE][-+]?[\\d']+)?)"
506 | }],relevance:0},i={className:"string",begin:'@"',end:'"',contains:[{begin:'""'}]
507 | },r=e.inherit(i,{illegal:/\n/}),s={className:"subst",begin:/\{/,end:/\}/,
508 | keywords:n},o=e.inherit(s,{illegal:/\n/}),l={className:"string",begin:/\$"/,
509 | end:'"',illegal:/\n/,contains:[{begin:/\{\{/},{begin:/\}\}/
510 | },e.BACKSLASH_ESCAPE,o]},c={className:"string",begin:/\$@"/,end:'"',contains:[{
511 | begin:/\{\{/},{begin:/\}\}/},{begin:'""'},s]},d=e.inherit(c,{illegal:/\n/,
512 | contains:[{begin:/\{\{/},{begin:/\}\}/},{begin:'""'},o]})
513 | ;s.contains=[c,l,i,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,a,e.C_BLOCK_COMMENT_MODE],
514 | o.contains=[d,l,r,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,a,e.inherit(e.C_BLOCK_COMMENT_MODE,{
515 | illegal:/\n/})];const g={variants:[c,l,i,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]
516 | },u={begin:"<",end:">",contains:[{beginKeywords:"in out"},t]
517 | },b=e.IDENT_RE+"(<"+e.IDENT_RE+"(\\s*,\\s*"+e.IDENT_RE+")*>)?(\\[\\])?",m={
518 | begin:"@"+e.IDENT_RE,relevance:0};return{name:"C#",aliases:["cs","c#"],
519 | keywords:n,illegal:/::/,contains:[e.COMMENT("///","$",{returnBegin:!0,
520 | contains:[{className:"doctag",variants:[{begin:"///",relevance:0},{
521 | begin:"\x3c!--|--\x3e"},{begin:"?",end:">"}]}]
522 | }),e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,{className:"meta",begin:"#",
523 | end:"$",keywords:{
524 | keyword:"if else elif endif define undef warning error line region endregion pragma checksum"
525 | }},g,a,{beginKeywords:"class interface",relevance:0,end:/[{;=]/,
526 | illegal:/[^\s:,]/,contains:[{beginKeywords:"where class"
527 | },t,u,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},{beginKeywords:"namespace",
528 | relevance:0,end:/[{;=]/,illegal:/[^\s:]/,
529 | contains:[t,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},{
530 | beginKeywords:"record",relevance:0,end:/[{;=]/,illegal:/[^\s:]/,
531 | contains:[t,u,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},{className:"meta",
532 | begin:"^\\s*\\[(?=[\\w])",excludeBegin:!0,end:"\\]",excludeEnd:!0,contains:[{
533 | className:"string",begin:/"/,end:/"/}]},{
534 | beginKeywords:"new return throw await else",relevance:0},{className:"function",
535 | begin:"("+b+"\\s+)+"+e.IDENT_RE+"\\s*(<[^=]+>\\s*)?\\(",returnBegin:!0,
536 | end:/\s*[{;=]/,excludeEnd:!0,keywords:n,contains:[{
537 | beginKeywords:"public private protected static internal protected abstract async extern override unsafe virtual new sealed partial",
538 | relevance:0},{begin:e.IDENT_RE+"\\s*(<[^=]+>\\s*)?\\(",returnBegin:!0,
539 | contains:[e.TITLE_MODE,u],relevance:0},{match:/\(\)/},{className:"params",
540 | begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:n,relevance:0,
541 | contains:[g,a,e.C_BLOCK_COMMENT_MODE]
542 | },e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},m]}},grmr_css:e=>{
543 | const n=e.regex,t=te(e),a=[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE];return{
544 | name:"CSS",case_insensitive:!0,illegal:/[=|'\$]/,keywords:{
545 | keyframePosition:"from to"},classNameAliases:{keyframePosition:"selector-tag"},
546 | contains:[t.BLOCK_COMMENT,{begin:/-(webkit|moz|ms|o)-(?=[a-z])/
547 | },t.CSS_NUMBER_MODE,{className:"selector-id",begin:/#[A-Za-z0-9_-]+/,relevance:0
548 | },{className:"selector-class",begin:"\\.[a-zA-Z-][a-zA-Z0-9_-]*",relevance:0
549 | },t.ATTRIBUTE_SELECTOR_MODE,{className:"selector-pseudo",variants:[{
550 | begin:":("+re.join("|")+")"},{begin:":(:)?("+se.join("|")+")"}]
551 | },t.CSS_VARIABLE,{className:"attribute",begin:"\\b("+oe.join("|")+")\\b"},{
552 | begin:/:/,end:/[;}{]/,
553 | contains:[t.BLOCK_COMMENT,t.HEXCOLOR,t.IMPORTANT,t.CSS_NUMBER_MODE,...a,{
554 | begin:/(url|data-uri)\(/,end:/\)/,relevance:0,keywords:{built_in:"url data-uri"
555 | },contains:[...a,{className:"string",begin:/[^)]/,endsWithParent:!0,
556 | excludeEnd:!0}]},t.FUNCTION_DISPATCH]},{begin:n.lookahead(/@/),end:"[{;]",
557 | relevance:0,illegal:/:/,contains:[{className:"keyword",begin:/@-?\w[\w]*(-\w+)*/
558 | },{begin:/\s/,endsWithParent:!0,excludeEnd:!0,relevance:0,keywords:{
559 | $pattern:/[a-z-]+/,keyword:"and or not only",attribute:ie.join(" ")},contains:[{
560 | begin:/[a-z-]+(?=:)/,className:"attribute"},...a,t.CSS_NUMBER_MODE]}]},{
561 | className:"selector-tag",begin:"\\b("+ae.join("|")+")\\b"}]}},grmr_diff:e=>{
562 | const n=e.regex;return{name:"Diff",aliases:["patch"],contains:[{
563 | className:"meta",relevance:10,
564 | match:n.either(/^@@ +-\d+,\d+ +\+\d+,\d+ +@@/,/^\*\*\* +\d+,\d+ +\*\*\*\*$/,/^--- +\d+,\d+ +----$/)
565 | },{className:"comment",variants:[{
566 | begin:n.either(/Index: /,/^index/,/={3,}/,/^-{3}/,/^\*{3} /,/^\+{3}/,/^diff --git/),
567 | end:/$/},{match:/^\*{15}$/}]},{className:"addition",begin:/^\+/,end:/$/},{
568 | className:"deletion",begin:/^-/,end:/$/},{className:"addition",begin:/^!/,
569 | end:/$/}]}},grmr_go:e=>{const n={
570 | keyword:["break","case","chan","const","continue","default","defer","else","fallthrough","for","func","go","goto","if","import","interface","map","package","range","return","select","struct","switch","type","var"],
571 | type:["bool","byte","complex64","complex128","error","float32","float64","int8","int16","int32","int64","string","uint8","uint16","uint32","uint64","int","uint","uintptr","rune"],
572 | literal:["true","false","iota","nil"],
573 | built_in:["append","cap","close","complex","copy","imag","len","make","new","panic","print","println","real","recover","delete"]
574 | };return{name:"Go",aliases:["golang"],keywords:n,illegal:"",
575 | contains:[e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,{className:"string",
576 | variants:[e.QUOTE_STRING_MODE,e.APOS_STRING_MODE,{begin:"`",end:"`"}]},{
577 | className:"number",variants:[{begin:e.C_NUMBER_RE+"[i]",relevance:1
578 | },e.C_NUMBER_MODE]},{begin:/:=/},{className:"function",beginKeywords:"func",
579 | end:"\\s*(\\{|$)",excludeEnd:!0,contains:[e.TITLE_MODE,{className:"params",
580 | begin:/\(/,end:/\)/,endsParent:!0,keywords:n,illegal:/["']/}]}]}},
581 | grmr_graphql:e=>{const n=e.regex;return{name:"GraphQL",aliases:["gql"],
582 | case_insensitive:!0,disableAutodetect:!1,keywords:{
583 | keyword:["query","mutation","subscription","type","input","schema","directive","interface","union","scalar","fragment","enum","on"],
584 | literal:["true","false","null"]},
585 | contains:[e.HASH_COMMENT_MODE,e.QUOTE_STRING_MODE,e.NUMBER_MODE,{
586 | scope:"punctuation",match:/[.]{3}/,relevance:0},{scope:"punctuation",
587 | begin:/[\!\(\)\:\=\[\]\{\|\}]{1}/,relevance:0},{scope:"variable",begin:/\$/,
588 | end:/\W/,excludeEnd:!0,relevance:0},{scope:"meta",match:/@\w+/,excludeEnd:!0},{
589 | scope:"symbol",begin:n.concat(/[_A-Za-z][_0-9A-Za-z]*/,n.lookahead(/\s*:/)),
590 | relevance:0}],illegal:[/[;<']/,/BEGIN/]}},grmr_ini:e=>{const n=e.regex,t={
591 | className:"number",relevance:0,variants:[{begin:/([+-]+)?[\d]+_[\d_]+/},{
592 | begin:e.NUMBER_RE}]},a=e.COMMENT();a.variants=[{begin:/;/,end:/$/},{begin:/#/,
593 | end:/$/}];const i={className:"variable",variants:[{begin:/\$[\w\d"][\w\d_]*/},{
594 | begin:/\$\{(.*?)\}/}]},r={className:"literal",
595 | begin:/\bon|off|true|false|yes|no\b/},s={className:"string",
596 | contains:[e.BACKSLASH_ESCAPE],variants:[{begin:"'''",end:"'''",relevance:10},{
597 | begin:'"""',end:'"""',relevance:10},{begin:'"',end:'"'},{begin:"'",end:"'"}]
598 | },o={begin:/\[/,end:/\]/,contains:[a,r,i,s,t,"self"],relevance:0
599 | },l=n.either(/[A-Za-z0-9_-]+/,/"(\\"|[^"])*"/,/'[^']*'/);return{
600 | name:"TOML, also INI",aliases:["toml"],case_insensitive:!0,illegal:/\S/,
601 | contains:[a,{className:"section",begin:/\[+/,end:/\]+/},{
602 | begin:n.concat(l,"(\\s*\\.\\s*",l,")*",n.lookahead(/\s*=\s*[^#\s]/)),
603 | className:"attr",starts:{end:/$/,contains:[a,o,r,i,s,t]}}]}},grmr_java:e=>{
604 | const n=e.regex,t="[\xc0-\u02b8a-zA-Z_$][\xc0-\u02b8a-zA-Z_$0-9]*",a=t+ue("(?:<"+t+"~~~(?:\\s*,\\s*"+t+"~~~)*>)?",/~~~/g,2),i={
605 | keyword:["synchronized","abstract","private","var","static","if","const ","for","while","strictfp","finally","protected","import","native","final","void","enum","else","break","transient","catch","instanceof","volatile","case","assert","package","default","public","try","switch","continue","throws","protected","public","private","module","requires","exports","do","sealed"],
606 | literal:["false","true","null"],
607 | type:["char","boolean","long","float","int","byte","short","double"],
608 | built_in:["super","this"]},r={className:"meta",begin:"@"+t,contains:[{
609 | begin:/\(/,end:/\)/,contains:["self"]}]},s={className:"params",begin:/\(/,
610 | end:/\)/,keywords:i,relevance:0,contains:[e.C_BLOCK_COMMENT_MODE],endsParent:!0}
611 | ;return{name:"Java",aliases:["jsp"],keywords:i,illegal:/<\/|#/,
612 | contains:[e.COMMENT("/\\*\\*","\\*/",{relevance:0,contains:[{begin:/\w+@/,
613 | relevance:0},{className:"doctag",begin:"@[A-Za-z]+"}]}),{
614 | begin:/import java\.[a-z]+\./,keywords:"import",relevance:2
615 | },e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,{begin:/"""/,end:/"""/,
616 | className:"string",contains:[e.BACKSLASH_ESCAPE]
617 | },e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,{
618 | match:[/\b(?:class|interface|enum|extends|implements|new)/,/\s+/,t],className:{
619 | 1:"keyword",3:"title.class"}},{match:/non-sealed/,scope:"keyword"},{
620 | begin:[n.concat(/(?!else)/,t),/\s+/,t,/\s+/,/=(?!=)/],className:{1:"type",
621 | 3:"variable",5:"operator"}},{begin:[/record/,/\s+/,t],className:{1:"keyword",
622 | 3:"title.class"},contains:[s,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},{
623 | beginKeywords:"new throw return else",relevance:0},{
624 | begin:["(?:"+a+"\\s+)",e.UNDERSCORE_IDENT_RE,/\s*(?=\()/],className:{
625 | 2:"title.function"},keywords:i,contains:[{className:"params",begin:/\(/,
626 | end:/\)/,keywords:i,relevance:0,
627 | contains:[r,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,ge,e.C_BLOCK_COMMENT_MODE]
628 | },e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},ge,r]}},grmr_javascript:we,
629 | grmr_json:e=>{const n=["true","false","null"],t={scope:"literal",
630 | beginKeywords:n.join(" ")};return{name:"JSON",keywords:{literal:n},contains:[{
631 | className:"attr",begin:/"(\\.|[^\\"\r\n])*"(?=\s*:)/,relevance:1.01},{
632 | match:/[{}[\],:]/,className:"punctuation",relevance:0
633 | },e.QUOTE_STRING_MODE,t,e.C_NUMBER_MODE,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE],
634 | illegal:"\\S"}},grmr_kotlin:e=>{const n={
635 | keyword:"abstract as val var vararg get set class object open private protected public noinline crossinline dynamic final enum if else do while for when throw try catch finally import package is in fun override companion reified inline lateinit init interface annotation data sealed internal infix operator out by constructor super tailrec where const inner suspend typealias external expect actual",
636 | built_in:"Byte Short Char Int Long Boolean Float Double Void Unit Nothing",
637 | literal:"true false null"},t={className:"symbol",begin:e.UNDERSCORE_IDENT_RE+"@"
638 | },a={className:"subst",begin:/\$\{/,end:/\}/,contains:[e.C_NUMBER_MODE]},i={
639 | className:"variable",begin:"\\$"+e.UNDERSCORE_IDENT_RE},r={className:"string",
640 | variants:[{begin:'"""',end:'"""(?=[^"])',contains:[i,a]},{begin:"'",end:"'",
641 | illegal:/\n/,contains:[e.BACKSLASH_ESCAPE]},{begin:'"',end:'"',illegal:/\n/,
642 | contains:[e.BACKSLASH_ESCAPE,i,a]}]};a.contains.push(r);const s={
643 | className:"meta",
644 | begin:"@(?:file|property|field|get|set|receiver|param|setparam|delegate)\\s*:(?:\\s*"+e.UNDERSCORE_IDENT_RE+")?"
645 | },o={className:"meta",begin:"@"+e.UNDERSCORE_IDENT_RE,contains:[{begin:/\(/,
646 | end:/\)/,contains:[e.inherit(r,{className:"string"}),"self"]}]
647 | },l=ge,c=e.COMMENT("/\\*","\\*/",{contains:[e.C_BLOCK_COMMENT_MODE]}),d={
648 | variants:[{className:"type",begin:e.UNDERSCORE_IDENT_RE},{begin:/\(/,end:/\)/,
649 | contains:[]}]},g=d;return g.variants[1].contains=[d],d.variants[1].contains=[g],
650 | {name:"Kotlin",aliases:["kt","kts"],keywords:n,
651 | contains:[e.COMMENT("/\\*\\*","\\*/",{relevance:0,contains:[{className:"doctag",
652 | begin:"@[A-Za-z]+"}]}),e.C_LINE_COMMENT_MODE,c,{className:"keyword",
653 | begin:/\b(break|continue|return|this)\b/,starts:{contains:[{className:"symbol",
654 | begin:/@\w+/}]}},t,s,o,{className:"function",beginKeywords:"fun",end:"[(]|$",
655 | returnBegin:!0,excludeEnd:!0,keywords:n,relevance:5,contains:[{
656 | begin:e.UNDERSCORE_IDENT_RE+"\\s*\\(",returnBegin:!0,relevance:0,
657 | contains:[e.UNDERSCORE_TITLE_MODE]},{className:"type",begin:/,end:/>/,
658 | keywords:"reified",relevance:0},{className:"params",begin:/\(/,end:/\)/,
659 | endsParent:!0,keywords:n,relevance:0,contains:[{begin:/:/,end:/[=,\/]/,
660 | endsWithParent:!0,contains:[d,e.C_LINE_COMMENT_MODE,c],relevance:0
661 | },e.C_LINE_COMMENT_MODE,c,s,o,r,e.C_NUMBER_MODE]},c]},{
662 | begin:[/class|interface|trait/,/\s+/,e.UNDERSCORE_IDENT_RE],beginScope:{
663 | 3:"title.class"},keywords:"class interface trait",end:/[:\{(]|$/,excludeEnd:!0,
664 | illegal:"extends implements",contains:[{
665 | beginKeywords:"public protected internal private constructor"
666 | },e.UNDERSCORE_TITLE_MODE,{className:"type",begin:/,end:/>/,excludeBegin:!0,
667 | excludeEnd:!0,relevance:0},{className:"type",begin:/[,:]\s*/,end:/[<\(,){\s]|$/,
668 | excludeBegin:!0,returnEnd:!0},s,o]},r,{className:"meta",begin:"^#!/usr/bin/env",
669 | end:"$",illegal:"\n"},l]}},grmr_less:e=>{
670 | const n=te(e),t=le,a="([\\w-]+|@\\{[\\w-]+\\})",i=[],r=[],s=e=>({
671 | className:"string",begin:"~?"+e+".*?"+e}),o=(e,n,t)=>({className:e,begin:n,
672 | relevance:t}),l={$pattern:/[a-z-]+/,keyword:"and or not only",
673 | attribute:ie.join(" ")},c={begin:"\\(",end:"\\)",contains:r,keywords:l,
674 | relevance:0}
675 | ;r.push(e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,s("'"),s('"'),n.CSS_NUMBER_MODE,{
676 | begin:"(url|data-uri)\\(",starts:{className:"string",end:"[\\)\\n]",
677 | excludeEnd:!0}
678 | },n.HEXCOLOR,c,o("variable","@@?[\\w-]+",10),o("variable","@\\{[\\w-]+\\}"),o("built_in","~?`[^`]*?`"),{
679 | className:"attribute",begin:"[\\w-]+\\s*:",end:":",returnBegin:!0,excludeEnd:!0
680 | },n.IMPORTANT,{beginKeywords:"and not"},n.FUNCTION_DISPATCH);const d=r.concat({
681 | begin:/\{/,end:/\}/,contains:i}),g={beginKeywords:"when",endsWithParent:!0,
682 | contains:[{beginKeywords:"and not"}].concat(r)},u={begin:a+"\\s*:",
683 | returnBegin:!0,end:/[;}]/,relevance:0,contains:[{begin:/-(webkit|moz|ms|o)-/
684 | },n.CSS_VARIABLE,{className:"attribute",begin:"\\b("+oe.join("|")+")\\b",
685 | end:/(?=:)/,starts:{endsWithParent:!0,illegal:"[<=$]",relevance:0,contains:r}}]
686 | },b={className:"keyword",
687 | begin:"@(import|media|charset|font-face|(-[a-z]+-)?keyframes|supports|document|namespace|page|viewport|host)\\b",
688 | starts:{end:"[;{}]",keywords:l,returnEnd:!0,contains:r,relevance:0}},m={
689 | className:"variable",variants:[{begin:"@[\\w-]+\\s*:",relevance:15},{
690 | begin:"@[\\w-]+"}],starts:{end:"[;}]",returnEnd:!0,contains:d}},p={variants:[{
691 | begin:"[\\.#:&\\[>]",end:"[;{}]"},{begin:a,end:/\{/}],returnBegin:!0,
692 | returnEnd:!0,illegal:"[<='$\"]",relevance:0,
693 | contains:[e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,g,o("keyword","all\\b"),o("variable","@\\{[\\w-]+\\}"),{
694 | begin:"\\b("+ae.join("|")+")\\b",className:"selector-tag"
695 | },n.CSS_NUMBER_MODE,o("selector-tag",a,0),o("selector-id","#"+a),o("selector-class","\\."+a,0),o("selector-tag","&",0),n.ATTRIBUTE_SELECTOR_MODE,{
696 | className:"selector-pseudo",begin:":("+re.join("|")+")"},{
697 | className:"selector-pseudo",begin:":(:)?("+se.join("|")+")"},{begin:/\(/,
698 | end:/\)/,relevance:0,contains:d},{begin:"!important"},n.FUNCTION_DISPATCH]},_={
699 | begin:`[\\w-]+:(:)?(${t.join("|")})`,returnBegin:!0,contains:[p]}
700 | ;return i.push(e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,b,m,_,u,p,g,n.FUNCTION_DISPATCH),
701 | {name:"Less",case_insensitive:!0,illegal:"[=>'/<($\"]",contains:i}},
702 | grmr_lua:e=>{const n="\\[=*\\[",t="\\]=*\\]",a={begin:n,end:t,contains:["self"]
703 | },i=[e.COMMENT("--(?!\\[=*\\[)","$"),e.COMMENT("--\\[=*\\[",t,{contains:[a],
704 | relevance:10})];return{name:"Lua",keywords:{$pattern:e.UNDERSCORE_IDENT_RE,
705 | literal:"true false nil",
706 | keyword:"and break do else elseif end for goto if in local not or repeat return then until while",
707 | built_in:"_G _ENV _VERSION __index __newindex __mode __call __metatable __tostring __len __gc __add __sub __mul __div __mod __pow __concat __unm __eq __lt __le assert collectgarbage dofile error getfenv getmetatable ipairs load loadfile loadstring module next pairs pcall print rawequal rawget rawset require select setfenv setmetatable tonumber tostring type unpack xpcall arg self coroutine resume yield status wrap create running debug getupvalue debug sethook getmetatable gethook setmetatable setlocal traceback setfenv getinfo setupvalue getlocal getregistry getfenv io lines write close flush open output type read stderr stdin input stdout popen tmpfile math log max acos huge ldexp pi cos tanh pow deg tan cosh sinh random randomseed frexp ceil floor rad abs sqrt modf asin min mod fmod log10 atan2 exp sin atan os exit setlocale date getenv difftime remove time clock tmpname rename execute package preload loadlib loaded loaders cpath config path seeall string sub upper len gfind rep find match char dump gmatch reverse byte format gsub lower table setn insert getn foreachi maxn foreach concat sort remove"
708 | },contains:i.concat([{className:"function",beginKeywords:"function",end:"\\)",
709 | contains:[e.inherit(e.TITLE_MODE,{
710 | begin:"([_a-zA-Z]\\w*\\.)*([_a-zA-Z]\\w*:)?[_a-zA-Z]\\w*"}),{className:"params",
711 | begin:"\\(",endsWithParent:!0,contains:i}].concat(i)
712 | },e.C_NUMBER_MODE,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,{className:"string",
713 | begin:n,end:t,contains:[a],relevance:5}])}},grmr_makefile:e=>{const n={
714 | className:"variable",variants:[{begin:"\\$\\("+e.UNDERSCORE_IDENT_RE+"\\)",
715 | contains:[e.BACKSLASH_ESCAPE]},{begin:/\$[@%\^\+\*]/}]},t={className:"string",
716 | begin:/"/,end:/"/,contains:[e.BACKSLASH_ESCAPE,n]},a={className:"variable",
717 | begin:/\$\([\w-]+\s/,end:/\)/,keywords:{
718 | built_in:"subst patsubst strip findstring filter filter-out sort word wordlist firstword lastword dir notdir suffix basename addsuffix addprefix join wildcard realpath abspath error warning shell origin flavor foreach if or and call eval file value"
719 | },contains:[n]},i={begin:"^"+e.UNDERSCORE_IDENT_RE+"\\s*(?=[:+?]?=)"},r={
720 | className:"section",begin:/^[^\s]+:/,end:/$/,contains:[n]};return{
721 | name:"Makefile",aliases:["mk","mak","make"],keywords:{$pattern:/[\w-]+/,
722 | keyword:"define endef undefine ifdef ifndef ifeq ifneq else endif include -include sinclude override export unexport private vpath"
723 | },contains:[e.HASH_COMMENT_MODE,n,t,a,i,{className:"meta",begin:/^\.PHONY:/,
724 | end:/$/,keywords:{$pattern:/[\.\w]+/,keyword:".PHONY"}},r]}},grmr_xml:e=>{
725 | const n=e.regex,t=n.concat(/[\p{L}_]/u,n.optional(/[\p{L}0-9_.-]*:/u),/[\p{L}0-9_.-]*/u),a={
726 | className:"symbol",begin:/&[a-z]+;|[0-9]+;|[a-f0-9]+;/},i={begin:/\s/,
727 | contains:[{className:"keyword",begin:/#?[a-z_][a-z1-9_-]+/,illegal:/\n/}]
728 | },r=e.inherit(i,{begin:/\(/,end:/\)/}),s=e.inherit(e.APOS_STRING_MODE,{
729 | className:"string"}),o=e.inherit(e.QUOTE_STRING_MODE,{className:"string"}),l={
730 | endsWithParent:!0,illegal:/,relevance:0,contains:[{className:"attr",
731 | begin:/[\p{L}0-9._:-]+/u,relevance:0},{begin:/=\s*/,relevance:0,contains:[{
732 | className:"string",endsParent:!0,variants:[{begin:/"/,end:/"/,contains:[a]},{
733 | begin:/'/,end:/'/,contains:[a]},{begin:/[^\s"'=<>`]+/}]}]}]};return{
734 | name:"HTML, XML",
735 | aliases:["html","xhtml","rss","atom","xjb","xsd","xsl","plist","wsf","svg"],
736 | case_insensitive:!0,unicodeRegex:!0,contains:[{className:"meta",begin://,relevance:10,contains:[i,o,s,r,{begin:/\[/,end:/\]/,contains:[{
738 | className:"meta",begin://,contains:[i,r,o,s]}]}]
739 | },e.COMMENT(//,{relevance:10}),{begin://,
740 | relevance:10},a,{className:"meta",end:/\?>/,variants:[{begin:/<\?xml/,
741 | relevance:10,contains:[o]},{begin:/<\?[a-z][a-z0-9]+/}]},{className:"tag",
742 | begin:/