diff --git a/frontend-assembly/package.json b/frontend-assembly/package.json
index 3a0bd2f..06f71df 100644
--- a/frontend-assembly/package.json
+++ b/frontend-assembly/package.json
@@ -5,7 +5,7 @@
"private": true,
"type": "module",
"scripts": {
- "build": "esbuild src/editor.js --bundle --format=esm --minify --outfile=${CM6_OUTPUT_DIR:-../public/static/codemirror}/editor.js"
+ "build": "esbuild src/editor.js --bundle --format=iife --minify --outfile=${CM6_OUTPUT_DIR:-../public/static/codemirror}/editor.js"
},
"devDependencies": {
"@babel/runtime": "7.29.7",
@@ -20,4 +20,4 @@
"@uiw/codemirror-theme-solarized": "4.25.10",
"esbuild": "0.28.0"
}
-}
+}
\ No newline at end of file
diff --git a/lpon_site/frontend/admin.py b/lpon_site/frontend/admin.py
index 2699d4d..0ef42ba 100644
--- a/lpon_site/frontend/admin.py
+++ b/lpon_site/frontend/admin.py
@@ -2,6 +2,8 @@
# Регистрируем модели с удобным интерфейсом.
from django import forms
+from django.db import models
+from django.forms import TextInput, Textarea, URLField
from django.contrib import admin
from django.utils.html import format_html, mark_safe
from easy_thumbnails.files import get_thumbnailer
@@ -25,8 +27,6 @@ class TbImageAdminForm(forms.ModelForm):
required=False,
widget=forms.TextInput(attrs={
'placeholder': 'Введите alt-текст для картинки',
- 'class': 'vTextField',
- 'size': 200,
}),
label='ALT (новый)',
help_text='Текст для alt-атрибута картинки <img alt="" .../>.'
@@ -37,8 +37,6 @@ class TbImageAdminForm(forms.ModelForm):
required=False,
widget=forms.TextInput(attrs={
'placeholder': 'Введите title-описание картинки',
- 'class': 'vTextField',
- 'cols': 120,
}),
label='TITLE (новый)',
help_text='Текст для title-атрибута картинки <img title="" .../>.'
@@ -49,8 +47,6 @@ class TbImageAdminForm(forms.ModelForm):
required=False,
widget=forms.TextInput(attrs={
'placeholder': 'XXXX, Авторские права на изображение',
- 'class': 'vTextField',
- 'cols': 120,
}),
label='Copyright',
help_text='Авторские права на изображение (например: 2025, Sergei Erjemin. Будет сохранён в filer_image.author'
@@ -64,6 +60,13 @@ class TbImageAdminForm(forms.ModelForm):
"""
При инициализации формы подгружаем текущие значения alt/caption из filer_image.
"""
+ # Атрибуты для активации CodeMirror редактора
+ codemirror_attrs = {
+ 'data-codemirror-editor': '1',
+ 'data-language': 'text',
+ 'data-width': '100%', # Ширина для патча (100% займет полную ширину)
+ }
+
super().__init__(*args, **kwargs)
# Если редактируем существующую запись, получаем текущие значения из filer
@@ -71,27 +74,70 @@ class TbImageAdminForm(forms.ModelForm):
try:
filer_image = self.instance.image
# Получаем текущие значения из filer и заполняем виртуальные поля
+ # ALT-text
self.fields['filer_alt_text'].initial = filer_image.default_alt_text or ''
+ self.fields['filer_alt_text'].widget = Textarea(attrs={
+ 'class': 'codemirror-width-m',
+ **codemirror_attrs,
+ })
self.fields['filer_caption'].initial = filer_image.default_caption or ''
+ self.fields['filer_caption'].widget = Textarea(attrs={
+ 'class': 'codemirror-width-m',
+ **codemirror_attrs,
+ })
self.fields['filer_copyright'].initial = filer_image.author or ''
+ self.fields['filer_copyright'].widget = Textarea(attrs={
+ 'class': 'codemirror-width-m',
+ **codemirror_attrs,
+ })
except Exception:
# Если ошибка при получении filer_image, просто оставляем пустые значения
pass
+ # s_img_src_url - поле URL источника (длинная строка)
+ self.fields['s_img_src_url'].widget = Textarea(attrs={
+ 'class': 'codemirror-width-xl',
+ **codemirror_attrs,
+ })
+
+ # i_img_sort - поле сортировки (до четырех цифр)
+ self.fields['i_img_sort'].widget = Textarea(attrs={
+ 'class': 'codemirror-width-s codemirror-no-lines',
+ **codemirror_attrs,
+ })
+
+ # f_img_confidence_score - поле confidence score (число с плавающей точкой)
+ self.fields['f_img_confidence_score'].widget = Textarea(attrs={
+ 'class': 'codemirror-width-s codemirror-no-lines',
+ **codemirror_attrs,
+ })
+
class ImageAdmin(admin.ModelAdmin):
"""
Админ для изображений TbImage с поддержкой редактирования метаданных filer_image.
Позволяет пользователю заполнить default_alt_text и default_caption для картинки в filer
- прямо в админке TbImage, без необходимости отдельного редактирования фiler.
+ прямо в админке TbImage, без необходимости отдельного редактирования filer.
"""
form = TbImageAdminForm # Используем кастомную форму с виртуальными полями
+
+ # Подключаем JS через Media (правильный способ!)
+ class Media:
+ css = {
+ 'all': ('codemirror/codemirror-styles.css',) # Стили для CodeMirror
+ }
+ js = (
+ 'codemirror/editor.js', # Основной CodeMirror
+ 'codemirror/codemirror-patch.js', # Патч для управления высотой/шириной
+ )
+
list_display = ('id', 'image_thumbnail', 'image', '_display_filer_alt_text', 'i_img_sort', 't_img_created')
list_display_links = ('id', 'image_thumbnail', 'image')
list_filter = ('l_img_source', 'l_img_reality', 't_img_created')
ordering = ('image', 'i_img_sort')
readonly_fields = ('t_img_created', 't_img_updated', '_display_filer_alt_text', '_display_filer_caption')
+
fieldsets = (
('Изображение', {
'fields': ('image', 'l_img_source', 'l_img_reality', 's_img_src_url', 'i_img_sort',
@@ -101,8 +147,8 @@ class ImageAdmin(admin.ModelAdmin):
('Метаданные filer (SEO для картинок)', {
'fields': ('_display_filer_alt_text', '_display_filer_caption', 'filer_alt_text', 'filer_caption',
'filer_copyright'),
- 'description': 'Редактируемые поля для заполнения Alt текста и описания в filer. Если не заполнить,'
- ' текущие значения останутся без изменений (или не будут заполнены при создании).',
+ 'description': 'Редактируемые поля для заполнения ALT-, TITLE- и ©-текста в filer. Если не заполнить,'
+ ' текущие значения останутся без изменений (и не будут заполнены при создании).',
# 'classes': ('collapse',),
}),
('Служебная информация', {
diff --git a/lpon_site/frontend/models.py b/lpon_site/frontend/models.py
index ca5f825..64e2841 100644
--- a/lpon_site/frontend/models.py
+++ b/lpon_site/frontend/models.py
@@ -314,9 +314,9 @@ class TbImage(models.Model):
# Доверие данным (для парсеров и API)
null=True,
blank=True,
- default=None,
+ default=10.0,
verbose_name='Достоверность',
- help_text='Уверенность (для автоматических данных) 0.0 - 1.0, насколько уверены, что это правильное изображение',
+ help_text='Уверенность (для автоматических данных) 0.0 - 10.0, насколько уверены, что это правильное изображение',
)
s_img_copyright = models.CharField(
# Авторские права и лицензия (по идее -- ненужное поле. Можно в filer использовать `obj.image.author`.
diff --git a/public/static/codemirror/codemirror-patch.js b/public/static/codemirror/codemirror-patch.js
new file mode 100644
index 0000000..cd0f56f
--- /dev/null
+++ b/public/static/codemirror/codemirror-patch.js
@@ -0,0 +1,78 @@
+/**
+ * CodeMirror 6 - Height Control Patch
+ *
+ * Этот патч перехватывает создание CodeMirror редакторов и копирует
+ * атрибут data-height с textarea на создаваемый wrapper div.
+ *
+ * Использование в admin.py:
+ * textarea widget: attrs={'data-height': '50px', 'data-codemirror-editor': '1'}
+ *
+ * Загружается ПОСЛЕ editor.js через Media в Admin класс.
+ */
+
+(function () {
+ 'use strict';
+
+ /**
+ * Применяем высоту к уже созданным wrapper'ам
+ * (CodeMirror уже загрузился и создал обёртки)
+ */
+ function applyHeightsToExistingWrappers() {
+ // Находим все textarea'ы с data-codemirror-editor
+ document.querySelectorAll('textarea[data-codemirror-editor]').forEach((textarea) => {
+ // Соседний div (wrapper, созданный CodeMirror)
+ const wrapper = textarea.previousElementSibling;
+
+ // Проверяем что это действительно wrapper CodeMirror
+ if (wrapper && wrapper.classList && wrapper.classList.contains('cm6-editor-wrapper')) {
+ // Копируем data-height на style если указано
+ if (textarea.dataset.height) {
+ wrapper.style.height = textarea.dataset.height;
+ }
+
+ // Копируем data-width на style если указано (для ширины)
+ if (textarea.dataset.width) {
+ wrapper.style.width = textarea.dataset.width;
+ wrapper.style.minWidth = textarea.dataset.width;
+
+ // Также устанавливаем ширину на сам .cm-editor внутри wrapper
+ // Используем !important чтобы переопределить flex: 1 1 auto из CSS
+ const cmEditor = wrapper.querySelector('.cm-editor');
+ // if (cmEditor) {
+ // cmEditor.style.cssText = `width: ${textarea.dataset.width} !important; flex: 0 0 auto;`;
+ // }
+ }
+
+ // Копируем классы с textarea если они есть
+ // (например cm6-editor-wrapper-xs, cm6-editor-wrapper-sm и т.д.)
+ if (textarea.className) {
+ // Добавляем классы из textarea (сохраняя cm6-editor-wrapper)
+ textarea.className.split(' ').forEach((cls) => {
+ if (cls && cls !== 'cm6-editor-wrapper') {
+ wrapper.classList.add(cls);
+ }
+ });
+ }
+ }
+ });
+ }
+
+ // Применяем высоты когда DOM готов
+ if (document.readyState === 'loading') {
+ document.addEventListener('DOMContentLoaded', applyHeightsToExistingWrappers);
+ } else {
+ // DOM уже загружен
+ applyHeightsToExistingWrappers();
+ }
+
+ // Также применяем для динамически добавленных элементов (если загружают CodeMirror после инициализации)
+ const observer = new MutationObserver(() => {
+ applyHeightsToExistingWrappers();
+ });
+
+ observer.observe(document, {
+ childList: true,
+ subtree: true,
+ });
+})();
+
diff --git a/public/static/codemirror/codemirror-styles.css b/public/static/codemirror/codemirror-styles.css
new file mode 100644
index 0000000..4aabb76
--- /dev/null
+++ b/public/static/codemirror/codemirror-styles.css
@@ -0,0 +1,58 @@
+/* CodeMirror 6 - Стили для правильного отображения */
+
+:root {
+ color-scheme: light dark;
+ --brdr: light-dark(#333, #ccc);
+ --accent-mode-color: light-dark(#222, #eee);
+ }
+
+.cm6-editor-wrapper {
+ /* Основной wrapper, созданный CodeMirror */
+ flex-direction: column;
+ overflow: hidden;
+}
+
+.cm-editor {
+ /* Сам редактор внутри wrapper - растягиваем на всю доступную высоту */
+ flex: 1 1 auto;
+ font-family: monospace;
+ line-height: 1;
+ border: 1px solid var(--brdr);;
+}
+
+/*
+ Утилитарные классы для управления шириной.
+ Мы ищем редактор .cm-editor ВНУТРИ элемента с нашим классом.
+*/
+
+.codemirror-width-s > .cm-editor {
+ /* Маленький (для чисел, коротких ID) */
+ max-width: 8em !important;
+}
+
+.codemirror-width-m .cm-editor {
+ /* Средний (для URL, коротких строк) */
+ max-width: calc(50% - 13em) !important;
+}
+
+.codemirror-width-l > .cm-editor {
+ /* Большой (для текста, JSON, HTML) */
+ max-width: calc(75% - 13em) !important;
+}
+
+.codemirror-width-xl > .cm-editor {
+ /* Во всю ширину контейнера */
+ max-width: calc(100% - 13em) !important;
+}
+
+/* --- Новое правило для скрытия номеров строк --- */
+/* Если у обертки есть наш класс, находим внутри панель с номерами и скрываем ее */
+.codemirror-no-lines .cm-gutters {
+ display: none !important;
+}
+
+
+/* Скрыть оригинальный textarea */
+textarea[data-codemirror-editor] {
+ display: none !important;
+}
diff --git a/public/static/codemirror/editor.js b/public/static/codemirror/editor.js
index d7dd9d6..2563485 100644
--- a/public/static/codemirror/editor.js
+++ b/public/static/codemirror/editor.js
@@ -1,4 +1,4 @@
-var Js=[],Vo=[];(()=>{let r="lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,2,,4,z,,u,r,2j,b,1m,9,9,,o,4,,9,,3,,5,17,3,3b,f,,w,1j,,,,4,8,4,,3,7,a,2,t,,1m,,,,2,4,8,,9,,a,2,q,,2,2,1l,,4,2,4,2,2,3,3,,u,2,3,,b,2,1l,,4,5,,2,4,,k,2,m,6,,,1m,,,2,,4,8,,7,3,a,2,u,,1n,,,,c,,9,,14,,3,,1l,3,5,3,,4,7,2,b,2,t,,1m,,2,,2,,3,,5,2,7,2,b,2,s,2,1l,2,,,2,4,8,,9,,a,2,t,,20,,4,,2,3,,,8,,29,,2,7,c,8,2q,,2,9,b,6,22,2,r,,,,,,1j,e,,5,,2,5,b,,10,9,,2u,4,,6,,2,2,2,p,2,4,3,g,4,d,,2,2,6,,f,,jj,3,qa,3,t,3,t,2,u,2,1s,2,,7,8,,2,b,9,,19,3,3b,2,y,,3a,3,4,2,9,,6,3,63,2,2,,1m,,,7,,,,,2,8,6,a,2,,1c,h,1r,4,1c,7,,,5,,14,9,c,2,w,4,2,2,,3,1k,,,2,3,,,3,1m,8,2,2,48,3,,d,,7,4,,6,,3,2,5i,1m,,5,ek,,5f,x,2da,3,3x,,2o,w,fe,6,2x,2,n9w,4,,a,w,2,28,2,7k,,3,,4,,p,2,5,,47,2,q,i,d,,12,8,p,b,1a,3,1c,,2,4,2,2,13,,1v,6,2,2,2,2,c,,8,,1b,,1f,,,3,2,2,5,2,,,16,2,8,,6m,,2,,4,,fn4,,kh,g,g,g,a6,2,gt,,6a,,45,5,1ae,3,,2,5,4,14,3,4,,4l,2,fx,4,ar,2,49,b,4w,,1i,f,1k,3,1d,4,2,2,1x,3,10,5,,8,1q,,c,2,1g,9,a,4,2,,2n,3,2,,,2,6,,4g,,3,8,l,2,1l,2,,,,,m,,e,7,3,5,5f,8,2,3,,,n,,29,,2,6,,,2,,,2,,2,6j,,2,4,6,2,,2,r,2,2d,8,2,,,2,2y,,,,2,6,,,2t,3,2,4,,5,77,9,,2,6t,,a,2,,,4,,40,4,2,2,4,,w,a,14,6,2,4,8,,9,6,2,3,1a,d,,2,ba,7,,6,,,2a,m,2,7,,2,,2,3e,6,3,,,2,,7,,,20,2,3,,,,9n,2,f0b,5,1n,7,t4,,1r,4,29,,f5k,2,43q,,,3,4,5,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,79,7,c5,4,15s,7,31,7,240,5,gx7k,2o,3k,6o".split(",").map(e=>e?parseInt(e,36):1);for(let e=0,t=0;e>1;if(r=Vo[i])e=i+1;else return!0;if(e==t)return!1}}function zo(r){return r>=127462&&r<=127487}var _o=8205;function Eo(r,e,t=!0,i=!0){return(t?Wo:mc)(r,e,i)}function Wo(r,e,t){if(e==r.length)return e;e&&qo(r.charCodeAt(e))&&Do(r.charCodeAt(e-1))&&e--;let i=Ks(r,e);for(e+=Yo(i);e=0&&zo(Ks(r,o));)n++,o-=2;if(n%2==0)break;e+=2}else break}return e}function mc(r,e,t){for(;e>0;){let i=Wo(r,e-2,t);if(i=56320&&r<57344}function Do(r){return r>=55296&&r<56320}function Yo(r){return r<65536?1:2}var M=class r{lineAt(e){if(e<0||e>this.length)throw new RangeError(`Invalid position ${e} in document of length ${this.length}`);return this.lineInner(e,!1,1,0)}line(e){if(e<1||e>this.lines)throw new RangeError(`Invalid line number ${e} in ${this.lines}-line document`);return this.lineInner(e,!0,1,0)}replace(e,t,i){[e,t]=zt(this,e,t);let s=[];return this.decompose(0,e,s,2),i.length&&i.decompose(0,i.length,s,3),this.decompose(t,this.length,s,1),At.from(s,this.length-(t-e)+i.length)}append(e){return this.replace(this.length,this.length,e)}slice(e,t=this.length){[e,t]=zt(this,e,t);let i=[];return this.decompose(e,t,i,0),At.from(i,t-e)}eq(e){if(e==this)return!0;if(e.length!=this.length||e.lines!=this.lines)return!1;let t=this.scanIdentical(e,1),i=this.length-this.scanIdentical(e,-1),s=new St(this),n=new St(e);for(let o=t,l=t;;){if(s.next(o),n.next(o),o=0,s.lineBreak!=n.lineBreak||s.done!=n.done||s.value!=n.value)return!1;if(l+=s.value.length,s.done||l>=i)return!0}}iter(e=1){return new St(this,e)}iterRange(e,t=this.length){return new Hi(this,e,t)}iterLines(e,t){let i;if(e==null)i=this.iter();else{t==null&&(t=this.lines+1);let s=this.line(e).from;i=this.iterRange(s,Math.max(s,t==this.lines+1?this.length:t<=1?0:this.line(t-1).to))}return new Ki(i)}toString(){return this.sliceString(0)}toJSON(){let e=[];return this.flatten(e),e}constructor(){}static of(e){if(e.length==0)throw new RangeError("A document must have at least one line");return e.length==1&&!e[0]?r.empty:e.length<=32?new Oe(e):At.from(Oe.split(e,[]))}},Oe=class r extends M{constructor(e,t=Sc(e)){super(),this.text=e,this.length=t}get lines(){return this.text.length}get children(){return null}lineInner(e,t,i,s){for(let n=0;;n++){let o=this.text[n],l=s+o.length;if((t?i:l)>=e)return new tr(s,l,i,o);s=l+1,i++}}decompose(e,t,i,s){let n=e<=0&&t>=this.length?this:new r(Lo(this.text,e,t),Math.min(t,this.length)-Math.max(0,e));if(s&1){let o=i.pop(),l=Fi(n.text,o.text.slice(),0,n.length);if(l.length<=32)i.push(new r(l,o.length+n.length));else{let a=l.length>>1;i.push(new r(l.slice(0,a)),new r(l.slice(a)))}}else i.push(n)}replace(e,t,i){if(!(i instanceof r))return super.replace(e,t,i);[e,t]=zt(this,e,t);let s=Fi(this.text,Fi(i.text,Lo(this.text,0,e)),t),n=this.length+i.length-(t-e);return s.length<=32?new r(s,n):At.from(r.split(s,[]),n)}sliceString(e,t=this.length,i=`
+(()=>{var Js=[],Vo=[];(()=>{let r="lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,2,,4,z,,u,r,2j,b,1m,9,9,,o,4,,9,,3,,5,17,3,3b,f,,w,1j,,,,4,8,4,,3,7,a,2,t,,1m,,,,2,4,8,,9,,a,2,q,,2,2,1l,,4,2,4,2,2,3,3,,u,2,3,,b,2,1l,,4,5,,2,4,,k,2,m,6,,,1m,,,2,,4,8,,7,3,a,2,u,,1n,,,,c,,9,,14,,3,,1l,3,5,3,,4,7,2,b,2,t,,1m,,2,,2,,3,,5,2,7,2,b,2,s,2,1l,2,,,2,4,8,,9,,a,2,t,,20,,4,,2,3,,,8,,29,,2,7,c,8,2q,,2,9,b,6,22,2,r,,,,,,1j,e,,5,,2,5,b,,10,9,,2u,4,,6,,2,2,2,p,2,4,3,g,4,d,,2,2,6,,f,,jj,3,qa,3,t,3,t,2,u,2,1s,2,,7,8,,2,b,9,,19,3,3b,2,y,,3a,3,4,2,9,,6,3,63,2,2,,1m,,,7,,,,,2,8,6,a,2,,1c,h,1r,4,1c,7,,,5,,14,9,c,2,w,4,2,2,,3,1k,,,2,3,,,3,1m,8,2,2,48,3,,d,,7,4,,6,,3,2,5i,1m,,5,ek,,5f,x,2da,3,3x,,2o,w,fe,6,2x,2,n9w,4,,a,w,2,28,2,7k,,3,,4,,p,2,5,,47,2,q,i,d,,12,8,p,b,1a,3,1c,,2,4,2,2,13,,1v,6,2,2,2,2,c,,8,,1b,,1f,,,3,2,2,5,2,,,16,2,8,,6m,,2,,4,,fn4,,kh,g,g,g,a6,2,gt,,6a,,45,5,1ae,3,,2,5,4,14,3,4,,4l,2,fx,4,ar,2,49,b,4w,,1i,f,1k,3,1d,4,2,2,1x,3,10,5,,8,1q,,c,2,1g,9,a,4,2,,2n,3,2,,,2,6,,4g,,3,8,l,2,1l,2,,,,,m,,e,7,3,5,5f,8,2,3,,,n,,29,,2,6,,,2,,,2,,2,6j,,2,4,6,2,,2,r,2,2d,8,2,,,2,2y,,,,2,6,,,2t,3,2,4,,5,77,9,,2,6t,,a,2,,,4,,40,4,2,2,4,,w,a,14,6,2,4,8,,9,6,2,3,1a,d,,2,ba,7,,6,,,2a,m,2,7,,2,,2,3e,6,3,,,2,,7,,,20,2,3,,,,9n,2,f0b,5,1n,7,t4,,1r,4,29,,f5k,2,43q,,,3,4,5,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,79,7,c5,4,15s,7,31,7,240,5,gx7k,2o,3k,6o".split(",").map(e=>e?parseInt(e,36):1);for(let e=0,t=0;e>1;if(r=Vo[i])e=i+1;else return!0;if(e==t)return!1}}function zo(r){return r>=127462&&r<=127487}var _o=8205;function Eo(r,e,t=!0,i=!0){return(t?Wo:mc)(r,e,i)}function Wo(r,e,t){if(e==r.length)return e;e&&qo(r.charCodeAt(e))&&Do(r.charCodeAt(e-1))&&e--;let i=Ks(r,e);for(e+=Yo(i);e=0&&zo(Ks(r,o));)n++,o-=2;if(n%2==0)break;e+=2}else break}return e}function mc(r,e,t){for(;e>0;){let i=Wo(r,e-2,t);if(i=56320&&r<57344}function Do(r){return r>=55296&&r<56320}function Yo(r){return r<65536?1:2}var M=class r{lineAt(e){if(e<0||e>this.length)throw new RangeError(`Invalid position ${e} in document of length ${this.length}`);return this.lineInner(e,!1,1,0)}line(e){if(e<1||e>this.lines)throw new RangeError(`Invalid line number ${e} in ${this.lines}-line document`);return this.lineInner(e,!0,1,0)}replace(e,t,i){[e,t]=zt(this,e,t);let s=[];return this.decompose(0,e,s,2),i.length&&i.decompose(0,i.length,s,3),this.decompose(t,this.length,s,1),At.from(s,this.length-(t-e)+i.length)}append(e){return this.replace(this.length,this.length,e)}slice(e,t=this.length){[e,t]=zt(this,e,t);let i=[];return this.decompose(e,t,i,0),At.from(i,t-e)}eq(e){if(e==this)return!0;if(e.length!=this.length||e.lines!=this.lines)return!1;let t=this.scanIdentical(e,1),i=this.length-this.scanIdentical(e,-1),s=new St(this),n=new St(e);for(let o=t,l=t;;){if(s.next(o),n.next(o),o=0,s.lineBreak!=n.lineBreak||s.done!=n.done||s.value!=n.value)return!1;if(l+=s.value.length,s.done||l>=i)return!0}}iter(e=1){return new St(this,e)}iterRange(e,t=this.length){return new Hi(this,e,t)}iterLines(e,t){let i;if(e==null)i=this.iter();else{t==null&&(t=this.lines+1);let s=this.line(e).from;i=this.iterRange(s,Math.max(s,t==this.lines+1?this.length:t<=1?0:this.line(t-1).to))}return new Ki(i)}toString(){return this.sliceString(0)}toJSON(){let e=[];return this.flatten(e),e}constructor(){}static of(e){if(e.length==0)throw new RangeError("A document must have at least one line");return e.length==1&&!e[0]?r.empty:e.length<=32?new Oe(e):At.from(Oe.split(e,[]))}},Oe=class r extends M{constructor(e,t=Sc(e)){super(),this.text=e,this.length=t}get lines(){return this.text.length}get children(){return null}lineInner(e,t,i,s){for(let n=0;;n++){let o=this.text[n],l=s+o.length;if((t?i:l)>=e)return new tr(s,l,i,o);s=l+1,i++}}decompose(e,t,i,s){let n=e<=0&&t>=this.length?this:new r(Lo(this.text,e,t),Math.min(t,this.length)-Math.max(0,e));if(s&1){let o=i.pop(),l=Fi(n.text,o.text.slice(),0,n.length);if(l.length<=32)i.push(new r(l,o.length+n.length));else{let a=l.length>>1;i.push(new r(l.slice(0,a)),new r(l.slice(a)))}}else i.push(n)}replace(e,t,i){if(!(i instanceof r))return super.replace(e,t,i);[e,t]=zt(this,e,t);let s=Fi(this.text,Fi(i.text,Lo(this.text,0,e)),t),n=this.length+i.length-(t-e);return s.length<=32?new r(s,n):At.from(r.split(s,[]),n)}sliceString(e,t=this.length,i=`
`){[e,t]=zt(this,e,t);let s="";for(let n=0,o=0;n<=t&&oe&&o&&(s+=i),en&&(s+=l.slice(Math.max(0,e-n),t-n)),n=a+1}return s}flatten(e){for(let t of this.text)e.push(t)}scanIdentical(){return 0}static split(e,t){let i=[],s=-1;for(let n of e)i.push(n),s+=n.length+1,i.length==32&&(t.push(new r(i,s)),i=[],s=-1);return s>-1&&t.push(new r(i,s)),t}},At=class r extends M{constructor(e,t){super(),this.children=e,this.length=t,this.lines=0;for(let i of e)this.lines+=i.lines}lineInner(e,t,i,s){for(let n=0;;n++){let o=this.children[n],l=s+o.length,a=i+o.lines-1;if((t?a:l)>=e)return o.lineInner(e,t,i,s);s=l+1,i=a+1}}decompose(e,t,i,s){for(let n=0,o=0;o<=t&&n=o){let h=s&((o<=e?1:0)|(a>=t?2:0));o>=e&&a<=t&&!h?i.push(l):l.decompose(e-o,t-o,i,h)}o=a+1}}replace(e,t,i){if([e,t]=zt(this,e,t),i.lines=n&&t<=l){let a=o.replace(e-n,t-n,i),h=this.lines-o.lines+a.lines;if(a.lines>4&&a.lines>h>>6){let c=this.children.slice();return c[s]=a,new r(c,this.length-(t-e)+i.length)}return super.replace(n,l,a)}n=l+1}return super.replace(e,t,i)}sliceString(e,t=this.length,i=`
`){[e,t]=zt(this,e,t);let s="";for(let n=0,o=0;ne&&n&&(s+=i),eo&&(s+=l.sliceString(e-o,t-o,i)),o=a+1}return s}flatten(e){for(let t of this.children)t.flatten(e)}scanIdentical(e,t){if(!(e instanceof r))return 0;let i=0,[s,n,o,l]=t>0?[0,0,this.children.length,e.children.length]:[this.children.length-1,e.children.length-1,-1,-1];for(;;s+=t,n+=t){if(s==o||n==l)return i;let a=this.children[s],h=e.children[n];if(a!=h)return i+a.scanIdentical(h,t);i+=a.length+1}}static from(e,t=e.reduce((i,s)=>i+s.length+1,-1)){let i=0;for(let O of e)i+=O.lines;if(i<32){let O=[];for(let p of e)p.flatten(O);return new Oe(O,t)}let s=Math.max(32,i>>5),n=s<<1,o=s>>1,l=[],a=0,h=-1,c=[];function f(O){let p;if(O.lines>n&&O instanceof r)for(let g of O.children)f(g);else O.lines>o&&(a>o||!a)?(u(),l.push(O)):O instanceof Oe&&a&&(p=c[c.length-1])instanceof Oe&&O.lines+p.lines<=32?(a+=O.lines,h+=O.length+1,c[c.length-1]=new Oe(p.text.concat(O.text),p.length+1+O.length)):(a+O.lines>s&&u(),a+=O.lines,h+=O.length+1,c.push(O))}function u(){a!=0&&(l.push(c.length==1?c[0]:r.from(c,h)),h=-1,a=c.length=0)}for(let O of e)f(O);return u(),l.length==1?l[0]:new r(l,t)}};M.empty=new Oe([""],0);function Sc(r){let e=-1;for(let t of r)e+=t.length+1;return e}function Fi(r,e,t=0,i=1e9){for(let s=0,n=0,o=!0;n=t&&(a>i&&(l=l.slice(0,i-s)),s0?1:(e instanceof Oe?e.text.length:e.children.length)<<1]}nextInner(e,t){for(this.done=this.lineBreak=!1;;){let i=this.nodes.length-1,s=this.nodes[i],n=this.offsets[i],o=n>>1,l=s instanceof Oe?s.text.length:s.children.length;if(o==(t>0?l:0)){if(i==0)return this.done=!0,this.value="",this;t>0&&this.offsets[i-1]++,this.nodes.pop(),this.offsets.pop()}else if((n&1)==(t>0?0:1)){if(this.offsets[i]+=t,e==0)return this.lineBreak=!0,this.value=`
`,this;e--}else if(s instanceof Oe){let a=s.text[o+(t<0?-1:0)];if(this.offsets[i]+=t,a.length>Math.max(0,e))return this.value=e==0?a:t>0?a.slice(e):a.slice(0,a.length-e),this;e-=a.length}else{let a=s.children[o+(t<0?-1:0)];e>a.length?(e-=a.length,this.offsets[i]+=t):(t<0&&this.offsets[i]--,this.nodes.push(a),this.offsets.push(t>0?1:(a instanceof Oe?a.text.length:a.children.length)<<1))}}}next(e=0){return e<0&&(this.nextInner(-e,-this.dir),e=this.value.length),this.nextInner(e,this.dir)}},Hi=class{constructor(e,t,i){this.value="",this.done=!1,this.cursor=new St(e,t>i?-1:1),this.pos=t>i?e.length:0,this.from=Math.min(t,i),this.to=Math.max(t,i)}nextInner(e,t){if(t<0?this.pos<=this.from:this.pos>=this.to)return this.value="",this.done=!0,this;e+=Math.max(0,t<0?this.pos-this.to:this.from-this.pos);let i=t<0?this.pos-this.from:this.to-this.pos;e>i&&(e=i),i-=e;let{value:s}=this.cursor.next(e);return this.pos+=(s.length+e)*t,this.value=s.length<=i?s:t<0?s.slice(s.length-i):s.slice(0,i),this.done=!this.value,this}next(e=0){return e<0?e=Math.max(e,this.from-this.pos):e>0&&(e=Math.min(e,this.to-this.pos)),this.nextInner(e,this.cursor.dir)}get lineBreak(){return this.cursor.lineBreak&&this.value!=""}},Ki=class{constructor(e){this.inner=e,this.afterBreak=!0,this.value="",this.done=!1}next(e=0){let{done:t,lineBreak:i,value:s}=this.inner.next(e);return t&&this.afterBreak?(this.value="",this.afterBreak=!1):t?(this.done=!0,this.value=""):i?this.afterBreak?this.value="":(this.afterBreak=!0,this.next()):(this.value=s,this.afterBreak=!1),this}get lineBreak(){return!1}};typeof Symbol<"u"&&(M.prototype[Symbol.iterator]=function(){return this.iter()},St.prototype[Symbol.iterator]=Hi.prototype[Symbol.iterator]=Ki.prototype[Symbol.iterator]=function(){return this});var tr=class{constructor(e,t,i,s){this.from=e,this.to=t,this.number=i,this.text=s}get length(){return this.to-this.from}};function zt(r,e,t){return e=Math.max(0,Math.min(r.length,e)),[e,Math.max(e,Math.min(r.length,t))]}function Pe(r,e,t=!0,i=!0){return Eo(r,e,t,i)}function bc(r){return r>=56320&&r<57344}function Qc(r){return r>=55296&&r<56320}function dr(r,e){let t=r.charCodeAt(e);if(!Qc(t)||e+1==r.length)return t;let i=r.charCodeAt(e+1);return bc(i)?(t-55296<<10)+(i-56320)+65536:t}function pr(r){return r<65536?1:2}var ir=/\r\n?|\n/,te=(function(r){return r[r.Simple=0]="Simple",r[r.TrackDel=1]="TrackDel",r[r.TrackBefore=2]="TrackBefore",r[r.TrackAfter=3]="TrackAfter",r})(te||(te={})),bt=class r{constructor(e){this.sections=e}get length(){let e=0;for(let t=0;te)return n+(e-s);n+=l}else{if(i!=te.Simple&&h>=e&&(i==te.TrackDel&&se||i==te.TrackBefore&&se))return null;if(h>e||h==e&&t<0&&!l)return e==s||t<0?n:n+a;n+=a}s=h}if(e>s)throw new RangeError(`Position ${e} is out of range for changeset of length ${s}`);return n}touchesRange(e,t=e){for(let i=0,s=0;i=0&&s<=t&&l>=e)return st?"cover":!0;s=l}return!1}toString(){let e="";for(let t=0;t=0?":"+s:"")}return e}toJSON(){return this.sections}static fromJSON(e){if(!Array.isArray(e)||e.length%2||e.some(t=>typeof t!="number"))throw new RangeError("Invalid JSON representation of ChangeDesc");return new r(e)}static create(e){return new r(e)}},de=class r extends bt{constructor(e,t){super(e),this.inserted=t}apply(e){if(this.length!=e.length)throw new RangeError("Applying change set to a document with the wrong length");return sr(this,(t,i,s,n,o)=>e=e.replace(s,s+(i-t),o),!1),e}mapDesc(e,t=!1){return rr(this,e,t,!0)}invert(e){let t=this.sections.slice(),i=[];for(let s=0,n=0;s=0){t[s]=l,t[s+1]=o;let a=s>>1;for(;i.length0&&Je(i,t,n.text),n.forward(c),l+=c}let h=e[o++];for(;l>1].toJSON()))}return e}static of(e,t,i){let s=[],n=[],o=0,l=null;function a(c=!1){if(!c&&!s.length)return;ou||f<0||u>t)throw new RangeError(`Invalid change range ${f} to ${u} (in doc of length ${t})`);let p=O?typeof O=="string"?M.of(O.split(i||ir)):O:M.empty,g=p.length;if(f==u&&g==0)return;fo&&se(s,f-o,-1),se(s,u-f,g),Je(n,s,p),o=u}}return h(e),a(!l),l}static empty(e){return new r(e?[e,-1]:[],[])}static fromJSON(e){if(!Array.isArray(e))throw new RangeError("Invalid JSON representation of ChangeSet");let t=[],i=[];for(let s=0;sl&&typeof o!="string"))throw new RangeError("Invalid JSON representation of ChangeSet");if(n.length==1)t.push(n[0],0);else{for(;i.length=0&&t<=0&&t==r[s+1]?r[s]+=e:s>=0&&e==0&&r[s]==0?r[s+1]+=t:i?(r[s]+=e,r[s+1]+=t):r.push(e,t)}function Je(r,e,t){if(t.length==0)return;let i=e.length-2>>1;if(i>1])),!(t||o==r.sections.length||r.sections[o+1]<0);)l=r.sections[o++],a=r.sections[o++];e(s,h,n,c,f),s=h,n=c}}}function rr(r,e,t,i=!1){let s=[],n=i?[]:null,o=new Qt(r),l=new Qt(e);for(let a=-1;;){if(o.done&&l.len||l.done&&o.len)throw new Error("Mismatched change set lengths");if(o.ins==-1&&l.ins==-1){let h=Math.min(o.len,l.len);se(s,h,-1),o.forward(h),l.forward(h)}else if(l.ins>=0&&(o.ins<0||a==o.i||o.off==0&&(l.len=0&&a=0){let h=0,c=o.len;for(;c;)if(l.ins==-1){let f=Math.min(c,l.len);h+=f,c-=f,l.forward(f)}else if(l.ins==0&&l.lena||o.ins>=0&&o.len>a)&&(l||i.length>h),n.forward2(a),o.forward(a)}}}}var Qt=class{constructor(e){this.set=e,this.i=0,this.next()}next(){let{sections:e}=this.set;this.i>1;return t>=e.length?M.empty:e[t]}textBit(e){let{inserted:t}=this.set,i=this.i-2>>1;return i>=t.length&&!e?M.empty:t[i].slice(this.off,e==null?void 0:this.off+e)}forward(e){e==this.len?this.next():(this.len-=e,this.off+=e)}forward2(e){this.ins==-1?this.forward(e):e==this.ins?this.next():(this.ins-=e,this.off+=e)}},Rt=class r{constructor(e,t,i){this.from=e,this.to=t,this.flags=i}get anchor(){return this.flags&32?this.to:this.from}get head(){return this.flags&32?this.from:this.to}get empty(){return this.from==this.to}get assoc(){return this.flags&8?-1:this.flags&16?1:0}get bidiLevel(){let e=this.flags&7;return e==7?null:e}get goalColumn(){let e=this.flags>>6;return e==16777215?void 0:e}map(e,t=-1){let i,s;return this.empty?i=s=e.mapPos(this.from,t):(i=e.mapPos(this.from,1),s=e.mapPos(this.to,-1)),i==this.from&&s==this.to?this:new r(i,s,this.flags)}extend(e,t=e,i=0){if(e<=this.anchor&&t>=this.anchor)return w.range(e,t,void 0,void 0,i);let s=Math.abs(e-this.anchor)>Math.abs(t-this.anchor)?e:t;return w.range(this.anchor,s,void 0,void 0,i)}eq(e,t=!1){return this.anchor==e.anchor&&this.head==e.head&&this.goalColumn==e.goalColumn&&(!t||!this.empty||this.assoc==e.assoc)}toJSON(){return{anchor:this.anchor,head:this.head}}static fromJSON(e){if(!e||typeof e.anchor!="number"||typeof e.head!="number")throw new RangeError("Invalid JSON representation for SelectionRange");return w.range(e.anchor,e.head)}static create(e,t,i){return new r(e,t,i)}},w=class r{constructor(e,t){this.ranges=e,this.mainIndex=t}map(e,t=-1){return e.empty?this:r.create(this.ranges.map(i=>i.map(e,t)),this.mainIndex)}eq(e,t=!1){if(this.ranges.length!=e.ranges.length||this.mainIndex!=e.mainIndex)return!1;for(let i=0;ie.toJSON()),main:this.mainIndex}}static fromJSON(e){if(!e||!Array.isArray(e.ranges)||typeof e.main!="number"||e.main>=e.ranges.length)throw new RangeError("Invalid JSON representation for EditorSelection");return new r(e.ranges.map(t=>Rt.fromJSON(t)),e.main)}static single(e,t=e){return new r([r.range(e,t)],0)}static create(e,t=0){if(e.length==0)throw new RangeError("A selection needs at least one range");for(let i=0,s=0;ss.from-n.from),t=e.indexOf(i);for(let s=1;sn.head?r.range(a,l):r.range(l,a))}}return new r(e,t)}};function Fo(r,e){for(let t of r.ranges)if(t.to>e)throw new RangeError("Selection points outside of document")}var gr=0,v=class r{constructor(e,t,i,s,n){this.combine=e,this.compareInput=t,this.compare=i,this.isStatic=s,this.id=gr++,this.default=e([]),this.extensions=typeof n=="function"?n(this):n}get reader(){return this}static define(e={}){return new r(e.combine||(t=>t),e.compareInput||((t,i)=>t===i),e.compare||(e.combine?(t,i)=>t===i:mr),!!e.static,e.enables)}of(e){return new Mt([],this,0,e)}compute(e,t){if(this.isStatic)throw new Error("Can't compute a static facet");return new Mt(e,this,1,t)}computeN(e,t){if(this.isStatic)throw new Error("Can't compute a static facet");return new Mt(e,this,2,t)}from(e,t){return t||(t=i=>i),this.compute([e],i=>t(i.field(e)))}};function mr(r,e){return r==e||r.length==e.length&&r.every((t,i)=>t===e[i])}var Mt=class{constructor(e,t,i,s){this.dependencies=e,this.facet=t,this.type=i,this.value=s,this.id=gr++}dynamicSlot(e){var t;let i=this.value,s=this.facet.compareInput,n=this.id,o=e[n]>>1,l=this.type==2,a=!1,h=!1,c=[];for(let f of this.dependencies)f=="doc"?a=!0:f=="selection"?h=!0:(((t=e[f.id])!==null&&t!==void 0?t:1)&1)==0&&c.push(e[f.id]);return{create(f){return f.values[o]=i(f),1},update(f,u){if(a&&u.docChanged||h&&(u.docChanged||u.selection)||nr(f,c)){let O=i(f);if(l?!Bo(O,f.values[o],s):!s(O,f.values[o]))return f.values[o]=O,1}return 0},reconfigure:(f,u)=>{let O,p=u.config.address[n];if(p!=null){let g=ts(u,p);if(this.dependencies.every(m=>m instanceof v?u.facet(m)===f.facet(m):m instanceof Te?u.field(m,!1)==f.field(m,!1):!0)||(l?Bo(O=i(f),g,s):s(O=i(f),g)))return f.values[o]=g,0}else O=i(f);return f.values[o]=O,1}}}};function Bo(r,e,t){if(r.length!=e.length)return!1;for(let i=0;ir[a.id]),s=t.map(a=>a.type),n=i.filter(a=>!(a&1)),o=r[e.id]>>1;function l(a){let h=[];for(let c=0;ci===s),e);return e.provide&&(t.provides=e.provide(t)),t}create(e){let t=e.facet(Ni).find(i=>i.field==this);return(t?.create||this.createF)(e)}slot(e){let t=e[this.id]>>1;return{create:i=>(i.values[t]=this.create(i),1),update:(i,s)=>{let n=i.values[t],o=this.updateF(n,s);return this.compareF(n,o)?0:(i.values[t]=o,1)},reconfigure:(i,s)=>{let n=i.facet(Ni),o=s.facet(Ni),l;return(l=n.find(a=>a.field==this))&&l!=o.find(a=>a.field==this)?(i.values[t]=l.create(i),1):s.config.address[this.id]!=null?(i.values[t]=s.field(this),0):(i.values[t]=this.create(i),1)}}}init(e){return[this,Ni.of({field:this,create:e})]}get extension(){return this}},gt={lowest:4,low:3,default:2,high:1,highest:0};function Oi(r){return e=>new Ji(e,r)}var xt={highest:Oi(gt.highest),high:Oi(gt.high),default:Oi(gt.default),low:Oi(gt.low),lowest:Oi(gt.lowest)},Ji=class{constructor(e,t){this.inner=e,this.prec=t}},_t=class r{of(e){return new pi(this,e)}reconfigure(e){return r.reconfigure.of({compartment:this,extension:e})}get(e){return e.config.compartments.get(this)}},pi=class{constructor(e,t){this.compartment=e,this.inner=t}},es=class r{constructor(e,t,i,s,n,o){for(this.base=e,this.compartments=t,this.dynamicSlots=i,this.address=s,this.staticValues=n,this.facets=o,this.statusTemplate=[];this.statusTemplate.length>1]}static resolve(e,t,i){let s=[],n=Object.create(null),o=new Map;for(let u of xc(e,t,o))u instanceof Te?s.push(u):(n[u.facet.id]||(n[u.facet.id]=[])).push(u);let l=Object.create(null),a=[],h=[];for(let u of s)l[u.id]=h.length<<1,h.push(O=>u.slot(O));let c=i?.config.facets;for(let u in n){let O=n[u],p=O[0].facet,g=c&&c[u]||[];if(O.every(m=>m.type==0))if(l[p.id]=a.length<<1|1,mr(g,O))a.push(i.facet(p));else{let m=p.combine(O.map(S=>S.value));a.push(i&&p.compare(m,i.facet(p))?i.facet(p):m)}else{for(let m of O)m.type==0?(l[m.id]=a.length<<1|1,a.push(m.value)):(l[m.id]=h.length<<1,h.push(S=>m.dynamicSlot(S)));l[p.id]=h.length<<1,h.push(m=>yc(m,p,O))}}let f=h.map(u=>u(l));return new r(e,o,f,l,a,n)}};function xc(r,e,t){let i=[[],[],[],[],[]],s=new Map;function n(o,l){let a=s.get(o);if(a!=null){if(a<=l)return;let h=i[a].indexOf(o);h>-1&&i[a].splice(h,1),o instanceof pi&&t.delete(o.compartment)}if(s.set(o,l),Array.isArray(o))for(let h of o)n(h,l);else if(o instanceof pi){if(t.has(o.compartment))throw new RangeError("Duplicate use of compartment in extensions");let h=e.get(o.compartment)||o.inner;t.set(o.compartment,h),n(h,l)}else if(o instanceof Ji)n(o.inner,o.prec);else if(o instanceof Te)i[l].push(o),o.provides&&n(o.provides,l);else if(o instanceof Mt)i[l].push(o),o.facet.extensions&&n(o.facet.extensions,gt.default);else{let h=o.extension;if(!h)throw new Error(`Unrecognized extension value in extension set (${o}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`);n(h,l)}}return n(r,gt.default),i.reduce((o,l)=>o.concat(l))}function di(r,e){if(e&1)return 2;let t=e>>1,i=r.status[t];if(i==4)throw new Error("Cyclic dependency between fields and/or facets");if(i&2)return i;r.status[t]=4;let s=r.computeSlot(r,r.config.dynamicSlots[t]);return r.status[t]=2|s}function ts(r,e){return e&1?r.config.staticValues[e>>1]:r.values[e>>1]}var Ho=v.define(),or=v.define({combine:r=>r.some(e=>e),static:!0}),Ko=v.define({combine:r=>r.length?r[0]:void 0,static:!0}),Jo=v.define(),el=v.define(),tl=v.define(),il=v.define({combine:r=>r.length?r[0]:!1}),Ze=class{constructor(e,t){this.type=e,this.value=t}static define(){return new lr}},lr=class{of(e){return new Ze(this,e)}},ar=class{constructor(e){this.map=e}of(e){return new D(this,e)}},D=class r{constructor(e,t){this.type=e,this.value=t}map(e){let t=this.type.map(this.value,e);return t===void 0?void 0:t==this.value?this:new r(this.type,t)}is(e){return this.type==e}static define(e={}){return new ar(e.map||(t=>t))}static mapEffects(e,t){if(!e.length)return e;let i=[];for(let s of e){let n=s.map(t);n&&i.push(n)}return i}};D.reconfigure=D.define();D.appendConfig=D.define();var re=class r{constructor(e,t,i,s,n,o){this.startState=e,this.changes=t,this.selection=i,this.effects=s,this.annotations=n,this.scrollIntoView=o,this._doc=null,this._state=null,i&&Fo(i,t.newLength),n.some(l=>l.type==r.time)||(this.annotations=n.concat(r.time.of(Date.now())))}static create(e,t,i,s,n,o){return new r(e,t,i,s,n,o)}get newDoc(){return this._doc||(this._doc=this.changes.apply(this.startState.doc))}get newSelection(){return this.selection||this.startState.selection.map(this.changes)}get state(){return this._state||this.startState.applyTransaction(this),this._state}annotation(e){for(let t of this.annotations)if(t.type==e)return t.value}get docChanged(){return!this.changes.empty}get reconfigured(){return this.startState.config!=this.state.config}isUserEvent(e){let t=this.annotation(r.userEvent);return!!(t&&(t==e||t.length>e.length&&t.slice(0,e.length)==e&&t[e.length]=="."))}};re.time=Ze.define();re.userEvent=Ze.define();re.addToHistory=Ze.define();re.remote=Ze.define();function wc(r,e){let t=[];for(let i=0,s=0;;){let n,o;if(i=r[i]))n=r[i++],o=r[i++];else if(s=0;s--){let n=i[s](r);n instanceof re?r=n:Array.isArray(n)&&n.length==1&&n[0]instanceof re?r=n[0]:r=rl(e,jt(n),!1)}return r}function kc(r){let e=r.startState,t=e.facet(tl),i=r;for(let s=t.length-1;s>=0;s--){let n=t[s](r);n&&Object.keys(n).length&&(i=sl(i,hr(e,n,r.changes.newLength),!0))}return i==r?r:re.create(e,r.changes,r.selection,i.effects,i.annotations,i.scrollIntoView)}var vc=[];function jt(r){return r==null?vc:Array.isArray(r)?r:[r]}var ve=(function(r){return r[r.Word=0]="Word",r[r.Space=1]="Space",r[r.Other=2]="Other",r})(ve||(ve={})),Pc=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/,cr;try{cr=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch{}function Tc(r){if(cr)return cr.test(r);for(let e=0;e"\x80"&&(t.toUpperCase()!=t.toLowerCase()||Pc.test(t)))return!0}return!1}function Zc(r){return e=>{if(!/\S/.test(e))return ve.Space;if(Tc(e))return ve.Word;for(let t=0;t-1)return ve.Word;return ve.Other}}var U=class r{constructor(e,t,i,s,n,o){this.config=e,this.doc=t,this.selection=i,this.values=s,this.status=e.statusTemplate.slice(),this.computeSlot=n,o&&(o._state=this);for(let l=0;ls.set(h,a)),t=null),s.set(l.value.compartment,l.value.extension)):l.is(D.reconfigure)?(t=null,i=l.value):l.is(D.appendConfig)&&(t=null,i=jt(i).concat(l.value));let n;t?n=e.startState.values.slice():(t=es.resolve(i,s,this),n=new r(t,this.doc,this.selection,t.dynamicSlots.map(()=>null),(a,h)=>h.reconfigure(a,this),null).values);let o=e.startState.facet(or)?e.newSelection:e.newSelection.asSingle();new r(t,e.newDoc,o,n,(l,a)=>a.update(l,e),e)}replaceSelection(e){return typeof e=="string"&&(e=this.toText(e)),this.changeByRange(t=>({changes:{from:t.from,to:t.to,insert:e},range:w.cursor(t.from+e.length)}))}changeByRange(e){let t=this.selection,i=e(t.ranges[0]),s=this.changes(i.changes),n=[i.range],o=jt(i.effects);for(let l=1;lo.spec.fromJSON(l,a)))}}return r.create({doc:e.doc,selection:w.fromJSON(e.selection),extensions:t.extensions?s.concat([t.extensions]):s})}static create(e={}){let t=es.resolve(e.extensions||[],new Map),i=e.doc instanceof M?e.doc:M.of((e.doc||"").split(t.staticFacet(r.lineSeparator)||ir)),s=e.selection?e.selection instanceof w?e.selection:w.single(e.selection.anchor,e.selection.head):w.single(0);return Fo(s,i.length),t.staticFacet(or)||(s=s.asSingle()),new r(t,i,s,t.dynamicSlots.map(()=>null),(n,o)=>o.create(n),null)}get tabSize(){return this.facet(r.tabSize)}get lineBreak(){return this.facet(r.lineSeparator)||`
@@ -19,4 +19,4 @@ var Js=[],Vo=[];(()=>{let r="lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,
constructor(\${params}) {
\${}
}
-}`,{label:"class",detail:"definition",type:"keyword"}),le('import {${names}} from "${module}"\n${}',{label:"import",detail:"named",type:"keyword"}),le('import ${name} from "${module}"\n${}',{label:"import",detail:"default",type:"keyword"})],Vd=Uh.concat([le("interface ${name} {\n ${}\n}",{label:"interface",detail:"definition",type:"keyword"}),le("type ${name} = ${type}",{label:"type",detail:"definition",type:"keyword"}),le("enum ${name} {\n ${}\n}",{label:"enum",detail:"definition",type:"keyword"})]),Ih=new Ht,Fh=new Set(["Script","Block","FunctionExpression","FunctionDeclaration","ArrowFunction","MethodDeclaration","ForStatement"]);function Di(r){return(e,t)=>{let i=e.node.getChild("VariableDefinition");return i&&t(i,r),!0}}var Ed=["FunctionDeclaration"],Wd={FunctionDeclaration:Di("function"),ClassDeclaration:Di("class"),ClassExpression:()=>!0,EnumDeclaration:Di("constant"),TypeAliasDeclaration:Di("type"),NamespaceDeclaration:Di("namespace"),VariableDefinition(r,e){r.matchContext(Ed)||e(r,"variable")},TypeDefinition(r,e){e(r,"type")},__proto__:null};function Hh(r,e){let t=Ih.get(e);if(t)return t;let i=[],s=!0;function n(o,l){let a=r.sliceString(o.from,o.to);i.push({label:a,type:l})}return e.cursor(j.IncludeAnonymous).iterate(o=>{if(s)s=!1;else if(o.name){let l=Wd[o.name];if(l&&l(o,n)||Fh.has(o.name))return!1}else if(o.to-o.from>8192){for(let l of Hh(r,o.node))i.push(l);return!1}}),Ih.set(e,i),i}var Nh=/^[\w$\xa1-\uffff][\w$\d\xa1-\uffff]*$/,Kh=["TemplateString","String","RegExp","LineComment","BlockComment","VariableDefinition","TypeDefinition","Label","PropertyDefinition","PropertyName","PrivatePropertyDefinition","PrivatePropertyName","JSXText","JSXAttributeValue","JSXOpenTag","JSXCloseTag","JSXSelfClosingTag",".","?."];function qd(r){let e=oe(r.state).resolveInner(r.pos,-1);if(Kh.indexOf(e.name)>-1)return null;let t=e.name=="VariableName"||e.to-e.from<20&&Nh.test(r.state.sliceDoc(e.from,e.to));if(!t&&!r.explicit)return null;let i=[];for(let s=e;s;s=s.parent)Fh.has(s.name)&&(i=i.concat(Hh(r.state.doc,s)));return{options:i,from:t?e.from:r.pos,validFor:Nh}}var Me=ht.define({name:"javascript",parser:Vh.configure({props:[ii.add({IfStatement:si({except:/^\s*({|else\b)/}),TryStatement:si({except:/^\s*({|catch\b|finally\b)/}),LabeledStatement:Ka,SwitchBody:r=>{let e=r.textAfter,t=/^\s*\}/.test(e),i=/^\s*(case|default)\b/.test(e);return r.baseIndent+(t?0:i?1:2)*r.unit},Block:Ha({closing:"}"}),ArrowFunction:r=>r.baseIndent+r.unit,"TemplateString BlockComment":()=>null,"Statement Property":si({except:/^\s*{/}),JSXElement(r){let e=/^\s*<\//.test(r.textAfter);return r.lineIndent(r.node.from)+(e?0:r.unit)},JSXEscape(r){let e=/\s*\}/.test(r.textAfter);return r.lineIndent(r.node.from)+(e?0:r.unit)},"JSXOpenTag JSXSelfClosingTag"(r){return r.column(r.node.from)+r.unit}}),ri.add({"Block ClassBody SwitchBody EnumBody ObjectExpression ArrayExpression ObjectType":Ds,BlockComment(r){return{from:r.from+2,to:r.to-2}},JSXElement(r){let e=r.firstChild;if(!e||e.name=="JSXSelfClosingTag")return null;let t=r.lastChild;return{from:e.to,to:t.type.isError?r.to:t.from}},"JSXSelfClosingTag JSXOpenTag"(r){var e;let t=(e=r.firstChild)===null||e===void 0?void 0:e.nextSibling,i=r.lastChild;return!t||t.type.isError?null:{from:t.to,to:i.type.isError?r.to:i.from}}})]}),languageData:{closeBrackets:{brackets:["(","[","{","'",'"',"`"]},commentTokens:{line:"//",block:{open:"/*",close:"*/"}},indentOnInput:/^\s*(?:case |default:|\{|\}|<\/)$/,wordChars:"$"}}),Jh={test:r=>/^JSX/.test(r.name),facet:Gn({commentTokens:{block:{open:"{/*",close:"*/}"}}})},$o=Me.configure({dialect:"ts"},"typescript"),ko=Me.configure({dialect:"jsx",props:[qs.add(r=>r.isTop?[Jh]:void 0)]}),vo=Me.configure({dialect:"jsx ts",props:[qs.add(r=>r.isTop?[Jh]:void 0)]},"typescript"),ec=r=>({label:r,type:"keyword"}),tc="break case const continue default delete export extends false finally in instanceof let new return static super switch this throw true typeof var yield".split(" ").map(ec),Dd=tc.concat(["declare","implements","private","protected","public"].map(ec));function Us(r={}){let e=r.jsx?r.typescript?vo:ko:r.typescript?$o:Me,t=r.typescript?Vd.concat(Dd):Uh.concat(tc);return new ct(e,[Me.data.of({autocomplete:Dh(Kh,qh(t))}),Me.data.of({autocomplete:qd}),r.jsx?Id:[]])}function Ld(r){for(;;){if(r.name=="JSXOpenTag"||r.name=="JSXSelfClosingTag"||r.name=="JSXFragmentTag")return r;if(r.name=="JSXEscape"||!r.parent)return null;r=r.parent}}function Gh(r,e,t=r.length){for(let i=e?.firstChild;i;i=i.nextSibling)if(i.name=="JSXIdentifier"||i.name=="JSXBuiltin"||i.name=="JSXNamespacedName"||i.name=="JSXMemberExpression")return r.sliceString(i.from,Math.min(i.to,t));return""}var Bd=typeof navigator=="object"&&/Android\b/.test(navigator.userAgent),Id=T.inputHandler.of((r,e,t,i,s)=>{if((Bd?r.composing:r.compositionStarted)||r.state.readOnly||e!=t||i!=">"&&i!="/"||!Me.isActiveAt(r.state,e,-1))return!1;let n=s(),{state:o}=n,l=o.changeByRange(a=>{var h;let{head:c}=a,f=oe(o).resolveInner(c-1,-1),u;if(f.name=="JSXStartTag"&&(f=f.parent),!(o.doc.sliceString(c-1,c)!=i||f.name=="JSXAttributeValue"&&f.to>c)){if(i==">"&&f.name=="JSXFragmentTag")return{range:a,changes:{from:c,insert:">"}};if(i=="/"&&f.name=="JSXStartCloseTag"){let O=f.parent,p=O.parent;if(p&&O.from==c-2&&((u=Gh(o.doc,p.firstChild,c))||((h=p.firstChild)===null||h===void 0?void 0:h.name)=="JSXFragmentTag")){let g=`${u}>`;return{range:w.cursor(c+g.length,-1),changes:{from:c,insert:g}}}}else if(i==">"){let O=Ld(f);if(O&&O.name=="JSXOpenTag"&&!/^\/?>|^<\//.test(o.doc.sliceString(c,c+2))&&(u=Gh(o.doc,O,c)))return{range:a,changes:{from:c,insert:`${u}>`}}}}return{range:a}});return l.changes.empty?!1:(r.dispatch([n,o.update(l,{userEvent:"input.complete",scrollIntoView:!0})]),!0)});var Li=["_blank","_self","_top","_parent"],Po=["ascii","utf-8","utf-16","latin1","latin1"],To=["get","post","put","delete"],Zo=["application/x-www-form-urlencoded","multipart/form-data","text/plain"],Se=["true","false"],$={},Nd={a:{attrs:{href:null,ping:null,type:null,media:null,target:Li,hreflang:null}},abbr:$,address:$,area:{attrs:{alt:null,coords:null,href:null,target:null,ping:null,media:null,hreflang:null,type:null,shape:["default","rect","circle","poly"]}},article:$,aside:$,audio:{attrs:{src:null,mediagroup:null,crossorigin:["anonymous","use-credentials"],preload:["none","metadata","auto"],autoplay:["autoplay"],loop:["loop"],controls:["controls"]}},b:$,base:{attrs:{href:null,target:Li}},bdi:$,bdo:$,blockquote:{attrs:{cite:null}},body:$,br:$,button:{attrs:{form:null,formaction:null,name:null,value:null,autofocus:["autofocus"],disabled:["autofocus"],formenctype:Zo,formmethod:To,formnovalidate:["novalidate"],formtarget:Li,type:["submit","reset","button"]}},canvas:{attrs:{width:null,height:null}},caption:$,center:$,cite:$,code:$,col:{attrs:{span:null}},colgroup:{attrs:{span:null}},command:{attrs:{type:["command","checkbox","radio"],label:null,icon:null,radiogroup:null,command:null,title:null,disabled:["disabled"],checked:["checked"]}},data:{attrs:{value:null}},datagrid:{attrs:{disabled:["disabled"],multiple:["multiple"]}},datalist:{attrs:{data:null}},dd:$,del:{attrs:{cite:null,datetime:null}},details:{attrs:{open:["open"]}},dfn:$,div:$,dl:$,dt:$,em:$,embed:{attrs:{src:null,type:null,width:null,height:null}},eventsource:{attrs:{src:null}},fieldset:{attrs:{disabled:["disabled"],form:null,name:null}},figcaption:$,figure:$,footer:$,form:{attrs:{action:null,name:null,"accept-charset":Po,autocomplete:["on","off"],enctype:Zo,method:To,novalidate:["novalidate"],target:Li}},h1:$,h2:$,h3:$,h4:$,h5:$,h6:$,head:{children:["title","base","link","style","meta","script","noscript","command"]},header:$,hgroup:$,hr:$,html:{attrs:{manifest:null}},i:$,iframe:{attrs:{src:null,srcdoc:null,name:null,width:null,height:null,sandbox:["allow-top-navigation","allow-same-origin","allow-forms","allow-scripts"],seamless:["seamless"]}},img:{attrs:{alt:null,src:null,ismap:null,usemap:null,width:null,height:null,crossorigin:["anonymous","use-credentials"]}},input:{attrs:{alt:null,dirname:null,form:null,formaction:null,height:null,list:null,max:null,maxlength:null,min:null,name:null,pattern:null,placeholder:null,size:null,src:null,step:null,value:null,width:null,accept:["audio/*","video/*","image/*"],autocomplete:["on","off"],autofocus:["autofocus"],checked:["checked"],disabled:["disabled"],formenctype:Zo,formmethod:To,formnovalidate:["novalidate"],formtarget:Li,multiple:["multiple"],readonly:["readonly"],required:["required"],type:["hidden","text","search","tel","url","email","password","datetime","date","month","week","time","datetime-local","number","range","color","checkbox","radio","file","submit","image","reset","button"]}},ins:{attrs:{cite:null,datetime:null}},kbd:$,keygen:{attrs:{challenge:null,form:null,name:null,autofocus:["autofocus"],disabled:["disabled"],keytype:["RSA"]}},label:{attrs:{for:null,form:null}},legend:$,li:{attrs:{value:null}},link:{attrs:{href:null,type:null,hreflang:null,media:null,sizes:["all","16x16","16x16 32x32","16x16 32x32 64x64"]}},map:{attrs:{name:null}},mark:$,menu:{attrs:{label:null,type:["list","context","toolbar"]}},meta:{attrs:{content:null,charset:Po,name:["viewport","application-name","author","description","generator","keywords"],"http-equiv":["content-language","content-type","default-style","refresh"]}},meter:{attrs:{value:null,min:null,low:null,high:null,max:null,optimum:null}},nav:$,noscript:$,object:{attrs:{data:null,type:null,name:null,usemap:null,form:null,width:null,height:null,typemustmatch:["typemustmatch"]}},ol:{attrs:{reversed:["reversed"],start:null,type:["1","a","A","i","I"]},children:["li","script","template","ul","ol"]},optgroup:{attrs:{disabled:["disabled"],label:null}},option:{attrs:{disabled:["disabled"],label:null,selected:["selected"],value:null}},output:{attrs:{for:null,form:null,name:null}},p:$,param:{attrs:{name:null,value:null}},pre:$,progress:{attrs:{value:null,max:null}},q:{attrs:{cite:null}},rp:$,rt:$,ruby:$,samp:$,script:{attrs:{type:["text/javascript"],src:null,async:["async"],defer:["defer"],charset:Po}},section:$,select:{attrs:{form:null,name:null,size:null,autofocus:["autofocus"],disabled:["disabled"],multiple:["multiple"]}},slot:{attrs:{name:null}},small:$,source:{attrs:{src:null,type:null,media:null}},span:$,strong:$,style:{attrs:{type:["text/css"],media:null,scoped:null}},sub:$,summary:$,sup:$,table:$,tbody:$,td:{attrs:{colspan:null,rowspan:null,headers:null}},template:$,textarea:{attrs:{dirname:null,form:null,maxlength:null,name:null,placeholder:null,rows:null,cols:null,autofocus:["autofocus"],disabled:["disabled"],readonly:["readonly"],required:["required"],wrap:["soft","hard"]}},tfoot:$,th:{attrs:{colspan:null,rowspan:null,headers:null,scope:["row","col","rowgroup","colgroup"]}},thead:$,time:{attrs:{datetime:null}},title:$,tr:$,track:{attrs:{src:null,label:null,default:null,kind:["subtitles","captions","descriptions","chapters","metadata"],srclang:null}},ul:{children:["li","script","template","ul","ol"]},var:$,video:{attrs:{src:null,poster:null,width:null,height:null,crossorigin:["anonymous","use-credentials"],preload:["auto","metadata","none"],autoplay:["autoplay"],mediagroup:["movie"],muted:["muted"],controls:["controls"]}},wbr:$},nc={accesskey:null,class:null,contenteditable:Se,contextmenu:null,dir:["ltr","rtl","auto"],draggable:["true","false","auto"],dropzone:["copy","move","link","string:","file:"],hidden:["hidden"],id:null,inert:["inert"],itemid:null,itemprop:null,itemref:null,itemscope:["itemscope"],itemtype:null,lang:["ar","bn","de","en-GB","en-US","es","fr","hi","id","ja","pa","pt","ru","tr","zh"],spellcheck:Se,autocorrect:Se,autocapitalize:Se,style:null,tabindex:null,title:null,translate:["yes","no"],rel:["stylesheet","alternate","author","bookmark","help","license","next","nofollow","noreferrer","prefetch","prev","search","tag"],role:"alert application article banner button cell checkbox complementary contentinfo dialog document feed figure form grid gridcell heading img list listbox listitem main navigation region row rowgroup search switch tab table tabpanel textbox timer".split(" "),"aria-activedescendant":null,"aria-atomic":Se,"aria-autocomplete":["inline","list","both","none"],"aria-busy":Se,"aria-checked":["true","false","mixed","undefined"],"aria-controls":null,"aria-describedby":null,"aria-disabled":Se,"aria-dropeffect":null,"aria-expanded":["true","false","undefined"],"aria-flowto":null,"aria-grabbed":["true","false","undefined"],"aria-haspopup":Se,"aria-hidden":Se,"aria-invalid":["true","false","grammar","spelling"],"aria-label":null,"aria-labelledby":null,"aria-level":null,"aria-live":["off","polite","assertive"],"aria-multiline":Se,"aria-multiselectable":Se,"aria-owns":null,"aria-posinset":null,"aria-pressed":["true","false","mixed","undefined"],"aria-readonly":Se,"aria-relevant":null,"aria-required":Se,"aria-selected":["true","false","undefined"],"aria-setsize":null,"aria-sort":["ascending","descending","none","other"],"aria-valuemax":null,"aria-valuemin":null,"aria-valuenow":null,"aria-valuetext":null},oc="beforeunload copy cut dragstart dragover dragleave dragenter dragend drag paste focus blur change click load mousedown mouseenter mouseleave mouseup keydown keyup resize scroll unload".split(" ").map(r=>"on"+r);for(let r of oc)nc[r]=null;var ai=class{constructor(e,t){this.tags={...Nd,...e},this.globalAttrs={...nc,...t},this.allTags=Object.keys(this.tags),this.globalAttrNames=Object.keys(this.globalAttrs)}};ai.default=new ai;function hi(r,e,t=r.length){if(!e)return"";let i=e.firstChild,s=i&&i.getChild("TagName");return s?r.sliceString(s.from,Math.min(s.to,t)):""}function ci(r,e=!1){for(;r;r=r.parent)if(r.name=="Element")if(e)e=!1;else return r;return null}function lc(r,e,t){let i=t.tags[hi(r,ci(e))];return i?.children||t.allTags}function Co(r,e){let t=[];for(let i=ci(e);i&&!i.type.isTop;i=ci(i.parent)){let s=hi(r,i);if(s&&i.lastChild.name=="CloseTag")break;s&&t.indexOf(s)<0&&(e.name=="EndTag"||e.from>=i.firstChild.to)&&t.push(s)}return t}var ac=/^[:\-\.\w\u00b7-\uffff]*$/;function ic(r,e,t,i,s){let n=/\s*>/.test(r.sliceDoc(s,s+5))?"":">",o=ci(t,t.name=="StartTag"||t.name=="TagName");return{from:i,to:s,options:lc(r.doc,o,e).map(l=>({label:l,type:"type"})).concat(Co(r.doc,t).map((l,a)=>({label:"/"+l,apply:"/"+l+n,type:"type",boost:99-a}))),validFor:/^\/?[:\-\.\w\u00b7-\uffff]*$/}}function sc(r,e,t,i){let s=/\s*>/.test(r.sliceDoc(i,i+5))?"":">";return{from:t,to:i,options:Co(r.doc,e).map((n,o)=>({label:n,apply:n+s,type:"type",boost:99-o})),validFor:ac}}function Gd(r,e,t,i){let s=[],n=0;for(let o of lc(r.doc,t,e))s.push({label:"<"+o,type:"type"});for(let o of Co(r.doc,t))s.push({label:""+o+">",type:"type",boost:99-n++});return{from:i,to:i,options:s,validFor:/^<\/?[:\-\.\w\u00b7-\uffff]*$/}}function Ud(r,e,t,i,s){let n=ci(t),o=n?e.tags[hi(r.doc,n)]:null,l=o&&o.attrs?Object.keys(o.attrs):[],a=o&&o.globalAttrs===!1?l:l.length?l.concat(e.globalAttrNames):e.globalAttrNames;return{from:i,to:s,options:a.map(h=>({label:h,type:"property"})),validFor:ac}}function Fd(r,e,t,i,s){var n;let o=(n=t.parent)===null||n===void 0?void 0:n.getChild("AttributeName"),l=[],a;if(o){let h=r.sliceDoc(o.from,o.to),c=e.globalAttrs[h];if(!c){let f=ci(t),u=f?e.tags[hi(r.doc,f)]:null;c=u?.attrs&&u.attrs[h]}if(c){let f=r.sliceDoc(i,s).toLowerCase(),u='"',O='"';/^['"]/.test(f)?(a=f[0]=='"'?/^[^"]*$/:/^[^']*$/,u="",O=r.sliceDoc(s,s+1)==f[0]?"":f[0],f=f.slice(1),i++):a=/^[^\s<>='"]*$/;for(let p of c)l.push({label:p,apply:u+p+O,type:"constant"})}}return{from:i,to:s,options:l,validFor:a}}function Hd(r,e){let{state:t,pos:i}=e,s=oe(t).resolveInner(i,-1),n=s.resolve(i);for(let o=i,l;n==s&&(l=s.childBefore(o));){let a=l.lastChild;if(!a||!a.type.isError||a.fromHd(i,s)}var Jd=Me.parser.configure({top:"SingleExpression"}),hc=[{tag:"script",attrs:r=>r.type=="text/typescript"||r.lang=="ts",parser:$o.parser},{tag:"script",attrs:r=>r.type=="text/babel"||r.type=="text/jsx",parser:ko.parser},{tag:"script",attrs:r=>r.type=="text/typescript-jsx",parser:vo.parser},{tag:"script",attrs(r){return/^(importmap|speculationrules|application\/(.+\+)?json)$/i.test(r.type)},parser:Jd},{tag:"script",attrs(r){return!r.type||/^(?:text|application)\/(?:x-)?(?:java|ecma)script$|^module$|^$/i.test(r.type)},parser:Me.parser},{tag:"style",attrs(r){return(!r.lang||r.lang=="css")&&(!r.type||/^(text\/)?(x-)?(stylesheet|css)$/i.test(r.type))},parser:Ei.parser}],cc=[{name:"style",parser:Ei.parser.configure({top:"Styles"})}].concat(oc.map(r=>({name:r,parser:Me.parser}))),fc=ht.define({name:"html",parser:$h.configure({props:[ii.add({Element(r){let e=/^(\s*)(<\/)?/.exec(r.textAfter);return r.node.to<=r.pos+e[0].length?r.continue():r.lineIndent(r.node.from)+(e[2]?0:r.unit)},"OpenTag CloseTag SelfClosingTag"(r){return r.column(r.node.from)+r.unit},Document(r){if(r.pos+/\s*/.exec(r.textAfter)[0].lengthr.getChild("TagName")})]}),languageData:{commentTokens:{block:{open:""}},indentOnInput:/^\s*<\/\w+\W$/,wordChars:"-_"}}),Fs=fc.configure({wrap:uo(hc,cc)});function uc(r={}){let e="",t;r.matchClosingTags===!1&&(e="noMatch"),r.selfClosingTags===!0&&(e=(e?e+" ":"")+"selfClosing"),(r.nestedLanguages&&r.nestedLanguages.length||r.nestedAttributes&&r.nestedAttributes.length)&&(t=uo((r.nestedLanguages||[]).concat(hc),(r.nestedAttributes||[]).concat(cc)));let i=t?fc.configure({wrap:t,dialect:e}):e?Fs.configure({dialect:e}):Fs;return new ct(i,[Fs.data.of({autocomplete:Kd(r)}),r.autoCloseTags!==!1?ep:[],Us().support,Gs().support])}var rc=new Set("area base br col command embed frame hr img input keygen link meta param source track wbr menuitem".split(" ")),ep=T.inputHandler.of((r,e,t,i,s)=>{if(r.composing||r.state.readOnly||e!=t||i!=">"&&i!="/"||!Fs.isActiveAt(r.state,e,-1))return!1;let n=s(),{state:o}=n,l=o.changeByRange(a=>{var h,c,f;let u=o.doc.sliceString(a.from-1,a.to)==i,{head:O}=a,p=oe(o).resolveInner(O,-1),g;if(u&&i==">"&&p.name=="EndTag"){let m=p.parent;if(((c=(h=m.parent)===null||h===void 0?void 0:h.lastChild)===null||c===void 0?void 0:c.name)!="CloseTag"&&(g=hi(o.doc,m.parent,O))&&!rc.has(g)){let S=O+(o.doc.sliceString(O,O+1)===">"?1:0),b=`${g}>`;return{range:a,changes:{from:O,to:S,insert:b}}}}else if(u&&i=="/"&&p.name=="IncompleteCloseTag"){let m=p.parent;if(p.from==O-2&&((f=m.lastChild)===null||f===void 0?void 0:f.name)!="CloseTag"&&(g=hi(o.doc,m,O))&&!rc.has(g)){let S=O+(o.doc.sliceString(O,O+1)===">"?1:0),b=`${g}>`;return{range:w.cursor(O+b.length,-1),changes:{from:O,to:S,insert:b}}}}return{range:a}});return l.changes.empty?!1:(r.dispatch([n,o.update(l,{userEvent:"input.complete",scrollIntoView:!0})]),!0)});function fi(){return fi=Object.assign?Object.assign.bind():function(r){for(var e=1;e{var e=r.theme,t=r.settings,i=t===void 0?{}:t,s=r.styles,n=s===void 0?[]:s,o={".cm-gutters":{}},l={};i.background&&(l.backgroundColor=i.background),i.backgroundImage&&(l.backgroundImage=i.backgroundImage),i.foreground&&(l.color=i.foreground),i.fontSize&&(l.fontSize=i.fontSize),(i.background||i.foreground)&&(o["&"]=l),i.fontFamily&&(o["&.cm-editor .cm-scroller"]={fontFamily:i.fontFamily}),i.gutterBackground&&(o[".cm-gutters"].backgroundColor=i.gutterBackground),i.gutterForeground&&(o[".cm-gutters"].color=i.gutterForeground),i.gutterBorder&&(o[".cm-gutters"].borderRightColor=i.gutterBorder),i.caret&&(o[".cm-content"]={caretColor:i.caret},o[".cm-cursor, .cm-dropCursor"]={borderLeftColor:i.caret});var a={};i.gutterActiveForeground&&(a.color=i.gutterActiveForeground),i.lineHighlight&&(o[".cm-activeLine"]={backgroundColor:i.lineHighlight},a.backgroundColor=i.lineHighlight),o[".cm-activeLineGutter"]=a,i.selection&&(o["&.cm-focused .cm-selectionBackground, & .cm-line::selection, & .cm-selectionLayer .cm-selectionBackground, .cm-content ::selection"]={background:i.selection+" !important"}),i.selectionMatch&&(o["& .cm-selectionMatch"]={backgroundColor:i.selectionMatch});var h=T.theme(o,{dark:e==="dark"}),c=ti.define(n),f=[h,Ls(c)];return f};var V={background:"#002B36",foreground:"#839496",selection:"#004454AA",selectionMatch:"#005A6FAA",cursor:"#D30102",dropdownBackground:"#00212B",dropdownBorder:"#2AA19899",activeLine:"#00cafe11",matchingBracket:"#073642",keyword:"#859900",storage:"#93A1A1",variable:"#268BD2",parameter:"#268BD2",function:"#268BD2",string:"#2AA198",constant:"#CB4B16",type:"#859900",class:"#268BD2",number:"#D33682",comment:"#586E75",heading:"#268BD2",invalid:"#DC322F",regexp:"#DC322F",tag:"#268BD2"};var tp={background:V.background,foreground:V.foreground,caret:V.cursor,selection:V.selection,selectionMatch:V.selection,gutterBackground:V.background,gutterForeground:V.foreground,gutterBorder:"transparent",lineHighlight:V.activeLine},ip=[{tag:d.keyword,color:V.keyword},{tag:[d.name,d.deleted,d.character,d.macroName],color:V.variable},{tag:[d.propertyName],color:V.function},{tag:[d.processingInstruction,d.string,d.inserted,d.special(d.string)],color:V.string},{tag:[d.function(d.variableName),d.labelName],color:V.function},{tag:[d.color,d.constant(d.name),d.standard(d.name)],color:V.constant},{tag:[d.definition(d.name),d.separator],color:V.variable},{tag:[d.className],color:V.class},{tag:[d.number,d.changed,d.annotation,d.modifier,d.self,d.namespace],color:V.number},{tag:[d.typeName],color:V.type,fontStyle:V.type},{tag:[d.operator,d.operatorKeyword],color:V.keyword},{tag:[d.url,d.escape,d.regexp,d.link],color:V.regexp},{tag:[d.meta,d.comment],color:V.comment},{tag:d.tagName,color:V.tag},{tag:d.strong,fontWeight:"bold"},{tag:d.emphasis,fontStyle:"italic"},{tag:d.link,textDecoration:"underline"},{tag:d.heading,fontWeight:"bold",color:V.heading},{tag:[d.atom,d.bool,d.special(d.variableName)],color:V.variable},{tag:d.invalid,color:V.invalid},{tag:d.strikethrough,textDecoration:"line-through"}],sp=r=>{var e=r||{},t=e.theme,i=t===void 0?"dark":t,s=e.settings,n=s===void 0?{}:s,o=e.styles,l=o===void 0?[]:o;return Hs({theme:i,settings:fi({},tp,n),styles:[...ip,...l]})},Xo=sp();var E={background:"#FDF6E3",foreground:"#657B83",selection:"#EEE8D5",selectionMatch:"#EEE8D5",cursor:"#657B83",dropdownBackground:"#EEE8D5",dropdownBorder:"#D3AF86",activeLine:"#3d392d11",matchingBracket:"#EEE8D5",keyword:"#859900",storage:"#586E75",variable:"#268BD2",parameter:"#268BD2",function:"#268BD2",string:"#2AA198",constant:"#CB4B16",type:"#859900",class:"#268BD2",number:"#D33682",comment:"#93A1A1",heading:"#268BD2",invalid:"#DC322F",regexp:"#DC322F",tag:"#268BD2"};var rp={background:E.background,foreground:E.foreground,caret:E.cursor,selection:E.selection,selectionMatch:E.selectionMatch,gutterBackground:E.background,gutterForeground:E.foreground,gutterBorder:"transparent",lineHighlight:E.activeLine},np=[{tag:d.keyword,color:E.keyword},{tag:[d.name,d.deleted,d.character,d.macroName],color:E.variable},{tag:[d.propertyName],color:E.function},{tag:[d.processingInstruction,d.string,d.inserted,d.special(d.string)],color:E.string},{tag:[d.function(d.variableName),d.labelName],color:E.function},{tag:[d.color,d.constant(d.name),d.standard(d.name)],color:E.constant},{tag:[d.definition(d.name),d.separator],color:E.variable},{tag:[d.className],color:E.class},{tag:[d.number,d.changed,d.annotation,d.modifier,d.self,d.namespace],color:E.number},{tag:[d.typeName],color:E.type,fontStyle:E.type},{tag:[d.operator,d.operatorKeyword],color:E.keyword},{tag:[d.url,d.escape,d.regexp,d.link],color:E.regexp},{tag:[d.meta,d.comment],color:E.comment},{tag:d.tagName,color:E.tag},{tag:d.strong,fontWeight:"bold"},{tag:d.emphasis,fontStyle:"italic"},{tag:d.link,textDecoration:"underline"},{tag:d.heading,fontWeight:"bold",color:E.heading},{tag:[d.atom,d.bool,d.special(d.variableName)],color:E.variable},{tag:d.invalid,color:E.invalid},{tag:d.strikethrough,textDecoration:"line-through"}],op=r=>{var e=r||{},t=e.theme,i=t===void 0?"light":t,s=e.settings,n=s===void 0?{}:s,o=e.styles,l=o===void 0?[]:o;return Hs({theme:i,settings:fi({},rp,n),styles:[...np,...l]})},Ro=op();var dc=new _t;function pc(){let r=document.documentElement.dataset.theme;return r==="dark"?!0:r==="light"?!1:window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches}function Ao(r){r.dispatch({effects:dc.reconfigure(pc()?Xo:Ro)})}function Oc(){document.querySelectorAll("textarea[data-codemirror-editor]").forEach(r=>{let e=r.dataset.language||"html",t=r.value??"",i=document.createElement("div");i.className="cm6-editor-wrapper",r.insertAdjacentElement("beforebegin",i),r.hidden=!0;let s=T.updateListener.of(c=>{c.docChanged&&(r.value=c.state.doc.toString())}),n=[Za(),T.lineWrapping,Ls(eh),s,dc.of(pc()?Xo:Ro)];e==="javascript"?n.unshift(Us()):e==="css"?n.unshift(Gs()):n.unshift(uc());let o=U.create({doc:t,extensions:n}),l=new T({state:o,parent:i});Ao(l),new MutationObserver(()=>Ao(l)).observe(document.documentElement,{attributes:!0,attributeFilter:["data-theme","class"]}),window.matchMedia("(prefers-color-scheme: dark)").addEventListener("change",()=>Ao(l)),r.value=l.state.doc.toString()})}document.readyState==="loading"?document.addEventListener("DOMContentLoaded",Oc,{once:!0}):Oc();
+}`,{label:"class",detail:"definition",type:"keyword"}),le('import {${names}} from "${module}"\n${}',{label:"import",detail:"named",type:"keyword"}),le('import ${name} from "${module}"\n${}',{label:"import",detail:"default",type:"keyword"})],Vd=Uh.concat([le("interface ${name} {\n ${}\n}",{label:"interface",detail:"definition",type:"keyword"}),le("type ${name} = ${type}",{label:"type",detail:"definition",type:"keyword"}),le("enum ${name} {\n ${}\n}",{label:"enum",detail:"definition",type:"keyword"})]),Ih=new Ht,Fh=new Set(["Script","Block","FunctionExpression","FunctionDeclaration","ArrowFunction","MethodDeclaration","ForStatement"]);function Di(r){return(e,t)=>{let i=e.node.getChild("VariableDefinition");return i&&t(i,r),!0}}var Ed=["FunctionDeclaration"],Wd={FunctionDeclaration:Di("function"),ClassDeclaration:Di("class"),ClassExpression:()=>!0,EnumDeclaration:Di("constant"),TypeAliasDeclaration:Di("type"),NamespaceDeclaration:Di("namespace"),VariableDefinition(r,e){r.matchContext(Ed)||e(r,"variable")},TypeDefinition(r,e){e(r,"type")},__proto__:null};function Hh(r,e){let t=Ih.get(e);if(t)return t;let i=[],s=!0;function n(o,l){let a=r.sliceString(o.from,o.to);i.push({label:a,type:l})}return e.cursor(j.IncludeAnonymous).iterate(o=>{if(s)s=!1;else if(o.name){let l=Wd[o.name];if(l&&l(o,n)||Fh.has(o.name))return!1}else if(o.to-o.from>8192){for(let l of Hh(r,o.node))i.push(l);return!1}}),Ih.set(e,i),i}var Nh=/^[\w$\xa1-\uffff][\w$\d\xa1-\uffff]*$/,Kh=["TemplateString","String","RegExp","LineComment","BlockComment","VariableDefinition","TypeDefinition","Label","PropertyDefinition","PropertyName","PrivatePropertyDefinition","PrivatePropertyName","JSXText","JSXAttributeValue","JSXOpenTag","JSXCloseTag","JSXSelfClosingTag",".","?."];function qd(r){let e=oe(r.state).resolveInner(r.pos,-1);if(Kh.indexOf(e.name)>-1)return null;let t=e.name=="VariableName"||e.to-e.from<20&&Nh.test(r.state.sliceDoc(e.from,e.to));if(!t&&!r.explicit)return null;let i=[];for(let s=e;s;s=s.parent)Fh.has(s.name)&&(i=i.concat(Hh(r.state.doc,s)));return{options:i,from:t?e.from:r.pos,validFor:Nh}}var Me=ht.define({name:"javascript",parser:Vh.configure({props:[ii.add({IfStatement:si({except:/^\s*({|else\b)/}),TryStatement:si({except:/^\s*({|catch\b|finally\b)/}),LabeledStatement:Ka,SwitchBody:r=>{let e=r.textAfter,t=/^\s*\}/.test(e),i=/^\s*(case|default)\b/.test(e);return r.baseIndent+(t?0:i?1:2)*r.unit},Block:Ha({closing:"}"}),ArrowFunction:r=>r.baseIndent+r.unit,"TemplateString BlockComment":()=>null,"Statement Property":si({except:/^\s*{/}),JSXElement(r){let e=/^\s*<\//.test(r.textAfter);return r.lineIndent(r.node.from)+(e?0:r.unit)},JSXEscape(r){let e=/\s*\}/.test(r.textAfter);return r.lineIndent(r.node.from)+(e?0:r.unit)},"JSXOpenTag JSXSelfClosingTag"(r){return r.column(r.node.from)+r.unit}}),ri.add({"Block ClassBody SwitchBody EnumBody ObjectExpression ArrayExpression ObjectType":Ds,BlockComment(r){return{from:r.from+2,to:r.to-2}},JSXElement(r){let e=r.firstChild;if(!e||e.name=="JSXSelfClosingTag")return null;let t=r.lastChild;return{from:e.to,to:t.type.isError?r.to:t.from}},"JSXSelfClosingTag JSXOpenTag"(r){var e;let t=(e=r.firstChild)===null||e===void 0?void 0:e.nextSibling,i=r.lastChild;return!t||t.type.isError?null:{from:t.to,to:i.type.isError?r.to:i.from}}})]}),languageData:{closeBrackets:{brackets:["(","[","{","'",'"',"`"]},commentTokens:{line:"//",block:{open:"/*",close:"*/"}},indentOnInput:/^\s*(?:case |default:|\{|\}|<\/)$/,wordChars:"$"}}),Jh={test:r=>/^JSX/.test(r.name),facet:Gn({commentTokens:{block:{open:"{/*",close:"*/}"}}})},$o=Me.configure({dialect:"ts"},"typescript"),ko=Me.configure({dialect:"jsx",props:[qs.add(r=>r.isTop?[Jh]:void 0)]}),vo=Me.configure({dialect:"jsx ts",props:[qs.add(r=>r.isTop?[Jh]:void 0)]},"typescript"),ec=r=>({label:r,type:"keyword"}),tc="break case const continue default delete export extends false finally in instanceof let new return static super switch this throw true typeof var yield".split(" ").map(ec),Dd=tc.concat(["declare","implements","private","protected","public"].map(ec));function Us(r={}){let e=r.jsx?r.typescript?vo:ko:r.typescript?$o:Me,t=r.typescript?Vd.concat(Dd):Uh.concat(tc);return new ct(e,[Me.data.of({autocomplete:Dh(Kh,qh(t))}),Me.data.of({autocomplete:qd}),r.jsx?Id:[]])}function Ld(r){for(;;){if(r.name=="JSXOpenTag"||r.name=="JSXSelfClosingTag"||r.name=="JSXFragmentTag")return r;if(r.name=="JSXEscape"||!r.parent)return null;r=r.parent}}function Gh(r,e,t=r.length){for(let i=e?.firstChild;i;i=i.nextSibling)if(i.name=="JSXIdentifier"||i.name=="JSXBuiltin"||i.name=="JSXNamespacedName"||i.name=="JSXMemberExpression")return r.sliceString(i.from,Math.min(i.to,t));return""}var Bd=typeof navigator=="object"&&/Android\b/.test(navigator.userAgent),Id=T.inputHandler.of((r,e,t,i,s)=>{if((Bd?r.composing:r.compositionStarted)||r.state.readOnly||e!=t||i!=">"&&i!="/"||!Me.isActiveAt(r.state,e,-1))return!1;let n=s(),{state:o}=n,l=o.changeByRange(a=>{var h;let{head:c}=a,f=oe(o).resolveInner(c-1,-1),u;if(f.name=="JSXStartTag"&&(f=f.parent),!(o.doc.sliceString(c-1,c)!=i||f.name=="JSXAttributeValue"&&f.to>c)){if(i==">"&&f.name=="JSXFragmentTag")return{range:a,changes:{from:c,insert:">"}};if(i=="/"&&f.name=="JSXStartCloseTag"){let O=f.parent,p=O.parent;if(p&&O.from==c-2&&((u=Gh(o.doc,p.firstChild,c))||((h=p.firstChild)===null||h===void 0?void 0:h.name)=="JSXFragmentTag")){let g=`${u}>`;return{range:w.cursor(c+g.length,-1),changes:{from:c,insert:g}}}}else if(i==">"){let O=Ld(f);if(O&&O.name=="JSXOpenTag"&&!/^\/?>|^<\//.test(o.doc.sliceString(c,c+2))&&(u=Gh(o.doc,O,c)))return{range:a,changes:{from:c,insert:`${u}>`}}}}return{range:a}});return l.changes.empty?!1:(r.dispatch([n,o.update(l,{userEvent:"input.complete",scrollIntoView:!0})]),!0)});var Li=["_blank","_self","_top","_parent"],Po=["ascii","utf-8","utf-16","latin1","latin1"],To=["get","post","put","delete"],Zo=["application/x-www-form-urlencoded","multipart/form-data","text/plain"],Se=["true","false"],$={},Nd={a:{attrs:{href:null,ping:null,type:null,media:null,target:Li,hreflang:null}},abbr:$,address:$,area:{attrs:{alt:null,coords:null,href:null,target:null,ping:null,media:null,hreflang:null,type:null,shape:["default","rect","circle","poly"]}},article:$,aside:$,audio:{attrs:{src:null,mediagroup:null,crossorigin:["anonymous","use-credentials"],preload:["none","metadata","auto"],autoplay:["autoplay"],loop:["loop"],controls:["controls"]}},b:$,base:{attrs:{href:null,target:Li}},bdi:$,bdo:$,blockquote:{attrs:{cite:null}},body:$,br:$,button:{attrs:{form:null,formaction:null,name:null,value:null,autofocus:["autofocus"],disabled:["autofocus"],formenctype:Zo,formmethod:To,formnovalidate:["novalidate"],formtarget:Li,type:["submit","reset","button"]}},canvas:{attrs:{width:null,height:null}},caption:$,center:$,cite:$,code:$,col:{attrs:{span:null}},colgroup:{attrs:{span:null}},command:{attrs:{type:["command","checkbox","radio"],label:null,icon:null,radiogroup:null,command:null,title:null,disabled:["disabled"],checked:["checked"]}},data:{attrs:{value:null}},datagrid:{attrs:{disabled:["disabled"],multiple:["multiple"]}},datalist:{attrs:{data:null}},dd:$,del:{attrs:{cite:null,datetime:null}},details:{attrs:{open:["open"]}},dfn:$,div:$,dl:$,dt:$,em:$,embed:{attrs:{src:null,type:null,width:null,height:null}},eventsource:{attrs:{src:null}},fieldset:{attrs:{disabled:["disabled"],form:null,name:null}},figcaption:$,figure:$,footer:$,form:{attrs:{action:null,name:null,"accept-charset":Po,autocomplete:["on","off"],enctype:Zo,method:To,novalidate:["novalidate"],target:Li}},h1:$,h2:$,h3:$,h4:$,h5:$,h6:$,head:{children:["title","base","link","style","meta","script","noscript","command"]},header:$,hgroup:$,hr:$,html:{attrs:{manifest:null}},i:$,iframe:{attrs:{src:null,srcdoc:null,name:null,width:null,height:null,sandbox:["allow-top-navigation","allow-same-origin","allow-forms","allow-scripts"],seamless:["seamless"]}},img:{attrs:{alt:null,src:null,ismap:null,usemap:null,width:null,height:null,crossorigin:["anonymous","use-credentials"]}},input:{attrs:{alt:null,dirname:null,form:null,formaction:null,height:null,list:null,max:null,maxlength:null,min:null,name:null,pattern:null,placeholder:null,size:null,src:null,step:null,value:null,width:null,accept:["audio/*","video/*","image/*"],autocomplete:["on","off"],autofocus:["autofocus"],checked:["checked"],disabled:["disabled"],formenctype:Zo,formmethod:To,formnovalidate:["novalidate"],formtarget:Li,multiple:["multiple"],readonly:["readonly"],required:["required"],type:["hidden","text","search","tel","url","email","password","datetime","date","month","week","time","datetime-local","number","range","color","checkbox","radio","file","submit","image","reset","button"]}},ins:{attrs:{cite:null,datetime:null}},kbd:$,keygen:{attrs:{challenge:null,form:null,name:null,autofocus:["autofocus"],disabled:["disabled"],keytype:["RSA"]}},label:{attrs:{for:null,form:null}},legend:$,li:{attrs:{value:null}},link:{attrs:{href:null,type:null,hreflang:null,media:null,sizes:["all","16x16","16x16 32x32","16x16 32x32 64x64"]}},map:{attrs:{name:null}},mark:$,menu:{attrs:{label:null,type:["list","context","toolbar"]}},meta:{attrs:{content:null,charset:Po,name:["viewport","application-name","author","description","generator","keywords"],"http-equiv":["content-language","content-type","default-style","refresh"]}},meter:{attrs:{value:null,min:null,low:null,high:null,max:null,optimum:null}},nav:$,noscript:$,object:{attrs:{data:null,type:null,name:null,usemap:null,form:null,width:null,height:null,typemustmatch:["typemustmatch"]}},ol:{attrs:{reversed:["reversed"],start:null,type:["1","a","A","i","I"]},children:["li","script","template","ul","ol"]},optgroup:{attrs:{disabled:["disabled"],label:null}},option:{attrs:{disabled:["disabled"],label:null,selected:["selected"],value:null}},output:{attrs:{for:null,form:null,name:null}},p:$,param:{attrs:{name:null,value:null}},pre:$,progress:{attrs:{value:null,max:null}},q:{attrs:{cite:null}},rp:$,rt:$,ruby:$,samp:$,script:{attrs:{type:["text/javascript"],src:null,async:["async"],defer:["defer"],charset:Po}},section:$,select:{attrs:{form:null,name:null,size:null,autofocus:["autofocus"],disabled:["disabled"],multiple:["multiple"]}},slot:{attrs:{name:null}},small:$,source:{attrs:{src:null,type:null,media:null}},span:$,strong:$,style:{attrs:{type:["text/css"],media:null,scoped:null}},sub:$,summary:$,sup:$,table:$,tbody:$,td:{attrs:{colspan:null,rowspan:null,headers:null}},template:$,textarea:{attrs:{dirname:null,form:null,maxlength:null,name:null,placeholder:null,rows:null,cols:null,autofocus:["autofocus"],disabled:["disabled"],readonly:["readonly"],required:["required"],wrap:["soft","hard"]}},tfoot:$,th:{attrs:{colspan:null,rowspan:null,headers:null,scope:["row","col","rowgroup","colgroup"]}},thead:$,time:{attrs:{datetime:null}},title:$,tr:$,track:{attrs:{src:null,label:null,default:null,kind:["subtitles","captions","descriptions","chapters","metadata"],srclang:null}},ul:{children:["li","script","template","ul","ol"]},var:$,video:{attrs:{src:null,poster:null,width:null,height:null,crossorigin:["anonymous","use-credentials"],preload:["auto","metadata","none"],autoplay:["autoplay"],mediagroup:["movie"],muted:["muted"],controls:["controls"]}},wbr:$},nc={accesskey:null,class:null,contenteditable:Se,contextmenu:null,dir:["ltr","rtl","auto"],draggable:["true","false","auto"],dropzone:["copy","move","link","string:","file:"],hidden:["hidden"],id:null,inert:["inert"],itemid:null,itemprop:null,itemref:null,itemscope:["itemscope"],itemtype:null,lang:["ar","bn","de","en-GB","en-US","es","fr","hi","id","ja","pa","pt","ru","tr","zh"],spellcheck:Se,autocorrect:Se,autocapitalize:Se,style:null,tabindex:null,title:null,translate:["yes","no"],rel:["stylesheet","alternate","author","bookmark","help","license","next","nofollow","noreferrer","prefetch","prev","search","tag"],role:"alert application article banner button cell checkbox complementary contentinfo dialog document feed figure form grid gridcell heading img list listbox listitem main navigation region row rowgroup search switch tab table tabpanel textbox timer".split(" "),"aria-activedescendant":null,"aria-atomic":Se,"aria-autocomplete":["inline","list","both","none"],"aria-busy":Se,"aria-checked":["true","false","mixed","undefined"],"aria-controls":null,"aria-describedby":null,"aria-disabled":Se,"aria-dropeffect":null,"aria-expanded":["true","false","undefined"],"aria-flowto":null,"aria-grabbed":["true","false","undefined"],"aria-haspopup":Se,"aria-hidden":Se,"aria-invalid":["true","false","grammar","spelling"],"aria-label":null,"aria-labelledby":null,"aria-level":null,"aria-live":["off","polite","assertive"],"aria-multiline":Se,"aria-multiselectable":Se,"aria-owns":null,"aria-posinset":null,"aria-pressed":["true","false","mixed","undefined"],"aria-readonly":Se,"aria-relevant":null,"aria-required":Se,"aria-selected":["true","false","undefined"],"aria-setsize":null,"aria-sort":["ascending","descending","none","other"],"aria-valuemax":null,"aria-valuemin":null,"aria-valuenow":null,"aria-valuetext":null},oc="beforeunload copy cut dragstart dragover dragleave dragenter dragend drag paste focus blur change click load mousedown mouseenter mouseleave mouseup keydown keyup resize scroll unload".split(" ").map(r=>"on"+r);for(let r of oc)nc[r]=null;var ai=class{constructor(e,t){this.tags={...Nd,...e},this.globalAttrs={...nc,...t},this.allTags=Object.keys(this.tags),this.globalAttrNames=Object.keys(this.globalAttrs)}};ai.default=new ai;function hi(r,e,t=r.length){if(!e)return"";let i=e.firstChild,s=i&&i.getChild("TagName");return s?r.sliceString(s.from,Math.min(s.to,t)):""}function ci(r,e=!1){for(;r;r=r.parent)if(r.name=="Element")if(e)e=!1;else return r;return null}function lc(r,e,t){let i=t.tags[hi(r,ci(e))];return i?.children||t.allTags}function Co(r,e){let t=[];for(let i=ci(e);i&&!i.type.isTop;i=ci(i.parent)){let s=hi(r,i);if(s&&i.lastChild.name=="CloseTag")break;s&&t.indexOf(s)<0&&(e.name=="EndTag"||e.from>=i.firstChild.to)&&t.push(s)}return t}var ac=/^[:\-\.\w\u00b7-\uffff]*$/;function ic(r,e,t,i,s){let n=/\s*>/.test(r.sliceDoc(s,s+5))?"":">",o=ci(t,t.name=="StartTag"||t.name=="TagName");return{from:i,to:s,options:lc(r.doc,o,e).map(l=>({label:l,type:"type"})).concat(Co(r.doc,t).map((l,a)=>({label:"/"+l,apply:"/"+l+n,type:"type",boost:99-a}))),validFor:/^\/?[:\-\.\w\u00b7-\uffff]*$/}}function sc(r,e,t,i){let s=/\s*>/.test(r.sliceDoc(i,i+5))?"":">";return{from:t,to:i,options:Co(r.doc,e).map((n,o)=>({label:n,apply:n+s,type:"type",boost:99-o})),validFor:ac}}function Gd(r,e,t,i){let s=[],n=0;for(let o of lc(r.doc,t,e))s.push({label:"<"+o,type:"type"});for(let o of Co(r.doc,t))s.push({label:""+o+">",type:"type",boost:99-n++});return{from:i,to:i,options:s,validFor:/^<\/?[:\-\.\w\u00b7-\uffff]*$/}}function Ud(r,e,t,i,s){let n=ci(t),o=n?e.tags[hi(r.doc,n)]:null,l=o&&o.attrs?Object.keys(o.attrs):[],a=o&&o.globalAttrs===!1?l:l.length?l.concat(e.globalAttrNames):e.globalAttrNames;return{from:i,to:s,options:a.map(h=>({label:h,type:"property"})),validFor:ac}}function Fd(r,e,t,i,s){var n;let o=(n=t.parent)===null||n===void 0?void 0:n.getChild("AttributeName"),l=[],a;if(o){let h=r.sliceDoc(o.from,o.to),c=e.globalAttrs[h];if(!c){let f=ci(t),u=f?e.tags[hi(r.doc,f)]:null;c=u?.attrs&&u.attrs[h]}if(c){let f=r.sliceDoc(i,s).toLowerCase(),u='"',O='"';/^['"]/.test(f)?(a=f[0]=='"'?/^[^"]*$/:/^[^']*$/,u="",O=r.sliceDoc(s,s+1)==f[0]?"":f[0],f=f.slice(1),i++):a=/^[^\s<>='"]*$/;for(let p of c)l.push({label:p,apply:u+p+O,type:"constant"})}}return{from:i,to:s,options:l,validFor:a}}function Hd(r,e){let{state:t,pos:i}=e,s=oe(t).resolveInner(i,-1),n=s.resolve(i);for(let o=i,l;n==s&&(l=s.childBefore(o));){let a=l.lastChild;if(!a||!a.type.isError||a.fromHd(i,s)}var Jd=Me.parser.configure({top:"SingleExpression"}),hc=[{tag:"script",attrs:r=>r.type=="text/typescript"||r.lang=="ts",parser:$o.parser},{tag:"script",attrs:r=>r.type=="text/babel"||r.type=="text/jsx",parser:ko.parser},{tag:"script",attrs:r=>r.type=="text/typescript-jsx",parser:vo.parser},{tag:"script",attrs(r){return/^(importmap|speculationrules|application\/(.+\+)?json)$/i.test(r.type)},parser:Jd},{tag:"script",attrs(r){return!r.type||/^(?:text|application)\/(?:x-)?(?:java|ecma)script$|^module$|^$/i.test(r.type)},parser:Me.parser},{tag:"style",attrs(r){return(!r.lang||r.lang=="css")&&(!r.type||/^(text\/)?(x-)?(stylesheet|css)$/i.test(r.type))},parser:Ei.parser}],cc=[{name:"style",parser:Ei.parser.configure({top:"Styles"})}].concat(oc.map(r=>({name:r,parser:Me.parser}))),fc=ht.define({name:"html",parser:$h.configure({props:[ii.add({Element(r){let e=/^(\s*)(<\/)?/.exec(r.textAfter);return r.node.to<=r.pos+e[0].length?r.continue():r.lineIndent(r.node.from)+(e[2]?0:r.unit)},"OpenTag CloseTag SelfClosingTag"(r){return r.column(r.node.from)+r.unit},Document(r){if(r.pos+/\s*/.exec(r.textAfter)[0].lengthr.getChild("TagName")})]}),languageData:{commentTokens:{block:{open:""}},indentOnInput:/^\s*<\/\w+\W$/,wordChars:"-_"}}),Fs=fc.configure({wrap:uo(hc,cc)});function uc(r={}){let e="",t;r.matchClosingTags===!1&&(e="noMatch"),r.selfClosingTags===!0&&(e=(e?e+" ":"")+"selfClosing"),(r.nestedLanguages&&r.nestedLanguages.length||r.nestedAttributes&&r.nestedAttributes.length)&&(t=uo((r.nestedLanguages||[]).concat(hc),(r.nestedAttributes||[]).concat(cc)));let i=t?fc.configure({wrap:t,dialect:e}):e?Fs.configure({dialect:e}):Fs;return new ct(i,[Fs.data.of({autocomplete:Kd(r)}),r.autoCloseTags!==!1?ep:[],Us().support,Gs().support])}var rc=new Set("area base br col command embed frame hr img input keygen link meta param source track wbr menuitem".split(" ")),ep=T.inputHandler.of((r,e,t,i,s)=>{if(r.composing||r.state.readOnly||e!=t||i!=">"&&i!="/"||!Fs.isActiveAt(r.state,e,-1))return!1;let n=s(),{state:o}=n,l=o.changeByRange(a=>{var h,c,f;let u=o.doc.sliceString(a.from-1,a.to)==i,{head:O}=a,p=oe(o).resolveInner(O,-1),g;if(u&&i==">"&&p.name=="EndTag"){let m=p.parent;if(((c=(h=m.parent)===null||h===void 0?void 0:h.lastChild)===null||c===void 0?void 0:c.name)!="CloseTag"&&(g=hi(o.doc,m.parent,O))&&!rc.has(g)){let S=O+(o.doc.sliceString(O,O+1)===">"?1:0),b=`${g}>`;return{range:a,changes:{from:O,to:S,insert:b}}}}else if(u&&i=="/"&&p.name=="IncompleteCloseTag"){let m=p.parent;if(p.from==O-2&&((f=m.lastChild)===null||f===void 0?void 0:f.name)!="CloseTag"&&(g=hi(o.doc,m,O))&&!rc.has(g)){let S=O+(o.doc.sliceString(O,O+1)===">"?1:0),b=`${g}>`;return{range:w.cursor(O+b.length,-1),changes:{from:O,to:S,insert:b}}}}return{range:a}});return l.changes.empty?!1:(r.dispatch([n,o.update(l,{userEvent:"input.complete",scrollIntoView:!0})]),!0)});function fi(){return fi=Object.assign?Object.assign.bind():function(r){for(var e=1;e{var e=r.theme,t=r.settings,i=t===void 0?{}:t,s=r.styles,n=s===void 0?[]:s,o={".cm-gutters":{}},l={};i.background&&(l.backgroundColor=i.background),i.backgroundImage&&(l.backgroundImage=i.backgroundImage),i.foreground&&(l.color=i.foreground),i.fontSize&&(l.fontSize=i.fontSize),(i.background||i.foreground)&&(o["&"]=l),i.fontFamily&&(o["&.cm-editor .cm-scroller"]={fontFamily:i.fontFamily}),i.gutterBackground&&(o[".cm-gutters"].backgroundColor=i.gutterBackground),i.gutterForeground&&(o[".cm-gutters"].color=i.gutterForeground),i.gutterBorder&&(o[".cm-gutters"].borderRightColor=i.gutterBorder),i.caret&&(o[".cm-content"]={caretColor:i.caret},o[".cm-cursor, .cm-dropCursor"]={borderLeftColor:i.caret});var a={};i.gutterActiveForeground&&(a.color=i.gutterActiveForeground),i.lineHighlight&&(o[".cm-activeLine"]={backgroundColor:i.lineHighlight},a.backgroundColor=i.lineHighlight),o[".cm-activeLineGutter"]=a,i.selection&&(o["&.cm-focused .cm-selectionBackground, & .cm-line::selection, & .cm-selectionLayer .cm-selectionBackground, .cm-content ::selection"]={background:i.selection+" !important"}),i.selectionMatch&&(o["& .cm-selectionMatch"]={backgroundColor:i.selectionMatch});var h=T.theme(o,{dark:e==="dark"}),c=ti.define(n),f=[h,Ls(c)];return f};var V={background:"#002B36",foreground:"#839496",selection:"#004454AA",selectionMatch:"#005A6FAA",cursor:"#D30102",dropdownBackground:"#00212B",dropdownBorder:"#2AA19899",activeLine:"#00cafe11",matchingBracket:"#073642",keyword:"#859900",storage:"#93A1A1",variable:"#268BD2",parameter:"#268BD2",function:"#268BD2",string:"#2AA198",constant:"#CB4B16",type:"#859900",class:"#268BD2",number:"#D33682",comment:"#586E75",heading:"#268BD2",invalid:"#DC322F",regexp:"#DC322F",tag:"#268BD2"};var tp={background:V.background,foreground:V.foreground,caret:V.cursor,selection:V.selection,selectionMatch:V.selection,gutterBackground:V.background,gutterForeground:V.foreground,gutterBorder:"transparent",lineHighlight:V.activeLine},ip=[{tag:d.keyword,color:V.keyword},{tag:[d.name,d.deleted,d.character,d.macroName],color:V.variable},{tag:[d.propertyName],color:V.function},{tag:[d.processingInstruction,d.string,d.inserted,d.special(d.string)],color:V.string},{tag:[d.function(d.variableName),d.labelName],color:V.function},{tag:[d.color,d.constant(d.name),d.standard(d.name)],color:V.constant},{tag:[d.definition(d.name),d.separator],color:V.variable},{tag:[d.className],color:V.class},{tag:[d.number,d.changed,d.annotation,d.modifier,d.self,d.namespace],color:V.number},{tag:[d.typeName],color:V.type,fontStyle:V.type},{tag:[d.operator,d.operatorKeyword],color:V.keyword},{tag:[d.url,d.escape,d.regexp,d.link],color:V.regexp},{tag:[d.meta,d.comment],color:V.comment},{tag:d.tagName,color:V.tag},{tag:d.strong,fontWeight:"bold"},{tag:d.emphasis,fontStyle:"italic"},{tag:d.link,textDecoration:"underline"},{tag:d.heading,fontWeight:"bold",color:V.heading},{tag:[d.atom,d.bool,d.special(d.variableName)],color:V.variable},{tag:d.invalid,color:V.invalid},{tag:d.strikethrough,textDecoration:"line-through"}],sp=r=>{var e=r||{},t=e.theme,i=t===void 0?"dark":t,s=e.settings,n=s===void 0?{}:s,o=e.styles,l=o===void 0?[]:o;return Hs({theme:i,settings:fi({},tp,n),styles:[...ip,...l]})},Xo=sp();var E={background:"#FDF6E3",foreground:"#657B83",selection:"#EEE8D5",selectionMatch:"#EEE8D5",cursor:"#657B83",dropdownBackground:"#EEE8D5",dropdownBorder:"#D3AF86",activeLine:"#3d392d11",matchingBracket:"#EEE8D5",keyword:"#859900",storage:"#586E75",variable:"#268BD2",parameter:"#268BD2",function:"#268BD2",string:"#2AA198",constant:"#CB4B16",type:"#859900",class:"#268BD2",number:"#D33682",comment:"#93A1A1",heading:"#268BD2",invalid:"#DC322F",regexp:"#DC322F",tag:"#268BD2"};var rp={background:E.background,foreground:E.foreground,caret:E.cursor,selection:E.selection,selectionMatch:E.selectionMatch,gutterBackground:E.background,gutterForeground:E.foreground,gutterBorder:"transparent",lineHighlight:E.activeLine},np=[{tag:d.keyword,color:E.keyword},{tag:[d.name,d.deleted,d.character,d.macroName],color:E.variable},{tag:[d.propertyName],color:E.function},{tag:[d.processingInstruction,d.string,d.inserted,d.special(d.string)],color:E.string},{tag:[d.function(d.variableName),d.labelName],color:E.function},{tag:[d.color,d.constant(d.name),d.standard(d.name)],color:E.constant},{tag:[d.definition(d.name),d.separator],color:E.variable},{tag:[d.className],color:E.class},{tag:[d.number,d.changed,d.annotation,d.modifier,d.self,d.namespace],color:E.number},{tag:[d.typeName],color:E.type,fontStyle:E.type},{tag:[d.operator,d.operatorKeyword],color:E.keyword},{tag:[d.url,d.escape,d.regexp,d.link],color:E.regexp},{tag:[d.meta,d.comment],color:E.comment},{tag:d.tagName,color:E.tag},{tag:d.strong,fontWeight:"bold"},{tag:d.emphasis,fontStyle:"italic"},{tag:d.link,textDecoration:"underline"},{tag:d.heading,fontWeight:"bold",color:E.heading},{tag:[d.atom,d.bool,d.special(d.variableName)],color:E.variable},{tag:d.invalid,color:E.invalid},{tag:d.strikethrough,textDecoration:"line-through"}],op=r=>{var e=r||{},t=e.theme,i=t===void 0?"light":t,s=e.settings,n=s===void 0?{}:s,o=e.styles,l=o===void 0?[]:o;return Hs({theme:i,settings:fi({},rp,n),styles:[...np,...l]})},Ro=op();var dc=new _t;function pc(){let r=document.documentElement.dataset.theme;return r==="dark"?!0:r==="light"?!1:window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches}function Ao(r){r.dispatch({effects:dc.reconfigure(pc()?Xo:Ro)})}function Oc(){document.querySelectorAll("textarea[data-codemirror-editor]").forEach(r=>{let e=r.dataset.language||"html",t=r.value??"",i=document.createElement("div");i.className="cm6-editor-wrapper",r.insertAdjacentElement("beforebegin",i),r.hidden=!0;let s=T.updateListener.of(c=>{c.docChanged&&(r.value=c.state.doc.toString())}),n=[Za(),T.lineWrapping,Ls(eh),s,dc.of(pc()?Xo:Ro)];e==="javascript"?n.unshift(Us()):e==="css"?n.unshift(Gs()):n.unshift(uc());let o=U.create({doc:t,extensions:n}),l=new T({state:o,parent:i});Ao(l),new MutationObserver(()=>Ao(l)).observe(document.documentElement,{attributes:!0,attributeFilter:["data-theme","class"]}),window.matchMedia("(prefers-color-scheme: dark)").addEventListener("change",()=>Ao(l)),r.value=l.state.doc.toString()})}document.readyState==="loading"?document.addEventListener("DOMContentLoaded",Oc,{once:!0}):Oc();})();