diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml index c68765b..0c6a15a 100644 --- a/.github/FUNDING.yml +++ b/.github/FUNDING.yml @@ -1 +1 @@ -github: :vendor_name +github: CodebarAg diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml index 96701be..b9eeb96 100644 --- a/.github/ISSUE_TEMPLATE/config.yml +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -1,11 +1,11 @@ blank_issues_enabled: false contact_links: - name: Ask a question - url: https://github.com/:vendor_name/:package_name/discussions/new?category=q-a + url: https://github.com/CodebarAg/filament-codemirror/discussions/new?category=q-a about: Ask the community for help - name: Request a feature - url: https://github.com/:vendor_name/:package_name/discussions/new?category=ideas + url: https://github.com/CodebarAg/filament-codemirror/discussions/new?category=ideas about: Share ideas for new features - name: Report a security issue - url: https://github.com/:vendor_name/:package_name/security/policy + url: https://github.com/CodebarAg/filament-codemirror/security/policy about: Learn how to notify us for sensitive bugs diff --git a/CHANGELOG.md b/CHANGELOG.md index 87b3242..0b04264 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,3 @@ # Changelog -All notable changes to `:package_name` will be documented in this file. +All notable changes to `filament-codemirror` will be documented in this file. diff --git a/LICENSE.md b/LICENSE.md index 58c9ad4..38fa742 100644 --- a/LICENSE.md +++ b/LICENSE.md @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) :vendor_name +Copyright (c) CodebarAg <43909932+RhysLees@users.noreply.github.com> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/README.md b/README.md index 375da96..5651629 100644 --- a/README.md +++ b/README.md @@ -1,24 +1,15 @@ -# :package_description - -[![Latest Version on Packagist](https://img.shields.io/packagist/v/:vendor_slug/:package_slug.svg?style=flat-square)](https://packagist.org/packages/:vendor_slug/:package_slug) -[![GitHub Tests Action Status](https://img.shields.io/github/actions/workflow/status/:vendor_slug/:package_slug/run-tests.yml?branch=main&label=tests&style=flat-square)](https://github.com/:vendor_slug/:package_slug/actions?query=workflow%3Arun-tests+branch%3Amain) -[![GitHub Code Style Action Status](https://img.shields.io/github/actions/workflow/status/:vendor_slug/:package_slug/fix-php-code-style-issues.yml?branch=main&label=code%20style&style=flat-square)](https://github.com/:vendor_slug/:package_slug/actions?query=workflow%3A"Fix+PHP+code+style+issues"+branch%3Amain) -[![Total Downloads](https://img.shields.io/packagist/dt/:vendor_slug/:package_slug.svg?style=flat-square)](https://packagist.org/packages/:vendor_slug/:package_slug) - ---- -This repo can be used to scaffold a Laravel package. Follow these steps to get started: - -1. Press the "Use this template" button at the top of this repo to create a new repo with the contents of this skeleton. -2. Run "php ./configure.php" to run a script that will replace all placeholders throughout all the files. -3. Have fun creating your package. -4. If you need help creating a package, consider picking up our Laravel Package Training video course. ---- - +# This is my package filament-codemirror + +[![Latest Version on Packagist](https://img.shields.io/packagist/v/codebar-ag/filament-codemirror.svg?style=flat-square)](https://packagist.org/packages/codebar-ag/filament-codemirror) +[![GitHub Tests Action Status](https://img.shields.io/github/actions/workflow/status/codebar-ag/filament-codemirror/run-tests.yml?branch=main&label=tests&style=flat-square)](https://github.com/codebar-ag/filament-codemirror/actions?query=workflow%3Arun-tests+branch%3Amain) +[![GitHub Code Style Action Status](https://img.shields.io/github/actions/workflow/status/codebar-ag/filament-codemirror/fix-php-code-style-issues.yml?branch=main&label=code%20style&style=flat-square)](https://github.com/codebar-ag/filament-codemirror/actions?query=workflow%3A"Fix+PHP+code+style+issues"+branch%3Amain) +[![Total Downloads](https://img.shields.io/packagist/dt/codebar-ag/filament-codemirror.svg?style=flat-square)](https://packagist.org/packages/codebar-ag/filament-codemirror) + This is where your description should go. Limit it to a paragraph or two. Consider adding a small example. ## Support us -[](https://spatie.be/github-ad-click/:package_name) +[](https://spatie.be/github-ad-click/filament-codemirror) We invest a lot of resources into creating [best in class open source packages](https://spatie.be/open-source). You can support us by [buying one of our paid products](https://spatie.be/open-source/support-us). @@ -29,40 +20,14 @@ We highly appreciate you sending us a postcard from your hometown, mentioning wh You can install the package via composer: ```bash -composer require :vendor_slug/:package_slug -``` - -You can publish and run the migrations with: - -```bash -php artisan vendor:publish --tag=":package_slug-migrations" -php artisan migrate -``` - -You can publish the config file with: - -```bash -php artisan vendor:publish --tag=":package_slug-config" -``` - -This is the contents of the published config file: +composer require codebar-ag/filament-codemirror -```php -return [ -]; +php artisan filament:assets ``` -Optionally, you can publish the views using - +## To compile the assets for distribution ```bash -php artisan vendor:publish --tag=":package_slug-views" -``` - -## Usage - -```php -$variable = new VendorName\Skeleton(); -echo $variable->echoPhrase('Hello, VendorName!'); +node bin/build ``` ## Testing @@ -85,7 +50,7 @@ Please review [our security policy](../../security/policy) on how to report secu ## Credits -- [:author_name](https://github.com/:author_username) +- [Rhys Lees](https://github.com/43909932+RhysLees) - [All Contributors](../../contributors) ## License diff --git a/bin/build.js b/bin/build.js new file mode 100644 index 0000000..b9c6d54 --- /dev/null +++ b/bin/build.js @@ -0,0 +1,12 @@ +import * as esbuild from 'esbuild'; + +esbuild.build({ + entryPoints: ['./resources/js/codemirror.js'], + outfile: './dist/codemirror.js', + bundle: true, + mainFields: ['module', 'main'], + platform: 'browser', + treeShaking: true, + target: ['es2020'], + minify: true, +}); diff --git a/composer.json b/composer.json index 65e9908..b4a67ce 100644 --- a/composer.json +++ b/composer.json @@ -1,24 +1,32 @@ { - "name": ":vendor_slug/:package_slug", - "description": ":package_description", + "name": "codebar-ag/filament-codemirror", + "description": "This is my package filament-codemirror", "keywords": [ - ":vendor_name", + "CodebarAg", "laravel", - ":package_slug" + "filament-codemirror" ], - "homepage": "https://github.com/:vendor_slug/:package_slug", + "homepage": "https://github.com/codebar-ag/filament-codemirror", "license": "MIT", "authors": [ { - "name": ":author_name", - "email": "author@domain.com", - "role": "Developer" + "name": "Sebastian Bürgin", + "email": "sebastian.fix@buergin.ch", + "homepage": "https://www.codebar.ch", + "role": "Sofware-Engineer" + }, + { + "name": "Rhys Lees", + "role": "Software-Developer" } ], "require": { "php": "^8.2", - "spatie/laravel-package-tools": "^1.16", - "illuminate/contracts": "^10.0||^11.0" + "filament/infolists": "^3.2", + "filament/support": "^3.2", + "filament/tables": "^3.2", + "illuminate/contracts": "^10.0||^11.0", + "spatie/laravel-package-tools": "^1.16" }, "require-dev": { "laravel/pint": "^1.14", @@ -35,19 +43,19 @@ }, "autoload": { "psr-4": { - "VendorName\\Skeleton\\": "src/", - "VendorName\\Skeleton\\Database\\Factories\\": "database/factories/" + "CodebarAg\\FilamentCodemirror\\": "src/", + "CodebarAg\\FilamentCodemirror\\Database\\Factories\\": "database/factories/" } }, "autoload-dev": { "psr-4": { - "VendorName\\Skeleton\\Tests\\": "tests/", + "CodebarAg\\FilamentCodemirror\\Tests\\": "tests/", "Workbench\\App\\": "workbench/app/" } }, "scripts": { "post-autoload-dump": "@composer run prepare", - "clear": "@php vendor/bin/testbench package:purge-skeleton --ansi", + "clear": "@php vendor/bin/testbench package:purge-filament-codemirror --ansi", "prepare": "@php vendor/bin/testbench package:discover --ansi", "build": [ "@composer run prepare", @@ -73,10 +81,10 @@ "extra": { "laravel": { "providers": [ - "VendorName\\Skeleton\\SkeletonServiceProvider" + "CodebarAg\\FilamentCodemirror\\FilamentCodemirrorServiceProvider" ], "aliases": { - "Skeleton": "VendorName\\Skeleton\\Facades\\Skeleton" + "FilamentCodemirror": "CodebarAg\\FilamentCodemirror\\Facades\\FilamentCodemirror" } } }, diff --git a/config/filament-codemirror.php b/config/filament-codemirror.php new file mode 100644 index 0000000..f5cb9a0 --- /dev/null +++ b/config/filament-codemirror.php @@ -0,0 +1,6 @@ + $version) { - if (in_array($name, $names, true)) { - unset($data['require-dev'][$name]); - } - } - - file_put_contents(__DIR__.'/composer.json', json_encode($data, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE)); -} - -function remove_composer_script($scriptName) -{ - $data = json_decode(file_get_contents(__DIR__.'/composer.json'), true); - - foreach ($data['scripts'] as $name => $script) { - if ($scriptName === $name) { - unset($data['scripts'][$name]); - break; - } - } - - file_put_contents(__DIR__.'/composer.json', json_encode($data, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE)); -} - -function remove_readme_paragraphs(string $file): void -{ - $contents = file_get_contents($file); - - file_put_contents( - $file, - preg_replace('/.*/s', '', $contents) ?: $contents - ); -} - -function safeUnlink(string $filename) -{ - if (file_exists($filename) && is_file($filename)) { - unlink($filename); - } -} - -function determineSeparator(string $path): string -{ - return str_replace('/', DIRECTORY_SEPARATOR, $path); -} - -function replaceForWindows(): array -{ - return preg_split('/\\r\\n|\\r|\\n/', run('dir /S /B * | findstr /v /i .git\ | findstr /v /i vendor | findstr /v /i '.basename(__FILE__).' | findstr /r /i /M /F:/ ":author :vendor :package VendorName skeleton migration_table_name vendor_name vendor_slug author@domain.com"')); -} - -function replaceForAllOtherOSes(): array -{ - return explode(PHP_EOL, run('grep -E -r -l -i ":author|:vendor|:package|VendorName|skeleton|migration_table_name|vendor_name|vendor_slug|author@domain.com" --exclude-dir=vendor ./* ./.github/* | grep -v '.basename(__FILE__))); -} - -function getGitHubApiEndpoint(string $endpoint): ?stdClass -{ - try { - $curl = curl_init("https://api.github.com/{$endpoint}"); - curl_setopt_array($curl, [ - CURLOPT_RETURNTRANSFER => true, - CURLOPT_FOLLOWLOCATION => true, - CURLOPT_HTTPGET => true, - CURLOPT_HTTPHEADER => [ - 'User-Agent: spatie-configure-script/1.0', - ], - ]); - - $response = curl_exec($curl); - $statusCode = curl_getinfo($curl, CURLINFO_HTTP_CODE); - - curl_close($curl); - - if ($statusCode === 200) { - return json_decode($response); - } - } catch (Exception $e) { - // ignore - } - - return null; -} - -function searchCommitsForGitHubUsername(): string -{ - $authorName = strtolower(trim(shell_exec('git config user.name'))); - - $committersRaw = shell_exec("git log --author='@users.noreply.github.com' --pretty='%an:%ae' --reverse"); - $committersLines = explode("\n", $committersRaw ?? ''); - $committers = array_filter(array_map(function ($line) use ($authorName) { - $line = trim($line); - [$name, $email] = explode(':', $line) + [null, null]; - - return [ - 'name' => $name, - 'email' => $email, - 'isMatch' => strtolower($name) === $authorName && ! str_contains($name, '[bot]'), - ]; - }, $committersLines), fn ($item) => $item['isMatch']); - - if (empty($committers)) { - return ''; - } - - $firstCommitter = reset($committers); - - return explode('@', $firstCommitter['email'])[0] ?? ''; -} - -function guessGitHubUsernameUsingCli() -{ - try { - if (preg_match('/ogged in to github\.com as ([a-zA-Z-_]+).+/', shell_exec('gh auth status -h github.com 2>&1'), $matches)) { - return $matches[1]; - } - } catch (Exception $e) { - // ignore - } - - return ''; -} - -function guessGitHubUsername(): string -{ - $username = searchCommitsForGitHubUsername(); - if (! empty($username)) { - return $username; - } - - $username = guessGitHubUsernameUsingCli(); - if (! empty($username)) { - return $username; - } - - // fall back to using the username from the git remote - $remoteUrl = shell_exec('git config remote.origin.url'); - $remoteUrlParts = explode('/', str_replace(':', '/', trim($remoteUrl))); - - return $remoteUrlParts[1] ?? ''; -} - -function guessGitHubVendorInfo($authorName, $username): array -{ - $remoteUrl = shell_exec('git config remote.origin.url'); - $remoteUrlParts = explode('/', str_replace(':', '/', trim($remoteUrl))); - - $response = getGitHubApiEndpoint("orgs/{$remoteUrlParts[1]}"); - - if ($response === null) { - return [$authorName, $username]; - } - - return [$response->name ?? $authorName, $response->login ?? $username]; -} - -$gitName = run('git config user.name'); -$authorName = ask('Author name', $gitName); - -$gitEmail = run('git config user.email'); -$authorEmail = ask('Author email', $gitEmail); -$authorUsername = ask('Author username', guessGitHubUsername()); - -$guessGitHubVendorInfo = guessGitHubVendorInfo($authorName, $authorUsername); - -$vendorName = ask('Vendor name', $guessGitHubVendorInfo[0]); -$vendorUsername = ask('Vendor username', $guessGitHubVendorInfo[1] ?? slugify($vendorName)); -$vendorSlug = slugify($vendorUsername); - -$vendorNamespace = str_replace('-', '', ucwords($vendorName)); -$vendorNamespace = ask('Vendor namespace', $vendorNamespace); - -$currentDirectory = getcwd(); -$folderName = basename($currentDirectory); - -$packageName = ask('Package name', $folderName); -$packageSlug = slugify($packageName); -$packageSlugWithoutPrefix = remove_prefix('laravel-', $packageSlug); - -$className = title_case($packageName); -$className = ask('Class name', $className); -$variableName = lcfirst($className); -$description = ask('Package description', "This is my package {$packageSlug}"); - -$usePhpStan = confirm('Enable PhpStan?', true); -$useLaravelPint = confirm('Enable Laravel Pint?', true); -$useDependabot = confirm('Enable Dependabot?', true); -$useLaravelRay = confirm('Use Ray for debugging?', true); -$useUpdateChangelogWorkflow = confirm('Use automatic changelog updater workflow?', true); - -writeln('------'); -writeln("Author : {$authorName} ({$authorUsername}, {$authorEmail})"); -writeln("Vendor : {$vendorName} ({$vendorSlug})"); -writeln("Package : {$packageSlug} <{$description}>"); -writeln("Namespace : {$vendorNamespace}\\{$className}"); -writeln("Class name : {$className}"); -writeln('---'); -writeln('Packages & Utilities'); -writeln('Use Laravel/Pint : '.($useLaravelPint ? 'yes' : 'no')); -writeln('Use Larastan/PhpStan : '.($usePhpStan ? 'yes' : 'no')); -writeln('Use Dependabot : '.($useDependabot ? 'yes' : 'no')); -writeln('Use Ray App : '.($useLaravelRay ? 'yes' : 'no')); -writeln('Use Auto-Changelog : '.($useUpdateChangelogWorkflow ? 'yes' : 'no')); -writeln('------'); - -writeln('This script will replace the above values in all relevant files in the project directory.'); - -if (! confirm('Modify files?', true)) { - exit(1); -} - -$files = (str_starts_with(strtoupper(PHP_OS), 'WIN') ? replaceForWindows() : replaceForAllOtherOSes()); - -foreach ($files as $file) { - replace_in_file($file, [ - ':author_name' => $authorName, - ':author_username' => $authorUsername, - 'author@domain.com' => $authorEmail, - ':vendor_name' => $vendorName, - ':vendor_slug' => $vendorSlug, - 'VendorName' => $vendorNamespace, - ':package_name' => $packageName, - ':package_slug' => $packageSlug, - ':package_slug_without_prefix' => $packageSlugWithoutPrefix, - 'Skeleton' => $className, - 'skeleton' => $packageSlug, - 'migration_table_name' => title_snake($packageSlug), - 'variable' => $variableName, - ':package_description' => $description, - ]); - - match (true) { - str_contains($file, determineSeparator('src/Skeleton.php')) => rename($file, determineSeparator('./src/'.$className.'.php')), - str_contains($file, determineSeparator('src/SkeletonServiceProvider.php')) => rename($file, determineSeparator('./src/'.$className.'ServiceProvider.php')), - str_contains($file, determineSeparator('src/Facades/Skeleton.php')) => rename($file, determineSeparator('./src/Facades/'.$className.'.php')), - str_contains($file, determineSeparator('src/Commands/SkeletonCommand.php')) => rename($file, determineSeparator('./src/Commands/'.$className.'Command.php')), - str_contains($file, determineSeparator('database/migrations/create_skeleton_table.php.stub')) => rename($file, determineSeparator('./database/migrations/create_'.title_snake($packageSlugWithoutPrefix).'_table.php.stub')), - str_contains($file, determineSeparator('config/skeleton.php')) => rename($file, determineSeparator('./config/'.$packageSlugWithoutPrefix.'.php')), - str_contains($file, 'README.md') => remove_readme_paragraphs($file), - default => [], - }; -} - -if (! $useLaravelPint) { - safeUnlink(__DIR__.'/.github/workflows/fix-php-code-style-issues.yml'); - safeUnlink(__DIR__.'/pint.json'); -} - -if (! $usePhpStan) { - safeUnlink(__DIR__.'/phpstan.neon.dist'); - safeUnlink(__DIR__.'/phpstan-baseline.neon'); - safeUnlink(__DIR__.'/.github/workflows/phpstan.yml'); - - remove_composer_deps([ - 'phpstan/extension-installer', - 'phpstan/phpstan-deprecation-rules', - 'phpstan/phpstan-phpunit', - 'larastan/larastan', - ]); - - remove_composer_script('phpstan'); -} - -if (! $useDependabot) { - safeUnlink(__DIR__.'/.github/dependabot.yml'); - safeUnlink(__DIR__.'/.github/workflows/dependabot-auto-merge.yml'); -} - -if (! $useLaravelRay) { - remove_composer_deps(['spatie/laravel-ray']); -} - -if (! $useUpdateChangelogWorkflow) { - safeUnlink(__DIR__.'/.github/workflows/update-changelog.yml'); -} - -confirm('Execute `composer install` and run tests?') && run('composer install && composer test'); - -confirm('Let this script delete itself?', true) && unlink(__FILE__); diff --git a/database/factories/ModelFactory.php b/database/factories/ModelFactory.php index c51604f..9e3b5a6 100644 --- a/database/factories/ModelFactory.php +++ b/database/factories/ModelFactory.php @@ -1,6 +1,6 @@ id(); - - // add fields - - $table->timestamps(); - }); - } -}; diff --git a/dist/codemirror.css b/dist/codemirror.css new file mode 100644 index 0000000..6c05c0b --- /dev/null +++ b/dist/codemirror.css @@ -0,0 +1 @@ +.CodeMirror-foldmarker{color:#00f;text-shadow:#b9f 1px 1px 2px,#b9f -1px -1px 2px,#b9f 1px -1px 2px,#b9f -1px 1px 2px;font-family:arial;line-height:.3;cursor:pointer}.CodeMirror-foldgutter{width:.7em}.CodeMirror-foldgutter-open,.CodeMirror-foldgutter-folded{cursor:pointer}.CodeMirror-foldgutter-open:after{content:"\25be"}.CodeMirror-foldgutter-folded:after{content:"\25b8"}.cm-s-darcula{font-family:Consolas,Menlo,Monaco,Lucida Console,Liberation Mono,DejaVu Sans Mono,Bitstream Vera Sans Mono,Courier New,monospace,serif}.cm-s-darcula.CodeMirror{background:#2b2b2b;color:#a9b7c6}.cm-s-darcula span.cm-meta{color:#bbb529}.cm-s-darcula span.cm-number{color:#6897bb}.cm-s-darcula span.cm-keyword{color:#cc7832;line-height:1em;font-weight:700}.cm-s-darcula span.cm-def{color:#a9b7c6;font-style:italic}.cm-s-darcula span.cm-variable,.cm-s-darcula span.cm-variable-2{color:#a9b7c6}.cm-s-darcula span.cm-variable-3{color:#9876aa}.cm-s-darcula span.cm-type{color:#abc;font-weight:700}.cm-s-darcula span.cm-property{color:#ffc66d}.cm-s-darcula span.cm-operator{color:#a9b7c6}.cm-s-darcula span.cm-string,.cm-s-darcula span.cm-string-2{color:#6a8759}.cm-s-darcula span.cm-comment{color:#61a151;font-style:italic}.cm-s-darcula span.cm-link,.cm-s-darcula span.cm-atom{color:#cc7832}.cm-s-darcula span.cm-error{color:#bc3f3c}.cm-s-darcula span.cm-tag{color:#629755;font-weight:700;font-style:italic;text-decoration:underline}.cm-s-darcula span.cm-attribute{color:#6897bb}.cm-s-darcula span.cm-qualifier{color:#6a8759}.cm-s-darcula span.cm-bracket{color:#a9b7c6}.cm-s-darcula span.cm-builtin,.cm-s-darcula span.cm-special{color:#ff9e59}.cm-s-darcula span.cm-matchhighlight{color:#fff;background-color:#325930b3;font-weight:400}.cm-s-darcula span.cm-searching{color:#fff;background-color:#3d733bb3;font-weight:400}.cm-s-darcula .CodeMirror-cursor{border-left:1px solid #A9B7C6}.cm-s-darcula .CodeMirror-activeline-background{background:#323232}.cm-s-darcula .CodeMirror-gutters{background:#313335;border-right:1px solid #313335}.cm-s-darcula .CodeMirror-guttermarker{color:#ffee80}.cm-s-darcula .CodeMirror-guttermarker-subtle{color:#d0d0d0}.cm-s-darcula .CodeMirrir-linenumber{color:#606366}.cm-s-darcula .CodeMirror-matchingbracket{background-color:#3b514d;color:#ffef28!important;font-weight:700}.cm-s-darcula div.CodeMirror-selected{background:#214283}.CodeMirror-hints.darcula{font-family:Menlo,Monaco,Consolas,Courier New,monospace;color:#9c9e9e;background-color:#3b3e3f!important}.CodeMirror-hints.darcula .CodeMirror-hint-active{background-color:#494d4e!important;color:#9c9e9e!important} diff --git a/dist/codemirror.js b/dist/codemirror.js new file mode 100644 index 0000000..9c93500 --- /dev/null +++ b/dist/codemirror.js @@ -0,0 +1,52 @@ +(()=>{var Qm=Object.create;var dc=Object.defineProperty;var $m=Object.getOwnPropertyDescriptor;var Vm=Object.getOwnPropertyNames;var e0=Object.getPrototypeOf,t0=Object.prototype.hasOwnProperty;var Ut=(t,r)=>()=>(r||t((r={exports:{}}).exports,r),r.exports);var r0=(t,r,n,l)=>{if(r&&typeof r=="object"||typeof r=="function")for(let a of Vm(r))!t0.call(t,a)&&a!==n&&dc(t,a,{get:()=>r[a],enumerable:!(l=$m(r,a))||l.enumerable});return t};var _t=(t,r,n)=>(n=t!=null?Qm(e0(t)):{},r0(r||!t||!t.__esModule?dc(n,"default",{value:t,enumerable:!0}):n,t));var Ht=Ut((au,fu)=>{(function(t,r){typeof au=="object"&&typeof fu<"u"?fu.exports=r():typeof define=="function"&&define.amd?define(r):(t=t||self,t.CodeMirror=r())})(au,function(){"use strict";var t=navigator.userAgent,r=navigator.platform,n=/gecko\/\d/i.test(t),l=/MSIE \d/.test(t),a=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(t),u=/Edge\/(\d+)/.exec(t),d=l||a||u,c=d&&(l?document.documentMode||6:+(u||a)[1]),g=!u&&/WebKit\//.test(t),m=g&&/Qt\/\d+\.\d+/.test(t),x=!u&&/Chrome\/(\d+)/.exec(t),S=x&&+x[1],k=/Opera\//.test(t),A=/Apple Computer/.test(navigator.vendor),T=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(t),L=/PhantomJS/.test(t),C=A&&(/Mobile\/\w+/.test(t)||navigator.maxTouchPoints>2),M=/Android/.test(t),D=C||M||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(t),E=C||/Mac/.test(r),B=/\bCrOS\b/.test(t),K=/win/i.test(r),X=k&&t.match(/Version\/(\d*\.\d*)/);X&&(X=Number(X[1])),X&&X>=15&&(k=!1,g=!0);var ee=E&&(m||k&&(X==null||X<12.11)),we=n||d&&c>=9;function he(e){return new RegExp("(^|\\s)"+e+"(?:$|\\s)\\s*")}var ke=function(e,i){var s=e.className,o=he(i).exec(s);if(o){var f=s.slice(o.index+o[0].length);e.className=s.slice(0,o.index)+(f?o[1]+f:"")}};function z(e){for(var i=e.childNodes.length;i>0;--i)e.removeChild(e.firstChild);return e}function Y(e,i){return z(e).appendChild(i)}function W(e,i,s,o){var f=document.createElement(e);if(s&&(f.className=s),o&&(f.style.cssText=o),typeof i=="string")f.appendChild(document.createTextNode(i));else if(i)for(var h=0;h=i)return p+(i-h);p+=v-h,p+=s-p%s,h=v+1}}var _r=function(){this.id=null,this.f=null,this.time=0,this.handler=ue(this.onTimeout,this)};_r.prototype.onTimeout=function(e){e.id=0,e.time<=+new Date?e.f():setTimeout(e.handler,e.time-+new Date)},_r.prototype.set=function(e,i){this.f=i;var s=+new Date+e;(!this.id||s=i)return o+Math.min(p,i-f);if(f+=h-o,f+=s-f%s,o=h+1,f>=i)return o}}var si=[""];function Vl(e){for(;si.length<=e;)si.push(Le(si)+" ");return si[e]}function Le(e){return e[e.length-1]}function sn(e,i){for(var s=[],o=0;o"\x80"&&(e.toUpperCase()!=e.toLowerCase()||hf.test(e))}function ai(e,i){return i?i.source.indexOf("\\w")>-1&&eo(e)?!0:i.test(e):eo(e)}function vs(e){for(var i in e)if(e.hasOwnProperty(i)&&e[i])return!1;return!0}var fi=/[\u0300-\u036f\u0483-\u0489\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u065e\u0670\u06d6-\u06dc\u06de-\u06e4\u06e7\u06e8\u06ea-\u06ed\u0711\u0730-\u074a\u07a6-\u07b0\u07eb-\u07f3\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0900-\u0902\u093c\u0941-\u0948\u094d\u0951-\u0955\u0962\u0963\u0981\u09bc\u09be\u09c1-\u09c4\u09cd\u09d7\u09e2\u09e3\u0a01\u0a02\u0a3c\u0a41\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a70\u0a71\u0a75\u0a81\u0a82\u0abc\u0ac1-\u0ac5\u0ac7\u0ac8\u0acd\u0ae2\u0ae3\u0b01\u0b3c\u0b3e\u0b3f\u0b41-\u0b44\u0b4d\u0b56\u0b57\u0b62\u0b63\u0b82\u0bbe\u0bc0\u0bcd\u0bd7\u0c3e-\u0c40\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0cbc\u0cbf\u0cc2\u0cc6\u0ccc\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0d3e\u0d41-\u0d44\u0d4d\u0d57\u0d62\u0d63\u0dca\u0dcf\u0dd2-\u0dd4\u0dd6\u0ddf\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0eb1\u0eb4-\u0eb9\u0ebb\u0ebc\u0ec8-\u0ecd\u0f18\u0f19\u0f35\u0f37\u0f39\u0f71-\u0f7e\u0f80-\u0f84\u0f86\u0f87\u0f90-\u0f97\u0f99-\u0fbc\u0fc6\u102d-\u1030\u1032-\u1037\u1039\u103a\u103d\u103e\u1058\u1059\u105e-\u1060\u1071-\u1074\u1082\u1085\u1086\u108d\u109d\u135f\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17b7-\u17bd\u17c6\u17c9-\u17d3\u17dd\u180b-\u180d\u18a9\u1920-\u1922\u1927\u1928\u1932\u1939-\u193b\u1a17\u1a18\u1a56\u1a58-\u1a5e\u1a60\u1a62\u1a65-\u1a6c\u1a73-\u1a7c\u1a7f\u1b00-\u1b03\u1b34\u1b36-\u1b3a\u1b3c\u1b42\u1b6b-\u1b73\u1b80\u1b81\u1ba2-\u1ba5\u1ba8\u1ba9\u1c2c-\u1c33\u1c36\u1c37\u1cd0-\u1cd2\u1cd4-\u1ce0\u1ce2-\u1ce8\u1ced\u1dc0-\u1de6\u1dfd-\u1dff\u200c\u200d\u20d0-\u20f0\u2cef-\u2cf1\u2de0-\u2dff\u302a-\u302f\u3099\u309a\ua66f-\ua672\ua67c\ua67d\ua6f0\ua6f1\ua802\ua806\ua80b\ua825\ua826\ua8c4\ua8e0-\ua8f1\ua926-\ua92d\ua947-\ua951\ua980-\ua982\ua9b3\ua9b6-\ua9b9\ua9bc\uaa29-\uaa2e\uaa31\uaa32\uaa35\uaa36\uaa43\uaa4c\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uabe5\uabe8\uabed\udc00-\udfff\ufb1e\ufe00-\ufe0f\ufe20-\ufe26\uff9e\uff9f]/;function rt(e){return e.charCodeAt(0)>=768&&fi.test(e)}function Hi(e,i,s){for(;(s<0?i>0:is?-1:1;;){if(i==s)return i;var f=(i+s)/2,h=o<0?Math.ceil(f):Math.floor(f);if(h==i)return e(h)?i:s;e(h)?s=h:i=h+o}}function Wi(e,i,s,o){if(!e)return o(i,s,"ltr",0);for(var f=!1,h=0;hi||i==s&&p.to==i)&&(o(Math.max(p.from,i),Math.min(p.to,s),p.level==1?"rtl":"ltr",h),f=!0)}f||o(i,s,"ltr")}var an=null;function Pi(e,i,s){var o;an=null;for(var f=0;fi)return f;h.to==i&&(h.from!=h.to&&s=="before"?o=f:an=f),h.from==i&&(h.from!=h.to&&s!="before"?o=f:an=f)}return o??an}var df=function(){var e="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN",i="nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111";function s(b){return b<=247?e.charAt(b):1424<=b&&b<=1524?"R":1536<=b&&b<=1785?i.charAt(b-1536):1774<=b&&b<=2220?"r":8192<=b&&b<=8203?"w":b==8204?"b":"L"}var o=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,f=/[stwN]/,h=/[LRr]/,p=/[Lb1n]/,v=/[1n]/;function y(b,O,H){this.level=b,this.from=O,this.to=H}return function(b,O){var H=O=="ltr"?"L":"R";if(b.length==0||O=="ltr"&&!o.test(b))return!1;for(var F=b.length,P=[],R=0;R-1&&(o[i]=f.slice(0,h).concat(f.slice(h+1)))}}}function je(e,i){var s=ui(e,i);if(s.length)for(var o=Array.prototype.slice.call(arguments,2),f=0;f0}function Lr(e){e.prototype.on=function(i,s){ae(this,i,s)},e.prototype.off=function(i,s){wt(this,i,s)}}function Ct(e){e.preventDefault?e.preventDefault():e.returnValue=!1}function Un(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0}function Ft(e){return e.defaultPrevented!=null?e.defaultPrevented:e.returnValue==!1}function Fi(e){Ct(e),Un(e)}function to(e){return e.target||e.srcElement}function Tr(e){var i=e.which;return i==null&&(e.button&1?i=1:e.button&2?i=3:e.button&4&&(i=2)),E&&e.ctrlKey&&i==1&&(i=3),i}var cf=function(){if(d&&c<9)return!1;var e=W("div");return"draggable"in e||"dragDrop"in e}(),_n;function ys(e){if(_n==null){var i=W("span","\u200B");Y(e,W("span",[i,document.createTextNode("x")])),e.firstChild.offsetHeight!=0&&(_n=i.offsetWidth<=1&&i.offsetHeight>2&&!(d&&c<8))}var s=_n?W("span","\u200B"):W("span","\xA0",null,"display: inline-block; width: 1px; margin-right: -1px");return s.setAttribute("cm-text",""),s}var ro;function Ei(e){if(ro!=null)return ro;var i=Y(e,document.createTextNode("A\u062EA")),s=Qe(i,0,1).getBoundingClientRect(),o=Qe(i,1,2).getBoundingClientRect();return z(e),!s||s.left==s.right?!1:ro=o.right-s.right<3}var cr=` + +b`.split(/\n/).length!=3?function(e){for(var i=0,s=[],o=e.length;i<=o;){var f=e.indexOf(` +`,i);f==-1&&(f=e.length);var h=e.slice(i,e.charAt(f-1)=="\r"?f-1:f),p=h.indexOf("\r");p!=-1?(s.push(h.slice(0,p)),i+=p+1):(s.push(h),i=f+1)}return s}:function(e){return e.split(/\r\n?|\n/)},Ii=window.getSelection?function(e){try{return e.selectionStart!=e.selectionEnd}catch{return!1}}:function(e){var i;try{i=e.ownerDocument.selection.createRange()}catch{}return!i||i.parentElement()!=e?!1:i.compareEndPoints("StartToEnd",i)!=0},xs=function(){var e=W("div");return"oncopy"in e?!0:(e.setAttribute("oncopy","return;"),typeof e.oncopy=="function")}(),Mr=null;function pf(e){if(Mr!=null)return Mr;var i=Y(e,W("span","x")),s=i.getBoundingClientRect(),o=Qe(i,0,1).getBoundingClientRect();return Mr=Math.abs(s.left-o.left)>1}var Kn={},Ar={};function Or(e,i){arguments.length>2&&(i.dependencies=Array.prototype.slice.call(arguments,2)),Kn[e]=i}function fn(e,i){Ar[e]=i}function Xn(e){if(typeof e=="string"&&Ar.hasOwnProperty(e))e=Ar[e];else if(e&&typeof e.name=="string"&&Ar.hasOwnProperty(e.name)){var i=Ar[e.name];typeof i=="string"&&(i={name:i}),e=gs(i,e),e.name=i.name}else{if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+xml$/.test(e))return Xn("application/xml");if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+json$/.test(e))return Xn("application/json")}return typeof e=="string"?{name:e}:e||{name:"null"}}function jn(e,i){i=Xn(i);var s=Kn[i.name];if(!s)return jn(e,"text/plain");var o=s(e,i);if(Bi.hasOwnProperty(i.name)){var f=Bi[i.name];for(var h in f)f.hasOwnProperty(h)&&(o.hasOwnProperty(h)&&(o["_"+h]=o[h]),o[h]=f[h])}if(o.name=i.name,i.helperType&&(o.helperType=i.helperType),i.modeProps)for(var p in i.modeProps)o[p]=i.modeProps[p];return o}var Bi={};function qn(e,i){var s=Bi.hasOwnProperty(e)?Bi[e]:Bi[e]={};ye(i,s)}function qr(e,i){if(i===!0)return i;if(e.copyState)return e.copyState(i);var s={};for(var o in i){var f=i[o];f instanceof Array&&(f=f.concat([])),s[o]=f}return s}function io(e,i){for(var s;e.innerMode&&(s=e.innerMode(i),!(!s||s.mode==e));)i=s.state,e=s.mode;return s||{mode:e,state:i}}function Yn(e,i,s){return e.startState?e.startState(i,s):!0}var Ye=function(e,i,s){this.pos=this.start=0,this.string=e,this.tabSize=i||8,this.lastColumnPos=this.lastColumnValue=0,this.lineStart=0,this.lineOracle=s};Ye.prototype.eol=function(){return this.pos>=this.string.length},Ye.prototype.sol=function(){return this.pos==this.lineStart},Ye.prototype.peek=function(){return this.string.charAt(this.pos)||void 0},Ye.prototype.next=function(){if(this.posi},Ye.prototype.eatSpace=function(){for(var e=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e},Ye.prototype.skipToEnd=function(){this.pos=this.string.length},Ye.prototype.skipTo=function(e){var i=this.string.indexOf(e,this.pos);if(i>-1)return this.pos=i,!0},Ye.prototype.backUp=function(e){this.pos-=e},Ye.prototype.column=function(){return this.lastColumnPos0?null:(h&&i!==!1&&(this.pos+=h[0].length),h)}},Ye.prototype.current=function(){return this.string.slice(this.start,this.pos)},Ye.prototype.hideFirstChars=function(e,i){this.lineStart+=e;try{return i()}finally{this.lineStart-=e}},Ye.prototype.lookAhead=function(e){var i=this.lineOracle;return i&&i.lookAhead(e)},Ye.prototype.baseToken=function(){var e=this.lineOracle;return e&&e.baseToken(this.pos)};function ie(e,i){if(i-=e.first,i<0||i>=e.size)throw new Error("There is no line "+(i+e.first)+" in the document.");for(var s=e;!s.lines;)for(var o=0;;++o){var f=s.children[o],h=f.chunkSize();if(i=e.first&&is?I(s,ie(e,s).text.length):$g(i,ie(e,i.line).text.length)}function $g(e,i){var s=e.ch;return s==null||s>i?I(e.line,i):s<0?I(e.line,0):e}function ph(e,i){for(var s=[],o=0;othis.maxLookAhead&&(this.maxLookAhead=e),i},Yr.prototype.baseToken=function(e){if(!this.baseTokens)return null;for(;this.baseTokens[this.baseTokenPos]<=e;)this.baseTokenPos+=2;var i=this.baseTokens[this.baseTokenPos+1];return{type:i&&i.replace(/( |^)overlay .*/,""),size:this.baseTokens[this.baseTokenPos]-e}},Yr.prototype.nextLine=function(){this.line++,this.maxLookAhead>0&&this.maxLookAhead--},Yr.fromSaved=function(e,i,s){return i instanceof bs?new Yr(e,qr(e.mode,i.state),s,i.lookAhead):new Yr(e,qr(e.mode,i),s)},Yr.prototype.save=function(e){var i=e!==!1?qr(this.doc.mode,this.state):this.state;return this.maxLookAhead>0?new bs(i,this.maxLookAhead):i};function gh(e,i,s,o){var f=[e.state.modeGen],h={};wh(e,i.text,e.doc.mode,s,function(b,O){return f.push(b,O)},h,o);for(var p=s.state,v=function(b){s.baseTokens=f;var O=e.state.overlays[b],H=1,F=0;s.state=!0,wh(e,i.text,O.mode,s,function(P,R){for(var _=H;FP&&f.splice(H,1,P,f[H+1],q),H+=2,F=Math.min(P,q)}if(R)if(O.opaque)f.splice(_,H-_,P,"overlay "+R),H=_+2;else for(;_e.options.maxHighlightLength&&qr(e.doc.mode,o.state),h=gh(e,i,o);f&&(o.state=f),i.stateAfter=o.save(!f),i.styles=h.styles,h.classes?i.styleClasses=h.classes:i.styleClasses&&(i.styleClasses=null),s===e.doc.highlightFrontier&&(e.doc.modeFrontier=Math.max(e.doc.modeFrontier,++e.doc.highlightFrontier))}return i.styles}function lo(e,i,s){var o=e.doc,f=e.display;if(!o.mode.startState)return new Yr(o,!0,i);var h=Vg(e,i,s),p=h>o.first&&ie(o,h-1).stateAfter,v=p?Yr.fromSaved(o,p,h):new Yr(o,Yn(o.mode),h);return o.iter(h,i,function(y){gf(e,y.text,v);var b=v.line;y.stateAfter=b==i-1||b%5==0||b>=f.viewFrom&&bi.start)return h}throw new Error("Mode "+e.name+" failed to advance stream.")}var yh=function(e,i,s){this.start=e.start,this.end=e.pos,this.string=e.current(),this.type=i||null,this.state=s};function xh(e,i,s,o){var f=e.doc,h=f.mode,p;i=ce(f,i);var v=ie(f,i.line),y=lo(e,i.line,s),b=new Ye(v.text,e.options.tabSize,y),O;for(o&&(O=[]);(o||b.pose.options.maxHighlightLength?(v=!1,p&&gf(e,i,o,O.pos),O.pos=i.length,H=null):H=bh(vf(s,O,o.state,F),h),F){var P=F[0].name;P&&(H="m-"+(H?P+" "+H:P))}if(!v||b!=H){for(;yp;--v){if(v<=h.first)return h.first;var y=ie(h,v-1),b=y.stateAfter;if(b&&(!s||v+(b instanceof bs?b.lookAhead:0)<=h.modeFrontier))return v;var O=Oe(y.text,null,e.options.tabSize);(f==null||o>O)&&(f=v-1,o=O)}return f}function ev(e,i){if(e.modeFrontier=Math.min(e.modeFrontier,i),!(e.highlightFrontiers;o--){var f=ie(e,o).stateAfter;if(f&&(!(f instanceof bs)||o+f.lookAhead=i:h.to>i);(o||(o=[])).push(new ws(p,h.from,y?null:h.to))}}return o}function ov(e,i,s){var o;if(e)for(var f=0;f=i:h.to>i);if(v||h.from==i&&p.type=="bookmark"&&(!s||h.marker.insertLeft)){var y=h.from==null||(p.inclusiveLeft?h.from<=i:h.from0&&v)for(var te=0;te0)){var O=[y,1],H=Q(b.from,v.from),F=Q(b.to,v.to);(H<0||!p.inclusiveLeft&&!H)&&O.push({from:b.from,to:v.from}),(F>0||!p.inclusiveRight&&!F)&&O.push({from:v.to,to:b.to}),f.splice.apply(f,O),y+=O.length-3}}return f}function kh(e){var i=e.markedSpans;if(i){for(var s=0;si)&&(!o||yf(o,h.marker)<0)&&(o=h.marker)}return o}function Ah(e,i,s,o,f){var h=ie(e,i),p=di&&h.markedSpans;if(p)for(var v=0;v=0&&H<=0||O<=0&&H>=0)&&(O<=0&&(y.marker.inclusiveRight&&f.inclusiveLeft?Q(b.to,s)>=0:Q(b.to,s)>0)||O>=0&&(y.marker.inclusiveRight&&f.inclusiveLeft?Q(b.from,o)<=0:Q(b.from,o)<0)))return!0}}}function Dr(e){for(var i;i=Mh(e);)e=i.find(-1,!0).line;return e}function fv(e){for(var i;i=ks(e);)e=i.find(1,!0).line;return e}function uv(e){for(var i,s;i=ks(e);)e=i.find(1,!0).line,(s||(s=[])).push(e);return s}function xf(e,i){var s=ie(e,i),o=Dr(s);return s==o?i:w(o)}function Oh(e,i){if(i>e.lastLine())return i;var s=ie(e,i),o;if(!Ri(e,s))return i;for(;o=ks(s);)s=o.find(1,!0).line;return w(s)+1}function Ri(e,i){var s=di&&i.markedSpans;if(s){for(var o=void 0,f=0;fi.maxLineLength&&(i.maxLineLength=f,i.maxLine=o)})}var Jn=function(e,i,s){this.text=e,Lh(this,i),this.height=s?s(this):1};Jn.prototype.lineNo=function(){return w(this)},Lr(Jn);function hv(e,i,s,o){e.text=i,e.stateAfter&&(e.stateAfter=null),e.styles&&(e.styles=null),e.order!=null&&(e.order=null),kh(e),Lh(e,s);var f=o?o(e):1;f!=e.height&&sr(e,f)}function dv(e){e.parent=null,kh(e)}var cv={},pv={};function Dh(e,i){if(!e||/^\s*$/.test(e))return null;var s=i.addModeClass?pv:cv;return s[e]||(s[e]=e.replace(/\S+/g,"cm-$&"))}function Nh(e,i){var s=De("span",null,null,g?"padding-right: .1px":null),o={pre:De("pre",[s],"CodeMirror-line"),content:s,col:0,pos:0,cm:e,trailingSpace:!1,splitSpaces:e.getOption("lineWrapping")};i.measure={};for(var f=0;f<=(i.rest?i.rest.length:0);f++){var h=f?i.rest[f-1]:i.line,p=void 0;o.pos=0,o.addToken=vv,Ei(e.display.measure)&&(p=Ce(h,e.doc.direction))&&(o.addToken=yv(o.addToken,p)),o.map=[];var v=i!=e.display.externalMeasured&&w(h);xv(h,o,vh(e,h,v)),h.styleClasses&&(h.styleClasses.bgClass&&(o.bgClass=Be(h.styleClasses.bgClass,o.bgClass||"")),h.styleClasses.textClass&&(o.textClass=Be(h.styleClasses.textClass,o.textClass||""))),o.map.length==0&&o.map.push(0,0,o.content.appendChild(ys(e.display.measure))),f==0?(i.measure.map=o.map,i.measure.cache={}):((i.measure.maps||(i.measure.maps=[])).push(o.map),(i.measure.caches||(i.measure.caches=[])).push({}))}if(g){var y=o.content.lastChild;(/\bcm-tab\b/.test(y.className)||y.querySelector&&y.querySelector(".cm-tab"))&&(o.content.className="cm-tab-wrap-hack")}return je(e,"renderLine",e,i.line,o.pre),o.pre.className&&(o.textClass=Be(o.pre.className,o.textClass||"")),o}function gv(e){var i=W("span","\u2022","cm-invalidchar");return i.title="\\u"+e.charCodeAt(0).toString(16),i.setAttribute("aria-label",i.title),i}function vv(e,i,s,o,f,h,p){if(i){var v=e.splitSpaces?mv(i,e.trailingSpace):i,y=e.cm.state.specialChars,b=!1,O;if(!y.test(i))e.col+=i.length,O=document.createTextNode(v),e.map.push(e.pos,e.pos+i.length,O),d&&c<9&&(b=!0),e.pos+=i.length;else{O=document.createDocumentFragment();for(var H=0;;){y.lastIndex=H;var F=y.exec(i),P=F?F.index-H:i.length-H;if(P){var R=document.createTextNode(v.slice(H,H+P));d&&c<9?O.appendChild(W("span",[R])):O.appendChild(R),e.map.push(e.pos,e.pos+P,R),e.col+=P,e.pos+=P}if(!F)break;H+=P+1;var _=void 0;if(F[0]==" "){var q=e.cm.options.tabSize,Z=q-e.col%q;_=O.appendChild(W("span",Vl(Z),"cm-tab")),_.setAttribute("role","presentation"),_.setAttribute("cm-text"," "),e.col+=Z}else F[0]=="\r"||F[0]==` +`?(_=O.appendChild(W("span",F[0]=="\r"?"\u240D":"\u2424","cm-invalidchar")),_.setAttribute("cm-text",F[0]),e.col+=1):(_=e.cm.options.specialCharPlaceholder(F[0]),_.setAttribute("cm-text",F[0]),d&&c<9?O.appendChild(W("span",[_])):O.appendChild(_),e.col+=1);e.map.push(e.pos,e.pos+1,_),e.pos++}}if(e.trailingSpace=v.charCodeAt(i.length-1)==32,s||o||f||b||h||p){var $=s||"";o&&($+=o),f&&($+=f);var J=W("span",[O],$,h);if(p)for(var te in p)p.hasOwnProperty(te)&&te!="style"&&te!="class"&&J.setAttribute(te,p[te]);return e.content.appendChild(J)}e.content.appendChild(O)}}function mv(e,i){if(e.length>1&&!/ /.test(e))return e;for(var s=i,o="",f=0;fb&&H.from<=b));F++);if(H.to>=O)return e(s,o,f,h,p,v,y);e(s,o.slice(0,H.to-b),f,h,null,v,y),h=null,o=o.slice(H.to-b),b=H.to}}}function Hh(e,i,s,o){var f=!o&&s.widgetNode;f&&e.map.push(e.pos,e.pos+i,f),!o&&e.cm.display.input.needsContentAttribute&&(f||(f=e.content.appendChild(document.createElement("span"))),f.setAttribute("cm-marker",s.id)),f&&(e.cm.display.input.setUneditable(f),e.content.appendChild(f)),e.pos+=i,e.trailingSpace=!1}function xv(e,i,s){var o=e.markedSpans,f=e.text,h=0;if(!o){for(var p=1;py||me.collapsed&&le.to==y&&le.from==y)){if(le.to!=null&&le.to!=y&&P>le.to&&(P=le.to,_=""),me.className&&(R+=" "+me.className),me.css&&(F=(F?F+";":"")+me.css),me.startStyle&&le.from==y&&(q+=" "+me.startStyle),me.endStyle&&le.to==P&&(te||(te=[])).push(me.endStyle,le.to),me.title&&(($||($={})).title=me.title),me.attributes)for(var Pe in me.attributes)($||($={}))[Pe]=me.attributes[Pe];me.collapsed&&(!Z||yf(Z.marker,me)<0)&&(Z=le)}else le.from>y&&P>le.from&&(P=le.from)}if(te)for(var pt=0;pt=v)break;for(var Qt=Math.min(v,P);;){if(O){var Rt=y+O.length;if(!Z){var it=Rt>Qt?O.slice(0,Qt-y):O;i.addToken(i,it,H?H+R:R,q,y+it.length==P?_:"",F,$)}if(Rt>=Qt){O=O.slice(Qt-y),y=Qt;break}y=Rt,q=""}O=f.slice(h,h=s[b++]),H=Dh(s[b++],i.cm.options)}}}function Wh(e,i,s){this.line=i,this.rest=uv(i),this.size=this.rest?w(Le(this.rest))-s+1:1,this.node=this.text=null,this.hidden=Ri(e,i)}function Ts(e,i,s){for(var o=[],f,h=i;h2&&h.push((y.bottom+b.top)/2-s.top)}}h.push(s.bottom-s.top)}}function zh(e,i,s){if(e.line==i)return{map:e.measure.map,cache:e.measure.cache};if(e.rest){for(var o=0;os)return{map:e.measure.maps[f],cache:e.measure.caches[f],before:!0}}}function Dv(e,i){i=Dr(i);var s=w(i),o=e.display.externalMeasured=new Wh(e.doc,i,s);o.lineN=s;var f=o.built=Nh(e,o);return o.text=f.pre,Y(e.display.lineMeasure,f.pre),o}function Gh(e,i,s,o){return Jr(e,$n(e,i),s,o)}function Lf(e,i){if(i>=e.display.viewFrom&&i=s.lineN&&ii)&&(h=y-v,f=h-1,i>=y&&(p="right")),f!=null){if(o=e[b+2],v==y&&s==(o.insertLeft?"left":"right")&&(p=s),s=="left"&&f==0)for(;b&&e[b-2]==e[b-3]&&e[b-1].insertLeft;)o=e[(b-=3)+2],p="left";if(s=="right"&&f==y-v)for(;b=0&&(s=e[f]).left==s.right;f--);return s}function Hv(e,i,s,o){var f=_h(i.map,s,o),h=f.node,p=f.start,v=f.end,y=f.collapse,b;if(h.nodeType==3){for(var O=0;O<4;O++){for(;p&&rt(i.line.text.charAt(f.coverStart+p));)--p;for(;f.coverStart+v0&&(y=o="right");var H;e.options.lineWrapping&&(H=h.getClientRects()).length>1?b=H[o=="right"?H.length-1:0]:b=h.getBoundingClientRect()}if(d&&c<9&&!p&&(!b||!b.left&&!b.right)){var F=h.parentNode.getClientRects()[0];F?b={left:F.left,right:F.left+el(e.display),top:F.top,bottom:F.bottom}:b=Uh}for(var P=b.top-i.rect.top,R=b.bottom-i.rect.top,_=(P+R)/2,q=i.view.measure.heights,Z=0;Z=o.text.length?(y=o.text.length,b="before"):y<=0&&(y=0,b="after"),!v)return p(b=="before"?y-1:y,b=="before");function O(R,_,q){var Z=v[_],$=Z.level==1;return p(q?R-1:R,$!=q)}var H=Pi(v,y,b),F=an,P=O(y,H,b=="before");return F!=null&&(P.other=O(y,F,b!="before")),P}function Zh(e,i){var s=0;i=ce(e.doc,i),e.options.lineWrapping||(s=el(e.display)*i.ch);var o=ie(e.doc,i.line),f=ci(o)+Ms(e.display);return{left:s,right:s,top:f,bottom:f+o.height}}function Mf(e,i,s,o,f){var h=I(e,i,s);return h.xRel=f,o&&(h.outside=o),h}function Af(e,i,s){var o=e.doc;if(s+=e.display.viewOffset,s<0)return Mf(o.first,0,null,-1,-1);var f=N(o,s),h=o.first+o.size-1;if(f>h)return Mf(o.first+o.size-1,ie(o,h).text.length,null,1,1);i<0&&(i=0);for(var p=ie(o,f);;){var v=Pv(e,p,f,i,s),y=av(p,v.ch+(v.xRel>0||v.outside>0?1:0));if(!y)return v;var b=y.find(1);if(b.line==f)return b;p=ie(o,f=b.line)}}function Jh(e,i,s,o){o-=Tf(i);var f=i.text.length,h=jr(function(p){return Jr(e,s,p-1).bottom<=o},f,0);return f=jr(function(p){return Jr(e,s,p).top>o},h,f),{begin:h,end:f}}function Qh(e,i,s,o){s||(s=$n(e,i));var f=As(e,i,Jr(e,s,o),"line").top;return Jh(e,i,s,f)}function Of(e,i,s,o){return e.bottom<=s?!1:e.top>s?!0:(o?e.left:e.right)>i}function Pv(e,i,s,o,f){f-=ci(i);var h=$n(e,i),p=Tf(i),v=0,y=i.text.length,b=!0,O=Ce(i,e.doc.direction);if(O){var H=(e.options.lineWrapping?Ev:Fv)(e,i,s,h,O,o,f);b=H.level!=1,v=b?H.from:H.to-1,y=b?H.to:H.from-1}var F=null,P=null,R=jr(function(fe){var le=Jr(e,h,fe);return le.top+=p,le.bottom+=p,Of(le,o,f,!1)?(le.top<=f&&le.left<=o&&(F=fe,P=le),!0):!1},v,y),_,q,Z=!1;if(P){var $=o-P.left=te.bottom?1:0}return R=Hi(i.text,R,1),Mf(s,R,q,Z,o-_)}function Fv(e,i,s,o,f,h,p){var v=jr(function(H){var F=f[H],P=F.level!=1;return Of(Nr(e,I(s,P?F.to:F.from,P?"before":"after"),"line",i,o),h,p,!0)},0,f.length-1),y=f[v];if(v>0){var b=y.level!=1,O=Nr(e,I(s,b?y.from:y.to,b?"after":"before"),"line",i,o);Of(O,h,p,!0)&&O.top>p&&(y=f[v-1])}return y}function Ev(e,i,s,o,f,h,p){var v=Jh(e,i,o,p),y=v.begin,b=v.end;/\s/.test(i.text.charAt(b-1))&&b--;for(var O=null,H=null,F=0;F=b||P.to<=y)){var R=P.level!=1,_=Jr(e,o,R?Math.min(b,P.to)-1:Math.max(y,P.from)).right,q=_q)&&(O=P,H=q)}}return O||(O=f[f.length-1]),O.fromb&&(O={from:O.from,to:b,level:O.level}),O}var hn;function Vn(e){if(e.cachedTextHeight!=null)return e.cachedTextHeight;if(hn==null){hn=W("pre",null,"CodeMirror-line-like");for(var i=0;i<49;++i)hn.appendChild(document.createTextNode("x")),hn.appendChild(W("br"));hn.appendChild(document.createTextNode("x"))}Y(e.measure,hn);var s=hn.offsetHeight/50;return s>3&&(e.cachedTextHeight=s),z(e.measure),s||1}function el(e){if(e.cachedCharWidth!=null)return e.cachedCharWidth;var i=W("span","xxxxxxxxxx"),s=W("pre",[i],"CodeMirror-line-like");Y(e.measure,s);var o=i.getBoundingClientRect(),f=(o.right-o.left)/10;return f>2&&(e.cachedCharWidth=f),f||10}function Df(e){for(var i=e.display,s={},o={},f=i.gutters.clientLeft,h=i.gutters.firstChild,p=0;h;h=h.nextSibling,++p){var v=e.display.gutterSpecs[p].className;s[v]=h.offsetLeft+h.clientLeft+f,o[v]=h.clientWidth}return{fixedPos:Nf(i),gutterTotalWidth:i.gutters.offsetWidth,gutterLeft:s,gutterWidth:o,wrapperWidth:i.wrapper.clientWidth}}function Nf(e){return e.scroller.getBoundingClientRect().left-e.sizer.getBoundingClientRect().left}function $h(e){var i=Vn(e.display),s=e.options.lineWrapping,o=s&&Math.max(5,e.display.scroller.clientWidth/el(e.display)-3);return function(f){if(Ri(e.doc,f))return 0;var h=0;if(f.widgets)for(var p=0;p0&&(b=ie(e.doc,y.line).text).length==y.ch){var O=Oe(b,b.length,e.options.tabSize)-b.length;y=I(y.line,Math.max(0,Math.round((h-Rh(e.display).left)/el(e.display))-O))}return y}function cn(e,i){if(i>=e.display.viewTo||(i-=e.display.viewFrom,i<0))return null;for(var s=e.display.view,o=0;oi)&&(f.updateLineNumbers=i),e.curOp.viewChanged=!0,i>=f.viewTo)di&&xf(e.doc,i)f.viewFrom?Gi(e):(f.viewFrom+=o,f.viewTo+=o);else if(i<=f.viewFrom&&s>=f.viewTo)Gi(e);else if(i<=f.viewFrom){var h=Ds(e,s,s+o,1);h?(f.view=f.view.slice(h.index),f.viewFrom=h.lineN,f.viewTo+=o):Gi(e)}else if(s>=f.viewTo){var p=Ds(e,i,i,-1);p?(f.view=f.view.slice(0,p.index),f.viewTo=p.lineN):Gi(e)}else{var v=Ds(e,i,i,-1),y=Ds(e,s,s+o,1);v&&y?(f.view=f.view.slice(0,v.index).concat(Ts(e,v.lineN,y.lineN)).concat(f.view.slice(y.index)),f.viewTo+=o):Gi(e)}var b=f.externalMeasured;b&&(s=f.lineN&&i=o.viewTo)){var h=o.view[cn(e,i)];if(h.node!=null){var p=h.changes||(h.changes=[]);ve(p,s)==-1&&p.push(s)}}}function Gi(e){e.display.viewFrom=e.display.viewTo=e.doc.first,e.display.view=[],e.display.viewOffset=0}function Ds(e,i,s,o){var f=cn(e,i),h,p=e.display.view;if(!di||s==e.doc.first+e.doc.size)return{index:f,lineN:s};for(var v=e.display.viewFrom,y=0;y0){if(f==p.length-1)return null;h=v+p[f].size-i,f++}else h=v-i;i+=h,s+=h}for(;xf(e.doc,s)!=s;){if(f==(o<0?0:p.length-1))return null;s+=o*p[f-(o<0?1:0)].size,f+=o}return{index:f,lineN:s}}function Iv(e,i,s){var o=e.display,f=o.view;f.length==0||i>=o.viewTo||s<=o.viewFrom?(o.view=Ts(e,i,s),o.viewFrom=i):(o.viewFrom>i?o.view=Ts(e,i,o.viewFrom).concat(o.view):o.viewFroms&&(o.view=o.view.slice(0,cn(e,s)))),o.viewTo=s}function Vh(e){for(var i=e.display.view,s=0,o=0;o=e.display.viewTo||y.to().line0?p:e.defaultCharWidth())+"px"}if(o.other){var v=s.appendChild(W("div","\xA0","CodeMirror-cursor CodeMirror-secondarycursor"));v.style.display="",v.style.left=o.other.left+"px",v.style.top=o.other.top+"px",v.style.height=(o.other.bottom-o.other.top)*.85+"px"}}function Ns(e,i){return e.top-i.top||e.left-i.left}function Bv(e,i,s){var o=e.display,f=e.doc,h=document.createDocumentFragment(),p=Rh(e.display),v=p.left,y=Math.max(o.sizerWidth,un(e)-o.sizer.offsetLeft)-p.right,b=f.direction=="ltr";function O(J,te,fe,le){te<0&&(te=0),te=Math.round(te),le=Math.round(le),h.appendChild(W("div",null,"CodeMirror-selected","position: absolute; left: "+J+`px; + top: `+te+"px; width: "+(fe??y-J)+`px; + height: `+(le-te)+"px"))}function H(J,te,fe){var le=ie(f,J),me=le.text.length,Pe,pt;function Ke(it,zt){return Os(e,I(J,it),"div",le,zt)}function Qt(it,zt,xt){var lt=Qh(e,le,null,it),nt=zt=="ltr"==(xt=="after")?"left":"right",Ze=xt=="after"?lt.begin:lt.end-(/\s/.test(le.text.charAt(lt.end-1))?2:1);return Ke(Ze,nt)[nt]}var Rt=Ce(le,f.direction);return Wi(Rt,te||0,fe??me,function(it,zt,xt,lt){var nt=xt=="ltr",Ze=Ke(it,nt?"left":"right"),Gt=Ke(zt-1,nt?"right":"left"),cl=te==null&&it==0,qi=fe==null&&zt==me,kt=lt==0,Qr=!Rt||lt==Rt.length-1;if(Gt.top-Ze.top<=3){var gt=(b?cl:qi)&&kt,ou=(b?qi:cl)&&Qr,mi=gt?v:(nt?Ze:Gt).left,yn=ou?y:(nt?Gt:Ze).right;O(mi,Ze.top,yn-mi,Ze.bottom)}else{var xn,Nt,pl,su;nt?(xn=b&&cl&&kt?v:Ze.left,Nt=b?y:Qt(it,xt,"before"),pl=b?v:Qt(zt,xt,"after"),su=b&&qi&&Qr?y:Gt.right):(xn=b?Qt(it,xt,"before"):v,Nt=!b&&cl&&kt?y:Ze.right,pl=!b&&qi&&Qr?v:Gt.left,su=b?Qt(zt,xt,"after"):y),O(xn,Ze.top,Nt-xn,Ze.bottom),Ze.bottom0?i.blinker=setInterval(function(){e.hasFocus()||tl(e),i.cursorDiv.style.visibility=(s=!s)?"":"hidden"},e.options.cursorBlinkRate):e.options.cursorBlinkRate<0&&(i.cursorDiv.style.visibility="hidden")}}function td(e){e.hasFocus()||(e.display.input.focus(),e.state.focused||Ef(e))}function Ff(e){e.state.delayingBlurEvent=!0,setTimeout(function(){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1,e.state.focused&&tl(e))},100)}function Ef(e,i){e.state.delayingBlurEvent&&!e.state.draggingText&&(e.state.delayingBlurEvent=!1),e.options.readOnly!="nocursor"&&(e.state.focused||(je(e,"focus",e,i),e.state.focused=!0,Ee(e.display.wrapper,"CodeMirror-focused"),!e.curOp&&e.display.selForContextMenu!=e.doc.sel&&(e.display.input.reset(),g&&setTimeout(function(){return e.display.input.reset(!0)},20)),e.display.input.receivedFocus()),Pf(e))}function tl(e,i){e.state.delayingBlurEvent||(e.state.focused&&(je(e,"blur",e,i),e.state.focused=!1,ke(e.display.wrapper,"CodeMirror-focused")),clearInterval(e.display.blinker),setTimeout(function(){e.state.focused||(e.display.shift=!1)},150))}function Hs(e){for(var i=e.display,s=i.lineDiv.offsetTop,o=Math.max(0,i.scroller.getBoundingClientRect().top),f=i.lineDiv.getBoundingClientRect().top,h=0,p=0;p.005||P<-.005)&&(fe.display.sizerWidth){var _=Math.ceil(O/el(e.display));_>e.display.maxLineLength&&(e.display.maxLineLength=_,e.display.maxLine=v.line,e.display.maxLineChanged=!0)}}}Math.abs(h)>2&&(i.scroller.scrollTop+=h)}function rd(e){if(e.widgets)for(var i=0;i=p&&(h=N(i,ci(ie(i,y))-e.wrapper.clientHeight),p=y)}return{from:h,to:Math.max(p,h+1)}}function Rv(e,i){if(!qe(e,"scrollCursorIntoView")){var s=e.display,o=s.sizer.getBoundingClientRect(),f=null,h=s.wrapper.ownerDocument;if(i.top+o.top<0?f=!0:i.bottom+o.top>(h.defaultView.innerHeight||h.documentElement.clientHeight)&&(f=!1),f!=null&&!L){var p=W("div","\u200B",null,`position: absolute; + top: `+(i.top-s.viewOffset-Ms(e.display))+`px; + height: `+(i.bottom-i.top+Zr(e)+s.barHeight)+`px; + left: `+i.left+"px; width: "+Math.max(2,i.right-i.left)+"px;");e.display.lineSpace.appendChild(p),p.scrollIntoView(f),e.display.lineSpace.removeChild(p)}}}function zv(e,i,s,o){o==null&&(o=0);var f;!e.options.lineWrapping&&i==s&&(s=i.sticky=="before"?I(i.line,i.ch+1,"before"):i,i=i.ch?I(i.line,i.sticky=="before"?i.ch-1:i.ch,"after"):i);for(var h=0;h<5;h++){var p=!1,v=Nr(e,i),y=!s||s==i?v:Nr(e,s);f={left:Math.min(v.left,y.left),top:Math.min(v.top,y.top)-o,right:Math.max(v.left,y.left),bottom:Math.max(v.bottom,y.bottom)+o};var b=If(e,f),O=e.doc.scrollTop,H=e.doc.scrollLeft;if(b.scrollTop!=null&&(po(e,b.scrollTop),Math.abs(e.doc.scrollTop-O)>1&&(p=!0)),b.scrollLeft!=null&&(pn(e,b.scrollLeft),Math.abs(e.doc.scrollLeft-H)>1&&(p=!0)),!p)break}return f}function Gv(e,i){var s=If(e,i);s.scrollTop!=null&&po(e,s.scrollTop),s.scrollLeft!=null&&pn(e,s.scrollLeft)}function If(e,i){var s=e.display,o=Vn(e.display);i.top<0&&(i.top=0);var f=e.curOp&&e.curOp.scrollTop!=null?e.curOp.scrollTop:s.scroller.scrollTop,h=kf(e),p={};i.bottom-i.top>h&&(i.bottom=i.top+h);var v=e.doc.height+Sf(s),y=i.topv-o;if(i.topf+h){var O=Math.min(i.top,(b?v:i.bottom)-h);O!=f&&(p.scrollTop=O)}var H=e.options.fixedGutter?0:s.gutters.offsetWidth,F=e.curOp&&e.curOp.scrollLeft!=null?e.curOp.scrollLeft:s.scroller.scrollLeft-H,P=un(e)-s.gutters.offsetWidth,R=i.right-i.left>P;return R&&(i.right=i.left+P),i.left<10?p.scrollLeft=0:i.leftP+F-3&&(p.scrollLeft=i.right+(R?0:10)-P),p}function Bf(e,i){i!=null&&(Ps(e),e.curOp.scrollTop=(e.curOp.scrollTop==null?e.doc.scrollTop:e.curOp.scrollTop)+i)}function rl(e){Ps(e);var i=e.getCursor();e.curOp.scrollToPos={from:i,to:i,margin:e.options.cursorScrollMargin}}function co(e,i,s){(i!=null||s!=null)&&Ps(e),i!=null&&(e.curOp.scrollLeft=i),s!=null&&(e.curOp.scrollTop=s)}function Uv(e,i){Ps(e),e.curOp.scrollToPos=i}function Ps(e){var i=e.curOp.scrollToPos;if(i){e.curOp.scrollToPos=null;var s=Zh(e,i.from),o=Zh(e,i.to);id(e,s,o,i.margin)}}function id(e,i,s,o){var f=If(e,{left:Math.min(i.left,s.left),top:Math.min(i.top,s.top)-o,right:Math.max(i.right,s.right),bottom:Math.max(i.bottom,s.bottom)+o});co(e,f.scrollLeft,f.scrollTop)}function po(e,i){Math.abs(e.doc.scrollTop-i)<2||(n||zf(e,{top:i}),nd(e,i,!0),n&&zf(e),mo(e,100))}function nd(e,i,s){i=Math.max(0,Math.min(e.display.scroller.scrollHeight-e.display.scroller.clientHeight,i)),!(e.display.scroller.scrollTop==i&&!s)&&(e.doc.scrollTop=i,e.display.scrollbars.setScrollTop(i),e.display.scroller.scrollTop!=i&&(e.display.scroller.scrollTop=i))}function pn(e,i,s,o){i=Math.max(0,Math.min(i,e.display.scroller.scrollWidth-e.display.scroller.clientWidth)),!((s?i==e.doc.scrollLeft:Math.abs(e.doc.scrollLeft-i)<2)&&!o)&&(e.doc.scrollLeft=i,fd(e),e.display.scroller.scrollLeft!=i&&(e.display.scroller.scrollLeft=i),e.display.scrollbars.setScrollLeft(i))}function go(e){var i=e.display,s=i.gutters.offsetWidth,o=Math.round(e.doc.height+Sf(e.display));return{clientHeight:i.scroller.clientHeight,viewHeight:i.wrapper.clientHeight,scrollWidth:i.scroller.scrollWidth,clientWidth:i.scroller.clientWidth,viewWidth:i.wrapper.clientWidth,barLeft:e.options.fixedGutter?s:0,docHeight:o,scrollHeight:o+Zr(e)+i.barHeight,nativeBarWidth:i.nativeBarWidth,gutterWidth:s}}var gn=function(e,i,s){this.cm=s;var o=this.vert=W("div",[W("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),f=this.horiz=W("div",[W("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");o.tabIndex=f.tabIndex=-1,e(o),e(f),ae(o,"scroll",function(){o.clientHeight&&i(o.scrollTop,"vertical")}),ae(f,"scroll",function(){f.clientWidth&&i(f.scrollLeft,"horizontal")}),this.checkedZeroWidth=!1,d&&c<8&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")};gn.prototype.update=function(e){var i=e.scrollWidth>e.clientWidth+1,s=e.scrollHeight>e.clientHeight+1,o=e.nativeBarWidth;if(s){this.vert.style.display="block",this.vert.style.bottom=i?o+"px":"0";var f=e.viewHeight-(i?o:0);this.vert.firstChild.style.height=Math.max(0,e.scrollHeight-e.clientHeight+f)+"px"}else this.vert.scrollTop=0,this.vert.style.display="",this.vert.firstChild.style.height="0";if(i){this.horiz.style.display="block",this.horiz.style.right=s?o+"px":"0",this.horiz.style.left=e.barLeft+"px";var h=e.viewWidth-e.barLeft-(s?o:0);this.horiz.firstChild.style.width=Math.max(0,e.scrollWidth-e.clientWidth+h)+"px"}else this.horiz.style.display="",this.horiz.firstChild.style.width="0";return!this.checkedZeroWidth&&e.clientHeight>0&&(o==0&&this.zeroWidthHack(),this.checkedZeroWidth=!0),{right:s?o:0,bottom:i?o:0}},gn.prototype.setScrollLeft=function(e){this.horiz.scrollLeft!=e&&(this.horiz.scrollLeft=e),this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz,"horiz")},gn.prototype.setScrollTop=function(e){this.vert.scrollTop!=e&&(this.vert.scrollTop=e),this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert,"vert")},gn.prototype.zeroWidthHack=function(){var e=E&&!T?"12px":"18px";this.horiz.style.height=this.vert.style.width=e,this.horiz.style.visibility=this.vert.style.visibility="hidden",this.disableHoriz=new _r,this.disableVert=new _r},gn.prototype.enableZeroWidthBar=function(e,i,s){e.style.visibility="";function o(){var f=e.getBoundingClientRect(),h=s=="vert"?document.elementFromPoint(f.right-1,(f.top+f.bottom)/2):document.elementFromPoint((f.right+f.left)/2,f.bottom-1);h!=e?e.style.visibility="hidden":i.set(1e3,o)}i.set(1e3,o)},gn.prototype.clear=function(){var e=this.horiz.parentNode;e.removeChild(this.horiz),e.removeChild(this.vert)};var vo=function(){};vo.prototype.update=function(){return{bottom:0,right:0}},vo.prototype.setScrollLeft=function(){},vo.prototype.setScrollTop=function(){},vo.prototype.clear=function(){};function il(e,i){i||(i=go(e));var s=e.display.barWidth,o=e.display.barHeight;ld(e,i);for(var f=0;f<4&&s!=e.display.barWidth||o!=e.display.barHeight;f++)s!=e.display.barWidth&&e.options.lineWrapping&&Hs(e),ld(e,go(e)),s=e.display.barWidth,o=e.display.barHeight}function ld(e,i){var s=e.display,o=s.scrollbars.update(i);s.sizer.style.paddingRight=(s.barWidth=o.right)+"px",s.sizer.style.paddingBottom=(s.barHeight=o.bottom)+"px",s.heightForcer.style.borderBottom=o.bottom+"px solid transparent",o.right&&o.bottom?(s.scrollbarFiller.style.display="block",s.scrollbarFiller.style.height=o.bottom+"px",s.scrollbarFiller.style.width=o.right+"px"):s.scrollbarFiller.style.display="",o.bottom&&e.options.coverGutterNextToScrollbar&&e.options.fixedGutter?(s.gutterFiller.style.display="block",s.gutterFiller.style.height=o.bottom+"px",s.gutterFiller.style.width=i.gutterWidth+"px"):s.gutterFiller.style.display=""}var od={native:gn,null:vo};function sd(e){e.display.scrollbars&&(e.display.scrollbars.clear(),e.display.scrollbars.addClass&&ke(e.display.wrapper,e.display.scrollbars.addClass)),e.display.scrollbars=new od[e.options.scrollbarStyle](function(i){e.display.wrapper.insertBefore(i,e.display.scrollbarFiller),ae(i,"mousedown",function(){e.state.focused&&setTimeout(function(){return e.display.input.focus()},0)}),i.setAttribute("cm-not-content","true")},function(i,s){s=="horizontal"?pn(e,i):po(e,i)},e),e.display.scrollbars.addClass&&Ee(e.display.wrapper,e.display.scrollbars.addClass)}var _v=0;function vn(e){e.curOp={cm:e,viewChanged:!1,startHeight:e.doc.height,forceUpdate:!1,updateInput:0,typing:!1,changeObjs:null,cursorActivityHandlers:null,cursorActivityCalled:0,selectionChanged:!1,updateMaxLine:!1,scrollLeft:null,scrollTop:null,scrollToPos:null,focus:!1,id:++_v,markArrays:null},bv(e.curOp)}function mn(e){var i=e.curOp;i&&Cv(i,function(s){for(var o=0;o=s.viewTo)||s.maxLineChanged&&i.options.lineWrapping,e.update=e.mustUpdate&&new Fs(i,e.mustUpdate&&{top:e.scrollTop,ensure:e.scrollToPos},e.forceUpdate)}function jv(e){e.updatedDisplay=e.mustUpdate&&Rf(e.cm,e.update)}function qv(e){var i=e.cm,s=i.display;e.updatedDisplay&&Hs(i),e.barMeasure=go(i),s.maxLineChanged&&!i.options.lineWrapping&&(e.adjustWidthTo=Gh(i,s.maxLine,s.maxLine.text.length).left+3,i.display.sizerWidth=e.adjustWidthTo,e.barMeasure.scrollWidth=Math.max(s.scroller.clientWidth,s.sizer.offsetLeft+e.adjustWidthTo+Zr(i)+i.display.barWidth),e.maxScrollLeft=Math.max(0,s.sizer.offsetLeft+e.adjustWidthTo-un(i))),(e.updatedDisplay||e.selectionChanged)&&(e.preparedSelection=s.input.prepareSelection())}function Yv(e){var i=e.cm;e.adjustWidthTo!=null&&(i.display.sizer.style.minWidth=e.adjustWidthTo+"px",e.maxScrollLeft=e.display.viewTo)){var s=+new Date+e.options.workTime,o=lo(e,i.highlightFrontier),f=[];i.iter(o.line,Math.min(i.first+i.size,e.display.viewTo+500),function(h){if(o.line>=e.display.viewFrom){var p=h.styles,v=h.text.length>e.options.maxHighlightLength?qr(i.mode,o.state):null,y=gh(e,h,o,!0);v&&(o.state=v),h.styles=y.styles;var b=h.styleClasses,O=y.classes;O?h.styleClasses=O:b&&(h.styleClasses=null);for(var H=!p||p.length!=h.styles.length||b!=O&&(!b||!O||b.bgClass!=O.bgClass||b.textClass!=O.textClass),F=0;!H&&Fs)return mo(e,e.options.workDelay),!0}),i.highlightFrontier=o.line,i.modeFrontier=Math.max(i.modeFrontier,o.line),f.length&&Jt(e,function(){for(var h=0;h=s.viewFrom&&i.visible.to<=s.viewTo&&(s.updateLineNumbers==null||s.updateLineNumbers>=s.viewTo)&&s.renderedView==s.view&&Vh(e)==0)return!1;ud(e)&&(Gi(e),i.dims=Df(e));var f=o.first+o.size,h=Math.max(i.visible.from-e.options.viewportMargin,o.first),p=Math.min(f,i.visible.to+e.options.viewportMargin);s.viewFromp&&s.viewTo-p<20&&(p=Math.min(f,s.viewTo)),di&&(h=xf(e.doc,h),p=Oh(e.doc,p));var v=h!=s.viewFrom||p!=s.viewTo||s.lastWrapHeight!=i.wrapperHeight||s.lastWrapWidth!=i.wrapperWidth;Iv(e,h,p),s.viewOffset=ci(ie(e.doc,s.viewFrom)),e.display.mover.style.top=s.viewOffset+"px";var y=Vh(e);if(!v&&y==0&&!i.force&&s.renderedView==s.view&&(s.updateLineNumbers==null||s.updateLineNumbers>=s.viewTo))return!1;var b=$v(e);return y>4&&(s.lineDiv.style.display="none"),em(e,s.updateLineNumbers,i.dims),y>4&&(s.lineDiv.style.display=""),s.renderedView=s.view,Vv(b),z(s.cursorDiv),z(s.selectionDiv),s.gutters.style.height=s.sizer.style.minHeight=0,v&&(s.lastWrapHeight=i.wrapperHeight,s.lastWrapWidth=i.wrapperWidth,mo(e,400)),s.updateLineNumbers=null,!0}function ad(e,i){for(var s=i.viewport,o=!0;;o=!1){if(!o||!e.options.lineWrapping||i.oldDisplayWidth==un(e)){if(s&&s.top!=null&&(s={top:Math.min(e.doc.height+Sf(e.display)-kf(e),s.top)}),i.visible=Ws(e.display,e.doc,s),i.visible.from>=e.display.viewFrom&&i.visible.to<=e.display.viewTo)break}else o&&(i.visible=Ws(e.display,e.doc,s));if(!Rf(e,i))break;Hs(e);var f=go(e);ho(e),il(e,f),Uf(e,f),i.force=!1}i.signal(e,"update",e),(e.display.viewFrom!=e.display.reportedViewFrom||e.display.viewTo!=e.display.reportedViewTo)&&(i.signal(e,"viewportChange",e,e.display.viewFrom,e.display.viewTo),e.display.reportedViewFrom=e.display.viewFrom,e.display.reportedViewTo=e.display.viewTo)}function zf(e,i){var s=new Fs(e,i);if(Rf(e,s)){Hs(e),ad(e,s);var o=go(e);ho(e),il(e,o),Uf(e,o),s.finish()}}function em(e,i,s){var o=e.display,f=e.options.lineNumbers,h=o.lineDiv,p=h.firstChild;function v(R){var _=R.nextSibling;return g&&E&&e.display.currentWheelTarget==R?R.style.display="none":R.parentNode.removeChild(R),_}for(var y=o.view,b=o.viewFrom,O=0;O-1&&(P=!1),Ph(e,H,b,s)),P&&(z(H.lineNumber),H.lineNumber.appendChild(document.createTextNode(j(e.options,b)))),p=H.node.nextSibling}b+=H.size}for(;p;)p=v(p)}function Gf(e){var i=e.gutters.offsetWidth;e.sizer.style.marginLeft=i+"px",ht(e,"gutterChanged",e)}function Uf(e,i){e.display.sizer.style.minHeight=i.docHeight+"px",e.display.heightForcer.style.top=i.docHeight+"px",e.display.gutters.style.height=i.docHeight+e.display.barHeight+Zr(e)+"px"}function fd(e){var i=e.display,s=i.view;if(!(!i.alignWidgets&&(!i.gutters.firstChild||!e.options.fixedGutter))){for(var o=Nf(i)-i.scroller.scrollLeft+e.doc.scrollLeft,f=i.gutters.offsetWidth,h=o+"px",p=0;p=105&&(f.wrapper.style.clipPath="inset(0px)"),f.wrapper.setAttribute("translate","no"),d&&c<8&&(f.gutters.style.zIndex=-1,f.scroller.style.paddingRight=0),!g&&!(n&&D)&&(f.scroller.draggable=!0),e&&(e.appendChild?e.appendChild(f.wrapper):e(f.wrapper)),f.viewFrom=f.viewTo=i.first,f.reportedViewFrom=f.reportedViewTo=i.first,f.view=[],f.renderedView=null,f.externalMeasured=null,f.viewOffset=0,f.lastWrapHeight=f.lastWrapWidth=0,f.updateLineNumbers=null,f.nativeBarWidth=f.barHeight=f.barWidth=0,f.scrollbarsClipped=!1,f.lineNumWidth=f.lineNumInnerWidth=f.lineNumChars=null,f.alignWidgets=!1,f.cachedCharWidth=f.cachedTextHeight=f.cachedPaddingH=null,f.maxLine=null,f.maxLineLength=0,f.maxLineChanged=!1,f.wheelDX=f.wheelDY=f.wheelStartX=f.wheelStartY=null,f.shift=!1,f.selForContextMenu=null,f.activeTouch=null,f.gutterSpecs=_f(o.gutters,o.lineNumbers),hd(f),s.init(f)}var Es=0,gi=null;d?gi=-.53:n?gi=15:x?gi=-.7:A&&(gi=-1/3);function dd(e){var i=e.wheelDeltaX,s=e.wheelDeltaY;return i==null&&e.detail&&e.axis==e.HORIZONTAL_AXIS&&(i=e.detail),s==null&&e.detail&&e.axis==e.VERTICAL_AXIS?s=e.detail:s==null&&(s=e.wheelDelta),{x:i,y:s}}function rm(e){var i=dd(e);return i.x*=gi,i.y*=gi,i}function cd(e,i){x&&S==102&&(e.display.chromeScrollHack==null?e.display.sizer.style.pointerEvents="none":clearTimeout(e.display.chromeScrollHack),e.display.chromeScrollHack=setTimeout(function(){e.display.chromeScrollHack=null,e.display.sizer.style.pointerEvents=""},100));var s=dd(i),o=s.x,f=s.y,h=gi;i.deltaMode===0&&(o=i.deltaX,f=i.deltaY,h=1);var p=e.display,v=p.scroller,y=v.scrollWidth>v.clientWidth,b=v.scrollHeight>v.clientHeight;if(o&&y||f&&b){if(f&&E&&g){e:for(var O=i.target,H=p.view;O!=v;O=O.parentNode)for(var F=0;F=0&&Q(e,o.to())<=0)return s}return-1};var Me=function(e,i){this.anchor=e,this.head=i};Me.prototype.from=function(){return Zn(this.anchor,this.head)},Me.prototype.to=function(){return Et(this.anchor,this.head)},Me.prototype.empty=function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch};function Hr(e,i,s){var o=e&&e.options.selectionsMayTouch,f=i[s];i.sort(function(F,P){return Q(F.from(),P.from())}),s=ve(i,f);for(var h=1;h0:y>=0){var b=Zn(v.from(),p.from()),O=Et(v.to(),p.to()),H=v.empty()?p.from()==p.head:v.from()==v.head;h<=s&&--s,i.splice(--h,2,new Me(H?O:b,H?b:O))}}return new ar(i,s)}function Ui(e,i){return new ar([new Me(e,i||e)],0)}function _i(e){return e.text?I(e.from.line+e.text.length-1,Le(e.text).length+(e.text.length==1?e.from.ch:0)):e.to}function pd(e,i){if(Q(e,i.from)<0)return e;if(Q(e,i.to)<=0)return _i(i);var s=e.line+i.text.length-(i.to.line-i.from.line)-1,o=e.ch;return e.line==i.to.line&&(o+=_i(i).ch-i.to.ch),I(s,o)}function Kf(e,i){for(var s=[],o=0;o1&&e.remove(v.line+1,R-1),e.insert(v.line+1,Z)}ht(e,"change",e,i)}function Ki(e,i,s){function o(f,h,p){if(f.linked)for(var v=0;v1&&!e.done[e.done.length-2].ranges)return e.done.pop(),Le(e.done)}function bd(e,i,s,o){var f=e.history;f.undone.length=0;var h=+new Date,p,v;if((f.lastOp==o||f.lastOrigin==i.origin&&i.origin&&(i.origin.charAt(0)=="+"&&f.lastModTime>h-(e.cm?e.cm.options.historyEventDelay:500)||i.origin.charAt(0)=="*"))&&(p=lm(f,f.lastOp==o)))v=Le(p.changes),Q(i.from,i.to)==0&&Q(i.from,v.to)==0?v.to=_i(i):p.changes.push(qf(e,i));else{var y=Le(f.done);for((!y||!y.ranges)&&Bs(e.sel,f.done),p={changes:[qf(e,i)],generation:f.generation},f.done.push(p);f.done.length>f.undoDepth;)f.done.shift(),f.done[0].ranges||f.done.shift()}f.done.push(s),f.generation=++f.maxGeneration,f.lastModTime=f.lastSelTime=h,f.lastOp=f.lastSelOp=o,f.lastOrigin=f.lastSelOrigin=i.origin,v||je(e,"historyAdded")}function om(e,i,s,o){var f=i.charAt(0);return f=="*"||f=="+"&&s.ranges.length==o.ranges.length&&s.somethingSelected()==o.somethingSelected()&&new Date-e.history.lastSelTime<=(e.cm?e.cm.options.historyEventDelay:500)}function sm(e,i,s,o){var f=e.history,h=o&&o.origin;s==f.lastSelOp||h&&f.lastSelOrigin==h&&(f.lastModTime==f.lastSelTime&&f.lastOrigin==h||om(e,h,Le(f.done),i))?f.done[f.done.length-1]=i:Bs(i,f.done),f.lastSelTime=+new Date,f.lastSelOrigin=h,f.lastSelOp=s,o&&o.clearRedo!==!1&&xd(f.undone)}function Bs(e,i){var s=Le(i);s&&s.ranges&&s.equals(e)||i.push(e)}function wd(e,i,s,o){var f=i["spans_"+e.id],h=0;e.iter(Math.max(e.first,s),Math.min(e.first+e.size,o),function(p){p.markedSpans&&((f||(f=i["spans_"+e.id]={}))[h]=p.markedSpans),++h})}function am(e){if(!e)return null;for(var i,s=0;s-1&&(Le(v)[H]=b[H],delete b[H])}}return o}function Yf(e,i,s,o){if(o){var f=e.anchor;if(s){var h=Q(i,f)<0;h!=Q(s,f)<0?(f=i,i=s):h!=Q(i,s)<0&&(i=s)}return new Me(f,i)}else return new Me(s||i,i)}function Rs(e,i,s,o,f){f==null&&(f=e.cm&&(e.cm.display.shift||e.extend)),St(e,new ar([Yf(e.sel.primary(),i,s,f)],0),o)}function Sd(e,i,s){for(var o=[],f=e.cm&&(e.cm.display.shift||e.extend),h=0;h=i.ch:v.to>i.ch))){if(f&&(je(y,"beforeCursorEnter"),y.explicitlyCleared))if(h.markedSpans){--p;continue}else break;if(!y.atomic)continue;if(s){var H=y.find(o<0?1:-1),F=void 0;if((o<0?O:b)&&(H=Od(e,H,-o,H&&H.line==i.line?h:null)),H&&H.line==i.line&&(F=Q(H,s))&&(o<0?F<0:F>0))return ll(e,H,i,o,f)}var P=y.find(o<0?-1:1);return(o<0?b:O)&&(P=Od(e,P,o,P.line==i.line?h:null)),P?ll(e,P,i,o,f):null}}return i}function Gs(e,i,s,o,f){var h=o||1,p=ll(e,i,s,h,f)||!f&&ll(e,i,s,h,!0)||ll(e,i,s,-h,f)||!f&&ll(e,i,s,-h,!0);return p||(e.cantEdit=!0,I(e.first,0))}function Od(e,i,s,o){return s<0&&i.ch==0?i.line>e.first?ce(e,I(i.line-1)):null:s>0&&i.ch==(o||ie(e,i.line)).text.length?i.line=0;--f)Hd(e,{from:o[f].from,to:o[f].to,text:f?[""]:i.text,origin:i.origin});else Hd(e,i)}}function Hd(e,i){if(!(i.text.length==1&&i.text[0]==""&&Q(i.from,i.to)==0)){var s=Kf(e,i);bd(e,i,s,e.cm?e.cm.curOp.id:NaN),bo(e,i,s,mf(e,i));var o=[];Ki(e,function(f,h){!h&&ve(o,f.history)==-1&&(Ed(f.history,i),o.push(f.history)),bo(f,i,null,mf(f,i))})}}function Us(e,i,s){var o=e.cm&&e.cm.state.suppressEdits;if(!(o&&!s)){for(var f=e.history,h,p=e.sel,v=i=="undo"?f.done:f.undone,y=i=="undo"?f.undone:f.done,b=0;b=0;--P){var R=F(P);if(R)return R.v}}}}function Wd(e,i){if(i!=0&&(e.first+=i,e.sel=new ar(sn(e.sel.ranges,function(f){return new Me(I(f.anchor.line+i,f.anchor.ch),I(f.head.line+i,f.head.ch))}),e.sel.primIndex),e.cm)){It(e.cm,e.first,e.first-i,i);for(var s=e.cm.display,o=s.viewFrom;oe.lastLine())){if(i.from.lineh&&(i={from:i.from,to:I(h,ie(e,h).text.length),text:[i.text[0]],origin:i.origin}),i.removed=hi(e,i.from,i.to),s||(s=Kf(e,i)),e.cm?hm(e.cm,i,o):jf(e,i,o),zs(e,s,lr),e.cantEdit&&Gs(e,I(e.firstLine(),0))&&(e.cantEdit=!1)}}function hm(e,i,s){var o=e.doc,f=e.display,h=i.from,p=i.to,v=!1,y=h.line;e.options.lineWrapping||(y=w(Dr(ie(o,h.line))),o.iter(y,p.line+1,function(P){if(P==f.maxLine)return v=!0,!0})),o.sel.contains(i.from,i.to)>-1&&dr(e),jf(o,i,s,$h(e)),e.options.lineWrapping||(o.iter(y,h.line+i.text.length,function(P){var R=Ls(P);R>f.maxLineLength&&(f.maxLine=P,f.maxLineLength=R,f.maxLineChanged=!0,v=!1)}),v&&(e.curOp.updateMaxLine=!0)),ev(o,h.line),mo(e,400);var b=i.text.length-(p.line-h.line)-1;i.full?It(e):h.line==p.line&&i.text.length==1&&!vd(e.doc,i)?zi(e,h.line,"text"):It(e,h.line,p.line+1,b);var O=Zt(e,"changes"),H=Zt(e,"change");if(H||O){var F={from:h,to:p,text:i.text,removed:i.removed,origin:i.origin};H&&ht(e,"change",e,F),O&&(e.curOp.changeObjs||(e.curOp.changeObjs=[])).push(F)}e.display.selForContextMenu=null}function sl(e,i,s,o,f){var h;o||(o=s),Q(o,s)<0&&(h=[o,s],s=h[0],o=h[1]),typeof i=="string"&&(i=e.splitLines(i)),ol(e,{from:s,to:o,text:i,origin:f})}function Pd(e,i,s,o){s1||!(this.children[0]instanceof Co))){var v=[];this.collapse(v),this.children=[new Co(v)],this.children[0].parent=this}},collapse:function(e){for(var i=0;i50){for(var p=f.lines.length%25+25,v=p;v10);e.parent.maybeSpill()}},iterN:function(e,i,s){for(var o=0;oe.display.maxLineLength&&(e.display.maxLine=b,e.display.maxLineLength=O,e.display.maxLineChanged=!0)}o!=null&&e&&this.collapsed&&It(e,o,f+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,e&&Md(e.doc)),e&&ht(e,"markerCleared",e,this,o,f),i&&mn(e),this.parent&&this.parent.clear()}},Xi.prototype.find=function(e,i){e==null&&this.type=="bookmark"&&(e=1);for(var s,o,f=0;f0||p==0&&h.clearWhenEmpty!==!1)return h;if(h.replacedWith&&(h.collapsed=!0,h.widgetNode=De("span",[h.replacedWith],"CodeMirror-widget"),o.handleMouseEvents||h.widgetNode.setAttribute("cm-ignore-events","true"),o.insertLeft&&(h.widgetNode.insertLeft=!0)),h.collapsed){if(Ah(e,i.line,i,s,h)||i.line!=s.line&&Ah(e,s.line,i,s,h))throw new Error("Inserting collapsed marker partially overlapping an existing one");rv()}h.addToHistory&&bd(e,{from:i,to:s,origin:"markText"},e.sel,NaN);var v=i.line,y=e.cm,b;if(e.iter(v,s.line+1,function(H){y&&h.collapsed&&!y.options.lineWrapping&&Dr(H)==y.display.maxLine&&(b=!0),h.collapsed&&v!=i.line&&sr(H,0),nv(H,new ws(h,v==i.line?i.ch:null,v==s.line?s.ch:null),e.cm&&e.cm.curOp),++v}),h.collapsed&&e.iter(i.line,s.line+1,function(H){Ri(e,H)&&sr(H,0)}),h.clearOnEnter&&ae(h,"beforeCursorEnter",function(){return h.clear()}),h.readOnly&&(tv(),(e.history.done.length||e.history.undone.length)&&e.clearHistory()),h.collapsed&&(h.id=++Bd,h.atomic=!0),y){if(b&&(y.curOp.updateMaxLine=!0),h.collapsed)It(y,i.line,s.line+1);else if(h.className||h.startStyle||h.endStyle||h.css||h.attributes||h.title)for(var O=i.line;O<=s.line;O++)zi(y,O,"text");h.atomic&&Md(y.doc),ht(y,"markerAdded",y,h)}return h}var Lo=function(e,i){this.markers=e,this.primary=i;for(var s=0;s=0;y--)ol(this,o[y]);v?Ld(this,v):this.cm&&rl(this.cm)}),undo:ct(function(){Us(this,"undo")}),redo:ct(function(){Us(this,"redo")}),undoSelection:ct(function(){Us(this,"undo",!0)}),redoSelection:ct(function(){Us(this,"redo",!0)}),setExtending:function(e){this.extend=e},getExtending:function(){return this.extend},historySize:function(){for(var e=this.history,i=0,s=0,o=0;o=e.ch)&&i.push(f.marker.parent||f.marker)}return i},findMarks:function(e,i,s){e=ce(this,e),i=ce(this,i);var o=[],f=e.line;return this.iter(e.line,i.line+1,function(h){var p=h.markedSpans;if(p)for(var v=0;v=y.to||y.from==null&&f!=e.line||y.from!=null&&f==i.line&&y.from>=i.ch)&&(!s||s(y.marker))&&o.push(y.marker.parent||y.marker)}++f}),o},getAllMarks:function(){var e=[];return this.iter(function(i){var s=i.markedSpans;if(s)for(var o=0;oe)return i=e,!0;e-=h,++s}),ce(this,I(s,i))},indexFromPos:function(e){e=ce(this,e);var i=e.ch;if(e.linei&&(i=e.from),e.to!=null&&e.to-1){i.state.draggingText(e),setTimeout(function(){return i.display.input.focus()},20);return}try{var O=e.dataTransfer.getData("Text");if(O){var H;if(i.state.draggingText&&!i.state.draggingText.copy&&(H=i.listSelections()),zs(i.doc,Ui(s,s)),H)for(var F=0;F=0;v--)sl(e.doc,"",o[v].from,o[v].to,"+delete");rl(e)})}function Jf(e,i,s){var o=Hi(e.text,i+s,s);return o<0||o>e.text.length?null:o}function Qf(e,i,s){var o=Jf(e,i.ch,s);return o==null?null:new I(i.line,o,s<0?"after":"before")}function $f(e,i,s,o,f){if(e){i.doc.direction=="rtl"&&(f=-f);var h=Ce(s,i.doc.direction);if(h){var p=f<0?Le(h):h[0],v=f<0==(p.level==1),y=v?"after":"before",b;if(p.level>0||i.doc.direction=="rtl"){var O=$n(i,s);b=f<0?s.text.length-1:0;var H=Jr(i,O,b).top;b=jr(function(F){return Jr(i,O,F).top==H},f<0==(p.level==1)?p.from:p.to-1,b),y=="before"&&(b=Jf(s,b,1))}else b=f<0?p.to:p.from;return new I(o,b,y)}}return new I(o,f<0?s.text.length:0,f<0?"before":"after")}function Lm(e,i,s,o){var f=Ce(i,e.doc.direction);if(!f)return Qf(i,s,o);s.ch>=i.text.length?(s.ch=i.text.length,s.sticky="before"):s.ch<=0&&(s.ch=0,s.sticky="after");var h=Pi(f,s.ch,s.sticky),p=f[h];if(e.doc.direction=="ltr"&&p.level%2==0&&(o>0?p.to>s.ch:p.from=p.from&&F>=O.begin)){var P=H?"before":"after";return new I(s.line,F,P)}}var R=function(Z,$,J){for(var te=function(Pe,pt){return pt?new I(s.line,v(Pe,1),"before"):new I(s.line,Pe,"after")};Z>=0&&Z0==(fe.level!=1),me=le?J.begin:v(J.end,-1);if(fe.from<=me&&me0?O.end:v(O.begin,-1);return q!=null&&!(o>0&&q==i.text.length)&&(_=R(o>0?0:f.length-1,o,b(q)),_)?_:null}var Ao={selectAll:Dd,singleSelection:function(e){return e.setSelection(e.getCursor("anchor"),e.getCursor("head"),lr)},killLine:function(e){return ul(e,function(i){if(i.empty()){var s=ie(e.doc,i.head.line).text.length;return i.head.ch==s&&i.head.line0)f=new I(f.line,f.ch+1),e.replaceRange(h.charAt(f.ch-1)+h.charAt(f.ch-2),I(f.line,f.ch-2),f,"+transpose");else if(f.line>e.doc.first){var p=ie(e.doc,f.line-1).text;p&&(f=new I(f.line,1),e.replaceRange(h.charAt(0)+e.doc.lineSeparator()+p.charAt(p.length-1),I(f.line-1,p.length-1),f,"+transpose"))}}s.push(new Me(f,f))}e.setSelections(s)})},newlineAndIndent:function(e){return Jt(e,function(){for(var i=e.listSelections(),s=i.length-1;s>=0;s--)e.replaceRange(e.doc.lineSeparator(),i[s].anchor,i[s].head,"+input");i=e.listSelections();for(var o=0;oe&&Q(i,this.pos)==0&&s==this.button};var Do,No;function Hm(e,i){var s=+new Date;return No&&No.compare(s,e,i)?(Do=No=null,"triple"):Do&&Do.compare(s,e,i)?(No=new eu(s,e,i),Do=null,"double"):(Do=new eu(s,e,i),No=null,"single")}function ec(e){var i=this,s=i.display;if(!(qe(i,e)||s.activeTouch&&s.input.supportsTouch())){if(s.input.ensurePolled(),s.shift=e.shiftKey,pi(s,e)){g||(s.scroller.draggable=!1,setTimeout(function(){return s.scroller.draggable=!0},100));return}if(!tu(i,e)){var o=dn(i,e),f=Tr(e),h=o?Hm(o,f):"single";pe(i).focus(),f==1&&i.state.selectingText&&i.state.selectingText(e),!(o&&Wm(i,f,o,h,e))&&(f==1?o?Fm(i,o,h,e):to(e)==s.scroller&&Ct(e):f==2?(o&&Rs(i.doc,o),setTimeout(function(){return s.input.focus()},20)):f==3&&(we?i.display.input.onContextMenu(e):Ff(i)))}}}function Wm(e,i,s,o,f){var h="Click";return o=="double"?h="Double"+h:o=="triple"&&(h="Triple"+h),h=(i==1?"Left":i==2?"Middle":"Right")+h,Oo(e,Xd(h,f),f,function(p){if(typeof p=="string"&&(p=Ao[p]),!p)return!1;var v=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),v=p(e,s)!=Ni}finally{e.state.suppressEdits=!1}return v})}function Pm(e,i,s){var o=e.getOption("configureMouse"),f=o?o(e,i,s):{};if(f.unit==null){var h=B?s.shiftKey&&s.metaKey:s.altKey;f.unit=h?"rectangle":i=="single"?"char":i=="double"?"word":"line"}return(f.extend==null||e.doc.extend)&&(f.extend=e.doc.extend||s.shiftKey),f.addNew==null&&(f.addNew=E?s.metaKey:s.ctrlKey),f.moveOnDrag==null&&(f.moveOnDrag=!(E?s.altKey:s.ctrlKey)),f}function Fm(e,i,s,o){d?setTimeout(ue(td,e),0):e.curOp.focus=ze(bt(e));var f=Pm(e,s,o),h=e.doc.sel,p;e.options.dragDrop&&cf&&!e.isReadOnly()&&s=="single"&&(p=h.contains(i))>-1&&(Q((p=h.ranges[p]).from(),i)<0||i.xRel>0)&&(Q(p.to(),i)>0||i.xRel<0)?Em(e,o,i,f):Im(e,o,i,f)}function Em(e,i,s,o){var f=e.display,h=!1,p=dt(e,function(b){g&&(f.scroller.draggable=!1),e.state.draggingText=!1,e.state.delayingBlurEvent&&(e.hasFocus()?e.state.delayingBlurEvent=!1:Ff(e)),wt(f.wrapper.ownerDocument,"mouseup",p),wt(f.wrapper.ownerDocument,"mousemove",v),wt(f.scroller,"dragstart",y),wt(f.scroller,"drop",p),h||(Ct(b),o.addNew||Rs(e.doc,s,null,null,o.extend),g&&!A||d&&c==9?setTimeout(function(){f.wrapper.ownerDocument.body.focus({preventScroll:!0}),f.input.focus()},20):f.input.focus())}),v=function(b){h=h||Math.abs(i.clientX-b.clientX)+Math.abs(i.clientY-b.clientY)>=10},y=function(){return h=!0};g&&(f.scroller.draggable=!0),e.state.draggingText=p,p.copy=!o.moveOnDrag,ae(f.wrapper.ownerDocument,"mouseup",p),ae(f.wrapper.ownerDocument,"mousemove",v),ae(f.scroller,"dragstart",y),ae(f.scroller,"drop",p),e.state.delayingBlurEvent=!0,setTimeout(function(){return f.input.focus()},20),f.scroller.dragDrop&&f.scroller.dragDrop()}function tc(e,i,s){if(s=="char")return new Me(i,i);if(s=="word")return e.findWordAt(i);if(s=="line")return new Me(I(i.line,0),ce(e.doc,I(i.line+1,0)));var o=s(e,i);return new Me(o.from,o.to)}function Im(e,i,s,o){d&&Ff(e);var f=e.display,h=e.doc;Ct(i);var p,v,y=h.sel,b=y.ranges;if(o.addNew&&!o.extend?(v=h.sel.contains(s),v>-1?p=b[v]:p=new Me(s,s)):(p=h.sel.primary(),v=h.sel.primIndex),o.unit=="rectangle")o.addNew||(p=new Me(s,s)),s=dn(e,i,!0,!0),v=-1;else{var O=tc(e,s,o.unit);o.extend?p=Yf(p,O.anchor,O.head,o.extend):p=O}o.addNew?v==-1?(v=b.length,St(h,Hr(e,b.concat([p]),v),{scroll:!1,origin:"*mouse"})):b.length>1&&b[v].empty()&&o.unit=="char"&&!o.extend?(St(h,Hr(e,b.slice(0,v).concat(b.slice(v+1)),0),{scroll:!1,origin:"*mouse"}),y=h.sel):Zf(h,v,p,Kr):(v=0,St(h,new ar([p],0),Kr),y=h.sel);var H=s;function F(J){if(Q(H,J)!=0)if(H=J,o.unit=="rectangle"){for(var te=[],fe=e.options.tabSize,le=Oe(ie(h,s.line).text,s.ch,fe),me=Oe(ie(h,J.line).text,J.ch,fe),Pe=Math.min(le,me),pt=Math.max(le,me),Ke=Math.min(s.line,J.line),Qt=Math.min(e.lastLine(),Math.max(s.line,J.line));Ke<=Qt;Ke++){var Rt=ie(h,Ke).text,it=Xr(Rt,Pe,fe);Pe==pt?te.push(new Me(I(Ke,it),I(Ke,it))):Rt.length>it&&te.push(new Me(I(Ke,it),I(Ke,Xr(Rt,pt,fe))))}te.length||te.push(new Me(s,s)),St(h,Hr(e,y.ranges.slice(0,v).concat(te),v),{origin:"*mouse",scroll:!1}),e.scrollIntoView(J)}else{var zt=p,xt=tc(e,J,o.unit),lt=zt.anchor,nt;Q(xt.anchor,lt)>0?(nt=xt.head,lt=Zn(zt.from(),xt.anchor)):(nt=xt.anchor,lt=Et(zt.to(),xt.head));var Ze=y.ranges.slice(0);Ze[v]=Bm(e,new Me(ce(h,lt),nt)),St(h,Hr(e,Ze,v),Kr)}}var P=f.wrapper.getBoundingClientRect(),R=0;function _(J){var te=++R,fe=dn(e,J,!0,o.unit=="rectangle");if(fe)if(Q(fe,H)!=0){e.curOp.focus=ze(bt(e)),F(fe);var le=Ws(f,h);(fe.line>=le.to||fe.lineP.bottom?20:0;me&&setTimeout(dt(e,function(){R==te&&(f.scroller.scrollTop+=me,_(J))}),50)}}function q(J){e.state.selectingText=!1,R=1/0,J&&(Ct(J),f.input.focus()),wt(f.wrapper.ownerDocument,"mousemove",Z),wt(f.wrapper.ownerDocument,"mouseup",$),h.history.lastSelOrigin=null}var Z=dt(e,function(J){J.buttons===0||!Tr(J)?q(J):_(J)}),$=dt(e,q);e.state.selectingText=$,ae(f.wrapper.ownerDocument,"mousemove",Z),ae(f.wrapper.ownerDocument,"mouseup",$)}function Bm(e,i){var s=i.anchor,o=i.head,f=ie(e.doc,s.line);if(Q(s,o)==0&&s.sticky==o.sticky)return i;var h=Ce(f);if(!h)return i;var p=Pi(h,s.ch,s.sticky),v=h[p];if(v.from!=s.ch&&v.to!=s.ch)return i;var y=p+(v.from==s.ch==(v.level!=1)?0:1);if(y==0||y==h.length)return i;var b;if(o.line!=s.line)b=(o.line-s.line)*(e.doc.direction=="ltr"?1:-1)>0;else{var O=Pi(h,o.ch,o.sticky),H=O-p||(o.ch-s.ch)*(v.level==1?-1:1);O==y-1||O==y?b=H<0:b=H>0}var F=h[y+(b?-1:0)],P=b==(F.level==1),R=P?F.from:F.to,_=P?"after":"before";return s.ch==R&&s.sticky==_?i:new Me(new I(s.line,R,_),o)}function rc(e,i,s,o){var f,h;if(i.touches)f=i.touches[0].clientX,h=i.touches[0].clientY;else try{f=i.clientX,h=i.clientY}catch{return!1}if(f>=Math.floor(e.display.gutters.getBoundingClientRect().right))return!1;o&&Ct(i);var p=e.display,v=p.lineDiv.getBoundingClientRect();if(h>v.bottom||!Zt(e,s))return Ft(i);h-=v.top-p.viewOffset;for(var y=0;y=f){var O=N(e.doc,h),H=e.display.gutterSpecs[y];return je(e,s,e,O,H.className,i),Ft(i)}}}function tu(e,i){return rc(e,i,"gutterClick",!0)}function ic(e,i){pi(e.display,i)||Rm(e,i)||qe(e,i,"contextmenu")||we||e.display.input.onContextMenu(i)}function Rm(e,i){return Zt(e,"gutterContextMenu")?rc(e,i,"gutterContextMenu",!1):!1}function nc(e){e.display.wrapper.className=e.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+e.options.theme.replace(/(^|\s)\s*/g," cm-s-"),uo(e)}var hl={toString:function(){return"CodeMirror.Init"}},lc={},js={};function zm(e){var i=e.optionHandlers;function s(o,f,h,p){e.defaults[o]=f,h&&(i[o]=p?function(v,y,b){b!=hl&&h(v,y,b)}:h)}e.defineOption=s,e.Init=hl,s("value","",function(o,f){return o.setValue(f)},!0),s("mode",null,function(o,f){o.doc.modeOption=f,Xf(o)},!0),s("indentUnit",2,Xf,!0),s("indentWithTabs",!1),s("smartIndent",!0),s("tabSize",4,function(o){xo(o),uo(o),It(o)},!0),s("lineSeparator",null,function(o,f){if(o.doc.lineSep=f,!!f){var h=[],p=o.doc.first;o.doc.iter(function(y){for(var b=0;;){var O=y.text.indexOf(f,b);if(O==-1)break;b=O+f.length,h.push(I(p,O))}p++});for(var v=h.length-1;v>=0;v--)sl(o.doc,f,h[v],I(h[v].line,h[v].ch+f.length))}}),s("specialChars",/[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b\u200e\u200f\u2028\u2029\u202d\u202e\u2066\u2067\u2069\ufeff\ufff9-\ufffc]/g,function(o,f,h){o.state.specialChars=new RegExp(f.source+(f.test(" ")?"":"| "),"g"),h!=hl&&o.refresh()}),s("specialCharPlaceholder",gv,function(o){return o.refresh()},!0),s("electricChars",!0),s("inputStyle",D?"contenteditable":"textarea",function(){throw new Error("inputStyle can not (yet) be changed in a running editor")},!0),s("spellcheck",!1,function(o,f){return o.getInputField().spellcheck=f},!0),s("autocorrect",!1,function(o,f){return o.getInputField().autocorrect=f},!0),s("autocapitalize",!1,function(o,f){return o.getInputField().autocapitalize=f},!0),s("rtlMoveVisually",!K),s("wholeLineUpdateBefore",!0),s("theme","default",function(o){nc(o),yo(o)},!0),s("keyMap","default",function(o,f,h){var p=Ks(f),v=h!=hl&&Ks(h);v&&v.detach&&v.detach(o,p),p.attach&&p.attach(o,v||null)}),s("extraKeys",null),s("configureMouse",null),s("lineWrapping",!1,Um,!0),s("gutters",[],function(o,f){o.display.gutterSpecs=_f(f,o.options.lineNumbers),yo(o)},!0),s("fixedGutter",!0,function(o,f){o.display.gutters.style.left=f?Nf(o.display)+"px":"0",o.refresh()},!0),s("coverGutterNextToScrollbar",!1,function(o){return il(o)},!0),s("scrollbarStyle","native",function(o){sd(o),il(o),o.display.scrollbars.setScrollTop(o.doc.scrollTop),o.display.scrollbars.setScrollLeft(o.doc.scrollLeft)},!0),s("lineNumbers",!1,function(o,f){o.display.gutterSpecs=_f(o.options.gutters,f),yo(o)},!0),s("firstLineNumber",1,yo,!0),s("lineNumberFormatter",function(o){return o},yo,!0),s("showCursorWhenSelecting",!1,ho,!0),s("resetSelectionOnContextMenu",!0),s("lineWiseCopyCut",!0),s("pasteLinesPerSelection",!0),s("selectionsMayTouch",!1),s("readOnly",!1,function(o,f){f=="nocursor"&&(tl(o),o.display.input.blur()),o.display.input.readOnlyChanged(f)}),s("screenReaderLabel",null,function(o,f){f=f===""?null:f,o.display.input.screenReaderLabelChanged(f)}),s("disableInput",!1,function(o,f){f||o.display.input.reset()},!0),s("dragDrop",!0,Gm),s("allowDropFileTypes",null),s("cursorBlinkRate",530),s("cursorScrollMargin",0),s("cursorHeight",1,ho,!0),s("singleCursorHeightPerLine",!0,ho,!0),s("workTime",100),s("workDelay",100),s("flattenSpans",!0,xo,!0),s("addModeClass",!1,xo,!0),s("pollInterval",100),s("undoDepth",200,function(o,f){return o.doc.history.undoDepth=f}),s("historyEventDelay",1250),s("viewportMargin",10,function(o){return o.refresh()},!0),s("maxHighlightLength",1e4,xo,!0),s("moveInputWithCursor",!0,function(o,f){f||o.display.input.resetPosition()}),s("tabindex",null,function(o,f){return o.display.input.getField().tabIndex=f||""}),s("autofocus",null),s("direction","ltr",function(o,f){return o.doc.setDirection(f)},!0),s("phrases",null)}function Gm(e,i,s){var o=s&&s!=hl;if(!i!=!o){var f=e.display.dragFunctions,h=i?ae:wt;h(e.display.scroller,"dragstart",f.start),h(e.display.scroller,"dragenter",f.enter),h(e.display.scroller,"dragover",f.over),h(e.display.scroller,"dragleave",f.leave),h(e.display.scroller,"drop",f.drop)}}function Um(e){e.options.lineWrapping?(Ee(e.display.wrapper,"CodeMirror-wrap"),e.display.sizer.style.minWidth="",e.display.sizerWidth=null):(ke(e.display.wrapper,"CodeMirror-wrap"),wf(e)),Hf(e),It(e),uo(e),setTimeout(function(){return il(e)},100)}function Ge(e,i){var s=this;if(!(this instanceof Ge))return new Ge(e,i);this.options=i=i?ye(i):{},ye(lc,i,!1);var o=i.value;typeof o=="string"?o=new Bt(o,i.mode,null,i.lineSeparator,i.direction):i.mode&&(o.modeOption=i.mode),this.doc=o;var f=new Ge.inputStyles[i.inputStyle](this),h=this.display=new tm(e,o,f,i);h.wrapper.CodeMirror=this,nc(this),i.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),sd(this),this.state={keyMaps:[],overlays:[],modeGen:0,overwrite:!1,delayingBlurEvent:!1,focused:!1,suppressEdits:!1,pasteIncoming:-1,cutIncoming:-1,selectingText:!1,draggingText:!1,highlight:new _r,keySeq:null,specialChars:null},i.autofocus&&!D&&h.input.focus(),d&&c<11&&setTimeout(function(){return s.display.input.reset(!0)},20),_m(this),bm(),vn(this),this.curOp.forceUpdate=!0,md(this,o),i.autofocus&&!D||this.hasFocus()?setTimeout(function(){s.hasFocus()&&!s.state.focused&&Ef(s)},20):tl(this);for(var p in js)js.hasOwnProperty(p)&&js[p](this,i[p],hl);ud(this),i.finishInit&&i.finishInit(this);for(var v=0;v20*20}ae(i.scroller,"touchstart",function(y){if(!qe(e,y)&&!h(y)&&!tu(e,y)){i.input.ensurePolled(),clearTimeout(s);var b=+new Date;i.activeTouch={start:b,moved:!1,prev:b-o.end<=300?o:null},y.touches.length==1&&(i.activeTouch.left=y.touches[0].pageX,i.activeTouch.top=y.touches[0].pageY)}}),ae(i.scroller,"touchmove",function(){i.activeTouch&&(i.activeTouch.moved=!0)}),ae(i.scroller,"touchend",function(y){var b=i.activeTouch;if(b&&!pi(i,y)&&b.left!=null&&!b.moved&&new Date-b.start<300){var O=e.coordsChar(i.activeTouch,"page"),H;!b.prev||p(b,b.prev)?H=new Me(O,O):!b.prev.prev||p(b,b.prev.prev)?H=e.findWordAt(O):H=new Me(I(O.line,0),ce(e.doc,I(O.line+1,0))),e.setSelection(H.anchor,H.head),e.focus(),Ct(y)}f()}),ae(i.scroller,"touchcancel",f),ae(i.scroller,"scroll",function(){i.scroller.clientHeight&&(po(e,i.scroller.scrollTop),pn(e,i.scroller.scrollLeft,!0),je(e,"scroll",e))}),ae(i.scroller,"mousewheel",function(y){return cd(e,y)}),ae(i.scroller,"DOMMouseScroll",function(y){return cd(e,y)}),ae(i.wrapper,"scroll",function(){return i.wrapper.scrollTop=i.wrapper.scrollLeft=0}),i.dragFunctions={enter:function(y){qe(e,y)||Fi(y)},over:function(y){qe(e,y)||(xm(e,y),Fi(y))},start:function(y){return ym(e,y)},drop:dt(e,mm),leave:function(y){qe(e,y)||Gd(e)}};var v=i.input.getField();ae(v,"keyup",function(y){return $d.call(e,y)}),ae(v,"keydown",dt(e,Qd)),ae(v,"keypress",dt(e,Vd)),ae(v,"focus",function(y){return Ef(e,y)}),ae(v,"blur",function(y){return tl(e,y)})}var ru=[];Ge.defineInitHook=function(e){return ru.push(e)};function Ho(e,i,s,o){var f=e.doc,h;s==null&&(s="add"),s=="smart"&&(f.mode.indent?h=lo(e,i).state:s="prev");var p=e.options.tabSize,v=ie(f,i),y=Oe(v.text,null,p);v.stateAfter&&(v.stateAfter=null);var b=v.text.match(/^\s*/)[0],O;if(!o&&!/\S/.test(v.text))O=0,s="not";else if(s=="smart"&&(O=f.mode.indent(h,v.text.slice(b.length),v.text),O==Ni||O>150)){if(!o)return;s="prev"}s=="prev"?i>f.first?O=Oe(ie(f,i-1).text,null,p):O=0:s=="add"?O=y+e.options.indentUnit:s=="subtract"?O=y-e.options.indentUnit:typeof s=="number"&&(O=y+s),O=Math.max(0,O);var H="",F=0;if(e.options.indentWithTabs)for(var P=Math.floor(O/p);P;--P)F+=p,H+=" ";if(Fp,y=cr(i),b=null;if(v&&o.ranges.length>1)if(Wr&&Wr.text.join(` +`)==i){if(o.ranges.length%Wr.text.length==0){b=[];for(var O=0;O=0;F--){var P=o.ranges[F],R=P.from(),_=P.to();P.empty()&&(s&&s>0?R=I(R.line,R.ch-s):e.state.overwrite&&!v?_=I(_.line,Math.min(ie(h,_.line).text.length,_.ch+Le(y).length)):v&&Wr&&Wr.lineWise&&Wr.text.join(` +`)==y.join(` +`)&&(R=_=I(R.line,0)));var q={from:R,to:_,text:b?b[F%b.length]:y,origin:f||(v?"paste":e.state.cutIncoming>p?"cut":"+input")};ol(e.doc,q),ht(e,"inputRead",e,q)}i&&!v&&sc(e,i),rl(e),e.curOp.updateInput<2&&(e.curOp.updateInput=H),e.curOp.typing=!0,e.state.pasteIncoming=e.state.cutIncoming=-1}function oc(e,i){var s=e.clipboardData&&e.clipboardData.getData("Text");if(s)return e.preventDefault(),!i.isReadOnly()&&!i.options.disableInput&&i.hasFocus()&&Jt(i,function(){return iu(i,s,0,null,"paste")}),!0}function sc(e,i){if(!(!e.options.electricChars||!e.options.smartIndent))for(var s=e.doc.sel,o=s.ranges.length-1;o>=0;o--){var f=s.ranges[o];if(!(f.head.ch>100||o&&s.ranges[o-1].head.line==f.head.line)){var h=e.getModeAt(f.head),p=!1;if(h.electricChars){for(var v=0;v-1){p=Ho(e,f.head.line,"smart");break}}else h.electricInput&&h.electricInput.test(ie(e.doc,f.head.line).text.slice(0,f.head.ch))&&(p=Ho(e,f.head.line,"smart"));p&&ht(e,"electricInput",e,f.head.line)}}}function ac(e){for(var i=[],s=[],o=0;oh&&(Ho(this,v.head.line,o,!0),h=v.head.line,p==this.doc.sel.primIndex&&rl(this));else{var y=v.from(),b=v.to(),O=Math.max(h,y.line);h=Math.min(this.lastLine(),b.line-(b.ch?0:1))+1;for(var H=O;H0&&Zf(this.doc,p,new Me(y,F[p].to()),lr)}}}),getTokenAt:function(o,f){return xh(this,o,f)},getLineTokens:function(o,f){return xh(this,I(o),f,!0)},getTokenTypeAt:function(o){o=ce(this.doc,o);var f=vh(this,ie(this.doc,o.line)),h=0,p=(f.length-1)/2,v=o.ch,y;if(v==0)y=f[2];else for(;;){var b=h+p>>1;if((b?f[b*2-1]:0)>=v)p=b;else if(f[b*2+1]y&&(o=y,p=!0),v=ie(this.doc,o)}else v=o;return As(this,v,{top:0,left:0},f||"page",h||p).top+(p?this.doc.height-ci(v):0)},defaultTextHeight:function(){return Vn(this.display)},defaultCharWidth:function(){return el(this.display)},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(o,f,h,p,v){var y=this.display;o=Nr(this,ce(this.doc,o));var b=o.bottom,O=o.left;if(f.style.position="absolute",f.setAttribute("cm-ignore-events","true"),this.display.input.setUneditable(f),y.sizer.appendChild(f),p=="over")b=o.top;else if(p=="above"||p=="near"){var H=Math.max(y.wrapper.clientHeight,this.doc.height),F=Math.max(y.sizer.clientWidth,y.lineSpace.clientWidth);(p=="above"||o.bottom+f.offsetHeight>H)&&o.top>f.offsetHeight?b=o.top-f.offsetHeight:o.bottom+f.offsetHeight<=H&&(b=o.bottom),O+f.offsetWidth>F&&(O=F-f.offsetWidth)}f.style.top=b+"px",f.style.left=f.style.right="",v=="right"?(O=y.sizer.clientWidth-f.offsetWidth,f.style.right="0px"):(v=="left"?O=0:v=="middle"&&(O=(y.sizer.clientWidth-f.offsetWidth)/2),f.style.left=O+"px"),h&&Gv(this,{left:O,top:b,right:O+f.offsetWidth,bottom:b+f.offsetHeight})},triggerOnKeyDown:Dt(Qd),triggerOnKeyPress:Dt(Vd),triggerOnKeyUp:$d,triggerOnMouseDown:Dt(ec),execCommand:function(o){if(Ao.hasOwnProperty(o))return Ao[o].call(null,this)},triggerElectric:Dt(function(o){sc(this,o)}),findPosH:function(o,f,h,p){var v=1;f<0&&(v=-1,f=-f);for(var y=ce(this.doc,o),b=0;b0&&O(h.charAt(p-1));)--p;for(;v.5||this.options.lineWrapping)&&Hf(this),je(this,"refresh",this)}),swapDoc:Dt(function(o){var f=this.doc;return f.cm=null,this.state.selectingText&&this.state.selectingText(),md(this,o),uo(this),this.display.input.reset(),co(this,o.scrollLeft,o.scrollTop),this.curOp.forceScroll=!0,ht(this,"swapDoc",this,f),f}),phrase:function(o){var f=this.options.phrases;return f&&Object.prototype.hasOwnProperty.call(f,o)?f[o]:o},getInputField:function(){return this.display.input.getField()},getWrapperElement:function(){return this.display.wrapper},getScrollerElement:function(){return this.display.scroller},getGutterElement:function(){return this.display.gutters}},Lr(e),e.registerHelper=function(o,f,h){s.hasOwnProperty(o)||(s[o]=e[o]={_global:[]}),s[o][f]=h},e.registerGlobalHelper=function(o,f,h,p){e.registerHelper(o,f,p),s[o]._global.push({pred:h,val:p})}}function lu(e,i,s,o,f){var h=i,p=s,v=ie(e,i.line),y=f&&e.direction=="rtl"?-s:s;function b(){var $=i.line+y;return $=e.first+e.size?!1:(i=new I($,i.ch,i.sticky),v=ie(e,$))}function O($){var J;if(o=="codepoint"){var te=v.text.charCodeAt(i.ch+(s>0?0:-1));if(isNaN(te))J=null;else{var fe=s>0?te>=55296&&te<56320:te>=56320&&te<57343;J=new I(i.line,Math.max(0,Math.min(v.text.length,i.ch+s*(fe?2:1))),-s)}}else f?J=Lm(e.cm,v,i,s):J=Qf(v,i,s);if(J==null)if(!$&&b())i=$f(f,e.cm,v,i.line,y);else return!1;else i=J;return!0}if(o=="char"||o=="codepoint")O();else if(o=="column")O(!0);else if(o=="word"||o=="group")for(var H=null,F=o=="group",P=e.cm&&e.cm.getHelper(i,"wordChars"),R=!0;!(s<0&&!O(!R));R=!1){var _=v.text.charAt(i.ch)||` +`,q=ai(_,P)?"w":F&&_==` +`?"n":!F||/\s/.test(_)?null:"p";if(F&&!R&&!q&&(q="s"),H&&H!=q){s<0&&(s=1,O(),i.sticky="after");break}if(q&&(H=q),s>0&&!O(!R))break}var Z=Gs(e,i,h,p,!0);return Te(h,Z)&&(Z.hitSide=!0),Z}function uc(e,i,s,o){var f=e.doc,h=i.left,p;if(o=="page"){var v=Math.min(e.display.wrapper.clientHeight,pe(e).innerHeight||f(e).documentElement.clientHeight),y=Math.max(v-.5*Vn(e.display),3);p=(s>0?i.bottom:i.top)+s*y}else o=="line"&&(p=s>0?i.bottom+3:i.top-3);for(var b;b=Af(e,h,p),!!b.outside;){if(s<0?p<=0:p>=f.height){b.hitSide=!0;break}p+=s*5}return b}var Ne=function(e){this.cm=e,this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null,this.polling=new _r,this.composing=null,this.gracePeriod=!1,this.readDOMTimeout=null};Ne.prototype.init=function(e){var i=this,s=this,o=s.cm,f=s.div=e.lineDiv;f.contentEditable=!0,nu(f,o.options.spellcheck,o.options.autocorrect,o.options.autocapitalize);function h(v){for(var y=v.target;y;y=y.parentNode){if(y==f)return!0;if(/\bCodeMirror-(?:line)?widget\b/.test(y.className))break}return!1}ae(f,"paste",function(v){!h(v)||qe(o,v)||oc(v,o)||c<=11&&setTimeout(dt(o,function(){return i.updateFromDOM()}),20)}),ae(f,"compositionstart",function(v){i.composing={data:v.data,done:!1}}),ae(f,"compositionupdate",function(v){i.composing||(i.composing={data:v.data,done:!1})}),ae(f,"compositionend",function(v){i.composing&&(v.data!=i.composing.data&&i.readFromDOMSoon(),i.composing.done=!0)}),ae(f,"touchstart",function(){return s.forceCompositionEnd()}),ae(f,"input",function(){i.composing||i.readFromDOMSoon()});function p(v){if(!(!h(v)||qe(o,v))){if(o.somethingSelected())qs({lineWise:!1,text:o.getSelections()}),v.type=="cut"&&o.replaceSelection("",null,"cut");else if(o.options.lineWiseCopyCut){var y=ac(o);qs({lineWise:!0,text:y.text}),v.type=="cut"&&o.operation(function(){o.setSelections(y.ranges,0,lr),o.replaceSelection("",null,"cut")})}else return;if(v.clipboardData){v.clipboardData.clearData();var b=Wr.text.join(` +`);if(v.clipboardData.setData("Text",b),v.clipboardData.getData("Text")==b){v.preventDefault();return}}var O=fc(),H=O.firstChild;nu(H),o.display.lineSpace.insertBefore(O,o.display.lineSpace.firstChild),H.value=Wr.text.join(` +`);var F=ze(ft(f));nr(H),setTimeout(function(){o.display.lineSpace.removeChild(O),F.focus(),F==f&&s.showPrimarySelection()},50)}}ae(f,"copy",p),ae(f,"cut",p)},Ne.prototype.screenReaderLabelChanged=function(e){e?this.div.setAttribute("aria-label",e):this.div.removeAttribute("aria-label")},Ne.prototype.prepareSelection=function(){var e=ed(this.cm,!1);return e.focus=ze(ft(this.div))==this.div,e},Ne.prototype.showSelection=function(e,i){!e||!this.cm.display.view.length||((e.focus||i)&&this.showPrimarySelection(),this.showMultipleSelections(e))},Ne.prototype.getSelection=function(){return this.cm.display.wrapper.ownerDocument.getSelection()},Ne.prototype.showPrimarySelection=function(){var e=this.getSelection(),i=this.cm,s=i.doc.sel.primary(),o=s.from(),f=s.to();if(i.display.viewTo==i.display.viewFrom||o.line>=i.display.viewTo||f.line=i.display.viewFrom&&hc(i,o)||{node:v[0].measure.map[2],offset:0},b=f.linee.firstLine()&&(o=I(o.line-1,ie(e.doc,o.line-1).length)),f.ch==ie(e.doc,f.line).text.length&&f.linei.viewTo-1)return!1;var h,p,v;o.line==i.viewFrom||(h=cn(e,o.line))==0?(p=w(i.view[0].line),v=i.view[0].node):(p=w(i.view[h].line),v=i.view[h-1].node.nextSibling);var y=cn(e,f.line),b,O;if(y==i.view.length-1?(b=i.viewTo-1,O=i.lineDiv.lastChild):(b=w(i.view[y+1].line)-1,O=i.view[y+1].node.previousSibling),!v)return!1;for(var H=e.doc.splitLines(jm(e,v,O,p,b)),F=hi(e.doc,I(p,0),I(b,ie(e.doc,b).text.length));H.length>1&&F.length>1;)if(Le(H)==Le(F))H.pop(),F.pop(),b--;else if(H[0]==F[0])H.shift(),F.shift(),p++;else break;for(var P=0,R=0,_=H[0],q=F[0],Z=Math.min(_.length,q.length);Po.ch&&$.charCodeAt($.length-R-1)==J.charCodeAt(J.length-R-1);)P--,R++;H[H.length-1]=$.slice(0,$.length-R).replace(/^\u200b+/,""),H[0]=H[0].slice(P).replace(/\u200b+$/,"");var fe=I(p,P),le=I(b,F.length?Le(F).length-R:0);if(H.length>1||H[0]||Q(fe,le))return sl(e.doc,H,fe,le,"+input"),!0},Ne.prototype.ensurePolled=function(){this.forceCompositionEnd()},Ne.prototype.reset=function(){this.forceCompositionEnd()},Ne.prototype.forceCompositionEnd=function(){this.composing&&(clearTimeout(this.readDOMTimeout),this.composing=null,this.updateFromDOM(),this.div.blur(),this.div.focus())},Ne.prototype.readFromDOMSoon=function(){var e=this;this.readDOMTimeout==null&&(this.readDOMTimeout=setTimeout(function(){if(e.readDOMTimeout=null,e.composing)if(e.composing.done)e.composing=null;else return;e.updateFromDOM()},80))},Ne.prototype.updateFromDOM=function(){var e=this;(this.cm.isReadOnly()||!this.pollContent())&&Jt(this.cm,function(){return It(e.cm)})},Ne.prototype.setUneditable=function(e){e.contentEditable="false"},Ne.prototype.onKeyPress=function(e){e.charCode==0||this.composing||(e.preventDefault(),this.cm.isReadOnly()||dt(this.cm,iu)(this.cm,String.fromCharCode(e.charCode==null?e.keyCode:e.charCode),0))},Ne.prototype.readOnlyChanged=function(e){this.div.contentEditable=String(e!="nocursor")},Ne.prototype.onContextMenu=function(){},Ne.prototype.resetPosition=function(){},Ne.prototype.needsContentAttribute=!0;function hc(e,i){var s=Lf(e,i.line);if(!s||s.hidden)return null;var o=ie(e.doc,i.line),f=zh(s,o,i.line),h=Ce(o,e.doc.direction),p="left";if(h){var v=Pi(h,i.ch);p=v%2?"right":"left"}var y=_h(f.map,i.ch,p);return y.offset=y.collapse=="right"?y.end:y.start,y}function Xm(e){for(var i=e;i;i=i.parentNode)if(/CodeMirror-gutter-wrapper/.test(i.className))return!0;return!1}function dl(e,i){return i&&(e.bad=!0),e}function jm(e,i,s,o,f){var h="",p=!1,v=e.doc.lineSeparator(),y=!1;function b(P){return function(R){return R.id==P}}function O(){p&&(h+=v,y&&(h+=v),p=y=!1)}function H(P){P&&(O(),h+=P)}function F(P){if(P.nodeType==1){var R=P.getAttribute("cm-text");if(R){H(R);return}var _=P.getAttribute("cm-marker"),q;if(_){var Z=e.findMarks(I(o,0),I(f+1,0),b(+_));Z.length&&(q=Z[0].find(0))&&H(hi(e.doc,q.from,q.to).join(v));return}if(P.getAttribute("contenteditable")=="false")return;var $=/^(pre|div|p|li|table|br)$/i.test(P.nodeName);if(!/^br$/i.test(P.nodeName)&&P.textContent.length==0)return;$&&O();for(var J=0;J=9&&i.hasSelection&&(i.hasSelection=null),s.poll()}),ae(f,"paste",function(p){qe(o,p)||oc(p,o)||(o.state.pasteIncoming=+new Date,s.fastPoll())});function h(p){if(!qe(o,p)){if(o.somethingSelected())qs({lineWise:!1,text:o.getSelections()});else if(o.options.lineWiseCopyCut){var v=ac(o);qs({lineWise:!0,text:v.text}),p.type=="cut"?o.setSelections(v.ranges,null,lr):(s.prevInput="",f.value=v.text.join(` +`),nr(f))}else return;p.type=="cut"&&(o.state.cutIncoming=+new Date)}}ae(f,"cut",h),ae(f,"copy",h),ae(e.scroller,"paste",function(p){if(!(pi(e,p)||qe(o,p))){if(!f.dispatchEvent){o.state.pasteIncoming=+new Date,s.focus();return}var v=new Event("paste");v.clipboardData=p.clipboardData,f.dispatchEvent(v)}}),ae(e.lineSpace,"selectstart",function(p){pi(e,p)||Ct(p)}),ae(f,"compositionstart",function(){var p=o.getCursor("from");s.composing&&s.composing.range.clear(),s.composing={start:p,range:o.markText(p,o.getCursor("to"),{className:"CodeMirror-composing"})}}),ae(f,"compositionend",function(){s.composing&&(s.poll(),s.composing.range.clear(),s.composing=null)})},$e.prototype.createField=function(e){this.wrapper=fc(),this.textarea=this.wrapper.firstChild;var i=this.cm.options;nu(this.textarea,i.spellcheck,i.autocorrect,i.autocapitalize)},$e.prototype.screenReaderLabelChanged=function(e){e?this.textarea.setAttribute("aria-label",e):this.textarea.removeAttribute("aria-label")},$e.prototype.prepareSelection=function(){var e=this.cm,i=e.display,s=e.doc,o=ed(e);if(e.options.moveInputWithCursor){var f=Nr(e,s.sel.primary().head,"div"),h=i.wrapper.getBoundingClientRect(),p=i.lineDiv.getBoundingClientRect();o.teTop=Math.max(0,Math.min(i.wrapper.clientHeight-10,f.top+p.top-h.top)),o.teLeft=Math.max(0,Math.min(i.wrapper.clientWidth-10,f.left+p.left-h.left))}return o},$e.prototype.showSelection=function(e){var i=this.cm,s=i.display;Y(s.cursorDiv,e.cursors),Y(s.selectionDiv,e.selection),e.teTop!=null&&(this.wrapper.style.top=e.teTop+"px",this.wrapper.style.left=e.teLeft+"px")},$e.prototype.reset=function(e){if(!(this.contextMenuPending||this.composing&&e)){var i=this.cm;if(this.resetting=!0,i.somethingSelected()){this.prevInput="";var s=i.getSelection();this.textarea.value=s,i.state.focused&&nr(this.textarea),d&&c>=9&&(this.hasSelection=s)}else e||(this.prevInput=this.textarea.value="",d&&c>=9&&(this.hasSelection=null));this.resetting=!1}},$e.prototype.getField=function(){return this.textarea},$e.prototype.supportsTouch=function(){return!1},$e.prototype.focus=function(){if(this.cm.options.readOnly!="nocursor"&&(!D||ze(ft(this.textarea))!=this.textarea))try{this.textarea.focus()}catch{}},$e.prototype.blur=function(){this.textarea.blur()},$e.prototype.resetPosition=function(){this.wrapper.style.top=this.wrapper.style.left=0},$e.prototype.receivedFocus=function(){this.slowPoll()},$e.prototype.slowPoll=function(){var e=this;this.pollingFast||this.polling.set(this.cm.options.pollInterval,function(){e.poll(),e.cm.state.focused&&e.slowPoll()})},$e.prototype.fastPoll=function(){var e=!1,i=this;i.pollingFast=!0;function s(){var o=i.poll();!o&&!e?(e=!0,i.polling.set(60,s)):(i.pollingFast=!1,i.slowPoll())}i.polling.set(20,s)},$e.prototype.poll=function(){var e=this,i=this.cm,s=this.textarea,o=this.prevInput;if(this.contextMenuPending||this.resetting||!i.state.focused||Ii(s)&&!o&&!this.composing||i.isReadOnly()||i.options.disableInput||i.state.keySeq)return!1;var f=s.value;if(f==o&&!i.somethingSelected())return!1;if(d&&c>=9&&this.hasSelection===f||E&&/[\uf700-\uf7ff]/.test(f))return i.display.input.reset(),!1;if(i.doc.sel==i.display.selForContextMenu){var h=f.charCodeAt(0);if(h==8203&&!o&&(o="\u200B"),h==8666)return this.reset(),this.cm.execCommand("undo")}for(var p=0,v=Math.min(o.length,f.length);p1e3||f.indexOf(` +`)>-1?s.value=e.prevInput="":e.prevInput=f,e.composing&&(e.composing.range.clear(),e.composing.range=i.markText(e.composing.start,i.getCursor("to"),{className:"CodeMirror-composing"}))}),!0},$e.prototype.ensurePolled=function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)},$e.prototype.onKeyPress=function(){d&&c>=9&&(this.hasSelection=null),this.fastPoll()},$e.prototype.onContextMenu=function(e){var i=this,s=i.cm,o=s.display,f=i.textarea;i.contextMenuPending&&i.contextMenuPending();var h=dn(s,e),p=o.scroller.scrollTop;if(!h||k)return;var v=s.options.resetSelectionOnContextMenu;v&&s.doc.sel.contains(h)==-1&&dt(s,St)(s.doc,Ui(h),lr);var y=f.style.cssText,b=i.wrapper.style.cssText,O=i.wrapper.offsetParent.getBoundingClientRect();i.wrapper.style.cssText="position: static",f.style.cssText=`position: absolute; width: 30px; height: 30px; + top: `+(e.clientY-O.top-5)+"px; left: "+(e.clientX-O.left-5)+`px; + z-index: 1000; background: `+(d?"rgba(255, 255, 255, .05)":"transparent")+`; + outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);`;var H;g&&(H=f.ownerDocument.defaultView.scrollY),o.input.focus(),g&&f.ownerDocument.defaultView.scrollTo(null,H),o.input.reset(),s.somethingSelected()||(f.value=i.prevInput=" "),i.contextMenuPending=P,o.selForContextMenu=s.doc.sel,clearTimeout(o.detectingSelectAll);function F(){if(f.selectionStart!=null){var _=s.somethingSelected(),q="\u200B"+(_?f.value:"");f.value="\u21DA",f.value=q,i.prevInput=_?"":"\u200B",f.selectionStart=1,f.selectionEnd=q.length,o.selForContextMenu=s.doc.sel}}function P(){if(i.contextMenuPending==P&&(i.contextMenuPending=!1,i.wrapper.style.cssText=b,f.style.cssText=y,d&&c<9&&o.scrollbars.setScrollTop(o.scroller.scrollTop=p),f.selectionStart!=null)){(!d||d&&c<9)&&F();var _=0,q=function(){o.selForContextMenu==s.doc.sel&&f.selectionStart==0&&f.selectionEnd>0&&i.prevInput=="\u200B"?dt(s,Dd)(s):_++<10?o.detectingSelectAll=setTimeout(q,500):(o.selForContextMenu=null,o.input.reset())};o.detectingSelectAll=setTimeout(q,200)}}if(d&&c>=9&&F(),we){Fi(e);var R=function(){wt(window,"mouseup",R),setTimeout(P,20)};ae(window,"mouseup",R)}else setTimeout(P,50)},$e.prototype.readOnlyChanged=function(e){e||this.reset(),this.textarea.disabled=e=="nocursor",this.textarea.readOnly=!!e},$e.prototype.setUneditable=function(){},$e.prototype.needsContentAttribute=!1;function Ym(e,i){if(i=i?ye(i):{},i.value=e.value,!i.tabindex&&e.tabIndex&&(i.tabindex=e.tabIndex),!i.placeholder&&e.placeholder&&(i.placeholder=e.placeholder),i.autofocus==null){var s=ze(ft(e));i.autofocus=s==e||e.getAttribute("autofocus")!=null&&s==document.body}function o(){e.value=v.getValue()}var f;if(e.form&&(ae(e.form,"submit",o),!i.leaveSubmitMethodAlone)){var h=e.form;f=h.submit;try{var p=h.submit=function(){o(),h.submit=f,h.submit(),h.submit=p}}catch{}}i.finishInit=function(y){y.save=o,y.getTextArea=function(){return e},y.toTextArea=function(){y.toTextArea=isNaN,o(),e.parentNode.removeChild(y.getWrapperElement()),e.style.display="",e.form&&(wt(e.form,"submit",o),!i.leaveSubmitMethodAlone&&typeof e.form.submit=="function"&&(e.form.submit=f))}},e.style.display="none";var v=Ge(function(y){return e.parentNode.insertBefore(y,e.nextSibling)},i);return v}function Zm(e){e.off=wt,e.on=ae,e.wheelEventPixels=rm,e.Doc=Bt,e.splitLines=cr,e.countColumn=Oe,e.findColumn=Xr,e.isWordChar=eo,e.Pass=Ni,e.signal=je,e.Line=Jn,e.changeEnd=_i,e.scrollbarModel=od,e.Pos=I,e.cmpPos=Q,e.modes=Kn,e.mimeModes=Ar,e.resolveMode=Xn,e.getMode=jn,e.modeExtensions=Bi,e.extendMode=qn,e.copyState=qr,e.startState=Yn,e.innerMode=io,e.commands=Ao,e.keyMap=vi,e.keyName=jd,e.isModifierKey=Kd,e.lookupKey=fl,e.normalizeKeyMap=km,e.StringStream=Ye,e.SharedTextMarker=Lo,e.TextMarker=Xi,e.LineWidget=ko,e.e_preventDefault=Ct,e.e_stopPropagation=Un,e.e_stop=Fi,e.addClass=Ee,e.contains=_e,e.rmClass=ke,e.keyNames=ji}zm(Ge),Km(Ge);var Jm="iter insert remove copy getEditor constructor".split(" ");for(var Zs in Bt.prototype)Bt.prototype.hasOwnProperty(Zs)&&ve(Jm,Zs)<0&&(Ge.prototype[Zs]=function(e){return function(){return e.apply(this.doc,arguments)}}(Bt.prototype[Zs]));return Lr(Bt),Ge.inputStyles={textarea:$e,contenteditable:Ne},Ge.defineMode=function(e){!Ge.defaults.mode&&e!="null"&&(Ge.defaults.mode=e),Or.apply(this,arguments)},Ge.defineMIME=fn,Ge.defineMode("null",function(){return{token:function(e){return e.skipToEnd()}}}),Ge.defineMIME("text/plain","null"),Ge.defineExtension=function(e,i){Ge.prototype[e]=i},Ge.defineDocExtension=function(e,i){Bt.prototype[e]=i},Ge.fromTextArea=Ym,Zm(Ge),Ge.version="5.65.16",Ge})});var cg=Ut((hg,dg)=>{(function(t){typeof hg=="object"&&typeof dg=="object"?t(Ht()):typeof define=="function"&&define.amd?define(["../../lib/codemirror"],t):t(CodeMirror)})(function(t){"use strict";t.defineMode("javascript",function(r,n){var l=r.indentUnit,a=n.statementIndent,u=n.jsonld,d=n.json||u,c=n.trackScope!==!1,g=n.typescript,m=n.wordCharacters||/[\w$\xa1-\uffff]/,x=function(){function w(ut){return{type:ut,style:"keyword"}}var N=w("keyword a"),G=w("keyword b"),j=w("keyword c"),I=w("keyword d"),Q=w("operator"),Te={type:"atom",style:"atom"};return{if:w("if"),while:N,with:N,else:G,do:G,try:G,finally:G,return:I,break:I,continue:I,new:w("new"),delete:j,void:j,throw:j,debugger:w("debugger"),var:w("var"),const:w("var"),let:w("var"),function:w("function"),catch:w("catch"),for:w("for"),switch:w("switch"),case:w("case"),default:w("default"),in:Q,typeof:Q,instanceof:Q,true:Te,false:Te,null:Te,undefined:Te,NaN:Te,Infinity:Te,this:w("this"),class:w("class"),super:w("atom"),yield:j,export:w("export"),import:w("import"),extends:j,await:j}}(),S=/[+\-*&%=<>!?|~^@]/,k=/^@(context|id|value|language|type|container|list|set|reverse|index|base|vocab|graph)"/;function A(w){for(var N=!1,G,j=!1;(G=w.next())!=null;){if(!N){if(G=="/"&&!j)return;G=="["?j=!0:j&&G=="]"&&(j=!1)}N=!N&&G=="\\"}}var T,L;function C(w,N,G){return T=w,L=G,N}function M(w,N){var G=w.next();if(G=='"'||G=="'")return N.tokenize=D(G),N.tokenize(w,N);if(G=="."&&w.match(/^\d[\d_]*(?:[eE][+\-]?[\d_]+)?/))return C("number","number");if(G=="."&&w.match(".."))return C("spread","meta");if(/[\[\]{}\(\),;\:\.]/.test(G))return C(G);if(G=="="&&w.eat(">"))return C("=>","operator");if(G=="0"&&w.match(/^(?:x[\dA-Fa-f_]+|o[0-7_]+|b[01_]+)n?/))return C("number","number");if(/\d/.test(G))return w.match(/^[\d_]*(?:n|(?:\.[\d_]*)?(?:[eE][+\-]?[\d_]+)?)?/),C("number","number");if(G=="/")return w.eat("*")?(N.tokenize=E,E(w,N)):w.eat("/")?(w.skipToEnd(),C("comment","comment")):sr(w,N,1)?(A(w),w.match(/^\b(([gimyus])(?![gimyus]*\2))+\b/),C("regexp","string-2")):(w.eat("="),C("operator","operator",w.current()));if(G=="`")return N.tokenize=B,B(w,N);if(G=="#"&&w.peek()=="!")return w.skipToEnd(),C("meta","meta");if(G=="#"&&w.eatWhile(m))return C("variable","property");if(G=="<"&&w.match("!--")||G=="-"&&w.match("->")&&!/\S/.test(w.string.slice(0,w.start)))return w.skipToEnd(),C("comment","comment");if(S.test(G))return(G!=">"||!N.lexical||N.lexical.type!=">")&&(w.eat("=")?(G=="!"||G=="=")&&w.eat("="):/[<>*+\-|&?]/.test(G)&&(w.eat(G),G==">"&&w.eat(G))),G=="?"&&w.eat(".")?C("."):C("operator","operator",w.current());if(m.test(G)){w.eatWhile(m);var j=w.current();if(N.lastType!="."){if(x.propertyIsEnumerable(j)){var I=x[j];return C(I.type,I.style,j)}if(j=="async"&&w.match(/^(\s|\/\*([^*]|\*(?!\/))*?\*\/)*[\[\(\w]/,!1))return C("async","keyword",j)}return C("variable","variable",j)}}function D(w){return function(N,G){var j=!1,I;if(u&&N.peek()=="@"&&N.match(k))return G.tokenize=M,C("jsonld-keyword","meta");for(;(I=N.next())!=null&&!(I==w&&!j);)j=!j&&I=="\\";return j||(G.tokenize=M),C("string","string")}}function E(w,N){for(var G=!1,j;j=w.next();){if(j=="/"&&G){N.tokenize=M;break}G=j=="*"}return C("comment","comment")}function B(w,N){for(var G=!1,j;(j=w.next())!=null;){if(!G&&(j=="`"||j=="$"&&w.eat("{"))){N.tokenize=M;break}G=!G&&j=="\\"}return C("quasi","string-2",w.current())}var K="([{}])";function X(w,N){N.fatArrowAt&&(N.fatArrowAt=null);var G=w.string.indexOf("=>",w.start);if(!(G<0)){if(g){var j=/:\s*(?:\w+(?:<[^>]*>|\[\])?|\{[^}]*\})\s*$/.exec(w.string.slice(w.start,G));j&&(G=j.index)}for(var I=0,Q=!1,Te=G-1;Te>=0;--Te){var ut=w.string.charAt(Te),Et=K.indexOf(ut);if(Et>=0&&Et<3){if(!I){++Te;break}if(--I==0){ut=="("&&(Q=!0);break}}else if(Et>=3&&Et<6)++I;else if(m.test(ut))Q=!0;else if(/["'\/`]/.test(ut))for(;;--Te){if(Te==0)return;var Zn=w.string.charAt(Te-1);if(Zn==ut&&w.string.charAt(Te-2)!="\\"){Te--;break}}else if(Q&&!I){++Te;break}}Q&&!I&&(N.fatArrowAt=Te)}}var ee={atom:!0,number:!0,variable:!0,string:!0,regexp:!0,this:!0,import:!0,"jsonld-keyword":!0};function we(w,N,G,j,I,Q){this.indented=w,this.column=N,this.type=G,this.prev=I,this.info=Q,j!=null&&(this.align=j)}function he(w,N){if(!c)return!1;for(var G=w.localVars;G;G=G.next)if(G.name==N)return!0;for(var j=w.context;j;j=j.prev)for(var G=j.vars;G;G=G.next)if(G.name==N)return!0}function ke(w,N,G,j,I){var Q=w.cc;for(z.state=w,z.stream=I,z.marked=null,z.cc=Q,z.style=N,w.lexical.hasOwnProperty("align")||(w.lexical.align=!0);;){var Te=Q.length?Q.pop():d?ve:Oe;if(Te(G,j)){for(;Q.length&&Q[Q.length-1].lex;)Q.pop()();return z.marked?z.marked:G=="variable"&&he(w,j)?"variable-2":N}}}var z={state:null,column:null,marked:null,cc:null};function Y(){for(var w=arguments.length-1;w>=0;w--)z.cc.push(arguments[w])}function W(){return Y.apply(null,arguments),!0}function De(w,N){for(var G=N;G;G=G.next)if(G.name==w)return!0;return!1}function Qe(w){var N=z.state;if(z.marked="def",!!c){if(N.context){if(N.lexical.info=="var"&&N.context&&N.context.block){var G=_e(w,N.context);if(G!=null){N.context=G;return}}else if(!De(w,N.localVars)){N.localVars=new Be(w,N.localVars);return}}n.globalVars&&!De(w,N.globalVars)&&(N.globalVars=new Be(w,N.globalVars))}}function _e(w,N){if(N)if(N.block){var G=_e(w,N.prev);return G?G==N.prev?N:new Ee(G,N.vars,!0):null}else return De(w,N.vars)?N:new Ee(N.prev,new Be(w,N.vars),!1);else return null}function ze(w){return w=="public"||w=="private"||w=="protected"||w=="abstract"||w=="readonly"}function Ee(w,N,G){this.prev=w,this.vars=N,this.block=G}function Be(w,N){this.name=w,this.next=N}var nr=new Be("this",new Be("arguments",null));function tt(){z.state.context=new Ee(z.state.context,z.state.localVars,!1),z.state.localVars=nr}function bt(){z.state.context=new Ee(z.state.context,z.state.localVars,!0),z.state.localVars=null}tt.lex=bt.lex=!0;function ft(){z.state.localVars=z.state.context.vars,z.state.context=z.state.context.prev}ft.lex=!0;function pe(w,N){var G=function(){var j=z.state,I=j.indented;if(j.lexical.type=="stat")I=j.lexical.indented;else for(var Q=j.lexical;Q&&Q.type==")"&&Q.align;Q=Q.prev)I=Q.indented;j.lexical=new we(I,z.stream.column(),w,null,j.lexical,N)};return G.lex=!0,G}function ue(){var w=z.state;w.lexical.prev&&(w.lexical.type==")"&&(w.indented=w.lexical.indented),w.lexical=w.lexical.prev)}ue.lex=!0;function ye(w){function N(G){return G==w?W():w==";"||G=="}"||G==")"||G=="]"?Y():W(N)}return N}function Oe(w,N){return w=="var"?W(pe("vardef",N),Un,ye(";"),ue):w=="keyword a"?W(pe("form"),Ni,Oe,ue):w=="keyword b"?W(pe("form"),Oe,ue):w=="keyword d"?z.stream.match(/^\s*$/,!1)?W():W(pe("stat"),Kr,ye(";"),ue):w=="debugger"?W(ye(";")):w=="{"?W(pe("}"),bt,jr,ue,ft):w==";"?W():w=="if"?(z.state.lexical.info=="else"&&z.state.cc[z.state.cc.length-1]==ue&&z.state.cc.pop()(),W(pe("form"),Ni,Oe,ue,_n)):w=="function"?W(cr):w=="for"?W(pe("form"),bt,ys,Oe,ft,ue):w=="class"||g&&N=="interface"?(z.marked="keyword",W(pe("form",w=="class"?w:N),Kn,ue)):w=="variable"?g&&N=="declare"?(z.marked="keyword",W(Oe)):g&&(N=="module"||N=="enum"||N=="type")&&z.stream.match(/^\s*\w/,!1)?(z.marked="keyword",N=="enum"?W(ie):N=="type"?W(xs,ye("operator"),Ce,ye(";")):W(pe("form"),Ft,ye("{"),pe("}"),jr,ue,ue)):g&&N=="namespace"?(z.marked="keyword",W(pe("form"),ve,Oe,ue)):g&&N=="abstract"?(z.marked="keyword",W(Oe)):W(pe("stat"),hf):w=="switch"?W(pe("form"),Ni,ye("{"),pe("}","switch"),bt,jr,ue,ue,ft):w=="case"?W(ve,ye(":")):w=="default"?W(ye(":")):w=="catch"?W(pe("form"),tt,_r,Oe,ue,ft):w=="export"?W(pe("stat"),Xn,ue):w=="import"?W(pe("stat"),Bi,ue):w=="async"?W(Oe):N=="@"?W(ve,Oe):Y(pe("stat"),ve,ye(";"),ue)}function _r(w){if(w=="(")return W(Mr,ye(")"))}function ve(w,N){return lr(w,N,!1)}function Ot(w,N){return lr(w,N,!0)}function Ni(w){return w!="("?Y():W(pe(")"),Kr,ye(")"),ue)}function lr(w,N,G){if(z.state.fatArrowAt==z.stream.start){var j=G?sn:Le;if(w=="(")return W(tt,pe(")"),rt(Mr,")"),ue,ye("=>"),j,ft);if(w=="variable")return Y(tt,Ft,ye("=>"),j,ft)}var I=G?Xr:or;return ee.hasOwnProperty(w)?W(I):w=="function"?W(cr,I):w=="class"||g&&N=="interface"?(z.marked="keyword",W(pe("form"),pf,ue)):w=="keyword c"||w=="async"?W(G?Ot:ve):w=="("?W(pe(")"),Kr,ye(")"),ue,I):w=="operator"||w=="spread"?W(G?Ot:ve):w=="["?W(pe("]"),Ye,ue,I):w=="{"?Hi(ai,"}",null,I):w=="quasi"?Y(si,I):w=="new"?W(uf(G)):W()}function Kr(w){return w.match(/[;\}\)\],]/)?Y():Y(ve)}function or(w,N){return w==","?W(Kr):Xr(w,N,!1)}function Xr(w,N,G){var j=G==!1?or:Xr,I=G==!1?ve:Ot;if(w=="=>")return W(tt,G?sn:Le,ft);if(w=="operator")return/\+\+|--/.test(N)||g&&N=="!"?W(j):g&&N=="<"&&z.stream.match(/^([^<>]|<[^<>]*>)*>\s*\(/,!1)?W(pe(">"),rt(Ce,">"),ue,j):N=="?"?W(ve,ye(":"),I):W(I);if(w=="quasi")return Y(si,j);if(w!=";"){if(w=="(")return Hi(Ot,")","call",j);if(w==".")return W(eo,j);if(w=="[")return W(pe("]"),Kr,ye("]"),ue,j);if(g&&N=="as")return z.marked="keyword",W(Ce,j);if(w=="regexp")return z.state.lastType=z.marked="operator",z.stream.backUp(z.stream.pos-z.stream.start-1),W(I)}}function si(w,N){return w!="quasi"?Y():N.slice(N.length-2)!="${"?W(si):W(Kr,Vl)}function Vl(w){if(w=="}")return z.marked="string-2",z.state.tokenize=B,W(si)}function Le(w){return X(z.stream,z.state),Y(w=="{"?Oe:ve)}function sn(w){return X(z.stream,z.state),Y(w=="{"?Oe:Ot)}function uf(w){return function(N){return N=="."?W(w?gs:ps):N=="variable"&&g?W(Zt,w?Xr:or):Y(w?Ot:ve)}}function ps(w,N){if(N=="target")return z.marked="keyword",W(or)}function gs(w,N){if(N=="target")return z.marked="keyword",W(Xr)}function hf(w){return w==":"?W(ue,Oe):Y(or,ye(";"),ue)}function eo(w){if(w=="variable")return z.marked="property",W()}function ai(w,N){if(w=="async")return z.marked="property",W(ai);if(w=="variable"||z.style=="keyword"){if(z.marked="property",N=="get"||N=="set")return W(vs);var G;return g&&z.state.fatArrowAt==z.stream.start&&(G=z.stream.match(/^\s*:\s*/,!1))&&(z.state.fatArrowAt=z.stream.pos+G[0].length),W(fi)}else{if(w=="number"||w=="string")return z.marked=u?"property":z.style+" property",W(fi);if(w=="jsonld-keyword")return W(fi);if(g&&ze(N))return z.marked="keyword",W(ai);if(w=="[")return W(ve,Wi,ye("]"),fi);if(w=="spread")return W(Ot,fi);if(N=="*")return z.marked="keyword",W(ai);if(w==":")return Y(fi)}}function vs(w){return w!="variable"?Y(fi):(z.marked="property",W(cr))}function fi(w){if(w==":")return W(Ot);if(w=="(")return Y(cr)}function rt(w,N,G){function j(I,Q){if(G?G.indexOf(I)>-1:I==","){var Te=z.state.lexical;return Te.info=="call"&&(Te.pos=(Te.pos||0)+1),W(function(ut,Et){return ut==N||Et==N?Y():Y(w)},j)}return I==N||Q==N?W():G&&G.indexOf(";")>-1?Y(w):W(ye(N))}return function(I,Q){return I==N||Q==N?W():Y(w,j)}}function Hi(w,N,G){for(var j=3;j"),Ce);if(w=="quasi")return Y(wt,dr)}function ms(w){if(w=="=>")return W(Ce)}function ae(w){return w.match(/[\}\)\]]/)?W():w==","||w==";"?W(ae):Y(ui,ae)}function ui(w,N){if(w=="variable"||z.style=="keyword")return z.marked="property",W(ui);if(N=="?"||w=="number"||w=="string")return W(ui);if(w==":")return W(Ce);if(w=="[")return W(ye("variable"),an,ye("]"),ui);if(w=="(")return Y(Ii,ui);if(!w.match(/[;\}\)\],]/))return W()}function wt(w,N){return w!="quasi"?Y():N.slice(N.length-2)!="${"?W(wt):W(Ce,je)}function je(w){if(w=="}")return z.marked="string-2",z.state.tokenize=B,W(wt)}function qe(w,N){return w=="variable"&&z.stream.match(/^\s*[?:]/,!1)||N=="?"?W(qe):w==":"?W(Ce):w=="spread"?W(qe):Y(Ce)}function dr(w,N){if(N=="<")return W(pe(">"),rt(Ce,">"),ue,dr);if(N=="|"||w=="."||N=="&")return W(Ce);if(w=="[")return W(Ce,ye("]"),dr);if(N=="extends"||N=="implements")return z.marked="keyword",W(Ce);if(N=="?")return W(Ce,ye(":"),Ce)}function Zt(w,N){if(N=="<")return W(pe(">"),rt(Ce,">"),ue,dr)}function Lr(){return Y(Ce,Ct)}function Ct(w,N){if(N=="=")return W(Ce)}function Un(w,N){return N=="enum"?(z.marked="keyword",W(ie)):Y(Ft,Wi,Tr,cf)}function Ft(w,N){if(g&&ze(N))return z.marked="keyword",W(Ft);if(w=="variable")return Qe(N),W();if(w=="spread")return W(Ft);if(w=="[")return Hi(to,"]");if(w=="{")return Hi(Fi,"}")}function Fi(w,N){return w=="variable"&&!z.stream.match(/^\s*:/,!1)?(Qe(N),W(Tr)):(w=="variable"&&(z.marked="property"),w=="spread"?W(Ft):w=="}"?Y():w=="["?W(ve,ye("]"),ye(":"),Fi):W(ye(":"),Ft,Tr))}function to(){return Y(Ft,Tr)}function Tr(w,N){if(N=="=")return W(Ot)}function cf(w){if(w==",")return W(Un)}function _n(w,N){if(w=="keyword b"&&N=="else")return W(pe("form","else"),Oe,ue)}function ys(w,N){if(N=="await")return W(ys);if(w=="(")return W(pe(")"),ro,ue)}function ro(w){return w=="var"?W(Un,Ei):w=="variable"?W(Ei):Y(Ei)}function Ei(w,N){return w==")"?W():w==";"?W(Ei):N=="in"||N=="of"?(z.marked="keyword",W(ve,Ei)):Y(ve,Ei)}function cr(w,N){if(N=="*")return z.marked="keyword",W(cr);if(w=="variable")return Qe(N),W(cr);if(w=="(")return W(tt,pe(")"),rt(Mr,")"),ue,Pi,Oe,ft);if(g&&N=="<")return W(pe(">"),rt(Lr,">"),ue,cr)}function Ii(w,N){if(N=="*")return z.marked="keyword",W(Ii);if(w=="variable")return Qe(N),W(Ii);if(w=="(")return W(tt,pe(")"),rt(Mr,")"),ue,Pi,ft);if(g&&N=="<")return W(pe(">"),rt(Lr,">"),ue,Ii)}function xs(w,N){if(w=="keyword"||w=="variable")return z.marked="type",W(xs);if(N=="<")return W(pe(">"),rt(Lr,">"),ue)}function Mr(w,N){return N=="@"&&W(ve,Mr),w=="spread"?W(Mr):g&&ze(N)?(z.marked="keyword",W(Mr)):g&&w=="this"?W(Wi,Tr):Y(Ft,Wi,Tr)}function pf(w,N){return w=="variable"?Kn(w,N):Ar(w,N)}function Kn(w,N){if(w=="variable")return Qe(N),W(Ar)}function Ar(w,N){if(N=="<")return W(pe(">"),rt(Lr,">"),ue,Ar);if(N=="extends"||N=="implements"||g&&w==",")return N=="implements"&&(z.marked="keyword"),W(g?Ce:ve,Ar);if(w=="{")return W(pe("}"),Or,ue)}function Or(w,N){if(w=="async"||w=="variable"&&(N=="static"||N=="get"||N=="set"||g&&ze(N))&&z.stream.match(/^\s+#?[\w$\xa1-\uffff]/,!1))return z.marked="keyword",W(Or);if(w=="variable"||z.style=="keyword")return z.marked="property",W(fn,Or);if(w=="number"||w=="string")return W(fn,Or);if(w=="[")return W(ve,Wi,ye("]"),fn,Or);if(N=="*")return z.marked="keyword",W(Or);if(g&&w=="(")return Y(Ii,Or);if(w==";"||w==",")return W(Or);if(w=="}")return W();if(N=="@")return W(ve,Or)}function fn(w,N){if(N=="!"||N=="?")return W(fn);if(w==":")return W(Ce,Tr);if(N=="=")return W(Ot);var G=z.state.lexical.prev,j=G&&G.info=="interface";return Y(j?Ii:cr)}function Xn(w,N){return N=="*"?(z.marked="keyword",W(Yn,ye(";"))):N=="default"?(z.marked="keyword",W(ve,ye(";"))):w=="{"?W(rt(jn,"}"),Yn,ye(";")):Y(Oe)}function jn(w,N){if(N=="as")return z.marked="keyword",W(ye("variable"));if(w=="variable")return Y(Ot,jn)}function Bi(w){return w=="string"?W():w=="("?Y(ve):w=="."?Y(or):Y(qn,qr,Yn)}function qn(w,N){return w=="{"?Hi(qn,"}"):(w=="variable"&&Qe(N),N=="*"&&(z.marked="keyword"),W(io))}function qr(w){if(w==",")return W(qn,qr)}function io(w,N){if(N=="as")return z.marked="keyword",W(qn)}function Yn(w,N){if(N=="from")return z.marked="keyword",W(ve)}function Ye(w){return w=="]"?W():Y(rt(Ot,"]"))}function ie(){return Y(pe("form"),Ft,ye("{"),pe("}"),rt(hi,"}"),ue,ue)}function hi(){return Y(Ft,Tr)}function no(w,N){return w.lastType=="operator"||w.lastType==","||S.test(N.charAt(0))||/[,.]/.test(N.charAt(0))}function sr(w,N,G){return N.tokenize==M&&/^(?:operator|sof|keyword [bcd]|case|new|export|default|spread|[\[{}\(,;:]|=>)$/.test(N.lastType)||N.lastType=="quasi"&&/\{\s*$/.test(w.string.slice(0,w.pos-(G||0)))}return{startState:function(w){var N={tokenize:M,lastType:"sof",cc:[],lexical:new we((w||0)-l,0,"block",!1),localVars:n.localVars,context:n.localVars&&new Ee(null,null,!1),indented:w||0};return n.globalVars&&typeof n.globalVars=="object"&&(N.globalVars=n.globalVars),N},token:function(w,N){if(w.sol()&&(N.lexical.hasOwnProperty("align")||(N.lexical.align=!1),N.indented=w.indentation(),X(w,N)),N.tokenize!=E&&w.eatSpace())return null;var G=N.tokenize(w,N);return T=="comment"?G:(N.lastType=T=="operator"&&(L=="++"||L=="--")?"incdec":T,ke(N,G,T,L,w))},indent:function(w,N){if(w.tokenize==E||w.tokenize==B)return t.Pass;if(w.tokenize!=M)return 0;var G=N&&N.charAt(0),j=w.lexical,I;if(!/^\s*else\b/.test(N))for(var Q=w.cc.length-1;Q>=0;--Q){var Te=w.cc[Q];if(Te==ue)j=j.prev;else if(Te!=_n&&Te!=ft)break}for(;(j.type=="stat"||j.type=="form")&&(G=="}"||(I=w.cc[w.cc.length-1])&&(I==or||I==Xr)&&!/^[,\.=+\-*:?[\(]/.test(N));)j=j.prev;a&&j.type==")"&&j.prev.type=="stat"&&(j=j.prev);var ut=j.type,Et=G==ut;return ut=="vardef"?j.indented+(w.lastType=="operator"||w.lastType==","?j.info.length+1:0):ut=="form"&&G=="{"?j.indented:ut=="form"?j.indented+l:ut=="stat"?j.indented+(no(w,N)?a||l:0):j.info=="switch"&&!Et&&n.doubleIndentSwitch!=!1?j.indented+(/^(?:case|default)\b/.test(N)?l:2*l):j.align?j.column+(Et?0:1):j.indented+(Et?0:l)},electricInput:/^\s*(?:case .*?:|default:|\{|\})$/,blockCommentStart:d?null:"/*",blockCommentEnd:d?null:"*/",blockCommentContinue:d?null:" * ",lineComment:d?null:"//",fold:"brace",closeBrackets:"()[]{}''\"\"``",helperType:d?"json":"javascript",jsonldMode:u,jsonMode:d,expressionAllowed:sr,skipExpression:function(w){ke(w,"atom","atom","true",new t.StringStream("",2,null))}}}),t.registerHelper("wordChars","javascript",/[\w$]/),t.defineMIME("text/javascript","javascript"),t.defineMIME("text/ecmascript","javascript"),t.defineMIME("application/javascript","javascript"),t.defineMIME("application/x-javascript","javascript"),t.defineMIME("application/ecmascript","javascript"),t.defineMIME("application/json",{name:"javascript",json:!0}),t.defineMIME("application/x-json",{name:"javascript",json:!0}),t.defineMIME("application/manifest+json",{name:"javascript",json:!0}),t.defineMIME("application/ld+json",{name:"javascript",jsonld:!0}),t.defineMIME("text/typescript",{name:"javascript",typescript:!0}),t.defineMIME("application/typescript",{name:"javascript",typescript:!0})})});var vg=Ut((pg,gg)=>{(function(t){typeof pg=="object"&&typeof gg=="object"?t(Ht()):typeof define=="function"&&define.amd?define(["../../lib/codemirror"],t):t(CodeMirror)})(function(t){var r={pairs:`()[]{}''""`,closeBefore:`)]}'":;>`,triples:"",explode:"[]{}"},n=t.Pos;t.defineOption("autoCloseBrackets",!1,function(L,C,M){M&&M!=t.Init&&(L.removeKeyMap(a),L.state.closeBrackets=null),C&&(u(l(C,"pairs")),L.state.closeBrackets=C,L.addKeyMap(a))});function l(L,C){return C=="pairs"&&typeof L=="string"?L:typeof L=="object"&&L[C]!=null?L[C]:r[C]}var a={Backspace:g,Enter:m};function u(L){for(var C=0;C=0;E--){var K=D[E].head;L.replaceRange("",n(K.line,K.ch-1),n(K.line,K.ch+1),"+delete")}}function m(L){var C=c(L),M=C&&l(C,"explode");if(!M||L.getOption("disableInput"))return t.Pass;for(var D=L.listSelections(),E=0;E0?{line:K.head.line,ch:K.head.ch+C}:{line:K.head.line-1};M.push({anchor:X,head:X})}L.setSelections(M,E)}function S(L){var C=t.cmpPos(L.anchor,L.head)>0;return{anchor:new n(L.anchor.line,L.anchor.ch+(C?-1:1)),head:new n(L.head.line,L.head.ch+(C?1:-1))}}function k(L,C){var M=c(L);if(!M||L.getOption("disableInput"))return t.Pass;var D=l(M,"pairs"),E=D.indexOf(C);if(E==-1)return t.Pass;for(var B=l(M,"closeBefore"),K=l(M,"triples"),X=D.charAt(E+1)==C,ee=L.listSelections(),we=E%2==0,he,ke=0;ke=0&&L.getRange(Y,n(Y.line,Y.ch+3))==C+C+C?W="skipThree":W="skip";else if(X&&Y.ch>1&&K.indexOf(C)>=0&&L.getRange(n(Y.line,Y.ch-2),Y)==C+C){if(Y.ch>2&&/\bstring/.test(L.getTokenTypeAt(n(Y.line,Y.ch-2))))return t.Pass;W="addFour"}else if(X){var Qe=Y.ch==0?" ":L.getRange(n(Y.line,Y.ch-1),Y);if(!t.isWordChar(De)&&Qe!=C&&!t.isWordChar(Qe))W="both";else return t.Pass}else if(we&&(De.length===0||/\s/.test(De)||B.indexOf(De)>-1))W="both";else return t.Pass;if(!he)he=W;else if(he!=W)return t.Pass}var _e=E%2?D.charAt(E-1):C,ze=E%2?C:D.charAt(E+1);L.operation(function(){if(he=="skip")x(L,1);else if(he=="skipThree")x(L,3);else if(he=="surround"){for(var Ee=L.getSelections(),Be=0;Be{(function(t){typeof mg=="object"&&typeof yg=="object"?t(Ht()):typeof define=="function"&&define.amd?define(["../../lib/codemirror"],t):t(CodeMirror)})(function(t){"use strict";var r=t.Pos;function n(C,M){return C.line-M.line||C.ch-M.ch}var l="A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD",a=l+"-:.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040",u=new RegExp("<(/?)(["+l+"]["+a+"]*)","g");function d(C,M,D,E){this.line=M,this.ch=D,this.cm=C,this.text=C.getLine(M),this.min=E?Math.max(E.from,C.firstLine()):C.firstLine(),this.max=E?Math.min(E.to-1,C.lastLine()):C.lastLine()}function c(C,M){var D=C.cm.getTokenTypeAt(r(C.line,M));return D&&/\btag\b/.test(D)}function g(C){if(!(C.line>=C.max))return C.ch=0,C.text=C.cm.getLine(++C.line),!0}function m(C){if(!(C.line<=C.min))return C.text=C.cm.getLine(--C.line),C.ch=C.text.length,!0}function x(C){for(;;){var M=C.text.indexOf(">",C.ch);if(M==-1){if(g(C))continue;return}if(!c(C,M+1)){C.ch=M+1;continue}var D=C.text.lastIndexOf("/",M),E=D>-1&&!/\S/.test(C.text.slice(D+1,M));return C.ch=M+1,E?"selfClose":"regular"}}function S(C){for(;;){var M=C.ch?C.text.lastIndexOf("<",C.ch-1):-1;if(M==-1){if(m(C))continue;return}if(!c(C,M+1)){C.ch=M;continue}u.lastIndex=M,C.ch=M;var D=u.exec(C.text);if(D&&D.index==M)return D}}function k(C){for(;;){u.lastIndex=C.ch;var M=u.exec(C.text);if(!M){if(g(C))continue;return}if(!c(C,M.index+1)){C.ch=M.index+1;continue}return C.ch=M.index+M[0].length,M}}function A(C){for(;;){var M=C.ch?C.text.lastIndexOf(">",C.ch-1):-1;if(M==-1){if(m(C))continue;return}if(!c(C,M+1)){C.ch=M;continue}var D=C.text.lastIndexOf("/",M),E=D>-1&&!/\S/.test(C.text.slice(D+1,M));return C.ch=M+1,E?"selfClose":"regular"}}function T(C,M){for(var D=[];;){var E=k(C),B,K=C.line,X=C.ch-(E?E[0].length:0);if(!E||!(B=x(C)))return;if(B!="selfClose")if(E[1]){for(var ee=D.length-1;ee>=0;--ee)if(D[ee]==E[2]){D.length=ee;break}if(ee<0&&(!M||M==E[2]))return{tag:E[2],from:r(K,X),to:r(C.line,C.ch)}}else D.push(E[2])}}function L(C,M){for(var D=[];;){var E=A(C);if(!E)return;if(E=="selfClose"){S(C);continue}var B=C.line,K=C.ch,X=S(C);if(!X)return;if(X[1])D.push(X[2]);else{for(var ee=D.length-1;ee>=0;--ee)if(D[ee]==X[2]){D.length=ee;break}if(ee<0&&(!M||M==X[2]))return{tag:X[2],from:r(C.line,C.ch),to:r(B,K)}}}}t.registerHelper("fold","xml",function(C,M){for(var D=new d(C,M.line,0);;){var E=k(D);if(!E||D.line!=M.line)return;var B=x(D);if(!B)return;if(!E[1]&&B!="selfClose"){var K=r(D.line,D.ch),X=T(D,E[2]);return X&&n(X.from,K)>0?{from:K,to:X.from}:null}}}),t.findMatchingTag=function(C,M,D){var E=new d(C,M.line,M.ch,D);if(!(E.text.indexOf(">")==-1&&E.text.indexOf("<")==-1)){var B=x(E),K=B&&r(E.line,E.ch),X=B&&S(E);if(!(!B||!X||n(E,M)>0)){var ee={from:r(E.line,E.ch),to:K,tag:X[2]};return B=="selfClose"?{open:ee,close:null,at:"open"}:X[1]?{open:L(E,X[2]),close:ee,at:"close"}:(E=new d(C,K.line,K.ch,D),{open:ee,close:T(E,X[2]),at:"open"})}}},t.findEnclosingTag=function(C,M,D,E){for(var B=new d(C,M.line,M.ch,D);;){var K=L(B,E);if(!K)break;var X=new d(C,M.line,M.ch,D),ee=T(X,K.tag);if(ee)return{open:K,close:ee}}},t.scanForClosingTag=function(C,M,D,E){var B=new d(C,M.line,M.ch,E?{from:0,to:E}:null);return T(B,D)}})});var wg=Ut((xg,bg)=>{(function(t){typeof xg=="object"&&typeof bg=="object"?t(Ht(),ff()):typeof define=="function"&&define.amd?define(["../../lib/codemirror","../fold/xml-fold"],t):t(CodeMirror)})(function(t){t.defineOption("autoCloseTags",!1,function(g,m,x){if(x!=t.Init&&x&&g.removeKeyMap("autoCloseTags"),!!m){var S={name:"autoCloseTags"};(typeof m!="object"||m.whenClosing!==!1)&&(S["'/'"]=function(k){return u(k)}),(typeof m!="object"||m.whenOpening!==!1)&&(S["'>'"]=function(k){return l(k)}),g.addKeyMap(S)}});var r=["area","base","br","col","command","embed","hr","img","input","keygen","link","meta","param","source","track","wbr"],n=["applet","blockquote","body","button","div","dl","fieldset","form","frameset","h1","h2","h3","h4","h5","h6","head","html","iframe","layer","legend","object","ol","p","select","table","ul"];function l(g){if(g.getOption("disableInput"))return t.Pass;for(var m=g.listSelections(),x=[],S=g.getOption("autoCloseTags"),k=0;kA.ch&&(D=D.slice(0,D.length-T.end+A.ch));var X=D.toLowerCase();if(!D||T.type=="string"&&(T.end!=A.ch||!/[\"\']/.test(T.string.charAt(T.string.length-1))||T.string.length==1)||T.type=="tag"&&M.close||T.string.indexOf("/")==A.ch-T.start-1||B&&d(B,X)>-1||c(g,L.mode.xmlCurrentContext&&L.mode.xmlCurrentContext(C)||[],D,A,!0))return t.Pass;var ee=typeof S=="object"&&S.emptyTags;if(ee&&d(ee,D)>-1){x[k]={text:"/>",newPos:t.Pos(A.line,A.ch+2)};continue}var we=K&&d(K,X)>-1;x[k]={indent:we,text:">"+(we?` + +`:"")+"",newPos:we?t.Pos(A.line+1,0):t.Pos(A.line,A.ch+1)}}for(var he=typeof S=="object"&&S.dontIndentOnAutoClose,k=m.length-1;k>=0;k--){var ke=x[k];g.replaceRange(ke.text,m[k].head,m[k].anchor,"+insert");var z=g.listSelections().slice(0);z[k]={head:ke.newPos,anchor:ke.newPos},g.setSelections(z),!he&&ke.indent&&(g.indentLine(ke.newPos.line,null,!0),g.indentLine(ke.newPos.line+1,null,!0))}}function a(g,m){for(var x=g.listSelections(),S=[],k=m?"/":""&&(B+=">"),S[L]=B}if(g.replaceSelections(S),x=g.listSelections(),!T)for(var L=0;L=0&&m[C]==x;C--)++L;S=T.to;for(var C=1;C{(function(t){typeof Cg=="object"&&typeof Sg=="object"?t(Ht()):typeof define=="function"&&define.amd?define(["../../lib/codemirror"],t):t(CodeMirror)})(function(t){"use strict";var r=/^(\s*)(>[> ]*|[*+-] \[[x ]\]\s|[*+-]\s|(\d+)([.)]))(\s*)/,n=/^(\s*)(>[> ]*|[*+-] \[[x ]\]|[*+-]|(\d+)[.)])(\s*)$/,l=/[*+-]\s/;t.commands.newlineAndIndentContinueMarkdownList=function(u){if(u.getOption("disableInput"))return t.Pass;for(var d=u.listSelections(),c=[],g=0;g\s*$/.test(T),D=!/>\s*$/.test(T);(M||D)&&u.replaceRange("",{line:m.line,ch:0},{line:m.line,ch:m.ch+1}),c[g]=` +`}else{var E=L[1],B=L[5],K=!(l.test(L[2])||L[2].indexOf(">")>=0),X=K?parseInt(L[3],10)+1+L[4]:L[2].replace("x"," ");c[g]=` +`+E+X+B,K&&a(u,m)}}u.replaceSelections(c)};function a(u,d){var c=d.line,g=0,m=0,x=r.exec(u.getLine(c)),S=x[1];do{g+=1;var k=c+g,A=u.getLine(k),T=r.exec(A);if(T){var L=T[1],C=parseInt(x[3],10)+g-m,M=parseInt(T[3],10),D=M;if(S===L&&!isNaN(M))C===M&&(D=M+1),C>M&&(D=C+1),u.replaceRange(A.replace(r,L+D+T[4]+T[5]),{line:k,ch:0},{line:k,ch:A.length});else{if(S.length>L.length||S.length{(function(t){typeof Lg=="object"&&typeof Tg=="object"?t(Ht()):typeof define=="function"&&define.amd?define(["../../lib/codemirror"],t):t(CodeMirror)})(function(t){var r=/MSIE \d/.test(navigator.userAgent)&&(document.documentMode==null||document.documentMode<8),n=t.Pos,l={"(":")>",")":"(<","[":"]>","]":"[<","{":"}>","}":"{<","<":">>",">":"<<"};function a(x){return x&&x.bracketRegex||/[(){}[\]]/}function u(x,S,k){var A=x.getLineHandle(S.line),T=S.ch-1,L=k&&k.afterCursor;L==null&&(L=/(^| )cm-fat-cursor($| )/.test(x.getWrapperElement().className));var C=a(k),M=!L&&T>=0&&C.test(A.text.charAt(T))&&l[A.text.charAt(T)]||C.test(A.text.charAt(T+1))&&l[A.text.charAt(++T)];if(!M)return null;var D=M.charAt(1)==">"?1:-1;if(k&&k.strict&&D>0!=(T==S.ch))return null;var E=x.getTokenTypeAt(n(S.line,T+1)),B=d(x,n(S.line,T+(D>0?1:0)),D,E,k);return B==null?null:{from:n(S.line,T),to:B&&B.pos,match:B&&B.ch==M.charAt(0),forward:D>0}}function d(x,S,k,A,T){for(var L=T&&T.maxScanLineLength||1e4,C=T&&T.maxScanLines||1e3,M=[],D=a(T),E=k>0?Math.min(S.line+C,x.lastLine()+1):Math.max(x.firstLine()-1,S.line-C),B=S.line;B!=E;B+=k){var K=x.getLine(B);if(K){var X=k>0?0:K.length-1,ee=k>0?K.length:-1;if(!(K.length>L))for(B==S.line&&(X=S.ch-(k<0?1:0));X!=ee;X+=k){var we=K.charAt(X);if(D.test(we)&&(A===void 0||(x.getTokenTypeAt(n(B,X+1))||"")==(A||""))){var he=l[we];if(he&&he.charAt(1)==">"==k>0)M.push(we);else if(M.length)M.pop();else return{pos:n(B,X),ch:we}}}}}return B-k==(k>0?x.lastLine():x.firstLine())?!1:null}function c(x,S,k){for(var A=x.state.matchBrackets.maxHighlightLineLength||1e3,T=k&&k.highlightNonMatching,L=[],C=x.listSelections(),M=0;M{(function(t){typeof Ag=="object"&&typeof Og=="object"?t(Ht(),ff()):typeof define=="function"&&define.amd?define(["../../lib/codemirror","../fold/xml-fold"],t):t(CodeMirror)})(function(t){"use strict";t.defineOption("matchTags",!1,function(a,u,d){d&&d!=t.Init&&(a.off("cursorActivity",n),a.off("viewportChange",l),r(a)),u&&(a.state.matchBothTags=typeof u=="object"&&u.bothTags,a.on("cursorActivity",n),a.on("viewportChange",l),n(a))});function r(a){a.state.tagHit&&a.state.tagHit.clear(),a.state.tagOther&&a.state.tagOther.clear(),a.state.tagHit=a.state.tagOther=null}function n(a){a.state.failedTagMatch=!1,a.operation(function(){if(r(a),!a.somethingSelected()){var u=a.getCursor(),d=a.getViewport();d.from=Math.min(d.from,u.line),d.to=Math.max(u.line+1,d.to);var c=t.findMatchingTag(a,u,d);if(c){if(a.state.matchBothTags){var g=c.at=="open"?c.open:c.close;g&&(a.state.tagHit=a.markText(g.from,g.to,{className:"CodeMirror-matchingtag"}))}var m=c.at=="close"?c.open:c.close;m?a.state.tagOther=a.markText(m.from,m.to,{className:"CodeMirror-matchingtag"}):a.state.failedTagMatch=!0}}})}function l(a){a.state.failedTagMatch&&n(a)}t.commands.toMatchingTag=function(a){var u=t.findMatchingTag(a,a.getCursor());if(u){var d=u.at=="close"?u.open:u.close;d&&a.extendSelection(d.to,d.from)}}})});var Wg=Ut((Ng,Hg)=>{(function(t){typeof Ng=="object"&&typeof Hg=="object"?t(Ht()):typeof define=="function"&&define.amd?define(["../../lib/codemirror"],t):t(CodeMirror)})(function(t){t.defineOption("showTrailingSpace",!1,function(r,n,l){l==t.Init&&(l=!1),l&&!n?r.removeOverlay("trailingspace"):!l&&n&&r.addOverlay({token:function(a){for(var u=a.string.length,d=u;d&&/\s/.test(a.string.charAt(d-1));--d);return d>a.pos?(a.pos=d,null):(a.pos=u,"trailingspace")},name:"trailingspace"})})})});var Eg=Ut((Pg,Fg)=>{(function(t){typeof Pg=="object"&&typeof Fg=="object"?t(Ht()):typeof define=="function"&&define.amd?define(["../../lib/codemirror"],t):t(CodeMirror)})(function(t){"use strict";function r(n){return function(l,a){var u=a.line,d=l.getLine(u);function c(A){for(var T,L=a.ch,C=0;;){var M=L<=0?-1:d.lastIndexOf(A[0],L-1);if(M==-1){if(C==1)break;C=1,L=d.length;continue}if(C==1&&Mn.lastLine())return null;var S=n.getTokenAt(t.Pos(x,1));if(/\S/.test(S.string)||(S=n.getTokenAt(t.Pos(x,S.end+1))),S.type!="keyword"||S.string!="import")return null;for(var k=x,A=Math.min(n.lastLine(),x+10);k<=A;++k){var T=n.getLine(k),L=T.indexOf(";");if(L!=-1)return{startCh:S.end,end:t.Pos(k,L)}}}var u=l.line,d=a(u),c;if(!d||a(u-1)||(c=a(u-2))&&c.end.line==u-1)return null;for(var g=d.end;;){var m=a(g.line+1);if(m==null)break;g=m.end}return{from:n.clipPos(t.Pos(u,d.startCh+1)),to:g}}),t.registerHelper("fold","include",function(n,l){function a(m){if(mn.lastLine())return null;var x=n.getTokenAt(t.Pos(m,1));if(/\S/.test(x.string)||(x=n.getTokenAt(t.Pos(m,x.end+1))),x.type=="meta"&&x.string.slice(0,8)=="#include")return x.start+8}var u=l.line,d=a(u);if(d==null||a(u-1)!=null)return null;for(var c=u;;){var g=a(c+1);if(g==null)break;++c}return{from:t.Pos(u,d+1),to:n.clipPos(t.Pos(c))}})})});var Rg=Ut((Ig,Bg)=>{(function(t){typeof Ig=="object"&&typeof Bg=="object"?t(Ht()):typeof define=="function"&&define.amd?define(["../../lib/codemirror"],t):t(CodeMirror)})(function(t){"use strict";t.registerGlobalHelper("fold","comment",function(r){return r.blockCommentStart&&r.blockCommentEnd},function(r,n){var l=r.getModeAt(n),a=l.blockCommentStart,u=l.blockCommentEnd;if(!(!a||!u)){for(var d=n.line,c=r.getLine(d),g,m=n.ch,x=0;;){var S=m<=0?-1:c.lastIndexOf(a,m-1);if(S==-1){if(x==1)return;x=1,m=c.length;continue}if(x==1&&S{(function(t){typeof zg=="object"&&typeof Gg=="object"?t(Ht()):typeof define=="function"&&define.amd?define(["../../lib/codemirror"],t):t(CodeMirror)})(function(t){"use strict";function r(u,d,c,g){if(c&&c.call){var m=c;c=null}else var m=a(u,c,"rangeFinder");typeof d=="number"&&(d=t.Pos(d,0));var x=a(u,c,"minFoldSize");function S(L){var C=m(u,d);if(!C||C.to.line-C.from.lineu.firstLine();)d=t.Pos(d.line-1,0),k=S(!1);if(!(!k||k.cleared||g==="unfold")){var A=n(u,c,k);t.on(A,"mousedown",function(L){T.clear(),t.e_preventDefault(L)});var T=u.markText(k.from,k.to,{replacedWith:A,clearOnEnter:a(u,c,"clearOnEnter"),__isFold:!0});T.on("clear",function(L,C){t.signal(u,"unfold",u,L,C)}),t.signal(u,"fold",u,k.from,k.to)}}function n(u,d,c){var g=a(u,d,"widget");if(typeof g=="function"&&(g=g(c.from,c.to)),typeof g=="string"){var m=document.createTextNode(g);g=document.createElement("span"),g.appendChild(m),g.className="CodeMirror-foldmarker"}else g&&(g=g.cloneNode(!0));return g}t.newFoldFunction=function(u,d){return function(c,g){r(c,g,{rangeFinder:u,widget:d})}},t.defineExtension("foldCode",function(u,d,c){r(this,u,d,c)}),t.defineExtension("isFolded",function(u){for(var d=this.findMarksAt(u),c=0;c{(function(t){typeof Ug=="object"&&typeof _g=="object"?t(Ht(),dh()):typeof define=="function"&&define.amd?define(["../../lib/codemirror","./foldcode"],t):t(CodeMirror)})(function(t){"use strict";t.defineOption("foldGutter",!1,function(T,L,C){C&&C!=t.Init&&(T.clearGutter(T.state.foldGutter.options.gutter),T.state.foldGutter=null,T.off("gutterClick",m),T.off("changes",S),T.off("viewportChange",k),T.off("fold",A),T.off("unfold",A),T.off("swapDoc",S),T.off("optionChange",x)),L&&(T.state.foldGutter=new n(l(L)),g(T),T.on("gutterClick",m),T.on("changes",S),T.on("viewportChange",k),T.on("fold",A),T.on("unfold",A),T.on("swapDoc",S),T.on("optionChange",x))});var r=t.Pos;function n(T){this.options=T,this.from=this.to=0}function l(T){return T===!0&&(T={}),T.gutter==null&&(T.gutter="CodeMirror-foldgutter"),T.indicatorOpen==null&&(T.indicatorOpen="CodeMirror-foldgutter-open"),T.indicatorFolded==null&&(T.indicatorFolded="CodeMirror-foldgutter-folded"),T}function a(T,L){for(var C=T.findMarks(r(L,0),r(L+1,0)),M=0;M=E){if(X&&he&&X.test(he.className))return;we=u(M.indicatorOpen)}}!we&&!he||T.setGutterMarker(ee,M.gutter,we)})}function c(T){return new RegExp("(^|\\s)"+T+"(?:$|\\s)\\s*")}function g(T){var L=T.getViewport(),C=T.state.foldGutter;C&&(T.operation(function(){d(T,L.from,L.to)}),C.from=L.from,C.to=L.to)}function m(T,L,C){var M=T.state.foldGutter;if(M){var D=M.options;if(C==D.gutter){var E=a(T,L);E?E.clear():T.foldCode(r(L,0),D)}}}function x(T,L){L=="mode"&&S(T)}function S(T){var L=T.state.foldGutter;if(L){var C=L.options;L.from=L.to=0,clearTimeout(L.changeUpdate),L.changeUpdate=setTimeout(function(){g(T)},C.foldOnChangeTimeSpan||600)}}function k(T){var L=T.state.foldGutter;if(L){var C=L.options;clearTimeout(L.changeUpdate),L.changeUpdate=setTimeout(function(){var M=T.getViewport();L.from==L.to||M.from-L.to>20||L.from-M.to>20?g(T):T.operation(function(){M.fromL.to&&(d(T,L.to,M.to),L.to=M.to)})},C.updateViewportTimeSpan||400)}}function A(T,L){var C=T.state.foldGutter;if(C){var M=L.line;M>=C.from&&M{(function(t){typeof Xg=="object"&&typeof jg=="object"?t(Ht()):typeof define=="function"&&define.amd?define(["../../lib/codemirror"],t):t(CodeMirror)})(function(t){"use strict";function r(n,l){var a=n.getLine(l),u=a.search(/\S/);return u==-1||/\bcomment\b/.test(n.getTokenTypeAt(t.Pos(l,u+1)))?-1:t.countColumn(a,null,n.getOption("tabSize"))}t.registerHelper("fold","indent",function(n,l){var a=r(n,l.line);if(!(a<0)){for(var u=null,d=l.line+1,c=n.lastLine();d<=c;++d){var g=r(n,d);if(g!=-1)if(g>a)u=d;else break}if(u)return{from:t.Pos(l.line,n.getLine(l.line).length),to:t.Pos(u,n.getLine(u).length)}}})})});var Jg=Ut((Yg,Zg)=>{(function(t){typeof Yg=="object"&&typeof Zg=="object"?t(Ht()):typeof define=="function"&&define.amd?define(["../../lib/codemirror"],t):t(CodeMirror)})(function(t){"use strict";t.registerHelper("fold","markdown",function(r,n){var l=100;function a(k){var A=r.getTokenTypeAt(t.Pos(k,0));return A&&/\bheader\b/.test(A)}function u(k,A,T){var L=A&&A.match(/^#+/);return L&&a(k)?L[0].length:(L=T&&T.match(/^[=\-]+\s*$/),L&&a(k+1)?T[0]=="="?1:2:l)}var d=r.getLine(n.line),c=r.getLine(n.line+1),g=u(n.line,d,c);if(g!==l){for(var m=r.lastLine(),x=n.line,S=r.getLine(x+2);x2),gl=/Android/.test(Kt),yi=Yi||gl||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(Kt),ot=Yi||/Mac/.test(cc),yc=/\bCrOS\b/.test(Kt),xc=/win/i.test(cc),bn=Wt&&Kt.match(/Version\/(\d*\.\d*)/);bn&&(bn=Number(bn[1]));bn&&bn>=15&&(Wt=!1,Ue=!0);var uu=ot&&(i0||Wt&&(bn==null||bn<12.11)),Wo=$t||de&&Se>=9;function Zi(t){return new RegExp("(^|\\s)"+t+"(?:$|\\s)\\s*")}var Vt=function(t,r){let n=t.className,l=Zi(r).exec(n);if(l){let a=n.slice(l.index+l[0].length);t.className=n.slice(0,l.index)+(a?l[1]+a:"")}};function gr(t){for(let r=t.childNodes.length;r>0;--r)t.removeChild(t.firstChild);return t}function vt(t,r){return gr(t).appendChild(r)}function re(t,r,n,l){let a=document.createElement(t);if(n&&(a.className=n),l&&(a.style.cssText=l),typeof r=="string")a.appendChild(document.createTextNode(r));else if(r)for(let u=0;u=r)return d+(r-u);d+=c-u,d+=n-d%n,u=c+1}}var fr=class{constructor(){this.id=null,this.f=null,this.time=0,this.handler=Po(this.onTimeout,this)}onTimeout(r){r.id=0,r.time<=+new Date?r.f():setTimeout(r.handler,r.time-+new Date)}set(r,n){this.f=n;let l=+new Date+r;(!this.id||l=r)return l+Math.min(d,r-a);if(a+=u-l,a+=n-a%n,l=u+1,a>=r)return l}}var Vs=[""];function ml(t){for(;Vs.length<=t;)Vs.push(ge(Vs)+" ");return Vs[t]}function ge(t){return t[t.length-1]}function Qi(t,r){let n=[];for(let l=0;l"\x80"&&(t.toUpperCase()!=t.toLowerCase()||n0.test(t))}function Eo(t,r){return r?r.source.indexOf("\\w")>-1&&ea(t)?!0:r.test(t):ea(t)}function hu(t){for(let r in t)if(t.hasOwnProperty(r)&&t[r])return!1;return!0}var l0=/[\u0300-\u036f\u0483-\u0489\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u065e\u0670\u06d6-\u06dc\u06de-\u06e4\u06e7\u06e8\u06ea-\u06ed\u0711\u0730-\u074a\u07a6-\u07b0\u07eb-\u07f3\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0900-\u0902\u093c\u0941-\u0948\u094d\u0951-\u0955\u0962\u0963\u0981\u09bc\u09be\u09c1-\u09c4\u09cd\u09d7\u09e2\u09e3\u0a01\u0a02\u0a3c\u0a41\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a70\u0a71\u0a75\u0a81\u0a82\u0abc\u0ac1-\u0ac5\u0ac7\u0ac8\u0acd\u0ae2\u0ae3\u0b01\u0b3c\u0b3e\u0b3f\u0b41-\u0b44\u0b4d\u0b56\u0b57\u0b62\u0b63\u0b82\u0bbe\u0bc0\u0bcd\u0bd7\u0c3e-\u0c40\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0cbc\u0cbf\u0cc2\u0cc6\u0ccc\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0d3e\u0d41-\u0d44\u0d4d\u0d57\u0d62\u0d63\u0dca\u0dcf\u0dd2-\u0dd4\u0dd6\u0ddf\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0eb1\u0eb4-\u0eb9\u0ebb\u0ebc\u0ec8-\u0ecd\u0f18\u0f19\u0f35\u0f37\u0f39\u0f71-\u0f7e\u0f80-\u0f84\u0f86\u0f87\u0f90-\u0f97\u0f99-\u0fbc\u0fc6\u102d-\u1030\u1032-\u1037\u1039\u103a\u103d\u103e\u1058\u1059\u105e-\u1060\u1071-\u1074\u1082\u1085\u1086\u108d\u109d\u135f\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17b7-\u17bd\u17c6\u17c9-\u17d3\u17dd\u180b-\u180d\u18a9\u1920-\u1922\u1927\u1928\u1932\u1939-\u193b\u1a17\u1a18\u1a56\u1a58-\u1a5e\u1a60\u1a62\u1a65-\u1a6c\u1a73-\u1a7c\u1a7f\u1b00-\u1b03\u1b34\u1b36-\u1b3a\u1b3c\u1b42\u1b6b-\u1b73\u1b80\u1b81\u1ba2-\u1ba5\u1ba8\u1ba9\u1c2c-\u1c33\u1c36\u1c37\u1cd0-\u1cd2\u1cd4-\u1ce0\u1ce2-\u1ce8\u1ced\u1dc0-\u1de6\u1dfd-\u1dff\u200c\u200d\u20d0-\u20f0\u2cef-\u2cf1\u2de0-\u2dff\u302a-\u302f\u3099\u309a\ua66f-\ua672\ua67c\ua67d\ua6f0\ua6f1\ua802\ua806\ua80b\ua825\ua826\ua8c4\ua8e0-\ua8f1\ua926-\ua92d\ua947-\ua951\ua980-\ua982\ua9b3\ua9b6-\ua9b9\ua9bc\uaa29-\uaa2e\uaa31\uaa32\uaa35\uaa36\uaa43\uaa4c\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uabe5\uabe8\uabed\udc00-\udfff\ufb1e\ufe00-\ufe0f\ufe20-\ufe26\uff9e\uff9f]/;function na(t){return t.charCodeAt(0)>=768&&l0.test(t)}function la(t,r,n){for(;(n<0?r>0:rn?-1:1;for(;;){if(r==n)return r;let a=(r+n)/2,u=l<0?Math.ceil(a):Math.floor(a);if(u==r)return t(u)?r:n;t(u)?n=u:r=u+l}}function Cc(t,r,n,l){if(!t)return l(r,n,"ltr",0);let a=!1;for(let u=0;ur||r==n&&d.to==r)&&(l(Math.max(d.from,r),Math.min(d.to,n),d.level==1?"rtl":"ltr",u),a=!0)}a||l(r,n,"ltr")}var yl=null;function bi(t,r,n){let l;yl=null;for(let a=0;ar)return a;u.to==r&&(u.from!=u.to&&n=="before"?l=a:yl=a),u.from==r&&(u.from!=u.to&&n!="before"?l=a:yl=a)}return l??yl}var o0=function(){let t="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN",r="nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111";function n(m){return m<=247?t.charAt(m):1424<=m&&m<=1524?"R":1536<=m&&m<=1785?r.charAt(m-1536):1774<=m&&m<=2220?"r":8192<=m&&m<=8203?"w":m==8204?"b":"L"}let l=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,a=/[stwN]/,u=/[LRr]/,d=/[Lb1n]/,c=/[1n]/;function g(m,x,S){this.level=m,this.from=x,this.to=S}return function(m,x){let S=x=="ltr"?"L":"R";if(m.length==0||x=="ltr"&&!l.test(m))return!1;let k=m.length,A=[];for(let C=0;C-1&&(l[r]=a.slice(0,u).concat(a.slice(u+1)))}}}function Ae(t,r){let n=oa(t,r);if(!n.length)return;let l=Array.prototype.slice.call(arguments,2);for(let a=0;a0}function Ir(t){t.prototype.on=function(r,n){ne(this,r,n)},t.prototype.off=function(r,n){yt(this,r,n)}}function Ve(t){t.preventDefault?t.preventDefault():t.returnValue=!1}function du(t){t.stopPropagation?t.stopPropagation():t.cancelBubble=!0}function aa(t){return t.defaultPrevented!=null?t.defaultPrevented:t.returnValue==!1}function wi(t){Ve(t),du(t)}function xl(t){return t.target||t.srcElement}function cu(t){let r=t.which;return r==null&&(t.button&1?r=1:t.button&2?r=3:t.button&4&&(r=2)),ot&&t.ctrlKey&&r==1&&(r=3),r}var kc=function(){if(de&&Se<9)return!1;let t=re("div");return"draggable"in t||"dragDrop"in t}(),pu;function Lc(t){if(pu==null){let n=re("span","\u200B");vt(t,re("span",[n,document.createTextNode("x")])),t.firstChild.offsetHeight!=0&&(pu=n.offsetWidth<=1&&n.offsetHeight>2&&!(de&&Se<8))}let r=pu?re("span","\u200B"):re("span","\xA0",null,"display: inline-block; width: 1px; margin-right: -1px");return r.setAttribute("cm-text",""),r}var gu;function Tc(t){if(gu!=null)return gu;let r=vt(t,document.createTextNode("A\u062EA")),n=$r(r,0,1).getBoundingClientRect(),l=$r(r,1,2).getBoundingClientRect();return gr(t),!n||n.left==n.right?!1:gu=l.right-n.right<3}var bl=` + +b`.split(/\n/).length!=3?t=>{let r=0,n=[],l=t.length;for(;r<=l;){let a=t.indexOf(` +`,r);a==-1&&(a=t.length);let u=t.slice(r,t.charAt(a-1)=="\r"?a-1:a),d=u.indexOf("\r");d!=-1?(n.push(u.slice(0,d)),r+=d+1):(n.push(u),r=a+1)}return n}:t=>t.split(/\r\n?|\n/),Mc=window.getSelection?t=>{try{return t.selectionStart!=t.selectionEnd}catch{return!1}}:t=>{let r;try{r=t.ownerDocument.selection.createRange()}catch{}return!r||r.parentElement()!=t?!1:r.compareEndPoints("StartToEnd",r)!=0},Ac=(()=>{let t=re("div");return"oncopy"in t?!0:(t.setAttribute("oncopy","return;"),typeof t.oncopy=="function")})(),vu=null;function Oc(t){if(vu!=null)return vu;let r=vt(t,re("span","x")),n=r.getBoundingClientRect(),l=$r(r,0,1).getBoundingClientRect();return vu=Math.abs(n.left-l.left)>1}var fa={},Tn={};function Dc(t,r){arguments.length>2&&(r.dependencies=Array.prototype.slice.call(arguments,2)),fa[t]=r}function Nc(t,r){Tn[t]=r}function Io(t){if(typeof t=="string"&&Tn.hasOwnProperty(t))t=Tn[t];else if(t&&typeof t.name=="string"&&Tn.hasOwnProperty(t.name)){let r=Tn[t.name];typeof r=="string"&&(r={name:r}),t=ia(r,t),t.name=r.name}else{if(typeof t=="string"&&/^[\w\-]+\/[\w\-]+\+xml$/.test(t))return Io("application/xml");if(typeof t=="string"&&/^[\w\-]+\/[\w\-]+\+json$/.test(t))return Io("application/json")}return typeof t=="string"?{name:t}:t||{name:"null"}}function Bo(t,r){r=Io(r);let n=fa[r.name];if(!n)return Bo(t,"text/plain");let l=n(t,r);if(Mn.hasOwnProperty(r.name)){let a=Mn[r.name];for(let u in a)a.hasOwnProperty(u)&&(l.hasOwnProperty(u)&&(l["_"+u]=l[u]),l[u]=a[u])}if(l.name=r.name,r.helperType&&(l.helperType=r.helperType),r.modeProps)for(let a in r.modeProps)l[a]=r.modeProps[a];return l}var Mn={};function Hc(t,r){let n=Mn.hasOwnProperty(t)?Mn[t]:Mn[t]={};Er(r,n)}function Vr(t,r){if(r===!0)return r;if(t.copyState)return t.copyState(r);let n={};for(let l in r){let a=r[l];a instanceof Array&&(a=a.concat([])),n[l]=a}return n}function Ro(t,r){let n;for(;t.innerMode&&(n=t.innerMode(r),!(!n||n.mode==t));)r=n.state,t=n.mode;return n||{mode:t,state:r}}function ua(t,r,n){return t.startState?t.startState(r,n):!0}var mu=class{constructor(r,n,l){this.pos=this.start=0,this.string=r,this.tabSize=n||8,this.lastColumnPos=this.lastColumnValue=0,this.lineStart=0,this.lineOracle=l}eol(){return this.pos>=this.string.length}sol(){return this.pos==this.lineStart}peek(){return this.string.charAt(this.pos)||void 0}next(){if(this.posn}eatSpace(){let r=this.pos;for(;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>r}skipToEnd(){this.pos=this.string.length}skipTo(r){let n=this.string.indexOf(r,this.pos);if(n>-1)return this.pos=n,!0}backUp(r){this.pos-=r}column(){return this.lastColumnPosl?d.toLowerCase():d,u=this.string.substr(this.pos,r.length);if(a(u)==a(r))return n!==!1&&(this.pos+=r.length),!0}else{let a=this.string.slice(this.pos).match(r);return a&&a.index>0?null:(a&&n!==!1&&(this.pos+=a[0].length),a)}}current(){return this.string.slice(this.start,this.pos)}hideFirstChars(r,n){this.lineStart+=r;try{return n()}finally{this.lineStart-=r}}lookAhead(r){let n=this.lineOracle;return n&&n.lookAhead(r)}baseToken(){let r=this.lineOracle;return r&&r.baseToken(this.pos)}},wl=mu;function V(t,r){if(r-=t.first,r<0||r>=t.size)throw new Error("There is no line "+(r+t.first)+" in the document.");let n=t;for(;!n.lines;)for(let l=0;;++l){let a=n.children[l],u=a.chunkSize();if(r{let d=u.text;a==n.line&&(d=d.slice(0,n.ch)),a==r.line&&(d=d.slice(r.ch)),l.push(d),++a}),l}function ha(t,r,n){let l=[];return t.iter(r,n,a=>{l.push(a.text)}),l}function Xt(t,r){let n=r-t.height;if(n)for(let l=t;l;l=l.parent)l.height+=n}function xe(t){if(t.parent==null)return null;let r=t.parent,n=He(r.lines,t);for(let l=r.parent;l;r=l,l=l.parent)for(let a=0;l.children[a]!=r;++a)n+=l.children[a].chunkSize();return n+r.first}function Rr(t,r){let n=t.first;e:do{for(let a=0;a=t.first&&rn?U(n,V(t,n).text.length):s0(r,V(t,r.line).text.length)}function s0(t,r){let n=t.ch;return n==null||n>r?U(t.line,r):n<0?U(t.line,0):t}function yu(t,r){let n=[];for(let l=0;lthis.maxLookAhead&&(this.maxLookAhead=r),n}baseToken(r){if(!this.baseTokens)return null;for(;this.baseTokens[this.baseTokenPos]<=r;)this.baseTokenPos+=2;let n=this.baseTokens[this.baseTokenPos+1];return{type:n&&n.replace(/( |^)overlay .*/,""),size:this.baseTokens[this.baseTokenPos]-r}}nextLine(){this.line++,this.maxLookAhead>0&&this.maxLookAhead--}static fromSaved(r,n,l){return n instanceof Sl?new t(r,Vr(r.mode,n.state),l,n.lookAhead):new t(r,Vr(r.mode,n),l)}save(r){let n=r!==!1?Vr(this.doc.mode,this.state):this.state;return this.maxLookAhead>0?new Sl(n,this.maxLookAhead):n}};function xu(t,r,n,l){let a=[t.state.modeGen],u={};Pc(t,r.text,t.doc.mode,n,(c,g)=>a.push(c,g),u,l);let d=n.state;for(let c=0;c{let A=m;for(;xS&&a.splice(m,1,S,a[m+1],T),m+=2,x=Math.min(S,T)}if(k)if(g.opaque)a.splice(A,m-A,S,"overlay "+k),m=A+2;else for(;At.options.maxHighlightLength&&Vr(t.doc.mode,l.state),u=xu(t,r,l);a&&(l.state=a),r.stateAfter=l.save(!a),r.styles=u.styles,u.classes?r.styleClasses=u.classes:r.styleClasses&&(r.styleClasses=null),n===t.doc.highlightFrontier&&(t.doc.modeFrontier=Math.max(t.doc.modeFrontier,++t.doc.highlightFrontier))}return r.styles}function Vi(t,r,n){let l=t.doc,a=t.display;if(!l.mode.startState)return new Uo(l,!0,r);let u=a0(t,r,n),d=u>l.first&&V(l,u-1).stateAfter,c=d?Uo.fromSaved(l,d,u):new Uo(l,ua(l.mode),u);return l.iter(u,r,g=>{ga(t,g.text,c);let m=c.line;g.stateAfter=m==r-1||m%5==0||m>=a.viewFrom&&mr.start)return u}throw new Error("Mode "+t.name+" failed to advance stream.")}var ca=class{constructor(r,n,l){this.start=r.start,this.end=r.pos,this.string=r.current(),this.type=n||null,this.state=l}};function wu(t,r,n,l){let a=t.doc,u=a.mode,d;r=oe(a,r);let c=V(a,r.line),g=Vi(t,r.line,n),m=new wl(c.text,t.options.tabSize,g),x;for(l&&(x=[]);(l||m.post.options.maxHighlightLength?(c=!1,d&&ga(t,r,l,x.pos),x.pos=r.length,S=null):S=Wc(bu(n,x,l.state,k),u),k){let A=k[0].name;A&&(S="m-"+(S?A+" "+S:A))}if(!c||m!=S){for(;gd;--c){if(c<=u.first)return u.first;let g=V(u,c-1),m=g.stateAfter;if(m&&(!n||c+(m instanceof Sl?m.lookAhead:0)<=u.modeFrontier))return c;let x=mt(g.text,null,t.options.tabSize);(a==null||l>x)&&(a=c-1,l=x)}return a}function Ec(t,r){if(t.modeFrontier=Math.min(t.modeFrontier,r),t.highlightFrontiern;l--){let a=V(t,l).stateAfter;if(a&&(!(a instanceof Sl)||l+a.lookAhead=r:u.to>r);(l||(l=[])).push(new _o(d,u.from,g?null:u.to))}}return l}function u0(t,r,n){let l;if(t)for(let a=0;a=r:u.to>r)||u.from==r&&d.type=="bookmark"&&(!n||u.marker.insertLeft)){let g=u.from==null||(d.inclusiveLeft?u.from<=r:u.from0&&c)for(let T=0;T{if(u.markedSpans)for(let d=0;d0)continue;let x=[g,1],S=se(m.from,c.from),k=se(m.to,c.to);(S<0||!d.inclusiveLeft&&!S)&&x.push({from:m.from,to:c.from}),(k>0||!d.inclusiveRight&&!k)&&x.push({from:c.to,to:m.to}),a.splice.apply(a,x),g+=x.length-3}}return a}function ku(t){let r=t.markedSpans;if(r){for(let n=0;nr)&&(!l||ya(l,u.marker)<0)&&(l=u.marker)}return l}function Tu(t,r,n,l,a){let u=V(t,r),d=mr&&u.markedSpans;if(d)for(let c=0;c=0&&S<=0||x<=0&&S>=0)&&(x<=0&&(g.marker.inclusiveRight&&a.inclusiveLeft?se(m.to,n)>=0:se(m.to,n)>0)||x>=0&&(g.marker.inclusiveRight&&a.inclusiveLeft?se(m.from,l)<=0:se(m.from,l)<0)))return!0}}function Mt(t){let r;for(;r=Kc(t);)t=r.find(-1,!0).line;return t}function jc(t){let r;for(;r=xa(t);)t=r.find(1,!0).line;return t}function qc(t){let r,n;for(;r=xa(t);)t=r.find(1,!0).line,(n||(n=[])).push(t);return n}function Xo(t,r){let n=V(t,r),l=Mt(n);return n==l?r:xe(l)}function ba(t,r){if(r>t.lastLine())return r;let n=V(t,r),l;if(!yr(t,n))return r;for(;l=xa(n);)n=l.find(1,!0).line;return xe(n)+1}function yr(t,r){let n=mr&&r.markedSpans;if(n){for(let l,a=0;a{let a=Ll(l);a>r.maxLineLength&&(r.maxLineLength=a,r.maxLine=l)})}var ei=class{constructor(r,n,l){this.text=r,Lu(this,n),this.height=l?l(this):1}lineNo(){return xe(this)}};Ir(ei);function Jc(t,r,n,l){t.text=r,t.stateAfter&&(t.stateAfter=null),t.styles&&(t.styles=null),t.order!=null&&(t.order=null),ku(t),Lu(t,n);let a=l?l(t):1;a!=t.height&&Xt(t,a)}function Qc(t){t.parent=null,ku(t)}var h0={},d0={};function Yc(t,r){if(!t||/^\s*$/.test(t))return null;let n=r.addModeClass?d0:h0;return n[t]||(n[t]=t.replace(/\S+/g,"cm-$&"))}function wa(t,r){let n=xi("span",null,null,Ue?"padding-right: .1px":null),l={pre:xi("pre",[n],"CodeMirror-line"),content:n,col:0,pos:0,cm:t,trailingSpace:!1,splitSpaces:t.getOption("lineWrapping")};r.measure={};for(let a=0;a<=(r.rest?r.rest.length:0);a++){let u=a?r.rest[a-1]:r.line,d;l.pos=0,l.addToken=c0,Tc(t.display.measure)&&(d=Pt(u,t.doc.direction))&&(l.addToken=g0(l.addToken,d)),l.map=[];let c=r!=t.display.externalMeasured&&xe(u);v0(u,l,pa(t,u,c)),u.styleClasses&&(u.styleClasses.bgClass&&(l.bgClass=$s(u.styleClasses.bgClass,l.bgClass||"")),u.styleClasses.textClass&&(l.textClass=$s(u.styleClasses.textClass,l.textClass||""))),l.map.length==0&&l.map.push(0,0,l.content.appendChild(Lc(t.display.measure))),a==0?(r.measure.map=l.map,r.measure.cache={}):((r.measure.maps||(r.measure.maps=[])).push(l.map),(r.measure.caches||(r.measure.caches=[])).push({}))}if(Ue){let a=l.content.lastChild;(/\bcm-tab\b/.test(a.className)||a.querySelector&&a.querySelector(".cm-tab"))&&(l.content.className="cm-tab-wrap-hack")}return Ae(t,"renderLine",t,r.line,l.pre),l.pre.className&&(l.textClass=$s(l.pre.className,l.textClass||"")),l}function $c(t){let r=re("span","\u2022","cm-invalidchar");return r.title="\\u"+t.charCodeAt(0).toString(16),r.setAttribute("aria-label",r.title),r}function c0(t,r,n,l,a,u,d){if(!r)return;let c=t.splitSpaces?p0(r,t.trailingSpace):r,g=t.cm.state.specialChars,m=!1,x;if(!g.test(r))t.col+=r.length,x=document.createTextNode(c),t.map.push(t.pos,t.pos+r.length,x),de&&Se<9&&(m=!0),t.pos+=r.length;else{x=document.createDocumentFragment();let S=0;for(;;){g.lastIndex=S;let k=g.exec(r),A=k?k.index-S:r.length-S;if(A){let L=document.createTextNode(c.slice(S,S+A));de&&Se<9?x.appendChild(re("span",[L])):x.appendChild(L),t.map.push(t.pos,t.pos+A,L),t.col+=A,t.pos+=A}if(!k)break;S+=A+1;let T;if(k[0]==" "){let L=t.cm.options.tabSize,C=L-t.col%L;T=x.appendChild(re("span",ml(C),"cm-tab")),T.setAttribute("role","presentation"),T.setAttribute("cm-text"," "),t.col+=C}else k[0]=="\r"||k[0]==` +`?(T=x.appendChild(re("span",k[0]=="\r"?"\u240D":"\u2424","cm-invalidchar")),T.setAttribute("cm-text",k[0]),t.col+=1):(T=t.cm.options.specialCharPlaceholder(k[0]),T.setAttribute("cm-text",k[0]),de&&Se<9?x.appendChild(re("span",[T])):x.appendChild(T),t.col+=1);t.map.push(t.pos,t.pos+1,T),t.pos++}}if(t.trailingSpace=c.charCodeAt(r.length-1)==32,n||l||a||m||u||d){let S=n||"";l&&(S+=l),a&&(S+=a);let k=re("span",[x],S,u);if(d)for(let A in d)d.hasOwnProperty(A)&&A!="style"&&A!="class"&&k.setAttribute(A,d[A]);return t.content.appendChild(k)}t.content.appendChild(x)}function p0(t,r){if(t.length>1&&!/ /.test(t))return t;let n=r,l="";for(let a=0;a{a=a?a+" cm-force-border":"cm-force-border";let m=n.pos,x=m+l.length;for(;;){let S;for(let k=0;km&&S.from<=m));k++);if(S.to>=x)return t(n,l,a,u,d,c,g);t(n,l.slice(0,S.to-m),a,u,null,c,g),u=null,l=l.slice(S.to-m),m=S.to}}}function Zc(t,r,n,l){let a=!l&&n.widgetNode;a&&t.map.push(t.pos,t.pos+r,a),!l&&t.cm.display.input.needsContentAttribute&&(a||(a=t.content.appendChild(document.createElement("span"))),a.setAttribute("cm-marker",n.id)),a&&(t.cm.display.input.setUneditable(a),t.content.appendChild(a)),t.pos+=r,t.trailingSpace=!1}function v0(t,r,n){let l=t.markedSpans,a=t.text,u=0;if(!l){for(let D=1;Dc||ee.collapsed&&X.to==c&&X.from==c)){if(X.to!=null&&X.to!=c&&k>X.to&&(k=X.to,T=""),ee.className&&(A+=" "+ee.className),ee.css&&(S=(S?S+";":"")+ee.css),ee.startStyle&&X.from==c&&(L+=" "+ee.startStyle),ee.endStyle&&X.to==k&&(B||(B=[])).push(ee.endStyle,X.to),ee.title&&((M||(M={})).title=ee.title),ee.attributes)for(let we in ee.attributes)(M||(M={}))[we]=ee.attributes[we];ee.collapsed&&(!C||ya(C.marker,ee)<0)&&(C=X)}else X.from>c&&k>X.from&&(k=X.from)}if(B)for(let K=0;K=d)break;let D=Math.min(d,k);for(;;){if(m){let E=c+m.length;if(!C){let B=E>D?m.slice(0,D-c):m;r.addToken(r,B,x?x+A:A,L,c+B.length==k?T:"",S,M)}if(E>=D){m=m.slice(D-c),c=D;break}c=E,L=""}m=a.slice(u,u=n[g++]),x=Yc(n[g++],r.cm.options)}}}function Mu(t,r,n){this.line=r,this.rest=qc(r),this.size=this.rest?xe(ge(this.rest))-n+1:1,this.node=this.text=null,this.hidden=yr(t,r)}function jo(t,r,n){let l=[],a;for(let u=r;un[u].apply(null,l))}function y0(){let t=qo;qo=null;for(let r=0;r2&&u.push((g.bottom+m.top)/2-n.top)}}u.push(n.bottom-n.top)}}function Hu(t,r,n){if(t.line==r)return{map:t.measure.map,cache:t.measure.cache};if(t.rest){for(let l=0;ln)return{map:t.measure.maps[l],cache:t.measure.caches[l],before:!0}}}function k0(t,r){r=Mt(r);let n=xe(r),l=t.display.externalMeasured=new Mu(t.doc,r,n);l.lineN=n;let a=l.built=wa(t,l);return l.text=a.pre,vt(t.display.lineMeasure,a.pre),l}function Wu(t,r,n,l){return zr(t,Nn(t,r),n,l)}function Zo(t,r){if(r>=t.display.viewFrom&&r=n.lineN&&rr)&&(u=g-c,a=u-1,r>=g&&(d="right")),a!=null){if(l=t[m+2],c==g&&n==(l.insertLeft?"left":"right")&&(d=n),n=="left"&&a==0)for(;m&&t[m-2]==t[m-3]&&t[m-1].insertLeft;)l=t[(m-=3)+2],d="left";if(n=="right"&&a==g-c)for(;m=0&&(n=t[l]).left==n.right;l--);return n}function T0(t,r,n,l){let a=Pu(r.map,n,l),u=a.node,d=a.start,c=a.end,g=a.collapse,m;if(u.nodeType==3){for(let D=0;D<4;D++){for(;d&&na(r.line.text.charAt(a.coverStart+d));)--d;for(;a.coverStart+c0&&(g=l="right");let D;t.options.lineWrapping&&(D=u.getClientRects()).length>1?m=D[l=="right"?D.length-1:0]:m=u.getBoundingClientRect()}if(de&&Se<9&&!d&&(!m||!m.left&&!m.right)){let D=u.parentNode.getClientRects()[0];D?m={left:D.left,right:D.left+rn(t.display),top:D.top,bottom:D.bottom}:m=op}let x=m.top-r.rect.top,S=m.bottom-r.rect.top,k=(x+S)/2,A=r.view.measure.heights,T=0;for(;T=l.text.length?(g=l.text.length,m="before"):g<=0&&(g=0,m="after"),!c)return d(m=="before"?g-1:g,m=="before");function x(T,L,C){let M=c[L],D=M.level==1;return d(C?T-1:T,D!=C)}let S=bi(c,g,m),k=yl,A=x(g,S,m=="before");return k!=null&&(A.other=x(g,k,m!="before")),A}function Ru(t,r){let n=0;r=oe(t.doc,r),t.options.lineWrapping||(n=rn(t.display)*r.ch);let l=V(t.doc,r.line),a=tr(l)+Al(t.display);return{left:n,right:n,top:a,bottom:a+l.height}}function Ou(t,r,n,l,a){let u=U(t,r,n);return u.xRel=a,l&&(u.outside=l),u}function Sa(t,r,n){let l=t.doc;if(n+=t.display.viewOffset,n<0)return Ou(l.first,0,null,-1,-1);let a=Rr(l,n),u=l.first+l.size-1;if(a>u)return Ou(l.first+l.size-1,V(l,u).text.length,null,1,1);r<0&&(r=0);let d=V(l,a);for(;;){let c=A0(t,d,a,r,n),g=Xc(d,c.ch+(c.xRel>0||c.outside>0?1:0));if(!g)return c;let m=g.find(1);if(m.line==a)return m;d=V(l,a=m.line)}}function fp(t,r,n,l){l-=Iu(r);let a=r.text.length,u=Ln(d=>zr(t,n,d-1).bottom<=l,a,0);return a=Ln(d=>zr(t,n,d).top>l,u,a),{begin:u,end:a}}function ka(t,r,n,l){n||(n=Nn(t,r));let a=Jo(t,r,zr(t,n,l),"line").top;return fp(t,r,n,a)}function Du(t,r,n,l){return t.bottom<=n?!1:t.top>n?!0:(l?t.left:t.right)>r}function A0(t,r,n,l,a){a-=tr(r);let u=Nn(t,r),d=Iu(r),c=0,g=r.text.length,m=!0,x=Pt(r,t.doc.direction);if(x){let M=(t.options.lineWrapping?D0:O0)(t,r,n,u,x,l,a);m=M.level!=1,c=m?M.from:M.to-1,g=m?M.to:M.from-1}let S=null,k=null,A=Ln(M=>{let D=zr(t,u,M);return D.top+=d,D.bottom+=d,Du(D,l,a,!1)?(D.top<=a&&D.left<=l&&(S=M,k=D),!0):!1},c,g),T,L,C=!1;if(k){let M=l-k.left=M.bottom?1:0}return A=la(r.text,A,1),Ou(n,A,L,C,l-T)}function O0(t,r,n,l,a,u,d){let c=Ln(m=>{let x=a[m],S=x.level!=1;return Du(jt(t,U(n,S?x.to:x.from,S?"before":"after"),"line",r,l),u,d,!0)},0,a.length-1),g=a[c];if(c>0){let m=g.level!=1,x=jt(t,U(n,m?g.from:g.to,m?"after":"before"),"line",r,l);Du(x,u,d,!0)&&x.top>d&&(g=a[c-1])}return g}function D0(t,r,n,l,a,u,d){let{begin:c,end:g}=fp(t,r,l,d);/\s/.test(r.text.charAt(g-1))&&g--;let m=null,x=null;for(let S=0;S=g||k.to<=c)continue;let A=k.level!=1,T=zr(t,l,A?Math.min(g,k.to)-1:Math.max(c,k.from)).right,L=TL)&&(m=k,x=L)}return m||(m=a[a.length-1]),m.fromg&&(m={from:m.from,to:g,level:m.level}),m}var Dn;function Ci(t){if(t.cachedTextHeight!=null)return t.cachedTextHeight;if(Dn==null){Dn=re("pre",null,"CodeMirror-line-like");for(let n=0;n<49;++n)Dn.appendChild(document.createTextNode("x")),Dn.appendChild(re("br"));Dn.appendChild(document.createTextNode("x"))}vt(t.measure,Dn);let r=Dn.offsetHeight/50;return r>3&&(t.cachedTextHeight=r),gr(t.measure),r||1}function rn(t){if(t.cachedCharWidth!=null)return t.cachedCharWidth;let r=re("span","xxxxxxxxxx"),n=re("pre",[r],"CodeMirror-line-like");vt(t.measure,n);let l=r.getBoundingClientRect(),a=(l.right-l.left)/10;return a>2&&(t.cachedCharWidth=a),a||10}function La(t){let r=t.display,n={},l={},a=r.gutters.clientLeft;for(let u=r.gutters.firstChild,d=0;u;u=u.nextSibling,++d){let c=t.display.gutterSpecs[d].className;n[c]=u.offsetLeft+u.clientLeft+a,l[c]=u.clientWidth}return{fixedPos:Qo(r),gutterTotalWidth:r.gutters.offsetWidth,gutterLeft:n,gutterWidth:l,wrapperWidth:r.wrapper.clientWidth}}function Qo(t){return t.scroller.getBoundingClientRect().left-t.sizer.getBoundingClientRect().left}function zu(t){let r=Ci(t.display),n=t.options.lineWrapping,l=n&&Math.max(5,t.display.scroller.clientWidth/rn(t.display)-3);return a=>{if(yr(t.doc,a))return 0;let u=0;if(a.widgets)for(let d=0;d{let a=n(l);a!=l.height&&Xt(l,a)})}function Gr(t,r,n,l){let a=t.display;if(!n&&xl(r).getAttribute("cm-not-content")=="true")return null;let u,d,c=a.lineSpace.getBoundingClientRect();try{u=r.clientX-c.left,d=r.clientY-c.top}catch{return null}let g=Sa(t,u,d),m;if(l&&g.xRel>0&&(m=V(t.doc,g.line).text).length==g.ch){let x=mt(m,m.length,t.options.tabSize)-m.length;g=U(g.line,Math.max(0,Math.round((u-Nu(t.display).left)/rn(t.display))-x))}return g}function Si(t,r){if(r>=t.display.viewTo||(r-=t.display.viewFrom,r<0))return null;let n=t.display.view;for(let l=0;lr)&&(a.updateLineNumbers=r),t.curOp.viewChanged=!0,r>=a.viewTo)mr&&Xo(t.doc,r)a.viewFrom?ki(t):(a.viewFrom+=l,a.viewTo+=l);else if(r<=a.viewFrom&&n>=a.viewTo)ki(t);else if(r<=a.viewFrom){let d=Ta(t,n,n+l,1);d?(a.view=a.view.slice(d.index),a.viewFrom=d.lineN,a.viewTo+=l):ki(t)}else if(n>=a.viewTo){let d=Ta(t,r,r,-1);d?(a.view=a.view.slice(0,d.index),a.viewTo=d.lineN):ki(t)}else{let d=Ta(t,r,r,-1),c=Ta(t,n,n+l,1);d&&c?(a.view=a.view.slice(0,d.index).concat(jo(t,d.lineN,c.lineN)).concat(a.view.slice(c.index)),a.viewTo+=l):ki(t)}let u=a.externalMeasured;u&&(n=a.lineN&&r=l.viewTo)return;let u=l.view[Si(t,r)];if(u.node==null)return;let d=u.changes||(u.changes=[]);He(d,n)==-1&&d.push(n)}function ki(t){t.display.viewFrom=t.display.viewTo=t.doc.first,t.display.view=[],t.display.viewOffset=0}function Ta(t,r,n,l){let a=Si(t,r),u,d=t.display.view;if(!mr||n==t.doc.first+t.doc.size)return{index:a,lineN:n};let c=t.display.viewFrom;for(let g=0;g0){if(a==d.length-1)return null;u=c+d[a].size-r,a++}else u=c-r;r+=u,n+=u}for(;Xo(t.doc,n)!=n;){if(a==(l<0?0:d.length-1))return null;n+=l*d[a-(l<0?1:0)].size,a+=l}return{index:a,lineN:n}}function up(t,r,n){let l=t.display;l.view.length==0||r>=l.viewTo||n<=l.viewFrom?(l.view=jo(t,r,n),l.viewFrom=r):(l.viewFrom>r?l.view=jo(t,r,l.viewFrom).concat(l.view):l.viewFromn&&(l.view=l.view.slice(0,Si(t,n)))),l.viewTo=n}function Gu(t){let r=t.display.view,n=0;for(let l=0;l=t.display.viewTo||g.to().line0?d:t.defaultCharWidth())+"px"}if(l.other){let u=n.appendChild(re("div","\xA0","CodeMirror-cursor CodeMirror-secondarycursor"));u.style.display="",u.style.left=l.other.left+"px",u.style.top=l.other.top+"px",u.style.height=(l.other.bottom-l.other.top)*.85+"px"}}function Ma(t,r){return t.top-r.top||t.left-r.left}function N0(t,r,n){let l=t.display,a=t.doc,u=document.createDocumentFragment(),d=Nu(t.display),c=d.left,g=Math.max(l.sizerWidth,xr(t)-l.sizer.offsetLeft)-d.right,m=a.direction=="ltr";function x(T,L,C,M){L<0&&(L=0),L=Math.round(L),M=Math.round(M),u.appendChild(re("div",null,"CodeMirror-selected",`position: absolute; left: ${T}px; + top: ${L}px; width: ${C??g-T}px; + height: ${M-L}px`))}function S(T,L,C){let M=V(a,T),D=M.text.length,E,B;function K(we,he){return Nl(t,U(T,we),"div",M,he)}function X(we,he,ke){let z=ka(t,M,null,we),Y=he=="ltr"==(ke=="after")?"left":"right",W=ke=="after"?z.begin:z.end-(/\s/.test(M.text.charAt(z.end-1))?2:1);return K(W,Y)[Y]}let ee=Pt(M,a.direction);return Cc(ee,L||0,C??D,(we,he,ke,z)=>{let Y=ke=="ltr",W=K(we,Y?"left":"right"),De=K(he-1,Y?"right":"left"),Qe=L==null&&we==0,_e=C==null&&he==D,ze=z==0,Ee=!ee||z==ee.length-1;if(De.top-W.top<=3){let Be=(m?Qe:_e)&&ze,nr=(m?_e:Qe)&&Ee,tt=Be?c:(Y?W:De).left,bt=nr?g:(Y?De:W).right;x(tt,W.top,bt-tt,W.bottom)}else{let Be,nr,tt,bt;Y?(Be=m&&Qe&&ze?c:W.left,nr=m?g:X(we,ke,"before"),tt=m?c:X(he,ke,"after"),bt=m&&_e&&Ee?g:De.right):(Be=m?X(we,ke,"before"):c,nr=!m&&Qe&&ze?g:W.right,tt=!m&&_e&&Ee?c:De.left,bt=m?X(he,ke,"after"):g),x(Be,W.top,nr-Be,W.bottom),W.bottom0?r.blinker=setInterval(()=>{t.hasFocus()||ti(t),r.cursorDiv.style.visibility=(n=!n)?"":"hidden"},t.options.cursorBlinkRate):t.options.cursorBlinkRate<0&&(r.cursorDiv.style.visibility="hidden")}function Da(t){t.hasFocus()||(t.display.input.focus(),t.state.focused||Ha(t))}function Na(t){t.state.delayingBlurEvent=!0,setTimeout(()=>{t.state.delayingBlurEvent&&(t.state.delayingBlurEvent=!1,t.state.focused&&ti(t))},100)}function Ha(t,r){t.state.delayingBlurEvent&&!t.state.draggingText&&(t.state.delayingBlurEvent=!1),t.options.readOnly!="nocursor"&&(t.state.focused||(Ae(t,"focus",t,r),t.state.focused=!0,er(t.display.wrapper,"CodeMirror-focused"),!t.curOp&&t.display.selForContextMenu!=t.doc.sel&&(t.display.input.reset(),Ue&&setTimeout(()=>t.display.input.reset(!0),20)),t.display.input.receivedFocus()),Wl(t))}function ti(t,r){t.state.delayingBlurEvent||(t.state.focused&&(Ae(t,"blur",t,r),t.state.focused=!1,Vt(t.display.wrapper,"CodeMirror-focused")),clearInterval(t.display.blinker),setTimeout(()=>{t.state.focused||(t.display.shift=!1)},150))}function Wn(t){let r=t.display,n=r.lineDiv.offsetTop,l=Math.max(0,r.scroller.getBoundingClientRect().top),a=r.lineDiv.getBoundingClientRect().top,u=0;for(let d=0;d.005||S<-.005)&&(at.display.sizerWidth){let k=Math.ceil(x/rn(t.display));k>t.display.maxLineLength&&(t.display.maxLineLength=k,t.display.maxLine=c.line,t.display.maxLineChanged=!0)}}Math.abs(u)>2&&(r.scroller.scrollTop+=u)}function hp(t){if(t.widgets)for(let r=0;r=d&&(u=Rr(r,tr(V(r,g))-t.wrapper.clientHeight),d=g)}return{from:u,to:Math.max(d,u+1)}}function dp(t,r){if(Re(t,"scrollCursorIntoView"))return;let n=t.display,l=n.sizer.getBoundingClientRect(),a=null,u=n.wrapper.ownerDocument;if(r.top+l.top<0?a=!0:r.bottom+l.top>(u.defaultView.innerHeight||u.documentElement.clientHeight)&&(a=!1),a!=null&&!mc){let d=re("div","\u200B",null,`position: absolute; + top: ${r.top-n.viewOffset-Al(t.display)}px; + height: ${r.bottom-r.top+qt(t)+n.barHeight}px; + left: ${r.left}px; width: ${Math.max(2,r.right-r.left)}px;`);t.display.lineSpace.appendChild(d),d.scrollIntoView(a),t.display.lineSpace.removeChild(d)}}function cp(t,r,n,l){l==null&&(l=0);let a;!t.options.lineWrapping&&r==n&&(n=r.sticky=="before"?U(r.line,r.ch+1,"before"):r,r=r.ch?U(r.line,r.sticky=="before"?r.ch-1:r.ch,"after"):r);for(let u=0;u<5;u++){let d=!1,c=jt(t,r),g=!n||n==r?c:jt(t,n);a={left:Math.min(c.left,g.left),top:Math.min(c.top,g.top)-l,right:Math.max(c.left,g.left),bottom:Math.max(c.bottom,g.bottom)+l};let m=Uu(t,a),x=t.doc.scrollTop,S=t.doc.scrollLeft;if(m.scrollTop!=null&&(nn(t,m.scrollTop),Math.abs(t.doc.scrollTop-x)>1&&(d=!0)),m.scrollLeft!=null&&(Ur(t,m.scrollLeft),Math.abs(t.doc.scrollLeft-S)>1&&(d=!0)),!d)break}return a}function pp(t,r){let n=Uu(t,r);n.scrollTop!=null&&nn(t,n.scrollTop),n.scrollLeft!=null&&Ur(t,n.scrollLeft)}function Uu(t,r){let n=t.display,l=Ci(t.display);r.top<0&&(r.top=0);let a=t.curOp&&t.curOp.scrollTop!=null?t.curOp.scrollTop:n.scroller.scrollTop,u=Dl(t),d={};r.bottom-r.top>u&&(r.bottom=r.top+u);let c=t.doc.height+Ol(n),g=r.topc-l;if(r.topa+u){let T=Math.min(r.top,(m?c:r.bottom)-u);T!=a&&(d.scrollTop=T)}let x=t.options.fixedGutter?0:n.gutters.offsetWidth,S=t.curOp&&t.curOp.scrollLeft!=null?t.curOp.scrollLeft:n.scroller.scrollLeft-x,k=xr(t)-n.gutters.offsetWidth,A=r.right-r.left>k;return A&&(r.right=r.left+k),r.left<10?d.scrollLeft=0:r.leftk+S-3&&(d.scrollLeft=r.right+(A?0:10)-k),d}function Vo(t,r){r!=null&&(Wa(t),t.curOp.scrollTop=(t.curOp.scrollTop==null?t.doc.scrollTop:t.curOp.scrollTop)+r)}function br(t){Wa(t);let r=t.getCursor();t.curOp.scrollToPos={from:r,to:r,margin:t.options.cursorScrollMargin}}function Pn(t,r,n){(r!=null||n!=null)&&Wa(t),r!=null&&(t.curOp.scrollLeft=r),n!=null&&(t.curOp.scrollTop=n)}function gp(t,r){Wa(t),t.curOp.scrollToPos=r}function Wa(t){let r=t.curOp.scrollToPos;if(r){t.curOp.scrollToPos=null;let n=Ru(t,r.from),l=Ru(t,r.to);_u(t,n,l,r.margin)}}function _u(t,r,n,l){let a=Uu(t,{left:Math.min(r.left,n.left),top:Math.min(r.top,n.top)-l,right:Math.max(r.right,n.right),bottom:Math.max(r.bottom,n.bottom)+l});Pn(t,a.scrollLeft,a.scrollTop)}function nn(t,r){Math.abs(t.doc.scrollTop-r)<2||($t||$o(t,{top:r}),Ku(t,r,!0),$t&&$o(t),Li(t,100))}function Ku(t,r,n){r=Math.max(0,Math.min(t.display.scroller.scrollHeight-t.display.scroller.clientHeight,r)),!(t.display.scroller.scrollTop==r&&!n)&&(t.doc.scrollTop=r,t.display.scrollbars.setScrollTop(r),t.display.scroller.scrollTop!=r&&(t.display.scroller.scrollTop=r))}function Ur(t,r,n,l){r=Math.max(0,Math.min(r,t.display.scroller.scrollWidth-t.display.scroller.clientWidth)),!((n?r==t.doc.scrollLeft:Math.abs(t.doc.scrollLeft-r)<2)&&!l)&&(t.doc.scrollLeft=r,Pa(t),t.display.scroller.scrollLeft!=r&&(t.display.scroller.scrollLeft=r),t.display.scrollbars.setScrollLeft(r))}function Fn(t){let r=t.display,n=r.gutters.offsetWidth,l=Math.round(t.doc.height+Ol(t.display));return{clientHeight:r.scroller.clientHeight,viewHeight:r.wrapper.clientHeight,scrollWidth:r.scroller.scrollWidth,clientWidth:r.scroller.clientWidth,viewWidth:r.wrapper.clientWidth,barLeft:t.options.fixedGutter?n:0,docHeight:l,scrollHeight:l+qt(t)+r.barHeight,nativeBarWidth:r.nativeBarWidth,gutterWidth:n}}var Xu=class{constructor(r,n,l){this.cm=l;let a=this.vert=re("div",[re("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),u=this.horiz=re("div",[re("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");a.tabIndex=u.tabIndex=-1,r(a),r(u),ne(a,"scroll",()=>{a.clientHeight&&n(a.scrollTop,"vertical")}),ne(u,"scroll",()=>{u.clientWidth&&n(u.scrollLeft,"horizontal")}),this.checkedZeroWidth=!1,de&&Se<8&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")}update(r){let n=r.scrollWidth>r.clientWidth+1,l=r.scrollHeight>r.clientHeight+1,a=r.nativeBarWidth;if(l){this.vert.style.display="block",this.vert.style.bottom=n?a+"px":"0";let u=r.viewHeight-(n?a:0);this.vert.firstChild.style.height=Math.max(0,r.scrollHeight-r.clientHeight+u)+"px"}else this.vert.scrollTop=0,this.vert.style.display="",this.vert.firstChild.style.height="0";if(n){this.horiz.style.display="block",this.horiz.style.right=l?a+"px":"0",this.horiz.style.left=r.barLeft+"px";let u=r.viewWidth-r.barLeft-(l?a:0);this.horiz.firstChild.style.width=Math.max(0,r.scrollWidth-r.clientWidth+u)+"px"}else this.horiz.style.display="",this.horiz.firstChild.style.width="0";return!this.checkedZeroWidth&&r.clientHeight>0&&(a==0&&this.zeroWidthHack(),this.checkedZeroWidth=!0),{right:l?a:0,bottom:n?a:0}}setScrollLeft(r){this.horiz.scrollLeft!=r&&(this.horiz.scrollLeft=r),this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz,"horiz")}setScrollTop(r){this.vert.scrollTop!=r&&(this.vert.scrollTop=r),this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert,"vert")}zeroWidthHack(){let r=ot&&!vc?"12px":"18px";this.horiz.style.height=this.vert.style.width=r,this.horiz.style.visibility=this.vert.style.visibility="hidden",this.disableHoriz=new fr,this.disableVert=new fr}enableZeroWidthBar(r,n,l){r.style.visibility="";function a(){let u=r.getBoundingClientRect();(l=="vert"?document.elementFromPoint(u.right-1,(u.top+u.bottom)/2):document.elementFromPoint((u.right+u.left)/2,u.bottom-1))!=r?r.style.visibility="hidden":n.set(1e3,a)}n.set(1e3,a)}clear(){let r=this.horiz.parentNode;r.removeChild(this.horiz),r.removeChild(this.vert)}},ju=class{update(){return{bottom:0,right:0}}setScrollLeft(){}setScrollTop(){}clear(){}};function Ti(t,r){r||(r=Fn(t));let n=t.display.barWidth,l=t.display.barHeight;vp(t,r);for(let a=0;a<4&&n!=t.display.barWidth||l!=t.display.barHeight;a++)n!=t.display.barWidth&&t.options.lineWrapping&&Wn(t),vp(t,Fn(t)),n=t.display.barWidth,l=t.display.barHeight}function vp(t,r){let n=t.display,l=n.scrollbars.update(r);n.sizer.style.paddingRight=(n.barWidth=l.right)+"px",n.sizer.style.paddingBottom=(n.barHeight=l.bottom)+"px",n.heightForcer.style.borderBottom=l.bottom+"px solid transparent",l.right&&l.bottom?(n.scrollbarFiller.style.display="block",n.scrollbarFiller.style.height=l.bottom+"px",n.scrollbarFiller.style.width=l.right+"px"):n.scrollbarFiller.style.display="",l.bottom&&t.options.coverGutterNextToScrollbar&&t.options.fixedGutter?(n.gutterFiller.style.display="block",n.gutterFiller.style.height=l.bottom+"px",n.gutterFiller.style.width=r.gutterWidth+"px"):n.gutterFiller.style.display=""}var qu={native:Xu,null:ju};function Fa(t){t.display.scrollbars&&(t.display.scrollbars.clear(),t.display.scrollbars.addClass&&Vt(t.display.wrapper,t.display.scrollbars.addClass)),t.display.scrollbars=new qu[t.options.scrollbarStyle](r=>{t.display.wrapper.insertBefore(r,t.display.scrollbarFiller),ne(r,"mousedown",()=>{t.state.focused&&setTimeout(()=>t.display.input.focus(),0)}),r.setAttribute("cm-not-content","true")},(r,n)=>{n=="horizontal"?Ur(t,r):nn(t,r)},t),t.display.scrollbars.addClass&&er(t.display.wrapper,t.display.scrollbars.addClass)}var H0=0;function ri(t){t.curOp={cm:t,viewChanged:!1,startHeight:t.doc.height,forceUpdate:!1,updateInput:0,typing:!1,changeObjs:null,cursorActivityHandlers:null,cursorActivityCalled:0,selectionChanged:!1,updateMaxLine:!1,scrollLeft:null,scrollTop:null,scrollToPos:null,focus:!1,id:++H0,markArrays:null},Vc(t.curOp)}function ii(t){let r=t.curOp;r&&ep(r,n=>{for(let l=0;l=n.viewTo)||n.maxLineChanged&&r.options.lineWrapping,t.update=t.mustUpdate&&new es(r,t.mustUpdate&&{top:t.scrollTop,ensure:t.scrollToPos},t.forceUpdate)}function F0(t){t.updatedDisplay=t.mustUpdate&&Ea(t.cm,t.update)}function E0(t){let r=t.cm,n=r.display;t.updatedDisplay&&Wn(r),t.barMeasure=Fn(r),n.maxLineChanged&&!r.options.lineWrapping&&(t.adjustWidthTo=Wu(r,n.maxLine,n.maxLine.text.length).left+3,r.display.sizerWidth=t.adjustWidthTo,t.barMeasure.scrollWidth=Math.max(n.scroller.clientWidth,n.sizer.offsetLeft+t.adjustWidthTo+qt(r)+r.display.barWidth),t.maxScrollLeft=Math.max(0,n.sizer.offsetLeft+t.adjustWidthTo-xr(r))),(t.updatedDisplay||t.selectionChanged)&&(t.preparedSelection=n.input.prepareSelection())}function I0(t){let r=t.cm;t.adjustWidthTo!=null&&(r.display.sizer.style.minWidth=t.adjustWidthTo+"px",t.maxScrollLeft=t.display.viewTo)return;let n=+new Date+t.options.workTime,l=Vi(t,r.highlightFrontier),a=[];r.iter(l.line,Math.min(r.first+r.size,t.display.viewTo+500),u=>{if(l.line>=t.display.viewFrom){let d=u.styles,c=u.text.length>t.options.maxHighlightLength?Vr(r.mode,l.state):null,g=xu(t,u,l,!0);c&&(l.state=c),u.styles=g.styles;let m=u.styleClasses,x=g.classes;x?u.styleClasses=x:m&&(u.styleClasses=null);let S=!d||d.length!=u.styles.length||m!=x&&(!m||!x||m.bgClass!=x.bgClass||m.textClass!=x.textClass);for(let k=0;!S&&kn)return Li(t,t.options.workDelay),!0}),r.highlightFrontier=l.line,r.modeFrontier=Math.max(r.modeFrontier,l.line),a.length&&Xe(t,()=>{for(let u=0;u=n.viewFrom&&r.visible.to<=n.viewTo&&(n.updateLineNumbers==null||n.updateLineNumbers>=n.viewTo)&&n.renderedView==n.view&&Gu(t)==0)return!1;Ba(t)&&(ki(t),r.dims=La(t));let a=l.first+l.size,u=Math.max(r.visible.from-t.options.viewportMargin,l.first),d=Math.min(a,r.visible.to+t.options.viewportMargin);n.viewFromd&&n.viewTo-d<20&&(d=Math.min(a,n.viewTo)),mr&&(u=Xo(t.doc,u),d=ba(t.doc,d));let c=u!=n.viewFrom||d!=n.viewTo||n.lastWrapHeight!=r.wrapperHeight||n.lastWrapWidth!=r.wrapperWidth;up(t,u,d),n.viewOffset=tr(V(t.doc,n.viewFrom)),t.display.mover.style.top=n.viewOffset+"px";let g=Gu(t);if(!c&&g==0&&!r.force&&n.renderedView==n.view&&(n.updateLineNumbers==null||n.updateLineNumbers>=n.viewTo))return!1;let m=z0(t);return g>4&&(n.lineDiv.style.display="none"),U0(t,n.updateLineNumbers,r.dims),g>4&&(n.lineDiv.style.display=""),n.renderedView=n.view,G0(m),gr(n.cursorDiv),gr(n.selectionDiv),n.gutters.style.height=n.sizer.style.minHeight=0,c&&(n.lastWrapHeight=r.wrapperHeight,n.lastWrapWidth=r.wrapperWidth,Li(t,400)),n.updateLineNumbers=null,!0}function Yu(t,r){let n=r.viewport;for(let l=!0;;l=!1){if(!l||!t.options.lineWrapping||r.oldDisplayWidth==xr(t)){if(n&&n.top!=null&&(n={top:Math.min(t.doc.height+Ol(t.display)-Dl(t),n.top)}),r.visible=Pl(t.display,t.doc,n),r.visible.from>=t.display.viewFrom&&r.visible.to<=t.display.viewTo)break}else l&&(r.visible=Pl(t.display,t.doc,n));if(!Ea(t,r))break;Wn(t);let a=Fn(t);Hn(t),Ti(t,a),Ia(t,a),r.force=!1}r.signal(t,"update",t),(t.display.viewFrom!=t.display.reportedViewFrom||t.display.viewTo!=t.display.reportedViewTo)&&(r.signal(t,"viewportChange",t,t.display.viewFrom,t.display.viewTo),t.display.reportedViewFrom=t.display.viewFrom,t.display.reportedViewTo=t.display.viewTo)}function $o(t,r){let n=new es(t,r);if(Ea(t,n)){Wn(t),Yu(t,n);let l=Fn(t);Hn(t),Ti(t,l),Ia(t,l),n.finish()}}function U0(t,r,n){let l=t.display,a=t.options.lineNumbers,u=l.lineDiv,d=u.firstChild;function c(x){let S=x.nextSibling;return Ue&&ot&&t.display.currentWheelTarget==x?x.style.display="none":x.parentNode.removeChild(x),S}let g=l.view,m=l.viewFrom;for(let x=0;x-1&&(k=!1),Ca(t,S,m,n)),k&&(gr(S.lineNumber),S.lineNumber.appendChild(document.createTextNode(Cl(t.options,m)))),d=S.node.nextSibling}m+=S.size}for(;d;)d=c(d)}function Fl(t){let r=t.gutters.offsetWidth;t.sizer.style.marginLeft=r+"px",We(t,"gutterChanged",t)}function Ia(t,r){t.display.sizer.style.minHeight=r.docHeight+"px",t.display.heightForcer.style.top=r.docHeight+"px",t.display.gutters.style.height=r.docHeight+t.display.barHeight+qt(t)+"px"}function Pa(t){let r=t.display,n=r.view;if(!r.alignWidgets&&(!r.gutters.firstChild||!t.options.fixedGutter))return;let l=Qo(r)-r.scroller.scrollLeft+t.doc.scrollLeft,a=r.gutters.offsetWidth,u=l+"px";for(let d=0;d=105&&(a.wrapper.style.clipPath="inset(0px)"),a.wrapper.setAttribute("translate","no"),de&&Se<8&&(a.gutters.style.zIndex=-1,a.scroller.style.paddingRight=0),!Ue&&!($t&&yi)&&(a.scroller.draggable=!0),t&&(t.appendChild?t.appendChild(a.wrapper):t(a.wrapper)),a.viewFrom=a.viewTo=r.first,a.reportedViewFrom=a.reportedViewTo=r.first,a.view=[],a.renderedView=null,a.externalMeasured=null,a.viewOffset=0,a.lastWrapHeight=a.lastWrapWidth=0,a.updateLineNumbers=null,a.nativeBarWidth=a.barHeight=a.barWidth=0,a.scrollbarsClipped=!1,a.lineNumWidth=a.lineNumInnerWidth=a.lineNumChars=null,a.alignWidgets=!1,a.cachedCharWidth=a.cachedTextHeight=a.cachedPaddingH=null,a.maxLine=null,a.maxLineLength=0,a.maxLineChanged=!1,a.wheelDX=a.wheelDY=a.wheelStartX=a.wheelStartY=null,a.shift=!1,a.selForContextMenu=null,a.activeTouch=null,a.gutterSpecs=ts(l.gutters,l.lineNumbers),Zu(a),n.init(a)}var Ra=0,Mi=null;de?Mi=-.53:$t?Mi=15:pr?Mi=-.7:wn&&(Mi=-1/3);function xp(t){let r=t.wheelDeltaX,n=t.wheelDeltaY;return r==null&&t.detail&&t.axis==t.HORIZONTAL_AXIS&&(r=t.detail),n==null&&t.detail&&t.axis==t.VERTICAL_AXIS?n=t.detail:n==null&&(n=t.wheelDelta),{x:r,y:n}}function bp(t){let r=xp(t);return r.x*=Mi,r.y*=Mi,r}function Ju(t,r){pr&&Qs==102&&(t.display.chromeScrollHack==null?t.display.sizer.style.pointerEvents="none":clearTimeout(t.display.chromeScrollHack),t.display.chromeScrollHack=setTimeout(()=>{t.display.chromeScrollHack=null,t.display.sizer.style.pointerEvents=""},100));let n=xp(r),l=n.x,a=n.y,u=Mi;r.deltaMode===0&&(l=r.deltaX,a=r.deltaY,u=1);let d=t.display,c=d.scroller,g=c.scrollWidth>c.clientWidth,m=c.scrollHeight>c.clientHeight;if(l&&g||a&&m){if(a&&ot&&Ue){e:for(let x=r.target,S=d.view;x!=c;x=x.parentNode)for(let k=0;k{if(d.wheelStartX==null)return;let x=c.scrollLeft-d.wheelStartX,S=c.scrollTop-d.wheelStartY,k=S&&d.wheelDY&&S/d.wheelDY||x&&d.wheelDX&&x/d.wheelDX;d.wheelStartX=d.wheelStartY=null,k&&(Mi=(Mi*Ra+k)/(Ra+1),++Ra)},200)):(d.wheelDX+=l,d.wheelDY+=a))}}var ir=class t{constructor(r,n){this.ranges=r,this.primIndex=n}primary(){return this.ranges[this.primIndex]}equals(r){if(r==this)return!0;if(r.primIndex!=this.primIndex||r.ranges.length!=this.ranges.length)return!1;for(let n=0;n=0&&se(r,a.to())<=0)return l}return-1}},be=class{constructor(r,n){this.anchor=r,this.head=n}from(){return On(this.anchor,this.head)}to(){return An(this.anchor,this.head)}empty(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch}};function Yt(t,r,n){let l=t&&t.options.selectionsMayTouch,a=r[n];r.sort((u,d)=>se(u.from(),d.from())),n=He(r,a);for(let u=1;u0:g>=0){let m=On(c.from(),d.from()),x=An(c.to(),d.to()),S=c.empty()?d.from()==d.head:c.from()==c.head;u<=n&&--n,r.splice(--u,2,new be(S?x:m,S?m:x))}}return new ir(r,n)}function hr(t,r){return new ir([new be(t,r||t)],0)}function wr(t){return t.text?U(t.from.line+t.text.length-1,ge(t.text).length+(t.text.length==1?t.from.ch:0)):t.to}function wp(t,r){if(se(t,r.from)<0)return t;if(se(t,r.to)<=0)return wr(r);let n=t.line+r.text.length-(r.to.line-r.from.line)-1,l=t.ch;return t.line==r.to.line&&(l+=wr(r).ch-r.to.ch),U(n,l)}function za(t,r){let n=[];for(let l=0;l{r.stateAfter&&(r.stateAfter=null),r.styles&&(r.styles=null)}),t.doc.modeFrontier=t.doc.highlightFrontier=t.doc.first,Li(t,100),t.state.modeGen++,t.curOp&&Je(t)}function Qu(t,r){return r.from.ch==0&&r.to.ch==0&&ge(r.text)==""&&(!t.cm||t.cm.options.wholeLineUpdateBefore)}function is(t,r,n,l){function a(L){return n?n[L]:null}function u(L,C,M){Jc(L,C,M,l),We(L,"change",L,r)}function d(L,C){let M=[];for(let D=L;D1&&t.remove(c.line+1,T-1),t.insert(c.line+1,L)}We(t,"change",t,r)}function Cr(t,r,n){function l(a,u,d){if(a.linked)for(let c=0;c{kp(t),Je(t)})}function ns(t){this.done=[],this.undone=[],this.undoDepth=t?t.undoDepth:1/0,this.lastModTime=this.lastSelTime=0,this.lastOp=this.lastSelOp=null,this.lastOrigin=this.lastSelOrigin=null,this.generation=this.maxGeneration=t?t.maxGeneration:1}function Ua(t,r){let n={from:Go(r.from),to:wr(r),text:Br(t,r.from,r.to)};return Tp(t,n,r.from.line,r.to.line+1),Cr(t,l=>Tp(l,n,r.from.line,r.to.line+1),!0),n}function Mp(t){for(;t.length&&ge(t).ranges;)t.pop()}function _0(t,r){if(r)return Mp(t.done),ge(t.done);if(t.done.length&&!ge(t.done).ranges)return ge(t.done);if(t.done.length>1&&!t.done[t.done.length-2].ranges)return t.done.pop(),ge(t.done)}function _a(t,r,n,l){let a=t.history;a.undone.length=0;let u=+new Date,d,c;if((a.lastOp==l||a.lastOrigin==r.origin&&r.origin&&(r.origin.charAt(0)=="+"&&a.lastModTime>u-(t.cm?t.cm.options.historyEventDelay:500)||r.origin.charAt(0)=="*"))&&(d=_0(a,a.lastOp==l)))c=ge(d.changes),se(r.from,r.to)==0&&se(r.from,c.to)==0?c.to=wr(r):d.changes.push(Ua(t,r));else{let g=ge(a.done);for((!g||!g.ranges)&&ls(t.sel,a.done),d={changes:[Ua(t,r)],generation:a.generation},a.done.push(d);a.done.length>a.undoDepth;)a.done.shift(),a.done[0].ranges||a.done.shift()}a.done.push(n),a.generation=++a.maxGeneration,a.lastModTime=a.lastSelTime=u,a.lastOp=a.lastSelOp=l,a.lastOrigin=a.lastSelOrigin=r.origin,c||Ae(t,"historyAdded")}function K0(t,r,n,l){let a=r.charAt(0);return a=="*"||a=="+"&&n.ranges.length==l.ranges.length&&n.somethingSelected()==l.somethingSelected()&&new Date-t.history.lastSelTime<=(t.cm?t.cm.options.historyEventDelay:500)}function Ap(t,r,n,l){let a=t.history,u=l&&l.origin;n==a.lastSelOp||u&&a.lastSelOrigin==u&&(a.lastModTime==a.lastSelTime&&a.lastOrigin==u||K0(t,u,ge(a.done),r))?a.done[a.done.length-1]=r:ls(r,a.done),a.lastSelTime=+new Date,a.lastSelOrigin=u,a.lastSelOp=n,l&&l.clearRedo!==!1&&Mp(a.undone)}function ls(t,r){let n=ge(r);n&&n.ranges&&n.equals(t)||r.push(t)}function Tp(t,r,n,l){let a=r["spans_"+t.id],u=0;t.iter(Math.max(t.first,n),Math.min(t.first+t.size,l),d=>{d.markedSpans&&((a||(a=r["spans_"+t.id]={}))[u]=d.markedSpans),++u})}function X0(t){if(!t)return null;let r;for(let n=0;n-1&&(ge(g)[a]=x[a],delete x[a])}}return l}function Ka(t,r,n,l){if(l){let a=t.anchor;if(n){let u=se(r,a)<0;u!=se(n,a)<0?(a=r,r=n):u!=se(r,n)<0&&(r=n)}return new be(a,r)}else return new be(n||r,r)}function In(t,r,n,l,a){a==null&&(a=t.cm&&(t.cm.display.shift||t.extend)),et(t,new ir([Ka(t.sel.primary(),r,n,a)],0),l)}function Vu(t,r,n){let l=[],a=t.cm&&(t.cm.display.shift||t.extend);for(let d=0;d=r.ch:c.to>r.ch))){if(a&&(Ae(g,"beforeCursorEnter"),g.explicitlyCleared))if(u.markedSpans){--d;continue}else break;if(!g.atomic)continue;if(n){let k=g.find(l<0?1:-1),A;if((l<0?x:m)&&(k=Op(t,k,-l,k&&k.line==r.line?u:null)),k&&k.line==r.line&&(A=se(k,n))&&(l<0?A<0:A>0))return Bl(t,k,r,l,a)}let S=g.find(l<0?-1:1);return(l<0?m:x)&&(S=Op(t,S,l,S.line==r.line?u:null)),S?Bl(t,S,r,l,a):null}}return r}function Rl(t,r,n,l,a){let u=l||1,d=Bl(t,r,n,u,a)||!a&&Bl(t,r,n,u,!0)||Bl(t,r,n,-u,a)||!a&&Bl(t,r,n,-u,!0);return d||(t.cantEdit=!0,U(t.first,0))}function Op(t,r,n,l){return n<0&&r.ch==0?r.line>t.first?oe(t,U(r.line-1)):null:n>0&&r.ch==(l||V(t,r.line)).text.length?r.linel.canceled=!0};return n&&(l.update=(a,u,d,c)=>{a&&(l.from=oe(t,a)),u&&(l.to=oe(t,u)),d&&(l.text=d),c!==void 0&&(l.origin=c)}),Ae(t,"beforeChange",t,l),t.cm&&Ae(t.cm,"beforeChange",t.cm,l),l.canceled?(t.cm&&(t.cm.curOp.updateInput=2),null):{from:l.from,to:l.to,text:l.text,origin:l.origin}}function Ai(t,r,n){if(t.cm){if(!t.cm.curOp)return Ie(t.cm,Ai)(t,r,n);if(t.cm.state.suppressEdits)return}if((Tt(t,"beforeChange")||t.cm&&Tt(t.cm,"beforeChange"))&&(r=Ep(t,r,!0),!r))return;let l=Cu&&!n&&Uc(t,r.from,r.to);if(l)for(let a=l.length-1;a>=0;--a)Hp(t,{from:l[a].from,to:l[a].to,text:a?[""]:r.text,origin:r.origin});else Hp(t,r)}function Hp(t,r){if(r.text.length==1&&r.text[0]==""&&se(r.from,r.to)==0)return;let n=za(t,r);_a(t,r,n,t.cm?t.cm.curOp.id:NaN),os(t,r,n,Ko(t,r));let l=[];Cr(t,(a,u)=>{!u&&He(l,a.history)==-1&&(Ip(a.history,r),l.push(a.history)),os(a,r,null,Ko(a,r))})}function ss(t,r,n){let l=t.cm&&t.cm.state.suppressEdits;if(l&&!n)return;let a=t.history,u,d=t.sel,c=r=="undo"?a.done:a.undone,g=r=="undo"?a.undone:a.done,m=0;for(;m=0;--k){let A=u.changes[k];if(A.origin=r,S&&!Ep(t,A,!1)){c.length=0;return}x.push(Ua(t,A));let T=k?za(t,A):ge(c);os(t,A,T,$u(t,A)),!k&&t.cm&&t.cm.scrollIntoView({from:A.from,to:wr(A)});let L=[];Cr(t,(C,M)=>{!M&&He(L,C.history)==-1&&(Ip(C.history,A),L.push(C.history)),os(C,A,null,$u(C,A))})}}function Wp(t,r){if(r!=0&&(t.first+=r,t.sel=new ir(Qi(t.sel.ranges,n=>new be(U(n.anchor.line+r,n.anchor.ch),U(n.head.line+r,n.head.ch))),t.sel.primIndex),t.cm)){Je(t.cm,t.first,t.first-r,r);for(let n=t.cm.display,l=n.viewFrom;lt.lastLine())return;if(r.from.linea&&(r={from:r.from,to:U(a,V(t,a).text.length),text:[r.text[0]],origin:r.origin}),r.removed=Br(t,r.from,r.to),n||(n=za(t,r)),t.cm?Y0(t.cm,r,l):is(t,r,l),Gl(t,n,Lt),t.cantEdit&&Rl(t,U(t.firstLine(),0))&&(t.cantEdit=!1)}function Y0(t,r,n){let l=t.doc,a=t.display,u=r.from,d=r.to,c=!1,g=u.line;t.options.lineWrapping||(g=xe(Mt(V(l,u.line))),l.iter(g,d.line+1,k=>{if(k==a.maxLine)return c=!0,!0})),l.sel.contains(r.from,r.to)>-1&&sa(t),is(l,r,n,zu(t)),t.options.lineWrapping||(l.iter(g,u.line+r.text.length,k=>{let A=Ll(k);A>a.maxLineLength&&(a.maxLine=k,a.maxLineLength=A,a.maxLineChanged=!0,c=!1)}),c&&(t.curOp.updateMaxLine=!0)),Ec(l,u.line),Li(t,400);let m=r.text.length-(d.line-u.line)-1;r.full?Je(t):u.line==d.line&&r.text.length==1&&!Qu(t.doc,r)?ur(t,u.line,"text"):Je(t,u.line,d.line+1,m);let x=Tt(t,"changes"),S=Tt(t,"change");if(S||x){let k={from:u,to:d,text:r.text,removed:r.removed,origin:r.origin};S&&We(t,"change",t,k),x&&(t.curOp.changeObjs||(t.curOp.changeObjs=[])).push(k)}t.display.selForContextMenu=null}function Sr(t,r,n,l,a){l||(l=n),se(l,n)<0&&([n,l]=[l,n]),typeof r=="string"&&(r=t.splitLines(r)),Ai(t,{from:n,to:l,text:r,origin:a})}function Pp(t,r,n,l){n1||!(this.children[0]instanceof Ul))){let n=[];this.collapse(n),this.children=[new Ul(n)],this.children[0].parent=this}},collapse(t){for(let r=0;r50){let d=a.lines.length%25+25;for(let c=d;c10);t.parent.maybeSpill()},iterN(t,r,n){for(let l=0;l{Bp(r,l,-u),ur(r,a,"widget")}),We(r,"lineWidgetCleared",r,this,a))}changed(){let r=this.height,n=this.doc.cm,l=this.line;this.height=null;let a=en(this)-r;a&&(yr(this.doc,l)||Xt(l,l.height+a),n&&Xe(n,()=>{n.curOp.forceUpdate=!0,Bp(n,l,a),We(n,"lineWidgetChanged",n,this,xe(l))}))}};Ir(Kl);function Bp(t,r,n){tr(r)<(t.curOp&&t.curOp.scrollTop||t.doc.scrollTop)&&Vo(t,n)}function Rp(t,r,n,l){let a=new Kl(t,n,l),u=t.cm;return u&&a.noHScroll&&(u.display.alignWidgets=!0),Bn(t,r,"widget",d=>{let c=d.widgets||(d.widgets=[]);if(a.insertAt==null?c.push(a):c.splice(Math.min(c.length,Math.max(0,a.insertAt)),0,a),a.line=d,u&&!yr(t,d)){let g=tr(d)r.display.maxLineLength&&(r.display.maxLine=d,r.display.maxLineLength=c,r.display.maxLineChanged=!0)}l!=null&&r&&this.collapsed&&Je(r,l,a+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,r&&th(r.doc)),r&&We(r,"markerCleared",r,this,l,a),n&&ii(r),this.parent&&this.parent.clear()}find(r,n){r==null&&this.type=="bookmark"&&(r=1);let l,a;for(let u=0;u{let a=r.line,u=xe(r.line),d=Zo(l,u);if(d&&(Fu(d),l.curOp.selectionChanged=l.curOp.forceUpdate=!0),l.curOp.updateMaxLine=!0,!yr(n.doc,a)&&n.height!=null){let c=n.height;n.height=null;let g=en(n)-c;g&&Xt(a,a.height+g)}We(l,"markerChanged",l,this)})}attachLine(r){if(!this.lines.length&&this.doc.cm){let n=this.doc.cm.curOp;(!n.maybeHiddenMarkers||He(n.maybeHiddenMarkers,this)==-1)&&(n.maybeUnhiddenMarkers||(n.maybeUnhiddenMarkers=[])).push(this)}this.lines.push(r)}detachLine(r){if(this.lines.splice(He(this.lines,r),1),!this.lines.length&&this.doc.cm){let n=this.doc.cm.curOp;(n.maybeHiddenMarkers||(n.maybeHiddenMarkers=[])).push(this)}}};Ir(Xl);function Rn(t,r,n,l,a){if(l&&l.shared)return Z0(t,r,n,l,a);if(t.cm&&!t.cm.curOp)return Ie(t.cm,Rn)(t,r,n,l,a);let u=new Xl(t,a),d=se(r,n);if(l&&Er(l,u,!1),d>0||d==0&&u.clearWhenEmpty!==!1)return u;if(u.replacedWith&&(u.collapsed=!0,u.widgetNode=xi("span",[u.replacedWith],"CodeMirror-widget"),l.handleMouseEvents||u.widgetNode.setAttribute("cm-ignore-events","true"),l.insertLeft&&(u.widgetNode.insertLeft=!0)),u.collapsed){if(Tu(t,r.line,r,n,u)||r.line!=n.line&&Tu(t,n.line,r,n,u))throw new Error("Inserting collapsed marker partially overlapping an existing one");Bc()}u.addToHistory&&_a(t,{from:r,to:n,origin:"markText"},t.sel,NaN);let c=r.line,g=t.cm,m;if(t.iter(c,n.line+1,x=>{g&&u.collapsed&&!g.options.lineWrapping&&Mt(x)==g.display.maxLine&&(m=!0),u.collapsed&&c!=r.line&&Xt(x,0),Gc(x,new _o(u,c==r.line?r.ch:null,c==n.line?n.ch:null),t.cm&&t.cm.curOp),++c}),u.collapsed&&t.iter(r.line,n.line+1,x=>{yr(t,x)&&Xt(x,0)}),u.clearOnEnter&&ne(u,"beforeCursorEnter",()=>u.clear()),u.readOnly&&(Ic(),(t.history.done.length||t.history.undone.length)&&t.clearHistory()),u.collapsed&&(u.id=++zp,u.atomic=!0),g){if(m&&(g.curOp.updateMaxLine=!0),u.collapsed)Je(g,r.line,n.line+1);else if(u.className||u.startStyle||u.endStyle||u.css||u.attributes||u.title)for(let x=r.line;x<=n.line;x++)ur(g,x,"text");u.atomic&&th(g.doc),We(g,"markerAdded",g,u)}return u}var jl=class{constructor(r,n){this.markers=r,this.primary=n;for(let l=0;l{c&&(l.widgetNode=c.cloneNode(!0)),u.push(Rn(g,oe(g,r),oe(g,n),l,a));for(let m=0;mr.parent)}function Gp(t,r){for(let n=0;nl.push(a));for(let a=0;a=0;d--)Ai(this,l[d]);u?Xa(this,u):this.cm&&br(this.cm)}),undo:at(function(){ss(this,"undo")}),redo:at(function(){ss(this,"redo")}),undoSelection:at(function(){ss(this,"undo",!0)}),redoSelection:at(function(){ss(this,"redo",!0)}),setExtending:function(t){this.extend=t},getExtending:function(){return this.extend},historySize:function(){let t=this.history,r=0,n=0;for(let l=0;lt.history=this.history,!0)},markClean:function(){this.cleanGeneration=this.changeGeneration(!0)},changeGeneration:function(t){return t&&(this.history.lastOp=this.history.lastSelOp=this.history.lastOrigin=null),this.history.generation},isClean:function(t){return this.history.generation==(t||this.cleanGeneration)},getHistory:function(){return{done:En(this.history.done),undone:En(this.history.undone)}},setHistory:function(t){let r=this.history=new ns(this.history);r.done=En(t.done.slice(0),null,!0),r.undone=En(t.undone.slice(0),null,!0)},setGutterMarker:at(function(t,r,n){return Bn(this,t,"gutter",l=>{let a=l.gutterMarkers||(l.gutterMarkers={});return a[r]=n,!n&&hu(a)&&(l.gutterMarkers=null),!0})}),clearGutter:at(function(t){this.iter(r=>{r.gutterMarkers&&r.gutterMarkers[t]&&Bn(this,r,"gutter",()=>(r.gutterMarkers[t]=null,hu(r.gutterMarkers)&&(r.gutterMarkers=null),!0))})}),lineInfo:function(t){let r;if(typeof t=="number"){if(!$i(this,t)||(r=t,t=V(this,t),!t))return null}else if(r=xe(t),r==null)return null;return{line:r,handle:t,text:t.text,gutterMarkers:t.gutterMarkers,textClass:t.textClass,bgClass:t.bgClass,wrapClass:t.wrapClass,widgets:t.widgets}},addLineClass:at(function(t,r,n){return Bn(this,t,r=="gutter"?"gutter":"class",l=>{let a=r=="text"?"textClass":r=="background"?"bgClass":r=="gutter"?"gutterClass":"wrapClass";if(!l[a])l[a]=n;else{if(Zi(n).test(l[a]))return!1;l[a]+=" "+n}return!0})}),removeLineClass:at(function(t,r,n){return Bn(this,t,r=="gutter"?"gutter":"class",l=>{let a=r=="text"?"textClass":r=="background"?"bgClass":r=="gutter"?"gutterClass":"wrapClass",u=l[a];if(u)if(n==null)l[a]=null;else{let d=u.match(Zi(n));if(!d)return!1;let c=d.index+d[0].length;l[a]=u.slice(0,d.index)+(!d.index||c==u.length?"":" ")+u.slice(c)||null}else return!1;return!0})}),addLineWidget:at(function(t,r,n){return Rp(this,t,r,n)}),removeLineWidget:function(t){t.clear()},markText:function(t,r,n){return Rn(this,oe(this,t),oe(this,r),n,n&&n.type||"range")},setBookmark:function(t,r){let n={replacedWith:r&&(r.nodeType==null?r.widget:r),insertLeft:r&&r.insertLeft,clearWhenEmpty:!1,shared:r&&r.shared,handleMouseEvents:r&&r.handleMouseEvents};return t=oe(this,t),Rn(this,t,t,n,"bookmark")},findMarksAt:function(t){t=oe(this,t);let r=[],n=V(this,t.line).markedSpans;if(n)for(let l=0;l=t.ch)&&r.push(a.marker.parent||a.marker)}return r},findMarks:function(t,r,n){t=oe(this,t),r=oe(this,r);let l=[],a=t.line;return this.iter(t.line,r.line+1,u=>{let d=u.markedSpans;if(d)for(let c=0;c=g.to||g.from==null&&a!=t.line||g.from!=null&&a==r.line&&g.from>=r.ch)&&(!n||n(g.marker))&&l.push(g.marker.parent||g.marker)}++a}),l},getAllMarks:function(){let t=[];return this.iter(r=>{let n=r.markedSpans;if(n)for(let l=0;l{let u=a.text.length+l;if(u>t)return r=t,!0;t-=u,++n}),oe(this,U(n,r))},indexFromPos:function(t){t=oe(this,t);let r=t.ch;if(t.line{r+=l.text.length+n}),r},copy:function(t){let r=new Oi(ha(this,this.first,this.first+this.size),this.modeOption,this.first,this.lineSep,this.direction);return r.scrollTop=this.scrollTop,r.scrollLeft=this.scrollLeft,r.sel=this.sel,r.extend=!1,t&&(r.history.undoDepth=this.history.undoDepth,r.setHistory(this.getHistory())),r},linkedDoc:function(t){t||(t={});let r=this.first,n=this.first+this.size;t.from!=null&&t.from>r&&(r=t.from),t.to!=null&&t.tor.push(n.id),!0),t.history=new ns(null),t.history.done=En(this.history.done,r),t.history.undone=En(this.history.undone,r)}},iterLinkedDocs:function(t){Cr(this,t)},getMode:function(){return this.mode},getEditor:function(){return this.cm},splitLines:function(t){return this.lineSep?t.split(this.lineSep):bl(t)},lineSeparator:function(){return this.lineSep||` +`},setDirection:at(function(t){t!="rtl"&&(t="ltr"),t!=this.direction&&(this.direction=t,this.iter(r=>r.order=null),this.cm&&Lp(this.cm))})});Oi.prototype.eachLine=Oi.prototype.iter;var ni=Oi;var Kp=0;function Xp(t){let r=this;if(ih(r),Re(r,t)||rr(r.display,t))return;Ve(t),de&&(Kp=+new Date);let n=Gr(r,t,!0),l=t.dataTransfer.files;if(!(!n||r.isReadOnly()))if(l&&l.length&&window.FileReader&&window.File){let a=l.length,u=Array(a),d=0,c=()=>{++d==a&&Ie(r,()=>{n=oe(r.doc,n);let m={from:n,to:n,text:r.doc.splitLines(u.filter(x=>x!=null).join(r.doc.lineSeparator())),origin:"paste"};Ai(r.doc,m),Xa(r.doc,hr(oe(r.doc,n),oe(r.doc,wr(m))))})()},g=(m,x)=>{if(r.options.allowDropFileTypes&&He(r.options.allowDropFileTypes,m.type)==-1){c();return}let S=new FileReader;S.onerror=()=>c(),S.onload=()=>{let k=S.result;if(/[\x00-\x08\x0e-\x1f]{2}/.test(k)){c();return}u[x]=k,c()},S.readAsText(m)};for(let m=0;m-1){r.state.draggingText(t),setTimeout(()=>r.display.input.focus(),20);return}try{let a=t.dataTransfer.getData("Text");if(a){let u;if(r.state.draggingText&&!r.state.draggingText.copy&&(u=r.listSelections()),Gl(r.doc,hr(n,n)),u)for(let d=0;d{for(let l=0;l{t==null&&(t=setTimeout(()=>{t=null,Yp($0)},100))}),ne(window,"blur",()=>Yp(ti))}function $0(t){let r=t.display;r.cachedCharWidth=r.cachedTextHeight=r.cachedPaddingH=null,r.scrollbarsClipped=!1,t.setSize()}var li={3:"Pause",8:"Backspace",9:"Tab",13:"Enter",16:"Shift",17:"Ctrl",18:"Alt",19:"Pause",20:"CapsLock",27:"Esc",32:"Space",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"Left",38:"Up",39:"Right",40:"Down",44:"PrintScrn",45:"Insert",46:"Delete",59:";",61:"=",91:"Mod",92:"Mod",93:"Mod",106:"*",107:"=",109:"-",110:".",111:"/",145:"ScrollLock",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'",224:"Mod",63232:"Up",63233:"Down",63234:"Left",63235:"Right",63272:"Delete",63273:"Home",63275:"End",63276:"PageUp",63277:"PageDown",63302:"Insert"};for(let t=0;t<10;t++)li[t+48]=li[t+96]=String(t);for(let t=65;t<=90;t++)li[t]=String.fromCharCode(t);for(let t=1;t<=12;t++)li[t+111]=li[t+63235]="F"+t;var oi={};oi.basic={Left:"goCharLeft",Right:"goCharRight",Up:"goLineUp",Down:"goLineDown",End:"goLineEnd",Home:"goLineStartSmart",PageUp:"goPageUp",PageDown:"goPageDown",Delete:"delCharAfter",Backspace:"delCharBefore","Shift-Backspace":"delCharBefore",Tab:"defaultTab","Shift-Tab":"indentAuto",Enter:"newlineAndIndent",Insert:"toggleOverwrite",Esc:"singleSelection"};oi.pcDefault={"Ctrl-A":"selectAll","Ctrl-D":"deleteLine","Ctrl-Z":"undo","Shift-Ctrl-Z":"redo","Ctrl-Y":"redo","Ctrl-Home":"goDocStart","Ctrl-End":"goDocEnd","Ctrl-Up":"goLineUp","Ctrl-Down":"goLineDown","Ctrl-Left":"goGroupLeft","Ctrl-Right":"goGroupRight","Alt-Left":"goLineStart","Alt-Right":"goLineEnd","Ctrl-Backspace":"delGroupBefore","Ctrl-Delete":"delGroupAfter","Ctrl-S":"save","Ctrl-F":"find","Ctrl-G":"findNext","Shift-Ctrl-G":"findPrev","Shift-Ctrl-F":"replace","Shift-Ctrl-R":"replaceAll","Ctrl-[":"indentLess","Ctrl-]":"indentMore","Ctrl-U":"undoSelection","Shift-Ctrl-U":"redoSelection","Alt-U":"redoSelection",fallthrough:"basic"};oi.emacsy={"Ctrl-F":"goCharRight","Ctrl-B":"goCharLeft","Ctrl-P":"goLineUp","Ctrl-N":"goLineDown","Ctrl-A":"goLineStart","Ctrl-E":"goLineEnd","Ctrl-V":"goPageDown","Shift-Ctrl-V":"goPageUp","Ctrl-D":"delCharAfter","Ctrl-H":"delCharBefore","Alt-Backspace":"delWordBefore","Ctrl-K":"killLine","Ctrl-T":"transposeChars","Ctrl-O":"openLine"};oi.macDefault={"Cmd-A":"selectAll","Cmd-D":"deleteLine","Cmd-Z":"undo","Shift-Cmd-Z":"redo","Cmd-Y":"redo","Cmd-Home":"goDocStart","Cmd-Up":"goDocStart","Cmd-End":"goDocEnd","Cmd-Down":"goDocEnd","Alt-Left":"goGroupLeft","Alt-Right":"goGroupRight","Cmd-Left":"goLineLeft","Cmd-Right":"goLineRight","Alt-Backspace":"delGroupBefore","Ctrl-Alt-Backspace":"delGroupAfter","Alt-Delete":"delGroupAfter","Cmd-S":"save","Cmd-F":"find","Cmd-G":"findNext","Shift-Cmd-G":"findPrev","Cmd-Alt-F":"replace","Shift-Cmd-Alt-F":"replaceAll","Cmd-[":"indentLess","Cmd-]":"indentMore","Cmd-Backspace":"delWrappedLineLeft","Cmd-Delete":"delWrappedLineRight","Cmd-U":"undoSelection","Shift-Cmd-U":"redoSelection","Ctrl-Up":"goDocStart","Ctrl-Down":"goDocEnd",fallthrough:["basic","emacsy"]};oi.default=ot?oi.macDefault:oi.pcDefault;function V0(t){let r=t.split(/-(?!$)/);t=r[r.length-1];let n,l,a,u;for(let d=0;d{for(let a=l.length-1;a>=0;a--)Sr(t.doc,"",l[a].from,l[a].to,"+delete");br(t)})}function lh(t,r,n){let l=la(t.text,r+n,n);return l<0||l>t.text.length?null:l}function Za(t,r,n){let l=lh(t,r.ch,n);return l==null?null:new U(r.line,l,n<0?"after":"before")}function as(t,r,n,l,a){if(t){r.doc.direction=="rtl"&&(a=-a);let u=Pt(n,r.doc.direction);if(u){let d=a<0?ge(u):u[0],g=a<0==(d.level==1)?"after":"before",m;if(d.level>0||r.doc.direction=="rtl"){let x=Nn(r,n);m=a<0?n.text.length-1:0;let S=zr(r,x,m).top;m=Ln(k=>zr(r,x,k).top==S,a<0==(d.level==1)?d.from:d.to-1,m),g=="before"&&(m=lh(n,m,1))}else m=a<0?d.to:d.from;return new U(l,m,g)}}return new U(l,a<0?n.text.length:0,a<0?"before":"after")}function $p(t,r,n,l){let a=Pt(r,t.doc.direction);if(!a)return Za(r,n,l);n.ch>=r.text.length?(n.ch=r.text.length,n.sticky="before"):n.ch<=0&&(n.ch=0,n.sticky="after");let u=bi(a,n.ch,n.sticky),d=a[u];if(t.doc.direction=="ltr"&&d.level%2==0&&(l>0?d.to>n.ch:d.fromlh(r,T instanceof U?T.ch:T,L),g,m=T=>t.options.lineWrapping?(g=g||Nn(t,r),ka(t,r,g,T)):{begin:0,end:r.text.length},x=m(n.sticky=="before"?c(n,-1):n.ch);if(t.doc.direction=="rtl"||d.level==1){let T=d.level==1==l<0,L=c(n,T?1:-1);if(L!=null&&(T?L<=d.to&&L<=x.end:L>=d.from&&L>=x.begin)){let C=T?"before":"after";return new U(n.line,L,C)}}let S=(T,L,C)=>{let M=(D,E)=>E?new U(n.line,c(D,1),"before"):new U(n.line,D,"after");for(;T>=0&&T0==(D.level!=1),B=E?C.begin:c(C.end,-1);if(D.from<=B&&B0?x.end:c(x.begin,-1);return A!=null&&!(l>0&&A==r.text.length)&&(k=S(l>0?0:a.length-1,l,m(A)),k)?k:null}var Di={selectAll:ja,singleSelection:t=>t.setSelection(t.getCursor("anchor"),t.getCursor("head"),Lt),killLine:t=>on(t,r=>{if(r.empty()){let n=V(t.doc,r.head.line).text.length;return r.head.ch==n&&r.head.lineon(t,r=>({from:U(r.from().line,0),to:oe(t.doc,U(r.to().line+1,0))})),delLineLeft:t=>on(t,r=>({from:U(r.from().line,0),to:r.from()})),delWrappedLineLeft:t=>on(t,r=>{let n=t.charCoords(r.head,"div").top+5;return{from:t.coordsChar({left:0,top:n},"div"),to:r.from()}}),delWrappedLineRight:t=>on(t,r=>{let n=t.charCoords(r.head,"div").top+5,l=t.coordsChar({left:t.display.lineDiv.offsetWidth+100,top:n},"div");return{from:r.from(),to:l}}),undo:t=>t.undo(),redo:t=>t.redo(),undoSelection:t=>t.undoSelection(),redoSelection:t=>t.redoSelection(),goDocStart:t=>t.extendSelection(U(t.firstLine(),0)),goDocEnd:t=>t.extendSelection(U(t.lastLine())),goLineStart:t=>t.extendSelectionsBy(r=>eg(t,r.head.line),{origin:"+move",bias:1}),goLineStartSmart:t=>t.extendSelectionsBy(r=>Vp(t,r.head),{origin:"+move",bias:1}),goLineEnd:t=>t.extendSelectionsBy(r=>ey(t,r.head.line),{origin:"+move",bias:-1}),goLineRight:t=>t.extendSelectionsBy(r=>{let n=t.cursorCoords(r.head,"div").top+5;return t.coordsChar({left:t.display.lineDiv.offsetWidth+100,top:n},"div")},kn),goLineLeft:t=>t.extendSelectionsBy(r=>{let n=t.cursorCoords(r.head,"div").top+5;return t.coordsChar({left:0,top:n},"div")},kn),goLineLeftSmart:t=>t.extendSelectionsBy(r=>{let n=t.cursorCoords(r.head,"div").top+5,l=t.coordsChar({left:0,top:n},"div");return l.cht.moveV(-1,"line"),goLineDown:t=>t.moveV(1,"line"),goPageUp:t=>t.moveV(-1,"page"),goPageDown:t=>t.moveV(1,"page"),goCharLeft:t=>t.moveH(-1,"char"),goCharRight:t=>t.moveH(1,"char"),goColumnLeft:t=>t.moveH(-1,"column"),goColumnRight:t=>t.moveH(1,"column"),goWordLeft:t=>t.moveH(-1,"word"),goGroupRight:t=>t.moveH(1,"group"),goGroupLeft:t=>t.moveH(-1,"group"),goWordRight:t=>t.moveH(1,"word"),delCharBefore:t=>t.deleteH(-1,"codepoint"),delCharAfter:t=>t.deleteH(1,"char"),delWordBefore:t=>t.deleteH(-1,"word"),delWordAfter:t=>t.deleteH(1,"word"),delGroupBefore:t=>t.deleteH(-1,"group"),delGroupAfter:t=>t.deleteH(1,"group"),indentAuto:t=>t.indentSelection("smart"),indentMore:t=>t.indentSelection("add"),indentLess:t=>t.indentSelection("subtract"),insertTab:t=>t.replaceSelection(" "),insertSoftTab:t=>{let r=[],n=t.listSelections(),l=t.options.tabSize;for(let a=0;a{t.somethingSelected()?t.indentSelection("add"):t.execCommand("insertTab")},transposeChars:t=>Xe(t,()=>{let r=t.listSelections(),n=[];for(let l=0;l0)a=new U(a.line,a.ch+1),t.replaceRange(u.charAt(a.ch-1)+u.charAt(a.ch-2),U(a.line,a.ch-2),a,"+transpose");else if(a.line>t.doc.first){let d=V(t.doc,a.line-1).text;d&&(a=new U(a.line,1),t.replaceRange(u.charAt(0)+t.doc.lineSeparator()+d.charAt(d.length-1),U(a.line-1,d.length-1),a,"+transpose"))}}n.push(new be(a,a))}t.setSelections(n)}),newlineAndIndent:t=>Xe(t,()=>{let r=t.listSelections();for(let n=r.length-1;n>=0;n--)t.replaceRange(t.doc.lineSeparator(),r[n].anchor,r[n].head,"+input");r=t.listSelections();for(let n=0;nt.replaceSelection(` +`,"start"),toggleOverwrite:t=>t.toggleOverwrite()};function eg(t,r){let n=V(t.doc,r),l=Mt(n);return l!=n&&(r=xe(l)),as(!0,t,l,r,1)}function ey(t,r){let n=V(t.doc,r),l=jc(n);return l!=n&&(r=xe(l)),as(!0,t,n,r,-1)}function Vp(t,r){let n=eg(t,r.line),l=V(t.doc,n.line),a=Pt(l,t.doc.direction);if(!a||a[0].level==0){let u=Math.max(n.ch,l.text.search(/\S/)),d=r.line==n.line&&r.ch<=u&&r.ch;return U(n.line,d?0:u,n.sticky)}return n}function Ja(t,r,n){if(typeof r=="string"&&(r=Di[r],!r))return!1;t.display.input.ensurePolled();let l=t.display.shift,a=!1;try{t.isReadOnly()&&(t.state.suppressEdits=!0),n&&(t.display.shift=!1),a=r(t)!=Ji}finally{t.display.shift=l,t.state.suppressEdits=!1}return a}function ty(t,r,n){for(let l=0;l{t.state.keySeq==a&&(t.state.keySeq=null,t.display.input.reset())}),tg(t,a+" "+r,n,l))return!0}return tg(t,r,n,l)}function tg(t,r,n,l){let a=ty(t,r,l);return a=="multi"&&(t.state.keySeq=r),a=="handled"&&We(t,"keyHandled",t,r,n),(a=="handled"||a=="multi")&&(Ve(n),Wl(t)),!!a}function rg(t,r){let n=Ya(r,!0);return n?r.shiftKey&&!t.state.keySeq?Yl(t,"Shift-"+n,r,l=>Ja(t,l,!0))||Yl(t,n,r,l=>{if(typeof l=="string"?/^go[A-Z]/.test(l):l.motion)return Ja(t,l)}):Yl(t,n,r,l=>Ja(t,l)):!1}function iy(t,r,n){return Yl(t,"'"+n+"'",r,l=>Ja(t,l,!0))}var oh=null;function Qa(t){let r=this;if(t.target&&t.target!=r.display.input.getField()||(r.curOp.focus=st(Pr(r)),Re(r,t)))return;de&&Se<11&&t.keyCode==27&&(t.returnValue=!1);let n=t.keyCode;r.display.shift=n==16||t.shiftKey;let l=rg(r,t);Wt&&(oh=l?n:null,!l&&n==88&&!Ac&&(ot?t.metaKey:t.ctrlKey)&&r.replaceSelection("",null,"cut")),$t&&!ot&&!l&&n==46&&t.shiftKey&&!t.ctrlKey&&document.execCommand&&document.execCommand("cut"),n==18&&!/\bCodeMirror-crosshair\b/.test(r.display.lineDiv.className)&&ny(r)}function ny(t){let r=t.display.lineDiv;er(r,"CodeMirror-crosshair");function n(l){(l.keyCode==18||!l.altKey)&&(Vt(r,"CodeMirror-crosshair"),yt(document,"keyup",n),yt(document,"mouseover",n))}ne(document,"keyup",n),ne(document,"mouseover",n)}function $a(t){t.keyCode==16&&(this.doc.sel.shift=!1),Re(this,t)}function Va(t){let r=this;if(t.target&&t.target!=r.display.input.getField()||rr(r.display,t)||Re(r,t)||t.ctrlKey&&!t.altKey||ot&&t.metaKey)return;let n=t.keyCode,l=t.charCode;if(Wt&&n==oh){oh=null,Ve(t);return}if(Wt&&(!t.which||t.which<10)&&rg(r,t))return;let a=String.fromCharCode(l??n);a!="\b"&&(iy(r,t,a)||r.display.input.onKeyPress(t))}var ly=400,ef=class{constructor(r,n,l){this.time=r,this.pos=n,this.button=l}compare(r,n,l){return this.time+ly>r&&se(n,this.pos)==0&&l==this.button}},fs,us;function oy(t,r){let n=+new Date;return us&&us.compare(n,t,r)?(fs=us=null,"triple"):fs&&fs.compare(n,t,r)?(us=new ef(n,t,r),fs=null,"double"):(fs=new ef(n,t,r),us=null,"single")}function tf(t){let r=this,n=r.display;if(Re(r,t)||n.activeTouch&&n.input.supportsTouch())return;if(n.input.ensurePolled(),n.shift=t.shiftKey,rr(n,t)){Ue||(n.scroller.draggable=!1,setTimeout(()=>n.scroller.draggable=!0,100));return}if(rf(r,t))return;let l=Gr(r,t),a=cu(t),u=l?oy(l,a):"single";Sn(r).focus(),a==1&&r.state.selectingText&&r.state.selectingText(t),!(l&&sy(r,a,l,u,t))&&(a==1?l?fy(r,l,u,t):xl(t)==n.scroller&&Ve(t):a==2?(l&&In(r.doc,l),setTimeout(()=>n.input.focus(),20)):a==3&&(Wo?r.display.input.onContextMenu(t):Na(r)))}function sy(t,r,n,l,a){let u="Click";return l=="double"?u="Double"+u:l=="triple"&&(u="Triple"+u),u=(r==1?"Left":r==2?"Middle":"Right")+u,Yl(t,nh(u,a),a,d=>{if(typeof d=="string"&&(d=Di[d]),!d)return!1;let c=!1;try{t.isReadOnly()&&(t.state.suppressEdits=!0),c=d(t,n)!=Ji}finally{t.state.suppressEdits=!1}return c})}function ay(t,r,n){let l=t.getOption("configureMouse"),a=l?l(t,r,n):{};if(a.unit==null){let u=yc?n.shiftKey&&n.metaKey:n.altKey;a.unit=u?"rectangle":r=="single"?"char":r=="double"?"word":"line"}return(a.extend==null||t.doc.extend)&&(a.extend=t.doc.extend||n.shiftKey),a.addNew==null&&(a.addNew=ot?n.metaKey:n.ctrlKey),a.moveOnDrag==null&&(a.moveOnDrag=!(ot?n.altKey:n.ctrlKey)),a}function fy(t,r,n,l){de?setTimeout(Po(Da,t),0):t.curOp.focus=st(Pr(t));let a=ay(t,n,l),u=t.doc.sel,d;t.options.dragDrop&&kc&&!t.isReadOnly()&&n=="single"&&(d=u.contains(r))>-1&&(se((d=u.ranges[d]).from(),r)<0||r.xRel>0)&&(se(d.to(),r)>0||r.xRel<0)?uy(t,l,r,a):hy(t,l,r,a)}function uy(t,r,n,l){let a=t.display,u=!1,d=Ie(t,m=>{Ue&&(a.scroller.draggable=!1),t.state.draggingText=!1,t.state.delayingBlurEvent&&(t.hasFocus()?t.state.delayingBlurEvent=!1:Na(t)),yt(a.wrapper.ownerDocument,"mouseup",d),yt(a.wrapper.ownerDocument,"mousemove",c),yt(a.scroller,"dragstart",g),yt(a.scroller,"drop",d),u||(Ve(m),l.addNew||In(t.doc,n,null,null,l.extend),Ue&&!wn||de&&Se==9?setTimeout(()=>{a.wrapper.ownerDocument.body.focus({preventScroll:!0}),a.input.focus()},20):a.input.focus())}),c=function(m){u=u||Math.abs(r.clientX-m.clientX)+Math.abs(r.clientY-m.clientY)>=10},g=()=>u=!0;Ue&&(a.scroller.draggable=!0),t.state.draggingText=d,d.copy=!l.moveOnDrag,ne(a.wrapper.ownerDocument,"mouseup",d),ne(a.wrapper.ownerDocument,"mousemove",c),ne(a.scroller,"dragstart",g),ne(a.scroller,"drop",d),t.state.delayingBlurEvent=!0,setTimeout(()=>a.input.focus(),20),a.scroller.dragDrop&&a.scroller.dragDrop()}function ig(t,r,n){if(n=="char")return new be(r,r);if(n=="word")return t.findWordAt(r);if(n=="line")return new be(U(r.line,0),oe(t.doc,U(r.line+1,0)));let l=n(t,r);return new be(l.from,l.to)}function hy(t,r,n,l){de&&Na(t);let a=t.display,u=t.doc;Ve(r);let d,c,g=u.sel,m=g.ranges;if(l.addNew&&!l.extend?(c=u.sel.contains(n),c>-1?d=m[c]:d=new be(n,n)):(d=u.sel.primary(),c=u.sel.primIndex),l.unit=="rectangle")l.addNew||(d=new be(n,n)),n=Gr(t,r,!0,!0),c=-1;else{let D=ig(t,n,l.unit);l.extend?d=Ka(d,D.anchor,D.head,l.extend):d=D}l.addNew?c==-1?(c=m.length,et(u,Yt(t,m.concat([d]),c),{scroll:!1,origin:"*mouse"})):m.length>1&&m[c].empty()&&l.unit=="char"&&!l.extend?(et(u,Yt(t,m.slice(0,c).concat(m.slice(c+1)),0),{scroll:!1,origin:"*mouse"}),g=u.sel):zl(u,c,d,ra):(c=0,et(u,new ir([d],0),ra),g=u.sel);let x=n;function S(D){if(se(x,D)!=0)if(x=D,l.unit=="rectangle"){let E=[],B=t.options.tabSize,K=mt(V(u,n.line).text,n.ch,B),X=mt(V(u,D.line).text,D.ch,B),ee=Math.min(K,X),we=Math.max(K,X);for(let he=Math.min(n.line,D.line),ke=Math.min(t.lastLine(),Math.max(n.line,D.line));he<=ke;he++){let z=V(u,he).text,Y=Fo(z,ee,B);ee==we?E.push(new be(U(he,Y),U(he,Y))):z.length>Y&&E.push(new be(U(he,Y),U(he,Fo(z,we,B))))}E.length||E.push(new be(n,n)),et(u,Yt(t,g.ranges.slice(0,c).concat(E),c),{origin:"*mouse",scroll:!1}),t.scrollIntoView(D)}else{let E=d,B=ig(t,D,l.unit),K=E.anchor,X;se(B.anchor,K)>0?(X=B.head,K=On(E.from(),B.anchor)):(X=B.anchor,K=An(E.to(),B.head));let ee=g.ranges.slice(0);ee[c]=dy(t,new be(oe(u,K),X)),et(u,Yt(t,ee,c),ra)}}let k=a.wrapper.getBoundingClientRect(),A=0;function T(D){let E=++A,B=Gr(t,D,!0,l.unit=="rectangle");if(B)if(se(B,x)!=0){t.curOp.focus=st(Pr(t)),S(B);let K=Pl(a,u);(B.line>=K.to||B.line{A==E&&T(D)}),150)}else{let K=D.clientYk.bottom?20:0;K&&setTimeout(Ie(t,()=>{A==E&&(a.scroller.scrollTop+=K,T(D))}),50)}}function L(D){t.state.selectingText=!1,A=1/0,D&&(Ve(D),a.input.focus()),yt(a.wrapper.ownerDocument,"mousemove",C),yt(a.wrapper.ownerDocument,"mouseup",M),u.history.lastSelOrigin=null}let C=Ie(t,D=>{D.buttons===0||!cu(D)?L(D):T(D)}),M=Ie(t,L);t.state.selectingText=M,ne(a.wrapper.ownerDocument,"mousemove",C),ne(a.wrapper.ownerDocument,"mouseup",M)}function dy(t,r){let{anchor:n,head:l}=r,a=V(t.doc,n.line);if(se(n,l)==0&&n.sticky==l.sticky)return r;let u=Pt(a);if(!u)return r;let d=bi(u,n.ch,n.sticky),c=u[d];if(c.from!=n.ch&&c.to!=n.ch)return r;let g=d+(c.from==n.ch==(c.level!=1)?0:1);if(g==0||g==u.length)return r;let m;if(l.line!=n.line)m=(l.line-n.line)*(t.doc.direction=="ltr"?1:-1)>0;else{let T=bi(u,l.ch,l.sticky),L=T-d||(l.ch-n.ch)*(c.level==1?-1:1);T==g-1||T==g?m=L<0:m=L>0}let x=u[g+(m?-1:0)],S=m==(x.level==1),k=S?x.from:x.to,A=S?"after":"before";return n.ch==k&&n.sticky==A?r:new be(new U(n.line,k,A),l)}function ng(t,r,n,l){let a,u;if(r.touches)a=r.touches[0].clientX,u=r.touches[0].clientY;else try{a=r.clientX,u=r.clientY}catch{return!1}if(a>=Math.floor(t.display.gutters.getBoundingClientRect().right))return!1;l&&Ve(r);let d=t.display,c=d.lineDiv.getBoundingClientRect();if(u>c.bottom||!Tt(t,n))return aa(r);u-=c.top-d.viewOffset;for(let g=0;g=a){let x=Rr(t.doc,u),S=t.display.gutterSpecs[g];return Ae(t,n,t,x,S.className,r),aa(r)}}}function rf(t,r){return ng(t,r,"gutterClick",!0)}function sh(t,r){rr(t.display,r)||cy(t,r)||Re(t,r,"contextmenu")||Wo||t.display.input.onContextMenu(r)}function cy(t,r){return Tt(t,"gutterContextMenu")?ng(t,r,"gutterContextMenu",!1):!1}function nf(t){t.display.wrapper.className=t.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+t.options.theme.replace(/(^|\s)\s*/g," cm-s-"),tn(t)}var zn={toString:function(){return"CodeMirror.Init"}},ah={},hs={};function lg(t){let r=t.optionHandlers;function n(l,a,u,d){t.defaults[l]=a,u&&(r[l]=d?(c,g,m)=>{m!=zn&&u(c,g,m)}:u)}t.defineOption=n,t.Init=zn,n("value","",(l,a)=>l.setValue(a),!0),n("mode",null,(l,a)=>{l.doc.modeOption=a,rs(l)},!0),n("indentUnit",2,rs,!0),n("indentWithTabs",!1),n("smartIndent",!0),n("tabSize",4,l=>{Il(l),tn(l),Je(l)},!0),n("lineSeparator",null,(l,a)=>{if(l.doc.lineSep=a,!a)return;let u=[],d=l.doc.first;l.doc.iter(c=>{for(let g=0;;){let m=c.text.indexOf(a,g);if(m==-1)break;g=m+a.length,u.push(U(d,m))}d++});for(let c=u.length-1;c>=0;c--)Sr(l.doc,a,u[c],U(u[c].line,u[c].ch+a.length))}),n("specialChars",/[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b\u200e\u200f\u2028\u2029\u202d\u202e\u2066\u2067\u2069\ufeff\ufff9-\ufffc]/g,(l,a,u)=>{l.state.specialChars=new RegExp(a.source+(a.test(" ")?"":"| "),"g"),u!=zn&&l.refresh()}),n("specialCharPlaceholder",$c,l=>l.refresh(),!0),n("electricChars",!0),n("inputStyle",yi?"contenteditable":"textarea",()=>{throw new Error("inputStyle can not (yet) be changed in a running editor")},!0),n("spellcheck",!1,(l,a)=>l.getInputField().spellcheck=a,!0),n("autocorrect",!1,(l,a)=>l.getInputField().autocorrect=a,!0),n("autocapitalize",!1,(l,a)=>l.getInputField().autocapitalize=a,!0),n("rtlMoveVisually",!xc),n("wholeLineUpdateBefore",!0),n("theme","default",l=>{nf(l),El(l)},!0),n("keyMap","default",(l,a,u)=>{let d=ql(a),c=u!=zn&&ql(u);c&&c.detach&&c.detach(l,d),d.attach&&d.attach(l,c||null)}),n("extraKeys",null),n("configureMouse",null),n("lineWrapping",!1,gy,!0),n("gutters",[],(l,a)=>{l.display.gutterSpecs=ts(a,l.options.lineNumbers),El(l)},!0),n("fixedGutter",!0,(l,a)=>{l.display.gutters.style.left=a?Qo(l.display)+"px":"0",l.refresh()},!0),n("coverGutterNextToScrollbar",!1,l=>Ti(l),!0),n("scrollbarStyle","native",l=>{Fa(l),Ti(l),l.display.scrollbars.setScrollTop(l.doc.scrollTop),l.display.scrollbars.setScrollLeft(l.doc.scrollLeft)},!0),n("lineNumbers",!1,(l,a)=>{l.display.gutterSpecs=ts(l.options.gutters,a),El(l)},!0),n("firstLineNumber",1,El,!0),n("lineNumberFormatter",l=>l,El,!0),n("showCursorWhenSelecting",!1,Hn,!0),n("resetSelectionOnContextMenu",!0),n("lineWiseCopyCut",!0),n("pasteLinesPerSelection",!0),n("selectionsMayTouch",!1),n("readOnly",!1,(l,a)=>{a=="nocursor"&&(ti(l),l.display.input.blur()),l.display.input.readOnlyChanged(a)}),n("screenReaderLabel",null,(l,a)=>{a=a===""?null:a,l.display.input.screenReaderLabelChanged(a)}),n("disableInput",!1,(l,a)=>{a||l.display.input.reset()},!0),n("dragDrop",!0,py),n("allowDropFileTypes",null),n("cursorBlinkRate",530),n("cursorScrollMargin",0),n("cursorHeight",1,Hn,!0),n("singleCursorHeightPerLine",!0,Hn,!0),n("workTime",100),n("workDelay",100),n("flattenSpans",!0,Il,!0),n("addModeClass",!1,Il,!0),n("pollInterval",100),n("undoDepth",200,(l,a)=>l.doc.history.undoDepth=a),n("historyEventDelay",1250),n("viewportMargin",10,l=>l.refresh(),!0),n("maxHighlightLength",1e4,Il,!0),n("moveInputWithCursor",!0,(l,a)=>{a||l.display.input.resetPosition()}),n("tabindex",null,(l,a)=>l.display.input.getField().tabIndex=a||""),n("autofocus",null),n("direction","ltr",(l,a)=>l.doc.setDirection(a),!0),n("phrases",null)}function py(t,r,n){let l=n&&n!=zn;if(!r!=!l){let a=t.display.dragFunctions,u=r?ne:yt;u(t.display.scroller,"dragstart",a.start),u(t.display.scroller,"dragenter",a.enter),u(t.display.scroller,"dragover",a.over),u(t.display.scroller,"dragleave",a.leave),u(t.display.scroller,"drop",a.drop)}}function gy(t){t.options.lineWrapping?(er(t.display.wrapper,"CodeMirror-wrap"),t.display.sizer.style.minWidth="",t.display.sizerWidth=null):(Vt(t.display.wrapper,"CodeMirror-wrap"),Tl(t)),Hl(t),Je(t),tn(t),setTimeout(()=>Ti(t),100)}function Fe(t,r){if(!(this instanceof Fe))return new Fe(t,r);this.options=r=r?Er(r):{},Er(ah,r,!1);let n=r.value;typeof n=="string"?n=new ni(n,r.mode,null,r.lineSeparator,r.direction):r.mode&&(n.modeOption=r.mode),this.doc=n;let l=new Fe.inputStyles[r.inputStyle](this),a=this.display=new yp(t,n,l,r);a.wrapper.CodeMirror=this,nf(this),r.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),Fa(this),this.state={keyMaps:[],overlays:[],modeGen:0,overwrite:!1,delayingBlurEvent:!1,focused:!1,suppressEdits:!1,pasteIncoming:-1,cutIncoming:-1,selectingText:!1,draggingText:!1,highlight:new fr,keySeq:null,specialChars:null},r.autofocus&&!yi&&a.input.focus(),de&&Se<11&&setTimeout(()=>this.display.input.reset(!0),20),vy(this),Jp(),ri(this),this.curOp.forceUpdate=!0,Ga(this,n),r.autofocus&&!yi||this.hasFocus()?setTimeout(()=>{this.hasFocus()&&!this.state.focused&&Ha(this)},20):ti(this);for(let u in hs)hs.hasOwnProperty(u)&&hs[u](this,r[u],zn);Ba(this),r.finishInit&&r.finishInit(this);for(let u=0;u{if(Re(t,g))return;let m=Gr(t,g);if(!m||rf(t,g)||rr(t.display,g))return;Ve(g);let x=t.findWordAt(m);In(t.doc,x.anchor,x.head)})):ne(r.scroller,"dblclick",g=>Re(t,g)||Ve(g)),ne(r.scroller,"contextmenu",g=>sh(t,g)),ne(r.input.getField(),"contextmenu",g=>{r.scroller.contains(g.target)||sh(t,g)});let n,l={end:0};function a(){r.activeTouch&&(n=setTimeout(()=>r.activeTouch=null,1e3),l=r.activeTouch,l.end=+new Date)}function u(g){if(g.touches.length!=1)return!1;let m=g.touches[0];return m.radiusX<=1&&m.radiusY<=1}function d(g,m){if(m.left==null)return!0;let x=m.left-g.left,S=m.top-g.top;return x*x+S*S>20*20}ne(r.scroller,"touchstart",g=>{if(!Re(t,g)&&!u(g)&&!rf(t,g)){r.input.ensurePolled(),clearTimeout(n);let m=+new Date;r.activeTouch={start:m,moved:!1,prev:m-l.end<=300?l:null},g.touches.length==1&&(r.activeTouch.left=g.touches[0].pageX,r.activeTouch.top=g.touches[0].pageY)}}),ne(r.scroller,"touchmove",()=>{r.activeTouch&&(r.activeTouch.moved=!0)}),ne(r.scroller,"touchend",g=>{let m=r.activeTouch;if(m&&!rr(r,g)&&m.left!=null&&!m.moved&&new Date-m.start<300){let x=t.coordsChar(r.activeTouch,"page"),S;!m.prev||d(m,m.prev)?S=new be(x,x):!m.prev.prev||d(m,m.prev.prev)?S=t.findWordAt(x):S=new be(U(x.line,0),oe(t.doc,U(x.line+1,0))),t.setSelection(S.anchor,S.head),t.focus(),Ve(g)}a()}),ne(r.scroller,"touchcancel",a),ne(r.scroller,"scroll",()=>{r.scroller.clientHeight&&(nn(t,r.scroller.scrollTop),Ur(t,r.scroller.scrollLeft,!0),Ae(t,"scroll",t))}),ne(r.scroller,"mousewheel",g=>Ju(t,g)),ne(r.scroller,"DOMMouseScroll",g=>Ju(t,g)),ne(r.wrapper,"scroll",()=>r.wrapper.scrollTop=r.wrapper.scrollLeft=0),r.dragFunctions={enter:g=>{Re(t,g)||wi(g)},over:g=>{Re(t,g)||(qp(t,g),wi(g))},start:g=>jp(t,g),drop:Ie(t,Xp),leave:g=>{Re(t,g)||ih(t)}};let c=r.input.getField();ne(c,"keyup",g=>$a.call(t,g)),ne(c,"keydown",Ie(t,Qa)),ne(c,"keypress",Ie(t,Va)),ne(c,"focus",g=>Ha(t,g)),ne(c,"blur",g=>ti(t,g))}var fh=[];Fe.defineInitHook=t=>fh.push(t);function Gn(t,r,n,l){let a=t.doc,u;n==null&&(n="add"),n=="smart"&&(a.mode.indent?u=Vi(t,r).state:n="prev");let d=t.options.tabSize,c=V(a,r),g=mt(c.text,null,d);c.stateAfter&&(c.stateAfter=null);let m=c.text.match(/^\s*/)[0],x;if(!l&&!/\S/.test(c.text))x=0,n="not";else if(n=="smart"&&(x=a.mode.indent(u,c.text.slice(m.length),c.text),x==Ji||x>150)){if(!l)return;n="prev"}n=="prev"?r>a.first?x=mt(V(a,r-1).text,null,d):x=0:n=="add"?x=g+t.options.indentUnit:n=="subtract"?x=g-t.options.indentUnit:typeof n=="number"&&(x=g+n),x=Math.max(0,x);let S="",k=0;if(t.options.indentWithTabs)for(let A=Math.floor(x/d);A;--A)k+=d,S+=" ";if(kd,g=bl(r),m=null;if(c&&l.ranges.length>1)if(kr&&kr.text.join(` +`)==r){if(l.ranges.length%kr.text.length==0){m=[];for(let S=0;S[S]));let x=t.curOp.updateInput;for(let S=l.ranges.length-1;S>=0;S--){let k=l.ranges[S],A=k.from(),T=k.to();k.empty()&&(n&&n>0?A=U(A.line,A.ch-n):t.state.overwrite&&!c?T=U(T.line,Math.min(V(u,T.line).text.length,T.ch+ge(g).length)):c&&kr&&kr.lineWise&&kr.text.join(` +`)==g.join(` +`)&&(A=T=U(A.line,0)));let L={from:A,to:T,text:m?m[S%m.length]:g,origin:a||(c?"paste":t.state.cutIncoming>d?"cut":"+input")};Ai(t.doc,L),We(t,"inputRead",t,L)}r&&!c&&uh(t,r),br(t),t.curOp.updateInput<2&&(t.curOp.updateInput=x),t.curOp.typing=!0,t.state.pasteIncoming=t.state.cutIncoming=-1}function lf(t,r){let n=t.clipboardData&&t.clipboardData.getData("Text");if(n)return t.preventDefault(),!r.isReadOnly()&&!r.options.disableInput&&r.hasFocus()&&Xe(r,()=>ds(r,n,0,null,"paste")),!0}function uh(t,r){if(!t.options.electricChars||!t.options.smartIndent)return;let n=t.doc.sel;for(let l=n.ranges.length-1;l>=0;l--){let a=n.ranges[l];if(a.head.ch>100||l&&n.ranges[l-1].head.line==a.head.line)continue;let u=t.getModeAt(a.head),d=!1;if(u.electricChars){for(let c=0;c-1){d=Gn(t,a.head.line,"smart");break}}else u.electricInput&&u.electricInput.test(V(t.doc,a.head.line).text.slice(0,a.head.ch))&&(d=Gn(t,a.head.line,"smart"));d&&We(t,"electricInput",t,a.head.line)}}function of(t){let r=[],n=[];for(let l=0;ld.priority),this.state.modeGen++,Je(this)}),removeOverlay:At(function(l){let a=this.state.overlays;for(let u=0;uu&&(Gn(this,c.head.line,l,!0),u=c.head.line,d==this.doc.sel.primIndex&&br(this));else{let g=c.from(),m=c.to(),x=Math.max(u,g.line);u=Math.min(this.lastLine(),m.line-(m.ch?0:1))+1;for(let k=x;k0&&zl(this.doc,d,new be(g,S[d].to()),Lt)}}}),getTokenAt:function(l,a){return wu(this,l,a)},getLineTokens:function(l,a){return wu(this,U(l),a,!0)},getTokenTypeAt:function(l){l=oe(this.doc,l);let a=pa(this,V(this.doc,l.line)),u=0,d=(a.length-1)/2,c=l.ch,g;if(c==0)g=a[2];else for(;;){let x=u+d>>1;if((x?a[x*2-1]:0)>=c)d=x;else if(a[x*2+1]g&&(l=g,d=!0),c=V(this.doc,l)}else c=l;return Jo(this,c,{top:0,left:0},a||"page",u||d).top+(d?this.doc.height-tr(c):0)},defaultTextHeight:function(){return Ci(this.display)},defaultCharWidth:function(){return rn(this.display)},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(l,a,u,d,c){let g=this.display;l=jt(this,oe(this.doc,l));let m=l.bottom,x=l.left;if(a.style.position="absolute",a.setAttribute("cm-ignore-events","true"),this.display.input.setUneditable(a),g.sizer.appendChild(a),d=="over")m=l.top;else if(d=="above"||d=="near"){let S=Math.max(g.wrapper.clientHeight,this.doc.height),k=Math.max(g.sizer.clientWidth,g.lineSpace.clientWidth);(d=="above"||l.bottom+a.offsetHeight>S)&&l.top>a.offsetHeight?m=l.top-a.offsetHeight:l.bottom+a.offsetHeight<=S&&(m=l.bottom),x+a.offsetWidth>k&&(x=k-a.offsetWidth)}a.style.top=m+"px",a.style.left=a.style.right="",c=="right"?(x=g.sizer.clientWidth-a.offsetWidth,a.style.right="0px"):(c=="left"?x=0:c=="middle"&&(x=(g.sizer.clientWidth-a.offsetWidth)/2),a.style.left=x+"px"),u&&pp(this,{left:x,top:m,right:x+a.offsetWidth,bottom:m+a.offsetHeight})},triggerOnKeyDown:At(Qa),triggerOnKeyPress:At(Va),triggerOnKeyUp:$a,triggerOnMouseDown:At(tf),execCommand:function(l){if(Di.hasOwnProperty(l))return Di[l].call(null,this)},triggerElectric:At(function(l){uh(this,l)}),findPosH:function(l,a,u,d){let c=1;a<0&&(c=-1,a=-a);let g=oe(this.doc,l);for(let m=0;mthis.display.shift||this.doc.extend||u.empty()?hh(this.doc,u.head,l,a,this.options.rtlMoveVisually):l<0?u.from():u.to(),kn)}),deleteH:At(function(l,a){let u=this.doc.sel,d=this.doc;u.somethingSelected()?d.replaceSelection("",null,"+delete"):on(this,c=>{let g=hh(d,c.head,l,a,!1);return l<0?{from:g,to:c.head}:{from:c.head,to:g}})}),findPosV:function(l,a,u,d){let c=1,g=d;a<0&&(c=-1,a=-a);let m=oe(this.doc,l);for(let x=0;x{if(c)return l<0?g.from():g.to();let m=jt(this,g.head,"div");g.goalColumn!=null&&(m.left=g.goalColumn),d.push(m.left);let x=og(this,m,l,a);return a=="page"&&g==u.sel.primary()&&Vo(this,Nl(this,x,"div").top-m.top),x},kn),d.length)for(let g=0;gEo(S,g):/\s/.test(m)?S=>/\s/.test(S):S=>!/\s/.test(S)&&!Eo(S);for(;d>0&&x(u.charAt(d-1));)--d;for(;ctypeof c=="number"||/^\d+$/.test(String(c))?c+"px":c;l!=null&&(this.display.wrapper.style.width=u(l)),a!=null&&(this.display.wrapper.style.height=u(a)),this.options.lineWrapping&&Eu(this);let d=this.display.viewFrom;this.doc.iter(d,this.display.viewTo,c=>{if(c.widgets){for(let g=0;g.5||this.options.lineWrapping)&&Hl(this),Ae(this,"refresh",this)}),swapDoc:At(function(l){let a=this.doc;return a.cm=null,this.state.selectingText&&this.state.selectingText(),Ga(this,l),tn(this),this.display.input.reset(),Pn(this,l.scrollLeft,l.scrollTop),this.curOp.forceScroll=!0,We(this,"swapDoc",this,a),a}),phrase:function(l){let a=this.options.phrases;return a&&Object.prototype.hasOwnProperty.call(a,l)?a[l]:l},getInputField:function(){return this.display.input.getField()},getWrapperElement:function(){return this.display.wrapper},getScrollerElement:function(){return this.display.scroller},getGutterElement:function(){return this.display.gutters}},Ir(t),t.registerHelper=function(l,a,u){n.hasOwnProperty(l)||(n[l]=t[l]={_global:[]}),n[l][a]=u},t.registerGlobalHelper=function(l,a,u,d){t.registerHelper(l,a,d),n[l]._global.push({pred:u,val:d})}}function hh(t,r,n,l,a){let u=r,d=n,c=V(t,r.line),g=a&&t.direction=="rtl"?-n:n;function m(){let k=r.line+g;return k=t.first+t.size?!1:(r=new U(k,r.ch,r.sticky),c=V(t,k))}function x(k){let A;if(l=="codepoint"){let T=c.text.charCodeAt(r.ch+(n>0?0:-1));if(isNaN(T))A=null;else{let L=n>0?T>=55296&&T<56320:T>=56320&&T<57343;A=new U(r.line,Math.max(0,Math.min(c.text.length,r.ch+n*(L?2:1))),-n)}}else a?A=$p(t.cm,c,r,n):A=Za(c,r,n);if(A==null)if(!k&&m())r=as(a,t.cm,c,r.line,g);else return!1;else r=A;return!0}if(l=="char"||l=="codepoint")x();else if(l=="column")x(!0);else if(l=="word"||l=="group"){let k=null,A=l=="group",T=t.cm&&t.cm.getHelper(r,"wordChars");for(let L=!0;!(n<0&&!x(!L));L=!1){let C=c.text.charAt(r.ch)||` +`,M=Eo(C,T)?"w":A&&C==` +`?"n":!A||/\s/.test(C)?null:"p";if(A&&!L&&!M&&(M="s"),k&&k!=M){n<0&&(n=1,x(),r.sticky="after");break}if(M&&(k=M),n>0&&!x(!L))break}}let S=Rl(t,r,u,d,!0);return zo(u,S)&&(S.hitSide=!0),S}function og(t,r,n,l){let a=t.doc,u=r.left,d;if(l=="page"){let g=Math.min(t.display.wrapper.clientHeight,Sn(t).innerHeight||a(t).documentElement.clientHeight),m=Math.max(g-.5*Ci(t.display),3);d=(n>0?r.bottom:r.top)+n*m}else l=="line"&&(d=n>0?r.bottom+3:r.top-3);let c;for(;c=Sa(t,u,d),!!c.outside;){if(n<0?d<=0:d>=a.height){c.hitSide=!0;break}d+=n*5}return c}var Ql=class{constructor(r){this.cm=r,this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null,this.polling=new fr,this.composing=null,this.gracePeriod=!1,this.readDOMTimeout=null}init(r){let n=this,l=n.cm,a=n.div=r.lineDiv;a.contentEditable=!0,cs(a,l.options.spellcheck,l.options.autocorrect,l.options.autocapitalize);function u(c){for(let g=c.target;g;g=g.parentNode){if(g==a)return!0;if(/\bCodeMirror-(?:line)?widget\b/.test(g.className))break}return!1}ne(a,"paste",c=>{!u(c)||Re(l,c)||lf(c,l)||Se<=11&&setTimeout(Ie(l,()=>this.updateFromDOM()),20)}),ne(a,"compositionstart",c=>{this.composing={data:c.data,done:!1}}),ne(a,"compositionupdate",c=>{this.composing||(this.composing={data:c.data,done:!1})}),ne(a,"compositionend",c=>{this.composing&&(c.data!=this.composing.data&&this.readFromDOMSoon(),this.composing.done=!0)}),ne(a,"touchstart",()=>n.forceCompositionEnd()),ne(a,"input",()=>{this.composing||this.readFromDOMSoon()});function d(c){if(!u(c)||Re(l,c))return;if(l.somethingSelected())Zl({lineWise:!1,text:l.getSelections()}),c.type=="cut"&&l.replaceSelection("",null,"cut");else if(l.options.lineWiseCopyCut){let S=of(l);Zl({lineWise:!0,text:S.text}),c.type=="cut"&&l.operation(()=>{l.setSelections(S.ranges,0,Lt),l.replaceSelection("",null,"cut")})}else return;if(c.clipboardData){c.clipboardData.clearData();let S=kr.text.join(` +`);if(c.clipboardData.setData("Text",S),c.clipboardData.getData("Text")==S){c.preventDefault();return}}let g=sf(),m=g.firstChild;cs(m),l.display.lineSpace.insertBefore(g,l.display.lineSpace.firstChild),m.value=kr.text.join(` +`);let x=st(Fr(a));Cn(m),setTimeout(()=>{l.display.lineSpace.removeChild(g),x.focus(),x==a&&n.showPrimarySelection()},50)}ne(a,"copy",d),ne(a,"cut",d)}screenReaderLabelChanged(r){r?this.div.setAttribute("aria-label",r):this.div.removeAttribute("aria-label")}prepareSelection(){let r=Oa(this.cm,!1);return r.focus=st(Fr(this.div))==this.div,r}showSelection(r,n){!r||!this.cm.display.view.length||((r.focus||n)&&this.showPrimarySelection(),this.showMultipleSelections(r))}getSelection(){return this.cm.display.wrapper.ownerDocument.getSelection()}showPrimarySelection(){let r=this.getSelection(),n=this.cm,l=n.doc.sel.primary(),a=l.from(),u=l.to();if(n.display.viewTo==n.display.viewFrom||a.line>=n.display.viewTo||u.line=n.display.viewFrom&&ag(n,a)||{node:g[0].measure.map[2],offset:0},x=u.line{this.gracePeriod=!1,this.selectionChanged()&&this.cm.operation(()=>this.cm.curOp.selectionChanged=!0)},20)}showMultipleSelections(r){vt(this.cm.display.cursorDiv,r.cursors),vt(this.cm.display.selectionDiv,r.selection)}rememberSelection(){let r=this.getSelection();this.lastAnchorNode=r.anchorNode,this.lastAnchorOffset=r.anchorOffset,this.lastFocusNode=r.focusNode,this.lastFocusOffset=r.focusOffset}selectionInEditor(){let r=this.getSelection();if(!r.rangeCount)return!1;let n=r.getRangeAt(0).commonAncestorContainer;return vr(this.div,n)}focus(){this.cm.options.readOnly!="nocursor"&&((!this.selectionInEditor()||st(Fr(this.div))!=this.div)&&this.showSelection(this.prepareSelection(),!0),this.div.focus())}blur(){this.div.blur()}getField(){return this.div}supportsTouch(){return!0}receivedFocus(){let r=this;this.selectionInEditor()?setTimeout(()=>this.pollSelection(),20):Xe(this.cm,()=>r.cm.curOp.selectionChanged=!0);function n(){r.cm.state.focused&&(r.pollSelection(),r.polling.set(r.cm.options.pollInterval,n))}this.polling.set(this.cm.options.pollInterval,n)}selectionChanged(){let r=this.getSelection();return r.anchorNode!=this.lastAnchorNode||r.anchorOffset!=this.lastAnchorOffset||r.focusNode!=this.lastFocusNode||r.focusOffset!=this.lastFocusOffset}pollSelection(){if(this.readDOMTimeout!=null||this.gracePeriod||!this.selectionChanged())return;let r=this.getSelection(),n=this.cm;if(gl&&pr&&this.cm.display.gutterSpecs.length&&my(r.anchorNode)){this.cm.triggerOnKeyDown({type:"keydown",keyCode:8,preventDefault:Math.abs}),this.blur(),this.focus();return}if(this.composing)return;this.rememberSelection();let l=af(n,r.anchorNode,r.anchorOffset),a=af(n,r.focusNode,r.focusOffset);l&&a&&Xe(n,()=>{et(n.doc,hr(l,a),Lt),(l.bad||a.bad)&&(n.curOp.selectionChanged=!0)})}pollContent(){this.readDOMTimeout!=null&&(clearTimeout(this.readDOMTimeout),this.readDOMTimeout=null);let r=this.cm,n=r.display,l=r.doc.sel.primary(),a=l.from(),u=l.to();if(a.ch==0&&a.line>r.firstLine()&&(a=U(a.line-1,V(r.doc,a.line-1).length)),u.ch==V(r.doc,u.line).text.length&&u.linen.viewTo-1)return!1;let d,c,g;a.line==n.viewFrom||(d=Si(r,a.line))==0?(c=xe(n.view[0].line),g=n.view[0].node):(c=xe(n.view[d].line),g=n.view[d-1].node.nextSibling);let m=Si(r,u.line),x,S;if(m==n.view.length-1?(x=n.viewTo-1,S=n.lineDiv.lastChild):(x=xe(n.view[m+1].line)-1,S=n.view[m+1].node.previousSibling),!g)return!1;let k=r.doc.splitLines(yy(r,g,S,c,x)),A=Br(r.doc,U(c,0),U(x,V(r.doc,x).text.length));for(;k.length>1&&A.length>1;)if(ge(k)==ge(A))k.pop(),A.pop(),x--;else if(k[0]==A[0])k.shift(),A.shift(),c++;else break;let T=0,L=0,C=k[0],M=A[0],D=Math.min(C.length,M.length);for(;Ta.ch&&E.charCodeAt(E.length-L-1)==B.charCodeAt(B.length-L-1);)T--,L++;k[k.length-1]=E.slice(0,E.length-L).replace(/^\u200b+/,""),k[0]=k[0].slice(T).replace(/\u200b+$/,"");let X=U(c,T),ee=U(x,A.length?ge(A).length-L:0);if(k.length>1||k[0]||se(X,ee))return Sr(r.doc,k,X,ee,"+input"),!0}ensurePolled(){this.forceCompositionEnd()}reset(){this.forceCompositionEnd()}forceCompositionEnd(){this.composing&&(clearTimeout(this.readDOMTimeout),this.composing=null,this.updateFromDOM(),this.div.blur(),this.div.focus())}readFromDOMSoon(){this.readDOMTimeout==null&&(this.readDOMTimeout=setTimeout(()=>{if(this.readDOMTimeout=null,this.composing)if(this.composing.done)this.composing=null;else return;this.updateFromDOM()},80))}updateFromDOM(){(this.cm.isReadOnly()||!this.pollContent())&&Xe(this.cm,()=>Je(this.cm))}setUneditable(r){r.contentEditable="false"}onKeyPress(r){r.charCode==0||this.composing||(r.preventDefault(),this.cm.isReadOnly()||Ie(this.cm,ds)(this.cm,String.fromCharCode(r.charCode==null?r.keyCode:r.charCode),0))}readOnlyChanged(r){this.div.contentEditable=String(r!="nocursor")}onContextMenu(){}resetPosition(){}};Ql.prototype.needsContentAttribute=!0;function ag(t,r){let n=Zo(t,r.line);if(!n||n.hidden)return null;let l=V(t.doc,r.line),a=Hu(n,l,r.line),u=Pt(l,t.doc.direction),d="left";u&&(d=bi(u,r.ch)%2?"right":"left");let c=Pu(a.map,r.ch,d);return c.offset=c.collapse=="right"?c.end:c.start,c}function my(t){for(let r=t;r;r=r.parentNode)if(/CodeMirror-gutter-wrapper/.test(r.className))return!0;return!1}function Jl(t,r){return r&&(t.bad=!0),t}function yy(t,r,n,l,a){let u="",d=!1,c=t.doc.lineSeparator(),g=!1;function m(A){return T=>T.id==A}function x(){d&&(u+=c,g&&(u+=c),d=g=!1)}function S(A){A&&(x(),u+=A)}function k(A){if(A.nodeType==1){let T=A.getAttribute("cm-text");if(T){S(T);return}let L=A.getAttribute("cm-marker"),C;if(L){let D=t.findMarks(U(l,0),U(a+1,0),m(+L));D.length&&(C=D[0].find(0))&&S(Br(t.doc,C.from,C.to).join(c));return}if(A.getAttribute("contenteditable")=="false")return;let M=/^(pre|div|p|li|table|br)$/i.test(A.nodeName);if(!/^br$/i.test(A.nodeName)&&A.textContent.length==0)return;M&&x();for(let D=0;D{de&&Se>=9&&this.hasSelection&&(this.hasSelection=null),n.poll()}),ne(a,"paste",d=>{Re(l,d)||lf(d,l)||(l.state.pasteIncoming=+new Date,n.fastPoll())});function u(d){if(!Re(l,d)){if(l.somethingSelected())Zl({lineWise:!1,text:l.getSelections()});else if(l.options.lineWiseCopyCut){let c=of(l);Zl({lineWise:!0,text:c.text}),d.type=="cut"?l.setSelections(c.ranges,null,Lt):(n.prevInput="",a.value=c.text.join(` +`),Cn(a))}else return;d.type=="cut"&&(l.state.cutIncoming=+new Date)}}ne(a,"cut",u),ne(a,"copy",u),ne(r.scroller,"paste",d=>{if(rr(r,d)||Re(l,d))return;if(!a.dispatchEvent){l.state.pasteIncoming=+new Date,n.focus();return}let c=new Event("paste");c.clipboardData=d.clipboardData,a.dispatchEvent(c)}),ne(r.lineSpace,"selectstart",d=>{rr(r,d)||Ve(d)}),ne(a,"compositionstart",()=>{let d=l.getCursor("from");n.composing&&n.composing.range.clear(),n.composing={start:d,range:l.markText(d,l.getCursor("to"),{className:"CodeMirror-composing"})}}),ne(a,"compositionend",()=>{n.composing&&(n.poll(),n.composing.range.clear(),n.composing=null)})}createField(r){this.wrapper=sf(),this.textarea=this.wrapper.firstChild;let n=this.cm.options;cs(this.textarea,n.spellcheck,n.autocorrect,n.autocapitalize)}screenReaderLabelChanged(r){r?this.textarea.setAttribute("aria-label",r):this.textarea.removeAttribute("aria-label")}prepareSelection(){let r=this.cm,n=r.display,l=r.doc,a=Oa(r);if(r.options.moveInputWithCursor){let u=jt(r,l.sel.primary().head,"div"),d=n.wrapper.getBoundingClientRect(),c=n.lineDiv.getBoundingClientRect();a.teTop=Math.max(0,Math.min(n.wrapper.clientHeight-10,u.top+c.top-d.top)),a.teLeft=Math.max(0,Math.min(n.wrapper.clientWidth-10,u.left+c.left-d.left))}return a}showSelection(r){let n=this.cm,l=n.display;vt(l.cursorDiv,r.cursors),vt(l.selectionDiv,r.selection),r.teTop!=null&&(this.wrapper.style.top=r.teTop+"px",this.wrapper.style.left=r.teLeft+"px")}reset(r){if(this.contextMenuPending||this.composing&&r)return;let n=this.cm;if(this.resetting=!0,n.somethingSelected()){this.prevInput="";let l=n.getSelection();this.textarea.value=l,n.state.focused&&Cn(this.textarea),de&&Se>=9&&(this.hasSelection=l)}else r||(this.prevInput=this.textarea.value="",de&&Se>=9&&(this.hasSelection=null));this.resetting=!1}getField(){return this.textarea}supportsTouch(){return!1}focus(){if(this.cm.options.readOnly!="nocursor"&&(!yi||st(Fr(this.textarea))!=this.textarea))try{this.textarea.focus()}catch{}}blur(){this.textarea.blur()}resetPosition(){this.wrapper.style.top=this.wrapper.style.left=0}receivedFocus(){this.slowPoll()}slowPoll(){this.pollingFast||this.polling.set(this.cm.options.pollInterval,()=>{this.poll(),this.cm.state.focused&&this.slowPoll()})}fastPoll(){let r=!1,n=this;n.pollingFast=!0;function l(){!n.poll()&&!r?(r=!0,n.polling.set(60,l)):(n.pollingFast=!1,n.slowPoll())}n.polling.set(20,l)}poll(){let r=this.cm,n=this.textarea,l=this.prevInput;if(this.contextMenuPending||this.resetting||!r.state.focused||Mc(n)&&!l&&!this.composing||r.isReadOnly()||r.options.disableInput||r.state.keySeq)return!1;let a=n.value;if(a==l&&!r.somethingSelected())return!1;if(de&&Se>=9&&this.hasSelection===a||ot&&/[\uf700-\uf7ff]/.test(a))return r.display.input.reset(),!1;if(r.doc.sel==r.display.selForContextMenu){let c=a.charCodeAt(0);if(c==8203&&!l&&(l="\u200B"),c==8666)return this.reset(),this.cm.execCommand("undo")}let u=0,d=Math.min(l.length,a.length);for(;u{ds(r,a.slice(u),l.length-u,null,this.composing?"*compose":null),a.length>1e3||a.indexOf(` +`)>-1?n.value=this.prevInput="":this.prevInput=a,this.composing&&(this.composing.range.clear(),this.composing.range=r.markText(this.composing.start,r.getCursor("to"),{className:"CodeMirror-composing"}))}),!0}ensurePolled(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)}onKeyPress(){de&&Se>=9&&(this.hasSelection=null),this.fastPoll()}onContextMenu(r){let n=this,l=n.cm,a=l.display,u=n.textarea;n.contextMenuPending&&n.contextMenuPending();let d=Gr(l,r),c=a.scroller.scrollTop;if(!d||Wt)return;l.options.resetSelectionOnContextMenu&&l.doc.sel.contains(d)==-1&&Ie(l,et)(l.doc,hr(d),Lt);let m=u.style.cssText,x=n.wrapper.style.cssText,S=n.wrapper.offsetParent.getBoundingClientRect();n.wrapper.style.cssText="position: static",u.style.cssText=`position: absolute; width: 30px; height: 30px; + top: ${r.clientY-S.top-5}px; left: ${r.clientX-S.left-5}px; + z-index: 1000; background: ${de?"rgba(255, 255, 255, .05)":"transparent"}; + outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);`;let k;Ue&&(k=u.ownerDocument.defaultView.scrollY),a.input.focus(),Ue&&u.ownerDocument.defaultView.scrollTo(null,k),a.input.reset(),l.somethingSelected()||(u.value=n.prevInput=" "),n.contextMenuPending=T,a.selForContextMenu=l.doc.sel,clearTimeout(a.detectingSelectAll);function A(){if(u.selectionStart!=null){let L=l.somethingSelected(),C="\u200B"+(L?u.value:"");u.value="\u21DA",u.value=C,n.prevInput=L?"":"\u200B",u.selectionStart=1,u.selectionEnd=C.length,a.selForContextMenu=l.doc.sel}}function T(){if(n.contextMenuPending==T&&(n.contextMenuPending=!1,n.wrapper.style.cssText=x,u.style.cssText=m,de&&Se<9&&a.scrollbars.setScrollTop(a.scroller.scrollTop=c),u.selectionStart!=null)){(!de||de&&Se<9)&&A();let L=0,C=()=>{a.selForContextMenu==l.doc.sel&&u.selectionStart==0&&u.selectionEnd>0&&n.prevInput=="\u200B"?Ie(l,ja)(l):L++<10?a.detectingSelectAll=setTimeout(C,500):(a.selForContextMenu=null,a.input.reset())};a.detectingSelectAll=setTimeout(C,200)}}if(de&&Se>=9&&A(),Wo){wi(r);let L=()=>{yt(window,"mouseup",L),setTimeout(T,20)};ne(window,"mouseup",L)}else setTimeout(T,50)}readOnlyChanged(r){r||this.reset(),this.textarea.disabled=r=="nocursor",this.textarea.readOnly=!!r}setUneditable(){}};$l.prototype.needsContentAttribute=!1;function fg(t,r){if(r=r?Er(r):{},r.value=t.value,!r.tabindex&&t.tabIndex&&(r.tabindex=t.tabIndex),!r.placeholder&&t.placeholder&&(r.placeholder=t.placeholder),r.autofocus==null){let u=st(Fr(t));r.autofocus=u==t||t.getAttribute("autofocus")!=null&&u==document.body}function n(){t.value=a.getValue()}let l;if(t.form&&(ne(t.form,"submit",n),!r.leaveSubmitMethodAlone)){let u=t.form;l=u.submit;try{let d=u.submit=()=>{n(),u.submit=l,u.submit(),u.submit=d}}catch{}}r.finishInit=u=>{u.save=n,u.getTextArea=()=>t,u.toTextArea=()=>{u.toTextArea=isNaN,n(),t.parentNode.removeChild(u.getWrapperElement()),t.style.display="",t.form&&(yt(t.form,"submit",n),!r.leaveSubmitMethodAlone&&typeof t.form.submit=="function"&&(t.form.submit=l))}},t.style.display="none";let a=Fe(u=>t.parentNode.insertBefore(u,t.nextSibling),r);return a}function ug(t){t.off=yt,t.on=ne,t.wheelEventPixels=bp,t.Doc=ni,t.splitLines=bl,t.countColumn=mt,t.findColumn=Fo,t.isWordChar=ea,t.Pass=Ji,t.signal=Ae,t.Line=ei,t.changeEnd=wr,t.scrollbarModel=qu,t.Pos=U,t.cmpPos=se,t.modes=fa,t.mimeModes=Tn,t.resolveMode=Io,t.getMode=Bo,t.modeExtensions=Mn,t.extendMode=Hc,t.copyState=Vr,t.startState=ua,t.innerMode=Ro,t.commands=Di,t.keyMap=oi,t.keyName=Ya,t.isModifierKey=qa,t.lookupKey=ln,t.normalizeKeyMap=Qp,t.StringStream=wl,t.SharedTextMarker=jl,t.TextMarker=Xl,t.LineWidget=Kl,t.e_preventDefault=Ve,t.e_stopPropagation=du,t.e_stop=wi,t.addClass=er,t.contains=vr,t.rmClass=Vt,t.keyNames=li}lg(Fe);sg(Fe);var by="iter insert remove copy getEditor constructor".split(" ");for(let t in ni.prototype)ni.prototype.hasOwnProperty(t)&&He(by,t)<0&&(Fe.prototype[t]=function(r){return function(){return r.apply(this.doc,arguments)}}(ni.prototype[t]));Ir(ni);Fe.inputStyles={textarea:$l,contenteditable:Ql};Fe.defineMode=function(t){!Fe.defaults.mode&&t!="null"&&(Fe.defaults.mode=t),Dc.apply(this,arguments)};Fe.defineMIME=Nc;Fe.defineMode("null",()=>({token:t=>t.skipToEnd()}));Fe.defineMIME("text/plain","null");Fe.defineExtension=(t,r)=>{Fe.prototype[t]=r};Fe.defineDocExtension=(t,r)=>{ni.prototype[t]=r};Fe.fromTextArea=fg;ug(Fe);Fe.version="5.65.16";var KT=_t(cg(),1),XT=_t(vg(),1),jT=_t(wg(),1),qT=_t(kg(),1),YT=_t(Mg(),1),ZT=_t(Dg(),1),JT=_t(Wg(),1),QT=_t(Eg(),1),$T=_t(Rg(),1),VT=_t(dh(),1),eM=_t(Kg(),1),tM=_t(qg(),1),rM=_t(Jg(),1),iM=_t(ff(),1);window.CodeMirror=Qg.default;})(); diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 0000000..1bb5fc5 --- /dev/null +++ b/package-lock.json @@ -0,0 +1,404 @@ +{ + "name": "filament-codemirror", + "version": "1.0.0", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "filament-codemirror", + "version": "1.0.0", + "license": "ISC", + "dependencies": { + "codemirror": "^5.65.16", + "esbuild": "^0.20.2" + } + }, + "node_modules/@esbuild/aix-ppc64": { + "version": "0.20.2", + "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.20.2.tgz", + "integrity": "sha512-D+EBOJHXdNZcLJRBkhENNG8Wji2kgc9AZ9KiPr1JuZjsNtyHzrsfLRrY0tk2H2aoFu6RANO1y1iPPUCDYWkb5g==", + "cpu": [ + "ppc64" + ], + "optional": true, + "os": [ + "aix" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/android-arm": { + "version": "0.20.2", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.20.2.tgz", + "integrity": "sha512-t98Ra6pw2VaDhqNWO2Oph2LXbz/EJcnLmKLGBJwEwXX/JAN83Fym1rU8l0JUWK6HkIbWONCSSatf4sf2NBRx/w==", + "cpu": [ + "arm" + ], + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/android-arm64": { + "version": "0.20.2", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.20.2.tgz", + "integrity": "sha512-mRzjLacRtl/tWU0SvD8lUEwb61yP9cqQo6noDZP/O8VkwafSYwZ4yWy24kan8jE/IMERpYncRt2dw438LP3Xmg==", + "cpu": [ + "arm64" + ], + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/android-x64": { + "version": "0.20.2", + "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.20.2.tgz", + "integrity": "sha512-btzExgV+/lMGDDa194CcUQm53ncxzeBrWJcncOBxuC6ndBkKxnHdFJn86mCIgTELsooUmwUm9FkhSp5HYu00Rg==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/darwin-arm64": { + "version": "0.20.2", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.20.2.tgz", + "integrity": "sha512-4J6IRT+10J3aJH3l1yzEg9y3wkTDgDk7TSDFX+wKFiWjqWp/iCfLIYzGyasx9l0SAFPT1HwSCR+0w/h1ES/MjA==", + "cpu": [ + "arm64" + ], + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/darwin-x64": { + "version": "0.20.2", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.20.2.tgz", + "integrity": "sha512-tBcXp9KNphnNH0dfhv8KYkZhjc+H3XBkF5DKtswJblV7KlT9EI2+jeA8DgBjp908WEuYll6pF+UStUCfEpdysA==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/freebsd-arm64": { + "version": "0.20.2", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.20.2.tgz", + "integrity": "sha512-d3qI41G4SuLiCGCFGUrKsSeTXyWG6yem1KcGZVS+3FYlYhtNoNgYrWcvkOoaqMhwXSMrZRl69ArHsGJ9mYdbbw==", + "cpu": [ + "arm64" + ], + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/freebsd-x64": { + "version": "0.20.2", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.20.2.tgz", + "integrity": "sha512-d+DipyvHRuqEeM5zDivKV1KuXn9WeRX6vqSqIDgwIfPQtwMP4jaDsQsDncjTDDsExT4lR/91OLjRo8bmC1e+Cw==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-arm": { + "version": "0.20.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.20.2.tgz", + "integrity": "sha512-VhLPeR8HTMPccbuWWcEUD1Az68TqaTYyj6nfE4QByZIQEQVWBB8vup8PpR7y1QHL3CpcF6xd5WVBU/+SBEvGTg==", + "cpu": [ + "arm" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-arm64": { + "version": "0.20.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.20.2.tgz", + "integrity": "sha512-9pb6rBjGvTFNira2FLIWqDk/uaf42sSyLE8j1rnUpuzsODBq7FvpwHYZxQ/It/8b+QOS1RYfqgGFNLRI+qlq2A==", + "cpu": [ + "arm64" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-ia32": { + "version": "0.20.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.20.2.tgz", + "integrity": "sha512-o10utieEkNPFDZFQm9CoP7Tvb33UutoJqg3qKf1PWVeeJhJw0Q347PxMvBgVVFgouYLGIhFYG0UGdBumROyiig==", + "cpu": [ + "ia32" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-loong64": { + "version": "0.20.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.20.2.tgz", + "integrity": "sha512-PR7sp6R/UC4CFVomVINKJ80pMFlfDfMQMYynX7t1tNTeivQ6XdX5r2XovMmha/VjR1YN/HgHWsVcTRIMkymrgQ==", + "cpu": [ + "loong64" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-mips64el": { + "version": "0.20.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.20.2.tgz", + "integrity": "sha512-4BlTqeutE/KnOiTG5Y6Sb/Hw6hsBOZapOVF6njAESHInhlQAghVVZL1ZpIctBOoTFbQyGW+LsVYZ8lSSB3wkjA==", + "cpu": [ + "mips64el" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-ppc64": { + "version": "0.20.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.20.2.tgz", + "integrity": "sha512-rD3KsaDprDcfajSKdn25ooz5J5/fWBylaaXkuotBDGnMnDP1Uv5DLAN/45qfnf3JDYyJv/ytGHQaziHUdyzaAg==", + "cpu": [ + "ppc64" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-riscv64": { + "version": "0.20.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.20.2.tgz", + "integrity": "sha512-snwmBKacKmwTMmhLlz/3aH1Q9T8v45bKYGE3j26TsaOVtjIag4wLfWSiZykXzXuE1kbCE+zJRmwp+ZbIHinnVg==", + "cpu": [ + "riscv64" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-s390x": { + "version": "0.20.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.20.2.tgz", + "integrity": "sha512-wcWISOobRWNm3cezm5HOZcYz1sKoHLd8VL1dl309DiixxVFoFe/o8HnwuIwn6sXre88Nwj+VwZUvJf4AFxkyrQ==", + "cpu": [ + "s390x" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-x64": { + "version": "0.20.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.20.2.tgz", + "integrity": "sha512-1MdwI6OOTsfQfek8sLwgyjOXAu+wKhLEoaOLTjbijk6E2WONYpH9ZU2mNtR+lZ2B4uwr+usqGuVfFT9tMtGvGw==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/netbsd-x64": { + "version": "0.20.2", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.20.2.tgz", + "integrity": "sha512-K8/DhBxcVQkzYc43yJXDSyjlFeHQJBiowJ0uVL6Tor3jGQfSGHNNJcWxNbOI8v5k82prYqzPuwkzHt3J1T1iZQ==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "netbsd" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/openbsd-x64": { + "version": "0.20.2", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.20.2.tgz", + "integrity": "sha512-eMpKlV0SThJmmJgiVyN9jTPJ2VBPquf6Kt/nAoo6DgHAoN57K15ZghiHaMvqjCye/uU4X5u3YSMgVBI1h3vKrQ==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "openbsd" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/sunos-x64": { + "version": "0.20.2", + "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.20.2.tgz", + "integrity": "sha512-2UyFtRC6cXLyejf/YEld4Hajo7UHILetzE1vsRcGL3earZEW77JxrFjH4Ez2qaTiEfMgAXxfAZCm1fvM/G/o8w==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "sunos" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/win32-arm64": { + "version": "0.20.2", + "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.20.2.tgz", + "integrity": "sha512-GRibxoawM9ZCnDxnP3usoUDO9vUkpAxIIZ6GQI+IlVmr5kP3zUq+l17xELTHMWTWzjxa2guPNyrpq1GWmPvcGQ==", + "cpu": [ + "arm64" + ], + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/win32-ia32": { + "version": "0.20.2", + "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.20.2.tgz", + "integrity": "sha512-HfLOfn9YWmkSKRQqovpnITazdtquEW8/SoHW7pWpuEeguaZI4QnCRW6b+oZTztdBnZOS2hqJ6im/D5cPzBTTlQ==", + "cpu": [ + "ia32" + ], + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/win32-x64": { + "version": "0.20.2", + "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.20.2.tgz", + "integrity": "sha512-N49X4lJX27+l9jbLKSqZ6bKNjzQvHaT8IIFUy+YIqmXQdjYCToGWwOItDrfby14c78aDd5NHQl29xingXfCdLQ==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/codemirror": { + "version": "5.65.16", + "resolved": "https://registry.npmjs.org/codemirror/-/codemirror-5.65.16.tgz", + "integrity": "sha512-br21LjYmSlVL0vFCPWPfhzUCT34FM/pAdK7rRIZwa0rrtrIdotvP4Oh4GUHsu2E3IrQMCfRkL/fN3ytMNxVQvg==" + }, + "node_modules/esbuild": { + "version": "0.20.2", + "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.20.2.tgz", + "integrity": "sha512-WdOOppmUNU+IbZ0PaDiTst80zjnrOkyJNHoKupIcVyU8Lvla3Ugx94VzkQ32Ijqd7UhHJy75gNWDMUekcrSJ6g==", + "hasInstallScript": true, + "bin": { + "esbuild": "bin/esbuild" + }, + "engines": { + "node": ">=12" + }, + "optionalDependencies": { + "@esbuild/aix-ppc64": "0.20.2", + "@esbuild/android-arm": "0.20.2", + "@esbuild/android-arm64": "0.20.2", + "@esbuild/android-x64": "0.20.2", + "@esbuild/darwin-arm64": "0.20.2", + "@esbuild/darwin-x64": "0.20.2", + "@esbuild/freebsd-arm64": "0.20.2", + "@esbuild/freebsd-x64": "0.20.2", + "@esbuild/linux-arm": "0.20.2", + "@esbuild/linux-arm64": "0.20.2", + "@esbuild/linux-ia32": "0.20.2", + "@esbuild/linux-loong64": "0.20.2", + "@esbuild/linux-mips64el": "0.20.2", + "@esbuild/linux-ppc64": "0.20.2", + "@esbuild/linux-riscv64": "0.20.2", + "@esbuild/linux-s390x": "0.20.2", + "@esbuild/linux-x64": "0.20.2", + "@esbuild/netbsd-x64": "0.20.2", + "@esbuild/openbsd-x64": "0.20.2", + "@esbuild/sunos-x64": "0.20.2", + "@esbuild/win32-arm64": "0.20.2", + "@esbuild/win32-ia32": "0.20.2", + "@esbuild/win32-x64": "0.20.2" + } + } + } +} diff --git a/package.json b/package.json new file mode 100644 index 0000000..3953e96 --- /dev/null +++ b/package.json @@ -0,0 +1,19 @@ +{ + "name": "filament-codemirror", + "version": "1.0.0", + "description": "[![Latest Version on Packagist](https://img.shields.io/packagist/v/codebar-ag/filament-codemirror.svg?style=flat-square)](https://packagist.org/packages/codebar-ag/filament-codemirror) [![GitHub Tests Action Status](https://img.shields.io/github/actions/workflow/status/codebar-ag/filament-codemirror/run-tests.yml?branch=main&label=tests&style=flat-square)](https://github.com/codebar-ag/filament-codemirror/actions?query=workflow%3Arun-tests+branch%3Amain) [![GitHub Code Style Action Status](https://img.shields.io/github/actions/workflow/status/codebar-ag/filament-codemirror/fix-php-code-style-issues.yml?branch=main&label=code%20style&style=flat-square)](https://github.com/codebar-ag/filament-codemirror/actions?query=workflow%3A\"Fix+PHP+code+style+issues\"+branch%3Amain) [![Total Downloads](https://img.shields.io/packagist/dt/codebar-ag/filament-codemirror.svg?style=flat-square)](https://packagist.org/packages/codebar-ag/filament-codemirror)", + "type": "module", + "main": "index.js", + "directories": { + "test": "tests" + }, + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "author": "", + "license": "ISC", + "dependencies": { + "codemirror": "^5.65.16", + "esbuild": "^0.20.2" + } +} diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 4c61042..785088a 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -16,7 +16,7 @@ backupStaticProperties="false" > - + tests diff --git a/resources/js/codemirror.js b/resources/js/codemirror.js new file mode 100644 index 0000000..5ff256f --- /dev/null +++ b/resources/js/codemirror.js @@ -0,0 +1,29 @@ + +import CodeMirror from "codemirror/lib/codemirror"; + +import "codemirror/src/codemirror.js"; +import "codemirror/src/modes"; + +import "codemirror/mode/javascript/javascript"; +import "codemirror/mode/"; + +import "codemirror/addon/edit/closebrackets"; +import "codemirror/addon/edit/closetag"; +import "codemirror/addon/edit/continuelist"; +import "codemirror/addon/edit/matchbrackets"; +import "codemirror/addon/edit/matchtags"; +import "codemirror/addon/edit/trailingspace"; + +import "codemirror/addon/fold/brace-fold"; +import "codemirror/addon/fold/comment-fold"; +import "codemirror/addon/fold/foldcode"; +import "codemirror/addon/fold/foldgutter"; +import "codemirror/addon/fold/indent-fold"; +import "codemirror/addon/fold/markdown-fold"; +import "codemirror/addon/fold/xml-fold"; +import "codemirror/addon/fold/foldgutter.css"; + +// Dark Mode +import "codemirror/theme/darcula.css"; + +window.CodeMirror = CodeMirror; diff --git a/resources/views/forms/components/json-input.blade.php b/resources/views/forms/components/json-input.blade.php new file mode 100644 index 0000000..a128711 --- /dev/null +++ b/resources/views/forms/components/json-input.blade.php @@ -0,0 +1,72 @@ + +
+
{ + var count = undefined; + + // Get open / close token + var startToken = '{', endToken = '}'; + var prevLine = codeMirrorEditor.getLine(from.line); + if (prevLine.lastIndexOf('[') > prevLine.lastIndexOf('{')) { + startToken = '[', endToken = ']'; + } + + // Get json content + var internal = codeMirrorEditor.getRange(from, to); + var toParse = startToken + internal + endToken; + + // Get key count + try { + var parsed = JSON.parse(toParse); + count = Object.keys(parsed).length; + } catch(e) { } + + return count ? `\u21A4${count}\u21A6` : '\u2194'; + } + } + }); + + codeMirrorEditor.setSize(null, '100%'); + codeMirrorEditor.setValue(state); + + setTimeout(function() { + codeMirrorEditor.refresh(); + }, 1); + + codeMirrorEditor.on('change', () => state = codeMirrorEditor.getValue()) + " + > +
+
+
+
diff --git a/resources/views/infolists/components/json-entry.blade.php b/resources/views/infolists/components/json-entry.blade.php new file mode 100644 index 0000000..a959a77 --- /dev/null +++ b/resources/views/infolists/components/json-entry.blade.php @@ -0,0 +1,25 @@ + + @php + $identification = $getId(); + @endphp + +
+ + + +
diff --git a/src/Commands/SkeletonCommand.php b/src/Commands/SkeletonCommand.php deleted file mode 100644 index 3e5f628..0000000 --- a/src/Commands/SkeletonCommand.php +++ /dev/null @@ -1,19 +0,0 @@ -comment('All done'); - - return self::SUCCESS; - } -} diff --git a/src/Facades/Skeleton.php b/src/Facades/Skeleton.php deleted file mode 100644 index 1fa9076..0000000 --- a/src/Facades/Skeleton.php +++ /dev/null @@ -1,16 +0,0 @@ -name('filament-codemirror') + ->hasConfigFile() + ->hasViews(); + } + + public function packageBooted() + { + FilamentAsset::register([ + Css::make('codemirror', __DIR__.'/../dist/codemirror.css'), + Js::make('codemirror', __DIR__.'/../dist/codemirror.js'), + ], 'filament-codemirror'); + } +} diff --git a/src/Forms/Components/JsonInput.php b/src/Forms/Components/JsonInput.php new file mode 100644 index 0000000..7116b17 --- /dev/null +++ b/src/Forms/Components/JsonInput.php @@ -0,0 +1,70 @@ +hasLineNumbers = $condition; + + return $this; + } + + public function autoCloseBrackets(bool|Closure $condition = true): static + { + $this->hasAutoCloseBrackets = $condition; + + return $this; + } + + public function darkTheme(bool|Closure $condition = true): static + { + $this->hasDarkTheme = $condition; + + return $this; + } + + public function foldingCode(bool|Closure $condition = true): static + { + $this->hasFoldingCode = $condition; + + return $this; + } + + public function getHasLineNumbers(): bool + { + return (bool) $this->evaluate($this->hasLineNumbers); + } + + public function getHasAutoCloseBrackets(): bool + { + return (bool) $this->evaluate($this->hasAutoCloseBrackets); + } + + public function getHasDarkTheme(): bool + { + return (bool) $this->evaluate($this->hasDarkTheme); + } + + public function getHasFoldingCode(): bool + { + return (bool) $this->evaluate($this->hasFoldingCode); + } +} diff --git a/src/Infolists/Components/JsonEntry.php b/src/Infolists/Components/JsonEntry.php new file mode 100644 index 0000000..ea17fc0 --- /dev/null +++ b/src/Infolists/Components/JsonEntry.php @@ -0,0 +1,10 @@ +name('skeleton') - ->hasConfigFile() - ->hasViews() - ->hasMigration('create_skeleton_table') - ->hasCommand(SkeletonCommand::class); - } -} diff --git a/tests/Pest.php b/tests/Pest.php index 7fe1500..d78010c 100644 --- a/tests/Pest.php +++ b/tests/Pest.php @@ -1,5 +1,5 @@ in(__DIR__); diff --git a/tests/TestCase.php b/tests/TestCase.php index d04fb0c..4059139 100644 --- a/tests/TestCase.php +++ b/tests/TestCase.php @@ -1,10 +1,10 @@ 'VendorName\\Skeleton\\Database\\Factories\\'.class_basename($modelName).'Factory' + fn (string $modelName) => 'CodebarAg\\FilamentCodemirror\\Database\\Factories\\'.class_basename($modelName).'Factory' ); } protected function getPackageProviders($app) { return [ - SkeletonServiceProvider::class, + FilamentCodemirrorServiceProvider::class, ]; } @@ -29,7 +29,7 @@ public function getEnvironmentSetUp($app) config()->set('database.default', 'testing'); /* - $migration = include __DIR__.'/../database/migrations/create_skeleton_table.php.stub'; + $migration = include __DIR__.'/../database/migrations/create_filament-codemirror_table.php.stub'; $migration->up(); */ }